import { jsxs as n, jsx as t, Fragment as z } from "@emotion/react/jsx-runtime";
import { PanelSlotStyled as h, PanelWindowHostStyled as P } from "../../../../../../../slots/AreasViewerSlots.js";
import { Window as y } from "../../../../Window/Window.js";
import { useOverlayPanelResize as W } from "../../../hooks/useOverlayPanelResize.js";
import { shouldRenderResizeRailBeforePanel as m } from "../../../helpers/panelRuntime.js";
import { PanelResizeRail as f } from "./PanelResizeRail.js";
const D = ({
  areaId: r,
  selected: w,
  overlay: i,
  panel: e,
  panelZIndexBase: s,
  onPinnedResizeStart: l
}) => {
  const { containerRef: R, handleResizeStart: c, resizeHandleStyle: S, slotStyle: a } = W({
    areaId: r,
    overlay: i,
    panel: e,
    selected: w
  }), u = /* @__PURE__ */ n(
    h,
    {
      ref: R,
      ownerState: { side: e.side, overlay: i, panelZIndexBase: s },
      style: a,
      "data-testid": `areas-panel-slot-${e.side}-${i ? "overlay" : "docked"}`,
      children: [
        /* @__PURE__ */ t(P, { children: /* @__PURE__ */ t(y, { windowId: e.windowId, areaId: r }) }),
        i ? /* @__PURE__ */ t(
          "div",
          {
            "data-testid": `areas-panel-resize-handle-${e.side}`,
            onMouseDown: c,
            style: S
          }
        ) : null
      ]
    }
  );
  return /* @__PURE__ */ n(z, { children: [
    !i && m(e.side) ? /* @__PURE__ */ t(
      f,
      {
        panel: e,
        side: e.side,
        panelZIndexBase: s,
        onResizeStart: (o, d) => {
          l?.(o, d);
        }
      }
    ) : null,
    u,
    !i && !m(e.side) ? /* @__PURE__ */ t(
      f,
      {
        panel: e,
        side: e.side,
        panelZIndexBase: s,
        onResizeStart: (o, d) => {
          l?.(o, d);
        }
      }
    ) : null
  ] });
};
export {
  D as PanelWindow
};
