"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const reactBindingUi = require("@contember/react-binding-ui");
const defaultUploader = require("../../defaultUploader.cjs");
const getAudioFileDataExtractor = require("../../fileDataExtractors/getAudioFileDataExtractor.cjs");
const getFileUrlDataExtractor = require("../../fileDataExtractors/getFileUrlDataExtractor.cjs");
const getGenericFileMetadataExtractor = require("../../fileDataExtractors/getGenericFileMetadataExtractor.cjs");
const acceptAudioFile = ({ file }) => file.type.startsWith("audio");
const renderAudioFilePreview = ({ objectUrl }) => /* @__PURE__ */ jsxRuntime.jsx("audio", { src: objectUrl, controls: true });
const getStockAudioFileKind = ({
  additionalExtractors = [],
  acceptMimeTypes = "audio/*",
  acceptFile = acceptAudioFile,
  baseEntity,
  children,
  durationField,
  fileSizeField,
  fileTypeField,
  lastModifiedField,
  fileNameField,
  renderFilePreview = renderAudioFilePreview,
  renderUploadedFile,
  uploader = defaultUploader.defaultUploader,
  urlField,
  childrenOutsideBaseEntity
}) => {
  const extractors = [
    getFileUrlDataExtractor.getFileUrlDataExtractor({ urlField }),
    getGenericFileMetadataExtractor.getGenericFileMetadataExtractor({ fileNameField, fileSizeField, fileTypeField, lastModifiedField }),
    getAudioFileDataExtractor.getAudioFileDataExtractor({ durationField }),
    ...additionalExtractors
  ];
  return {
    acceptMimeTypes,
    acceptFile,
    renderFilePreview,
    uploader,
    renderUploadedFile: renderUploadedFile ?? /* @__PURE__ */ jsxRuntime.jsx(reactBindingUi.FileUrlFieldView, { fileUrlField: urlField }),
    baseEntity,
    children,
    childrenOutsideBaseEntity,
    extractors
  };
};
exports.acceptAudioFile = acceptAudioFile;
exports.getStockAudioFileKind = getStockAudioFileKind;
exports.renderAudioFilePreview = renderAudioFilePreview;
//# sourceMappingURL=getStockAudioFileKind.cjs.map
