import { Button, FileUpload, FormField } from "@wix/design-system";
import React, { useContext } from "react";
import {
  EditorContext,
  ModalServiceContext,
  RicosContext,
  useDevService
} from "./../../ricos-context/index.js";
import { useWixInstanceService } from "./../../_shared/request-service-provider/wix-instance-context.js";
import { useEditorProps } from "./../../_shared/some-editor-props-context.js";
import { MEDIA_POPOVERS_BUTTONS_NAMES_BI } from "./../../wix-rich-content-common/index.js";
import { UPLOAD_TAB_UPLOAD_BUTTON } from "../data-hooks.js";
import { handleVideoUpload } from "../handle-video-upload.js";
import { VIDEO_TYPE } from "../types.js";
const FILE_INPUT_ACCEPT = "video/*";
const UploadVideo = ({
  nodeId,
  helpers,
  uploadService,
  closeModal,
  disableDownloadDefault,
  logBi
}) => {
  const { t } = useContext(RicosContext);
  const { getPublicCommands } = useContext(EditorContext);
  const wixInstance = useWixInstanceService();
  const { metaSiteId } = wixInstance();
  const editorProps = useEditorProps();
  const modalService = useContext(ModalServiceContext);
  const devService = useDevService();
  const handleUploadClick = async () => {
    helpers?.onPluginsPopOverClick?.({
      pluginId: VIDEO_TYPE,
      buttonName: MEDIA_POPOVERS_BUTTONS_NAMES_BI.upload
    });
    logBi({ dataHook: UPLOAD_TAB_UPLOAD_BUTTON });
    handleVideoUpload({
      services: {
        uploadService,
        devService,
        wixInstance,
        editorProps,
        modals: modalService
      },
      config: { disableDownloadDefault },
      publicCommands: getPublicCommands(),
      nodeId
    });
    closeModal();
  };
  return /* @__PURE__ */ React.createElement(FormField, { label: t("VideoCustomUploadModal_Title"), maxLines: 2 }, metaSiteId || devService().handleFileSelection || devService().handleFileUpload || editorProps.pickMedia ? /* @__PURE__ */ React.createElement(FileUpload, { onChange: () => {
  }, accept: FILE_INPUT_ACCEPT }, () => /* @__PURE__ */ React.createElement(
    Button,
    {
      dataHook: UPLOAD_TAB_UPLOAD_BUTTON,
      onClick: handleUploadClick,
      fullWidth: true,
      size: "small"
    },
    t("VideoUploadModal_CustomVideoClickText")
  )) : null);
};
export {
  UploadVideo
};
//# sourceMappingURL=upload-video.js.map
