{ "version": 3, "sources": ["../../../node_modules/namespace-emitter/index.js", "../../../node_modules/lodash.throttle/index.js", "../../../node_modules/@transloadit/prettier-bytes/prettierBytes.js", "../../../node_modules/wildcard/index.js", "../../../node_modules/mime-match/index.js", "../../../node_modules/classnames/index.js", "../../../node_modules/exifr/dist/mini.umd.js", "../../../node_modules/lodash.debounce/index.js", "../../../node_modules/is-shallow-equal/index.js", "../../../node_modules/cropperjs/dist/cropper.js", "../../../node_modules/js-base64/base64.js", "../../../node_modules/requires-port/index.js", "../../../node_modules/querystringify/index.js", "../../../node_modules/url-parse/index.js", "../../../node_modules/component-emitter/index.js", "../../../node_modules/parseuri/index.js", "../../../node_modules/has-cors/index.js", "../../../node_modules/@socket.io/component-emitter/index.js", "../../../node_modules/yeast/index.js", "../../../node_modules/parseqs/index.js", "../../../node_modules/backo2/index.js", "../../@uppy/compressor/node_modules/@transloadit/prettier-bytes/prettierBytes.js", "../../../node_modules/compressorjs/dist/compressor.common.js", "../index.mjs", "../../@uppy/utils/lib/hasProperty.js", "../../@uppy/utils/lib/Translator.js", "../../@uppy/core/lib/Uppy.js", "../../../node_modules/nanoid/non-secure/index.js", "../../@uppy/store-default/lib/index.js", "../../@uppy/utils/lib/getFileNameAndExtension.js", "../../@uppy/utils/lib/mimeTypes.js", "../../@uppy/utils/lib/getFileType.js", "../../@uppy/utils/lib/generateFileID.js", "../../@uppy/core/lib/supportsUploadProgress.js", "../../@uppy/core/lib/getFileName.js", "../../@uppy/utils/lib/getTimeStamp.js", "../../@uppy/core/lib/loggers.js", "../../@uppy/core/lib/Restricter.js", "../../@uppy/core/lib/locale.js", "../../../node_modules/preact/src/util.js", "../../../node_modules/preact/src/options.js", "../../../node_modules/preact/src/create-element.js", "../../../node_modules/preact/src/component.js", "../../../node_modules/preact/src/create-context.js", "../../../node_modules/preact/src/constants.js", "../../../node_modules/preact/src/diff/children.js", "../../../node_modules/preact/src/diff/props.js", "../../../node_modules/preact/src/diff/index.js", "../../../node_modules/preact/src/render.js", "../../../node_modules/preact/src/clone-element.js", "../../../node_modules/preact/src/diff/catch-error.js", "../../@uppy/utils/lib/isDOMElement.js", "../../@uppy/utils/lib/findDOMElement.js", "../../@uppy/utils/lib/getTextDirection.js", "../../@uppy/core/lib/BasePlugin.js", "../../@uppy/core/lib/UIPlugin.js", "../../@uppy/core/lib/index.js", "../../@uppy/companion-client/lib/index.js", "../../@uppy/utils/lib/NetworkError.js", "../../@uppy/utils/lib/fetchWithNetworkError.js", "../../@uppy/utils/lib/ErrorWithCause.js", "../../@uppy/companion-client/lib/AuthError.js", "../../@uppy/companion-client/lib/RequestClient.js", "../../@uppy/companion-client/lib/tokenStorage.js", "../../@uppy/companion-client/lib/Provider.js", "../../@uppy/companion-client/lib/SearchProvider.js", "../../@uppy/companion-client/lib/Socket.js", "../../@uppy/provider-views/lib/index.js", "../../@uppy/provider-views/lib/ProviderView/AuthView.js", "../../@uppy/provider-views/lib/ProviderView/User.js", "../../@uppy/provider-views/lib/Breadcrumbs.js", "../../@uppy/provider-views/lib/ProviderView/Header.js", "../../@uppy/provider-views/lib/Browser.js", "../../@uppy/utils/lib/remoteFileObjToLocal.js", "../../@uppy/provider-views/lib/Filter.js", "../../@uppy/provider-views/lib/FooterActions.js", "../../@uppy/provider-views/lib/Item/index.js", "../../@uppy/provider-views/lib/Item/components/ItemIcon.js", "../../@uppy/provider-views/lib/Item/components/GridLi.js", "../../@uppy/provider-views/lib/Item/components/ListLi.js", "../../@uppy/provider-views/lib/Loader.js", "../../@uppy/provider-views/lib/CloseWrapper.js", "../../@uppy/utils/lib/isPreviewSupported.js", "../../@uppy/provider-views/lib/SharedHandler.js", "../../@uppy/provider-views/lib/View.js", "../../@uppy/provider-views/lib/ProviderView/ProviderView.js", "../../@uppy/provider-views/lib/SearchProviderView/InputView.js", "../../@uppy/provider-views/lib/SearchProviderView/Header.js", "../../@uppy/provider-views/lib/SearchProviderView/SearchProviderView.js", "../../@uppy/store-redux/lib/index.js", "../../@uppy/utils/lib/getSpeed.js", "../../@uppy/utils/lib/getBytesRemaining.js", "../../@uppy/status-bar/lib/StatusBarStates.js", "../../@uppy/status-bar/lib/StatusBar.js", "../../@uppy/status-bar/lib/calculateProcessingProgress.js", "../../@uppy/status-bar/lib/Components.js", "../../@uppy/utils/lib/secondsToTime.js", "../../@uppy/utils/lib/prettyETA.js", "../../@uppy/status-bar/lib/locale.js", "../../@uppy/status-bar/lib/_StatusBar.js", "../../@uppy/informer/lib/FadeIn.js", "../../@uppy/informer/lib/TransitionGroup.js", "../../@uppy/informer/lib/Informer.js", "../../@uppy/utils/lib/dataURItoBlob.js", "../../@uppy/utils/lib/isObjectURL.js", "../../@uppy/thumbnail-generator/lib/index.js", "../../@uppy/thumbnail-generator/lib/locale.js", "../../@uppy/utils/lib/findAllDOMElements.js", "../../@uppy/utils/lib/toArray.js", "../../@uppy/utils/lib/getDroppedFiles/utils/webkitGetAsEntryApi/getRelativePath.js", "../../@uppy/utils/lib/getDroppedFiles/utils/webkitGetAsEntryApi/getFilesAndDirectoriesFromDirectory.js", "../../@uppy/utils/lib/getDroppedFiles/utils/webkitGetAsEntryApi/index.js", "../../@uppy/utils/lib/getDroppedFiles/utils/fallbackApi.js", "../../@uppy/utils/lib/getDroppedFiles/index.js", "../../../node_modules/memoize-one/dist/memoize-one.esm.js", "../../@uppy/utils/lib/FOCUSABLE_ELEMENTS.js", "../../@uppy/dashboard/lib/utils/getActiveOverlayEl.js", "../../@uppy/dashboard/lib/utils/trapFocus.js", "../../@uppy/dashboard/lib/utils/createSuperFocus.js", "../../@uppy/dashboard/lib/components/Dashboard.js", "../../@uppy/utils/lib/isDragDropSupported.js", "../../@uppy/dashboard/lib/components/FileList.js", "../../@uppy/dashboard/lib/components/FileItem/index.js", "../../@uppy/dashboard/lib/utils/getFileTypeIcon.js", "../../@uppy/dashboard/lib/components/FilePreview.js", "../../@uppy/dashboard/lib/components/FileItem/MetaErrorMessage.js", "../../@uppy/dashboard/lib/components/FileItem/FilePreviewAndLink/index.js", "../../@uppy/dashboard/lib/components/FileItem/FileProgress/index.js", "../../@uppy/dashboard/lib/components/FileItem/FileInfo/index.js", "../../@uppy/utils/lib/truncateString.js", "../../@uppy/dashboard/lib/utils/copyToClipboard.js", "../../@uppy/dashboard/lib/components/FileItem/Buttons/index.js", "../../@uppy/dashboard/lib/components/VirtualList.js", "../../@uppy/dashboard/lib/components/AddFiles.js", "../../@uppy/dashboard/lib/components/AddFilesPanel.js", "../../@uppy/dashboard/lib/components/PickerPanelContent.js", "../../@uppy/dashboard/lib/utils/ignoreEvent.js", "../../@uppy/dashboard/lib/components/EditorPanel.js", "../../@uppy/dashboard/lib/components/PickerPanelTopBar.js", "../../@uppy/dashboard/lib/components/FileCard/index.js", "../../@uppy/dashboard/lib/components/Slide.js", "../../@uppy/dashboard/lib/locale.js", "../../@uppy/dashboard/lib/Dashboard.js", "../../@uppy/drag-drop/lib/locale.js", "../../@uppy/drag-drop/lib/DragDrop.js", "../../@uppy/drop-target/lib/index.js", "../../@uppy/file-input/lib/locale.js", "../../@uppy/file-input/lib/FileInput.js", "../../@uppy/image-editor/lib/Editor.js", "../../@uppy/image-editor/lib/locale.js", "../../@uppy/image-editor/lib/ImageEditor.js", "../../@uppy/progress-bar/lib/ProgressBar.js", "../../@uppy/utils/lib/getFileTypeExtension.js", "../../@uppy/audio/lib/supportsMediaRecorder.js", "../../../node_modules/preact/hooks/src/index.js", "../../@uppy/audio/lib/RecordButton.js", "../../@uppy/audio/lib/formatSeconds.js", "../../@uppy/audio/lib/RecordingLength.js", "../../@uppy/audio/lib/AudioSourceSelect.js", "../../@uppy/audio/lib/audio-oscilloscope/index.js", "../../@uppy/audio/lib/SubmitButton.js", "../../@uppy/audio/lib/DiscardButton.js", "../../@uppy/audio/lib/RecordingScreen.js", "../../@uppy/audio/lib/PermissionsScreen.js", "../../@uppy/audio/lib/locale.js", "../../@uppy/audio/lib/Audio.js", "../../@uppy/box/lib/locale.js", "../../@uppy/box/lib/Box.js", "../../@uppy/dropbox/lib/locale.js", "../../@uppy/dropbox/lib/Dropbox.js", "../../@uppy/facebook/lib/locale.js", "../../@uppy/facebook/lib/Facebook.js", "../../@uppy/google-drive/lib/DriveProviderViews.js", "../../@uppy/google-drive/lib/locale.js", "../../@uppy/google-drive/lib/GoogleDrive.js", "../../@uppy/instagram/lib/locale.js", "../../@uppy/instagram/lib/Instagram.js", "../../@uppy/onedrive/lib/locale.js", "../../@uppy/onedrive/lib/OneDrive.js", "../../@uppy/unsplash/lib/Unsplash.js", "../../@uppy/url/lib/UrlUI.js", "../../@uppy/url/lib/utils/forEachDroppedOrPastedUrl.js", "../../@uppy/url/lib/locale.js", "../../@uppy/url/lib/Url.js", "../../@uppy/zoom/lib/locale.js", "../../@uppy/zoom/lib/Zoom.js", "../../@uppy/remote-sources/lib/index.js", "../../@uppy/screen-capture/lib/ScreenRecIcon.js", "../../@uppy/screen-capture/lib/RecordButton.js", "../../@uppy/screen-capture/lib/SubmitButton.js", "../../@uppy/screen-capture/lib/StopWatch.js", "../../@uppy/screen-capture/lib/StreamStatus.js", "../../@uppy/screen-capture/lib/CaptureScreen.js", "../../@uppy/screen-capture/lib/locale.js", "../../@uppy/screen-capture/lib/ScreenCapture.js", "../../@uppy/utils/lib/canvasToBlob.js", "../../@uppy/webcam/lib/supportsMediaRecorder.js", "../../@uppy/webcam/lib/CameraIcon.js", "../../@uppy/webcam/lib/SnapshotButton.js", "../../@uppy/webcam/lib/RecordButton.js", "../../@uppy/webcam/lib/formatSeconds.js", "../../@uppy/webcam/lib/RecordingLength.js", "../../@uppy/webcam/lib/VideoSourceSelect.js", "../../@uppy/webcam/lib/SubmitButton.js", "../../@uppy/webcam/lib/DiscardButton.js", "../../@uppy/webcam/lib/CameraScreen.js", "../../@uppy/webcam/lib/PermissionsScreen.js", "../../@uppy/webcam/lib/locale.js", "../../@uppy/webcam/lib/Webcam.js", "../../@uppy/utils/lib/RateLimitedQueue.js", "../../@uppy/utils/lib/emitSocketProgress.js", "../../@uppy/utils/lib/getSocketHost.js", "../../@uppy/utils/lib/EventTracker.js", "../../@uppy/utils/lib/ProgressTimeout.js", "../../@uppy/utils/lib/isNetworkError.js", "../../@uppy/aws-s3/lib/MiniXHRUpload.js", "../../@uppy/aws-s3/lib/isXml.js", "../../@uppy/aws-s3/lib/locale.js", "../../@uppy/aws-s3/lib/index.js", "../../@uppy/utils/lib/AbortController.js", "../../@uppy/utils/lib/delay.js", "../../@uppy/aws-s3-multipart/lib/MultipartUploader.js", "../../@uppy/aws-s3-multipart/lib/index.js", "../../../node_modules/tus-js-client/lib.esm/upload.js", "../../../node_modules/tus-js-client/lib.esm/error.js", "../../../node_modules/tus-js-client/lib.esm/logger.js", "../../../node_modules/tus-js-client/lib.esm/uuid.js", "../../../node_modules/tus-js-client/lib.esm/noopUrlStorage.js", "../../../node_modules/tus-js-client/lib.esm/browser/urlStorage.js", "../../../node_modules/tus-js-client/lib.esm/browser/httpStack.js", "../../../node_modules/tus-js-client/lib.esm/browser/isReactNative.js", "../../../node_modules/tus-js-client/lib.esm/browser/uriToBlob.js", "../../../node_modules/tus-js-client/lib.esm/browser/isCordova.js", "../../../node_modules/tus-js-client/lib.esm/browser/readAsByteArray.js", "../../../node_modules/tus-js-client/lib.esm/browser/fileReader.js", "../../../node_modules/tus-js-client/lib.esm/browser/fingerprint.js", "../../../node_modules/tus-js-client/lib.esm/browser/index.js", "../../@uppy/utils/lib/settle.js", "../../@uppy/tus/lib/getFingerprint.js", "../../@uppy/tus/lib/index.js", "../../@uppy/transloadit/lib/Assembly.js", "../../../node_modules/socket.io-client/build/esm/url.js", "../../../node_modules/engine.io-client/build/esm/transports/xmlhttprequest.browser.js", "../../../node_modules/engine.io-client/build/esm/globalThis.browser.js", "../../../node_modules/engine.io-client/build/esm/util.js", "../../../node_modules/engine.io-client/build/esm/transports/polling-xhr.js", "../../../node_modules/engine.io-parser/build/esm/commons.js", "../../../node_modules/engine.io-parser/build/esm/encodePacket.browser.js", "../../../node_modules/src/index.ts", "../../../node_modules/engine.io-parser/build/esm/decodePacket.browser.js", "../../../node_modules/engine.io-parser/build/esm/index.js", "../../../node_modules/engine.io-client/build/esm/transport.js", "../../../node_modules/engine.io-client/build/esm/transports/polling.js", "../../../node_modules/engine.io-client/build/esm/transports/websocket.js", "../../../node_modules/engine.io-client/build/esm/transports/websocket-constructor.browser.js", "../../../node_modules/engine.io-client/build/esm/transports/index.js", "../../../node_modules/engine.io-client/build/esm/socket.js", "../../../node_modules/engine.io-client/build/esm/index.js", "../../../node_modules/socket.io-parser/build/esm/index.js", "../../../node_modules/socket.io-parser/build/esm/is-binary.js", "../../../node_modules/socket.io-parser/build/esm/binary.js", "../../../node_modules/socket.io-client/build/esm/on.js", "../../../node_modules/socket.io-client/build/esm/socket.js", "../../../node_modules/socket.io-client/build/esm/manager.js", "../../../node_modules/socket.io-client/build/esm/index.js", "../../@uppy/transloadit/lib/parseUrl.js", "../../@uppy/transloadit/lib/Client.js", "../../@uppy/transloadit/lib/AssemblyOptions.js", "../../@uppy/transloadit/lib/AssemblyWatcher.js", "../../@uppy/transloadit/lib/locale.js", "../../@uppy/transloadit/lib/index.js", "../../@uppy/xhr-upload/lib/locale.js", "../../@uppy/xhr-upload/lib/index.js", "../../@uppy/compressor/lib/index.js", "../../@uppy/compressor/lib/locale.js", "../../../node_modules/get-form-data/es/index.js", "../../@uppy/form/lib/index.js", "../../@uppy/golden-retriever/lib/index.js", "../../@uppy/golden-retriever/lib/ServiceWorkerStore.js", "../../@uppy/golden-retriever/lib/IndexedDBStore.js", "../../@uppy/golden-retriever/lib/MetaDataStore.js", "../../@uppy/redux-dev-tools/lib/index.js", "../bundle.mjs"], "sourcesContent": ["/**\n* Create an event emitter with namespaces\n* @name createNamespaceEmitter\n* @example\n* var emitter = require('./index')()\n*\n* emitter.on('*', function () {\n* console.log('all events emitted', this.event)\n* })\n*\n* emitter.on('example', function () {\n* console.log('example event emitted')\n* })\n*/\nmodule.exports = function createNamespaceEmitter () {\n var emitter = {}\n var _fns = emitter._fns = {}\n\n /**\n * Emit an event. Optionally namespace the event. Handlers are fired in the order in which they were added with exact matches taking precedence. Separate the namespace and event with a `:`\n * @name emit\n * @param {String} event \u2013 the name of the event, with optional namespace\n * @param {...*} data \u2013 up to 6 arguments that are passed to the event listener\n * @example\n * emitter.emit('example')\n * emitter.emit('demo:test')\n * emitter.emit('data', { example: true}, 'a string', 1)\n */\n emitter.emit = function emit (event, arg1, arg2, arg3, arg4, arg5, arg6) {\n var toEmit = getListeners(event)\n\n if (toEmit.length) {\n emitAll(event, toEmit, [arg1, arg2, arg3, arg4, arg5, arg6])\n }\n }\n\n /**\n * Create en event listener.\n * @name on\n * @param {String} event\n * @param {Function} fn\n * @example\n * emitter.on('example', function () {})\n * emitter.on('demo', function () {})\n */\n emitter.on = function on (event, fn) {\n if (!_fns[event]) {\n _fns[event] = []\n }\n\n _fns[event].push(fn)\n }\n\n /**\n * Create en event listener that fires once.\n * @name once\n * @param {String} event\n * @param {Function} fn\n * @example\n * emitter.once('example', function () {})\n * emitter.once('demo', function () {})\n */\n emitter.once = function once (event, fn) {\n function one () {\n fn.apply(this, arguments)\n emitter.off(event, one)\n }\n this.on(event, one)\n }\n\n /**\n * Stop listening to an event. Stop all listeners on an event by only passing the event name. Stop a single listener by passing that event handler as a callback.\n * You must be explicit about what will be unsubscribed: `emitter.off('demo')` will unsubscribe an `emitter.on('demo')` listener,\n * `emitter.off('demo:example')` will unsubscribe an `emitter.on('demo:example')` listener\n * @name off\n * @param {String} event\n * @param {Function} [fn] \u2013 the specific handler\n * @example\n * emitter.off('example')\n * emitter.off('demo', function () {})\n */\n emitter.off = function off (event, fn) {\n var keep = []\n\n if (event && fn) {\n var fns = this._fns[event]\n var i = 0\n var l = fns ? fns.length : 0\n\n for (i; i < l; i++) {\n if (fns[i] !== fn) {\n keep.push(fns[i])\n }\n }\n }\n\n keep.length ? this._fns[event] = keep : delete this._fns[event]\n }\n\n function getListeners (e) {\n var out = _fns[e] ? _fns[e] : []\n var idx = e.indexOf(':')\n var args = (idx === -1) ? [e] : [e.substring(0, idx), e.substring(idx + 1)]\n\n var keys = Object.keys(_fns)\n var i = 0\n var l = keys.length\n\n for (i; i < l; i++) {\n var key = keys[i]\n if (key === '*') {\n out = out.concat(_fns[key])\n }\n\n if (args.length === 2 && args[0] === key) {\n out = out.concat(_fns[key])\n break\n }\n }\n\n return out\n }\n\n function emitAll (e, fns, args) {\n var i = 0\n var l = fns.length\n\n for (i; i < l; i++) {\n if (!fns[i]) break\n fns[i].event = e\n fns[i].apply(fns[i], args)\n }\n }\n\n return emitter\n}\n", "/**\n * lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n result = wait - timeSinceLastCall;\n\n return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\n/**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed `func` invocations and a `flush` method to\n * immediately invoke them. Provide `options` to indicate whether `func`\n * should be invoked on the leading and/or trailing edge of the `wait`\n * timeout. The `func` is invoked with the last arguments provided to the\n * throttled function. Subsequent calls to the throttled function return the\n * result of the last `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the throttled function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=true]\n * Specify invoking on the leading edge of the timeout.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // Avoid excessively updating the position while scrolling.\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.\n * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });\n * jQuery(element).on('click', throttled);\n *\n * // Cancel the trailing throttled invocation.\n * jQuery(window).on('popstate', throttled.cancel);\n */\nfunction throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, {\n 'leading': leading,\n 'maxWait': wait,\n 'trailing': trailing\n });\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = throttle;\n", "// Adapted from https://github.com/Flet/prettier-bytes/\n// Changing 1000 bytes to 1024, so we can keep uppercase KB vs kB\n// ISC License (c) Dan Flettre https://github.com/Flet/prettier-bytes/blob/master/LICENSE\nmodule.exports = function prettierBytes (num) {\n if (typeof num !== 'number' || isNaN(num)) {\n throw new TypeError('Expected a number, got ' + typeof num)\n }\n\n var neg = num < 0\n var units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']\n\n if (neg) {\n num = -num\n }\n\n if (num < 1) {\n return (neg ? '-' : '') + num + ' B'\n }\n\n var exponent = Math.min(Math.floor(Math.log(num) / Math.log(1024)), units.length - 1)\n num = Number(num / Math.pow(1024, exponent))\n var unit = units[exponent]\n\n if (num >= 10 || num % 1 === 0) {\n // Do not show decimals when the number is two-digit, or if the number has no\n // decimal component.\n return (neg ? '-' : '') + num.toFixed(0) + ' ' + unit\n } else {\n return (neg ? '-' : '') + num.toFixed(1) + ' ' + unit\n }\n}\n", "/* jshint node: true */\n'use strict';\n\n/**\n # wildcard\n\n Very simple wildcard matching, which is designed to provide the same\n functionality that is found in the\n [eve](https://github.com/adobe-webplatform/eve) eventing library.\n\n ## Usage\n\n It works with strings:\n\n <<< examples/strings.js\n\n Arrays:\n\n <<< examples/arrays.js\n\n Objects (matching against keys):\n\n <<< examples/objects.js\n\n While the library works in Node, if you are are looking for file-based\n wildcard matching then you should have a look at:\n\n \n**/\n\nfunction WildcardMatcher(text, separator) {\n this.text = text = text || '';\n this.hasWild = ~text.indexOf('*');\n this.separator = separator;\n this.parts = text.split(separator);\n}\n\nWildcardMatcher.prototype.match = function(input) {\n var matches = true;\n var parts = this.parts;\n var ii;\n var partsCount = parts.length;\n var testParts;\n\n if (typeof input == 'string' || input instanceof String) {\n if (!this.hasWild && this.text != input) {\n matches = false;\n } else {\n testParts = (input || '').split(this.separator);\n for (ii = 0; matches && ii < partsCount; ii++) {\n if (parts[ii] === '*') {\n continue;\n } else if (ii < testParts.length) {\n matches = parts[ii] === testParts[ii];\n } else {\n matches = false;\n }\n }\n\n // If matches, then return the component parts\n matches = matches && testParts;\n }\n }\n else if (typeof input.splice == 'function') {\n matches = [];\n\n for (ii = input.length; ii--; ) {\n if (this.match(input[ii])) {\n matches[matches.length] = input[ii];\n }\n }\n }\n else if (typeof input == 'object') {\n matches = {};\n\n for (var key in input) {\n if (this.match(key)) {\n matches[key] = input[key];\n }\n }\n }\n\n return matches;\n};\n\nmodule.exports = function(text, test, separator) {\n var matcher = new WildcardMatcher(text, separator || /[\\/\\.]/);\n if (typeof test != 'undefined') {\n return matcher.match(test);\n }\n\n return matcher;\n};\n", "var wildcard = require('wildcard');\nvar reMimePartSplit = /[\\/\\+\\.]/;\n\n/**\n # mime-match\n\n A simple function to checker whether a target mime type matches a mime-type\n pattern (e.g. image/jpeg matches image/jpeg OR image/*).\n\n ## Example Usage\n\n <<< example.js\n\n**/\nmodule.exports = function(target, pattern) {\n function test(pattern) {\n var result = wildcard(pattern, target, reMimePartSplit);\n\n // ensure that we have a valid mime type (should have two parts)\n return result && result.length >= 2;\n }\n\n return pattern ? test(pattern.split(';')[0]) : test;\n};\n", "/*!\n Copyright (c) 2018 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames() {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg)) {\n\t\t\t\tif (arg.length) {\n\t\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\t\tif (inner) {\n\t\t\t\t\t\tclasses.push(inner);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tif (arg.toString === Object.prototype.toString) {\n\t\t\t\t\tfor (var key in arg) {\n\t\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tclasses.push(arg.toString());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n", "\"use strict\";\nfunction e(e, t, i) {\n return (\n t in e\n ? Object.defineProperty(e, t, {\n value: i,\n enumerable: !0,\n configurable: !0,\n writable: !0,\n })\n : (e[t] = i),\n e\n );\n}\nObject.defineProperty(exports, \"__esModule\", { value: !0 });\nvar t = \"undefined\" != typeof self ? self : global;\nconst i = \"undefined\" != typeof navigator,\n s = i && \"undefined\" == typeof HTMLImageElement,\n n = !(\n \"undefined\" == typeof global ||\n \"undefined\" == typeof process ||\n !process.versions ||\n !process.versions.node\n ),\n r = !!t.Buffer,\n a = (e) => void 0 !== e;\nfunction h(e) {\n return (\n void 0 === e ||\n (e instanceof Map ? 0 === e.size : 0 === Object.values(e).filter(a).length)\n );\n}\nfunction f(e) {\n let t = new Error(e);\n throw (delete t.stack, t);\n}\nfunction o(e) {\n let t = (function (e) {\n let t = 0;\n return (\n e.ifd0.enabled && (t += 1024),\n e.exif.enabled && (t += 2048),\n e.makerNote && (t += 2048),\n e.userComment && (t += 1024),\n e.gps.enabled && (t += 512),\n e.interop.enabled && (t += 100),\n e.ifd1.enabled && (t += 1024),\n t + 2048\n );\n })(e);\n return (\n e.jfif.enabled && (t += 50),\n e.xmp.enabled && (t += 2e4),\n e.iptc.enabled && (t += 14e3),\n e.icc.enabled && (t += 6e3),\n t\n );\n}\nconst l = (e) => String.fromCharCode.apply(null, e),\n d = \"undefined\" != typeof TextDecoder ? new TextDecoder(\"utf-8\") : void 0;\nclass u {\n static from(e, t) {\n return e instanceof this && e.le === t ? e : new u(e, void 0, void 0, t);\n }\n constructor(e) {\n let t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0,\n i = arguments.length > 2 ? arguments[2] : void 0,\n s = arguments.length > 3 ? arguments[3] : void 0;\n if (\n (\"boolean\" == typeof s && (this.le = s),\n Array.isArray(e) && (e = new Uint8Array(e)),\n 0 === e)\n )\n (this.byteOffset = 0), (this.byteLength = 0);\n else if (e instanceof ArrayBuffer) {\n void 0 === i && (i = e.byteLength - t);\n let s = new DataView(e, t, i);\n this._swapDataView(s);\n } else if (\n e instanceof Uint8Array ||\n e instanceof DataView ||\n e instanceof u\n ) {\n void 0 === i && (i = e.byteLength - t),\n (t += e.byteOffset),\n t + i > e.byteOffset + e.byteLength &&\n f(\"Creating view outside of available memory in ArrayBuffer\");\n let s = new DataView(e.buffer, t, i);\n this._swapDataView(s);\n } else if (\"number\" == typeof e) {\n let t = new DataView(new ArrayBuffer(e));\n this._swapDataView(t);\n } else f(\"Invalid input argument for BufferView: \" + e);\n }\n _swapArrayBuffer(e) {\n this._swapDataView(new DataView(e));\n }\n _swapBuffer(e) {\n this._swapDataView(new DataView(e.buffer, e.byteOffset, e.byteLength));\n }\n _swapDataView(e) {\n (this.dataView = e),\n (this.buffer = e.buffer),\n (this.byteOffset = e.byteOffset),\n (this.byteLength = e.byteLength);\n }\n _lengthToEnd(e) {\n return this.byteLength - e;\n }\n set(e, t) {\n let i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : u;\n return (\n e instanceof DataView || e instanceof u\n ? (e = new Uint8Array(e.buffer, e.byteOffset, e.byteLength))\n : e instanceof ArrayBuffer && (e = new Uint8Array(e)),\n e instanceof Uint8Array || f(\"BufferView.set(): Invalid data argument.\"),\n this.toUint8().set(e, t),\n new i(this, t, e.byteLength)\n );\n }\n subarray(e, t) {\n return (t = t || this._lengthToEnd(e)), new u(this, e, t);\n }\n toUint8() {\n return new Uint8Array(this.buffer, this.byteOffset, this.byteLength);\n }\n getUint8Array(e, t) {\n return new Uint8Array(this.buffer, this.byteOffset + e, t);\n }\n getString() {\n let e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0,\n t =\n arguments.length > 1 && void 0 !== arguments[1]\n ? arguments[1]\n : this.byteLength,\n i = this.getUint8Array(e, t);\n return (\n (s = i),\n d\n ? d.decode(s)\n : r\n ? Buffer.from(s).toString(\"utf8\")\n : decodeURIComponent(escape(l(s)))\n );\n var s;\n }\n getLatin1String() {\n let e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0,\n t =\n arguments.length > 1 && void 0 !== arguments[1]\n ? arguments[1]\n : this.byteLength,\n i = this.getUint8Array(e, t);\n return l(i);\n }\n getUnicodeString() {\n let e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0,\n t =\n arguments.length > 1 && void 0 !== arguments[1]\n ? arguments[1]\n : this.byteLength;\n const i = [];\n for (let s = 0; s < t && e + s < this.byteLength; s += 2)\n i.push(this.getUint16(e + s));\n return l(i);\n }\n getInt8(e) {\n return this.dataView.getInt8(e);\n }\n getUint8(e) {\n return this.dataView.getUint8(e);\n }\n getInt16(e) {\n let t =\n arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.le;\n return this.dataView.getInt16(e, t);\n }\n getInt32(e) {\n let t =\n arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.le;\n return this.dataView.getInt32(e, t);\n }\n getUint16(e) {\n let t =\n arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.le;\n return this.dataView.getUint16(e, t);\n }\n getUint32(e) {\n let t =\n arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.le;\n return this.dataView.getUint32(e, t);\n }\n getFloat32(e) {\n let t =\n arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.le;\n return this.dataView.getFloat32(e, t);\n }\n getFloat64(e) {\n let t =\n arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.le;\n return this.dataView.getFloat64(e, t);\n }\n getFloat(e) {\n let t =\n arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.le;\n return this.dataView.getFloat32(e, t);\n }\n getDouble(e) {\n let t =\n arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.le;\n return this.dataView.getFloat64(e, t);\n }\n getUintBytes(e, t, i) {\n switch (t) {\n case 1:\n return this.getUint8(e, i);\n case 2:\n return this.getUint16(e, i);\n case 4:\n return this.getUint32(e, i);\n case 8:\n return this.getUint64 && this.getUint64(e, i);\n }\n }\n getUint(e, t, i) {\n switch (t) {\n case 8:\n return this.getUint8(e, i);\n case 16:\n return this.getUint16(e, i);\n case 32:\n return this.getUint32(e, i);\n case 64:\n return this.getUint64 && this.getUint64(e, i);\n }\n }\n toString(e) {\n return this.dataView.toString(e, this.constructor.name);\n }\n ensureChunk() {}\n}\nfunction p(e, t) {\n f(`${e} '${t}' was not loaded, try using full build of exifr.`);\n}\nclass c extends Map {\n constructor(e) {\n super(), (this.kind = e);\n }\n get(e, t) {\n return (\n this.has(e) || p(this.kind, e),\n t &&\n (e in t ||\n (function (e, t) {\n f(`Unknown ${e} '${t}'.`);\n })(this.kind, e),\n t[e].enabled || p(this.kind, e)),\n super.get(e)\n );\n }\n keyList() {\n return Array.from(this.keys());\n }\n}\nvar g = new c(\"file parser\"),\n m = new c(\"segment parser\"),\n b = new c(\"file reader\");\nlet y = t.fetch;\nfunction w(e, t) {\n return (s = e).startsWith(\"data:\") || s.length > 1e4\n ? v(e, t, \"base64\")\n : n && e.includes(\"://\")\n ? k(e, t, \"url\", S)\n : n\n ? v(e, t, \"fs\")\n : i\n ? k(e, t, \"url\", S)\n : void f(\"Invalid input argument\");\n var s;\n}\nasync function k(e, t, i, s) {\n return b.has(i)\n ? v(e, t, i)\n : s\n ? (async function (e, t) {\n let i = await t(e);\n return new u(i);\n })(e, s)\n : void f(`Parser ${i} is not loaded`);\n}\nasync function v(e, t, i) {\n let s = new (b.get(i))(e, t);\n return await s.read(), s;\n}\nconst S = (e) => y(e).then((e) => e.arrayBuffer()),\n O = (e) =>\n new Promise((t, i) => {\n let s = new FileReader();\n (s.onloadend = () => t(s.result || new ArrayBuffer())),\n (s.onerror = i),\n s.readAsArrayBuffer(e);\n });\nconst U = new Map(),\n A = new Map(),\n I = new Map(),\n x = [\n \"chunked\",\n \"firstChunkSize\",\n \"firstChunkSizeNode\",\n \"firstChunkSizeBrowser\",\n \"chunkSize\",\n \"chunkLimit\",\n ],\n B = [\"jfif\", \"xmp\", \"icc\", \"iptc\", \"ihdr\"],\n T = [\"tiff\", ...B],\n V = [\"ifd0\", \"ifd1\", \"exif\", \"gps\", \"interop\"],\n C = [...T, ...V],\n F = [\"makerNote\", \"userComment\"],\n P = [\"translateKeys\", \"translateValues\", \"reviveValues\", \"multiSegment\"],\n L = [...P, \"sanitize\", \"mergeOutput\", \"silentErrors\"];\nclass z {\n get translate() {\n return this.translateKeys || this.translateValues || this.reviveValues;\n }\n}\nclass j extends z {\n get needed() {\n return this.enabled || this.deps.size > 0;\n }\n constructor(t, i, s, n) {\n if (\n (super(),\n e(this, \"enabled\", !1),\n e(this, \"skip\", new Set()),\n e(this, \"pick\", new Set()),\n e(this, \"deps\", new Set()),\n e(this, \"translateKeys\", !1),\n e(this, \"translateValues\", !1),\n e(this, \"reviveValues\", !1),\n (this.key = t),\n (this.enabled = i),\n (this.parse = this.enabled),\n this.applyInheritables(n),\n (this.canBeFiltered = V.includes(t)),\n this.canBeFiltered && (this.dict = U.get(t)),\n void 0 !== s)\n )\n if (Array.isArray(s))\n (this.parse = this.enabled = !0),\n this.canBeFiltered &&\n s.length > 0 &&\n this.translateTagSet(s, this.pick);\n else if (\"object\" == typeof s) {\n if (\n ((this.enabled = !0),\n (this.parse = !1 !== s.parse),\n this.canBeFiltered)\n ) {\n let { pick: e, skip: t } = s;\n e && e.length > 0 && this.translateTagSet(e, this.pick),\n t && t.length > 0 && this.translateTagSet(t, this.skip);\n }\n this.applyInheritables(s);\n } else\n !0 === s || !1 === s\n ? (this.parse = this.enabled = s)\n : f(`Invalid options argument: ${s}`);\n }\n applyInheritables(e) {\n let t, i;\n for (t of P) (i = e[t]), void 0 !== i && (this[t] = i);\n }\n translateTagSet(e, t) {\n if (this.dict) {\n let i,\n s,\n { tagKeys: n, tagValues: r } = this.dict;\n for (i of e)\n \"string\" == typeof i\n ? ((s = r.indexOf(i)),\n -1 === s && (s = n.indexOf(Number(i))),\n -1 !== s && t.add(Number(n[s])))\n : t.add(i);\n } else for (let i of e) t.add(i);\n }\n finalizeFilters() {\n !this.enabled && this.deps.size > 0\n ? ((this.enabled = !0), _(this.pick, this.deps))\n : this.enabled && this.pick.size > 0 && _(this.pick, this.deps);\n }\n}\nvar M = {\n jfif: !1,\n tiff: !0,\n xmp: !1,\n icc: !1,\n iptc: !1,\n ifd0: !0,\n ifd1: !1,\n exif: !0,\n gps: !0,\n interop: !1,\n ihdr: void 0,\n makerNote: !1,\n userComment: !1,\n multiSegment: !1,\n skip: [],\n pick: [],\n translateKeys: !0,\n translateValues: !0,\n reviveValues: !0,\n sanitize: !0,\n mergeOutput: !0,\n silentErrors: !0,\n chunked: !0,\n firstChunkSize: void 0,\n firstChunkSizeNode: 512,\n firstChunkSizeBrowser: 65536,\n chunkSize: 65536,\n chunkLimit: 5,\n },\n E = new Map();\nclass N extends z {\n static useCached(e) {\n let t = E.get(e);\n return void 0 !== t || ((t = new this(e)), E.set(e, t)), t;\n }\n constructor(e) {\n super(),\n !0 === e\n ? this.setupFromTrue()\n : void 0 === e\n ? this.setupFromUndefined()\n : Array.isArray(e)\n ? this.setupFromArray(e)\n : \"object\" == typeof e\n ? this.setupFromObject(e)\n : f(`Invalid options argument ${e}`),\n void 0 === this.firstChunkSize &&\n (this.firstChunkSize = i\n ? this.firstChunkSizeBrowser\n : this.firstChunkSizeNode),\n this.mergeOutput && (this.ifd1.enabled = !1),\n this.filterNestedSegmentTags(),\n this.traverseTiffDependencyTree(),\n this.checkLoadedPlugins();\n }\n setupFromUndefined() {\n let e;\n for (e of x) this[e] = M[e];\n for (e of L) this[e] = M[e];\n for (e of F) this[e] = M[e];\n for (e of C) this[e] = new j(e, M[e], void 0, this);\n }\n setupFromTrue() {\n let e;\n for (e of x) this[e] = M[e];\n for (e of L) this[e] = M[e];\n for (e of F) this[e] = !0;\n for (e of C) this[e] = new j(e, !0, void 0, this);\n }\n setupFromArray(e) {\n let t;\n for (t of x) this[t] = M[t];\n for (t of L) this[t] = M[t];\n for (t of F) this[t] = M[t];\n for (t of C) this[t] = new j(t, !1, void 0, this);\n this.setupGlobalFilters(e, void 0, V);\n }\n setupFromObject(e) {\n let t;\n for (t of ((V.ifd0 = V.ifd0 || V.image),\n (V.ifd1 = V.ifd1 || V.thumbnail),\n Object.assign(this, e),\n x))\n this[t] = $(e[t], M[t]);\n for (t of L) this[t] = $(e[t], M[t]);\n for (t of F) this[t] = $(e[t], M[t]);\n for (t of T) this[t] = new j(t, M[t], e[t], this);\n for (t of V) this[t] = new j(t, M[t], e[t], this.tiff);\n this.setupGlobalFilters(e.pick, e.skip, V, C),\n !0 === e.tiff\n ? this.batchEnableWithBool(V, !0)\n : !1 === e.tiff\n ? this.batchEnableWithUserValue(V, e)\n : Array.isArray(e.tiff)\n ? this.setupGlobalFilters(e.tiff, void 0, V)\n : \"object\" == typeof e.tiff &&\n this.setupGlobalFilters(e.tiff.pick, e.tiff.skip, V);\n }\n batchEnableWithBool(e, t) {\n for (let i of e) this[i].enabled = t;\n }\n batchEnableWithUserValue(e, t) {\n for (let i of e) {\n let e = t[i];\n this[i].enabled = !1 !== e && void 0 !== e;\n }\n }\n setupGlobalFilters(e, t, i) {\n let s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : i;\n if (e && e.length) {\n for (let e of s) this[e].enabled = !1;\n let t = D(e, i);\n for (let [e, i] of t) _(this[e].pick, i), (this[e].enabled = !0);\n } else if (t && t.length) {\n let e = D(t, i);\n for (let [t, i] of e) _(this[t].skip, i);\n }\n }\n filterNestedSegmentTags() {\n let { ifd0: e, exif: t, xmp: i, iptc: s, icc: n } = this;\n this.makerNote ? t.deps.add(37500) : t.skip.add(37500),\n this.userComment ? t.deps.add(37510) : t.skip.add(37510),\n i.enabled || e.skip.add(700),\n s.enabled || e.skip.add(33723),\n n.enabled || e.skip.add(34675);\n }\n traverseTiffDependencyTree() {\n let { ifd0: e, exif: t, gps: i, interop: s } = this;\n s.needed && (t.deps.add(40965), e.deps.add(40965)),\n t.needed && e.deps.add(34665),\n i.needed && e.deps.add(34853),\n (this.tiff.enabled =\n V.some((e) => !0 === this[e].enabled) ||\n this.makerNote ||\n this.userComment);\n for (let e of V) this[e].finalizeFilters();\n }\n get onlyTiff() {\n return (\n !B.map((e) => this[e].enabled).some((e) => !0 === e) && this.tiff.enabled\n );\n }\n checkLoadedPlugins() {\n for (let e of T) this[e].enabled && !m.has(e) && p(\"segment parser\", e);\n }\n}\nfunction D(e, t) {\n let i,\n s,\n n,\n r,\n a = [];\n for (n of t) {\n for (r of ((i = U.get(n)), (s = []), i))\n (e.includes(r[0]) || e.includes(r[1])) && s.push(r[0]);\n s.length && a.push([n, s]);\n }\n return a;\n}\nfunction $(e, t) {\n return void 0 !== e ? e : void 0 !== t ? t : void 0;\n}\nfunction _(e, t) {\n for (let i of t) e.add(i);\n}\ne(N, \"default\", M);\nclass X {\n constructor(t) {\n e(this, \"parsers\", {}),\n e(this, \"output\", {}),\n e(this, \"errors\", []),\n e(this, \"pushToErrors\", (e) => this.errors.push(e)),\n (this.options = N.useCached(t));\n }\n async read(e) {\n this.file = await (function (e, t) {\n return \"string\" == typeof e\n ? w(e, t)\n : i && !s && e instanceof HTMLImageElement\n ? w(e.src, t)\n : e instanceof Uint8Array ||\n e instanceof ArrayBuffer ||\n e instanceof DataView\n ? new u(e)\n : i && e instanceof Blob\n ? k(e, t, \"blob\", O)\n : void f(\"Invalid input argument\");\n })(e, this.options);\n }\n setup() {\n if (this.fileParser) return;\n let { file: e } = this,\n t = e.getUint16(0);\n for (let [i, s] of g)\n if (s.canHandle(e, t))\n return (\n (this.fileParser = new s(this.options, this.file, this.parsers)),\n (e[i] = !0)\n );\n this.file.close && this.file.close(), f(\"Unknown file format\");\n }\n async parse() {\n let { output: e, errors: t } = this;\n return (\n this.setup(),\n this.options.silentErrors\n ? (await this.executeParsers().catch(this.pushToErrors),\n t.push(...this.fileParser.errors))\n : await this.executeParsers(),\n this.file.close && this.file.close(),\n this.options.silentErrors && t.length > 0 && (e.errors = t),\n h((i = e)) ? void 0 : i\n );\n var i;\n }\n async executeParsers() {\n let { output: e } = this;\n await this.fileParser.parse();\n let t = Object.values(this.parsers).map(async (t) => {\n let i = await t.parse();\n t.assignToOutput(e, i);\n });\n this.options.silentErrors && (t = t.map((e) => e.catch(this.pushToErrors))),\n await Promise.all(t);\n }\n async extractThumbnail() {\n this.setup();\n let { options: e, file: t } = this,\n i = m.get(\"tiff\", e);\n var s;\n if (\n (t.tiff\n ? (s = { start: 0, type: \"tiff\" })\n : t.jpeg && (s = await this.fileParser.getOrFindSegment(\"tiff\")),\n void 0 === s)\n )\n return;\n let n = await this.fileParser.ensureSegmentChunk(s),\n r = (this.parsers.tiff = new i(n, e, t)),\n a = await r.extractThumbnail();\n return t.close && t.close(), a;\n }\n}\nclass H {\n static findPosition(e, t) {\n let i = e.getUint16(t + 2) + 2,\n s =\n \"function\" == typeof this.headerLength\n ? this.headerLength(e, t, i)\n : this.headerLength,\n n = t + s,\n r = i - s;\n return {\n offset: t,\n length: i,\n headerLength: s,\n start: n,\n size: r,\n end: n + r,\n };\n }\n static parse(e) {\n let t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};\n return new this(e, new N({ [this.type]: t }), e).parse();\n }\n normalizeInput(e) {\n return e instanceof u ? e : new u(e);\n }\n constructor(t) {\n let i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {},\n s = arguments.length > 2 ? arguments[2] : void 0;\n e(this, \"errors\", []),\n e(this, \"raw\", new Map()),\n e(this, \"handleError\", (e) => {\n if (!this.options.silentErrors) throw e;\n this.errors.push(e.message);\n }),\n (this.chunk = this.normalizeInput(t)),\n (this.file = s),\n (this.type = this.constructor.type),\n (this.globalOptions = this.options = i),\n (this.localOptions = i[this.type]),\n (this.canTranslate = this.localOptions && this.localOptions.translate);\n }\n translate() {\n this.canTranslate &&\n (this.translated = this.translateBlock(this.raw, this.type));\n }\n get output() {\n return this.translated\n ? this.translated\n : this.raw\n ? Object.fromEntries(this.raw)\n : void 0;\n }\n translateBlock(e, t) {\n let i = I.get(t),\n s = A.get(t),\n n = U.get(t),\n r = this.options[t],\n a = r.reviveValues && !!i,\n h = r.translateValues && !!s,\n f = r.translateKeys && !!n,\n o = {};\n for (let [t, r] of e)\n a && i.has(t)\n ? (r = i.get(t)(r))\n : h && s.has(t) && (r = this.translateValue(r, s.get(t))),\n f && n.has(t) && (t = n.get(t) || t),\n (o[t] = r);\n return o;\n }\n translateValue(e, t) {\n return t[e] || t.DEFAULT || e;\n }\n assignToOutput(e, t) {\n this.assignObjectToOutput(e, this.constructor.type, t);\n }\n assignObjectToOutput(e, t, i) {\n if (this.globalOptions.mergeOutput) return Object.assign(e, i);\n e[t] ? Object.assign(e[t], i) : (e[t] = i);\n }\n}\ne(H, \"headerLength\", 4),\n e(H, \"type\", void 0),\n e(H, \"multiSegment\", !1),\n e(H, \"canHandle\", () => !1);\nfunction W(e) {\n return (\n 192 === e ||\n 194 === e ||\n 196 === e ||\n 219 === e ||\n 221 === e ||\n 218 === e ||\n 254 === e\n );\n}\nfunction Y(e) {\n return e >= 224 && e <= 239;\n}\nfunction G(e, t, i) {\n for (let [s, n] of m) if (n.canHandle(e, t, i)) return s;\n}\nclass K extends class {\n constructor(t, i, s) {\n e(this, \"errors\", []),\n e(this, \"ensureSegmentChunk\", async (e) => {\n let t = e.start,\n i = e.size || 65536;\n if (this.file.chunked)\n if (this.file.available(t, i)) e.chunk = this.file.subarray(t, i);\n else\n try {\n e.chunk = await this.file.readChunk(t, i);\n } catch (t) {\n f(`Couldn't read segment: ${JSON.stringify(e)}. ${t.message}`);\n }\n else\n this.file.byteLength > t + i\n ? (e.chunk = this.file.subarray(t, i))\n : void 0 === e.size\n ? (e.chunk = this.file.subarray(t))\n : f(\"Segment unreachable: \" + JSON.stringify(e));\n return e.chunk;\n }),\n this.extendOptions && this.extendOptions(t),\n (this.options = t),\n (this.file = i),\n (this.parsers = s);\n }\n injectSegment(e, t) {\n this.options[e].enabled && this.createParser(e, t);\n }\n createParser(e, t) {\n let i = new (m.get(e))(t, this.options, this.file);\n return (this.parsers[e] = i);\n }\n createParsers(e) {\n for (let t of e) {\n let { type: e, chunk: i } = t,\n s = this.options[e];\n if (s && s.enabled) {\n let t = this.parsers[e];\n (t && t.append) || t || this.createParser(e, i);\n }\n }\n }\n async readSegments(e) {\n let t = e.map(this.ensureSegmentChunk);\n await Promise.all(t);\n }\n} {\n constructor() {\n super(...arguments),\n e(this, \"appSegments\", []),\n e(this, \"jpegSegments\", []),\n e(this, \"unknownSegments\", []);\n }\n static canHandle(e, t) {\n return 65496 === t;\n }\n async parse() {\n await this.findAppSegments(),\n await this.readSegments(this.appSegments),\n this.mergeMultiSegments(),\n this.createParsers(this.mergedAppSegments || this.appSegments);\n }\n setupSegmentFinderArgs(e) {\n !0 === e\n ? ((this.findAll = !0), (this.wanted = new Set(m.keyList())))\n : ((e =\n void 0 === e\n ? m.keyList().filter((e) => this.options[e].enabled)\n : e.filter((e) => this.options[e].enabled && m.has(e))),\n (this.findAll = !1),\n (this.remaining = new Set(e)),\n (this.wanted = new Set(e))),\n (this.unfinishedMultiSegment = !1);\n }\n async findAppSegments() {\n let e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0,\n t = arguments.length > 1 ? arguments[1] : void 0;\n this.setupSegmentFinderArgs(t);\n let { file: i, findAll: s, wanted: n, remaining: r } = this;\n if (\n (!s &&\n this.file.chunked &&\n ((s = Array.from(n).some((e) => {\n let t = m.get(e),\n i = this.options[e];\n return t.multiSegment && i.multiSegment;\n })),\n s && (await this.file.readWhole())),\n (e = this.findAppSegmentsInRange(e, i.byteLength)),\n !this.options.onlyTiff && i.chunked)\n ) {\n let t = !1;\n for (\n ;\n r.size > 0 && !t && (i.canReadNextChunk || this.unfinishedMultiSegment);\n\n ) {\n let { nextChunkOffset: s } = i,\n n = this.appSegments.some(\n (e) => !this.file.available(e.offset || e.start, e.length || e.size)\n );\n if (\n ((t =\n e > s && !n\n ? !(await i.readNextChunk(e))\n : !(await i.readNextChunk(s))),\n (e = this.findAppSegmentsInRange(e, i.byteLength)),\n void 0 === e)\n )\n return;\n }\n }\n }\n findAppSegmentsInRange(e, t) {\n t -= 2;\n let i,\n s,\n n,\n r,\n a,\n h,\n { file: f, findAll: o, wanted: l, remaining: d, options: u } = this;\n for (; e < t; e++)\n if (255 === f.getUint8(e))\n if (((i = f.getUint8(e + 1)), Y(i))) {\n if (\n ((s = f.getUint16(e + 2)),\n (n = G(f, e, s)),\n n &&\n l.has(n) &&\n ((r = m.get(n)),\n (a = r.findPosition(f, e)),\n (h = u[n]),\n (a.type = n),\n this.appSegments.push(a),\n !o &&\n (r.multiSegment && h.multiSegment\n ? ((this.unfinishedMultiSegment =\n a.chunkNumber < a.chunkCount),\n this.unfinishedMultiSegment || d.delete(n))\n : d.delete(n),\n 0 === d.size)))\n )\n break;\n u.recordUnknownSegments &&\n ((a = H.findPosition(f, e)),\n (a.marker = i),\n this.unknownSegments.push(a)),\n (e += s + 1);\n } else if (W(i)) {\n if (((s = f.getUint16(e + 2)), 218 === i && !1 !== u.stopAfterSos))\n return;\n u.recordJpegSegments &&\n this.jpegSegments.push({ offset: e, length: s, marker: i }),\n (e += s + 1);\n }\n return e;\n }\n mergeMultiSegments() {\n if (!this.appSegments.some((e) => e.multiSegment)) return;\n let e = (function (e, t) {\n let i,\n s,\n n,\n r = new Map();\n for (let a = 0; a < e.length; a++)\n (i = e[a]),\n (s = i[t]),\n r.has(s) ? (n = r.get(s)) : r.set(s, (n = [])),\n n.push(i);\n return Array.from(r);\n })(this.appSegments, \"type\");\n this.mergedAppSegments = e.map((e) => {\n let [t, i] = e,\n s = m.get(t, this.options);\n if (s.handleMultiSegments) {\n return { type: t, chunk: s.handleMultiSegments(i) };\n }\n return i[0];\n });\n }\n getSegment(e) {\n return this.appSegments.find((t) => t.type === e);\n }\n async getOrFindSegment(e) {\n let t = this.getSegment(e);\n return (\n void 0 === t &&\n (await this.findAppSegments(0, [e]), (t = this.getSegment(e))),\n t\n );\n }\n}\ne(K, \"type\", \"jpeg\"), g.set(\"jpeg\", K);\nconst R = [void 0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 4];\nclass J extends H {\n parseHeader() {\n var e = this.chunk.getUint16();\n 18761 === e ? (this.le = !0) : 19789 === e && (this.le = !1),\n (this.chunk.le = this.le),\n (this.headerParsed = !0);\n }\n parseTags(e, t) {\n let i =\n arguments.length > 2 && void 0 !== arguments[2]\n ? arguments[2]\n : new Map(),\n { pick: s, skip: n } = this.options[t];\n s = new Set(s);\n let r = s.size > 0,\n a = 0 === n.size,\n h = this.chunk.getUint16(e);\n e += 2;\n for (let f = 0; f < h; f++) {\n let h = this.chunk.getUint16(e);\n if (r) {\n if (\n s.has(h) &&\n (i.set(h, this.parseTag(e, h, t)), s.delete(h), 0 === s.size)\n )\n break;\n } else (!a && n.has(h)) || i.set(h, this.parseTag(e, h, t));\n e += 12;\n }\n return i;\n }\n parseTag(e, t, i) {\n let { chunk: s } = this,\n n = s.getUint16(e + 2),\n r = s.getUint32(e + 4),\n a = R[n];\n if (\n (a * r <= 4 ? (e += 8) : (e = s.getUint32(e + 8)),\n (n < 1 || n > 13) &&\n f(\n `Invalid TIFF value type. block: ${i.toUpperCase()}, tag: ${t.toString(\n 16\n )}, type: ${n}, offset ${e}`\n ),\n e > s.byteLength &&\n f(\n `Invalid TIFF value offset. block: ${i.toUpperCase()}, tag: ${t.toString(\n 16\n )}, type: ${n}, offset ${e} is outside of chunk size ${s.byteLength}`\n ),\n 1 === n)\n )\n return s.getUint8Array(e, r);\n if (2 === n)\n return \"\" ===\n (h = (function (e) {\n for (; e.endsWith(\"\\0\"); ) e = e.slice(0, -1);\n return e;\n })((h = s.getString(e, r))).trim())\n ? void 0\n : h;\n var h;\n if (7 === n) return s.getUint8Array(e, r);\n if (1 === r) return this.parseTagValue(n, e);\n {\n let t = (function (e) {\n switch (e) {\n case 1:\n return Uint8Array;\n case 3:\n return Uint16Array;\n case 4:\n return Uint32Array;\n case 5:\n case 10:\n default:\n return Array;\n case 6:\n return Int8Array;\n case 8:\n return Int16Array;\n case 9:\n return Int32Array;\n case 11:\n return Float32Array;\n case 12:\n return Float64Array;\n }\n })(n),\n i = new t(r),\n s = a;\n for (let t = 0; t < r; t++) (i[t] = this.parseTagValue(n, e)), (e += s);\n return i;\n }\n }\n parseTagValue(e, t) {\n let { chunk: i } = this;\n switch (e) {\n case 1:\n return i.getUint8(t);\n case 3:\n return i.getUint16(t);\n case 4:\n case 13:\n return i.getUint32(t);\n case 5:\n return i.getUint32(t) / i.getUint32(t + 4);\n case 6:\n return i.getInt8(t);\n case 8:\n return i.getInt16(t);\n case 9:\n return i.getInt32(t);\n case 10:\n return i.getInt32(t) / i.getInt32(t + 4);\n case 11:\n return i.getFloat(t);\n case 12:\n return i.getDouble(t);\n default:\n f(`Invalid tiff type ${e}`);\n }\n }\n}\nclass q extends J {\n static canHandle(e, t) {\n return (\n 225 === e.getUint8(t + 1) &&\n 1165519206 === e.getUint32(t + 4) &&\n 0 === e.getUint16(t + 8)\n );\n }\n async parse() {\n this.parseHeader();\n let { options: e } = this;\n return (\n e.ifd0.enabled && (await this.parseIfd0Block()),\n e.exif.enabled && (await this.safeParse(\"parseExifBlock\")),\n e.gps.enabled && (await this.safeParse(\"parseGpsBlock\")),\n e.interop.enabled && (await this.safeParse(\"parseInteropBlock\")),\n e.ifd1.enabled && (await this.safeParse(\"parseThumbnailBlock\")),\n this.createOutput()\n );\n }\n safeParse(e) {\n let t = this[e]();\n return void 0 !== t.catch && (t = t.catch(this.handleError)), t;\n }\n findIfd0Offset() {\n void 0 === this.ifd0Offset && (this.ifd0Offset = this.chunk.getUint32(4));\n }\n findIfd1Offset() {\n if (void 0 === this.ifd1Offset) {\n this.findIfd0Offset();\n let e = this.chunk.getUint16(this.ifd0Offset),\n t = this.ifd0Offset + 2 + 12 * e;\n this.ifd1Offset = this.chunk.getUint32(t);\n }\n }\n parseBlock(e, t) {\n let i = new Map();\n return (this[t] = i), this.parseTags(e, t, i), i;\n }\n async parseIfd0Block() {\n if (this.ifd0) return;\n let { file: e } = this;\n this.findIfd0Offset(),\n this.ifd0Offset < 8 && f(\"Malformed EXIF data\"),\n !e.chunked &&\n this.ifd0Offset > e.byteLength &&\n f(\n `IFD0 offset points to outside of file.\\nthis.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`\n ),\n e.tiff && (await e.ensureChunk(this.ifd0Offset, o(this.options)));\n let t = this.parseBlock(this.ifd0Offset, \"ifd0\");\n return 0 !== t.size\n ? ((this.exifOffset = t.get(34665)),\n (this.interopOffset = t.get(40965)),\n (this.gpsOffset = t.get(34853)),\n (this.xmp = t.get(700)),\n (this.iptc = t.get(33723)),\n (this.icc = t.get(34675)),\n this.options.sanitize &&\n (t.delete(34665),\n t.delete(40965),\n t.delete(34853),\n t.delete(700),\n t.delete(33723),\n t.delete(34675)),\n t)\n : void 0;\n }\n async parseExifBlock() {\n if (this.exif) return;\n if (\n (this.ifd0 || (await this.parseIfd0Block()), void 0 === this.exifOffset)\n )\n return;\n this.file.tiff &&\n (await this.file.ensureChunk(this.exifOffset, o(this.options)));\n let e = this.parseBlock(this.exifOffset, \"exif\");\n return (\n this.interopOffset || (this.interopOffset = e.get(40965)),\n (this.makerNote = e.get(37500)),\n (this.userComment = e.get(37510)),\n this.options.sanitize &&\n (e.delete(40965), e.delete(37500), e.delete(37510)),\n this.unpack(e, 41728),\n this.unpack(e, 41729),\n e\n );\n }\n unpack(e, t) {\n let i = e.get(t);\n i && 1 === i.length && e.set(t, i[0]);\n }\n async parseGpsBlock() {\n if (this.gps) return;\n if ((this.ifd0 || (await this.parseIfd0Block()), void 0 === this.gpsOffset))\n return;\n let e = this.parseBlock(this.gpsOffset, \"gps\");\n return (\n e &&\n e.has(2) &&\n e.has(4) &&\n (e.set(\"latitude\", Q(...e.get(2), e.get(1))),\n e.set(\"longitude\", Q(...e.get(4), e.get(3)))),\n e\n );\n }\n async parseInteropBlock() {\n if (\n !this.interop &&\n (this.ifd0 || (await this.parseIfd0Block()),\n void 0 !== this.interopOffset ||\n this.exif ||\n (await this.parseExifBlock()),\n void 0 !== this.interopOffset)\n )\n return this.parseBlock(this.interopOffset, \"interop\");\n }\n async parseThumbnailBlock() {\n let e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];\n if (!this.ifd1 && !this.ifd1Parsed && (!this.options.mergeOutput || e))\n return (\n this.findIfd1Offset(),\n this.ifd1Offset > 0 &&\n (this.parseBlock(this.ifd1Offset, \"ifd1\"), (this.ifd1Parsed = !0)),\n this.ifd1\n );\n }\n async extractThumbnail() {\n if (\n (this.headerParsed || this.parseHeader(),\n this.ifd1Parsed || (await this.parseThumbnailBlock(!0)),\n void 0 === this.ifd1)\n )\n return;\n let e = this.ifd1.get(513),\n t = this.ifd1.get(514);\n return this.chunk.getUint8Array(e, t);\n }\n get image() {\n return this.ifd0;\n }\n get thumbnail() {\n return this.ifd1;\n }\n createOutput() {\n let e,\n t,\n i,\n s = {};\n for (t of V)\n if (((e = this[t]), !h(e)))\n if (\n ((i = this.canTranslate\n ? this.translateBlock(e, t)\n : Object.fromEntries(e)),\n this.options.mergeOutput)\n ) {\n if (\"ifd1\" === t) continue;\n Object.assign(s, i);\n } else s[t] = i;\n return (\n this.makerNote && (s.makerNote = this.makerNote),\n this.userComment && (s.userComment = this.userComment),\n s\n );\n }\n assignToOutput(e, t) {\n if (this.globalOptions.mergeOutput) Object.assign(e, t);\n else\n for (let [i, s] of Object.entries(t)) this.assignObjectToOutput(e, i, s);\n }\n}\nfunction Q(e, t, i, s) {\n var n = e + t / 60 + i / 3600;\n return (\"S\" !== s && \"W\" !== s) || (n *= -1), n;\n}\ne(q, \"type\", \"tiff\"), e(q, \"headerLength\", 10), m.set(\"tiff\", q);\nconst Z = Object.assign(\n {},\n {\n ifd0: !1,\n ifd1: !1,\n exif: !1,\n gps: !1,\n interop: !1,\n sanitize: !1,\n reviveValues: !0,\n translateKeys: !1,\n translateValues: !1,\n mergeOutput: !1,\n },\n { firstChunkSize: 4e4, ifd0: [274] }\n);\nconst ee = Object.freeze({\n 1: { dimensionSwapped: !1, scaleX: 1, scaleY: 1, deg: 0, rad: 0 },\n 2: { dimensionSwapped: !1, scaleX: -1, scaleY: 1, deg: 0, rad: 0 },\n 3: {\n dimensionSwapped: !1,\n scaleX: 1,\n scaleY: 1,\n deg: 180,\n rad: (180 * Math.PI) / 180,\n },\n 4: {\n dimensionSwapped: !1,\n scaleX: -1,\n scaleY: 1,\n deg: 180,\n rad: (180 * Math.PI) / 180,\n },\n 5: {\n dimensionSwapped: !0,\n scaleX: 1,\n scaleY: -1,\n deg: 90,\n rad: (90 * Math.PI) / 180,\n },\n 6: {\n dimensionSwapped: !0,\n scaleX: 1,\n scaleY: 1,\n deg: 90,\n rad: (90 * Math.PI) / 180,\n },\n 7: {\n dimensionSwapped: !0,\n scaleX: 1,\n scaleY: -1,\n deg: 270,\n rad: (270 * Math.PI) / 180,\n },\n 8: {\n dimensionSwapped: !0,\n scaleX: 1,\n scaleY: 1,\n deg: 270,\n rad: (270 * Math.PI) / 180,\n },\n});\nlet te = !0,\n ie = !0;\nif (\"object\" == typeof navigator) {\n let e = navigator.userAgent;\n if (e.includes(\"iPad\") || e.includes(\"iPhone\")) {\n let t = e.match(/OS (\\d+)_(\\d+)/);\n if (t) {\n let [, e, i] = t,\n s = Number(e) + 0.1 * Number(i);\n (te = s < 13.4), (ie = !1);\n }\n } else if (e.includes(\"OS X 10\")) {\n let [, t] = e.match(/OS X 10[_.](\\d+)/);\n te = ie = Number(t) < 15;\n }\n if (e.includes(\"Chrome/\")) {\n let [, t] = e.match(/Chrome\\/(\\d+)/);\n te = ie = Number(t) < 81;\n } else if (e.includes(\"Firefox/\")) {\n let [, t] = e.match(/Firefox\\/(\\d+)/);\n te = ie = Number(t) < 77;\n }\n}\nexports.rotation = async function (e) {\n let t = await (async function (e) {\n let t = new X(Z);\n await t.read(e);\n let i = await t.parse();\n if (i && i.ifd0) return i.ifd0[274];\n })(e);\n return Object.assign({ canvas: te, css: ie }, ee[t]);\n};\n", "/**\n * lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n result = wait - timeSinceLastCall;\n\n return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = debounce;\n", "module.exports = function isShallowEqual (a, b) {\n if (a === b) return true\n for (var i in a) if (!(i in b)) return false\n for (var i in b) if (a[i] !== b[i]) return false\n return true\n}\n", "/*!\n * Cropper.js v1.5.7\n * https://fengyuanchen.github.io/cropperjs\n *\n * Copyright 2015-present Chen Fengyuan\n * Released under the MIT license\n *\n * Date: 2020-05-23T05:23:00.081Z\n */\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = global || self, global.Cropper = factory());\n}(this, (function () { 'use strict';\n\n function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function (obj) {\n return typeof obj;\n };\n } else {\n _typeof = function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n }\n\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n }\n\n function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n }\n\n function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n }\n\n function ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n }\n\n function _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n }\n\n function _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();\n }\n\n function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return _arrayLikeToArray(arr);\n }\n\n function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter);\n }\n\n function _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n }\n\n function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n\n return arr2;\n }\n\n function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n\n var IS_BROWSER = typeof window !== 'undefined' && typeof window.document !== 'undefined';\n var WINDOW = IS_BROWSER ? window : {};\n var IS_TOUCH_DEVICE = IS_BROWSER && WINDOW.document.documentElement ? 'ontouchstart' in WINDOW.document.documentElement : false;\n var HAS_POINTER_EVENT = IS_BROWSER ? 'PointerEvent' in WINDOW : false;\n var NAMESPACE = 'cropper'; // Actions\n\n var ACTION_ALL = 'all';\n var ACTION_CROP = 'crop';\n var ACTION_MOVE = 'move';\n var ACTION_ZOOM = 'zoom';\n var ACTION_EAST = 'e';\n var ACTION_WEST = 'w';\n var ACTION_SOUTH = 's';\n var ACTION_NORTH = 'n';\n var ACTION_NORTH_EAST = 'ne';\n var ACTION_NORTH_WEST = 'nw';\n var ACTION_SOUTH_EAST = 'se';\n var ACTION_SOUTH_WEST = 'sw'; // Classes\n\n var CLASS_CROP = \"\".concat(NAMESPACE, \"-crop\");\n var CLASS_DISABLED = \"\".concat(NAMESPACE, \"-disabled\");\n var CLASS_HIDDEN = \"\".concat(NAMESPACE, \"-hidden\");\n var CLASS_HIDE = \"\".concat(NAMESPACE, \"-hide\");\n var CLASS_INVISIBLE = \"\".concat(NAMESPACE, \"-invisible\");\n var CLASS_MODAL = \"\".concat(NAMESPACE, \"-modal\");\n var CLASS_MOVE = \"\".concat(NAMESPACE, \"-move\"); // Data keys\n\n var DATA_ACTION = \"\".concat(NAMESPACE, \"Action\");\n var DATA_PREVIEW = \"\".concat(NAMESPACE, \"Preview\"); // Drag modes\n\n var DRAG_MODE_CROP = 'crop';\n var DRAG_MODE_MOVE = 'move';\n var DRAG_MODE_NONE = 'none'; // Events\n\n var EVENT_CROP = 'crop';\n var EVENT_CROP_END = 'cropend';\n var EVENT_CROP_MOVE = 'cropmove';\n var EVENT_CROP_START = 'cropstart';\n var EVENT_DBLCLICK = 'dblclick';\n var EVENT_TOUCH_START = IS_TOUCH_DEVICE ? 'touchstart' : 'mousedown';\n var EVENT_TOUCH_MOVE = IS_TOUCH_DEVICE ? 'touchmove' : 'mousemove';\n var EVENT_TOUCH_END = IS_TOUCH_DEVICE ? 'touchend touchcancel' : 'mouseup';\n var EVENT_POINTER_DOWN = HAS_POINTER_EVENT ? 'pointerdown' : EVENT_TOUCH_START;\n var EVENT_POINTER_MOVE = HAS_POINTER_EVENT ? 'pointermove' : EVENT_TOUCH_MOVE;\n var EVENT_POINTER_UP = HAS_POINTER_EVENT ? 'pointerup pointercancel' : EVENT_TOUCH_END;\n var EVENT_READY = 'ready';\n var EVENT_RESIZE = 'resize';\n var EVENT_WHEEL = 'wheel';\n var EVENT_ZOOM = 'zoom'; // Mime types\n\n var MIME_TYPE_JPEG = 'image/jpeg'; // RegExps\n\n var REGEXP_ACTIONS = /^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/;\n var REGEXP_DATA_URL = /^data:/;\n var REGEXP_DATA_URL_JPEG = /^data:image\\/jpeg;base64,/;\n var REGEXP_TAG_NAME = /^img|canvas$/i; // Misc\n\n var DEFAULTS = {\n // Define the view mode of the cropper\n viewMode: 0,\n // 0, 1, 2, 3\n // Define the dragging mode of the cropper\n dragMode: DRAG_MODE_CROP,\n // 'crop', 'move' or 'none'\n // Define the initial aspect ratio of the crop box\n initialAspectRatio: NaN,\n // Define the aspect ratio of the crop box\n aspectRatio: NaN,\n // An object with the previous cropping result data\n data: null,\n // A selector for adding extra containers to preview\n preview: '',\n // Re-render the cropper when resize the window\n responsive: true,\n // Restore the cropped area after resize the window\n restore: true,\n // Check if the current image is a cross-origin image\n checkCrossOrigin: true,\n // Check the current image's Exif Orientation information\n checkOrientation: true,\n // Show the black modal\n modal: true,\n // Show the dashed lines for guiding\n guides: true,\n // Show the center indicator for guiding\n center: true,\n // Show the white modal to highlight the crop box\n highlight: true,\n // Show the grid background\n background: true,\n // Enable to crop the image automatically when initialize\n autoCrop: true,\n // Define the percentage of automatic cropping area when initializes\n autoCropArea: 0.8,\n // Enable to move the image\n movable: true,\n // Enable to rotate the image\n rotatable: true,\n // Enable to scale the image\n scalable: true,\n // Enable to zoom the image\n zoomable: true,\n // Enable to zoom the image by dragging touch\n zoomOnTouch: true,\n // Enable to zoom the image by wheeling mouse\n zoomOnWheel: true,\n // Define zoom ratio when zoom the image by wheeling mouse\n wheelZoomRatio: 0.1,\n // Enable to move the crop box\n cropBoxMovable: true,\n // Enable to resize the crop box\n cropBoxResizable: true,\n // Toggle drag mode between \"crop\" and \"move\" when click twice on the cropper\n toggleDragModeOnDblclick: true,\n // Size limitation\n minCanvasWidth: 0,\n minCanvasHeight: 0,\n minCropBoxWidth: 0,\n minCropBoxHeight: 0,\n minContainerWidth: 200,\n minContainerHeight: 100,\n // Shortcuts of events\n ready: null,\n cropstart: null,\n cropmove: null,\n cropend: null,\n crop: null,\n zoom: null\n };\n\n var TEMPLATE = '
' + '
' + '
' + '
' + '
' + '
' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '
' + '
';\n\n /**\n * Check if the given value is not a number.\n */\n\n var isNaN = Number.isNaN || WINDOW.isNaN;\n /**\n * Check if the given value is a number.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the given value is a number, else `false`.\n */\n\n function isNumber(value) {\n return typeof value === 'number' && !isNaN(value);\n }\n /**\n * Check if the given value is a positive number.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the given value is a positive number, else `false`.\n */\n\n var isPositiveNumber = function isPositiveNumber(value) {\n return value > 0 && value < Infinity;\n };\n /**\n * Check if the given value is undefined.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the given value is undefined, else `false`.\n */\n\n function isUndefined(value) {\n return typeof value === 'undefined';\n }\n /**\n * Check if the given value is an object.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the given value is an object, else `false`.\n */\n\n function isObject(value) {\n return _typeof(value) === 'object' && value !== null;\n }\n var hasOwnProperty = Object.prototype.hasOwnProperty;\n /**\n * Check if the given value is a plain object.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the given value is a plain object, else `false`.\n */\n\n function isPlainObject(value) {\n if (!isObject(value)) {\n return false;\n }\n\n try {\n var _constructor = value.constructor;\n var prototype = _constructor.prototype;\n return _constructor && prototype && hasOwnProperty.call(prototype, 'isPrototypeOf');\n } catch (error) {\n return false;\n }\n }\n /**\n * Check if the given value is a function.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the given value is a function, else `false`.\n */\n\n function isFunction(value) {\n return typeof value === 'function';\n }\n var slice = Array.prototype.slice;\n /**\n * Convert array-like or iterable object to an array.\n * @param {*} value - The value to convert.\n * @returns {Array} Returns a new array.\n */\n\n function toArray(value) {\n return Array.from ? Array.from(value) : slice.call(value);\n }\n /**\n * Iterate the given data.\n * @param {*} data - The data to iterate.\n * @param {Function} callback - The process function for each element.\n * @returns {*} The original data.\n */\n\n function forEach(data, callback) {\n if (data && isFunction(callback)) {\n if (Array.isArray(data) || isNumber(data.length)\n /* array-like */\n ) {\n toArray(data).forEach(function (value, key) {\n callback.call(data, value, key, data);\n });\n } else if (isObject(data)) {\n Object.keys(data).forEach(function (key) {\n callback.call(data, data[key], key, data);\n });\n }\n }\n\n return data;\n }\n /**\n * Extend the given object.\n * @param {*} target - The target object to extend.\n * @param {*} args - The rest objects for merging to the target object.\n * @returns {Object} The extended object.\n */\n\n var assign = Object.assign || function assign(target) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n if (isObject(target) && args.length > 0) {\n args.forEach(function (arg) {\n if (isObject(arg)) {\n Object.keys(arg).forEach(function (key) {\n target[key] = arg[key];\n });\n }\n });\n }\n\n return target;\n };\n var REGEXP_DECIMALS = /\\.\\d*(?:0|9){12}\\d*$/;\n /**\n * Normalize decimal number.\n * Check out {@link https://0.30000000000000004.com/}\n * @param {number} value - The value to normalize.\n * @param {number} [times=100000000000] - The times for normalizing.\n * @returns {number} Returns the normalized number.\n */\n\n function normalizeDecimalNumber(value) {\n var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100000000000;\n return REGEXP_DECIMALS.test(value) ? Math.round(value * times) / times : value;\n }\n var REGEXP_SUFFIX = /^width|height|left|top|marginLeft|marginTop$/;\n /**\n * Apply styles to the given element.\n * @param {Element} element - The target element.\n * @param {Object} styles - The styles for applying.\n */\n\n function setStyle(element, styles) {\n var style = element.style;\n forEach(styles, function (value, property) {\n if (REGEXP_SUFFIX.test(property) && isNumber(value)) {\n value = \"\".concat(value, \"px\");\n }\n\n style[property] = value;\n });\n }\n /**\n * Check if the given element has a special class.\n * @param {Element} element - The element to check.\n * @param {string} value - The class to search.\n * @returns {boolean} Returns `true` if the special class was found.\n */\n\n function hasClass(element, value) {\n return element.classList ? element.classList.contains(value) : element.className.indexOf(value) > -1;\n }\n /**\n * Add classes to the given element.\n * @param {Element} element - The target element.\n * @param {string} value - The classes to be added.\n */\n\n function addClass(element, value) {\n if (!value) {\n return;\n }\n\n if (isNumber(element.length)) {\n forEach(element, function (elem) {\n addClass(elem, value);\n });\n return;\n }\n\n if (element.classList) {\n element.classList.add(value);\n return;\n }\n\n var className = element.className.trim();\n\n if (!className) {\n element.className = value;\n } else if (className.indexOf(value) < 0) {\n element.className = \"\".concat(className, \" \").concat(value);\n }\n }\n /**\n * Remove classes from the given element.\n * @param {Element} element - The target element.\n * @param {string} value - The classes to be removed.\n */\n\n function removeClass(element, value) {\n if (!value) {\n return;\n }\n\n if (isNumber(element.length)) {\n forEach(element, function (elem) {\n removeClass(elem, value);\n });\n return;\n }\n\n if (element.classList) {\n element.classList.remove(value);\n return;\n }\n\n if (element.className.indexOf(value) >= 0) {\n element.className = element.className.replace(value, '');\n }\n }\n /**\n * Add or remove classes from the given element.\n * @param {Element} element - The target element.\n * @param {string} value - The classes to be toggled.\n * @param {boolean} added - Add only.\n */\n\n function toggleClass(element, value, added) {\n if (!value) {\n return;\n }\n\n if (isNumber(element.length)) {\n forEach(element, function (elem) {\n toggleClass(elem, value, added);\n });\n return;\n } // IE10-11 doesn't support the second parameter of `classList.toggle`\n\n\n if (added) {\n addClass(element, value);\n } else {\n removeClass(element, value);\n }\n }\n var REGEXP_CAMEL_CASE = /([a-z\\d])([A-Z])/g;\n /**\n * Transform the given string from camelCase to kebab-case\n * @param {string} value - The value to transform.\n * @returns {string} The transformed value.\n */\n\n function toParamCase(value) {\n return value.replace(REGEXP_CAMEL_CASE, '$1-$2').toLowerCase();\n }\n /**\n * Get data from the given element.\n * @param {Element} element - The target element.\n * @param {string} name - The data key to get.\n * @returns {string} The data value.\n */\n\n function getData(element, name) {\n if (isObject(element[name])) {\n return element[name];\n }\n\n if (element.dataset) {\n return element.dataset[name];\n }\n\n return element.getAttribute(\"data-\".concat(toParamCase(name)));\n }\n /**\n * Set data to the given element.\n * @param {Element} element - The target element.\n * @param {string} name - The data key to set.\n * @param {string} data - The data value.\n */\n\n function setData(element, name, data) {\n if (isObject(data)) {\n element[name] = data;\n } else if (element.dataset) {\n element.dataset[name] = data;\n } else {\n element.setAttribute(\"data-\".concat(toParamCase(name)), data);\n }\n }\n /**\n * Remove data from the given element.\n * @param {Element} element - The target element.\n * @param {string} name - The data key to remove.\n */\n\n function removeData(element, name) {\n if (isObject(element[name])) {\n try {\n delete element[name];\n } catch (error) {\n element[name] = undefined;\n }\n } else if (element.dataset) {\n // #128 Safari not allows to delete dataset property\n try {\n delete element.dataset[name];\n } catch (error) {\n element.dataset[name] = undefined;\n }\n } else {\n element.removeAttribute(\"data-\".concat(toParamCase(name)));\n }\n }\n var REGEXP_SPACES = /\\s\\s*/;\n\n var onceSupported = function () {\n var supported = false;\n\n if (IS_BROWSER) {\n var once = false;\n\n var listener = function listener() {};\n\n var options = Object.defineProperty({}, 'once', {\n get: function get() {\n supported = true;\n return once;\n },\n\n /**\n * This setter can fix a `TypeError` in strict mode\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Getter_only}\n * @param {boolean} value - The value to set\n */\n set: function set(value) {\n once = value;\n }\n });\n WINDOW.addEventListener('test', listener, options);\n WINDOW.removeEventListener('test', listener, options);\n }\n\n return supported;\n }();\n /**\n * Remove event listener from the target element.\n * @param {Element} element - The event target.\n * @param {string} type - The event type(s).\n * @param {Function} listener - The event listener.\n * @param {Object} options - The event options.\n */\n\n\n function removeListener(element, type, listener) {\n var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n var handler = listener;\n type.trim().split(REGEXP_SPACES).forEach(function (event) {\n if (!onceSupported) {\n var listeners = element.listeners;\n\n if (listeners && listeners[event] && listeners[event][listener]) {\n handler = listeners[event][listener];\n delete listeners[event][listener];\n\n if (Object.keys(listeners[event]).length === 0) {\n delete listeners[event];\n }\n\n if (Object.keys(listeners).length === 0) {\n delete element.listeners;\n }\n }\n }\n\n element.removeEventListener(event, handler, options);\n });\n }\n /**\n * Add event listener to the target element.\n * @param {Element} element - The event target.\n * @param {string} type - The event type(s).\n * @param {Function} listener - The event listener.\n * @param {Object} options - The event options.\n */\n\n function addListener(element, type, listener) {\n var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n var _handler = listener;\n type.trim().split(REGEXP_SPACES).forEach(function (event) {\n if (options.once && !onceSupported) {\n var _element$listeners = element.listeners,\n listeners = _element$listeners === void 0 ? {} : _element$listeners;\n\n _handler = function handler() {\n delete listeners[event][listener];\n element.removeEventListener(event, _handler, options);\n\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n listener.apply(element, args);\n };\n\n if (!listeners[event]) {\n listeners[event] = {};\n }\n\n if (listeners[event][listener]) {\n element.removeEventListener(event, listeners[event][listener], options);\n }\n\n listeners[event][listener] = _handler;\n element.listeners = listeners;\n }\n\n element.addEventListener(event, _handler, options);\n });\n }\n /**\n * Dispatch event on the target element.\n * @param {Element} element - The event target.\n * @param {string} type - The event type(s).\n * @param {Object} data - The additional event data.\n * @returns {boolean} Indicate if the event is default prevented or not.\n */\n\n function dispatchEvent(element, type, data) {\n var event; // Event and CustomEvent on IE9-11 are global objects, not constructors\n\n if (isFunction(Event) && isFunction(CustomEvent)) {\n event = new CustomEvent(type, {\n detail: data,\n bubbles: true,\n cancelable: true\n });\n } else {\n event = document.createEvent('CustomEvent');\n event.initCustomEvent(type, true, true, data);\n }\n\n return element.dispatchEvent(event);\n }\n /**\n * Get the offset base on the document.\n * @param {Element} element - The target element.\n * @returns {Object} The offset data.\n */\n\n function getOffset(element) {\n var box = element.getBoundingClientRect();\n return {\n left: box.left + (window.pageXOffset - document.documentElement.clientLeft),\n top: box.top + (window.pageYOffset - document.documentElement.clientTop)\n };\n }\n var location = WINDOW.location;\n var REGEXP_ORIGINS = /^(\\w+:)\\/\\/([^:/?#]*):?(\\d*)/i;\n /**\n * Check if the given URL is a cross origin URL.\n * @param {string} url - The target URL.\n * @returns {boolean} Returns `true` if the given URL is a cross origin URL, else `false`.\n */\n\n function isCrossOriginURL(url) {\n var parts = url.match(REGEXP_ORIGINS);\n return parts !== null && (parts[1] !== location.protocol || parts[2] !== location.hostname || parts[3] !== location.port);\n }\n /**\n * Add timestamp to the given URL.\n * @param {string} url - The target URL.\n * @returns {string} The result URL.\n */\n\n function addTimestamp(url) {\n var timestamp = \"timestamp=\".concat(new Date().getTime());\n return url + (url.indexOf('?') === -1 ? '?' : '&') + timestamp;\n }\n /**\n * Get transforms base on the given object.\n * @param {Object} obj - The target object.\n * @returns {string} A string contains transform values.\n */\n\n function getTransforms(_ref) {\n var rotate = _ref.rotate,\n scaleX = _ref.scaleX,\n scaleY = _ref.scaleY,\n translateX = _ref.translateX,\n translateY = _ref.translateY;\n var values = [];\n\n if (isNumber(translateX) && translateX !== 0) {\n values.push(\"translateX(\".concat(translateX, \"px)\"));\n }\n\n if (isNumber(translateY) && translateY !== 0) {\n values.push(\"translateY(\".concat(translateY, \"px)\"));\n } // Rotate should come first before scale to match orientation transform\n\n\n if (isNumber(rotate) && rotate !== 0) {\n values.push(\"rotate(\".concat(rotate, \"deg)\"));\n }\n\n if (isNumber(scaleX) && scaleX !== 1) {\n values.push(\"scaleX(\".concat(scaleX, \")\"));\n }\n\n if (isNumber(scaleY) && scaleY !== 1) {\n values.push(\"scaleY(\".concat(scaleY, \")\"));\n }\n\n var transform = values.length ? values.join(' ') : 'none';\n return {\n WebkitTransform: transform,\n msTransform: transform,\n transform: transform\n };\n }\n /**\n * Get the max ratio of a group of pointers.\n * @param {string} pointers - The target pointers.\n * @returns {number} The result ratio.\n */\n\n function getMaxZoomRatio(pointers) {\n var pointers2 = _objectSpread2({}, pointers);\n\n var ratios = [];\n forEach(pointers, function (pointer, pointerId) {\n delete pointers2[pointerId];\n forEach(pointers2, function (pointer2) {\n var x1 = Math.abs(pointer.startX - pointer2.startX);\n var y1 = Math.abs(pointer.startY - pointer2.startY);\n var x2 = Math.abs(pointer.endX - pointer2.endX);\n var y2 = Math.abs(pointer.endY - pointer2.endY);\n var z1 = Math.sqrt(x1 * x1 + y1 * y1);\n var z2 = Math.sqrt(x2 * x2 + y2 * y2);\n var ratio = (z2 - z1) / z1;\n ratios.push(ratio);\n });\n });\n ratios.sort(function (a, b) {\n return Math.abs(a) < Math.abs(b);\n });\n return ratios[0];\n }\n /**\n * Get a pointer from an event object.\n * @param {Object} event - The target event object.\n * @param {boolean} endOnly - Indicates if only returns the end point coordinate or not.\n * @returns {Object} The result pointer contains start and/or end point coordinates.\n */\n\n function getPointer(_ref2, endOnly) {\n var pageX = _ref2.pageX,\n pageY = _ref2.pageY;\n var end = {\n endX: pageX,\n endY: pageY\n };\n return endOnly ? end : _objectSpread2({\n startX: pageX,\n startY: pageY\n }, end);\n }\n /**\n * Get the center point coordinate of a group of pointers.\n * @param {Object} pointers - The target pointers.\n * @returns {Object} The center point coordinate.\n */\n\n function getPointersCenter(pointers) {\n var pageX = 0;\n var pageY = 0;\n var count = 0;\n forEach(pointers, function (_ref3) {\n var startX = _ref3.startX,\n startY = _ref3.startY;\n pageX += startX;\n pageY += startY;\n count += 1;\n });\n pageX /= count;\n pageY /= count;\n return {\n pageX: pageX,\n pageY: pageY\n };\n }\n /**\n * Get the max sizes in a rectangle under the given aspect ratio.\n * @param {Object} data - The original sizes.\n * @param {string} [type='contain'] - The adjust type.\n * @returns {Object} The result sizes.\n */\n\n function getAdjustedSizes(_ref4) // or 'cover'\n {\n var aspectRatio = _ref4.aspectRatio,\n height = _ref4.height,\n width = _ref4.width;\n var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'contain';\n var isValidWidth = isPositiveNumber(width);\n var isValidHeight = isPositiveNumber(height);\n\n if (isValidWidth && isValidHeight) {\n var adjustedWidth = height * aspectRatio;\n\n if (type === 'contain' && adjustedWidth > width || type === 'cover' && adjustedWidth < width) {\n height = width / aspectRatio;\n } else {\n width = height * aspectRatio;\n }\n } else if (isValidWidth) {\n height = width / aspectRatio;\n } else if (isValidHeight) {\n width = height * aspectRatio;\n }\n\n return {\n width: width,\n height: height\n };\n }\n /**\n * Get the new sizes of a rectangle after rotated.\n * @param {Object} data - The original sizes.\n * @returns {Object} The result sizes.\n */\n\n function getRotatedSizes(_ref5) {\n var width = _ref5.width,\n height = _ref5.height,\n degree = _ref5.degree;\n degree = Math.abs(degree) % 180;\n\n if (degree === 90) {\n return {\n width: height,\n height: width\n };\n }\n\n var arc = degree % 90 * Math.PI / 180;\n var sinArc = Math.sin(arc);\n var cosArc = Math.cos(arc);\n var newWidth = width * cosArc + height * sinArc;\n var newHeight = width * sinArc + height * cosArc;\n return degree > 90 ? {\n width: newHeight,\n height: newWidth\n } : {\n width: newWidth,\n height: newHeight\n };\n }\n /**\n * Get a canvas which drew the given image.\n * @param {HTMLImageElement} image - The image for drawing.\n * @param {Object} imageData - The image data.\n * @param {Object} canvasData - The canvas data.\n * @param {Object} options - The options.\n * @returns {HTMLCanvasElement} The result canvas.\n */\n\n function getSourceCanvas(image, _ref6, _ref7, _ref8) {\n var imageAspectRatio = _ref6.aspectRatio,\n imageNaturalWidth = _ref6.naturalWidth,\n imageNaturalHeight = _ref6.naturalHeight,\n _ref6$rotate = _ref6.rotate,\n rotate = _ref6$rotate === void 0 ? 0 : _ref6$rotate,\n _ref6$scaleX = _ref6.scaleX,\n scaleX = _ref6$scaleX === void 0 ? 1 : _ref6$scaleX,\n _ref6$scaleY = _ref6.scaleY,\n scaleY = _ref6$scaleY === void 0 ? 1 : _ref6$scaleY;\n var aspectRatio = _ref7.aspectRatio,\n naturalWidth = _ref7.naturalWidth,\n naturalHeight = _ref7.naturalHeight;\n var _ref8$fillColor = _ref8.fillColor,\n fillColor = _ref8$fillColor === void 0 ? 'transparent' : _ref8$fillColor,\n _ref8$imageSmoothingE = _ref8.imageSmoothingEnabled,\n imageSmoothingEnabled = _ref8$imageSmoothingE === void 0 ? true : _ref8$imageSmoothingE,\n _ref8$imageSmoothingQ = _ref8.imageSmoothingQuality,\n imageSmoothingQuality = _ref8$imageSmoothingQ === void 0 ? 'low' : _ref8$imageSmoothingQ,\n _ref8$maxWidth = _ref8.maxWidth,\n maxWidth = _ref8$maxWidth === void 0 ? Infinity : _ref8$maxWidth,\n _ref8$maxHeight = _ref8.maxHeight,\n maxHeight = _ref8$maxHeight === void 0 ? Infinity : _ref8$maxHeight,\n _ref8$minWidth = _ref8.minWidth,\n minWidth = _ref8$minWidth === void 0 ? 0 : _ref8$minWidth,\n _ref8$minHeight = _ref8.minHeight,\n minHeight = _ref8$minHeight === void 0 ? 0 : _ref8$minHeight;\n var canvas = document.createElement('canvas');\n var context = canvas.getContext('2d');\n var maxSizes = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: maxWidth,\n height: maxHeight\n });\n var minSizes = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: minWidth,\n height: minHeight\n }, 'cover');\n var width = Math.min(maxSizes.width, Math.max(minSizes.width, naturalWidth));\n var height = Math.min(maxSizes.height, Math.max(minSizes.height, naturalHeight)); // Note: should always use image's natural sizes for drawing as\n // imageData.naturalWidth === canvasData.naturalHeight when rotate % 180 === 90\n\n var destMaxSizes = getAdjustedSizes({\n aspectRatio: imageAspectRatio,\n width: maxWidth,\n height: maxHeight\n });\n var destMinSizes = getAdjustedSizes({\n aspectRatio: imageAspectRatio,\n width: minWidth,\n height: minHeight\n }, 'cover');\n var destWidth = Math.min(destMaxSizes.width, Math.max(destMinSizes.width, imageNaturalWidth));\n var destHeight = Math.min(destMaxSizes.height, Math.max(destMinSizes.height, imageNaturalHeight));\n var params = [-destWidth / 2, -destHeight / 2, destWidth, destHeight];\n canvas.width = normalizeDecimalNumber(width);\n canvas.height = normalizeDecimalNumber(height);\n context.fillStyle = fillColor;\n context.fillRect(0, 0, width, height);\n context.save();\n context.translate(width / 2, height / 2);\n context.rotate(rotate * Math.PI / 180);\n context.scale(scaleX, scaleY);\n context.imageSmoothingEnabled = imageSmoothingEnabled;\n context.imageSmoothingQuality = imageSmoothingQuality;\n context.drawImage.apply(context, [image].concat(_toConsumableArray(params.map(function (param) {\n return Math.floor(normalizeDecimalNumber(param));\n }))));\n context.restore();\n return canvas;\n }\n var fromCharCode = String.fromCharCode;\n /**\n * Get string from char code in data view.\n * @param {DataView} dataView - The data view for read.\n * @param {number} start - The start index.\n * @param {number} length - The read length.\n * @returns {string} The read result.\n */\n\n function getStringFromCharCode(dataView, start, length) {\n var str = '';\n length += start;\n\n for (var i = start; i < length; i += 1) {\n str += fromCharCode(dataView.getUint8(i));\n }\n\n return str;\n }\n var REGEXP_DATA_URL_HEAD = /^data:.*,/;\n /**\n * Transform Data URL to array buffer.\n * @param {string} dataURL - The Data URL to transform.\n * @returns {ArrayBuffer} The result array buffer.\n */\n\n function dataURLToArrayBuffer(dataURL) {\n var base64 = dataURL.replace(REGEXP_DATA_URL_HEAD, '');\n var binary = atob(base64);\n var arrayBuffer = new ArrayBuffer(binary.length);\n var uint8 = new Uint8Array(arrayBuffer);\n forEach(uint8, function (value, i) {\n uint8[i] = binary.charCodeAt(i);\n });\n return arrayBuffer;\n }\n /**\n * Transform array buffer to Data URL.\n * @param {ArrayBuffer} arrayBuffer - The array buffer to transform.\n * @param {string} mimeType - The mime type of the Data URL.\n * @returns {string} The result Data URL.\n */\n\n function arrayBufferToDataURL(arrayBuffer, mimeType) {\n var chunks = []; // Chunk Typed Array for better performance (#435)\n\n var chunkSize = 8192;\n var uint8 = new Uint8Array(arrayBuffer);\n\n while (uint8.length > 0) {\n // XXX: Babel's `toConsumableArray` helper will throw error in IE or Safari 9\n // eslint-disable-next-line prefer-spread\n chunks.push(fromCharCode.apply(null, toArray(uint8.subarray(0, chunkSize))));\n uint8 = uint8.subarray(chunkSize);\n }\n\n return \"data:\".concat(mimeType, \";base64,\").concat(btoa(chunks.join('')));\n }\n /**\n * Get orientation value from given array buffer.\n * @param {ArrayBuffer} arrayBuffer - The array buffer to read.\n * @returns {number} The read orientation value.\n */\n\n function resetAndGetOrientation(arrayBuffer) {\n var dataView = new DataView(arrayBuffer);\n var orientation; // Ignores range error when the image does not have correct Exif information\n\n try {\n var littleEndian;\n var app1Start;\n var ifdStart; // Only handle JPEG image (start by 0xFFD8)\n\n if (dataView.getUint8(0) === 0xFF && dataView.getUint8(1) === 0xD8) {\n var length = dataView.byteLength;\n var offset = 2;\n\n while (offset + 1 < length) {\n if (dataView.getUint8(offset) === 0xFF && dataView.getUint8(offset + 1) === 0xE1) {\n app1Start = offset;\n break;\n }\n\n offset += 1;\n }\n }\n\n if (app1Start) {\n var exifIDCode = app1Start + 4;\n var tiffOffset = app1Start + 10;\n\n if (getStringFromCharCode(dataView, exifIDCode, 4) === 'Exif') {\n var endianness = dataView.getUint16(tiffOffset);\n littleEndian = endianness === 0x4949;\n\n if (littleEndian || endianness === 0x4D4D\n /* bigEndian */\n ) {\n if (dataView.getUint16(tiffOffset + 2, littleEndian) === 0x002A) {\n var firstIFDOffset = dataView.getUint32(tiffOffset + 4, littleEndian);\n\n if (firstIFDOffset >= 0x00000008) {\n ifdStart = tiffOffset + firstIFDOffset;\n }\n }\n }\n }\n }\n\n if (ifdStart) {\n var _length = dataView.getUint16(ifdStart, littleEndian);\n\n var _offset;\n\n var i;\n\n for (i = 0; i < _length; i += 1) {\n _offset = ifdStart + i * 12 + 2;\n\n if (dataView.getUint16(_offset, littleEndian) === 0x0112\n /* Orientation */\n ) {\n // 8 is the offset of the current tag's value\n _offset += 8; // Get the original orientation value\n\n orientation = dataView.getUint16(_offset, littleEndian); // Override the orientation with its default value\n\n dataView.setUint16(_offset, 1, littleEndian);\n break;\n }\n }\n }\n } catch (error) {\n orientation = 1;\n }\n\n return orientation;\n }\n /**\n * Parse Exif Orientation value.\n * @param {number} orientation - The orientation to parse.\n * @returns {Object} The parsed result.\n */\n\n function parseOrientation(orientation) {\n var rotate = 0;\n var scaleX = 1;\n var scaleY = 1;\n\n switch (orientation) {\n // Flip horizontal\n case 2:\n scaleX = -1;\n break;\n // Rotate left 180\u00B0\n\n case 3:\n rotate = -180;\n break;\n // Flip vertical\n\n case 4:\n scaleY = -1;\n break;\n // Flip vertical and rotate right 90\u00B0\n\n case 5:\n rotate = 90;\n scaleY = -1;\n break;\n // Rotate right 90\u00B0\n\n case 6:\n rotate = 90;\n break;\n // Flip horizontal and rotate right 90\u00B0\n\n case 7:\n rotate = 90;\n scaleX = -1;\n break;\n // Rotate left 90\u00B0\n\n case 8:\n rotate = -90;\n break;\n }\n\n return {\n rotate: rotate,\n scaleX: scaleX,\n scaleY: scaleY\n };\n }\n\n var render = {\n render: function render() {\n this.initContainer();\n this.initCanvas();\n this.initCropBox();\n this.renderCanvas();\n\n if (this.cropped) {\n this.renderCropBox();\n }\n },\n initContainer: function initContainer() {\n var element = this.element,\n options = this.options,\n container = this.container,\n cropper = this.cropper;\n addClass(cropper, CLASS_HIDDEN);\n removeClass(element, CLASS_HIDDEN);\n var containerData = {\n width: Math.max(container.offsetWidth, Number(options.minContainerWidth) || 200),\n height: Math.max(container.offsetHeight, Number(options.minContainerHeight) || 100)\n };\n this.containerData = containerData;\n setStyle(cropper, {\n width: containerData.width,\n height: containerData.height\n });\n addClass(element, CLASS_HIDDEN);\n removeClass(cropper, CLASS_HIDDEN);\n },\n // Canvas (image wrapper)\n initCanvas: function initCanvas() {\n var containerData = this.containerData,\n imageData = this.imageData;\n var viewMode = this.options.viewMode;\n var rotated = Math.abs(imageData.rotate) % 180 === 90;\n var naturalWidth = rotated ? imageData.naturalHeight : imageData.naturalWidth;\n var naturalHeight = rotated ? imageData.naturalWidth : imageData.naturalHeight;\n var aspectRatio = naturalWidth / naturalHeight;\n var canvasWidth = containerData.width;\n var canvasHeight = containerData.height;\n\n if (containerData.height * aspectRatio > containerData.width) {\n if (viewMode === 3) {\n canvasWidth = containerData.height * aspectRatio;\n } else {\n canvasHeight = containerData.width / aspectRatio;\n }\n } else if (viewMode === 3) {\n canvasHeight = containerData.width / aspectRatio;\n } else {\n canvasWidth = containerData.height * aspectRatio;\n }\n\n var canvasData = {\n aspectRatio: aspectRatio,\n naturalWidth: naturalWidth,\n naturalHeight: naturalHeight,\n width: canvasWidth,\n height: canvasHeight\n };\n canvasData.left = (containerData.width - canvasWidth) / 2;\n canvasData.top = (containerData.height - canvasHeight) / 2;\n canvasData.oldLeft = canvasData.left;\n canvasData.oldTop = canvasData.top;\n this.canvasData = canvasData;\n this.limited = viewMode === 1 || viewMode === 2;\n this.limitCanvas(true, true);\n this.initialImageData = assign({}, imageData);\n this.initialCanvasData = assign({}, canvasData);\n },\n limitCanvas: function limitCanvas(sizeLimited, positionLimited) {\n var options = this.options,\n containerData = this.containerData,\n canvasData = this.canvasData,\n cropBoxData = this.cropBoxData;\n var viewMode = options.viewMode;\n var aspectRatio = canvasData.aspectRatio;\n var cropped = this.cropped && cropBoxData;\n\n if (sizeLimited) {\n var minCanvasWidth = Number(options.minCanvasWidth) || 0;\n var minCanvasHeight = Number(options.minCanvasHeight) || 0;\n\n if (viewMode > 1) {\n minCanvasWidth = Math.max(minCanvasWidth, containerData.width);\n minCanvasHeight = Math.max(minCanvasHeight, containerData.height);\n\n if (viewMode === 3) {\n if (minCanvasHeight * aspectRatio > minCanvasWidth) {\n minCanvasWidth = minCanvasHeight * aspectRatio;\n } else {\n minCanvasHeight = minCanvasWidth / aspectRatio;\n }\n }\n } else if (viewMode > 0) {\n if (minCanvasWidth) {\n minCanvasWidth = Math.max(minCanvasWidth, cropped ? cropBoxData.width : 0);\n } else if (minCanvasHeight) {\n minCanvasHeight = Math.max(minCanvasHeight, cropped ? cropBoxData.height : 0);\n } else if (cropped) {\n minCanvasWidth = cropBoxData.width;\n minCanvasHeight = cropBoxData.height;\n\n if (minCanvasHeight * aspectRatio > minCanvasWidth) {\n minCanvasWidth = minCanvasHeight * aspectRatio;\n } else {\n minCanvasHeight = minCanvasWidth / aspectRatio;\n }\n }\n }\n\n var _getAdjustedSizes = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: minCanvasWidth,\n height: minCanvasHeight\n });\n\n minCanvasWidth = _getAdjustedSizes.width;\n minCanvasHeight = _getAdjustedSizes.height;\n canvasData.minWidth = minCanvasWidth;\n canvasData.minHeight = minCanvasHeight;\n canvasData.maxWidth = Infinity;\n canvasData.maxHeight = Infinity;\n }\n\n if (positionLimited) {\n if (viewMode > (cropped ? 0 : 1)) {\n var newCanvasLeft = containerData.width - canvasData.width;\n var newCanvasTop = containerData.height - canvasData.height;\n canvasData.minLeft = Math.min(0, newCanvasLeft);\n canvasData.minTop = Math.min(0, newCanvasTop);\n canvasData.maxLeft = Math.max(0, newCanvasLeft);\n canvasData.maxTop = Math.max(0, newCanvasTop);\n\n if (cropped && this.limited) {\n canvasData.minLeft = Math.min(cropBoxData.left, cropBoxData.left + (cropBoxData.width - canvasData.width));\n canvasData.minTop = Math.min(cropBoxData.top, cropBoxData.top + (cropBoxData.height - canvasData.height));\n canvasData.maxLeft = cropBoxData.left;\n canvasData.maxTop = cropBoxData.top;\n\n if (viewMode === 2) {\n if (canvasData.width >= containerData.width) {\n canvasData.minLeft = Math.min(0, newCanvasLeft);\n canvasData.maxLeft = Math.max(0, newCanvasLeft);\n }\n\n if (canvasData.height >= containerData.height) {\n canvasData.minTop = Math.min(0, newCanvasTop);\n canvasData.maxTop = Math.max(0, newCanvasTop);\n }\n }\n }\n } else {\n canvasData.minLeft = -canvasData.width;\n canvasData.minTop = -canvasData.height;\n canvasData.maxLeft = containerData.width;\n canvasData.maxTop = containerData.height;\n }\n }\n },\n renderCanvas: function renderCanvas(changed, transformed) {\n var canvasData = this.canvasData,\n imageData = this.imageData;\n\n if (transformed) {\n var _getRotatedSizes = getRotatedSizes({\n width: imageData.naturalWidth * Math.abs(imageData.scaleX || 1),\n height: imageData.naturalHeight * Math.abs(imageData.scaleY || 1),\n degree: imageData.rotate || 0\n }),\n naturalWidth = _getRotatedSizes.width,\n naturalHeight = _getRotatedSizes.height;\n\n var width = canvasData.width * (naturalWidth / canvasData.naturalWidth);\n var height = canvasData.height * (naturalHeight / canvasData.naturalHeight);\n canvasData.left -= (width - canvasData.width) / 2;\n canvasData.top -= (height - canvasData.height) / 2;\n canvasData.width = width;\n canvasData.height = height;\n canvasData.aspectRatio = naturalWidth / naturalHeight;\n canvasData.naturalWidth = naturalWidth;\n canvasData.naturalHeight = naturalHeight;\n this.limitCanvas(true, false);\n }\n\n if (canvasData.width > canvasData.maxWidth || canvasData.width < canvasData.minWidth) {\n canvasData.left = canvasData.oldLeft;\n }\n\n if (canvasData.height > canvasData.maxHeight || canvasData.height < canvasData.minHeight) {\n canvasData.top = canvasData.oldTop;\n }\n\n canvasData.width = Math.min(Math.max(canvasData.width, canvasData.minWidth), canvasData.maxWidth);\n canvasData.height = Math.min(Math.max(canvasData.height, canvasData.minHeight), canvasData.maxHeight);\n this.limitCanvas(false, true);\n canvasData.left = Math.min(Math.max(canvasData.left, canvasData.minLeft), canvasData.maxLeft);\n canvasData.top = Math.min(Math.max(canvasData.top, canvasData.minTop), canvasData.maxTop);\n canvasData.oldLeft = canvasData.left;\n canvasData.oldTop = canvasData.top;\n setStyle(this.canvas, assign({\n width: canvasData.width,\n height: canvasData.height\n }, getTransforms({\n translateX: canvasData.left,\n translateY: canvasData.top\n })));\n this.renderImage(changed);\n\n if (this.cropped && this.limited) {\n this.limitCropBox(true, true);\n }\n },\n renderImage: function renderImage(changed) {\n var canvasData = this.canvasData,\n imageData = this.imageData;\n var width = imageData.naturalWidth * (canvasData.width / canvasData.naturalWidth);\n var height = imageData.naturalHeight * (canvasData.height / canvasData.naturalHeight);\n assign(imageData, {\n width: width,\n height: height,\n left: (canvasData.width - width) / 2,\n top: (canvasData.height - height) / 2\n });\n setStyle(this.image, assign({\n width: imageData.width,\n height: imageData.height\n }, getTransforms(assign({\n translateX: imageData.left,\n translateY: imageData.top\n }, imageData))));\n\n if (changed) {\n this.output();\n }\n },\n initCropBox: function initCropBox() {\n var options = this.options,\n canvasData = this.canvasData;\n var aspectRatio = options.aspectRatio || options.initialAspectRatio;\n var autoCropArea = Number(options.autoCropArea) || 0.8;\n var cropBoxData = {\n width: canvasData.width,\n height: canvasData.height\n };\n\n if (aspectRatio) {\n if (canvasData.height * aspectRatio > canvasData.width) {\n cropBoxData.height = cropBoxData.width / aspectRatio;\n } else {\n cropBoxData.width = cropBoxData.height * aspectRatio;\n }\n }\n\n this.cropBoxData = cropBoxData;\n this.limitCropBox(true, true); // Initialize auto crop area\n\n cropBoxData.width = Math.min(Math.max(cropBoxData.width, cropBoxData.minWidth), cropBoxData.maxWidth);\n cropBoxData.height = Math.min(Math.max(cropBoxData.height, cropBoxData.minHeight), cropBoxData.maxHeight); // The width/height of auto crop area must large than \"minWidth/Height\"\n\n cropBoxData.width = Math.max(cropBoxData.minWidth, cropBoxData.width * autoCropArea);\n cropBoxData.height = Math.max(cropBoxData.minHeight, cropBoxData.height * autoCropArea);\n cropBoxData.left = canvasData.left + (canvasData.width - cropBoxData.width) / 2;\n cropBoxData.top = canvasData.top + (canvasData.height - cropBoxData.height) / 2;\n cropBoxData.oldLeft = cropBoxData.left;\n cropBoxData.oldTop = cropBoxData.top;\n this.initialCropBoxData = assign({}, cropBoxData);\n },\n limitCropBox: function limitCropBox(sizeLimited, positionLimited) {\n var options = this.options,\n containerData = this.containerData,\n canvasData = this.canvasData,\n cropBoxData = this.cropBoxData,\n limited = this.limited;\n var aspectRatio = options.aspectRatio;\n\n if (sizeLimited) {\n var minCropBoxWidth = Number(options.minCropBoxWidth) || 0;\n var minCropBoxHeight = Number(options.minCropBoxHeight) || 0;\n var maxCropBoxWidth = limited ? Math.min(containerData.width, canvasData.width, canvasData.width + canvasData.left, containerData.width - canvasData.left) : containerData.width;\n var maxCropBoxHeight = limited ? Math.min(containerData.height, canvasData.height, canvasData.height + canvasData.top, containerData.height - canvasData.top) : containerData.height; // The min/maxCropBoxWidth/Height must be less than container's width/height\n\n minCropBoxWidth = Math.min(minCropBoxWidth, containerData.width);\n minCropBoxHeight = Math.min(minCropBoxHeight, containerData.height);\n\n if (aspectRatio) {\n if (minCropBoxWidth && minCropBoxHeight) {\n if (minCropBoxHeight * aspectRatio > minCropBoxWidth) {\n minCropBoxHeight = minCropBoxWidth / aspectRatio;\n } else {\n minCropBoxWidth = minCropBoxHeight * aspectRatio;\n }\n } else if (minCropBoxWidth) {\n minCropBoxHeight = minCropBoxWidth / aspectRatio;\n } else if (minCropBoxHeight) {\n minCropBoxWidth = minCropBoxHeight * aspectRatio;\n }\n\n if (maxCropBoxHeight * aspectRatio > maxCropBoxWidth) {\n maxCropBoxHeight = maxCropBoxWidth / aspectRatio;\n } else {\n maxCropBoxWidth = maxCropBoxHeight * aspectRatio;\n }\n } // The minWidth/Height must be less than maxWidth/Height\n\n\n cropBoxData.minWidth = Math.min(minCropBoxWidth, maxCropBoxWidth);\n cropBoxData.minHeight = Math.min(minCropBoxHeight, maxCropBoxHeight);\n cropBoxData.maxWidth = maxCropBoxWidth;\n cropBoxData.maxHeight = maxCropBoxHeight;\n }\n\n if (positionLimited) {\n if (limited) {\n cropBoxData.minLeft = Math.max(0, canvasData.left);\n cropBoxData.minTop = Math.max(0, canvasData.top);\n cropBoxData.maxLeft = Math.min(containerData.width, canvasData.left + canvasData.width) - cropBoxData.width;\n cropBoxData.maxTop = Math.min(containerData.height, canvasData.top + canvasData.height) - cropBoxData.height;\n } else {\n cropBoxData.minLeft = 0;\n cropBoxData.minTop = 0;\n cropBoxData.maxLeft = containerData.width - cropBoxData.width;\n cropBoxData.maxTop = containerData.height - cropBoxData.height;\n }\n }\n },\n renderCropBox: function renderCropBox() {\n var options = this.options,\n containerData = this.containerData,\n cropBoxData = this.cropBoxData;\n\n if (cropBoxData.width > cropBoxData.maxWidth || cropBoxData.width < cropBoxData.minWidth) {\n cropBoxData.left = cropBoxData.oldLeft;\n }\n\n if (cropBoxData.height > cropBoxData.maxHeight || cropBoxData.height < cropBoxData.minHeight) {\n cropBoxData.top = cropBoxData.oldTop;\n }\n\n cropBoxData.width = Math.min(Math.max(cropBoxData.width, cropBoxData.minWidth), cropBoxData.maxWidth);\n cropBoxData.height = Math.min(Math.max(cropBoxData.height, cropBoxData.minHeight), cropBoxData.maxHeight);\n this.limitCropBox(false, true);\n cropBoxData.left = Math.min(Math.max(cropBoxData.left, cropBoxData.minLeft), cropBoxData.maxLeft);\n cropBoxData.top = Math.min(Math.max(cropBoxData.top, cropBoxData.minTop), cropBoxData.maxTop);\n cropBoxData.oldLeft = cropBoxData.left;\n cropBoxData.oldTop = cropBoxData.top;\n\n if (options.movable && options.cropBoxMovable) {\n // Turn to move the canvas when the crop box is equal to the container\n setData(this.face, DATA_ACTION, cropBoxData.width >= containerData.width && cropBoxData.height >= containerData.height ? ACTION_MOVE : ACTION_ALL);\n }\n\n setStyle(this.cropBox, assign({\n width: cropBoxData.width,\n height: cropBoxData.height\n }, getTransforms({\n translateX: cropBoxData.left,\n translateY: cropBoxData.top\n })));\n\n if (this.cropped && this.limited) {\n this.limitCanvas(true, true);\n }\n\n if (!this.disabled) {\n this.output();\n }\n },\n output: function output() {\n this.preview();\n dispatchEvent(this.element, EVENT_CROP, this.getData());\n }\n };\n\n var preview = {\n initPreview: function initPreview() {\n var element = this.element,\n crossOrigin = this.crossOrigin;\n var preview = this.options.preview;\n var url = crossOrigin ? this.crossOriginUrl : this.url;\n var alt = element.alt || 'The image to preview';\n var image = document.createElement('img');\n\n if (crossOrigin) {\n image.crossOrigin = crossOrigin;\n }\n\n image.src = url;\n image.alt = alt;\n this.viewBox.appendChild(image);\n this.viewBoxImage = image;\n\n if (!preview) {\n return;\n }\n\n var previews = preview;\n\n if (typeof preview === 'string') {\n previews = element.ownerDocument.querySelectorAll(preview);\n } else if (preview.querySelector) {\n previews = [preview];\n }\n\n this.previews = previews;\n forEach(previews, function (el) {\n var img = document.createElement('img'); // Save the original size for recover\n\n setData(el, DATA_PREVIEW, {\n width: el.offsetWidth,\n height: el.offsetHeight,\n html: el.innerHTML\n });\n\n if (crossOrigin) {\n img.crossOrigin = crossOrigin;\n }\n\n img.src = url;\n img.alt = alt;\n /**\n * Override img element styles\n * Add `display:block` to avoid margin top issue\n * Add `height:auto` to override `height` attribute on IE8\n * (Occur only when margin-top <= -height)\n */\n\n img.style.cssText = 'display:block;' + 'width:100%;' + 'height:auto;' + 'min-width:0!important;' + 'min-height:0!important;' + 'max-width:none!important;' + 'max-height:none!important;' + 'image-orientation:0deg!important;\"';\n el.innerHTML = '';\n el.appendChild(img);\n });\n },\n resetPreview: function resetPreview() {\n forEach(this.previews, function (element) {\n var data = getData(element, DATA_PREVIEW);\n setStyle(element, {\n width: data.width,\n height: data.height\n });\n element.innerHTML = data.html;\n removeData(element, DATA_PREVIEW);\n });\n },\n preview: function preview() {\n var imageData = this.imageData,\n canvasData = this.canvasData,\n cropBoxData = this.cropBoxData;\n var cropBoxWidth = cropBoxData.width,\n cropBoxHeight = cropBoxData.height;\n var width = imageData.width,\n height = imageData.height;\n var left = cropBoxData.left - canvasData.left - imageData.left;\n var top = cropBoxData.top - canvasData.top - imageData.top;\n\n if (!this.cropped || this.disabled) {\n return;\n }\n\n setStyle(this.viewBoxImage, assign({\n width: width,\n height: height\n }, getTransforms(assign({\n translateX: -left,\n translateY: -top\n }, imageData))));\n forEach(this.previews, function (element) {\n var data = getData(element, DATA_PREVIEW);\n var originalWidth = data.width;\n var originalHeight = data.height;\n var newWidth = originalWidth;\n var newHeight = originalHeight;\n var ratio = 1;\n\n if (cropBoxWidth) {\n ratio = originalWidth / cropBoxWidth;\n newHeight = cropBoxHeight * ratio;\n }\n\n if (cropBoxHeight && newHeight > originalHeight) {\n ratio = originalHeight / cropBoxHeight;\n newWidth = cropBoxWidth * ratio;\n newHeight = originalHeight;\n }\n\n setStyle(element, {\n width: newWidth,\n height: newHeight\n });\n setStyle(element.getElementsByTagName('img')[0], assign({\n width: width * ratio,\n height: height * ratio\n }, getTransforms(assign({\n translateX: -left * ratio,\n translateY: -top * ratio\n }, imageData))));\n });\n }\n };\n\n var events = {\n bind: function bind() {\n var element = this.element,\n options = this.options,\n cropper = this.cropper;\n\n if (isFunction(options.cropstart)) {\n addListener(element, EVENT_CROP_START, options.cropstart);\n }\n\n if (isFunction(options.cropmove)) {\n addListener(element, EVENT_CROP_MOVE, options.cropmove);\n }\n\n if (isFunction(options.cropend)) {\n addListener(element, EVENT_CROP_END, options.cropend);\n }\n\n if (isFunction(options.crop)) {\n addListener(element, EVENT_CROP, options.crop);\n }\n\n if (isFunction(options.zoom)) {\n addListener(element, EVENT_ZOOM, options.zoom);\n }\n\n addListener(cropper, EVENT_POINTER_DOWN, this.onCropStart = this.cropStart.bind(this));\n\n if (options.zoomable && options.zoomOnWheel) {\n addListener(cropper, EVENT_WHEEL, this.onWheel = this.wheel.bind(this), {\n passive: false,\n capture: true\n });\n }\n\n if (options.toggleDragModeOnDblclick) {\n addListener(cropper, EVENT_DBLCLICK, this.onDblclick = this.dblclick.bind(this));\n }\n\n addListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onCropMove = this.cropMove.bind(this));\n addListener(element.ownerDocument, EVENT_POINTER_UP, this.onCropEnd = this.cropEnd.bind(this));\n\n if (options.responsive) {\n addListener(window, EVENT_RESIZE, this.onResize = this.resize.bind(this));\n }\n },\n unbind: function unbind() {\n var element = this.element,\n options = this.options,\n cropper = this.cropper;\n\n if (isFunction(options.cropstart)) {\n removeListener(element, EVENT_CROP_START, options.cropstart);\n }\n\n if (isFunction(options.cropmove)) {\n removeListener(element, EVENT_CROP_MOVE, options.cropmove);\n }\n\n if (isFunction(options.cropend)) {\n removeListener(element, EVENT_CROP_END, options.cropend);\n }\n\n if (isFunction(options.crop)) {\n removeListener(element, EVENT_CROP, options.crop);\n }\n\n if (isFunction(options.zoom)) {\n removeListener(element, EVENT_ZOOM, options.zoom);\n }\n\n removeListener(cropper, EVENT_POINTER_DOWN, this.onCropStart);\n\n if (options.zoomable && options.zoomOnWheel) {\n removeListener(cropper, EVENT_WHEEL, this.onWheel, {\n passive: false,\n capture: true\n });\n }\n\n if (options.toggleDragModeOnDblclick) {\n removeListener(cropper, EVENT_DBLCLICK, this.onDblclick);\n }\n\n removeListener(element.ownerDocument, EVENT_POINTER_MOVE, this.onCropMove);\n removeListener(element.ownerDocument, EVENT_POINTER_UP, this.onCropEnd);\n\n if (options.responsive) {\n removeListener(window, EVENT_RESIZE, this.onResize);\n }\n }\n };\n\n var handlers = {\n resize: function resize() {\n if (this.disabled) {\n return;\n }\n\n var options = this.options,\n container = this.container,\n containerData = this.containerData;\n var ratio = container.offsetWidth / containerData.width; // Resize when width changed or height changed\n\n if (ratio !== 1 || container.offsetHeight !== containerData.height) {\n var canvasData;\n var cropBoxData;\n\n if (options.restore) {\n canvasData = this.getCanvasData();\n cropBoxData = this.getCropBoxData();\n }\n\n this.render();\n\n if (options.restore) {\n this.setCanvasData(forEach(canvasData, function (n, i) {\n canvasData[i] = n * ratio;\n }));\n this.setCropBoxData(forEach(cropBoxData, function (n, i) {\n cropBoxData[i] = n * ratio;\n }));\n }\n }\n },\n dblclick: function dblclick() {\n if (this.disabled || this.options.dragMode === DRAG_MODE_NONE) {\n return;\n }\n\n this.setDragMode(hasClass(this.dragBox, CLASS_CROP) ? DRAG_MODE_MOVE : DRAG_MODE_CROP);\n },\n wheel: function wheel(event) {\n var _this = this;\n\n var ratio = Number(this.options.wheelZoomRatio) || 0.1;\n var delta = 1;\n\n if (this.disabled) {\n return;\n }\n\n event.preventDefault(); // Limit wheel speed to prevent zoom too fast (#21)\n\n if (this.wheeling) {\n return;\n }\n\n this.wheeling = true;\n setTimeout(function () {\n _this.wheeling = false;\n }, 50);\n\n if (event.deltaY) {\n delta = event.deltaY > 0 ? 1 : -1;\n } else if (event.wheelDelta) {\n delta = -event.wheelDelta / 120;\n } else if (event.detail) {\n delta = event.detail > 0 ? 1 : -1;\n }\n\n this.zoom(-delta * ratio, event);\n },\n cropStart: function cropStart(event) {\n var buttons = event.buttons,\n button = event.button;\n\n if (this.disabled // Handle mouse event and pointer event and ignore touch event\n || (event.type === 'mousedown' || event.type === 'pointerdown' && event.pointerType === 'mouse') && ( // No primary button (Usually the left button)\n isNumber(buttons) && buttons !== 1 || isNumber(button) && button !== 0 // Open context menu\n || event.ctrlKey)) {\n return;\n }\n\n var options = this.options,\n pointers = this.pointers;\n var action;\n\n if (event.changedTouches) {\n // Handle touch event\n forEach(event.changedTouches, function (touch) {\n pointers[touch.identifier] = getPointer(touch);\n });\n } else {\n // Handle mouse event and pointer event\n pointers[event.pointerId || 0] = getPointer(event);\n }\n\n if (Object.keys(pointers).length > 1 && options.zoomable && options.zoomOnTouch) {\n action = ACTION_ZOOM;\n } else {\n action = getData(event.target, DATA_ACTION);\n }\n\n if (!REGEXP_ACTIONS.test(action)) {\n return;\n }\n\n if (dispatchEvent(this.element, EVENT_CROP_START, {\n originalEvent: event,\n action: action\n }) === false) {\n return;\n } // This line is required for preventing page zooming in iOS browsers\n\n\n event.preventDefault();\n this.action = action;\n this.cropping = false;\n\n if (action === ACTION_CROP) {\n this.cropping = true;\n addClass(this.dragBox, CLASS_MODAL);\n }\n },\n cropMove: function cropMove(event) {\n var action = this.action;\n\n if (this.disabled || !action) {\n return;\n }\n\n var pointers = this.pointers;\n event.preventDefault();\n\n if (dispatchEvent(this.element, EVENT_CROP_MOVE, {\n originalEvent: event,\n action: action\n }) === false) {\n return;\n }\n\n if (event.changedTouches) {\n forEach(event.changedTouches, function (touch) {\n // The first parameter should not be undefined (#432)\n assign(pointers[touch.identifier] || {}, getPointer(touch, true));\n });\n } else {\n assign(pointers[event.pointerId || 0] || {}, getPointer(event, true));\n }\n\n this.change(event);\n },\n cropEnd: function cropEnd(event) {\n if (this.disabled) {\n return;\n }\n\n var action = this.action,\n pointers = this.pointers;\n\n if (event.changedTouches) {\n forEach(event.changedTouches, function (touch) {\n delete pointers[touch.identifier];\n });\n } else {\n delete pointers[event.pointerId || 0];\n }\n\n if (!action) {\n return;\n }\n\n event.preventDefault();\n\n if (!Object.keys(pointers).length) {\n this.action = '';\n }\n\n if (this.cropping) {\n this.cropping = false;\n toggleClass(this.dragBox, CLASS_MODAL, this.cropped && this.options.modal);\n }\n\n dispatchEvent(this.element, EVENT_CROP_END, {\n originalEvent: event,\n action: action\n });\n }\n };\n\n var change = {\n change: function change(event) {\n var options = this.options,\n canvasData = this.canvasData,\n containerData = this.containerData,\n cropBoxData = this.cropBoxData,\n pointers = this.pointers;\n var action = this.action;\n var aspectRatio = options.aspectRatio;\n var left = cropBoxData.left,\n top = cropBoxData.top,\n width = cropBoxData.width,\n height = cropBoxData.height;\n var right = left + width;\n var bottom = top + height;\n var minLeft = 0;\n var minTop = 0;\n var maxWidth = containerData.width;\n var maxHeight = containerData.height;\n var renderable = true;\n var offset; // Locking aspect ratio in \"free mode\" by holding shift key\n\n if (!aspectRatio && event.shiftKey) {\n aspectRatio = width && height ? width / height : 1;\n }\n\n if (this.limited) {\n minLeft = cropBoxData.minLeft;\n minTop = cropBoxData.minTop;\n maxWidth = minLeft + Math.min(containerData.width, canvasData.width, canvasData.left + canvasData.width);\n maxHeight = minTop + Math.min(containerData.height, canvasData.height, canvasData.top + canvasData.height);\n }\n\n var pointer = pointers[Object.keys(pointers)[0]];\n var range = {\n x: pointer.endX - pointer.startX,\n y: pointer.endY - pointer.startY\n };\n\n var check = function check(side) {\n switch (side) {\n case ACTION_EAST:\n if (right + range.x > maxWidth) {\n range.x = maxWidth - right;\n }\n\n break;\n\n case ACTION_WEST:\n if (left + range.x < minLeft) {\n range.x = minLeft - left;\n }\n\n break;\n\n case ACTION_NORTH:\n if (top + range.y < minTop) {\n range.y = minTop - top;\n }\n\n break;\n\n case ACTION_SOUTH:\n if (bottom + range.y > maxHeight) {\n range.y = maxHeight - bottom;\n }\n\n break;\n }\n };\n\n switch (action) {\n // Move crop box\n case ACTION_ALL:\n left += range.x;\n top += range.y;\n break;\n // Resize crop box\n\n case ACTION_EAST:\n if (range.x >= 0 && (right >= maxWidth || aspectRatio && (top <= minTop || bottom >= maxHeight))) {\n renderable = false;\n break;\n }\n\n check(ACTION_EAST);\n width += range.x;\n\n if (width < 0) {\n action = ACTION_WEST;\n width = -width;\n left -= width;\n }\n\n if (aspectRatio) {\n height = width / aspectRatio;\n top += (cropBoxData.height - height) / 2;\n }\n\n break;\n\n case ACTION_NORTH:\n if (range.y <= 0 && (top <= minTop || aspectRatio && (left <= minLeft || right >= maxWidth))) {\n renderable = false;\n break;\n }\n\n check(ACTION_NORTH);\n height -= range.y;\n top += range.y;\n\n if (height < 0) {\n action = ACTION_SOUTH;\n height = -height;\n top -= height;\n }\n\n if (aspectRatio) {\n width = height * aspectRatio;\n left += (cropBoxData.width - width) / 2;\n }\n\n break;\n\n case ACTION_WEST:\n if (range.x <= 0 && (left <= minLeft || aspectRatio && (top <= minTop || bottom >= maxHeight))) {\n renderable = false;\n break;\n }\n\n check(ACTION_WEST);\n width -= range.x;\n left += range.x;\n\n if (width < 0) {\n action = ACTION_EAST;\n width = -width;\n left -= width;\n }\n\n if (aspectRatio) {\n height = width / aspectRatio;\n top += (cropBoxData.height - height) / 2;\n }\n\n break;\n\n case ACTION_SOUTH:\n if (range.y >= 0 && (bottom >= maxHeight || aspectRatio && (left <= minLeft || right >= maxWidth))) {\n renderable = false;\n break;\n }\n\n check(ACTION_SOUTH);\n height += range.y;\n\n if (height < 0) {\n action = ACTION_NORTH;\n height = -height;\n top -= height;\n }\n\n if (aspectRatio) {\n width = height * aspectRatio;\n left += (cropBoxData.width - width) / 2;\n }\n\n break;\n\n case ACTION_NORTH_EAST:\n if (aspectRatio) {\n if (range.y <= 0 && (top <= minTop || right >= maxWidth)) {\n renderable = false;\n break;\n }\n\n check(ACTION_NORTH);\n height -= range.y;\n top += range.y;\n width = height * aspectRatio;\n } else {\n check(ACTION_NORTH);\n check(ACTION_EAST);\n\n if (range.x >= 0) {\n if (right < maxWidth) {\n width += range.x;\n } else if (range.y <= 0 && top <= minTop) {\n renderable = false;\n }\n } else {\n width += range.x;\n }\n\n if (range.y <= 0) {\n if (top > minTop) {\n height -= range.y;\n top += range.y;\n }\n } else {\n height -= range.y;\n top += range.y;\n }\n }\n\n if (width < 0 && height < 0) {\n action = ACTION_SOUTH_WEST;\n height = -height;\n width = -width;\n top -= height;\n left -= width;\n } else if (width < 0) {\n action = ACTION_NORTH_WEST;\n width = -width;\n left -= width;\n } else if (height < 0) {\n action = ACTION_SOUTH_EAST;\n height = -height;\n top -= height;\n }\n\n break;\n\n case ACTION_NORTH_WEST:\n if (aspectRatio) {\n if (range.y <= 0 && (top <= minTop || left <= minLeft)) {\n renderable = false;\n break;\n }\n\n check(ACTION_NORTH);\n height -= range.y;\n top += range.y;\n width = height * aspectRatio;\n left += cropBoxData.width - width;\n } else {\n check(ACTION_NORTH);\n check(ACTION_WEST);\n\n if (range.x <= 0) {\n if (left > minLeft) {\n width -= range.x;\n left += range.x;\n } else if (range.y <= 0 && top <= minTop) {\n renderable = false;\n }\n } else {\n width -= range.x;\n left += range.x;\n }\n\n if (range.y <= 0) {\n if (top > minTop) {\n height -= range.y;\n top += range.y;\n }\n } else {\n height -= range.y;\n top += range.y;\n }\n }\n\n if (width < 0 && height < 0) {\n action = ACTION_SOUTH_EAST;\n height = -height;\n width = -width;\n top -= height;\n left -= width;\n } else if (width < 0) {\n action = ACTION_NORTH_EAST;\n width = -width;\n left -= width;\n } else if (height < 0) {\n action = ACTION_SOUTH_WEST;\n height = -height;\n top -= height;\n }\n\n break;\n\n case ACTION_SOUTH_WEST:\n if (aspectRatio) {\n if (range.x <= 0 && (left <= minLeft || bottom >= maxHeight)) {\n renderable = false;\n break;\n }\n\n check(ACTION_WEST);\n width -= range.x;\n left += range.x;\n height = width / aspectRatio;\n } else {\n check(ACTION_SOUTH);\n check(ACTION_WEST);\n\n if (range.x <= 0) {\n if (left > minLeft) {\n width -= range.x;\n left += range.x;\n } else if (range.y >= 0 && bottom >= maxHeight) {\n renderable = false;\n }\n } else {\n width -= range.x;\n left += range.x;\n }\n\n if (range.y >= 0) {\n if (bottom < maxHeight) {\n height += range.y;\n }\n } else {\n height += range.y;\n }\n }\n\n if (width < 0 && height < 0) {\n action = ACTION_NORTH_EAST;\n height = -height;\n width = -width;\n top -= height;\n left -= width;\n } else if (width < 0) {\n action = ACTION_SOUTH_EAST;\n width = -width;\n left -= width;\n } else if (height < 0) {\n action = ACTION_NORTH_WEST;\n height = -height;\n top -= height;\n }\n\n break;\n\n case ACTION_SOUTH_EAST:\n if (aspectRatio) {\n if (range.x >= 0 && (right >= maxWidth || bottom >= maxHeight)) {\n renderable = false;\n break;\n }\n\n check(ACTION_EAST);\n width += range.x;\n height = width / aspectRatio;\n } else {\n check(ACTION_SOUTH);\n check(ACTION_EAST);\n\n if (range.x >= 0) {\n if (right < maxWidth) {\n width += range.x;\n } else if (range.y >= 0 && bottom >= maxHeight) {\n renderable = false;\n }\n } else {\n width += range.x;\n }\n\n if (range.y >= 0) {\n if (bottom < maxHeight) {\n height += range.y;\n }\n } else {\n height += range.y;\n }\n }\n\n if (width < 0 && height < 0) {\n action = ACTION_NORTH_WEST;\n height = -height;\n width = -width;\n top -= height;\n left -= width;\n } else if (width < 0) {\n action = ACTION_SOUTH_WEST;\n width = -width;\n left -= width;\n } else if (height < 0) {\n action = ACTION_NORTH_EAST;\n height = -height;\n top -= height;\n }\n\n break;\n // Move canvas\n\n case ACTION_MOVE:\n this.move(range.x, range.y);\n renderable = false;\n break;\n // Zoom canvas\n\n case ACTION_ZOOM:\n this.zoom(getMaxZoomRatio(pointers), event);\n renderable = false;\n break;\n // Create crop box\n\n case ACTION_CROP:\n if (!range.x || !range.y) {\n renderable = false;\n break;\n }\n\n offset = getOffset(this.cropper);\n left = pointer.startX - offset.left;\n top = pointer.startY - offset.top;\n width = cropBoxData.minWidth;\n height = cropBoxData.minHeight;\n\n if (range.x > 0) {\n action = range.y > 0 ? ACTION_SOUTH_EAST : ACTION_NORTH_EAST;\n } else if (range.x < 0) {\n left -= width;\n action = range.y > 0 ? ACTION_SOUTH_WEST : ACTION_NORTH_WEST;\n }\n\n if (range.y < 0) {\n top -= height;\n } // Show the crop box if is hidden\n\n\n if (!this.cropped) {\n removeClass(this.cropBox, CLASS_HIDDEN);\n this.cropped = true;\n\n if (this.limited) {\n this.limitCropBox(true, true);\n }\n }\n\n break;\n }\n\n if (renderable) {\n cropBoxData.width = width;\n cropBoxData.height = height;\n cropBoxData.left = left;\n cropBoxData.top = top;\n this.action = action;\n this.renderCropBox();\n } // Override\n\n\n forEach(pointers, function (p) {\n p.startX = p.endX;\n p.startY = p.endY;\n });\n }\n };\n\n var methods = {\n // Show the crop box manually\n crop: function crop() {\n if (this.ready && !this.cropped && !this.disabled) {\n this.cropped = true;\n this.limitCropBox(true, true);\n\n if (this.options.modal) {\n addClass(this.dragBox, CLASS_MODAL);\n }\n\n removeClass(this.cropBox, CLASS_HIDDEN);\n this.setCropBoxData(this.initialCropBoxData);\n }\n\n return this;\n },\n // Reset the image and crop box to their initial states\n reset: function reset() {\n if (this.ready && !this.disabled) {\n this.imageData = assign({}, this.initialImageData);\n this.canvasData = assign({}, this.initialCanvasData);\n this.cropBoxData = assign({}, this.initialCropBoxData);\n this.renderCanvas();\n\n if (this.cropped) {\n this.renderCropBox();\n }\n }\n\n return this;\n },\n // Clear the crop box\n clear: function clear() {\n if (this.cropped && !this.disabled) {\n assign(this.cropBoxData, {\n left: 0,\n top: 0,\n width: 0,\n height: 0\n });\n this.cropped = false;\n this.renderCropBox();\n this.limitCanvas(true, true); // Render canvas after crop box rendered\n\n this.renderCanvas();\n removeClass(this.dragBox, CLASS_MODAL);\n addClass(this.cropBox, CLASS_HIDDEN);\n }\n\n return this;\n },\n\n /**\n * Replace the image's src and rebuild the cropper\n * @param {string} url - The new URL.\n * @param {boolean} [hasSameSize] - Indicate if the new image has the same size as the old one.\n * @returns {Cropper} this\n */\n replace: function replace(url) {\n var hasSameSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n if (!this.disabled && url) {\n if (this.isImg) {\n this.element.src = url;\n }\n\n if (hasSameSize) {\n this.url = url;\n this.image.src = url;\n\n if (this.ready) {\n this.viewBoxImage.src = url;\n forEach(this.previews, function (element) {\n element.getElementsByTagName('img')[0].src = url;\n });\n }\n } else {\n if (this.isImg) {\n this.replaced = true;\n }\n\n this.options.data = null;\n this.uncreate();\n this.load(url);\n }\n }\n\n return this;\n },\n // Enable (unfreeze) the cropper\n enable: function enable() {\n if (this.ready && this.disabled) {\n this.disabled = false;\n removeClass(this.cropper, CLASS_DISABLED);\n }\n\n return this;\n },\n // Disable (freeze) the cropper\n disable: function disable() {\n if (this.ready && !this.disabled) {\n this.disabled = true;\n addClass(this.cropper, CLASS_DISABLED);\n }\n\n return this;\n },\n\n /**\n * Destroy the cropper and remove the instance from the image\n * @returns {Cropper} this\n */\n destroy: function destroy() {\n var element = this.element;\n\n if (!element[NAMESPACE]) {\n return this;\n }\n\n element[NAMESPACE] = undefined;\n\n if (this.isImg && this.replaced) {\n element.src = this.originalUrl;\n }\n\n this.uncreate();\n return this;\n },\n\n /**\n * Move the canvas with relative offsets\n * @param {number} offsetX - The relative offset distance on the x-axis.\n * @param {number} [offsetY=offsetX] - The relative offset distance on the y-axis.\n * @returns {Cropper} this\n */\n move: function move(offsetX) {\n var offsetY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : offsetX;\n var _this$canvasData = this.canvasData,\n left = _this$canvasData.left,\n top = _this$canvasData.top;\n return this.moveTo(isUndefined(offsetX) ? offsetX : left + Number(offsetX), isUndefined(offsetY) ? offsetY : top + Number(offsetY));\n },\n\n /**\n * Move the canvas to an absolute point\n * @param {number} x - The x-axis coordinate.\n * @param {number} [y=x] - The y-axis coordinate.\n * @returns {Cropper} this\n */\n moveTo: function moveTo(x) {\n var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x;\n var canvasData = this.canvasData;\n var changed = false;\n x = Number(x);\n y = Number(y);\n\n if (this.ready && !this.disabled && this.options.movable) {\n if (isNumber(x)) {\n canvasData.left = x;\n changed = true;\n }\n\n if (isNumber(y)) {\n canvasData.top = y;\n changed = true;\n }\n\n if (changed) {\n this.renderCanvas(true);\n }\n }\n\n return this;\n },\n\n /**\n * Zoom the canvas with a relative ratio\n * @param {number} ratio - The target ratio.\n * @param {Event} _originalEvent - The original event if any.\n * @returns {Cropper} this\n */\n zoom: function zoom(ratio, _originalEvent) {\n var canvasData = this.canvasData;\n ratio = Number(ratio);\n\n if (ratio < 0) {\n ratio = 1 / (1 - ratio);\n } else {\n ratio = 1 + ratio;\n }\n\n return this.zoomTo(canvasData.width * ratio / canvasData.naturalWidth, null, _originalEvent);\n },\n\n /**\n * Zoom the canvas to an absolute ratio\n * @param {number} ratio - The target ratio.\n * @param {Object} pivot - The zoom pivot point coordinate.\n * @param {Event} _originalEvent - The original event if any.\n * @returns {Cropper} this\n */\n zoomTo: function zoomTo(ratio, pivot, _originalEvent) {\n var options = this.options,\n canvasData = this.canvasData;\n var width = canvasData.width,\n height = canvasData.height,\n naturalWidth = canvasData.naturalWidth,\n naturalHeight = canvasData.naturalHeight;\n ratio = Number(ratio);\n\n if (ratio >= 0 && this.ready && !this.disabled && options.zoomable) {\n var newWidth = naturalWidth * ratio;\n var newHeight = naturalHeight * ratio;\n\n if (dispatchEvent(this.element, EVENT_ZOOM, {\n ratio: ratio,\n oldRatio: width / naturalWidth,\n originalEvent: _originalEvent\n }) === false) {\n return this;\n }\n\n if (_originalEvent) {\n var pointers = this.pointers;\n var offset = getOffset(this.cropper);\n var center = pointers && Object.keys(pointers).length ? getPointersCenter(pointers) : {\n pageX: _originalEvent.pageX,\n pageY: _originalEvent.pageY\n }; // Zoom from the triggering point of the event\n\n canvasData.left -= (newWidth - width) * ((center.pageX - offset.left - canvasData.left) / width);\n canvasData.top -= (newHeight - height) * ((center.pageY - offset.top - canvasData.top) / height);\n } else if (isPlainObject(pivot) && isNumber(pivot.x) && isNumber(pivot.y)) {\n canvasData.left -= (newWidth - width) * ((pivot.x - canvasData.left) / width);\n canvasData.top -= (newHeight - height) * ((pivot.y - canvasData.top) / height);\n } else {\n // Zoom from the center of the canvas\n canvasData.left -= (newWidth - width) / 2;\n canvasData.top -= (newHeight - height) / 2;\n }\n\n canvasData.width = newWidth;\n canvasData.height = newHeight;\n this.renderCanvas(true);\n }\n\n return this;\n },\n\n /**\n * Rotate the canvas with a relative degree\n * @param {number} degree - The rotate degree.\n * @returns {Cropper} this\n */\n rotate: function rotate(degree) {\n return this.rotateTo((this.imageData.rotate || 0) + Number(degree));\n },\n\n /**\n * Rotate the canvas to an absolute degree\n * @param {number} degree - The rotate degree.\n * @returns {Cropper} this\n */\n rotateTo: function rotateTo(degree) {\n degree = Number(degree);\n\n if (isNumber(degree) && this.ready && !this.disabled && this.options.rotatable) {\n this.imageData.rotate = degree % 360;\n this.renderCanvas(true, true);\n }\n\n return this;\n },\n\n /**\n * Scale the image on the x-axis.\n * @param {number} scaleX - The scale ratio on the x-axis.\n * @returns {Cropper} this\n */\n scaleX: function scaleX(_scaleX) {\n var scaleY = this.imageData.scaleY;\n return this.scale(_scaleX, isNumber(scaleY) ? scaleY : 1);\n },\n\n /**\n * Scale the image on the y-axis.\n * @param {number} scaleY - The scale ratio on the y-axis.\n * @returns {Cropper} this\n */\n scaleY: function scaleY(_scaleY) {\n var scaleX = this.imageData.scaleX;\n return this.scale(isNumber(scaleX) ? scaleX : 1, _scaleY);\n },\n\n /**\n * Scale the image\n * @param {number} scaleX - The scale ratio on the x-axis.\n * @param {number} [scaleY=scaleX] - The scale ratio on the y-axis.\n * @returns {Cropper} this\n */\n scale: function scale(scaleX) {\n var scaleY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : scaleX;\n var imageData = this.imageData;\n var transformed = false;\n scaleX = Number(scaleX);\n scaleY = Number(scaleY);\n\n if (this.ready && !this.disabled && this.options.scalable) {\n if (isNumber(scaleX)) {\n imageData.scaleX = scaleX;\n transformed = true;\n }\n\n if (isNumber(scaleY)) {\n imageData.scaleY = scaleY;\n transformed = true;\n }\n\n if (transformed) {\n this.renderCanvas(true, true);\n }\n }\n\n return this;\n },\n\n /**\n * Get the cropped area position and size data (base on the original image)\n * @param {boolean} [rounded=false] - Indicate if round the data values or not.\n * @returns {Object} The result cropped data.\n */\n getData: function getData() {\n var rounded = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n var options = this.options,\n imageData = this.imageData,\n canvasData = this.canvasData,\n cropBoxData = this.cropBoxData;\n var data;\n\n if (this.ready && this.cropped) {\n data = {\n x: cropBoxData.left - canvasData.left,\n y: cropBoxData.top - canvasData.top,\n width: cropBoxData.width,\n height: cropBoxData.height\n };\n var ratio = imageData.width / imageData.naturalWidth;\n forEach(data, function (n, i) {\n data[i] = n / ratio;\n });\n\n if (rounded) {\n // In case rounding off leads to extra 1px in right or bottom border\n // we should round the top-left corner and the dimension (#343).\n var bottom = Math.round(data.y + data.height);\n var right = Math.round(data.x + data.width);\n data.x = Math.round(data.x);\n data.y = Math.round(data.y);\n data.width = right - data.x;\n data.height = bottom - data.y;\n }\n } else {\n data = {\n x: 0,\n y: 0,\n width: 0,\n height: 0\n };\n }\n\n if (options.rotatable) {\n data.rotate = imageData.rotate || 0;\n }\n\n if (options.scalable) {\n data.scaleX = imageData.scaleX || 1;\n data.scaleY = imageData.scaleY || 1;\n }\n\n return data;\n },\n\n /**\n * Set the cropped area position and size with new data\n * @param {Object} data - The new data.\n * @returns {Cropper} this\n */\n setData: function setData(data) {\n var options = this.options,\n imageData = this.imageData,\n canvasData = this.canvasData;\n var cropBoxData = {};\n\n if (this.ready && !this.disabled && isPlainObject(data)) {\n var transformed = false;\n\n if (options.rotatable) {\n if (isNumber(data.rotate) && data.rotate !== imageData.rotate) {\n imageData.rotate = data.rotate;\n transformed = true;\n }\n }\n\n if (options.scalable) {\n if (isNumber(data.scaleX) && data.scaleX !== imageData.scaleX) {\n imageData.scaleX = data.scaleX;\n transformed = true;\n }\n\n if (isNumber(data.scaleY) && data.scaleY !== imageData.scaleY) {\n imageData.scaleY = data.scaleY;\n transformed = true;\n }\n }\n\n if (transformed) {\n this.renderCanvas(true, true);\n }\n\n var ratio = imageData.width / imageData.naturalWidth;\n\n if (isNumber(data.x)) {\n cropBoxData.left = data.x * ratio + canvasData.left;\n }\n\n if (isNumber(data.y)) {\n cropBoxData.top = data.y * ratio + canvasData.top;\n }\n\n if (isNumber(data.width)) {\n cropBoxData.width = data.width * ratio;\n }\n\n if (isNumber(data.height)) {\n cropBoxData.height = data.height * ratio;\n }\n\n this.setCropBoxData(cropBoxData);\n }\n\n return this;\n },\n\n /**\n * Get the container size data.\n * @returns {Object} The result container data.\n */\n getContainerData: function getContainerData() {\n return this.ready ? assign({}, this.containerData) : {};\n },\n\n /**\n * Get the image position and size data.\n * @returns {Object} The result image data.\n */\n getImageData: function getImageData() {\n return this.sized ? assign({}, this.imageData) : {};\n },\n\n /**\n * Get the canvas position and size data.\n * @returns {Object} The result canvas data.\n */\n getCanvasData: function getCanvasData() {\n var canvasData = this.canvasData;\n var data = {};\n\n if (this.ready) {\n forEach(['left', 'top', 'width', 'height', 'naturalWidth', 'naturalHeight'], function (n) {\n data[n] = canvasData[n];\n });\n }\n\n return data;\n },\n\n /**\n * Set the canvas position and size with new data.\n * @param {Object} data - The new canvas data.\n * @returns {Cropper} this\n */\n setCanvasData: function setCanvasData(data) {\n var canvasData = this.canvasData;\n var aspectRatio = canvasData.aspectRatio;\n\n if (this.ready && !this.disabled && isPlainObject(data)) {\n if (isNumber(data.left)) {\n canvasData.left = data.left;\n }\n\n if (isNumber(data.top)) {\n canvasData.top = data.top;\n }\n\n if (isNumber(data.width)) {\n canvasData.width = data.width;\n canvasData.height = data.width / aspectRatio;\n } else if (isNumber(data.height)) {\n canvasData.height = data.height;\n canvasData.width = data.height * aspectRatio;\n }\n\n this.renderCanvas(true);\n }\n\n return this;\n },\n\n /**\n * Get the crop box position and size data.\n * @returns {Object} The result crop box data.\n */\n getCropBoxData: function getCropBoxData() {\n var cropBoxData = this.cropBoxData;\n var data;\n\n if (this.ready && this.cropped) {\n data = {\n left: cropBoxData.left,\n top: cropBoxData.top,\n width: cropBoxData.width,\n height: cropBoxData.height\n };\n }\n\n return data || {};\n },\n\n /**\n * Set the crop box position and size with new data.\n * @param {Object} data - The new crop box data.\n * @returns {Cropper} this\n */\n setCropBoxData: function setCropBoxData(data) {\n var cropBoxData = this.cropBoxData;\n var aspectRatio = this.options.aspectRatio;\n var widthChanged;\n var heightChanged;\n\n if (this.ready && this.cropped && !this.disabled && isPlainObject(data)) {\n if (isNumber(data.left)) {\n cropBoxData.left = data.left;\n }\n\n if (isNumber(data.top)) {\n cropBoxData.top = data.top;\n }\n\n if (isNumber(data.width) && data.width !== cropBoxData.width) {\n widthChanged = true;\n cropBoxData.width = data.width;\n }\n\n if (isNumber(data.height) && data.height !== cropBoxData.height) {\n heightChanged = true;\n cropBoxData.height = data.height;\n }\n\n if (aspectRatio) {\n if (widthChanged) {\n cropBoxData.height = cropBoxData.width / aspectRatio;\n } else if (heightChanged) {\n cropBoxData.width = cropBoxData.height * aspectRatio;\n }\n }\n\n this.renderCropBox();\n }\n\n return this;\n },\n\n /**\n * Get a canvas drawn the cropped image.\n * @param {Object} [options={}] - The config options.\n * @returns {HTMLCanvasElement} - The result canvas.\n */\n getCroppedCanvas: function getCroppedCanvas() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n if (!this.ready || !window.HTMLCanvasElement) {\n return null;\n }\n\n var canvasData = this.canvasData;\n var source = getSourceCanvas(this.image, this.imageData, canvasData, options); // Returns the source canvas if it is not cropped.\n\n if (!this.cropped) {\n return source;\n }\n\n var _this$getData = this.getData(),\n initialX = _this$getData.x,\n initialY = _this$getData.y,\n initialWidth = _this$getData.width,\n initialHeight = _this$getData.height;\n\n var ratio = source.width / Math.floor(canvasData.naturalWidth);\n\n if (ratio !== 1) {\n initialX *= ratio;\n initialY *= ratio;\n initialWidth *= ratio;\n initialHeight *= ratio;\n }\n\n var aspectRatio = initialWidth / initialHeight;\n var maxSizes = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: options.maxWidth || Infinity,\n height: options.maxHeight || Infinity\n });\n var minSizes = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: options.minWidth || 0,\n height: options.minHeight || 0\n }, 'cover');\n\n var _getAdjustedSizes = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: options.width || (ratio !== 1 ? source.width : initialWidth),\n height: options.height || (ratio !== 1 ? source.height : initialHeight)\n }),\n width = _getAdjustedSizes.width,\n height = _getAdjustedSizes.height;\n\n width = Math.min(maxSizes.width, Math.max(minSizes.width, width));\n height = Math.min(maxSizes.height, Math.max(minSizes.height, height));\n var canvas = document.createElement('canvas');\n var context = canvas.getContext('2d');\n canvas.width = normalizeDecimalNumber(width);\n canvas.height = normalizeDecimalNumber(height);\n context.fillStyle = options.fillColor || 'transparent';\n context.fillRect(0, 0, width, height);\n var _options$imageSmoothi = options.imageSmoothingEnabled,\n imageSmoothingEnabled = _options$imageSmoothi === void 0 ? true : _options$imageSmoothi,\n imageSmoothingQuality = options.imageSmoothingQuality;\n context.imageSmoothingEnabled = imageSmoothingEnabled;\n\n if (imageSmoothingQuality) {\n context.imageSmoothingQuality = imageSmoothingQuality;\n } // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D.drawImage\n\n\n var sourceWidth = source.width;\n var sourceHeight = source.height; // Source canvas parameters\n\n var srcX = initialX;\n var srcY = initialY;\n var srcWidth;\n var srcHeight; // Destination canvas parameters\n\n var dstX;\n var dstY;\n var dstWidth;\n var dstHeight;\n\n if (srcX <= -initialWidth || srcX > sourceWidth) {\n srcX = 0;\n srcWidth = 0;\n dstX = 0;\n dstWidth = 0;\n } else if (srcX <= 0) {\n dstX = -srcX;\n srcX = 0;\n srcWidth = Math.min(sourceWidth, initialWidth + srcX);\n dstWidth = srcWidth;\n } else if (srcX <= sourceWidth) {\n dstX = 0;\n srcWidth = Math.min(initialWidth, sourceWidth - srcX);\n dstWidth = srcWidth;\n }\n\n if (srcWidth <= 0 || srcY <= -initialHeight || srcY > sourceHeight) {\n srcY = 0;\n srcHeight = 0;\n dstY = 0;\n dstHeight = 0;\n } else if (srcY <= 0) {\n dstY = -srcY;\n srcY = 0;\n srcHeight = Math.min(sourceHeight, initialHeight + srcY);\n dstHeight = srcHeight;\n } else if (srcY <= sourceHeight) {\n dstY = 0;\n srcHeight = Math.min(initialHeight, sourceHeight - srcY);\n dstHeight = srcHeight;\n }\n\n var params = [srcX, srcY, srcWidth, srcHeight]; // Avoid \"IndexSizeError\"\n\n if (dstWidth > 0 && dstHeight > 0) {\n var scale = width / initialWidth;\n params.push(dstX * scale, dstY * scale, dstWidth * scale, dstHeight * scale);\n } // All the numerical parameters should be integer for `drawImage`\n // https://github.com/fengyuanchen/cropper/issues/476\n\n\n context.drawImage.apply(context, [source].concat(_toConsumableArray(params.map(function (param) {\n return Math.floor(normalizeDecimalNumber(param));\n }))));\n return canvas;\n },\n\n /**\n * Change the aspect ratio of the crop box.\n * @param {number} aspectRatio - The new aspect ratio.\n * @returns {Cropper} this\n */\n setAspectRatio: function setAspectRatio(aspectRatio) {\n var options = this.options;\n\n if (!this.disabled && !isUndefined(aspectRatio)) {\n // 0 -> NaN\n options.aspectRatio = Math.max(0, aspectRatio) || NaN;\n\n if (this.ready) {\n this.initCropBox();\n\n if (this.cropped) {\n this.renderCropBox();\n }\n }\n }\n\n return this;\n },\n\n /**\n * Change the drag mode.\n * @param {string} mode - The new drag mode.\n * @returns {Cropper} this\n */\n setDragMode: function setDragMode(mode) {\n var options = this.options,\n dragBox = this.dragBox,\n face = this.face;\n\n if (this.ready && !this.disabled) {\n var croppable = mode === DRAG_MODE_CROP;\n var movable = options.movable && mode === DRAG_MODE_MOVE;\n mode = croppable || movable ? mode : DRAG_MODE_NONE;\n options.dragMode = mode;\n setData(dragBox, DATA_ACTION, mode);\n toggleClass(dragBox, CLASS_CROP, croppable);\n toggleClass(dragBox, CLASS_MOVE, movable);\n\n if (!options.cropBoxMovable) {\n // Sync drag mode to crop box when it is not movable\n setData(face, DATA_ACTION, mode);\n toggleClass(face, CLASS_CROP, croppable);\n toggleClass(face, CLASS_MOVE, movable);\n }\n }\n\n return this;\n }\n };\n\n var AnotherCropper = WINDOW.Cropper;\n\n var Cropper = /*#__PURE__*/function () {\n /**\n * Create a new Cropper.\n * @param {Element} element - The target element for cropping.\n * @param {Object} [options={}] - The configuration options.\n */\n function Cropper(element) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n _classCallCheck(this, Cropper);\n\n if (!element || !REGEXP_TAG_NAME.test(element.tagName)) {\n throw new Error('The first argument is required and must be an or element.');\n }\n\n this.element = element;\n this.options = assign({}, DEFAULTS, isPlainObject(options) && options);\n this.cropped = false;\n this.disabled = false;\n this.pointers = {};\n this.ready = false;\n this.reloading = false;\n this.replaced = false;\n this.sized = false;\n this.sizing = false;\n this.init();\n }\n\n _createClass(Cropper, [{\n key: \"init\",\n value: function init() {\n var element = this.element;\n var tagName = element.tagName.toLowerCase();\n var url;\n\n if (element[NAMESPACE]) {\n return;\n }\n\n element[NAMESPACE] = this;\n\n if (tagName === 'img') {\n this.isImg = true; // e.g.: \"img/picture.jpg\"\n\n url = element.getAttribute('src') || '';\n this.originalUrl = url; // Stop when it's a blank image\n\n if (!url) {\n return;\n } // e.g.: \"https://example.com/img/picture.jpg\"\n\n\n url = element.src;\n } else if (tagName === 'canvas' && window.HTMLCanvasElement) {\n url = element.toDataURL();\n }\n\n this.load(url);\n }\n }, {\n key: \"load\",\n value: function load(url) {\n var _this = this;\n\n if (!url) {\n return;\n }\n\n this.url = url;\n this.imageData = {};\n var element = this.element,\n options = this.options;\n\n if (!options.rotatable && !options.scalable) {\n options.checkOrientation = false;\n } // Only IE10+ supports Typed Arrays\n\n\n if (!options.checkOrientation || !window.ArrayBuffer) {\n this.clone();\n return;\n } // Detect the mime type of the image directly if it is a Data URL\n\n\n if (REGEXP_DATA_URL.test(url)) {\n // Read ArrayBuffer from Data URL of JPEG images directly for better performance\n if (REGEXP_DATA_URL_JPEG.test(url)) {\n this.read(dataURLToArrayBuffer(url));\n } else {\n // Only a JPEG image may contains Exif Orientation information,\n // the rest types of Data URLs are not necessary to check orientation at all.\n this.clone();\n }\n\n return;\n } // 1. Detect the mime type of the image by a XMLHttpRequest.\n // 2. Load the image as ArrayBuffer for reading orientation if its a JPEG image.\n\n\n var xhr = new XMLHttpRequest();\n var clone = this.clone.bind(this);\n this.reloading = true;\n this.xhr = xhr; // 1. Cross origin requests are only supported for protocol schemes:\n // http, https, data, chrome, chrome-extension.\n // 2. Access to XMLHttpRequest from a Data URL will be blocked by CORS policy\n // in some browsers as IE11 and Safari.\n\n xhr.onabort = clone;\n xhr.onerror = clone;\n xhr.ontimeout = clone;\n\n xhr.onprogress = function () {\n // Abort the request directly if it not a JPEG image for better performance\n if (xhr.getResponseHeader('content-type') !== MIME_TYPE_JPEG) {\n xhr.abort();\n }\n };\n\n xhr.onload = function () {\n _this.read(xhr.response);\n };\n\n xhr.onloadend = function () {\n _this.reloading = false;\n _this.xhr = null;\n }; // Bust cache when there is a \"crossOrigin\" property to avoid browser cache error\n\n\n if (options.checkCrossOrigin && isCrossOriginURL(url) && element.crossOrigin) {\n url = addTimestamp(url);\n }\n\n xhr.open('GET', url);\n xhr.responseType = 'arraybuffer';\n xhr.withCredentials = element.crossOrigin === 'use-credentials';\n xhr.send();\n }\n }, {\n key: \"read\",\n value: function read(arrayBuffer) {\n var options = this.options,\n imageData = this.imageData; // Reset the orientation value to its default value 1\n // as some iOS browsers will render image with its orientation\n\n var orientation = resetAndGetOrientation(arrayBuffer);\n var rotate = 0;\n var scaleX = 1;\n var scaleY = 1;\n\n if (orientation > 1) {\n // Generate a new URL which has the default orientation value\n this.url = arrayBufferToDataURL(arrayBuffer, MIME_TYPE_JPEG);\n\n var _parseOrientation = parseOrientation(orientation);\n\n rotate = _parseOrientation.rotate;\n scaleX = _parseOrientation.scaleX;\n scaleY = _parseOrientation.scaleY;\n }\n\n if (options.rotatable) {\n imageData.rotate = rotate;\n }\n\n if (options.scalable) {\n imageData.scaleX = scaleX;\n imageData.scaleY = scaleY;\n }\n\n this.clone();\n }\n }, {\n key: \"clone\",\n value: function clone() {\n var element = this.element,\n url = this.url;\n var crossOrigin = element.crossOrigin;\n var crossOriginUrl = url;\n\n if (this.options.checkCrossOrigin && isCrossOriginURL(url)) {\n if (!crossOrigin) {\n crossOrigin = 'anonymous';\n } // Bust cache when there is not a \"crossOrigin\" property (#519)\n\n\n crossOriginUrl = addTimestamp(url);\n }\n\n this.crossOrigin = crossOrigin;\n this.crossOriginUrl = crossOriginUrl;\n var image = document.createElement('img');\n\n if (crossOrigin) {\n image.crossOrigin = crossOrigin;\n }\n\n image.src = crossOriginUrl || url;\n image.alt = element.alt || 'The image to crop';\n this.image = image;\n image.onload = this.start.bind(this);\n image.onerror = this.stop.bind(this);\n addClass(image, CLASS_HIDE);\n element.parentNode.insertBefore(image, element.nextSibling);\n }\n }, {\n key: \"start\",\n value: function start() {\n var _this2 = this;\n\n var image = this.image;\n image.onload = null;\n image.onerror = null;\n this.sizing = true; // Match all browsers that use WebKit as the layout engine in iOS devices,\n // such as Safari for iOS, Chrome for iOS, and in-app browsers.\n\n var isIOSWebKit = WINDOW.navigator && /(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(WINDOW.navigator.userAgent);\n\n var done = function done(naturalWidth, naturalHeight) {\n assign(_this2.imageData, {\n naturalWidth: naturalWidth,\n naturalHeight: naturalHeight,\n aspectRatio: naturalWidth / naturalHeight\n });\n _this2.sizing = false;\n _this2.sized = true;\n\n _this2.build();\n }; // Most modern browsers (excepts iOS WebKit)\n\n\n if (image.naturalWidth && !isIOSWebKit) {\n done(image.naturalWidth, image.naturalHeight);\n return;\n }\n\n var sizingImage = document.createElement('img');\n var body = document.body || document.documentElement;\n this.sizingImage = sizingImage;\n\n sizingImage.onload = function () {\n done(sizingImage.width, sizingImage.height);\n\n if (!isIOSWebKit) {\n body.removeChild(sizingImage);\n }\n };\n\n sizingImage.src = image.src; // iOS WebKit will convert the image automatically\n // with its orientation once append it into DOM (#279)\n\n if (!isIOSWebKit) {\n sizingImage.style.cssText = 'left:0;' + 'max-height:none!important;' + 'max-width:none!important;' + 'min-height:0!important;' + 'min-width:0!important;' + 'opacity:0;' + 'position:absolute;' + 'top:0;' + 'z-index:-1;';\n body.appendChild(sizingImage);\n }\n }\n }, {\n key: \"stop\",\n value: function stop() {\n var image = this.image;\n image.onload = null;\n image.onerror = null;\n image.parentNode.removeChild(image);\n this.image = null;\n }\n }, {\n key: \"build\",\n value: function build() {\n if (!this.sized || this.ready) {\n return;\n }\n\n var element = this.element,\n options = this.options,\n image = this.image; // Create cropper elements\n\n var container = element.parentNode;\n var template = document.createElement('div');\n template.innerHTML = TEMPLATE;\n var cropper = template.querySelector(\".\".concat(NAMESPACE, \"-container\"));\n var canvas = cropper.querySelector(\".\".concat(NAMESPACE, \"-canvas\"));\n var dragBox = cropper.querySelector(\".\".concat(NAMESPACE, \"-drag-box\"));\n var cropBox = cropper.querySelector(\".\".concat(NAMESPACE, \"-crop-box\"));\n var face = cropBox.querySelector(\".\".concat(NAMESPACE, \"-face\"));\n this.container = container;\n this.cropper = cropper;\n this.canvas = canvas;\n this.dragBox = dragBox;\n this.cropBox = cropBox;\n this.viewBox = cropper.querySelector(\".\".concat(NAMESPACE, \"-view-box\"));\n this.face = face;\n canvas.appendChild(image); // Hide the original image\n\n addClass(element, CLASS_HIDDEN); // Inserts the cropper after to the current image\n\n container.insertBefore(cropper, element.nextSibling); // Show the image if is hidden\n\n if (!this.isImg) {\n removeClass(image, CLASS_HIDE);\n }\n\n this.initPreview();\n this.bind();\n options.initialAspectRatio = Math.max(0, options.initialAspectRatio) || NaN;\n options.aspectRatio = Math.max(0, options.aspectRatio) || NaN;\n options.viewMode = Math.max(0, Math.min(3, Math.round(options.viewMode))) || 0;\n addClass(cropBox, CLASS_HIDDEN);\n\n if (!options.guides) {\n addClass(cropBox.getElementsByClassName(\"\".concat(NAMESPACE, \"-dashed\")), CLASS_HIDDEN);\n }\n\n if (!options.center) {\n addClass(cropBox.getElementsByClassName(\"\".concat(NAMESPACE, \"-center\")), CLASS_HIDDEN);\n }\n\n if (options.background) {\n addClass(cropper, \"\".concat(NAMESPACE, \"-bg\"));\n }\n\n if (!options.highlight) {\n addClass(face, CLASS_INVISIBLE);\n }\n\n if (options.cropBoxMovable) {\n addClass(face, CLASS_MOVE);\n setData(face, DATA_ACTION, ACTION_ALL);\n }\n\n if (!options.cropBoxResizable) {\n addClass(cropBox.getElementsByClassName(\"\".concat(NAMESPACE, \"-line\")), CLASS_HIDDEN);\n addClass(cropBox.getElementsByClassName(\"\".concat(NAMESPACE, \"-point\")), CLASS_HIDDEN);\n }\n\n this.render();\n this.ready = true;\n this.setDragMode(options.dragMode);\n\n if (options.autoCrop) {\n this.crop();\n }\n\n this.setData(options.data);\n\n if (isFunction(options.ready)) {\n addListener(element, EVENT_READY, options.ready, {\n once: true\n });\n }\n\n dispatchEvent(element, EVENT_READY);\n }\n }, {\n key: \"unbuild\",\n value: function unbuild() {\n if (!this.ready) {\n return;\n }\n\n this.ready = false;\n this.unbind();\n this.resetPreview();\n this.cropper.parentNode.removeChild(this.cropper);\n removeClass(this.element, CLASS_HIDDEN);\n }\n }, {\n key: \"uncreate\",\n value: function uncreate() {\n if (this.ready) {\n this.unbuild();\n this.ready = false;\n this.cropped = false;\n } else if (this.sizing) {\n this.sizingImage.onload = null;\n this.sizing = false;\n this.sized = false;\n } else if (this.reloading) {\n this.xhr.onabort = null;\n this.xhr.abort();\n } else if (this.image) {\n this.stop();\n }\n }\n /**\n * Get the no conflict cropper class.\n * @returns {Cropper} The cropper class.\n */\n\n }], [{\n key: \"noConflict\",\n value: function noConflict() {\n window.Cropper = AnotherCropper;\n return Cropper;\n }\n /**\n * Change the default options.\n * @param {Object} options - The new default options.\n */\n\n }, {\n key: \"setDefaults\",\n value: function setDefaults(options) {\n assign(DEFAULTS, isPlainObject(options) && options);\n }\n }]);\n\n return Cropper;\n }();\n\n assign(Cropper.prototype, render, preview, events, handlers, change, methods);\n\n return Cropper;\n\n})));\n", "/*\n * base64.js\n *\n * Licensed under the BSD 3-Clause License.\n * http://opensource.org/licenses/BSD-3-Clause\n *\n * References:\n * http://en.wikipedia.org/wiki/Base64\n */\n;(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined'\n ? module.exports = factory(global)\n : typeof define === 'function' && define.amd\n ? define(factory) : factory(global)\n}((\n typeof self !== 'undefined' ? self\n : typeof window !== 'undefined' ? window\n : typeof global !== 'undefined' ? global\n: this\n), function(global) {\n 'use strict';\n // existing version for noConflict()\n global = global || {};\n var _Base64 = global.Base64;\n var version = \"2.6.4\";\n // constants\n var b64chars\n = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n var b64tab = function(bin) {\n var t = {};\n for (var i = 0, l = bin.length; i < l; i++) t[bin.charAt(i)] = i;\n return t;\n }(b64chars);\n var fromCharCode = String.fromCharCode;\n // encoder stuff\n var cb_utob = function(c) {\n if (c.length < 2) {\n var cc = c.charCodeAt(0);\n return cc < 0x80 ? c\n : cc < 0x800 ? (fromCharCode(0xc0 | (cc >>> 6))\n + fromCharCode(0x80 | (cc & 0x3f)))\n : (fromCharCode(0xe0 | ((cc >>> 12) & 0x0f))\n + fromCharCode(0x80 | ((cc >>> 6) & 0x3f))\n + fromCharCode(0x80 | ( cc & 0x3f)));\n } else {\n var cc = 0x10000\n + (c.charCodeAt(0) - 0xD800) * 0x400\n + (c.charCodeAt(1) - 0xDC00);\n return (fromCharCode(0xf0 | ((cc >>> 18) & 0x07))\n + fromCharCode(0x80 | ((cc >>> 12) & 0x3f))\n + fromCharCode(0x80 | ((cc >>> 6) & 0x3f))\n + fromCharCode(0x80 | ( cc & 0x3f)));\n }\n };\n var re_utob = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFFF]|[^\\x00-\\x7F]/g;\n var utob = function(u) {\n return u.replace(re_utob, cb_utob);\n };\n var cb_encode = function(ccc) {\n var padlen = [0, 2, 1][ccc.length % 3],\n ord = ccc.charCodeAt(0) << 16\n | ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8)\n | ((ccc.length > 2 ? ccc.charCodeAt(2) : 0)),\n chars = [\n b64chars.charAt( ord >>> 18),\n b64chars.charAt((ord >>> 12) & 63),\n padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),\n padlen >= 1 ? '=' : b64chars.charAt(ord & 63)\n ];\n return chars.join('');\n };\n var btoa = global.btoa && typeof global.btoa == 'function'\n ? function(b){ return global.btoa(b) } : function(b) {\n if (b.match(/[^\\x00-\\xFF]/)) throw new RangeError(\n 'The string contains invalid characters.'\n );\n return b.replace(/[\\s\\S]{1,3}/g, cb_encode);\n };\n var _encode = function(u) {\n return btoa(utob(String(u)));\n };\n var mkUriSafe = function (b64) {\n return b64.replace(/[+\\/]/g, function(m0) {\n return m0 == '+' ? '-' : '_';\n }).replace(/=/g, '');\n };\n var encode = function(u, urisafe) {\n return urisafe ? mkUriSafe(_encode(u)) : _encode(u);\n };\n var encodeURI = function(u) { return encode(u, true) };\n var fromUint8Array;\n if (global.Uint8Array) fromUint8Array = function(a, urisafe) {\n // return btoa(fromCharCode.apply(null, a));\n var b64 = '';\n for (var i = 0, l = a.length; i < l; i += 3) {\n var a0 = a[i], a1 = a[i+1], a2 = a[i+2];\n var ord = a0 << 16 | a1 << 8 | a2;\n b64 += b64chars.charAt( ord >>> 18)\n + b64chars.charAt((ord >>> 12) & 63)\n + ( typeof a1 != 'undefined'\n ? b64chars.charAt((ord >>> 6) & 63) : '=')\n + ( typeof a2 != 'undefined'\n ? b64chars.charAt( ord & 63) : '=');\n }\n return urisafe ? mkUriSafe(b64) : b64;\n };\n // decoder stuff\n var re_btou = /[\\xC0-\\xDF][\\x80-\\xBF]|[\\xE0-\\xEF][\\x80-\\xBF]{2}|[\\xF0-\\xF7][\\x80-\\xBF]{3}/g;\n var cb_btou = function(cccc) {\n switch(cccc.length) {\n case 4:\n var cp = ((0x07 & cccc.charCodeAt(0)) << 18)\n | ((0x3f & cccc.charCodeAt(1)) << 12)\n | ((0x3f & cccc.charCodeAt(2)) << 6)\n | (0x3f & cccc.charCodeAt(3)),\n offset = cp - 0x10000;\n return (fromCharCode((offset >>> 10) + 0xD800)\n + fromCharCode((offset & 0x3FF) + 0xDC00));\n case 3:\n return fromCharCode(\n ((0x0f & cccc.charCodeAt(0)) << 12)\n | ((0x3f & cccc.charCodeAt(1)) << 6)\n | (0x3f & cccc.charCodeAt(2))\n );\n default:\n return fromCharCode(\n ((0x1f & cccc.charCodeAt(0)) << 6)\n | (0x3f & cccc.charCodeAt(1))\n );\n }\n };\n var btou = function(b) {\n return b.replace(re_btou, cb_btou);\n };\n var cb_decode = function(cccc) {\n var len = cccc.length,\n padlen = len % 4,\n n = (len > 0 ? b64tab[cccc.charAt(0)] << 18 : 0)\n | (len > 1 ? b64tab[cccc.charAt(1)] << 12 : 0)\n | (len > 2 ? b64tab[cccc.charAt(2)] << 6 : 0)\n | (len > 3 ? b64tab[cccc.charAt(3)] : 0),\n chars = [\n fromCharCode( n >>> 16),\n fromCharCode((n >>> 8) & 0xff),\n fromCharCode( n & 0xff)\n ];\n chars.length -= [0, 0, 2, 1][padlen];\n return chars.join('');\n };\n var _atob = global.atob && typeof global.atob == 'function'\n ? function(a){ return global.atob(a) } : function(a){\n return a.replace(/\\S{1,4}/g, cb_decode);\n };\n var atob = function(a) {\n return _atob(String(a).replace(/[^A-Za-z0-9\\+\\/]/g, ''));\n };\n var _decode = function(a) { return btou(_atob(a)) };\n var _fromURI = function(a) {\n return String(a).replace(/[-_]/g, function(m0) {\n return m0 == '-' ? '+' : '/'\n }).replace(/[^A-Za-z0-9\\+\\/]/g, '');\n };\n var decode = function(a){\n return _decode(_fromURI(a));\n };\n var toUint8Array;\n if (global.Uint8Array) toUint8Array = function(a) {\n return Uint8Array.from(atob(_fromURI(a)), function(c) {\n return c.charCodeAt(0);\n });\n };\n var noConflict = function() {\n var Base64 = global.Base64;\n global.Base64 = _Base64;\n return Base64;\n };\n // export Base64\n global.Base64 = {\n VERSION: version,\n atob: atob,\n btoa: btoa,\n fromBase64: decode,\n toBase64: encode,\n utob: utob,\n encode: encode,\n encodeURI: encodeURI,\n btou: btou,\n decode: decode,\n noConflict: noConflict,\n fromUint8Array: fromUint8Array,\n toUint8Array: toUint8Array\n };\n // if ES5 is available, make Base64.extendString() available\n if (typeof Object.defineProperty === 'function') {\n var noEnum = function(v){\n return {value:v,enumerable:false,writable:true,configurable:true};\n };\n global.Base64.extendString = function () {\n Object.defineProperty(\n String.prototype, 'fromBase64', noEnum(function () {\n return decode(this)\n }));\n Object.defineProperty(\n String.prototype, 'toBase64', noEnum(function (urisafe) {\n return encode(this, urisafe)\n }));\n Object.defineProperty(\n String.prototype, 'toBase64URI', noEnum(function () {\n return encode(this, true)\n }));\n };\n }\n //\n // export Base64 to the namespace\n //\n if (global['Meteor']) { // Meteor.js\n Base64 = global.Base64;\n }\n // module.exports and AMD are mutually exclusive.\n // module.exports has precedence.\n if (typeof module !== 'undefined' && module.exports) {\n module.exports.Base64 = global.Base64;\n }\n else if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module.\n define([], function(){ return global.Base64 });\n }\n // that's it!\n return {Base64: global.Base64}\n}));\n", "'use strict';\n\n/**\n * Check if we're required to add a port number.\n *\n * @see https://url.spec.whatwg.org/#default-port\n * @param {Number|String} port Port number we need to check\n * @param {String} protocol Protocol we need to check against.\n * @returns {Boolean} Is it a default port for the given protocol\n * @api private\n */\nmodule.exports = function required(port, protocol) {\n protocol = protocol.split(':')[0];\n port = +port;\n\n if (!port) return false;\n\n switch (protocol) {\n case 'http':\n case 'ws':\n return port !== 80;\n\n case 'https':\n case 'wss':\n return port !== 443;\n\n case 'ftp':\n return port !== 21;\n\n case 'gopher':\n return port !== 70;\n\n case 'file':\n return false;\n }\n\n return port !== 0;\n};\n", "'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , undef;\n\n/**\n * Decode a URI encoded string.\n *\n * @param {String} input The URI encoded string.\n * @returns {String|Null} The decoded string.\n * @api private\n */\nfunction decode(input) {\n try {\n return decodeURIComponent(input.replace(/\\+/g, ' '));\n } catch (e) {\n return null;\n }\n}\n\n/**\n * Attempts to encode a given input.\n *\n * @param {String} input The string that needs to be encoded.\n * @returns {String|Null} The encoded string.\n * @api private\n */\nfunction encode(input) {\n try {\n return encodeURIComponent(input);\n } catch (e) {\n return null;\n }\n}\n\n/**\n * Simple query string parser.\n *\n * @param {String} query The query string that needs to be parsed.\n * @returns {Object}\n * @api public\n */\nfunction querystring(query) {\n var parser = /([^=?#&]+)=?([^&]*)/g\n , result = {}\n , part;\n\n while (part = parser.exec(query)) {\n var key = decode(part[1])\n , value = decode(part[2]);\n\n //\n // Prevent overriding of existing properties. This ensures that build-in\n // methods like `toString` or __proto__ are not overriden by malicious\n // querystrings.\n //\n // In the case if failed decoding, we want to omit the key/value pairs\n // from the result.\n //\n if (key === null || value === null || key in result) continue;\n result[key] = value;\n }\n\n return result;\n}\n\n/**\n * Transform a query string to an object.\n *\n * @param {Object} obj Object that should be transformed.\n * @param {String} prefix Optional prefix.\n * @returns {String}\n * @api public\n */\nfunction querystringify(obj, prefix) {\n prefix = prefix || '';\n\n var pairs = []\n , value\n , key;\n\n //\n // Optionally prefix with a '?' if needed\n //\n if ('string' !== typeof prefix) prefix = '?';\n\n for (key in obj) {\n if (has.call(obj, key)) {\n value = obj[key];\n\n //\n // Edge cases where we actually want to encode the value to an empty\n // string instead of the stringified value.\n //\n if (!value && (value === null || value === undef || isNaN(value))) {\n value = '';\n }\n\n key = encode(key);\n value = encode(value);\n\n //\n // If we failed to encode the strings, we should bail out as we don't\n // want to add invalid strings to the query.\n //\n if (key === null || value === null) continue;\n pairs.push(key +'='+ value);\n }\n }\n\n return pairs.length ? prefix + pairs.join('&') : '';\n}\n\n//\n// Expose the module.\n//\nexports.stringify = querystringify;\nexports.parse = querystring;\n", "'use strict';\n\nvar required = require('requires-port')\n , qs = require('querystringify')\n , slashes = /^[A-Za-z][A-Za-z0-9+-.]*:\\/\\//\n , protocolre = /^([a-z][a-z0-9.+-]*:)?(\\/\\/)?([\\\\/]+)?([\\S\\s]*)/i\n , windowsDriveLetter = /^[a-zA-Z]:/\n , whitespace = '[\\\\x09\\\\x0A\\\\x0B\\\\x0C\\\\x0D\\\\x20\\\\xA0\\\\u1680\\\\u180E\\\\u2000\\\\u2001\\\\u2002\\\\u2003\\\\u2004\\\\u2005\\\\u2006\\\\u2007\\\\u2008\\\\u2009\\\\u200A\\\\u202F\\\\u205F\\\\u3000\\\\u2028\\\\u2029\\\\uFEFF]'\n , left = new RegExp('^'+ whitespace +'+');\n\n/**\n * Trim a given string.\n *\n * @param {String} str String to trim.\n * @public\n */\nfunction trimLeft(str) {\n return (str ? str : '').toString().replace(left, '');\n}\n\n/**\n * These are the parse rules for the URL parser, it informs the parser\n * about:\n *\n * 0. The char it Needs to parse, if it's a string it should be done using\n * indexOf, RegExp using exec and NaN means set as current value.\n * 1. The property we should set when parsing this value.\n * 2. Indication if it's backwards or forward parsing, when set as number it's\n * the value of extra chars that should be split off.\n * 3. Inherit from location if non existing in the parser.\n * 4. `toLowerCase` the resulting value.\n */\nvar rules = [\n ['#', 'hash'], // Extract from the back.\n ['?', 'query'], // Extract from the back.\n function sanitize(address, url) { // Sanitize what is left of the address\n return isSpecial(url.protocol) ? address.replace(/\\\\/g, '/') : address;\n },\n ['/', 'pathname'], // Extract from the back.\n ['@', 'auth', 1], // Extract from the front.\n [NaN, 'host', undefined, 1, 1], // Set left over value.\n [/:(\\d+)$/, 'port', undefined, 1], // RegExp the back.\n [NaN, 'hostname', undefined, 1, 1] // Set left over.\n];\n\n/**\n * These properties should not be copied or inherited from. This is only needed\n * for all non blob URL's as a blob URL does not include a hash, only the\n * origin.\n *\n * @type {Object}\n * @private\n */\nvar ignore = { hash: 1, query: 1 };\n\n/**\n * The location object differs when your code is loaded through a normal page,\n * Worker or through a worker using a blob. And with the blobble begins the\n * trouble as the location object will contain the URL of the blob, not the\n * location of the page where our code is loaded in. The actual origin is\n * encoded in the `pathname` so we can thankfully generate a good \"default\"\n * location from it so we can generate proper relative URL's again.\n *\n * @param {Object|String} loc Optional default location object.\n * @returns {Object} lolcation object.\n * @public\n */\nfunction lolcation(loc) {\n var globalVar;\n\n if (typeof window !== 'undefined') globalVar = window;\n else if (typeof global !== 'undefined') globalVar = global;\n else if (typeof self !== 'undefined') globalVar = self;\n else globalVar = {};\n\n var location = globalVar.location || {};\n loc = loc || location;\n\n var finaldestination = {}\n , type = typeof loc\n , key;\n\n if ('blob:' === loc.protocol) {\n finaldestination = new Url(unescape(loc.pathname), {});\n } else if ('string' === type) {\n finaldestination = new Url(loc, {});\n for (key in ignore) delete finaldestination[key];\n } else if ('object' === type) {\n for (key in loc) {\n if (key in ignore) continue;\n finaldestination[key] = loc[key];\n }\n\n if (finaldestination.slashes === undefined) {\n finaldestination.slashes = slashes.test(loc.href);\n }\n }\n\n return finaldestination;\n}\n\n/**\n * Check whether a protocol scheme is special.\n *\n * @param {String} The protocol scheme of the URL\n * @return {Boolean} `true` if the protocol scheme is special, else `false`\n * @private\n */\nfunction isSpecial(scheme) {\n return (\n scheme === 'file:' ||\n scheme === 'ftp:' ||\n scheme === 'http:' ||\n scheme === 'https:' ||\n scheme === 'ws:' ||\n scheme === 'wss:'\n );\n}\n\n/**\n * @typedef ProtocolExtract\n * @type Object\n * @property {String} protocol Protocol matched in the URL, in lowercase.\n * @property {Boolean} slashes `true` if protocol is followed by \"//\", else `false`.\n * @property {String} rest Rest of the URL that is not part of the protocol.\n */\n\n/**\n * Extract protocol information from a URL with/without double slash (\"//\").\n *\n * @param {String} address URL we want to extract from.\n * @param {Object} location\n * @return {ProtocolExtract} Extracted information.\n * @private\n */\nfunction extractProtocol(address, location) {\n address = trimLeft(address);\n location = location || {};\n\n var match = protocolre.exec(address);\n var protocol = match[1] ? match[1].toLowerCase() : '';\n var forwardSlashes = !!match[2];\n var otherSlashes = !!match[3];\n var slashesCount = 0;\n var rest;\n\n if (forwardSlashes) {\n if (otherSlashes) {\n rest = match[2] + match[3] + match[4];\n slashesCount = match[2].length + match[3].length;\n } else {\n rest = match[2] + match[4];\n slashesCount = match[2].length;\n }\n } else {\n if (otherSlashes) {\n rest = match[3] + match[4];\n slashesCount = match[3].length;\n } else {\n rest = match[4]\n }\n }\n\n if (protocol === 'file:') {\n if (slashesCount >= 2) {\n rest = rest.slice(2);\n }\n } else if (isSpecial(protocol)) {\n rest = match[4];\n } else if (protocol) {\n if (forwardSlashes) {\n rest = rest.slice(2);\n }\n } else if (slashesCount >= 2 && isSpecial(location.protocol)) {\n rest = match[4];\n }\n\n return {\n protocol: protocol,\n slashes: forwardSlashes || isSpecial(protocol),\n slashesCount: slashesCount,\n rest: rest\n };\n}\n\n/**\n * Resolve a relative URL pathname against a base URL pathname.\n *\n * @param {String} relative Pathname of the relative URL.\n * @param {String} base Pathname of the base URL.\n * @return {String} Resolved pathname.\n * @private\n */\nfunction resolve(relative, base) {\n if (relative === '') return base;\n\n var path = (base || '/').split('/').slice(0, -1).concat(relative.split('/'))\n , i = path.length\n , last = path[i - 1]\n , unshift = false\n , up = 0;\n\n while (i--) {\n if (path[i] === '.') {\n path.splice(i, 1);\n } else if (path[i] === '..') {\n path.splice(i, 1);\n up++;\n } else if (up) {\n if (i === 0) unshift = true;\n path.splice(i, 1);\n up--;\n }\n }\n\n if (unshift) path.unshift('');\n if (last === '.' || last === '..') path.push('');\n\n return path.join('/');\n}\n\n/**\n * The actual URL instance. Instead of returning an object we've opted-in to\n * create an actual constructor as it's much more memory efficient and\n * faster and it pleases my OCD.\n *\n * It is worth noting that we should not use `URL` as class name to prevent\n * clashes with the global URL instance that got introduced in browsers.\n *\n * @constructor\n * @param {String} address URL we want to parse.\n * @param {Object|String} [location] Location defaults for relative paths.\n * @param {Boolean|Function} [parser] Parser for the query string.\n * @private\n */\nfunction Url(address, location, parser) {\n address = trimLeft(address);\n\n if (!(this instanceof Url)) {\n return new Url(address, location, parser);\n }\n\n var relative, extracted, parse, instruction, index, key\n , instructions = rules.slice()\n , type = typeof location\n , url = this\n , i = 0;\n\n //\n // The following if statements allows this module two have compatibility with\n // 2 different API:\n //\n // 1. Node.js's `url.parse` api which accepts a URL, boolean as arguments\n // where the boolean indicates that the query string should also be parsed.\n //\n // 2. The `URL` interface of the browser which accepts a URL, object as\n // arguments. The supplied object will be used as default values / fall-back\n // for relative paths.\n //\n if ('object' !== type && 'string' !== type) {\n parser = location;\n location = null;\n }\n\n if (parser && 'function' !== typeof parser) parser = qs.parse;\n\n location = lolcation(location);\n\n //\n // Extract protocol information before running the instructions.\n //\n extracted = extractProtocol(address || '', location);\n relative = !extracted.protocol && !extracted.slashes;\n url.slashes = extracted.slashes || relative && location.slashes;\n url.protocol = extracted.protocol || location.protocol || '';\n address = extracted.rest;\n\n //\n // When the authority component is absent the URL starts with a path\n // component.\n //\n if (\n extracted.protocol === 'file:' && (\n extracted.slashesCount !== 2 || windowsDriveLetter.test(address)) ||\n (!extracted.slashes &&\n (extracted.protocol ||\n extracted.slashesCount < 2 ||\n !isSpecial(url.protocol)))\n ) {\n instructions[3] = [/(.*)/, 'pathname'];\n }\n\n for (; i < instructions.length; i++) {\n instruction = instructions[i];\n\n if (typeof instruction === 'function') {\n address = instruction(address, url);\n continue;\n }\n\n parse = instruction[0];\n key = instruction[1];\n\n if (parse !== parse) {\n url[key] = address;\n } else if ('string' === typeof parse) {\n if (~(index = address.indexOf(parse))) {\n if ('number' === typeof instruction[2]) {\n url[key] = address.slice(0, index);\n address = address.slice(index + instruction[2]);\n } else {\n url[key] = address.slice(index);\n address = address.slice(0, index);\n }\n }\n } else if ((index = parse.exec(address))) {\n url[key] = index[1];\n address = address.slice(0, index.index);\n }\n\n url[key] = url[key] || (\n relative && instruction[3] ? location[key] || '' : ''\n );\n\n //\n // Hostname, host and protocol should be lowercased so they can be used to\n // create a proper `origin`.\n //\n if (instruction[4]) url[key] = url[key].toLowerCase();\n }\n\n //\n // Also parse the supplied query string in to an object. If we're supplied\n // with a custom parser as function use that instead of the default build-in\n // parser.\n //\n if (parser) url.query = parser(url.query);\n\n //\n // If the URL is relative, resolve the pathname against the base URL.\n //\n if (\n relative\n && location.slashes\n && url.pathname.charAt(0) !== '/'\n && (url.pathname !== '' || location.pathname !== '')\n ) {\n url.pathname = resolve(url.pathname, location.pathname);\n }\n\n //\n // Default to a / for pathname if none exists. This normalizes the URL\n // to always have a /\n //\n if (url.pathname.charAt(0) !== '/' && isSpecial(url.protocol)) {\n url.pathname = '/' + url.pathname;\n }\n\n //\n // We should not add port numbers if they are already the default port number\n // for a given protocol. As the host also contains the port number we're going\n // override it with the hostname which contains no port number.\n //\n if (!required(url.port, url.protocol)) {\n url.host = url.hostname;\n url.port = '';\n }\n\n //\n // Parse down the `auth` for the username and password.\n //\n url.username = url.password = '';\n if (url.auth) {\n instruction = url.auth.split(':');\n url.username = instruction[0] || '';\n url.password = instruction[1] || '';\n }\n\n url.origin = url.protocol !== 'file:' && isSpecial(url.protocol) && url.host\n ? url.protocol +'//'+ url.host\n : 'null';\n\n //\n // The href is just the compiled result.\n //\n url.href = url.toString();\n}\n\n/**\n * This is convenience method for changing properties in the URL instance to\n * insure that they all propagate correctly.\n *\n * @param {String} part Property we need to adjust.\n * @param {Mixed} value The newly assigned value.\n * @param {Boolean|Function} fn When setting the query, it will be the function\n * used to parse the query.\n * When setting the protocol, double slash will be\n * removed from the final url if it is true.\n * @returns {URL} URL instance for chaining.\n * @public\n */\nfunction set(part, value, fn) {\n var url = this;\n\n switch (part) {\n case 'query':\n if ('string' === typeof value && value.length) {\n value = (fn || qs.parse)(value);\n }\n\n url[part] = value;\n break;\n\n case 'port':\n url[part] = value;\n\n if (!required(value, url.protocol)) {\n url.host = url.hostname;\n url[part] = '';\n } else if (value) {\n url.host = url.hostname +':'+ value;\n }\n\n break;\n\n case 'hostname':\n url[part] = value;\n\n if (url.port) value += ':'+ url.port;\n url.host = value;\n break;\n\n case 'host':\n url[part] = value;\n\n if (/:\\d+$/.test(value)) {\n value = value.split(':');\n url.port = value.pop();\n url.hostname = value.join(':');\n } else {\n url.hostname = value;\n url.port = '';\n }\n\n break;\n\n case 'protocol':\n url.protocol = value.toLowerCase();\n url.slashes = !fn;\n break;\n\n case 'pathname':\n case 'hash':\n if (value) {\n var char = part === 'pathname' ? '/' : '#';\n url[part] = value.charAt(0) !== char ? char + value : value;\n } else {\n url[part] = value;\n }\n break;\n\n default:\n url[part] = value;\n }\n\n for (var i = 0; i < rules.length; i++) {\n var ins = rules[i];\n\n if (ins[4]) url[ins[1]] = url[ins[1]].toLowerCase();\n }\n\n url.origin = url.protocol !== 'file:' && isSpecial(url.protocol) && url.host\n ? url.protocol +'//'+ url.host\n : 'null';\n\n url.href = url.toString();\n\n return url;\n}\n\n/**\n * Transform the properties back in to a valid and full URL string.\n *\n * @param {Function} stringify Optional query stringify function.\n * @returns {String} Compiled version of the URL.\n * @public\n */\nfunction toString(stringify) {\n if (!stringify || 'function' !== typeof stringify) stringify = qs.stringify;\n\n var query\n , url = this\n , protocol = url.protocol;\n\n if (protocol && protocol.charAt(protocol.length - 1) !== ':') protocol += ':';\n\n var result = protocol + (url.slashes || isSpecial(url.protocol) ? '//' : '');\n\n if (url.username) {\n result += url.username;\n if (url.password) result += ':'+ url.password;\n result += '@';\n }\n\n result += url.host + url.pathname;\n\n query = 'object' === typeof url.query ? stringify(url.query) : url.query;\n if (query) result += '?' !== query.charAt(0) ? '?'+ query : query;\n\n if (url.hash) result += url.hash;\n\n return result;\n}\n\nUrl.prototype = { set: set, toString: toString };\n\n//\n// Expose the URL parser and some additional properties that might be useful for\n// others or testing.\n//\nUrl.extractProtocol = extractProtocol;\nUrl.location = lolcation;\nUrl.trimLeft = trimLeft;\nUrl.qs = qs;\n\nmodule.exports = Url;\n", "\r\n/**\r\n * Expose `Emitter`.\r\n */\r\n\r\nif (typeof module !== 'undefined') {\r\n module.exports = Emitter;\r\n}\r\n\r\n/**\r\n * Initialize a new `Emitter`.\r\n *\r\n * @api public\r\n */\r\n\r\nfunction Emitter(obj) {\r\n if (obj) return mixin(obj);\r\n};\r\n\r\n/**\r\n * Mixin the emitter properties.\r\n *\r\n * @param {Object} obj\r\n * @return {Object}\r\n * @api private\r\n */\r\n\r\nfunction mixin(obj) {\r\n for (var key in Emitter.prototype) {\r\n obj[key] = Emitter.prototype[key];\r\n }\r\n return obj;\r\n}\r\n\r\n/**\r\n * Listen on the given `event` with `fn`.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.on =\r\nEmitter.prototype.addEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n (this._callbacks['$' + event] = this._callbacks['$' + event] || [])\r\n .push(fn);\r\n return this;\r\n};\r\n\r\n/**\r\n * Adds an `event` listener that will be invoked a single\r\n * time then automatically removed.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.once = function(event, fn){\r\n function on() {\r\n this.off(event, on);\r\n fn.apply(this, arguments);\r\n }\r\n\r\n on.fn = fn;\r\n this.on(event, on);\r\n return this;\r\n};\r\n\r\n/**\r\n * Remove the given callback for `event` or all\r\n * registered callbacks.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.off =\r\nEmitter.prototype.removeListener =\r\nEmitter.prototype.removeAllListeners =\r\nEmitter.prototype.removeEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n\r\n // all\r\n if (0 == arguments.length) {\r\n this._callbacks = {};\r\n return this;\r\n }\r\n\r\n // specific event\r\n var callbacks = this._callbacks['$' + event];\r\n if (!callbacks) return this;\r\n\r\n // remove all handlers\r\n if (1 == arguments.length) {\r\n delete this._callbacks['$' + event];\r\n return this;\r\n }\r\n\r\n // remove specific handler\r\n var cb;\r\n for (var i = 0; i < callbacks.length; i++) {\r\n cb = callbacks[i];\r\n if (cb === fn || cb.fn === fn) {\r\n callbacks.splice(i, 1);\r\n break;\r\n }\r\n }\r\n\r\n // Remove event specific arrays for event types that no\r\n // one is subscribed for to avoid memory leak.\r\n if (callbacks.length === 0) {\r\n delete this._callbacks['$' + event];\r\n }\r\n\r\n return this;\r\n};\r\n\r\n/**\r\n * Emit `event` with the given args.\r\n *\r\n * @param {String} event\r\n * @param {Mixed} ...\r\n * @return {Emitter}\r\n */\r\n\r\nEmitter.prototype.emit = function(event){\r\n this._callbacks = this._callbacks || {};\r\n\r\n var args = new Array(arguments.length - 1)\r\n , callbacks = this._callbacks['$' + event];\r\n\r\n for (var i = 1; i < arguments.length; i++) {\r\n args[i - 1] = arguments[i];\r\n }\r\n\r\n if (callbacks) {\r\n callbacks = callbacks.slice(0);\r\n for (var i = 0, len = callbacks.length; i < len; ++i) {\r\n callbacks[i].apply(this, args);\r\n }\r\n }\r\n\r\n return this;\r\n};\r\n\r\n/**\r\n * Return array of callbacks for `event`.\r\n *\r\n * @param {String} event\r\n * @return {Array}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.listeners = function(event){\r\n this._callbacks = this._callbacks || {};\r\n return this._callbacks['$' + event] || [];\r\n};\r\n\r\n/**\r\n * Check if this emitter has `event` handlers.\r\n *\r\n * @param {String} event\r\n * @return {Boolean}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.hasListeners = function(event){\r\n return !! this.listeners(event).length;\r\n};\r\n", "/**\n * Parses an URI\n *\n * @author Steven Levithan (MIT license)\n * @api private\n */\n\nvar re = /^(?:(?![^:@]+:[^:@\\/]*@)(http|https|ws|wss):\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/;\n\nvar parts = [\n 'source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'\n];\n\nmodule.exports = function parseuri(str) {\n var src = str,\n b = str.indexOf('['),\n e = str.indexOf(']');\n\n if (b != -1 && e != -1) {\n str = str.substring(0, b) + str.substring(b, e).replace(/:/g, ';') + str.substring(e, str.length);\n }\n\n var m = re.exec(str || ''),\n uri = {},\n i = 14;\n\n while (i--) {\n uri[parts[i]] = m[i] || '';\n }\n\n if (b != -1 && e != -1) {\n uri.source = src;\n uri.host = uri.host.substring(1, uri.host.length - 1).replace(/;/g, ':');\n uri.authority = uri.authority.replace('[', '').replace(']', '').replace(/;/g, ':');\n uri.ipv6uri = true;\n }\n\n uri.pathNames = pathNames(uri, uri['path']);\n uri.queryKey = queryKey(uri, uri['query']);\n\n return uri;\n};\n\nfunction pathNames(obj, path) {\n var regx = /\\/{2,9}/g,\n names = path.replace(regx, \"/\").split(\"/\");\n\n if (path.substr(0, 1) == '/' || path.length === 0) {\n names.splice(0, 1);\n }\n if (path.substr(path.length - 1, 1) == '/') {\n names.splice(names.length - 1, 1);\n }\n\n return names;\n}\n\nfunction queryKey(uri, query) {\n var data = {};\n\n query.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function ($0, $1, $2) {\n if ($1) {\n data[$1] = $2;\n }\n });\n\n return data;\n}\n", "\n/**\n * Module exports.\n *\n * Logic borrowed from Modernizr:\n *\n * - https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cors.js\n */\n\ntry {\n module.exports = typeof XMLHttpRequest !== 'undefined' &&\n 'withCredentials' in new XMLHttpRequest();\n} catch (err) {\n // if XMLHttp support is disabled in IE then it will throw\n // when trying to create\n module.exports = false;\n}\n", "\n/**\n * Expose `Emitter`.\n */\n\nexports.Emitter = Emitter;\n\n/**\n * Initialize a new `Emitter`.\n *\n * @api public\n */\n\nfunction Emitter(obj) {\n if (obj) return mixin(obj);\n}\n\n/**\n * Mixin the emitter properties.\n *\n * @param {Object} obj\n * @return {Object}\n * @api private\n */\n\nfunction mixin(obj) {\n for (var key in Emitter.prototype) {\n obj[key] = Emitter.prototype[key];\n }\n return obj;\n}\n\n/**\n * Listen on the given `event` with `fn`.\n *\n * @param {String} event\n * @param {Function} fn\n * @return {Emitter}\n * @api public\n */\n\nEmitter.prototype.on =\nEmitter.prototype.addEventListener = function(event, fn){\n this._callbacks = this._callbacks || {};\n (this._callbacks['$' + event] = this._callbacks['$' + event] || [])\n .push(fn);\n return this;\n};\n\n/**\n * Adds an `event` listener that will be invoked a single\n * time then automatically removed.\n *\n * @param {String} event\n * @param {Function} fn\n * @return {Emitter}\n * @api public\n */\n\nEmitter.prototype.once = function(event, fn){\n function on() {\n this.off(event, on);\n fn.apply(this, arguments);\n }\n\n on.fn = fn;\n this.on(event, on);\n return this;\n};\n\n/**\n * Remove the given callback for `event` or all\n * registered callbacks.\n *\n * @param {String} event\n * @param {Function} fn\n * @return {Emitter}\n * @api public\n */\n\nEmitter.prototype.off =\nEmitter.prototype.removeListener =\nEmitter.prototype.removeAllListeners =\nEmitter.prototype.removeEventListener = function(event, fn){\n this._callbacks = this._callbacks || {};\n\n // all\n if (0 == arguments.length) {\n this._callbacks = {};\n return this;\n }\n\n // specific event\n var callbacks = this._callbacks['$' + event];\n if (!callbacks) return this;\n\n // remove all handlers\n if (1 == arguments.length) {\n delete this._callbacks['$' + event];\n return this;\n }\n\n // remove specific handler\n var cb;\n for (var i = 0; i < callbacks.length; i++) {\n cb = callbacks[i];\n if (cb === fn || cb.fn === fn) {\n callbacks.splice(i, 1);\n break;\n }\n }\n\n // Remove event specific arrays for event types that no\n // one is subscribed for to avoid memory leak.\n if (callbacks.length === 0) {\n delete this._callbacks['$' + event];\n }\n\n return this;\n};\n\n/**\n * Emit `event` with the given args.\n *\n * @param {String} event\n * @param {Mixed} ...\n * @return {Emitter}\n */\n\nEmitter.prototype.emit = function(event){\n this._callbacks = this._callbacks || {};\n\n var args = new Array(arguments.length - 1)\n , callbacks = this._callbacks['$' + event];\n\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n\n if (callbacks) {\n callbacks = callbacks.slice(0);\n for (var i = 0, len = callbacks.length; i < len; ++i) {\n callbacks[i].apply(this, args);\n }\n }\n\n return this;\n};\n\n// alias used for reserved events (protected method)\nEmitter.prototype.emitReserved = Emitter.prototype.emit;\n\n/**\n * Return array of callbacks for `event`.\n *\n * @param {String} event\n * @return {Array}\n * @api public\n */\n\nEmitter.prototype.listeners = function(event){\n this._callbacks = this._callbacks || {};\n return this._callbacks['$' + event] || [];\n};\n\n/**\n * Check if this emitter has `event` handlers.\n *\n * @param {String} event\n * @return {Boolean}\n * @api public\n */\n\nEmitter.prototype.hasListeners = function(event){\n return !! this.listeners(event).length;\n};\n", "'use strict';\n\nvar alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split('')\n , length = 64\n , map = {}\n , seed = 0\n , i = 0\n , prev;\n\n/**\n * Return a string representing the specified number.\n *\n * @param {Number} num The number to convert.\n * @returns {String} The string representation of the number.\n * @api public\n */\nfunction encode(num) {\n var encoded = '';\n\n do {\n encoded = alphabet[num % length] + encoded;\n num = Math.floor(num / length);\n } while (num > 0);\n\n return encoded;\n}\n\n/**\n * Return the integer value specified by the given string.\n *\n * @param {String} str The string to convert.\n * @returns {Number} The integer value represented by the string.\n * @api public\n */\nfunction decode(str) {\n var decoded = 0;\n\n for (i = 0; i < str.length; i++) {\n decoded = decoded * length + map[str.charAt(i)];\n }\n\n return decoded;\n}\n\n/**\n * Yeast: A tiny growing id generator.\n *\n * @returns {String} A unique id.\n * @api public\n */\nfunction yeast() {\n var now = encode(+new Date());\n\n if (now !== prev) return seed = 0, prev = now;\n return now +'.'+ encode(seed++);\n}\n\n//\n// Map each character to its index.\n//\nfor (; i < length; i++) map[alphabet[i]] = i;\n\n//\n// Expose the `yeast`, `encode` and `decode` functions.\n//\nyeast.encode = encode;\nyeast.decode = decode;\nmodule.exports = yeast;\n", "/**\n * Compiles a querystring\n * Returns string representation of the object\n *\n * @param {Object}\n * @api private\n */\n\nexports.encode = function (obj) {\n var str = '';\n\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) {\n if (str.length) str += '&';\n str += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]);\n }\n }\n\n return str;\n};\n\n/**\n * Parses a simple querystring into an object\n *\n * @param {String} qs\n * @api private\n */\n\nexports.decode = function(qs){\n var qry = {};\n var pairs = qs.split('&');\n for (var i = 0, l = pairs.length; i < l; i++) {\n var pair = pairs[i].split('=');\n qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);\n }\n return qry;\n};\n", "\n/**\n * Expose `Backoff`.\n */\n\nmodule.exports = Backoff;\n\n/**\n * Initialize backoff timer with `opts`.\n *\n * - `min` initial timeout in milliseconds [100]\n * - `max` max timeout [10000]\n * - `jitter` [0]\n * - `factor` [2]\n *\n * @param {Object} opts\n * @api public\n */\n\nfunction Backoff(opts) {\n opts = opts || {};\n this.ms = opts.min || 100;\n this.max = opts.max || 10000;\n this.factor = opts.factor || 2;\n this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0;\n this.attempts = 0;\n}\n\n/**\n * Return the backoff duration.\n *\n * @return {Number}\n * @api public\n */\n\nBackoff.prototype.duration = function(){\n var ms = this.ms * Math.pow(this.factor, this.attempts++);\n if (this.jitter) {\n var rand = Math.random();\n var deviation = Math.floor(rand * this.jitter * ms);\n ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation;\n }\n return Math.min(ms, this.max) | 0;\n};\n\n/**\n * Reset the number of attempts.\n *\n * @api public\n */\n\nBackoff.prototype.reset = function(){\n this.attempts = 0;\n};\n\n/**\n * Set the minimum duration\n *\n * @api public\n */\n\nBackoff.prototype.setMin = function(min){\n this.ms = min;\n};\n\n/**\n * Set the maximum duration\n *\n * @api public\n */\n\nBackoff.prototype.setMax = function(max){\n this.max = max;\n};\n\n/**\n * Set the jitter\n *\n * @api public\n */\n\nBackoff.prototype.setJitter = function(jitter){\n this.jitter = jitter;\n};\n\n", "// Adapted from https://github.com/Flet/prettier-bytes/\n// Changing 1000 bytes to 1024, so we can keep uppercase KB vs kB\n// ISC License (c) Dan Flettre https://github.com/Flet/prettier-bytes/blob/master/LICENSE\nmodule.exports = function prettierBytes (num) {\n if (typeof num !== 'number' || isNaN(num)) {\n throw new TypeError(`Expected a number, got ${typeof num}`)\n }\n\n const neg = num < 0\n const units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']\n\n if (neg) {\n num = -num\n }\n\n if (num < 1) {\n return `${(neg ? '-' : '') + num} B`\n }\n\n const exponent = Math.min(Math.floor(Math.log(num) / Math.log(1024)), units.length - 1)\n num = Number(num / Math.pow(1024, exponent))\n const unit = units[exponent]\n\n if (num >= 10 || num % 1 === 0) {\n // Do not show decimals when the number is two-digit, or if the number has no\n // decimal component.\n return `${(neg ? '-' : '') + num.toFixed(0)} ${unit}`\n }\n return `${(neg ? '-' : '') + num.toFixed(1)} ${unit}`\n}\n", "/*!\n * Compressor.js v1.1.1\n * https://fengyuanchen.github.io/compressorjs\n *\n * Copyright 2018-present Chen Fengyuan\n * Released under the MIT license\n *\n * Date: 2021-10-05T02:32:40.212Z\n */\n\n'use strict';\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n\n if (enumerableOnly) {\n symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n }\n\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nvar canvasToBlob = {exports: {}};\n\n/*\n * JavaScript Canvas to Blob\n * https://github.com/blueimp/JavaScript-Canvas-to-Blob\n *\n * Copyright 2012, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n *\n * Based on stackoverflow user Stoive's code snippet:\n * http://stackoverflow.com/q/4998908\n */\n\n(function (module) {\n if (typeof window === 'undefined') {\n return;\n }\n\n (function (window) {\n\n var CanvasPrototype = window.HTMLCanvasElement && window.HTMLCanvasElement.prototype;\n\n var hasBlobConstructor = window.Blob && function () {\n try {\n return Boolean(new Blob());\n } catch (e) {\n return false;\n }\n }();\n\n var hasArrayBufferViewSupport = hasBlobConstructor && window.Uint8Array && function () {\n try {\n return new Blob([new Uint8Array(100)]).size === 100;\n } catch (e) {\n return false;\n }\n }();\n\n var BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder;\n var dataURIPattern = /^data:((.*?)(;charset=.*?)?)(;base64)?,/;\n\n var dataURLtoBlob = (hasBlobConstructor || BlobBuilder) && window.atob && window.ArrayBuffer && window.Uint8Array && function (dataURI) {\n var matches, mediaType, isBase64, dataString, byteString, arrayBuffer, intArray, i, bb; // Parse the dataURI components as per RFC 2397\n\n matches = dataURI.match(dataURIPattern);\n\n if (!matches) {\n throw new Error('invalid data URI');\n } // Default to text/plain;charset=US-ASCII\n\n\n mediaType = matches[2] ? matches[1] : 'text/plain' + (matches[3] || ';charset=US-ASCII');\n isBase64 = !!matches[4];\n dataString = dataURI.slice(matches[0].length);\n\n if (isBase64) {\n // Convert base64 to raw binary data held in a string:\n byteString = atob(dataString);\n } else {\n // Convert base64/URLEncoded data component to raw binary:\n byteString = decodeURIComponent(dataString);\n } // Write the bytes of the string to an ArrayBuffer:\n\n\n arrayBuffer = new ArrayBuffer(byteString.length);\n intArray = new Uint8Array(arrayBuffer);\n\n for (i = 0; i < byteString.length; i += 1) {\n intArray[i] = byteString.charCodeAt(i);\n } // Write the ArrayBuffer (or ArrayBufferView) to a blob:\n\n\n if (hasBlobConstructor) {\n return new Blob([hasArrayBufferViewSupport ? intArray : arrayBuffer], {\n type: mediaType\n });\n }\n\n bb = new BlobBuilder();\n bb.append(arrayBuffer);\n return bb.getBlob(mediaType);\n };\n\n if (window.HTMLCanvasElement && !CanvasPrototype.toBlob) {\n if (CanvasPrototype.mozGetAsFile) {\n CanvasPrototype.toBlob = function (callback, type, quality) {\n var self = this;\n setTimeout(function () {\n if (quality && CanvasPrototype.toDataURL && dataURLtoBlob) {\n callback(dataURLtoBlob(self.toDataURL(type, quality)));\n } else {\n callback(self.mozGetAsFile('blob', type));\n }\n });\n };\n } else if (CanvasPrototype.toDataURL && dataURLtoBlob) {\n if (CanvasPrototype.msToBlob) {\n CanvasPrototype.toBlob = function (callback, type, quality) {\n var self = this;\n setTimeout(function () {\n if ((type && type !== 'image/png' || quality) && CanvasPrototype.toDataURL && dataURLtoBlob) {\n callback(dataURLtoBlob(self.toDataURL(type, quality)));\n } else {\n callback(self.msToBlob(type));\n }\n });\n };\n } else {\n CanvasPrototype.toBlob = function (callback, type, quality) {\n var self = this;\n setTimeout(function () {\n callback(dataURLtoBlob(self.toDataURL(type, quality)));\n });\n };\n }\n }\n }\n\n if (module.exports) {\n module.exports = dataURLtoBlob;\n } else {\n window.dataURLtoBlob = dataURLtoBlob;\n }\n })(window);\n})(canvasToBlob);\n\nvar toBlob = canvasToBlob.exports;\n\nvar isBlob = function isBlob(value) {\n if (typeof Blob === 'undefined') {\n return false;\n }\n\n return value instanceof Blob || Object.prototype.toString.call(value) === '[object Blob]';\n};\n\nvar DEFAULTS = {\n /**\n * Indicates if output the original image instead of the compressed one\n * when the size of the compressed image is greater than the original one's\n * @type {boolean}\n */\n strict: true,\n\n /**\n * Indicates if read the image's Exif Orientation information,\n * and then rotate or flip the image automatically.\n * @type {boolean}\n */\n checkOrientation: true,\n\n /**\n * The max width of the output image.\n * @type {number}\n */\n maxWidth: Infinity,\n\n /**\n * The max height of the output image.\n * @type {number}\n */\n maxHeight: Infinity,\n\n /**\n * The min width of the output image.\n * @type {number}\n */\n minWidth: 0,\n\n /**\n * The min height of the output image.\n * @type {number}\n */\n minHeight: 0,\n\n /**\n * The width of the output image.\n * If not specified, the natural width of the source image will be used.\n * @type {number}\n */\n width: undefined,\n\n /**\n * The height of the output image.\n * If not specified, the natural height of the source image will be used.\n * @type {number}\n */\n height: undefined,\n\n /**\n * Sets how the size of the image should be resized to the container\n * specified by the `width` and `height` options.\n * @type {string}\n */\n resize: 'none',\n\n /**\n * The quality of the output image.\n * It must be a number between `0` and `1`,\n * and only available for `image/jpeg` and `image/webp` images.\n * Check out {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob canvas.toBlob}.\n * @type {number}\n */\n quality: 0.8,\n\n /**\n * The mime type of the output image.\n * By default, the original mime type of the source image file will be used.\n * @type {string}\n */\n mimeType: 'auto',\n\n /**\n * Files whose file type is included in this list,\n * and whose file size exceeds the `convertSize` value will be converted to JPEGs.\n * @type {string\uFF5CArray}\n */\n convertTypes: ['image/png'],\n\n /**\n * PNG files over this size (5 MB by default) will be converted to JPEGs.\n * To disable this, just set the value to `Infinity`.\n * @type {number}\n */\n convertSize: 5000000,\n\n /**\n * The hook function to execute before draw the image into the canvas for compression.\n * @type {Function}\n * @param {CanvasRenderingContext2D} context - The 2d rendering context of the canvas.\n * @param {HTMLCanvasElement} canvas - The canvas for compression.\n * @example\n * function (context, canvas) {\n * context.fillStyle = '#fff';\n * }\n */\n beforeDraw: null,\n\n /**\n * The hook function to execute after drew the image into the canvas for compression.\n * @type {Function}\n * @param {CanvasRenderingContext2D} context - The 2d rendering context of the canvas.\n * @param {HTMLCanvasElement} canvas - The canvas for compression.\n * @example\n * function (context, canvas) {\n * context.filter = 'grayscale(100%)';\n * }\n */\n drew: null,\n\n /**\n * The hook function to execute when success to compress the image.\n * @type {Function}\n * @param {File} file - The compressed image File object.\n * @example\n * function (file) {\n * console.log(file);\n * }\n */\n success: null,\n\n /**\n * The hook function to execute when fail to compress the image.\n * @type {Function}\n * @param {Error} err - An Error object.\n * @example\n * function (err) {\n * console.log(err.message);\n * }\n */\n error: null\n};\n\nvar IS_BROWSER = typeof window !== 'undefined' && typeof window.document !== 'undefined';\nvar WINDOW = IS_BROWSER ? window : {};\n\n/**\n * Check if the given value is a positive number.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the given value is a positive number, else `false`.\n */\n\nvar isPositiveNumber = function isPositiveNumber(value) {\n return value > 0 && value < Infinity;\n};\nvar slice = Array.prototype.slice;\n/**\n * Convert array-like or iterable object to an array.\n * @param {*} value - The value to convert.\n * @returns {Array} Returns a new array.\n */\n\nfunction toArray(value) {\n return Array.from ? Array.from(value) : slice.call(value);\n}\nvar REGEXP_IMAGE_TYPE = /^image\\/.+$/;\n/**\n * Check if the given value is a mime type of image.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the given is a mime type of image, else `false`.\n */\n\nfunction isImageType(value) {\n return REGEXP_IMAGE_TYPE.test(value);\n}\n/**\n * Convert image type to extension.\n * @param {string} value - The image type to convert.\n * @returns {boolean} Returns the image extension.\n */\n\nfunction imageTypeToExtension(value) {\n var extension = isImageType(value) ? value.substr(6) : '';\n\n if (extension === 'jpeg') {\n extension = 'jpg';\n }\n\n return \".\".concat(extension);\n}\nvar fromCharCode = String.fromCharCode;\n/**\n * Get string from char code in data view.\n * @param {DataView} dataView - The data view for read.\n * @param {number} start - The start index.\n * @param {number} length - The read length.\n * @returns {string} The read result.\n */\n\nfunction getStringFromCharCode(dataView, start, length) {\n var str = '';\n var i;\n length += start;\n\n for (i = start; i < length; i += 1) {\n str += fromCharCode(dataView.getUint8(i));\n }\n\n return str;\n}\nvar btoa = WINDOW.btoa;\n/**\n * Transform array buffer to Data URL.\n * @param {ArrayBuffer} arrayBuffer - The array buffer to transform.\n * @param {string} mimeType - The mime type of the Data URL.\n * @returns {string} The result Data URL.\n */\n\nfunction arrayBufferToDataURL(arrayBuffer, mimeType) {\n var chunks = [];\n var chunkSize = 8192;\n var uint8 = new Uint8Array(arrayBuffer);\n\n while (uint8.length > 0) {\n // XXX: Babel's `toConsumableArray` helper will throw error in IE or Safari 9\n // eslint-disable-next-line prefer-spread\n chunks.push(fromCharCode.apply(null, toArray(uint8.subarray(0, chunkSize))));\n uint8 = uint8.subarray(chunkSize);\n }\n\n return \"data:\".concat(mimeType, \";base64,\").concat(btoa(chunks.join('')));\n}\n/**\n * Get orientation value from given array buffer.\n * @param {ArrayBuffer} arrayBuffer - The array buffer to read.\n * @returns {number} The read orientation value.\n */\n\nfunction resetAndGetOrientation(arrayBuffer) {\n var dataView = new DataView(arrayBuffer);\n var orientation; // Ignores range error when the image does not have correct Exif information\n\n try {\n var littleEndian;\n var app1Start;\n var ifdStart; // Only handle JPEG image (start by 0xFFD8)\n\n if (dataView.getUint8(0) === 0xFF && dataView.getUint8(1) === 0xD8) {\n var length = dataView.byteLength;\n var offset = 2;\n\n while (offset + 1 < length) {\n if (dataView.getUint8(offset) === 0xFF && dataView.getUint8(offset + 1) === 0xE1) {\n app1Start = offset;\n break;\n }\n\n offset += 1;\n }\n }\n\n if (app1Start) {\n var exifIDCode = app1Start + 4;\n var tiffOffset = app1Start + 10;\n\n if (getStringFromCharCode(dataView, exifIDCode, 4) === 'Exif') {\n var endianness = dataView.getUint16(tiffOffset);\n littleEndian = endianness === 0x4949;\n\n if (littleEndian || endianness === 0x4D4D\n /* bigEndian */\n ) {\n if (dataView.getUint16(tiffOffset + 2, littleEndian) === 0x002A) {\n var firstIFDOffset = dataView.getUint32(tiffOffset + 4, littleEndian);\n\n if (firstIFDOffset >= 0x00000008) {\n ifdStart = tiffOffset + firstIFDOffset;\n }\n }\n }\n }\n }\n\n if (ifdStart) {\n var _length = dataView.getUint16(ifdStart, littleEndian);\n\n var _offset;\n\n var i;\n\n for (i = 0; i < _length; i += 1) {\n _offset = ifdStart + i * 12 + 2;\n\n if (dataView.getUint16(_offset, littleEndian) === 0x0112\n /* Orientation */\n ) {\n // 8 is the offset of the current tag's value\n _offset += 8; // Get the original orientation value\n\n orientation = dataView.getUint16(_offset, littleEndian); // Override the orientation with its default value\n\n dataView.setUint16(_offset, 1, littleEndian);\n break;\n }\n }\n }\n } catch (e) {\n orientation = 1;\n }\n\n return orientation;\n}\n/**\n * Parse Exif Orientation value.\n * @param {number} orientation - The orientation to parse.\n * @returns {Object} The parsed result.\n */\n\nfunction parseOrientation(orientation) {\n var rotate = 0;\n var scaleX = 1;\n var scaleY = 1;\n\n switch (orientation) {\n // Flip horizontal\n case 2:\n scaleX = -1;\n break;\n // Rotate left 180\u00B0\n\n case 3:\n rotate = -180;\n break;\n // Flip vertical\n\n case 4:\n scaleY = -1;\n break;\n // Flip vertical and rotate right 90\u00B0\n\n case 5:\n rotate = 90;\n scaleY = -1;\n break;\n // Rotate right 90\u00B0\n\n case 6:\n rotate = 90;\n break;\n // Flip horizontal and rotate right 90\u00B0\n\n case 7:\n rotate = 90;\n scaleX = -1;\n break;\n // Rotate left 90\u00B0\n\n case 8:\n rotate = -90;\n break;\n }\n\n return {\n rotate: rotate,\n scaleX: scaleX,\n scaleY: scaleY\n };\n}\nvar REGEXP_DECIMALS = /\\.\\d*(?:0|9){12}\\d*$/;\n/**\n * Normalize decimal number.\n * Check out {@link https://0.30000000000000004.com/}\n * @param {number} value - The value to normalize.\n * @param {number} [times=100000000000] - The times for normalizing.\n * @returns {number} Returns the normalized number.\n */\n\nfunction normalizeDecimalNumber(value) {\n var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100000000000;\n return REGEXP_DECIMALS.test(value) ? Math.round(value * times) / times : value;\n}\n/**\n * Get the max sizes in a rectangle under the given aspect ratio.\n * @param {Object} data - The original sizes.\n * @param {string} [type='contain'] - The adjust type.\n * @returns {Object} The result sizes.\n */\n\nfunction getAdjustedSizes(_ref) {\n var aspectRatio = _ref.aspectRatio,\n height = _ref.height,\n width = _ref.width;\n var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'none';\n var isValidWidth = isPositiveNumber(width);\n var isValidHeight = isPositiveNumber(height);\n\n if (isValidWidth && isValidHeight) {\n var adjustedWidth = height * aspectRatio;\n\n if ((type === 'contain' || type === 'none') && adjustedWidth > width || type === 'cover' && adjustedWidth < width) {\n height = width / aspectRatio;\n } else {\n width = height * aspectRatio;\n }\n } else if (isValidWidth) {\n height = width / aspectRatio;\n } else if (isValidHeight) {\n width = height * aspectRatio;\n }\n\n return {\n width: width,\n height: height\n };\n}\n\nvar ArrayBuffer$1 = WINDOW.ArrayBuffer,\n FileReader = WINDOW.FileReader;\nvar URL = WINDOW.URL || WINDOW.webkitURL;\nvar REGEXP_EXTENSION = /\\.\\w+$/;\nvar AnotherCompressor = WINDOW.Compressor;\n/**\n * Creates a new image compressor.\n * @class\n */\n\nvar Compressor = /*#__PURE__*/function () {\n /**\n * The constructor of Compressor.\n * @param {File|Blob} file - The target image file for compressing.\n * @param {Object} [options] - The options for compressing.\n */\n function Compressor(file, options) {\n _classCallCheck(this, Compressor);\n\n this.file = file;\n this.image = new Image();\n this.options = _objectSpread2(_objectSpread2({}, DEFAULTS), options);\n this.aborted = false;\n this.result = null;\n this.init();\n }\n\n _createClass(Compressor, [{\n key: \"init\",\n value: function init() {\n var _this = this;\n\n var file = this.file,\n options = this.options;\n\n if (!isBlob(file)) {\n this.fail(new Error('The first argument must be a File or Blob object.'));\n return;\n }\n\n var mimeType = file.type;\n\n if (!isImageType(mimeType)) {\n this.fail(new Error('The first argument must be an image File or Blob object.'));\n return;\n }\n\n if (!URL || !FileReader) {\n this.fail(new Error('The current browser does not support image compression.'));\n return;\n }\n\n if (!ArrayBuffer$1) {\n options.checkOrientation = false;\n }\n\n if (URL && !options.checkOrientation) {\n this.load({\n url: URL.createObjectURL(file)\n });\n } else {\n var reader = new FileReader();\n var checkOrientation = options.checkOrientation && mimeType === 'image/jpeg';\n this.reader = reader;\n\n reader.onload = function (_ref) {\n var target = _ref.target;\n var result = target.result;\n var data = {};\n\n if (checkOrientation) {\n // Reset the orientation value to its default value 1\n // as some iOS browsers will render image with its orientation\n var orientation = resetAndGetOrientation(result);\n\n if (orientation > 1 || !URL) {\n // Generate a new URL which has the default orientation value\n data.url = arrayBufferToDataURL(result, mimeType);\n\n if (orientation > 1) {\n _extends(data, parseOrientation(orientation));\n }\n } else {\n data.url = URL.createObjectURL(file);\n }\n } else {\n data.url = result;\n }\n\n _this.load(data);\n };\n\n reader.onabort = function () {\n _this.fail(new Error('Aborted to read the image with FileReader.'));\n };\n\n reader.onerror = function () {\n _this.fail(new Error('Failed to read the image with FileReader.'));\n };\n\n reader.onloadend = function () {\n _this.reader = null;\n };\n\n if (checkOrientation) {\n reader.readAsArrayBuffer(file);\n } else {\n reader.readAsDataURL(file);\n }\n }\n }\n }, {\n key: \"load\",\n value: function load(data) {\n var _this2 = this;\n\n var file = this.file,\n image = this.image;\n\n image.onload = function () {\n _this2.draw(_objectSpread2(_objectSpread2({}, data), {}, {\n naturalWidth: image.naturalWidth,\n naturalHeight: image.naturalHeight\n }));\n };\n\n image.onabort = function () {\n _this2.fail(new Error('Aborted to load the image.'));\n };\n\n image.onerror = function () {\n _this2.fail(new Error('Failed to load the image.'));\n }; // Match all browsers that use WebKit as the layout engine in iOS devices,\n // such as Safari for iOS, Chrome for iOS, and in-app browsers.\n\n\n if (WINDOW.navigator && /(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(WINDOW.navigator.userAgent)) {\n // Fix the `The operation is insecure` error (#57)\n image.crossOrigin = 'anonymous';\n }\n\n image.alt = file.name;\n image.src = data.url;\n }\n }, {\n key: \"draw\",\n value: function draw(_ref2) {\n var _this3 = this;\n\n var naturalWidth = _ref2.naturalWidth,\n naturalHeight = _ref2.naturalHeight,\n _ref2$rotate = _ref2.rotate,\n rotate = _ref2$rotate === void 0 ? 0 : _ref2$rotate,\n _ref2$scaleX = _ref2.scaleX,\n scaleX = _ref2$scaleX === void 0 ? 1 : _ref2$scaleX,\n _ref2$scaleY = _ref2.scaleY,\n scaleY = _ref2$scaleY === void 0 ? 1 : _ref2$scaleY;\n var file = this.file,\n image = this.image,\n options = this.options;\n var canvas = document.createElement('canvas');\n var context = canvas.getContext('2d');\n var is90DegreesRotated = Math.abs(rotate) % 180 === 90;\n var resizable = (options.resize === 'contain' || options.resize === 'cover') && isPositiveNumber(options.width) && isPositiveNumber(options.height);\n var maxWidth = Math.max(options.maxWidth, 0) || Infinity;\n var maxHeight = Math.max(options.maxHeight, 0) || Infinity;\n var minWidth = Math.max(options.minWidth, 0) || 0;\n var minHeight = Math.max(options.minHeight, 0) || 0;\n var aspectRatio = naturalWidth / naturalHeight;\n var width = options.width,\n height = options.height;\n\n if (is90DegreesRotated) {\n var _ref3 = [maxHeight, maxWidth];\n maxWidth = _ref3[0];\n maxHeight = _ref3[1];\n var _ref4 = [minHeight, minWidth];\n minWidth = _ref4[0];\n minHeight = _ref4[1];\n var _ref5 = [height, width];\n width = _ref5[0];\n height = _ref5[1];\n }\n\n if (resizable) {\n aspectRatio = width / height;\n }\n\n var _getAdjustedSizes = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: maxWidth,\n height: maxHeight\n }, 'contain');\n\n maxWidth = _getAdjustedSizes.width;\n maxHeight = _getAdjustedSizes.height;\n\n var _getAdjustedSizes2 = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: minWidth,\n height: minHeight\n }, 'cover');\n\n minWidth = _getAdjustedSizes2.width;\n minHeight = _getAdjustedSizes2.height;\n\n if (resizable) {\n var _getAdjustedSizes3 = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: width,\n height: height\n }, options.resize);\n\n width = _getAdjustedSizes3.width;\n height = _getAdjustedSizes3.height;\n } else {\n var _getAdjustedSizes4 = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: width,\n height: height\n });\n\n var _getAdjustedSizes4$wi = _getAdjustedSizes4.width;\n width = _getAdjustedSizes4$wi === void 0 ? naturalWidth : _getAdjustedSizes4$wi;\n var _getAdjustedSizes4$he = _getAdjustedSizes4.height;\n height = _getAdjustedSizes4$he === void 0 ? naturalHeight : _getAdjustedSizes4$he;\n }\n\n width = Math.floor(normalizeDecimalNumber(Math.min(Math.max(width, minWidth), maxWidth)));\n height = Math.floor(normalizeDecimalNumber(Math.min(Math.max(height, minHeight), maxHeight)));\n var destX = -width / 2;\n var destY = -height / 2;\n var destWidth = width;\n var destHeight = height;\n var params = [];\n\n if (resizable) {\n var srcX = 0;\n var srcY = 0;\n var srcWidth = naturalWidth;\n var srcHeight = naturalHeight;\n\n var _getAdjustedSizes5 = getAdjustedSizes({\n aspectRatio: aspectRatio,\n width: naturalWidth,\n height: naturalHeight\n }, {\n contain: 'cover',\n cover: 'contain'\n }[options.resize]);\n\n srcWidth = _getAdjustedSizes5.width;\n srcHeight = _getAdjustedSizes5.height;\n srcX = (naturalWidth - srcWidth) / 2;\n srcY = (naturalHeight - srcHeight) / 2;\n params.push(srcX, srcY, srcWidth, srcHeight);\n }\n\n params.push(destX, destY, destWidth, destHeight);\n\n if (is90DegreesRotated) {\n var _ref6 = [height, width];\n width = _ref6[0];\n height = _ref6[1];\n }\n\n canvas.width = width;\n canvas.height = height;\n\n if (!isImageType(options.mimeType)) {\n options.mimeType = file.type;\n }\n\n var fillStyle = 'transparent'; // Converts PNG files over the `convertSize` to JPEGs.\n\n if (file.size > options.convertSize && options.convertTypes.indexOf(options.mimeType) >= 0) {\n options.mimeType = 'image/jpeg';\n }\n\n if (options.mimeType === 'image/jpeg') {\n fillStyle = '#fff';\n } // Override the default fill color (#000, black)\n\n\n context.fillStyle = fillStyle;\n context.fillRect(0, 0, width, height);\n\n if (options.beforeDraw) {\n options.beforeDraw.call(this, context, canvas);\n }\n\n if (this.aborted) {\n return;\n }\n\n context.save();\n context.translate(width / 2, height / 2);\n context.rotate(rotate * Math.PI / 180);\n context.scale(scaleX, scaleY);\n context.drawImage.apply(context, [image].concat(params));\n context.restore();\n\n if (options.drew) {\n options.drew.call(this, context, canvas);\n }\n\n if (this.aborted) {\n return;\n }\n\n var done = function done(result) {\n if (!_this3.aborted) {\n _this3.done({\n naturalWidth: naturalWidth,\n naturalHeight: naturalHeight,\n result: result\n });\n }\n };\n\n if (canvas.toBlob) {\n canvas.toBlob(done, options.mimeType, options.quality);\n } else {\n done(toBlob(canvas.toDataURL(options.mimeType, options.quality)));\n }\n }\n }, {\n key: \"done\",\n value: function done(_ref7) {\n var naturalWidth = _ref7.naturalWidth,\n naturalHeight = _ref7.naturalHeight,\n result = _ref7.result;\n var file = this.file,\n image = this.image,\n options = this.options;\n\n if (URL && !options.checkOrientation) {\n URL.revokeObjectURL(image.src);\n }\n\n if (result) {\n // Returns original file if the result is greater than it and without size related options\n if (options.strict && result.size > file.size && options.mimeType === file.type && !(options.width > naturalWidth || options.height > naturalHeight || options.minWidth > naturalWidth || options.minHeight > naturalHeight || options.maxWidth < naturalWidth || options.maxHeight < naturalHeight)) {\n result = file;\n } else {\n var date = new Date();\n result.lastModified = date.getTime();\n result.lastModifiedDate = date;\n result.name = file.name; // Convert the extension to match its type\n\n if (result.name && result.type !== file.type) {\n result.name = result.name.replace(REGEXP_EXTENSION, imageTypeToExtension(result.type));\n }\n }\n } else {\n // Returns original file if the result is null in some cases.\n result = file;\n }\n\n this.result = result;\n\n if (options.success) {\n options.success.call(this, result);\n }\n }\n }, {\n key: \"fail\",\n value: function fail(err) {\n var options = this.options;\n\n if (options.error) {\n options.error.call(this, err);\n } else {\n throw err;\n }\n }\n }, {\n key: \"abort\",\n value: function abort() {\n if (!this.aborted) {\n this.aborted = true;\n\n if (this.reader) {\n this.reader.abort();\n } else if (!this.image.complete) {\n this.image.onload = null;\n this.image.onabort();\n } else {\n this.fail(new Error('The compression process has been aborted.'));\n }\n }\n }\n /**\n * Get the no conflict compressor class.\n * @returns {Compressor} The compressor class.\n */\n\n }], [{\n key: \"noConflict\",\n value: function noConflict() {\n window.Compressor = AnotherCompressor;\n return Compressor;\n }\n /**\n * Change the default options.\n * @param {Object} options - The new default options.\n */\n\n }, {\n key: \"setDefaults\",\n value: function setDefaults(options) {\n _extends(DEFAULTS, options);\n }\n }]);\n\n return Compressor;\n}();\n\nmodule.exports = Compressor;\n", "// Core\nexport { default as Core, debugLogger } from '@uppy/core'\n\n// Utilities\nexport * as server from '@uppy/companion-client'\n\nimport * as ProviderView from '@uppy/provider-views'\nexport const views = { ProviderView }\n\n// Stores\nexport { default as DefaultStore } from '@uppy/store-default'\nexport { default as ReduxStore } from '@uppy/store-redux'\n\n// UI plugins\nexport { default as Dashboard } from '@uppy/dashboard'\nexport { default as DragDrop } from '@uppy/drag-drop'\nexport { default as DropTarget } from '@uppy/drop-target'\nexport { default as FileInput } from '@uppy/file-input'\nexport { default as ImageEditor } from '@uppy/image-editor'\nexport { default as Informer } from '@uppy/informer'\nexport { default as ProgressBar } from '@uppy/progress-bar'\nexport { default as StatusBar } from '@uppy/status-bar'\n\n// Acquirers\nexport { default as Audio } from '@uppy/audio'\nexport { default as Box } from '@uppy/box'\nexport { default as Dropbox } from '@uppy/dropbox'\nexport { default as Facebook } from '@uppy/facebook'\nexport { default as GoogleDrive } from '@uppy/google-drive'\nexport { default as Instagram } from '@uppy/instagram'\nexport { default as OneDrive } from '@uppy/onedrive'\nexport { default as RemoteSources } from '@uppy/remote-sources'\nexport { default as ScreenCapture } from '@uppy/screen-capture'\nexport { default as Unsplash } from '@uppy/unsplash'\nexport { default as Url } from '@uppy/url'\nexport { default as Webcam } from '@uppy/webcam'\nexport { default as Zoom } from '@uppy/zoom'\n\n// Uploaders\nexport { default as AwsS3 } from '@uppy/aws-s3'\nexport { default as AwsS3Multipart } from '@uppy/aws-s3-multipart'\nexport { default as Transloadit } from '@uppy/transloadit'\nexport { default as Tus } from '@uppy/tus'\nexport { default as XHRUpload } from '@uppy/xhr-upload'\n\n// Miscellaneous\nexport { default as Compressor } from '@uppy/compressor'\nexport { default as Form } from '@uppy/form'\nexport { default as GoldenRetriever } from '@uppy/golden-retriever'\nexport { default as ReduxDevTools } from '@uppy/redux-dev-tools'\nexport { default as ThumbnailGenerator } from '@uppy/thumbnail-generator'\n\nexport const locales = {}\n", "export default function has(object, key) {\n return Object.prototype.hasOwnProperty.call(object, key);\n}", "function _classPrivateFieldLooseBase(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError(\"attempted to use private field on non-instance\"); } return receiver; }\n\nvar id = 0;\n\nfunction _classPrivateFieldLooseKey(name) { return \"__private_\" + id++ + \"_\" + name; }\n\nimport has from './hasProperty.js';\n\nfunction insertReplacement(source, rx, replacement) {\n const newParts = [];\n source.forEach(chunk => {\n // When the source contains multiple placeholders for interpolation,\n // we should ignore chunks that are not strings, because those\n // can be JSX objects and will be otherwise incorrectly turned into strings.\n // Without this condition we\u2019d get this: [object Object] hello [object Object] my