import { jsxs as t, Fragment as p, jsx as i } from "react/jsx-runtime";
import { forwardRef as b } from "react";
import { cx as N } from "../../utils/classNames.js";
import { useArrowTheme as k } from "../../hooks/useArrowTheme.js";
import { StatusLabel as q } from "../status-label/StatusLabel.js";
import { Divider as L } from "../divider/Divider.js";
const z = b(
  ({
    inverse: x,
    label: m,
    labelId: l,
    body: r,
    status: n,
    leadingDecorationType: e,
    leadingImage: o,
    leadingIcon: c,
    leadingDecorationA11yLabel: j,
    dividerPosition: d = "bottom",
    trailingContent: a,
    navigationUrl: u,
    focused: w,
    className: A
  }, C) => {
    const F = k(), s = x ?? F.inverse;
    if (!m)
      return null;
    const R = /* @__PURE__ */ t(p, { children: [
      /* @__PURE__ */ i("div", { className: "tdds-list-item__label", children: m }),
      r == null ? void 0 : r.map(
        ({ text: _, icon: S, iconA11yLabel: B }, $) => _ ? /* @__PURE__ */ t("div", { className: "tdds-list-item__optional-copy", children: [
          S || null,
          _
        ] }, $) : null
      )
    ] }), v = /* @__PURE__ */ t("div", { className: "tdds-list-item__content", children: [
      e ? /* @__PURE__ */ t(
        "div",
        {
          className: "tdds-list-item__leading-decoration",
          "data-image-type": e,
          id: l ? `${l}-leading-decoration` : void 0,
          children: [
            e === "icon" && c ? c : null,
            e !== "icon" && o ? /* @__PURE__ */ i(
              "img",
              {
                src: o,
                alt: j || ""
              }
            ) : null
          ]
        }
      ) : null,
      /* @__PURE__ */ t("div", { className: "tdds-list-item__main-content", id: l || void 0, children: [
        R,
        n ? /* @__PURE__ */ i(q, { ...n, inverse: s }) : null
      ] }),
      a ? /* @__PURE__ */ i("div", { className: "tdds-list-item__trailing-content", children: a }) : null
    ] }), h = d === "top" ? /* @__PURE__ */ i(L, { inverse: s }) : null, f = d === "bottom" ? /* @__PURE__ */ i(L, { inverse: s }) : null;
    return /* @__PURE__ */ i(
      "li",
      {
        ref: C,
        className: N("tdds-list-item", A),
        ...s ? { "data-inverse": "true" } : {},
        role: "listitem",
        children: u ? /* @__PURE__ */ t(
          "a",
          {
            href: u,
            className: N({ "force-focus": !!w }),
            children: [
              h,
              v,
              f
            ]
          }
        ) : /* @__PURE__ */ t(p, { children: [
          h,
          v,
          f
        ] })
      }
    );
  }
);
z.displayName = "ListItem";
export {
  z as ListItem
};
//# sourceMappingURL=ListItem.js.map
