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,KAAK,QAAQ,aAAc,OACrB,uBAAuB,KAAM,2BAA4B,KAAK,aAC1F,EAAU,CAAE,KAAM,uBAAuB,KAAM,2BAA4B,KAAK,YAChF,EAAa,IAAI,KAAK,CAAC,GAAO,EAAY,GACwC,QAAvF,GAAM,EAAK,uBAAuB,KAAM,2BAA4B,MAAM,eAA4B,IAAP,GAAyB,EAAG,KAAK,EAAI,CAAC,EAAY,IAGlJ,MAAM,EAAS,uBAAuB,KAAM,0BAA2B,KACvE,EAAO,MAAQ,EAAO,OAAS,EAE/B,uBAAuB,KAAM,yBAA0B,KAAK,IAAM,GAClE,uBAAuB,KAAM,2BAA4B,KAAK,QAAU,KACxE,uBAAuB,KAAM,2BAA4B,KAAK,OAAS,KACvE,uBAAuB,KAAM,+BAA+B,EAAO,KACnE,uBAAuB,KAAM,wBAAyB,KAAM,IAChE,EAAG,0BAA4B,SAAmC,GAC9D,IAAI,EAAI,EAC+E,QAAtF,GAAM,EAAK,uBAAuB,KAAM,2BAA4B,MAAM,cAA2B,IAAP,GAAyB,EAAG,KAAK,EAAI,GACpI,uBAAuB,KAAM,2BAA4B,KAAK,QAAU,KACxE,uBAAuB,KAAM,2BAA4B,KAAK,OAAS,KACvE,uBAAuB,KAAM,+BAA+B,EAAO,IACvE,EACA,MAAM,IAAM,IAAI,gCACD,CAAC,EAAM,IAAY,IAAI,OAAO,EAAM","file":"/npm/image-minify-client@1.0.1/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/image-minify-client@1.0.1/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","var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\r\n    if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n    if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n    if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n    return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n};\r\nvar __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\r\n    if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n    if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n    return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n};\r\nvar _ImageMinifyClient_instances, _ImageMinifyClient_canvas, _ImageMinifyClient_context, _ImageMinifyClient_image, _ImageMinifyClient_file, _ImageMinifyClient_allowableMaximumSize, _ImageMinifyClient_available, _ImageMinifyClient_processing, _ImageMinifyClient_promise, _ImageMinifyClient_options, _ImageMinifyClient_imageLoadError, _ImageMinifyClient_imageLoaded, _ImageMinifyClient_resolve, _ImageMinifyClient_reject;\r\nclass ImageMinifyClient {\r\n    constructor() {\r\n        _ImageMinifyClient_instances.add(this);\r\n        _ImageMinifyClient_canvas.set(this, null);\r\n        _ImageMinifyClient_context.set(this, null);\r\n        _ImageMinifyClient_image.set(this, null);\r\n        _ImageMinifyClient_file.set(this, null);\r\n        _ImageMinifyClient_allowableMaximumSize.set(this, 0); // 지원 가능한 이미지의 최대 크기\r\n        _ImageMinifyClient_available.set(this, true); // 모듈 사용 가능\r\n        _ImageMinifyClient_processing.set(this, false); // 모듈 작업 처리 중\r\n        _ImageMinifyClient_promise.set(this, {\r\n            resolve: null,\r\n            reject: null\r\n        });\r\n        _ImageMinifyClient_options.set(this, {\r\n            quality: 0.8,\r\n            maxWidth: 0,\r\n            maxHeight: 0,\r\n            outputType: 'jpeg'\r\n        });\r\n        try {\r\n            __classPrivateFieldSet(this, _ImageMinifyClient_canvas, document.createElement('canvas'), \"f\");\r\n            __classPrivateFieldSet(this, _ImageMinifyClient_context, __classPrivateFieldGet(this, _ImageMinifyClient_canvas, \"f\").getContext('2d'), \"f\");\r\n            __classPrivateFieldSet(this, _ImageMinifyClient_image, new Image(), \"f\");\r\n            __classPrivateFieldGet(this, _ImageMinifyClient_image, \"f\").onerror = __classPrivateFieldGet(this, _ImageMinifyClient_instances, \"m\", _ImageMinifyClient_imageLoadError).bind(this);\r\n            __classPrivateFieldGet(this, _ImageMinifyClient_image, \"f\").onload = __classPrivateFieldGet(this, _ImageMinifyClient_instances, \"m\", _ImageMinifyClient_imageLoaded).bind(this);\r\n        }\r\n        catch (_a) {\r\n            __classPrivateFieldSet(this, _ImageMinifyClient_available, false, \"f\");\r\n            return;\r\n        }\r\n    }\r\n    // 압축\r\n    minify(file, options) {\r\n        return new Promise(function (resolve, reject) {\r\n            const fileType = file.type.replace(/\\/.+$/, '');\r\n            const fileFormat = file.type.replace(/^[^\\/]+\\//, '');\r\n            const formats = [\r\n                'bmp',\r\n                'gif',\r\n                'png',\r\n                'jpeg',\r\n                'webp',\r\n            ];\r\n            let error = null;\r\n            __classPrivateFieldGet(this, _ImageMinifyClient_promise, \"f\").resolve = resolve;\r\n            __classPrivateFieldGet(this, _ImageMinifyClient_promise, \"f\").reject = reject;\r\n            // 예외처리 *************************************************\r\n            // 예외: 모듈을 지원하지 않음\r\n            if (!__classPrivateFieldGet(this, _ImageMinifyClient_available, \"f\")) {\r\n                error = {\r\n                    code: 501,\r\n                    message: 'Does not support modules.'\r\n                };\r\n            }\r\n            // 예외: 이미 작동중\r\n            else if (__classPrivateFieldGet(this, _ImageMinifyClient_processing, \"f\")) {\r\n                error = {\r\n                    code: 409,\r\n                    message: 'The process is already running.'\r\n                };\r\n            }\r\n            // 예외: 파라미터 필요\r\n            else if (file == null) {\r\n                error = {\r\n                    code: 400,\r\n                    message: 'The first parameter cannot be empty.'\r\n                };\r\n            }\r\n            // 예외: 첫번째 파라미터가 파일타입 객체가 아님\r\n            else if (!(file instanceof File)) {\r\n                error = {\r\n                    code: 400,\r\n                    message: 'The first parameter is not a File type.'\r\n                };\r\n            }\r\n            // 예외: 파일 타입이 이미지가 아님\r\n            else if (fileType !== 'image') {\r\n                error = {\r\n                    code: 415,\r\n                    message: 'The first parameter is not a Image File type.'\r\n                };\r\n            }\r\n            // 예외: 지원 포멧의 이미지가 아님\r\n            else if (formats.indexOf(fileFormat) === -1) {\r\n                error = {\r\n                    code: 415,\r\n                    message: `\"${fileFormat}\" format is not support.`\r\n                };\r\n            }\r\n            // 조건: 예외가 있을경우 예외처리\r\n            if (error) {\r\n                return __classPrivateFieldGet(this, _ImageMinifyClient_instances, \"m\", _ImageMinifyClient_reject).call(this, error);\r\n            }\r\n            // 조건: 옵션이 없다 || 객체가 아니다\r\n            if (!options) {\r\n                __classPrivateFieldGet(this, _ImageMinifyClient_options, \"f\").quality = 0.8;\r\n                __classPrivateFieldGet(this, _ImageMinifyClient_options, \"f\").maxWidth = 0;\r\n                __classPrivateFieldGet(this, _ImageMinifyClient_options, \"f\").maxHeight = 0;\r\n                __classPrivateFieldGet(this, _ImageMinifyClient_options, \"f\").outputType = 'jpeg';\r\n            }\r\n            else {\r\n                let quality = Math.abs(Number(options.quality)) || 0.8;\r\n                quality = isFinite(quality) ? quality : 0.8;\r\n                quality = quality > 1 ? 1 : quality;\r\n                __classPrivateFieldGet(this, _ImageMinifyClient_options, \"f\").quality = quality;\r\n                let maxWidth = Math.abs(Number(options.maxWidth)) || 0;\r\n                maxWidth = isFinite(maxWidth) ? maxWidth : 0;\r\n                __classPrivateFieldGet(this, _ImageMinifyClient_options, \"f\").maxWidth = Math.floor(maxWidth);\r\n                let maxHeight = Math.abs(Number(options.maxHeight)) || 0;\r\n                maxHeight = isFinite(maxHeight) ? maxHeight : 0;\r\n                __classPrivateFieldGet(this, _ImageMinifyClient_options, \"f\").maxHeight = Math.floor(maxHeight);\r\n                __classPrivateFieldGet(this, _ImageMinifyClient_options, \"f\").outputType =\r\n                    options.outputType === 'webp' ? 'webp' : 'jpeg';\r\n            }\r\n            __classPrivateFieldSet(this, _ImageMinifyClient_processing, true, \"f\");\r\n            __classPrivateFieldSet(this, _ImageMinifyClient_file, file, \"f\");\r\n            // @ts-ignore\r\n            // 할당: 이미지 로드 시작 (로드 관련 이벤트 헨들러에서 프로세스 이어짐)\r\n            __classPrivateFieldGet(this, _ImageMinifyClient_image, \"f\").src = URL.createObjectURL(file);\r\n        }.bind(this));\r\n    }\r\n}\r\n_ImageMinifyClient_canvas = new WeakMap(), _ImageMinifyClient_context = new WeakMap(), _ImageMinifyClient_image = new WeakMap(), _ImageMinifyClient_file = new WeakMap(), _ImageMinifyClient_allowableMaximumSize = new WeakMap(), _ImageMinifyClient_available = new WeakMap(), _ImageMinifyClient_processing = new WeakMap(), _ImageMinifyClient_promise = new WeakMap(), _ImageMinifyClient_options = new WeakMap(), _ImageMinifyClient_instances = new WeakSet(), _ImageMinifyClient_imageLoadError = function _ImageMinifyClient_imageLoadError() {\r\n    __classPrivateFieldGet(this, _ImageMinifyClient_instances, \"m\", _ImageMinifyClient_reject).call(this, {\r\n        code: 404,\r\n        message: 'The image could not be loaded.'\r\n    });\r\n}, _ImageMinifyClient_imageLoaded = function _ImageMinifyClient_imageLoaded() {\r\n    var _a;\r\n    // @ts-ignore\r\n    const img = __classPrivateFieldGet(this, _ImageMinifyClient_image, \"f\");\r\n    const width = img.naturalWidth;\r\n    const height = img.naturalHeight;\r\n    // 조건: 정상적으로 이미지 로드가 안됬다\r\n    if (width === 0 || height === 0) {\r\n        return __classPrivateFieldGet(this, _ImageMinifyClient_instances, \"m\", _ImageMinifyClient_imageLoadError).call(this);\r\n    }\r\n    const outputType = `image/${__classPrivateFieldGet(this, _ImageMinifyClient_options, \"f\").outputType}`;\r\n    // @ts-ignore\r\n    const canvas = __classPrivateFieldGet(this, _ImageMinifyClient_canvas, \"f\");\r\n    // @ts-ignore\r\n    const context = __classPrivateFieldGet(this, _ImageMinifyClient_context, \"f\");\r\n    const maxWidth = __classPrivateFieldGet(this, _ImageMinifyClient_options, \"f\").maxWidth || width;\r\n    const maxHeight = __classPrivateFieldGet(this, _ImageMinifyClient_options, \"f\").maxHeight || height;\r\n    const widthRatio = width / maxWidth;\r\n    const heightRatio = height / maxHeight;\r\n    const ratio = Math.max(widthRatio, heightRatio, 1);\r\n    const canvasWidth = Math.floor(width / ratio);\r\n    const canvasHeight = Math.floor(height / ratio);\r\n    try {\r\n        /* ********************************************************\r\n          켄버스가 지원하는 사이즈라면,\r\n          우하단 모서리에 빨간점을 그리고 해당 위치 색 코드를 불러올 수 있다.\r\n          이 과정 중 애러 발생(firefox) 또는 색 코드가 빨간색이 아니라면,\r\n          브라우저가 지원하는 사이즈를 넘어선 경우이다.\r\n        ******************************************************** */\r\n        const x = canvasWidth - 1;\r\n        const y = canvasHeight - 1;\r\n        canvas.width = canvasWidth;\r\n        canvas.height = canvasHeight;\r\n        context.fillStyle = '#ff0000';\r\n        context.fillRect(x, y, 1, 1);\r\n        const rgba = context.getImageData(x, y, 1, 1).data;\r\n        context.clearRect(x, y, canvasWidth, canvasHeight);\r\n        // 조건: 색 코드가 빨간색이 아니다\r\n        if (rgba[0] !== 255) {\r\n            throw false;\r\n        }\r\n    }\r\n    catch (_b) {\r\n        /* ********************************************************\r\n          지원 사이즈를 넘어선 경우,\r\n          켄버스의 사이즈를 조절하더라도 컨텍스트가 작동하지 않으므로\r\n          켄버스와 컨텍스트를 새로 생성해야 한다.\r\n        ******************************************************** */\r\n        __classPrivateFieldSet(this, _ImageMinifyClient_canvas, document.createElement('canvas'), \"f\");\r\n        __classPrivateFieldSet(this, _ImageMinifyClient_context, __classPrivateFieldGet(this, _ImageMinifyClient_canvas, \"f\").getContext('2d'), \"f\");\r\n        return __classPrivateFieldGet(this, _ImageMinifyClient_instances, \"m\", _ImageMinifyClient_reject).call(this, {\r\n            code: 413,\r\n            message: 'Image is over than the size supported.'\r\n        });\r\n    }\r\n    // 켄버스 크기를 출력될 이미지 크기로 조정\r\n    canvas.width = canvasWidth;\r\n    canvas.height = canvasHeight;\r\n    // 켄버스에 이미지 그리기\r\n    context.drawImage(img, 0, 0, canvasWidth, canvasHeight);\r\n    // 이미지 데이터 blob 으로 출력\r\n    canvas.toBlob((_a = __classPrivateFieldGet(this, _ImageMinifyClient_instances, \"m\", _ImageMinifyClient_resolve)) === null || _a === void 0 ? void 0 : _a.bind(this), outputType, __classPrivateFieldGet(this, _ImageMinifyClient_options, \"f\").quality);\r\n}, _ImageMinifyClient_resolve = function _ImageMinifyClient_resolve(blob) {\r\n    var _a, _b;\r\n    if (!blob) {\r\n        return __classPrivateFieldGet(this, _ImageMinifyClient_instances, \"m\", _ImageMinifyClient_reject).call(this, {\r\n            code: 412,\r\n            message: 'Failed to minify image.'\r\n        });\r\n    }\r\n    // @ts-ignore\r\n    const originFile = __classPrivateFieldGet(this, _ImageMinifyClient_file, \"f\");\r\n    const fileName = originFile.name.replace(/\\.[a-z]+$/i, '');\r\n    const outputName = `${fileName}.${__classPrivateFieldGet(this, _ImageMinifyClient_options, \"f\").outputType}`;\r\n    const options = { type: __classPrivateFieldGet(this, _ImageMinifyClient_options, \"f\").outputType };\r\n    const minifyFile = new File([blob], outputName, options);\r\n    (_b = (_a = __classPrivateFieldGet(this, _ImageMinifyClient_promise, \"f\")).resolve) === null || _b === void 0 ? void 0 : _b.call(_a, [minifyFile, originFile]);\r\n    // 메모리 누수 방지 초기화 ******************************************\r\n    // @ts-ignore\r\n    const canvas = __classPrivateFieldGet(this, _ImageMinifyClient_canvas, \"f\");\r\n    canvas.width = canvas.height = 1;\r\n    // @ts-ignore\r\n    __classPrivateFieldGet(this, _ImageMinifyClient_image, \"f\").src = '';\r\n    __classPrivateFieldGet(this, _ImageMinifyClient_promise, \"f\").resolve = null;\r\n    __classPrivateFieldGet(this, _ImageMinifyClient_promise, \"f\").reject = null;\r\n    __classPrivateFieldSet(this, _ImageMinifyClient_processing, false, \"f\");\r\n    __classPrivateFieldSet(this, _ImageMinifyClient_file, null, \"f\");\r\n}, _ImageMinifyClient_reject = function _ImageMinifyClient_reject(error) {\r\n    var _a, _b;\r\n    (_b = (_a = __classPrivateFieldGet(this, _ImageMinifyClient_promise, \"f\")).reject) === null || _b === void 0 ? void 0 : _b.call(_a, error);\r\n    __classPrivateFieldGet(this, _ImageMinifyClient_promise, \"f\").resolve = null;\r\n    __classPrivateFieldGet(this, _ImageMinifyClient_promise, \"f\").reject = null;\r\n    __classPrivateFieldSet(this, _ImageMinifyClient_processing, false, \"f\");\r\n};\r\nconst imc = new ImageMinifyClient;\r\nexport default (file, options) => imc.minify(file, options);\r\n"]}