import { Fragment, jsx, jsxs } from "react/jsx-runtime";
import { InjectionSpot } from "./InjectionSpot.js";
function normalizePath(path) {
  const trimmed = path.replace(/\?.*$/, "").replace(/\/+$/, "");
  const withoutLeading = trimmed.startsWith("/") ? trimmed.slice(1) : trimmed;
  const safe = withoutLeading.length ? withoutLeading : "root";
  return safe.replace(/[^a-zA-Z0-9]+/g, ":");
}
function PageInjectionBoundary({
  path,
  context,
  children
}) {
  const handle = normalizePath(path || "/");
  const beforeSpotId = `admin.page:${handle}:before`;
  const afterSpotId = `admin.page:${handle}:after`;
  return /* @__PURE__ */ jsxs(Fragment, { children: [
    /* @__PURE__ */ jsx(InjectionSpot, { spotId: beforeSpotId, context: context ?? { path } }),
    children,
    /* @__PURE__ */ jsx(InjectionSpot, { spotId: afterSpotId, context: context ?? { path } })
  ] });
}
export {
  PageInjectionBoundary
};
//# sourceMappingURL=PageInjectionBoundary.js.map
