import { j as d } from "../../../../_virtual/jsx-runtime.js";
import { useState as q } from "react";
import { BottomSheetHeader as z } from "../bottomSheetHeader/index.js";
import { BottomSheetWrapper as D, MainContentWrapper as G, PullTab as J, CustomHeaderWrapper as K, InnerWrapper as L } from "../../styles.js";
import { BottomSheetBody as N } from "../bottomSheetBody/index.js";
import { BottomSheetFooter as Q } from "../bottomSheetFooter/index.js";
import k from "../bottomSheetImage/index.js";
import { getId as U } from "../../../../utils/index.js";
const u = ({
  headerTitle: w,
  headerContentModifiers: b,
  headerControlsModifiers: r,
  hasPullTab: o,
  icon: H,
  dismissAction: c,
  primaryAction: f,
  stackedActionButtons: h,
  pinnedFooter: x = !1,
  pinnedHeader: i = !1,
  hasBodyPadding: I = !0,
  isOpened: W = !1,
  shouldCloseOnEsc: X = !0,
  shouldCloseOnOverlayClick: Y = !0,
  children: p,
  bottomSheetRoot: Z,
  height: n,
  width: m,
  imgValues: t,
  position: y = "center",
  onClose: S,
  customHeader: j,
  customFooter: B,
  onPullTabClick: O,
  bodyRef: v,
  ...a
}) => {
  const [E, R] = q(n), e = U(a.id), $ = () => R(
    (C) => C === "100%" ? n : "100%"
  );
  return /* @__PURE__ */ d.jsx(
    D,
    {
      isOpened: W,
      height: E,
      width: m,
      hasPullTab: o,
      stackedActionButtons: h,
      position: y,
      "data-testid": `${a["data-testid"]}-bottom-sheet-wrapper`,
      id: e("wrapper"),
      children: /* @__PURE__ */ d.jsxs(G, { id: e("wrapper"), children: [
        o && /* @__PURE__ */ d.jsx(
          J,
          {
            hasPullTab: o,
            onClick: O || $,
            "data-testid": `${a["data-testid"]}-bottom-sheet-pull-tab`,
            id: e("pull-tab")
          }
        ),
        b === "empty" && r === "default" || t != null && t.asHeader || j !== void 0 ? null : /* @__PURE__ */ d.jsx(
          z,
          {
            headerTitle: w,
            onClose: S,
            hasPullTab: o,
            headerContentModifiers: b,
            headerControlsModifiers: r,
            pinnedHeader: i,
            icon: H,
            "data-testid": a["data-testid"],
            "data-trackid": a["data-trackid"],
            "aria-label": a["aria-label"],
            id: e("header")
          }
        ),
        j && /* @__PURE__ */ d.jsx(K, { id: e("custom-header-wrapper"), children: j }),
        (t == null ? void 0 : t.imgSrc) && (t == null ? void 0 : t.asHeader) && /* @__PURE__ */ d.jsx(
          k,
          {
            imgValues: t,
            onClose: S,
            headerControlsModifiers: r
          }
        ),
        /* @__PURE__ */ d.jsxs(
          L,
          {
            pinnedHeader: i,
            pinnedFooter: x,
            id: e("inner-wrapper"),
            children: [
              (t == null ? void 0 : t.imgSrc) && !(t != null && t.asHeader) && /* @__PURE__ */ d.jsx(
                k,
                {
                  imgValues: t,
                  onClose: S,
                  headerControlsModifiers: r
                }
              ),
              p && /* @__PURE__ */ d.jsx(
                N,
                {
                  pinnedFooter: x,
                  dismissAction: c,
                  stackedActionButtons: h,
                  hasBodyPadding: I,
                  "data-testid": a["data-testid"],
                  "data-trackid": a["data-trackid"],
                  "aria-label": a["aria-label"],
                  bodyRef: v,
                  id: e("body"),
                  children: p
                }
              ),
              f && !B && /* @__PURE__ */ d.jsx(
                Q,
                {
                  primaryAction: f,
                  dismissAction: c,
                  stackedActionButtons: h,
                  pinnedFooter: x,
                  "data-testid": a["data-testid"],
                  "data-trackid": a["data-trackid"],
                  "aria-label": a["aria-label"],
                  id: e("footer")
                }
              ),
              B
            ]
          }
        )
      ] })
    }
  );
};
export {
  u as BottomSheetContent
};
