import { createElement } from "react";
import { defaultUploader } from "../../defaultUploader.js";
import { getFileUrlDataExtractor } from "../../fileDataExtractors/getFileUrlDataExtractor.js";
import { getGenericFileMetadataExtractor } from "../../fileDataExtractors/getGenericFileMetadataExtractor.js";
import { FileUrlFieldView } from "../../../fieldViews/FileUrlFieldView.js";
const acceptAnyFile = () => true;
const renderAnyFilePreview = ({ objectUrl }) => /* @__PURE__ */ createElement("a", {
  style: { whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", direction: "rtl" },
  href: objectUrl,
  onClick: (e) => e.stopPropagation(),
  download: true
}, 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__ */ createElement(FileUrlFieldView, {
      fileUrlField: urlField
    }),
    uploader,
    children,
    childrenOutsideBaseEntity,
    baseEntity,
    extractors
  };
};
export { acceptAnyFile, getStockAnyFileKind, renderAnyFilePreview };
//# sourceMappingURL=getStockAnyFileKind.js.map
