"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxDevRuntime = require("react/jsx-dev-runtime");
const reactBindingUi = require("@contember/react-binding-ui");
const defaultUploader = require("../../defaultUploader.cjs");
const getImageFileDataExtractor = require("../../fileDataExtractors/getImageFileDataExtractor.cjs");
const getFileUrlDataExtractor = require("../../fileDataExtractors/getFileUrlDataExtractor.cjs");
const getGenericFileMetadataExtractor = require("../../fileDataExtractors/getGenericFileMetadataExtractor.cjs");
const acceptImageFile = ({ file }) => file.type.startsWith("image");
const renderImageFilePreview = ({ objectUrl }) => /* @__PURE__ */ jsxDevRuntime.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.defaultUploader,
  urlField,
  childrenOutsideBaseEntity
}) => {
  const extractors = [
    getFileUrlDataExtractor.getFileUrlDataExtractor({ urlField }),
    getGenericFileMetadataExtractor.getGenericFileMetadataExtractor({ fileNameField, fileSizeField, fileTypeField, lastModifiedField }),
    getImageFileDataExtractor.getImageFileDataExtractor({ heightField, widthField }),
    ...additionalExtractors
  ];
  return {
    acceptMimeTypes,
    acceptFile,
    renderFilePreview,
    uploader,
    renderUploadedFile: renderUploadedFile ?? /* @__PURE__ */ jsxDevRuntime.jsxDEV(reactBindingUi.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
  };
};
exports.acceptImageFile = acceptImageFile;
exports.getStockImageFileKind = getStockImageFileKind;
exports.renderImageFilePreview = renderImageFilePreview;
//# sourceMappingURL=getStockImageFileKind.cjs.map
