import { Fragment, jsx } from "react/jsx-runtime";
import {
  createContext,
  forwardRef
} from "react";
import {
  ApiHandlerHeaders,
  serializeSiteVersion
} from "../../../api/site-version";
import { BaseHeadSnippet } from "./page/HeadSnippet";
const DefaultHead = ({ children }) => /* @__PURE__ */ jsx(Fragment, { children });
const DefaultHeadSnippet = BaseHeadSnippet;
const DefaultImage = ({ priority, fill, style, ...props }) => /* @__PURE__ */ jsx(
  "img",
  {
    ...props,
    style: {
      ...fill ? {
        height: "100%",
        width: "100%",
        objectFit: "cover"
      } : {},
      ...style
    },
    loading: priority ? "eager" : "lazy"
  }
);
const DefaultLink = forwardRef(
  ({ linkType, ...props }, ref) => /* @__PURE__ */ jsx("a", { ...props, ref })
);
const versionedFetch = (siteVersion) => (url, init) => fetch(url, {
  ...init,
  headers: {
    ...init?.headers,
    ...siteVersion != null ? { [ApiHandlerHeaders.SiteVersion]: serializeSiteVersion(siteVersion) } : {}
  }
});
const FrameworkContext = createContext({
  Head: DefaultHead,
  HeadSnippet: DefaultHeadSnippet,
  Image: DefaultImage,
  Link: DefaultLink,
  versionedFetch
});
export {
  DefaultHead,
  DefaultHeadSnippet,
  DefaultImage,
  DefaultLink,
  FrameworkContext,
  versionedFetch
};
//# sourceMappingURL=framework-context.js.map