import { jsx as e, jsxs as T } from "@emotion/react/jsx-runtime";
import { getPropDataTestId as i } from "../../test/getNameDataTestId.js";
import { WINDOW_BASE_KEY_COMPONENT as o } from "./constants.js";
import { getComponentSlotRoot as b } from "../../utils/getComponentSlotRoot.js";
import v from "clsx";
import { HeaderWindowBase as N } from "./subcomponents/Header/HeaderWindowBase.js";
import { EditionInfo as D } from "./subcomponents/EditionInfo/EditionInfo.js";
import { WindowBaseStyled as E, ToastContainerStyled as P, ContentWindowStyled as O, LinearProgressIndeterminateStyled as _ } from "./slots/WindowBaseSlots.js";
import { useComponentSize as j, AppearanceComponentProvider as A } from "@m4l/graphics";
import { WindowBaseSlots as a } from "./slots/WindowBaseEnum.js";
const J = (w) => {
  const {
    children: u,
    size: d = "medium",
    selected: s = !1,
    maximized: t,
    variant: m = "outlined",
    version: S,
    buildTime: W,
    dataTestId: n,
    onClose: B,
    className: C,
    isLoading: I,
    windowId: x,
    onMouseDown: h,
    editionInfo: l,
    emergeType: r = "layout",
    collapsed: p,
    draggable: y,
    ...z
  } = w, { currentSize: c } = j(d), f = y ?? r !== "panel", g = {
    selected: s,
    variant: t ? "text" : m,
    size: c,
    emergeType: r,
    maximized: t,
    collapsed: p,
    draggable: f
  };
  return /* @__PURE__ */ e(A, { defaultSize: c, children: /* @__PURE__ */ T(
    E,
    {
      className: v(b(o), C),
      ...i(o, a.wrapperWindowBase, n),
      ownerState: g,
      onMouseDown: h,
      children: [
        /* @__PURE__ */ e(
          N,
          {
            ...i(o, a.headerContentWindowBase, n),
            version: S,
            buildTime: W,
            size: d,
            variant: m,
            selected: s,
            maximized: t,
            collapsed: p,
            onClose: B,
            emergeType: r,
            draggable: f,
            ...z
          }
        ),
        /* @__PURE__ */ e(P, { fixed: !1, position: "top-right", containerId: x }),
        l && /* @__PURE__ */ e(D, { editionInfo: l }),
        /* @__PURE__ */ e(
          O,
          {
            ...i(o, a.contentWindowBase, n),
            ownerState: g,
            children: u
          }
        ),
        I && /* @__PURE__ */ e(_, {})
      ]
    }
  ) });
};
export {
  J as WindowBase
};
