import { jsx as t, jsxs as m } from "react/jsx-runtime";
import "react";
import e from "./index-Drawer.module.scss.js";
import { Button as C, ButtonSizes as N, ButtonTypes as x } from "./index-Button.js";
import { IconNames as y } from "./index-IconNames.js";
import s from "./index-_virtual4.js";
import { Header as D, HeaderTypes as p } from "./index-Header.js";
import H from "./index-Drawer2.js";
var o;
(function(r) {
  r.left = "left", r.top = "top", r.right = "right", r.bottom = "bottom";
})(o || (o = {}));
const O = (r) => {
  const {
    open: f = !1,
    anchor: d = o.right,
    title: l,
    description: u,
    isHeaderCompact: c = !1,
    isHeaderSticky: h = !1,
    onClose: n,
    children: v,
    hideBackdrop: a,
    variant: B = "persistent",
    zIndex: i,
    showCloseButton: k = !1
  } = r;
  return t(H, {
    anchor: d,
    transitionDuration: 400,
    hideBackdrop: a,
    open: f,
    variant: B,
    sx: i !== void 0 ? {
      zIndex: i
    } : {
      zIndex: 1099
    },
    ModalProps: {
      hideBackdrop: a,
      BackdropProps: {
        invisible: !!a
      },
      style: i !== void 0 ? {
        zIndex: i
      } : void 0,
      // The drawer is a side panel, not a blocking dialog — we layer modals
      // and popovers on top of it. MUI's default FocusTrap yanks focus back
      // into the drawer whenever an input on a higher overlay receives it,
      // which makes those inputs untypable. Turn enforcement off so focus
      // can rest where the user puts it.
      disableEnforceFocus: !0
    },
    onClose: (b, w) => n && n({
      isOk: !1,
      data: {
        reason: w
      }
    }),
    children: m("div", {
      className: s(e.drawer, d === o.right ? e.right : e.left),
      children: [m("div", {
        className: s(h ? e.headerSticky : void 0, e.headerContainer),
        children: [t("div", {
          className: e.closeButton,
          children: k ? t(C, {
            type: x.muted,
            size: N.medium,
            icon: y.close,
            onClick: n
          }) : null
        }), l ? t("div", {
          className: s(e.header, c ? e.compact : void 0),
          children: t(D, {
            title: l,
            description: u,
            type: c ? p.compactDrawerHeader : p.drawerHeader
          })
        }) : null]
      }), t("div", {
        className: e.drawerContent,
        children: v
      })]
    })
  });
};
export {
  o as AnchorTypes,
  O as Drawer
};
