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AAwB,sBAChC,QAAQ,gBAAkB,gBAC1B,QAAQ,uBAAyB,uBACjC,QAAQ,wBAA0B,wBAClC,QAAQ,uBAAyB,uBACjC,QAAQ,WAAa,WACrB,QAAQ,yBAA2B,yBACnC,QAAQ,YAAc,YACtB,QAAQ,kBAAoB,kBAC5B,QAAQ,OAAS,OACjB,QAAQ,YAAc,YACtB,QAAQ,YAAc,YACtB,QAAQ,qBAAuB,qBAC/B,QAAQ,iBAAmB,iBAC3B,QAAQ,aAAe,aACvB,QAAQ,eAAiB,eACzB,QAAQ,iBAAmB,iBAC3B,QAAQ,sBAAwB,sBAChC,QAAQ,iBAAmB,iBAC3B,QAAQ,gBAAkB","file":"/npm/graphql-upload-ts@2.1.3/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/graphql-upload-ts@2.1.3/dist/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","'use strict';\n\nvar node_crypto = require('node:crypto');\nvar node_events = require('node:events');\nvar node_fs = require('node:fs');\nvar node_os = require('node:os');\nvar node_path = require('node:path');\nvar node_stream = require('node:stream');\nvar graphql = require('graphql');\nvar busboy = require('busboy');\nvar createError = require('http-errors');\nvar objectPath = require('object-path');\n\nclass ReadAfterDestroyedError extends Error {\n}\nclass ReadAfterReleasedError extends Error {\n}\n// Use a “proxy” event emitter configured to have an infinite maximum number of\n// listeners to prevent Node.js max listeners exceeded warnings if many\n// `fs-capacitor` `ReadStream` instances are created at the same time. See:\n// https://github.com/mike-marcacci/fs-capacitor/issues/30\nconst processExitProxy = new node_events.EventEmitter();\nprocessExitProxy.setMaxListeners(Number.POSITIVE_INFINITY);\nprocess.once('exit', () => processExitProxy.emit('exit'));\nclass ReadStream extends node_stream.Readable {\n    constructor(writeStream, options) {\n        super({\n            highWaterMark: options?.highWaterMark,\n            encoding: options?.encoding,\n            autoDestroy: true,\n        });\n        this._pos = 0;\n        this._writeStream = writeStream;\n    }\n    _read(n) {\n        if (this.destroyed)\n            return;\n        if (typeof this._writeStream._fd !== 'number') {\n            this._writeStream.once('ready', () => this._read(n));\n            return;\n        }\n        // Using `allocUnsafe` here is OK because we return a slice the length of\n        // `bytesRead`, and discard the rest. This prevents node from having to zero\n        // out the entire allocation first.\n        const buf = Buffer.allocUnsafe(n);\n        node_fs.read(this._writeStream._fd, buf, 0, n, this._pos, (error, bytesRead) => {\n            if (error)\n                this.destroy(error);\n            // Push any read bytes into the local stream buffer.\n            if (bytesRead) {\n                this._pos += bytesRead;\n                this.push(buf.slice(0, bytesRead));\n                return;\n            }\n            // If there were no more bytes to read and the write stream is finished,\n            // then this stream has reached the end.\n            if (this._writeStream._writableState\n                .finished) {\n                // Check if we have consumed the whole file up to where\n                // the write stream has written before ending the stream\n                if (this._pos < this._writeStream._pos)\n                    this._read(n);\n                else\n                    this.push(null);\n                return;\n            }\n            // Otherwise, wait for the write stream to add more data or finish.\n            const retry = () => {\n                this._writeStream.off('finish', retry);\n                this._writeStream.off('write', retry);\n                this._read(n);\n            };\n            this._writeStream.on('finish', retry);\n            this._writeStream.on('write', retry);\n        });\n    }\n}\nclass WriteStream extends node_stream.Writable {\n    constructor(options) {\n        super({\n            highWaterMark: options?.highWaterMark,\n            defaultEncoding: options?.defaultEncoding,\n            autoDestroy: false,\n        });\n        this._fd = null;\n        this._path = null;\n        this._pos = 0;\n        this._readStreams = new Set();\n        this._released = false;\n        this._cleanup = (callback) => {\n            const fd = this._fd;\n            const path = this._path;\n            if (typeof fd !== 'number' || typeof path !== 'string') {\n                callback(null);\n                return;\n            }\n            // Close the file descriptor.\n            node_fs.close(fd, (closeError) => {\n                // An error here probably means the fd was already closed, but we can\n                // still try to unlink the file.\n                node_fs.unlink(path, (unlinkError) => {\n                    // If we are unable to unlink the file, the operating system will\n                    // clean up on next restart, since we use store thes in `os.tmpdir()`\n                    this._fd = null;\n                    // We avoid removing this until now in case an exit occurs while\n                    // asyncronously cleaning up.\n                    processExitProxy.off('exit', this._cleanupSync);\n                    callback(unlinkError ?? closeError);\n                });\n            });\n        };\n        this._cleanupSync = () => {\n            processExitProxy.off('exit', this._cleanupSync);\n            if (typeof this._fd === 'number')\n                try {\n                    node_fs.closeSync(this._fd);\n                }\n                catch (_error) {\n                    // An error here probably means the fd was already closed, but we can\n                    // still try to unlink the file.\n                }\n            try {\n                if (this._path !== null) {\n                    node_fs.unlinkSync(this._path);\n                }\n            }\n            catch (_error) {\n                // If we are unable to unlink the file, the operating system will clean\n                // up on next restart, since we use store thes in `os.tmpdir()`\n            }\n        };\n        // Generate a random filename.\n        node_crypto.randomBytes(16, (error, buffer) => {\n            if (error) {\n                this.destroy(error);\n                return;\n            }\n            this._path = node_path.join((options?.tmpdir ?? node_os.tmpdir)(), `capacitor-${buffer.toString('hex')}.tmp`);\n            // Create a file in the OS's temporary files directory.\n            node_fs.open(this._path, 'wx+', 0o600, (error, fd) => {\n                if (error) {\n                    this.destroy(error);\n                    return;\n                }\n                // Cleanup when the process exits or is killed.\n                processExitProxy.once('exit', this._cleanupSync);\n                this._fd = fd;\n                this.emit('ready');\n            });\n        });\n    }\n    _final(callback) {\n        if (typeof this._fd !== 'number') {\n            this.once('ready', () => this._final(callback));\n            return;\n        }\n        callback();\n    }\n    _write(chunk, encoding, callback) {\n        if (typeof this._fd !== 'number') {\n            this.once('ready', () => this._write(chunk, encoding, callback));\n            return;\n        }\n        node_fs.write(this._fd, chunk, 0, chunk.length, this._pos, (error) => {\n            if (error) {\n                callback(error);\n                return;\n            }\n            // It's safe to increment `this._pos` after flushing to the filesystem\n            // because node streams ensure that only one `_write()` is active at a\n            // time. If this assumption is broken, the behavior of this library is\n            // undefined, regardless of where this is incremented. Relocating this\n            // to increment syncronously would result in correct file contents, but\n            // the out-of-order writes would still open the potential for read streams\n            // to scan positions that have not yet been written.\n            this._pos += chunk.length;\n            this.emit('write');\n            callback();\n        });\n    }\n    release() {\n        this._released = true;\n        if (this._readStreams.size === 0)\n            this.destroy();\n    }\n    _destroy(error, callback) {\n        // Destroy all attached read streams.\n        for (const readStream of this._readStreams) {\n            readStream.destroy(error || undefined);\n        }\n        // This capacitor is fully initialized.\n        if (typeof this._fd === 'number' && typeof this._path === 'string') {\n            this._cleanup((cleanupError) => callback(cleanupError ?? error));\n            return;\n        }\n        // This capacitor has not yet finished initialization; if initialization\n        // does complete, immediately clean up after.\n        this.once('ready', () => {\n            this._cleanup((cleanupError) => {\n                if (cleanupError) {\n                    this.emit('error', cleanupError);\n                }\n            });\n        });\n        callback(error);\n    }\n    createReadStream(options) {\n        if (this.destroyed)\n            throw new ReadAfterDestroyedError('A ReadStream cannot be created from a destroyed WriteStream.');\n        if (this._released)\n            throw new ReadAfterReleasedError('A ReadStream cannot be created from a released WriteStream.');\n        const readStream = new ReadStream(this, options);\n        this._readStreams.add(readStream);\n        readStream.once('close', () => {\n            this._readStreams.delete(readStream);\n            if (this._released && this._readStreams.size === 0) {\n                this.destroy();\n            }\n        });\n        return readStream;\n    }\n}\n\nclass Upload {\n    constructor() {\n        this.promise = new Promise((resolve, reject) => {\n            this._resolve = resolve;\n            this._reject = reject;\n        });\n        // Prevent unhandled promise rejection errors\n        this.promise.catch(() => { });\n    }\n    resolve(file) {\n        this.file = file;\n        this._resolve(file);\n    }\n    reject(error) {\n        this._reject(error);\n    }\n}\n\n/**\n * A GraphQL `Upload` scalar that can be used in a GraphQL schema.\n * Its value in resolvers is a promise that resolves to file upload details\n * for processing and storage.\n *\n * @example Import usage\n * ```typescript\n * import { GraphQLUpload } from 'graphql-upload-ts';\n * ```\n *\n * @example Schema usage with GraphQL Tools\n * ```typescript\n * import { makeExecutableSchema } from '@graphql-tools/schema';\n * import { GraphQLUpload } from 'graphql-upload-ts';\n *\n * const schema = makeExecutableSchema({\n *   typeDefs: `\n *     scalar Upload\n *\n *     type Mutation {\n *       uploadFile(file: Upload!): Boolean\n *     }\n *   `,\n *   resolvers: {\n *     Upload: GraphQLUpload,\n *     Mutation: {\n *       uploadFile: async (_, { file }) => {\n *         const { filename, mimetype, createReadStream } = await file;\n *         const stream = createReadStream();\n *         // Process the file stream...\n *         return true;\n *       }\n *     }\n *   },\n * });\n * ```\n */\nconst uploadScalarConfig = {\n    name: 'Upload',\n    description: 'The `Upload` scalar type represents a file upload.',\n    parseValue(value) {\n        if (value instanceof Upload) {\n            return value.promise;\n        }\n        throw new graphql.GraphQLError('Upload value invalid. Expected Upload instance.', {\n            extensions: { code: 'INVALID_UPLOAD_VALUE' },\n        });\n    },\n    parseLiteral(node) {\n        throw new graphql.GraphQLError('Upload literal unsupported. Uploads can only be passed as variables.', {\n            nodes: node,\n            extensions: { code: 'UPLOAD_LITERAL_UNSUPPORTED' },\n        });\n    },\n    serialize() {\n        throw new graphql.GraphQLError('Upload serialization unsupported. Uploads cannot be serialized.', {\n            extensions: { code: 'UPLOAD_SERIALIZATION_UNSUPPORTED' },\n        });\n    },\n};\nconst GraphQLUpload = new graphql.GraphQLScalarType(uploadScalarConfig);\n\n/**\n * Safely ignores a Node.js readable stream.\n */\nfunction ignoreStream(stream) {\n    // Prevent an unhandled error from crashing the process.\n    stream.on('error', () => { });\n    // Waste the stream.\n    stream.resume();\n}\n\n/**\n * Maximum size for non-file form fields (in bytes).\n * This applies to text fields like 'operations' and 'map' in GraphQL multipart requests.\n * These fields contain JSON data (query, variables, and file mappings).\n * Default: 1MB - sufficient for large GraphQL queries and variable sets.\n */\nconst DEFAULT_MAX_FIELD_SIZE = 1000000; // 1MB\n/**\n * Maximum size for uploaded files (in bytes).\n * This applies to the actual binary file content being uploaded.\n * Default: 5MB - a reasonable limit for most web applications.\n * Can be overridden per request for larger files (videos, high-res images, etc.).\n */\nconst DEFAULT_MAX_FILE_SIZE = 5000000; // 5MB\n/**\n * Maximum number of files that can be uploaded in a single request.\n * Default: Infinity - no limit on the number of files.\n * Should be set to a reasonable number in production to prevent abuse.\n */\nconst DEFAULT_MAX_FILES = Number.POSITIVE_INFINITY;\nfunction validateOptions(options) {\n    const validatedOptions = {\n        maxFieldSize: options?.maxFieldSize ?? DEFAULT_MAX_FIELD_SIZE,\n        maxFileSize: options?.maxFileSize ?? DEFAULT_MAX_FILE_SIZE,\n        maxFiles: options?.maxFiles ?? DEFAULT_MAX_FILES,\n    };\n    if (validatedOptions.maxFieldSize <= 0) {\n        throw new Error('maxFieldSize must be a positive number');\n    }\n    if (validatedOptions.maxFileSize <= 0) {\n        throw new Error('maxFileSize must be a positive number');\n    }\n    if (validatedOptions.maxFiles <= 0) {\n        throw new Error('maxFiles must be a positive number');\n    }\n    if (!Number.isInteger(validatedOptions.maxFiles) &&\n        validatedOptions.maxFiles !== Number.POSITIVE_INFINITY) {\n        throw new Error('maxFiles must be an integer');\n    }\n    return validatedOptions;\n}\nfunction validateMimeType(mimetype, allowedTypes) {\n    if (!allowedTypes || allowedTypes.length === 0) {\n        return { isValid: true };\n    }\n    const isValid = allowedTypes.some((type) => {\n        if (type.endsWith('/*')) {\n            const prefix = type.slice(0, -2);\n            return mimetype.startsWith(`${prefix}/`);\n        }\n        return mimetype === type;\n    });\n    return {\n        isValid,\n        error: isValid ? undefined : `File type '${mimetype}' is not allowed`,\n    };\n}\nfunction validateFileExtension(filename, allowedExtensions) {\n    if (!allowedExtensions || allowedExtensions.length === 0) {\n        return { isValid: true };\n    }\n    const extension = filename.split('.').pop()?.toLowerCase();\n    if (!extension) {\n        return {\n            isValid: false,\n            error: 'File must have an extension',\n        };\n    }\n    const isValid = allowedExtensions.some((ext) => ext.toLowerCase() === extension);\n    return {\n        isValid,\n        error: isValid ? undefined : `File extension '.${extension}' is not allowed`,\n    };\n}\nfunction sanitizeFilename(filename) {\n    // Remove path traversal attempts\n    let sanitized = filename.replace(/\\.\\./g, '');\n    // Remove directory separators\n    sanitized = sanitized.replace(/[/\\\\]/g, '');\n    // Remove control characters and non-printable characters\n    // biome-ignore lint/suspicious/noControlCharactersInRegex: Intentional to remove control characters\n    sanitized = sanitized.replace(/[\\x00-\\x1f\\x7f-\\x9f]/g, '');\n    // Remove leading/trailing dots and spaces\n    sanitized = sanitized.replace(/^[\\s.]+|[\\s.]+$/g, '');\n    // If filename is empty after sanitization, generate a default name\n    if (!sanitized) {\n        sanitized = `upload_${Date.now()}`;\n    }\n    // Limit filename length\n    const maxLength = 255;\n    if (sanitized.length > maxLength) {\n        const extension = sanitized.split('.').pop();\n        const nameWithoutExt = sanitized.substring(0, sanitized.lastIndexOf('.'));\n        if (extension && extension.length < 20) {\n            sanitized = `${nameWithoutExt.substring(0, maxLength - extension.length - 1)}.${extension}`;\n        }\n        else {\n            sanitized = sanitized.substring(0, maxLength);\n        }\n    }\n    return sanitized;\n}\n\nconst GRAPHQL_MULTIPART_REQUEST_SPEC_URL$1 = 'https://github.com/jaydenseric/graphql-multipart-request-spec';\nasync function processRequest(request, response, options) {\n    const { maxFieldSize = DEFAULT_MAX_FIELD_SIZE, maxFileSize = DEFAULT_MAX_FILE_SIZE, maxFiles = DEFAULT_MAX_FILES, } = options ?? {};\n    return new Promise((resolve, reject) => {\n        let released = false;\n        let exitError;\n        let operations;\n        let operationsPath;\n        let map;\n        const parser = busboy({\n            headers: request.headers,\n            defParamCharset: 'utf8',\n            limits: {\n                fieldSize: maxFieldSize,\n                fields: 2, // Only operations and map.\n                fileSize: maxFileSize,\n                files: maxFiles,\n            },\n        });\n        function exit(error, isParserError = false) {\n            if (exitError)\n                return;\n            exitError = error;\n            if (map) {\n                for (const upload of map.values()) {\n                    if (!upload.file)\n                        upload.reject(exitError);\n                }\n            }\n            // If the error came from the parser, don’t cause it to be emitted again.\n            if (isParserError) {\n                parser.destroy();\n            }\n            else {\n                parser.destroy(exitError);\n            }\n            request.unpipe(parser);\n            // With a sufficiently large request body, subsequent events in the same\n            // event frame cause the stream to pause after the parser is destroyed. To\n            // ensure that the request resumes, the call to .resume() is scheduled for\n            // later in the event loop.\n            setImmediate(() => request.resume());\n            reject(exitError);\n        }\n        parser.on('field', (fieldName, value, { valueTruncated }) => {\n            if (valueTruncated)\n                return exit(createError(413, `The ‘${fieldName}’ multipart field value exceeds the ${maxFieldSize} byte size limit.`));\n            switch (fieldName) {\n                case 'operations':\n                    try {\n                        operations = JSON.parse(value);\n                    }\n                    catch (_error) {\n                        return exit(createError(400, `Invalid JSON in the ‘operations’ multipart field (${GRAPHQL_MULTIPART_REQUEST_SPEC_URL$1}).`));\n                    }\n                    // `operations` should be an object or an array. Note that arrays\n                    // and `null` have an `object` type.\n                    if (typeof operations !== 'object' || !operations)\n                        return exit(createError(400, `Invalid type for the ‘operations’ multipart field (${GRAPHQL_MULTIPART_REQUEST_SPEC_URL$1}).`));\n                    operationsPath = objectPath(operations);\n                    break;\n                case 'map': {\n                    if (!operations)\n                        return exit(createError(400, `Disordered multipart fields; ‘map’ should follow ‘operations’ (${GRAPHQL_MULTIPART_REQUEST_SPEC_URL$1}).`));\n                    let parsedMap;\n                    try {\n                        parsedMap = JSON.parse(value);\n                    }\n                    catch (_error) {\n                        return exit(createError(400, `Invalid JSON in the ‘map’ multipart field (${GRAPHQL_MULTIPART_REQUEST_SPEC_URL$1}).`));\n                    }\n                    // `map` should be an object.\n                    if (typeof parsedMap !== 'object' || !parsedMap || Array.isArray(parsedMap))\n                        return exit(createError(400, `Invalid type for the ‘map’ multipart field (${GRAPHQL_MULTIPART_REQUEST_SPEC_URL$1}).`));\n                    const mapEntries = Object.entries(parsedMap);\n                    // Check max files is not exceeded, even though the number of files\n                    // to parse might not match the map provided by the client.\n                    if (mapEntries.length > maxFiles)\n                        return exit(createError(413, `${maxFiles} max file uploads exceeded.`));\n                    map = new Map();\n                    for (const [fieldName, paths] of mapEntries) {\n                        if (!Array.isArray(paths))\n                            return exit(createError(400, `Invalid type for the ‘map’ multipart field entry key ‘${fieldName}’ array (${GRAPHQL_MULTIPART_REQUEST_SPEC_URL$1}).`));\n                        map.set(fieldName, new Upload());\n                        for (const [index, path] of paths.entries()) {\n                            if (typeof path !== 'string')\n                                return exit(createError(400, `Invalid type for the ‘map’ multipart field entry key ‘${fieldName}’ array index ‘${index}’ value (${GRAPHQL_MULTIPART_REQUEST_SPEC_URL$1}).`));\n                            try {\n                                operationsPath?.set(path, map.get(fieldName));\n                            }\n                            catch (_error) {\n                                return exit(createError(400, `Invalid object path for the ‘map’ multipart field entry key ‘${fieldName}’ array index ‘${index}’ value ‘${path}’ (${GRAPHQL_MULTIPART_REQUEST_SPEC_URL$1}).`));\n                            }\n                        }\n                    }\n                    resolve(operations);\n                }\n            }\n        });\n        parser.on('file', (fieldName, stream, { filename, encoding, mimeType: mimetype }) => {\n            if (!map) {\n                ignoreStream(stream);\n                return exit(createError(400, `Disordered multipart fields; files should follow ‘map’ (${GRAPHQL_MULTIPART_REQUEST_SPEC_URL$1}).`));\n            }\n            const upload = map.get(fieldName);\n            if (!upload) {\n                // The file is extraneous. As the rest can still be processed, just\n                // ignore it and don’t exit with an error.\n                ignoreStream(stream);\n                return;\n            }\n            let fileError;\n            const capacitor = new WriteStream();\n            capacitor.on('error', () => {\n                stream.unpipe();\n                stream.resume();\n            });\n            stream.on('limit', () => {\n                fileError = createError(413, `File truncated as it exceeds the ${maxFileSize} byte size limit.`);\n                stream.unpipe();\n                capacitor.destroy(fileError);\n            });\n            stream.on('error', (error) => {\n                fileError = error;\n                stream.unpipe();\n                capacitor.destroy(fileError);\n            });\n            const file = {\n                fieldName,\n                filename,\n                mimetype,\n                encoding,\n                createReadStream(options) {\n                    const error = fileError || (released ? exitError : null);\n                    if (error)\n                        throw error;\n                    return capacitor.createReadStream(options);\n                },\n                capacitor,\n            };\n            Object.defineProperty(file, 'capacitor', {\n                enumerable: false,\n                configurable: false,\n                writable: false,\n            });\n            stream.pipe(capacitor);\n            upload.resolve(file);\n        });\n        parser.once('filesLimit', () => exit(createError(413, `${maxFiles} max file uploads exceeded.`)));\n        parser.once('finish', () => {\n            request.unpipe(parser);\n            request.resume();\n            if (!operations)\n                return exit(createError(400, `Missing multipart field ‘operations’ (${GRAPHQL_MULTIPART_REQUEST_SPEC_URL$1}).`));\n            if (!map)\n                return exit(createError(400, `Missing multipart field ‘map’ (${GRAPHQL_MULTIPART_REQUEST_SPEC_URL$1}).`));\n            for (const upload of map.values())\n                if (!upload.file)\n                    upload.reject(createError(400, 'File missing in the request.'));\n        });\n        // Use the `on` method instead of `once` as in edge cases the same parser\n        // could have multiple `error` events and all must be handled to prevent the\n        // Node.js process exiting with an error. One edge case is if there is a\n        // malformed part header as well as an unexpected end of the form.\n        parser.on('error', (error) => {\n            exit(error, true);\n        });\n        response.once('close', () => {\n            released = true;\n            if (map) {\n                for (const upload of map.values()) {\n                    if (upload.file) {\n                        // Release resources and clean up temporary files.\n                        upload.file.capacitor.release();\n                    }\n                }\n            }\n        });\n        request.once('close', () => {\n            if (!request.readableEnded)\n                exit(createError(499, 'Request disconnected during file upload stream parsing.'));\n        });\n        request.pipe(parser);\n    });\n}\n\n/**\n * Creates Express middleware for handling GraphQL multipart requests (file uploads).\n * This middleware processes multipart/form-data requests and converts them into a format\n * that GraphQL servers can understand.\n *\n * @example Basic setup with Apollo Server\n * ```typescript\n * import express from 'express';\n * import { graphqlUploadExpress } from 'graphql-upload-ts';\n * import { ApolloServer } from '@apollo/server';\n *\n * const app = express();\n *\n * app.use(\n *   '/graphql',\n *   graphqlUploadExpress({\n *     maxFileSize: 10_000_000, // 10MB\n *     maxFiles: 10\n *   })\n * );\n *\n * // Apollo Server setup continues...\n * ```\n */\nfunction graphqlUploadExpress(options = {}) {\n    const { processRequest: processRequest$1 = processRequest, overrideSendResponse = processRequest$1 !== processRequest, ...uploadOptions } = options;\n    return function graphqlUploadExpressMiddleware(request, response, next) {\n        if (!request.is('multipart/form-data')) {\n            return next();\n        }\n        // Only override response.send if explicitly enabled\n        if (overrideSendResponse) {\n            // Store the original send method\n            const originalSend = response.send.bind(response);\n            let requestFinished = false;\n            // Monitor when the request is complete\n            request.on('end', () => {\n                requestFinished = true;\n            });\n            // Override send to ensure request is complete before sending response\n            response.send = (...args) => {\n                if (!requestFinished) {\n                    // If request isn't finished, wait for it\n                    request.on('end', () => {\n                        response.send = originalSend;\n                        originalSend(...args);\n                    });\n                }\n                else {\n                    // Request is already finished, send immediately\n                    response.send = originalSend;\n                    originalSend(...args);\n                }\n                return response;\n            };\n        }\n        processRequest$1(request, response, uploadOptions)\n            .then((body) => {\n            request.body = body;\n            next();\n        })\n            .catch((error) => {\n            if ('status' in error && 'expose' in error && error.expose) {\n                response.status(error.status);\n            }\n            next(error);\n        });\n    };\n}\n\n/**\n * Creates Koa middleware for handling GraphQL multipart requests (file uploads).\n * This middleware processes multipart/form-data requests and converts them into a format\n * that GraphQL servers can understand.\n *\n * @example Basic setup with Apollo Server Koa\n * ```typescript\n * import Koa from 'koa';\n * import { graphqlUploadKoa } from 'graphql-upload-ts';\n * import { ApolloServer } from '@apollo/server';\n * import { koaMiddleware } from '@as-integrations/koa';\n *\n * const app = new Koa();\n *\n * app.use(\n *   graphqlUploadKoa({\n *     maxFileSize: 10_000_000, // 10MB\n *     maxFiles: 10\n *   })\n * );\n *\n * // Apollo Server setup continues...\n * ```\n */\nfunction graphqlUploadKoa(options = {}) {\n    const { processRequest: processRequest$1 = processRequest, ...uploadOptions } = options;\n    return async function graphqlUploadKoaMiddleware(ctx, next) {\n        if (!ctx.request.is('multipart/form-data')) {\n            return next();\n        }\n        const finished = new Promise((resolve) => {\n            ctx.req.on('end', resolve);\n        });\n        try {\n            ctx.body = await processRequest$1(ctx.req, ctx.res, uploadOptions);\n            await next();\n        }\n        finally {\n            await finished;\n        }\n    };\n}\n\nexports.UploadErrorCode = void 0;\n(function (UploadErrorCode) {\n    UploadErrorCode[\"FILE_TOO_LARGE\"] = \"FILE_TOO_LARGE\";\n    UploadErrorCode[\"TOO_MANY_FILES\"] = \"TOO_MANY_FILES\";\n    UploadErrorCode[\"FIELD_TOO_LARGE\"] = \"FIELD_TOO_LARGE\";\n    UploadErrorCode[\"INVALID_MULTIPART\"] = \"INVALID_MULTIPART\";\n    UploadErrorCode[\"MISSING_OPERATIONS\"] = \"MISSING_OPERATIONS\";\n    UploadErrorCode[\"MISSING_MAP\"] = \"MISSING_MAP\";\n    UploadErrorCode[\"INVALID_JSON\"] = \"INVALID_JSON\";\n    UploadErrorCode[\"INVALID_MAP\"] = \"INVALID_MAP\";\n    UploadErrorCode[\"FILE_MISSING\"] = \"FILE_MISSING\";\n    UploadErrorCode[\"STREAM_ERROR\"] = \"STREAM_ERROR\";\n    UploadErrorCode[\"REQUEST_DISCONNECTED\"] = \"REQUEST_DISCONNECTED\";\n    UploadErrorCode[\"INVALID_UPLOAD_VALUE\"] = \"INVALID_UPLOAD_VALUE\";\n    UploadErrorCode[\"UPLOAD_LITERAL_UNSUPPORTED\"] = \"UPLOAD_LITERAL_UNSUPPORTED\";\n    UploadErrorCode[\"UPLOAD_SERIALIZATION_UNSUPPORTED\"] = \"UPLOAD_SERIALIZATION_UNSUPPORTED\";\n})(exports.UploadErrorCode || (exports.UploadErrorCode = {}));\nclass UploadError extends Error {\n    constructor(message, code, status = 400, expose = true) {\n        super(message);\n        this.name = 'UploadError';\n        this.code = code;\n        this.status = status;\n        this.expose = expose;\n        Object.setPrototypeOf(this, UploadError.prototype);\n    }\n    toGraphQLError() {\n        return new graphql.GraphQLError(this.message, {\n            extensions: {\n                code: this.code,\n                status: this.status,\n            },\n        });\n    }\n}\nclass FileTooLargeError extends UploadError {\n    constructor(maxSize) {\n        super(`File truncated as it exceeds the ${maxSize} byte size limit.`, exports.UploadErrorCode.FILE_TOO_LARGE, 413);\n    }\n}\nclass TooManyFilesError extends UploadError {\n    constructor(maxFiles) {\n        super(`${maxFiles} max file uploads exceeded.`, exports.UploadErrorCode.TOO_MANY_FILES, 413);\n    }\n}\nclass FieldTooLargeError extends UploadError {\n    constructor(fieldName, maxSize) {\n        super(`The '${fieldName}' multipart field value exceeds the ${maxSize} byte size limit.`, exports.UploadErrorCode.FIELD_TOO_LARGE, 413);\n    }\n}\nclass InvalidMultipartError extends UploadError {\n    constructor(message) {\n        super(message, exports.UploadErrorCode.INVALID_MULTIPART);\n    }\n}\nclass MissingOperationsError extends UploadError {\n    constructor() {\n        super(`Missing multipart field 'operations' (${GRAPHQL_MULTIPART_REQUEST_SPEC_URL}).`, exports.UploadErrorCode.MISSING_OPERATIONS);\n    }\n}\nclass MissingMapError extends UploadError {\n    constructor() {\n        super(`Missing multipart field 'map' (${GRAPHQL_MULTIPART_REQUEST_SPEC_URL}).`, exports.UploadErrorCode.MISSING_MAP);\n    }\n}\nclass InvalidJSONError extends UploadError {\n    constructor(fieldName) {\n        super(`Invalid JSON in the '${fieldName}' multipart field (${GRAPHQL_MULTIPART_REQUEST_SPEC_URL}).`, exports.UploadErrorCode.INVALID_JSON);\n    }\n}\nclass InvalidMapError extends UploadError {\n    constructor(message) {\n        super(`${message} (${GRAPHQL_MULTIPART_REQUEST_SPEC_URL}).`, exports.UploadErrorCode.INVALID_MAP);\n    }\n}\nclass FileMissingError extends UploadError {\n    constructor() {\n        super('File missing in the request.', exports.UploadErrorCode.FILE_MISSING);\n    }\n}\nclass StreamError extends UploadError {\n    constructor(message) {\n        super(message, exports.UploadErrorCode.STREAM_ERROR, 500);\n    }\n}\nclass RequestDisconnectedError extends UploadError {\n    constructor() {\n        super('Request disconnected during file upload stream parsing.', exports.UploadErrorCode.REQUEST_DISCONNECTED, 499);\n    }\n}\nconst GRAPHQL_MULTIPART_REQUEST_SPEC_URL = 'https://github.com/jaydenseric/graphql-multipart-request-spec';\n\nexports.DEFAULT_MAX_FIELD_SIZE = DEFAULT_MAX_FIELD_SIZE;\nexports.DEFAULT_MAX_FILES = DEFAULT_MAX_FILES;\nexports.DEFAULT_MAX_FILE_SIZE = DEFAULT_MAX_FILE_SIZE;\nexports.FieldTooLargeError = FieldTooLargeError;\nexports.FileMissingError = FileMissingError;\nexports.FileTooLargeError = FileTooLargeError;\nexports.GRAPHQL_MULTIPART_REQUEST_SPEC_URL = GRAPHQL_MULTIPART_REQUEST_SPEC_URL$1;\nexports.GraphQLUpload = GraphQLUpload;\nexports.InvalidJSONError = InvalidJSONError;\nexports.InvalidMapError = InvalidMapError;\nexports.InvalidMultipartError = InvalidMultipartError;\nexports.MissingMapError = MissingMapError;\nexports.MissingOperationsError = MissingOperationsError;\nexports.ReadAfterDestroyedError = ReadAfterDestroyedError;\nexports.ReadAfterReleasedError = ReadAfterReleasedError;\nexports.ReadStream = ReadStream;\nexports.RequestDisconnectedError = RequestDisconnectedError;\nexports.StreamError = StreamError;\nexports.TooManyFilesError = TooManyFilesError;\nexports.Upload = Upload;\nexports.UploadError = UploadError;\nexports.WriteStream = WriteStream;\nexports.graphqlUploadExpress = graphqlUploadExpress;\nexports.graphqlUploadKoa = graphqlUploadKoa;\nexports.ignoreStream = ignoreStream;\nexports.processRequest = processRequest;\nexports.sanitizeFilename = sanitizeFilename;\nexports.validateFileExtension = validateFileExtension;\nexports.validateMimeType = validateMimeType;\nexports.validateOptions = validateOptions;\n\n"]}