import { jsx as e } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js";
import d from "classnames";
import { useModalContext as u } from "../../../../internal/Modal/Modal.js";
import { useDisputeFlow as a } from "../../context/dispute/context.js";
import { AcceptDisputeFlow as f } from "../AcceptDisputeFlow/AcceptDisputeFlow.js";
import { DefendDisputeFlow as D } from "../DefendDisputeFlow/DefendDisputeFlow.js";
import { DisputeData as w } from "../DisputesData/DisputeData.js";
import { useEffect as h } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js";
import { Fragment as F } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/dist/preact.module.js";
import { Header as g } from "../../../../internal/Header/Header.js";
const r = ({ children: o, hideTitle: t }) => {
  const { flowState: s } = a(), { withinModal: i } = u();
  return /* @__PURE__ */ e(F, { children: [
    /* @__PURE__ */ e("div", { className: d({ "adyen-pe-visually-hidden": s !== "details" }), children: /* @__PURE__ */ e(g, { hideTitle: t, forwardedToRoot: !i, titleKey: "disputes.management.common.title" }) }),
    o
  ] });
}, k = ({
  id: o,
  hideTitle: t,
  dataCustomization: s,
  onContactSupport: i,
  onDisputeAccept: m,
  onDisputeDefend: c,
  onDismiss: l
}) => {
  const { flowState: p, getDisputesConfig: n } = a();
  switch (h(() => {
    n();
  }, [n]), p) {
    case "details":
      return /* @__PURE__ */ e(r, { hideTitle: t, children: /* @__PURE__ */ e(w, { disputeId: o, dataCustomization: s, onContactSupport: i, onDismiss: l }) });
    case "accept":
      return /* @__PURE__ */ e(r, { hideTitle: t, children: /* @__PURE__ */ e(f, { onDisputeAccept: m }) });
    case "defendReasonSelectionView":
    case "defenseSubmitResponseView":
    case "uploadDefenseFilesView":
      return /* @__PURE__ */ e(r, { hideTitle: t, children: /* @__PURE__ */ e(D, { onDisputeDefend: c }) });
    default:
      return null;
  }
};
export {
  k as DisputeDetails
};
