window.NodeList&&!NodeList.prototype.forEach&&(NodeList.prototype.forEach=Array.prototype.forEach),Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(e){var t=this;do{if(t.matches(e))return t;t=t.parentElement||t.parentNode}while(null!==t&&1===t.nodeType);return null});var ACF_Upload_Instance=function(){function e(e){this.elem=e,this.item_id=1,this.token=Joomla.getOptions("csrf.token"),this.upload_url="index.php?option=com_ajax&format=raw&plugin=ACFUpload&group=fields",this.init()}var t=e.prototype;return t.init=function(){var e=this.elem.previousElementSibling,t=e.innerHTML;if("1"!=this.elem.getAttribute("data-disabled")){e.parentElement.removeChild(e);var i=parseFloat(this.elem.getAttribute("data-maxfilesize"));i=i||null;var o=parseInt(this.elem.getAttribute("data-maxfiles")),n=1!=(o=o||null),r=!(!this.elem.previousElementSibling||"INPUT"!=this.elem.previousElementSibling.nodeName),a=this;new Dropzone(this.elem,{url:this.elem.dataset.baseurl+this.upload_url,previewTemplate:t,maxFilesize:i,uploadMultiple:n,maxFiles:o,acceptedFiles:this.elem.getAttribute("data-acceptedfiles"),autoProcessQueue:!0,parallelUploads:1,filesizeBase:1e3,createImageThumbnails:!1,previewsContainer:this.elem.querySelector(".acfupload-items"),timeout:0,dictFallbackMessage:Joomla.JText._("ACF_UPLOAD_FALLBACK_MESSAGE"),dictFileTooBig:Joomla.JText._("ACF_UPLOAD_FILETOOBIG"),dictInvalidFileType:Joomla.JText._("ACF_UPLOAD_INVALID_FILE"),dictResponseError:Joomla.JText._("ACF_UPLOAD_RESPONSE_ERROR"),dictCancelUpload:Joomla.JText._("ACF_UPLOAD_CANCEL_UPLOAD"),dictCancelUploadConfirmation:Joomla.JText._("ACF_UPLOAD_CANCEL_UPLOAD_CONFIRMATION"),dictRemoveFile:Joomla.JText._("ACF_UPLOAD_REMOVE_FILE"),dictMaxFilesExceeded:Joomla.JText._("ACF_UPLOAD_MAX_FILES_EXCEEDED"),dictRemoveFileConfirmation:Joomla.JText._("ACF_UPLOAD_REMOVE_FILE_CONFIRM"),init:function(){var e=this;"undefined"!=typeof Sortable&&n&&new Sortable(a.elem.querySelector(".acfupload-items"),{animation:150,handle:".cfup-file",onStart:function(){e.element.setAttribute("data-sorting",!0)},onEnd:function(){e.element.setAttribute("data-sorting",!1)}}),this.on("addedfile",function(t){null==t.upload&&(a.createHiddenInput(t.previewTemplate,t.path,t.title,t.description),t.error?(t.previewTemplate.classList.add("dz-error"),el_error=t.previewTemplate.querySelector(".cfup-error"),el_error.innerHTML=t.error,el_error.style.display="block"):(t.previewTemplate.querySelectorAll(".upload-link").forEach(function(e){return e.setAttribute("href",t.url)}),t.previewTemplate.dataset.file=t.encoded));var e=t.name.split(".");e&&t.previewTemplate.classList.add("cfup-"+e.pop())});var t=a.elem.dataset.value;if(t){t=JSON.parse(t);for(var i=0;i