3 lines
44 KiB
JavaScript
3 lines
44 KiB
JavaScript
!function(){function e(t){return(e=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(t)}function t(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(t=function(){return!!e})()}function i(e,t){if(t&&("object"==(t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function n(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function r(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e,t,i){return t&&r(e.prototype,t),i&&r(e,i),e}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var a,s=function(){"use strict";function e(){n(this,e)}return o(e,[{key:"on",value:function(e,t){return this._callbacks=this._callbacks||{},this._callbacks[e]||(this._callbacks[e]=[]),this._callbacks[e].push(t),this}},{key:"emit",value:function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];this._callbacks=this._callbacks||{};var r=this._callbacks[e],o=!0,l=!1,a=void 0;if(r)try{for(var s,u=r[Symbol.iterator]();!(o=(s=u.next()).done);o=!0)s.value.apply(this,i)}catch(e){l=!0,a=e}finally{try{o||null==u.return||u.return()}finally{if(l)throw a}}return this.element&&this.element.dispatchEvent(this.makeEvent("dropzone:"+e,{args:i})),this}},{key:"makeEvent",value:function(e,t){var i={bubbles:!0,cancelable:!0,detail:t};if("function"==typeof window.CustomEvent)return new CustomEvent(e,i);var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,i.bubbles,i.cancelable,i.detail),n}},{key:"off",value:function(e,t){if(!this._callbacks||0==arguments.length)return this._callbacks={},this;var i=this._callbacks[e];if(!i)return this;if(1==arguments.length)return delete this._callbacks[e],this;for(var n=0;n<i.length;n++)if(i[n]===t){i.splice(n,1);break}return this}}]),e}(),u={},d={url:null,method:"post",withCredentials:!1,timeout:null,parallelUploads:2,uploadMultiple:!1,chunking:!1,forceChunking:!1,chunkSize:2097152,parallelChunkUploads:!1,retryChunks:!1,retryChunksLimit:3,maxFilesize:256,paramName:"file",createImageThumbnails:!0,maxThumbnailFilesize:10,thumbnailWidth:120,thumbnailHeight:120,thumbnailMethod:"crop",resizeWidth:null,resizeHeight:null,resizeMimeType:null,resizeQuality:.8,resizeMethod:"contain",filesizeBase:1e3,maxFiles:null,headers:null,defaultHeaders:!0,clickable:!0,ignoreHiddenFiles:!0,acceptedFiles:null,autoProcessQueue:!0,autoQueue:!0,addRemoveLinks:!1,previewsContainer:null,disablePreviews:!1,hiddenInputContainer:"body",capture:null,renameFilename:null,renameFile:null,forceFallback:!1,dictDefaultMessage:"Drop files here to upload",dictFallbackMessage:"Your browser does not support drag'n'drop file uploads.",dictFallbackText:"Please use the fallback form below to upload your files like in the olden days.",dictFileTooBig:"File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",dictInvalidFileType:"You can't upload files of this type.",dictResponseError:"Server responded with {{statusCode}} code.",dictCancelUpload:"Cancel upload",dictUploadCanceled:"Upload canceled.",dictCancelUploadConfirmation:"Are you sure you want to cancel this upload?",dictRemoveFile:"Remove file",dictRemoveFileConfirmation:null,dictMaxFilesExceeded:"You cannot upload any more files.",dictFileSizeUnits:{tb:"TB",gb:"GB",mb:"MB",kb:"KB",b:"b"},init:function(){},params:function(e,t,i){if(i)return{dzuuid:i.file.upload.uuid,dzchunkindex:i.index,dztotalfilesize:i.file.size,dzchunksize:this.options.chunkSize,dztotalchunkcount:i.file.upload.totalChunkCount,dzchunkbyteoffset:i.index*this.options.chunkSize}},accept:function(e,t){return t()},chunksUploaded:function(e,t){t()},binaryBody:!1,fallback:function(){this.element.className="".concat(this.element.className," dz-browser-not-supported");var e=!0,t=!1,i=void 0;try{for(var n,r,o=this.element.getElementsByTagName("div")[Symbol.iterator]();!(e=(r=o.next()).done);e=!0){var l=r.value;if(/(^| )dz-message($| )/.test(l.className)){n=l,l.className="dz-message";break}}}catch(e){t=!0,i=e}finally{try{e||null==o.return||o.return()}finally{if(t)throw i}}n||(n=c.createElement('<div class="dz-message"><span></span></div>'),this.element.appendChild(n));var a=n.getElementsByTagName("span")[0];return a&&(null!=a.textContent?a.textContent=this.options.dictFallbackMessage:null!=a.innerText&&(a.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize:function(e,t,i,n){var r={srcX:0,srcY:0,srcWidth:e.width,srcHeight:e.height},o=e.width/e.height;null==t&&null==i?(t=r.srcWidth,i=r.srcHeight):null==t?t=i*o:null==i&&(i=t/o);var l=(t=Math.min(t,r.srcWidth))/(i=Math.min(i,r.srcHeight));if(r.srcWidth>t||r.srcHeight>i)if("crop"===n)o>l?(r.srcHeight=e.height,r.srcWidth=r.srcHeight*l):(r.srcWidth=e.width,r.srcHeight=r.srcWidth/l);else if("contain"===n)o>l?i=t/o:t=i*o;else throw Error("Unknown resizeMethod '".concat(n,"'"));return r.srcX=(e.width-r.srcWidth)/2,r.srcY=(e.height-r.srcHeight)/2,r.trgWidth=t,r.trgHeight=i,r},transformFile:function(e,t){return(this.options.resizeWidth||this.options.resizeHeight)&&e.type.match(/image.*/)?this.resizeImage(e,this.options.resizeWidth,this.options.resizeHeight,this.options.resizeMethod,t):t(e)},previewTemplate:(a='<div class="dz-file-preview dz-preview">\n <div class=dz-image><img data-dz-thumbnail></div>\n <div class=dz-details>\n <div class=dz-size><span data-dz-size></span></div>\n <div class=dz-filename><span data-dz-name></span></div>\n </div>\n <div class=dz-progress>\n <span class=dz-upload data-dz-uploadprogress></span>\n </div>\n <div class=dz-error-message><span data-dz-errormessage></span></div>\n <div class=dz-success-mark>\n <svg xmlns:xmlns=http://www.w3.org/2000/svg width=54 height=54 fill=#fff viewBox="0 0 54 54"><path d="m10.207 29.793 4.086-4.086a1 1 0 0 1 1.414 0l5.586 5.586a1 1 0 0 0 1.414 0l15.586-15.586a1 1 0 0 1 1.414 0l4.086 4.086a1 1 0 0 1 0 1.414L22.707 42.293a1 1 0 0 1-1.414 0L10.207 31.207a1 1 0 0 1 0-1.414"/></svg>\n </div>\n <div class=dz-error-mark>\n <svg xmlns:xmlns=http://www.w3.org/2000/svg width=54 height=54 fill=#fff viewBox="0 0 54 54"><path d="m26.293 20.293-7.086-7.086a1 1 0 0 0-1.414 0l-4.586 4.586a1 1 0 0 0 0 1.414l7.086 7.086a1 1 0 0 1 0 1.414l-7.086 7.086a1 1 0 0 0 0 1.414l4.586 4.586a1 1 0 0 0 1.414 0l7.086-7.086a1 1 0 0 1 1.414 0l7.086 7.086a1 1 0 0 0 1.414 0l4.586-4.586a1 1 0 0 0 0-1.414l-7.086-7.086a1 1 0 0 1 0-1.414l7.086-7.086a1 1 0 0 0 0-1.414l-4.586-4.586a1 1 0 0 0-1.414 0l-7.086 7.086a1 1 0 0 1-1.414 0"/></svg>\n </div>\n</div>\n').__esModule?a.default:a,drop:function(e){return this.element.classList.remove("dz-drag-hover")},dragstart:function(e){},dragend:function(e){return this.element.classList.remove("dz-drag-hover")},dragenter:function(e){return this.element.classList.add("dz-drag-hover")},dragover:function(e){return this.element.classList.add("dz-drag-hover")},dragleave:function(e){return this.element.classList.remove("dz-drag-hover")},paste:function(e){},reset:function(){return this.element.classList.remove("dz-started")},addedfile:function(e){var t=this;if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer&&!this.options.disablePreviews){e.previewElement=c.createElement(this.options.previewTemplate.trim()),e.previewTemplate=e.previewElement,this.previewsContainer.appendChild(e.previewElement);var i=!0,n=!1,r=void 0;try{for(var o,l=e.previewElement.querySelectorAll("[data-dz-name]")[Symbol.iterator]();!(i=(o=l.next()).done);i=!0){var a=o.value;a.textContent=e.name}}catch(e){n=!0,r=e}finally{try{i||null==l.return||l.return()}finally{if(n)throw r}}var s=!0,u=!1,d=void 0;try{for(var h,p=e.previewElement.querySelectorAll("[data-dz-size]")[Symbol.iterator]();!(s=(h=p.next()).done);s=!0)(a=h.value).innerHTML=this.filesize(e.size)}catch(e){u=!0,d=e}finally{try{s||null==p.return||p.return()}finally{if(u)throw d}}this.options.addRemoveLinks&&(e._removeLink=c.createElement('<a class="dz-remove" href="javascript:undefined;" data-dz-remove>'.concat(this.options.dictRemoveFile,"</a>")),e.previewElement.appendChild(e._removeLink));var f=function(i){if(i.preventDefault(),i.stopPropagation(),e.status===c.UPLOADING)if(t.options.dictCancelUploadConfirmation)return c.confirm(t.options.dictCancelUploadConfirmation,function(){return t.removeFile(e)});else return t.removeFile(e);return t.options.dictRemoveFileConfirmation?c.confirm(t.options.dictRemoveFileConfirmation,function(){return t.removeFile(e)}):t.removeFile(e)},m=!0,v=!1,y=void 0;try{for(var g,b=e.previewElement.querySelectorAll("[data-dz-remove]")[Symbol.iterator]();!(m=(g=b.next()).done);m=!0)g.value.addEventListener("click",f)}catch(e){v=!0,y=e}finally{try{m||null==b.return||b.return()}finally{if(v)throw y}}}},removedfile:function(e){return null!=e.previewElement&&null!=e.previewElement.parentNode&&e.previewElement.parentNode.removeChild(e.previewElement),this._updateMaxFilesReachedClass()},thumbnail:function(e,t){if(e.previewElement){e.previewElement.classList.remove("dz-file-preview");var i=!0,n=!1,r=void 0;try{for(var o,l=e.previewElement.querySelectorAll("[data-dz-thumbnail]")[Symbol.iterator]();!(i=(o=l.next()).done);i=!0){var a=o.value;a.alt=e.name,a.src=t}}catch(e){n=!0,r=e}finally{try{i||null==l.return||l.return()}finally{if(n)throw r}}return setTimeout(function(){return e.previewElement.classList.add("dz-image-preview")},1)}},error:function(e,t){if(e.previewElement){e.previewElement.classList.add("dz-error"),"string"!=typeof t&&t.error&&(t=t.error);var i=!0,n=!1,r=void 0;try{for(var o,l=e.previewElement.querySelectorAll("[data-dz-errormessage]")[Symbol.iterator]();!(i=(o=l.next()).done);i=!0)o.value.textContent=t}catch(e){n=!0,r=e}finally{try{i||null==l.return||l.return()}finally{if(n)throw r}}}},errormultiple:function(){},processing:function(e){if(e.previewElement&&(e.previewElement.classList.add("dz-processing"),e._removeLink))return e._removeLink.innerHTML=this.options.dictCancelUpload},processingmultiple:function(){},uploadprogress:function(e,t,i){var n=!0,r=!1,o=void 0;if(e.previewElement)try{for(var l,a=e.previewElement.querySelectorAll("[data-dz-uploadprogress]")[Symbol.iterator]();!(n=(l=a.next()).done);n=!0){var s=l.value;"PROGRESS"===s.nodeName?s.value=t:s.style.width="".concat(t,"%")}}catch(e){r=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(r)throw o}}},totaluploadprogress:function(){},sending:function(){},sendingmultiple:function(){},success:function(e){if(e.previewElement)return e.previewElement.classList.add("dz-success")},successmultiple:function(){},canceled:function(e){return this.emit("error",e,this.options.dictUploadCanceled)},canceledmultiple:function(){},complete:function(e){if(e._removeLink&&(e._removeLink.innerHTML=this.options.dictRemoveFile),e.previewElement)return e.previewElement.classList.add("dz-complete")},completemultiple:function(){},maxfilesexceeded:function(){},maxfilesreached:function(){},queuecomplete:function(){},addedfiles:function(){},emptyfolder:function(){}},c=function(r){"use strict";if("function"!=typeof r&&null!==r)throw TypeError("Super expression must either be null or a function");function a(r,o){if(n(this,a),l=e(l=a),(u=i(this,t()?Reflect.construct(l,[],e(this).constructor):l.apply(this,s))).element=r,u.clickableElements=[],u.listeners=[],u.files=[],"string"==typeof u.element&&(u.element=document.querySelector(u.element)),null===u.element||!u.element instanceof HTMLElement)throw Error("Invalid dropzone element: not an instance of HTMLElement.");if(u.element.dropzone)throw Error("Dropzone already attached.");a.instances.push(u),u.element.dropzone=u;var l,s,u,c,h,p=null!=(h=a.optionsForElement(u.element))?h:{};if(u.options=Object.assign({},d,p,null!=o?o:{}),u.options.previewTemplate=u.options.previewTemplate.replace(/\n*/g,""),u.options.forceFallback||!a.isBrowserSupported())return i(u,u.options.fallback.call(u));if(null==u.options.url&&(u.options.url=u.element.getAttribute("action")),!u.options.url)throw Error("No URL provided.");if(u.options.uploadMultiple&&u.options.chunking)throw Error("You cannot set both: uploadMultiple and chunking.");if(u.options.binaryBody&&u.options.uploadMultiple)throw Error("You cannot set both: binaryBody and uploadMultiple.");return"string"==typeof u.options.method&&(u.options.method=u.options.method.toUpperCase()),(c=u.getExistingFallback())&&c.parentNode&&c.parentNode.removeChild(c),!1!==u.options.previewsContainer&&(u.options.previewsContainer?u.previewsContainer=a.getElement(u.options.previewsContainer,"previewsContainer"):u.previewsContainer=u.element),u.options.clickable&&(!0===u.options.clickable?u.clickableElements=[u.element]:u.clickableElements=a.getElements(u.options.clickable,"clickable")),u.init(),u}return a.prototype=Object.create(r&&r.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),r&&l(a,r),o(a,[{key:"getAcceptedFiles",value:function(){return this.files.filter(function(e){return e.accepted}).map(function(e){return e})}},{key:"getRejectedFiles",value:function(){return this.files.filter(function(e){return!e.accepted}).map(function(e){return e})}},{key:"getFilesWithStatus",value:function(e){return this.files.filter(function(t){return t.status===e}).map(function(e){return e})}},{key:"getQueuedFiles",value:function(){return this.getFilesWithStatus(a.QUEUED)}},{key:"getUploadingFiles",value:function(){return this.getFilesWithStatus(a.UPLOADING)}},{key:"getAddedFiles",value:function(){return this.getFilesWithStatus(a.ADDED)}},{key:"getActiveFiles",value:function(){return this.files.filter(function(e){return e.status===a.UPLOADING||e.status===a.QUEUED}).map(function(e){return e})}},{key:"init",value:function(){var e=this;if("form"===this.element.tagName&&this.element.setAttribute("enctype","multipart/form-data"),this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")&&this.element.appendChild(a.createElement('<div class="dz-default dz-message"><button class="dz-button" type="button">'.concat(this.options.dictDefaultMessage,"</button></div>"))),this.clickableElements.length){var t=function(){var i;e.hiddenFileInput&&(null==(i=e.hiddenFileInput.parentNode)||i.removeChild(e.hiddenFileInput)),e.hiddenFileInput=document.createElement("input"),e.hiddenFileInput.setAttribute("type","file"),e.hiddenFileInput.setAttribute("form",e.element.id),(null===e.options.maxFiles||e.options.maxFiles>1)&&e.hiddenFileInput.setAttribute("multiple","multiple"),e.hiddenFileInput.className="dz-hidden-input",null!==e.options.acceptedFiles&&e.hiddenFileInput.setAttribute("accept",e.options.acceptedFiles),null!==e.options.capture&&e.hiddenFileInput.setAttribute("capture",e.options.capture),e.hiddenFileInput.setAttribute("tabindex","-1"),e.hiddenFileInput.setAttribute("aria-label","dropzone hidden input"),e.hiddenFileInput.style.visibility="hidden",e.hiddenFileInput.style.position="absolute",e.hiddenFileInput.style.top="0",e.hiddenFileInput.style.left="0",e.hiddenFileInput.style.height="0",e.hiddenFileInput.style.width="0",a.getElement(e.options.hiddenInputContainer,"hiddenInputContainer").appendChild(e.hiddenFileInput),e.hiddenFileInput.addEventListener("change",function(){var i=e.hiddenFileInput.files,n=!0,r=!1,o=void 0;if(i.length)try{for(var l,a=i[Symbol.iterator]();!(n=(l=a.next()).done);n=!0){var s=l.value;e.addFile(s)}}catch(e){r=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(r)throw o}}e.emit("addedfiles",i),t()})};t()}this.URL=null!==window.URL?window.URL:window.webkitURL;var i=!0,n=!1,r=void 0;try{for(var o,l=this.events[Symbol.iterator]();!(i=(o=l.next()).done);i=!0){var s=o.value;this.on(s,this.options[s])}}catch(e){n=!0,r=e}finally{try{i||null==l.return||l.return()}finally{if(n)throw r}}this.on("uploadprogress",function(){return e.updateTotalUploadProgress()}),this.on("removedfile",function(){return e.updateTotalUploadProgress()}),this.on("canceled",function(t){return e.emit("complete",t)}),this.on("complete",function(t){if(0===e.getAddedFiles().length&&0===e.getUploadingFiles().length&&0===e.getQueuedFiles().length)return setTimeout(function(){return e.emit("queuecomplete")},0)});var u=function(e){if(e.dataTransfer.types&&e.dataTransfer.types.includes("Files"))return e.stopPropagation(),e.preventDefault()};return this.listeners=[{element:this.element,events:{dragstart:function(t){return e.emit("dragstart",t)},dragenter:function(t){return u(t),e.emit("dragenter",t)},dragover:function(t){var i=t.dataTransfer.effectAllowed;return t.dataTransfer.dropEffect="move"===i||"linkMove"===i?"move":"copy",u(t),e.emit("dragover",t)},dragleave:function(t){return e.emit("dragleave",t)},drop:function(t){return u(t),e.drop(t)},dragend:function(t){return e.emit("dragend",t)}}}],this.clickableElements.forEach(function(t){return e.listeners.push({element:t,events:{click:function(i){return(t!==e.element||i.target===e.element||a.elementInside(i.target,e.element.querySelector(".dz-message")))&&e.hiddenFileInput.click(),!0}}})}),this.enable(),this.options.init.call(this)}},{key:"destroy",value:function(){return this.disable(),this.removeAllFiles(!0),(null!=this.hiddenFileInput?this.hiddenFileInput.parentNode:void 0)&&(this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=null),delete this.element.dropzone,a.instances.splice(a.instances.indexOf(this),1)}},{key:"updateTotalUploadProgress",value:function(){var e=0,t=0;if(this.getActiveFiles().length){var i=!0,n=!1,r=void 0;try{for(var o,l,a=this.getActiveFiles()[Symbol.iterator]();!(i=(l=a.next()).done);i=!0){var s=l.value;e+=s.upload.bytesSent,t+=s.upload.total}}catch(e){n=!0,r=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw r}}o=100*e/t}else o=100;return this.emit("totaluploadprogress",o,t,e)}},{key:"_getParamName",value:function(e){return"function"==typeof this.options.paramName?this.options.paramName(e):"".concat(this.options.paramName).concat(this.options.uploadMultiple?"[".concat(e,"]"):"")}},{key:"_renameFile",value:function(e){var t,i,n=(t=function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){var n;n=i[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},e),i=i={name:e.name.replace(/\u202F/g," ")},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):(function(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);i.push.apply(i,n)}return i})(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}),t);return"function"!=typeof this.options.renameFile?n.name:this.options.renameFile(n)}},{key:"getFallbackForm",value:function(){if(e=this.getExistingFallback())return e;var e,t,i='<div class="dz-fallback">';this.options.dictFallbackText&&(i+="<p>".concat(this.options.dictFallbackText,"</p>")),i+='<input type="file" name="'.concat(this._getParamName(0),'" ').concat(this.options.uploadMultiple?'multiple="multiple"':void 0,' /><input type="submit" value="Upload!"></div>');var n=a.createElement(i);return"FORM"!==this.element.tagName?(t=a.createElement('<form action="'.concat(this.options.url,'" enctype="multipart/form-data" method="').concat(this.options.method,'"></form>'))).appendChild(n):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),null!=t?t:n}},{key:"getExistingFallback",value:function(){for(var e=0,t=["div","form"];e<t.length;e++){var i,n=t[e];if(i=function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=e[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var l=r.value;if(/(^| )fallback($| )/.test(l.className))return l}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}(this.element.getElementsByTagName(n)))return i}}},{key:"setupEventListeners",value:function(){return this.listeners.map(function(e){var t=[];for(var i in e.events){var n=e.events[i];t.push(e.element.addEventListener(i,n,!1))}return t})}},{key:"removeEventListeners",value:function(){return this.listeners.map(function(e){var t=[];for(var i in e.events){var n=e.events[i];t.push(e.element.removeEventListener(i,n,!1))}return t})}},{key:"disable",value:function(){var e=this;return this.clickableElements.forEach(function(e){return e.classList.remove("dz-clickable")}),this.removeEventListeners(),this.disabled=!0,this.files.map(function(t){return e.cancelUpload(t)})}},{key:"enable",value:function(){return delete this.disabled,this.clickableElements.forEach(function(e){return e.classList.add("dz-clickable")}),this.setupEventListeners()}},{key:"filesize",value:function(e){var t=0,i="b";if(e>0){for(var n=["tb","gb","mb","kb","b"],r=0;r<n.length;r++){var o=n[r];if(e>=Math.pow(this.options.filesizeBase,4-r)/10){t=e/Math.pow(this.options.filesizeBase,4-r),i=o;break}}t=Math.round(10*t)/10}return"<strong>".concat(t,"</strong> ").concat(this.options.dictFileSizeUnits[i])}},{key:"_updateMaxFilesReachedClass",value:function(){return null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(this.getAcceptedFiles().length===this.options.maxFiles&&this.emit("maxfilesreached",this.files),this.element.classList.add("dz-max-files-reached")):this.element.classList.remove("dz-max-files-reached")}},{key:"drop",value:function(e){if(e.dataTransfer){this.emit("drop",e);for(var t=[],i=0;i<e.dataTransfer.files.length;i++)t[i]=e.dataTransfer.files[i];if(t.length){var n=e.dataTransfer.items;n&&n.length&&null!=n[0].webkitGetAsEntry?this._addFilesFromItems(n):this.handleFiles(t)}this.emit("addedfiles",t)}}},{key:"paste",value:function(e){var t,i;if(null!=(t=null!=e?e.clipboardData:void 0,i=function(e){return e.items},null!=t?i(t):void 0)){this.emit("paste",e);var n=e.clipboardData.items;if(n.length)return this._addFilesFromItems(n)}}},{key:"handleFiles",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=e[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var l=r.value;this.addFile(l)}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"_addFilesFromItems",value:function(e){var t=this;return function(){var i=[],n=!0,r=!1,o=void 0;try{for(var l,a=e[Symbol.iterator]();!(n=(l=a.next()).done);n=!0){var s,u=l.value;null!=u.webkitGetAsEntry&&(s=u.webkitGetAsEntry())?s.isFile?i.push(t.addFile(u.getAsFile())):s.isDirectory?i.push(t._addFilesFromDirectory(s,s.name)):i.push(void 0):null!=u.getAsFile&&(null==u.kind||"file"===u.kind)?i.push(t.addFile(u.getAsFile())):i.push(void 0)}}catch(e){r=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(r)throw o}}return i}()}},{key:"_addFilesFromDirectory",value:function(e,t){var i=this,n=e.createReader(),r=function(e){var t,i,n;return t=console,i="log",n=function(t){return t.log(e)},null!=t&&"function"==typeof t.log?n(t,i):void 0},o=0,l=function(){return n.readEntries(function(e){if(e.length>0){var n=!0,r=!1,a=void 0;try{for(var s,u=e[Symbol.iterator]();!(n=(s=u.next()).done);n=!0){var d=s.value;d.isFile?(++o,d.file(function(e){if(!i.options.ignoreHiddenFiles||"."!==e.name.substring(0,1))return e.fullPath="".concat(t,"/").concat(e.name),i.addFile(e)})):d.isDirectory&&i._addFilesFromDirectory(d,"".concat(t,"/").concat(d.name))}}catch(e){r=!0,a=e}finally{try{n||null==u.return||u.return()}finally{if(r)throw a}}l()}else 0===o&&i.emit("emptyfolder",t);return null},r)};return l()}},{key:"accept",value:function(e,t){this.options.maxFilesize&&e.size>1048576*this.options.maxFilesize?t(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(e.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):a.isValidFile(e,this.options.acceptedFiles)?null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(t(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",e)):this.options.accept.call(this,e,t):t(this.options.dictInvalidFileType)}},{key:"addFile",value:function(e){var t=this;e.upload={uuid:window.isSecureContext?self.crypto.randomUUID():a.uuidv4(),progress:0,total:e.size,bytesSent:0,filename:this._renameFile(e)},this.files.push(e),e.status=a.ADDED,this.emit("addedfile",e),this._enqueueThumbnail(e),this.accept(e,function(i){i?(e.accepted=!1,t._errorProcessing([e],i)):(e.accepted=!0,t.options.autoQueue&&t.enqueueFile(e)),t._updateMaxFilesReachedClass()})}},{key:"enqueueFiles",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=e[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var l=r.value;this.enqueueFile(l)}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return null}},{key:"enqueueFile",value:function(e){var t=this;if(e.status===a.ADDED&&!0===e.accepted){if(e.status=a.QUEUED,this.options.autoProcessQueue)return setTimeout(function(){return t.processQueue()},0)}else throw Error("This file can't be queued because it has already been processed or was rejected.")}},{key:"_enqueueThumbnail",value:function(e){var t=this;if(this.options.createImageThumbnails&&e.type.match(/image.*/)&&e.size<=1048576*this.options.maxThumbnailFilesize)return this._thumbnailQueue.push(e),setTimeout(function(){return t._processThumbnailQueue()},0)}},{key:"_processThumbnailQueue",value:function(){var e=this;if(!this._processingThumbnail&&0!==this._thumbnailQueue.length){this._processingThumbnail=!0;var t=this._thumbnailQueue.shift();return this.createThumbnail(t,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,!0,function(i){return e.emit("thumbnail",t,i),e._processingThumbnail=!1,e._processThumbnailQueue()})}}},{key:"removeFile",value:function(e){if(e.status===a.UPLOADING&&this.cancelUpload(e),this.files=h(this.files,e),this.emit("removedfile",e),0===this.files.length)return this.emit("reset")}},{key:"removeAllFiles",value:function(e){null==e&&(e=!1);var t=!0,i=!1,n=void 0;try{for(var r,o=this.files.slice()[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var l=r.value;(l.status!==a.UPLOADING||e)&&this.removeFile(l)}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return null}},{key:"resizeImage",value:function(e,t,i,n,r){var o=this;return this.createThumbnail(e,t,i,n,!0,function(t,i){if(null==i)return r(e);var n=o.options.resizeMimeType;null==n&&(n=e.type);var l=i.toDataURL(n,o.options.resizeQuality);return("image/jpeg"===n||"image/jpg"===n)&&(l=function(e,t){var i="data:image/jpeg;base64,";if(!(e.startsWith(i)&&t.startsWith(i)))return t;var n=window.atob(e.slice(i.length));if(!n.startsWith("ÿØÿ"))return t;for(var r=0,o="";r<n.length;)if("ÿÚ"==n.slice(r,r+2))break;else if("ÿØ"==n.slice(r,r+2))r+=2;else{var l=256*n.charCodeAt(r+2)+n.charCodeAt(r+3),a=r+l+2,s=n.slice(r,a);s.startsWith("ÿá")&&(o+=s),r=a}if(""==o)return t;var u=window.atob(t.slice(i.length));if(!u.startsWith("ÿØÿ"))return t;var d=4+256*u.charCodeAt(4)+u.charCodeAt(5);return u=u.slice(0,d)+o+u.slice(d),i+window.btoa(u)}(e.dataURL,l)),r(a.dataURItoBlob(l))},!0)}},{key:"createThumbnail",value:function(e,t,i,n,r,o){var l=this,a=arguments.length>6&&void 0!==arguments[6]&&arguments[6],s=new FileReader;s.onload=function(){if(e.dataURL=s.result,"image/svg+xml"===e.type){null!=o&&o(s.result);return}l.createThumbnailFromUrl(e,t,i,n,r,o,void 0,a)},s.readAsDataURL(e)}},{key:"displayExistingFile",value:function(e,t,i,n){var r=this,o=!(arguments.length>4)||void 0===arguments[4]||arguments[4];this.emit("addedfile",e),this.emit("complete",e),o?(e.dataURL=t,this.createThumbnailFromUrl(e,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,this.options.fixOrientation,function(t){r.emit("thumbnail",e,t),i&&i()},n)):(this.emit("thumbnail",e,t),i&&i())}},{key:"createThumbnailFromUrl",value:function(e,t,i,n,r,o,l){var a=this,s=arguments.length>7&&void 0!==arguments[7]&&arguments[7],u=document.createElement("img");l&&(u.crossOrigin=l),r="from-image"!=getComputedStyle(document.body).imageOrientation&&r,u.onload=function(){var l=function(e){return e(1)};return"undefined"!=typeof EXIF&&null!==EXIF&&r&&(l=function(e){return EXIF.getData(u,function(){return e(EXIF.getTag(this,"Orientation"))})}),l(function(r){e.width=u.width,e.height=u.height;var l=a.options.resize.call(a,e,t,i,n),s=document.createElement("canvas"),d=s.getContext("2d");switch(s.width=l.trgWidth,s.height=l.trgHeight,r>4&&(s.width=l.trgHeight,s.height=l.trgWidth),r){case 2:d.translate(s.width,0),d.scale(-1,1);break;case 3:d.translate(s.width,s.height),d.rotate(Math.PI);break;case 4:d.translate(0,s.height),d.scale(1,-1);break;case 5:d.rotate(.5*Math.PI),d.scale(1,-1);break;case 6:d.rotate(.5*Math.PI),d.translate(0,-s.width);break;case 7:d.rotate(.5*Math.PI),d.translate(s.height,-s.width),d.scale(-1,1);break;case 8:d.rotate(-.5*Math.PI),d.translate(-s.height,0)}m(d,u,null!=l.srcX?l.srcX:0,null!=l.srcY?l.srcY:0,l.srcWidth,l.srcHeight,null!=l.trgX?l.trgX:0,null!=l.trgY?l.trgY:0,l.trgWidth,l.trgHeight);var c=s.toDataURL("image/png");if(null!=o)return o(c,s)})},null!=o&&(u.onerror=o);var d=e.dataURL;return s&&(d=function(e){var t="data:image/jpeg;base64,";if(!e.startsWith(t))return e;var i=window.atob(e.slice(t.length));if(!i.startsWith("ÿØÿ"))return e;for(var n=0,r="";n<i.length;)if("ÿÚ"==i.slice(n,n+2)){r+=i.slice(n);break}else if("ÿØ"==i.slice(n,n+2))r+=i.slice(n,n+2),n+=2;else{var o=256*i.charCodeAt(n+2)+i.charCodeAt(n+3),l=n+o+2,a=i.slice(n,l);a.startsWith("ÿá")||(r+=a),n=l}return t+window.btoa(r)}(d)),u.src=d}},{key:"processQueue",value:function(){var e=this.options.parallelUploads,t=this.getUploadingFiles().length,i=t;if(!(t>=e)){var n=this.getQueuedFiles();if(n.length>0)if(this.options.uploadMultiple)return this.processFiles(n.slice(0,e-t));else for(;i<e;){if(!n.length)return;this.processFile(n.shift()),i++}}}},{key:"processFile",value:function(e){return this.processFiles([e])}},{key:"processFiles",value:function(e){var t=!0,i=!1,n=void 0;try{for(var r,o=e[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var l=r.value;l.processing=!0,l.status=a.UPLOADING,this.emit("processing",l)}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}return this.options.uploadMultiple&&this.emit("processingmultiple",e),this.uploadFiles(e)}},{key:"_getFilesWithXhr",value:function(e){return this.files.filter(function(t){return t.xhr===e}).map(function(e){return e})}},{key:"cancelUpload",value:function(e){if(e.status===a.UPLOADING){var t=this._getFilesWithXhr(e.xhr),i=!0,n=!1,r=void 0;try{for(var o,l=t[Symbol.iterator]();!(i=(o=l.next()).done);i=!0)o.value.status=a.CANCELED}catch(e){n=!0,r=e}finally{try{i||null==l.return||l.return()}finally{if(n)throw r}}void 0!==e.xhr&&e.xhr.abort();var s=!0,u=!1,d=void 0;try{for(var c,h=t[Symbol.iterator]();!(s=(c=h.next()).done);s=!0){var p=c.value;this.emit("canceled",p)}}catch(e){u=!0,d=e}finally{try{s||null==h.return||h.return()}finally{if(u)throw d}}this.options.uploadMultiple&&this.emit("canceledmultiple",t)}else(e.status===a.ADDED||e.status===a.QUEUED)&&(e.status=a.CANCELED,this.emit("canceled",e),this.options.uploadMultiple&&this.emit("canceledmultiple",[e]));if(this.options.autoProcessQueue)return this.processQueue()}},{key:"resolveOption",value:function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return"function"==typeof e?e.apply(this,i):e}},{key:"uploadFile",value:function(e){return this.uploadFiles([e])}},{key:"uploadFiles",value:function(e){var t=this;this._transformFiles(e,function(i){if(t.options.chunking){var n=i[0];e[0].upload.chunked=t.options.chunking&&(t.options.forceChunking||n.size>t.options.chunkSize),e[0].upload.totalChunkCount=Math.ceil(n.size/t.options.chunkSize),0===n.size&&(e[0].upload.totalChunkCount=1)}if(e[0].upload.chunked){var r=e[0],o=i[0];r.upload.chunks=[];var l=function(){for(var i=0;void 0!==r.upload.chunks[i];)i++;if(!(i>=r.upload.totalChunkCount)){var n=i*t.options.chunkSize,l=Math.min(n+t.options.chunkSize,o.size),s={name:t._getParamName(0),data:o.webkitSlice?o.webkitSlice(n,l):o.slice(n,l),filename:r.upload.filename,chunkIndex:i};r.upload.chunks[i]={file:r,index:i,dataBlock:s,status:a.UPLOADING,progress:0,retries:0},t._uploadData(e,[s])}};if(r.upload.finishedChunkUpload=function(i,n){var o=!0;i.status=a.SUCCESS,i.dataBlock=null,i.response=i.xhr.responseText,i.responseHeaders=i.xhr.getAllResponseHeaders(),i.xhr=null;for(var s=0;s<r.upload.totalChunkCount;s++){if(void 0===r.upload.chunks[s])return l();r.upload.chunks[s].status!==a.SUCCESS&&(o=!1)}o&&t.options.chunksUploaded(r,function(){t._finished(e,n,null)})},t.options.parallelChunkUploads)for(var s=Math.min(!0===t.options.parallelChunkUploads?t.options.parallelUploads:t.options.parallelChunkUploads,r.upload.totalChunkCount),u=0;u<s;u++)l();else l()}else{for(var d=[],c=0;c<e.length;c++)d[c]={name:t._getParamName(c),data:i[c],filename:e[c].upload.filename};t._uploadData(e,d)}})}},{key:"_getChunk",value:function(e,t){for(var i=0;i<e.upload.totalChunkCount;i++)if(void 0!==e.upload.chunks[i]&&e.upload.chunks[i].xhr===t)return e.upload.chunks[i]}},{key:"_uploadData",value:function(e,t){var i=this,n=new XMLHttpRequest,r=!0,o=!1,l=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done);r=!0)a.value.xhr=n}catch(e){o=!0,l=e}finally{try{r||null==s.return||s.return()}finally{if(o)throw l}}e[0].upload.chunked&&(e[0].upload.chunks[t[0].chunkIndex].xhr=n);var u=this.resolveOption(this.options.method,e,t),d=this.resolveOption(this.options.url,e,t);n.open(u,d,!0),this.resolveOption(this.options.timeout,e)&&(n.timeout=this.resolveOption(this.options.timeout,e)),n.withCredentials=!!this.options.withCredentials,n.onload=function(t){i._finishedUploading(e,n,t)},n.ontimeout=function(){i._handleUploadError(e,n,"Request timedout after ".concat(i.options.timeout/1e3," seconds"))},n.onerror=function(){i._handleUploadError(e,n)},(null!=n.upload?n.upload:n).onprogress=function(t){return i._updateFilesUploadProgress(e,n,t)};var c=this.options.defaultHeaders?{Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"}:{};for(var h in this.options.binaryBody&&(c["Content-Type"]=e[0].type),this.options.headers&&Object.assign(c,this.options.headers),c){var p=c[h];p&&n.setRequestHeader(h,p)}if(this.options.binaryBody){var f=!0,m=!1,v=void 0;try{for(var y,g=e[Symbol.iterator]();!(f=(y=g.next()).done);f=!0){var b=y.value;this.emit("sending",b,n)}}catch(e){m=!0,v=e}finally{try{f||null==g.return||g.return()}finally{if(m)throw v}}this.options.uploadMultiple&&this.emit("sendingmultiple",e,n),this.submitRequest(n,null,e)}else{var k=new FormData;if(this.options.params){var w=this.options.params;for(var F in"function"==typeof w&&(w=w.call(this,e,n,e[0].upload.chunked?this._getChunk(e[0],n):null)),w){var E=w[F];if(Array.isArray(E))for(var C=0;C<E.length;C++)k.append(F,E[C]);else k.append(F,E)}}var z=!0,x=!1,S=void 0;try{for(var U,_=e[Symbol.iterator]();!(z=(U=_.next()).done);z=!0){var A=U.value;this.emit("sending",A,n,k)}}catch(e){x=!0,S=e}finally{try{z||null==_.return||_.return()}finally{if(x)throw S}}this.options.uploadMultiple&&this.emit("sendingmultiple",e,n,k),this._addFormElementData(k);for(var L=0;L<t.length;L++){var T=t[L];k.append(T.name,T.data,T.filename)}this.submitRequest(n,k,e)}}},{key:"_transformFiles",value:function(e,t){for(var i,n=function(n){i.options.transformFile.call(i,e[n],function(i){r[n]=i,++o===e.length&&t(r)})},r=[],o=0,l=0;l<e.length;l++)i=this,n(l)}},{key:"_addFormElementData",value:function(e){var t=!0,i=!1,n=void 0;if("FORM"===this.element.tagName)try{for(var r,o=this.element.querySelectorAll("input, textarea, select, button")[Symbol.iterator]();!(t=(r=o.next()).done);t=!0){var l=r.value,a=l.getAttribute("name"),s=l.getAttribute("type");if(s&&(s=s.toLowerCase()),null!=a)if("SELECT"===l.tagName&&l.hasAttribute("multiple")){var u=!0,d=!1,c=void 0;try{for(var h,p=l.options[Symbol.iterator]();!(u=(h=p.next()).done);u=!0){var f=h.value;f.selected&&e.append(a,f.value)}}catch(e){d=!0,c=e}finally{try{u||null==p.return||p.return()}finally{if(d)throw c}}}else(!s||"checkbox"!==s&&"radio"!==s||l.checked)&&e.append(a,l.value)}}catch(e){i=!0,n=e}finally{try{t||null==o.return||o.return()}finally{if(i)throw n}}}},{key:"_updateFilesUploadProgress",value:function(e,t,i){var n=!0,r=!1,o=void 0;if(e[0].upload.chunked){var l=e[0],a=this._getChunk(l,t);i?(a.progress=100*i.loaded/i.total,a.total=i.total,a.bytesSent=i.loaded):(a.progress=100,a.bytesSent=a.total),l.upload.progress=0,l.upload.total=0,l.upload.bytesSent=0;for(var s=0;s<l.upload.totalChunkCount;s++)l.upload.chunks[s]&&void 0!==l.upload.chunks[s].progress&&(l.upload.progress+=l.upload.chunks[s].progress,l.upload.total+=l.upload.chunks[s].total,l.upload.bytesSent+=l.upload.chunks[s].bytesSent);l.upload.progress=l.upload.progress/l.upload.totalChunkCount,this.emit("uploadprogress",l,l.upload.progress,l.upload.bytesSent)}else try{for(var u,d=e[Symbol.iterator]();!(n=(u=d.next()).done);n=!0){var c=u.value;c.upload.total&&c.upload.bytesSent&&c.upload.bytesSent==c.upload.total||(i?(c.upload.progress=100*i.loaded/i.total,c.upload.total=i.total,c.upload.bytesSent=i.loaded):(c.upload.progress=100,c.upload.bytesSent=c.upload.total),this.emit("uploadprogress",c,c.upload.progress,c.upload.bytesSent))}}catch(e){r=!0,o=e}finally{try{n||null==d.return||d.return()}finally{if(r)throw o}}}},{key:"_finishedUploading",value:function(e,t,i){var n;if(e[0].status!==a.CANCELED&&4===t.readyState){if("arraybuffer"!==t.responseType&&"blob"!==t.responseType&&(n=t.responseText,t.getResponseHeader("content-type")&&~t.getResponseHeader("content-type").indexOf("application/json")))try{n=JSON.parse(n)}catch(e){i=e,n="Invalid JSON response from server."}this._updateFilesUploadProgress(e,t),200<=t.status&&t.status<300?e[0].upload.chunked?e[0].upload.finishedChunkUpload(this._getChunk(e[0],t),n):this._finished(e,n,i):this._handleUploadError(e,t,n)}}},{key:"_handleUploadError",value:function(e,t,i){if(e[0].status!==a.CANCELED){if(e[0].upload.chunked&&this.options.retryChunks){var n=this._getChunk(e[0],t);if(n.retries++<this.options.retryChunksLimit)return void this._uploadData(e,[n.dataBlock]);console.warn("Retried this chunk too often. Giving up.")}this._errorProcessing(e,i||this.options.dictResponseError.replace("{{statusCode}}",t.status),t)}}},{key:"submitRequest",value:function(e,t,i){if(1!=e.readyState)return void console.warn("Cannot send this request because the XMLHttpRequest.readyState is not OPENED.");if(this.options.binaryBody)if(i[0].upload.chunked){var n=this._getChunk(i[0],e);e.send(n.dataBlock.data)}else e.send(i[0]);else e.send(t)}},{key:"_finished",value:function(e,t,i){var n=!0,r=!1,o=void 0;try{for(var l,s=e[Symbol.iterator]();!(n=(l=s.next()).done);n=!0){var u=l.value;u.status=a.SUCCESS,this.emit("success",u,t,i),this.emit("complete",u)}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}if(this.options.uploadMultiple&&(this.emit("successmultiple",e,t,i),this.emit("completemultiple",e)),this.options.autoProcessQueue)return this.processQueue()}},{key:"_errorProcessing",value:function(e,t,i){var n=!0,r=!1,o=void 0;try{for(var l,s=e[Symbol.iterator]();!(n=(l=s.next()).done);n=!0){var u=l.value;u.status=a.ERROR,this.emit("error",u,t,i),this.emit("complete",u)}}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}if(this.options.uploadMultiple&&(this.emit("errormultiple",e,t,i),this.emit("completemultiple",e)),this.options.autoProcessQueue)return this.processQueue()}}],[{key:"initClass",value:function(){this.prototype.Emitter=s,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","emptyfolder"],this.prototype._thumbnailQueue=[],this.prototype._processingThumbnail=!1}},{key:"uuidv4",value:function(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,function(e){return(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)})}}]),a}(s);c.initClass(),c.options={},c.optionsForElement=function(e){return e.getAttribute("id")&&void 0!==c.options?c.options[p(e.getAttribute("id"))]:void 0},c.instances=[],c.forElement=function(e){if("string"==typeof e&&(e=document.querySelector(e)),(null!=e?e.dropzone:void 0)==null)throw 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.");return e.dropzone},c.discover=function(){var e;if(document.querySelectorAll)e=document.querySelectorAll(".dropzone");else{e=[];var t=function(t){return function(){var i=[],n=!0,r=!1,o=void 0;try{for(var l,a=t[Symbol.iterator]();!(n=(l=a.next()).done);n=!0){var s=l.value;/(^| )dropzone($| )/.test(s.className)?i.push(e.push(s)):i.push(void 0)}}catch(e){r=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(r)throw o}}return i}()};t(document.getElementsByTagName("div")),t(document.getElementsByTagName("form"))}return function(){var t=[],i=!0,n=!1,r=void 0;try{for(var o,l=e[Symbol.iterator]();!(i=(o=l.next()).done);i=!0){var a=o.value;!1!==c.optionsForElement(a)?t.push(new c(a)):t.push(void 0)}}catch(e){n=!0,r=e}finally{try{i||null==l.return||l.return()}finally{if(n)throw r}}return t}()},c.isBrowserSupported=function(){return"undefined"!=typeof Promise},c.dataURItoBlob=function(e){for(var t=atob(e.split(",")[1]),i=e.split(",")[0].split(":")[1].split(";")[0],n=new ArrayBuffer(t.length),r=new Uint8Array(n),o=0,l=t.length,a=0<=l;a?o<=l:o>=l;a?o++:o--)r[o]=t.charCodeAt(o);return new Blob([n],{type:i})};var h=function(e,t){return e.filter(function(e){return e!==t}).map(function(e){return e})},p=function(e){return e.replace(/[\-_](\w)/g,function(e){return e.charAt(1).toUpperCase()})};c.createElement=function(e){var t=document.createElement("div");return t.innerHTML=e,t.childNodes[0]},c.elementInside=function(e,t){if(e===t)return!0;for(;e=e.parentNode;)if(e===t)return!0;return!1},c.getElement=function(e,t){var i;if("string"==typeof e?i=document.querySelector(e):null!=e.nodeType&&(i=e),null==i)throw Error("Invalid `".concat(t,"` option provided. Please provide a CSS selector or a plain HTML element."));return i},c.getElements=function(e,t){var i,n;if(e instanceof Array){n=[];try{var r=!0,o=!1,l=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done);r=!0)i=a.value,n.push(this.getElement(i,t))}catch(e){o=!0,l=e}finally{try{r||null==s.return||s.return()}finally{if(o)throw l}}}catch(e){n=null}}else if("string"==typeof e){n=[];var u=!0,d=!1,c=void 0;try{for(var h,p=document.querySelectorAll(e)[Symbol.iterator]();!(u=(h=p.next()).done);u=!0)i=h.value,n.push(i)}catch(e){d=!0,c=e}finally{try{u||null==p.return||p.return()}finally{if(d)throw c}}}else null!=e.nodeType&&(n=[e]);if(null==n||!n.length)throw Error("Invalid `".concat(t,"` option provided. Please provide a CSS selector, a plain HTML element or a list of those."));return n},c.confirm=function(e,t,i){return window.confirm(e)?t():null!=i?i():void 0},c.isValidFile=function(e,t){if(!t)return!0;t=t.split(",");var i=e.type,n=i.replace(/\/.*$/,""),r=!0,o=!1,l=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done);r=!0){var u=a.value;if(u=u.trim(),"."===u.charAt(0)){if(-1!==e.name.toLowerCase().indexOf(u.toLowerCase(),e.name.length-u.length))return!0}else if(/\/\*$/.test(u)){if(n===u.replace(/\/.*$/,""))return!0}else if(i===u)return!0}}catch(e){o=!0,l=e}finally{try{r||null==s.return||s.return()}finally{if(o)throw l}}return!1},"undefined"!=typeof jQuery&&null!==jQuery&&(jQuery.fn.dropzone=function(e){return this.each(function(){return new c(this,e)})}),c.ADDED="added",c.QUEUED="queued",c.ACCEPTED=c.QUEUED,c.UPLOADING="uploading",c.PROCESSING=c.UPLOADING,c.CANCELED="canceled",c.ERROR="error",c.SUCCESS="success";var f=function(e){var t=e.naturalHeight,i=document.createElement("canvas");i.width=1,i.height=t;var n=i.getContext("2d");n.drawImage(e,0,0);for(var r=n.getImageData(1,0,1,t).data,o=0,l=t,a=t;a>o;)0===r[(a-1)*4+3]?l=a:o=a,a=l+o>>1;var s=a/t;return 0===s?1:s},m=function(e,t,i,n,r,o,l,a,s,u){var d=f(t);return e.drawImage(t,i,n,r,o,l,a,s,u/d)};window.Dropzone=c}();
|
|
//# sourceMappingURL=dropzone-min.js.map
|