'use client';
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
import { useModal } from '@faceless-ui/modal';
import { getTranslation } from '@payloadcms/translations';
import { reduceFieldsToValues } from 'payload/shared';
import React from 'react';
import { useAuth } from '../../../providers/Auth/index.js';
import { useConfig } from '../../../providers/Config/index.js';
import { DocumentInfoProvider } from '../../../providers/DocumentInfo/index.js';
import { useTranslation } from '../../../providers/Translation/index.js';
import { ActionsBar } from '../ActionsBar/index.js';
import { discardBulkUploadModalSlug, DiscardWithoutSaving } from '../DiscardWithoutSaving/index.js';
import { EditForm } from '../EditForm/index.js';
import { FileSidebar } from '../FileSidebar/index.js';
import { useFormsManager } from '../FormsManager/index.js';
import { DrawerHeader } from '../Header/index.js';
import './index.scss';
const baseClass = 'bulk-upload--file-manager';
export function AddingFilesView() {
    const { activeIndex, collectionSlug, docPermissions, documentSlots, forms, hasPublishPermission, hasSavePermission, hasSubmitted, resetUploadEdits, updateUploadEdits } = useFormsManager();
    const activeForm = forms[activeIndex];
    const { getEntityConfig } = useConfig();
    const { i18n } = useTranslation();
    const { user } = useAuth();
    const { openModal } = useModal();
    const collectionConfig = getEntityConfig({
        collectionSlug
    });
    return /*#__PURE__*/ _jsxDEV("div", {
        className: baseClass,
        children: [
            /*#__PURE__*/ _jsxDEV(FileSidebar, {}, void 0, false, {
                fileName: "src/elements/BulkUpload/AddingFilesView/index.tsx",
                lineNumber: 45,
                columnNumber: 7
            }, this),
            /*#__PURE__*/ _jsxDEV("div", {
                className: `${baseClass}__editView`,
                children: [
                    /*#__PURE__*/ _jsxDEV(DrawerHeader, {
                        onClose: ()=>openModal(discardBulkUploadModalSlug),
                        title: getTranslation(collectionConfig.labels.singular, i18n)
                    }, void 0, false, {
                        fileName: "src/elements/BulkUpload/AddingFilesView/index.tsx",
                        lineNumber: 48,
                        columnNumber: 9
                    }, this),
                    activeForm ? /*#__PURE__*/ _jsxDEV(DocumentInfoProvider, {
                        collectionSlug: collectionSlug,
                        currentEditor: user,
                        docPermissions: docPermissions,
                        hasPublishedDoc: false,
                        hasPublishPermission: hasPublishPermission,
                        hasSavePermission: hasSavePermission,
                        id: null,
                        initialData: reduceFieldsToValues(activeForm.formState, true),
                        initialState: activeForm.formState,
                        isLocked: false,
                        lastUpdateTime: 0,
                        mostRecentVersionIsAutosaved: false,
                        unpublishedVersionCount: 0,
                        Upload: documentSlots.Upload,
                        versionCount: 0,
                        children: [
                            /*#__PURE__*/ _jsxDEV(ActionsBar, {
                                collectionConfig: collectionConfig
                            }, void 0, false, {
                                fileName: "src/elements/BulkUpload/AddingFilesView/index.tsx",
                                lineNumber: 71,
                                columnNumber: 13
                            }, this),
                            /*#__PURE__*/ _jsxDEV(EditForm, {
                                resetUploadEdits: resetUploadEdits,
                                submitted: hasSubmitted,
                                updateUploadEdits: updateUploadEdits,
                                uploadEdits: activeForm?.uploadEdits
                            }, void 0, false, {
                                fileName: "src/elements/BulkUpload/AddingFilesView/index.tsx",
                                lineNumber: 72,
                                columnNumber: 13
                            }, this)
                        ]
                    }, `${activeIndex}-${forms.length}`, true, {
                        fileName: "src/elements/BulkUpload/AddingFilesView/index.tsx",
                        lineNumber: 53,
                        columnNumber: 11
                    }, this) : null
                ]
            }, void 0, true, {
                fileName: "src/elements/BulkUpload/AddingFilesView/index.tsx",
                lineNumber: 47,
                columnNumber: 7
            }, this),
            /*#__PURE__*/ _jsxDEV(DiscardWithoutSaving, {}, void 0, false, {
                fileName: "src/elements/BulkUpload/AddingFilesView/index.tsx",
                lineNumber: 82,
                columnNumber: 7
            }, this)
        ]
    }, void 0, true, {
        fileName: "src/elements/BulkUpload/AddingFilesView/index.tsx",
        lineNumber: 44,
        columnNumber: 5
    }, this);
}

//# sourceMappingURL=index.js.map