{"version":3,"sources":["jsdelivr-header.js","/npm/@uppy/core@4.5.3/lib/BasePlugin.js","/npm/@uppy/core@4.5.3/lib/loggers.js","/npm/@uppy/core@4.5.3/lib/UIPlugin.js","/npm/@uppy/core@4.5.3/lib/getFileName.js","/npm/@uppy/core@4.5.3/lib/locale.js","/npm/@uppy/core@4.5.3/lib/Restricter.js","/npm/@uppy/core@4.5.3/lib/supportsUploadProgress.js","/npm/@uppy/core@4.5.3/lib/Uppy.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,szBCGe,MAAM,CAAW,CAC5B,KACA,KACA,GACA,cACA,KACA,UACA,KACA,QACA,YAAY,EAAM,EAAM,CACpB,KAAK,KAAO,EACZ,KAAK,KAAO,GAAQ,CAAA,CACxB,CACA,gBAAiB,CACb,KAAM,CAAE,QAAA,CAAO,EAAK,KAAK,KAAK,SAAQ,EACtC,OAAQ,IAAU,KAAK,EAAE,GAAK,CAAA,CAClC,CACA,eAAe,EAAQ,CACnB,KAAM,CAAE,QAAA,CAAO,EAAK,KAAK,KAAK,SAAQ,EACtC,KAAK,KAAK,SAAS,CACf,QAAS,CACL,GAAG,EACH,CAAC,KAAK,EAAE,EAAG,CACP,GAAG,EAAQ,KAAK,EAAE,EAClB,GAAG,CACvB,CACA,CACA,CAAS,CACL,CACA,WAAW,EAAS,CAChB,KAAK,KAAO,CAAE,GAAG,KAAK,KAAM,GAAG,CAAO,EACtC,KAAK,eAAe,MAAS,EAC7B,KAAK,SAAQ,CACjB,CACA,UAAW,CACP,MAAM,EAAa,IAAI,EAAW,CAC9B,KAAK,cACL,KAAK,KAAK,OACV,KAAK,KAAK,MACtB,CAAS,EACD,KAAK,KAAO,EAAW,UAAU,KAAK,CAAU,EAChD,KAAK,UAAY,EAAW,eAAe,KAAK,CAAU,EAC1D,KAAK,eAAe,MAAS,CACjC,CAOA,UAAU,EAAQ,CACd,MAAM,IAAI,MAAM,2EAA2E,CAC/F,CACA,SAAU,CAAE,CACZ,WA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AQ,EAC7C,YAAK,KAAK,WAAY,CAAM,EACrB,CACX,CAAC,EACI,MAAO,GAAQ,CAChB,WAAK,KAAK,QAAS,CAAG,EACtB,KAAK,IAAI,EAAK,OAAO,EACf,CACV,CAAC,EACL,CACJ","file":"/npm/@uppy/core@4.5.3/lib/index.js/+esm","sourceRoot":"","sourcesContent":["/**\n * Bundled by jsDelivr using Rollup v4.62.2 and esbuild v0.28.1.\n * Original file: /npm/@uppy/core@4.5.3/lib/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/**\n * Core plugin logic that all plugins share.\n *\n * BasePlugin does not contain DOM rendering so it can be used for plugins\n * without a user interface.\n *\n * See `Plugin` for the extended version with Preact rendering for interfaces.\n */\nimport Translator from '@uppy/utils/lib/Translator';\nexport default class BasePlugin {\n    uppy;\n    opts;\n    id;\n    defaultLocale;\n    i18n;\n    i18nArray;\n    type;\n    VERSION;\n    constructor(uppy, opts) {\n        this.uppy = uppy;\n        this.opts = opts ?? {};\n    }\n    getPluginState() {\n        const { plugins } = this.uppy.getState();\n        return (plugins?.[this.id] || {});\n    }\n    setPluginState(update) {\n        const { plugins } = this.uppy.getState();\n        this.uppy.setState({\n            plugins: {\n                ...plugins,\n                [this.id]: {\n                    ...plugins[this.id],\n                    ...update,\n                },\n            },\n        });\n    }\n    setOptions(newOpts) {\n        this.opts = { ...this.opts, ...newOpts };\n        this.setPluginState(undefined); // so that UI re-renders with new options\n        this.i18nInit();\n    }\n    i18nInit() {\n        const translator = new Translator([\n            this.defaultLocale,\n            this.uppy.locale,\n            this.opts.locale,\n        ]);\n        this.i18n = translator.translate.bind(translator);\n        this.i18nArray = translator.translateArray.bind(translator);\n        this.setPluginState(undefined); // so that UI re-renders and we see the updated locale\n    }\n    /**\n     * Extendable methods\n     * ==================\n     * These methods are here to serve as an overview of the extendable methods as well as\n     * making them not conditional in use, such as `if (this.afterUpdate)`.\n     */\n    addTarget(plugin) {\n        throw new Error(\"Extend the addTarget method to add your plugin to another plugin's target\");\n    }\n    install() { }\n    uninstall() { }\n    update(state) { }\n    // Called after every state update, after everything's mounted. Debounced.\n    afterUpdate() { }\n}\n","import getTimeStamp from '@uppy/utils/lib/getTimeStamp';\n// Swallow all logs, except errors.\n// default if logger is not set or debug: false\nconst justErrorsLogger = {\n    debug: () => { },\n    warn: () => { },\n    error: (...args) => console.error(`[Uppy] [${getTimeStamp()}]`, ...args),\n};\n// Print logs to console with namespace + timestamp,\n// set by logger: Uppy.debugLogger or debug: true\nconst debugLogger = {\n    debug: (...args) => console.debug(`[Uppy] [${getTimeStamp()}]`, ...args),\n    warn: (...args) => console.warn(`[Uppy] [${getTimeStamp()}]`, ...args),\n    error: (...args) => console.error(`[Uppy] [${getTimeStamp()}]`, ...args),\n};\nexport { justErrorsLogger, debugLogger };\n","import findDOMElement from '@uppy/utils/lib/findDOMElement';\nimport getTextDirection from '@uppy/utils/lib/getTextDirection';\nimport { render } from 'preact/compat';\nimport BasePlugin from './BasePlugin.js';\n/**\n * Defer a frequent call to the microtask queue.\n */\nfunction debounce(fn) {\n    let calling = null;\n    let latestArgs;\n    return (...args) => {\n        latestArgs = args;\n        if (!calling) {\n            calling = Promise.resolve().then(() => {\n                calling = null;\n                // At this point `args` may be different from the most\n                // recent state, if multiple calls happened since this task\n                // was queued. So we use the `latestArgs`, which definitely\n                // is the most recent call.\n                return fn(...latestArgs);\n            });\n        }\n        return calling;\n    };\n}\n/**\n * UIPlugin is the extended version of BasePlugin to incorporate rendering with Preact.\n * Use this for plugins that need a user interface.\n *\n * For plugins without an user interface, see BasePlugin.\n */\nclass UIPlugin extends BasePlugin {\n    #updateUI;\n    isTargetDOMEl;\n    el;\n    parent;\n    title;\n    getTargetPlugin(target) {\n        let targetPlugin;\n        if (typeof target?.addTarget === 'function') {\n            // Targeting a plugin *instance*\n            targetPlugin = target;\n            if (!(targetPlugin instanceof UIPlugin)) {\n                console.warn(new Error('The provided plugin is not an instance of UIPlugin. This is an indication of a bug with the way Uppy is bundled.', { cause: { targetPlugin, UIPlugin } }));\n            }\n        }\n        else if (typeof target === 'function') {\n            // Targeting a plugin type\n            const Target = target;\n            // Find the target plugin instance.\n            this.uppy.iteratePlugins((p) => {\n                if (p instanceof Target) {\n                    targetPlugin = p;\n                }\n            });\n        }\n        return targetPlugin;\n    }\n    /**\n     * Check if supplied `target` is a DOM element or an `object`.\n     * If it’s an object — target is a plugin, and we search `plugins`\n     * for a plugin with same name and return its target.\n     */\n    mount(target, plugin) {\n        const callerPluginName = plugin.id;\n        const targetElement = findDOMElement(target);\n        if (targetElement) {\n            this.isTargetDOMEl = true;\n            // When target is <body> with a single <div> element,\n            // Preact thinks it’s the Uppy root element in there when doing a diff,\n            // and destroys it. So we are creating a fragment (could be empty div)\n            const uppyRootElement = document.createElement('div');\n            uppyRootElement.classList.add('uppy-Root');\n            // API for plugins that require a synchronous rerender.\n            this.#updateUI = debounce((state) => {\n                // plugin could be removed, but this.rerender is debounced below,\n                // so it could still be called even after uppy.removePlugin or uppy.destroy\n                // hence the check\n                if (!this.uppy.getPlugin(this.id))\n                    return;\n                render(this.render(state, uppyRootElement), uppyRootElement);\n                this.afterUpdate();\n            });\n            this.uppy.log(`Installing ${callerPluginName} to a DOM element '${target}'`);\n            if (this.opts.replaceTargetContent) {\n                // Doing render(h(null), targetElement), which should have been\n                // a better way, since because the component might need to do additional cleanup when it is removed,\n                // stopped working — Preact just adds null into target, not replacing\n                targetElement.innerHTML = '';\n            }\n            render(this.render(this.uppy.getState(), uppyRootElement), uppyRootElement);\n            this.el = uppyRootElement;\n            targetElement.appendChild(uppyRootElement);\n            // Set the text direction if the page has not defined one.\n            uppyRootElement.dir =\n                this.opts.direction || getTextDirection(uppyRootElement) || 'ltr';\n            this.onMount();\n            return this.el;\n        }\n        const targetPlugin = this.getTargetPlugin(target);\n        if (targetPlugin) {\n            this.uppy.log(`Installing ${callerPluginName} to ${targetPlugin.id}`);\n            this.parent = targetPlugin;\n            this.el = targetPlugin.addTarget(plugin);\n            this.onMount();\n            return this.el;\n        }\n        this.uppy.log(`Not installing ${callerPluginName}`);\n        let message = `Invalid target option given to ${callerPluginName}.`;\n        if (typeof target === 'function') {\n            message +=\n                ' The given target is not a Plugin class. ' +\n                    \"Please check that you're not specifying a React Component instead of a plugin. \" +\n                    'If you are using @uppy/* packages directly, make sure you have only 1 version of @uppy/core installed: ' +\n                    'run `npm ls @uppy/core` on the command line and verify that all the versions match and are deduped correctly.';\n        }\n        else {\n            message +=\n                'If you meant to target an HTML element, please make sure that the element exists. ' +\n                    'Check that the <script> tag initializing Uppy is right before the closing </body> tag at the end of the page. ' +\n                    '(see https://github.com/transloadit/uppy/issues/1042)\\n\\n' +\n                    'If you meant to target a plugin, please confirm that your `import` statements or `require` calls are correct.';\n        }\n        throw new Error(message);\n    }\n    /**\n     * Called when plugin is mounted, whether in DOM or into another plugin.\n     * Needed because sometimes plugins are mounted separately/after `install`,\n     * so this.el and this.parent might not be available in `install`.\n     * This is the case with @uppy/react plugins, for example.\n     */\n    render(state, container) {\n        throw new Error('Extend the render method to add your plugin to a DOM element');\n    }\n    update(state) {\n        if (this.el != null) {\n            this.#updateUI?.(state);\n        }\n    }\n    unmount() {\n        if (this.isTargetDOMEl) {\n            this.el?.remove();\n        }\n        this.onUnmount();\n    }\n    onMount() { }\n    onUnmount() { }\n}\nexport default UIPlugin;\n","export default function getFileName(fileType, fileDescriptor) {\n    if (fileDescriptor.name) {\n        return fileDescriptor.name;\n    }\n    if (fileType.split('/')[0] === 'image') {\n        return `${fileType.split('/')[0]}.${fileType.split('/')[1]}`;\n    }\n    return 'noname';\n}\n","export default {\n    strings: {\n        addBulkFilesFailed: {\n            0: 'Failed to add %{smart_count} file due to an internal error',\n            1: 'Failed to add %{smart_count} files due to internal errors',\n        },\n        youCanOnlyUploadX: {\n            0: 'You can only upload %{smart_count} file',\n            1: 'You can only upload %{smart_count} files',\n        },\n        youHaveToAtLeastSelectX: {\n            0: 'You have to select at least %{smart_count} file',\n            1: 'You have to select at least %{smart_count} files',\n        },\n        aggregateExceedsSize: 'You selected %{size} of files, but maximum allowed size is %{sizeAllowed}',\n        exceedsSize: '%{file} exceeds maximum allowed size of %{size}',\n        missingRequiredMetaField: 'Missing required meta fields',\n        missingRequiredMetaFieldOnFile: 'Missing required meta fields in %{fileName}',\n        inferiorSize: 'This file is smaller than the allowed size of %{size}',\n        youCanOnlyUploadFileTypes: 'You can only upload: %{types}',\n        noMoreFilesAllowed: 'Cannot add more files',\n        noDuplicates: \"Cannot add the duplicate file '%{fileName}', it already exists\",\n        companionError: 'Connection with Companion failed',\n        authAborted: 'Authentication aborted',\n        companionUnauthorizeHint: 'To unauthorize to your %{provider} account, please go to %{url}',\n        failedToUpload: 'Failed to upload %{file}',\n        noInternetConnection: 'No Internet connection',\n        connectedToInternet: 'Connected to the Internet',\n        // Strings for remote providers\n        noFilesFound: 'You have no files or folders here',\n        noSearchResults: 'Unfortunately, there are no results for this search',\n        selectX: {\n            0: 'Select %{smart_count}',\n            1: 'Select %{smart_count}',\n        },\n        allFilesFromFolderNamed: 'All files from folder %{name}',\n        openFolderNamed: 'Open folder %{name}',\n        cancel: 'Cancel',\n        logOut: 'Log out',\n        logIn: 'Log in',\n        pickFiles: 'Pick files',\n        pickPhotos: 'Pick photos',\n        filter: 'Filter',\n        resetFilter: 'Reset filter',\n        loading: 'Loading...',\n        loadedXFiles: 'Loaded %{numFiles} files',\n        authenticateWithTitle: 'Please authenticate with %{pluginName} to select files',\n        authenticateWith: 'Connect to %{pluginName}',\n        signInWithGoogle: 'Sign in with Google',\n        searchImages: 'Search for images',\n        enterTextToSearch: 'Enter text to search for images',\n        search: 'Search',\n        resetSearch: 'Reset search',\n        emptyFolderAdded: 'No files were added from empty folder',\n        addedNumFiles: 'Added %{numFiles} file(s)',\n        folderAlreadyAdded: 'The folder \"%{folder}\" was already added',\n        folderAdded: {\n            0: 'Added %{smart_count} file from %{folder}',\n            1: 'Added %{smart_count} files from %{folder}',\n        },\n        additionalRestrictionsFailed: '%{count} additional restrictions were not fulfilled',\n        unnamed: 'Unnamed',\n        pleaseWait: 'Please wait',\n    },\n};\n","import prettierBytes from '@transloadit/prettier-bytes';\n// @ts-ignore untyped\nimport match from 'mime-match';\nconst defaultOptions = {\n    maxFileSize: null,\n    minFileSize: null,\n    maxTotalFileSize: null,\n    maxNumberOfFiles: null,\n    minNumberOfFiles: null,\n    allowedFileTypes: null,\n    requiredMetaFields: [],\n};\nclass RestrictionError extends Error {\n    isUserFacing;\n    file;\n    constructor(message, opts) {\n        super(message);\n        this.isUserFacing = opts?.isUserFacing ?? true;\n        if (opts?.file) {\n            this.file = opts.file; // only some restriction errors are related to a particular file\n        }\n    }\n    isRestriction = true;\n}\nclass Restricter {\n    getI18n;\n    getOpts;\n    constructor(getOpts, getI18n) {\n        this.getI18n = getI18n;\n        this.getOpts = () => {\n            const opts = getOpts();\n            if (opts.restrictions?.allowedFileTypes != null &&\n                !Array.isArray(opts.restrictions.allowedFileTypes)) {\n                throw new TypeError('`restrictions.allowedFileTypes` must be an array');\n            }\n            return opts;\n        };\n    }\n    // Because these operations are slow, we cannot run them for every file (if we are adding multiple files)\n    validateAggregateRestrictions(existingFiles, addingFiles) {\n        const { maxTotalFileSize, maxNumberOfFiles } = this.getOpts().restrictions;\n        if (maxNumberOfFiles) {\n            const nonGhostFiles = existingFiles.filter((f) => !f.isGhost);\n            if (nonGhostFiles.length + addingFiles.length > maxNumberOfFiles) {\n                throw new RestrictionError(`${this.getI18n()('youCanOnlyUploadX', {\n                    smart_count: maxNumberOfFiles,\n                })}`);\n            }\n        }\n        if (maxTotalFileSize) {\n            const totalFilesSize = [...existingFiles, ...addingFiles].reduce((total, f) => total + (f.size ?? 0), 0);\n            if (totalFilesSize > maxTotalFileSize) {\n                throw new RestrictionError(this.getI18n()('aggregateExceedsSize', {\n                    sizeAllowed: prettierBytes(maxTotalFileSize),\n                    size: prettierBytes(totalFilesSize),\n                }));\n            }\n        }\n    }\n    validateSingleFile(file) {\n        const { maxFileSize, minFileSize, allowedFileTypes } = this.getOpts().restrictions;\n        if (allowedFileTypes) {\n            const isCorrectFileType = allowedFileTypes.some((type) => {\n                // check if this is a mime-type\n                if (type.includes('/')) {\n                    if (!file.type)\n                        return false;\n                    return match(file.type.replace(/;.*?$/, ''), type);\n                }\n                // otherwise this is likely an extension\n                if (type[0] === '.' && file.extension) {\n                    return file.extension.toLowerCase() === type.slice(1).toLowerCase();\n                }\n                return false;\n            });\n            if (!isCorrectFileType) {\n                const allowedFileTypesString = allowedFileTypes.join(', ');\n                throw new RestrictionError(this.getI18n()('youCanOnlyUploadFileTypes', {\n                    types: allowedFileTypesString,\n                }), { file });\n            }\n        }\n        // We can't check maxFileSize if the size is unknown.\n        if (maxFileSize && file.size != null && file.size > maxFileSize) {\n            throw new RestrictionError(this.getI18n()('exceedsSize', {\n                size: prettierBytes(maxFileSize),\n                file: file.name ?? this.getI18n()('unnamed'),\n            }), { file });\n        }\n        // We can't check minFileSize if the size is unknown.\n        if (minFileSize && file.size != null && file.size < minFileSize) {\n            throw new RestrictionError(this.getI18n()('inferiorSize', {\n                size: prettierBytes(minFileSize),\n            }), { file });\n        }\n    }\n    validate(existingFiles, addingFiles) {\n        addingFiles.forEach((addingFile) => {\n            this.validateSingleFile(addingFile);\n        });\n        this.validateAggregateRestrictions(existingFiles, addingFiles);\n    }\n    validateMinNumberOfFiles(files) {\n        const { minNumberOfFiles } = this.getOpts().restrictions;\n        if (minNumberOfFiles && Object.keys(files).length < minNumberOfFiles) {\n            throw new RestrictionError(this.getI18n()('youHaveToAtLeastSelectX', {\n                smart_count: minNumberOfFiles,\n            }));\n        }\n    }\n    getMissingRequiredMetaFields(file) {\n        const error = new RestrictionError(this.getI18n()('missingRequiredMetaFieldOnFile', {\n            fileName: file.name ?? this.getI18n()('unnamed'),\n        }));\n        const { requiredMetaFields } = this.getOpts().restrictions;\n        const missingFields = [];\n        for (const field of requiredMetaFields) {\n            if (!Object.hasOwn(file.meta, field) || file.meta[field] === '') {\n                missingFields.push(field);\n            }\n        }\n        return { missingFields, error };\n    }\n}\nexport { Restricter, defaultOptions, RestrictionError };\n","// Edge 15.x does not fire 'progress' events on uploads.\n// See https://github.com/transloadit/uppy/issues/945\n// And https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12224510/\nexport default function supportsUploadProgress(userAgent) {\n    // Allow passing in userAgent for tests\n    if (userAgent == null && typeof navigator !== 'undefined') {\n        userAgent = navigator.userAgent;\n    }\n    // Assume it works because basically everything supports progress events.\n    if (!userAgent)\n        return true;\n    const m = /Edge\\/(\\d+\\.\\d+)/.exec(userAgent);\n    if (!m)\n        return true;\n    const edgeVersion = m[1];\n    const version = edgeVersion.split('.', 2);\n    const major = parseInt(version[0], 10);\n    const minor = parseInt(version[1], 10);\n    // Worked before:\n    // Edge 40.15063.0.0\n    // Microsoft EdgeHTML 15.15063\n    if (major < 15 || (major === 15 && minor < 15063)) {\n        return true;\n    }\n    // Fixed in:\n    // Microsoft EdgeHTML 18.18218\n    if (major > 18 || (major === 18 && minor >= 18218)) {\n        return true;\n    }\n    // other versions don't work.\n    return false;\n}\n","/* global AggregateError */\nimport DefaultStore, {} from '@uppy/store-default';\nimport { getSafeFileId } from '@uppy/utils/lib/generateFileID';\nimport getFileNameAndExtension from '@uppy/utils/lib/getFileNameAndExtension';\nimport getFileType from '@uppy/utils/lib/getFileType';\nimport Translator from '@uppy/utils/lib/Translator';\nimport throttle from 'lodash/throttle.js';\n// @ts-ignore untyped\nimport ee from 'namespace-emitter';\nimport { nanoid } from 'nanoid/non-secure';\nimport packageJson from '../package.json' with { type: 'json' };\nimport getFileName from './getFileName.js';\nimport locale from './locale.js';\nimport { debugLogger, justErrorsLogger } from './loggers.js';\nimport { defaultOptions as defaultRestrictionOptions, Restricter, RestrictionError, } from './Restricter.js';\nimport supportsUploadProgress from './supportsUploadProgress.js';\nconst defaultUploadState = {\n    totalProgress: 0,\n    allowNewUpload: true,\n    error: null,\n    recoveredState: null,\n};\n/**\n * Uppy Core module.\n * Manages plugins, state updates, acts as an event bus,\n * adds/removes files and metadata.\n */\nexport class Uppy {\n    static VERSION = packageJson.version;\n    #plugins = Object.create(null);\n    #restricter;\n    #storeUnsubscribe;\n    #emitter = ee();\n    #preProcessors = new Set();\n    #uploaders = new Set();\n    #postProcessors = new Set();\n    defaultLocale;\n    locale;\n    // The user optionally passes in options, but we set defaults for missing options.\n    // We consider all options present after the contructor has run.\n    opts;\n    store;\n    // Warning: do not use this from a plugin, as it will cause the plugins' translations to be missing\n    i18n;\n    i18nArray;\n    scheduledAutoProceed = null;\n    wasOffline = false;\n    /**\n     * Instantiate Uppy\n     */\n    constructor(opts) {\n        this.defaultLocale = locale;\n        const defaultOptions = {\n            id: 'uppy',\n            autoProceed: false,\n            allowMultipleUploadBatches: true,\n            debug: false,\n            restrictions: defaultRestrictionOptions,\n            meta: {},\n            onBeforeFileAdded: (file, files) => !Object.hasOwn(files, file.id),\n            onBeforeUpload: (files) => files,\n            store: new DefaultStore(),\n            logger: justErrorsLogger,\n            infoTimeout: 5000,\n        };\n        const merged = { ...defaultOptions, ...opts };\n        // Merge default options with the ones set by user,\n        // making sure to merge restrictions too\n        this.opts = {\n            ...merged,\n            restrictions: {\n                ...defaultOptions.restrictions,\n                ...opts?.restrictions,\n            },\n        };\n        // Support debug: true for backwards-compatability, unless logger is set in opts\n        // opts instead of this.opts to avoid comparing objects — we set logger: justErrorsLogger in defaultOptions\n        if (opts?.logger && opts.debug) {\n            this.log('You are using a custom `logger`, but also set `debug: true`, which uses built-in logger to output logs to console. Ignoring `debug: true` and using your custom `logger`.', 'warning');\n        }\n        else if (opts?.debug) {\n            this.opts.logger = debugLogger;\n        }\n        this.log(`Using Core v${Uppy.VERSION}`);\n        this.i18nInit();\n        this.store = this.opts.store;\n        this.setState({\n            ...defaultUploadState,\n            plugins: {},\n            files: {},\n            currentUploads: {},\n            capabilities: {\n                uploadProgress: supportsUploadProgress(),\n                individualCancellation: true,\n                resumableUploads: false,\n            },\n            meta: { ...this.opts.meta },\n            info: [],\n        });\n        this.#restricter = new Restricter(() => this.opts, () => this.i18n);\n        this.#storeUnsubscribe = this.store.subscribe((prevState, nextState, patch) => {\n            this.emit('state-update', prevState, nextState, patch);\n            this.updateAll(nextState);\n        });\n        // Exposing uppy object on window for debugging and testing\n        if (this.opts.debug && typeof window !== 'undefined') {\n            // @ts-ignore Mutating the global object for debug purposes\n            window[this.opts.id] = this;\n        }\n        this.#addListeners();\n    }\n    emit(event, ...args) {\n        this.#emitter.emit(event, ...args);\n    }\n    on(event, callback) {\n        this.#emitter.on(event, callback);\n        return this;\n    }\n    once(event, callback) {\n        this.#emitter.once(event, callback);\n        return this;\n    }\n    off(event, callback) {\n        this.#emitter.off(event, callback);\n        return this;\n    }\n    /**\n     * Iterate on all plugins and run `update` on them.\n     * Called each time state changes.\n     *\n     */\n    updateAll(state) {\n        this.iteratePlugins((plugin) => {\n            plugin.update(state);\n        });\n    }\n    /**\n     * Updates state with a patch\n     */\n    setState(patch) {\n        this.store.setState(patch);\n    }\n    /**\n     * Returns current state.\n     */\n    getState() {\n        return this.store.getState();\n    }\n    patchFilesState(filesWithNewState) {\n        const existingFilesState = this.getState().files;\n        this.setState({\n            files: {\n                ...existingFilesState,\n                ...Object.fromEntries(Object.entries(filesWithNewState).map(([fileID, newFileState]) => [\n                    fileID,\n                    {\n                        ...existingFilesState[fileID],\n                        ...newFileState,\n                    },\n                ])),\n            },\n        });\n    }\n    /**\n     * Shorthand to set state for a specific file.\n     */\n    setFileState(fileID, state) {\n        if (!this.getState().files[fileID]) {\n            throw new Error(`Can’t set state for ${fileID} (the file could have been removed)`);\n        }\n        this.patchFilesState({ [fileID]: state });\n    }\n    i18nInit() {\n        const onMissingKey = (key) => this.log(`Missing i18n string: ${key}`, 'error');\n        const translator = new Translator([this.defaultLocale, this.opts.locale], {\n            onMissingKey,\n        });\n        this.i18n = translator.translate.bind(translator);\n        this.i18nArray = translator.translateArray.bind(translator);\n        this.locale = translator.locale;\n    }\n    setOptions(newOpts) {\n        this.opts = {\n            ...this.opts,\n            ...newOpts,\n            restrictions: {\n                ...this.opts.restrictions,\n                ...newOpts?.restrictions,\n            },\n        };\n        if (newOpts.meta) {\n            this.setMeta(newOpts.meta);\n        }\n        this.i18nInit();\n        if (newOpts.locale) {\n            this.iteratePlugins((plugin) => {\n                plugin.setOptions(newOpts);\n            });\n        }\n        // Note: this is not the preact `setState`, it's an internal function that has the same name.\n        this.setState(undefined); // so that UI re-renders with new options\n    }\n    resetProgress() {\n        const defaultProgress = {\n            percentage: 0,\n            bytesUploaded: false,\n            uploadComplete: false,\n            uploadStarted: null,\n        };\n        const files = { ...this.getState().files };\n        const updatedFiles = Object.create(null);\n        Object.keys(files).forEach((fileID) => {\n            updatedFiles[fileID] = {\n                ...files[fileID],\n                progress: {\n                    ...files[fileID].progress,\n                    ...defaultProgress,\n                },\n                // @ts-expect-error these typed are inserted\n                // into the namespace in their respective packages\n                // but core isn't ware of those\n                tus: undefined,\n                transloadit: undefined,\n            };\n        });\n        this.setState({ files: updatedFiles, ...defaultUploadState });\n    }\n    clear() {\n        const { capabilities, currentUploads } = this.getState();\n        if (Object.keys(currentUploads).length > 0 &&\n            !capabilities.individualCancellation) {\n            throw new Error('The installed uploader plugin does not allow removing files during an upload.');\n        }\n        this.setState({ ...defaultUploadState, files: {} });\n    }\n    addPreProcessor(fn) {\n        this.#preProcessors.add(fn);\n    }\n    removePreProcessor(fn) {\n        return this.#preProcessors.delete(fn);\n    }\n    addPostProcessor(fn) {\n        this.#postProcessors.add(fn);\n    }\n    removePostProcessor(fn) {\n        return this.#postProcessors.delete(fn);\n    }\n    addUploader(fn) {\n        this.#uploaders.add(fn);\n    }\n    removeUploader(fn) {\n        return this.#uploaders.delete(fn);\n    }\n    setMeta(data) {\n        const updatedMeta = { ...this.getState().meta, ...data };\n        const updatedFiles = { ...this.getState().files };\n        Object.keys(updatedFiles).forEach((fileID) => {\n            updatedFiles[fileID] = {\n                ...updatedFiles[fileID],\n                meta: { ...updatedFiles[fileID].meta, ...data },\n            };\n        });\n        this.log('Adding metadata:');\n        this.log(data);\n        this.setState({\n            meta: updatedMeta,\n            files: updatedFiles,\n        });\n    }\n    setFileMeta(fileID, data) {\n        const updatedFiles = { ...this.getState().files };\n        if (!updatedFiles[fileID]) {\n            this.log(`Was trying to set metadata for a file that has been removed: ${fileID}`);\n            return;\n        }\n        const newMeta = { ...updatedFiles[fileID].meta, ...data };\n        updatedFiles[fileID] = { ...updatedFiles[fileID], meta: newMeta };\n        this.setState({ files: updatedFiles });\n    }\n    /**\n     * Get a file object.\n     */\n    getFile(fileID) {\n        return this.getState().files[fileID];\n    }\n    /**\n     * Get all files in an array.\n     */\n    getFiles() {\n        const { files } = this.getState();\n        return Object.values(files);\n    }\n    getFilesByIds(ids) {\n        return ids.map((id) => this.getFile(id));\n    }\n    getObjectOfFilesPerState() {\n        const { files: filesObject, totalProgress, error } = this.getState();\n        const files = Object.values(filesObject);\n        const inProgressFiles = [];\n        const newFiles = [];\n        const startedFiles = [];\n        const uploadStartedFiles = [];\n        const pausedFiles = [];\n        const completeFiles = [];\n        const erroredFiles = [];\n        const inProgressNotPausedFiles = [];\n        const processingFiles = [];\n        for (const file of files) {\n            const { progress } = file;\n            if (!progress.uploadComplete && progress.uploadStarted) {\n                inProgressFiles.push(file);\n                if (!file.isPaused) {\n                    inProgressNotPausedFiles.push(file);\n                }\n            }\n            if (!progress.uploadStarted) {\n                newFiles.push(file);\n            }\n            if (progress.uploadStarted ||\n                progress.preprocess ||\n                progress.postprocess) {\n                startedFiles.push(file);\n            }\n            if (progress.uploadStarted) {\n                uploadStartedFiles.push(file);\n            }\n            if (file.isPaused) {\n                pausedFiles.push(file);\n            }\n            if (progress.uploadComplete) {\n                completeFiles.push(file);\n            }\n            if (file.error) {\n                erroredFiles.push(file);\n            }\n            if (progress.preprocess || progress.postprocess) {\n                processingFiles.push(file);\n            }\n        }\n        return {\n            newFiles,\n            startedFiles,\n            uploadStartedFiles,\n            pausedFiles,\n            completeFiles,\n            erroredFiles,\n            inProgressFiles,\n            inProgressNotPausedFiles,\n            processingFiles,\n            isUploadStarted: uploadStartedFiles.length > 0,\n            isAllComplete: totalProgress === 100 &&\n                completeFiles.length === files.length &&\n                processingFiles.length === 0,\n            isAllErrored: !!error && erroredFiles.length === files.length,\n            isAllPaused: inProgressFiles.length !== 0 &&\n                pausedFiles.length === inProgressFiles.length,\n            isUploadInProgress: inProgressFiles.length > 0,\n            isSomeGhost: files.some((file) => file.isGhost),\n        };\n    }\n    #informAndEmit(errors) {\n        for (const error of errors) {\n            if (error.isRestriction) {\n                this.emit('restriction-failed', error.file, error);\n            }\n            else {\n                this.emit('error', error, error.file);\n            }\n            this.log(error, 'warning');\n        }\n        const userFacingErrors = errors.filter((error) => error.isUserFacing);\n        // don't flood the user: only show the first 4 toasts\n        const maxNumToShow = 4;\n        const firstErrors = userFacingErrors.slice(0, maxNumToShow);\n        const additionalErrors = userFacingErrors.slice(maxNumToShow);\n        firstErrors.forEach(({ message, details = '' }) => {\n            this.info({ message, details }, 'error', this.opts.infoTimeout);\n        });\n        if (additionalErrors.length > 0) {\n            this.info({\n                message: this.i18n('additionalRestrictionsFailed', {\n                    count: additionalErrors.length,\n                }),\n            });\n        }\n    }\n    validateRestrictions(file, files = this.getFiles()) {\n        try {\n            this.#restricter.validate(files, [file]);\n        }\n        catch (err) {\n            return err;\n        }\n        return null;\n    }\n    validateSingleFile(file) {\n        try {\n            this.#restricter.validateSingleFile(file);\n        }\n        catch (err) {\n            return err.message;\n        }\n        return null;\n    }\n    validateAggregateRestrictions(files) {\n        const existingFiles = this.getFiles();\n        try {\n            this.#restricter.validateAggregateRestrictions(existingFiles, files);\n        }\n        catch (err) {\n            return err.message;\n        }\n        return null;\n    }\n    #checkRequiredMetaFieldsOnFile(file) {\n        const { missingFields, error } = this.#restricter.getMissingRequiredMetaFields(file);\n        if (missingFields.length > 0) {\n            this.setFileState(file.id, {\n                missingRequiredMetaFields: missingFields,\n                error: error.message,\n            });\n            this.log(error.message);\n            this.emit('restriction-failed', file, error);\n            return false;\n        }\n        if (missingFields.length === 0 && file.missingRequiredMetaFields) {\n            this.setFileState(file.id, {\n                missingRequiredMetaFields: [],\n            });\n        }\n        return true;\n    }\n    #checkRequiredMetaFields(files) {\n        let success = true;\n        for (const file of Object.values(files)) {\n            if (!this.#checkRequiredMetaFieldsOnFile(file)) {\n                success = false;\n            }\n        }\n        return success;\n    }\n    #assertNewUploadAllowed(file) {\n        const { allowNewUpload } = this.getState();\n        if (allowNewUpload === false) {\n            const error = new RestrictionError(this.i18n('noMoreFilesAllowed'), {\n                file,\n            });\n            this.#informAndEmit([error]);\n            throw error;\n        }\n    }\n    checkIfFileAlreadyExists(fileID) {\n        const { files } = this.getState();\n        if (files[fileID] && !files[fileID].isGhost) {\n            return true;\n        }\n        return false;\n    }\n    /**\n     * Create a file state object based on user-provided `addFile()` options.\n     */\n    #transformFile(fileDescriptorOrFile) {\n        // Uppy expects files in { name, type, size, data } format.\n        // If the actual File object is passed from input[type=file] or drag-drop,\n        // we normalize it to match Uppy file object\n        const file = (fileDescriptorOrFile instanceof File\n            ? {\n                name: fileDescriptorOrFile.name,\n                type: fileDescriptorOrFile.type,\n                size: fileDescriptorOrFile.size,\n                data: fileDescriptorOrFile,\n            }\n            : fileDescriptorOrFile);\n        const fileType = getFileType(file);\n        const fileName = getFileName(fileType, file);\n        const fileExtension = getFileNameAndExtension(fileName).extension;\n        const id = getSafeFileId(file, this.getID());\n        const meta = file.meta || {};\n        meta.name = fileName;\n        meta.type = fileType;\n        // `null` means the size is unknown.\n        const size = Number.isFinite(file.data.size)\n            ? file.data.size\n            : null;\n        return {\n            source: file.source || '',\n            id,\n            name: fileName,\n            extension: fileExtension || '',\n            meta: {\n                ...this.getState().meta,\n                ...meta,\n            },\n            type: fileType,\n            data: file.data,\n            progress: {\n                percentage: 0,\n                bytesUploaded: false,\n                bytesTotal: size,\n                uploadComplete: false,\n                uploadStarted: null,\n            },\n            size,\n            isGhost: false,\n            isRemote: file.isRemote || false,\n            remote: file.remote,\n            preview: file.preview,\n        };\n    }\n    // Schedule an upload if `autoProceed` is enabled.\n    #startIfAutoProceed() {\n        if (this.opts.autoProceed && !this.scheduledAutoProceed) {\n            this.scheduledAutoProceed = setTimeout(() => {\n                this.scheduledAutoProceed = null;\n                this.upload().catch((err) => {\n                    if (!err.isRestriction) {\n                        this.log(err.stack || err.message || err);\n                    }\n                });\n            }, 4);\n        }\n    }\n    #checkAndUpdateFileState(filesToAdd) {\n        let { files: existingFiles } = this.getState();\n        // create a copy of the files object only once\n        let nextFilesState = { ...existingFiles };\n        const validFilesToAdd = [];\n        const errors = [];\n        for (const fileToAdd of filesToAdd) {\n            try {\n                let newFile = this.#transformFile(fileToAdd);\n                // If a file has been recovered (Golden Retriever), but we were unable to recover its data (probably too large),\n                // users are asked to re-select these half-recovered files and then this method will be called again.\n                // In order to keep the progress, meta and everything else, we keep the existing file,\n                // but we replace `data`, and we remove `isGhost`, because the file is no longer a ghost now\n                const isGhost = existingFiles[newFile.id]?.isGhost;\n                if (isGhost) {\n                    const existingFileState = existingFiles[newFile.id];\n                    newFile = {\n                        ...existingFileState,\n                        isGhost: false,\n                        data: fileToAdd.data,\n                    };\n                    this.log(`Replaced the blob in the restored ghost file: ${newFile.name}, ${newFile.id}`);\n                }\n                const onBeforeFileAddedResult = this.opts.onBeforeFileAdded(newFile, nextFilesState);\n                // update state after onBeforeFileAdded\n                existingFiles = this.getState().files;\n                nextFilesState = { ...existingFiles, ...nextFilesState };\n                if (!onBeforeFileAddedResult &&\n                    this.checkIfFileAlreadyExists(newFile.id)) {\n                    throw new RestrictionError(this.i18n('noDuplicates', {\n                        fileName: newFile.name ?? this.i18n('unnamed'),\n                    }), { file: fileToAdd });\n                }\n                // Pass through reselected files from Golden Retriever\n                if (onBeforeFileAddedResult === false && !isGhost) {\n                    // Don’t show UI info for this error, as it should be done by the developer\n                    throw new RestrictionError('Cannot add the file because onBeforeFileAdded returned false.', { isUserFacing: false, file: fileToAdd });\n                }\n                else if (typeof onBeforeFileAddedResult === 'object' &&\n                    onBeforeFileAddedResult !== null) {\n                    newFile = onBeforeFileAddedResult;\n                }\n                this.#restricter.validateSingleFile(newFile);\n                // need to add it to the new local state immediately, so we can use the state to validate the next files too\n                nextFilesState[newFile.id] = newFile;\n                validFilesToAdd.push(newFile);\n            }\n            catch (err) {\n                errors.push(err);\n            }\n        }\n        try {\n            // need to run this separately because it's much more slow, so if we run it inside the for-loop it will be very slow\n            // when many files are added\n            this.#restricter.validateAggregateRestrictions(Object.values(existingFiles), validFilesToAdd);\n        }\n        catch (err) {\n            errors.push(err);\n            // If we have any aggregate error, don't allow adding this batch\n            return {\n                nextFilesState: existingFiles,\n                validFilesToAdd: [],\n                errors,\n            };\n        }\n        return {\n            nextFilesState,\n            validFilesToAdd,\n            errors,\n        };\n    }\n    /**\n     * Add a new file to `state.files`. This will run `onBeforeFileAdded`,\n     * try to guess file type in a clever way, check file against restrictions,\n     * and start an upload if `autoProceed === true`.\n     */\n    addFile(file) {\n        this.#assertNewUploadAllowed(file);\n        const { nextFilesState, validFilesToAdd, errors } = this.#checkAndUpdateFileState([file]);\n        const restrictionErrors = errors.filter((error) => error.isRestriction);\n        this.#informAndEmit(restrictionErrors);\n        if (errors.length > 0)\n            throw errors[0];\n        this.setState({ files: nextFilesState });\n        const [firstValidFileToAdd] = validFilesToAdd;\n        this.emit('file-added', firstValidFileToAdd);\n        this.emit('files-added', validFilesToAdd);\n        this.log(`Added file: ${firstValidFileToAdd.name}, ${firstValidFileToAdd.id}, mime type: ${firstValidFileToAdd.type}`);\n        this.#startIfAutoProceed();\n        return firstValidFileToAdd.id;\n    }\n    /**\n     * Add multiple files to `state.files`. See the `addFile()` documentation.\n     *\n     * If an error occurs while adding a file, it is logged and the user is notified.\n     * This is good for UI plugins, but not for programmatic use.\n     * Programmatic users should usually still use `addFile()` on individual files.\n     */\n    addFiles(fileDescriptors) {\n        this.#assertNewUploadAllowed();\n        const { nextFilesState, validFilesToAdd, errors } = this.#checkAndUpdateFileState(fileDescriptors);\n        const restrictionErrors = errors.filter((error) => error.isRestriction);\n        this.#informAndEmit(restrictionErrors);\n        const nonRestrictionErrors = errors.filter((error) => !error.isRestriction);\n        if (nonRestrictionErrors.length > 0) {\n            let message = 'Multiple errors occurred while adding files:\\n';\n            nonRestrictionErrors.forEach((subError) => {\n                message += `\\n * ${subError.message}`;\n            });\n            this.info({\n                message: this.i18n('addBulkFilesFailed', {\n                    smart_count: nonRestrictionErrors.length,\n                }),\n                details: message,\n            }, 'error', this.opts.infoTimeout);\n            if (typeof AggregateError === 'function') {\n                throw new AggregateError(nonRestrictionErrors, message);\n            }\n            else {\n                const err = new Error(message);\n                // @ts-expect-error fallback when AggregateError is not available\n                err.errors = nonRestrictionErrors;\n                throw err;\n            }\n        }\n        // OK, we haven't thrown an error, we can start updating state and emitting events now:\n        this.setState({ files: nextFilesState });\n        validFilesToAdd.forEach((file) => {\n            this.emit('file-added', file);\n        });\n        this.emit('files-added', validFilesToAdd);\n        if (validFilesToAdd.length > 5) {\n            this.log(`Added batch of ${validFilesToAdd.length} files`);\n        }\n        else {\n            Object.values(validFilesToAdd).forEach((file) => {\n                this.log(`Added file: ${file.name}\\n id: ${file.id}\\n type: ${file.type}`);\n            });\n        }\n        if (validFilesToAdd.length > 0) {\n            this.#startIfAutoProceed();\n        }\n    }\n    removeFiles(fileIDs) {\n        const { files, currentUploads } = this.getState();\n        const updatedFiles = { ...files };\n        const updatedUploads = { ...currentUploads };\n        const removedFiles = Object.create(null);\n        fileIDs.forEach((fileID) => {\n            if (files[fileID]) {\n                removedFiles[fileID] = files[fileID];\n                delete updatedFiles[fileID];\n            }\n        });\n        // Remove files from the `fileIDs` list in each upload.\n        function fileIsNotRemoved(uploadFileID) {\n            return removedFiles[uploadFileID] === undefined;\n        }\n        Object.keys(updatedUploads).forEach((uploadID) => {\n            const newFileIDs = currentUploads[uploadID].fileIDs.filter(fileIsNotRemoved);\n            // Remove the upload if no files are associated with it anymore.\n            if (newFileIDs.length === 0) {\n                delete updatedUploads[uploadID];\n                return;\n            }\n            const { capabilities } = this.getState();\n            if (newFileIDs.length !== currentUploads[uploadID].fileIDs.length &&\n                !capabilities.individualCancellation) {\n                throw new Error('The installed uploader plugin does not allow removing files during an upload.');\n            }\n            updatedUploads[uploadID] = {\n                ...currentUploads[uploadID],\n                fileIDs: newFileIDs,\n            };\n        });\n        const stateUpdate = {\n            currentUploads: updatedUploads,\n            files: updatedFiles,\n        };\n        // If all files were removed - allow new uploads,\n        // and clear recoveredState\n        if (Object.keys(updatedFiles).length === 0) {\n            stateUpdate.allowNewUpload = true;\n            stateUpdate.error = null;\n            stateUpdate.recoveredState = null;\n        }\n        this.setState(stateUpdate);\n        this.#updateTotalProgressThrottled();\n        const removedFileIDs = Object.keys(removedFiles);\n        removedFileIDs.forEach((fileID) => {\n            this.emit('file-removed', removedFiles[fileID]);\n        });\n        if (removedFileIDs.length > 5) {\n            this.log(`Removed ${removedFileIDs.length} files`);\n        }\n        else {\n            this.log(`Removed files: ${removedFileIDs.join(', ')}`);\n        }\n    }\n    removeFile(fileID) {\n        this.removeFiles([fileID]);\n    }\n    pauseResume(fileID) {\n        if (!this.getState().capabilities.resumableUploads ||\n            this.getFile(fileID).progress.uploadComplete) {\n            return undefined;\n        }\n        const file = this.getFile(fileID);\n        const wasPaused = file.isPaused || false;\n        const isPaused = !wasPaused;\n        this.setFileState(fileID, {\n            isPaused,\n        });\n        this.emit('upload-pause', file, isPaused);\n        return isPaused;\n    }\n    pauseAll() {\n        const updatedFiles = { ...this.getState().files };\n        const inProgressUpdatedFiles = Object.keys(updatedFiles).filter((file) => {\n            return (!updatedFiles[file].progress.uploadComplete &&\n                updatedFiles[file].progress.uploadStarted);\n        });\n        inProgressUpdatedFiles.forEach((file) => {\n            const updatedFile = { ...updatedFiles[file], isPaused: true };\n            updatedFiles[file] = updatedFile;\n        });\n        this.setState({ files: updatedFiles });\n        this.emit('pause-all');\n    }\n    resumeAll() {\n        const updatedFiles = { ...this.getState().files };\n        const inProgressUpdatedFiles = Object.keys(updatedFiles).filter((file) => {\n            return (!updatedFiles[file].progress.uploadComplete &&\n                updatedFiles[file].progress.uploadStarted);\n        });\n        inProgressUpdatedFiles.forEach((file) => {\n            const updatedFile = {\n                ...updatedFiles[file],\n                isPaused: false,\n                error: null,\n            };\n            updatedFiles[file] = updatedFile;\n        });\n        this.setState({ files: updatedFiles });\n        this.emit('resume-all');\n    }\n    #getFilesToRetry() {\n        const { files } = this.getState();\n        return Object.keys(files).filter((fileId) => {\n            const file = files[fileId];\n            // Only retry files that have errors AND don't have missing required metadata\n            return (file.error &&\n                (!file.missingRequiredMetaFields ||\n                    file.missingRequiredMetaFields.length === 0));\n        });\n    }\n    async #doRetryAll() {\n        const filesToRetry = this.#getFilesToRetry();\n        const updatedFiles = { ...this.getState().files };\n        filesToRetry.forEach((fileID) => {\n            updatedFiles[fileID] = {\n                ...updatedFiles[fileID],\n                isPaused: false,\n                error: null,\n            };\n        });\n        this.setState({\n            files: updatedFiles,\n            error: null,\n        });\n        this.emit('retry-all', this.getFilesByIds(filesToRetry));\n        if (filesToRetry.length === 0) {\n            return {\n                successful: [],\n                failed: [],\n            };\n        }\n        const uploadID = this.#createUpload(filesToRetry, {\n            forceAllowNewUpload: true, // create new upload even if allowNewUpload: false\n        });\n        return this.#runUpload(uploadID);\n    }\n    async retryAll() {\n        const result = await this.#doRetryAll();\n        this.emit('complete', result);\n        return result;\n    }\n    cancelAll() {\n        this.emit('cancel-all');\n        const { files } = this.getState();\n        const fileIDs = Object.keys(files);\n        if (fileIDs.length) {\n            this.removeFiles(fileIDs);\n        }\n        this.setState(defaultUploadState);\n    }\n    retryUpload(fileID) {\n        this.setFileState(fileID, {\n            error: null,\n            isPaused: false,\n        });\n        this.emit('upload-retry', this.getFile(fileID));\n        const uploadID = this.#createUpload([fileID], {\n            forceAllowNewUpload: true, // create new upload even if allowNewUpload: false\n        });\n        return this.#runUpload(uploadID);\n    }\n    logout() {\n        this.iteratePlugins((plugin) => {\n            ;\n            plugin.provider?.logout?.();\n        });\n    }\n    #handleUploadProgress = (file, progress) => {\n        const fileInState = file ? this.getFile(file.id) : undefined;\n        if (file == null || !fileInState) {\n            this.log(`Not setting progress for a file that has been removed: ${file?.id}`);\n            return;\n        }\n        if (fileInState.progress.percentage === 100) {\n            this.log(`Not setting progress for a file that has been already uploaded: ${file.id}`);\n            return;\n        }\n        const newProgress = {\n            bytesTotal: progress.bytesTotal,\n            // bytesTotal may be null or zero; in that case we can't divide by it\n            percentage: progress.bytesTotal != null &&\n                Number.isFinite(progress.bytesTotal) &&\n                progress.bytesTotal > 0\n                ? Math.round((progress.bytesUploaded / progress.bytesTotal) * 100)\n                : undefined,\n        };\n        if (fileInState.progress.uploadStarted != null) {\n            this.setFileState(file.id, {\n                progress: {\n                    ...fileInState.progress,\n                    ...newProgress,\n                    bytesUploaded: progress.bytesUploaded,\n                },\n            });\n        }\n        else {\n            this.setFileState(file.id, {\n                progress: {\n                    ...fileInState.progress,\n                    ...newProgress,\n                },\n            });\n        }\n        this.#updateTotalProgressThrottled();\n    };\n    #updateTotalProgress() {\n        const totalProgress = this.#calculateTotalProgress();\n        let totalProgressPercent = null;\n        if (totalProgress != null) {\n            totalProgressPercent = Math.round(totalProgress * 100);\n            if (totalProgressPercent > 100)\n                totalProgressPercent = 100;\n            else if (totalProgressPercent < 0)\n                totalProgressPercent = 0;\n        }\n        this.emit('progress', totalProgressPercent ?? 0);\n        this.setState({\n            totalProgress: totalProgressPercent ?? 0,\n        });\n    }\n    // ___Why throttle at 500ms?\n    //    - We must throttle at >250ms for superfocus in Dashboard to work well\n    //    (because animation takes 0.25s, and we want to wait for all animations to be over before refocusing).\n    //    [Practical Check]: if thottle is at 100ms, then if you are uploading a file,\n    //    and click 'ADD MORE FILES', - focus won't activate in Firefox.\n    //    - We must throttle at around >500ms to avoid performance lags.\n    //    [Practical Check] Firefox, try to upload a big file for a prolonged period of time. Laptop will start to heat up.\n    #updateTotalProgressThrottled = throttle(() => this.#updateTotalProgress(), 500, { leading: true, trailing: true });\n    [Symbol.for('uppy test: updateTotalProgress')]() {\n        return this.#updateTotalProgress();\n    }\n    #calculateTotalProgress() {\n        // calculate total progress, using the number of files currently uploading,\n        // between 0 and 1 and sum of individual progress of each file\n        const files = this.getFiles();\n        // note: also includes files that have completed uploading:\n        const filesInProgress = files.filter((file) => {\n            return (file.progress.uploadStarted ||\n                file.progress.preprocess ||\n                file.progress.postprocess);\n        });\n        if (filesInProgress.length === 0) {\n            return 0;\n        }\n        if (filesInProgress.every((file) => file.progress.uploadComplete)) {\n            // If every uploading file is complete, and we're still getting progress, it probably means\n            // there's a bug somewhere in some progress reporting code (maybe not even our code)\n            // and we're still getting progress, so let's just assume it means a 100% progress\n            return 1;\n        }\n        const isSizedFile = (file) => file.progress.bytesTotal != null && file.progress.bytesTotal !== 0;\n        const sizedFilesInProgress = filesInProgress.filter(isSizedFile);\n        const unsizedFilesInProgress = filesInProgress.filter((file) => !isSizedFile(file));\n        if (sizedFilesInProgress.every((file) => file.progress.uploadComplete) &&\n            unsizedFilesInProgress.length > 0 &&\n            !unsizedFilesInProgress.every((file) => file.progress.uploadComplete)) {\n            // we are done with uploading all files of known size, however\n            // there is at least one file with unknown size still uploading,\n            // and we cannot say anything about their progress\n            // In any case, return null because it doesn't make any sense to show a progress\n            return null;\n        }\n        const totalFilesSize = sizedFilesInProgress.reduce((acc, file) => acc + (file.progress.bytesTotal ?? 0), 0);\n        const totalUploadedSize = sizedFilesInProgress.reduce((acc, file) => acc + (file.progress.bytesUploaded || 0), 0);\n        return totalFilesSize === 0 ? 0 : totalUploadedSize / totalFilesSize;\n    }\n    /**\n     * Registers listeners for all global actions, like:\n     * `error`, `file-removed`, `upload-progress`\n     */\n    #addListeners() {\n        // Type inference only works for inline functions so we have to type it again\n        const errorHandler = (error, file, response) => {\n            let errorMsg = error.message || 'Unknown error';\n            if (error.details) {\n                errorMsg += ` ${error.details}`;\n            }\n            this.setState({ error: errorMsg });\n            if (file != null && file.id in this.getState().files) {\n                this.setFileState(file.id, {\n                    error: errorMsg,\n                    response,\n                });\n            }\n        };\n        this.on('error', errorHandler);\n        this.on('upload-error', (file, error, response) => {\n            errorHandler(error, file, response);\n            if (typeof error === 'object' && error.message) {\n                this.log(error.message, 'error');\n                const newError = new Error(this.i18n('failedToUpload', { file: file?.name ?? '' })); // we may want a new custom error here\n                newError.isUserFacing = true; // todo maybe don't do this with all errors?\n                newError.details = error.message;\n                if (error.details) {\n                    newError.details += ` ${error.details}`;\n                }\n                this.#informAndEmit([newError]);\n            }\n            else {\n                this.#informAndEmit([error]);\n            }\n        });\n        let uploadStalledWarningRecentlyEmitted = null;\n        this.on('upload-stalled', (error, files) => {\n            const { message } = error;\n            const details = files.map((file) => file.meta.name).join(', ');\n            if (!uploadStalledWarningRecentlyEmitted) {\n                this.info({ message, details }, 'warning', this.opts.infoTimeout);\n                uploadStalledWarningRecentlyEmitted = setTimeout(() => {\n                    uploadStalledWarningRecentlyEmitted = null;\n                }, this.opts.infoTimeout);\n            }\n            this.log(`${message} ${details}`.trim(), 'warning');\n        });\n        this.on('upload', () => {\n            this.setState({ error: null });\n        });\n        const onUploadStarted = (files) => {\n            const filesFiltered = files.filter((file) => {\n                const exists = file != null && this.getFile(file.id);\n                if (!exists)\n                    this.log(`Not setting progress for a file that has been removed: ${file?.id}`);\n                return exists;\n            });\n            const filesState = Object.fromEntries(filesFiltered.map((file) => [\n                file.id,\n                {\n                    progress: {\n                        uploadStarted: Date.now(),\n                        uploadComplete: false,\n                        bytesUploaded: 0,\n                        bytesTotal: file.size,\n                    },\n                },\n            ]));\n            this.patchFilesState(filesState);\n        };\n        this.on('upload-start', onUploadStarted);\n        this.on('upload-progress', this.#handleUploadProgress);\n        this.on('upload-success', (file, uploadResp) => {\n            if (file == null || !this.getFile(file.id)) {\n                this.log(`Not setting progress for a file that has been removed: ${file?.id}`);\n                return;\n            }\n            const currentProgress = this.getFile(file.id).progress;\n            this.setFileState(file.id, {\n                progress: {\n                    ...currentProgress,\n                    postprocess: this.#postProcessors.size > 0\n                        ? {\n                            mode: 'indeterminate',\n                        }\n                        : undefined,\n                    uploadComplete: true,\n                    percentage: 100,\n                    bytesUploaded: currentProgress.bytesTotal,\n                },\n                response: uploadResp,\n                uploadURL: uploadResp.uploadURL,\n                isPaused: false,\n            });\n            // Remote providers sometimes don't tell us the file size,\n            // but we can know how many bytes we uploaded once the upload is complete.\n            if (file.size == null) {\n                this.setFileState(file.id, {\n                    size: uploadResp.bytesUploaded || currentProgress.bytesTotal,\n                });\n            }\n            this.#updateTotalProgressThrottled();\n        });\n        this.on('preprocess-progress', (file, progress) => {\n            if (file == null || !this.getFile(file.id)) {\n                this.log(`Not setting progress for a file that has been removed: ${file?.id}`);\n                return;\n            }\n            this.setFileState(file.id, {\n                progress: { ...this.getFile(file.id).progress, preprocess: progress },\n            });\n        });\n        this.on('preprocess-complete', (file) => {\n            if (file == null || !this.getFile(file.id)) {\n                this.log(`Not setting progress for a file that has been removed: ${file?.id}`);\n                return;\n            }\n            const files = { ...this.getState().files };\n            files[file.id] = {\n                ...files[file.id],\n                progress: { ...files[file.id].progress },\n            };\n            delete files[file.id].progress.preprocess;\n            this.setState({ files });\n        });\n        this.on('postprocess-progress', (file, progress) => {\n            if (file == null || !this.getFile(file.id)) {\n                this.log(`Not setting progress for a file that has been removed: ${file?.id}`);\n                return;\n            }\n            this.setFileState(file.id, {\n                progress: {\n                    ...this.getState().files[file.id].progress,\n                    postprocess: progress,\n                },\n            });\n        });\n        this.on('postprocess-complete', (file) => {\n            if (file == null || !this.getFile(file.id)) {\n                this.log(`Not setting progress for a file that has been removed: ${file?.id}`);\n                return;\n            }\n            const files = {\n                ...this.getState().files,\n            };\n            files[file.id] = {\n                ...files[file.id],\n                progress: {\n                    ...files[file.id].progress,\n                },\n            };\n            delete files[file.id].progress.postprocess;\n            this.setState({ files });\n        });\n        this.on('restored', () => {\n            // Files may have changed--ensure progress is still accurate.\n            this.#updateTotalProgressThrottled();\n        });\n        // @ts-expect-error should fix itself when dashboard it typed (also this doesn't belong here)\n        this.on('dashboard:file-edit-complete', (file) => {\n            if (file) {\n                this.#checkRequiredMetaFieldsOnFile(file);\n            }\n        });\n        // show informer if offline\n        if (typeof window !== 'undefined' && window.addEventListener) {\n            window.addEventListener('online', this.#updateOnlineStatus);\n            window.addEventListener('offline', this.#updateOnlineStatus);\n            setTimeout(this.#updateOnlineStatus, 3000);\n        }\n    }\n    updateOnlineStatus() {\n        const online = window.navigator.onLine ?? true;\n        if (!online) {\n            this.emit('is-offline');\n            this.info(this.i18n('noInternetConnection'), 'error', 0);\n            this.wasOffline = true;\n        }\n        else {\n            this.emit('is-online');\n            if (this.wasOffline) {\n                this.emit('back-online');\n                this.info(this.i18n('connectedToInternet'), 'success', 3000);\n                this.wasOffline = false;\n            }\n        }\n    }\n    #updateOnlineStatus = this.updateOnlineStatus.bind(this);\n    getID() {\n        return this.opts.id;\n    }\n    /**\n     * Registers a plugin with Core.\n     */\n    use(Plugin, \n    // We want to let the plugin decide whether `opts` is optional or not\n    // so we spread the argument rather than defining `opts:` ourselves.\n    ...args) {\n        if (typeof Plugin !== 'function') {\n            const msg = `Expected a plugin class, but got ${Plugin === null ? 'null' : typeof Plugin}.` +\n                ' Please verify that the plugin was imported and spelled correctly.';\n            throw new TypeError(msg);\n        }\n        // Instantiate\n        const plugin = new Plugin(this, ...args);\n        const pluginId = plugin.id;\n        if (!pluginId) {\n            throw new Error('Your plugin must have an id');\n        }\n        if (!plugin.type) {\n            throw new Error('Your plugin must have a type');\n        }\n        const existsPluginAlready = this.getPlugin(pluginId);\n        if (existsPluginAlready) {\n            const msg = `Already found a plugin named '${existsPluginAlready.id}'. ` +\n                `Tried to use: '${pluginId}'.\\n` +\n                'Uppy plugins must have unique `id` options.';\n            throw new Error(msg);\n        }\n        // @ts-expect-error does exist\n        if (Plugin.VERSION) {\n            // @ts-expect-error does exist\n            this.log(`Using ${pluginId} v${Plugin.VERSION}`);\n        }\n        if (plugin.type in this.#plugins) {\n            this.#plugins[plugin.type].push(plugin);\n        }\n        else {\n            this.#plugins[plugin.type] = [plugin];\n        }\n        plugin.install();\n        this.emit('plugin-added', plugin);\n        return this;\n    }\n    /**\n     * Find one Plugin by name.\n     */\n    getPlugin(id) {\n        for (const plugins of Object.values(this.#plugins)) {\n            const foundPlugin = plugins.find((plugin) => plugin.id === id);\n            if (foundPlugin != null)\n                return foundPlugin;\n        }\n        return undefined;\n    }\n    [Symbol.for('uppy test: getPlugins')](type) {\n        return this.#plugins[type];\n    }\n    /**\n     * Iterate through all `use`d plugins.\n     *\n     */\n    iteratePlugins(method) {\n        Object.values(this.#plugins).flat(1).forEach(method);\n    }\n    /**\n     * Uninstall and remove a plugin.\n     *\n     * @param {object} instance The plugin instance to remove.\n     */\n    removePlugin(instance) {\n        this.log(`Removing plugin ${instance.id}`);\n        this.emit('plugin-remove', instance);\n        if (instance.uninstall) {\n            instance.uninstall();\n        }\n        const list = this.#plugins[instance.type];\n        // list.indexOf failed here, because Vue3 converted the plugin instance\n        // to a Proxy object, which failed the strict comparison test:\n        // obj !== objProxy\n        const index = list.findIndex((item) => item.id === instance.id);\n        if (index !== -1) {\n            list.splice(index, 1);\n        }\n        const state = this.getState();\n        const updatedState = {\n            plugins: {\n                ...state.plugins,\n                [instance.id]: undefined,\n            },\n        };\n        this.setState(updatedState);\n    }\n    /**\n     * Uninstall all plugins and close down this Uppy instance.\n     */\n    destroy() {\n        this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`);\n        this.cancelAll();\n        this.#storeUnsubscribe();\n        this.iteratePlugins((plugin) => {\n            this.removePlugin(plugin);\n        });\n        if (typeof window !== 'undefined' && window.removeEventListener) {\n            window.removeEventListener('online', this.#updateOnlineStatus);\n            window.removeEventListener('offline', this.#updateOnlineStatus);\n        }\n    }\n    hideInfo() {\n        const { info } = this.getState();\n        this.setState({ info: info.slice(1) });\n        this.emit('info-hidden');\n    }\n    /**\n     * Set info message in `state.info`, so that UI plugins like `Informer`\n     * can display the message.\n     */\n    info(message, type = 'info', duration = 3000) {\n        const isComplexMessage = typeof message === 'object';\n        this.setState({\n            info: [\n                ...this.getState().info,\n                {\n                    type,\n                    message: isComplexMessage ? message.message : message,\n                    details: isComplexMessage ? message.details : null,\n                },\n            ],\n        });\n        setTimeout(() => this.hideInfo(), duration);\n        this.emit('info-visible');\n    }\n    /**\n     * Passes messages to a function, provided in `opts.logger`.\n     * If `opts.logger: Uppy.debugLogger` or `opts.debug: true`, logs to the browser console.\n     */\n    log(message, type) {\n        const { logger } = this.opts;\n        switch (type) {\n            case 'error':\n                logger.error(message);\n                break;\n            case 'warning':\n                logger.warn(message);\n                break;\n            default:\n                logger.debug(message);\n                break;\n        }\n    }\n    // We need to store request clients by a unique ID, so we can share RequestClient instances across files\n    // this allows us to do rate limiting and synchronous operations like refreshing provider tokens\n    // example: refreshing tokens: if each file has their own requestclient,\n    // we don't have any way to synchronize all requests in order to\n    // - block all requests\n    // - refresh the token\n    // - unblock all requests and allow them to run with a the new access token\n    // back when we had a requestclient per file, once an access token expired,\n    // all 6 files would go ahead and refresh the token at the same time\n    // (calling /refresh-token up to 6 times), which will probably fail for some providers\n    #requestClientById = new Map();\n    registerRequestClient(id, client) {\n        this.#requestClientById.set(id, client);\n    }\n    /** @protected */\n    getRequestClientForFile(file) {\n        if (!file.remote)\n            throw new Error(`Tried to get RequestClient for a non-remote file ${file.id}`);\n        const requestClient = this.#requestClientById.get(file.remote.requestClientId);\n        if (requestClient == null)\n            throw new Error(`requestClientId \"${file.remote.requestClientId}\" not registered for file \"${file.id}\"`);\n        return requestClient;\n    }\n    /**\n     * Restore an upload by its ID.\n     */\n    restore(uploadID) {\n        this.log(`Core: attempting to restore upload \"${uploadID}\"`);\n        if (!this.getState().currentUploads[uploadID]) {\n            this.#removeUpload(uploadID);\n            return Promise.reject(new Error('Nonexistent upload'));\n        }\n        return this.#runUpload(uploadID);\n    }\n    /**\n     * Create an upload for a bunch of files.\n     *\n     */\n    #createUpload(fileIDs, opts = {}) {\n        // uppy.retryAll sets this to true — when retrying we want to ignore `allowNewUpload: false`\n        const { forceAllowNewUpload = false } = opts;\n        const { allowNewUpload, currentUploads } = this.getState();\n        if (!allowNewUpload && !forceAllowNewUpload) {\n            throw new Error('Cannot create a new upload: already uploading.');\n        }\n        const uploadID = nanoid();\n        this.emit('upload', uploadID, this.getFilesByIds(fileIDs));\n        this.setState({\n            allowNewUpload: this.opts.allowMultipleUploadBatches !== false &&\n                this.opts.allowMultipleUploads !== false,\n            currentUploads: {\n                ...currentUploads,\n                [uploadID]: {\n                    fileIDs,\n                    step: 0,\n                    result: {},\n                },\n            },\n        });\n        return uploadID;\n    }\n    [Symbol.for('uppy test: createUpload')](...args) {\n        // @ts-expect-error https://github.com/microsoft/TypeScript/issues/47595\n        return this.#createUpload(...args);\n    }\n    #getUpload(uploadID) {\n        const { currentUploads } = this.getState();\n        return currentUploads[uploadID];\n    }\n    /**\n     * Add data to an upload's result object.\n     */\n    addResultData(uploadID, data) {\n        if (!this.#getUpload(uploadID)) {\n            this.log(`Not setting result for an upload that has been removed: ${uploadID}`);\n            return;\n        }\n        const { currentUploads } = this.getState();\n        const currentUpload = {\n            ...currentUploads[uploadID],\n            result: { ...currentUploads[uploadID].result, ...data },\n        };\n        this.setState({\n            currentUploads: { ...currentUploads, [uploadID]: currentUpload },\n        });\n    }\n    /**\n     * Remove an upload, eg. if it has been canceled or completed.\n     *\n     */\n    #removeUpload(uploadID) {\n        const currentUploads = { ...this.getState().currentUploads };\n        delete currentUploads[uploadID];\n        this.setState({\n            currentUploads,\n        });\n    }\n    /**\n     * Run an upload. This picks up where it left off in case the upload is being restored.\n     */\n    async #runUpload(uploadID) {\n        const getCurrentUpload = () => {\n            const { currentUploads } = this.getState();\n            return currentUploads[uploadID];\n        };\n        let currentUpload = getCurrentUpload();\n        const steps = [\n            ...this.#preProcessors,\n            ...this.#uploaders,\n            ...this.#postProcessors,\n        ];\n        try {\n            for (let step = currentUpload.step || 0; step < steps.length; step++) {\n                if (!currentUpload) {\n                    break;\n                }\n                const fn = steps[step];\n                this.setState({\n                    currentUploads: {\n                        ...this.getState().currentUploads,\n                        [uploadID]: {\n                            ...currentUpload,\n                            step,\n                        },\n                    },\n                });\n                const { fileIDs } = currentUpload;\n                // TODO give this the `updatedUpload` object as its only parameter maybe?\n                // Otherwise when more metadata may be added to the upload this would keep getting more parameters\n                await fn(fileIDs, uploadID);\n                // Update currentUpload value in case it was modified asynchronously.\n                currentUpload = getCurrentUpload();\n            }\n        }\n        catch (err) {\n            this.#removeUpload(uploadID);\n            throw err;\n        }\n        // Set result data.\n        if (currentUpload) {\n            // Mark postprocessing step as complete if necessary; this addresses a case where we might get\n            // stuck in the postprocessing UI while the upload is fully complete.\n            // If the postprocessing steps do not do any work, they may not emit postprocessing events at\n            // all, and never mark the postprocessing as complete. This is fine on its own but we\n            // introduced code in the @uppy/core upload-success handler to prepare postprocessing progress\n            // state if any postprocessors are registered. That is to avoid a \"flash of completed state\"\n            // before the postprocessing plugins can emit events.\n            //\n            // So, just in case an upload with postprocessing plugins *has* completed *without* emitting\n            // postprocessing completion, we do it instead.\n            currentUpload.fileIDs.forEach((fileID) => {\n                const file = this.getFile(fileID);\n                if (file?.progress.postprocess) {\n                    this.emit('postprocess-complete', file);\n                }\n            });\n            const files = currentUpload.fileIDs.map((fileID) => this.getFile(fileID));\n            const successful = files.filter((file) => !file.error);\n            const failed = files.filter((file) => file.error);\n            this.addResultData(uploadID, { successful, failed, uploadID });\n            // Update currentUpload value in case it was modified asynchronously.\n            currentUpload = getCurrentUpload();\n        }\n        // Emit completion events.\n        // This is in a separate function so that the `currentUploads` variable\n        // always refers to the latest state. In the handler right above it refers\n        // to an outdated object without the `.result` property.\n        let result;\n        if (currentUpload) {\n            result = currentUpload.result;\n            this.#removeUpload(uploadID);\n        }\n        if (result == null) {\n            this.log(`Not setting result for an upload that has been removed: ${uploadID}`);\n            result = {\n                successful: [],\n                failed: [],\n                uploadID,\n            };\n        }\n        return result;\n    }\n    /**\n     * Start an upload for all the files that are not currently being uploaded.\n     */\n    async upload() {\n        if (!this.#plugins.uploader?.length) {\n            this.log('No uploader type plugins are used', 'warning');\n        }\n        let { files } = this.getState();\n        // retry any failed files from a previous upload() call\n        const filesToRetry = this.#getFilesToRetry();\n        if (filesToRetry.length > 0) {\n            const retryResult = await this.#doRetryAll(); // we don't want the complete event to fire\n            const hasNewFiles = this.getFiles().filter((file) => file.progress.uploadStarted == null)\n                .length > 0;\n            // if no new files, make it idempotent and return\n            if (!hasNewFiles) {\n                this.emit('complete', retryResult);\n                return retryResult;\n            }\n            // reload files which might have  changed after retry\n            ;\n            ({ files } = this.getState());\n        }\n        // If no files to retry, proceed with original upload() behavior for new files\n        const onBeforeUploadResult = this.opts.onBeforeUpload(files);\n        if (onBeforeUploadResult === false) {\n            return Promise.reject(new Error('Not starting the upload because onBeforeUpload returned false'));\n        }\n        if (onBeforeUploadResult && typeof onBeforeUploadResult === 'object') {\n            files = onBeforeUploadResult;\n            // Updating files in state, because uploader plugins receive file IDs,\n            // and then fetch the actual file object from state\n            this.setState({\n                files,\n            });\n        }\n        return Promise.resolve()\n            .then(() => this.#restricter.validateMinNumberOfFiles(files))\n            .catch((err) => {\n            this.#informAndEmit([err]);\n            throw err;\n        })\n            .then(() => {\n            if (!this.#checkRequiredMetaFields(files)) {\n                throw new RestrictionError(this.i18n('missingRequiredMetaField'));\n            }\n        })\n            .catch((err) => {\n            // Doing this in a separate catch because we already emited and logged\n            // all the errors in `checkRequiredMetaFields` so we only throw a generic\n            // missing fields error here.\n            throw err;\n        })\n            .then(async () => {\n            const { currentUploads } = this.getState();\n            // get a list of files that are currently assigned to uploads\n            const currentlyUploadingFiles = Object.values(currentUploads).flatMap((curr) => curr.fileIDs);\n            const waitingFileIDs = [];\n            Object.keys(files).forEach((fileID) => {\n                const file = this.getFile(fileID);\n                // if the file hasn't started uploading and hasn't already been assigned to an upload..\n                if (!file.progress.uploadStarted &&\n                    currentlyUploadingFiles.indexOf(fileID) === -1) {\n                    waitingFileIDs.push(file.id);\n                }\n            });\n            const uploadID = this.#createUpload(waitingFileIDs);\n            const result = await this.#runUpload(uploadID);\n            this.emit('complete', result);\n            return result;\n        })\n            .catch((err) => {\n            this.emit('error', err);\n            this.log(err, 'error');\n            throw err;\n        });\n    }\n}\nexport default Uppy;\n"]}