import { MediaUploadErrorKey } from "./../ricos-content/index.js";
const withFileSizeLimitation = (uploadFunction, fileUploadSizeLimit) => {
  return (file, updateEntity) => isFileSizeExcceeded(file, fileUploadSizeLimit) ? updateEntity({
    error: {
      key: MediaUploadErrorKey.SIZE_LIMIT,
      args: { maxLimit: fileUploadSizeLimit }
    }
  }) : uploadFunction(file, updateEntity);
};
function isFileSizeExcceeded(file, fileUploadSizeLimit) {
  return !!fileUploadSizeLimit && file.size >= fileUploadSizeLimit * 1024 * 1024;
}
export {
  withFileSizeLimitation
};
//# sourceMappingURL=with-file-size-limitation.js.map
