import { jsx as r } from "react/jsx-runtime";
import { useMemo as h } from "react";
import u from "../../../Icons.js";
import { C as _ } from "../../../../index-20bzTFSx.js";
import { useTableContext as m } from "../../context/index.js";
import "../../../../utils/functions.js";
import "../../../../clsx-7d8NmkQq.js";
import "../../../../utils/components/RenderEach.js";
import "../../../../utils/components/RenderIf.js";
import "../../../Inputs/variants.js";
import "../../../../index-xVF7D3FM.js";
import "../../../../motion-dVICNqWI.js";
import "../../../../SVGVisualElement-aqO4D4Z5.js";
import "../../../../LayoutGroupContext-3euHzeKi.js";
import "../../../../context/index.js";
const T = ({ targetId: k, ...s }) => {
  var i;
  const [d = {}, o] = m((e) => e.checkedData), [c] = m((e) => e.data), p = h(() => c.reduce((e, n) => (e[n.id] = n, e), {}), [c]), t = (((i = Object.keys(d)) == null ? void 0 : i.length) ?? 0) > 0, a = () => {
    o(t ? (e) => {
      e.checkedData = {};
    } : (e) => {
      e.checkedData = p;
    });
  };
  return t ? /* @__PURE__ */ r(
    "div",
    {
      onClick: a,
      className: "_cursor-pointer _bg-primary/80 _border-2 _border-primary  _w-5 _h-5 _rounded _flex _justify-center _items-center",
      children: /* @__PURE__ */ r(u.MinusIcon, { className: "_text-white _rounded " })
    }
  ) : /* @__PURE__ */ r(
    _,
    {
      inputProps: {
        checked: t,
        onChange: a,
        ...s
      }
    }
  );
};
export {
  T as default
};
