"use client";
import { jsx } from "react/jsx-runtime";
import * as React from "react";
import { useSearchParams } from "next/navigation";
import { Page, PageBody } from "@open-mercato/ui/backend/Page";
import { CreateDealForm } from "../../../../components/detail/create/CreateDealForm.js";
const DEFAULT_RETURN_TO = "/backend/customers/deals";
function resolveReturnTo(value) {
  if (!value) return DEFAULT_RETURN_TO;
  if (!value.startsWith("/backend/customers/deals")) return DEFAULT_RETURN_TO;
  return value;
}
function CreateDealPage() {
  const searchParams = useSearchParams();
  const returnTo = React.useMemo(
    () => resolveReturnTo(searchParams?.get("returnTo") ?? null),
    [searchParams]
  );
  return /* @__PURE__ */ jsx(Page, { children: /* @__PURE__ */ jsx(PageBody, { children: /* @__PURE__ */ jsx(CreateDealForm, { returnTo }) }) });
}
export {
  CreateDealPage as default
};
//# sourceMappingURL=page.js.map
