import { j as h } from "./jsx-runtime-tc70JA_2.js";
import { useMemo as A, useCallback as R, useState as D, useEffect as N, useRef as L, useSyncExternalStore as oe, memo as _e } from "react";
import { TimeSpan as U, id as Be, TimeStamp as O, primitive as He, array as F, unique as Me } from "@synnaxlabs/x";
import { C as w } from "./css-D90kZTM8.js";
import { D as Ge } from "./Dialog-Bj7FiHJD.js";
import { u as ie } from "./Animated-CO--9HPM.js";
import { B as Ke } from "./Copy-COWBkO_v.js";
import { c as Z, I as Oe, z as We, S as Ze, L as Xe, E as Ye, q as G } from "./Text-2MISZsc5.js";
import { d as Je, u as ae, F as Qe, a as et, I as tt } from "./Items-DQba1BFQ.js";
import { d as T, T as C, b as rt, f as st, c as nt } from "./Editable-C17ILP50.js";
import { C as K, e as ot } from "./types-CGRCBVD4.js";
import { c as it, C as at } from "./Provider-jFWpR0CX.js";
import { a as X, E as lt } from "./Box-Bi280MYh.js";
import { j as ct, k as ut, A as dt, l as ft } from "./provider-Bt-E2O6g.js";
import "react-dom";
import { u as mt, b as se } from "./hooks-QNj6PdUo.js";
const [ht, pt] = Z({
  defaultValue: [],
  displayName: "Status.Context"
}), [gt, le] = Z({
  defaultValue: () => {
  },
  displayName: "Status.AdderContext"
}), $t = 0.9, rr = ({ children: e, maxHistory: n = 500 }) => {
  const [{ path: r }, { statuses: s }, u] = it({
    type: dt.TYPE,
    schema: ut,
    initialState: { statuses: [] }
  });
  if (s.length > n) {
    const l = Math.floor(n * $t);
    u((a) => ({ ...a, statuses: s.slice(0, l) }));
  }
  const c = R(
    (l) => {
      const a = { time: O.now(), key: Be.create(), ...l };
      u((m) => ({
        ...m,
        statuses: [a, ...m.statuses.filter((p) => p.key != a.key)]
      }));
    },
    [u]
  );
  return /* @__PURE__ */ h.jsx(ht, { value: s, children: /* @__PURE__ */ h.jsx(gt, { value: c, children: /* @__PURE__ */ h.jsx(at, { path: r, children: e }) }) });
}, sr = () => {
  const e = le();
  return A(() => ct(e), [e]);
}, nr = () => {
  const e = le();
  return A(() => ft(e), [e]);
}, xt = U.seconds(7), vt = U.seconds(1), or = ({
  expiration: e = xt,
  poll: n = vt
} = {}) => {
  const r = pt(), [s, u] = D(/* @__PURE__ */ new Set()), [c, l] = D(() => O.now());
  N(() => {
    const $ = setInterval(() => l(O.now()), n.milliseconds);
    return () => clearInterval($);
  }, [n.milliseconds]);
  const a = A(() => {
    const $ = c.sub(e), v = r.filter(
      ({ key: d, time: o }) => o.afterEq($) && !s.has(d)
    ).reduce((d, o) => {
      const t = `${o.variant}:${o.message}`;
      if (!d.has(t))
        return d.set(t, { ...o, count: 1 }), d;
      const i = d.get(t);
      return d.set(t, {
        ...i,
        count: i.count + 1,
        time: o.time.after(i.time) ? o.time : i.time
      }), d;
    }, /* @__PURE__ */ new Map());
    return Array.from(v.values());
  }, [r, e, s, c]), m = T(r), p = R(($) => {
    u((g) => {
      const v = /* @__PURE__ */ new Set(), d = m.current.find(({ key: o }) => o === $);
      return g.has($) || v.add($), d != null && m.current.filter(
        ({ message: t, variant: i }) => t === d.message && i === d.variant
      ).forEach((t) => v.add(t.key)), v.size == 0 ? g : /* @__PURE__ */ new Set([...v, ...g]);
    });
  }, []);
  return { statuses: a, silence: p };
}, ir = Oe(Ze, { topRight: We }), W = ({
  level: e = "p",
  variant: n,
  description: r,
  hideIcon: s = !1,
  status: u,
  className: c,
  children: l,
  message: a,
  color: m,
  ...p
}) => {
  let $;
  if (u != null) {
    const { key: o, ...t } = u;
    return /* @__PURE__ */ h.jsx(W, { ...p, ...t });
  }
  s || ($ = n === "loading" ? /* @__PURE__ */ h.jsx(Xe, {}) : /* @__PURE__ */ h.jsx(Ye, {}));
  const g = He.isNonZero(r);
  l ??= a;
  const v = /* @__PURE__ */ h.jsxs(
    C,
    {
      className: w(c, !g && w.BE("status", "text")),
      level: e,
      status: n,
      ...r == null ? p : {},
      children: [
        $,
        l
      ]
    }
  );
  if (!g) return v;
  const d = /* @__PURE__ */ h.jsx(C, { level: "small", color: 8, children: r });
  return /* @__PURE__ */ h.jsxs(X, { y: !0, align: "start", gap: "small", center: !0, ...p, children: [
    v,
    d
  ] });
}, bt = ({
  size: e = "medium",
  ref: n,
  value: r,
  onChange: s,
  className: u,
  onFocus: c,
  onKeyDown: l,
  selectOnFocus: a = !1,
  centerPlaceholder: m = !1,
  placeholder: p,
  variant: $ = "outlined",
  level: g,
  onBlur: v,
  disabled: d,
  resetOnBlurIfEmpty: o = !1,
  status: t,
  weight: i,
  style: f,
  contrast: x,
  color: b,
  sharp: S,
  onlyChangeOnBlur: y = !1,
  endContent: k,
  full: I,
  children: z,
  grow: P,
  shrink: j,
  borderColor: _,
  borderWidth: ge,
  bordered: $e,
  rounded: xe,
  tabIndex: B,
  trigger: ve,
  triggerIndicator: be,
  textColor: ye,
  textVariant: Re,
  preventClick: Se,
  onClickDelay: Ee,
  startContent: J,
  tooltip: we,
  tooltipDelay: je,
  tooltipLocation: Ie,
  hideTooltip: Te,
  ghost: Ae,
  area: Pe,
  propagateClick: Le,
  ...Ce
}) => {
  const Q = L(r), [q, H] = D(null), ee = L(null), M = L(!1), ke = (E) => {
    M.current = !1, o && E.target.value === "" ? s?.(Q.current) : y && q != null && s?.(q), H(null), v?.(E);
  }, ze = (E) => {
    d || (y ? H(E.target.value) : s?.(E.target.value));
  }, Ne = (E) => {
    y && H(r), c?.(E), Q.current = E.target.value;
  }, qe = () => {
    !a || M.current || (M.current = !0, ee.current?.select());
  }, Ve = (E) => {
    y && E.key === "Enter" ? E.currentTarget.blur() : E.key === "Escape" && (E.currentTarget.blur(), E.stopPropagation()), l?.(E);
  }, De = rt(n, ee), Fe = (r == null || r.length === 0) && q == null && p != null && typeof p != "string";
  B ??= $ === "preview" ? -1 : void 0;
  const te = {
    style: f,
    full: I,
    grow: P,
    shrink: j
  }, Ue = z != null ? {} : te, re = /* @__PURE__ */ h.jsxs(
    Ke,
    {
      el: "div",
      x: !0,
      empty: !0,
      align: "center",
      className: w(
        w.B("input"),
        w.disabled(d),
        t != null && w.M(t),
        u
      ),
      size: e,
      level: g,
      color: b,
      contrast: x,
      sharp: S,
      status: t,
      bordered: $e,
      borderColor: _,
      borderWidth: ge,
      pack: !0,
      variant: $,
      rounded: xe,
      tabIndex: B,
      trigger: ve,
      triggerIndicator: be,
      textColor: ye,
      textVariant: Re,
      preventClick: Se,
      onClickDelay: Ee,
      tooltip: we,
      tooltipDelay: je,
      tooltipLocation: Ie,
      hideTooltip: Te,
      ghost: Ae,
      propagateClick: Le,
      ...Ue,
      children: [
        Fe && /* @__PURE__ */ h.jsx(
          C,
          {
            className: w(
              w.visible(!1),
              w.BE("input", "placeholder"),
              m && w.M("centered")
            ),
            level: g ?? K[e],
            children: p
          }
        ),
        J != null && /* @__PURE__ */ h.jsx(
          C,
          {
            className: w.BE("input", "start-content"),
            level: g ?? K[e],
            children: J
          }
        ),
        /* @__PURE__ */ h.jsx(
          lt,
          {
            el: Pe ? "textarea" : "input",
            ref: De,
            value: q ?? r,
            role: "textbox",
            onChange: ze,
            autoCapitalize: "off",
            autoComplete: "off",
            autoCorrect: "off",
            onFocus: Ne,
            onKeyDown: Ve,
            tabIndex: B,
            onMouseUp: qe,
            onBlur: ke,
            disabled: d,
            placeholder: typeof p == "string" ? p : void 0,
            style: { fontWeight: i },
            ...Ce
          }
        ),
        k != null && /* @__PURE__ */ h.jsx(
          C,
          {
            className: w.BE("input", "end-content"),
            level: g ?? K[e],
            children: k
          }
        )
      ]
    }
  );
  return z == null ? re : /* @__PURE__ */ h.jsxs(X, { x: !0, pack: !0, className: w.BE("input", "container"), ...te, children: [
    re,
    z
  ] });
}, ce = ["ArrowUp"], ue = ["ArrowDown"], de = ["Enter"], yt = [ce, ue, de], Rt = U.milliseconds(200).milliseconds, St = U.milliseconds(100).milliseconds, fe = ({
  data: e,
  initialHover: n = -1,
  onSelect: r
}) => {
  const s = T(e), [u, c, l] = st(n), { visible: a } = ie(), m = T(a), { scrollToIndex: p } = Je(), $ = R(
    (d) => {
      const o = l.current, t = ot(d, o);
      c(t), p(t, o > t ? "bottom" : "top");
    },
    [p]
  );
  N(() => {
    l.current >= e.length && $(0);
  }, [e.length]);
  const g = L(null), v = R(
    ({ triggers: d, stage: o }) => {
      if (!m.current || (g.current != null && (clearInterval(g.current), g.current = null), o !== "start")) return;
      const t = s.current;
      if (G(d, [de])) {
        if (l.current === -1) return;
        r?.(t[l.current]);
        return;
      }
      const i = () => {
        const f = s.current;
        G(d, [ce], { loose: !0 }) ? $((x) => x <= 0 ? f.length - 1 : x - 1) : G(d, [ue], { loose: !0 }) && $((x) => x >= f.length - 1 ? 0 : x + 1);
      };
      i(), g.current = setTimeout(() => {
        g.current = setInterval(i, St);
      }, Rt);
    },
    [r]
  );
  return mt({
    triggers: yt,
    callback: v,
    loose: !0
  }), { hover: e[u] };
}, Et = ({
  allowNone: e = !1,
  onChange: n,
  value: r,
  closeDialogOnSelect: s = !1,
  initialHover: u,
  autoSelectOnNone: c = !1
}) => {
  const l = T(r), { data: a } = ae(), { close: m } = ie(), p = T(a);
  N(() => {
    const o = r != null && a.includes(r);
    c && a.length > 0 && !o && n(a[0], { clicked: a[0], clickedIndex: 0 });
  }, [c, n, r, a.length, a]);
  const $ = R(
    (o) => {
      if (l.current === o) {
        e && n(null, { clicked: null, clickedIndex: null }), s && m();
        return;
      }
      const t = p.current.findIndex((i) => i === o);
      n(o, { clicked: o, clickedIndex: t }), s && m();
    },
    [p, n, m]
  ), g = R(() => {
    e && n(null, { clicked: null, clickedIndex: null });
  }, [n, e]), v = R(
    (o) => n(o[0], { clicked: null, clickedIndex: null }),
    [n]
  ), d = fe({ data: a, onSelect: $, initialHover: u });
  return { onSelect: $, setSelected: v, clear: g, ...d };
}, wt = ({
  value: e = [],
  replaceOnSingle: n = !1,
  onChange: r,
  initialHover: s,
  allowNone: u = !0,
  closeDialogOnSelect: c = !1,
  autoSelectOnNone: l = !1
}) => {
  const { data: a } = ae(), m = L(null), p = se({ triggers: [["Shift"]], loose: !0 }), $ = se({ triggers: [["Control"]], loose: !0 }), g = T(e), v = T(a);
  N(() => {
    const f = a.some((x) => e.includes(x));
    l && a.length > 0 && !f && r([a[0]], { clicked: a[0], clickedIndex: 0 });
  }, [l, r, e, a.length, a]);
  const d = R(
    (f) => {
      const x = m.current, b = v.current;
      let S = [];
      const y = F.toArray(g.current).filter((I) => I != null);
      if ($.current.held && n)
        y.includes(f) ? S = y.filter((I) => I !== f) : S = [...y, f];
      else if (p.current.held && x !== null) {
        const [I, z] = [
          b.findIndex((j) => j === f),
          b.findIndex((j) => j === x)
        ].sort((j, _) => j - _), P = b.slice(I, z + 1).map((j) => j);
        P.slice(1, P.length - 1).every((j) => y.includes(j)) && y.includes(f) ? S = y.filter((j) => !P.includes(j)) : S = [...y, ...P], m.current = null;
      } else
        m.current = f, n ? S = y.includes(f) && y.length === 1 ? [] : [f] : y.includes(f) ? S = y.filter((I) => I !== f) : S = [...y, f];
      const k = Me.unique(S);
      if (k.length === 0) {
        if (!u) return;
        m.current = null;
      }
      r(k, {
        clicked: f,
        clickedIndex: b.findIndex((I) => I === f)
      }), c && close();
    },
    [g, v, r]
  ), o = R(
    () => r([], { clicked: null, clickedIndex: 0 }),
    [r]
  ), t = R(
    (f) => r(f, { clicked: null, clickedIndex: 0 }),
    [r]
  ), i = fe({ data: a, onSelect: d, initialHover: s });
  return { onSelect: d, setSelected: t, clear: o, ...i };
}, jt = () => {
  const e = nt(() => /* @__PURE__ */ new Map()), n = R((s) => {
    e.current.forEach((u, c) => {
      (u == null || s.includes(u)) && c();
    });
  }, []), r = R((s, u) => {
    if (e.current.has(s)) {
      const c = e.current.get(s);
      console.warn(
        `[store] attempted to subscribe listener with key ${c} to key ${u} without being unsubscribed first`
      );
    }
    return e.current.set(s, u), () => e.current.delete(s);
  }, []);
  return { notifyListeners: n, subscribe: r };
}, [It, Tt] = Z({
  defaultValue: {
    clear: () => {
    },
    getState: () => ({ value: void 0, hover: void 0 }),
    onSelect: () => {
    },
    setSelected: () => {
    },
    subscribe: () => () => {
    }
  },
  displayName: "Select.Context"
}), At = (e, n) => e == null ? !1 : Array.isArray(e) ? e.includes(n) : e === n, Pt = ({
  children: e,
  ...n
}) => {
  const { value: r } = n, s = wt(n);
  return /* @__PURE__ */ h.jsx(me, { value: r, ...s, children: e });
}, Lt = ({
  children: e,
  ...n
}) => {
  const { value: r } = n, s = Et(n);
  return /* @__PURE__ */ h.jsx(me, { value: r, ...s, children: e });
}, me = ({
  value: e,
  onSelect: n,
  clear: r,
  setSelected: s,
  children: u,
  hover: c
}) => {
  const l = L(F.toArray(e)), a = T(c), { notifyListeners: m, subscribe: p } = jt(), $ = R(
    () => ({ value: l.current, hover: a.current }),
    []
  ), g = A(
    () => ({
      onSelect: n,
      setSelected: s,
      clear: r,
      hover: c,
      subscribe: p,
      getState: $
    }),
    [$, n, s, r, c, p]
  );
  return N(() => {
    const v = l.current, d = F.toArray(e), o = [...v, ...d];
    l.current = d, m(o);
  }, [e, m]), /* @__PURE__ */ h.jsx(It, { value: g, children: u });
}, Y = () => Tt(), Ct = (e) => {
  const { getState: n, onSelect: r, subscribe: s } = Y(), u = R(() => r(e), [e, r]), c = oe(
    R((l) => s(l, e), [e, s]),
    R(() => {
      const l = n(), a = At(l.value, e), m = l.hover === e;
      return a && m ? "selected-hovered" : a ? "selected" : m ? "hovered" : "none";
    }, [e, n]),
    R(() => "none", [])
  );
  return A(
    () => ({
      selected: c === "selected" || c === "selected-hovered",
      hovered: c === "hovered" || c === "selected-hovered",
      onSelect: u
    }),
    [c, u]
  );
}, ar = () => {
  const { getState: e, subscribe: n } = Y(), r = oe(
    n,
    () => e().value,
    () => null
  );
  return A(() => r == null ? [] : F.toArray(r), [r]);
}, lr = () => Y().clear, kt = ({
  data: e,
  getItem: n,
  subscribe: r,
  itemHeight: s,
  multiple: u,
  onFetchMore: c,
  virtual: l = !1,
  value: a,
  onChange: m,
  ...p
}) => /* @__PURE__ */ h.jsx(
  Qe,
  {
    data: e,
    getItem: n,
    subscribe: r,
    onFetchMore: c,
    itemHeight: s,
    virtual: l,
    children: u ? /* @__PURE__ */ h.jsx(Pt, { value: a, onChange: m, ...p }) : /* @__PURE__ */ h.jsx(Lt, { value: a, onChange: m, ...p })
  }
);
kt.displayName = "Select.Frame";
function zt(e) {
  throw new Error('Could not dynamically require "' + e + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
}
var V = { exports: {} }, Nt = V.exports, ne;
function qt() {
  return ne || (ne = 1, (function(e, n) {
    (function(r, s) {
      typeof zt == "function" ? e.exports = s() : r.pluralize = s();
    })(Nt, function() {
      var r = [], s = [], u = {}, c = {}, l = {};
      function a(t) {
        return typeof t == "string" ? new RegExp("^" + t + "$", "i") : t;
      }
      function m(t, i) {
        return t === i ? i : t === t.toLowerCase() ? i.toLowerCase() : t === t.toUpperCase() ? i.toUpperCase() : t[0] === t[0].toUpperCase() ? i.charAt(0).toUpperCase() + i.substr(1).toLowerCase() : i.toLowerCase();
      }
      function p(t, i) {
        return t.replace(/\$(\d{1,2})/g, function(f, x) {
          return i[x] || "";
        });
      }
      function $(t, i) {
        return t.replace(i[0], function(f, x) {
          var b = p(i[1], arguments);
          return m(f === "" ? t[x - 1] : f, b);
        });
      }
      function g(t, i, f) {
        if (!t.length || u.hasOwnProperty(t))
          return i;
        for (var x = f.length; x--; ) {
          var b = f[x];
          if (b[0].test(i)) return $(i, b);
        }
        return i;
      }
      function v(t, i, f) {
        return function(x) {
          var b = x.toLowerCase();
          return i.hasOwnProperty(b) ? m(x, b) : t.hasOwnProperty(b) ? m(x, t[b]) : g(b, x, f);
        };
      }
      function d(t, i, f, x) {
        return function(b) {
          var S = b.toLowerCase();
          return i.hasOwnProperty(S) ? !0 : t.hasOwnProperty(S) ? !1 : g(S, S, f) === S;
        };
      }
      function o(t, i, f) {
        var x = i === 1 ? o.singular(t) : o.plural(t);
        return (f ? i + " " : "") + x;
      }
      return o.plural = v(
        l,
        c,
        r
      ), o.isPlural = d(
        l,
        c,
        r
      ), o.singular = v(
        c,
        l,
        s
      ), o.isSingular = d(
        c,
        l,
        s
      ), o.addPluralRule = function(t, i) {
        r.push([a(t), i]);
      }, o.addSingularRule = function(t, i) {
        s.push([a(t), i]);
      }, o.addUncountableRule = function(t) {
        if (typeof t == "string") {
          u[t.toLowerCase()] = !0;
          return;
        }
        o.addPluralRule(t, "$0"), o.addSingularRule(t, "$0");
      }, o.addIrregularRule = function(t, i) {
        i = i.toLowerCase(), t = t.toLowerCase(), l[t] = i, c[i] = t;
      }, [
        // Pronouns.
        ["I", "we"],
        ["me", "us"],
        ["he", "they"],
        ["she", "they"],
        ["them", "them"],
        ["myself", "ourselves"],
        ["yourself", "yourselves"],
        ["itself", "themselves"],
        ["herself", "themselves"],
        ["himself", "themselves"],
        ["themself", "themselves"],
        ["is", "are"],
        ["was", "were"],
        ["has", "have"],
        ["this", "these"],
        ["that", "those"],
        // Words ending in with a consonant and `o`.
        ["echo", "echoes"],
        ["dingo", "dingoes"],
        ["volcano", "volcanoes"],
        ["tornado", "tornadoes"],
        ["torpedo", "torpedoes"],
        // Ends with `us`.
        ["genus", "genera"],
        ["viscus", "viscera"],
        // Ends with `ma`.
        ["stigma", "stigmata"],
        ["stoma", "stomata"],
        ["dogma", "dogmata"],
        ["lemma", "lemmata"],
        ["schema", "schemata"],
        ["anathema", "anathemata"],
        // Other irregular rules.
        ["ox", "oxen"],
        ["axe", "axes"],
        ["die", "dice"],
        ["yes", "yeses"],
        ["foot", "feet"],
        ["eave", "eaves"],
        ["goose", "geese"],
        ["tooth", "teeth"],
        ["quiz", "quizzes"],
        ["human", "humans"],
        ["proof", "proofs"],
        ["carve", "carves"],
        ["valve", "valves"],
        ["looey", "looies"],
        ["thief", "thieves"],
        ["groove", "grooves"],
        ["pickaxe", "pickaxes"],
        ["passerby", "passersby"]
      ].forEach(function(t) {
        return o.addIrregularRule(t[0], t[1]);
      }), [
        [/s?$/i, "s"],
        [/[^\u0000-\u007F]$/i, "$0"],
        [/([^aeiou]ese)$/i, "$1"],
        [/(ax|test)is$/i, "$1es"],
        [/(alias|[^aou]us|t[lm]as|gas|ris)$/i, "$1es"],
        [/(e[mn]u)s?$/i, "$1s"],
        [/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i, "$1"],
        [/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1i"],
        [/(alumn|alg|vertebr)(?:a|ae)$/i, "$1ae"],
        [/(seraph|cherub)(?:im)?$/i, "$1im"],
        [/(her|at|gr)o$/i, "$1oes"],
        [/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i, "$1a"],
        [/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i, "$1a"],
        [/sis$/i, "ses"],
        [/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i, "$1$2ves"],
        [/([^aeiouy]|qu)y$/i, "$1ies"],
        [/([^ch][ieo][ln])ey$/i, "$1ies"],
        [/(x|ch|ss|sh|zz)$/i, "$1es"],
        [/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i, "$1ices"],
        [/\b((?:tit)?m|l)(?:ice|ouse)$/i, "$1ice"],
        [/(pe)(?:rson|ople)$/i, "$1ople"],
        [/(child)(?:ren)?$/i, "$1ren"],
        [/eaux$/i, "$0"],
        [/m[ae]n$/i, "men"],
        ["thou", "you"]
      ].forEach(function(t) {
        return o.addPluralRule(t[0], t[1]);
      }), [
        [/s$/i, ""],
        [/(ss)$/i, "$1"],
        [/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i, "$1fe"],
        [/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, "$1f"],
        [/ies$/i, "y"],
        [/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i, "$1ie"],
        [/\b(mon|smil)ies$/i, "$1ey"],
        [/\b((?:tit)?m|l)ice$/i, "$1ouse"],
        [/(seraph|cherub)im$/i, "$1"],
        [/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i, "$1"],
        [/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i, "$1sis"],
        [/(movie|twelve|abuse|e[mn]u)s$/i, "$1"],
        [/(test)(?:is|es)$/i, "$1is"],
        [/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1us"],
        [/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i, "$1um"],
        [/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i, "$1on"],
        [/(alumn|alg|vertebr)ae$/i, "$1a"],
        [/(cod|mur|sil|vert|ind)ices$/i, "$1ex"],
        [/(matr|append)ices$/i, "$1ix"],
        [/(pe)(rson|ople)$/i, "$1rson"],
        [/(child)ren$/i, "$1"],
        [/(eau)x?$/i, "$1"],
        [/men$/i, "man"]
      ].forEach(function(t) {
        return o.addSingularRule(t[0], t[1]);
      }), [
        // Singular words with no plurals.
        "adulthood",
        "advice",
        "agenda",
        "aid",
        "aircraft",
        "alcohol",
        "ammo",
        "analytics",
        "anime",
        "athletics",
        "audio",
        "bison",
        "blood",
        "bream",
        "buffalo",
        "butter",
        "carp",
        "cash",
        "chassis",
        "chess",
        "clothing",
        "cod",
        "commerce",
        "cooperation",
        "corps",
        "debris",
        "diabetes",
        "digestion",
        "elk",
        "energy",
        "equipment",
        "excretion",
        "expertise",
        "firmware",
        "flounder",
        "fun",
        "gallows",
        "garbage",
        "graffiti",
        "hardware",
        "headquarters",
        "health",
        "herpes",
        "highjinks",
        "homework",
        "housework",
        "information",
        "jeans",
        "justice",
        "kudos",
        "labour",
        "literature",
        "machinery",
        "mackerel",
        "mail",
        "media",
        "mews",
        "moose",
        "music",
        "mud",
        "manga",
        "news",
        "only",
        "personnel",
        "pike",
        "plankton",
        "pliers",
        "police",
        "pollution",
        "premises",
        "rain",
        "research",
        "rice",
        "salmon",
        "scissors",
        "series",
        "sewage",
        "shambles",
        "shrimp",
        "software",
        "species",
        "staff",
        "swine",
        "tennis",
        "traffic",
        "transportation",
        "trout",
        "tuna",
        "wealth",
        "welfare",
        "whiting",
        "wildebeest",
        "wildlife",
        "you",
        /pok[eé]mon$/i,
        // Regexes.
        /[^aeiou]ese$/i,
        // "chinese", "japanese"
        /deer$/i,
        // "deer", "reindeer"
        /fish$/i,
        // "fish", "blowfish", "angelfish"
        /measles$/i,
        /o[iu]s$/i,
        // "carnivorous"
        /pox$/i,
        // "chickpox", "smallpox"
        /sheep$/i
      ].forEach(o.addUncountableRule), o;
    });
  })(V)), V.exports;
}
var he = qt();
const Vt = ({
  searchPlaceholder: e = "Search...",
  onSearch: n,
  actions: r,
  dialogVariant: s = "floating"
}) => {
  const [u, c] = D(""), l = /* @__PURE__ */ h.jsx(
    bt,
    {
      value: u,
      autoFocus: !0,
      placeholder: e,
      size: s === "modal" ? "large" : "medium",
      contrast: 3,
      rounded: !0,
      grow: !0,
      full: "x",
      onChange: (a) => {
        c(a), n?.(a);
      }
    }
  );
  return r == null ? l : /* @__PURE__ */ h.jsxs(X, { pack: !0, x: !0, children: [
    l,
    r
  ] });
}, Dt = ({ resourceName: e }) => /* @__PURE__ */ h.jsxs(C, { center: !0, status: "disabled", children: [
  "No ",
  he.plural(e),
  " found"
] }), pe = _e(
  ({
    onSearch: e,
    children: n,
    emptyContent: r,
    status: s,
    resourceName: u,
    actions: c,
    ...l
  }) => (r = A(() => s != null && s.variant !== "success" ? /* @__PURE__ */ h.jsx(
    W,
    {
      center: !0,
      variant: s?.variant,
      description: s?.description,
      children: s?.message
    }
  ) : typeof r == "string" ? /* @__PURE__ */ h.jsx(W, { center: !0, variant: "disabled", children: r }) : r ?? /* @__PURE__ */ h.jsx(Dt, { resourceName: u }), [s?.key, r]), /* @__PURE__ */ h.jsxs(
    Ge,
    {
      ...l,
      className: w.BE("select", "dialog"),
      bordered: !1,
      children: [
        e != null && /* @__PURE__ */ h.jsx(
          Vt,
          {
            dialogVariant: "floating",
            onSearch: e,
            searchPlaceholder: `Search ${he.plural(u)}...`,
            actions: c
          }
        ),
        /* @__PURE__ */ h.jsx(
          et,
          {
            emptyContent: r,
            bordered: !0,
            borderColor: 6,
            grow: !0,
            rounded: !0,
            full: "x",
            children: n
          }
        )
      ]
    }
  ))
);
pe.displayName = "Select.Dialog";
const cr = pe, ur = (e) => {
  const { itemKey: n } = e, r = Ct(n);
  return /* @__PURE__ */ h.jsx(tt, { ...r, ...e });
};
export {
  rr as A,
  ir as C,
  cr as D,
  kt as F,
  ur as L,
  W as S,
  bt as T,
  sr as a,
  nr as b,
  Ct as c,
  ar as d,
  Y as e,
  lr as f,
  fe as g,
  wt as h,
  Et as i,
  or as j,
  he as p,
  le as u
};
