import { jsxDEV } from "react/jsx-dev-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__ */ jsxDEV(
  "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))
  },
  void 0,
  false,
  {
    fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/upload/fileKinds/factories/getStockAnyFileKind.tsx",
    lineNumber: 13,
    columnNumber: 2
  },
  void 0
);
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__ */ jsxDEV(FileUrlFieldView, { fileUrlField: urlField }, void 0, false, {
      fileName: "/__w/interface/interface/packages/admin/src/components/bindingFacade/upload/fileKinds/factories/getStockAnyFileKind.tsx",
      lineNumber: 49,
      columnNumber: 45
    }, void 0),
    uploader,
    children,
    childrenOutsideBaseEntity,
    baseEntity,
    extractors
  };
};
export {
  acceptAnyFile,
  getStockAnyFileKind,
  renderAnyFilePreview
};
//# sourceMappingURL=getStockAnyFileKind.js.map
