(()=>{"use strict";document.addEventListener("DOMContentLoaded",(function(){const e=document.querySelectorAll(".repeater-container");function t(e,t){const o=t.querySelectorAll(".field-container");e.addEventListener("click",(()=>{const r=e.closest(".field-container");if(r.remove(),r){const e=t.querySelectorAll(".field-container");o&&e.forEach(((e,t)=>{const o=e.querySelectorAll("input"),r=e.querySelector(".container-index"),n=r.textContent;r&&(r.textContent=t),o.forEach((e=>{const o=e.id.replace(n,t);e.setAttribute("data-index",t),e.id=o,e.setAttribute("name",o)}))}))}}))}e&&e.forEach((e=>{const o=e.querySelector(".field-container-wrap"),r=e.querySelector(".add-field"),n=o.querySelectorAll(".remove-field");n&&n.forEach((o=>{t(o,e)})),r&&r.addEventListener("click",(()=>{const r=e.querySelectorAll(".field-container"),n=r[0].cloneNode(!0),l=n.querySelectorAll("[name]"),c=r.length;l&&l.forEach((e=>{e.name=e.name.replaceAll("0",c),e.id=e.id.replaceAll("0",c)})),n.querySelector(".container-index").textContent=c,o.appendChild(n);const i=n.querySelector(".remove-field"),a=n.querySelector(".upload_image_button"),d=n.querySelector(".remove_image_button");a&&d&&(window.initExploreUploadButton(a),window.initExploreRemoveButton(d)),t(i,e)}))}));const o=document.querySelectorAll(".explore-color-field");o&&o.forEach((e=>{jQuery(e).iris({defaultColor:e.dataset.defaultColor,change(t,o){e.value=o.color.toString()}});const t=e.parentNode.querySelector(".iris-picker");t.style.display="none",e.addEventListener("focus",(()=>{t.style.display="block"})),document.addEventListener("click",(o=>{e.contains(o.target)||t.contains(o.target)||(t.style.display="none")}))}));const r=document.querySelectorAll(".grouped-meta-data");0<r.length&&r.forEach((e=>{if(!e.querySelector("[required]")){e.classList.add("not-required-group");const t=e.querySelector("h2");t&&t.addEventListener("click",(()=>{e.classList.toggle("engage")}))}}))}))})();