2 lines
49 KiB
JavaScript
2 lines
49 KiB
JavaScript
|
|
"use strict";var _createClass=function(){function a(e,c){for(var b=0;b<c.length;b++){var d=c[b];d.enumerable=d.enumerable||false;d.configurable=true;if("value" in d){d.writable=true}Object.defineProperty(e,d.key,d)}}return function(d,b,c){if(b){a(d.prototype,b)}if(c){a(d,c)}return d}}();function _possibleConstructorReturn(a,b){if(!a){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return b&&(typeof b==="object"||typeof b==="function")?b:a}function _inherits(b,a){if(typeof a!=="function"&&a!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof a)}b.prototype=Object.create(a&&a.prototype,{constructor:{value:b,enumerable:false,writable:true,configurable:true}});if(a){Object.setPrototypeOf?Object.setPrototypeOf(b,a):b.__proto__=a}}function _classCallCheck(a,b){if(!(a instanceof b)){throw new TypeError("Cannot call a class as a function")}}var Emitter=function(){function c(){_classCallCheck(this,c)}_createClass(c,[{key:"on",value:function a(f,e){this._callbacks=this._callbacks||{};if(!this._callbacks[f]){this._callbacks[f]=[]}this._callbacks[f].push(e);return this}},{key:"emit",value:function b(e){this._callbacks=this._callbacks||{};var j=this._callbacks[e];if(j){for(var m=arguments.length,k=Array(m>1?m-1:0),f=1;f<m;f++){k[f-1]=arguments[f]}for(var i=j,l=true,g=0,i=l?i:i[Symbol.iterator]();;){var h;if(l){if(g>=i.length){break}h=i[g++]}else{g=i.next();if(g.done){break}h=g.value}var n=h;n.apply(this,k)}}return this}},{key:"off",value:function d(h,f){if(!this._callbacks||arguments.length===0){this._callbacks={};return this}var g=this._callbacks[h];if(!g){return this}if(arguments.length===1){delete this._callbacks[h];return this}for(var e=0;e<g.length;e++){var j=g[e];if(j===f){g.splice(e,1);break}}return this}}]);return c}();var Dropzone=function(j){_inherits(C,j);_createClass(C,null,[{key:"initClass",value:function B(){this.prototype.Emitter=Emitter;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"];this.prototype.defaultOptions={url:null,method:"post",withCredentials:false,timeout:30000,parallelUploads:2,uploadMultiple:false,chunking:false,forceChunking:false,chunkSize:2000000,parallelChunkUploads:false,retryChunks:false,retryChunksLimit:3,maxFilesize:256,paramName:"file",createImageThumbnails:true,maxThumbnailFilesize:10,thumbnailWidth:120,thumbnailHeight:120,thumbnailMethod:"crop",resizeWidth:null,resizeHeight:null,resizeMimeType:null,resizeQuality:0.8,resizeMethod:"contain",filesizeBase:1000,maxFiles:null,headers:null,clickable:true,ignoreHiddenFiles:true,acceptedFiles:null,acceptedMimeTypes:null,autoProcessQueue:true,autoQueue:true,addRemoveLinks:false,previewsContainer:null,hiddenInputContainer:"body",capture:null,renameFilename:null,renameFile:null,forceFallback:false,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 can not upload any more files.",dictFileSizeUnits:{tb:"TB",gb:"GB",mb:"MB",kb:"KB",b:"b"},init:function aM(){},params:function aj(aT,aU,aS){if(aS){return{dzuuid:aS.file.upload.uuid,dzchunkindex:aS.index,dztotalfilesize:aS.file.size,dzchunksize:this.options.chunkSize,dztotalchunkcount:aS.file.upload.totalChunkCount,dzchunkbyteoffset:aS.index*this.options.chunkSize}}},accept:function an(aT,aS){return aS()},chunksUploaded:function aO(aT,aS){aS()},fallback:function aR(){var aU=void 0;this.element.className=this.element.className+" dz-browser-not-supported";for(var aT=this.element.getElementsByTagName("div"),aS=true,aY=0,aT=aS?aT:aT[Symbol.iterator]();;){var aX;if(aS){if(aY>=aT.length){break}aX=aT[aY++]}else{aY=aT.next();if(aY.done){break}aX=aY.value}var aW=aX;if(/(^| )dz-message($| )/.test(aW.className)){aU=aW;aW.className="dz-message";break}}if(!aU){aU=C.createElement('<div class="dz-message"><span></span></div>');this.element.appendChild(aU)}var aV=aU.getElementsByTagName("span")[0];if(aV){if(aV.textContent!=null){aV.textContent=this.options.dictFallbackMessage}else{if(aV.innerText!=null){aV.innerText=this.options.dictFallbackMessage}}}return this.element.appendChild(this.getFallbackForm())},resize:function ax(aU,aW,aS,aY){var aX={srcX:0,srcY:0,srcWidth:aU.width,srcHeight:aU.height};var aV=aU.width/aU.height;if(aW==null&&aS==null){aW=aX.srcWidth;aS=aX.srcHeight}else{if(aW==null){aW=aS*aV}else{if(aS==null){aS=aW/aV}}}aW=Math.min(aW,aX.srcWidth);aS=Math.min(aS,aX.srcHeight);var aT=aW/aS;if(aX.srcWidth>aW||aX.srcHeight>aS){if(aY==="crop"){if(aV>aT){aX.srcHeight=aU.height;aX.srcWidth=aX.srcHeight*aT}else{aX.srcWidth=aU.width;aX.srcHeight=aX.srcWidth/aT}}else{if(aY==="contain"){if(aV>aT){aS=aW/aV}else{aW=aS*aV}}else{throw new Error("Unknown resizeMethod '"+aY+"'")}}}aX.srcX=(aU.width-aX.srcWidth)/2;aX.srcY=(aU.height-aX.srcHeight)/2;aX.trgWidth=aW;aX.trgHeight=aS;return aX},transformFile:function aA(aT,aS){if((this.options.resizeWidth||this.options.resizeHeight)&&aT.type.match(/image.*/)){return this.resizeImage(aT,this.options.resizeWidth,this.options.resizeHeight,this.options.resizeMethod,aS)}else{return aS(aT)}},previewTemplate:'<div class="dz-preview dz-file-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"><span class="dz-upload" data-dz-uploadprogress></span></div>\n <div class="dz-error-message"><span data-dz-errormessage></span></div>\n <div class="dz-success-mark">\n <svg width="54px" height="54px" viewBox="0 0 54 54" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">\n <title>Check</title>\n <defs></defs>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">\n <path d="M23.5,31.8431458 L17.5852419,25.9283877 C16.0248253,24.3679711 13.4910294,24.366835 11.9289322,25.9289322 C10.3700136,27.4878508 10.3665912,30.0234455 11.9283877,31.5852419 L20.4147581,40.0716123 C20.5133999,40.1702541 20.6159315,40.2626649 20.7218615,40.3488435 C22.2835669,41.8725651 24.794234,41.8626202 26.3461564,40.3106978 L43.3106978,23.3461564 C44.8771021,21.7797521 44.8758057,19.2483887 43.3137085,17.6862915 C41.7547899,16.1273729 39.2176035,16.1255422 37.6538436,17.6893022 L23.5,31.8431458 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z" id="Oval-2" stroke-opacity="0.198794158" stroke="#747474" fill-opacity="0.816519475" fill="#FFFFFF" sketch:type="MSShapeGroup"></path>\n </g>\n </svg>\n </div>\n <div class="dz-error-mark">\n <svg width="54px" height="54px" viewBox="0 0 54 54" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">\n <title>Error</title>\n <defs></defs>\n <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">\n <g id="Check-+-Oval-2" sketch:type="MSLayerGroup" stroke="#747474" stroke-opacity="0.198794158" fill="#FFFFFF" fill-opacity="0.816519475">\n <path d="M32.6568542,29 L38.3106978,23.3461564 C39.8771021,21.7797521 39.8758057,19.2483887 38.3137085,17.6862915 C36.7547899,16.1273729 34.2176035,16.1255422 32.6538436,17.6893022 L27,23.3431458 L21.3461564,17.6893022 C19.7823965,16.1255422 17.2452101,16.1273729 15.6862915,17.6862915 C14.1241943,19.2483887 14.1228979,21.7797521 15.6893022,23.3461564 L21.3431458,29 L15.6893022,34.6538436 C14.1228979,36.2202479 14.1241943,38.7516113 15.6862915,40.3137085 C17.2452101,41.8726271 19.7823965,41.8744578 21.3461564,40.3106978 L27,34.6568542 L32.6538436,40.3106978 C34.2176035,41.8744578 36.7547899,41.8726271 38.3137085,40.3137085 C39.8758057,38.7516113 39.8771021,36.2202479 38.3106978,34.6538436 L32.6568542,29 Z M27,53 C41.3594035,53 53,41.3594035 53,27 C53,12.6405965 41.3594035,1 27,1 C12.6405965,1 1,12.6405965 1,27 C1,41.3594035 12.6405965,53 27,53 Z" id="Oval-2" sketch:type="MSShapeGroup"></path>\n </g>\n </g>\n </svg>\n </div>\n</div>',drop:function az(aS){return this.element.classList.remove("dz-drag-hover")},dragstart:function ay(aS){},dragend:function ao(aS){return this.element.classList.remove("dz-drag-hover")},dragenter:function aL(aS){return this.element.classList.add("dz-drag-hover")},dragover:function aG(aS){return this.element.classList.add("dz-drag-hover")},dragleave:function ai(aS){return this.element.classList.remove("dz-drag-hover")},paste:function aP(aS){},reset:function aH(){return this.element.classList.remove("dz-started")},addedfile:function aD(aV){var aZ=this;if(this.element===this.previewsContainer){this.element.classList.add("dz-started")}if(this.previewsContainer){aV.previewElement=C.createElement(this.options.previewTemplate.trim());aV.previewTemplate=aV.previewElement;this.previewsContainer.appendChild(aV.previewElement);for(var a7=aV.previewElement.querySelectorAll("[data-dz-name]"),a0=true,a5=0,a7=a0?a7:a7[Symbol.iterator]();;){var aT;if(a0){if(a5>=a7.length){break}aT=a7[a5++]}else{a5=a7.next();if(a5.done){break}aT=a5.value}var aU=aT;aU.textContent=aV.name}for(var a6=aV.previewElement.querySelectorAll("[data-dz-size]"),aY=true,a3=0,a6=aY?a6:a6[Symbol.iterator]();;){if(aY){if(a3>=a6.length){break}aU=a6[a3++]}else{a3=a6.next();if(a3.done){break}aU=a3.value}aU.innerHTML=this.filesize(aV.size)}if(this.options.addRemoveLinks){aV._removeLink=C.createElement('<a class="dz-remove" href="javascript:undefined;" data-dz-remove>'+this.options.dictRemoveFile+"</a>");aV.previewElement.appendChild(aV._removeLink)}var aX=function aX(a8){a8.preventDefault();a8.stopPropagation();if(aV.status===C.UPLOADING){return C.confirm(aZ.options.dictCancelUploadConfirmation,function(){return aZ.removeFile(aV)})}else{if(aZ.options.dictRemoveFileConfirmation){return C.confirm(aZ.options.dictRemoveFileConfirmation,function(){return aZ.removeFile(aV)})}else{return aZ.removeFile(aV)}}};for(var a4=aV.previewElement.querySelectorAll("[data-dz-remove]"),aW=true,a2=0,a4=aW?a4:a4[Symbol.iterator]();;){var aS;if(aW){if(a2>=a4.length){break}aS=a4[a2++]}else{a2=a4.next();if(a2.done){break}aS=a2.value}var a1=aS;a1.addEventListener("click",aX)}}},removedfile:function av(aS){if(aS.previewElement!=null&&aS.previewElement.parentNode!=null){aS.previewElement.parentNode.removeChild(aS.previewElement)}return this._updateMaxFilesReachedClass()},thumbnail:function aK(aV,aY){if(aV.previewElement){aV.previewElement.classList.remove("dz-file-preview");for(var aT=aV.previewElement.querySelectorAll("[data-dz-thumbnail]"),aS=true,aW=0,aT=aS?aT:aT[Symbol.iterator]();;){var aX;if(aS){if(aW>=aT.length){break}aX=aT[aW++]}else{aW=aT.next();if(aW.done){break}aX=aW.value}var aU=aX;aU.alt=aV.name;aU.src=aY}return setTimeout(function(){return aV.previewElement.classList.add("dz-image-preview")},1)}},error:function aC(aS,aW){if(aS.previewElement){aS.previewElement.classList.add("dz-error");if(typeof aW!=="String"&&aW.error){aW=aW.error}for(var aY=aS.previewElement.querySelectorAll("[data-dz-errormessage]"),aX=true,aT=0,aY=aX?aY:aY[Symbol.iterator]();;){var aV;if(aX){if(aT>=aY.length){break}aV=aY[aT++]}else{aT=aY.next();if(aT.done){break}aV=aT.value}var aU=aV;aU.textContent=aW}}},errormultiple:function at(){},processing:function aB(aS){if(aS.previewElement){aS.previewElement.classList.add("dz-processing");if(aS._removeLink){return aS._removeLink.textContent=this.options.dictCancelUpload}}},processingmultiple:function aF(){},uploadprogress:function aI(aV,aS,aU){if(aV.previewElement){for(var aZ=aV.previewElement.querySelectorAll("[data-dz-uploadprogress]"),aY=true,aT=0,aZ=aY?aZ:aZ[Symbol.iterator]();;){var aW;if(aY){if(aT>=aZ.length){break}aW=aZ[aT++]}else{aT=aZ.next();if(aT.done){break}aW=aT.value}var aX=aW;aX.nodeName==="PROGRESS"?aX.value=aS:aX.style.width=aS+"%"}}},totaluploadprogress:function ah(){},sending:function ap(){},sendingmultiple:function aq(){},success:function aJ(aS){if(aS.previewElement){return aS.previewElement.classList.add("dz-success")}},successmultiple:function al(){},canceled:function aE(aS){return this.emit("error",aS,this.options.dictUploadCanceled)},canceledmultiple:function aN(){},complete:function aw(aS){if(aS._removeLink){aS._removeLink.textContent=this.options.dictRemoveFile}if(aS.previewElement){return aS.previewElement.classList.add("dz-complete")}},completemultiple:function am(){},maxfilesexceeded:function au(){},maxfilesreached:function ar(){},queuecomplete:function ak(){},addedfiles:function aQ(){}};this.prototype._thumbnailQueue=[];this.prototype._processingThumbnail=false}},{key:"extend",value:function o(an){for(var ai=arguments.length,ar=Array(ai>1?ai-1:0),am=1;am<ai;am++){ar[am-1]=arguments[am]}for(var ap=ar,al=true,ao=0,ap=al?ap:ap[Symbol.iterator]();;){var ah;if(al){if(ao>=ap.length){break}ah=ap[ao++]}else{ao=ap.next();if(ao.done){break}ah=ao.value}var ak=ah;for(var aq in ak){var aj=ak[aq];an[aq]=aj}}return an}}]);function C(ak,ai){_classCallCheck(this,C);var an=_possibleConstructorReturn(this,(C.__proto__||Object.getPrototypeOf(C)).call(this));var am=void 0,al=void 0;an.element=ak;an.version=C.version;an.defaultOptions.previewTemplate=an.defaultOptions.previewTemplate.replace(/\n*/g,"");an.clickableElements=[];an.listeners=[];an.files=[];if(typeof an.element==="string"){an.element=document.querySelector(an.element)}if(!an.element||an.element.nodeType==null){throw new Error("Invalid dropzone element.")}if(an.element.dropzone){throw new Error("Dropzone already attached.")}C.instances.push(an);an.element.dropzone=an;var ah=(al=C.optionsForElement(an.element))!=null?al:{};an.options=C.extend({},an.defaultOptions,ah,ai!=null?ai:{});if(an.options.forceFallback||!C.isBrowserSupported()){var aj;return aj=an.options.fallback.call(an),_possibleConstructorReturn(an,aj)}if(an.options.url==null){an.options.url=an.element.getAttribute("action")}if(!an.options.url){throw new Error("No URL provided.")}if(an.options.acceptedFiles&&an.options.acceptedMimeTypes){throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.")}if(an.options.uploadMultiple&&an.options.chunking){throw new Error("You cannot set both: uploadMultiple and chunking.")}if(an.options.acceptedMimeTypes){an.options.acceptedFiles=an.options.acceptedMimeTypes;delete an.options.acceptedMimeTypes}if(an.options.renameFilename!=null){an.options.renameFile=function(ao){return an.options.renameFilename.call(an,ao.name,ao)}}an.options.method=an.options.method.toUpperCase();if((am=an.getExistingFallback())&&am.parentNode){am.parentNode.removeChild(am)}if(an.options.previewsContainer!==false){if(an.options.previewsContainer){an.previewsContainer=C.getElement(an.options.previewsContainer,"previewsContainer")}else{an.previewsContainer=an.element}}if(an.options.clickable){if(an.options.clickable===true){an.clickableElements=[an.element]}else{an.clickableElements=C.getElements(an.options.clickable,"clickable")}}an.init();return an}_createClass(C,[{key:"getAcceptedFiles",value:function x(){return this.files.filter(function(ah){return ah.accepted}).map(function(ah){return ah})}},{key:"getRejectedFiles",value:function ab(){return this.files.filter(function(ah){return !ah.accepted}).map(function(ah){return ah})}},{key:"getFilesWithStatus",value:function i(ah){return this.files.filter(function(ai){return ai.status===ah}).map(function(ai){return ai})}},{key:"getQueuedFiles",value:function y(){return this.getFilesWithStatus(C.QUEUED)}},{key:"getUploadingFiles",value:function a(){return this.getFilesWithStatus(C.UPLOADING)}},{key:"getAddedFiles",value:function u(){return this.getFilesWithStatus(C.ADDED)}},{key:"getActiveFiles",value:function M(){return this.files.filter(function(ah){return ah.status===C.UPLOADING||ah.status===C.QUEUED}).map(function(ah){return ah})}},{key:"init",value:function Z(){var ao=this;if(this.element.tagName==="form"){this.element.setAttribute("enctype","multipart/form-data")}if(this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")){this.element.appendChild(C.createElement('<div class="dz-default dz-message"><span>'+this.options.dictDefaultMessage+"</span></div>"))}if(this.clickableElements.length){var ar=function ar(){if(ao.hiddenFileInput){ao.hiddenFileInput.parentNode.removeChild(ao.hiddenFileInput)}ao.hiddenFileInput=document.createElement("input");ao.hiddenFileInput.setAttribute("type","file");if(ao.options.maxFiles===null||ao.options.maxFiles>1){ao.hiddenFileInput.setAttribute("multiple","multiple")}ao.hiddenFileInput.className="dz-hidden-input";if(ao.options.acceptedFiles!==null){ao.hiddenFileInput.setAttribute("accept",ao.options.acceptedFiles)}if(ao.options.capture!==null){ao.hiddenFileInput.setAttribute("capture",ao.options.capture)}ao.hiddenFileInput.style.visibility="hidden";ao.hiddenFileInput.style.position="absolute";ao.hiddenFileInput.style.top="0";ao.hiddenFileInput.style.left="0";ao.hiddenFileInput.style.height="0";ao.hiddenFileInput.style.width="0";document.querySelector(ao.options.hiddenInputContainer).appendChild(ao.hiddenFileInput);return ao.hiddenFileInput.addEventListener("change",function(){var aB=ao.hiddenFileInput.files;if(aB.length){for(var aA=aB,ax=true,az=0,aA=ax?aA:aA[Symbol.iterator]();;){var aw;if(ax){if(az>=aA.length){break}aw=aA[az++]}else{az=aA.next();if(az.done){break}aw=az.value}var ay=aw;ao.addFile(ay)}}ao.emit("addedfiles",aB);return ar()})};ar()}this.URL=window.URL!==null?window.URL:window.webkitURL;for(var al=this.events,au=true,at=0,al=au?al:al[Symbol.iterator]();;){var av;if(au){if(at>=al.length){break}av=al[at++]}else{at=al.next();if(at.done){break}av=at.value}var am=av;this.on(am,this.options[am])}this.on("uploadprogress",function(){return ao.updateTotalUploadProgress()});this.on("removedfile",function(){return ao.updateTotalUploadProgress()});this.on("canceled",function(aw){return ao.emit("complete",aw)});this.on("complete",function(aw){if(ao.getAddedFiles().length===0&&ao.getUploadingFiles().length===0&&ao.getQueuedFiles().length===0){return setTimeout(function(){return ao.emit("queuecomplete")},0)}});var ap=function ap(aw){aw.stopPropagation();if(aw.preventDefault){return aw.preventDefault()}else{return aw.returnValue=false}};this.listeners=[{element:this.element,events:{dragstart:function ah(aw){return ao.emit("dragstart",aw)},dragenter:function an(aw){ap(aw);return ao.emit("dragenter",aw)},dragover:function ak(ay){var ax=void 0;try{ax=ay.dataTransfer.effectAllowed}catch(aw){}ay.dataTransfer.dropEffect="move"===ax||"linkMove"===ax?"move":"copy";ap(ay);return ao.emit("dragover",ay)},dragleave:function aq(aw){return ao.emit("dragleave",aw)},drop:function aj(aw){ap(aw);return ao.drop(aw)},dragend:function ai(aw){return ao.emit("dragend",aw)}}}];this.clickableElements.forEach(function(aw){return ao.listeners.push({element:aw,events:{click:function ax(ay){if(aw!==ao.element||ay.target===ao.element||C.elementInside(ay.target,ao.element.querySelector(".dz-message"))){ao.hiddenFileInput.click()}return true}}})});this.enable();return this.options.init.call(this)}},{key:"destroy",value:function V(){this.disable();this.removeAllFiles(true);if(this.hiddenFileInput!=null?this.hiddenFileInput.parentNode:undefined){this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput);this.hiddenFileInput=null}delete this.element.dropzone;return C.instances.splice(C.instances.indexOf(this),1)}},{key:"updateTotalUploadProgress",value:function ag(){var ah=void 0;var ai=0;var ak=0;var am=this.getActiveFiles();if(am.length){for(var al=this.getActiveFiles(),ao=true,an=0,al=ao?al:al[Symbol.iterator]();;){var ap;if(ao){if(an>=al.length){break}ap=al[an++]}else{an=al.next();if(an.done){break}ap=an.value}var aj=ap;ai+=aj.upload.bytesSent;ak+=aj.upload.total}ah=100*ai/ak}else{ah=100}return this.emit("totaluploadprogress",ah,ak,ai)}},{key:"_getParamName",value:function J(ah){if(typeof this.options.paramName==="function"){return this.options.paramName(ah)}else{return""+this.options.paramName+(this.options.uploadMultiple?"["+ah+"]":"")}}},{key:"_renameFile",value:function ae(ah){if(typeof this.options.renameFile!=="function"){return ah.name}return this.options.renameFile(ah)}},{key:"getFallbackForm",value:function P(){var ai=void 0,aj=void 0;if(ai=this.getExistingFallback()){return ai}var ak='<div class="dz-fallback">';if(this.options.dictFallbackText){ak+="<p>"+this.options.dictFallbackText+"</p>"}ak+='<input type="file" name="'+this._getParamName(0)+'" '+(this.options.uploadMultiple?'multiple="multiple"':undefined)+' /><input type="submit" value="Upload!"></div>';var ah=C.createElement(ak);if(this.element.tagName!=="FORM"){aj=C.createElement('<form action="'+this.options.url+'" enctype="multipart/form-data" method="'+this.options.method+'"></form>');aj.appendChild(ah)}else{this.element.setAttribute("enctype","multipart/form-data");this.element.setAttribute("method",this.options.method)}return aj!=null?aj:ah}},{key:"getExistingFallback",value:function G(){var ak=function ak(ar){for(var ao=ar,am=true,an=0,ao=am?ao:ao[Symbol.iterator]();;){var ap;if(am){if(an>=ao.length){break}ap=ao[an++]}else{an=ao.next();if(an.done){break}ap=an.value}var aq=ap;if(/(^| )fallback($| )/.test(aq.className)){return aq}}};var ai=["div","form"];for(var ah=0;ah<ai.length;ah++){var aj=ai[ah];var al;if(al=ak(this.element.getElementsByTagName(aj))){return al}}}},{key:"setupEventListeners",value:function N(){return this.listeners.map(function(ah){return function(){var ai=[];for(var aj in ah.events){var ak=ah.events[aj];ai.push(ah.element.addEventListener(aj,ak,false))}return ai}()})}},{key:"removeEventListeners",value:function S(){return this.listeners.map(function(ah){return function(){var ai=[];for(var aj in ah.events){var ak=ah.events[aj];ai.push(ah.element.removeEventListener(aj,ak,false))}return ai}()})}},{key:"disable",value:function f(){var ah=this;this.clickableElements.forEach(function(ai){return ai.classList.remove("dz-clickable")});this.removeEventListeners();this.disabled=true;return this.files.map(function(ai){return ah.cancelUpload(ai)})}},{key:"enable",value:function l(){delete this.disabled;this.clickableElements.forEach(function(ah){return ah.classList.add("dz-clickable")});return this.setupEventListeners()}},{key:"filesize",value:function E(ak){var al=0;var an="b";if(ak>0){var ai=["tb","gb","mb","kb","b"];for(var aj=0;aj<ai.length;aj++){var am=ai[aj];var ah=Math.pow(this.options.filesizeBase,4-aj)/10;if(ak>=ah){al=ak/Math.pow(this.options.filesizeBase,4-aj);an=am;break}}al=Math.round(10*al)/10}return"<strong>"+al+"</strong> "+this.options.dictFileSizeUnits[an]}},{key:"_updateMaxFilesReachedClass",value:function r(){if(this.options.maxFiles!=null&&this.getAcceptedFiles().length>=this.options.maxFiles){if(this.getAcceptedFiles().length===this.options.maxFiles){this.emit("maxfilesreached",this.files)}return this.element.classList.add("dz-max-files-reached")}else{return this.element.classList.remove("dz-max-files-reached")}}},{key:"drop",value:function A(ak){if(!ak.dataTransfer){return}this.emit("drop",ak);var aj=[];for(var ai=0;ai<ak.dataTransfer.files.length;ai++){aj[ai]=ak.dataTransfer.files[ai]}this.emit("addedfiles",aj);if(aj.length){var ah=ak.dataTransfer.items;if(ah&&ah.length&&ah[0].webkitGetAsEntry!=null){this._addFilesFromItems(ah)}else{this.handleFiles(aj)}}}},{key:"paste",value:function af(ai){if(__guard__(ai!=null?ai.clipboardData:undefined,function(aj){return aj.items})==null){return}this.emit("paste",ai);var ah=ai.clipboardData.items;if(ah.length){return this._addFilesFromItems(ah)}}},{key:"handleFiles",value:function ad(ak){for(var ah=ak,am=true,al=0,ah=am?ah:ah[Symbol.iterator]();;){var ai;if(am){if(al>=ah.length){break}ai=ah[al++]}else{al=ah.next();if(al.done){break}ai=al.value}var aj=ai;this.addFile(aj)}}},{key:"_addFilesFromItems",value:function K(ah){var ai=this;return function(){var ak=[];for(var aj=ah,ap=true,ao=0,aj=ap?aj:aj[Symbol.iterator]();;){var al;if(ap){if(ao>=aj.length){break}al=aj[ao++]}else{ao=aj.next();if(ao.done){break}al=ao.value}var an=al;var am;if(an.webkitGetAsEntry!=null&&(am=an.webkitGetAsEntry())){if(am.isFile){ak.push(ai.addFile(an.getAsFile()))}else{if(am.isDirectory){ak.push(ai._addFilesFromDirectory(am,am.name))}else{ak.push(undefined)}}}else{if(an.getAsFile!=null){if(an.kind==null||an.kind==="file"){ak.push(ai.addFile(an.getAsFile()))}else{ak.push(undefined)}}else{ak.push(undefined)}}}return ak}()}},{key:"_addFilesFromDirectory",value:function w(ah,am){var ak=this;var al=ah.createReader();var aj=function aj(an){return __guardMethod__(console,"log",function(ao){return ao.log(an)})};var ai=function ai(){return al.readEntries(function(an){if(an.length>0){for(var at=an,ar=true,aq=0,at=ar?at:at[Symbol.iterator]();;){var ao;if(ar){if(aq>=at.length){break}ao=at[aq++]}else{aq=at.next();if(aq.done){break}ao=aq.value}var ap=ao;if(ap.isFile){ap.file(function(au){if(ak.options.ignoreHiddenFiles&&au.name.substring(0,1)==="."){return}au.fullPath=am+"/"+au.name;return ak.addFile(au)})}else{if(ap.isDirectory){ak._addFilesFromDirectory(ap,am+"/"+ap.name)}}}ai()}return null},aj)};return ai()}},{key:"accept",value:function g(ai,ah){if(this.options.maxFilesize&&ai.size>this.options.maxFilesize*1024*1024){return ah(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(ai.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize))}else{if(!C.isValidFile(ai,this.options.acceptedFiles)){return ah(this.options.dictInvalidFileType)}else{if(this.options.maxFiles!=null&&this.getAcceptedFiles().length>=this.options.maxFiles){ah(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles));return this.emit("maxfilesexceeded",ai)}else{return this.options.accept.call(this,ai,ah)}}}}},{key:"addFile",value:function R(ai){var ah=this;ai.upload={uuid:C.uuidv4(),progress:0,total:ai.size,bytesSent:0,filename:this._renameFile(ai),chunked:this.options.chunking&&(this.options.forceChunking||ai.size>this.options.chunkSize),totalChunkCount:Math.ceil(ai.size/this.options.chunkSize)};this.files.push(ai);ai.status=C.ADDED;this.emit("addedfile",ai);this._enqueueThumbnail(ai);return this.accept(ai,function(aj){if(aj){ai.accepted=false;ah._errorProcessing([ai],aj)}else{ai.accepted=true;if(ah.options.autoQueue){ah.enqueueFile(ai)}}return ah._updateMaxFilesReachedClass()})}},{key:"enqueueFiles",value:function t(aj){for(var am=aj,al=true,ak=0,am=al?am:am[Symbol.iterator]();;){var ah;if(al){if(ak>=am.length){break}ah=am[ak++]}else{ak=am.next();if(ak.done){break}ah=ak.value}var ai=ah;this.enqueueFile(ai)}return null}},{key:"enqueueFile",value:function D(ai){var ah=this;if(ai.status===C.ADDED&&ai.accepted===true){ai.status=C.QUEUED;if(this.options.autoProcessQueue){return setTimeout(function(){return ah.processQueue()},0)}}else{throw new Error("This file can't be queued because it has already been processed or was rejected.")}}},{key:"_enqueueThumbnail",value:function q(ah){var ai=this;if(this.options.createImageThumbnails&&ah.type.match(/image.*/)&&ah.size<=this.options.maxThumbnailFilesize*1024*1024){this._thumbnailQueue.push(ah);return setTimeout(function(){return ai._processThumbnailQueue()},0)}}},{key:"_processThumbnailQueue",value:function F(){var ai=this;if(this._processingThumbnail||this._thumbnailQueue.length===0){return}this._processingThumbnail=true;var ah=this._thumbnailQueue.shift();return this.createThumbnail(ah,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,true,function(aj){ai.emit("thumbnail",ah,aj);ai._processingThumbnail=false;return ai._processThumbnailQueue()})}},{key:"removeFile",value:function c(ah){if(ah.status===C.UPLOADING){this.cancelUpload(ah)}this.files=without(this.files,ah);this.emit("removedfile",ah);if(this.files.length===0){return this.emit("reset")}}},{key:"removeAllFiles",value:function d(am){if(am==null){am=false}for(var ak=this.files.slice(),aj=true,ai=0,ak=aj?ak:ak[Symbol.iterator]();;){var al;if(aj){if(ai>=ak.length){break}al=ak[ai++]}else{ai=ak.next();if(ai.done){break}al=ai.value}var ah=al;if(ah.status!==C.UPLOADING||am){this.removeFile(ah)}}return null}},{key:"resizeImage",value:function n(ai,aj,ah,al,am){var ak=this;return this.createThumbnail(ai,aj,ah,al,false,function(aq,an){if(an==null){return am(ai)}else{var ao=ak.options.resizeMimeType;if(ao==null){ao=ai.type}var ap=an.toDataURL(ao,ak.options.resizeQuality);if(ao==="image/jpeg"||ao==="image/jpg"){ap=ExifRestore.restore(ai.dataURL,ap)}return am(C.dataURItoBlob(ap))}})}},{key:"createThumbnail",value:function I(ak,al,ah,an,aj,ao){var am=this;var ai=new FileReader();ai.onload=function(){ak.dataURL=ai.result;if(ak.type==="image/svg+xml"){if(ao!=null){ao(ai.result)}return}return am.createThumbnailFromUrl(ak,al,ah,an,aj,ao)};return ai.readAsDataURL(ak)}},{key:"createThumbnailFromUrl",value:function T(ai,ah,ap,aj,am,ao,an){var ak=this;var al=document.createElement("img");if(an){al.crossOrigin=an}al.onload=function(){var aq=function aq(ar){return ar(1)};if(typeof EXIF!=="undefined"&&EXIF!==null&&am){aq=function aq(ar){return EXIF.getData(al,function(){return ar(EXIF.getTag(this,"Orientation"))})}}return aq(function(at){ai.width=al.width;ai.height=al.height;var av=ak.options.resize.call(ak,ai,ah,ap,aj);var au=document.createElement("canvas");var ar=au.getContext("2d");au.width=av.trgWidth;au.height=av.trgHeight;if(at>4){au.width=av.trgHeight;au.height=av.trgWidth}switch(at){case 2:ar.translate(au.width,0);ar.scale(-1,1);break;case 3:ar.translate(au.width,au.height);ar.rotate(Math.PI);break;case 4:ar.translate(0,au.height);ar.scale(1,-1);break;case 5:ar.rotate(0.5*Math.PI);ar.scale(1,-1);break;case 6:ar.rotate(0.5*Math.PI);ar.translate(0,-au.height);break;case 7:ar.rotate(0.5*Math.PI);ar.translate(au.width,-au.height);ar.scale(-1,1);break;case 8:ar.rotate(-0.5*Math.PI);ar.translate(-au.width,0);break}drawImageIOSFix(ar,al,av.srcX!=null?av.srcX:0,av.srcY!=null?av.srcY:0,av.srcWidth,av.srcHeight,av.trgX!=null?av.trgX:0,av.trgY!=null?av.trgY:0,av.trgWidth,av.trgHeight);var aw=au.toDataURL("image/png");if(ao!=null){return ao(aw,au)}})};if(ao!=null){al.onerror=ao}return al.src=ai.dataURL}},{key:"processQueue",value:function U(){var ak=this.options.parallelUploads;var ah=this.getUploadingFiles().length;var ai=ah;if(ah>=ak){return}var aj=this.getQueuedFiles();if(!(aj.length>0)){return}if(this.options.uploadMultiple){return this.processFiles(aj.slice(0,ak-ah))}else{while(ai<ak){if(!aj.length){return}this.processFile(aj.shift());ai++}}}},{key:"processFile",value:function b(ah){return this.processFiles([ah])}},{key:"processFiles",value:function h(ak){for(var al=ak,ai=true,aj=0,al=ai?al:al[Symbol.iterator]();;){var am;if(ai){if(aj>=al.length){break}am=al[aj++]}else{aj=al.next();if(aj.done){break}am=aj.value}var ah=am;ah.processing=true;ah.status=C.UPLOADING;this.emit("processing",ah)}if(this.options.uploadMultiple){this.emit("processingmultiple",ak)}return this.uploadFiles(ak)}},{key:"_getFilesWithXhr",value:function s(ai){var ah=void 0;return ah=this.files.filter(function(aj){return aj.xhr===ai}).map(function(aj){return aj})}},{key:"cancelUpload",value:function aa(aj){if(aj.status===C.UPLOADING){var at=this._getFilesWithXhr(aj.xhr);for(var ai=at,aq=true,al=0,ai=aq?ai:ai[Symbol.iterator]();;){var ao;if(aq){if(al>=ai.length){break}ao=ai[al++]}else{al=ai.next();if(al.done){break}ao=al.value}var am=ao;am.status=C.CANCELED}if(typeof aj.xhr!=="undefined"){aj.xhr.abort()}for(var ah=at,an=true,ak=0,ah=an?ah:ah[Symbol.iterator]();;){var ap;if(an){if(ak>=ah.length){break}ap=ah[ak++]}else{ak=ah.next();if(ak.done){break}ap=ak.value}var ar=ap;this.emit("canceled",ar)}if(this.options.uploadMultiple){this.emit("canceledmultiple",at)}}else{if(aj.status===C.ADDED||aj.status===C.QUEUED){aj.status=C.CANCELED;this.emit("canceled",aj);if(this.options.uploadMultiple){this.emit("canceledmultiple",[aj])}}}if(this.options.autoProcessQueue){return this.processQueue()}}},{key:"resolveOption",value:function p(aj){if(typeof aj==="function"){for(var ak=arguments.length,ai=Array(ak>1?ak-1:0),ah=1;ah<ak;ah++){ai[ah-1]=arguments[ah]}return aj.apply(this,ai)}return aj}},{key:"uploadFile",value:function L(ah){return this.uploadFiles([ah])}},{key:"uploadFiles",value:function k(ai){var ah=this;this._transformFiles(ai,function(an){if(ai[0].upload.chunked){var am=ai[0];var ap=an[0];var aq=0;am.upload.chunks=[];var ao=function ao(){var at=0;while(am.upload.chunks[at]!==undefined){at++}if(at>=am.upload.totalChunkCount){return}aq++;var av=at*ah.options.chunkSize;var ar=Math.min(av+ah.options.chunkSize,am.size);var au={name:ah._getParamName(0),data:ap.webkitSlice?ap.webkitSlice(av,ar):ap.slice(av,ar),filename:am.upload.filename,chunkIndex:at};am.upload.chunks[at]={file:am,index:at,dataBlock:au,status:C.UPLOADING,progress:0,retries:0};ah._uploadData(ai,[au])};am.upload.finishedChunkUpload=function(ar){var au=true;ar.status=C.SUCCESS;ar.dataBlock=null;for(var at=0;at<am.upload.totalChunkCount;at++){if(am.upload.chunks[at]===undefined){return ao()}if(am.upload.chunks[at].status!==C.SUCCESS){au=false}}if(au){ah.options.chunksUploaded(am,function(){ah._finished(ai,"",null)})}};if(ah.options.parallelChunkUploads){for(var al=0;al<am.upload.totalChunkCount;al++){ao()}}else{ao()}}else{var aj=[];for(var ak=0;ak<ai.length;ak++){aj[ak]={name:ah._getParamName(ak),data:an[ak],filename:ai[ak].upload.filename}}ah._uploadData(ai,aj)}})}},{key:"_getChunk",value:function z(ai,aj){for(var ah=0;ah<ai.upload.totalChunkCount;ah++){if(ai.upload.chunks[ah]!==undefined&&ai.upload.chunks[ah].xhr===aj){return ai.upload.chunks[ah]}}}},{key:"_uploadData",value:function O(aq,ai){var aA=this;var av=new XMLHttpRequest();for(var ao=aq,aF=true,am=0,ao=aF?ao:ao[Symbol.iterator]();;){var aw;if(aF){if(am>=ao.length){break}aw=ao[am++]}else{am=ao.next();if(am.done){break}aw=am.value}var aG=aw;aG.xhr=av}if(aq[0].upload.chunked){aq[0].upload.chunks[ai[0].chunkIndex].xhr=av}var an=this.resolveOption(this.options.method,aq);var ap=this.resolveOption(this.options.url,aq);av.open(an,ap,true);av.timeout=this.resolveOption(this.options.timeout,aq);av.withCredentials=!!this.options.withCredentials;av.onload=function(aI){aA._finishedUploading(aq,av,aI)};av.onerror=function(){aA._handleUploadError(aq,av)};var ar=av.upload!=null?av.upload:av;ar.onprogress=function(aI){return aA._updateFilesUploadProgress(aq,av,aI)};var aj={Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"};if(this.options.headers){C.extend(aj,this.options.headers)}for(var az in aj){var au=aj[az];if(au){av.setRequestHeader(az,au)}}var aC=new FormData();if(this.options.params){var ax=this.options.params;if(typeof ax==="function"){ax=ax.call(this,aq,av,aq[0].upload.chunked?this._getChunk(aq[0],av):null)}for(var aH in ax){var aB=ax[aH];aC.append(aH,aB)}}for(var al=aq,aE=true,ak=0,al=aE?al:al[Symbol.iterator]();;){var at;if(aE){if(ak>=al.length){break}at=al[ak++]}else{ak=al.next();if(ak.done){break}at=ak.value}var ay=at;this.emit("sending",ay,av,aC)}if(this.options.uploadMultiple){this.emit("sendingmultiple",aq,av,aC)}this._addFormElementData(aC);for(var aD=0;aD<ai.length;aD++){var ah=ai[aD];aC.append(ah.name,ah.data,ah.filename)}this.submitRequest(av,aC,aq)}},{key:"_transformFiles",value:function Q(al,ai){var aj=this;var am=[];var ah=0;var an=function an(ao){aj.options.transformFile.call(aj,al[ao],function(ap){am[ao]=ap;if(++ah===al.length){ai(am)}})};for(var ak=0;ak<al.length;ak++){an(ak)}}},{key:"_addFormElementData",value:function X(aj){if(this.element.tagName==="FORM"){for(var au=this.element.querySelectorAll("input, textarea, select, button"),an=true,ak=0,au=an?au:au[Symbol.iterator]();;){var ap;if(an){if(ak>=au.length){break}ap=au[ak++]}else{ak=au.next();if(ak.done){break}ap=ak.value}var ar=ap;var aq=ar.getAttribute("name");var ah=ar.getAttribute("type");if(ah){ah=ah.toLowerCase()}if(typeof aq==="undefined"||aq===null){continue}if(ar.tagName==="SELECT"&&ar.hasAttribute("multiple")){for(var at=ar.options,al=true,ai=0,at=al?at:at[Symbol.iterator]();;){var am;if(al){if(ai>=at.length){break}am=at[ai++]}else{ai=at.next();if(ai.done){break}am=ai.value}var ao=am;if(ao.selected){aj.append(aq,ao.value)}}}else{if(!ah||ah!=="checkbox"&&ah!=="radio"||ar.checked){aj.append(aq,ar.value)}}}}}},{key:"_updateFilesUploadProgress",value:function e(av,ay,aK){var ax=void 0;if(typeof aK!=="undefined"){ax=100*aK.loaded/aK.total;if(av[0].upload.chunked){var aL=av[0];var az=this._getChunk(aL,ay);az.progress=ax;az.total=aK.total;az.bytesSent=aK.loaded;var aJ=0,aC=void 0,aM=void 0;aL.upload.progress=0;aL.upload.total=0;aL.upload.bytesSent=0;for(var aH=0;aH<aL.upload.totalChunkCount;aH++){if(aL.upload.chunks[aH]!==undefined&&aL.upload.chunks[aH].progress!==undefined){aL.upload.progress+=aL.upload.chunks[aH].progress;aL.upload.total+=aL.upload.chunks[aH].total;aL.upload.bytesSent+=aL.upload.chunks[aH].bytesSent}}aL.upload.progress=aL.upload.progress/aL.upload.totalChunkCount}else{for(var am=av,aG=true,al=0,am=aG?am:am[Symbol.iterator]();;){var aw;if(aG){if(al>=am.length){break}aw=am[al++]}else{al=am.next();if(al.done){break}aw=al.value}var ar=aw;ar.upload.progress=ax;ar.upload.total=aK.total;ar.upload.bytesSent=aK.loaded}}for(var ak=av,aF=true,aj=0,ak=aF?ak:ak[Symbol.iterator]();;){var au;if(aF){if(aj>=ak.length){break}au=ak[aj++]}else{aj=ak.next();if(aj.done){break}au=aj.value}var ap=au;this.emit("uploadprogress",ap,ap.upload.progress,ap.upload.bytesSent)}}else{var aI=true;ax=100;for(var ai=av,aE=true,aB=0,ai=aE?ai:ai[Symbol.iterator]();;){var at;if(aE){if(aB>=ai.length){break}at=ai[aB++]}else{aB=ai.next();if(aB.done){break}at=aB.value}var ao=at;if(ao.upload.progress!==100||ao.upload.bytesSent!==ao.upload.total){aI=false}ao.upload.progress=ax;ao.upload.bytesSent=ao.upload.total}if(aI){return}for(var ah=av,aD=true,aA=0,ah=aD?ah:ah[Symbol.iterator]();;){var aq;if(aD){if(aA>=ah.length){break}aq=ah[aA++]}else{aA=ah.next();if(aA.done){break}aq=aA.value}var an=aq;this.emit("uploadprogress",an,ax,an.upload.bytesSent)}}}},{key:"_finishedUploading",value:function m(aj,al,ak){var ah=void 0;if(aj[0].status===C.CANCELED){return}if(al.readyState!==4){return}if(al.responseType!=="arraybuffer"&&al.responseType!=="blob"){ah=al.responseText;if(al.getResponseHeader("content-type")&&~al.getResponseHeader("content-type").indexOf("application/json")){try{ah=JSON.parse(ah)}catch(ai){ak=ai;ah="Invalid JSON response from server."}}}this._updateFilesUploadProgress(aj);if(!(200<=al.status&&al.status<300)){this._handleUploadError(aj,al,ah)}else{if(aj[0].upload.chunked){aj[0].upload.finishedChunkUpload(this._getChunk(aj[0],al))}else{this._finished(aj,ah,ak)}}}},{key:"_handleUploadError",value:function v(ah,ap,am){if(ah[0].status===C.CANCELED){return}if(ah[0].upload.chunked&&this.options.retryChunks){var ao=this._getChunk(ah[0],ap);if(ao.retries++<this.options.retryChunksLimit){this._uploadData(ah,[ao.dataBlock]);return}else{console.warn("Retried this chunk too often. Giving up.")}}for(var an=ah,al=true,ai=0,an=al?an:an[Symbol.iterator]();;){var aj;if(al){if(ai>=an.length){break}aj=an[ai++]}else{ai=an.next();if(ai.done){break}aj=ai.value}var ak=aj;this._errorProcessing(ah,am||this.options.dictResponseError.replace("{{statusCode}}",ap.status),ap)}}},{key:"submitRequest",value:function Y(aj,ai,ah){aj.send(ai)}},{key:"_finished",value:function ac(ak,al,an){for(var am=ak,aj=true,ai=0,am=aj?am:am[Symbol.iterator]();;){var ao;if(aj){if(ai>=am.length){break}ao=am[ai++]}else{ai=am.next();if(ai.done){break}ao=ai.value}var ah=ao;ah.status=C.SUCCESS;this.emit("success",ah,al,an);this.emit("complete",ah)}if(this.options.uploadMultiple){this.emit("successmultiple",ak,al,an);this.emit("completemultiple",ak)}if(this.options.autoProcessQueue){return this.processQueue()}}},{key:"_errorProcessing",value:function H(al,ak,ao){for(var am=al,aj=true,ai=0,am=aj?am:am[Symbol.iterator]();;){var an;if(aj){if(ai>=am.length){break}an=am[ai++]}else{ai=am.next();if(ai.done){break}an=ai.value}var ah=an;ah.status=C.ERROR;this.emit("error",ah,ak,ao);this.emit("complete",ah)}if(this.options.uploadMultiple){this.emit("errormultiple",al,ak,ao);this.emit("completemultiple",al)}if(this.options.autoProcessQueue){return this.processQueue()}}}],[{key:"uuidv4",value:function W(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(aj){var ai=Math.random()*16|0,ah=aj==="x"?ai:ai&3|8;return ah.toString(16)})}}]);return C}(Emitter);Dropzone.initClass();Dropzone.version="5.4.0";Dropzone.options={};Dropzone.optionsForElement=function(a){if(a.getAttribute("id")){return Dropzone.options[camelize(a.getAttribute("id"))]}else{return undefined}};Dropzone.instances=[];Dropzone.forElement=function(a){if(typeof a==="string"){a=document.querySelector(a)}if((a!=null?a.dropzone:undefined)==null){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.")}return a.dropzone};Dropzone.autoDiscover=true;Dropzone.discover=function(){var a=void 0;if(document.querySelectorAll){a=document.querySelectorAll(".dropzone")}else{a=[];var b=function b(c){return function(){var d=[];for(var h=c,f=true,e=0,h=f?h:h[Symbol.iterator]();;){var i;if(f){if(e>=h.length){break}i=h[e++]}else{e=h.next();if(e.done){break}i=e.value}var g=i;if(/(^| )dropzone($| )/.test(g.className)){d.push(a.push(g))}else{d.push(undefined)}}return d}()};b(document.getElementsByTagName("div"));b(document.getElementsByTagName("form"))}return function(){var c=[];for(var g=a,f=true,e=0,g=f?g:g[Symbol.iterator]();;){var h;if(f){if(e>=g.length){break}h=g[e++]}else{e=g.next();if(e.done){break}h=e.value}var d=h;if(Dropzone.optionsForElement(d)!==false){c.push(new Dropzone(d))}else{c.push(undefined)}}return c}()};Dropzone.blacklistedBrowsers=[/opera.*(Macintosh|Windows Phone).*version\/12/i];Dropzone.isBrowserSupported=function(){var d=true;if(window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector){if(!("classList" in document.createElement("a"))){d=false}else{for(var c=Dropzone.blacklistedBrowsers,b=true,a=0,c=b?c:c[Symbol.iterator]();;){var f;if(b){if(a>=c.length){break}f=c[a++]}else{a=c.next();if(a.done){break}f=a.value}var e=f;if(e.test(navigator.userAgent)){d=false;continue}}}}else{d=false}return d};Dropzone.dataURItoBlob=function(c){var h=atob(c.split(",")[1]);var a=c.split(",")[0].split(":")[1].split(";")[0];var g=new ArrayBuffer(h.length);var d=new Uint8Array(g);for(var e=0,b=h.length,f=0<=b;f?e<=b:e>=b;f?e++:e--){d[e]=h.charCodeAt(e)}return new Blob([g],{type:a})};var without=function without(b,a){return b.filter(function(c){return c!==a}).map(function(c){return c})};var camelize=function camelize(a){return a.replace(/[\-_](\w)/g,function(b){return b.charAt(1).toUpperCase()})};Dropzone.createElement=function(a){var b=document.createElement("div");b.innerHTML=a;return b.childNodes[0]};Dropzone.elementInside=function(b,a){if(b===a){return true}while(b=b.parentNode){if(b===a){return true}}return false};Dropzone.getElement=function(c,a){var b=void 0;if(typeof c==="string"){b=document.querySelector(c)}else{if(c.nodeType!=null){b=c}}if(b==null){throw new Error("Invalid `"+a+"` option provided. Please provide a CSS selector or a plain HTML element.")}return b};Dropzone.getElements=function(d,b){var c=void 0,a=void 0;if(d instanceof Array){a=[];try{for(var g=d,l=true,j=0,g=l?g:g[Symbol.iterator]();;){if(l){if(j>=g.length){break}c=g[j++]}else{j=g.next();if(j.done){break}c=j.value}a.push(this.getElement(c,b))}}catch(h){a=null}}else{if(typeof d==="string"){a=[];for(var f=document.querySelectorAll(d),k=true,i=0,f=k?f:f[Symbol.iterator]();;){if(k){if(i>=f.length){break}c=f[i++]}else{i=f.next();if(i.done){break}c=i.value}a.push(c)}}else{if(d.nodeType!=null){a=[d]}}}if(a==null||!a.length){throw new Error("Invalid `"+b+"` option provided. Please provide a CSS selector, a plain HTML element or a list of those.")}return a};Dropzone.confirm=function(a,c,b){if(window.confirm(a)){return c()}else{if(b!=null){return b()}}};Dropzone.isValidFile=function(e,b){if(!b){return true}b=b.split(",");var c=e.type;var d=c.replace(/\/.*$/,"");for(var f=b,i=true,h=0,f=i?f:f[Symbol.iterator]();;){var a;if(i){if(h>=f.length){break}a=f[h++]}else{h=f.next();if(h.done){break}a=h.value}var g=a;g=g.trim();if(g.charAt(0)==="."){if(e.name.toLowerCase().indexOf(g.toLowerCase(),e.name.length-g.length)!==-1){return true}}else{if(/\/\*$/.test(g)){if(d===g.replace(/\/.*$/,"")){return true}}else{if(c===g){return true}}}}return false};if(typeof jQuery!=="undefined"&&jQuery!==null){jQuery.fn.dropzone=function(a){return this.each(function(){return new Dropzone(this,a)})}}if(typeof module!=="undefined"&&module!==null){module.exports=Dropzone}else{window.Dropzone=Dropzone}Dropzone.ADDED="added";Dropzone.QUEUED="queued";Dropzone.ACCEPTED=Dropzone.QUEUED;Dropzone.UPLOADING="uploading";Dropzone.PROCESSING=Dropzone.UPLOADING;Dropzone.CANCELED="canceled";Dropzone.ERROR="error";Dropzone.SUCCESS="success";var detectVerticalSquash=function detectVerticalSquash(e){var b=e.naturalWidth;var k=e.naturalHeight;var a=document.createElement("canvas");a.width=1;a.height=k;var l=a.getContext("2d");l.drawImage(e,0,0);var j=l.getImageData(1,0,1,k),d=j.data;var h=0;var f=k;var i=k;while(i>h){var c=d[(i-1)*4+3];if(c===0){f=i}else{h=i}i=f+h>>1}var g=i/k;if(g===0){return 1}else{return g}};var drawImageIOSFix=function drawImageIOSFix(i,b,g,f,h,c,k,j,a,e){var d=detectVerticalSquash(b);return i.drawImage(b,g,f,h,c,k,j,a,e/d)};var ExifRestore=function(){function f(){_classCallCheck(this,f)}_createClass(f,null,[{key:"initClass",value:function b(){this.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}},{key:"encode64",value:function i(l){var j="";var s=undefined;var q=undefined;var o="";var r=undefined;var p=undefined;var n=undefined;var m="";var k=0;while(true){s=l[k++];q=l[k++];o=l[k++];r=s>>2;p=(s&3)<<4|q>>4;n=(q&15)<<2|o>>6;m=o&63;if(isNaN(q)){n=m=64}else{if(isNaN(o)){m=64}}j=j+this.KEY_STR.charAt(r)+this.KEY_STR.charAt(p)+this.KEY_STR.charAt(n)+this.KEY_STR.charAt(m);s=q=o="";r=p=n=m="";if(!(k<l.length)){break}}return j}},{key:"restore",value:function g(j,n){if(!j.match("data:image/jpeg;base64,")){return n}var m=this.decode64(j.replace("data:image/jpeg;base64,",""));var k=this.slice2Segments(m);var l=this.exifManipulation(n,k);return"data:image/jpeg;base64,"+this.encode64(l)}},{key:"exifManipulation",value:function c(n,l){var j=this.getExifArray(l);var k=this.insertExif(n,j);var m=new Uint8Array(k);return m}},{key:"getExifArray",value:function e(l){var k=undefined;var j=0;while(j<l.length){k=l[j];if(k[0]===255&k[1]===225){return k}j++}return[]}},{key:"insertExif",value:function h(q,j){var p=q.replace("data:image/jpeg;base64,","");var l=this.decode64(p);var k=l.indexOf(255,3);var n=l.slice(0,k);var m=l.slice(k);var o=n;o=o.concat(j);o=o.concat(m);return o}},{key:"slice2Segments",value:function a(k){var n=0;var l=[];while(true){var o;if(k[n]===255&k[n+1]===218){break}if(k[n]===255&k[n+1]===216){n+=2}else{o=k[n+2]*256+k[n+3];var m=n+o+2;var j=k.slice(n,m);l.push(j);n=m}if(n>k.length){break}}return l}},{key:"decode64",value:function d(n){var l="";var u=undefined;var s=undefined;var q="";var t=undefined;var r=undefined;var p=undefined;var o="";var m=0;var k=[];var j=/[^A-Za-z0-9\+\/\=]/g;if(j.exec(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.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(true){t=this.KEY_STR.indexOf(n.charAt(m++));r=this.KEY_STR.indexOf(n.charAt(m++));p=this.KEY_STR.indexOf(n.charAt(m++));o=this.KEY_STR.indexOf(n.charAt(m++));u=t<<2|r>>4;s=(r&15)<<4|p>>2;q=(p&3)<<6|o;k.push(u);if(p!==64){k.push(s)}if(o!==64){k.push(q)}u=s=q="";t=r=p=o="";if(!(m<n.length)){break}}return k}}]);return f}();ExifRestore.initClass();var contentLoaded=function contentLoaded(c,g){var b=false;var f=true;var i=c.document;var h=i.documentElement;var l=i.addEventListener?"addEventListener":"attachEvent";var j=i.addEventListener?"removeEventListener":"detachEvent";var a=i.addEventListener?"":"on";var k=function k(m){if(m.type==="readystatechange"&&i.readyState!=="complete"){return}(m.type==="load"?c:i)[j](a+m.type,k,false);if(!b&&(b=true)){return g.call(c,m.type||m)}};var d=function d(){try{h.doScroll("left")}catch(m){setTimeout(d,50);return}return k("poll")};if(i.readyState!=="complete"){if(i.createEventObject&&h.doScroll){try{f=!c.frameElement}catch(e){}if(f){d()}}i[l](a+"DOMContentLoaded",k,false);i[l](a+"readystatechange",k,false);return c[l](a+"load",k,false)}};Dropzone._autoDiscoverFunction=function(){if(Dropzone.autoDiscover){return Dropzone.discover()}};contentLoaded(window,Dropzone._autoDiscoverFunction);function __guard__(b,a){return typeof b!=="undefined"&&b!==null?a(b):undefined}function __guardMethod__(c,a,b){if(typeof c!=="undefined"&&c!==null&&typeof c[a]==="function"){return b(c,a)}else{return undefined}}; |