import { ap as Mn, e as O, Y as N, ao as A, ab as F, an as M, b as B, aq as $e, aM as Ln, aN as St, aO as ze, ar as de, aP as zn, aQ as kn, aR as jn, j as P, z as Pn, aS as Bn, $ as Fn, x as $t, a5 as $n } from "./index-c65ca4a4.mjs";
function Xn() {
  for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)
    t[n] = arguments[n];
  return A(
    () => (r) => {
      t.forEach((o) => o(r));
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    t
  );
}
const lt = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
function De(e) {
  const t = Object.prototype.toString.call(e);
  return t === "[object Window]" || // In Electron context the Window object serializes to [object global]
  t === "[object global]";
}
function Ct(e) {
  return "nodeType" in e;
}
function $(e) {
  var t, n;
  return e ? De(e) ? e : Ct(e) && (t = (n = e.ownerDocument) == null ? void 0 : n.defaultView) != null ? t : window : window;
}
function Rt(e) {
  const {
    Document: t
  } = $(e);
  return e instanceof t;
}
function Xe(e) {
  return De(e) ? !1 : e instanceof $(e).HTMLElement;
}
function Yn(e) {
  return e instanceof $(e).SVGElement;
}
function Se(e) {
  return e ? De(e) ? e.document : Ct(e) ? Rt(e) ? e : Xe(e) ? e.ownerDocument : document : document : document;
}
const q = lt ? Mn : O;
function ct(e) {
  const t = N(e);
  return q(() => {
    t.current = e;
  }), F(function() {
    for (var n = arguments.length, r = new Array(n), o = 0; o < n; o++)
      r[o] = arguments[o];
    return t.current == null ? void 0 : t.current(...r);
  }, []);
}
function Kn() {
  const e = N(null), t = F((r, o) => {
    e.current = setInterval(r, o);
  }, []), n = F(() => {
    e.current !== null && (clearInterval(e.current), e.current = null);
  }, []);
  return [t, n];
}
function Be(e, t) {
  t === void 0 && (t = [e]);
  const n = N(e);
  return q(() => {
    n.current !== e && (n.current = e);
  }, t), n;
}
function Ye(e, t) {
  const n = N();
  return A(
    () => {
      const r = e(n.current);
      return n.current = r, r;
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [...t]
  );
}
function nt(e) {
  const t = ct(e), n = N(null), r = F(
    (o) => {
      o !== n.current && (t == null || t(o, n.current)), n.current = o;
    },
    //eslint-disable-next-line
    []
  );
  return [n, r];
}
function rt(e) {
  const t = N();
  return O(() => {
    t.current = e;
  }, [e]), t.current;
}
let vt = {};
function Ke(e, t) {
  return A(() => {
    if (t)
      return t;
    const n = vt[e] == null ? 0 : vt[e] + 1;
    return vt[e] = n, e + "-" + n;
  }, [e, t]);
}
function Zt(e) {
  return function(t) {
    for (var n = arguments.length, r = new Array(n > 1 ? n - 1 : 0), o = 1; o < n; o++)
      r[o - 1] = arguments[o];
    return r.reduce((i, s) => {
      const a = Object.entries(s);
      for (const [l, c] of a) {
        const u = i[l];
        u != null && (i[l] = u + e * c);
      }
      return i;
    }, {
      ...t
    });
  };
}
const xe = /* @__PURE__ */ Zt(1), ot = /* @__PURE__ */ Zt(-1);
function Hn(e) {
  return "clientX" in e && "clientY" in e;
}
function ut(e) {
  if (!e)
    return !1;
  const {
    KeyboardEvent: t
  } = $(e.target);
  return t && e instanceof t;
}
function Wn(e) {
  if (!e)
    return !1;
  const {
    TouchEvent: t
  } = $(e.target);
  return t && e instanceof t;
}
function it(e) {
  if (Wn(e)) {
    if (e.touches && e.touches.length) {
      const {
        clientX: t,
        clientY: n
      } = e.touches[0];
      return {
        x: t,
        y: n
      };
    } else if (e.changedTouches && e.changedTouches.length) {
      const {
        clientX: t,
        clientY: n
      } = e.changedTouches[0];
      return {
        x: t,
        y: n
      };
    }
  }
  return Hn(e) ? {
    x: e.clientX,
    y: e.clientY
  } : null;
}
const fe = /* @__PURE__ */ Object.freeze({
  Translate: {
    toString(e) {
      if (!e)
        return;
      const {
        x: t,
        y: n
      } = e;
      return "translate3d(" + (t ? Math.round(t) : 0) + "px, " + (n ? Math.round(n) : 0) + "px, 0)";
    }
  },
  Scale: {
    toString(e) {
      if (!e)
        return;
      const {
        scaleX: t,
        scaleY: n
      } = e;
      return "scaleX(" + t + ") scaleY(" + n + ")";
    }
  },
  Transform: {
    toString(e) {
      if (e)
        return [fe.Translate.toString(e), fe.Scale.toString(e)].join(" ");
    }
  },
  Transition: {
    toString(e) {
      let {
        property: t,
        duration: n,
        easing: r
      } = e;
      return t + " " + n + "ms " + r;
    }
  }
}), Xt = "a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";
function Un(e) {
  return e.matches(Xt) ? e : e.querySelector(Xt);
}
const Vn = {
  display: "none"
};
function qn(e) {
  let {
    id: t,
    value: n
  } = e;
  return M.createElement("div", {
    id: t,
    style: Vn
  }, n);
}
const Jn = {
  position: "fixed",
  width: 1,
  height: 1,
  margin: -1,
  border: 0,
  padding: 0,
  overflow: "hidden",
  clip: "rect(0 0 0 0)",
  clipPath: "inset(100%)",
  whiteSpace: "nowrap"
};
function Gn(e) {
  let {
    id: t,
    announcement: n
  } = e;
  return M.createElement("div", {
    id: t,
    style: Jn,
    role: "status",
    "aria-live": "assertive",
    "aria-atomic": !0
  }, n);
}
function _n() {
  const [e, t] = B("");
  return {
    announce: F((r) => {
      r != null && t(r);
    }, []),
    announcement: e
  };
}
const en = /* @__PURE__ */ $e(null);
function Qn(e) {
  const t = de(en);
  O(() => {
    if (!t)
      throw new Error("useDndMonitor must be used within a children of <DndContext>");
    return t(e);
  }, [e, t]);
}
function Zn() {
  const [e] = B(() => /* @__PURE__ */ new Set()), t = F((r) => (e.add(r), () => e.delete(r)), [e]);
  return [F((r) => {
    let {
      type: o,
      event: i
    } = r;
    e.forEach((s) => {
      var a;
      return (a = s[o]) == null ? void 0 : a.call(s, i);
    });
  }, [e]), t];
}
const er = {
  draggable: `
    To pick up a draggable item, press the space bar.
    While dragging, use the arrow keys to move the item.
    Press space again to drop the item in its new position, or press escape to cancel.
  `
}, tr = {
  onDragStart(e) {
    let {
      active: t
    } = e;
    return "Picked up draggable item " + t.id + ".";
  },
  onDragOver(e) {
    let {
      active: t,
      over: n
    } = e;
    return n ? "Draggable item " + t.id + " was moved over droppable area " + n.id + "." : "Draggable item " + t.id + " is no longer over a droppable area.";
  },
  onDragEnd(e) {
    let {
      active: t,
      over: n
    } = e;
    return n ? "Draggable item " + t.id + " was dropped over droppable area " + n.id : "Draggable item " + t.id + " was dropped.";
  },
  onDragCancel(e) {
    let {
      active: t
    } = e;
    return "Dragging was cancelled. Draggable item " + t.id + " was dropped.";
  }
};
function nr(e) {
  let {
    announcements: t = tr,
    container: n,
    hiddenTextDescribedById: r,
    screenReaderInstructions: o = er
  } = e;
  const {
    announce: i,
    announcement: s
  } = _n(), a = Ke("DndLiveRegion"), [l, c] = B(!1);
  if (O(() => {
    c(!0);
  }, []), Qn(A(() => ({
    onDragStart(d) {
      let {
        active: g
      } = d;
      i(t.onDragStart({
        active: g
      }));
    },
    onDragMove(d) {
      let {
        active: g,
        over: f
      } = d;
      t.onDragMove && i(t.onDragMove({
        active: g,
        over: f
      }));
    },
    onDragOver(d) {
      let {
        active: g,
        over: f
      } = d;
      i(t.onDragOver({
        active: g,
        over: f
      }));
    },
    onDragEnd(d) {
      let {
        active: g,
        over: f
      } = d;
      i(t.onDragEnd({
        active: g,
        over: f
      }));
    },
    onDragCancel(d) {
      let {
        active: g,
        over: f
      } = d;
      i(t.onDragCancel({
        active: g,
        over: f
      }));
    }
  }), [i, t])), !l)
    return null;
  const u = M.createElement(M.Fragment, null, M.createElement(qn, {
    id: r,
    value: o.draggable
  }), M.createElement(Gn, {
    id: a,
    announcement: s
  }));
  return n ? zn(u, n) : u;
}
var z;
(function(e) {
  e.DragStart = "dragStart", e.DragMove = "dragMove", e.DragEnd = "dragEnd", e.DragCancel = "dragCancel", e.DragOver = "dragOver", e.RegisterDroppable = "registerDroppable", e.SetDroppableDisabled = "setDroppableDisabled", e.UnregisterDroppable = "unregisterDroppable";
})(z || (z = {}));
function st() {
}
const Z = /* @__PURE__ */ Object.freeze({
  x: 0,
  y: 0
});
function rr(e, t) {
  return Math.sqrt(Math.pow(e.x - t.x, 2) + Math.pow(e.y - t.y, 2));
}
function or(e, t) {
  const n = it(e);
  if (!n)
    return "0 0";
  const r = {
    x: (n.x - t.left) / t.width * 100,
    y: (n.y - t.top) / t.height * 100
  };
  return r.x + "% " + r.y + "%";
}
function ir(e, t) {
  let {
    data: {
      value: n
    }
  } = e, {
    data: {
      value: r
    }
  } = t;
  return n - r;
}
function sr(e, t) {
  let {
    data: {
      value: n
    }
  } = e, {
    data: {
      value: r
    }
  } = t;
  return r - n;
}
function ar(e, t) {
  if (!e || e.length === 0)
    return null;
  const [n] = e;
  return t ? n[t] : n;
}
function Yt(e, t, n) {
  return t === void 0 && (t = e.left), n === void 0 && (n = e.top), {
    x: t + e.width * 0.5,
    y: n + e.height * 0.5
  };
}
const lr = (e) => {
  let {
    collisionRect: t,
    droppableRects: n,
    droppableContainers: r
  } = e;
  const o = Yt(t, t.left, t.top), i = [];
  for (const s of r) {
    const {
      id: a
    } = s, l = n.get(a);
    if (l) {
      const c = rr(Yt(l), o);
      i.push({
        id: a,
        data: {
          droppableContainer: s,
          value: c
        }
      });
    }
  }
  return i.sort(ir);
};
function cr(e, t) {
  const n = Math.max(t.top, e.top), r = Math.max(t.left, e.left), o = Math.min(t.left + t.width, e.left + e.width), i = Math.min(t.top + t.height, e.top + e.height), s = o - r, a = i - n;
  if (r < o && n < i) {
    const l = t.width * t.height, c = e.width * e.height, u = s * a, d = u / (l + c - u);
    return Number(d.toFixed(4));
  }
  return 0;
}
const ur = (e) => {
  let {
    collisionRect: t,
    droppableRects: n,
    droppableContainers: r
  } = e;
  const o = [];
  for (const i of r) {
    const {
      id: s
    } = i, a = n.get(s);
    if (a) {
      const l = cr(a, t);
      l > 0 && o.push({
        id: s,
        data: {
          droppableContainer: i,
          value: l
        }
      });
    }
  }
  return o.sort(sr);
};
function dr(e, t, n) {
  return {
    ...e,
    scaleX: t && n ? t.width / n.width : 1,
    scaleY: t && n ? t.height / n.height : 1
  };
}
function tn(e, t) {
  return e && t ? {
    x: e.left - t.left,
    y: e.top - t.top
  } : Z;
}
function fr(e) {
  return function(n) {
    for (var r = arguments.length, o = new Array(r > 1 ? r - 1 : 0), i = 1; i < r; i++)
      o[i - 1] = arguments[i];
    return o.reduce((s, a) => ({
      ...s,
      top: s.top + e * a.y,
      bottom: s.bottom + e * a.y,
      left: s.left + e * a.x,
      right: s.right + e * a.x
    }), {
      ...n
    });
  };
}
const gr = /* @__PURE__ */ fr(1);
function nn(e) {
  if (e.startsWith("matrix3d(")) {
    const t = e.slice(9, -1).split(/, /);
    return {
      x: +t[12],
      y: +t[13],
      scaleX: +t[0],
      scaleY: +t[5]
    };
  } else if (e.startsWith("matrix(")) {
    const t = e.slice(7, -1).split(/, /);
    return {
      x: +t[4],
      y: +t[5],
      scaleX: +t[0],
      scaleY: +t[3]
    };
  }
  return null;
}
function hr(e, t, n) {
  const r = nn(t);
  if (!r)
    return e;
  const {
    scaleX: o,
    scaleY: i,
    x: s,
    y: a
  } = r, l = e.left - s - (1 - o) * parseFloat(n), c = e.top - a - (1 - i) * parseFloat(n.slice(n.indexOf(" ") + 1)), u = o ? e.width / o : e.width, d = i ? e.height / i : e.height;
  return {
    width: u,
    height: d,
    top: c,
    right: l + u,
    bottom: c + d,
    left: l
  };
}
const vr = {
  ignoreTransform: !1
};
function Ce(e, t) {
  t === void 0 && (t = vr);
  let n = e.getBoundingClientRect();
  if (t.ignoreTransform) {
    const {
      transform: c,
      transformOrigin: u
    } = $(e).getComputedStyle(e);
    c && (n = hr(n, c, u));
  }
  const {
    top: r,
    left: o,
    width: i,
    height: s,
    bottom: a,
    right: l
  } = n;
  return {
    top: r,
    left: o,
    width: i,
    height: s,
    bottom: a,
    right: l
  };
}
function Kt(e) {
  return Ce(e, {
    ignoreTransform: !0
  });
}
function pr(e) {
  const t = e.innerWidth, n = e.innerHeight;
  return {
    top: 0,
    left: 0,
    right: t,
    bottom: n,
    width: t,
    height: n
  };
}
function br(e, t) {
  return t === void 0 && (t = $(e).getComputedStyle(e)), t.position === "fixed";
}
function mr(e, t) {
  t === void 0 && (t = $(e).getComputedStyle(e));
  const n = /(auto|scroll|overlay)/;
  return ["overflow", "overflowX", "overflowY"].some((o) => {
    const i = t[o];
    return typeof i == "string" ? n.test(i) : !1;
  });
}
function Et(e, t) {
  const n = [];
  function r(o) {
    if (t != null && n.length >= t || !o)
      return n;
    if (Rt(o) && o.scrollingElement != null && !n.includes(o.scrollingElement))
      return n.push(o.scrollingElement), n;
    if (!Xe(o) || Yn(o) || n.includes(o))
      return n;
    const i = $(e).getComputedStyle(o);
    return o !== e && mr(o, i) && n.push(o), br(o, i) ? n : r(o.parentNode);
  }
  return e ? r(e) : n;
}
function rn(e) {
  const [t] = Et(e, 1);
  return t ?? null;
}
function pt(e) {
  return !lt || !e ? null : De(e) ? e : Ct(e) ? Rt(e) || e === Se(e).scrollingElement ? window : Xe(e) ? e : null : null;
}
function on(e) {
  return De(e) ? e.scrollX : e.scrollLeft;
}
function sn(e) {
  return De(e) ? e.scrollY : e.scrollTop;
}
function wt(e) {
  return {
    x: on(e),
    y: sn(e)
  };
}
var k;
(function(e) {
  e[e.Forward = 1] = "Forward", e[e.Backward = -1] = "Backward";
})(k || (k = {}));
function an(e) {
  return !lt || !e ? !1 : e === document.scrollingElement;
}
function ln(e) {
  const t = {
    x: 0,
    y: 0
  }, n = an(e) ? {
    height: window.innerHeight,
    width: window.innerWidth
  } : {
    height: e.clientHeight,
    width: e.clientWidth
  }, r = {
    x: e.scrollWidth - n.width,
    y: e.scrollHeight - n.height
  }, o = e.scrollTop <= t.y, i = e.scrollLeft <= t.x, s = e.scrollTop >= r.y, a = e.scrollLeft >= r.x;
  return {
    isTop: o,
    isLeft: i,
    isBottom: s,
    isRight: a,
    maxScroll: r,
    minScroll: t
  };
}
const yr = {
  x: 0.2,
  y: 0.2
};
function wr(e, t, n, r, o) {
  let {
    top: i,
    left: s,
    right: a,
    bottom: l
  } = n;
  r === void 0 && (r = 10), o === void 0 && (o = yr);
  const {
    isTop: c,
    isBottom: u,
    isLeft: d,
    isRight: g
  } = ln(e), f = {
    x: 0,
    y: 0
  }, p = {
    x: 0,
    y: 0
  }, h = {
    height: t.height * o.y,
    width: t.width * o.x
  };
  return !c && i <= t.top + h.height ? (f.y = k.Backward, p.y = r * Math.abs((t.top + h.height - i) / h.height)) : !u && l >= t.bottom - h.height && (f.y = k.Forward, p.y = r * Math.abs((t.bottom - h.height - l) / h.height)), !g && a >= t.right - h.width ? (f.x = k.Forward, p.x = r * Math.abs((t.right - h.width - a) / h.width)) : !d && s <= t.left + h.width && (f.x = k.Backward, p.x = r * Math.abs((t.left + h.width - s) / h.width)), {
    direction: f,
    speed: p
  };
}
function xr(e) {
  if (e === document.scrollingElement) {
    const {
      innerWidth: i,
      innerHeight: s
    } = window;
    return {
      top: 0,
      left: 0,
      right: i,
      bottom: s,
      width: i,
      height: s
    };
  }
  const {
    top: t,
    left: n,
    right: r,
    bottom: o
  } = e.getBoundingClientRect();
  return {
    top: t,
    left: n,
    right: r,
    bottom: o,
    width: e.clientWidth,
    height: e.clientHeight
  };
}
function cn(e) {
  return e.reduce((t, n) => xe(t, wt(n)), Z);
}
function Dr(e) {
  return e.reduce((t, n) => t + on(n), 0);
}
function Sr(e) {
  return e.reduce((t, n) => t + sn(n), 0);
}
function un(e, t) {
  if (t === void 0 && (t = Ce), !e)
    return;
  const {
    top: n,
    left: r,
    bottom: o,
    right: i
  } = t(e);
  rn(e) && (o <= 0 || i <= 0 || n >= window.innerHeight || r >= window.innerWidth) && e.scrollIntoView({
    block: "center",
    inline: "center"
  });
}
const Cr = [["x", ["left", "right"], Dr], ["y", ["top", "bottom"], Sr]];
class It {
  constructor(t, n) {
    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 r = Et(n), o = cn(r);
    this.rect = {
      ...t
    }, this.width = t.width, this.height = t.height;
    for (const [i, s, a] of Cr)
      for (const l of s)
        Object.defineProperty(this, l, {
          get: () => {
            const c = a(r), u = o[i] - c;
            return this.rect[l] + u;
          },
          enumerable: !0
        });
    Object.defineProperty(this, "rect", {
      enumerable: !1
    });
  }
}
class ke {
  constructor(t) {
    this.target = void 0, this.listeners = [], this.removeAll = () => {
      this.listeners.forEach((n) => {
        var r;
        return (r = this.target) == null ? void 0 : r.removeEventListener(...n);
      });
    }, this.target = t;
  }
  add(t, n, r) {
    var o;
    (o = this.target) == null || o.addEventListener(t, n, r), this.listeners.push([t, n, r]);
  }
}
function Rr(e) {
  const {
    EventTarget: t
  } = $(e);
  return e instanceof t ? e : Se(e);
}
function bt(e, t) {
  const n = Math.abs(e.x), r = Math.abs(e.y);
  return typeof t == "number" ? Math.sqrt(n ** 2 + r ** 2) > t : "x" in t && "y" in t ? n > t.x && r > t.y : "x" in t ? n > t.x : "y" in t ? r > t.y : !1;
}
var V;
(function(e) {
  e.Click = "click", e.DragStart = "dragstart", e.Keydown = "keydown", e.ContextMenu = "contextmenu", e.Resize = "resize", e.SelectionChange = "selectionchange", e.VisibilityChange = "visibilitychange";
})(V || (V = {}));
function Ht(e) {
  e.preventDefault();
}
function Er(e) {
  e.stopPropagation();
}
var R;
(function(e) {
  e.Space = "Space", e.Down = "ArrowDown", e.Right = "ArrowRight", e.Left = "ArrowLeft", e.Up = "ArrowUp", e.Esc = "Escape", e.Enter = "Enter";
})(R || (R = {}));
const dn = {
  start: [R.Space, R.Enter],
  cancel: [R.Esc],
  end: [R.Space, R.Enter]
}, Ir = (e, t) => {
  let {
    currentCoordinates: n
  } = t;
  switch (e.code) {
    case R.Right:
      return {
        ...n,
        x: n.x + 25
      };
    case R.Left:
      return {
        ...n,
        x: n.x - 25
      };
    case R.Down:
      return {
        ...n,
        y: n.y + 25
      };
    case R.Up:
      return {
        ...n,
        y: n.y - 25
      };
  }
};
class fn {
  constructor(t) {
    this.props = void 0, this.autoScrollEnabled = !1, this.referenceCoordinates = void 0, this.listeners = void 0, this.windowListeners = void 0, this.props = t;
    const {
      event: {
        target: n
      }
    } = t;
    this.props = t, this.listeners = new ke(Se(n)), this.windowListeners = new ke($(n)), this.handleKeyDown = this.handleKeyDown.bind(this), this.handleCancel = this.handleCancel.bind(this), this.attach();
  }
  attach() {
    this.handleStart(), this.windowListeners.add(V.Resize, this.handleCancel), this.windowListeners.add(V.VisibilityChange, this.handleCancel), setTimeout(() => this.listeners.add(V.Keydown, this.handleKeyDown));
  }
  handleStart() {
    const {
      activeNode: t,
      onStart: n
    } = this.props, r = t.node.current;
    r && un(r), n(Z);
  }
  handleKeyDown(t) {
    if (ut(t)) {
      const {
        active: n,
        context: r,
        options: o
      } = this.props, {
        keyboardCodes: i = dn,
        coordinateGetter: s = Ir,
        scrollBehavior: a = "smooth"
      } = o, {
        code: l
      } = t;
      if (i.end.includes(l)) {
        this.handleEnd(t);
        return;
      }
      if (i.cancel.includes(l)) {
        this.handleCancel(t);
        return;
      }
      const {
        collisionRect: c
      } = r.current, u = c ? {
        x: c.left,
        y: c.top
      } : Z;
      this.referenceCoordinates || (this.referenceCoordinates = u);
      const d = s(t, {
        active: n,
        context: r.current,
        currentCoordinates: u
      });
      if (d) {
        const g = ot(d, u), f = {
          x: 0,
          y: 0
        }, {
          scrollableAncestors: p
        } = r.current;
        for (const h of p) {
          const v = t.code, {
            isTop: b,
            isRight: w,
            isLeft: m,
            isBottom: D,
            maxScroll: S,
            minScroll: C
          } = ln(h), y = xr(h), x = {
            x: Math.min(v === R.Right ? y.right - y.width / 2 : y.right, Math.max(v === R.Right ? y.left : y.left + y.width / 2, d.x)),
            y: Math.min(v === R.Down ? y.bottom - y.height / 2 : y.bottom, Math.max(v === R.Down ? y.top : y.top + y.height / 2, d.y))
          }, T = v === R.Right && !w || v === R.Left && !m, L = v === R.Down && !D || v === R.Up && !b;
          if (T && x.x !== d.x) {
            const I = h.scrollLeft + g.x, J = v === R.Right && I <= S.x || v === R.Left && I >= C.x;
            if (J && !g.y) {
              h.scrollTo({
                left: I,
                behavior: a
              });
              return;
            }
            J ? f.x = h.scrollLeft - I : f.x = v === R.Right ? h.scrollLeft - S.x : h.scrollLeft - C.x, f.x && h.scrollBy({
              left: -f.x,
              behavior: a
            });
            break;
          } else if (L && x.y !== d.y) {
            const I = h.scrollTop + g.y, J = v === R.Down && I <= S.y || v === R.Up && I >= C.y;
            if (J && !g.x) {
              h.scrollTo({
                top: I,
                behavior: a
              });
              return;
            }
            J ? f.y = h.scrollTop - I : f.y = v === R.Down ? h.scrollTop - S.y : h.scrollTop - C.y, f.y && h.scrollBy({
              top: -f.y,
              behavior: a
            });
            break;
          }
        }
        this.handleMove(t, xe(ot(d, this.referenceCoordinates), f));
      }
    }
  }
  handleMove(t, n) {
    const {
      onMove: r
    } = this.props;
    t.preventDefault(), r(n);
  }
  handleEnd(t) {
    const {
      onEnd: n
    } = this.props;
    t.preventDefault(), this.detach(), n();
  }
  handleCancel(t) {
    const {
      onCancel: n
    } = this.props;
    t.preventDefault(), this.detach(), n();
  }
  detach() {
    this.listeners.removeAll(), this.windowListeners.removeAll();
  }
}
fn.activators = [{
  eventName: "onKeyDown",
  handler: (e, t, n) => {
    let {
      keyboardCodes: r = dn,
      onActivation: o
    } = t, {
      active: i
    } = n;
    const {
      code: s
    } = e.nativeEvent;
    if (r.start.includes(s)) {
      const a = i.activatorNode.current;
      return a && e.target !== a ? !1 : (e.preventDefault(), o == null || o({
        event: e.nativeEvent
      }), !0);
    }
    return !1;
  }
}];
function Wt(e) {
  return !!(e && "distance" in e);
}
function Ut(e) {
  return !!(e && "delay" in e);
}
class Ot {
  constructor(t, n, r) {
    var o;
    r === void 0 && (r = Rr(t.event.target)), this.props = void 0, this.events = void 0, this.autoScrollEnabled = !0, this.document = void 0, this.activated = !1, this.initialCoordinates = void 0, this.timeoutId = null, this.listeners = void 0, this.documentListeners = void 0, this.windowListeners = void 0, this.props = t, this.events = n;
    const {
      event: i
    } = t, {
      target: s
    } = i;
    this.props = t, this.events = n, this.document = Se(s), this.documentListeners = new ke(this.document), this.listeners = new ke(r), this.windowListeners = new ke($(s)), this.initialCoordinates = (o = it(i)) != null ? o : Z, 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: t,
      props: {
        options: {
          activationConstraint: n
        }
      }
    } = this;
    if (this.listeners.add(t.move.name, this.handleMove, {
      passive: !1
    }), this.listeners.add(t.end.name, this.handleEnd), this.windowListeners.add(V.Resize, this.handleCancel), this.windowListeners.add(V.DragStart, Ht), this.windowListeners.add(V.VisibilityChange, this.handleCancel), this.windowListeners.add(V.ContextMenu, Ht), this.documentListeners.add(V.Keydown, this.handleKeydown), n) {
      if (Wt(n))
        return;
      if (Ut(n)) {
        this.timeoutId = setTimeout(this.handleStart, n.delay);
        return;
      }
    }
    this.handleStart();
  }
  detach() {
    this.listeners.removeAll(), this.windowListeners.removeAll(), setTimeout(this.documentListeners.removeAll, 50), this.timeoutId !== null && (clearTimeout(this.timeoutId), this.timeoutId = null);
  }
  handleStart() {
    const {
      initialCoordinates: t
    } = this, {
      onStart: n
    } = this.props;
    t && (this.activated = !0, this.documentListeners.add(V.Click, Er, {
      capture: !0
    }), this.removeTextSelection(), this.documentListeners.add(V.SelectionChange, this.removeTextSelection), n(t));
  }
  handleMove(t) {
    var n;
    const {
      activated: r,
      initialCoordinates: o,
      props: i
    } = this, {
      onMove: s,
      options: {
        activationConstraint: a
      }
    } = i;
    if (!o)
      return;
    const l = (n = it(t)) != null ? n : Z, c = ot(o, l);
    if (!r && a) {
      if (Ut(a))
        return bt(c, a.tolerance) ? this.handleCancel() : void 0;
      if (Wt(a))
        return a.tolerance != null && bt(c, a.tolerance) ? this.handleCancel() : bt(c, a.distance) ? this.handleStart() : void 0;
    }
    t.cancelable && t.preventDefault(), s(l);
  }
  handleEnd() {
    const {
      onEnd: t
    } = this.props;
    this.detach(), t();
  }
  handleCancel() {
    const {
      onCancel: t
    } = this.props;
    this.detach(), t();
  }
  handleKeydown(t) {
    t.code === R.Esc && this.handleCancel();
  }
  removeTextSelection() {
    var t;
    (t = this.document.getSelection()) == null || t.removeAllRanges();
  }
}
const Or = {
  move: {
    name: "pointermove"
  },
  end: {
    name: "pointerup"
  }
};
class gn extends Ot {
  constructor(t) {
    const {
      event: n
    } = t, r = Se(n.target);
    super(t, Or, r);
  }
}
gn.activators = [{
  eventName: "onPointerDown",
  handler: (e, t) => {
    let {
      nativeEvent: n
    } = e, {
      onActivation: r
    } = t;
    return !n.isPrimary || n.button !== 0 ? !1 : (r == null || r({
      event: n
    }), !0);
  }
}];
const Ar = {
  move: {
    name: "mousemove"
  },
  end: {
    name: "mouseup"
  }
};
var xt;
(function(e) {
  e[e.RightClick = 2] = "RightClick";
})(xt || (xt = {}));
class Nr extends Ot {
  constructor(t) {
    super(t, Ar, Se(t.event.target));
  }
}
Nr.activators = [{
  eventName: "onMouseDown",
  handler: (e, t) => {
    let {
      nativeEvent: n
    } = e, {
      onActivation: r
    } = t;
    return n.button === xt.RightClick ? !1 : (r == null || r({
      event: n
    }), !0);
  }
}];
const mt = {
  move: {
    name: "touchmove"
  },
  end: {
    name: "touchend"
  }
};
class Tr extends Ot {
  constructor(t) {
    super(t, mt);
  }
  static setup() {
    return window.addEventListener(mt.move.name, t, {
      capture: !1,
      passive: !1
    }), function() {
      window.removeEventListener(mt.move.name, t);
    };
    function t() {
    }
  }
}
Tr.activators = [{
  eventName: "onTouchStart",
  handler: (e, t) => {
    let {
      nativeEvent: n
    } = e, {
      onActivation: r
    } = t;
    const {
      touches: o
    } = n;
    return o.length > 1 ? !1 : (r == null || r({
      event: n
    }), !0);
  }
}];
var je;
(function(e) {
  e[e.Pointer = 0] = "Pointer", e[e.DraggableRect = 1] = "DraggableRect";
})(je || (je = {}));
var at;
(function(e) {
  e[e.TreeOrder = 0] = "TreeOrder", e[e.ReversedTreeOrder = 1] = "ReversedTreeOrder";
})(at || (at = {}));
function Mr(e) {
  let {
    acceleration: t,
    activator: n = je.Pointer,
    canScroll: r,
    draggingRect: o,
    enabled: i,
    interval: s = 5,
    order: a = at.TreeOrder,
    pointerCoordinates: l,
    scrollableAncestors: c,
    scrollableAncestorRects: u,
    delta: d,
    threshold: g
  } = e;
  const f = zr({
    delta: d,
    disabled: !i
  }), [p, h] = Kn(), v = N({
    x: 0,
    y: 0
  }), b = N({
    x: 0,
    y: 0
  }), w = A(() => {
    switch (n) {
      case je.Pointer:
        return l ? {
          top: l.y,
          bottom: l.y,
          left: l.x,
          right: l.x
        } : null;
      case je.DraggableRect:
        return o;
    }
  }, [n, o, l]), m = N(null), D = F(() => {
    const C = m.current;
    if (!C)
      return;
    const y = v.current.x * b.current.x, x = v.current.y * b.current.y;
    C.scrollBy(y, x);
  }, []), S = A(() => a === at.TreeOrder ? [...c].reverse() : c, [a, c]);
  O(
    () => {
      if (!i || !c.length || !w) {
        h();
        return;
      }
      for (const C of S) {
        if ((r == null ? void 0 : r(C)) === !1)
          continue;
        const y = c.indexOf(C), x = u[y];
        if (!x)
          continue;
        const {
          direction: T,
          speed: L
        } = wr(C, x, w, t, g);
        for (const I of ["x", "y"])
          f[I][T[I]] || (L[I] = 0, T[I] = 0);
        if (L.x > 0 || L.y > 0) {
          h(), m.current = C, p(D, s), v.current = L, b.current = T;
          return;
        }
      }
      v.current = {
        x: 0,
        y: 0
      }, b.current = {
        x: 0,
        y: 0
      }, h();
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [
      t,
      D,
      r,
      h,
      i,
      s,
      // eslint-disable-next-line react-hooks/exhaustive-deps
      JSON.stringify(w),
      // eslint-disable-next-line react-hooks/exhaustive-deps
      JSON.stringify(f),
      p,
      c,
      S,
      u,
      // eslint-disable-next-line react-hooks/exhaustive-deps
      JSON.stringify(g)
    ]
  );
}
const Lr = {
  x: {
    [k.Backward]: !1,
    [k.Forward]: !1
  },
  y: {
    [k.Backward]: !1,
    [k.Forward]: !1
  }
};
function zr(e) {
  let {
    delta: t,
    disabled: n
  } = e;
  const r = rt(t);
  return Ye((o) => {
    if (n || !r || !o)
      return Lr;
    const i = {
      x: Math.sign(t.x - r.x),
      y: Math.sign(t.y - r.y)
    };
    return {
      x: {
        [k.Backward]: o.x[k.Backward] || i.x === -1,
        [k.Forward]: o.x[k.Forward] || i.x === 1
      },
      y: {
        [k.Backward]: o.y[k.Backward] || i.y === -1,
        [k.Forward]: o.y[k.Forward] || i.y === 1
      }
    };
  }, [n, t, r]);
}
function kr(e, t) {
  const n = t !== null ? e.get(t) : void 0, r = n ? n.node.current : null;
  return Ye((o) => {
    var i;
    return t === null ? null : (i = r ?? o) != null ? i : null;
  }, [r, t]);
}
function jr(e, t) {
  return A(() => e.reduce((n, r) => {
    const {
      sensor: o
    } = r, i = o.activators.map((s) => ({
      eventName: s.eventName,
      handler: t(s.handler, r)
    }));
    return [...n, ...i];
  }, []), [e, t]);
}
var Fe;
(function(e) {
  e[e.Always = 0] = "Always", e[e.BeforeDragging = 1] = "BeforeDragging", e[e.WhileDragging = 2] = "WhileDragging";
})(Fe || (Fe = {}));
var Dt;
(function(e) {
  e.Optimized = "optimized";
})(Dt || (Dt = {}));
const Vt = /* @__PURE__ */ new Map();
function Pr(e, t) {
  let {
    dragging: n,
    dependencies: r,
    config: o
  } = t;
  const [i, s] = B(null), {
    frequency: a,
    measure: l,
    strategy: c
  } = o, u = N(e), d = v(), g = Be(d), f = F(function(b) {
    b === void 0 && (b = []), !g.current && s((w) => w === null ? b : w.concat(b.filter((m) => !w.includes(m))));
  }, [g]), p = N(null), h = Ye((b) => {
    if (d && !n)
      return Vt;
    if (!b || b === Vt || u.current !== e || i != null) {
      const w = /* @__PURE__ */ new Map();
      for (let m of e) {
        if (!m)
          continue;
        if (i && i.length > 0 && !i.includes(m.id) && m.rect.current) {
          w.set(m.id, m.rect.current);
          continue;
        }
        const D = m.node.current, S = D ? new It(l(D), D) : null;
        m.rect.current = S, S && w.set(m.id, S);
      }
      return w;
    }
    return b;
  }, [e, i, n, d, l]);
  return O(() => {
    u.current = e;
  }, [e]), O(
    () => {
      d || f();
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [n, d]
  ), O(
    () => {
      i && i.length > 0 && s(null);
    },
    //eslint-disable-next-line react-hooks/exhaustive-deps
    [JSON.stringify(i)]
  ), O(
    () => {
      d || typeof a != "number" || p.current !== null || (p.current = setTimeout(() => {
        f(), p.current = null;
      }, a));
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [a, d, f, ...r]
  ), {
    droppableRects: h,
    measureDroppableContainers: f,
    measuringScheduled: i != null
  };
  function v() {
    switch (c) {
      case Fe.Always:
        return !1;
      case Fe.BeforeDragging:
        return n;
      default:
        return !n;
    }
  }
}
function At(e, t) {
  return Ye((n) => e ? n || (typeof t == "function" ? t(e) : e) : null, [t, e]);
}
function Br(e, t) {
  return At(e, t);
}
function Fr(e) {
  let {
    callback: t,
    disabled: n
  } = e;
  const r = ct(t), o = A(() => {
    if (n || typeof window > "u" || typeof window.MutationObserver > "u")
      return;
    const {
      MutationObserver: i
    } = window;
    return new i(r);
  }, [r, n]);
  return O(() => () => o == null ? void 0 : o.disconnect(), [o]), o;
}
function dt(e) {
  let {
    callback: t,
    disabled: n
  } = e;
  const r = ct(t), o = A(
    () => {
      if (n || typeof window > "u" || typeof window.ResizeObserver > "u")
        return;
      const {
        ResizeObserver: i
      } = window;
      return new i(r);
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [n]
  );
  return O(() => () => o == null ? void 0 : o.disconnect(), [o]), o;
}
function $r(e) {
  return new It(Ce(e), e);
}
function qt(e, t, n) {
  t === void 0 && (t = $r);
  const [r, o] = St(a, null), i = Fr({
    callback(l) {
      if (e)
        for (const c of l) {
          const {
            type: u,
            target: d
          } = c;
          if (u === "childList" && d instanceof HTMLElement && d.contains(e)) {
            o();
            break;
          }
        }
    }
  }), s = dt({
    callback: o
  });
  return q(() => {
    o(), e ? (s == null || s.observe(e), i == null || i.observe(document.body, {
      childList: !0,
      subtree: !0
    })) : (s == null || s.disconnect(), i == null || i.disconnect());
  }, [e]), r;
  function a(l) {
    if (!e)
      return null;
    if (e.isConnected === !1) {
      var c;
      return (c = l ?? n) != null ? c : null;
    }
    const u = t(e);
    return JSON.stringify(l) === JSON.stringify(u) ? l : u;
  }
}
function Xr(e) {
  const t = At(e);
  return tn(e, t);
}
const Jt = [];
function Yr(e) {
  const t = N(e), n = Ye((r) => e ? r && r !== Jt && e && t.current && e.parentNode === t.current.parentNode ? r : Et(e) : Jt, [e]);
  return O(() => {
    t.current = e;
  }, [e]), n;
}
function Kr(e) {
  const [t, n] = B(null), r = N(e), o = F((i) => {
    const s = pt(i.target);
    s && n((a) => a ? (a.set(s, wt(s)), new Map(a)) : null);
  }, []);
  return O(() => {
    const i = r.current;
    if (e !== i) {
      s(i);
      const a = e.map((l) => {
        const c = pt(l);
        return c ? (c.addEventListener("scroll", o, {
          passive: !0
        }), [c, wt(c)]) : null;
      }).filter((l) => l != null);
      n(a.length ? new Map(a) : null), r.current = e;
    }
    return () => {
      s(e), s(i);
    };
    function s(a) {
      a.forEach((l) => {
        const c = pt(l);
        c == null || c.removeEventListener("scroll", o);
      });
    }
  }, [o, e]), A(() => e.length ? t ? Array.from(t.values()).reduce((i, s) => xe(i, s), Z) : cn(e) : Z, [e, t]);
}
function Gt(e, t) {
  t === void 0 && (t = []);
  const n = N(null);
  return O(
    () => {
      n.current = null;
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    t
  ), O(() => {
    const r = e !== Z;
    r && !n.current && (n.current = e), !r && n.current && (n.current = null);
  }, [e]), n.current ? ot(e, n.current) : Z;
}
function Hr(e) {
  O(
    () => {
      if (!lt)
        return;
      const t = e.map((n) => {
        let {
          sensor: r
        } = n;
        return r.setup == null ? void 0 : r.setup();
      });
      return () => {
        for (const n of t)
          n == null || n();
      };
    },
    // TO-DO: Sensors length could theoretically change which would not be a valid dependency
    // eslint-disable-next-line react-hooks/exhaustive-deps
    e.map((t) => {
      let {
        sensor: n
      } = t;
      return n;
    })
  );
}
function Wr(e, t) {
  return A(() => e.reduce((n, r) => {
    let {
      eventName: o,
      handler: i
    } = r;
    return n[o] = (s) => {
      i(s, t);
    }, n;
  }, {}), [e, t]);
}
function hn(e) {
  return A(() => e ? pr(e) : null, [e]);
}
const yt = [];
function Ur(e, t) {
  t === void 0 && (t = Ce);
  const [n] = e, r = hn(n ? $(n) : null), [o, i] = St(a, yt), s = dt({
    callback: i
  });
  return e.length > 0 && o === yt && i(), q(() => {
    e.length ? e.forEach((l) => s == null ? void 0 : s.observe(l)) : (s == null || s.disconnect(), i());
  }, [e]), o;
  function a() {
    return e.length ? e.map((l) => an(l) ? r : new It(t(l), l)) : yt;
  }
}
function vn(e) {
  if (!e)
    return null;
  if (e.children.length > 1)
    return e;
  const t = e.children[0];
  return Xe(t) ? t : e;
}
function Vr(e) {
  let {
    measure: t
  } = e;
  const [n, r] = B(null), o = F((c) => {
    for (const {
      target: u
    } of c)
      if (Xe(u)) {
        r((d) => {
          const g = t(u);
          return d ? {
            ...d,
            width: g.width,
            height: g.height
          } : g;
        });
        break;
      }
  }, [t]), i = dt({
    callback: o
  }), s = F((c) => {
    const u = vn(c);
    i == null || i.disconnect(), u && (i == null || i.observe(u)), r(u ? t(u) : null);
  }, [t, i]), [a, l] = nt(s);
  return A(() => ({
    nodeRef: a,
    rect: n,
    setRef: l
  }), [n, a, l]);
}
const qr = [{
  sensor: gn,
  options: {}
}, {
  sensor: fn,
  options: {}
}], Jr = {
  current: {}
}, tt = {
  draggable: {
    measure: Kt
  },
  droppable: {
    measure: Kt,
    strategy: Fe.WhileDragging,
    frequency: Dt.Optimized
  },
  dragOverlay: {
    measure: Ce
  }
};
class Pe extends Map {
  get(t) {
    var n;
    return t != null && (n = super.get(t)) != null ? n : void 0;
  }
  toArray() {
    return Array.from(this.values());
  }
  getEnabled() {
    return this.toArray().filter((t) => {
      let {
        disabled: n
      } = t;
      return !n;
    });
  }
  getNodeFor(t) {
    var n, r;
    return (n = (r = this.get(t)) == null ? void 0 : r.node.current) != null ? n : void 0;
  }
}
const Gr = {
  activatorEvent: null,
  active: null,
  activeNode: null,
  activeNodeRect: null,
  collisions: null,
  containerNodeRect: null,
  draggableNodes: /* @__PURE__ */ new Map(),
  droppableRects: /* @__PURE__ */ new Map(),
  droppableContainers: /* @__PURE__ */ new Pe(),
  over: null,
  dragOverlay: {
    nodeRef: {
      current: null
    },
    rect: null,
    setRef: st
  },
  scrollableAncestors: [],
  scrollableAncestorRects: [],
  measuringConfiguration: tt,
  measureDroppableContainers: st,
  windowRect: null,
  measuringScheduled: !1
}, pn = {
  activatorEvent: null,
  activators: [],
  active: null,
  activeNodeRect: null,
  ariaDescribedById: {
    draggable: ""
  },
  dispatch: st,
  draggableNodes: /* @__PURE__ */ new Map(),
  over: null,
  measureDroppableContainers: st
}, He = /* @__PURE__ */ $e(pn), bn = /* @__PURE__ */ $e(Gr);
function _r() {
  return {
    draggable: {
      active: null,
      initialCoordinates: {
        x: 0,
        y: 0
      },
      nodes: /* @__PURE__ */ new Map(),
      translate: {
        x: 0,
        y: 0
      }
    },
    droppable: {
      containers: new Pe()
    }
  };
}
function Qr(e, t) {
  switch (t.type) {
    case z.DragStart:
      return {
        ...e,
        draggable: {
          ...e.draggable,
          initialCoordinates: t.initialCoordinates,
          active: t.active
        }
      };
    case z.DragMove:
      return e.draggable.active ? {
        ...e,
        draggable: {
          ...e.draggable,
          translate: {
            x: t.coordinates.x - e.draggable.initialCoordinates.x,
            y: t.coordinates.y - e.draggable.initialCoordinates.y
          }
        }
      } : e;
    case z.DragEnd:
    case z.DragCancel:
      return {
        ...e,
        draggable: {
          ...e.draggable,
          active: null,
          initialCoordinates: {
            x: 0,
            y: 0
          },
          translate: {
            x: 0,
            y: 0
          }
        }
      };
    case z.RegisterDroppable: {
      const {
        element: n
      } = t, {
        id: r
      } = n, o = new Pe(e.droppable.containers);
      return o.set(r, n), {
        ...e,
        droppable: {
          ...e.droppable,
          containers: o
        }
      };
    }
    case z.SetDroppableDisabled: {
      const {
        id: n,
        key: r,
        disabled: o
      } = t, i = e.droppable.containers.get(n);
      if (!i || r !== i.key)
        return e;
      const s = new Pe(e.droppable.containers);
      return s.set(n, {
        ...i,
        disabled: o
      }), {
        ...e,
        droppable: {
          ...e.droppable,
          containers: s
        }
      };
    }
    case z.UnregisterDroppable: {
      const {
        id: n,
        key: r
      } = t, o = e.droppable.containers.get(n);
      if (!o || r !== o.key)
        return e;
      const i = new Pe(e.droppable.containers);
      return i.delete(n), {
        ...e,
        droppable: {
          ...e.droppable,
          containers: i
        }
      };
    }
    default:
      return e;
  }
}
function Zr(e) {
  let {
    disabled: t
  } = e;
  const {
    active: n,
    activatorEvent: r,
    draggableNodes: o
  } = de(He), i = rt(r), s = rt(n == null ? void 0 : n.id);
  return O(() => {
    if (!t && !r && i && s != null) {
      if (!ut(i) || document.activeElement === i.target)
        return;
      const a = o.get(s);
      if (!a)
        return;
      const {
        activatorNode: l,
        node: c
      } = a;
      if (!l.current && !c.current)
        return;
      requestAnimationFrame(() => {
        for (const u of [l.current, c.current]) {
          if (!u)
            continue;
          const d = Un(u);
          if (d) {
            d.focus();
            break;
          }
        }
      });
    }
  }, [r, t, o, s, i]), null;
}
function mn(e, t) {
  let {
    transform: n,
    ...r
  } = t;
  return e != null && e.length ? e.reduce((o, i) => i({
    transform: o,
    ...r
  }), n) : n;
}
function eo(e) {
  return A(
    () => ({
      draggable: {
        ...tt.draggable,
        ...e == null ? void 0 : e.draggable
      },
      droppable: {
        ...tt.droppable,
        ...e == null ? void 0 : e.droppable
      },
      dragOverlay: {
        ...tt.dragOverlay,
        ...e == null ? void 0 : e.dragOverlay
      }
    }),
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [e == null ? void 0 : e.draggable, e == null ? void 0 : e.droppable, e == null ? void 0 : e.dragOverlay]
  );
}
function to(e) {
  let {
    activeNode: t,
    measure: n,
    initialRect: r,
    config: o = !0
  } = e;
  const i = N(!1), {
    x: s,
    y: a
  } = typeof o == "boolean" ? {
    x: o,
    y: o
  } : o;
  q(() => {
    if (!s && !a || !t) {
      i.current = !1;
      return;
    }
    if (i.current || !r)
      return;
    const c = t == null ? void 0 : t.node.current;
    if (!c || c.isConnected === !1)
      return;
    const u = n(c), d = tn(u, r);
    if (s || (d.x = 0), a || (d.y = 0), i.current = !0, Math.abs(d.x) > 0 || Math.abs(d.y) > 0) {
      const g = rn(c);
      g && g.scrollBy({
        top: d.y,
        left: d.x
      });
    }
  }, [t, s, a, r, n]);
}
const ft = /* @__PURE__ */ $e({
  ...Z,
  scaleX: 1,
  scaleY: 1
});
var ue;
(function(e) {
  e[e.Uninitialized = 0] = "Uninitialized", e[e.Initializing = 1] = "Initializing", e[e.Initialized = 2] = "Initialized";
})(ue || (ue = {}));
const no = /* @__PURE__ */ Ln(function(t) {
  var n, r, o, i;
  let {
    id: s,
    accessibility: a,
    autoScroll: l = !0,
    children: c,
    sensors: u = qr,
    collisionDetection: d = ur,
    measuring: g,
    modifiers: f,
    ...p
  } = t;
  const h = St(Qr, void 0, _r), [v, b] = h, [w, m] = Zn(), [D, S] = B(ue.Uninitialized), C = D === ue.Initialized, {
    draggable: {
      active: y,
      nodes: x,
      translate: T
    },
    droppable: {
      containers: L
    }
  } = v, I = y ? x.get(y) : null, J = N({
    initial: null,
    translated: null
  }), G = A(() => {
    var j;
    return y != null ? {
      id: y,
      // It's possible for the active node to unmount while dragging
      data: (j = I == null ? void 0 : I.data) != null ? j : Jr,
      rect: J
    } : null;
  }, [y, I]), ee = N(null), [Re, We] = B(null), [Y, Ue] = B(null), ge = Be(p, Object.values(p)), Ee = Ke("DndDescribedBy", s), Ve = A(() => L.getEnabled(), [L]), X = eo(g), {
    droppableRects: re,
    measureDroppableContainers: he,
    measuringScheduled: Ie
  } = Pr(Ve, {
    dragging: C,
    dependencies: [T.x, T.y],
    config: X.droppable
  }), W = kr(x, y), qe = A(() => Y ? it(Y) : null, [Y]), se = Tn(), oe = Br(W, X.draggable.measure);
  to({
    activeNode: y ? x.get(y) : null,
    config: se.layoutShiftCompensation,
    initialRect: oe,
    measure: X.draggable.measure
  });
  const E = qt(W, X.draggable.measure, oe), Oe = qt(W ? W.parentElement : null), te = N({
    activatorEvent: null,
    active: null,
    activeNode: W,
    collisionRect: null,
    collisions: null,
    droppableRects: re,
    draggableNodes: x,
    draggingNode: null,
    draggingNodeRect: null,
    droppableContainers: L,
    over: null,
    scrollableAncestors: [],
    scrollAdjustedTranslate: null
  }), ve = L.getNodeFor((n = te.current.over) == null ? void 0 : n.id), ie = Vr({
    measure: X.dragOverlay.measure
  }), pe = (r = ie.nodeRef.current) != null ? r : W, be = C ? (o = ie.rect) != null ? o : E : null, Tt = !!(ie.nodeRef.current && ie.rect), Mt = Xr(Tt ? null : E), gt = hn(pe ? $(pe) : null), ae = Yr(C ? ve ?? W : null), Je = Ur(ae), Ge = mn(f, {
    transform: {
      x: T.x - Mt.x,
      y: T.y - Mt.y,
      scaleX: 1,
      scaleY: 1
    },
    activatorEvent: Y,
    active: G,
    activeNodeRect: E,
    containerNodeRect: Oe,
    draggingNodeRect: be,
    over: te.current.over,
    overlayNodeRect: ie.rect,
    scrollableAncestors: ae,
    scrollableAncestorRects: Je,
    windowRect: gt
  }), Lt = qe ? xe(qe, T) : null, zt = Kr(ae), Cn = Gt(zt), Rn = Gt(zt, [E]), me = xe(Ge, Cn), ye = be ? gr(be, Ge) : null, Ae = G && ye ? d({
    active: G,
    collisionRect: ye,
    droppableRects: re,
    droppableContainers: Ve,
    pointerCoordinates: Lt
  }) : null, kt = ar(Ae, "id"), [le, jt] = B(null), En = Tt ? Ge : xe(Ge, Rn), In = dr(En, (i = le == null ? void 0 : le.rect) != null ? i : null, E), Pt = F(
    (j, K) => {
      let {
        sensor: H,
        options: ce
      } = K;
      if (ee.current == null)
        return;
      const U = x.get(ee.current);
      if (!U)
        return;
      const _ = j.nativeEvent, ne = new H({
        active: ee.current,
        activeNode: U,
        event: _,
        options: ce,
        // Sensors need to be instantiated with refs for arguments that change over time
        // otherwise they are frozen in time with the stale arguments
        context: te,
        onStart(Q) {
          const Ne = ee.current;
          if (Ne == null)
            return;
          const Te = x.get(Ne);
          if (!Te)
            return;
          const {
            onDragStart: _e
          } = ge.current, Qe = {
            active: {
              id: Ne,
              data: Te.data,
              rect: J
            }
          };
          ze(() => {
            _e == null || _e(Qe), S(ue.Initializing), b({
              type: z.DragStart,
              initialCoordinates: Q,
              active: Ne
            }), w({
              type: "onDragStart",
              event: Qe
            });
          });
        },
        onMove(Q) {
          b({
            type: z.DragMove,
            coordinates: Q
          });
        },
        onEnd: we(z.DragEnd),
        onCancel: we(z.DragCancel)
      });
      ze(() => {
        We(ne), Ue(j.nativeEvent);
      });
      function we(Q) {
        return async function() {
          const {
            active: Te,
            collisions: _e,
            over: Qe,
            scrollAdjustedTranslate: Ft
          } = te.current;
          let Me = null;
          if (Te && Ft) {
            const {
              cancelDrop: Le
            } = ge.current;
            Me = {
              activatorEvent: _,
              active: Te,
              collisions: _e,
              delta: Ft,
              over: Qe
            }, Q === z.DragEnd && typeof Le == "function" && await Promise.resolve(Le(Me)) && (Q = z.DragCancel);
          }
          ee.current = null, ze(() => {
            b({
              type: Q
            }), S(ue.Uninitialized), jt(null), We(null), Ue(null);
            const Le = Q === z.DragEnd ? "onDragEnd" : "onDragCancel";
            if (Me) {
              const ht = ge.current[Le];
              ht == null || ht(Me), w({
                type: Le,
                event: Me
              });
            }
          });
        };
      }
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [x]
  ), On = F((j, K) => (H, ce) => {
    const U = H.nativeEvent, _ = x.get(ce);
    if (
      // Another sensor is already instantiating
      ee.current !== null || // No active draggable
      !_ || // Event has already been captured
      U.dndKit || U.defaultPrevented
    )
      return;
    const ne = {
      active: _
    };
    j(H, K.options, ne) === !0 && (U.dndKit = {
      capturedBy: K.sensor
    }, ee.current = ce, Pt(H, K));
  }, [x, Pt]), Bt = jr(u, On);
  Hr(u), q(() => {
    E && D === ue.Initializing && S(ue.Initialized);
  }, [E, D]), O(
    () => {
      const {
        onDragMove: j
      } = ge.current, {
        active: K,
        activatorEvent: H,
        collisions: ce,
        over: U
      } = te.current;
      if (!K || !H)
        return;
      const _ = {
        active: K,
        activatorEvent: H,
        collisions: ce,
        delta: {
          x: me.x,
          y: me.y
        },
        over: U
      };
      ze(() => {
        j == null || j(_), w({
          type: "onDragMove",
          event: _
        });
      });
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [me.x, me.y]
  ), O(
    () => {
      const {
        active: j,
        activatorEvent: K,
        collisions: H,
        droppableContainers: ce,
        scrollAdjustedTranslate: U
      } = te.current;
      if (!j || ee.current == null || !K || !U)
        return;
      const {
        onDragOver: _
      } = ge.current, ne = ce.get(kt), we = ne && ne.rect.current ? {
        id: ne.id,
        rect: ne.rect.current,
        data: ne.data,
        disabled: ne.disabled
      } : null, Q = {
        active: j,
        activatorEvent: K,
        collisions: H,
        delta: {
          x: U.x,
          y: U.y
        },
        over: we
      };
      ze(() => {
        jt(we), _ == null || _(Q), w({
          type: "onDragOver",
          event: Q
        });
      });
    },
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [kt]
  ), q(() => {
    te.current = {
      activatorEvent: Y,
      active: G,
      activeNode: W,
      collisionRect: ye,
      collisions: Ae,
      droppableRects: re,
      draggableNodes: x,
      draggingNode: pe,
      draggingNodeRect: be,
      droppableContainers: L,
      over: le,
      scrollableAncestors: ae,
      scrollAdjustedTranslate: me
    }, J.current = {
      initial: be,
      translated: ye
    };
  }, [G, W, Ae, ye, x, pe, be, re, L, le, ae, me]), Mr({
    ...se,
    delta: T,
    draggingRect: ye,
    pointerCoordinates: Lt,
    scrollableAncestors: ae,
    scrollableAncestorRects: Je
  });
  const An = A(() => ({
    active: G,
    activeNode: W,
    activeNodeRect: E,
    activatorEvent: Y,
    collisions: Ae,
    containerNodeRect: Oe,
    dragOverlay: ie,
    draggableNodes: x,
    droppableContainers: L,
    droppableRects: re,
    over: le,
    measureDroppableContainers: he,
    scrollableAncestors: ae,
    scrollableAncestorRects: Je,
    measuringConfiguration: X,
    measuringScheduled: Ie,
    windowRect: gt
  }), [G, W, E, Y, Ae, Oe, ie, x, L, re, le, he, ae, Je, X, Ie, gt]), Nn = A(() => ({
    activatorEvent: Y,
    activators: Bt,
    active: G,
    activeNodeRect: E,
    ariaDescribedById: {
      draggable: Ee
    },
    dispatch: b,
    draggableNodes: x,
    over: le,
    measureDroppableContainers: he
  }), [Y, Bt, G, E, b, Ee, x, le, he]);
  return M.createElement(en.Provider, {
    value: m
  }, M.createElement(He.Provider, {
    value: Nn
  }, M.createElement(bn.Provider, {
    value: An
  }, M.createElement(ft.Provider, {
    value: In
  }, c)), M.createElement(Zr, {
    disabled: (a == null ? void 0 : a.restoreFocus) === !1
  })), M.createElement(nr, {
    ...a,
    hiddenTextDescribedById: Ee
  }));
  function Tn() {
    const j = (Re == null ? void 0 : Re.autoScrollEnabled) === !1, K = typeof l == "object" ? l.enabled === !1 : l === !1, H = C && !j && !K;
    return typeof l == "object" ? {
      ...l,
      enabled: H
    } : {
      enabled: H
    };
  }
}), ro = /* @__PURE__ */ $e(null), _t = "button", oo = "Droppable";
function io(e) {
  let {
    id: t,
    data: n,
    disabled: r = !1,
    attributes: o
  } = e;
  const i = Ke(oo), {
    activators: s,
    activatorEvent: a,
    active: l,
    activeNodeRect: c,
    ariaDescribedById: u,
    draggableNodes: d,
    over: g
  } = de(He), {
    role: f = _t,
    roleDescription: p = "draggable",
    tabIndex: h = 0
  } = o ?? {}, v = (l == null ? void 0 : l.id) === t, b = de(v ? ft : ro), [w, m] = nt(), [D, S] = nt(), C = Wr(s, t), y = Be(n);
  q(
    () => (d.set(t, {
      id: t,
      key: i,
      node: w,
      activatorNode: D,
      data: y
    }), () => {
      const T = d.get(t);
      T && T.key === i && d.delete(t);
    }),
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [d, t]
  );
  const x = A(() => ({
    role: f,
    tabIndex: h,
    "aria-disabled": r,
    "aria-pressed": v && f === _t ? !0 : void 0,
    "aria-roledescription": p,
    "aria-describedby": u.draggable
  }), [r, f, h, v, p, u.draggable]);
  return {
    active: l,
    activatorEvent: a,
    activeNodeRect: c,
    attributes: x,
    isDragging: v,
    listeners: r ? void 0 : C,
    node: w,
    over: g,
    setNodeRef: m,
    setActivatorNodeRef: S,
    transform: b
  };
}
function yn() {
  return de(bn);
}
const so = "Droppable", ao = {
  timeout: 25
};
function lo(e) {
  let {
    data: t,
    disabled: n = !1,
    id: r,
    resizeObserverConfig: o
  } = e;
  const i = Ke(so), {
    active: s,
    dispatch: a,
    over: l,
    measureDroppableContainers: c
  } = de(He), u = N({
    disabled: n
  }), d = N(!1), g = N(null), f = N(null), {
    disabled: p,
    updateMeasurementsFor: h,
    timeout: v
  } = {
    ...ao,
    ...o
  }, b = Be(h ?? r), w = F(
    () => {
      if (!d.current) {
        d.current = !0;
        return;
      }
      f.current != null && clearTimeout(f.current), f.current = setTimeout(() => {
        c(Array.isArray(b.current) ? b.current : [b.current]), f.current = null;
      }, v);
    },
    //eslint-disable-next-line react-hooks/exhaustive-deps
    [v]
  ), m = dt({
    callback: w,
    disabled: p || !s
  }), D = F((x, T) => {
    m && (T && (m.unobserve(T), d.current = !1), x && m.observe(x));
  }, [m]), [S, C] = nt(D), y = Be(t);
  return O(() => {
    !m || !S.current || (m.disconnect(), d.current = !1, m.observe(S.current));
  }, [S, m]), q(
    () => (a({
      type: z.RegisterDroppable,
      element: {
        id: r,
        key: i,
        disabled: n,
        node: S,
        rect: g,
        data: y
      }
    }), () => a({
      type: z.UnregisterDroppable,
      key: i,
      id: r
    })),
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [r]
  ), O(() => {
    n !== u.current.disabled && (a({
      type: z.SetDroppableDisabled,
      id: r,
      key: i,
      disabled: n
    }), u.current.disabled = n);
  }, [r, i, n, a]), {
    active: s,
    rect: g,
    isOver: (l == null ? void 0 : l.id) === r,
    node: S,
    over: l,
    setNodeRef: C
  };
}
function co(e) {
  let {
    animation: t,
    children: n
  } = e;
  const [r, o] = B(null), [i, s] = B(null), a = rt(n);
  return !n && !r && a && o(a), q(() => {
    if (!i)
      return;
    const l = r == null ? void 0 : r.key, c = r == null ? void 0 : r.props.id;
    if (l == null || c == null) {
      o(null);
      return;
    }
    Promise.resolve(t(c, i)).then(() => {
      o(null);
    });
  }, [t, r, i]), M.createElement(M.Fragment, null, n, r ? kn(r, {
    ref: s
  }) : null);
}
const uo = {
  x: 0,
  y: 0,
  scaleX: 1,
  scaleY: 1
};
function fo(e) {
  let {
    children: t
  } = e;
  return M.createElement(He.Provider, {
    value: pn
  }, M.createElement(ft.Provider, {
    value: uo
  }, t));
}
const go = {
  position: "fixed",
  touchAction: "none"
}, ho = (e) => ut(e) ? "transform 250ms ease" : void 0, vo = /* @__PURE__ */ jn((e, t) => {
  let {
    as: n,
    activatorEvent: r,
    adjustScale: o,
    children: i,
    className: s,
    rect: a,
    style: l,
    transform: c,
    transition: u = ho
  } = e;
  if (!a)
    return null;
  const d = o ? c : {
    ...c,
    scaleX: 1,
    scaleY: 1
  }, g = {
    ...go,
    width: a.width,
    height: a.height,
    top: a.top,
    left: a.left,
    transform: fe.Transform.toString(d),
    transformOrigin: o && r ? or(r, a) : void 0,
    transition: typeof u == "function" ? u(r) : u,
    ...l
  };
  return M.createElement(n, {
    className: s,
    style: g,
    ref: t
  }, i);
}), po = (e) => (t) => {
  let {
    active: n,
    dragOverlay: r
  } = t;
  const o = {}, {
    styles: i,
    className: s
  } = e;
  if (i != null && i.active)
    for (const [a, l] of Object.entries(i.active))
      l !== void 0 && (o[a] = n.node.style.getPropertyValue(a), n.node.style.setProperty(a, l));
  if (i != null && i.dragOverlay)
    for (const [a, l] of Object.entries(i.dragOverlay))
      l !== void 0 && r.node.style.setProperty(a, l);
  return s != null && s.active && n.node.classList.add(s.active), s != null && s.dragOverlay && r.node.classList.add(s.dragOverlay), function() {
    for (const [l, c] of Object.entries(o))
      n.node.style.setProperty(l, c);
    s != null && s.active && n.node.classList.remove(s.active);
  };
}, bo = (e) => {
  let {
    transform: {
      initial: t,
      final: n
    }
  } = e;
  return [{
    transform: fe.Transform.toString(t)
  }, {
    transform: fe.Transform.toString(n)
  }];
}, mo = {
  duration: 250,
  easing: "ease",
  keyframes: bo,
  sideEffects: /* @__PURE__ */ po({
    styles: {
      active: {
        opacity: "0"
      }
    }
  })
};
function yo(e) {
  let {
    config: t,
    draggableNodes: n,
    droppableContainers: r,
    measuringConfiguration: o
  } = e;
  return ct((i, s) => {
    if (t === null)
      return;
    const a = n.get(i);
    if (!a)
      return;
    const l = a.node.current;
    if (!l)
      return;
    const c = vn(s);
    if (!c)
      return;
    const {
      transform: u
    } = $(s).getComputedStyle(s), d = nn(u);
    if (!d)
      return;
    const g = typeof t == "function" ? t : wo(t);
    return un(l, o.draggable.measure), g({
      active: {
        id: i,
        data: a.data,
        node: l,
        rect: o.draggable.measure(l)
      },
      draggableNodes: n,
      dragOverlay: {
        node: s,
        rect: o.dragOverlay.measure(c)
      },
      droppableContainers: r,
      measuringConfiguration: o,
      transform: d
    });
  });
}
function wo(e) {
  const {
    duration: t,
    easing: n,
    sideEffects: r,
    keyframes: o
  } = {
    ...mo,
    ...e
  };
  return (i) => {
    let {
      active: s,
      dragOverlay: a,
      transform: l,
      ...c
    } = i;
    if (!t)
      return;
    const u = {
      x: a.rect.left - s.rect.left,
      y: a.rect.top - s.rect.top
    }, d = {
      scaleX: l.scaleX !== 1 ? s.rect.width * l.scaleX / a.rect.width : 1,
      scaleY: l.scaleY !== 1 ? s.rect.height * l.scaleY / a.rect.height : 1
    }, g = {
      x: l.x - u.x,
      y: l.y - u.y,
      ...d
    }, f = o({
      ...c,
      active: s,
      dragOverlay: a,
      transform: {
        initial: l,
        final: g
      }
    }), [p] = f, h = f[f.length - 1];
    if (JSON.stringify(p) === JSON.stringify(h))
      return;
    const v = r == null ? void 0 : r({
      active: s,
      dragOverlay: a,
      ...c
    }), b = a.node.animate(f, {
      duration: t,
      easing: n,
      fill: "forwards"
    });
    return new Promise((w) => {
      b.onfinish = () => {
        v == null || v(), w();
      };
    });
  };
}
let Qt = 0;
function xo(e) {
  return A(() => {
    if (e != null)
      return Qt++, Qt;
  }, [e]);
}
const Do = /* @__PURE__ */ M.memo((e) => {
  let {
    adjustScale: t = !1,
    children: n,
    dropAnimation: r,
    style: o,
    transition: i,
    modifiers: s,
    wrapperElement: a = "div",
    className: l,
    zIndex: c = 999
  } = e;
  const {
    activatorEvent: u,
    active: d,
    activeNodeRect: g,
    containerNodeRect: f,
    draggableNodes: p,
    droppableContainers: h,
    dragOverlay: v,
    over: b,
    measuringConfiguration: w,
    scrollableAncestors: m,
    scrollableAncestorRects: D,
    windowRect: S
  } = yn(), C = de(ft), y = xo(d == null ? void 0 : d.id), x = mn(s, {
    activatorEvent: u,
    active: d,
    activeNodeRect: g,
    containerNodeRect: f,
    draggingNodeRect: v.rect,
    over: b,
    overlayNodeRect: v.rect,
    scrollableAncestors: m,
    scrollableAncestorRects: D,
    transform: C,
    windowRect: S
  }), T = At(g), L = yo({
    config: r,
    draggableNodes: p,
    droppableContainers: h,
    measuringConfiguration: w
  }), I = T ? v.setRef : void 0;
  return M.createElement(fo, null, M.createElement(co, {
    animation: L
  }, d && y ? M.createElement(vo, {
    key: y,
    id: d.id,
    ref: I,
    as: a,
    activatorEvent: u,
    adjustScale: t,
    className: l,
    transition: i,
    rect: T,
    style: {
      zIndex: c,
      ...o
    },
    transform: x
  }, n) : null));
});
function Nt(e, t, n) {
  const r = e.slice();
  return r.splice(n < 0 ? r.length + n : n, 0, r.splice(t, 1)[0]), r;
}
function So(e, t) {
  return e.reduce((n, r, o) => {
    const i = t.get(r);
    return i && (n[o] = i), n;
  }, Array(e.length));
}
function Ze(e) {
  return e !== null && e >= 0;
}
function Co(e, t) {
  if (e === t)
    return !0;
  if (e.length !== t.length)
    return !1;
  for (let n = 0; n < e.length; n++)
    if (e[n] !== t[n])
      return !1;
  return !0;
}
function Ro(e) {
  return typeof e == "boolean" ? {
    draggable: e,
    droppable: e
  } : e;
}
const wn = (e) => {
  let {
    rects: t,
    activeIndex: n,
    overIndex: r,
    index: o
  } = e;
  const i = Nt(t, r, n), s = t[o], a = i[o];
  return !a || !s ? null : {
    x: a.left - s.left,
    y: a.top - s.top,
    scaleX: a.width / s.width,
    scaleY: a.height / s.height
  };
}, et = {
  scaleX: 1,
  scaleY: 1
}, Eo = (e) => {
  var t;
  let {
    activeIndex: n,
    activeNodeRect: r,
    index: o,
    rects: i,
    overIndex: s
  } = e;
  const a = (t = i[n]) != null ? t : r;
  if (!a)
    return null;
  if (o === n) {
    const c = i[s];
    return c ? {
      x: 0,
      y: n < s ? c.top + c.height - (a.top + a.height) : c.top - a.top,
      ...et
    } : null;
  }
  const l = Io(i, o, n);
  return o > n && o <= s ? {
    x: 0,
    y: -a.height - l,
    ...et
  } : o < n && o >= s ? {
    x: 0,
    y: a.height + l,
    ...et
  } : {
    x: 0,
    y: 0,
    ...et
  };
};
function Io(e, t, n) {
  const r = e[t], o = e[t - 1], i = e[t + 1];
  return r ? n < t ? o ? r.top - (o.top + o.height) : i ? i.top - (r.top + r.height) : 0 : i ? i.top - (r.top + r.height) : o ? r.top - (o.top + o.height) : 0 : 0;
}
const xn = "Sortable", Dn = /* @__PURE__ */ M.createContext({
  activeIndex: -1,
  containerId: xn,
  disableTransforms: !1,
  items: [],
  overIndex: -1,
  useDragOverlay: !1,
  sortedRects: [],
  strategy: wn,
  disabled: {
    draggable: !1,
    droppable: !1
  }
});
function Oo(e) {
  let {
    children: t,
    id: n,
    items: r,
    strategy: o = wn,
    disabled: i = !1
  } = e;
  const {
    active: s,
    dragOverlay: a,
    droppableRects: l,
    over: c,
    measureDroppableContainers: u
  } = yn(), d = Ke(xn, n), g = a.rect !== null, f = A(() => r.map((C) => typeof C == "object" && "id" in C ? C.id : C), [r]), p = s != null, h = s ? f.indexOf(s.id) : -1, v = c ? f.indexOf(c.id) : -1, b = N(f), w = !Co(f, b.current), m = v !== -1 && h === -1 || w, D = Ro(i);
  q(() => {
    w && p && u(f);
  }, [w, f, p, u]), O(() => {
    b.current = f;
  }, [f]);
  const S = A(
    () => ({
      activeIndex: h,
      containerId: d,
      disabled: D,
      disableTransforms: m,
      items: f,
      overIndex: v,
      useDragOverlay: g,
      sortedRects: So(f, l),
      strategy: o
    }),
    // eslint-disable-next-line react-hooks/exhaustive-deps
    [h, d, D.draggable, D.droppable, m, f, v, l, g, o]
  );
  return M.createElement(Dn.Provider, {
    value: S
  }, t);
}
const Ao = (e) => {
  let {
    id: t,
    items: n,
    activeIndex: r,
    overIndex: o
  } = e;
  return Nt(n, r, o).indexOf(t);
}, No = (e) => {
  let {
    containerId: t,
    isSorting: n,
    wasDragging: r,
    index: o,
    items: i,
    newIndex: s,
    previousItems: a,
    previousContainerId: l,
    transition: c
  } = e;
  return !c || !r || a !== i && o === s ? !1 : n ? !0 : s !== o && t === l;
}, To = {
  duration: 200,
  easing: "ease"
}, Sn = "transform", Mo = /* @__PURE__ */ fe.Transition.toString({
  property: Sn,
  duration: 0,
  easing: "linear"
}), Lo = {
  roleDescription: "sortable"
};
function zo(e) {
  let {
    disabled: t,
    index: n,
    node: r,
    rect: o
  } = e;
  const [i, s] = B(null), a = N(n);
  return q(() => {
    if (!t && n !== a.current && r.current) {
      const l = o.current;
      if (l) {
        const c = Ce(r.current, {
          ignoreTransform: !0
        }), u = {
          x: l.left - c.left,
          y: l.top - c.top,
          scaleX: l.width / c.width,
          scaleY: l.height / c.height
        };
        (u.x || u.y) && s(u);
      }
    }
    n !== a.current && (a.current = n);
  }, [t, n, r, o]), O(() => {
    i && s(null);
  }, [i]), i;
}
function ko(e) {
  let {
    animateLayoutChanges: t = No,
    attributes: n,
    disabled: r,
    data: o,
    getNewIndex: i = Ao,
    id: s,
    strategy: a,
    resizeObserverConfig: l,
    transition: c = To
  } = e;
  const {
    items: u,
    containerId: d,
    activeIndex: g,
    disabled: f,
    disableTransforms: p,
    sortedRects: h,
    overIndex: v,
    useDragOverlay: b,
    strategy: w
  } = de(Dn), m = jo(r, f), D = u.indexOf(s), S = A(() => ({
    sortable: {
      containerId: d,
      index: D,
      items: u
    },
    ...o
  }), [d, o, D, u]), C = A(() => u.slice(u.indexOf(s)), [u, s]), {
    rect: y,
    node: x,
    isOver: T,
    setNodeRef: L
  } = lo({
    id: s,
    data: S,
    disabled: m.droppable,
    resizeObserverConfig: {
      updateMeasurementsFor: C,
      ...l
    }
  }), {
    active: I,
    activatorEvent: J,
    activeNodeRect: G,
    attributes: ee,
    setNodeRef: Re,
    listeners: We,
    isDragging: Y,
    over: Ue,
    setActivatorNodeRef: ge,
    transform: Ee
  } = io({
    id: s,
    data: S,
    attributes: {
      ...Lo,
      ...n
    },
    disabled: m.draggable
  }), Ve = Xn(L, Re), X = !!I, re = X && !p && Ze(g) && Ze(v), he = !b && Y, Ie = he && re ? Ee : null, qe = re ? Ie ?? (a ?? w)({
    rects: h,
    activeNodeRect: G,
    activeIndex: g,
    overIndex: v,
    index: D
  }) : null, se = Ze(g) && Ze(v) ? i({
    id: s,
    items: u,
    activeIndex: g,
    overIndex: v
  }) : D, oe = I == null ? void 0 : I.id, E = N({
    activeId: oe,
    items: u,
    newIndex: se,
    containerId: d
  }), Oe = u !== E.current.items, te = t({
    active: I,
    containerId: d,
    isDragging: Y,
    isSorting: X,
    id: s,
    index: D,
    items: u,
    newIndex: E.current.newIndex,
    previousItems: E.current.items,
    previousContainerId: E.current.containerId,
    transition: c,
    wasDragging: E.current.activeId != null
  }), ve = zo({
    disabled: !te,
    index: D,
    node: x,
    rect: y
  });
  return O(() => {
    X && E.current.newIndex !== se && (E.current.newIndex = se), d !== E.current.containerId && (E.current.containerId = d), u !== E.current.items && (E.current.items = u);
  }, [X, se, d, u]), O(() => {
    if (oe === E.current.activeId)
      return;
    if (oe && !E.current.activeId) {
      E.current.activeId = oe;
      return;
    }
    const pe = setTimeout(() => {
      E.current.activeId = oe;
    }, 50);
    return () => clearTimeout(pe);
  }, [oe]), {
    active: I,
    activeIndex: g,
    attributes: ee,
    data: S,
    rect: y,
    index: D,
    newIndex: se,
    items: u,
    isOver: T,
    isSorting: X,
    isDragging: Y,
    listeners: We,
    node: x,
    overIndex: v,
    over: Ue,
    setNodeRef: Ve,
    setActivatorNodeRef: ge,
    setDroppableNodeRef: L,
    setDraggableNodeRef: Re,
    transform: ve ?? qe,
    transition: ie()
  };
  function ie() {
    if (
      // Temporarily disable transitions for a single frame to set up derived transforms
      ve || // Or to prevent items jumping to back to their "new" position when items change
      Oe && E.current.newIndex === D
    )
      return Mo;
    if (!(he && !ut(J) || !c) && (X || te))
      return fe.Transition.toString({
        ...c,
        property: Sn
      });
  }
}
function jo(e, t) {
  var n, r;
  return typeof e == "boolean" ? {
    draggable: e,
    // Backwards compatibility
    droppable: !1
  } : {
    draggable: (n = e == null ? void 0 : e.draggable) != null ? n : t.draggable,
    droppable: (r = e == null ? void 0 : e.droppable) != null ? r : t.droppable
  };
}
R.Down, R.Right, R.Up, R.Left;
const Po = ({
  setRef: e,
  isDragging: t,
  dragHandleAttributes: n,
  dragHandleListeners: r,
  dragHandleClass: o,
  style: i,
  separator: s,
  children: a
}) => /* @__PURE__ */ P.jsxs(
  "div",
  {
    ref: e,
    className: $t(
      "group flex w-full items-center gap-3 bg-white py-1",
      s && "border-b border-grey-200",
      t && "opacity-75"
    ),
    style: i,
    children: [
      /* @__PURE__ */ P.jsx(
        "button",
        {
          className: $t(
            "h-7 opacity-50 group-hover:opacity-100",
            t ? "cursor-grabbing" : "cursor-grab",
            o
          ),
          type: "button",
          ...n,
          ...r,
          children: /* @__PURE__ */ P.jsx($n, { colorClass: "text-grey-500", name: "hamburger", size: "sm" })
        }
      ),
      a
    ]
  }
), Bo = ({ id: e, children: t, separator: n, dragHandleClass: r, container: o }) => {
  const {
    attributes: i,
    listeners: s,
    setNodeRef: a,
    transform: l,
    transition: c
  } = ko({ id: e }), u = {
    transform: fe.Transform.toString(l),
    transition: c
  };
  return o({
    setRef: a,
    isDragging: !1,
    separator: n,
    dragHandleClass: r,
    dragHandleAttributes: i,
    dragHandleListeners: s,
    style: u,
    children: t
  });
}, $o = ({
  title: e,
  titleSeparator: t,
  hint: n,
  items: r,
  itemSeparator: o = !0,
  dragHandleClass: i,
  onMove: s,
  renderItem: a,
  container: l = (u) => /* @__PURE__ */ P.jsx(Po, { ...u }),
  ...c
}) => {
  const [u, d] = B(null);
  return r.length ? /* @__PURE__ */ P.jsxs("div", { ...c, children: [
    e && /* @__PURE__ */ P.jsx(Pn, { level: 6, separator: t, grey: !0, children: e }),
    /* @__PURE__ */ P.jsx("div", { className: `${e && t ? "-mt-2" : ""}`, children: /* @__PURE__ */ P.jsxs(
      no,
      {
        collisionDetection: lr,
        onDragEnd: (g) => {
          var f;
          return s(g.active.id, (f = g.over) == null ? void 0 : f.id);
        },
        onDragStart: (g) => d(g.active.id),
        children: [
          /* @__PURE__ */ P.jsx(
            Oo,
            {
              items: r,
              strategy: Eo,
              children: r.map((g) => /* @__PURE__ */ P.jsx(Bo, { container: l, dragHandleClass: i, id: g.id, separator: o, children: a(g) }, g.id))
            }
          ),
          /* @__PURE__ */ P.jsx(Do, { children: u ? l({
            isDragging: !0,
            children: a(r.find(({ id: g }) => g === u))
          }) : null })
        ]
      }
    ) }),
    n && /* @__PURE__ */ P.jsxs(P.Fragment, { children: [
      !o && /* @__PURE__ */ P.jsx(Bn, {}),
      /* @__PURE__ */ P.jsx(Fn, { children: n })
    ] })
  ] }) : /* @__PURE__ */ P.jsx(P.Fragment, {});
}, Xo = ({ items: e, setItems: t, blank: n, canAddNewItem: r }) => {
  const [o, i] = B(e.map((g, f) => ({ item: g, id: f.toString() }))), [s, a] = B(n);
  return O(() => {
    const g = o.map(({ item: f }) => f);
    r(s) && g.push(s), JSON.stringify(g) !== JSON.stringify(e) && t(g);
  }, [o, s, e, t, r]), {
    items: o,
    updateItem: (g, f) => {
      const p = o.map((h) => h.id === g ? { ...h, item: f } : h);
      i(p), t(p.map((h) => h.item));
    },
    addItem: () => {
      if (r(s)) {
        const g = o.reduce((p, h) => Math.max(p, parseInt(h.id)), 0), f = o.concat({ item: s, id: (g + 1).toString() });
        i(f), t(f.map((p) => p.item)), a(n);
      }
    },
    removeItem: (g) => {
      const f = o.filter((p) => p.id !== g);
      i(f), t(f.map((p) => p.item));
    },
    moveItem: (g, f) => {
      if (g !== f) {
        const p = o.findIndex((b) => b.id === g), h = f ? o.findIndex((b) => b.id === f) : 0, v = Nt(o, p, h);
        i(v), t(v.map((b) => b.item));
      }
    },
    newItem: s,
    setNewItem: a
  };
};
export {
  $o as S,
  Xo as u
};
//# sourceMappingURL=useSortableIndexedList-064b5b13.mjs.map
