import { jsx } from "react/jsx-runtime";
import { FileUrlFieldView } from "@contember/react-binding-ui";
import { defaultUploader } from "../../defaultUploader.js";
import { getFileUrlDataExtractor } from "../../fileDataExtractors/getFileUrlDataExtractor.js";
import { getGenericFileMetadataExtractor } from "../../fileDataExtractors/getGenericFileMetadataExtractor.js";
const acceptAnyFile = () => true;
const renderAnyFilePreview = ({ objectUrl }) => /* @__PURE__ */ jsx(
  "a",
  {
    style: { whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", direction: "rtl" },
    href: objectUrl,
    onClick: (e) => e.stopPropagation(),
    download: true,
    children: objectUrl.substring(Math.max(0, objectUrl.lastIndexOf("/") + 1))
  }
);
const getStockAnyFileKind = ({
  additionalExtractors = [],
  acceptMimeTypes = null,
  acceptFile = acceptAnyFile,
  baseEntity,
  children,
  fileSizeField,
  fileTypeField,
  lastModifiedField,
  fileNameField,
  renderFilePreview = renderAnyFilePreview,
  renderUploadedFile,
  uploader = defaultUploader,
  urlField,
  childrenOutsideBaseEntity
}) => {
  const extractors = [
    getFileUrlDataExtractor({ urlField }),
    getGenericFileMetadataExtractor({ fileNameField, fileSizeField, fileTypeField, lastModifiedField }),
    ...additionalExtractors
  ];
  return {
    acceptMimeTypes,
    acceptFile,
    renderFilePreview,
    renderUploadedFile: renderUploadedFile ?? /* @__PURE__ */ jsx(FileUrlFieldView, { fileUrlField: urlField }),
    uploader,
    children,
    childrenOutsideBaseEntity,
    baseEntity,
    extractors
  };
};
export {
  acceptAnyFile,
  getStockAnyFileKind,
  renderAnyFilePreview
};
//# sourceMappingURL=getStockAnyFileKind.js.map
