');\n this.element.appendChild(messageElement);\n }\n var span = messageElement.getElementsByTagName(\"span\")[0];\n if (span) {\n if (span.textContent != null) {\n span.textContent = this.options.dictFallbackMessage;\n } else if (span.innerText != null) {\n span.innerText = this.options.dictFallbackMessage;\n }\n }\n return this.element.appendChild(this.getFallbackForm());\n },\n /**\n * Gets called to calculate the thumbnail dimensions.\n *\n * It gets `file`, `width` and `height` (both may be `null`) as parameters and must return an object containing:\n *\n * - `srcWidth` & `srcHeight` (required)\n * - `trgWidth` & `trgHeight` (required)\n * - `srcX` & `srcY` (optional, default `0`)\n * - `trgX` & `trgY` (optional, default `0`)\n *\n * Those values are going to be used by `ctx.drawImage()`.\n */\n resize: function resize(file, width, height, resizeMethod) {\n var info = {\n srcX: 0,\n srcY: 0,\n srcWidth: file.width,\n srcHeight: file.height\n };\n var srcRatio = file.width / file.height; // Automatically calculate dimensions if not specified\n\n if (width == null && height == null) {\n width = info.srcWidth;\n height = info.srcHeight;\n } else if (width == null) {\n width = height * srcRatio;\n } else if (height == null) {\n height = width / srcRatio;\n } // Make sure images aren't upscaled\n\n width = Math.min(width, info.srcWidth);\n height = Math.min(height, info.srcHeight);\n var trgRatio = width / height;\n if (info.srcWidth > width || info.srcHeight > height) {\n // Image is bigger and needs rescaling\n if (resizeMethod === \"crop\") {\n if (srcRatio > trgRatio) {\n info.srcHeight = file.height;\n info.srcWidth = info.srcHeight * trgRatio;\n } else {\n info.srcWidth = file.width;\n info.srcHeight = info.srcWidth / trgRatio;\n }\n } else if (resizeMethod === \"contain\") {\n // Method 'contain'\n if (srcRatio > trgRatio) {\n height = width / srcRatio;\n } else {\n width = height * srcRatio;\n }\n } else {\n throw new Error(\"Unknown resizeMethod '\".concat(resizeMethod, \"'\"));\n }\n }\n info.srcX = (file.width - info.srcWidth) / 2;\n info.srcY = (file.height - info.srcHeight) / 2;\n info.trgWidth = width;\n info.trgHeight = height;\n return info;\n },\n /**\n * Can be used to transform the file (for example, resize an image if necessary).\n *\n * The default implementation uses `resizeWidth` and `resizeHeight` (if provided) and resizes\n * images according to those dimensions.\n *\n * Gets the `file` as the first parameter, and a `done()` function as the second, that needs\n * to be invoked with the file when the transformation is done.\n */\n transformFile: function transformFile(file, done) {\n if ((this.options.resizeWidth || this.options.resizeHeight) && file.type.match(/image.*/)) {\n return this.resizeImage(file, this.options.resizeWidth, this.options.resizeHeight, this.options.resizeMethod, done);\n } else {\n return done(file);\n }\n },\n /**\n * A string that contains the template used for each dropped\n * file. Change it to fulfill your needs but make sure to properly\n * provide all elements.\n *\n * If you want to use an actual HTML element instead of providing a String\n * as a config option, you could create a div with the id `tpl`,\n * put the template inside it and provide the element like this:\n *\n * document\n * .querySelector('#tpl')\n * .innerHTML\n *\n */\n previewTemplate: preview_template,\n /*\n Those functions register themselves to the events on init and handle all\n the user interface specific stuff. Overwriting them won't break the upload\n but can break the way it's displayed.\n You can overwrite them if you don't like the default behavior. If you just\n want to add an additional event handler, register it on the dropzone object\n and don't overwrite those options.\n */\n // Those are self explanatory and simply concern the DragnDrop.\n drop: function drop(e) {\n return this.element.classList.remove(\"dz-drag-hover\");\n },\n dragstart: function dragstart(e) {},\n dragend: function dragend(e) {\n return this.element.classList.remove(\"dz-drag-hover\");\n },\n dragenter: function dragenter(e) {\n return this.element.classList.add(\"dz-drag-hover\");\n },\n dragover: function dragover(e) {\n return this.element.classList.add(\"dz-drag-hover\");\n },\n dragleave: function dragleave(e) {\n return this.element.classList.remove(\"dz-drag-hover\");\n },\n paste: function paste(e) {},\n // Called whenever there are no files left in the dropzone anymore, and the\n // dropzone should be displayed as if in the initial state.\n reset: function reset() {\n return this.element.classList.remove(\"dz-started\");\n },\n // Called when a file is added to the queue\n // Receives `file`\n addedfile: function addedfile(file) {\n var _this = this;\n if (this.element === this.previewsContainer) {\n this.element.classList.add(\"dz-started\");\n }\n if (this.previewsContainer && !this.options.disablePreviews) {\n file.previewElement = _Dropzone.createElement(this.options.previewTemplate.trim());\n file.previewTemplate = file.previewElement; // Backwards compatibility\n\n this.previewsContainer.appendChild(file.previewElement);\n var _iterator2 = options_createForOfIteratorHelper(file.previewElement.querySelectorAll(\"[data-dz-name]\"), true),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var node = _step2.value;\n node.textContent = file.name;\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n var _iterator3 = options_createForOfIteratorHelper(file.previewElement.querySelectorAll(\"[data-dz-size]\"), true),\n _step3;\n try {\n for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {\n node = _step3.value;\n node.innerHTML = this.filesize(file.size);\n }\n } catch (err) {\n _iterator3.e(err);\n } finally {\n _iterator3.f();\n }\n if (this.options.addRemoveLinks) {\n file._removeLink = _Dropzone.createElement(\"\".concat(this.options.dictRemoveFile, \"\"));\n file.previewElement.appendChild(file._removeLink);\n }\n var removeFileEvent = function removeFileEvent(e) {\n e.preventDefault();\n e.stopPropagation();\n if (file.status === _Dropzone.UPLOADING) {\n return _Dropzone.confirm(_this.options.dictCancelUploadConfirmation, function () {\n return _this.removeFile(file);\n });\n } else {\n if (_this.options.dictRemoveFileConfirmation) {\n return _Dropzone.confirm(_this.options.dictRemoveFileConfirmation, function () {\n return _this.removeFile(file);\n });\n } else {\n return _this.removeFile(file);\n }\n }\n };\n var _iterator4 = options_createForOfIteratorHelper(file.previewElement.querySelectorAll(\"[data-dz-remove]\"), true),\n _step4;\n try {\n for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {\n var removeLink = _step4.value;\n removeLink.addEventListener(\"click\", removeFileEvent);\n }\n } catch (err) {\n _iterator4.e(err);\n } finally {\n _iterator4.f();\n }\n }\n },\n // Called whenever a file is removed.\n removedfile: function removedfile(file) {\n if (file.previewElement != null && file.previewElement.parentNode != null) {\n file.previewElement.parentNode.removeChild(file.previewElement);\n }\n return this._updateMaxFilesReachedClass();\n },\n // Called when a thumbnail has been generated\n // Receives `file` and `dataUrl`\n thumbnail: function thumbnail(file, dataUrl) {\n if (file.previewElement) {\n file.previewElement.classList.remove(\"dz-file-preview\");\n var _iterator5 = options_createForOfIteratorHelper(file.previewElement.querySelectorAll(\"[data-dz-thumbnail]\"), true),\n _step5;\n try {\n for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {\n var thumbnailElement = _step5.value;\n thumbnailElement.alt = file.name;\n thumbnailElement.src = dataUrl;\n }\n } catch (err) {\n _iterator5.e(err);\n } finally {\n _iterator5.f();\n }\n return setTimeout(function () {\n return file.previewElement.classList.add(\"dz-image-preview\");\n }, 1);\n }\n },\n // Called whenever an error occurs\n // Receives `file` and `message`\n error: function error(file, message) {\n if (file.previewElement) {\n file.previewElement.classList.add(\"dz-error\");\n if (typeof message !== \"string\" && message.error) {\n message = message.error;\n }\n var _iterator6 = options_createForOfIteratorHelper(file.previewElement.querySelectorAll(\"[data-dz-errormessage]\"), true),\n _step6;\n try {\n for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {\n var node = _step6.value;\n node.textContent = message;\n }\n } catch (err) {\n _iterator6.e(err);\n } finally {\n _iterator6.f();\n }\n }\n },\n errormultiple: function errormultiple() {},\n // Called when a file gets processed. Since there is a cue, not all added\n // files are processed immediately.\n // Receives `file`\n processing: function processing(file) {\n if (file.previewElement) {\n file.previewElement.classList.add(\"dz-processing\");\n if (file._removeLink) {\n return file._removeLink.innerHTML = this.options.dictCancelUpload;\n }\n }\n },\n processingmultiple: function processingmultiple() {},\n // Called whenever the upload progress gets updated.\n // Receives `file`, `progress` (percentage 0-100) and `bytesSent`.\n // To get the total number of bytes of the file, use `file.size`\n uploadprogress: function uploadprogress(file, progress, bytesSent) {\n if (file.previewElement) {\n var _iterator7 = options_createForOfIteratorHelper(file.previewElement.querySelectorAll(\"[data-dz-uploadprogress]\"), true),\n _step7;\n try {\n for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {\n var node = _step7.value;\n node.nodeName === \"PROGRESS\" ? node.value = progress : node.style.width = \"\".concat(progress, \"%\");\n }\n } catch (err) {\n _iterator7.e(err);\n } finally {\n _iterator7.f();\n }\n }\n },\n // Called whenever the total upload progress gets updated.\n // Called with totalUploadProgress (0-100), totalBytes and totalBytesSent\n totaluploadprogress: function totaluploadprogress() {},\n // Called just before the file is sent. Gets the `xhr` object as second\n // parameter, so you can modify it (for example to add a CSRF token) and a\n // `formData` object to add additional information.\n sending: function sending() {},\n sendingmultiple: function sendingmultiple() {},\n // When the complete upload is finished and successful\n // Receives `file`\n success: function success(file) {\n if (file.previewElement) {\n return file.previewElement.classList.add(\"dz-success\");\n }\n },\n successmultiple: function successmultiple() {},\n // When the upload is canceled.\n canceled: function canceled(file) {\n return this.emit(\"error\", file, this.options.dictUploadCanceled);\n },\n canceledmultiple: function canceledmultiple() {},\n // When the upload is finished, either with success or an error.\n // Receives `file`\n complete: function complete(file) {\n if (file._removeLink) {\n file._removeLink.innerHTML = this.options.dictRemoveFile;\n }\n if (file.previewElement) {\n return file.previewElement.classList.add(\"dz-complete\");\n }\n },\n completemultiple: function completemultiple() {},\n maxfilesexceeded: function maxfilesexceeded() {},\n maxfilesreached: function maxfilesreached() {},\n queuecomplete: function queuecomplete() {},\n addedfiles: function addedfiles() {}\n };\n /* harmony default export */\n var src_options = defaultOptions;\n ; // CONCATENATED MODULE: ./src/dropzone.js\n function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n return _typeof(obj);\n }\n function dropzone_createForOfIteratorHelper(o, allowArrayLike) {\n var it;\n if (typeof Symbol === \"undefined\" || o[Symbol.iterator] == null) {\n if (Array.isArray(o) || (it = dropzone_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n var F = function F() {};\n return {\n s: F,\n n: function n() {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n },\n e: function e(_e) {\n throw _e;\n },\n f: F\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n var normalCompletion = true,\n didErr = false,\n err;\n return {\n s: function s() {\n it = o[Symbol.iterator]();\n },\n n: function n() {\n var step = it.next();\n normalCompletion = step.done;\n return step;\n },\n e: function e(_e2) {\n didErr = true;\n err = _e2;\n },\n f: function f() {\n try {\n if (!normalCompletion && it[\"return\"] != null) it[\"return\"]();\n } finally {\n if (didErr) throw err;\n }\n }\n };\n }\n function dropzone_unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return dropzone_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 dropzone_arrayLikeToArray(o, minLen);\n }\n function dropzone_arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n return arr2;\n }\n function dropzone_classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n }\n function dropzone_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 function dropzone_createClass(Constructor, protoProps, staticProps) {\n if (protoProps) dropzone_defineProperties(Constructor.prototype, protoProps);\n if (staticProps) dropzone_defineProperties(Constructor, staticProps);\n return Constructor;\n }\n function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n }\n function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n }\n function _createSuper(Derived) {\n var hasNativeReflectConstruct = _isNativeReflectConstruct();\n return function _createSuperInternal() {\n var Super = _getPrototypeOf(Derived),\n result;\n if (hasNativeReflectConstruct) {\n var NewTarget = _getPrototypeOf(this).constructor;\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n return _possibleConstructorReturn(this, result);\n };\n }\n function _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n return _assertThisInitialized(self);\n }\n function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n return self;\n }\n function _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n }\n function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n }\n var _Dropzone = /*#__PURE__*/function (_Emitter) {\n _inherits(Dropzone, _Emitter);\n var _super = _createSuper(Dropzone);\n function Dropzone(el, options) {\n var _this;\n dropzone_classCallCheck(this, Dropzone);\n _this = _super.call(this);\n var fallback, left;\n _this.element = el; // For backwards compatibility since the version was in the prototype previously\n\n _this.version = Dropzone.version;\n _this.clickableElements = [];\n _this.listeners = [];\n _this.files = []; // All files\n\n if (typeof _this.element === \"string\") {\n _this.element = document.querySelector(_this.element);\n } // Not checking if instance of HTMLElement or Element since IE9 is extremely weird.\n\n if (!_this.element || _this.element.nodeType == null) {\n throw new Error(\"Invalid dropzone element.\");\n }\n if (_this.element.dropzone) {\n throw new Error(\"Dropzone already attached.\");\n } // Now add this dropzone to the instances.\n\n Dropzone.instances.push(_assertThisInitialized(_this)); // Put the dropzone inside the element itself.\n\n _this.element.dropzone = _assertThisInitialized(_this);\n var elementOptions = (left = Dropzone.optionsForElement(_this.element)) != null ? left : {};\n _this.options = Dropzone.extend({}, src_options, elementOptions, options != null ? options : {});\n _this.options.previewTemplate = _this.options.previewTemplate.replace(/\\n*/g, \"\"); // If the browser failed, just call the fallback and leave\n\n if (_this.options.forceFallback || !Dropzone.isBrowserSupported()) {\n return _possibleConstructorReturn(_this, _this.options.fallback.call(_assertThisInitialized(_this)));\n } // @options.url = @element.getAttribute \"action\" unless @options.url?\n\n if (_this.options.url == null) {\n _this.options.url = _this.element.getAttribute(\"action\");\n }\n if (!_this.options.url) {\n throw new Error(\"No URL provided.\");\n }\n if (_this.options.acceptedFiles && _this.options.acceptedMimeTypes) {\n throw new Error(\"You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.\");\n }\n if (_this.options.uploadMultiple && _this.options.chunking) {\n throw new Error(\"You cannot set both: uploadMultiple and chunking.\");\n } // Backwards compatibility\n\n if (_this.options.acceptedMimeTypes) {\n _this.options.acceptedFiles = _this.options.acceptedMimeTypes;\n delete _this.options.acceptedMimeTypes;\n } // Backwards compatibility\n\n if (_this.options.renameFilename != null) {\n _this.options.renameFile = function (file) {\n return _this.options.renameFilename.call(_assertThisInitialized(_this), file.name, file);\n };\n }\n if (typeof _this.options.method === \"string\") {\n _this.options.method = _this.options.method.toUpperCase();\n }\n if ((fallback = _this.getExistingFallback()) && fallback.parentNode) {\n // Remove the fallback\n fallback.parentNode.removeChild(fallback);\n } // Display previews in the previewsContainer element or the Dropzone element unless explicitly set to false\n\n if (_this.options.previewsContainer !== false) {\n if (_this.options.previewsContainer) {\n _this.previewsContainer = Dropzone.getElement(_this.options.previewsContainer, \"previewsContainer\");\n } else {\n _this.previewsContainer = _this.element;\n }\n }\n if (_this.options.clickable) {\n if (_this.options.clickable === true) {\n _this.clickableElements = [_this.element];\n } else {\n _this.clickableElements = Dropzone.getElements(_this.options.clickable, \"clickable\");\n }\n }\n _this.init();\n return _this;\n } // Returns all files that have been accepted\n\n dropzone_createClass(Dropzone, [{\n key: \"getAcceptedFiles\",\n value: function getAcceptedFiles() {\n return this.files.filter(function (file) {\n return file.accepted;\n }).map(function (file) {\n return file;\n });\n } // Returns all files that have been rejected\n // Not sure when that's going to be useful, but added for completeness.\n }, {\n key: \"getRejectedFiles\",\n value: function getRejectedFiles() {\n return this.files.filter(function (file) {\n return !file.accepted;\n }).map(function (file) {\n return file;\n });\n }\n }, {\n key: \"getFilesWithStatus\",\n value: function getFilesWithStatus(status) {\n return this.files.filter(function (file) {\n return file.status === status;\n }).map(function (file) {\n return file;\n });\n } // Returns all files that are in the queue\n }, {\n key: \"getQueuedFiles\",\n value: function getQueuedFiles() {\n return this.getFilesWithStatus(Dropzone.QUEUED);\n }\n }, {\n key: \"getUploadingFiles\",\n value: function getUploadingFiles() {\n return this.getFilesWithStatus(Dropzone.UPLOADING);\n }\n }, {\n key: \"getAddedFiles\",\n value: function getAddedFiles() {\n return this.getFilesWithStatus(Dropzone.ADDED);\n } // Files that are either queued or uploading\n }, {\n key: \"getActiveFiles\",\n value: function getActiveFiles() {\n return this.files.filter(function (file) {\n return file.status === Dropzone.UPLOADING || file.status === Dropzone.QUEUED;\n }).map(function (file) {\n return file;\n });\n } // The function that gets called when Dropzone is initialized. You\n // can (and should) setup event listeners inside this function.\n }, {\n key: \"init\",\n value: function init() {\n var _this2 = this;\n\n // In case it isn't set already\n if (this.element.tagName === \"form\") {\n this.element.setAttribute(\"enctype\", \"multipart/form-data\");\n }\n if (this.element.classList.contains(\"dropzone\") && !this.element.querySelector(\".dz-message\")) {\n this.element.appendChild(Dropzone.createElement(\"\")));\n }\n if (this.clickableElements.length) {\n var setupHiddenFileInput = function setupHiddenFileInput() {\n if (_this2.hiddenFileInput) {\n _this2.hiddenFileInput.parentNode.removeChild(_this2.hiddenFileInput);\n }\n _this2.hiddenFileInput = document.createElement(\"input\");\n _this2.hiddenFileInput.setAttribute(\"type\", \"file\");\n if (_this2.options.maxFiles === null || _this2.options.maxFiles > 1) {\n _this2.hiddenFileInput.setAttribute(\"multiple\", \"multiple\");\n }\n _this2.hiddenFileInput.className = \"dz-hidden-input\";\n if (_this2.options.acceptedFiles !== null) {\n _this2.hiddenFileInput.setAttribute(\"accept\", _this2.options.acceptedFiles);\n }\n if (_this2.options.capture !== null) {\n _this2.hiddenFileInput.setAttribute(\"capture\", _this2.options.capture);\n } // Making sure that no one can \"tab\" into this field.\n\n _this2.hiddenFileInput.setAttribute(\"tabindex\", \"-1\"); // Not setting `display=\"none\"` because some browsers don't accept clicks\n // on elements that aren't displayed.\n\n _this2.hiddenFileInput.style.visibility = \"hidden\";\n _this2.hiddenFileInput.style.position = \"absolute\";\n _this2.hiddenFileInput.style.top = \"0\";\n _this2.hiddenFileInput.style.left = \"0\";\n _this2.hiddenFileInput.style.height = \"0\";\n _this2.hiddenFileInput.style.width = \"0\";\n Dropzone.getElement(_this2.options.hiddenInputContainer, \"hiddenInputContainer\").appendChild(_this2.hiddenFileInput);\n _this2.hiddenFileInput.addEventListener(\"change\", function () {\n var files = _this2.hiddenFileInput.files;\n if (files.length) {\n var _iterator = dropzone_createForOfIteratorHelper(files, true),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var file = _step.value;\n _this2.addFile(file);\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n }\n _this2.emit(\"addedfiles\", files);\n setupHiddenFileInput();\n });\n };\n setupHiddenFileInput();\n }\n this.URL = window.URL !== null ? window.URL : window.webkitURL; // Setup all event listeners on the Dropzone object itself.\n // They're not in @setupEventListeners() because they shouldn't be removed\n // again when the dropzone gets disabled.\n\n var _iterator2 = dropzone_createForOfIteratorHelper(this.events, true),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var eventName = _step2.value;\n this.on(eventName, this.options[eventName]);\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n this.on(\"uploadprogress\", function () {\n return _this2.updateTotalUploadProgress();\n });\n this.on(\"removedfile\", function () {\n return _this2.updateTotalUploadProgress();\n });\n this.on(\"canceled\", function (file) {\n return _this2.emit(\"complete\", file);\n }); // Emit a `queuecomplete` event if all files finished uploading.\n\n this.on(\"complete\", function (file) {\n if (_this2.getAddedFiles().length === 0 && _this2.getUploadingFiles().length === 0 && _this2.getQueuedFiles().length === 0) {\n // This needs to be deferred so that `queuecomplete` really triggers after `complete`\n return setTimeout(function () {\n return _this2.emit(\"queuecomplete\");\n }, 0);\n }\n });\n var containsFiles = function containsFiles(e) {\n if (e.dataTransfer.types) {\n // Because e.dataTransfer.types is an Object in\n // IE, we need to iterate like this instead of\n // using e.dataTransfer.types.some()\n for (var i = 0; i < e.dataTransfer.types.length; i++) {\n if (e.dataTransfer.types[i] === \"Files\") return true;\n }\n }\n return false;\n };\n var noPropagation = function noPropagation(e) {\n // If there are no files, we don't want to stop\n // propagation so we don't interfere with other\n // drag and drop behaviour.\n if (!containsFiles(e)) return;\n e.stopPropagation();\n if (e.preventDefault) {\n return e.preventDefault();\n } else {\n return e.returnValue = false;\n }\n }; // Create the listeners\n\n this.listeners = [{\n element: this.element,\n events: {\n dragstart: function dragstart(e) {\n return _this2.emit(\"dragstart\", e);\n },\n dragenter: function dragenter(e) {\n noPropagation(e);\n return _this2.emit(\"dragenter\", e);\n },\n dragover: function dragover(e) {\n // Makes it possible to drag files from chrome's download bar\n // http://stackoverflow.com/questions/19526430/drag-and-drop-file-uploads-from-chrome-downloads-bar\n // Try is required to prevent bug in Internet Explorer 11 (SCRIPT65535 exception)\n var efct;\n try {\n efct = e.dataTransfer.effectAllowed;\n } catch (error) {}\n e.dataTransfer.dropEffect = \"move\" === efct || \"linkMove\" === efct ? \"move\" : \"copy\";\n noPropagation(e);\n return _this2.emit(\"dragover\", e);\n },\n dragleave: function dragleave(e) {\n return _this2.emit(\"dragleave\", e);\n },\n drop: function drop(e) {\n noPropagation(e);\n return _this2.drop(e);\n },\n dragend: function dragend(e) {\n return _this2.emit(\"dragend\", e);\n }\n } // This is disabled right now, because the browsers don't implement it properly.\n // \"paste\": (e) =>\n // noPropagation e\n // @paste e\n }];\n this.clickableElements.forEach(function (clickableElement) {\n return _this2.listeners.push({\n element: clickableElement,\n events: {\n click: function click(evt) {\n // Only the actual dropzone or the message element should trigger file selection\n if (clickableElement !== _this2.element || evt.target === _this2.element || Dropzone.elementInside(evt.target, _this2.element.querySelector(\".dz-message\"))) {\n _this2.hiddenFileInput.click(); // Forward the click\n }\n return true;\n }\n }\n });\n });\n this.enable();\n return this.options.init.call(this);\n } // Not fully tested yet\n }, {\n key: \"destroy\",\n value: function destroy() {\n this.disable();\n this.removeAllFiles(true);\n if (this.hiddenFileInput != null ? this.hiddenFileInput.parentNode : undefined) {\n this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput);\n this.hiddenFileInput = null;\n }\n delete this.element.dropzone;\n return Dropzone.instances.splice(Dropzone.instances.indexOf(this), 1);\n }\n }, {\n key: \"updateTotalUploadProgress\",\n value: function updateTotalUploadProgress() {\n var totalUploadProgress;\n var totalBytesSent = 0;\n var totalBytes = 0;\n var activeFiles = this.getActiveFiles();\n if (activeFiles.length) {\n var _iterator3 = dropzone_createForOfIteratorHelper(this.getActiveFiles(), true),\n _step3;\n try {\n for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {\n var file = _step3.value;\n totalBytesSent += file.upload.bytesSent;\n totalBytes += file.upload.total;\n }\n } catch (err) {\n _iterator3.e(err);\n } finally {\n _iterator3.f();\n }\n totalUploadProgress = 100 * totalBytesSent / totalBytes;\n } else {\n totalUploadProgress = 100;\n }\n return this.emit(\"totaluploadprogress\", totalUploadProgress, totalBytes, totalBytesSent);\n } // @options.paramName can be a function taking one parameter rather than a string.\n // A parameter name for a file is obtained simply by calling this with an index number.\n }, {\n key: \"_getParamName\",\n value: function _getParamName(n) {\n if (typeof this.options.paramName === \"function\") {\n return this.options.paramName(n);\n } else {\n return \"\".concat(this.options.paramName).concat(this.options.uploadMultiple ? \"[\".concat(n, \"]\") : \"\");\n }\n } // If @options.renameFile is a function,\n // the function will be used to rename the file.name before appending it to the formData\n }, {\n key: \"_renameFile\",\n value: function _renameFile(file) {\n if (typeof this.options.renameFile !== \"function\") {\n return file.name;\n }\n return this.options.renameFile(file);\n } // Returns a form that can be used as fallback if the browser does not support DragnDrop\n //\n // If the dropzone is already a form, only the input field and button are returned. Otherwise a complete form element is provided.\n // This code has to pass in IE7 :(\n }, {\n key: \"getFallbackForm\",\n value: function getFallbackForm() {\n var existingFallback, form;\n if (existingFallback = this.getExistingFallback()) {\n return existingFallback;\n }\n var fieldsString = '
';\n if (this.options.dictFallbackText) {\n fieldsString += \"
\".concat(this.options.dictFallbackText, \"
\");\n }\n fieldsString += \"
\");\n var fields = Dropzone.createElement(fieldsString);\n if (this.element.tagName !== \"FORM\") {\n form = Dropzone.createElement(\"\"));\n form.appendChild(fields);\n } else {\n // Make sure that the enctype and method attributes are set properly\n this.element.setAttribute(\"enctype\", \"multipart/form-data\");\n this.element.setAttribute(\"method\", this.options.method);\n }\n return form != null ? form : fields;\n } // Returns the fallback elements if they exist already\n //\n // This code has to pass in IE7 :(\n }, {\n key: \"getExistingFallback\",\n value: function getExistingFallback() {\n var getFallback = function getFallback(elements) {\n var _iterator4 = dropzone_createForOfIteratorHelper(elements, true),\n _step4;\n try {\n for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {\n var el = _step4.value;\n if (/(^| )fallback($| )/.test(el.className)) {\n return el;\n }\n }\n } catch (err) {\n _iterator4.e(err);\n } finally {\n _iterator4.f();\n }\n };\n for (var _i = 0, _arr = [\"div\", \"form\"]; _i < _arr.length; _i++) {\n var tagName = _arr[_i];\n var fallback;\n if (fallback = getFallback(this.element.getElementsByTagName(tagName))) {\n return fallback;\n }\n }\n } // Activates all listeners stored in @listeners\n }, {\n key: \"setupEventListeners\",\n value: function setupEventListeners() {\n return this.listeners.map(function (elementListeners) {\n return function () {\n var result = [];\n for (var event in elementListeners.events) {\n var listener = elementListeners.events[event];\n result.push(elementListeners.element.addEventListener(event, listener, false));\n }\n return result;\n }();\n });\n } // Deactivates all listeners stored in @listeners\n }, {\n key: \"removeEventListeners\",\n value: function removeEventListeners() {\n return this.listeners.map(function (elementListeners) {\n return function () {\n var result = [];\n for (var event in elementListeners.events) {\n var listener = elementListeners.events[event];\n result.push(elementListeners.element.removeEventListener(event, listener, false));\n }\n return result;\n }();\n });\n } // Removes all event listeners and cancels all files in the queue or being processed.\n }, {\n key: \"disable\",\n value: function disable() {\n var _this3 = this;\n this.clickableElements.forEach(function (element) {\n return element.classList.remove(\"dz-clickable\");\n });\n this.removeEventListeners();\n this.disabled = true;\n return this.files.map(function (file) {\n return _this3.cancelUpload(file);\n });\n }\n }, {\n key: \"enable\",\n value: function enable() {\n delete this.disabled;\n this.clickableElements.forEach(function (element) {\n return element.classList.add(\"dz-clickable\");\n });\n return this.setupEventListeners();\n } // Returns a nicely formatted filesize\n }, {\n key: \"filesize\",\n value: function filesize(size) {\n var selectedSize = 0;\n var selectedUnit = \"b\";\n if (size > 0) {\n var units = [\"tb\", \"gb\", \"mb\", \"kb\", \"b\"];\n for (var i = 0; i < units.length; i++) {\n var unit = units[i];\n var cutoff = Math.pow(this.options.filesizeBase, 4 - i) / 10;\n if (size >= cutoff) {\n selectedSize = size / Math.pow(this.options.filesizeBase, 4 - i);\n selectedUnit = unit;\n break;\n }\n }\n selectedSize = Math.round(10 * selectedSize) / 10; // Cutting of digits\n }\n return \"\".concat(selectedSize, \" \").concat(this.options.dictFileSizeUnits[selectedUnit]);\n } // Adds or removes the `dz-max-files-reached` class from the form.\n }, {\n key: \"_updateMaxFilesReachedClass\",\n value: function _updateMaxFilesReachedClass() {\n if (this.options.maxFiles != null && this.getAcceptedFiles().length >= this.options.maxFiles) {\n if (this.getAcceptedFiles().length === this.options.maxFiles) {\n this.emit(\"maxfilesreached\", this.files);\n }\n return this.element.classList.add(\"dz-max-files-reached\");\n } else {\n return this.element.classList.remove(\"dz-max-files-reached\");\n }\n }\n }, {\n key: \"drop\",\n value: function drop(e) {\n if (!e.dataTransfer) {\n return;\n }\n this.emit(\"drop\", e); // Convert the FileList to an Array\n // This is necessary for IE11\n\n var files = [];\n for (var i = 0; i < e.dataTransfer.files.length; i++) {\n files[i] = e.dataTransfer.files[i];\n } // Even if it's a folder, files.length will contain the folders.\n\n if (files.length) {\n var items = e.dataTransfer.items;\n if (items && items.length && items[0].webkitGetAsEntry != null) {\n // The browser supports dropping of folders, so handle items instead of files\n this._addFilesFromItems(items);\n } else {\n this.handleFiles(files);\n }\n }\n this.emit(\"addedfiles\", files);\n }\n }, {\n key: \"paste\",\n value: function paste(e) {\n if (__guard__(e != null ? e.clipboardData : undefined, function (x) {\n return x.items;\n }) == null) {\n return;\n }\n this.emit(\"paste\", e);\n var items = e.clipboardData.items;\n if (items.length) {\n return this._addFilesFromItems(items);\n }\n }\n }, {\n key: \"handleFiles\",\n value: function handleFiles(files) {\n var _iterator5 = dropzone_createForOfIteratorHelper(files, true),\n _step5;\n try {\n for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {\n var file = _step5.value;\n this.addFile(file);\n }\n } catch (err) {\n _iterator5.e(err);\n } finally {\n _iterator5.f();\n }\n } // When a folder is dropped (or files are pasted), items must be handled\n // instead of files.\n }, {\n key: \"_addFilesFromItems\",\n value: function _addFilesFromItems(items) {\n var _this4 = this;\n return function () {\n var result = [];\n var _iterator6 = dropzone_createForOfIteratorHelper(items, true),\n _step6;\n try {\n for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {\n var item = _step6.value;\n var entry;\n if (item.webkitGetAsEntry != null && (entry = item.webkitGetAsEntry())) {\n if (entry.isFile) {\n result.push(_this4.addFile(item.getAsFile()));\n } else if (entry.isDirectory) {\n // Append all files from that directory to files\n result.push(_this4._addFilesFromDirectory(entry, entry.name));\n } else {\n result.push(undefined);\n }\n } else if (item.getAsFile != null) {\n if (item.kind == null || item.kind === \"file\") {\n result.push(_this4.addFile(item.getAsFile()));\n } else {\n result.push(undefined);\n }\n } else {\n result.push(undefined);\n }\n }\n } catch (err) {\n _iterator6.e(err);\n } finally {\n _iterator6.f();\n }\n return result;\n }();\n } // Goes through the directory, and adds each file it finds recursively\n }, {\n key: \"_addFilesFromDirectory\",\n value: function _addFilesFromDirectory(directory, path) {\n var _this5 = this;\n var dirReader = directory.createReader();\n var errorHandler = function errorHandler(error) {\n return __guardMethod__(console, \"log\", function (o) {\n return o.log(error);\n });\n };\n var readEntries = function readEntries() {\n return dirReader.readEntries(function (entries) {\n if (entries.length > 0) {\n var _iterator7 = dropzone_createForOfIteratorHelper(entries, true),\n _step7;\n try {\n for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {\n var entry = _step7.value;\n if (entry.isFile) {\n entry.file(function (file) {\n if (_this5.options.ignoreHiddenFiles && file.name.substring(0, 1) === \".\") {\n return;\n }\n file.fullPath = \"\".concat(path, \"/\").concat(file.name);\n return _this5.addFile(file);\n });\n } else if (entry.isDirectory) {\n _this5._addFilesFromDirectory(entry, \"\".concat(path, \"/\").concat(entry.name));\n }\n } // Recursively call readEntries() again, since browser only handle\n // the first 100 entries.\n // See: https://developer.mozilla.org/en-US/docs/Web/API/DirectoryReader#readEntries\n } catch (err) {\n _iterator7.e(err);\n } finally {\n _iterator7.f();\n }\n readEntries();\n }\n return null;\n }, errorHandler);\n };\n return readEntries();\n } // If `done()` is called without argument the file is accepted\n // If you call it with an error message, the file is rejected\n // (This allows for asynchronous validation)\n //\n // This function checks the filesize, and if the file.type passes the\n // `acceptedFiles` check.\n }, {\n key: \"accept\",\n value: function accept(file, done) {\n if (this.options.maxFilesize && file.size > this.options.maxFilesize * 1024 * 1024) {\n done(this.options.dictFileTooBig.replace(\"{{filesize}}\", Math.round(file.size / 1024 / 10.24) / 100).replace(\"{{maxFilesize}}\", this.options.maxFilesize));\n } else if (!Dropzone.isValidFile(file, this.options.acceptedFiles)) {\n done(this.options.dictInvalidFileType);\n } else if (this.options.maxFiles != null && this.getAcceptedFiles().length >= this.options.maxFiles) {\n done(this.options.dictMaxFilesExceeded.replace(\"{{maxFiles}}\", this.options.maxFiles));\n this.emit(\"maxfilesexceeded\", file);\n } else {\n this.options.accept.call(this, file, done);\n }\n }\n }, {\n key: \"addFile\",\n value: function addFile(file) {\n var _this6 = this;\n file.upload = {\n uuid: Dropzone.uuidv4(),\n progress: 0,\n // Setting the total upload size to file.size for the beginning\n // It's actual different than the size to be transmitted.\n total: file.size,\n bytesSent: 0,\n filename: this._renameFile(file) // Not setting chunking information here, because the acutal data — and\n // thus the chunks — might change if `options.transformFile` is set\n // and does something to the data.\n };\n this.files.push(file);\n file.status = Dropzone.ADDED;\n this.emit(\"addedfile\", file);\n this._enqueueThumbnail(file);\n this.accept(file, function (error) {\n if (error) {\n file.accepted = false;\n _this6._errorProcessing([file], error); // Will set the file.status\n } else {\n file.accepted = true;\n if (_this6.options.autoQueue) {\n _this6.enqueueFile(file);\n } // Will set .accepted = true\n }\n _this6._updateMaxFilesReachedClass();\n });\n } // Wrapper for enqueueFile\n }, {\n key: \"enqueueFiles\",\n value: function enqueueFiles(files) {\n var _iterator8 = dropzone_createForOfIteratorHelper(files, true),\n _step8;\n try {\n for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {\n var file = _step8.value;\n this.enqueueFile(file);\n }\n } catch (err) {\n _iterator8.e(err);\n } finally {\n _iterator8.f();\n }\n return null;\n }\n }, {\n key: \"enqueueFile\",\n value: function enqueueFile(file) {\n var _this7 = this;\n if (file.status === Dropzone.ADDED && file.accepted === true) {\n file.status = Dropzone.QUEUED;\n if (this.options.autoProcessQueue) {\n return setTimeout(function () {\n return _this7.processQueue();\n }, 0); // Deferring the call\n }\n } else {\n throw new Error(\"This file can't be queued because it has already been processed or was rejected.\");\n }\n }\n }, {\n key: \"_enqueueThumbnail\",\n value: function _enqueueThumbnail(file) {\n var _this8 = this;\n if (this.options.createImageThumbnails && file.type.match(/image.*/) && file.size <= this.options.maxThumbnailFilesize * 1024 * 1024) {\n this._thumbnailQueue.push(file);\n return setTimeout(function () {\n return _this8._processThumbnailQueue();\n }, 0); // Deferring the call\n }\n }\n }, {\n key: \"_processThumbnailQueue\",\n value: function _processThumbnailQueue() {\n var _this9 = this;\n if (this._processingThumbnail || this._thumbnailQueue.length === 0) {\n return;\n }\n this._processingThumbnail = true;\n var file = this._thumbnailQueue.shift();\n return this.createThumbnail(file, this.options.thumbnailWidth, this.options.thumbnailHeight, this.options.thumbnailMethod, true, function (dataUrl) {\n _this9.emit(\"thumbnail\", file, dataUrl);\n _this9._processingThumbnail = false;\n return _this9._processThumbnailQueue();\n });\n } // Can be called by the user to remove a file\n }, {\n key: \"removeFile\",\n value: function removeFile(file) {\n if (file.status === Dropzone.UPLOADING) {\n this.cancelUpload(file);\n }\n this.files = without(this.files, file);\n this.emit(\"removedfile\", file);\n if (this.files.length === 0) {\n return this.emit(\"reset\");\n }\n } // Removes all files that aren't currently processed from the list\n }, {\n key: \"removeAllFiles\",\n value: function removeAllFiles(cancelIfNecessary) {\n // Create a copy of files since removeFile() changes the @files array.\n if (cancelIfNecessary == null) {\n cancelIfNecessary = false;\n }\n var _iterator9 = dropzone_createForOfIteratorHelper(this.files.slice(), true),\n _step9;\n try {\n for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {\n var file = _step9.value;\n if (file.status !== Dropzone.UPLOADING || cancelIfNecessary) {\n this.removeFile(file);\n }\n }\n } catch (err) {\n _iterator9.e(err);\n } finally {\n _iterator9.f();\n }\n return null;\n } // Resizes an image before it gets sent to the server. This function is the default behavior of\n // `options.transformFile` if `resizeWidth` or `resizeHeight` are set. The callback is invoked with\n // the resized blob.\n }, {\n key: \"resizeImage\",\n value: function resizeImage(file, width, height, resizeMethod, callback) {\n var _this10 = this;\n return this.createThumbnail(file, width, height, resizeMethod, true, function (dataUrl, canvas) {\n if (canvas == null) {\n // The image has not been resized\n return callback(file);\n } else {\n var resizeMimeType = _this10.options.resizeMimeType;\n if (resizeMimeType == null) {\n resizeMimeType = file.type;\n }\n var resizedDataURL = canvas.toDataURL(resizeMimeType, _this10.options.resizeQuality);\n if (resizeMimeType === \"image/jpeg\" || resizeMimeType === \"image/jpg\") {\n // Now add the original EXIF information\n resizedDataURL = ExifRestore.restore(file.dataURL, resizedDataURL);\n }\n return callback(Dropzone.dataURItoBlob(resizedDataURL));\n }\n });\n }\n }, {\n key: \"createThumbnail\",\n value: function createThumbnail(file, width, height, resizeMethod, fixOrientation, callback) {\n var _this11 = this;\n var fileReader = new FileReader();\n fileReader.onload = function () {\n file.dataURL = fileReader.result; // Don't bother creating a thumbnail for SVG images since they're vector\n\n if (file.type === \"image/svg+xml\") {\n if (callback != null) {\n callback(fileReader.result);\n }\n return;\n }\n _this11.createThumbnailFromUrl(file, width, height, resizeMethod, fixOrientation, callback);\n };\n fileReader.readAsDataURL(file);\n } // `mockFile` needs to have these attributes:\n //\n // { name: 'name', size: 12345, imageUrl: '' }\n //\n // `callback` will be invoked when the image has been downloaded and displayed.\n // `crossOrigin` will be added to the `img` tag when accessing the file.\n }, {\n key: \"displayExistingFile\",\n value: function displayExistingFile(mockFile, imageUrl, callback, crossOrigin) {\n var _this12 = this;\n var resizeThumbnail = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;\n this.emit(\"addedfile\", mockFile);\n this.emit(\"complete\", mockFile);\n if (!resizeThumbnail) {\n this.emit(\"thumbnail\", mockFile, imageUrl);\n if (callback) callback();\n } else {\n var onDone = function onDone(thumbnail) {\n _this12.emit(\"thumbnail\", mockFile, thumbnail);\n if (callback) callback();\n };\n mockFile.dataURL = imageUrl;\n this.createThumbnailFromUrl(mockFile, this.options.thumbnailWidth, this.options.thumbnailHeight, this.options.thumbnailMethod, this.options.fixOrientation, onDone, crossOrigin);\n }\n }\n }, {\n key: \"createThumbnailFromUrl\",\n value: function createThumbnailFromUrl(file, width, height, resizeMethod, fixOrientation, callback, crossOrigin) {\n var _this13 = this;\n\n // Not using `new Image` here because of a bug in latest Chrome versions.\n // See https://github.com/enyo/dropzone/pull/226\n var img = document.createElement(\"img\");\n if (crossOrigin) {\n img.crossOrigin = crossOrigin;\n } // fixOrientation is not needed anymore with browsers handling imageOrientation\n\n fixOrientation = getComputedStyle(document.body)[\"imageOrientation\"] == \"from-image\" ? false : fixOrientation;\n img.onload = function () {\n var loadExif = function loadExif(callback) {\n return callback(1);\n };\n if (typeof EXIF !== \"undefined\" && EXIF !== null && fixOrientation) {\n loadExif = function loadExif(callback) {\n return EXIF.getData(img, function () {\n return callback(EXIF.getTag(this, \"Orientation\"));\n });\n };\n }\n return loadExif(function (orientation) {\n file.width = img.width;\n file.height = img.height;\n var resizeInfo = _this13.options.resize.call(_this13, file, width, height, resizeMethod);\n var canvas = document.createElement(\"canvas\");\n var ctx = canvas.getContext(\"2d\");\n canvas.width = resizeInfo.trgWidth;\n canvas.height = resizeInfo.trgHeight;\n if (orientation > 4) {\n canvas.width = resizeInfo.trgHeight;\n canvas.height = resizeInfo.trgWidth;\n }\n switch (orientation) {\n case 2:\n // horizontal flip\n ctx.translate(canvas.width, 0);\n ctx.scale(-1, 1);\n break;\n case 3:\n // 180° rotate left\n ctx.translate(canvas.width, canvas.height);\n ctx.rotate(Math.PI);\n break;\n case 4:\n // vertical flip\n ctx.translate(0, canvas.height);\n ctx.scale(1, -1);\n break;\n case 5:\n // vertical flip + 90 rotate right\n ctx.rotate(0.5 * Math.PI);\n ctx.scale(1, -1);\n break;\n case 6:\n // 90° rotate right\n ctx.rotate(0.5 * Math.PI);\n ctx.translate(0, -canvas.width);\n break;\n case 7:\n // horizontal flip + 90 rotate right\n ctx.rotate(0.5 * Math.PI);\n ctx.translate(canvas.height, -canvas.width);\n ctx.scale(-1, 1);\n break;\n case 8:\n // 90° rotate left\n ctx.rotate(-0.5 * Math.PI);\n ctx.translate(-canvas.height, 0);\n break;\n } // This is a bugfix for iOS' scaling bug.\n\n drawImageIOSFix(ctx, img, resizeInfo.srcX != null ? resizeInfo.srcX : 0, resizeInfo.srcY != null ? resizeInfo.srcY : 0, resizeInfo.srcWidth, resizeInfo.srcHeight, resizeInfo.trgX != null ? resizeInfo.trgX : 0, resizeInfo.trgY != null ? resizeInfo.trgY : 0, resizeInfo.trgWidth, resizeInfo.trgHeight);\n var thumbnail = canvas.toDataURL(\"image/png\");\n if (callback != null) {\n return callback(thumbnail, canvas);\n }\n });\n };\n if (callback != null) {\n img.onerror = callback;\n }\n return img.src = file.dataURL;\n } // Goes through the queue and processes files if there aren't too many already.\n }, {\n key: \"processQueue\",\n value: function processQueue() {\n var parallelUploads = this.options.parallelUploads;\n var processingLength = this.getUploadingFiles().length;\n var i = processingLength; // There are already at least as many files uploading than should be\n\n if (processingLength >= parallelUploads) {\n return;\n }\n var queuedFiles = this.getQueuedFiles();\n if (!(queuedFiles.length > 0)) {\n return;\n }\n if (this.options.uploadMultiple) {\n // The files should be uploaded in one request\n return this.processFiles(queuedFiles.slice(0, parallelUploads - processingLength));\n } else {\n while (i < parallelUploads) {\n if (!queuedFiles.length) {\n return;\n } // Nothing left to process\n\n this.processFile(queuedFiles.shift());\n i++;\n }\n }\n } // Wrapper for `processFiles`\n }, {\n key: \"processFile\",\n value: function processFile(file) {\n return this.processFiles([file]);\n } // Loads the file, then calls finishedLoading()\n }, {\n key: \"processFiles\",\n value: function processFiles(files) {\n var _iterator10 = dropzone_createForOfIteratorHelper(files, true),\n _step10;\n try {\n for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {\n var file = _step10.value;\n file.processing = true; // Backwards compatibility\n\n file.status = Dropzone.UPLOADING;\n this.emit(\"processing\", file);\n }\n } catch (err) {\n _iterator10.e(err);\n } finally {\n _iterator10.f();\n }\n if (this.options.uploadMultiple) {\n this.emit(\"processingmultiple\", files);\n }\n return this.uploadFiles(files);\n }\n }, {\n key: \"_getFilesWithXhr\",\n value: function _getFilesWithXhr(xhr) {\n var files;\n return files = this.files.filter(function (file) {\n return file.xhr === xhr;\n }).map(function (file) {\n return file;\n });\n } // Cancels the file upload and sets the status to CANCELED\n // **if** the file is actually being uploaded.\n // If it's still in the queue, the file is being removed from it and the status\n // set to CANCELED.\n }, {\n key: \"cancelUpload\",\n value: function cancelUpload(file) {\n if (file.status === Dropzone.UPLOADING) {\n var groupedFiles = this._getFilesWithXhr(file.xhr);\n var _iterator11 = dropzone_createForOfIteratorHelper(groupedFiles, true),\n _step11;\n try {\n for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {\n var groupedFile = _step11.value;\n groupedFile.status = Dropzone.CANCELED;\n }\n } catch (err) {\n _iterator11.e(err);\n } finally {\n _iterator11.f();\n }\n if (typeof file.xhr !== \"undefined\") {\n file.xhr.abort();\n }\n var _iterator12 = dropzone_createForOfIteratorHelper(groupedFiles, true),\n _step12;\n try {\n for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {\n var _groupedFile = _step12.value;\n this.emit(\"canceled\", _groupedFile);\n }\n } catch (err) {\n _iterator12.e(err);\n } finally {\n _iterator12.f();\n }\n if (this.options.uploadMultiple) {\n this.emit(\"canceledmultiple\", groupedFiles);\n }\n } else if (file.status === Dropzone.ADDED || file.status === Dropzone.QUEUED) {\n file.status = Dropzone.CANCELED;\n this.emit(\"canceled\", file);\n if (this.options.uploadMultiple) {\n this.emit(\"canceledmultiple\", [file]);\n }\n }\n if (this.options.autoProcessQueue) {\n return this.processQueue();\n }\n }\n }, {\n key: \"resolveOption\",\n value: function resolveOption(option) {\n if (typeof option === \"function\") {\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 return option.apply(this, args);\n }\n return option;\n }\n }, {\n key: \"uploadFile\",\n value: function uploadFile(file) {\n return this.uploadFiles([file]);\n }\n }, {\n key: \"uploadFiles\",\n value: function uploadFiles(files) {\n var _this14 = this;\n this._transformFiles(files, function (transformedFiles) {\n if (_this14.options.chunking) {\n // Chunking is not allowed to be used with `uploadMultiple` so we know\n // that there is only __one__file.\n var transformedFile = transformedFiles[0];\n files[0].upload.chunked = _this14.options.chunking && (_this14.options.forceChunking || transformedFile.size > _this14.options.chunkSize);\n files[0].upload.totalChunkCount = Math.ceil(transformedFile.size / _this14.options.chunkSize);\n }\n if (files[0].upload.chunked) {\n // This file should be sent in chunks!\n // If the chunking option is set, we **know** that there can only be **one** file, since\n // uploadMultiple is not allowed with this option.\n var file = files[0];\n var _transformedFile = transformedFiles[0];\n var startedChunkCount = 0;\n file.upload.chunks = [];\n var handleNextChunk = function handleNextChunk() {\n var chunkIndex = 0; // Find the next item in file.upload.chunks that is not defined yet.\n\n while (file.upload.chunks[chunkIndex] !== undefined) {\n chunkIndex++;\n } // This means, that all chunks have already been started.\n\n if (chunkIndex >= file.upload.totalChunkCount) return;\n startedChunkCount++;\n var start = chunkIndex * _this14.options.chunkSize;\n var end = Math.min(start + _this14.options.chunkSize, _transformedFile.size);\n var dataBlock = {\n name: _this14._getParamName(0),\n data: _transformedFile.webkitSlice ? _transformedFile.webkitSlice(start, end) : _transformedFile.slice(start, end),\n filename: file.upload.filename,\n chunkIndex: chunkIndex\n };\n file.upload.chunks[chunkIndex] = {\n file: file,\n index: chunkIndex,\n dataBlock: dataBlock,\n // In case we want to retry.\n status: Dropzone.UPLOADING,\n progress: 0,\n retries: 0 // The number of times this block has been retried.\n };\n _this14._uploadData(files, [dataBlock]);\n };\n file.upload.finishedChunkUpload = function (chunk, response) {\n var allFinished = true;\n chunk.status = Dropzone.SUCCESS; // Clear the data from the chunk\n\n chunk.dataBlock = null; // Leaving this reference to xhr intact here will cause memory leaks in some browsers\n\n chunk.xhr = null;\n for (var i = 0; i < file.upload.totalChunkCount; i++) {\n if (file.upload.chunks[i] === undefined) {\n return handleNextChunk();\n }\n if (file.upload.chunks[i].status !== Dropzone.SUCCESS) {\n allFinished = false;\n }\n }\n if (allFinished) {\n _this14.options.chunksUploaded(file, function () {\n _this14._finished(files, response, null);\n });\n }\n };\n if (_this14.options.parallelChunkUploads) {\n for (var i = 0; i < file.upload.totalChunkCount; i++) {\n handleNextChunk();\n }\n } else {\n handleNextChunk();\n }\n } else {\n var dataBlocks = [];\n for (var _i2 = 0; _i2 < files.length; _i2++) {\n dataBlocks[_i2] = {\n name: _this14._getParamName(_i2),\n data: transformedFiles[_i2],\n filename: files[_i2].upload.filename\n };\n }\n _this14._uploadData(files, dataBlocks);\n }\n });\n } /// Returns the right chunk for given file and xhr\n }, {\n key: \"_getChunk\",\n value: function _getChunk(file, xhr) {\n for (var i = 0; i < file.upload.totalChunkCount; i++) {\n if (file.upload.chunks[i] !== undefined && file.upload.chunks[i].xhr === xhr) {\n return file.upload.chunks[i];\n }\n }\n } // This function actually uploads the file(s) to the server.\n // If dataBlocks contains the actual data to upload (meaning, that this could either be transformed\n // files, or individual chunks for chunked upload).\n }, {\n key: \"_uploadData\",\n value: function _uploadData(files, dataBlocks) {\n var _this15 = this;\n var xhr = new XMLHttpRequest(); // Put the xhr object in the file objects to be able to reference it later.\n\n var _iterator13 = dropzone_createForOfIteratorHelper(files, true),\n _step13;\n try {\n for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {\n var file = _step13.value;\n file.xhr = xhr;\n }\n } catch (err) {\n _iterator13.e(err);\n } finally {\n _iterator13.f();\n }\n if (files[0].upload.chunked) {\n // Put the xhr object in the right chunk object, so it can be associated later, and found with _getChunk\n files[0].upload.chunks[dataBlocks[0].chunkIndex].xhr = xhr;\n }\n var method = this.resolveOption(this.options.method, files);\n var url = this.resolveOption(this.options.url, files);\n xhr.open(method, url, true); // Setting the timeout after open because of IE11 issue: https://gitlab.com/meno/dropzone/issues/8\n\n var timeout = this.resolveOption(this.options.timeout, files);\n if (timeout) xhr.timeout = this.resolveOption(this.options.timeout, files); // Has to be after `.open()`. See https://github.com/enyo/dropzone/issues/179\n\n xhr.withCredentials = !!this.options.withCredentials;\n xhr.onload = function (e) {\n _this15._finishedUploading(files, xhr, e);\n };\n xhr.ontimeout = function () {\n _this15._handleUploadError(files, xhr, \"Request timedout after \".concat(_this15.options.timeout / 1000, \" seconds\"));\n };\n xhr.onerror = function () {\n _this15._handleUploadError(files, xhr);\n }; // Some browsers do not have the .upload property\n\n var progressObj = xhr.upload != null ? xhr.upload : xhr;\n progressObj.onprogress = function (e) {\n return _this15._updateFilesUploadProgress(files, xhr, e);\n };\n var headers = {\n Accept: \"application/json\",\n \"Cache-Control\": \"no-cache\",\n \"X-Requested-With\": \"XMLHttpRequest\"\n };\n if (this.options.headers) {\n Dropzone.extend(headers, this.options.headers);\n }\n for (var headerName in headers) {\n var headerValue = headers[headerName];\n if (headerValue) {\n xhr.setRequestHeader(headerName, headerValue);\n }\n }\n var formData = new FormData(); // Adding all @options parameters\n\n if (this.options.params) {\n var additionalParams = this.options.params;\n if (typeof additionalParams === \"function\") {\n additionalParams = additionalParams.call(this, files, xhr, files[0].upload.chunked ? this._getChunk(files[0], xhr) : null);\n }\n for (var key in additionalParams) {\n var value = additionalParams[key];\n if (Array.isArray(value)) {\n // The additional parameter contains an array,\n // so lets iterate over it to attach each value\n // individually.\n for (var i = 0; i < value.length; i++) {\n formData.append(key, value[i]);\n }\n } else {\n formData.append(key, value);\n }\n }\n } // Let the user add additional data if necessary\n\n var _iterator14 = dropzone_createForOfIteratorHelper(files, true),\n _step14;\n try {\n for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {\n var _file = _step14.value;\n this.emit(\"sending\", _file, xhr, formData);\n }\n } catch (err) {\n _iterator14.e(err);\n } finally {\n _iterator14.f();\n }\n if (this.options.uploadMultiple) {\n this.emit(\"sendingmultiple\", files, xhr, formData);\n }\n this._addFormElementData(formData); // Finally add the files\n // Has to be last because some servers (eg: S3) expect the file to be the last parameter\n\n for (var _i3 = 0; _i3 < dataBlocks.length; _i3++) {\n var dataBlock = dataBlocks[_i3];\n formData.append(dataBlock.name, dataBlock.data, dataBlock.filename);\n }\n this.submitRequest(xhr, formData, files);\n } // Transforms all files with this.options.transformFile and invokes done with the transformed files when done.\n }, {\n key: \"_transformFiles\",\n value: function _transformFiles(files, done) {\n var _this16 = this;\n var transformedFiles = []; // Clumsy way of handling asynchronous calls, until I get to add a proper Future library.\n\n var doneCounter = 0;\n var _loop = function _loop(i) {\n _this16.options.transformFile.call(_this16, files[i], function (transformedFile) {\n transformedFiles[i] = transformedFile;\n if (++doneCounter === files.length) {\n done(transformedFiles);\n }\n });\n };\n for (var i = 0; i < files.length; i++) {\n _loop(i);\n }\n } // Takes care of adding other input elements of the form to the AJAX request\n }, {\n key: \"_addFormElementData\",\n value: function _addFormElementData(formData) {\n // Take care of other input elements\n if (this.element.tagName === \"FORM\") {\n var _iterator15 = dropzone_createForOfIteratorHelper(this.element.querySelectorAll(\"input, textarea, select, button\"), true),\n _step15;\n try {\n for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {\n var input = _step15.value;\n var inputName = input.getAttribute(\"name\");\n var inputType = input.getAttribute(\"type\");\n if (inputType) inputType = inputType.toLowerCase(); // If the input doesn't have a name, we can't use it.\n\n if (typeof inputName === \"undefined\" || inputName === null) continue;\n if (input.tagName === \"SELECT\" && input.hasAttribute(\"multiple\")) {\n // Possibly multiple values\n var _iterator16 = dropzone_createForOfIteratorHelper(input.options, true),\n _step16;\n try {\n for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {\n var option = _step16.value;\n if (option.selected) {\n formData.append(inputName, option.value);\n }\n }\n } catch (err) {\n _iterator16.e(err);\n } finally {\n _iterator16.f();\n }\n } else if (!inputType || inputType !== \"checkbox\" && inputType !== \"radio\" || input.checked) {\n formData.append(inputName, input.value);\n }\n }\n } catch (err) {\n _iterator15.e(err);\n } finally {\n _iterator15.f();\n }\n }\n } // Invoked when there is new progress information about given files.\n // If e is not provided, it is assumed that the upload is finished.\n }, {\n key: \"_updateFilesUploadProgress\",\n value: function _updateFilesUploadProgress(files, xhr, e) {\n if (!files[0].upload.chunked) {\n // Handle file uploads without chunking\n var _iterator17 = dropzone_createForOfIteratorHelper(files, true),\n _step17;\n try {\n for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {\n var file = _step17.value;\n if (file.upload.total && file.upload.bytesSent && file.upload.bytesSent == file.upload.total) {\n // If both, the `total` and `bytesSent` have already been set, and\n // they are equal (meaning progress is at 100%), we can skip this\n // file, since an upload progress shouldn't go down.\n continue;\n }\n if (e) {\n file.upload.progress = 100 * e.loaded / e.total;\n file.upload.total = e.total;\n file.upload.bytesSent = e.loaded;\n } else {\n // No event, so we're at 100%\n file.upload.progress = 100;\n file.upload.bytesSent = file.upload.total;\n }\n this.emit(\"uploadprogress\", file, file.upload.progress, file.upload.bytesSent);\n }\n } catch (err) {\n _iterator17.e(err);\n } finally {\n _iterator17.f();\n }\n } else {\n // Handle chunked file uploads\n // Chunked upload is not compatible with uploading multiple files in one\n // request, so we know there's only one file.\n var _file2 = files[0]; // Since this is a chunked upload, we need to update the appropriate chunk\n // progress.\n\n var chunk = this._getChunk(_file2, xhr);\n if (e) {\n chunk.progress = 100 * e.loaded / e.total;\n chunk.total = e.total;\n chunk.bytesSent = e.loaded;\n } else {\n // No event, so we're at 100%\n chunk.progress = 100;\n chunk.bytesSent = chunk.total;\n } // Now tally the *file* upload progress from its individual chunks\n\n _file2.upload.progress = 0;\n _file2.upload.total = 0;\n _file2.upload.bytesSent = 0;\n for (var i = 0; i < _file2.upload.totalChunkCount; i++) {\n if (_file2.upload.chunks[i] && typeof _file2.upload.chunks[i].progress !== \"undefined\") {\n _file2.upload.progress += _file2.upload.chunks[i].progress;\n _file2.upload.total += _file2.upload.chunks[i].total;\n _file2.upload.bytesSent += _file2.upload.chunks[i].bytesSent;\n }\n } // Since the process is a percentage, we need to divide by the amount of\n // chunks we've used.\n\n _file2.upload.progress = _file2.upload.progress / _file2.upload.totalChunkCount;\n this.emit(\"uploadprogress\", _file2, _file2.upload.progress, _file2.upload.bytesSent);\n }\n }\n }, {\n key: \"_finishedUploading\",\n value: function _finishedUploading(files, xhr, e) {\n var response;\n if (files[0].status === Dropzone.CANCELED) {\n return;\n }\n if (xhr.readyState !== 4) {\n return;\n }\n if (xhr.responseType !== \"arraybuffer\" && xhr.responseType !== \"blob\") {\n response = xhr.responseText;\n if (xhr.getResponseHeader(\"content-type\") && ~xhr.getResponseHeader(\"content-type\").indexOf(\"application/json\")) {\n try {\n response = JSON.parse(response);\n } catch (error) {\n e = error;\n response = \"Invalid JSON response from server.\";\n }\n }\n }\n this._updateFilesUploadProgress(files, xhr);\n if (!(200 <= xhr.status && xhr.status < 300)) {\n this._handleUploadError(files, xhr, response);\n } else {\n if (files[0].upload.chunked) {\n files[0].upload.finishedChunkUpload(this._getChunk(files[0], xhr), response);\n } else {\n this._finished(files, response, e);\n }\n }\n }\n }, {\n key: \"_handleUploadError\",\n value: function _handleUploadError(files, xhr, response) {\n if (files[0].status === Dropzone.CANCELED) {\n return;\n }\n if (files[0].upload.chunked && this.options.retryChunks) {\n var chunk = this._getChunk(files[0], xhr);\n if (chunk.retries++ < this.options.retryChunksLimit) {\n this._uploadData(files, [chunk.dataBlock]);\n return;\n } else {\n console.warn(\"Retried this chunk too often. Giving up.\");\n }\n }\n this._errorProcessing(files, response || this.options.dictResponseError.replace(\"{{statusCode}}\", xhr.status), xhr);\n }\n }, {\n key: \"submitRequest\",\n value: function submitRequest(xhr, formData, files) {\n if (xhr.readyState != 1) {\n console.warn(\"Cannot send this request because the XMLHttpRequest.readyState is not OPENED.\");\n return;\n }\n xhr.send(formData);\n } // Called internally when processing is finished.\n // Individual callbacks have to be called in the appropriate sections.\n }, {\n key: \"_finished\",\n value: function _finished(files, responseText, e) {\n var _iterator18 = dropzone_createForOfIteratorHelper(files, true),\n _step18;\n try {\n for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {\n var file = _step18.value;\n file.status = Dropzone.SUCCESS;\n this.emit(\"success\", file, responseText, e);\n this.emit(\"complete\", file);\n }\n } catch (err) {\n _iterator18.e(err);\n } finally {\n _iterator18.f();\n }\n if (this.options.uploadMultiple) {\n this.emit(\"successmultiple\", files, responseText, e);\n this.emit(\"completemultiple\", files);\n }\n if (this.options.autoProcessQueue) {\n return this.processQueue();\n }\n } // Called internally when processing is finished.\n // Individual callbacks have to be called in the appropriate sections.\n }, {\n key: \"_errorProcessing\",\n value: function _errorProcessing(files, message, xhr) {\n var _iterator19 = dropzone_createForOfIteratorHelper(files, true),\n _step19;\n try {\n for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {\n var file = _step19.value;\n file.status = Dropzone.ERROR;\n this.emit(\"error\", file, message, xhr);\n this.emit(\"complete\", file);\n }\n } catch (err) {\n _iterator19.e(err);\n } finally {\n _iterator19.f();\n }\n if (this.options.uploadMultiple) {\n this.emit(\"errormultiple\", files, message, xhr);\n this.emit(\"completemultiple\", files);\n }\n if (this.options.autoProcessQueue) {\n return this.processQueue();\n }\n }\n }], [{\n key: \"initClass\",\n value: function initClass() {\n // Exposing the emitter class, mainly for tests\n this.prototype.Emitter = Emitter;\n /*\n This is a list of all available events you can register on a dropzone object.\n You can register an event handler like this:\n dropzone.on(\"dragEnter\", function() { });\n */\n\n this.prototype.events = [\"drop\", \"dragstart\", \"dragend\", \"dragenter\", \"dragover\", \"dragleave\", \"addedfile\", \"addedfiles\", \"removedfile\", \"thumbnail\", \"error\", \"errormultiple\", \"processing\", \"processingmultiple\", \"uploadprogress\", \"totaluploadprogress\", \"sending\", \"sendingmultiple\", \"success\", \"successmultiple\", \"canceled\", \"canceledmultiple\", \"complete\", \"completemultiple\", \"reset\", \"maxfilesexceeded\", \"maxfilesreached\", \"queuecomplete\"];\n this.prototype._thumbnailQueue = [];\n this.prototype._processingThumbnail = false;\n } // global utility\n }, {\n key: \"extend\",\n value: function extend(target) {\n for (var _len2 = arguments.length, objects = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n objects[_key2 - 1] = arguments[_key2];\n }\n for (var _i4 = 0, _objects = objects; _i4 < _objects.length; _i4++) {\n var object = _objects[_i4];\n for (var key in object) {\n var val = object[key];\n target[key] = val;\n }\n }\n return target;\n }\n }, {\n key: \"uuidv4\",\n value: function uuidv4() {\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, function (c) {\n var r = Math.random() * 16 | 0,\n v = c === \"x\" ? r : r & 0x3 | 0x8;\n return v.toString(16);\n });\n }\n }]);\n return Dropzone;\n }(Emitter);\n _Dropzone.initClass();\n _Dropzone.version = \"5.9.3\"; // This is a map of options for your different dropzones. Add configurations\n // to this object for your different dropzone elemens.\n //\n // Example:\n //\n // Dropzone.options.myDropzoneElementId = { maxFilesize: 1 };\n //\n // To disable autoDiscover for a specific element, you can set `false` as an option:\n //\n // Dropzone.options.myDisabledElementId = false;\n //\n // And in html:\n //\n // \n\n _Dropzone.options = {}; // Returns the options for an element or undefined if none available.\n\n _Dropzone.optionsForElement = function (element) {\n // Get the `Dropzone.options.elementId` for this element if it exists\n if (element.getAttribute(\"id\")) {\n return _Dropzone.options[camelize(element.getAttribute(\"id\"))];\n } else {\n return undefined;\n }\n }; // Holds a list of all dropzone instances\n\n _Dropzone.instances = []; // Returns the dropzone for given element if any\n\n _Dropzone.forElement = function (element) {\n if (typeof element === \"string\") {\n element = document.querySelector(element);\n }\n if ((element != null ? element.dropzone : undefined) == null) {\n throw new Error(\"No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.\");\n }\n return element.dropzone;\n }; // Set to false if you don't want Dropzone to automatically find and attach to .dropzone elements.\n\n _Dropzone.autoDiscover = true; // Looks for all .dropzone elements and creates a dropzone for them\n\n _Dropzone.discover = function () {\n var dropzones;\n if (document.querySelectorAll) {\n dropzones = document.querySelectorAll(\".dropzone\");\n } else {\n dropzones = []; // IE :(\n\n var checkElements = function checkElements(elements) {\n return function () {\n var result = [];\n var _iterator20 = dropzone_createForOfIteratorHelper(elements, true),\n _step20;\n try {\n for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {\n var el = _step20.value;\n if (/(^| )dropzone($| )/.test(el.className)) {\n result.push(dropzones.push(el));\n } else {\n result.push(undefined);\n }\n }\n } catch (err) {\n _iterator20.e(err);\n } finally {\n _iterator20.f();\n }\n return result;\n }();\n };\n checkElements(document.getElementsByTagName(\"div\"));\n checkElements(document.getElementsByTagName(\"form\"));\n }\n return function () {\n var result = [];\n var _iterator21 = dropzone_createForOfIteratorHelper(dropzones, true),\n _step21;\n try {\n for (_iterator21.s(); !(_step21 = _iterator21.n()).done;) {\n var dropzone = _step21.value;\n\n // Create a dropzone unless auto discover has been disabled for specific element\n if (_Dropzone.optionsForElement(dropzone) !== false) {\n result.push(new _Dropzone(dropzone));\n } else {\n result.push(undefined);\n }\n }\n } catch (err) {\n _iterator21.e(err);\n } finally {\n _iterator21.f();\n }\n return result;\n }();\n }; // Some browsers support drag and drog functionality, but not correctly.\n //\n // So I created a blocklist of userAgents. Yes, yes. Browser sniffing, I know.\n // But what to do when browsers *theoretically* support an API, but crash\n // when using it.\n //\n // This is a list of regular expressions tested against navigator.userAgent\n //\n // ** It should only be used on browser that *do* support the API, but\n // incorrectly **\n\n _Dropzone.blockedBrowsers = [\n // The mac os and windows phone version of opera 12 seems to have a problem with the File drag'n'drop API.\n /opera.*(Macintosh|Windows Phone).*version\\/12/i]; // Checks if the browser is supported\n\n _Dropzone.isBrowserSupported = function () {\n var capableBrowser = true;\n if (window.File && window.FileReader && window.FileList && window.Blob && window.FormData && document.querySelector) {\n if (!(\"classList\" in document.createElement(\"a\"))) {\n capableBrowser = false;\n } else {\n if (_Dropzone.blacklistedBrowsers !== undefined) {\n // Since this has been renamed, this makes sure we don't break older\n // configuration.\n _Dropzone.blockedBrowsers = _Dropzone.blacklistedBrowsers;\n } // The browser supports the API, but may be blocked.\n\n var _iterator22 = dropzone_createForOfIteratorHelper(_Dropzone.blockedBrowsers, true),\n _step22;\n try {\n for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) {\n var regex = _step22.value;\n if (regex.test(navigator.userAgent)) {\n capableBrowser = false;\n continue;\n }\n }\n } catch (err) {\n _iterator22.e(err);\n } finally {\n _iterator22.f();\n }\n }\n } else {\n capableBrowser = false;\n }\n return capableBrowser;\n };\n _Dropzone.dataURItoBlob = function (dataURI) {\n // convert base64 to raw binary data held in a string\n // doesn't handle URLEncoded DataURIs - see SO answer #6850276 for code that does this\n var byteString = atob(dataURI.split(\",\")[1]); // separate out the mime component\n\n var mimeString = dataURI.split(\",\")[0].split(\":\")[1].split(\";\")[0]; // write the bytes of the string to an ArrayBuffer\n\n var ab = new ArrayBuffer(byteString.length);\n var ia = new Uint8Array(ab);\n for (var i = 0, end = byteString.length, asc = 0 <= end; asc ? i <= end : i >= end; asc ? i++ : i--) {\n ia[i] = byteString.charCodeAt(i);\n } // write the ArrayBuffer to a blob\n\n return new Blob([ab], {\n type: mimeString\n });\n }; // Returns an array without the rejected item\n\n var without = function without(list, rejectedItem) {\n return list.filter(function (item) {\n return item !== rejectedItem;\n }).map(function (item) {\n return item;\n });\n }; // abc-def_ghi -> abcDefGhi\n\n var camelize = function camelize(str) {\n return str.replace(/[\\-_](\\w)/g, function (match) {\n return match.charAt(1).toUpperCase();\n });\n }; // Creates an element from string\n\n _Dropzone.createElement = function (string) {\n var div = document.createElement(\"div\");\n div.innerHTML = string;\n return div.childNodes[0];\n }; // Tests if given element is inside (or simply is) the container\n\n _Dropzone.elementInside = function (element, container) {\n if (element === container) {\n return true;\n } // Coffeescript doesn't support do/while loops\n\n while (element = element.parentNode) {\n if (element === container) {\n return true;\n }\n }\n return false;\n };\n _Dropzone.getElement = function (el, name) {\n var element;\n if (typeof el === \"string\") {\n element = document.querySelector(el);\n } else if (el.nodeType != null) {\n element = el;\n }\n if (element == null) {\n throw new Error(\"Invalid `\".concat(name, \"` option provided. Please provide a CSS selector or a plain HTML element.\"));\n }\n return element;\n };\n _Dropzone.getElements = function (els, name) {\n var el, elements;\n if (els instanceof Array) {\n elements = [];\n try {\n var _iterator23 = dropzone_createForOfIteratorHelper(els, true),\n _step23;\n try {\n for (_iterator23.s(); !(_step23 = _iterator23.n()).done;) {\n el = _step23.value;\n elements.push(this.getElement(el, name));\n }\n } catch (err) {\n _iterator23.e(err);\n } finally {\n _iterator23.f();\n }\n } catch (e) {\n elements = null;\n }\n } else if (typeof els === \"string\") {\n elements = [];\n var _iterator24 = dropzone_createForOfIteratorHelper(document.querySelectorAll(els), true),\n _step24;\n try {\n for (_iterator24.s(); !(_step24 = _iterator24.n()).done;) {\n el = _step24.value;\n elements.push(el);\n }\n } catch (err) {\n _iterator24.e(err);\n } finally {\n _iterator24.f();\n }\n } else if (els.nodeType != null) {\n elements = [els];\n }\n if (elements == null || !elements.length) {\n throw new Error(\"Invalid `\".concat(name, \"` option provided. Please provide a CSS selector, a plain HTML element or a list of those.\"));\n }\n return elements;\n }; // Asks the user the question and calls accepted or rejected accordingly\n //\n // The default implementation just uses `window.confirm` and then calls the\n // appropriate callback.\n\n _Dropzone.confirm = function (question, accepted, rejected) {\n if (window.confirm(question)) {\n return accepted();\n } else if (rejected != null) {\n return rejected();\n }\n }; // Validates the mime type like this:\n //\n // https://developer.mozilla.org/en-US/docs/HTML/Element/input#attr-accept\n\n _Dropzone.isValidFile = function (file, acceptedFiles) {\n if (!acceptedFiles) {\n return true;\n } // If there are no accepted mime types, it's OK\n\n acceptedFiles = acceptedFiles.split(\",\");\n var mimeType = file.type;\n var baseMimeType = mimeType.replace(/\\/.*$/, \"\");\n var _iterator25 = dropzone_createForOfIteratorHelper(acceptedFiles, true),\n _step25;\n try {\n for (_iterator25.s(); !(_step25 = _iterator25.n()).done;) {\n var validType = _step25.value;\n validType = validType.trim();\n if (validType.charAt(0) === \".\") {\n if (file.name.toLowerCase().indexOf(validType.toLowerCase(), file.name.length - validType.length) !== -1) {\n return true;\n }\n } else if (/\\/\\*$/.test(validType)) {\n // This is something like a image/* mime type\n if (baseMimeType === validType.replace(/\\/.*$/, \"\")) {\n return true;\n }\n } else {\n if (mimeType === validType) {\n return true;\n }\n }\n }\n } catch (err) {\n _iterator25.e(err);\n } finally {\n _iterator25.f();\n }\n return false;\n }; // Augment jQuery\n\n if (typeof jQuery !== \"undefined\" && jQuery !== null) {\n jQuery.fn.dropzone = function (options) {\n return this.each(function () {\n return new _Dropzone(this, options);\n });\n };\n } // Dropzone file status codes\n\n _Dropzone.ADDED = \"added\";\n _Dropzone.QUEUED = \"queued\"; // For backwards compatibility. Now, if a file is accepted, it's either queued\n // or uploading.\n\n _Dropzone.ACCEPTED = _Dropzone.QUEUED;\n _Dropzone.UPLOADING = \"uploading\";\n _Dropzone.PROCESSING = _Dropzone.UPLOADING; // alias\n\n _Dropzone.CANCELED = \"canceled\";\n _Dropzone.ERROR = \"error\";\n _Dropzone.SUCCESS = \"success\";\n /*\n \n Bugfix for iOS 6 and 7\n Source: http://stackoverflow.com/questions/11929099/html5-canvas-drawimage-ratio-bug-ios\n based on the work of https://github.com/stomita/ios-imagefile-megapixel\n \n */\n // Detecting vertical squash in loaded image.\n // Fixes a bug which squash image vertically while drawing into canvas for some images.\n // This is a bug in iOS6 devices. This function from https://github.com/stomita/ios-imagefile-megapixel\n\n var detectVerticalSquash = function detectVerticalSquash(img) {\n var iw = img.naturalWidth;\n var ih = img.naturalHeight;\n var canvas = document.createElement(\"canvas\");\n canvas.width = 1;\n canvas.height = ih;\n var ctx = canvas.getContext(\"2d\");\n ctx.drawImage(img, 0, 0);\n var _ctx$getImageData = ctx.getImageData(1, 0, 1, ih),\n data = _ctx$getImageData.data; // search image edge pixel position in case it is squashed vertically.\n\n var sy = 0;\n var ey = ih;\n var py = ih;\n while (py > sy) {\n var alpha = data[(py - 1) * 4 + 3];\n if (alpha === 0) {\n ey = py;\n } else {\n sy = py;\n }\n py = ey + sy >> 1;\n }\n var ratio = py / ih;\n if (ratio === 0) {\n return 1;\n } else {\n return ratio;\n }\n }; // A replacement for context.drawImage\n // (args are for source and destination).\n\n var drawImageIOSFix = function drawImageIOSFix(ctx, img, sx, sy, sw, sh, dx, dy, dw, dh) {\n var vertSquashRatio = detectVerticalSquash(img);\n return ctx.drawImage(img, sx, sy, sw, sh, dx, dy, dw, dh / vertSquashRatio);\n }; // Based on MinifyJpeg\n // Source: http://www.perry.cz/files/ExifRestorer.js\n // http://elicon.blog57.fc2.com/blog-entry-206.html\n\n var ExifRestore = /*#__PURE__*/function () {\n function ExifRestore() {\n dropzone_classCallCheck(this, ExifRestore);\n }\n dropzone_createClass(ExifRestore, null, [{\n key: \"initClass\",\n value: function initClass() {\n this.KEY_STR = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n }\n }, {\n key: \"encode64\",\n value: function encode64(input) {\n var output = \"\";\n var chr1 = undefined;\n var chr2 = undefined;\n var chr3 = \"\";\n var enc1 = undefined;\n var enc2 = undefined;\n var enc3 = undefined;\n var enc4 = \"\";\n var i = 0;\n while (true) {\n chr1 = input[i++];\n chr2 = input[i++];\n chr3 = input[i++];\n enc1 = chr1 >> 2;\n enc2 = (chr1 & 3) << 4 | chr2 >> 4;\n enc3 = (chr2 & 15) << 2 | chr3 >> 6;\n enc4 = chr3 & 63;\n if (isNaN(chr2)) {\n enc3 = enc4 = 64;\n } else if (isNaN(chr3)) {\n enc4 = 64;\n }\n output = output + this.KEY_STR.charAt(enc1) + this.KEY_STR.charAt(enc2) + this.KEY_STR.charAt(enc3) + this.KEY_STR.charAt(enc4);\n chr1 = chr2 = chr3 = \"\";\n enc1 = enc2 = enc3 = enc4 = \"\";\n if (!(i < input.length)) {\n break;\n }\n }\n return output;\n }\n }, {\n key: \"restore\",\n value: function restore(origFileBase64, resizedFileBase64) {\n if (!origFileBase64.match(\"data:image/jpeg;base64,\")) {\n return resizedFileBase64;\n }\n var rawImage = this.decode64(origFileBase64.replace(\"data:image/jpeg;base64,\", \"\"));\n var segments = this.slice2Segments(rawImage);\n var image = this.exifManipulation(resizedFileBase64, segments);\n return \"data:image/jpeg;base64,\".concat(this.encode64(image));\n }\n }, {\n key: \"exifManipulation\",\n value: function exifManipulation(resizedFileBase64, segments) {\n var exifArray = this.getExifArray(segments);\n var newImageArray = this.insertExif(resizedFileBase64, exifArray);\n var aBuffer = new Uint8Array(newImageArray);\n return aBuffer;\n }\n }, {\n key: \"getExifArray\",\n value: function getExifArray(segments) {\n var seg = undefined;\n var x = 0;\n while (x < segments.length) {\n seg = segments[x];\n if (seg[0] === 255 & seg[1] === 225) {\n return seg;\n }\n x++;\n }\n return [];\n }\n }, {\n key: \"insertExif\",\n value: function insertExif(resizedFileBase64, exifArray) {\n var imageData = resizedFileBase64.replace(\"data:image/jpeg;base64,\", \"\");\n var buf = this.decode64(imageData);\n var separatePoint = buf.indexOf(255, 3);\n var mae = buf.slice(0, separatePoint);\n var ato = buf.slice(separatePoint);\n var array = mae;\n array = array.concat(exifArray);\n array = array.concat(ato);\n return array;\n }\n }, {\n key: \"slice2Segments\",\n value: function slice2Segments(rawImageArray) {\n var head = 0;\n var segments = [];\n while (true) {\n var length;\n if (rawImageArray[head] === 255 & rawImageArray[head + 1] === 218) {\n break;\n }\n if (rawImageArray[head] === 255 & rawImageArray[head + 1] === 216) {\n head += 2;\n } else {\n length = rawImageArray[head + 2] * 256 + rawImageArray[head + 3];\n var endPoint = head + length + 2;\n var seg = rawImageArray.slice(head, endPoint);\n segments.push(seg);\n head = endPoint;\n }\n if (head > rawImageArray.length) {\n break;\n }\n }\n return segments;\n }\n }, {\n key: \"decode64\",\n value: function decode64(input) {\n var output = \"\";\n var chr1 = undefined;\n var chr2 = undefined;\n var chr3 = \"\";\n var enc1 = undefined;\n var enc2 = undefined;\n var enc3 = undefined;\n var enc4 = \"\";\n var i = 0;\n var buf = []; // remove all characters that are not A-Z, a-z, 0-9, +, /, or =\n\n var base64test = /[^A-Za-z0-9\\+\\/\\=]/g;\n if (base64test.exec(input)) {\n console.warn(\"There were invalid base64 characters in the input text.\\nValid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\\nExpect errors in decoding.\");\n }\n input = input.replace(/[^A-Za-z0-9\\+\\/\\=]/g, \"\");\n while (true) {\n enc1 = this.KEY_STR.indexOf(input.charAt(i++));\n enc2 = this.KEY_STR.indexOf(input.charAt(i++));\n enc3 = this.KEY_STR.indexOf(input.charAt(i++));\n enc4 = this.KEY_STR.indexOf(input.charAt(i++));\n chr1 = enc1 << 2 | enc2 >> 4;\n chr2 = (enc2 & 15) << 4 | enc3 >> 2;\n chr3 = (enc3 & 3) << 6 | enc4;\n buf.push(chr1);\n if (enc3 !== 64) {\n buf.push(chr2);\n }\n if (enc4 !== 64) {\n buf.push(chr3);\n }\n chr1 = chr2 = chr3 = \"\";\n enc1 = enc2 = enc3 = enc4 = \"\";\n if (!(i < input.length)) {\n break;\n }\n }\n return buf;\n }\n }]);\n return ExifRestore;\n }();\n ExifRestore.initClass();\n /*\n * contentloaded.js\n *\n * Author: Diego Perini (diego.perini at gmail.com)\n * Summary: cross-browser wrapper for DOMContentLoaded\n * Updated: 20101020\n * License: MIT\n * Version: 1.2\n *\n * URL:\n * http://javascript.nwbox.com/ContentLoaded/\n * http://javascript.nwbox.com/ContentLoaded/MIT-LICENSE\n */\n // @win window reference\n // @fn function reference\n\n var contentLoaded = function contentLoaded(win, fn) {\n var done = false;\n var top = true;\n var doc = win.document;\n var root = doc.documentElement;\n var add = doc.addEventListener ? \"addEventListener\" : \"attachEvent\";\n var rem = doc.addEventListener ? \"removeEventListener\" : \"detachEvent\";\n var pre = doc.addEventListener ? \"\" : \"on\";\n var init = function init(e) {\n if (e.type === \"readystatechange\" && doc.readyState !== \"complete\") {\n return;\n }\n (e.type === \"load\" ? win : doc)[rem](pre + e.type, init, false);\n if (!done && (done = true)) {\n return fn.call(win, e.type || e);\n }\n };\n var poll = function poll() {\n try {\n root.doScroll(\"left\");\n } catch (e) {\n setTimeout(poll, 50);\n return;\n }\n return init(\"poll\");\n };\n if (doc.readyState !== \"complete\") {\n if (doc.createEventObject && root.doScroll) {\n try {\n top = !win.frameElement;\n } catch (error) {}\n if (top) {\n poll();\n }\n }\n doc[add](pre + \"DOMContentLoaded\", init, false);\n doc[add](pre + \"readystatechange\", init, false);\n return win[add](pre + \"load\", init, false);\n }\n }; // As a single function to be able to write tests.\n\n _Dropzone._autoDiscoverFunction = function () {\n if (_Dropzone.autoDiscover) {\n return _Dropzone.discover();\n }\n };\n contentLoaded(window, _Dropzone._autoDiscoverFunction);\n function __guard__(value, transform) {\n return typeof value !== \"undefined\" && value !== null ? transform(value) : undefined;\n }\n function __guardMethod__(obj, methodName, transform) {\n if (typeof obj !== \"undefined\" && obj !== null && typeof obj[methodName] === \"function\") {\n return transform(obj, methodName);\n } else {\n return undefined;\n }\n }\n ; // CONCATENATED MODULE: ./tool/dropzone.dist.js\n /// Make Dropzone a global variable.\n\n window.Dropzone = _Dropzone;\n /* harmony default export */\n var dropzone_dist = _Dropzone;\n }();\n /******/\n return __webpack_exports__;\n /******/\n }();\n});","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\n/*!\n * Masonry v4.2.2\n * Cascading grid layout library\n * https://masonry.desandro.com\n * MIT License\n * by David DeSandro\n */\n\n(function (window, factory) {\n // universal module definition\n /* jshint strict: false */ /*globals define, module, require */\n if (typeof define == 'function' && define.amd) {\n // AMD\n define(['outlayer/outlayer', 'get-size/get-size'], factory);\n } else if ((typeof module === \"undefined\" ? \"undefined\" : _typeof(module)) == 'object' && module.exports) {\n // CommonJS\n module.exports = factory(require('outlayer'), require('get-size'));\n } else {\n // browser global\n window.Masonry = factory(window.Outlayer, window.getSize);\n }\n})(window, function factory(Outlayer, getSize) {\n 'use strict';\n\n // -------------------------- masonryDefinition -------------------------- //\n\n // create an Outlayer layout class\n var Masonry = Outlayer.create('masonry');\n // isFitWidth -> fitWidth\n Masonry.compatOptions.fitWidth = 'isFitWidth';\n var proto = Masonry.prototype;\n proto._resetLayout = function () {\n this.getSize();\n this._getMeasurement('columnWidth', 'outerWidth');\n this._getMeasurement('gutter', 'outerWidth');\n this.measureColumns();\n\n // reset column Y\n this.colYs = [];\n for (var i = 0; i < this.cols; i++) {\n this.colYs.push(0);\n }\n this.maxY = 0;\n this.horizontalColIndex = 0;\n };\n proto.measureColumns = function () {\n this.getContainerWidth();\n // if columnWidth is 0, default to outerWidth of first item\n if (!this.columnWidth) {\n var firstItem = this.items[0];\n var firstItemElem = firstItem && firstItem.element;\n // columnWidth fall back to item of first element\n this.columnWidth = firstItemElem && getSize(firstItemElem).outerWidth ||\n // if first elem has no width, default to size of container\n this.containerWidth;\n }\n var columnWidth = this.columnWidth += this.gutter;\n\n // calculate columns\n var containerWidth = this.containerWidth + this.gutter;\n var cols = containerWidth / columnWidth;\n // fix rounding errors, typically with gutters\n var excess = columnWidth - containerWidth % columnWidth;\n // if overshoot is less than a pixel, round up, otherwise floor it\n var mathMethod = excess && excess < 1 ? 'round' : 'floor';\n cols = Math[mathMethod](cols);\n this.cols = Math.max(cols, 1);\n };\n proto.getContainerWidth = function () {\n // container is parent if fit width\n var isFitWidth = this._getOption('fitWidth');\n var container = isFitWidth ? this.element.parentNode : this.element;\n // check that this.size and size are there\n // IE8 triggers resize on body size change, so they might not be\n var size = getSize(container);\n this.containerWidth = size && size.innerWidth;\n };\n proto._getItemLayoutPosition = function (item) {\n item.getSize();\n // how many columns does this brick span\n var remainder = item.size.outerWidth % this.columnWidth;\n var mathMethod = remainder && remainder < 1 ? 'round' : 'ceil';\n // round if off by 1 pixel, otherwise use ceil\n var colSpan = Math[mathMethod](item.size.outerWidth / this.columnWidth);\n colSpan = Math.min(colSpan, this.cols);\n // use horizontal or top column position\n var colPosMethod = this.options.horizontalOrder ? '_getHorizontalColPosition' : '_getTopColPosition';\n var colPosition = this[colPosMethod](colSpan, item);\n // position the brick\n var position = {\n x: this.columnWidth * colPosition.col,\n y: colPosition.y\n };\n // apply setHeight to necessary columns\n var setHeight = colPosition.y + item.size.outerHeight;\n var setMax = colSpan + colPosition.col;\n for (var i = colPosition.col; i < setMax; i++) {\n this.colYs[i] = setHeight;\n }\n return position;\n };\n proto._getTopColPosition = function (colSpan) {\n var colGroup = this._getTopColGroup(colSpan);\n // get the minimum Y value from the columns\n var minimumY = Math.min.apply(Math, colGroup);\n return {\n col: colGroup.indexOf(minimumY),\n y: minimumY\n };\n };\n\n /**\n * @param {Number} colSpan - number of columns the element spans\n * @returns {Array} colGroup\n */\n proto._getTopColGroup = function (colSpan) {\n if (colSpan < 2) {\n // if brick spans only one column, use all the column Ys\n return this.colYs;\n }\n var colGroup = [];\n // how many different places could this brick fit horizontally\n var groupCount = this.cols + 1 - colSpan;\n // for each group potential horizontal position\n for (var i = 0; i < groupCount; i++) {\n colGroup[i] = this._getColGroupY(i, colSpan);\n }\n return colGroup;\n };\n proto._getColGroupY = function (col, colSpan) {\n if (colSpan < 2) {\n return this.colYs[col];\n }\n // make an array of colY values for that one group\n var groupColYs = this.colYs.slice(col, col + colSpan);\n // and get the max value of the array\n return Math.max.apply(Math, groupColYs);\n };\n\n // get column position based on horizontal index. #873\n proto._getHorizontalColPosition = function (colSpan, item) {\n var col = this.horizontalColIndex % this.cols;\n var isOver = colSpan > 1 && col + colSpan > this.cols;\n // shift to next row if item can't fit on current row\n col = isOver ? 0 : col;\n // don't let zero-size items take up space\n var hasSize = item.size.outerWidth && item.size.outerHeight;\n this.horizontalColIndex = hasSize ? col + colSpan : this.horizontalColIndex;\n return {\n col: col,\n y: this._getColGroupY(col, colSpan)\n };\n };\n proto._manageStamp = function (stamp) {\n var stampSize = getSize(stamp);\n var offset = this._getElementOffset(stamp);\n // get the columns that this stamp affects\n var isOriginLeft = this._getOption('originLeft');\n var firstX = isOriginLeft ? offset.left : offset.right;\n var lastX = firstX + stampSize.outerWidth;\n var firstCol = Math.floor(firstX / this.columnWidth);\n firstCol = Math.max(0, firstCol);\n var lastCol = Math.floor(lastX / this.columnWidth);\n // lastCol should not go over if multiple of columnWidth #425\n lastCol -= lastX % this.columnWidth ? 0 : 1;\n lastCol = Math.min(this.cols - 1, lastCol);\n // set colYs to bottom of the stamp\n\n var isOriginTop = this._getOption('originTop');\n var stampMaxY = (isOriginTop ? offset.top : offset.bottom) + stampSize.outerHeight;\n for (var i = firstCol; i <= lastCol; i++) {\n this.colYs[i] = Math.max(stampMaxY, this.colYs[i]);\n }\n };\n proto._getContainerSize = function () {\n this.maxY = Math.max.apply(Math, this.colYs);\n var size = {\n height: this.maxY\n };\n if (this._getOption('fitWidth')) {\n size.width = this._getContainerFitWidth();\n }\n return size;\n };\n proto._getContainerFitWidth = function () {\n var unusedCols = 0;\n // count unused columns\n var i = this.cols;\n while (--i) {\n if (this.colYs[i] !== 0) {\n break;\n }\n unusedCols++;\n }\n // fit container to columns that have been used\n return (this.cols - unusedCols) * this.columnWidth - this.gutter;\n };\n proto.needsResizeLayout = function () {\n var previousWidth = this.containerWidth;\n this.getContainerWidth();\n return previousWidth != this.containerWidth;\n };\n return Masonry;\n});","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\n/*!\n * \n * litepicker.umd.js\n * Litepicker v2.0.12 (https://github.com/wakirin/Litepicker)\n * Package: litepicker (https://www.npmjs.com/package/litepicker)\n * License: MIT (https://github.com/wakirin/Litepicker/blob/master/LICENCE.md)\n * Copyright 2019-2021 Rinat G.\n * \n * Hash: 504eef9c08cb42543660\n * \n */\n!function (t, e) {\n \"object\" == (typeof exports === \"undefined\" ? \"undefined\" : _typeof(exports)) && \"object\" == (typeof module === \"undefined\" ? \"undefined\" : _typeof(module)) ? module.exports = e() : \"function\" == typeof define && define.amd ? define(\"Litepicker\", [], e) : \"object\" == (typeof exports === \"undefined\" ? \"undefined\" : _typeof(exports)) ? exports.Litepicker = e() : t.Litepicker = e();\n}(window, function () {\n return function (t) {\n var e = {};\n function i(n) {\n if (e[n]) return e[n].exports;\n var o = e[n] = {\n i: n,\n l: !1,\n exports: {}\n };\n return t[n].call(o.exports, o, o.exports, i), o.l = !0, o.exports;\n }\n return i.m = t, i.c = e, i.d = function (t, e, n) {\n i.o(t, e) || Object.defineProperty(t, e, {\n enumerable: !0,\n get: n\n });\n }, i.r = function (t) {\n \"undefined\" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t, Symbol.toStringTag, {\n value: \"Module\"\n }), Object.defineProperty(t, \"__esModule\", {\n value: !0\n });\n }, i.t = function (t, e) {\n if (1 & e && (t = i(t)), 8 & e) return t;\n if (4 & e && \"object\" == _typeof(t) && t && t.__esModule) return t;\n var n = Object.create(null);\n if (i.r(n), Object.defineProperty(n, \"default\", {\n enumerable: !0,\n value: t\n }), 2 & e && \"string\" != typeof t) for (var o in t) i.d(n, o, function (e) {\n return t[e];\n }.bind(null, o));\n return n;\n }, i.n = function (t) {\n var e = t && t.__esModule ? function () {\n return t[\"default\"];\n } : function () {\n return t;\n };\n return i.d(e, \"a\", e), e;\n }, i.o = function (t, e) {\n return Object.prototype.hasOwnProperty.call(t, e);\n }, i.p = \"\", i(i.s = 4);\n }([function (t, e, i) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n });\n var n = function () {\n function t(e, i, n) {\n void 0 === e && (e = null), void 0 === i && (i = null), void 0 === n && (n = \"en-US\"), this.dateInstance = \"object\" == _typeof(i) && null !== i ? i.parse(e instanceof t ? e.clone().toJSDate() : e) : \"string\" == typeof i ? t.parseDateTime(e, i, n) : e ? t.parseDateTime(e) : t.parseDateTime(new Date()), this.lang = n;\n }\n return t.parseDateTime = function (e, i, n) {\n if (void 0 === i && (i = \"YYYY-MM-DD\"), void 0 === n && (n = \"en-US\"), !e) return new Date(NaN);\n if (e instanceof Date) return new Date(e);\n if (e instanceof t) return e.clone().toJSDate();\n if (/^-?\\d{10,}$/.test(e)) return t.getDateZeroTime(new Date(Number(e)));\n if (\"string\" == typeof e) {\n for (var o = [], s = null; null != (s = t.regex.exec(i));) \"\\\\\" !== s[1] && o.push(s);\n if (o.length) {\n var r = {\n year: null,\n month: null,\n shortMonth: null,\n longMonth: null,\n day: null,\n value: \"\"\n };\n o[0].index > 0 && (r.value += \".*?\");\n for (var a = 0, l = Object.entries(o); a < l.length; a++) {\n var c = l[a],\n h = c[0],\n p = c[1],\n d = Number(h),\n u = t.formatPatterns(p[0], n),\n m = u.group,\n f = u.pattern;\n r[m] = d + 1, r.value += f, r.value += \".*?\";\n }\n var g = new RegExp(\"^\" + r.value + \"$\");\n if (g.test(e)) {\n var v = g.exec(e),\n y = Number(v[r.year]),\n b = null;\n r.month ? b = Number(v[r.month]) - 1 : r.shortMonth ? b = t.shortMonths(n).indexOf(v[r.shortMonth]) : r.longMonth && (b = t.longMonths(n).indexOf(v[r.longMonth]));\n var k = Number(v[r.day]) || 1;\n return new Date(y, b, k, 0, 0, 0, 0);\n }\n }\n }\n return t.getDateZeroTime(new Date(e));\n }, t.convertArray = function (e, i) {\n return e.map(function (e) {\n return e instanceof Array ? e.map(function (e) {\n return new t(e, i);\n }) : new t(e, i);\n });\n }, t.getDateZeroTime = function (t) {\n return new Date(t.getFullYear(), t.getMonth(), t.getDate(), 0, 0, 0, 0);\n }, t.shortMonths = function (e) {\n return t.MONTH_JS.map(function (t) {\n return new Date(2019, t).toLocaleString(e, {\n month: \"short\"\n });\n });\n }, t.longMonths = function (e) {\n return t.MONTH_JS.map(function (t) {\n return new Date(2019, t).toLocaleString(e, {\n month: \"long\"\n });\n });\n }, t.formatPatterns = function (e, i) {\n switch (e) {\n case \"YY\":\n case \"YYYY\":\n return {\n group: \"year\",\n pattern: \"(\\\\d{\" + e.length + \"})\"\n };\n case \"M\":\n return {\n group: \"month\",\n pattern: \"(\\\\d{1,2})\"\n };\n case \"MM\":\n return {\n group: \"month\",\n pattern: \"(\\\\d{2})\"\n };\n case \"MMM\":\n return {\n group: \"shortMonth\",\n pattern: \"(\" + t.shortMonths(i).join(\"|\") + \")\"\n };\n case \"MMMM\":\n return {\n group: \"longMonth\",\n pattern: \"(\" + t.longMonths(i).join(\"|\") + \")\"\n };\n case \"D\":\n return {\n group: \"day\",\n pattern: \"(\\\\d{1,2})\"\n };\n case \"DD\":\n return {\n group: \"day\",\n pattern: \"(\\\\d{2})\"\n };\n }\n }, t.prototype.toJSDate = function () {\n return this.dateInstance;\n }, t.prototype.toLocaleString = function (t, e) {\n return this.dateInstance.toLocaleString(t, e);\n }, t.prototype.toDateString = function () {\n return this.dateInstance.toDateString();\n }, t.prototype.getSeconds = function () {\n return this.dateInstance.getSeconds();\n }, t.prototype.getDay = function () {\n return this.dateInstance.getDay();\n }, t.prototype.getTime = function () {\n return this.dateInstance.getTime();\n }, t.prototype.getDate = function () {\n return this.dateInstance.getDate();\n }, t.prototype.getMonth = function () {\n return this.dateInstance.getMonth();\n }, t.prototype.getFullYear = function () {\n return this.dateInstance.getFullYear();\n }, t.prototype.setMonth = function (t) {\n return this.dateInstance.setMonth(t);\n }, t.prototype.setHours = function (t, e, i, n) {\n void 0 === t && (t = 0), void 0 === e && (e = 0), void 0 === i && (i = 0), void 0 === n && (n = 0), this.dateInstance.setHours(t, e, i, n);\n }, t.prototype.setSeconds = function (t) {\n return this.dateInstance.setSeconds(t);\n }, t.prototype.setDate = function (t) {\n return this.dateInstance.setDate(t);\n }, t.prototype.setFullYear = function (t) {\n return this.dateInstance.setFullYear(t);\n }, t.prototype.getWeek = function (t) {\n var e = new Date(this.timestamp()),\n i = (this.getDay() + (7 - t)) % 7;\n e.setDate(e.getDate() - i);\n var n = e.getTime();\n return e.setMonth(0, 1), e.getDay() !== t && e.setMonth(0, 1 + (4 - e.getDay() + 7) % 7), 1 + Math.ceil((n - e.getTime()) / 6048e5);\n }, t.prototype.clone = function () {\n return new t(this.toJSDate());\n }, t.prototype.isBetween = function (t, e, i) {\n switch (void 0 === i && (i = \"()\"), i) {\n default:\n case \"()\":\n return this.timestamp() > t.getTime() && this.timestamp() < e.getTime();\n case \"[)\":\n return this.timestamp() >= t.getTime() && this.timestamp() < e.getTime();\n case \"(]\":\n return this.timestamp() > t.getTime() && this.timestamp() <= e.getTime();\n case \"[]\":\n return this.timestamp() >= t.getTime() && this.timestamp() <= e.getTime();\n }\n }, t.prototype.isBefore = function (t, e) {\n switch (void 0 === e && (e = \"seconds\"), e) {\n case \"second\":\n case \"seconds\":\n return t.getTime() > this.getTime();\n case \"day\":\n case \"days\":\n return new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime() > new Date(this.getFullYear(), this.getMonth(), this.getDate()).getTime();\n case \"month\":\n case \"months\":\n return new Date(t.getFullYear(), t.getMonth(), 1).getTime() > new Date(this.getFullYear(), this.getMonth(), 1).getTime();\n case \"year\":\n case \"years\":\n return t.getFullYear() > this.getFullYear();\n }\n throw new Error(\"isBefore: Invalid unit!\");\n }, t.prototype.isSameOrBefore = function (t, e) {\n switch (void 0 === e && (e = \"seconds\"), e) {\n case \"second\":\n case \"seconds\":\n return t.getTime() >= this.getTime();\n case \"day\":\n case \"days\":\n return new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime() >= new Date(this.getFullYear(), this.getMonth(), this.getDate()).getTime();\n case \"month\":\n case \"months\":\n return new Date(t.getFullYear(), t.getMonth(), 1).getTime() >= new Date(this.getFullYear(), this.getMonth(), 1).getTime();\n }\n throw new Error(\"isSameOrBefore: Invalid unit!\");\n }, t.prototype.isAfter = function (t, e) {\n switch (void 0 === e && (e = \"seconds\"), e) {\n case \"second\":\n case \"seconds\":\n return this.getTime() > t.getTime();\n case \"day\":\n case \"days\":\n return new Date(this.getFullYear(), this.getMonth(), this.getDate()).getTime() > new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime();\n case \"month\":\n case \"months\":\n return new Date(this.getFullYear(), this.getMonth(), 1).getTime() > new Date(t.getFullYear(), t.getMonth(), 1).getTime();\n case \"year\":\n case \"years\":\n return this.getFullYear() > t.getFullYear();\n }\n throw new Error(\"isAfter: Invalid unit!\");\n }, t.prototype.isSameOrAfter = function (t, e) {\n switch (void 0 === e && (e = \"seconds\"), e) {\n case \"second\":\n case \"seconds\":\n return this.getTime() >= t.getTime();\n case \"day\":\n case \"days\":\n return new Date(this.getFullYear(), this.getMonth(), this.getDate()).getTime() >= new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime();\n case \"month\":\n case \"months\":\n return new Date(this.getFullYear(), this.getMonth(), 1).getTime() >= new Date(t.getFullYear(), t.getMonth(), 1).getTime();\n }\n throw new Error(\"isSameOrAfter: Invalid unit!\");\n }, t.prototype.isSame = function (t, e) {\n switch (void 0 === e && (e = \"seconds\"), e) {\n case \"second\":\n case \"seconds\":\n return this.getTime() === t.getTime();\n case \"day\":\n case \"days\":\n return new Date(this.getFullYear(), this.getMonth(), this.getDate()).getTime() === new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime();\n case \"month\":\n case \"months\":\n return new Date(this.getFullYear(), this.getMonth(), 1).getTime() === new Date(t.getFullYear(), t.getMonth(), 1).getTime();\n }\n throw new Error(\"isSame: Invalid unit!\");\n }, t.prototype.add = function (t, e) {\n switch (void 0 === e && (e = \"seconds\"), e) {\n case \"second\":\n case \"seconds\":\n this.setSeconds(this.getSeconds() + t);\n break;\n case \"day\":\n case \"days\":\n this.setDate(this.getDate() + t);\n break;\n case \"month\":\n case \"months\":\n this.setMonth(this.getMonth() + t);\n }\n return this;\n }, t.prototype.subtract = function (t, e) {\n switch (void 0 === e && (e = \"seconds\"), e) {\n case \"second\":\n case \"seconds\":\n this.setSeconds(this.getSeconds() - t);\n break;\n case \"day\":\n case \"days\":\n this.setDate(this.getDate() - t);\n break;\n case \"month\":\n case \"months\":\n this.setMonth(this.getMonth() - t);\n }\n return this;\n }, t.prototype.diff = function (t, e) {\n void 0 === e && (e = \"seconds\");\n switch (e) {\n default:\n case \"second\":\n case \"seconds\":\n return this.getTime() - t.getTime();\n case \"day\":\n case \"days\":\n return Math.round((this.timestamp() - t.getTime()) / 864e5);\n case \"month\":\n case \"months\":\n }\n }, t.prototype.format = function (e, i) {\n if (void 0 === i && (i = \"en-US\"), \"object\" == _typeof(e)) return e.output(this.clone().toJSDate());\n for (var n = \"\", o = [], s = null; null != (s = t.regex.exec(e));) \"\\\\\" !== s[1] && o.push(s);\n if (o.length) {\n o[0].index > 0 && (n += e.substring(0, o[0].index));\n for (var r = 0, a = Object.entries(o); r < a.length; r++) {\n var l = a[r],\n c = l[0],\n h = l[1],\n p = Number(c);\n n += this.formatTokens(h[0], i), o[p + 1] && (n += e.substring(h.index + h[0].length, o[p + 1].index)), p === o.length - 1 && (n += e.substring(h.index + h[0].length));\n }\n }\n return n.replace(/\\\\/g, \"\");\n }, t.prototype.timestamp = function () {\n return new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0, 0).getTime();\n }, t.prototype.formatTokens = function (e, i) {\n switch (e) {\n case \"YY\":\n return String(this.getFullYear()).slice(-2);\n case \"YYYY\":\n return String(this.getFullYear());\n case \"M\":\n return String(this.getMonth() + 1);\n case \"MM\":\n return (\"0\" + (this.getMonth() + 1)).slice(-2);\n case \"MMM\":\n return t.shortMonths(i)[this.getMonth()];\n case \"MMMM\":\n return t.longMonths(i)[this.getMonth()];\n case \"D\":\n return String(this.getDate());\n case \"DD\":\n return (\"0\" + this.getDate()).slice(-2);\n default:\n return \"\";\n }\n }, t.regex = /(\\\\)?(Y{2,4}|M{1,4}|D{1,2}|d{1,4})/g, t.MONTH_JS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], t;\n }();\n e.DateTime = n;\n }, function (t, e, i) {\n \"use strict\";\n\n var _n,\n o = this && this.__extends || (_n = function n(t, e) {\n return (_n = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (t, e) {\n t.__proto__ = e;\n } || function (t, e) {\n for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i]);\n })(t, e);\n }, function (t, e) {\n function i() {\n this.constructor = t;\n }\n _n(t, e), t.prototype = null === e ? Object.create(e) : (i.prototype = e.prototype, new i());\n }),\n s = this && this.__spreadArrays || function () {\n for (var t = 0, e = 0, i = arguments.length; e < i; e++) t += arguments[e].length;\n var n = Array(t),\n o = 0;\n for (e = 0; e < i; e++) for (var s = arguments[e], r = 0, a = s.length; r < a; r++, o++) n[o] = s[r];\n return n;\n };\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n });\n var r = i(5),\n a = i(0),\n l = i(3),\n c = i(2),\n h = function (t) {\n function e(e) {\n var i = t.call(this, e) || this;\n return i.preventClick = !1, i.bindEvents(), i;\n }\n return o(e, t), e.prototype.scrollToDate = function (t) {\n if (this.options.scrollToDate) {\n var e = this.options.startDate instanceof a.DateTime ? this.options.startDate.clone() : null,\n i = this.options.endDate instanceof a.DateTime ? this.options.endDate.clone() : null;\n !this.options.startDate || t && t !== this.options.element ? t && this.options.endDate && t === this.options.elementEnd && (i.setDate(1), this.options.numberOfMonths > 1 && i.isAfter(e) && i.setMonth(i.getMonth() - (this.options.numberOfMonths - 1)), this.calendars[0] = i.clone()) : (e.setDate(1), this.calendars[0] = e.clone());\n }\n }, e.prototype.bindEvents = function () {\n document.addEventListener(\"click\", this.onClick.bind(this), !0), this.ui = document.createElement(\"div\"), this.ui.className = l.litepicker, this.ui.style.display = \"none\", this.ui.addEventListener(\"mouseenter\", this.onMouseEnter.bind(this), !0), this.ui.addEventListener(\"mouseleave\", this.onMouseLeave.bind(this), !1), this.options.autoRefresh ? (this.options.element instanceof HTMLElement && this.options.element.addEventListener(\"keyup\", this.onInput.bind(this), !0), this.options.elementEnd instanceof HTMLElement && this.options.elementEnd.addEventListener(\"keyup\", this.onInput.bind(this), !0)) : (this.options.element instanceof HTMLElement && this.options.element.addEventListener(\"change\", this.onInput.bind(this), !0), this.options.elementEnd instanceof HTMLElement && this.options.elementEnd.addEventListener(\"change\", this.onInput.bind(this), !0)), this.options.parentEl ? this.options.parentEl instanceof HTMLElement ? this.options.parentEl.appendChild(this.ui) : document.querySelector(this.options.parentEl).appendChild(this.ui) : this.options.inlineMode ? this.options.element instanceof HTMLInputElement ? this.options.element.parentNode.appendChild(this.ui) : this.options.element.appendChild(this.ui) : document.body.appendChild(this.ui), this.updateInput(), this.init(), \"function\" == typeof this.options.setup && this.options.setup.call(this, this), this.render(), this.options.inlineMode && this.show();\n }, e.prototype.updateInput = function () {\n if (this.options.element instanceof HTMLInputElement) {\n var t = this.options.startDate,\n e = this.options.endDate;\n if (this.options.singleMode && t) this.options.element.value = t.format(this.options.format, this.options.lang);else if (!this.options.singleMode && t && e) {\n var i = t.format(this.options.format, this.options.lang),\n n = e.format(this.options.format, this.options.lang);\n this.options.elementEnd instanceof HTMLInputElement ? (this.options.element.value = i, this.options.elementEnd.value = n) : this.options.element.value = \"\" + i + this.options.delimiter + n;\n }\n t || e || (this.options.element.value = \"\", this.options.elementEnd instanceof HTMLInputElement && (this.options.elementEnd.value = \"\"));\n }\n }, e.prototype.isSamePicker = function (t) {\n return t.closest(\".\" + l.litepicker) === this.ui;\n }, e.prototype.shouldShown = function (t) {\n return !t.disabled && (t === this.options.element || this.options.elementEnd && t === this.options.elementEnd);\n }, e.prototype.shouldResetDatePicked = function () {\n return this.options.singleMode || 2 === this.datePicked.length;\n }, e.prototype.shouldSwapDatePicked = function () {\n return 2 === this.datePicked.length && this.datePicked[0].getTime() > this.datePicked[1].getTime();\n }, e.prototype.shouldCheckLockDays = function () {\n return this.options.disallowLockDaysInRange && 2 === this.datePicked.length;\n }, e.prototype.onClick = function (t) {\n var e = t.target;\n if (t.target.shadowRoot && (e = t.composedPath()[0]), e && this.ui) if (this.shouldShown(e)) this.show(e);else if (e.closest(\".\" + l.litepicker) || !this.isShowning()) {\n if (this.isSamePicker(e)) if (this.emit(\"before:click\", e), this.preventClick) this.preventClick = !1;else {\n if (e.classList.contains(l.dayItem)) {\n if (t.preventDefault(), e.classList.contains(l.isLocked)) return;\n if (this.shouldResetDatePicked() && (this.datePicked.length = 0), this.datePicked[this.datePicked.length] = new a.DateTime(e.dataset.time), this.shouldSwapDatePicked()) {\n var i = this.datePicked[1].clone();\n this.datePicked[1] = this.datePicked[0].clone(), this.datePicked[0] = i.clone();\n }\n if (this.shouldCheckLockDays()) c.rangeIsLocked(this.datePicked, this.options) && (this.emit(\"error:range\", this.datePicked), this.datePicked.length = 0);\n return this.render(), this.emit.apply(this, s([\"preselect\"], s(this.datePicked).map(function (t) {\n return t.clone();\n }))), void (this.options.autoApply && (this.options.singleMode && this.datePicked.length ? (this.setDate(this.datePicked[0]), this.hide()) : this.options.singleMode || 2 !== this.datePicked.length || (this.setDateRange(this.datePicked[0], this.datePicked[1]), this.hide())));\n }\n if (e.classList.contains(l.buttonPreviousMonth)) {\n t.preventDefault();\n var n = 0,\n o = this.options.switchingMonths || this.options.numberOfMonths;\n if (this.options.splitView) {\n var r = e.closest(\".\" + l.monthItem);\n n = c.findNestedMonthItem(r), o = 1;\n }\n return this.calendars[n].setMonth(this.calendars[n].getMonth() - o), this.gotoDate(this.calendars[n], n), void this.emit(\"change:month\", this.calendars[n], n);\n }\n if (e.classList.contains(l.buttonNextMonth)) {\n t.preventDefault();\n n = 0, o = this.options.switchingMonths || this.options.numberOfMonths;\n if (this.options.splitView) {\n r = e.closest(\".\" + l.monthItem);\n n = c.findNestedMonthItem(r), o = 1;\n }\n return this.calendars[n].setMonth(this.calendars[n].getMonth() + o), this.gotoDate(this.calendars[n], n), void this.emit(\"change:month\", this.calendars[n], n);\n }\n e.classList.contains(l.buttonCancel) && (t.preventDefault(), this.hide(), this.emit(\"button:cancel\")), e.classList.contains(l.buttonApply) && (t.preventDefault(), this.options.singleMode && this.datePicked.length ? this.setDate(this.datePicked[0]) : this.options.singleMode || 2 !== this.datePicked.length || this.setDateRange(this.datePicked[0], this.datePicked[1]), this.hide(), this.emit(\"button:apply\", this.options.startDate, this.options.endDate));\n }\n } else this.hide();\n }, e.prototype.showTooltip = function (t, e) {\n var i = this.ui.querySelector(\".\" + l.containerTooltip);\n i.style.visibility = \"visible\", i.innerHTML = e;\n var n = this.ui.getBoundingClientRect(),\n o = i.getBoundingClientRect(),\n s = t.getBoundingClientRect(),\n r = s.top,\n a = s.left;\n if (this.options.inlineMode && this.options.parentEl) {\n var c = this.ui.parentNode.getBoundingClientRect();\n r -= c.top, a -= c.left;\n } else r -= n.top, a -= n.left;\n r -= o.height, a -= o.width / 2, a += s.width / 2, i.style.top = r + \"px\", i.style.left = a + \"px\", this.emit(\"tooltip\", i, t);\n }, e.prototype.hideTooltip = function () {\n this.ui.querySelector(\".\" + l.containerTooltip).style.visibility = \"hidden\";\n }, e.prototype.shouldAllowMouseEnter = function (t) {\n return !this.options.singleMode && !t.classList.contains(l.isLocked);\n }, e.prototype.shouldAllowRepick = function () {\n return this.options.elementEnd && this.options.allowRepick && this.options.startDate && this.options.endDate;\n }, e.prototype.isDayItem = function (t) {\n return t.classList.contains(l.dayItem);\n }, e.prototype.onMouseEnter = function (t) {\n var e = this,\n i = t.target;\n if (this.isDayItem(i) && this.shouldAllowMouseEnter(i)) {\n if (this.shouldAllowRepick() && (this.triggerElement === this.options.element ? this.datePicked[0] = this.options.endDate.clone() : this.triggerElement === this.options.elementEnd && (this.datePicked[0] = this.options.startDate.clone())), 1 !== this.datePicked.length) return;\n var n = this.ui.querySelector(\".\" + l.dayItem + '[data-time=\"' + this.datePicked[0].getTime() + '\"]'),\n o = this.datePicked[0].clone(),\n s = new a.DateTime(i.dataset.time),\n r = !1;\n if (o.getTime() > s.getTime()) {\n var c = o.clone();\n o = s.clone(), s = c.clone(), r = !0;\n }\n if (Array.prototype.slice.call(this.ui.querySelectorAll(\".\" + l.dayItem)).forEach(function (t) {\n var i = new a.DateTime(t.dataset.time),\n n = e.renderDay(i);\n i.isBetween(o, s) && n.classList.add(l.isInRange), t.className = n.className;\n }), i.classList.add(l.isEndDate), r ? (n && n.classList.add(l.isFlipped), i.classList.add(l.isFlipped)) : (n && n.classList.remove(l.isFlipped), i.classList.remove(l.isFlipped)), this.options.showTooltip) {\n var h = s.diff(o, \"day\") + 1;\n if (\"function\" == typeof this.options.tooltipNumber && (h = this.options.tooltipNumber.call(this, h)), h > 0) {\n var p = this.pluralSelector(h),\n d = h + \" \" + (this.options.tooltipText[p] ? this.options.tooltipText[p] : \"[\" + p + \"]\");\n this.showTooltip(i, d);\n var u = window.navigator.userAgent,\n m = /(iphone|ipad)/i.test(u),\n f = /OS 1([0-2])/i.test(u);\n m && f && i.dispatchEvent(new Event(\"click\"));\n } else this.hideTooltip();\n }\n }\n }, e.prototype.onMouseLeave = function (t) {\n t.target;\n this.options.allowRepick && (!this.options.allowRepick || this.options.startDate || this.options.endDate) && (this.datePicked.length = 0, this.render());\n }, e.prototype.onInput = function (t) {\n var e = this.parseInput(),\n i = e[0],\n n = e[1],\n o = this.options.format;\n if (this.options.elementEnd ? i instanceof a.DateTime && n instanceof a.DateTime && i.format(o) === this.options.element.value && n.format(o) === this.options.elementEnd.value : this.options.singleMode ? i instanceof a.DateTime && i.format(o) === this.options.element.value : i instanceof a.DateTime && n instanceof a.DateTime && \"\" + i.format(o) + this.options.delimiter + n.format(o) === this.options.element.value) {\n if (n && i.getTime() > n.getTime()) {\n var s = i.clone();\n i = n.clone(), n = s.clone();\n }\n this.options.startDate = new a.DateTime(i, this.options.format, this.options.lang), n && (this.options.endDate = new a.DateTime(n, this.options.format, this.options.lang)), this.updateInput(), this.render();\n var r = i.clone(),\n l = 0;\n (this.options.elementEnd ? i.format(o) === t.target.value : t.target.value.startsWith(i.format(o))) || (r = n.clone(), l = this.options.numberOfMonths - 1), this.emit(\"selected\", this.getStartDate(), this.getEndDate()), this.gotoDate(r, l);\n }\n }, e;\n }(r.Calendar);\n e.Litepicker = h;\n }, function (t, e, i) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n }), e.findNestedMonthItem = function (t) {\n for (var e = t.parentNode.childNodes, i = 0; i < e.length; i += 1) {\n if (e.item(i) === t) return i;\n }\n return 0;\n }, e.dateIsLocked = function (t, e, i) {\n var n = !1;\n return e.lockDays.length && (n = e.lockDays.filter(function (i) {\n return i instanceof Array ? t.isBetween(i[0], i[1], e.lockDaysInclusivity) : i.isSame(t, \"day\");\n }).length), n || \"function\" != typeof e.lockDaysFilter || (n = e.lockDaysFilter.call(this, t.clone(), null, i)), n;\n }, e.rangeIsLocked = function (t, e) {\n var i = !1;\n return e.lockDays.length && (i = e.lockDays.filter(function (i) {\n if (i instanceof Array) {\n var n = t[0].toDateString() === i[0].toDateString() && t[1].toDateString() === i[1].toDateString();\n return i[0].isBetween(t[0], t[1], e.lockDaysInclusivity) || i[1].isBetween(t[0], t[1], e.lockDaysInclusivity) || n;\n }\n return i.isBetween(t[0], t[1], e.lockDaysInclusivity);\n }).length), i || \"function\" != typeof e.lockDaysFilter || (i = e.lockDaysFilter.call(this, t[0].clone(), t[1].clone(), t)), i;\n };\n }, function (t, e, i) {\n var n = i(8);\n \"string\" == typeof n && (n = [[t.i, n, \"\"]]);\n var o = {\n insert: function insert(t) {\n var e = document.querySelector(\"head\"),\n i = window._lastElementInsertedByStyleLoader;\n window.disableLitepickerStyles || (i ? i.nextSibling ? e.insertBefore(t, i.nextSibling) : e.appendChild(t) : e.insertBefore(t, e.firstChild), window._lastElementInsertedByStyleLoader = t);\n },\n singleton: !1\n };\n i(10)(n, o);\n n.locals && (t.exports = n.locals);\n }, function (t, e, i) {\n \"use strict\";\n\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n });\n var n = i(1);\n e.Litepicker = n.Litepicker, i(11), window.Litepicker = n.Litepicker, e[\"default\"] = n.Litepicker;\n }, function (t, e, i) {\n \"use strict\";\n\n var _n2,\n o = this && this.__extends || (_n2 = function n(t, e) {\n return (_n2 = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (t, e) {\n t.__proto__ = e;\n } || function (t, e) {\n for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i]);\n })(t, e);\n }, function (t, e) {\n function i() {\n this.constructor = t;\n }\n _n2(t, e), t.prototype = null === e ? Object.create(e) : (i.prototype = e.prototype, new i());\n });\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n });\n var s = i(6),\n r = i(0),\n a = i(3),\n l = i(2),\n c = function (t) {\n function e(e) {\n return t.call(this, e) || this;\n }\n return o(e, t), e.prototype.render = function () {\n var t = this;\n this.emit(\"before:render\", this.ui);\n var e = document.createElement(\"div\");\n e.className = a.containerMain;\n var i = document.createElement(\"div\");\n i.className = a.containerMonths, a[\"columns\" + this.options.numberOfColumns] && (i.classList.remove(a.columns2, a.columns3, a.columns4), i.classList.add(a[\"columns\" + this.options.numberOfColumns])), this.options.splitView && i.classList.add(a.splitView), this.options.showWeekNumbers && i.classList.add(a.showWeekNumbers);\n for (var n = this.calendars[0].clone(), o = n.getMonth(), s = n.getMonth() + this.options.numberOfMonths, r = 0, l = o; l < s; l += 1) {\n var c = n.clone();\n c.setDate(1), c.setHours(0, 0, 0, 0), this.options.splitView ? c = this.calendars[r].clone() : c.setMonth(l), i.appendChild(this.renderMonth(c, r)), r += 1;\n }\n if (this.ui.innerHTML = \"\", e.appendChild(i), this.options.resetButton) {\n var h = void 0;\n \"function\" == typeof this.options.resetButton ? h = this.options.resetButton.call(this) : ((h = document.createElement(\"button\")).type = \"button\", h.className = a.resetButton, h.innerHTML = this.options.buttonText.reset), h.addEventListener(\"click\", function (e) {\n e.preventDefault(), t.clearSelection();\n }), e.querySelector(\".\" + a.monthItem + \":last-child\").querySelector(\".\" + a.monthItemHeader).appendChild(h);\n }\n this.ui.appendChild(e), this.options.autoApply && !this.options.footerHTML || this.ui.appendChild(this.renderFooter()), this.options.showTooltip && this.ui.appendChild(this.renderTooltip()), this.ui.dataset.plugins = (this.options.plugins || []).join(\"|\"), this.emit(\"render\", this.ui);\n }, e.prototype.renderMonth = function (t, e) {\n var i = this,\n n = t.clone(),\n o = 32 - new Date(n.getFullYear(), n.getMonth(), 32).getDate(),\n s = document.createElement(\"div\");\n s.className = a.monthItem;\n var c = document.createElement(\"div\");\n c.className = a.monthItemHeader;\n var h = document.createElement(\"div\");\n if (this.options.dropdowns.months) {\n var p = document.createElement(\"select\");\n p.className = a.monthItemName;\n for (var d = 0; d < 12; d += 1) {\n var u = document.createElement(\"option\"),\n m = new r.DateTime(new Date(t.getFullYear(), d, 2, 0, 0, 0)),\n f = new r.DateTime(new Date(t.getFullYear(), d, 1, 0, 0, 0));\n u.value = String(d), u.text = m.toLocaleString(this.options.lang, {\n month: \"long\"\n }), u.disabled = this.options.minDate && f.isBefore(new r.DateTime(this.options.minDate), \"month\") || this.options.maxDate && f.isAfter(new r.DateTime(this.options.maxDate), \"month\"), u.selected = f.getMonth() === t.getMonth(), p.appendChild(u);\n }\n p.addEventListener(\"change\", function (t) {\n var e = t.target,\n n = 0;\n if (i.options.splitView) {\n var o = e.closest(\".\" + a.monthItem);\n n = l.findNestedMonthItem(o);\n }\n i.calendars[n].setMonth(Number(e.value)), i.render(), i.emit(\"change:month\", i.calendars[n], n, t);\n }), h.appendChild(p);\n } else {\n (m = document.createElement(\"strong\")).className = a.monthItemName, m.innerHTML = t.toLocaleString(this.options.lang, {\n month: \"long\"\n }), h.appendChild(m);\n }\n if (this.options.dropdowns.years) {\n var g = document.createElement(\"select\");\n g.className = a.monthItemYear;\n var v = this.options.dropdowns.minYear,\n y = this.options.dropdowns.maxYear ? this.options.dropdowns.maxYear : new Date().getFullYear();\n if (t.getFullYear() > y) (u = document.createElement(\"option\")).value = String(t.getFullYear()), u.text = String(t.getFullYear()), u.selected = !0, u.disabled = !0, g.appendChild(u);\n for (d = y; d >= v; d -= 1) {\n var u = document.createElement(\"option\"),\n b = new r.DateTime(new Date(d, 0, 1, 0, 0, 0));\n u.value = String(d), u.text = String(d), u.disabled = this.options.minDate && b.isBefore(new r.DateTime(this.options.minDate), \"year\") || this.options.maxDate && b.isAfter(new r.DateTime(this.options.maxDate), \"year\"), u.selected = t.getFullYear() === d, g.appendChild(u);\n }\n if (t.getFullYear() < v) (u = document.createElement(\"option\")).value = String(t.getFullYear()), u.text = String(t.getFullYear()), u.selected = !0, u.disabled = !0, g.appendChild(u);\n if (\"asc\" === this.options.dropdowns.years) {\n var k = Array.prototype.slice.call(g.childNodes).reverse();\n g.innerHTML = \"\", k.forEach(function (t) {\n t.innerHTML = t.value, g.appendChild(t);\n });\n }\n g.addEventListener(\"change\", function (t) {\n var e = t.target,\n n = 0;\n if (i.options.splitView) {\n var o = e.closest(\".\" + a.monthItem);\n n = l.findNestedMonthItem(o);\n }\n i.calendars[n].setFullYear(Number(e.value)), i.render(), i.emit(\"change:year\", i.calendars[n], n, t);\n }), h.appendChild(g);\n } else {\n var w = document.createElement(\"span\");\n w.className = a.monthItemYear, w.innerHTML = String(t.getFullYear()), h.appendChild(w);\n }\n var D = document.createElement(\"button\");\n D.type = \"button\", D.className = a.buttonPreviousMonth, D.innerHTML = this.options.buttonText.previousMonth;\n var x = document.createElement(\"button\");\n x.type = \"button\", x.className = a.buttonNextMonth, x.innerHTML = this.options.buttonText.nextMonth, c.appendChild(D), c.appendChild(h), c.appendChild(x), this.options.minDate && n.isSameOrBefore(new r.DateTime(this.options.minDate), \"month\") && s.classList.add(a.noPreviousMonth), this.options.maxDate && n.isSameOrAfter(new r.DateTime(this.options.maxDate), \"month\") && s.classList.add(a.noNextMonth);\n var M = document.createElement(\"div\");\n M.className = a.monthItemWeekdaysRow, this.options.showWeekNumbers && (M.innerHTML = \"
W
\");\n for (var _ = 1; _ <= 7; _ += 1) {\n var T = 3 + this.options.firstDay + _,\n L = document.createElement(\"div\");\n L.innerHTML = this.weekdayName(T), L.title = this.weekdayName(T, \"long\"), M.appendChild(L);\n }\n var E = document.createElement(\"div\");\n E.className = a.containerDays;\n var S = this.calcSkipDays(n);\n this.options.showWeekNumbers && S && E.appendChild(this.renderWeekNumber(n));\n for (var I = 0; I < S; I += 1) {\n var P = document.createElement(\"div\");\n E.appendChild(P);\n }\n for (I = 1; I <= o; I += 1) n.setDate(I), this.options.showWeekNumbers && n.getDay() === this.options.firstDay && E.appendChild(this.renderWeekNumber(n)), E.appendChild(this.renderDay(n));\n return s.appendChild(c), s.appendChild(M), s.appendChild(E), this.emit(\"render:month\", s, t), s;\n }, e.prototype.renderDay = function (t) {\n t.setHours();\n var e = document.createElement(\"div\");\n if (e.className = a.dayItem, e.innerHTML = String(t.getDate()), e.dataset.time = String(t.getTime()), t.toDateString() === new Date().toDateString() && e.classList.add(a.isToday), this.datePicked.length) this.datePicked[0].toDateString() === t.toDateString() && (e.classList.add(a.isStartDate), this.options.singleMode && e.classList.add(a.isEndDate)), 2 === this.datePicked.length && this.datePicked[1].toDateString() === t.toDateString() && e.classList.add(a.isEndDate), 2 === this.datePicked.length && t.isBetween(this.datePicked[0], this.datePicked[1]) && e.classList.add(a.isInRange);else if (this.options.startDate) {\n var i = this.options.startDate,\n n = this.options.endDate;\n i.toDateString() === t.toDateString() && (e.classList.add(a.isStartDate), this.options.singleMode && e.classList.add(a.isEndDate)), n && n.toDateString() === t.toDateString() && e.classList.add(a.isEndDate), i && n && t.isBetween(i, n) && e.classList.add(a.isInRange);\n }\n if (this.options.minDate && t.isBefore(new r.DateTime(this.options.minDate)) && e.classList.add(a.isLocked), this.options.maxDate && t.isAfter(new r.DateTime(this.options.maxDate)) && e.classList.add(a.isLocked), this.options.minDays > 1 && 1 === this.datePicked.length) {\n var o = this.options.minDays - 1,\n s = this.datePicked[0].clone().subtract(o, \"day\"),\n c = this.datePicked[0].clone().add(o, \"day\");\n t.isBetween(s, this.datePicked[0], \"(]\") && e.classList.add(a.isLocked), t.isBetween(this.datePicked[0], c, \"[)\") && e.classList.add(a.isLocked);\n }\n if (this.options.maxDays && 1 === this.datePicked.length) {\n var h = this.options.maxDays;\n s = this.datePicked[0].clone().subtract(h, \"day\"), c = this.datePicked[0].clone().add(h, \"day\");\n t.isSameOrBefore(s) && e.classList.add(a.isLocked), t.isSameOrAfter(c) && e.classList.add(a.isLocked);\n }\n (this.options.selectForward && 1 === this.datePicked.length && t.isBefore(this.datePicked[0]) && e.classList.add(a.isLocked), this.options.selectBackward && 1 === this.datePicked.length && t.isAfter(this.datePicked[0]) && e.classList.add(a.isLocked), l.dateIsLocked(t, this.options, this.datePicked) && e.classList.add(a.isLocked), this.options.highlightedDays.length) && this.options.highlightedDays.filter(function (e) {\n return e instanceof Array ? t.isBetween(e[0], e[1], \"[]\") : e.isSame(t, \"day\");\n }).length && e.classList.add(a.isHighlighted);\n return e.tabIndex = e.classList.contains(\"is-locked\") ? -1 : 0, this.emit(\"render:day\", e, t), e;\n }, e.prototype.renderFooter = function () {\n var t = document.createElement(\"div\");\n if (t.className = a.containerFooter, this.options.footerHTML ? t.innerHTML = this.options.footerHTML : t.innerHTML = '\\n \\n \\n \\n \", this.options.singleMode) {\n if (1 === this.datePicked.length) {\n var e = this.datePicked[0].format(this.options.format, this.options.lang);\n t.querySelector(\".\" + a.previewDateRange).innerHTML = e;\n }\n } else if (1 === this.datePicked.length && t.querySelector(\".\" + a.buttonApply).setAttribute(\"disabled\", \"\"), 2 === this.datePicked.length) {\n e = this.datePicked[0].format(this.options.format, this.options.lang);\n var i = this.datePicked[1].format(this.options.format, this.options.lang);\n t.querySelector(\".\" + a.previewDateRange).innerHTML = \"\" + e + this.options.delimiter + i;\n }\n return this.emit(\"render:footer\", t), t;\n }, e.prototype.renderWeekNumber = function (t) {\n var e = document.createElement(\"div\"),\n i = t.getWeek(this.options.firstDay);\n return e.className = a.weekNumber, e.innerHTML = 53 === i && 0 === t.getMonth() ? \"53 / 1\" : i, e;\n }, e.prototype.renderTooltip = function () {\n var t = document.createElement(\"div\");\n return t.className = a.containerTooltip, t;\n }, e.prototype.weekdayName = function (t, e) {\n return void 0 === e && (e = \"short\"), new Date(1970, 0, t, 12, 0, 0, 0).toLocaleString(this.options.lang, {\n weekday: e\n });\n }, e.prototype.calcSkipDays = function (t) {\n var e = t.getDay() - this.options.firstDay;\n return e < 0 && (e += 7), e;\n }, e;\n }(s.LPCore);\n e.Calendar = c;\n }, function (t, e, i) {\n \"use strict\";\n\n var _n3,\n o = this && this.__extends || (_n3 = function n(t, e) {\n return (_n3 = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (t, e) {\n t.__proto__ = e;\n } || function (t, e) {\n for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i]);\n })(t, e);\n }, function (t, e) {\n function i() {\n this.constructor = t;\n }\n _n3(t, e), t.prototype = null === e ? Object.create(e) : (i.prototype = e.prototype, new i());\n }),\n s = this && this.__assign || function () {\n return (s = Object.assign || function (t) {\n for (var e, i = 1, n = arguments.length; i < n; i++) for (var o in e = arguments[i]) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);\n return t;\n }).apply(this, arguments);\n };\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n });\n var r = i(7),\n a = i(0),\n l = i(1),\n c = function (t) {\n function e(e) {\n var i = t.call(this) || this;\n i.datePicked = [], i.calendars = [], i.options = {\n element: null,\n elementEnd: null,\n parentEl: null,\n firstDay: 1,\n format: \"YYYY-MM-DD\",\n lang: \"en-US\",\n delimiter: \" - \",\n numberOfMonths: 1,\n numberOfColumns: 1,\n startDate: null,\n endDate: null,\n zIndex: 9999,\n position: \"auto\",\n selectForward: !1,\n selectBackward: !1,\n splitView: !1,\n inlineMode: !1,\n singleMode: !0,\n autoApply: !0,\n allowRepick: !1,\n showWeekNumbers: !1,\n showTooltip: !0,\n scrollToDate: !0,\n mobileFriendly: !0,\n resetButton: !1,\n autoRefresh: !1,\n lockDaysFormat: \"YYYY-MM-DD\",\n lockDays: [],\n disallowLockDaysInRange: !1,\n lockDaysInclusivity: \"[]\",\n highlightedDaysFormat: \"YYYY-MM-DD\",\n highlightedDays: [],\n dropdowns: {\n minYear: 1990,\n maxYear: null,\n months: !1,\n years: !1\n },\n buttonText: {\n apply: \"Apply\",\n cancel: \"Cancel\",\n previousMonth: '',\n nextMonth: '',\n reset: ''\n },\n tooltipText: {\n one: \"day\",\n other: \"days\"\n }\n }, i.options = s(s({}, i.options), e.element.dataset), Object.keys(i.options).forEach(function (t) {\n \"true\" !== i.options[t] && \"false\" !== i.options[t] || (i.options[t] = \"true\" === i.options[t]);\n });\n var n = s(s({}, i.options.dropdowns), e.dropdowns),\n o = s(s({}, i.options.buttonText), e.buttonText),\n r = s(s({}, i.options.tooltipText), e.tooltipText);\n i.options = s(s({}, i.options), e), i.options.dropdowns = s({}, n), i.options.buttonText = s({}, o), i.options.tooltipText = s({}, r), i.options.elementEnd || (i.options.allowRepick = !1), i.options.lockDays.length && (i.options.lockDays = a.DateTime.convertArray(i.options.lockDays, i.options.lockDaysFormat)), i.options.highlightedDays.length && (i.options.highlightedDays = a.DateTime.convertArray(i.options.highlightedDays, i.options.highlightedDaysFormat));\n var l = i.parseInput(),\n c = l[0],\n h = l[1];\n i.options.startDate && (i.options.singleMode || i.options.endDate) && (c = new a.DateTime(i.options.startDate, i.options.format, i.options.lang)), c && i.options.endDate && (h = new a.DateTime(i.options.endDate, i.options.format, i.options.lang)), c instanceof a.DateTime && !isNaN(c.getTime()) && (i.options.startDate = c), i.options.startDate && h instanceof a.DateTime && !isNaN(h.getTime()) && (i.options.endDate = h), !i.options.singleMode || i.options.startDate instanceof a.DateTime || (i.options.startDate = null), i.options.singleMode || i.options.startDate instanceof a.DateTime && i.options.endDate instanceof a.DateTime || (i.options.startDate = null, i.options.endDate = null);\n for (var p = 0; p < i.options.numberOfMonths; p += 1) {\n var d = i.options.startDate instanceof a.DateTime ? i.options.startDate.clone() : new a.DateTime();\n if (!i.options.startDate && (0 === p || i.options.splitView)) {\n var u = i.options.maxDate ? new a.DateTime(i.options.maxDate) : null,\n m = i.options.minDate ? new a.DateTime(i.options.minDate) : null,\n f = i.options.numberOfMonths - 1;\n m && u && d.isAfter(u) ? (d = m.clone()).setDate(1) : !m && u && d.isAfter(u) && ((d = u.clone()).setDate(1), d.setMonth(d.getMonth() - f));\n }\n d.setDate(1), d.setMonth(d.getMonth() + p), i.calendars[p] = d;\n }\n if (i.options.showTooltip) if (i.options.tooltipPluralSelector) i.pluralSelector = i.options.tooltipPluralSelector;else try {\n var g = new Intl.PluralRules(i.options.lang);\n i.pluralSelector = g.select.bind(g);\n } catch (t) {\n i.pluralSelector = function (t) {\n return 0 === Math.abs(t) ? \"one\" : \"other\";\n };\n }\n return i;\n }\n return o(e, t), e.add = function (t, e) {\n l.Litepicker.prototype[t] = e;\n }, e.prototype.DateTime = function (t, e) {\n return t ? new a.DateTime(t, e) : new a.DateTime();\n }, e.prototype.init = function () {\n var t = this;\n this.options.plugins && this.options.plugins.length && this.options.plugins.forEach(function (e) {\n l.Litepicker.prototype.hasOwnProperty(e) ? l.Litepicker.prototype[e].init.call(t, t) : console.warn(\"Litepicker: plugin «\" + e + \"» not found.\");\n });\n }, e.prototype.parseInput = function () {\n var t = this.options.delimiter,\n e = new RegExp(\"\" + t),\n i = this.options.element instanceof HTMLInputElement ? this.options.element.value.split(t) : [];\n if (this.options.elementEnd) {\n if (this.options.element instanceof HTMLInputElement && this.options.element.value.length && this.options.elementEnd instanceof HTMLInputElement && this.options.elementEnd.value.length) return [new a.DateTime(this.options.element.value, this.options.format), new a.DateTime(this.options.elementEnd.value, this.options.format)];\n } else if (this.options.singleMode) {\n if (this.options.element instanceof HTMLInputElement && this.options.element.value.length) return [new a.DateTime(this.options.element.value, this.options.format)];\n } else if (this.options.element instanceof HTMLInputElement && e.test(this.options.element.value) && i.length && i.length % 2 == 0) {\n var n = i.slice(0, i.length / 2).join(t),\n o = i.slice(i.length / 2).join(t);\n return [new a.DateTime(n, this.options.format), new a.DateTime(o, this.options.format)];\n }\n return [];\n }, e.prototype.isShowning = function () {\n return this.ui && \"none\" !== this.ui.style.display;\n }, e.prototype.findPosition = function (t) {\n var e = t.getBoundingClientRect(),\n i = this.ui.getBoundingClientRect(),\n n = this.options.position.split(\" \"),\n o = window.scrollX || window.pageXOffset,\n s = window.scrollY || window.pageYOffset,\n r = 0,\n a = 0;\n if (\"auto\" !== n[0] && /top|bottom/.test(n[0])) r = e[n[0]] + s, \"top\" === n[0] && (r -= i.height);else {\n r = e.bottom + s;\n var l = e.bottom + i.height > window.innerHeight,\n c = e.top + s - i.height >= i.height;\n l && c && (r = e.top + s - i.height);\n }\n if (/left|right/.test(n[0]) || n[1] && \"auto\" !== n[1] && /left|right/.test(n[1])) a = /left|right/.test(n[0]) ? e[n[0]] + o : e[n[1]] + o, \"right\" !== n[0] && \"right\" !== n[1] || (a -= i.width);else {\n a = e.left + o;\n l = e.left + i.width > window.innerWidth;\n var h = e.right + o - i.width >= 0;\n l && h && (a = e.right + o - i.width);\n }\n return {\n left: a,\n top: r\n };\n }, e;\n }(r.EventEmitter);\n e.LPCore = c;\n }, function (t, e, i) {\n \"use strict\";\n\n var n,\n o = \"object\" == (typeof Reflect === \"undefined\" ? \"undefined\" : _typeof(Reflect)) ? Reflect : null,\n s = o && \"function\" == typeof o.apply ? o.apply : function (t, e, i) {\n return Function.prototype.apply.call(t, e, i);\n };\n n = o && \"function\" == typeof o.ownKeys ? o.ownKeys : Object.getOwnPropertySymbols ? function (t) {\n return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t));\n } : function (t) {\n return Object.getOwnPropertyNames(t);\n };\n var r = Number.isNaN || function (t) {\n return t != t;\n };\n function a() {\n a.init.call(this);\n }\n t.exports = a, a.EventEmitter = a, a.prototype._events = void 0, a.prototype._eventsCount = 0, a.prototype._maxListeners = void 0;\n var l = 10;\n function c(t) {\n return void 0 === t._maxListeners ? a.defaultMaxListeners : t._maxListeners;\n }\n function h(t, e, i, n) {\n var o, s, r, a;\n if (\"function\" != typeof i) throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + _typeof(i));\n if (void 0 === (s = t._events) ? (s = t._events = Object.create(null), t._eventsCount = 0) : (void 0 !== s.newListener && (t.emit(\"newListener\", e, i.listener ? i.listener : i), s = t._events), r = s[e]), void 0 === r) r = s[e] = i, ++t._eventsCount;else if (\"function\" == typeof r ? r = s[e] = n ? [i, r] : [r, i] : n ? r.unshift(i) : r.push(i), (o = c(t)) > 0 && r.length > o && !r.warned) {\n r.warned = !0;\n var l = new Error(\"Possible EventEmitter memory leak detected. \" + r.length + \" \" + String(e) + \" listeners added. Use emitter.setMaxListeners() to increase limit\");\n l.name = \"MaxListenersExceededWarning\", l.emitter = t, l.type = e, l.count = r.length, a = l, console && console.warn && console.warn(a);\n }\n return t;\n }\n function p() {\n for (var t = [], e = 0; e < arguments.length; e++) t.push(arguments[e]);\n this.fired || (this.target.removeListener(this.type, this.wrapFn), this.fired = !0, s(this.listener, this.target, t));\n }\n function d(t, e, i) {\n var n = {\n fired: !1,\n wrapFn: void 0,\n target: t,\n type: e,\n listener: i\n },\n o = p.bind(n);\n return o.listener = i, n.wrapFn = o, o;\n }\n function u(t, e, i) {\n var n = t._events;\n if (void 0 === n) return [];\n var o = n[e];\n return void 0 === o ? [] : \"function\" == typeof o ? i ? [o.listener || o] : [o] : i ? function (t) {\n for (var e = new Array(t.length), i = 0; i < e.length; ++i) e[i] = t[i].listener || t[i];\n return e;\n }(o) : f(o, o.length);\n }\n function m(t) {\n var e = this._events;\n if (void 0 !== e) {\n var i = e[t];\n if (\"function\" == typeof i) return 1;\n if (void 0 !== i) return i.length;\n }\n return 0;\n }\n function f(t, e) {\n for (var i = new Array(e), n = 0; n < e; ++n) i[n] = t[n];\n return i;\n }\n Object.defineProperty(a, \"defaultMaxListeners\", {\n enumerable: !0,\n get: function get() {\n return l;\n },\n set: function set(t) {\n if (\"number\" != typeof t || t < 0 || r(t)) throw new RangeError('The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received ' + t + \".\");\n l = t;\n }\n }), a.init = function () {\n void 0 !== this._events && this._events !== Object.getPrototypeOf(this)._events || (this._events = Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;\n }, a.prototype.setMaxListeners = function (t) {\n if (\"number\" != typeof t || t < 0 || r(t)) throw new RangeError('The value of \"n\" is out of range. It must be a non-negative number. Received ' + t + \".\");\n return this._maxListeners = t, this;\n }, a.prototype.getMaxListeners = function () {\n return c(this);\n }, a.prototype.emit = function (t) {\n for (var e = [], i = 1; i < arguments.length; i++) e.push(arguments[i]);\n var n = \"error\" === t,\n o = this._events;\n if (void 0 !== o) n = n && void 0 === o.error;else if (!n) return !1;\n if (n) {\n var r;\n if (e.length > 0 && (r = e[0]), r instanceof Error) throw r;\n var a = new Error(\"Unhandled error.\" + (r ? \" (\" + r.message + \")\" : \"\"));\n throw a.context = r, a;\n }\n var l = o[t];\n if (void 0 === l) return !1;\n if (\"function\" == typeof l) s(l, this, e);else {\n var c = l.length,\n h = f(l, c);\n for (i = 0; i < c; ++i) s(h[i], this, e);\n }\n return !0;\n }, a.prototype.addListener = function (t, e) {\n return h(this, t, e, !1);\n }, a.prototype.on = a.prototype.addListener, a.prototype.prependListener = function (t, e) {\n return h(this, t, e, !0);\n }, a.prototype.once = function (t, e) {\n if (\"function\" != typeof e) throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + _typeof(e));\n return this.on(t, d(this, t, e)), this;\n }, a.prototype.prependOnceListener = function (t, e) {\n if (\"function\" != typeof e) throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + _typeof(e));\n return this.prependListener(t, d(this, t, e)), this;\n }, a.prototype.removeListener = function (t, e) {\n var i, n, o, s, r;\n if (\"function\" != typeof e) throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + _typeof(e));\n if (void 0 === (n = this._events)) return this;\n if (void 0 === (i = n[t])) return this;\n if (i === e || i.listener === e) 0 == --this._eventsCount ? this._events = Object.create(null) : (delete n[t], n.removeListener && this.emit(\"removeListener\", t, i.listener || e));else if (\"function\" != typeof i) {\n for (o = -1, s = i.length - 1; s >= 0; s--) if (i[s] === e || i[s].listener === e) {\n r = i[s].listener, o = s;\n break;\n }\n if (o < 0) return this;\n 0 === o ? i.shift() : function (t, e) {\n for (; e + 1 < t.length; e++) t[e] = t[e + 1];\n t.pop();\n }(i, o), 1 === i.length && (n[t] = i[0]), void 0 !== n.removeListener && this.emit(\"removeListener\", t, r || e);\n }\n return this;\n }, a.prototype.off = a.prototype.removeListener, a.prototype.removeAllListeners = function (t) {\n var e, i, n;\n if (void 0 === (i = this._events)) return this;\n if (void 0 === i.removeListener) return 0 === arguments.length ? (this._events = Object.create(null), this._eventsCount = 0) : void 0 !== i[t] && (0 == --this._eventsCount ? this._events = Object.create(null) : delete i[t]), this;\n if (0 === arguments.length) {\n var o,\n s = Object.keys(i);\n for (n = 0; n < s.length; ++n) \"removeListener\" !== (o = s[n]) && this.removeAllListeners(o);\n return this.removeAllListeners(\"removeListener\"), this._events = Object.create(null), this._eventsCount = 0, this;\n }\n if (\"function\" == typeof (e = i[t])) this.removeListener(t, e);else if (void 0 !== e) for (n = e.length - 1; n >= 0; n--) this.removeListener(t, e[n]);\n return this;\n }, a.prototype.listeners = function (t) {\n return u(this, t, !0);\n }, a.prototype.rawListeners = function (t) {\n return u(this, t, !1);\n }, a.listenerCount = function (t, e) {\n return \"function\" == typeof t.listenerCount ? t.listenerCount(e) : m.call(t, e);\n }, a.prototype.listenerCount = m, a.prototype.eventNames = function () {\n return this._eventsCount > 0 ? n(this._events) : [];\n };\n }, function (t, e, i) {\n (e = i(9)(!1)).push([t.i, ':root{--litepicker-container-months-color-bg: #fff;--litepicker-container-months-box-shadow-color: #ddd;--litepicker-footer-color-bg: #fafafa;--litepicker-footer-box-shadow-color: #ddd;--litepicker-tooltip-color-bg: #fff;--litepicker-month-header-color: #333;--litepicker-button-prev-month-color: #9e9e9e;--litepicker-button-next-month-color: #9e9e9e;--litepicker-button-prev-month-color-hover: #2196f3;--litepicker-button-next-month-color-hover: #2196f3;--litepicker-month-width: calc(var(--litepicker-day-width) * 7);--litepicker-month-weekday-color: #9e9e9e;--litepicker-month-week-number-color: #9e9e9e;--litepicker-day-width: 38px;--litepicker-day-color: #333;--litepicker-day-color-hover: #2196f3;--litepicker-is-today-color: #f44336;--litepicker-is-in-range-color: #bbdefb;--litepicker-is-locked-color: #9e9e9e;--litepicker-is-start-color: #fff;--litepicker-is-start-color-bg: #2196f3;--litepicker-is-end-color: #fff;--litepicker-is-end-color-bg: #2196f3;--litepicker-button-cancel-color: #fff;--litepicker-button-cancel-color-bg: #9e9e9e;--litepicker-button-apply-color: #fff;--litepicker-button-apply-color-bg: #2196f3;--litepicker-button-reset-color: #909090;--litepicker-button-reset-color-hover: #2196f3;--litepicker-highlighted-day-color: #333;--litepicker-highlighted-day-color-bg: #ffeb3b}.show-week-numbers{--litepicker-month-width: calc(var(--litepicker-day-width) * 8)}.litepicker{font-family:-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;font-size:0.8em;display:none}.litepicker button{border:none;background:none}.litepicker .container__main{display:-webkit-box;display:-ms-flexbox;display:flex}.litepicker .container__months{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;background-color:var(--litepicker-container-months-color-bg);border-radius:5px;-webkit-box-shadow:0 0 5px var(--litepicker-container-months-box-shadow-color);box-shadow:0 0 5px var(--litepicker-container-months-box-shadow-color);width:calc(var(--litepicker-month-width) + 10px);-webkit-box-sizing:content-box;box-sizing:content-box}.litepicker .container__months.columns-2{width:calc((var(--litepicker-month-width) * 2) + 20px)}.litepicker .container__months.columns-3{width:calc((var(--litepicker-month-width) * 3) + 30px)}.litepicker .container__months.columns-4{width:calc((var(--litepicker-month-width) * 4) + 40px)}.litepicker .container__months.split-view .month-item-header .button-previous-month,.litepicker .container__months.split-view .month-item-header .button-next-month{visibility:visible}.litepicker .container__months .month-item{padding:5px;width:var(--litepicker-month-width);-webkit-box-sizing:content-box;box-sizing:content-box}.litepicker .container__months .month-item-header{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;font-weight:500;padding:10px 5px;text-align:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:var(--litepicker-month-header-color)}.litepicker .container__months .month-item-header div{-webkit-box-flex:1;-ms-flex:1;flex:1}.litepicker .container__months .month-item-header div>.month-item-name{margin-right:5px}.litepicker .container__months .month-item-header div>.month-item-year{padding:0}.litepicker .container__months .month-item-header .reset-button{color:var(--litepicker-button-reset-color)}.litepicker .container__months .month-item-header .reset-button>svg{fill:var(--litepicker-button-reset-color)}.litepicker .container__months .month-item-header .reset-button *{pointer-events:none}.litepicker .container__months .month-item-header .reset-button:hover{color:var(--litepicker-button-reset-color-hover)}.litepicker .container__months .month-item-header .reset-button:hover>svg{fill:var(--litepicker-button-reset-color-hover)}.litepicker .container__months .month-item-header .button-previous-month,.litepicker .container__months .month-item-header .button-next-month{visibility:hidden;text-decoration:none;padding:3px 5px;border-radius:3px;-webkit-transition:color 0.3s, border 0.3s;transition:color 0.3s, border 0.3s;cursor:default}.litepicker .container__months .month-item-header .button-previous-month *,.litepicker .container__months .month-item-header .button-next-month *{pointer-events:none}.litepicker .container__months .month-item-header .button-previous-month{color:var(--litepicker-button-prev-month-color)}.litepicker .container__months .month-item-header .button-previous-month>svg,.litepicker .container__months .month-item-header .button-previous-month>img{fill:var(--litepicker-button-prev-month-color)}.litepicker .container__months .month-item-header .button-previous-month:hover{color:var(--litepicker-button-prev-month-color-hover)}.litepicker .container__months .month-item-header .button-previous-month:hover>svg{fill:var(--litepicker-button-prev-month-color-hover)}.litepicker .container__months .month-item-header .button-next-month{color:var(--litepicker-button-next-month-color)}.litepicker .container__months .month-item-header .button-next-month>svg,.litepicker .container__months .month-item-header .button-next-month>img{fill:var(--litepicker-button-next-month-color)}.litepicker .container__months .month-item-header .button-next-month:hover{color:var(--litepicker-button-next-month-color-hover)}.litepicker .container__months .month-item-header .button-next-month:hover>svg{fill:var(--litepicker-button-next-month-color-hover)}.litepicker .container__months .month-item-weekdays-row{display:-webkit-box;display:-ms-flexbox;display:flex;justify-self:center;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;color:var(--litepicker-month-weekday-color)}.litepicker .container__months .month-item-weekdays-row>div{padding:5px 0;font-size:85%;-webkit-box-flex:1;-ms-flex:1;flex:1;width:var(--litepicker-day-width);text-align:center}.litepicker .container__months .month-item:first-child .button-previous-month{visibility:visible}.litepicker .container__months .month-item:last-child .button-next-month{visibility:visible}.litepicker .container__months .month-item.no-previous-month .button-previous-month{visibility:hidden}.litepicker .container__months .month-item.no-next-month .button-next-month{visibility:hidden}.litepicker .container__days{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;justify-self:center;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;text-align:center;-webkit-box-sizing:content-box;box-sizing:content-box}.litepicker .container__days>div,.litepicker .container__days>a{padding:5px 0;width:var(--litepicker-day-width)}.litepicker .container__days .day-item{color:var(--litepicker-day-color);text-align:center;text-decoration:none;border-radius:3px;-webkit-transition:color 0.3s, border 0.3s;transition:color 0.3s, border 0.3s;cursor:default}.litepicker .container__days .day-item:hover{color:var(--litepicker-day-color-hover);-webkit-box-shadow:inset 0 0 0 1px var(--litepicker-day-color-hover);box-shadow:inset 0 0 0 1px var(--litepicker-day-color-hover)}.litepicker .container__days .day-item.is-today{color:var(--litepicker-is-today-color)}.litepicker .container__days .day-item.is-locked{color:var(--litepicker-is-locked-color)}.litepicker .container__days .day-item.is-locked:hover{color:var(--litepicker-is-locked-color);-webkit-box-shadow:none;box-shadow:none;cursor:default}.litepicker .container__days .day-item.is-in-range{background-color:var(--litepicker-is-in-range-color);border-radius:0}.litepicker .container__days .day-item.is-start-date{color:var(--litepicker-is-start-color);background-color:var(--litepicker-is-start-color-bg);border-top-left-radius:5px;border-bottom-left-radius:5px;border-top-right-radius:0;border-bottom-right-radius:0}.litepicker .container__days .day-item.is-start-date.is-flipped{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:5px;border-bottom-right-radius:5px}.litepicker .container__days .day-item.is-end-date{color:var(--litepicker-is-end-color);background-color:var(--litepicker-is-end-color-bg);border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:5px;border-bottom-right-radius:5px}.litepicker .container__days .day-item.is-end-date.is-flipped{border-top-left-radius:5px;border-bottom-left-radius:5px;border-top-right-radius:0;border-bottom-right-radius:0}.litepicker .container__days .day-item.is-start-date.is-end-date{border-top-left-radius:5px;border-bottom-left-radius:5px;border-top-right-radius:5px;border-bottom-right-radius:5px}.litepicker .container__days .day-item.is-highlighted{color:var(--litepicker-highlighted-day-color);background-color:var(--litepicker-highlighted-day-color-bg)}.litepicker .container__days .week-number{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;color:var(--litepicker-month-week-number-color);font-size:85%}.litepicker .container__footer{text-align:right;padding:10px 5px;margin:0 5px;background-color:var(--litepicker-footer-color-bg);-webkit-box-shadow:inset 0px 3px 3px 0px var(--litepicker-footer-box-shadow-color);box-shadow:inset 0px 3px 3px 0px var(--litepicker-footer-box-shadow-color);border-bottom-left-radius:5px;border-bottom-right-radius:5px}.litepicker .container__footer .preview-date-range{margin-right:10px;font-size:90%}.litepicker .container__footer .button-cancel{background-color:var(--litepicker-button-cancel-color-bg);color:var(--litepicker-button-cancel-color);border:0;padding:3px 7px 4px;border-radius:3px}.litepicker .container__footer .button-cancel *{pointer-events:none}.litepicker .container__footer .button-apply{background-color:var(--litepicker-button-apply-color-bg);color:var(--litepicker-button-apply-color);border:0;padding:3px 7px 4px;border-radius:3px;margin-left:10px;margin-right:10px}.litepicker .container__footer .button-apply:disabled{opacity:0.7}.litepicker .container__footer .button-apply *{pointer-events:none}.litepicker .container__tooltip{position:absolute;margin-top:-4px;padding:4px 8px;border-radius:4px;background-color:var(--litepicker-tooltip-color-bg);-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.25);box-shadow:0 1px 3px rgba(0,0,0,0.25);white-space:nowrap;font-size:11px;pointer-events:none;visibility:hidden}.litepicker .container__tooltip:before{position:absolute;bottom:-5px;left:calc(50% - 5px);border-top:5px solid rgba(0,0,0,0.12);border-right:5px solid transparent;border-left:5px solid transparent;content:\"\"}.litepicker .container__tooltip:after{position:absolute;bottom:-4px;left:calc(50% - 4px);border-top:4px solid var(--litepicker-tooltip-color-bg);border-right:4px solid transparent;border-left:4px solid transparent;content:\"\"}\\n', \"\"]), e.locals = {\n showWeekNumbers: \"show-week-numbers\",\n litepicker: \"litepicker\",\n containerMain: \"container__main\",\n containerMonths: \"container__months\",\n columns2: \"columns-2\",\n columns3: \"columns-3\",\n columns4: \"columns-4\",\n splitView: \"split-view\",\n monthItemHeader: \"month-item-header\",\n buttonPreviousMonth: \"button-previous-month\",\n buttonNextMonth: \"button-next-month\",\n monthItem: \"month-item\",\n monthItemName: \"month-item-name\",\n monthItemYear: \"month-item-year\",\n resetButton: \"reset-button\",\n monthItemWeekdaysRow: \"month-item-weekdays-row\",\n noPreviousMonth: \"no-previous-month\",\n noNextMonth: \"no-next-month\",\n containerDays: \"container__days\",\n dayItem: \"day-item\",\n isToday: \"is-today\",\n isLocked: \"is-locked\",\n isInRange: \"is-in-range\",\n isStartDate: \"is-start-date\",\n isFlipped: \"is-flipped\",\n isEndDate: \"is-end-date\",\n isHighlighted: \"is-highlighted\",\n weekNumber: \"week-number\",\n containerFooter: \"container__footer\",\n previewDateRange: \"preview-date-range\",\n buttonCancel: \"button-cancel\",\n buttonApply: \"button-apply\",\n containerTooltip: \"container__tooltip\"\n }, t.exports = e;\n }, function (t, e, i) {\n \"use strict\";\n\n t.exports = function (t) {\n var e = [];\n return e.toString = function () {\n return this.map(function (e) {\n var i = function (t, e) {\n var i = t[1] || \"\",\n n = t[3];\n if (!n) return i;\n if (e && \"function\" == typeof btoa) {\n var o = (r = n, a = btoa(unescape(encodeURIComponent(JSON.stringify(r)))), l = \"sourceMappingURL=data:application/json;charset=utf-8;base64,\".concat(a), \"/*# \".concat(l, \" */\")),\n s = n.sources.map(function (t) {\n return \"/*# sourceURL=\".concat(n.sourceRoot || \"\").concat(t, \" */\");\n });\n return [i].concat(s).concat([o]).join(\"\\n\");\n }\n var r, a, l;\n return [i].join(\"\\n\");\n }(e, t);\n return e[2] ? \"@media \".concat(e[2], \" {\").concat(i, \"}\") : i;\n }).join(\"\");\n }, e.i = function (t, i, n) {\n \"string\" == typeof t && (t = [[null, t, \"\"]]);\n var o = {};\n if (n) for (var s = 0; s < this.length; s++) {\n var r = this[s][0];\n null != r && (o[r] = !0);\n }\n for (var a = 0; a < t.length; a++) {\n var l = [].concat(t[a]);\n n && o[l[0]] || (i && (l[2] ? l[2] = \"\".concat(i, \" and \").concat(l[2]) : l[2] = i), e.push(l));\n }\n }, e;\n };\n }, function (t, e, i) {\n \"use strict\";\n\n var n,\n o = {},\n s = function s() {\n return void 0 === n && (n = Boolean(window && document && document.all && !window.atob)), n;\n },\n r = function () {\n var t = {};\n return function (e) {\n if (void 0 === t[e]) {\n var i = document.querySelector(e);\n if (window.HTMLIFrameElement && i instanceof window.HTMLIFrameElement) try {\n i = i.contentDocument.head;\n } catch (t) {\n i = null;\n }\n t[e] = i;\n }\n return t[e];\n };\n }();\n function a(t, e) {\n for (var i = [], n = {}, o = 0; o < t.length; o++) {\n var s = t[o],\n r = e.base ? s[0] + e.base : s[0],\n a = {\n css: s[1],\n media: s[2],\n sourceMap: s[3]\n };\n n[r] ? n[r].parts.push(a) : i.push(n[r] = {\n id: r,\n parts: [a]\n });\n }\n return i;\n }\n function l(t, e) {\n for (var i = 0; i < t.length; i++) {\n var n = t[i],\n s = o[n.id],\n r = 0;\n if (s) {\n for (s.refs++; r < s.parts.length; r++) s.parts[r](n.parts[r]);\n for (; r < n.parts.length; r++) s.parts.push(g(n.parts[r], e));\n } else {\n for (var a = []; r < n.parts.length; r++) a.push(g(n.parts[r], e));\n o[n.id] = {\n id: n.id,\n refs: 1,\n parts: a\n };\n }\n }\n }\n function c(t) {\n var e = document.createElement(\"style\");\n if (void 0 === t.attributes.nonce) {\n var n = i.nc;\n n && (t.attributes.nonce = n);\n }\n if (Object.keys(t.attributes).forEach(function (i) {\n e.setAttribute(i, t.attributes[i]);\n }), \"function\" == typeof t.insert) t.insert(e);else {\n var o = r(t.insert || \"head\");\n if (!o) throw new Error(\"Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.\");\n o.appendChild(e);\n }\n return e;\n }\n var h,\n p = (h = [], function (t, e) {\n return h[t] = e, h.filter(Boolean).join(\"\\n\");\n });\n function d(t, e, i, n) {\n var o = i ? \"\" : n.css;\n if (t.styleSheet) t.styleSheet.cssText = p(e, o);else {\n var s = document.createTextNode(o),\n r = t.childNodes;\n r[e] && t.removeChild(r[e]), r.length ? t.insertBefore(s, r[e]) : t.appendChild(s);\n }\n }\n function u(t, e, i) {\n var n = i.css,\n o = i.media,\n s = i.sourceMap;\n if (o && t.setAttribute(\"media\", o), s && btoa && (n += \"\\n/*# sourceMappingURL=data:application/json;base64,\".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s)))), \" */\")), t.styleSheet) t.styleSheet.cssText = n;else {\n for (; t.firstChild;) t.removeChild(t.firstChild);\n t.appendChild(document.createTextNode(n));\n }\n }\n var m = null,\n f = 0;\n function g(t, e) {\n var i, n, o;\n if (e.singleton) {\n var s = f++;\n i = m || (m = c(e)), n = d.bind(null, i, s, !1), o = d.bind(null, i, s, !0);\n } else i = c(e), n = u.bind(null, i, e), o = function o() {\n !function (t) {\n if (null === t.parentNode) return !1;\n t.parentNode.removeChild(t);\n }(i);\n };\n return n(t), function (e) {\n if (e) {\n if (e.css === t.css && e.media === t.media && e.sourceMap === t.sourceMap) return;\n n(t = e);\n } else o();\n };\n }\n t.exports = function (t, e) {\n (e = e || {}).attributes = \"object\" == _typeof(e.attributes) ? e.attributes : {}, e.singleton || \"boolean\" == typeof e.singleton || (e.singleton = s());\n var i = a(t, e);\n return l(i, e), function (t) {\n for (var n = [], s = 0; s < i.length; s++) {\n var r = i[s],\n c = o[r.id];\n c && (c.refs--, n.push(c));\n }\n t && l(a(t, e), e);\n for (var h = 0; h < n.length; h++) {\n var p = n[h];\n if (0 === p.refs) {\n for (var d = 0; d < p.parts.length; d++) p.parts[d]();\n delete o[p.id];\n }\n }\n };\n };\n }, function (t, e, i) {\n \"use strict\";\n\n var n = this && this.__assign || function () {\n return (n = Object.assign || function (t) {\n for (var e, i = 1, n = arguments.length; i < n; i++) for (var o in e = arguments[i]) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);\n return t;\n }).apply(this, arguments);\n };\n Object.defineProperty(e, \"__esModule\", {\n value: !0\n });\n var o = i(0),\n s = i(1),\n r = i(2);\n s.Litepicker.prototype.show = function (t) {\n void 0 === t && (t = null), this.emit(\"before:show\", t);\n var e = t || this.options.element;\n if (this.triggerElement = e, !this.isShowning()) {\n if (this.options.inlineMode) return this.ui.style.position = \"relative\", this.ui.style.display = \"inline-block\", this.ui.style.top = null, this.ui.style.left = null, this.ui.style.bottom = null, void (this.ui.style.right = null);\n this.scrollToDate(t), this.render(), this.ui.style.position = \"absolute\", this.ui.style.display = \"block\", this.ui.style.zIndex = this.options.zIndex;\n var i = this.findPosition(e);\n this.ui.style.top = i.top + \"px\", this.ui.style.left = i.left + \"px\", this.ui.style.right = null, this.ui.style.bottom = null, this.emit(\"show\", t);\n }\n }, s.Litepicker.prototype.hide = function () {\n this.isShowning() && (this.datePicked.length = 0, this.updateInput(), this.options.inlineMode ? this.render() : (this.ui.style.display = \"none\", this.emit(\"hide\")));\n }, s.Litepicker.prototype.getDate = function () {\n return this.getStartDate();\n }, s.Litepicker.prototype.getStartDate = function () {\n return this.options.startDate ? this.options.startDate.clone() : null;\n }, s.Litepicker.prototype.getEndDate = function () {\n return this.options.endDate ? this.options.endDate.clone() : null;\n }, s.Litepicker.prototype.setDate = function (t, e) {\n void 0 === e && (e = !1);\n var i = new o.DateTime(t, this.options.format, this.options.lang);\n r.dateIsLocked(i, this.options, [i]) && !e ? this.emit(\"error:date\", i) : (this.setStartDate(t), this.options.inlineMode && this.render(), this.emit(\"selected\", this.getDate()));\n }, s.Litepicker.prototype.setStartDate = function (t) {\n t && (this.options.startDate = new o.DateTime(t, this.options.format, this.options.lang), this.updateInput());\n }, s.Litepicker.prototype.setEndDate = function (t) {\n t && (this.options.endDate = new o.DateTime(t, this.options.format, this.options.lang), this.options.startDate.getTime() > this.options.endDate.getTime() && (this.options.endDate = this.options.startDate.clone(), this.options.startDate = new o.DateTime(t, this.options.format, this.options.lang)), this.updateInput());\n }, s.Litepicker.prototype.setDateRange = function (t, e, i) {\n void 0 === i && (i = !1), this.triggerElement = void 0;\n var n = new o.DateTime(t, this.options.format, this.options.lang),\n s = new o.DateTime(e, this.options.format, this.options.lang);\n (this.options.disallowLockDaysInRange ? r.rangeIsLocked([n, s], this.options) : r.dateIsLocked(n, this.options, [n, s]) || r.dateIsLocked(s, this.options, [n, s])) && !i ? this.emit(\"error:range\", [n, s]) : (this.setStartDate(n), this.setEndDate(s), this.options.inlineMode && this.render(), this.updateInput(), this.emit(\"selected\", this.getStartDate(), this.getEndDate()));\n }, s.Litepicker.prototype.gotoDate = function (t, e) {\n void 0 === e && (e = 0);\n var i = new o.DateTime(t);\n i.setDate(1), this.calendars[e] = i.clone(), this.render();\n }, s.Litepicker.prototype.setLockDays = function (t) {\n this.options.lockDays = o.DateTime.convertArray(t, this.options.lockDaysFormat), this.render();\n }, s.Litepicker.prototype.setHighlightedDays = function (t) {\n this.options.highlightedDays = o.DateTime.convertArray(t, this.options.highlightedDaysFormat), this.render();\n }, s.Litepicker.prototype.setOptions = function (t) {\n delete t.element, delete t.elementEnd, delete t.parentEl, t.startDate && (t.startDate = new o.DateTime(t.startDate, this.options.format, this.options.lang)), t.endDate && (t.endDate = new o.DateTime(t.endDate, this.options.format, this.options.lang));\n var e = n(n({}, this.options.dropdowns), t.dropdowns),\n i = n(n({}, this.options.buttonText), t.buttonText),\n s = n(n({}, this.options.tooltipText), t.tooltipText);\n this.options = n(n({}, this.options), t), this.options.dropdowns = n({}, e), this.options.buttonText = n({}, i), this.options.tooltipText = n({}, s), !this.options.singleMode || this.options.startDate instanceof o.DateTime || (this.options.startDate = null, this.options.endDate = null), this.options.singleMode || this.options.startDate instanceof o.DateTime && this.options.endDate instanceof o.DateTime || (this.options.startDate = null, this.options.endDate = null);\n for (var r = 0; r < this.options.numberOfMonths; r += 1) {\n var a = this.options.startDate ? this.options.startDate.clone() : new o.DateTime();\n a.setDate(1), a.setMonth(a.getMonth() + r), this.calendars[r] = a;\n }\n this.options.lockDays.length && (this.options.lockDays = o.DateTime.convertArray(this.options.lockDays, this.options.lockDaysFormat)), this.options.highlightedDays.length && (this.options.highlightedDays = o.DateTime.convertArray(this.options.highlightedDays, this.options.highlightedDaysFormat)), this.render(), this.options.inlineMode && this.show(), this.updateInput();\n }, s.Litepicker.prototype.clearSelection = function () {\n this.options.startDate = null, this.options.endDate = null, this.datePicked.length = 0, this.updateInput(), this.isShowning() && this.render(), this.emit(\"clear:selection\");\n }, s.Litepicker.prototype.destroy = function () {\n this.ui && this.ui.parentNode && (this.ui.parentNode.removeChild(this.ui), this.ui = null), this.emit(\"destroy\");\n };\n }]);\n});","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\n/*!\n * imagesLoaded v4.1.4\n * JavaScript is all like \"You images are done yet or what?\"\n * MIT License\n */\n\n(function (window, factory) {\n 'use strict';\n\n // universal module definition\n\n /*global define: false, module: false, require: false */\n if (typeof define == 'function' && define.amd) {\n // AMD\n define(['ev-emitter/ev-emitter'], function (EvEmitter) {\n return factory(window, EvEmitter);\n });\n } else if ((typeof module === \"undefined\" ? \"undefined\" : _typeof(module)) == 'object' && module.exports) {\n // CommonJS\n module.exports = factory(window, require('ev-emitter'));\n } else {\n // browser global\n window.imagesLoaded = factory(window, window.EvEmitter);\n }\n})(typeof window !== 'undefined' ? window : this,\n// -------------------------- factory -------------------------- //\n\nfunction factory(window, EvEmitter) {\n 'use strict';\n\n var $ = window.jQuery;\n var console = window.console;\n\n // -------------------------- helpers -------------------------- //\n\n // extend objects\n function extend(a, b) {\n for (var prop in b) {\n a[prop] = b[prop];\n }\n return a;\n }\n var arraySlice = Array.prototype.slice;\n\n // turn element or nodeList into an array\n function makeArray(obj) {\n if (Array.isArray(obj)) {\n // use object if already an array\n return obj;\n }\n var isArrayLike = _typeof(obj) == 'object' && typeof obj.length == 'number';\n if (isArrayLike) {\n // convert nodeList to array\n return arraySlice.call(obj);\n }\n\n // array of single index\n return [obj];\n }\n\n // -------------------------- imagesLoaded -------------------------- //\n\n /**\n * @param {Array, Element, NodeList, String} elem\n * @param {Object or Function} options - if function, use as callback\n * @param {Function} onAlways - callback function\n */\n function ImagesLoaded(elem, options, onAlways) {\n // coerce ImagesLoaded() without new, to be new ImagesLoaded()\n if (!(this instanceof ImagesLoaded)) {\n return new ImagesLoaded(elem, options, onAlways);\n }\n // use elem as selector string\n var queryElem = elem;\n if (typeof elem == 'string') {\n queryElem = document.querySelectorAll(elem);\n }\n // bail if bad element\n if (!queryElem) {\n console.error('Bad element for imagesLoaded ' + (queryElem || elem));\n return;\n }\n this.elements = makeArray(queryElem);\n this.options = extend({}, this.options);\n // shift arguments if no options set\n if (typeof options == 'function') {\n onAlways = options;\n } else {\n extend(this.options, options);\n }\n if (onAlways) {\n this.on('always', onAlways);\n }\n this.getImages();\n if ($) {\n // add jQuery Deferred object\n this.jqDeferred = new $.Deferred();\n }\n\n // HACK check async to allow time to bind listeners\n setTimeout(this.check.bind(this));\n }\n ImagesLoaded.prototype = Object.create(EvEmitter.prototype);\n ImagesLoaded.prototype.options = {};\n ImagesLoaded.prototype.getImages = function () {\n this.images = [];\n\n // filter & find items if we have an item selector\n this.elements.forEach(this.addElementImages, this);\n };\n\n /**\n * @param {Node} element\n */\n ImagesLoaded.prototype.addElementImages = function (elem) {\n // filter siblings\n if (elem.nodeName == 'IMG') {\n this.addImage(elem);\n }\n // get background image on element\n if (this.options.background === true) {\n this.addElementBackgroundImages(elem);\n }\n\n // find children\n // no non-element nodes, #143\n var nodeType = elem.nodeType;\n if (!nodeType || !elementNodeTypes[nodeType]) {\n return;\n }\n var childImgs = elem.querySelectorAll('img');\n // concat childElems to filterFound array\n for (var i = 0; i < childImgs.length; i++) {\n var img = childImgs[i];\n this.addImage(img);\n }\n\n // get child background images\n if (typeof this.options.background == 'string') {\n var children = elem.querySelectorAll(this.options.background);\n for (i = 0; i < children.length; i++) {\n var child = children[i];\n this.addElementBackgroundImages(child);\n }\n }\n };\n var elementNodeTypes = {\n 1: true,\n 9: true,\n 11: true\n };\n ImagesLoaded.prototype.addElementBackgroundImages = function (elem) {\n var style = getComputedStyle(elem);\n if (!style) {\n // Firefox returns null if in a hidden iframe https://bugzil.la/548397\n return;\n }\n // get url inside url(\"...\")\n var reURL = /url\\((['\"])?(.*?)\\1\\)/gi;\n var matches = reURL.exec(style.backgroundImage);\n while (matches !== null) {\n var url = matches && matches[2];\n if (url) {\n this.addBackground(url, elem);\n }\n matches = reURL.exec(style.backgroundImage);\n }\n };\n\n /**\n * @param {Image} img\n */\n ImagesLoaded.prototype.addImage = function (img) {\n var loadingImage = new LoadingImage(img);\n this.images.push(loadingImage);\n };\n ImagesLoaded.prototype.addBackground = function (url, elem) {\n var background = new Background(url, elem);\n this.images.push(background);\n };\n ImagesLoaded.prototype.check = function () {\n var _this = this;\n this.progressedCount = 0;\n this.hasAnyBroken = false;\n // complete if no images\n if (!this.images.length) {\n this.complete();\n return;\n }\n function onProgress(image, elem, message) {\n // HACK - Chrome triggers event before object properties have changed. #83\n setTimeout(function () {\n _this.progress(image, elem, message);\n });\n }\n this.images.forEach(function (loadingImage) {\n loadingImage.once('progress', onProgress);\n loadingImage.check();\n });\n };\n ImagesLoaded.prototype.progress = function (image, elem, message) {\n this.progressedCount++;\n this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded;\n // progress event\n this.emitEvent('progress', [this, image, elem]);\n if (this.jqDeferred && this.jqDeferred.notify) {\n this.jqDeferred.notify(this, image);\n }\n // check if completed\n if (this.progressedCount == this.images.length) {\n this.complete();\n }\n if (this.options.debug && console) {\n console.log('progress: ' + message, image, elem);\n }\n };\n ImagesLoaded.prototype.complete = function () {\n var eventName = this.hasAnyBroken ? 'fail' : 'done';\n this.isComplete = true;\n this.emitEvent(eventName, [this]);\n this.emitEvent('always', [this]);\n if (this.jqDeferred) {\n var jqMethod = this.hasAnyBroken ? 'reject' : 'resolve';\n this.jqDeferred[jqMethod](this);\n }\n };\n\n // -------------------------- -------------------------- //\n\n function LoadingImage(img) {\n this.img = img;\n }\n LoadingImage.prototype = Object.create(EvEmitter.prototype);\n LoadingImage.prototype.check = function () {\n // If complete is true and browser supports natural sizes,\n // try to check for image status manually.\n var isComplete = this.getIsImageComplete();\n if (isComplete) {\n // report based on naturalWidth\n this.confirm(this.img.naturalWidth !== 0, 'naturalWidth');\n return;\n }\n\n // If none of the checks above matched, simulate loading on detached element.\n this.proxyImage = new Image();\n this.proxyImage.addEventListener('load', this);\n this.proxyImage.addEventListener('error', this);\n // bind to image as well for Firefox. #191\n this.img.addEventListener('load', this);\n this.img.addEventListener('error', this);\n this.proxyImage.src = this.img.src;\n };\n LoadingImage.prototype.getIsImageComplete = function () {\n // check for non-zero, non-undefined naturalWidth\n // fixes Safari+InfiniteScroll+Masonry bug infinite-scroll#671\n return this.img.complete && this.img.naturalWidth;\n };\n LoadingImage.prototype.confirm = function (isLoaded, message) {\n this.isLoaded = isLoaded;\n this.emitEvent('progress', [this, this.img, message]);\n };\n\n // ----- events ----- //\n\n // trigger specified handler for event type\n LoadingImage.prototype.handleEvent = function (event) {\n var method = 'on' + event.type;\n if (this[method]) {\n this[method](event);\n }\n };\n LoadingImage.prototype.onload = function () {\n this.confirm(true, 'onload');\n this.unbindEvents();\n };\n LoadingImage.prototype.onerror = function () {\n this.confirm(false, 'onerror');\n this.unbindEvents();\n };\n LoadingImage.prototype.unbindEvents = function () {\n this.proxyImage.removeEventListener('load', this);\n this.proxyImage.removeEventListener('error', this);\n this.img.removeEventListener('load', this);\n this.img.removeEventListener('error', this);\n };\n\n // -------------------------- Background -------------------------- //\n\n function Background(url, element) {\n this.url = url;\n this.element = element;\n this.img = new Image();\n }\n\n // inherit LoadingImage prototype\n Background.prototype = Object.create(LoadingImage.prototype);\n Background.prototype.check = function () {\n this.img.addEventListener('load', this);\n this.img.addEventListener('error', this);\n this.img.src = this.url;\n // check if image is already complete\n var isComplete = this.getIsImageComplete();\n if (isComplete) {\n this.confirm(this.img.naturalWidth !== 0, 'naturalWidth');\n this.unbindEvents();\n }\n };\n Background.prototype.unbindEvents = function () {\n this.img.removeEventListener('load', this);\n this.img.removeEventListener('error', this);\n };\n Background.prototype.confirm = function (isLoaded, message) {\n this.isLoaded = isLoaded;\n this.emitEvent('progress', [this, this.element, message]);\n };\n\n // -------------------------- jQuery -------------------------- //\n\n ImagesLoaded.makeJQueryPlugin = function (jQuery) {\n jQuery = jQuery || window.jQuery;\n if (!jQuery) {\n return;\n }\n // set local variable\n $ = jQuery;\n // $().imagesLoaded()\n $.fn.imagesLoaded = function (options, callback) {\n var instance = new ImagesLoaded(this, options, callback);\n return instance.jqDeferred.promise($(this));\n };\n };\n // try making plugin\n ImagesLoaded.makeJQueryPlugin();\n\n // -------------------------- -------------------------- //\n\n return ImagesLoaded;\n});","(function (global, factory) {\n if (typeof define === \"function\" && define.amd) {\n define(['./lg-utils'], factory);\n } else if (typeof exports !== \"undefined\") {\n factory(require('./lg-utils'));\n } else {\n var mod = {\n exports: {}\n };\n factory(global.lgUtils);\n global.lightgallery = mod.exports;\n }\n})(this, function (_lgUtils) {\n 'use strict';\n\n var _lgUtils2 = _interopRequireDefault(_lgUtils);\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n \"default\": obj\n };\n }\n var _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n\n /** Polyfill the CustomEvent() constructor functionality in Internet Explorer 9 and higher */\n (function () {\n if (typeof window.CustomEvent === 'function') {\n return false;\n }\n function CustomEvent(event, params) {\n params = params || {\n bubbles: false,\n cancelable: false,\n detail: undefined\n };\n var evt = document.createEvent('CustomEvent');\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n return evt;\n }\n CustomEvent.prototype = window.Event.prototype;\n window.CustomEvent = CustomEvent;\n })();\n window.utils = _lgUtils2[\"default\"];\n window.lgData = {\n uid: 0\n };\n window.lgModules = {};\n var defaults = {\n mode: 'lg-slide',\n // Ex : 'ease'\n cssEasing: 'ease',\n //'for jquery animation'\n easing: 'linear',\n speed: 600,\n height: '100%',\n width: '100%',\n addClass: '',\n startClass: 'lg-start-zoom',\n backdropDuration: 150,\n // Set 0, if u don't want to hide the controls \n hideBarsDelay: 6000,\n useLeft: false,\n // aria-labelledby attribute fot gallery\n ariaLabelledby: '',\n //aria-describedby attribute for gallery\n ariaDescribedby: '',\n closable: true,\n loop: true,\n escKey: true,\n keyPress: true,\n controls: true,\n slideEndAnimatoin: true,\n hideControlOnEnd: false,\n mousewheel: false,\n getCaptionFromTitleOrAlt: true,\n // .lg-item || '.lg-sub-html'\n appendSubHtmlTo: '.lg-sub-html',\n subHtmlSelectorRelative: false,\n /**\n * @desc number of preload slides\n * will exicute only after the current slide is fully loaded.\n *\n * @ex you clicked on 4th image and if preload = 1 then 3rd slide and 5th\n * slide will be loaded in the background after the 4th slide is fully loaded..\n * if preload is 2 then 2nd 3rd 5th 6th slides will be preloaded.. ... ...\n *\n */\n preload: 1,\n showAfterLoad: true,\n selector: '',\n selectWithin: '',\n nextHtml: '',\n prevHtml: '',\n // 0, 1\n index: false,\n iframeMaxWidth: '100%',\n download: true,\n counter: true,\n appendCounterTo: '.lg-toolbar',\n swipeThreshold: 50,\n enableSwipe: true,\n enableDrag: true,\n dynamic: false,\n dynamicEl: [],\n galleryId: 1,\n supportLegacyBrowser: true\n };\n function Plugin(element, options) {\n // Current lightGallery element\n this.el = element;\n\n // lightGallery settings\n this.s = _extends({}, defaults, options);\n\n // When using dynamic mode, ensure dynamicEl is an array\n if (this.s.dynamic && this.s.dynamicEl !== 'undefined' && this.s.dynamicEl.constructor === Array && !this.s.dynamicEl.length) {\n throw 'When using dynamic mode, you must also define dynamicEl as an Array.';\n }\n\n // lightGallery modules\n this.modules = {};\n\n // false when lightgallery complete first slide;\n this.lGalleryOn = false;\n this.lgBusy = false;\n\n // Timeout function for hiding controls;\n this.hideBartimeout = false;\n\n // To determine browser supports for touch events;\n this.isTouch = 'ontouchstart' in document.documentElement;\n\n // Disable hideControlOnEnd if sildeEndAnimation is true\n if (this.s.slideEndAnimatoin) {\n this.s.hideControlOnEnd = false;\n }\n this.items = [];\n\n // Gallery items\n if (this.s.dynamic) {\n this.items = this.s.dynamicEl;\n } else {\n if (this.s.selector === 'this') {\n this.items.push(this.el);\n } else if (this.s.selector !== '') {\n if (this.s.selectWithin) {\n this.items = document.querySelector(this.s.selectWithin).querySelectorAll(this.s.selector);\n } else {\n this.items = this.el.querySelectorAll(this.s.selector);\n }\n } else {\n this.items = this.el.children;\n }\n }\n\n // .lg-item\n\n this.___slide = '';\n\n // .lg-outer\n this.outer = '';\n this.init();\n return this;\n }\n Plugin.prototype.init = function () {\n var _this = this;\n\n // s.preload should not be more than $item.length\n if (_this.s.preload > _this.items.length) {\n _this.s.preload = _this.items.length;\n }\n\n // if dynamic option is enabled execute immediately\n var _hash = window.location.hash;\n if (_hash.indexOf('lg=' + this.s.galleryId) > 0) {\n _this.index = parseInt(_hash.split('&slide=')[1], 10);\n _lgUtils2[\"default\"].addClass(document.body, 'lg-from-hash');\n if (!_lgUtils2[\"default\"].hasClass(document.body, 'lg-on')) {\n _lgUtils2[\"default\"].addClass(document.body, 'lg-on');\n setTimeout(function () {\n _this.build(_this.index);\n });\n }\n }\n if (_this.s.dynamic) {\n _lgUtils2[\"default\"].trigger(this.el, 'onBeforeOpen');\n _this.index = _this.s.index || 0;\n\n // prevent accidental double execution\n if (!_lgUtils2[\"default\"].hasClass(document.body, 'lg-on')) {\n _lgUtils2[\"default\"].addClass(document.body, 'lg-on');\n setTimeout(function () {\n _this.build(_this.index);\n });\n }\n } else {\n for (var i = 0; i < _this.items.length; i++) {\n /*jshint loopfunc: true */\n (function (index) {\n // Using different namespace for click because click event should not unbind if selector is same object('this')\n _lgUtils2[\"default\"].on(_this.items[index], 'click.lgcustom', function (e) {\n e.preventDefault();\n _lgUtils2[\"default\"].trigger(_this.el, 'onBeforeOpen');\n _this.index = _this.s.index || index;\n if (!_lgUtils2[\"default\"].hasClass(document.body, 'lg-on')) {\n _this.build(_this.index);\n _lgUtils2[\"default\"].addClass(document.body, 'lg-on');\n }\n });\n })(i);\n }\n }\n };\n Plugin.prototype.build = function (index) {\n var _this = this;\n _this.structure();\n for (var key in window.lgModules) {\n _this.modules[key] = new window.lgModules[key](_this.el);\n }\n\n // initiate slide function\n _this.slide(index, false, false);\n if (_this.s.keyPress) {\n _this.keyPress();\n }\n if (_this.items.length > 1) {\n _this.arrow();\n setTimeout(function () {\n _this.enableDrag();\n _this.enableSwipe();\n }, 50);\n if (_this.s.mousewheel) {\n _this.mousewheel();\n }\n }\n _this.counter();\n _this.closeGallery();\n _lgUtils2[\"default\"].trigger(_this.el, 'onAfterOpen');\n\n // Hide controllers if mouse doesn't move for some period\n if (_this.s.hideBarsDelay > 0) {\n // Hide controls if user doesn't use mouse or touch after opening gallery\n var initialHideBarTimeout = setTimeout(function () {\n _lgUtils2[\"default\"].addClass(_this.outer, 'lg-hide-items');\n }, _this.s.hideBarsDelay);\n _lgUtils2[\"default\"].on(_this.outer, 'mousemove.lg click.lg touchstart.lg', function () {\n // Cancel initalHideBarTimout if user uses mouse or touch events\n // Before it fires\n clearTimeout(initialHideBarTimeout);\n _lgUtils2[\"default\"].removeClass(_this.outer, 'lg-hide-items');\n clearTimeout(_this.hideBartimeout);\n\n // Timeout will be cleared on each slide movement also\n _this.hideBartimeout = setTimeout(function () {\n _lgUtils2[\"default\"].addClass(_this.outer, 'lg-hide-items');\n }, _this.s.hideBarsDelay);\n });\n }\n };\n Plugin.prototype.structure = function () {\n var list = '';\n var controls = '';\n var i = 0;\n var subHtmlCont = '';\n var template;\n var _this = this;\n document.body.insertAdjacentHTML('beforeend', '');\n _lgUtils2[\"default\"].setVendor(document.querySelector('.lg-backdrop'), 'TransitionDuration', this.s.backdropDuration + 'ms');\n\n // Create gallery items\n for (i = 0; i < this.items.length; i++) {\n list += '';\n }\n\n // Create controlls\n if (this.s.controls && this.items.length > 1) {\n controls = '