import { jsxs as N, jsx as e, Fragment as z } from "react/jsx-runtime";
import { c as k } from "./index.CfM2L_w0.js";
import { n as h } from "./index.B0wX8xO7.js";
import { a as w } from "./index.CfQlFjZU.js";
import { a as y } from "./Checkbox.BszXXvCK.js";
import { u as p } from "./useId.7P31viIO.js";
import { l as A } from "./index.C1ZfizMq.js";
const G = "creator_checkboxContainer_uRwAf", g = "creator_childrenContainer_-uzHt", j = "creator_vertical_2o5AI", I = "creator_horizontal_7-r0T", Q = "creator_label_cQrWq", $ = "creator_helper_tBAQ6", r = { checkboxContainer: G, childrenContainer: g, vertical: j, horizontal: I, label: Q, helper: $ };
function q({
  direction: a = "horizontal",
  checkboxes: o,
  label: s,
  helper: c,
  onCheckboxChecked: i
}) {
  const l = p(), t = p(), n = o && o.length > 0;
  return {
    checkboxes: o,
    checkboxContainerClassName: r.checkboxContainer,
    childrenContainerClassName: k(r.childrenContainer, {
      [r.horizontal]: a === "horizontal",
      [r.vertical]: a === "vertical"
    }),
    label: s,
    helper: c,
    direction: a,
    labelId: l,
    helperId: t,
    labelClassName: r.label,
    helperClassName: r.helper,
    hasCheckboxes: n,
    onCheckboxChecked: i
  };
}
function B({
  checkboxes: a,
  checkboxContainerClassName: o,
  childrenContainerClassName: s,
  labelClassName: c,
  helperClassName: i,
  label: l,
  helper: t,
  labelId: n,
  helperId: m,
  hasCheckboxes: _,
  onCheckboxChecked: u
}) {
  return /* @__PURE__ */ N(
    "div",
    {
      className: o,
      "aria-labelledby": `${n} ${m}`,
      children: [
        /* @__PURE__ */ e(
          h,
          {
            value: l,
            then: /* @__PURE__ */ e("label", { id: n, className: c, children: l })
          }
        ),
        /* @__PURE__ */ e("div", { className: s, children: /* @__PURE__ */ e(
          h,
          {
            value: !_,
            then: /* @__PURE__ */ e(z, {}),
            otherwise: /* @__PURE__ */ e(
              A,
              {
                values: a,
                layout: ({
                  id: C,
                  name: d,
                  checked: b,
                  disabled: f,
                  indeterminate: v,
                  label: x
                }) => /* @__PURE__ */ e(
                  y,
                  {
                    name: d,
                    checked: b,
                    disabled: f,
                    indeterminate: v,
                    label: x,
                    onChecked: () => u && u(C, !b)
                  },
                  C
                )
              }
            )
          }
        ) }),
        /* @__PURE__ */ e(
          h,
          {
            value: t,
            then: /* @__PURE__ */ e("label", { id: m, className: i, children: t })
          }
        )
      ]
    }
  );
}
const E = w(B, q, "CheckboxGroup");
export {
  E as C
};
