!function(){"use strict";document.addEventListener("DOMContentLoaded",(function(){var e=[].concat(document.querySelectorAll(".folder-url, .component-folder-url, .plugin-folder-url, .layout-folder-url")),t=[].concat(document.querySelectorAll(".folder ul, .component-folder ul, .plugin-folder ul, .layout-folder ul")),r=[].concat(document.querySelectorAll(".show > ul")),o=[].concat(document.querySelectorAll("#fileModal .folder-url")),c=[].concat(document.querySelectorAll("#folderModal .folder-url"));t.forEach((function(e){e.classList.add("hidden")})),r.forEach((function(e){e.classList.remove("hidden")})),e.forEach((function(e){e.addEventListener("click",(function(e){e.preventDefault();var t=e.currentTarget.parentNode.querySelector("ul");t&&(t.classList.contains("hidden")?t.classList.remove("hidden"):t.classList.add("hidden"))}))})),o.forEach((function(e){e.addEventListener("click",(function(e){e.preventDefault(),o.forEach((function(e){e.classList.remove("selected")})),e.currentTarget.classList.add("selected");var t="media"===e.currentTarget.dataset.base?1:0;[].concat(document.querySelectorAll("#fileModal input.address")).forEach((function(t){t.value=e.currentTarget.getAttribute("data-id")})),[].concat(document.querySelectorAll('#fileModal input[name="isMedia"]')).forEach((function(e){e.value=t}))}))})),c.forEach((function(e){e.addEventListener("click",(function(e){e.preventDefault(),c.forEach((function(e){e.classList.remove("selected")})),e.currentTarget.classList.add("selected");var t="media"===e.currentTarget.dataset.base?1:0;[].concat(document.querySelectorAll("#folderModal input.address")).forEach((function(t){t.value=e.currentTarget.getAttribute("data-id")})),[].concat(document.querySelectorAll('#folderModal input[name="isMedia"]')).forEach((function(e){e.value=t}))}))}));var l=document.querySelector("#treeholder .treeselect"),a=[].concat(l.querySelectorAll(".folder.show"));if(document.querySelector("p.lead.hidden.path")){var n=document.querySelector("p.lead.hidden.path").innerText;n&&"/"===n.charAt(0)&&(n=(n=(n=n.slice(1)).split("/"))[n.length-1],a.forEach((function(e,t){if(e.querySelector("a").classList.add("active"),t===a.length-1){var r=e.querySelector("ul");[].concat(r.querySelectorAll("li")).forEach((function(e){var t=e.querySelector("a"),r=t.querySelector("span");r&&r.innerText.trim()&&t.classList.add("active")}))}})))}var d=document.getElementById("image-crop");if(d){var u=document.getElementById("imageWidth").value,i=document.getElementById("imageHeight").value;new window.Cropper(d,{viewMode:1,scalable:!0,zoomable:!1,movable:!1,dragMode:"crop",cropBoxMovable:!0,cropBoxResizable:!0,autoCrop:!0,autoCropArea:1,background:!0,center:!0,minCanvasWidth:u,minCanvasHeight:i}),d.addEventListener("crop",(function(e){document.getElementById("x").value=e.detail.x,document.getElementById("y").value=e.detail.y,document.getElementById("w").value=e.detail.width,document.getElementById("h").value=e.detail.height}))}}))}();