function A(n, r) {
  return n.filter((t, o) => o !== r);
}
function g(n, r) {
  return n.filter((t, o) => !r.includes(o));
}
function h(n, r, t) {
  return [...n.slice(0, r), t, ...n.slice(r)];
}
function v(n, r, t) {
  return [...n.slice(0, r), ...t, ...n.slice(r)];
}
function M(n, r, t) {
  return n.findIndex((o) => o[r] === t);
}
function T(n, r, t) {
  const o = [...n], c = A(o, r);
  let e = t;
  return e >= n.length - 1 && (e = e + 1), h(c, e, n[r]);
}
function y(n, r, t) {
  const o = [...n], c = g(o, r), e = t !== 0 ? r.reduce(
    (i, a) => t > a ? i - 1 : i,
    t
  ) : t;
  return v(
    c,
    e,
    r.map((i) => n[i])
  );
}
function F(n, r) {
  return n.reduce(
    (t, o) => {
      const c = o[r];
      return t[c] ??= [], t[c].push(o), t;
    },
    {}
  );
}
function S(n, r, t) {
  if (!n.length)
    return [r];
  const o = t.findIndex(
    (u) => u.id === r
  ), c = n[n.length - 1], e = t.findIndex(
    (u) => u.id === c
  );
  if (o < 0 || e < 0)
    return [r];
  const s = t.reduce(
    (u, f, p) => (u[f.id] = p, u),
    {}
  ), i = o > e, a = i ? e : o, w = i ? o : e, d = t.slice(a, w + 1).filter((u) => !(!u || n.includes(u.id))).map((u) => u.id), x = i ? d : [...d].reverse(), l = n.includes(r) ? n.slice(0, n.indexOf(r) + 1) : [...n, ...x];
  return l.sort((u, f) => s[u] - s[f]), l;
}
function N(n, r, t, o, c, e) {
  const s = t + 1;
  if (n.length < 2)
    throw new Error("Values array must contain at least 2 elements");
  if (t < 0 || s >= n.length)
    throw new Error("Invalid index or not enough values to adjust");
  if (o < 0)
    throw new Error("Minimum value must be non-negative");
  let i = c + r;
  i < o && (r = o - c, i = o);
  let a = e - r;
  a < o && (r = e - o, i = c + r, a = o), n[t] = parseFloat(i.toFixed(2)), n[s] = parseFloat(a.toFixed(2));
}
const b = (n, r) => {
  try {
    window.Matrix3?.ShowNotification && window.Matrix3.ShowNotification(
      n,
      r ? {
        notificationType: r.notificationType
      } : void 0
    );
  } catch {
    return;
  }
};
export {
  y as a,
  A as b,
  h as c,
  T as d,
  N as e,
  M as f,
  F as g,
  v as i,
  S as m,
  g as r,
  b as t
};
