Skip to content

v3.0.2 20240227 [Hotfix issue] #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 27, 2024
Merged

v3.0.2 20240227 [Hotfix issue] #85

merged 3 commits into from
Feb 27, 2024

Conversation

Signed-off-by: Dicky Herlambang (花) <[email protected]>
Signed-off-by: Dicky Herlambang (花) <[email protected]>
Signed-off-by: Dicky Herlambang (花) <[email protected]>
@Nicklas373 Nicklas373 added bug Something isn't working javascript Pull requests that update Javascript code labels Feb 27, 2024
@Nicklas373 Nicklas373 self-assigned this Feb 27, 2024
</div>
`;let ae={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(i,e,t){if(t)return{dzuuid:t.file.upload.uuid,dzchunkindex:t.index,dztotalfilesize:t.file.size,dzchunksize:this.options.chunkSize,dztotalchunkcount:t.file.upload.totalChunkCount,dzchunkbyteoffset:t.index*this.options.chunkSize}},accept(i,e){return e()},chunksUploaded:function(i,e){e()},binaryBody:!1,fallback(){let i;this.element.className=`${this.element.className} dz-browser-not-supported`;for(let t of this.element.getElementsByTagName("div"))if(/(^| )dz-message($| )/.test(t.className)){i=t,t.className="dz-message";break}i||(i=a.createElement('<div class="dz-message"><span></span></div>'),this.element.appendChild(i));let e=i.getElementsByTagName("span")[0];return e&&(e.textContent!=null?e.textContent=this.options.dictFallbackMessage:e.innerText!=null&&(e.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize(i,e,t,n){let l={srcX:0,srcY:0,srcWidth:i.width,srcHeight:i.height},o=i.width/i.height;e==null&&t==null?(e=l.srcWidth,t=l.srcHeight):e==null?e=t*o:t==null&&(t=e/o),e=Math.min(e,l.srcWidth),t=Math.min(t,l.srcHeight);let s=e/t;if(l.srcWidth>e||l.srcHeight>t)if(n==="crop")o>s?(l.srcHeight=i.height,l.srcWidth=l.srcHeight*s):(l.srcWidth=i.width,l.srcHeight=l.srcWidth/s);else if(n==="contain")o>s?t=e/o:e=t*o;else throw new Error(`Unknown resizeMethod '${n}'`);return l.srcX=(i.width-l.srcWidth)/2,l.srcY=(i.height-l.srcHeight)/2,l.trgWidth=e,l.trgHeight=t,l},transformFile(i,e){return(this.options.resizeWidth||this.options.resizeHeight)&&i.type.match(/image.*/)?this.resizeImage(i,this.options.resizeWidth,this.options.resizeHeight,this.options.resizeMethod,e):e(i)},previewTemplate:re(ee),drop(i){return this.element.classList.remove("dz-drag-hover")},dragstart(i){},dragend(i){return this.element.classList.remove("dz-drag-hover")},dragenter(i){return this.element.classList.add("dz-drag-hover")},dragover(i){return this.element.classList.add("dz-drag-hover")},dragleave(i){return this.element.classList.remove("dz-drag-hover")},paste(i){},reset(){return this.element.classList.remove("dz-started")},addedfile(i){if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer&&!this.options.disablePreviews){i.previewElement=a.createElement(this.options.previewTemplate.trim()),i.previewTemplate=i.previewElement,this.previewsContainer.appendChild(i.previewElement);for(var e of i.previewElement.querySelectorAll("[data-dz-name]"))e.textContent=i.name;for(e of i.previewElement.querySelectorAll("[data-dz-size]"))e.innerHTML=this.filesize(i.size);this.options.addRemoveLinks&&(i._removeLink=a.createElement(`<a class="dz-remove" href="javascript:undefined;" data-dz-remove>${this.options.dictRemoveFile}</a>`),i.previewElement.appendChild(i._removeLink));let t=n=>(n.preventDefault(),n.stopPropagation(),i.status===a.UPLOADING?a.confirm(this.options.dictCancelUploadConfirmation,()=>this.removeFile(i)):this.options.dictRemoveFileConfirmation?a.confirm(this.options.dictRemoveFileConfirmation,()=>this.removeFile(i)):this.removeFile(i));for(let n of i.previewElement.querySelectorAll("[data-dz-remove]"))n.addEventListener("click",t)}},removedfile(i){return i.previewElement!=null&&i.previewElement.parentNode!=null&&i.previewElement.parentNode.removeChild(i.previewElement),this._updateMaxFilesReachedClass()},thumbnail(i,e){if(i.previewElement){i.previewElement.classList.remove("dz-file-preview");for(let t of i.previewElement.querySelectorAll("[data-dz-thumbnail]"))t.alt=i.name,t.src=e;return setTimeout(()=>i.previewElement.classList.add("dz-image-preview"),1)}},error(i,e){if(i.previewElement){i.previewElement.classList.add("dz-error"),typeof e!="string"&&e.error&&(e=e.error);for(let t of i.previewElement.querySelectorAll("[data-dz-errormessage]"))t.textContent=e}},errormultiple(){},processing(i){if(i.previewElement&&(i.previewElement.classList.add("dz-processing"),i._removeLink))return i._removeLink.innerHTML=this.options.dictCancelUpload},processingmultiple(){},uploadprogress(i,e,t){if(i.previewElement)for(let n of i.previewElement.querySelectorAll("[data-dz-uploadprogress]"))n.nodeName==="PROGRESS"?n.value=e:n.style.width=`${e}%`},totaluploadprogress(){},sending(){},sendingmultiple(){},success(i){if(i.previewElement)return i.previewElement.classList.add("dz-success")},successmultiple(){},canceled(i){return this.emit("error",i,this.options.dictUploadCanceled)},canceledmultiple(){},complete(i){if(i._removeLink&&(i._removeLink.innerHTML=this.options.dictRemoveFile),i.previewElement)return i.previewElement.classList.add("dz-complete")},completemultiple(){},maxfilesexceeded(){},maxfilesreached(){},queuecomplete(){},addedfiles(){}};var de=ae;class a extends K{static initClass(){this.prototype.Emitter=K,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._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(t=>t)}getQueuedFiles(){return this.getFilesWithStatus(a.QUEUED)}getUploadingFiles(){return this.getFilesWithStatus(a.UPLOADING)}getAddedFiles(){return this.getFilesWithStatus(a.ADDED)}getActiveFiles(){return this.files.filter(e=>e.status===a.UPLOADING||e.status===a.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(a.createElement(`<div class="dz-default dz-message"><button class="dz-button" type="button">${this.options.dictDefaultMessage}</button></div>`)),this.clickableElements.length){let n=()=>{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",a.getElement(this.options.hiddenInputContainer,"hiddenInputContainer").appendChild(this.hiddenFileInput),this.hiddenFileInput.addEventListener("change",()=>{let{files:l}=this.hiddenFileInput;if(l.length)for(let o of l)this.addFile(o);this.emit("addedfiles",l),n()})};n()}this.URL=window.URL!==null?window.URL:window.webkitURL;for(let n of this.events)this.on(n,this.options[n]);this.on("uploadprogress",()=>this.updateTotalUploadProgress()),this.on("removedfile",()=>this.updateTotalUploadProgress()),this.on("canceled",n=>this.emit("complete",n)),this.on("complete",n=>{if(this.getAddedFiles().length===0&&this.getUploadingFiles().length===0&&this.getQueuedFiles().length===0)return setTimeout(()=>this.emit("queuecomplete"),0)});const e=function(n){if(n.dataTransfer.types){for(var l=0;l<n.dataTransfer.types.length;l++)if(n.dataTransfer.types[l]==="Files")return!0}return!1};let t=function(n){if(e(n))return n.stopPropagation(),n.preventDefault?n.preventDefault():n.returnValue=!1};return this.listeners=[{element:this.element,events:{dragstart:n=>this.emit("dragstart",n),dragenter:n=>(t(n),this.emit("dragenter",n)),dragover:n=>{let l;try{l=n.dataTransfer.effectAllowed}catch{}return n.dataTransfer.dropEffect=l==="move"||l==="linkMove"?"move":"copy",t(n),this.emit("dragover",n)},dragleave:n=>this.emit("dragleave",n),drop:n=>(t(n),this.drop(n)),dragend:n=>this.emit("dragend",n)}}],this.clickableElements.forEach(n=>this.listeners.push({element:n,events:{click:l=>((n!==this.element||l.target===this.element||a.elementInside(l.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,a.instances.splice(a.instances.indexOf(this),1)}updateTotalUploadProgress(){let e,t=0,n=0;if(this.getActiveFiles().length){for(let o of this.getActiveFiles())t+=o.upload.bytesSent,n+=o.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"?e.name:this.options.renameFile(e)}getFallbackForm(){let e,t;if(e=this.getExistingFallback())return e;let n='<div class="dz-fallback">';this.options.dictFallbackText&&(n+=`<p>${this.options.dictFallbackText}</p>`),n+=`<input type="file" name="${this._getParamName(0)}" ${this.options.uploadMultiple?'multiple="multiple"':void 0} /><input type="submit" value="Upload!"></div>`;let l=a.createElement(n);return this.element.tagName!=="FORM"?(t=a.createElement(`<form action="${this.options.url}" enctype="multipart/form-data" method="${this.options.method}"></form>`),t.appendChild(l)):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),t??l}getExistingFallback(){let e=function(n){for(let l of n)if(/(^| )fallback($| )/.test(l.className))return l};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 l=e.events[n];t.push(e.element.addEventListener(n,l,!1))}return t})())}removeEventListeners(){return this.listeners.map(e=>(()=>{let t=[];for(let n in e.events){let l=e.events[n];t.push(e.element.removeEventListener(n,l,!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 l=["tb","gb","mb","kb","b"];for(let o=0;o<l.length;o++){let s=l[o],r=Math.pow(this.options.filesizeBase,4-o)/10;if(e>=r){t=e/Math.pow(this.options.filesizeBase,4-o),n=s;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(he(e!=null?e.clipboardData:void 0,n=>n.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 l of e){var n;l.webkitGetAsEntry!=null&&(n=l.webkitGetAsEntry())?n.isFile?t.push(this.addFile(l.getAsFile())):n.isDirectory?t.push(this._addFilesFromDirectory(n,n.name)):t.push(void 0):l.getAsFile!=null&&(l.kind==null||l.kind==="file")?t.push(this.addFile(l.getAsFile())):t.push(void 0)}return t})()}_addFilesFromDirectory(e,t){let n=e.createReader(),l=s=>ge(console,"log",r=>r.log(s));var o=()=>n.readEntries(s=>{if(s.length>0){for(let r of s)r.isFile?r.file(d=>{if(!(this.options.ignoreHiddenFiles&&d.name.substring(0,1)==="."))return d.fullPath=`${t}/${d.name}`,this.addFile(d)}):r.isDirectory&&this._addFilesFromDirectory(r,`${t}/${r.name}`);o()}return null},l);return o()}accept(e,t){this.options.maxFilesize&&e.size>this.options.maxFilesize*1048576?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)?this.options.maxFiles!=null&&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)}addFile(e){e.upload={uuid: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,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===a.ADDED&&e.accepted===!0){if(e.status=a.QUEUED,this.options.autoProcessQueue)return setTimeout(()=>this.processQueue(),0)}else throw new 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===a.UPLOADING&&this.cancelUpload(e),this.files=ue(this.files,e),this.emit("removedfile",e),this.files.length===0)return this.emit("reset")}removeAllFiles(e){e==null&&(e=!1);for(let t of this.files.slice())(t.status!==a.UPLOADING||e)&&this.removeFile(t);return null}resizeImage(e,t,n,l,o){return this.createThumbnail(e,t,n,l,!0,(s,r)=>{if(r==null)return o(e);{let{resizeMimeType:d}=this.options;d==null&&(d=e.type);let u=r.toDataURL(d,this.options.resizeQuality);return(d==="image/jpeg"||d==="image/jpg")&&(u=te.restore(e.dataURL,u)),o(a.dataURItoBlob(u))}})}createThumbnail(e,t,n,l,o,s){let r=new FileReader;r.onload=()=>{if(e.dataURL=r.result,e.type==="image/svg+xml"){s!=null&&s(r.result);return}this.createThumbnailFromUrl(e,t,n,l,o,s)},r.readAsDataURL(e)}displayExistingFile(e,t,n,l,o=!0){if(this.emit("addedfile",e),this.emit("complete",e),!o)this.emit("thumbnail",e,t),n&&n();else{let s=r=>{this.emit("thumbnail",e,r),n&&n()};e.dataURL=t,this.createThumbnailFromUrl(e,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,this.options.fixOrientation,s,l)}}createThumbnailFromUrl(e,t,n,l,o,s,r){let d=document.createElement("img");return r&&(d.crossOrigin=r),o=getComputedStyle(document.body).imageOrientation=="from-image"?!1:o,d.onload=()=>{let u=E=>E(1);return typeof EXIF<"u"&&EXIF!==null&&o&&(u=E=>EXIF.getData(d,function(){return E(EXIF.getTag(this,"Orientation"))})),u(E=>{e.width=d.width,e.height=d.height;let w=this.options.resize.call(this,e,t,n,l),x=document.createElement("canvas"),b=x.getContext("2d");switch(x.width=w.trgWidth,x.height=w.trgHeight,E>4&&(x.width=w.trgHeight,x.height=w.trgWidth),E){case 2:b.translate(x.width,0),b.scale(-1,1);break;case 3:b.translate(x.width,x.height),b.rotate(Math.PI);break;case 4:b.translate(0,x.height),b.scale(1,-1);break;case 5:b.rotate(.5*Math.PI),b.scale(1,-1);break;case 6:b.rotate(.5*Math.PI),b.translate(0,-x.width);break;case 7:b.rotate(.5*Math.PI),b.translate(x.height,-x.width),b.scale(-1,1);break;case 8:b.rotate(-.5*Math.PI),b.translate(-x.height,0);break}pe(b,d,w.srcX!=null?w.srcX:0,w.srcY!=null?w.srcY:0,w.srcWidth,w.srcHeight,w.trgX!=null?w.trgX:0,w.trgY!=null?w.trgY:0,w.trgWidth,w.trgHeight);let j=x.toDataURL("image/png");if(s!=null)return s(j,x)})},s!=null&&(d.onerror=s),d.src=e.dataURL}processQueue(){let{parallelUploads:e}=this.options,t=this.getUploadingFiles().length,n=t;if(t>=e)return;let l=this.getQueuedFiles();if(l.length>0){if(this.options.uploadMultiple)return this.processFiles(l.slice(0,e-t));for(;n<e;){if(!l.length)return;this.processFile(l.shift()),n++}}}processFile(e){return this.processFiles([e])}processFiles(e){for(let t of e)t.processing=!0,t.status=a.UPLOADING,this.emit("processing",t);return this.options.uploadMultiple&&this.emit("processingmultiple",e),this.uploadFiles(e)}_getFilesWithXhr(e){return this.files.filter(t=>t.xhr===e).map(t=>t)}cancelUpload(e){if(e.status===a.UPLOADING){let t=this._getFilesWithXhr(e.xhr);for(let n of t)n.status=a.CANCELED;typeof e.xhr<"u"&&e.xhr.abort();for(let n of t)this.emit("canceled",n);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()}resolveOption(e,...t){return typeof e=="function"?e.apply(this,t):e}uploadFile(e){return this.uploadFiles([e])}uploadFiles(e){this._transformFiles(e,t=>{if(this.options.chunking){let n=t[0];e[0].upload.chunked=this.options.chunking&&(this.options.forceChunking||n.size>this.options.chunkSize),e[0].upload.totalChunkCount=Math.ceil(n.size/this.options.chunkSize)}if(e[0].upload.chunked){let n=e[0],l=t[0];n.upload.chunks=[];let o=()=>{let s=0;for(;n.upload.chunks[s]!==void 0;)s++;if(s>=n.upload.totalChunkCount)return;let r=s*this.options.chunkSize,d=Math.min(r+this.options.chunkSize,l.size),u={name:this._getParamName(0),data:l.webkitSlice?l.webkitSlice(r,d):l.slice(r,d),filename:n.upload.filename,chunkIndex:s};n.upload.chunks[s]={file:n,index:s,dataBlock:u,status:a.UPLOADING,progress:0,retries:0},this._uploadData(e,[u])};if(n.upload.finishedChunkUpload=(s,r)=>{let d=!0;s.status=a.SUCCESS,s.dataBlock=null,s.response=s.xhr.responseText,s.responseHeaders=s.xhr.getAllResponseHeaders(),s.xhr=null;for(let u=0;u<n.upload.totalChunkCount;u++){if(n.upload.chunks[u]===void 0)return o();n.upload.chunks[u].status!==a.SUCCESS&&(d=!1)}d&&this.options.chunksUploaded(n,()=>{this._finished(e,r,null)})},this.options.parallelChunkUploads)for(let s=0;s<n.upload.totalChunkCount;s++)o();else o()}else{let n=[];for(let l=0;l<e.length;l++)n[l]={name:this._getParamName(l),data:t[l],filename:e[l].upload.filename};this._uploadData(e,n)}})}_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(e,t){let n=new XMLHttpRequest;for(let u of e)u.xhr=n;e[0].upload.chunked&&(e[0].upload.chunks[t[0].chunkIndex].xhr=n);let l=this.resolveOption(this.options.method,e,t),o=this.resolveOption(this.options.url,e,t);n.open(l,o,!0),this.resolveOption(this.options.timeout,e)&&(n.timeout=this.resolveOption(this.options.timeout,e)),n.withCredentials=!!this.options.withCredentials,n.onload=u=>{this._finishedUploading(e,n,u)},n.ontimeout=()=>{this._handleUploadError(e,n,`Request timedout after ${this.options.timeout/1e3} seconds`)},n.onerror=()=>{this._handleUploadError(e,n)};let r=n.upload!=null?n.upload:n;r.onprogress=u=>this._updateFilesUploadProgress(e,n,u);let d=this.options.defaultHeaders?{Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"}:{};this.options.binaryBody&&(d["Content-Type"]=e[0].type),this.options.headers&&G(d,this.options.headers);for(let u in d){let E=d[u];E&&n.setRequestHeader(u,E)}if(this.options.binaryBody){for(let u of e)this.emit("sending",u,n);this.options.uploadMultiple&&this.emit("sendingmultiple",e,n),this.submitRequest(n,null,e)}else{let u=new FormData;if(this.options.params){let E=this.options.params;typeof E=="function"&&(E=E.call(this,e,n,e[0].upload.chunked?this._getChunk(e[0],n):null));for(let w in E){let x=E[w];if(Array.isArray(x))for(let b=0;b<x.length;b++)u.append(w,x[b]);else u.append(w,x)}}for(let E of e)this.emit("sending",E,n,u);this.options.uploadMultiple&&this.emit("sendingmultiple",e,n,u),this._addFormElementData(u);for(let E=0;E<t.length;E++){let w=t[E];u.append(w.name,w.data,w.filename)}this.submitRequest(n,u,e)}}_transformFiles(e,t){let n=[],l=0;for(let o=0;o<e.length;o++)this.options.transformFile.call(this,e[o],s=>{n[o]=s,++l===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"),l=t.getAttribute("type");if(l&&(l=l.toLowerCase()),!(typeof n>"u"||n===null))if(t.tagName==="SELECT"&&t.hasAttribute("multiple"))for(let o of t.options)o.selected&&e.append(n,o.value);else(!l||l!=="checkbox"&&l!=="radio"||t.checked)&&e.append(n,t.value)}}_updateFilesUploadProgress(e,t,n){if(e[0].upload.chunked){let l=e[0],o=this._getChunk(l,t);n?(o.progress=100*n.loaded/n.total,o.total=n.total,o.bytesSent=n.loaded):(o.progress=100,o.bytesSent=o.total),l.upload.progress=0,l.upload.total=0,l.upload.bytesSent=0;for(let s=0;s<l.upload.totalChunkCount;s++)l.upload.chunks[s]&&typeof l.upload.chunks[s].progress<"u"&&(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 for(let l of e)l.upload.total&&l.upload.bytesSent&&l.upload.bytesSent==l.upload.total||(n?(l.upload.progress=100*n.loaded/n.total,l.upload.total=n.total,l.upload.bytesSent=n.loaded):(l.upload.progress=100,l.upload.bytesSent=l.upload.total),this.emit("uploadprogress",l,l.upload.progress,l.upload.bytesSent))}_finishedUploading(e,t,n){let l;if(e[0].status!==a.CANCELED&&t.readyState===4){if(t.responseType!=="arraybuffer"&&t.responseType!=="blob"&&(l=t.responseText,t.getResponseHeader("content-type")&&~t.getResponseHeader("content-type").indexOf("application/json")))try{l=JSON.parse(l)}catch(o){n=o,l="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),l):this._finished(e,l,n):this._handleUploadError(e,t,l)}}_handleUploadError(e,t,n){if(e[0].status!==a.CANCELED){if(e[0].upload.chunked&&this.options.retryChunks){let l=this._getChunk(e[0],t);if(l.retries++<this.options.retryChunksLimit){this._uploadData(e,[l.dataBlock]);return}else console.warn("Retried this chunk too often. Giving up.")}this._errorProcessing(e,n||this.options.dictResponseError.replace("{{statusCode}}",t.status),t)}}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){const l=this._getChunk(n[0],e);e.send(l.dataBlock.data)}else e.send(n[0]);else e.send(t)}_finished(e,t,n){for(let l of e)l.status=a.SUCCESS,this.emit("success",l,t,n),this.emit("complete",l);if(this.options.uploadMultiple&&(this.emit("successmultiple",e,t,n),this.emit("completemultiple",e)),this.options.autoProcessQueue)return this.processQueue()}_errorProcessing(e,t,n){for(let l of e)l.status=a.ERROR,this.emit("error",l,t,n),this.emit("complete",l);if(this.options.uploadMultiple&&(this.emit("errormultiple",e,t,n),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(e,t){super();let n,l;if(this.element=e,this.clickableElements=[],this.listeners=[],this.files=[],typeof this.element=="string"&&(this.element=document.querySelector(this.element)),!this.element||this.element.nodeType==null)throw new Error("Invalid dropzone element.");if(this.element.dropzone)throw new Error("Dropzone already attached.");a.instances.push(this),this.element.dropzone=this;let o=(l=a.optionsForElement(this.element))!=null?l:{};if(this.options=G(!0,{},de,o,t??{}),this.options.previewTemplate=this.options.previewTemplate.replace(/\n*/g,""),this.options.forceFallback||!a.isBrowserSupported())return this.options.fallback.call(this);if(this.options.url==null&&(this.options.url=this.element.getAttribute("action")),!this.options.url)throw new Error("No URL provided.");if(this.options.acceptedFiles&&this.options.acceptedMimeTypes)throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.");if(this.options.uploadMultiple&&this.options.chunking)throw new Error("You cannot set both: uploadMultiple and chunking.");if(this.options.binaryBody&&this.options.uploadMultiple)throw new 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=s=>this.options.renameFilename.call(this,s.name,s)),typeof this.options.method=="string"&&(this.options.method=this.options.method.toUpperCase()),(n=this.getExistingFallback())&&n.parentNode&&n.parentNode.removeChild(n),this.options.previewsContainer!==!1&&(this.options.previewsContainer?this.previewsContainer=a.getElement(this.options.previewsContainer,"previewsContainer"):this.previewsContainer=this.element),this.options.clickable&&(this.options.clickable===!0?this.clickableElements=[this.element]:this.clickableElements=a.getElements(this.options.clickable,"clickable")),this.init()}}a.initClass();a.options={};a.optionsForElement=function(i){if(i.getAttribute("id"))return a.options[ce(i.getAttribute("id"))]};a.instances=[];a.forElement=function(i){if(typeof i=="string"&&(i=document.querySelector(i)),(i!=null?i.dropzone:void 0)==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 i.dropzone};a.discover=function(){let i;if(document.querySelectorAll)i=document.querySelectorAll(".dropzone");else{i=[];let e=t=>(()=>{let n=[];for(let l of t)/(^| )dropzone($| )/.test(l.className)?n.push(i.push(l)):n.push(void 0);return n})();e(document.getElementsByTagName("div")),e(document.getElementsByTagName("form"))}return(()=>{let e=[];for(let t of i)a.optionsForElement(t)!==!1?e.push(new a(t)):e.push(void 0);return e})()};a.blockedBrowsers=[/opera.*(Macintosh|Windows Phone).*version\/12/i];a.isBrowserSupported=function(){let i=!0;if(window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector)if(!("classList"in document.createElement("a")))i=!1;else{a.blacklistedBrowsers!==void 0&&(a.blockedBrowsers=a.blacklistedBrowsers);for(let e of a.blockedBrowsers)if(e.test(navigator.userAgent)){i=!1;continue}}else i=!1;return i};a.dataURItoBlob=function(i){let e=atob(i.split(",")[1]),t=i.split(",")[0].split(":")[1].split(";")[0],n=new ArrayBuffer(e.length),l=new Uint8Array(n);for(let o=0,s=e.length,r=0<=s;r?o<=s:o>=s;r?o++:o--)l[o]=e.charCodeAt(o);return new Blob([n],{type:t})};const ue=(i,e)=>i.filter(t=>t!==e).map(t=>t),ce=i=>i.replace(/[\-_](\w)/g,e=>e.charAt(1).toUpperCase());a.createElement=function(i){let e=document.createElement("div");return e.innerHTML=i,e.childNodes[0]};a.elementInside=function(i,e){if(i===e)return!0;for(;i=i.parentNode;)if(i===e)return!0;return!1};a.getElement=function(i,e){let t;if(typeof i=="string"?t=document.querySelector(i):i.nodeType!=null&&(t=i),t==null)throw new Error(`Invalid \`${e}\` option provided. Please provide a CSS selector or a plain HTML element.`);return t};a.getElements=function(i,e){let t,n;if(i instanceof Array){n=[];try{for(t of i)n.push(this.getElement(t,e))}catch{n=null}}else if(typeof i=="string"){n=[];for(t of document.querySelectorAll(i))n.push(t)}else i.nodeType!=null&&(n=[i]);if(n==null||!n.length)throw new Error(`Invalid \`${e}\` option provided. Please provide a CSS selector, a plain HTML element or a list of those.`);return n};a.confirm=function(i,e,t){if(window.confirm(i))return e();if(t!=null)return t()};a.isValidFile=function(i,e){if(!e)return!0;e=e.split(",");let t=i.type,n=t.replace(/\/.*$/,"");for(let l of e)if(l=l.trim(),l.charAt(0)==="."){if(i.name.toLowerCase().indexOf(l.toLowerCase(),i.name.length-l.length)!==-1)return!0}else if(/\/\*$/.test(l)){if(n===l.replace(/\/.*$/,""))return!0}else if(t===l)return!0;return!1};typeof jQuery<"u"&&jQuery!==null&&(jQuery.fn.dropzone=function(i){return this.each(function(){return new a(this,i)})});a.ADDED="added";a.QUEUED="queued";a.ACCEPTED=a.QUEUED;a.UPLOADING="uploading";a.PROCESSING=a.UPLOADING;a.CANCELED="canceled";a.ERROR="error";a.SUCCESS="success";let me=function(i){i.naturalWidth;let e=i.naturalHeight,t=document.createElement("canvas");t.width=1,t.height=e;let n=t.getContext("2d");n.drawImage(i,0,0);let{data:l}=n.getImageData(1,0,1,e),o=0,s=e,r=e;for(;r>o;)l[(r-1)*4+3]===0?s=r:o=r,r=s+o>>1;let d=r/e;return d===0?1:d};var pe=function(i,e,t,n,l,o,s,r,d,u){let E=me(e);return i.drawImage(e,t,n,l,o,s,r,d,u/E)};class te{static initClass(){this.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}static encode64(e){let t="",n,l,o="",s,r,d,u="",E=0;for(;n=e[E++],l=e[E++],o=e[E++],s=n>>2,r=(n&3)<<4|l>>4,d=(l&15)<<2|o>>6,u=o&63,isNaN(l)?d=u=64:isNaN(o)&&(u=64),t=t+this.KEY_STR.charAt(s)+this.KEY_STR.charAt(r)+this.KEY_STR.charAt(d)+this.KEY_STR.charAt(u),n=l=o="",s=r=d=u="",E<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,","")),l=this.slice2Segments(n),o=this.exifManipulation(t,l);return`data:image/jpeg;base64,${this.encode64(o)}`}static exifManipulation(e,t){let n=this.getExifArray(t),l=this.insertExif(e,n);return new Uint8Array(l)}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,",""),l=this.decode64(n),o=l.indexOf(255,3),s=l.slice(0,o),r=l.slice(o),d=s;return d=d.concat(t),d=d.concat(r),d}static slice2Segments(e){let t=0,n=[];for(;;){var l;if(e[t]===255&e[t+1]===218)break;if(e[t]===255&e[t+1]===216)t+=2;else{l=e[t+2]*256+e[t+3];let o=t+l+2,s=e.slice(t,o);n.push(s),t=o}if(t>e.length)break}return n}static decode64(e){let t,n,l="",o,s,r,d="",u=0,E=[];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,"");o=this.KEY_STR.indexOf(e.charAt(u++)),s=this.KEY_STR.indexOf(e.charAt(u++)),r=this.KEY_STR.indexOf(e.charAt(u++)),d=this.KEY_STR.indexOf(e.charAt(u++)),t=o<<2|s>>4,n=(s&15)<<4|r>>2,l=(r&3)<<6|d,E.push(t),r!==64&&E.push(n),d!==64&&E.push(l),t=n=l="",o=s=r=d="",u<e.length;);return E}}te.initClass();function he(i,e){return typeof i<"u"&&i!==null?e(i):void 0}function ge(i,e,t){if(typeof i<"u"&&i!==null&&typeof i[e]=="function")return t(i,e)}const fe=document.getElementById("errModal"),ye=document.getElementById("loadingModal"),ve=document.getElementById("previewModal"),Ee=document.getElementById("previewDocumentModal"),we=document.getElementById("previewImgModal"),Z={placement:"bottom-right",backdrop:"static",backdropClasses:"bg-gray-900 bg-opacity-50 backdrop-filter backdrop-blur-sm fixed inset-0 z-40",closable:!0,onHide:()=>{},onShow:()=>{},onToggle:()=>{}},c=new W(fe,Z),h=new W(ye,Z),ne=new W(ve,Z),xe=new W(Ee,Z),be=new W(we,Z);let k,C,D;var m=document.getElementById("altSubMessageModal"),p=document.getElementById("errMessageModal"),g=document.getElementById("errSubMessageModal"),Fe=document.getElementById("err-list"),y=document.getElementById("err-list-title"),I=document.getElementById("submitBtn"),R=document.getElementById("titleMessageModal"),S=[],Ie=document.getElementById("dropzoneArea"),Te=document.getElementById("dropzoneAreaCnv"),ke=document.getElementById("dropzoneAreaSingle"),ie="16199e0c9a4042f0969ea2ed591c547b",Be="https://docs.google.com/viewerng/viewer?url=",le="/storage/upload/",Q="https://pdf.hana-ci.com/storage/upload/";I&&Pe().then(function(){I.onclick=function(i){De(i)}}).catch(function(i){console.log(i),p.innerText="There was unexpected error !",g.innerText="",y.innerText="Error message",v(),f("Cannot establish connection with the server"),m.style=null,h.hide(),c.show(),setTimeout(function(){location.reload()},3e3)});if(Ie){let i=new a("#dropzoneArea",{url:"api/v1/file/upload",paramName:"file",maxFilesize:25,maxFiles:4,acceptedFiles:"application/pdf",addRemoveLinks:!0,dictDefaultMessage:"",dictRemoveFile:"Remove",timeout:5e3,previewTemplate:'<div class="dz-file-preview dz-preview dz-processing dz-success dz-complete z-0"><div class="flex flex-col items-center justify-center"><div class="mt-2 flex items-center justify-center lg:h-[200px] lg:w-[150px]"><img id="imgThumbnail" class="dz-image-thumbnail h-48 w-32 object-scale-down" src="/assets/icons/placeholder_pdf.svg"></div><div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div><div class="dz-success-mark"><svg class="w-4 h-4 text-ac" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8.5 11.5 11 14l4-4m6 2a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/></svg></div><div class="dz-error-mark"><svg class="w-4 h-4 text-rt1" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"></path></svg></div><div class="dz-details -mt-8"><div class="dz-filename font-sm font-magistral text-lt1"><span data-dz-name></span></div></div><div class="dz-error-message mt-2 ms-1 lg:ms-4"><span data-dz-errormessage></span></div><div class="flex flex-row mx-auto"><button type="button" id="prvBtn" class="prvBtn mt-2 mx-4 p-2 bg-pc2 text-lt rounded-lg cursor-pointer w-8 h-8 text-center flex items-center justify-center"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="w-6 h-6 text-white"><path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z" /><path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" /></svg></button><button type="button" id="rmvBtn" class="rmvBtn mt-2 mx-4 p-2 bg-rt1 text-lt rounded-lg cursor-pointer w-8 h-8 text-center flex items-center justify-center" data-dz-remove=""><svg class="w-6 h-6 text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 7h14m-9 3v8m4-8v8M10 3h4a1 1 0 0 1 1 1v3H9V4a1 1 0 0 1 1-1ZM6 7h12v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V7Z"></path></svg></button></div></div></div>',clickable:!0,init:function(){document.getElementById("dropzoneUploadInit").addEventListener("click",function(){i.hiddenFileInput.click()}),document.getElementById("dropzoneUploadExt").addEventListener("click",function(){i.files.length>=4?document.getElementById("dropzoneUiExt").classList.add("hidden"):(i.hiddenFileInput.click(),document.getElementById("dropzoneUiExt").classList.remove("hidden"))}),this.on("addedfile",function(e){var t=document.getElementsByClassName("dz-remove"),n=document.querySelectorAll('[data-dz-name=""]');document.querySelector(".dz-default.dz-message").style.display="none",document.getElementById("dropzoneUiInit").style.display="none";for(var l=0;l<t.length;l++)t[l].style.display="none";if(n.forEach(function(r){r.style.borderColor="transparent",r.style.backgroundColor="transparent"}),e.type==="application/pdf"){se(e),i.files.length>=4?(document.getElementById("dropzoneUiExt").classList.add("hidden"),i.hiddenFileInput.setAttribute("disabled","disabled")):(document.getElementById("dropzoneUiExt").classList.remove("hidden"),i.hiddenFileInput.removeAttribute("disabled","disabled")),I.style.backgroundColor="#4DAAAA",I.style.borderColor="transparent";var o=document.querySelectorAll(".prvBtn"),s=document.querySelectorAll(".rmvBtn");o.forEach(function(r){r.addEventListener("click",function(d){var u=d.target.closest(".dz-file-preview"),E=u.querySelector(".dz-filename span"),w=Y(E.innerText),x=Q+w,b=new AdobeDC.View({clientId:ie,divId:"adobe-dc-view"});b.previewFile({content:{location:{url:x}},metaData:{fileName:w}},{embedMode:"SIZED_CONTAINER",focusOnRendering:!0,showDownloadPDF:!1}),ne.show()})}),s.forEach(function(r){r.addEventListener("click",function(){var d=document.getElementById("adobe-dc-view");d&&(d.innerHTML='<script src="https://acrobatservices.adobe.com/view-sdk/viewer.js"><\/script>'),i.files.length>3?document.getElementById("dropzoneUiExt").classList.add("hidden"):i.files.length>0&&i.files.length<4&&(i.hiddenFileInput.removeAttribute("disabled","disabled"),document.getElementById("dropzoneUiExt").classList.remove("hidden"))})})}}),this.on("removedfile",function(e){if(i.files.length===0&&(document.getElementById("dropzoneUiInit").style.display=null,document.getElementById("dropzoneUiExt").classList.add("hidden"),I.style.backgroundColor=null,I.style.borderColor="#E0E4E5",I.style.color=null),e){const t=document.querySelector('input[name="_token"]').value,n="/storage/upload/"+e.name;S=S.filter(l=>!e.name.includes(l)),fetch("api/v1/file/remove",{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-TOKEN":t,file:n},body:JSON.stringify({file:n})}).then(l=>l.json()).then(l=>{console.log(l)}).catch(l=>{console.log("Error: Failed to remove file: ",l)})}else console.log("Error: File object is null or undefined.")}),this.on("success",function(e){console.log(e);var t=e.name;S.push(t)}),this.on("maxfilesexceeded",function(e){p.innerText="PDF file can not be processed !",g.innerText="",y.innerText="Error message",v(),f("Maximum upload files reached"),m.style=null,c.show(),i.removeFile(e)})}});i||I&&(document.getElementById("compress")!==null||document.getElementById("cnvFrPDF")!==null)&&(console.log("Dropzone instance are not ready"),p.innerText="There was unexpected error !",g.innerText="",y.innerText="Error message",v(),f("Cannot establish connection with the server"),m.style=null,h.hide(),c.show())}if(Te){let i=new a("#dropzoneAreaCnv",{url:"api/v1/file/upload",paramName:"file",maxFilesize:25,maxFiles:4,acceptedFiles:".xlsx, .xls, .ppt, .pptx, .docx, doc, image/*",addRemoveLinks:!0,dictDefaultMessage:"",dictRemoveFile:"Remove",timeout:5e3,previewTemplate:'<div class="dz-file-preview dz-preview dz-processing dz-success dz-complete z-0"><div class="flex flex-col items-center justify-center"><div class="mt-2 flex items-center justify-center lg:h-[200px] lg:w-[150px]"><img id="imgThumbnail" class="dz-image-thumbnail h-48 w-32 object-scale-down" src="/assets/icons/placeholder_pdf.svg"></div><div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div><div class="dz-success-mark"><svg class="w-4 h-4 text-ac" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8.5 11.5 11 14l4-4m6 2a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/></svg></div><div class="dz-error-mark"><svg class="w-4 h-4 text-rt1" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"></path></svg></div><div class="dz-details -mt-8"><div class="dz-filename font-sm font-magistral text-lt1"><span data-dz-name></span></div></div><div class="dz-error-message mt-2 ms-1 lg:ms-4"><span data-dz-errormessage></span></div><div class="flex flex-row mx-auto"><button type="button" id="prvBtn" class="prvBtn mt-2 mx-4 p-2 bg-pc2 text-lt rounded-lg cursor-pointer w-8 h-8 text-center flex items-center justify-center"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="w-6 h-6 text-white"><path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z" /><path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" /></svg></button><button type="button" id="rmvBtn" class="rmvBtn mt-2 mx-4 p-2 bg-rt1 text-lt rounded-lg cursor-pointer w-8 h-8 text-center flex items-center justify-center" data-dz-remove=""><svg class="w-6 h-6 text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 7h14m-9 3v8m4-8v8M10 3h4a1 1 0 0 1 1 1v3H9V4a1 1 0 0 1 1-1ZM6 7h12v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V7Z"></path></svg></button></div></div></div>',clickable:!0,init:function(){document.getElementById("dropzoneUploadInit").addEventListener("click",function(){i.hiddenFileInput.click()}),document.getElementById("dropzoneUploadExt").addEventListener("click",function(){i.files.length>=4?document.getElementById("dropzoneUiExt").classList.add("hidden"):(i.hiddenFileInput.click(),document.getElementById("dropzoneUiExt").classList.remove("hidden"))}),this.on("addedfile",function(e){var t=document.getElementsByClassName("dz-remove"),n=document.querySelectorAll('[data-dz-name=""]');document.querySelector(".dz-default.dz-message").style.display="none",document.getElementById("dropzoneUiInit").style.display="none";for(var l=0;l<t.length;l++)t[l].style.display="none";n.forEach(function(r){r.style.borderColor="transparent",r.style.backgroundColor="transparent"}),i.files.length>=4?(document.getElementById("dropzoneUiExt").classList.add("hidden"),i.hiddenFileInput.setAttribute("disabled","disabled")):(I.style.backgroundColor="#4DAAAA",I.style.borderColor="transparent",document.getElementById("dropzoneUiExt").classList.remove("hidden"),i.hiddenFileInput.removeAttribute("disabled","disabled"));var o=document.querySelectorAll(".prvBtn"),s=document.querySelectorAll(".rmvBtn");o.forEach(function(r){r.addEventListener("click",function(d){var u=d.target.closest(".dz-preview"),E=u.querySelector(".dz-filename span"),w=Y(E.innerText),x=Q+w,b=Be+Q+w+"&embedded=true";e.type.startsWith("image/")?(document.getElementById("imgPrv").src=x,be.show()):(document.getElementById("iFrame").src=b,xe.show())})}),s.forEach(function(r){r.addEventListener("click",function(){document.getElementById("iFrame").src=null,i.files.length>3?document.getElementById("dropzoneUiExt").classList.add("hidden"):i.files.length>0&&i.files.length<4&&(i.hiddenFileInput.removeAttribute("disabled","disabled"),document.getElementById("dropzoneUiExt").classList.remove("hidden"))})})}),this.on("removedfile",function(e){if(i.files.length===0&&(document.getElementById("dropzoneUiInit").style.display=null,document.getElementById("dropzoneUiExt").classList.add("hidden"),I.style.backgroundColor=null,I.style.borderColor="#E0E4E5",I.style.color=null),e){const t=document.querySelector('input[name="_token"]').value,n=le+e.name;S=S.filter(l=>!e.name.includes(l)),fetch("api/v1/file/remove",{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-TOKEN":t,file:n},body:JSON.stringify({file:n})}).then(l=>l.json()).then(l=>{console.log(l)}).catch(l=>{console.log("Error: Failed to remove file: ",l)})}else console.log("Error: File object is null or undefined.")}),this.on("success",function(e,t){var n=t.fileName;S.push(n),e.type.startsWith("image/")||ze(e.name).then(function(l){e.previewElement.querySelector(".dz-image-thumbnail").src=l}).catch(function(l){e.previewElement.querySelector(".dz-image-thumbnail").src="/assets/icons/placeholder_pptx.svg",console.log(l.message)})}),this.on("thumbnail",function(e){e.type.startsWith("image/")&&(e.previewElement.querySelector(".dz-image-thumbnail").src=e.dataURL)}),this.on("maxfilesexceeded",function(e){p.innerText="PDF file can not be processed !",g.innerText="",y.innerText="Error message",v(),f("Maximum upload files reached"),m.style=null,c.show(),i.removeFile(e)})}});i||I&&document.getElementById("cnvToPDF")!==null&&(console.log("Dropzone instance are not ready"),p.innerText="There was unexpected error !",g.innerText="",y.innerText="Error message",v(),f("Cannot establish connection with the server"),m.style=null,h.hide(),c.show())}if(ke){let i=new a("#dropzoneAreaSingle",{url:"api/v1/file/upload",paramName:"file",maxFilesize:25,maxFiles:1,acceptedFiles:"application/pdf",addRemoveLinks:!0,dictDefaultMessage:"",dictRemoveFile:"Remove",timeout:5e3,previewTemplate:'<div class="dz-file-preview dz-preview dz-processing dz-success dz-complete z-0"><div class="flex flex-col items-center justify-center"><div class="mt-2 flex items-center justify-center lg:h-[200px] lg:w-[150px]"><img id="imgThumbnail" class="dz-image-thumbnail h-48 w-32 object-scale-down" src="/assets/icons/placeholder_pdf.svg"></div><div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div><div class="dz-success-mark"><svg class="w-4 h-4 text-ac" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8.5 11.5 11 14l4-4m6 2a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/></svg></div><div class="dz-error-mark"><svg class="w-4 h-4 text-rt1" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"></path></svg></div><div class="dz-details -mt-8"><div class="dz-filename font-sm font-magistral text-lt1"><span data-dz-name></span></div></div><div class="dz-error-message mt-2 ms-1 lg:ms-4"><span data-dz-errormessage></span></div><div class="flex flex-row mx-auto"><button type="button" id="prvBtn" class="prvBtn mt-2 mx-4 p-2 bg-pc2 text-lt rounded-lg cursor-pointer w-8 h-8 text-center flex items-center justify-center"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="w-6 h-6 text-white"><path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z" /><path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" /></svg></button><button type="button" id="rmvBtn" class="rmvBtn mt-2 mx-4 p-2 bg-rt1 text-lt rounded-lg cursor-pointer w-8 h-8 text-center flex items-center justify-center" data-dz-remove=""><svg class="w-6 h-6 text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 7h14m-9 3v8m4-8v8M10 3h4a1 1 0 0 1 1 1v3H9V4a1 1 0 0 1 1-1ZM6 7h12v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V7Z"></path></svg></button></div></div></div>',clickable:!0,init:function(){document.getElementById("dropzoneUploadInit").addEventListener("click",function(){i.hiddenFileInput.click()}),document.getElementById("dropzoneUploadExt").addEventListener("click",function(){i.files.length>=1?document.getElementById("dropzoneUiExt").classList.add("hidden"):(i.hiddenFileInput.click(),document.getElementById("dropzoneUiExt").classList.remove("hidden"))}),this.on("addedfile",function(e){var t=document.getElementsByClassName("dz-remove"),n=document.querySelectorAll('[data-dz-name=""]');document.querySelector(".dz-default.dz-message").style.display="none",document.getElementById("dropzoneUiInit").style.display="none";for(var l=0;l<t.length;l++)t[l].style.display="none";if(n.forEach(function(r){r.style.borderColor="transparent",r.style.backgroundColor="transparent"}),e.type==="application/pdf"){se(e),i.files.length>=1?(document.getElementById("dropzoneUiExt").classList.add("hidden"),i.hiddenFileInput.setAttribute("disabled","disabled")):(document.getElementById("dropzoneUiExt").classList.remove("hidden"),i.hiddenFileInput.removeAttribute("disabled","disabled")),I.style.backgroundColor="#4DAAAA",I.style.color="#E0E4E5";var o=document.querySelectorAll(".prvBtn"),s=document.querySelectorAll(".rmvBtn");o.forEach(function(r){r.addEventListener("click",function(d){var u=d.target.closest(".dz-file-preview"),E=u.querySelector(".dz-filename span"),w=Y(E.innerText),x=Q+w,b=new AdobeDC.View({clientId:ie,divId:"adobe-dc-view"});b.previewFile({content:{location:{url:x}},metaData:{fileName:w}},{embedMode:"SIZED_CONTAINER",focusOnRendering:!0,showDownloadPDF:!1}),ne.show()})}),s.forEach(function(r){r.addEventListener("click",function(){var d=document.getElementById("adobe-dc-view");d&&(d.innerHTML='<script src="https://acrobatservices.adobe.com/view-sdk/viewer.js"><\/script>'),i.files.length>=1?(i.hiddenFileInput.removeAttribute("disabled","disabled"),document.getElementById("dropzoneUiExt").classList.remove("hidden")):document.getElementById("dropzoneUiExt").classList.add("hidden")})})}}),this.on("removedfile",function(e){if(i.files.length===0&&(document.getElementById("dropzoneUiInit").style.display=null,document.getElementById("dropzoneUiExt").classList.add("hidden"),I.style.backgroundColor=null,I.style.color=null),e){const t=document.querySelector('input[name="_token"]').value,n=le+e.name;S=S.filter(l=>!e.name.includes(l)),fetch("api/v1/file/remove",{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-TOKEN":t,file:n},body:JSON.stringify({file:n})}).then(l=>l.json()).then(l=>{console.log(l)}).catch(l=>{console.log("Error: Failed to remove file: ",l)})}else console.log("Error: File object is null or undefined.")}),this.on("success",function(e){console.log(e);var t=e.name;S.push(t)}),this.on("maxfilesexceeded",function(e){p.innerText="PDF file can not be processed !",g.innerText="",y.innerText="Error message",v(),f("Maximum upload files reached"),m.style=null,c.show(),i.removeFile(e)})}});i||I&&(document.getElementById("merge")!==null||document.getElementById("split")!==null||document.getElementById("watermark")!==null)&&(console.log("Dropzone instance are not ready"),p.innerText="There was unexpected error !",g.innerText="",y.innerText="Error message",v(),f("Cannot establish connection with the server"),m.style=null,h.hide(),c.show())}function se(i){const e=new FileReader;e.onload=function(){const t=new Uint8Array(this.result);pdfjsLib.getDocument(t).promise.then(function(n){n.getPage(1).then(function(l){const o=document.createElement("canvas"),s=o.getContext("2d"),r=l.getViewport({scale:.5});o.width=r.width,o.height=r.height;const d={canvasContext:s,viewport:r};l.render(d).promise.then(function(){const u=o.toDataURL("image/jpeg"),w=i.previewElement.querySelector(".dz-image-thumbnail");w.src=u})})})},e.readAsArrayBuffer(i)}function P(){return S}function z(i,e){var t=P();Ce(t,i,e).then(function(){h.hide()}).catch(function(n){h.hide(),console.log(n)})}function ze(i){return new Promise(function(e,t){var n=new XMLHttpRequest,l=new FormData,o=document.querySelector('input[name="_token"]').value;console.log(i),l.append("_token",o),l.append("file",i),n.open("POST","api/v1/file/thumbnail",!0),n.onreadystatechange=function(){if(n.readyState==4)if(n.status==200){var s=JSON.parse(n.responseText);s.status==200?e(s.res):t(new Error("API response error: "+s.message))}else t(new Error("API response error! Status: "+n.status))},n.send(l)})}function Ce(i,e,t){return new Promise(function(n,l){var o=new XMLHttpRequest,s=new FormData,r=document.querySelector('input[name="_token"]').value;if(s.append("_token",r),e=="compress"){var d=document.querySelector('input[name="compMethod"]:checked').value;s.append("compMethod",d)}else if(e=="convert"){if(document.getElementById("cnvToPDF")!==null){var u="pdf";s.append("extImage","false")}else if(document.getElementById("cnvFrPDF")!==null){var u=document.querySelector('input[name="convertType"]:checked').value,E=document.getElementById("extImage");E.checked?s.append("extImage","true"):s.append("extImage","false")}s.append("convertType",u)}else if(e=="split"){var w=document.getElementById("customPageSplit").value,x=document.getElementById("customPageDelete").value,b=document.getElementById("fromPage").value,j=document.getElementById("toPage").value,N=document.getElementById("mergePDF").checked;s.append("action",t),s.append("fromPage",b),s.append("toPage",j),s.append("mergePDF",N.toString()),s.append("customPageSplit",w),s.append("customPageDelete",x)}else if(e=="watermark"){if(document.getElementById("firstRadio").checked==!0){let F,T;var U=document.getElementById("wm_file_input").files[0],q=document.getElementById("watermarkPageImage").value,H=document.getElementById("watermarkFontTransparency").value,B=document.getElementById("isMosaicImage").checked;document.getElementById("wmRadioImageLayoutStyleA").checked==!0?F=document.getElementById("wmRadioImageLayoutStyleA").value:document.getElementById("wmRadioImageLayoutStyleB").checked==!0?F=document.getElementById("wmRadioImageLayoutStyleB").value:F=document.getElementById("wmRadioImageLayoutStyleA").value,document.getElementById("wmRadioImageRotationA").checked==!0?T=document.getElementById("wmRadioImageRotationA").value:document.getElementById("wmRadioImageRotationB").checked==!0?T=document.getElementById("wmRadioImageRotationB").value:document.getElementById("wmRadioImageRotationC").checked==!0?T=document.getElementById("wmRadioImageRotationC").value:document.getElementById("wmRadioImageRotationD").checked==!0?T=document.getElementById("wmRadioImageRotationD").value:T=document.getElementById("wmRadioImageRotationA").value,s.append("action",t),s.append("imgFile",U),s.append("wmFontColor",""),s.append("wmFontSize",""),s.append("wmFontStyle",""),s.append("wmFontFamily",""),s.append("wmLayoutStyle",F),s.append("wmRotation",T),s.append("wmPage",q),s.append("wmText",""),s.append("wmTransparency",H),s.append("wmMosaic",B.toString())}else if(document.getElementById("secondRadio").checked==!0){let F,T,X,O;var L=document.getElementById("watermarkFontSize").value,M=document.getElementById("watermarkFontColor").value,q=document.getElementById("watermarkPageText").value,A=document.getElementById("watermarkText").value,H=document.getElementById("watermarkFontTransparency").value,B=document.getElementById("isMosaicText").checked;document.getElementById("wmRadioFontFamilyA").checked==!0?F=document.getElementById("wmRadioFontFamilyA").value:document.getElementById("wmRadioFontFamilyB").checked==!0?F=document.getElementById("wmRadioFontFamilyB").value:document.getElementById("wmRadioFontFamilyC").checked==!0?F=document.getElementById("wmRadioFontFamilyC").value:document.getElementById("wmRadioFontFamilyD").checked==!0?F=document.getElementById("wmRadioFontFamilyD").value:document.getElementById("wmRadioFontFamilyE").checked==!0?F=document.getElementById("wmRadioFontFamilyE").value:document.getElementById("wmRadioFontFamilyF").checked==!0?F=document.getElementById("wmRadioFontFamilyF").value:F=document.getElementById("wmRadioFontFamilyA").value,document.getElementById("wmRadioFontStyleA").checked==!0?T=document.getElementById("wmRadioFontStyleA").value:document.getElementById("wmRadioFontStyleB").checked==!0?T=document.getElementById("wmRadioFontStyleB").value:document.getElementById("wmRadioFontStyleC").checked==!0?T=document.getElementById("wmRadioFontStyleC").value:T=document.getElementById("wmRadioFontStyleA").value,document.getElementById("wmRadioLayoutStyleA").checked==!0?X=document.getElementById("wmRadioLayoutStyleA").value:document.getElementById("wmRadioLayoutStyleB").checked==!0?X=document.getElementById("wmRadioLayoutStyleB").value:X=document.getElementById("wmRadioLayoutStyleA").value,document.getElementById("wmRadioRotationA").checked==!0?O=document.getElementById("wmRadioRotationA").value:document.getElementById("wmRadioRotationB").checked==!0?O=document.getElementById("wmRadioRotationB").value:document.getElementById("wmRadioRotationC").checked==!0?O=document.getElementById("wmRadioRotationC").value:document.getElementById("wmRadioRotationD").checked==!0?O=document.getElementById("wmRadioRotationD").value:O=document.getElementById("wmRadioRotationA").value,s.append("action",t),s.append("imgFile",""),s.append("wmFontColor",M),s.append("wmFontSize",L),s.append("wmFontStyle",T),s.append("wmFontFamily",F),s.append("wmLayoutStyle",X),s.append("wmRotation",O),s.append("wmPage",q),s.append("wmText",A),s.append("wmTransparency",H),s.append("wmMosaic",B.toString())}}else if(e=="html"){var _=document.getElementById("urlToPDF").value;s.append("urlToPDF",_)}e!=="html"&&(i.length>1?s.append("batch","true"):s.append("batch","false"),i.forEach(function(F,T){s.append("file["+T+"]",F)})),o.open("POST","api/v2/proc/"+e,!0),o.onreadystatechange=function(){if(o.readyState==4)if(o.status==200){var F=JSON.parse(o.responseText);F.status==200&&(e=="compress"?(J(F.res,F.fileName),document.getElementById("alert-scs").classList.remove("hidden","opacity-0"),document.getElementById("alert-err").classList.add("hidden","opacity-0"),document.getElementById("scsMsgTitle").innerText="HANA PDF Process completed !",document.getElementById("scsMsgResult").innerHTML=`

Check warning

Code scanning / CodeQL

DOM text reinterpreted as HTML

[DOM text](1) is reinterpreted as HTML without escaping meta-characters.
</div>
`;let ae={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(i,e,t){if(t)return{dzuuid:t.file.upload.uuid,dzchunkindex:t.index,dztotalfilesize:t.file.size,dzchunksize:this.options.chunkSize,dztotalchunkcount:t.file.upload.totalChunkCount,dzchunkbyteoffset:t.index*this.options.chunkSize}},accept(i,e){return e()},chunksUploaded:function(i,e){e()},binaryBody:!1,fallback(){let i;this.element.className=`${this.element.className} dz-browser-not-supported`;for(let t of this.element.getElementsByTagName("div"))if(/(^| )dz-message($| )/.test(t.className)){i=t,t.className="dz-message";break}i||(i=a.createElement('<div class="dz-message"><span></span></div>'),this.element.appendChild(i));let e=i.getElementsByTagName("span")[0];return e&&(e.textContent!=null?e.textContent=this.options.dictFallbackMessage:e.innerText!=null&&(e.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize(i,e,t,n){let l={srcX:0,srcY:0,srcWidth:i.width,srcHeight:i.height},o=i.width/i.height;e==null&&t==null?(e=l.srcWidth,t=l.srcHeight):e==null?e=t*o:t==null&&(t=e/o),e=Math.min(e,l.srcWidth),t=Math.min(t,l.srcHeight);let s=e/t;if(l.srcWidth>e||l.srcHeight>t)if(n==="crop")o>s?(l.srcHeight=i.height,l.srcWidth=l.srcHeight*s):(l.srcWidth=i.width,l.srcHeight=l.srcWidth/s);else if(n==="contain")o>s?t=e/o:e=t*o;else throw new Error(`Unknown resizeMethod '${n}'`);return l.srcX=(i.width-l.srcWidth)/2,l.srcY=(i.height-l.srcHeight)/2,l.trgWidth=e,l.trgHeight=t,l},transformFile(i,e){return(this.options.resizeWidth||this.options.resizeHeight)&&i.type.match(/image.*/)?this.resizeImage(i,this.options.resizeWidth,this.options.resizeHeight,this.options.resizeMethod,e):e(i)},previewTemplate:re(ee),drop(i){return this.element.classList.remove("dz-drag-hover")},dragstart(i){},dragend(i){return this.element.classList.remove("dz-drag-hover")},dragenter(i){return this.element.classList.add("dz-drag-hover")},dragover(i){return this.element.classList.add("dz-drag-hover")},dragleave(i){return this.element.classList.remove("dz-drag-hover")},paste(i){},reset(){return this.element.classList.remove("dz-started")},addedfile(i){if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer&&!this.options.disablePreviews){i.previewElement=a.createElement(this.options.previewTemplate.trim()),i.previewTemplate=i.previewElement,this.previewsContainer.appendChild(i.previewElement);for(var e of i.previewElement.querySelectorAll("[data-dz-name]"))e.textContent=i.name;for(e of i.previewElement.querySelectorAll("[data-dz-size]"))e.innerHTML=this.filesize(i.size);this.options.addRemoveLinks&&(i._removeLink=a.createElement(`<a class="dz-remove" href="javascript:undefined;" data-dz-remove>${this.options.dictRemoveFile}</a>`),i.previewElement.appendChild(i._removeLink));let t=n=>(n.preventDefault(),n.stopPropagation(),i.status===a.UPLOADING?a.confirm(this.options.dictCancelUploadConfirmation,()=>this.removeFile(i)):this.options.dictRemoveFileConfirmation?a.confirm(this.options.dictRemoveFileConfirmation,()=>this.removeFile(i)):this.removeFile(i));for(let n of i.previewElement.querySelectorAll("[data-dz-remove]"))n.addEventListener("click",t)}},removedfile(i){return i.previewElement!=null&&i.previewElement.parentNode!=null&&i.previewElement.parentNode.removeChild(i.previewElement),this._updateMaxFilesReachedClass()},thumbnail(i,e){if(i.previewElement){i.previewElement.classList.remove("dz-file-preview");for(let t of i.previewElement.querySelectorAll("[data-dz-thumbnail]"))t.alt=i.name,t.src=e;return setTimeout(()=>i.previewElement.classList.add("dz-image-preview"),1)}},error(i,e){if(i.previewElement){i.previewElement.classList.add("dz-error"),typeof e!="string"&&e.error&&(e=e.error);for(let t of i.previewElement.querySelectorAll("[data-dz-errormessage]"))t.textContent=e}},errormultiple(){},processing(i){if(i.previewElement&&(i.previewElement.classList.add("dz-processing"),i._removeLink))return i._removeLink.innerHTML=this.options.dictCancelUpload},processingmultiple(){},uploadprogress(i,e,t){if(i.previewElement)for(let n of i.previewElement.querySelectorAll("[data-dz-uploadprogress]"))n.nodeName==="PROGRESS"?n.value=e:n.style.width=`${e}%`},totaluploadprogress(){},sending(){},sendingmultiple(){},success(i){if(i.previewElement)return i.previewElement.classList.add("dz-success")},successmultiple(){},canceled(i){return this.emit("error",i,this.options.dictUploadCanceled)},canceledmultiple(){},complete(i){if(i._removeLink&&(i._removeLink.innerHTML=this.options.dictRemoveFile),i.previewElement)return i.previewElement.classList.add("dz-complete")},completemultiple(){},maxfilesexceeded(){},maxfilesreached(){},queuecomplete(){},addedfiles(){}};var de=ae;class a extends K{static initClass(){this.prototype.Emitter=K,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._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(t=>t)}getQueuedFiles(){return this.getFilesWithStatus(a.QUEUED)}getUploadingFiles(){return this.getFilesWithStatus(a.UPLOADING)}getAddedFiles(){return this.getFilesWithStatus(a.ADDED)}getActiveFiles(){return this.files.filter(e=>e.status===a.UPLOADING||e.status===a.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(a.createElement(`<div class="dz-default dz-message"><button class="dz-button" type="button">${this.options.dictDefaultMessage}</button></div>`)),this.clickableElements.length){let n=()=>{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",a.getElement(this.options.hiddenInputContainer,"hiddenInputContainer").appendChild(this.hiddenFileInput),this.hiddenFileInput.addEventListener("change",()=>{let{files:l}=this.hiddenFileInput;if(l.length)for(let o of l)this.addFile(o);this.emit("addedfiles",l),n()})};n()}this.URL=window.URL!==null?window.URL:window.webkitURL;for(let n of this.events)this.on(n,this.options[n]);this.on("uploadprogress",()=>this.updateTotalUploadProgress()),this.on("removedfile",()=>this.updateTotalUploadProgress()),this.on("canceled",n=>this.emit("complete",n)),this.on("complete",n=>{if(this.getAddedFiles().length===0&&this.getUploadingFiles().length===0&&this.getQueuedFiles().length===0)return setTimeout(()=>this.emit("queuecomplete"),0)});const e=function(n){if(n.dataTransfer.types){for(var l=0;l<n.dataTransfer.types.length;l++)if(n.dataTransfer.types[l]==="Files")return!0}return!1};let t=function(n){if(e(n))return n.stopPropagation(),n.preventDefault?n.preventDefault():n.returnValue=!1};return this.listeners=[{element:this.element,events:{dragstart:n=>this.emit("dragstart",n),dragenter:n=>(t(n),this.emit("dragenter",n)),dragover:n=>{let l;try{l=n.dataTransfer.effectAllowed}catch{}return n.dataTransfer.dropEffect=l==="move"||l==="linkMove"?"move":"copy",t(n),this.emit("dragover",n)},dragleave:n=>this.emit("dragleave",n),drop:n=>(t(n),this.drop(n)),dragend:n=>this.emit("dragend",n)}}],this.clickableElements.forEach(n=>this.listeners.push({element:n,events:{click:l=>((n!==this.element||l.target===this.element||a.elementInside(l.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,a.instances.splice(a.instances.indexOf(this),1)}updateTotalUploadProgress(){let e,t=0,n=0;if(this.getActiveFiles().length){for(let o of this.getActiveFiles())t+=o.upload.bytesSent,n+=o.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"?e.name:this.options.renameFile(e)}getFallbackForm(){let e,t;if(e=this.getExistingFallback())return e;let n='<div class="dz-fallback">';this.options.dictFallbackText&&(n+=`<p>${this.options.dictFallbackText}</p>`),n+=`<input type="file" name="${this._getParamName(0)}" ${this.options.uploadMultiple?'multiple="multiple"':void 0} /><input type="submit" value="Upload!"></div>`;let l=a.createElement(n);return this.element.tagName!=="FORM"?(t=a.createElement(`<form action="${this.options.url}" enctype="multipart/form-data" method="${this.options.method}"></form>`),t.appendChild(l)):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),t??l}getExistingFallback(){let e=function(n){for(let l of n)if(/(^| )fallback($| )/.test(l.className))return l};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 l=e.events[n];t.push(e.element.addEventListener(n,l,!1))}return t})())}removeEventListeners(){return this.listeners.map(e=>(()=>{let t=[];for(let n in e.events){let l=e.events[n];t.push(e.element.removeEventListener(n,l,!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 l=["tb","gb","mb","kb","b"];for(let o=0;o<l.length;o++){let s=l[o],r=Math.pow(this.options.filesizeBase,4-o)/10;if(e>=r){t=e/Math.pow(this.options.filesizeBase,4-o),n=s;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(he(e!=null?e.clipboardData:void 0,n=>n.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 l of e){var n;l.webkitGetAsEntry!=null&&(n=l.webkitGetAsEntry())?n.isFile?t.push(this.addFile(l.getAsFile())):n.isDirectory?t.push(this._addFilesFromDirectory(n,n.name)):t.push(void 0):l.getAsFile!=null&&(l.kind==null||l.kind==="file")?t.push(this.addFile(l.getAsFile())):t.push(void 0)}return t})()}_addFilesFromDirectory(e,t){let n=e.createReader(),l=s=>ge(console,"log",r=>r.log(s));var o=()=>n.readEntries(s=>{if(s.length>0){for(let r of s)r.isFile?r.file(d=>{if(!(this.options.ignoreHiddenFiles&&d.name.substring(0,1)==="."))return d.fullPath=`${t}/${d.name}`,this.addFile(d)}):r.isDirectory&&this._addFilesFromDirectory(r,`${t}/${r.name}`);o()}return null},l);return o()}accept(e,t){this.options.maxFilesize&&e.size>this.options.maxFilesize*1048576?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)?this.options.maxFiles!=null&&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)}addFile(e){e.upload={uuid: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,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===a.ADDED&&e.accepted===!0){if(e.status=a.QUEUED,this.options.autoProcessQueue)return setTimeout(()=>this.processQueue(),0)}else throw new 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===a.UPLOADING&&this.cancelUpload(e),this.files=ue(this.files,e),this.emit("removedfile",e),this.files.length===0)return this.emit("reset")}removeAllFiles(e){e==null&&(e=!1);for(let t of this.files.slice())(t.status!==a.UPLOADING||e)&&this.removeFile(t);return null}resizeImage(e,t,n,l,o){return this.createThumbnail(e,t,n,l,!0,(s,r)=>{if(r==null)return o(e);{let{resizeMimeType:d}=this.options;d==null&&(d=e.type);let u=r.toDataURL(d,this.options.resizeQuality);return(d==="image/jpeg"||d==="image/jpg")&&(u=te.restore(e.dataURL,u)),o(a.dataURItoBlob(u))}})}createThumbnail(e,t,n,l,o,s){let r=new FileReader;r.onload=()=>{if(e.dataURL=r.result,e.type==="image/svg+xml"){s!=null&&s(r.result);return}this.createThumbnailFromUrl(e,t,n,l,o,s)},r.readAsDataURL(e)}displayExistingFile(e,t,n,l,o=!0){if(this.emit("addedfile",e),this.emit("complete",e),!o)this.emit("thumbnail",e,t),n&&n();else{let s=r=>{this.emit("thumbnail",e,r),n&&n()};e.dataURL=t,this.createThumbnailFromUrl(e,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,this.options.fixOrientation,s,l)}}createThumbnailFromUrl(e,t,n,l,o,s,r){let d=document.createElement("img");return r&&(d.crossOrigin=r),o=getComputedStyle(document.body).imageOrientation=="from-image"?!1:o,d.onload=()=>{let u=E=>E(1);return typeof EXIF<"u"&&EXIF!==null&&o&&(u=E=>EXIF.getData(d,function(){return E(EXIF.getTag(this,"Orientation"))})),u(E=>{e.width=d.width,e.height=d.height;let w=this.options.resize.call(this,e,t,n,l),x=document.createElement("canvas"),b=x.getContext("2d");switch(x.width=w.trgWidth,x.height=w.trgHeight,E>4&&(x.width=w.trgHeight,x.height=w.trgWidth),E){case 2:b.translate(x.width,0),b.scale(-1,1);break;case 3:b.translate(x.width,x.height),b.rotate(Math.PI);break;case 4:b.translate(0,x.height),b.scale(1,-1);break;case 5:b.rotate(.5*Math.PI),b.scale(1,-1);break;case 6:b.rotate(.5*Math.PI),b.translate(0,-x.width);break;case 7:b.rotate(.5*Math.PI),b.translate(x.height,-x.width),b.scale(-1,1);break;case 8:b.rotate(-.5*Math.PI),b.translate(-x.height,0);break}pe(b,d,w.srcX!=null?w.srcX:0,w.srcY!=null?w.srcY:0,w.srcWidth,w.srcHeight,w.trgX!=null?w.trgX:0,w.trgY!=null?w.trgY:0,w.trgWidth,w.trgHeight);let j=x.toDataURL("image/png");if(s!=null)return s(j,x)})},s!=null&&(d.onerror=s),d.src=e.dataURL}processQueue(){let{parallelUploads:e}=this.options,t=this.getUploadingFiles().length,n=t;if(t>=e)return;let l=this.getQueuedFiles();if(l.length>0){if(this.options.uploadMultiple)return this.processFiles(l.slice(0,e-t));for(;n<e;){if(!l.length)return;this.processFile(l.shift()),n++}}}processFile(e){return this.processFiles([e])}processFiles(e){for(let t of e)t.processing=!0,t.status=a.UPLOADING,this.emit("processing",t);return this.options.uploadMultiple&&this.emit("processingmultiple",e),this.uploadFiles(e)}_getFilesWithXhr(e){return this.files.filter(t=>t.xhr===e).map(t=>t)}cancelUpload(e){if(e.status===a.UPLOADING){let t=this._getFilesWithXhr(e.xhr);for(let n of t)n.status=a.CANCELED;typeof e.xhr<"u"&&e.xhr.abort();for(let n of t)this.emit("canceled",n);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()}resolveOption(e,...t){return typeof e=="function"?e.apply(this,t):e}uploadFile(e){return this.uploadFiles([e])}uploadFiles(e){this._transformFiles(e,t=>{if(this.options.chunking){let n=t[0];e[0].upload.chunked=this.options.chunking&&(this.options.forceChunking||n.size>this.options.chunkSize),e[0].upload.totalChunkCount=Math.ceil(n.size/this.options.chunkSize)}if(e[0].upload.chunked){let n=e[0],l=t[0];n.upload.chunks=[];let o=()=>{let s=0;for(;n.upload.chunks[s]!==void 0;)s++;if(s>=n.upload.totalChunkCount)return;let r=s*this.options.chunkSize,d=Math.min(r+this.options.chunkSize,l.size),u={name:this._getParamName(0),data:l.webkitSlice?l.webkitSlice(r,d):l.slice(r,d),filename:n.upload.filename,chunkIndex:s};n.upload.chunks[s]={file:n,index:s,dataBlock:u,status:a.UPLOADING,progress:0,retries:0},this._uploadData(e,[u])};if(n.upload.finishedChunkUpload=(s,r)=>{let d=!0;s.status=a.SUCCESS,s.dataBlock=null,s.response=s.xhr.responseText,s.responseHeaders=s.xhr.getAllResponseHeaders(),s.xhr=null;for(let u=0;u<n.upload.totalChunkCount;u++){if(n.upload.chunks[u]===void 0)return o();n.upload.chunks[u].status!==a.SUCCESS&&(d=!1)}d&&this.options.chunksUploaded(n,()=>{this._finished(e,r,null)})},this.options.parallelChunkUploads)for(let s=0;s<n.upload.totalChunkCount;s++)o();else o()}else{let n=[];for(let l=0;l<e.length;l++)n[l]={name:this._getParamName(l),data:t[l],filename:e[l].upload.filename};this._uploadData(e,n)}})}_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(e,t){let n=new XMLHttpRequest;for(let u of e)u.xhr=n;e[0].upload.chunked&&(e[0].upload.chunks[t[0].chunkIndex].xhr=n);let l=this.resolveOption(this.options.method,e,t),o=this.resolveOption(this.options.url,e,t);n.open(l,o,!0),this.resolveOption(this.options.timeout,e)&&(n.timeout=this.resolveOption(this.options.timeout,e)),n.withCredentials=!!this.options.withCredentials,n.onload=u=>{this._finishedUploading(e,n,u)},n.ontimeout=()=>{this._handleUploadError(e,n,`Request timedout after ${this.options.timeout/1e3} seconds`)},n.onerror=()=>{this._handleUploadError(e,n)};let r=n.upload!=null?n.upload:n;r.onprogress=u=>this._updateFilesUploadProgress(e,n,u);let d=this.options.defaultHeaders?{Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"}:{};this.options.binaryBody&&(d["Content-Type"]=e[0].type),this.options.headers&&G(d,this.options.headers);for(let u in d){let E=d[u];E&&n.setRequestHeader(u,E)}if(this.options.binaryBody){for(let u of e)this.emit("sending",u,n);this.options.uploadMultiple&&this.emit("sendingmultiple",e,n),this.submitRequest(n,null,e)}else{let u=new FormData;if(this.options.params){let E=this.options.params;typeof E=="function"&&(E=E.call(this,e,n,e[0].upload.chunked?this._getChunk(e[0],n):null));for(let w in E){let x=E[w];if(Array.isArray(x))for(let b=0;b<x.length;b++)u.append(w,x[b]);else u.append(w,x)}}for(let E of e)this.emit("sending",E,n,u);this.options.uploadMultiple&&this.emit("sendingmultiple",e,n,u),this._addFormElementData(u);for(let E=0;E<t.length;E++){let w=t[E];u.append(w.name,w.data,w.filename)}this.submitRequest(n,u,e)}}_transformFiles(e,t){let n=[],l=0;for(let o=0;o<e.length;o++)this.options.transformFile.call(this,e[o],s=>{n[o]=s,++l===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"),l=t.getAttribute("type");if(l&&(l=l.toLowerCase()),!(typeof n>"u"||n===null))if(t.tagName==="SELECT"&&t.hasAttribute("multiple"))for(let o of t.options)o.selected&&e.append(n,o.value);else(!l||l!=="checkbox"&&l!=="radio"||t.checked)&&e.append(n,t.value)}}_updateFilesUploadProgress(e,t,n){if(e[0].upload.chunked){let l=e[0],o=this._getChunk(l,t);n?(o.progress=100*n.loaded/n.total,o.total=n.total,o.bytesSent=n.loaded):(o.progress=100,o.bytesSent=o.total),l.upload.progress=0,l.upload.total=0,l.upload.bytesSent=0;for(let s=0;s<l.upload.totalChunkCount;s++)l.upload.chunks[s]&&typeof l.upload.chunks[s].progress<"u"&&(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 for(let l of e)l.upload.total&&l.upload.bytesSent&&l.upload.bytesSent==l.upload.total||(n?(l.upload.progress=100*n.loaded/n.total,l.upload.total=n.total,l.upload.bytesSent=n.loaded):(l.upload.progress=100,l.upload.bytesSent=l.upload.total),this.emit("uploadprogress",l,l.upload.progress,l.upload.bytesSent))}_finishedUploading(e,t,n){let l;if(e[0].status!==a.CANCELED&&t.readyState===4){if(t.responseType!=="arraybuffer"&&t.responseType!=="blob"&&(l=t.responseText,t.getResponseHeader("content-type")&&~t.getResponseHeader("content-type").indexOf("application/json")))try{l=JSON.parse(l)}catch(o){n=o,l="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),l):this._finished(e,l,n):this._handleUploadError(e,t,l)}}_handleUploadError(e,t,n){if(e[0].status!==a.CANCELED){if(e[0].upload.chunked&&this.options.retryChunks){let l=this._getChunk(e[0],t);if(l.retries++<this.options.retryChunksLimit){this._uploadData(e,[l.dataBlock]);return}else console.warn("Retried this chunk too often. Giving up.")}this._errorProcessing(e,n||this.options.dictResponseError.replace("{{statusCode}}",t.status),t)}}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){const l=this._getChunk(n[0],e);e.send(l.dataBlock.data)}else e.send(n[0]);else e.send(t)}_finished(e,t,n){for(let l of e)l.status=a.SUCCESS,this.emit("success",l,t,n),this.emit("complete",l);if(this.options.uploadMultiple&&(this.emit("successmultiple",e,t,n),this.emit("completemultiple",e)),this.options.autoProcessQueue)return this.processQueue()}_errorProcessing(e,t,n){for(let l of e)l.status=a.ERROR,this.emit("error",l,t,n),this.emit("complete",l);if(this.options.uploadMultiple&&(this.emit("errormultiple",e,t,n),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(e,t){super();let n,l;if(this.element=e,this.clickableElements=[],this.listeners=[],this.files=[],typeof this.element=="string"&&(this.element=document.querySelector(this.element)),!this.element||this.element.nodeType==null)throw new Error("Invalid dropzone element.");if(this.element.dropzone)throw new Error("Dropzone already attached.");a.instances.push(this),this.element.dropzone=this;let o=(l=a.optionsForElement(this.element))!=null?l:{};if(this.options=G(!0,{},de,o,t??{}),this.options.previewTemplate=this.options.previewTemplate.replace(/\n*/g,""),this.options.forceFallback||!a.isBrowserSupported())return this.options.fallback.call(this);if(this.options.url==null&&(this.options.url=this.element.getAttribute("action")),!this.options.url)throw new Error("No URL provided.");if(this.options.acceptedFiles&&this.options.acceptedMimeTypes)throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.");if(this.options.uploadMultiple&&this.options.chunking)throw new Error("You cannot set both: uploadMultiple and chunking.");if(this.options.binaryBody&&this.options.uploadMultiple)throw new 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=s=>this.options.renameFilename.call(this,s.name,s)),typeof this.options.method=="string"&&(this.options.method=this.options.method.toUpperCase()),(n=this.getExistingFallback())&&n.parentNode&&n.parentNode.removeChild(n),this.options.previewsContainer!==!1&&(this.options.previewsContainer?this.previewsContainer=a.getElement(this.options.previewsContainer,"previewsContainer"):this.previewsContainer=this.element),this.options.clickable&&(this.options.clickable===!0?this.clickableElements=[this.element]:this.clickableElements=a.getElements(this.options.clickable,"clickable")),this.init()}}a.initClass();a.options={};a.optionsForElement=function(i){if(i.getAttribute("id"))return a.options[ce(i.getAttribute("id"))]};a.instances=[];a.forElement=function(i){if(typeof i=="string"&&(i=document.querySelector(i)),(i!=null?i.dropzone:void 0)==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 i.dropzone};a.discover=function(){let i;if(document.querySelectorAll)i=document.querySelectorAll(".dropzone");else{i=[];let e=t=>(()=>{let n=[];for(let l of t)/(^| )dropzone($| )/.test(l.className)?n.push(i.push(l)):n.push(void 0);return n})();e(document.getElementsByTagName("div")),e(document.getElementsByTagName("form"))}return(()=>{let e=[];for(let t of i)a.optionsForElement(t)!==!1?e.push(new a(t)):e.push(void 0);return e})()};a.blockedBrowsers=[/opera.*(Macintosh|Windows Phone).*version\/12/i];a.isBrowserSupported=function(){let i=!0;if(window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector)if(!("classList"in document.createElement("a")))i=!1;else{a.blacklistedBrowsers!==void 0&&(a.blockedBrowsers=a.blacklistedBrowsers);for(let e of a.blockedBrowsers)if(e.test(navigator.userAgent)){i=!1;continue}}else i=!1;return i};a.dataURItoBlob=function(i){let e=atob(i.split(",")[1]),t=i.split(",")[0].split(":")[1].split(";")[0],n=new ArrayBuffer(e.length),l=new Uint8Array(n);for(let o=0,s=e.length,r=0<=s;r?o<=s:o>=s;r?o++:o--)l[o]=e.charCodeAt(o);return new Blob([n],{type:t})};const ue=(i,e)=>i.filter(t=>t!==e).map(t=>t),ce=i=>i.replace(/[\-_](\w)/g,e=>e.charAt(1).toUpperCase());a.createElement=function(i){let e=document.createElement("div");return e.innerHTML=i,e.childNodes[0]};a.elementInside=function(i,e){if(i===e)return!0;for(;i=i.parentNode;)if(i===e)return!0;return!1};a.getElement=function(i,e){let t;if(typeof i=="string"?t=document.querySelector(i):i.nodeType!=null&&(t=i),t==null)throw new Error(`Invalid \`${e}\` option provided. Please provide a CSS selector or a plain HTML element.`);return t};a.getElements=function(i,e){let t,n;if(i instanceof Array){n=[];try{for(t of i)n.push(this.getElement(t,e))}catch{n=null}}else if(typeof i=="string"){n=[];for(t of document.querySelectorAll(i))n.push(t)}else i.nodeType!=null&&(n=[i]);if(n==null||!n.length)throw new Error(`Invalid \`${e}\` option provided. Please provide a CSS selector, a plain HTML element or a list of those.`);return n};a.confirm=function(i,e,t){if(window.confirm(i))return e();if(t!=null)return t()};a.isValidFile=function(i,e){if(!e)return!0;e=e.split(",");let t=i.type,n=t.replace(/\/.*$/,"");for(let l of e)if(l=l.trim(),l.charAt(0)==="."){if(i.name.toLowerCase().indexOf(l.toLowerCase(),i.name.length-l.length)!==-1)return!0}else if(/\/\*$/.test(l)){if(n===l.replace(/\/.*$/,""))return!0}else if(t===l)return!0;return!1};typeof jQuery<"u"&&jQuery!==null&&(jQuery.fn.dropzone=function(i){return this.each(function(){return new a(this,i)})});a.ADDED="added";a.QUEUED="queued";a.ACCEPTED=a.QUEUED;a.UPLOADING="uploading";a.PROCESSING=a.UPLOADING;a.CANCELED="canceled";a.ERROR="error";a.SUCCESS="success";let me=function(i){i.naturalWidth;let e=i.naturalHeight,t=document.createElement("canvas");t.width=1,t.height=e;let n=t.getContext("2d");n.drawImage(i,0,0);let{data:l}=n.getImageData(1,0,1,e),o=0,s=e,r=e;for(;r>o;)l[(r-1)*4+3]===0?s=r:o=r,r=s+o>>1;let d=r/e;return d===0?1:d};var pe=function(i,e,t,n,l,o,s,r,d,u){let E=me(e);return i.drawImage(e,t,n,l,o,s,r,d,u/E)};class te{static initClass(){this.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}static encode64(e){let t="",n,l,o="",s,r,d,u="",E=0;for(;n=e[E++],l=e[E++],o=e[E++],s=n>>2,r=(n&3)<<4|l>>4,d=(l&15)<<2|o>>6,u=o&63,isNaN(l)?d=u=64:isNaN(o)&&(u=64),t=t+this.KEY_STR.charAt(s)+this.KEY_STR.charAt(r)+this.KEY_STR.charAt(d)+this.KEY_STR.charAt(u),n=l=o="",s=r=d=u="",E<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,","")),l=this.slice2Segments(n),o=this.exifManipulation(t,l);return`data:image/jpeg;base64,${this.encode64(o)}`}static exifManipulation(e,t){let n=this.getExifArray(t),l=this.insertExif(e,n);return new Uint8Array(l)}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,",""),l=this.decode64(n),o=l.indexOf(255,3),s=l.slice(0,o),r=l.slice(o),d=s;return d=d.concat(t),d=d.concat(r),d}static slice2Segments(e){let t=0,n=[];for(;;){var l;if(e[t]===255&e[t+1]===218)break;if(e[t]===255&e[t+1]===216)t+=2;else{l=e[t+2]*256+e[t+3];let o=t+l+2,s=e.slice(t,o);n.push(s),t=o}if(t>e.length)break}return n}static decode64(e){let t,n,l="",o,s,r,d="",u=0,E=[];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,"");o=this.KEY_STR.indexOf(e.charAt(u++)),s=this.KEY_STR.indexOf(e.charAt(u++)),r=this.KEY_STR.indexOf(e.charAt(u++)),d=this.KEY_STR.indexOf(e.charAt(u++)),t=o<<2|s>>4,n=(s&15)<<4|r>>2,l=(r&3)<<6|d,E.push(t),r!==64&&E.push(n),d!==64&&E.push(l),t=n=l="",o=s=r=d="",u<e.length;);return E}}te.initClass();function he(i,e){return typeof i<"u"&&i!==null?e(i):void 0}function ge(i,e,t){if(typeof i<"u"&&i!==null&&typeof i[e]=="function")return t(i,e)}const fe=document.getElementById("errModal"),ye=document.getElementById("loadingModal"),ve=document.getElementById("previewModal"),Ee=document.getElementById("previewDocumentModal"),we=document.getElementById("previewImgModal"),Z={placement:"bottom-right",backdrop:"static",backdropClasses:"bg-gray-900 bg-opacity-50 backdrop-filter backdrop-blur-sm fixed inset-0 z-40",closable:!0,onHide:()=>{},onShow:()=>{},onToggle:()=>{}},c=new W(fe,Z),h=new W(ye,Z),ne=new W(ve,Z),xe=new W(Ee,Z),be=new W(we,Z);let k,C,D;var m=document.getElementById("altSubMessageModal"),p=document.getElementById("errMessageModal"),g=document.getElementById("errSubMessageModal"),Fe=document.getElementById("err-list"),y=document.getElementById("err-list-title"),I=document.getElementById("submitBtn"),R=document.getElementById("titleMessageModal"),S=[],Ie=document.getElementById("dropzoneArea"),Te=document.getElementById("dropzoneAreaCnv"),ke=document.getElementById("dropzoneAreaSingle"),ie="16199e0c9a4042f0969ea2ed591c547b",Be="https://docs.google.com/viewerng/viewer?url=",le="/storage/upload/",Q="https://pdf.hana-ci.com/storage/upload/";I&&Pe().then(function(){I.onclick=function(i){De(i)}}).catch(function(i){console.log(i),p.innerText="There was unexpected error !",g.innerText="",y.innerText="Error message",v(),f("Cannot establish connection with the server"),m.style=null,h.hide(),c.show(),setTimeout(function(){location.reload()},3e3)});if(Ie){let i=new a("#dropzoneArea",{url:"api/v1/file/upload",paramName:"file",maxFilesize:25,maxFiles:4,acceptedFiles:"application/pdf",addRemoveLinks:!0,dictDefaultMessage:"",dictRemoveFile:"Remove",timeout:5e3,previewTemplate:'<div class="dz-file-preview dz-preview dz-processing dz-success dz-complete z-0"><div class="flex flex-col items-center justify-center"><div class="mt-2 flex items-center justify-center lg:h-[200px] lg:w-[150px]"><img id="imgThumbnail" class="dz-image-thumbnail h-48 w-32 object-scale-down" src="/assets/icons/placeholder_pdf.svg"></div><div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div><div class="dz-success-mark"><svg class="w-4 h-4 text-ac" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8.5 11.5 11 14l4-4m6 2a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/></svg></div><div class="dz-error-mark"><svg class="w-4 h-4 text-rt1" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"></path></svg></div><div class="dz-details -mt-8"><div class="dz-filename font-sm font-magistral text-lt1"><span data-dz-name></span></div></div><div class="dz-error-message mt-2 ms-1 lg:ms-4"><span data-dz-errormessage></span></div><div class="flex flex-row mx-auto"><button type="button" id="prvBtn" class="prvBtn mt-2 mx-4 p-2 bg-pc2 text-lt rounded-lg cursor-pointer w-8 h-8 text-center flex items-center justify-center"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="w-6 h-6 text-white"><path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z" /><path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" /></svg></button><button type="button" id="rmvBtn" class="rmvBtn mt-2 mx-4 p-2 bg-rt1 text-lt rounded-lg cursor-pointer w-8 h-8 text-center flex items-center justify-center" data-dz-remove=""><svg class="w-6 h-6 text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 7h14m-9 3v8m4-8v8M10 3h4a1 1 0 0 1 1 1v3H9V4a1 1 0 0 1 1-1ZM6 7h12v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V7Z"></path></svg></button></div></div></div>',clickable:!0,init:function(){document.getElementById("dropzoneUploadInit").addEventListener("click",function(){i.hiddenFileInput.click()}),document.getElementById("dropzoneUploadExt").addEventListener("click",function(){i.files.length>=4?document.getElementById("dropzoneUiExt").classList.add("hidden"):(i.hiddenFileInput.click(),document.getElementById("dropzoneUiExt").classList.remove("hidden"))}),this.on("addedfile",function(e){var t=document.getElementsByClassName("dz-remove"),n=document.querySelectorAll('[data-dz-name=""]');document.querySelector(".dz-default.dz-message").style.display="none",document.getElementById("dropzoneUiInit").style.display="none";for(var l=0;l<t.length;l++)t[l].style.display="none";if(n.forEach(function(r){r.style.borderColor="transparent",r.style.backgroundColor="transparent"}),e.type==="application/pdf"){se(e),i.files.length>=4?(document.getElementById("dropzoneUiExt").classList.add("hidden"),i.hiddenFileInput.setAttribute("disabled","disabled")):(document.getElementById("dropzoneUiExt").classList.remove("hidden"),i.hiddenFileInput.removeAttribute("disabled","disabled")),I.style.backgroundColor="#4DAAAA",I.style.borderColor="transparent";var o=document.querySelectorAll(".prvBtn"),s=document.querySelectorAll(".rmvBtn");o.forEach(function(r){r.addEventListener("click",function(d){var u=d.target.closest(".dz-file-preview"),E=u.querySelector(".dz-filename span"),w=Y(E.innerText),x=Q+w,b=new AdobeDC.View({clientId:ie,divId:"adobe-dc-view"});b.previewFile({content:{location:{url:x}},metaData:{fileName:w}},{embedMode:"SIZED_CONTAINER",focusOnRendering:!0,showDownloadPDF:!1}),ne.show()})}),s.forEach(function(r){r.addEventListener("click",function(){var d=document.getElementById("adobe-dc-view");d&&(d.innerHTML='<script src="https://acrobatservices.adobe.com/view-sdk/viewer.js"><\/script>'),i.files.length>3?document.getElementById("dropzoneUiExt").classList.add("hidden"):i.files.length>0&&i.files.length<4&&(i.hiddenFileInput.removeAttribute("disabled","disabled"),document.getElementById("dropzoneUiExt").classList.remove("hidden"))})})}}),this.on("removedfile",function(e){if(i.files.length===0&&(document.getElementById("dropzoneUiInit").style.display=null,document.getElementById("dropzoneUiExt").classList.add("hidden"),I.style.backgroundColor=null,I.style.borderColor="#E0E4E5",I.style.color=null),e){const t=document.querySelector('input[name="_token"]').value,n="/storage/upload/"+e.name;S=S.filter(l=>!e.name.includes(l)),fetch("api/v1/file/remove",{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-TOKEN":t,file:n},body:JSON.stringify({file:n})}).then(l=>l.json()).then(l=>{console.log(l)}).catch(l=>{console.log("Error: Failed to remove file: ",l)})}else console.log("Error: File object is null or undefined.")}),this.on("success",function(e){console.log(e);var t=e.name;S.push(t)}),this.on("maxfilesexceeded",function(e){p.innerText="PDF file can not be processed !",g.innerText="",y.innerText="Error message",v(),f("Maximum upload files reached"),m.style=null,c.show(),i.removeFile(e)})}});i||I&&(document.getElementById("compress")!==null||document.getElementById("cnvFrPDF")!==null)&&(console.log("Dropzone instance are not ready"),p.innerText="There was unexpected error !",g.innerText="",y.innerText="Error message",v(),f("Cannot establish connection with the server"),m.style=null,h.hide(),c.show())}if(Te){let i=new a("#dropzoneAreaCnv",{url:"api/v1/file/upload",paramName:"file",maxFilesize:25,maxFiles:4,acceptedFiles:".xlsx, .xls, .ppt, .pptx, .docx, doc, image/*",addRemoveLinks:!0,dictDefaultMessage:"",dictRemoveFile:"Remove",timeout:5e3,previewTemplate:'<div class="dz-file-preview dz-preview dz-processing dz-success dz-complete z-0"><div class="flex flex-col items-center justify-center"><div class="mt-2 flex items-center justify-center lg:h-[200px] lg:w-[150px]"><img id="imgThumbnail" class="dz-image-thumbnail h-48 w-32 object-scale-down" src="/assets/icons/placeholder_pdf.svg"></div><div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div><div class="dz-success-mark"><svg class="w-4 h-4 text-ac" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8.5 11.5 11 14l4-4m6 2a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/></svg></div><div class="dz-error-mark"><svg class="w-4 h-4 text-rt1" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"></path></svg></div><div class="dz-details -mt-8"><div class="dz-filename font-sm font-magistral text-lt1"><span data-dz-name></span></div></div><div class="dz-error-message mt-2 ms-1 lg:ms-4"><span data-dz-errormessage></span></div><div class="flex flex-row mx-auto"><button type="button" id="prvBtn" class="prvBtn mt-2 mx-4 p-2 bg-pc2 text-lt rounded-lg cursor-pointer w-8 h-8 text-center flex items-center justify-center"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="w-6 h-6 text-white"><path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z" /><path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" /></svg></button><button type="button" id="rmvBtn" class="rmvBtn mt-2 mx-4 p-2 bg-rt1 text-lt rounded-lg cursor-pointer w-8 h-8 text-center flex items-center justify-center" data-dz-remove=""><svg class="w-6 h-6 text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 7h14m-9 3v8m4-8v8M10 3h4a1 1 0 0 1 1 1v3H9V4a1 1 0 0 1 1-1ZM6 7h12v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V7Z"></path></svg></button></div></div></div>',clickable:!0,init:function(){document.getElementById("dropzoneUploadInit").addEventListener("click",function(){i.hiddenFileInput.click()}),document.getElementById("dropzoneUploadExt").addEventListener("click",function(){i.files.length>=4?document.getElementById("dropzoneUiExt").classList.add("hidden"):(i.hiddenFileInput.click(),document.getElementById("dropzoneUiExt").classList.remove("hidden"))}),this.on("addedfile",function(e){var t=document.getElementsByClassName("dz-remove"),n=document.querySelectorAll('[data-dz-name=""]');document.querySelector(".dz-default.dz-message").style.display="none",document.getElementById("dropzoneUiInit").style.display="none";for(var l=0;l<t.length;l++)t[l].style.display="none";n.forEach(function(r){r.style.borderColor="transparent",r.style.backgroundColor="transparent"}),i.files.length>=4?(document.getElementById("dropzoneUiExt").classList.add("hidden"),i.hiddenFileInput.setAttribute("disabled","disabled")):(I.style.backgroundColor="#4DAAAA",I.style.borderColor="transparent",document.getElementById("dropzoneUiExt").classList.remove("hidden"),i.hiddenFileInput.removeAttribute("disabled","disabled"));var o=document.querySelectorAll(".prvBtn"),s=document.querySelectorAll(".rmvBtn");o.forEach(function(r){r.addEventListener("click",function(d){var u=d.target.closest(".dz-preview"),E=u.querySelector(".dz-filename span"),w=Y(E.innerText),x=Q+w,b=Be+Q+w+"&embedded=true";e.type.startsWith("image/")?(document.getElementById("imgPrv").src=x,be.show()):(document.getElementById("iFrame").src=b,xe.show())})}),s.forEach(function(r){r.addEventListener("click",function(){document.getElementById("iFrame").src=null,i.files.length>3?document.getElementById("dropzoneUiExt").classList.add("hidden"):i.files.length>0&&i.files.length<4&&(i.hiddenFileInput.removeAttribute("disabled","disabled"),document.getElementById("dropzoneUiExt").classList.remove("hidden"))})})}),this.on("removedfile",function(e){if(i.files.length===0&&(document.getElementById("dropzoneUiInit").style.display=null,document.getElementById("dropzoneUiExt").classList.add("hidden"),I.style.backgroundColor=null,I.style.borderColor="#E0E4E5",I.style.color=null),e){const t=document.querySelector('input[name="_token"]').value,n=le+e.name;S=S.filter(l=>!e.name.includes(l)),fetch("api/v1/file/remove",{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-TOKEN":t,file:n},body:JSON.stringify({file:n})}).then(l=>l.json()).then(l=>{console.log(l)}).catch(l=>{console.log("Error: Failed to remove file: ",l)})}else console.log("Error: File object is null or undefined.")}),this.on("success",function(e,t){var n=t.fileName;S.push(n),e.type.startsWith("image/")||ze(e.name).then(function(l){e.previewElement.querySelector(".dz-image-thumbnail").src=l}).catch(function(l){e.previewElement.querySelector(".dz-image-thumbnail").src="/assets/icons/placeholder_pptx.svg",console.log(l.message)})}),this.on("thumbnail",function(e){e.type.startsWith("image/")&&(e.previewElement.querySelector(".dz-image-thumbnail").src=e.dataURL)}),this.on("maxfilesexceeded",function(e){p.innerText="PDF file can not be processed !",g.innerText="",y.innerText="Error message",v(),f("Maximum upload files reached"),m.style=null,c.show(),i.removeFile(e)})}});i||I&&document.getElementById("cnvToPDF")!==null&&(console.log("Dropzone instance are not ready"),p.innerText="There was unexpected error !",g.innerText="",y.innerText="Error message",v(),f("Cannot establish connection with the server"),m.style=null,h.hide(),c.show())}if(ke){let i=new a("#dropzoneAreaSingle",{url:"api/v1/file/upload",paramName:"file",maxFilesize:25,maxFiles:1,acceptedFiles:"application/pdf",addRemoveLinks:!0,dictDefaultMessage:"",dictRemoveFile:"Remove",timeout:5e3,previewTemplate:'<div class="dz-file-preview dz-preview dz-processing dz-success dz-complete z-0"><div class="flex flex-col items-center justify-center"><div class="mt-2 flex items-center justify-center lg:h-[200px] lg:w-[150px]"><img id="imgThumbnail" class="dz-image-thumbnail h-48 w-32 object-scale-down" src="/assets/icons/placeholder_pdf.svg"></div><div class="dz-progress"><span class="dz-upload" data-dz-uploadprogress></span></div><div class="dz-success-mark"><svg class="w-4 h-4 text-ac" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8.5 11.5 11 14l4-4m6 2a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"/></svg></div><div class="dz-error-mark"><svg class="w-4 h-4 text-rt1" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="m9.75 9.75 4.5 4.5m0-4.5-4.5 4.5M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"></path></svg></div><div class="dz-details -mt-8"><div class="dz-filename font-sm font-magistral text-lt1"><span data-dz-name></span></div></div><div class="dz-error-message mt-2 ms-1 lg:ms-4"><span data-dz-errormessage></span></div><div class="flex flex-row mx-auto"><button type="button" id="prvBtn" class="prvBtn mt-2 mx-4 p-2 bg-pc2 text-lt rounded-lg cursor-pointer w-8 h-8 text-center flex items-center justify-center"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" class="w-6 h-6 text-white"><path stroke-linecap="round" stroke-linejoin="round" d="M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z" /><path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" /></svg></button><button type="button" id="rmvBtn" class="rmvBtn mt-2 mx-4 p-2 bg-rt1 text-lt rounded-lg cursor-pointer w-8 h-8 text-center flex items-center justify-center" data-dz-remove=""><svg class="w-6 h-6 text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 7h14m-9 3v8m4-8v8M10 3h4a1 1 0 0 1 1 1v3H9V4a1 1 0 0 1 1-1ZM6 7h12v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V7Z"></path></svg></button></div></div></div>',clickable:!0,init:function(){document.getElementById("dropzoneUploadInit").addEventListener("click",function(){i.hiddenFileInput.click()}),document.getElementById("dropzoneUploadExt").addEventListener("click",function(){i.files.length>=1?document.getElementById("dropzoneUiExt").classList.add("hidden"):(i.hiddenFileInput.click(),document.getElementById("dropzoneUiExt").classList.remove("hidden"))}),this.on("addedfile",function(e){var t=document.getElementsByClassName("dz-remove"),n=document.querySelectorAll('[data-dz-name=""]');document.querySelector(".dz-default.dz-message").style.display="none",document.getElementById("dropzoneUiInit").style.display="none";for(var l=0;l<t.length;l++)t[l].style.display="none";if(n.forEach(function(r){r.style.borderColor="transparent",r.style.backgroundColor="transparent"}),e.type==="application/pdf"){se(e),i.files.length>=1?(document.getElementById("dropzoneUiExt").classList.add("hidden"),i.hiddenFileInput.setAttribute("disabled","disabled")):(document.getElementById("dropzoneUiExt").classList.remove("hidden"),i.hiddenFileInput.removeAttribute("disabled","disabled")),I.style.backgroundColor="#4DAAAA",I.style.color="#E0E4E5";var o=document.querySelectorAll(".prvBtn"),s=document.querySelectorAll(".rmvBtn");o.forEach(function(r){r.addEventListener("click",function(d){var u=d.target.closest(".dz-file-preview"),E=u.querySelector(".dz-filename span"),w=Y(E.innerText),x=Q+w,b=new AdobeDC.View({clientId:ie,divId:"adobe-dc-view"});b.previewFile({content:{location:{url:x}},metaData:{fileName:w}},{embedMode:"SIZED_CONTAINER",focusOnRendering:!0,showDownloadPDF:!1}),ne.show()})}),s.forEach(function(r){r.addEventListener("click",function(){var d=document.getElementById("adobe-dc-view");d&&(d.innerHTML='<script src="https://acrobatservices.adobe.com/view-sdk/viewer.js"><\/script>'),i.files.length>=1?(i.hiddenFileInput.removeAttribute("disabled","disabled"),document.getElementById("dropzoneUiExt").classList.remove("hidden")):document.getElementById("dropzoneUiExt").classList.add("hidden")})})}}),this.on("removedfile",function(e){if(i.files.length===0&&(document.getElementById("dropzoneUiInit").style.display=null,document.getElementById("dropzoneUiExt").classList.add("hidden"),I.style.backgroundColor=null,I.style.color=null),e){const t=document.querySelector('input[name="_token"]').value,n=le+e.name;S=S.filter(l=>!e.name.includes(l)),fetch("api/v1/file/remove",{method:"POST",headers:{"Content-Type":"application/json","X-CSRF-TOKEN":t,file:n},body:JSON.stringify({file:n})}).then(l=>l.json()).then(l=>{console.log(l)}).catch(l=>{console.log("Error: Failed to remove file: ",l)})}else console.log("Error: File object is null or undefined.")}),this.on("success",function(e){console.log(e);var t=e.name;S.push(t)}),this.on("maxfilesexceeded",function(e){p.innerText="PDF file can not be processed !",g.innerText="",y.innerText="Error message",v(),f("Maximum upload files reached"),m.style=null,c.show(),i.removeFile(e)})}});i||I&&(document.getElementById("merge")!==null||document.getElementById("split")!==null||document.getElementById("watermark")!==null)&&(console.log("Dropzone instance are not ready"),p.innerText="There was unexpected error !",g.innerText="",y.innerText="Error message",v(),f("Cannot establish connection with the server"),m.style=null,h.hide(),c.show())}function se(i){const e=new FileReader;e.onload=function(){const t=new Uint8Array(this.result);pdfjsLib.getDocument(t).promise.then(function(n){n.getPage(1).then(function(l){const o=document.createElement("canvas"),s=o.getContext("2d"),r=l.getViewport({scale:.5});o.width=r.width,o.height=r.height;const d={canvasContext:s,viewport:r};l.render(d).promise.then(function(){const u=o.toDataURL("image/jpeg"),w=i.previewElement.querySelector(".dz-image-thumbnail");w.src=u})})})},e.readAsArrayBuffer(i)}function P(){return S}function z(i,e){var t=P();Ce(t,i,e).then(function(){h.hide()}).catch(function(n){h.hide(),console.log(n)})}function ze(i){return new Promise(function(e,t){var n=new XMLHttpRequest,l=new FormData,o=document.querySelector('input[name="_token"]').value;console.log(i),l.append("_token",o),l.append("file",i),n.open("POST","api/v1/file/thumbnail",!0),n.onreadystatechange=function(){if(n.readyState==4)if(n.status==200){var s=JSON.parse(n.responseText);s.status==200?e(s.res):t(new Error("API response error: "+s.message))}else t(new Error("API response error! Status: "+n.status))},n.send(l)})}function Ce(i,e,t){return new Promise(function(n,l){var o=new XMLHttpRequest,s=new FormData,r=document.querySelector('input[name="_token"]').value;if(s.append("_token",r),e=="compress"){var d=document.querySelector('input[name="compMethod"]:checked').value;s.append("compMethod",d)}else if(e=="convert"){if(document.getElementById("cnvToPDF")!==null){var u="pdf";s.append("extImage","false")}else if(document.getElementById("cnvFrPDF")!==null){var u=document.querySelector('input[name="convertType"]:checked').value,E=document.getElementById("extImage");E.checked?s.append("extImage","true"):s.append("extImage","false")}s.append("convertType",u)}else if(e=="split"){var w=document.getElementById("customPageSplit").value,x=document.getElementById("customPageDelete").value,b=document.getElementById("fromPage").value,j=document.getElementById("toPage").value,N=document.getElementById("mergePDF").checked;s.append("action",t),s.append("fromPage",b),s.append("toPage",j),s.append("mergePDF",N.toString()),s.append("customPageSplit",w),s.append("customPageDelete",x)}else if(e=="watermark"){if(document.getElementById("firstRadio").checked==!0){let F,T;var U=document.getElementById("wm_file_input").files[0],q=document.getElementById("watermarkPageImage").value,H=document.getElementById("watermarkFontTransparency").value,B=document.getElementById("isMosaicImage").checked;document.getElementById("wmRadioImageLayoutStyleA").checked==!0?F=document.getElementById("wmRadioImageLayoutStyleA").value:document.getElementById("wmRadioImageLayoutStyleB").checked==!0?F=document.getElementById("wmRadioImageLayoutStyleB").value:F=document.getElementById("wmRadioImageLayoutStyleA").value,document.getElementById("wmRadioImageRotationA").checked==!0?T=document.getElementById("wmRadioImageRotationA").value:document.getElementById("wmRadioImageRotationB").checked==!0?T=document.getElementById("wmRadioImageRotationB").value:document.getElementById("wmRadioImageRotationC").checked==!0?T=document.getElementById("wmRadioImageRotationC").value:document.getElementById("wmRadioImageRotationD").checked==!0?T=document.getElementById("wmRadioImageRotationD").value:T=document.getElementById("wmRadioImageRotationA").value,s.append("action",t),s.append("imgFile",U),s.append("wmFontColor",""),s.append("wmFontSize",""),s.append("wmFontStyle",""),s.append("wmFontFamily",""),s.append("wmLayoutStyle",F),s.append("wmRotation",T),s.append("wmPage",q),s.append("wmText",""),s.append("wmTransparency",H),s.append("wmMosaic",B.toString())}else if(document.getElementById("secondRadio").checked==!0){let F,T,X,O;var L=document.getElementById("watermarkFontSize").value,M=document.getElementById("watermarkFontColor").value,q=document.getElementById("watermarkPageText").value,A=document.getElementById("watermarkText").value,H=document.getElementById("watermarkFontTransparency").value,B=document.getElementById("isMosaicText").checked;document.getElementById("wmRadioFontFamilyA").checked==!0?F=document.getElementById("wmRadioFontFamilyA").value:document.getElementById("wmRadioFontFamilyB").checked==!0?F=document.getElementById("wmRadioFontFamilyB").value:document.getElementById("wmRadioFontFamilyC").checked==!0?F=document.getElementById("wmRadioFontFamilyC").value:document.getElementById("wmRadioFontFamilyD").checked==!0?F=document.getElementById("wmRadioFontFamilyD").value:document.getElementById("wmRadioFontFamilyE").checked==!0?F=document.getElementById("wmRadioFontFamilyE").value:document.getElementById("wmRadioFontFamilyF").checked==!0?F=document.getElementById("wmRadioFontFamilyF").value:F=document.getElementById("wmRadioFontFamilyA").value,document.getElementById("wmRadioFontStyleA").checked==!0?T=document.getElementById("wmRadioFontStyleA").value:document.getElementById("wmRadioFontStyleB").checked==!0?T=document.getElementById("wmRadioFontStyleB").value:document.getElementById("wmRadioFontStyleC").checked==!0?T=document.getElementById("wmRadioFontStyleC").value:T=document.getElementById("wmRadioFontStyleA").value,document.getElementById("wmRadioLayoutStyleA").checked==!0?X=document.getElementById("wmRadioLayoutStyleA").value:document.getElementById("wmRadioLayoutStyleB").checked==!0?X=document.getElementById("wmRadioLayoutStyleB").value:X=document.getElementById("wmRadioLayoutStyleA").value,document.getElementById("wmRadioRotationA").checked==!0?O=document.getElementById("wmRadioRotationA").value:document.getElementById("wmRadioRotationB").checked==!0?O=document.getElementById("wmRadioRotationB").value:document.getElementById("wmRadioRotationC").checked==!0?O=document.getElementById("wmRadioRotationC").value:document.getElementById("wmRadioRotationD").checked==!0?O=document.getElementById("wmRadioRotationD").value:O=document.getElementById("wmRadioRotationA").value,s.append("action",t),s.append("imgFile",""),s.append("wmFontColor",M),s.append("wmFontSize",L),s.append("wmFontStyle",T),s.append("wmFontFamily",F),s.append("wmLayoutStyle",X),s.append("wmRotation",O),s.append("wmPage",q),s.append("wmText",A),s.append("wmTransparency",H),s.append("wmMosaic",B.toString())}}else if(e=="html"){var _=document.getElementById("urlToPDF").value;s.append("urlToPDF",_)}e!=="html"&&(i.length>1?s.append("batch","true"):s.append("batch","false"),i.forEach(function(F,T){s.append("file["+T+"]",F)})),o.open("POST","api/v2/proc/"+e,!0),o.onreadystatechange=function(){if(o.readyState==4)if(o.status==200){var F=JSON.parse(o.responseText);F.status==200&&(e=="compress"?(J(F.res,F.fileName),document.getElementById("alert-scs").classList.remove("hidden","opacity-0"),document.getElementById("alert-err").classList.add("hidden","opacity-0"),document.getElementById("scsMsgTitle").innerText="HANA PDF Process completed !",document.getElementById("scsMsgResult").innerHTML=`

Check warning

Code scanning / CodeQL

DOM text reinterpreted as HTML

[DOM text](1) is reinterpreted as HTML without escaping meta-characters.
</svg>
</div>
</div>
`;let ae={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(i,e,t){if(t)return{dzuuid:t.file.upload.uuid,dzchunkindex:t.index,dztotalfilesize:t.file.size,dzchunksize:this.options.chunkSize,dztotalchunkcount:t.file.upload.totalChunkCount,dzchunkbyteoffset:t.index*this.options.chunkSize}},accept(i,e){return e()},chunksUploaded:function(i,e){e()},binaryBody:!1,fallback(){let i;this.element.className=`${this.element.className} dz-browser-not-supported`;for(let t of this.element.getElementsByTagName("div"))if(/(^| )dz-message($| )/.test(t.className)){i=t,t.className="dz-message";break}i||(i=a.createElement('<div class="dz-message"><span></span></div>'),this.element.appendChild(i));let e=i.getElementsByTagName("span")[0];return e&&(e.textContent!=null?e.textContent=this.options.dictFallbackMessage:e.innerText!=null&&(e.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize(i,e,t,n){let l={srcX:0,srcY:0,srcWidth:i.width,srcHeight:i.height},o=i.width/i.height;e==null&&t==null?(e=l.srcWidth,t=l.srcHeight):e==null?e=t*o:t==null&&(t=e/o),e=Math.min(e,l.srcWidth),t=Math.min(t,l.srcHeight);let s=e/t;if(l.srcWidth>e||l.srcHeight>t)if(n==="crop")o>s?(l.srcHeight=i.height,l.srcWidth=l.srcHeight*s):(l.srcWidth=i.width,l.srcHeight=l.srcWidth/s);else if(n==="contain")o>s?t=e/o:e=t*o;else throw new Error(`Unknown resizeMethod '${n}'`);return l.srcX=(i.width-l.srcWidth)/2,l.srcY=(i.height-l.srcHeight)/2,l.trgWidth=e,l.trgHeight=t,l},transformFile(i,e){return(this.options.resizeWidth||this.options.resizeHeight)&&i.type.match(/image.*/)?this.resizeImage(i,this.options.resizeWidth,this.options.resizeHeight,this.options.resizeMethod,e):e(i)},previewTemplate:re(ee),drop(i){return this.element.classList.remove("dz-drag-hover")},dragstart(i){},dragend(i){return this.element.classList.remove("dz-drag-hover")},dragenter(i){return this.element.classList.add("dz-drag-hover")},dragover(i){return this.element.classList.add("dz-drag-hover")},dragleave(i){return this.element.classList.remove("dz-drag-hover")},paste(i){},reset(){return this.element.classList.remove("dz-started")},addedfile(i){if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer&&!this.options.disablePreviews){i.previewElement=a.createElement(this.options.previewTemplate.trim()),i.previewTemplate=i.previewElement,this.previewsContainer.appendChild(i.previewElement);for(var e of i.previewElement.querySelectorAll("[data-dz-name]"))e.textContent=i.name;for(e of i.previewElement.querySelectorAll("[data-dz-size]"))e.innerHTML=this.filesize(i.size);this.options.addRemoveLinks&&(i._removeLink=a.createElement(`<a class="dz-remove" href="javascript:undefined;" data-dz-remove>${this.options.dictRemoveFile}</a>`),i.previewElement.appendChild(i._removeLink));let t=n=>(n.preventDefault(),n.stopPropagation(),i.status===a.UPLOADING?a.confirm(this.options.dictCancelUploadConfirmation,()=>this.removeFile(i)):this.options.dictRemoveFileConfirmation?a.confirm(this.options.dictRemoveFileConfirmation,()=>this.removeFile(i)):this.removeFile(i));for(let n of i.previewElement.querySelectorAll("[data-dz-remove]"))n.addEventListener("click",t)}},removedfile(i){return i.previewElement!=null&&i.previewElement.parentNode!=null&&i.previewElement.parentNode.removeChild(i.previewElement),this._updateMaxFilesReachedClass()},thumbnail(i,e){if(i.previewElement){i.previewElement.classList.remove("dz-file-preview");for(let t of i.previewElement.querySelectorAll("[data-dz-thumbnail]"))t.alt=i.name,t.src=e;return setTimeout(()=>i.previewElement.classList.add("dz-image-preview"),1)}},error(i,e){if(i.previewElement){i.previewElement.classList.add("dz-error"),typeof e!="string"&&e.error&&(e=e.error);for(let t of i.previewElement.querySelectorAll("[data-dz-errormessage]"))t.textContent=e}},errormultiple(){},processing(i){if(i.previewElement&&(i.previewElement.classList.add("dz-processing"),i._removeLink))return i._removeLink.innerHTML=this.options.dictCancelUpload},processingmultiple(){},uploadprogress(i,e,t){if(i.previewElement)for(let n of i.previewElement.querySelectorAll("[data-dz-uploadprogress]"))n.nodeName==="PROGRESS"?n.value=e:n.style.width=`${e}%`},totaluploadprogress(){},sending(){},sendingmultiple(){},success(i){if(i.previewElement)return i.previewElement.classList.add("dz-success")},successmultiple(){},canceled(i){return this.emit("error",i,this.options.dictUploadCanceled)},canceledmultiple(){},complete(i){if(i._removeLink&&(i._removeLink.innerHTML=this.options.dictRemoveFile),i.previewElement)return i.previewElement.classList.add("dz-complete")},completemultiple(){},maxfilesexceeded(){},maxfilesreached(){},queuecomplete(){},addedfiles(){}};var de=ae;class a extends K{static initClass(){this.prototype.Emitter=K,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._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(t=>t)}getQueuedFiles(){return this.getFilesWithStatus(a.QUEUED)}getUploadingFiles(){return this.getFilesWithStatus(a.UPLOADING)}getAddedFiles(){return this.getFilesWithStatus(a.ADDED)}getActiveFiles(){return this.files.filter(e=>e.status===a.UPLOADING||e.status===a.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(a.createElement(`<div class="dz-default dz-message"><button class="dz-button" type="button">${this.options.dictDefaultMessage}</button></div>`)),this.clickableElements.length){let n=()=>{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",a.getElement(this.options.hiddenInputContainer,"hiddenInputContainer").appendChild(this.hiddenFileInput),this.hiddenFileInput.addEventListener("change",()=>{let{files:l}=this.hiddenFileInput;if(l.length)for(let o of l)this.addFile(o);this.emit("addedfiles",l),n()})};n()}this.URL=window.URL!==null?window.URL:window.webkitURL;for(let n of this.events)this.on(n,this.options[n]);this.on("uploadprogress",()=>this.updateTotalUploadProgress()),this.on("removedfile",()=>this.updateTotalUploadProgress()),this.on("canceled",n=>this.emit("complete",n)),this.on("complete",n=>{if(this.getAddedFiles().length===0&&this.getUploadingFiles().length===0&&this.getQueuedFiles().length===0)return setTimeout(()=>this.emit("queuecomplete"),0)});const e=function(n){if(n.dataTransfer.types){for(var l=0;l<n.dataTransfer.types.length;l++)if(n.dataTransfer.types[l]==="Files")return!0}return!1};let t=function(n){if(e(n))return n.stopPropagation(),n.preventDefault?n.preventDefault():n.returnValue=!1};return this.listeners=[{element:this.element,events:{dragstart:n=>this.emit("dragstart",n),dragenter:n=>(t(n),this.emit("dragenter",n)),dragover:n=>{let l;try{l=n.dataTransfer.effectAllowed}catch{}return n.dataTransfer.dropEffect=l==="move"||l==="linkMove"?"move":"copy",t(n),this.emit("dragover",n)},dragleave:n=>this.emit("dragleave",n),drop:n=>(t(n),this.drop(n)),dragend:n=>this.emit("dragend",n)}}],this.clickableElements.forEach(n=>this.listeners.push({element:n,events:{click:l=>((n!==this.element||l.target===this.element||a.elementInside(l.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,a.instances.splice(a.instances.indexOf(this),1)}updateTotalUploadProgress(){let e,t=0,n=0;if(this.getActiveFiles().length){for(let o of this.getActiveFiles())t+=o.upload.bytesSent,n+=o.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"?e.name:this.options.renameFile(e)}getFallbackForm(){let e,t;if(e=this.getExistingFallback())return e;let n='<div class="dz-fallback">';this.options.dictFallbackText&&(n+=`<p>${this.options.dictFallbackText}</p>`),n+=`<input type="file" name="${this._getParamName(0)}" ${this.options.uploadMultiple?'multiple="multiple"':void 0} /><input type="submit" value="Upload!"></div>`;let l=a.createElement(n);return this.element.tagName!=="FORM"?(t=a.createElement(`<form action="${this.options.url}" enctype="multipart/form-data" method="${this.options.method}"></form>`),t.appendChild(l)):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),t??l}getExistingFallback(){let e=function(n){for(let l of n)if(/(^| )fallback($| )/.test(l.className))return l};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 l=e.events[n];t.push(e.element.addEventListener(n,l,!1))}return t})())}removeEventListeners(){return this.listeners.map(e=>(()=>{let t=[];for(let n in e.events){let l=e.events[n];t.push(e.element.removeEventListener(n,l,!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 l=["tb","gb","mb","kb","b"];for(let o=0;o<l.length;o++){let s=l[o],r=Math.pow(this.options.filesizeBase,4-o)/10;if(e>=r){t=e/Math.pow(this.options.filesizeBase,4-o),n=s;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(he(e!=null?e.clipboardData:void 0,n=>n.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 l of e){var n;l.webkitGetAsEntry!=null&&(n=l.webkitGetAsEntry())?n.isFile?t.push(this.addFile(l.getAsFile())):n.isDirectory?t.push(this._addFilesFromDirectory(n,n.name)):t.push(void 0):l.getAsFile!=null&&(l.kind==null||l.kind==="file")?t.push(this.addFile(l.getAsFile())):t.push(void 0)}return t})()}_addFilesFromDirectory(e,t){let n=e.createReader(),l=s=>ge(console,"log",r=>r.log(s));var o=()=>n.readEntries(s=>{if(s.length>0){for(let r of s)r.isFile?r.file(d=>{if(!(this.options.ignoreHiddenFiles&&d.name.substring(0,1)==="."))return d.fullPath=`${t}/${d.name}`,this.addFile(d)}):r.isDirectory&&this._addFilesFromDirectory(r,`${t}/${r.name}`);o()}return null},l);return o()}accept(e,t){this.options.maxFilesize&&e.size>this.options.maxFilesize*1048576?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)?this.options.maxFiles!=null&&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)}addFile(e){e.upload={uuid: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,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===a.ADDED&&e.accepted===!0){if(e.status=a.QUEUED,this.options.autoProcessQueue)return setTimeout(()=>this.processQueue(),0)}else throw new 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===a.UPLOADING&&this.cancelUpload(e),this.files=ue(this.files,e),this.emit("removedfile",e),this.files.length===0)return this.emit("reset")}removeAllFiles(e){e==null&&(e=!1);for(let t of this.files.slice())(t.status!==a.UPLOADING||e)&&this.removeFile(t);return null}resizeImage(e,t,n,l,o){return this.createThumbnail(e,t,n,l,!0,(s,r)=>{if(r==null)return o(e);{let{resizeMimeType:d}=this.options;d==null&&(d=e.type);let u=r.toDataURL(d,this.options.resizeQuality);return(d==="image/jpeg"||d==="image/jpg")&&(u=te.restore(e.dataURL,u)),o(a.dataURItoBlob(u))}})}createThumbnail(e,t,n,l,o,s){let r=new FileReader;r.onload=()=>{if(e.dataURL=r.result,e.type==="image/svg+xml"){s!=null&&s(r.result);return}this.createThumbnailFromUrl(e,t,n,l,o,s)},r.readAsDataURL(e)}displayExistingFile(e,t,n,l,o=!0){if(this.emit("addedfile",e),this.emit("complete",e),!o)this.emit("thumbnail",e,t),n&&n();else{let s=r=>{this.emit("thumbnail",e,r),n&&n()};e.dataURL=t,this.createThumbnailFromUrl(e,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,this.options.fixOrientation,s,l)}}createThumbnailFromUrl(e,t,n,l,o,s,r){let d=document.createElement("img");return r&&(d.crossOrigin=r),o=getComputedStyle(document.body).imageOrientation=="from-image"?!1:o,d.onload=()=>{let u=E=>E(1);return typeof EXIF<"u"&&EXIF!==null&&o&&(u=E=>EXIF.getData(d,function(){return E(EXIF.getTag(this,"Orientation"))})),u(E=>{e.width=d.width,e.height=d.height;let w=this.options.resize.call(this,e,t,n,l),x=document.createElement("canvas"),b=x.getContext("2d");switch(x.width=w.trgWidth,x.height=w.trgHeight,E>4&&(x.width=w.trgHeight,x.height=w.trgWidth),E){case 2:b.translate(x.width,0),b.scale(-1,1);break;case 3:b.translate(x.width,x.height),b.rotate(Math.PI);break;case 4:b.translate(0,x.height),b.scale(1,-1);break;case 5:b.rotate(.5*Math.PI),b.scale(1,-1);break;case 6:b.rotate(.5*Math.PI),b.translate(0,-x.width);break;case 7:b.rotate(.5*Math.PI),b.translate(x.height,-x.width),b.scale(-1,1);break;case 8:b.rotate(-.5*Math.PI),b.translate(-x.height,0);break}pe(b,d,w.srcX!=null?w.srcX:0,w.srcY!=null?w.srcY:0,w.srcWidth,w.srcHeight,w.trgX!=null?w.trgX:0,w.trgY!=null?w.trgY:0,w.trgWidth,w.trgHeight);let j=x.toDataURL("image/png");if(s!=null)return s(j,x)})},s!=null&&(d.onerror=s),d.src=e.dataURL}processQueue(){let{parallelUploads:e}=this.options,t=this.getUploadingFiles().length,n=t;if(t>=e)return;let l=this.getQueuedFiles();if(l.length>0){if(this.options.uploadMultiple)return this.processFiles(l.slice(0,e-t));for(;n<e;){if(!l.length)return;this.processFile(l.shift()),n++}}}processFile(e){return this.processFiles([e])}processFiles(e){for(let t of e)t.processing=!0,t.status=a.UPLOADING,this.emit("processing",t);return this.options.uploadMultiple&&this.emit("processingmultiple",e),this.uploadFiles(e)}_getFilesWithXhr(e){return this.files.filter(t=>t.xhr===e).map(t=>t)}cancelUpload(e){if(e.status===a.UPLOADING){let t=this._getFilesWithXhr(e.xhr);for(let n of t)n.status=a.CANCELED;typeof e.xhr<"u"&&e.xhr.abort();for(let n of t)this.emit("canceled",n);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()}resolveOption(e,...t){return typeof e=="function"?e.apply(this,t):e}uploadFile(e){return this.uploadFiles([e])}uploadFiles(e){this._transformFiles(e,t=>{if(this.options.chunking){let n=t[0];e[0].upload.chunked=this.options.chunking&&(this.options.forceChunking||n.size>this.options.chunkSize),e[0].upload.totalChunkCount=Math.ceil(n.size/this.options.chunkSize)}if(e[0].upload.chunked){let n=e[0],l=t[0];n.upload.chunks=[];let o=()=>{let s=0;for(;n.upload.chunks[s]!==void 0;)s++;if(s>=n.upload.totalChunkCount)return;let r=s*this.options.chunkSize,d=Math.min(r+this.options.chunkSize,l.size),u={name:this._getParamName(0),data:l.webkitSlice?l.webkitSlice(r,d):l.slice(r,d),filename:n.upload.filename,chunkIndex:s};n.upload.chunks[s]={file:n,index:s,dataBlock:u,status:a.UPLOADING,progress:0,retries:0},this._uploadData(e,[u])};if(n.upload.finishedChunkUpload=(s,r)=>{let d=!0;s.status=a.SUCCESS,s.dataBlock=null,s.response=s.xhr.responseText,s.responseHeaders=s.xhr.getAllResponseHeaders(),s.xhr=null;for(let u=0;u<n.upload.totalChunkCount;u++){if(n.upload.chunks[u]===void 0)return o();n.upload.chunks[u].status!==a.SUCCESS&&(d=!1)}d&&this.options.chunksUploaded(n,()=>{this._finished(e,r,null)})},this.options.parallelChunkUploads)for(let s=0;s<n.upload.totalChunkCount;s++)o();else o()}else{let n=[];for(let l=0;l<e.length;l++)n[l]={name:this._getParamName(l),data:t[l],filename:e[l].upload.filename};this._uploadData(e,n)}})}_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(e,t){let n=new XMLHttpRequest;for(let u of e)u.xhr=n;e[0].upload.chunked&&(e[0].upload.chunks[t[0].chunkIndex].xhr=n);let l=this.resolveOption(this.options.method,e,t),o=this.resolveOption(this.options.url,e,t);n.open(l,o,!0),this.resolveOption(this.options.timeout,e)&&(n.timeout=this.resolveOption(this.options.timeout,e)),n.withCredentials=!!this.options.withCredentials,n.onload=u=>{this._finishedUploading(e,n,u)},n.ontimeout=()=>{this._handleUploadError(e,n,`Request timedout after ${this.options.timeout/1e3} seconds`)},n.onerror=()=>{this._handleUploadError(e,n)};let r=n.upload!=null?n.upload:n;r.onprogress=u=>this._updateFilesUploadProgress(e,n,u);let d=this.options.defaultHeaders?{Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"}:{};this.options.binaryBody&&(d["Content-Type"]=e[0].type),this.options.headers&&G(d,this.options.headers);for(let u in d){let E=d[u];E&&n.setRequestHeader(u,E)}if(this.options.binaryBody){for(let u of e)this.emit("sending",u,n);this.options.uploadMultiple&&this.emit("sendingmultiple",e,n),this.submitRequest(n,null,e)}else{let u=new FormData;if(this.options.params){let E=this.options.params;typeof E=="function"&&(E=E.call(this,e,n,e[0].upload.chunked?this._getChunk(e[0],n):null));for(let w in E){let x=E[w];if(Array.isArray(x))for(let b=0;b<x.length;b++)u.append(w,x[b]);else u.append(w,x)}}for(let E of e)this.emit("sending",E,n,u);this.options.uploadMultiple&&this.emit("sendingmultiple",e,n,u),this._addFormElementData(u);for(let E=0;E<t.length;E++){let w=t[E];u.append(w.name,w.data,w.filename)}this.submitRequest(n,u,e)}}_transformFiles(e,t){let n=[],l=0;for(let o=0;o<e.length;o++)this.options.transformFile.call(this,e[o],s=>{n[o]=s,++l===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"),l=t.getAttribute("type");if(l&&(l=l.toLowerCase()),!(typeof n>"u"||n===null))if(t.tagName==="SELECT"&&t.hasAttribute("multiple"))for(let o of t.options)o.selected&&e.append(n,o.value);else(!l||l!=="checkbox"&&l!=="radio"||t.checked)&&e.append(n,t.value)}}_updateFilesUploadProgress(e,t,n){if(e[0].upload.chunked){let l=e[0],o=this._getChunk(l,t);n?(o.progress=100*n.loaded/n.total,o.total=n.total,o.bytesSent=n.loaded):(o.progress=100,o.bytesSent=o.total),l.upload.progress=0,l.upload.total=0,l.upload.bytesSent=0;for(let s=0;s<l.upload.totalChunkCount;s++)l.upload.chunks[s]&&typeof l.upload.chunks[s].progress<"u"&&(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 for(let l of e)l.upload.total&&l.upload.bytesSent&&l.upload.bytesSent==l.upload.total||(n?(l.upload.progress=100*n.loaded/n.total,l.upload.total=n.total,l.upload.bytesSent=n.loaded):(l.upload.progress=100,l.upload.bytesSent=l.upload.total),this.emit("uploadprogress",l,l.upload.progress,l.upload.bytesSent))}_finishedUploading(e,t,n){let l;if(e[0].status!==a.CANCELED&&t.readyState===4){if(t.responseType!=="arraybuffer"&&t.responseType!=="blob"&&(l=t.responseText,t.getResponseHeader("content-type")&&~t.getResponseHeader("content-type").indexOf("application/json")))try{l=JSON.parse(l)}catch(o){n=o,l="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),l):this._finished(e,l,n):this._handleUploadError(e,t,l)}}_handleUploadError(e,t,n){if(e[0].status!==a.CANCELED){if(e[0].upload.chunked&&this.options.retryChunks){let l=this._getChunk(e[0],t);if(l.retries++<this.options.retryChunksLimit){this._uploadData(e,[l.dataBlock]);return}else console.warn("Retried this chunk too often. Giving up.")}this._errorProcessing(e,n||this.options.dictResponseError.replace("{{statusCode}}",t.status),t)}}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){const l=this._getChunk(n[0],e);e.send(l.dataBlock.data)}else e.send(n[0]);else e.send(t)}_finished(e,t,n){for(let l of e)l.status=a.SUCCESS,this.emit("success",l,t,n),this.emit("complete",l);if(this.options.uploadMultiple&&(this.emit("successmultiple",e,t,n),this.emit("completemultiple",e)),this.options.autoProcessQueue)return this.processQueue()}_errorProcessing(e,t,n){for(let l of e)l.status=a.ERROR,this.emit("error",l,t,n),this.emit("complete",l);if(this.options.uploadMultiple&&(this.emit("errormultiple",e,t,n),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(e,t){super();let n,l;if(this.element=e,this.clickableElements=[],this.listeners=[],this.files=[],typeof this.element=="string"&&(this.element=document.querySelector(this.element)),!this.element||this.element.nodeType==null)throw new Error("Invalid dropzone element.");if(this.element.dropzone)throw new Error("Dropzone already attached.");a.instances.push(this),this.element.dropzone=this;let o=(l=a.optionsForElement(this.element))!=null?l:{};if(this.options=G(!0,{},de,o,t??{}),this.options.previewTemplate=this.options.previewTemplate.replace(/\n*/g,""),this.options.forceFallback||!a.isBrowserSupported())return this.options.fallback.call(this);if(this.options.url==null&&(this.options.url=this.element.getAttribute("action")),!this.options.url)throw new Error("No URL provided.");if(this.options.acceptedFiles&&this.options.acceptedMimeTypes)throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.");if(this.options.uploadMultiple&&this.options.chunking)throw new Error("You cannot set both: uploadMultiple and chunking.");if(this.options.binaryBody&&this.options.uploadMultiple)throw new 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=s=>this.options.renameFilename.call(this,s.name,s)),typeof this.options.method=="string"&&(this.options.method=this.options.method.toUpperCase()),(n=this.getExistingFallback())&&n.parentNode&&n.parentNode.removeChild(n),this.options.previewsContainer!==!1&&(this.options.previewsContainer?this.previewsContainer=a.getElement(this.options.previewsContainer,"previewsContainer"):this.previewsContainer=this.element),this.options.clickable&&(this.options.clickable===!0?this.clickableElements=[this.element]:this.clickableElements=a.getElements(this.options.clickable,"clickable")),this.init()}}a.initClass();a.options={};a.optionsForElement=function(i){if(i.getAttribute("id"))return a.options[ce(i.getAttribute("id"))]};a.instances=[];a.forElement=function(i){if(typeof i=="string"&&(i=document.querySelector(i)),(i!=null?i.dropzone:void 0)==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 i.dropzone};a.discover=function(){let i;if(document.querySelectorAll)i=document.querySelectorAll(".dropzone");else{i=[];let e=t=>(()=>{let n=[];for(let l of t)/(^| )dropzone($| )/.test(l.className)?n.push(i.push(l)):n.push(void 0);return n})();e(document.getElementsByTagName("div")),e(document.getElementsByTagName("form"))}return(()=>{let e=[];for(let t of i)a.optionsForElement(t)!==!1?e.push(new a(t)):e.push(void 0);return e})()};a.blockedBrowsers=[/opera.*(Macintosh|Windows Phone).*version\/12/i];a.isBrowserSupported=function(){let i=!0;if(window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector)if(!("classList"in document.createElement("a")))i=!1;else{a.blacklistedBrowsers!==void 0&&(a.blockedBrowsers=a.blacklistedBrowsers);for(let e of a.blockedBrowsers)if(e.test(navigator.userAgent)){i=!1;continue}}else i=!1;return i};a.dataURItoBlob=function(i){let e=atob(i.split(",")[1]),t=i.split(",")[0].split(":")[1].split(";")[0],n=new ArrayBuffer(e.length),l=new Uint8Array(n);for(let o=0,s=e.length,r=0<=s;r?o<=s:o>=s;r?o++:o--)l[o]=e.charCodeAt(o);return new Blob([n],{type:t})};const ue=(i,e)=>i.filter(t=>t!==e).map(t=>t),ce=i=>i.replace(/[\-_](\w)/g,e=>e.charAt(1).toUpperCase());a.createElement=function(i){let e=document.createElement("div");return e.innerHTML=i,e.childNodes[0]};a.elementInside=function(i,e){if(i===e)return!0;for(;i=i.parentNode;)if(i===e)return!0;return!1};a.getElement=function(i,e){let t;if(typeof i=="string"?t=document.querySelector(i):i.nodeType!=null&&(t=i),t==null)throw new Error(`Invalid \`${e}\` option provided. Please provide a CSS selector or a plain HTML element.`);return t};a.getElements=function(i,e){let t,n;if(i instanceof Array){n=[];try{for(t of i)n.push(this.getElement(t,e))}catch{n=null}}else if(typeof i=="string"){n=[];for(t of document.querySelectorAll(i))n.push(t)}else i.nodeType!=null&&(n=[i]);if(n==null||!n.length)throw new Error(`Invalid \`${e}\` option provided. Please provide a CSS selector, a plain HTML element or a list of those.`);return n};a.confirm=function(i,e,t){if(window.confirm(i))return e();if(t!=null)return t()};a.isValidFile=function(i,e){if(!e)return!0;e=e.split(",");let t=i.type,n=t.replace(/\/.*$/,"");for(let l of e)if(l=l.trim(),l.charAt(0)==="."){if(i.name.toLowerCase().indexOf(l.toLowerCase(),i.name.length-l.length)!==-1)return!0}else if(/\/\*$/.test(l)){if(n===l.replace(/\/.*$/,""))return!0}else if(t===l)return!0;return!1};typeof jQuery<"u"&&jQuery!==null&&(jQuery.fn.dropzone=function(i){return this.each(function(){return new a(this,i)})});a.ADDED="added";a.QUEUED="queued";a.ACCEPTED=a.QUEUED;a.UPLOADING="uploading";a.PROCESSING=a.UPLOADING;a.CANCELED="canceled";a.ERROR="error";a.SUCCESS="success";let me=function(i){i.naturalWidth;let e=i.naturalHeight,t=document.createElement("canvas");t.width=1,t.height=e;let n=t.getContext("2d");n.drawImage(i,0,0);let{data:l}=n.getImageData(1,0,1,e),o=0,s=e,r=e;for(;r>o;)l[(r-1)*4+3]===0?s=r:o=r,r=s+o>>1;let d=r/e;return d===0?1:d};var pe=function(i,e,t,n,l,o,s,r,d,u){let E=me(e);return i.drawImage(e,t,n,l,o,s,r,d,u/E)};class te{static initClass(){this.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}static encode64(e){let t="",n,l,o="",s,r,d,u="",E=0;for(;n=e[E++],l=e[E++],o=e[E++],s=n>>2,r=(n&3)<<4|l>>4,d=(l&15)<<2|o>>6,u=o&63,isNaN(l)?d=u=64:isNaN(o)&&(u=64),t=t+this.KEY_STR.charAt(s)+this.KEY_STR.charAt(r)+this.KEY_STR.charAt(d)+this.KEY_STR.charAt(u),n=l=o="",s=r=d=u="",E<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,","")),l=this.slice2Segments(n),o=this.exifManipulation(t,l);return`data:image/jpeg;base64,${this.encode64(o)}`}static exifManipulation(e,t){let n=this.getExifArray(t),l=this.insertExif(e,n);return new Uint8Array(l)}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,",""),l=this.decode64(n),o=l.indexOf(255,3),s=l.slice(0,o),r=l.slice(o),d=s;return d=d.concat(t),d=d.concat(r),d}static slice2Segments(e){let t=0,n=[];for(;;){var l;if(e[t]===255&e[t+1]===218)break;if(e[t]===255&e[t+1]===216)t+=2;else{l=e[t+2]*256+e[t+3];let o=t+l+2,s=e.slice(t,o);n.push(s),t=o}if(t>e.length)break}return n}static decode64(e){let t,n,l="",o,s,r,d="",u=0,E=[];for(/[^A-Za-z0-9\+\/\=]/g.exec(e)&&console.warn(`There were invalid base64 characters in the input text.

Check failure

Code scanning / CodeQL

Insecure randomness

This uses a cryptographically insecure random number generated at [Math.random()](1) in a security context.
@Nicklas373 Nicklas373 merged commit 62874a8 into master Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working javascript Pull requests that update Javascript code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant