var e=t;function t(){var e=[].slice.call(arguments),i=!1;typeof e[0]==`boolean`&&(i=e.shift());var a=e[0];if(r(a))throw Error(`extendee must be an object`);for(var o=e.slice(1),s=o.length,c=0;c<s;c++){var l=o[c];for(var u in l)if(Object.prototype.hasOwnProperty.call(l,u)){var d=l[u];if(i&&n(d)){var f=Array.isArray(d)?[]:{};a[u]=t(!0,Object.prototype.hasOwnProperty.call(a,u)&&!r(a[u])?a[u]:f,d)}else a[u]=d}}return a}function n(e){return Array.isArray(e)||{}.toString.call(e)==`[object Object]`}function r(e){return!e||typeof e!=`object`&&typeof e!=`function`}function i(e){return e&&e.__esModule?e.default:e}var a=class{on(e,t){return this._callbacks=this._callbacks||{},this._callbacks[e]||(this._callbacks[e]=[]),this._callbacks[e].push(t),this}emit(e,...t){this._callbacks=this._callbacks||{};let n=this._callbacks[e];if(n)for(let e of n)e.apply(this,t);return this.element&&this.element.dispatchEvent(this.makeEvent(`dropzone:`+e,{args:t})),this}makeEvent(e,t){let n={bubbles:!0,cancelable:!0,detail:t};if(typeof window.CustomEvent==`function`)return new CustomEvent(e,n);var r=document.createEvent(`CustomEvent`);return r.initCustomEvent(e,n.bubbles,n.cancelable,n.detail),r}off(e,t){if(!this._callbacks||arguments.length===0)return this._callbacks={},this;let n=this._callbacks[e];if(!n)return this;if(arguments.length===1)return delete this._callbacks[e],this;for(let e=0;e<n.length;e++)if(n[e]===t){n.splice(e,1);break}return this}},o={};o=`<div class="dz-preview dz-file-preview">
  <div class="dz-image"><img data-dz-thumbnail=""></div>
  <div class="dz-details">
    <div class="dz-size"><span data-dz-size=""></span></div>
    <div class="dz-filename"><span data-dz-name=""></span></div>
  </div>
  <div class="dz-progress">
    <span class="dz-upload" data-dz-uploadprogress=""></span>
  </div>
  <div class="dz-error-message"><span data-dz-errormessage=""></span></div>
  <div class="dz-success-mark">
    <svg width="54" height="54" viewBox="0 0 54 54" fill="white" xmlns="http://www.w3.org/2000/svg">
      <path d="M10.2071 29.7929L14.2929 25.7071C14.6834 25.3166 15.3166 25.3166 15.7071 25.7071L21.2929 31.2929C21.6834 31.6834 22.3166 31.6834 22.7071 31.2929L38.2929 15.7071C38.6834 15.3166 39.3166 15.3166 39.7071 15.7071L43.7929 19.7929C44.1834 20.1834 44.1834 20.8166 43.7929 21.2071L22.7071 42.2929C22.3166 42.6834 21.6834 42.6834 21.2929 42.2929L10.2071 31.2071C9.81658 30.8166 9.81658 30.1834 10.2071 29.7929Z"></path>
    </svg>
  </div>
  <div class="dz-error-mark">
    <svg width="54" height="54" viewBox="0 0 54 54" fill="white" xmlns="http://www.w3.org/2000/svg">
      <path d="M26.2929 20.2929L19.2071 13.2071C18.8166 12.8166 18.1834 12.8166 17.7929 13.2071L13.2071 17.7929C12.8166 18.1834 12.8166 18.8166 13.2071 19.2071L20.2929 26.2929C20.6834 26.6834 20.6834 27.3166 20.2929 27.7071L13.2071 34.7929C12.8166 35.1834 12.8166 35.8166 13.2071 36.2071L17.7929 40.7929C18.1834 41.1834 18.8166 41.1834 19.2071 40.7929L26.2929 33.7071C26.6834 33.3166 27.3166 33.3166 27.7071 33.7071L34.7929 40.7929C35.1834 41.1834 35.8166 41.1834 36.2071 40.7929L40.7929 36.2071C41.1834 35.8166 41.1834 35.1834 40.7929 34.7929L33.7071 27.7071C33.3166 27.3166 33.3166 26.6834 33.7071 26.2929L40.7929 19.2071C41.1834 18.8166 41.1834 18.1834 40.7929 17.7929L36.2071 13.2071C35.8166 12.8166 35.1834 12.8166 34.7929 13.2071L27.7071 20.2929C27.3166 20.6834 26.6834 20.6834 26.2929 20.2929Z"></path>
    </svg>
  </div>
</div>
`;var s={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,acceptedMimeTypes: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 can not upload any more files.`,dictFileSizeUnits:{tb:`TB`,gb:`GB`,mb:`MB`,kb:`KB`,b:`b`},init(){},params(e,t,n){if(n)return{dzuuid:n.file.upload.uuid,dzchunkindex:n.index,dztotalfilesize:n.file.size,dzchunksize:this.options.chunkSize,dztotalchunkcount:n.file.upload.totalChunkCount,dzchunkbyteoffset:n.index*this.options.chunkSize}},accept(e,t){return t()},chunksUploaded:function(e,t){t()},binaryBody:!1,fallback(){let e;this.element.className=`${this.element.className} dz-browser-not-supported`;for(let t of this.element.getElementsByTagName(`div`))if(/(^| )dz-message($| )/.test(t.className)){e=t,t.className=`dz-message`;break}e||(e=c.createElement(`<div class="dz-message"><span></span></div>`),this.element.appendChild(e));let t=e.getElementsByTagName(`span`)[0];return t&&(t.textContent==null?t.innerText!=null&&(t.innerText=this.options.dictFallbackMessage):t.textContent=this.options.dictFallbackMessage),this.element.appendChild(this.getFallbackForm())},resize(e,t,n,r){let i={srcX:0,srcY:0,srcWidth:e.width,srcHeight:e.height},a=e.width/e.height;t==null&&n==null?(t=i.srcWidth,n=i.srcHeight):t==null?t=n*a:n??(n=t/a),t=Math.min(t,i.srcWidth),n=Math.min(n,i.srcHeight);let o=t/n;if(i.srcWidth>t||i.srcHeight>n)if(r===`crop`)a>o?(i.srcHeight=e.height,i.srcWidth=i.srcHeight*o):(i.srcWidth=e.width,i.srcHeight=i.srcWidth/o);else if(r===`contain`)a>o?n=t/a:t=n*a;else throw Error(`Unknown resizeMethod '${r}'`);return i.srcX=(e.width-i.srcWidth)/2,i.srcY=(e.height-i.srcHeight)/2,i.trgWidth=t,i.trgHeight=n,i},transformFile(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:i(o),drop(e){return this.element.classList.remove(`dz-drag-hover`)},dragstart(e){},dragend(e){return this.element.classList.remove(`dz-drag-hover`)},dragenter(e){return this.element.classList.add(`dz-drag-hover`)},dragover(e){return this.element.classList.add(`dz-drag-hover`)},dragleave(e){return this.element.classList.remove(`dz-drag-hover`)},paste(e){},reset(){return this.element.classList.remove(`dz-started`)},addedfile(e){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);for(var t of e.previewElement.querySelectorAll(`[data-dz-name]`))t.textContent=e.name;for(t of e.previewElement.querySelectorAll(`[data-dz-size]`))t.innerHTML=this.filesize(e.size);this.options.addRemoveLinks&&(e._removeLink=c.createElement(`<a class="dz-remove" href="javascript:undefined;" data-dz-remove>${this.options.dictRemoveFile}</a>`),e.previewElement.appendChild(e._removeLink));let n=t=>(t.preventDefault(),t.stopPropagation(),e.status===c.UPLOADING?c.confirm(this.options.dictCancelUploadConfirmation,()=>this.removeFile(e)):this.options.dictRemoveFileConfirmation?c.confirm(this.options.dictRemoveFileConfirmation,()=>this.removeFile(e)):this.removeFile(e));for(let t of e.previewElement.querySelectorAll(`[data-dz-remove]`))t.addEventListener(`click`,n)}},removedfile(e){return e.previewElement!=null&&e.previewElement.parentNode!=null&&e.previewElement.parentNode.removeChild(e.previewElement),this._updateMaxFilesReachedClass()},thumbnail(e,t){if(e.previewElement){e.previewElement.classList.remove(`dz-file-preview`);for(let n of e.previewElement.querySelectorAll(`[data-dz-thumbnail]`))n.alt=e.name,n.src=t;return setTimeout(()=>e.previewElement.classList.add(`dz-image-preview`),1)}},error(e,t){if(e.previewElement){e.previewElement.classList.add(`dz-error`),typeof t!=`string`&&t.error&&(t=t.error);for(let n of e.previewElement.querySelectorAll(`[data-dz-errormessage]`))n.textContent=t}},errormultiple(){},processing(e){if(e.previewElement&&(e.previewElement.classList.add(`dz-processing`),e._removeLink))return e._removeLink.innerHTML=this.options.dictCancelUpload},processingmultiple(){},uploadprogress(e,t,n){if(e.previewElement)for(let n of e.previewElement.querySelectorAll(`[data-dz-uploadprogress]`))n.nodeName===`PROGRESS`?n.value=t:n.style.width=`${t}%`},totaluploadprogress(){},sending(){},sendingmultiple(){},success(e){if(e.previewElement)return e.previewElement.classList.add(`dz-success`)},successmultiple(){},canceled(e){return this.emit(`error`,e,this.options.dictUploadCanceled)},canceledmultiple(){},complete(e){if(e._removeLink&&(e._removeLink.innerHTML=this.options.dictRemoveFile),e.previewElement)return e.previewElement.classList.add(`dz-complete`)},completemultiple(){},maxfilesexceeded(){},maxfilesreached(){},queuecomplete(){},addedfiles(){}},c=class t extends a{static initClass(){this.prototype.Emitter=a,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`.split(`.`),this.prototype._thumbnailQueue=[],this.prototype._processingThumbnail=!1}getAcceptedFiles(){return this.files.filter(e=>e.accepted).map(e=>e)}getRejectedFiles(){return this.files.filter(e=>!e.accepted).map(e=>e)}getFilesWithStatus(e){return this.files.filter(t=>t.status===e).map(e=>e)}getQueuedFiles(){return this.getFilesWithStatus(t.QUEUED)}getUploadingFiles(){return this.getFilesWithStatus(t.UPLOADING)}getAddedFiles(){return this.getFilesWithStatus(t.ADDED)}getActiveFiles(){return this.files.filter(e=>e.status===t.UPLOADING||e.status===t.QUEUED).map(e=>e)}init(){if(this.element.tagName===`form`&&this.element.setAttribute(`enctype`,`multipart/form-data`),this.element.classList.contains(`dropzone`)&&!this.element.querySelector(`.dz-message`)&&this.element.appendChild(t.createElement(`<div class="dz-default dz-message"><button class="dz-button" type="button">${this.options.dictDefaultMessage}</button></div>`)),this.clickableElements.length){let e=()=>{this.hiddenFileInput&&this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=document.createElement(`input`),this.hiddenFileInput.setAttribute(`type`,`file`),(this.options.maxFiles===null||this.options.maxFiles>1)&&this.hiddenFileInput.setAttribute(`multiple`,`multiple`),this.hiddenFileInput.className=`dz-hidden-input`,this.options.acceptedFiles!==null&&this.hiddenFileInput.setAttribute(`accept`,this.options.acceptedFiles),this.options.capture!==null&&this.hiddenFileInput.setAttribute(`capture`,this.options.capture),this.hiddenFileInput.setAttribute(`tabindex`,`-1`),this.hiddenFileInput.style.visibility=`hidden`,this.hiddenFileInput.style.position=`absolute`,this.hiddenFileInput.style.top=`0`,this.hiddenFileInput.style.left=`0`,this.hiddenFileInput.style.height=`0`,this.hiddenFileInput.style.width=`0`,t.getElement(this.options.hiddenInputContainer,`hiddenInputContainer`).appendChild(this.hiddenFileInput),this.hiddenFileInput.addEventListener(`change`,()=>{let{files:t}=this.hiddenFileInput;if(t.length)for(let e of t)this.addFile(e);this.emit(`addedfiles`,t),e()})};e()}this.URL=window.URL===null?window.webkitURL:window.URL;for(let e of this.events)this.on(e,this.options[e]);this.on(`uploadprogress`,()=>this.updateTotalUploadProgress()),this.on(`removedfile`,()=>this.updateTotalUploadProgress()),this.on(`canceled`,e=>this.emit(`complete`,e)),this.on(`complete`,e=>{if(this.getAddedFiles().length===0&&this.getUploadingFiles().length===0&&this.getQueuedFiles().length===0)return setTimeout(()=>this.emit(`queuecomplete`),0)});let e=function(e){if(e.dataTransfer.types){for(var t=0;t<e.dataTransfer.types.length;t++)if(e.dataTransfer.types[t]===`Files`)return!0}return!1},n=function(t){if(e(t))return t.stopPropagation(),t.preventDefault?t.preventDefault():t.returnValue=!1};return this.listeners=[{element:this.element,events:{dragstart:e=>this.emit(`dragstart`,e),dragenter:e=>(n(e),this.emit(`dragenter`,e)),dragover:e=>{let t;try{t=e.dataTransfer.effectAllowed}catch{}return e.dataTransfer.dropEffect=t===`move`||t===`linkMove`?`move`:`copy`,n(e),this.emit(`dragover`,e)},dragleave:e=>this.emit(`dragleave`,e),drop:e=>(n(e),this.drop(e)),dragend:e=>this.emit(`dragend`,e)}}],this.clickableElements.forEach(e=>this.listeners.push({element:e,events:{click:n=>((e!==this.element||n.target===this.element||t.elementInside(n.target,this.element.querySelector(`.dz-message`)))&&this.hiddenFileInput.click(),!0)}})),this.enable(),this.options.init.call(this)}destroy(){return this.disable(),this.removeAllFiles(!0),this.hiddenFileInput!=null&&this.hiddenFileInput.parentNode&&(this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=null),delete this.element.dropzone,t.instances.splice(t.instances.indexOf(this),1)}updateTotalUploadProgress(){let e,t=0,n=0;if(this.getActiveFiles().length){for(let e of this.getActiveFiles())t+=e.upload.bytesSent,n+=e.upload.total;e=100*t/n}else e=100;return this.emit(`totaluploadprogress`,e,n,t)}_getParamName(e){return typeof this.options.paramName==`function`?this.options.paramName(e):`${this.options.paramName}${this.options.uploadMultiple?`[${e}]`:``}`}_renameFile(e){return typeof this.options.renameFile==`function`?this.options.renameFile(e):e.name}getFallbackForm(){let e,n;if(e=this.getExistingFallback())return e;let r=`<div class="dz-fallback">`;this.options.dictFallbackText&&(r+=`<p>${this.options.dictFallbackText}</p>`),r+=`<input type="file" name="${this._getParamName(0)}" ${this.options.uploadMultiple?`multiple="multiple"`:void 0} /><input type="submit" value="Upload!"></div>`;let i=t.createElement(r);return this.element.tagName===`FORM`?(this.element.setAttribute(`enctype`,`multipart/form-data`),this.element.setAttribute(`method`,this.options.method)):(n=t.createElement(`<form action="${this.options.url}" enctype="multipart/form-data" method="${this.options.method}"></form>`),n.appendChild(i)),n??i}getExistingFallback(){let e=function(e){for(let t of e)if(/(^| )fallback($| )/.test(t.className))return t};for(let n of[`div`,`form`]){var t;if(t=e(this.element.getElementsByTagName(n)))return t}}setupEventListeners(){return this.listeners.map(e=>(()=>{let t=[];for(let n in e.events){let r=e.events[n];t.push(e.element.addEventListener(n,r,!1))}return t})())}removeEventListeners(){return this.listeners.map(e=>(()=>{let t=[];for(let n in e.events){let r=e.events[n];t.push(e.element.removeEventListener(n,r,!1))}return t})())}disable(){return this.clickableElements.forEach(e=>e.classList.remove(`dz-clickable`)),this.removeEventListeners(),this.disabled=!0,this.files.map(e=>this.cancelUpload(e))}enable(){return delete this.disabled,this.clickableElements.forEach(e=>e.classList.add(`dz-clickable`)),this.setupEventListeners()}filesize(e){let t=0,n=`b`;if(e>0){let r=[`tb`,`gb`,`mb`,`kb`,`b`];for(let i=0;i<r.length;i++){let a=r[i];if(e>=this.options.filesizeBase**(4-i)/10){t=e/this.options.filesizeBase**(4-i),n=a;break}}t=Math.round(10*t)/10}return`<strong>${t}</strong> ${this.options.dictFileSizeUnits[n]}`}_updateMaxFilesReachedClass(){return this.options.maxFiles!=null&&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`)}drop(e){if(!e.dataTransfer)return;this.emit(`drop`,e);let t=[];for(let n=0;n<e.dataTransfer.files.length;n++)t[n]=e.dataTransfer.files[n];if(t.length){let{items:n}=e.dataTransfer;n&&n.length&&n[0].webkitGetAsEntry!=null?this._addFilesFromItems(n):this.handleFiles(t)}this.emit(`addedfiles`,t)}paste(e){if(m(e?.clipboardData,e=>e.items)==null)return;this.emit(`paste`,e);let{items:t}=e.clipboardData;if(t.length)return this._addFilesFromItems(t)}handleFiles(e){for(let t of e)this.addFile(t)}_addFilesFromItems(e){return(()=>{let t=[];for(let r of e){var n;r.webkitGetAsEntry!=null&&(n=r.webkitGetAsEntry())?n.isFile?t.push(this.addFile(r.getAsFile())):n.isDirectory?t.push(this._addFilesFromDirectory(n,n.name)):t.push(void 0):r.getAsFile==null?t.push(void 0):r.kind==null||r.kind===`file`?t.push(this.addFile(r.getAsFile())):t.push(void 0)}return t})()}_addFilesFromDirectory(e,t){let n=e.createReader(),r=e=>h(console,`log`,t=>t.log(e));var i=()=>n.readEntries(e=>{if(e.length>0){for(let n of e)n.isFile?n.file(e=>{if(!(this.options.ignoreHiddenFiles&&e.name.substring(0,1)===`.`))return e.fullPath=`${t}/${e.name}`,this.addFile(e)}):n.isDirectory&&this._addFilesFromDirectory(n,`${t}/${n.name}`);i()}return null},r);return i()}accept(e,n){this.options.maxFilesize&&e.size>this.options.maxFilesize*1048576?n(this.options.dictFileTooBig.replace(`{{filesize}}`,Math.round(e.size/1024/10.24)/100).replace(`{{maxFilesize}}`,this.options.maxFilesize)):t.isValidFile(e,this.options.acceptedFiles)?this.options.maxFiles!=null&&this.getAcceptedFiles().length>=this.options.maxFiles?(n(this.options.dictMaxFilesExceeded.replace(`{{maxFiles}}`,this.options.maxFiles)),this.emit(`maxfilesexceeded`,e)):this.options.accept.call(this,e,n):n(this.options.dictInvalidFileType)}addFile(e){e.upload={uuid:t.uuidv4(),progress:0,total:e.size,bytesSent:0,filename:this._renameFile(e)},this.files.push(e),e.status=t.ADDED,this.emit(`addedfile`,e),this._enqueueThumbnail(e),this.accept(e,t=>{t?(e.accepted=!1,this._errorProcessing([e],t)):(e.accepted=!0,this.options.autoQueue&&this.enqueueFile(e)),this._updateMaxFilesReachedClass()})}enqueueFiles(e){for(let t of e)this.enqueueFile(t);return null}enqueueFile(e){if(e.status===t.ADDED&&e.accepted===!0){if(e.status=t.QUEUED,this.options.autoProcessQueue)return setTimeout(()=>this.processQueue(),0)}else throw Error(`This file can't be queued because it has already been processed or was rejected.`)}_enqueueThumbnail(e){if(this.options.createImageThumbnails&&e.type.match(/image.*/)&&e.size<=this.options.maxThumbnailFilesize*1048576)return this._thumbnailQueue.push(e),setTimeout(()=>this._processThumbnailQueue(),0)}_processThumbnailQueue(){if(this._processingThumbnail||this._thumbnailQueue.length===0)return;this._processingThumbnail=!0;let e=this._thumbnailQueue.shift();return this.createThumbnail(e,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,!0,t=>(this.emit(`thumbnail`,e,t),this._processingThumbnail=!1,this._processThumbnailQueue()))}removeFile(e){if(e.status===t.UPLOADING&&this.cancelUpload(e),this.files=l(this.files,e),this.emit(`removedfile`,e),this.files.length===0)return this.emit(`reset`)}removeAllFiles(e){e??(e=!1);for(let n of this.files.slice())(n.status!==t.UPLOADING||e)&&this.removeFile(n);return null}resizeImage(e,n,r,i,a){return this.createThumbnail(e,n,r,i,!0,(n,r)=>{if(r==null)return a(e);{let{resizeMimeType:n}=this.options;n??(n=e.type);let i=r.toDataURL(n,this.options.resizeQuality);return(n===`image/jpeg`||n===`image/jpg`)&&(i=p.restore(e.dataURL,i)),a(t.dataURItoBlob(i))}})}createThumbnail(e,t,n,r,i,a){let o=new FileReader;o.onload=()=>{if(e.dataURL=o.result,e.type===`image/svg+xml`){a?.(o.result);return}this.createThumbnailFromUrl(e,t,n,r,i,a)},o.readAsDataURL(e)}displayExistingFile(e,t,n,r,i=!0){this.emit(`addedfile`,e),this.emit(`complete`,e),i?(e.dataURL=t,this.createThumbnailFromUrl(e,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,this.options.fixOrientation,t=>{this.emit(`thumbnail`,e,t),n&&n()},r)):(this.emit(`thumbnail`,e,t),n&&n())}createThumbnailFromUrl(e,t,n,r,i,a,o){let s=document.createElement(`img`);return o&&(s.crossOrigin=o),i=getComputedStyle(document.body).imageOrientation==`from-image`?!1:i,s.onload=()=>{let o=e=>e(1);return typeof EXIF<`u`&&EXIF!==null&&i&&(o=e=>EXIF.getData(s,function(){return e(EXIF.getTag(this,`Orientation`))})),o(i=>{e.width=s.width,e.height=s.height;let o=this.options.resize.call(this,e,t,n,r),c=document.createElement(`canvas`),l=c.getContext(`2d`);switch(c.width=o.trgWidth,c.height=o.trgHeight,i>4&&(c.width=o.trgHeight,c.height=o.trgWidth),i){case 2:l.translate(c.width,0),l.scale(-1,1);break;case 3:l.translate(c.width,c.height),l.rotate(Math.PI);break;case 4:l.translate(0,c.height),l.scale(1,-1);break;case 5:l.rotate(.5*Math.PI),l.scale(1,-1);break;case 6:l.rotate(.5*Math.PI),l.translate(0,-c.width);break;case 7:l.rotate(.5*Math.PI),l.translate(c.height,-c.width),l.scale(-1,1);break;case 8:l.rotate(-.5*Math.PI),l.translate(-c.height,0);break}f(l,s,o.srcX==null?0:o.srcX,o.srcY==null?0:o.srcY,o.srcWidth,o.srcHeight,o.trgX==null?0:o.trgX,o.trgY==null?0:o.trgY,o.trgWidth,o.trgHeight);let u=c.toDataURL(`image/png`);if(a!=null)return a(u,c)})},a!=null&&(s.onerror=a),s.src=e.dataURL}processQueue(){let{parallelUploads:e}=this.options,t=this.getUploadingFiles().length,n=t;if(t>=e)return;let r=this.getQueuedFiles();if(r.length>0){if(this.options.uploadMultiple)return this.processFiles(r.slice(0,e-t));for(;n<e;){if(!r.length)return;this.processFile(r.shift()),n++}}}processFile(e){return this.processFiles([e])}processFiles(e){for(let n of e)n.processing=!0,n.status=t.UPLOADING,this.emit(`processing`,n);return this.options.uploadMultiple&&this.emit(`processingmultiple`,e),this.uploadFiles(e)}_getFilesWithXhr(e){return this.files.filter(t=>t.xhr===e).map(e=>e)}cancelUpload(e){if(e.status===t.UPLOADING){let n=this._getFilesWithXhr(e.xhr);for(let e of n)e.status=t.CANCELED;e.xhr!==void 0&&e.xhr.abort();for(let e of n)this.emit(`canceled`,e);this.options.uploadMultiple&&this.emit(`canceledmultiple`,n)}else (e.status===t.ADDED||e.status===t.QUEUED)&&(e.status=t.CANCELED,this.emit(`canceled`,e),this.options.uploadMultiple&&this.emit(`canceledmultiple`,[e]));if(this.options.autoProcessQueue)return this.processQueue()}resolveOption(e,...t){return typeof e==`function`?e.apply(this,t):e}uploadFile(e){return this.uploadFiles([e])}uploadFiles(e){this._transformFiles(e,n=>{if(this.options.chunking){let t=n[0];e[0].upload.chunked=this.options.chunking&&(this.options.forceChunking||t.size>this.options.chunkSize),e[0].upload.totalChunkCount=Math.ceil(t.size/this.options.chunkSize)}if(e[0].upload.chunked){let r=e[0],i=n[0],a=0;r.upload.chunks=[];let o=()=>{let n=0;for(;r.upload.chunks[n]!==void 0;)n++;if(n>=r.upload.totalChunkCount)return;a++;let o=n*this.options.chunkSize,s=Math.min(o+this.options.chunkSize,i.size),c={name:this._getParamName(0),data:i.webkitSlice?i.webkitSlice(o,s):i.slice(o,s),filename:r.upload.filename,chunkIndex:n};r.upload.chunks[n]={file:r,index:n,dataBlock:c,status:t.UPLOADING,progress:0,retries:0},this._uploadData(e,[c])};if(r.upload.finishedChunkUpload=(n,i)=>{let a=!0;n.status=t.SUCCESS,n.dataBlock=null,n.response=n.xhr.responseText,n.responseHeaders=n.xhr.getAllResponseHeaders(),n.xhr=null;for(let e=0;e<r.upload.totalChunkCount;e++){if(r.upload.chunks[e]===void 0)return o();r.upload.chunks[e].status!==t.SUCCESS&&(a=!1)}a&&this.options.chunksUploaded(r,()=>{this._finished(e,i,null)})},this.options.parallelChunkUploads)for(let e=0;e<r.upload.totalChunkCount;e++)o();else o()}else{let t=[];for(let r=0;r<e.length;r++)t[r]={name:this._getParamName(r),data:n[r],filename:e[r].upload.filename};this._uploadData(e,t)}})}_getChunk(e,t){for(let n=0;n<e.upload.totalChunkCount;n++)if(e.upload.chunks[n]!==void 0&&e.upload.chunks[n].xhr===t)return e.upload.chunks[n]}_uploadData(t,n){let r=new XMLHttpRequest;for(let e of t)e.xhr=r;t[0].upload.chunked&&(t[0].upload.chunks[n[0].chunkIndex].xhr=r);let i=this.resolveOption(this.options.method,t,n),a=this.resolveOption(this.options.url,t,n);r.open(i,a,!0),this.resolveOption(this.options.timeout,t)&&(r.timeout=this.resolveOption(this.options.timeout,t)),r.withCredentials=!!this.options.withCredentials,r.onload=e=>{this._finishedUploading(t,r,e)},r.ontimeout=()=>{this._handleUploadError(t,r,`Request timedout after ${this.options.timeout/1e3} seconds`)},r.onerror=()=>{this._handleUploadError(t,r)};let o=r.upload==null?r:r.upload;o.onprogress=e=>this._updateFilesUploadProgress(t,r,e);let s=this.options.defaultHeaders?{Accept:`application/json`,"Cache-Control":`no-cache`,"X-Requested-With":`XMLHttpRequest`}:{};this.options.binaryBody&&(s[`Content-Type`]=t[0].type),this.options.headers&&e(s,this.options.headers);for(let e in s){let t=s[e];t&&r.setRequestHeader(e,t)}if(this.options.binaryBody){for(let e of t)this.emit(`sending`,e,r);this.options.uploadMultiple&&this.emit(`sendingmultiple`,t,r),this.submitRequest(r,null,t)}else{let e=new FormData;if(this.options.params){let n=this.options.params;typeof n==`function`&&(n=n.call(this,t,r,t[0].upload.chunked?this._getChunk(t[0],r):null));for(let t in n){let r=n[t];if(Array.isArray(r))for(let n=0;n<r.length;n++)e.append(t,r[n]);else e.append(t,r)}}for(let n of t)this.emit(`sending`,n,r,e);this.options.uploadMultiple&&this.emit(`sendingmultiple`,t,r,e),this._addFormElementData(e);for(let t=0;t<n.length;t++){let r=n[t];e.append(r.name,r.data,r.filename)}this.submitRequest(r,e,t)}}_transformFiles(e,t){let n=[],r=0;for(let i=0;i<e.length;i++)this.options.transformFile.call(this,e[i],a=>{n[i]=a,++r===e.length&&t(n)})}_addFormElementData(e){if(this.element.tagName===`FORM`)for(let t of this.element.querySelectorAll(`input, textarea, select, button`)){let n=t.getAttribute(`name`),r=t.getAttribute(`type`);if(r&&(r=r.toLowerCase()),n!=null)if(t.tagName===`SELECT`&&t.hasAttribute(`multiple`))for(let r of t.options)r.selected&&e.append(n,r.value);else (!r||r!==`checkbox`&&r!==`radio`||t.checked)&&e.append(n,t.value)}}_updateFilesUploadProgress(e,t,n){if(e[0].upload.chunked){let r=e[0],i=this._getChunk(r,t);n?(i.progress=100*n.loaded/n.total,i.total=n.total,i.bytesSent=n.loaded):(i.progress=100,i.bytesSent=i.total),r.upload.progress=0,r.upload.total=0,r.upload.bytesSent=0;for(let e=0;e<r.upload.totalChunkCount;e++)r.upload.chunks[e]&&r.upload.chunks[e].progress!==void 0&&(r.upload.progress+=r.upload.chunks[e].progress,r.upload.total+=r.upload.chunks[e].total,r.upload.bytesSent+=r.upload.chunks[e].bytesSent);r.upload.progress=r.upload.progress/r.upload.totalChunkCount,this.emit(`uploadprogress`,r,r.upload.progress,r.upload.bytesSent)}else for(let t of e)t.upload.total&&t.upload.bytesSent&&t.upload.bytesSent==t.upload.total||(n?(t.upload.progress=100*n.loaded/n.total,t.upload.total=n.total,t.upload.bytesSent=n.loaded):(t.upload.progress=100,t.upload.bytesSent=t.upload.total),this.emit(`uploadprogress`,t,t.upload.progress,t.upload.bytesSent))}_finishedUploading(e,n,r){let i;if(e[0].status!==t.CANCELED&&n.readyState===4){if(n.responseType!==`arraybuffer`&&n.responseType!==`blob`&&(i=n.responseText,n.getResponseHeader(`content-type`)&&~n.getResponseHeader(`content-type`).indexOf(`application/json`)))try{i=JSON.parse(i)}catch(e){r=e,i=`Invalid JSON response from server.`}this._updateFilesUploadProgress(e,n),200<=n.status&&n.status<300?e[0].upload.chunked?e[0].upload.finishedChunkUpload(this._getChunk(e[0],n),i):this._finished(e,i,r):this._handleUploadError(e,n,i)}}_handleUploadError(e,n,r){if(e[0].status!==t.CANCELED){if(e[0].upload.chunked&&this.options.retryChunks){let t=this._getChunk(e[0],n);if(t.retries++<this.options.retryChunksLimit){this._uploadData(e,[t.dataBlock]);return}else console.warn(`Retried this chunk too often. Giving up.`)}this._errorProcessing(e,r||this.options.dictResponseError.replace(`{{statusCode}}`,n.status),n)}}submitRequest(e,t,n){if(e.readyState!=1){console.warn(`Cannot send this request because the XMLHttpRequest.readyState is not OPENED.`);return}if(this.options.binaryBody)if(n[0].upload.chunked){let t=this._getChunk(n[0],e);e.send(t.dataBlock.data)}else e.send(n[0]);else e.send(t)}_finished(e,n,r){for(let i of e)i.status=t.SUCCESS,this.emit(`success`,i,n,r),this.emit(`complete`,i);if(this.options.uploadMultiple&&(this.emit(`successmultiple`,e,n,r),this.emit(`completemultiple`,e)),this.options.autoProcessQueue)return this.processQueue()}_errorProcessing(e,n,r){for(let i of e)i.status=t.ERROR,this.emit(`error`,i,n,r),this.emit(`complete`,i);if(this.options.uploadMultiple&&(this.emit(`errormultiple`,e,n,r),this.emit(`completemultiple`,e)),this.options.autoProcessQueue)return this.processQueue()}static uuidv4(){return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,function(e){let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}constructor(n,r){super();let i;if(this.element=n,this.clickableElements=[],this.listeners=[],this.files=[],typeof this.element==`string`&&(this.element=document.querySelector(this.element)),!this.element||this.element.nodeType==null)throw Error(`Invalid dropzone element.`);if(this.element.dropzone)throw Error(`Dropzone already attached.`);if(t.instances.push(this),this.element.dropzone=this,this.options=e(!0,{},s,t.optionsForElement(this.element)??{},r??{}),this.options.previewTemplate=this.options.previewTemplate.replace(/\n*/g,``),this.options.forceFallback||!t.isBrowserSupported())return this.options.fallback.call(this);if(this.options.url??(this.options.url=this.element.getAttribute(`action`)),!this.options.url)throw Error(`No URL provided.`);if(this.options.acceptedFiles&&this.options.acceptedMimeTypes)throw Error(`You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.`);if(this.options.uploadMultiple&&this.options.chunking)throw Error(`You cannot set both: uploadMultiple and chunking.`);if(this.options.binaryBody&&this.options.uploadMultiple)throw Error(`You cannot set both: binaryBody and uploadMultiple.`);this.options.acceptedMimeTypes&&(this.options.acceptedFiles=this.options.acceptedMimeTypes,delete this.options.acceptedMimeTypes),this.options.renameFilename!=null&&(this.options.renameFile=e=>this.options.renameFilename.call(this,e.name,e)),typeof this.options.method==`string`&&(this.options.method=this.options.method.toUpperCase()),(i=this.getExistingFallback())&&i.parentNode&&i.parentNode.removeChild(i),this.options.previewsContainer!==!1&&(this.options.previewsContainer?this.previewsContainer=t.getElement(this.options.previewsContainer,`previewsContainer`):this.previewsContainer=this.element),this.options.clickable&&(this.options.clickable===!0?this.clickableElements=[this.element]:this.clickableElements=t.getElements(this.options.clickable,`clickable`)),this.init()}};c.initClass(),c.options={},c.optionsForElement=function(e){if(e.getAttribute(`id`))return c.options[u(e.getAttribute(`id`))]},c.instances=[],c.forElement=function(e){if(typeof e==`string`&&(e=document.querySelector(e)),e?.dropzone==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(){let e;if(document.querySelectorAll)e=document.querySelectorAll(`.dropzone`);else{e=[];let t=t=>(()=>{let n=[];for(let r of t)/(^| )dropzone($| )/.test(r.className)?n.push(e.push(r)):n.push(void 0);return n})();t(document.getElementsByTagName(`div`)),t(document.getElementsByTagName(`form`))}return(()=>{let t=[];for(let n of e)c.optionsForElement(n)===!1?t.push(void 0):t.push(new c(n));return t})()},c.blockedBrowsers=[/opera.*(Macintosh|Windows Phone).*version\/12/i],c.isBrowserSupported=function(){let e=!0;if(window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector)if(!(`classList`in document.createElement(`a`)))e=!1;else{c.blacklistedBrowsers!==void 0&&(c.blockedBrowsers=c.blacklistedBrowsers);for(let t of c.blockedBrowsers)if(t.test(navigator.userAgent)){e=!1;continue}}else e=!1;return e},c.dataURItoBlob=function(e){let t=atob(e.split(`,`)[1]),n=e.split(`,`)[0].split(`:`)[1].split(`;`)[0],r=new ArrayBuffer(t.length),i=new Uint8Array(r);for(let e=0,n=t.length,r=0<=n;r?e<=n:e>=n;r?e++:e--)i[e]=t.charCodeAt(e);return new Blob([r],{type:n})};var l=(e,t)=>e.filter(e=>e!==t).map(e=>e),u=e=>e.replace(/[\-_](\w)/g,e=>e.charAt(1).toUpperCase());c.createElement=function(e){let 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){let n;if(typeof e==`string`?n=document.querySelector(e):e.nodeType!=null&&(n=e),n==null)throw Error(`Invalid \`${t}\` option provided. Please provide a CSS selector or a plain HTML element.`);return n},c.getElements=function(e,t){let n,r;if(e instanceof Array){r=[];try{for(n of e)r.push(this.getElement(n,t))}catch{r=null}}else if(typeof e==`string`){r=[];for(n of document.querySelectorAll(e))r.push(n)}else e.nodeType!=null&&(r=[e]);if(r==null||!r.length)throw Error(`Invalid \`${t}\` option provided. Please provide a CSS selector, a plain HTML element or a list of those.`);return r},c.confirm=function(e,t,n){if(window.confirm(e))return t();if(n!=null)return n()},c.isValidFile=function(e,t){if(!t)return!0;t=t.split(`,`);let n=e.type,r=n.replace(/\/.*$/,``);for(let i of t)if(i=i.trim(),i.charAt(0)===`.`){if(e.name.toLowerCase().indexOf(i.toLowerCase(),e.name.length-i.length)!==-1)return!0}else if(/\/\*$/.test(i)){if(r===i.replace(/\/.*$/,``))return!0}else if(n===i)return!0;return!1},typeof jQuery<`u`&&jQuery!==null&&(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 d=function(e){e.naturalWidth;let t=e.naturalHeight,n=document.createElement(`canvas`);n.width=1,n.height=t;let r=n.getContext(`2d`);r.drawImage(e,0,0);let{data:i}=r.getImageData(1,0,1,t),a=0,o=t,s=t;for(;s>a;)i[(s-1)*4+3]===0?o=s:a=s,s=o+a>>1;let c=s/t;return c===0?1:c},f=function(e,t,n,r,i,a,o,s,c,l){let u=d(t);return e.drawImage(t,n,r,i,a,o,s,c,l/u)},p=class{static initClass(){this.KEY_STR=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`}static encode64(e){let t=``,n,r,i=``,a,o,s,c=``,l=0;for(;n=e[l++],r=e[l++],i=e[l++],a=n>>2,o=(n&3)<<4|r>>4,s=(r&15)<<2|i>>6,c=i&63,isNaN(r)?s=c=64:isNaN(i)&&(c=64),t=t+this.KEY_STR.charAt(a)+this.KEY_STR.charAt(o)+this.KEY_STR.charAt(s)+this.KEY_STR.charAt(c),n=r=i=``,a=o=s=c=``,l<e.length;);return t}static restore(e,t){if(!e.match(`data:image/jpeg;base64,`))return t;let n=this.decode64(e.replace(`data:image/jpeg;base64,`,``)),r=this.slice2Segments(n),i=this.exifManipulation(t,r);return`data:image/jpeg;base64,${this.encode64(i)}`}static exifManipulation(e,t){let n=this.getExifArray(t),r=this.insertExif(e,n);return new Uint8Array(r)}static getExifArray(e){let t,n=0;for(;n<e.length;){if(t=e[n],t[0]===255&t[1]===225)return t;n++}return[]}static insertExif(e,t){let n=e.replace(`data:image/jpeg;base64,`,``),r=this.decode64(n),i=r.indexOf(255,3),a=r.slice(0,i),o=r.slice(i),s=a;return s=s.concat(t),s=s.concat(o),s}static slice2Segments(e){let t=0,n=[];for(;;){var r;if(e[t]===255&e[t+1]===218)break;if(e[t]===255&e[t+1]===216)t+=2;else{r=e[t+2]*256+e[t+3];let i=t+r+2,a=e.slice(t,i);n.push(a),t=i}if(t>e.length)break}return n}static decode64(e){let t,n,r=``,i,a,o,s=``,c=0,l=[];for(/[^A-Za-z0-9\+\/\=]/g.exec(e)&&console.warn(`There were invalid base64 characters in the input text.
Valid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='
Expect errors in decoding.`),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,``);i=this.KEY_STR.indexOf(e.charAt(c++)),a=this.KEY_STR.indexOf(e.charAt(c++)),o=this.KEY_STR.indexOf(e.charAt(c++)),s=this.KEY_STR.indexOf(e.charAt(c++)),t=i<<2|a>>4,n=(a&15)<<4|o>>2,r=(o&3)<<6|s,l.push(t),o!==64&&l.push(n),s!==64&&l.push(r),t=n=r=``,i=a=o=s=``,c<e.length;);return l}};p.initClass();function m(e,t){return e==null?void 0:t(e)}function h(e,t,n){if(e!=null&&typeof e[t]==`function`)return n(e,t)}export{c as Dropzone,c as default};
//# sourceMappingURL=dropzone.fVTQwp76.js.map