import { jsxDEV } from "react/jsx-dev-runtime";
import { ImageFieldView } from "@contember/react-binding-ui";
import { defaultUploader } from "../../defaultUploader.js";
import { getImageFileDataExtractor } from "../../fileDataExtractors/getImageFileDataExtractor.js";
import { getFileUrlDataExtractor } from "../../fileDataExtractors/getFileUrlDataExtractor.js";
import { getGenericFileMetadataExtractor } from "../../fileDataExtractors/getGenericFileMetadataExtractor.js";
const acceptImageFile = ({ file }) => file.type.startsWith("image");
const renderImageFilePreview = ({ objectUrl }) => /* @__PURE__ */ jsxDEV("img", { src: objectUrl, alt: "" }, void 0, false, {
  fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/upload/fileKinds/factories/getStockImageFileKind.tsx",
  lineNumber: 18,
  columnNumber: 84
}, void 0);
const getStockImageFileKind = ({
  additionalExtractors = [],
  acceptMimeTypes = "image/*",
  acceptFile = acceptImageFile,
  baseEntity,
  children,
  fileSizeField,
  fileTypeField,
  lastModifiedField,
  fileNameField,
  renderFilePreview = renderImageFilePreview,
  renderUploadedFile,
  heightField,
  widthField,
  uploader = defaultUploader,
  urlField,
  childrenOutsideBaseEntity
}) => {
  const extractors = [
    getFileUrlDataExtractor({ urlField }),
    getGenericFileMetadataExtractor({ fileNameField, fileSizeField, fileTypeField, lastModifiedField }),
    getImageFileDataExtractor({ heightField, widthField }),
    ...additionalExtractors
  ];
  return {
    acceptMimeTypes,
    acceptFile,
    renderFilePreview,
    uploader,
    renderUploadedFile: renderUploadedFile ?? /* @__PURE__ */ jsxDEV(ImageFieldView, { srcField: urlField }, void 0, false, {
      fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/upload/fileKinds/factories/getStockImageFileKind.tsx",
      lineNumber: 50,
      columnNumber: 45
    }, void 0),
    children,
    childrenOutsideBaseEntity,
    baseEntity,
    extractors
  };
};
export {
  acceptImageFile,
  getStockImageFileKind,
  renderImageFilePreview
};
//# sourceMappingURL=getStockImageFileKind.js.map
