import { t as invariant } from "./invariant-UcGKQEhF.js";
function clamp(e, o, s) {
  return Math.min(Math.max(e, o), s);
}
function arrayDelete(e, o) {
  let s = [...e];
  return s.splice(o, 1), s;
}
function arrayInsert(e, s, c) {
  s = clamp(s, 0, e.length);
  let l = [...e];
  return l.splice(s, 0, c), l;
}
function arrayMove(e, o, s) {
  let c = [...e], [l] = c.splice(o, 1);
  return c.splice(s, 0, l), c;
}
function arrayInsertMany(e, s, c) {
  if (e.length === 0) return c;
  s = clamp(s, 0, e.length);
  let l = [...e];
  return l.splice(s, 0, ...c), l;
}
function arrayShallowEquals(e, o) {
  if (e === o) return true;
  if (e.length !== o.length) return false;
  for (let s = 0, c = e.length; s < c; s++) if (e[s] !== o[s]) return false;
  return true;
}
const Arrays = {
  EMPTY: [],
  zip: (o, s) => (invariant(o.length === s.length, "Arrays must be the same length"), o.map((e, o2) => [e, s[o2]]))
};
function uniq(e) {
  return [...new Set(e)];
}
function uniqueBy(e, o) {
  let s = [], c = /* @__PURE__ */ new Set();
  for (let l of e) {
    let e2 = o(l);
    c.has(e2) || (c.add(e2), s.push(l));
  }
  return s;
}
export {
  arrayMove as a,
  uniqueBy as c,
  arrayInsertMany as i,
  clamp as l,
  arrayDelete as n,
  arrayShallowEquals as o,
  arrayInsert as r,
  uniq as s,
  Arrays as t
};
