import { jsx as e, Fragment as y, jsxs as P } from "@emotion/react/jsx-runtime";
import { useMemo as _ } from "react";
import { getPropDataTestId as m } from "../../../test/getNameDataTestId.js";
import { getComponentClasses as h } from "../../../utils/getComponentSlotRoot.js";
import { SPLIT_LAYOUT_KEY_COMPONENT as i, SPLIT_LAYOUT_ICONS as z } from "./constants.js";
import { SplitLayoutSlots as r } from "./slots/SplitLayoutEnum.js";
import { SplitLayoutRootStyled as I, SplitMasterStyled as L, SplitResizeHandleStyled as M, SplitResizeHandleIconStyled as N, SplitDetailStyled as T } from "./slots/SplitLayoutSlots.js";
import { useEnvironment as D } from "@m4l/core";
const H = (p) => {
  const { firstPart: o, secondPart: a, splitPosition: t, dataTestId: l, defaultMasterSize: c = 50, defaultDetailSize: d = 50 } = p, s = h(i, r), { host_static_assets: S, environment_assets: f } = D(), u = _(() => typeof o == "function" ? o() : o, [o]), n = {
    splitPosition: t
  };
  return /* @__PURE__ */ e(y, { children: /* @__PURE__ */ P(
    I,
    {
      ...m(i, r.root, l),
      className: s.root,
      direction: t === "none" ? "vertical" : t,
      ownerState: n,
      children: [
        /* @__PURE__ */ e(
          L,
          {
            ...m(i, r.splitMaster, l),
            ownerState: {
              splitPosition: t
            },
            defaultSize: c,
            className: s.splitMaster,
            children: u
          }
        ),
        /* @__PURE__ */ e(
          M,
          {
            className: `${s.splitResizeHandle}-${t}`,
            ownerState: n,
            children: /* @__PURE__ */ e(N, { src: `${S}/${f}/${z.handleIcon}` })
          }
        ),
        /* @__PURE__ */ e(
          T,
          {
            ...m(i, r.splitDetail, l),
            className: s.splitDetail,
            ownerState: n,
            defaultSize: d,
            children: typeof a == "function" ? a() : a
          }
        )
      ]
    }
  ) });
};
export {
  H as SplitLayout
};
