File: /mnt/drbd/www/edenhouse/wp-content/plugins/essential-blocks/blocks/accordion/frontend/index.js
(()=>{var t=window.eb_frontend,e=t.EBGetIconClass,r=t.EBGetIconType;document.addEventListener("DOMContentLoaded",(function(t){var i=document.querySelectorAll(".eb-accordion-container > .eb-accordion-inner");if(i)for(var s=function(){var t=i[l].parentElement,s=Number(t.getAttribute("data-transition-duration")),d=t.children[0].children,c=[];Array.from(d).forEach((function(t){c.push(t.querySelector(".eb-accordion-title-wrapper"))})),c.forEach((function(t,e){var r=Math.random().toString(36).substr(2,7);t.setAttribute("id","eb-accordion-header-"+r),t.setAttribute("aria-controls","eb-accordion-panel-"+r),t.setAttribute("aria-expanded",!1),t.setAttribute("role","button");var a=t.nextElementSibling;a.setAttribute("id","eb-accordion-panel-"+r),a.setAttribute("aria-labelledby","eb-accordion-header-"+r),a.setAttribute("role","region"),t.addEventListener("keydown",(function(t){var r=t.which.toString(),a=t.ctrlKey&&r.match(/33|34/);if(r.match(/38|40/)||a){var o=r.match(/34|40/)?1:-1,n=c.length;c[(e+n+o)%n].focus(),t.preventDefault()}else if(r.match(/35|36/)){switch(r){case"36":c[0].focus();break;case"35":c[c.length-1].focus()}t.preventDefault()}}))}));var p=[];Array.from(d).forEach((function(t){p.push(t.querySelector(".eb-accordion-content-wrapper"))}));var u="eb-accordion-hidden";t.classList.add("eb_accdn_loaded");for(var y=0;y<p.length;y++)p[y].style.height="0px";var m=document.createElement("span"),f=t.getAttribute("data-accordion-type"),v=t.getAttribute("data-tab-icon")||"_ _",h=t.getAttribute("data-expanded-icon")||"_ _";v=e(v),h=e(h);var b=v.split(" ")[0],g="fontawesome"===r(v)?v.split(" ")[1]:v.split(" ")[2],A=h.split(" ")[0],E="fontawesome"===r(h)?h.split(" ")[1]:h.split(" ")[2];function L(t){var e=t.querySelector(".eb-accordion-icon")||m;e.classList.contains(E)?("dashicon"===r(E)&&e.classList.remove("dashicons"),e.classList.remove(A,E),"dashicon"===r(g)&&e.classList.add("dashicons"),e.classList.add(b,g)):("dashicon"===r(g)&&e.classList.remove("dashicons"),e.classList.remove(b,g),"dashicon"===r(E)&&e.classList.add("dashicons"),e.classList.add(A,E))}for(var w=0;w<d.length;w++)"true"==d[w].getAttribute("data-clickable")?(p[w].setAttribute("data-collapsed","false"),n(p[w],s),L(p[w].parentElement.querySelector(".eb-accordion-title-wrapper"))):(p[w].setAttribute("data-collapsed","true"),o(p[w],s),p[w].parentElement.classList.add(u));function P(t){var e=this,r=this.nextElementSibling;"true"===r.getAttribute("data-collapsed")?(n(r,s),r.setAttribute("data-collapsed","false"),e.setAttribute("aria-expanded","true"),e.parentElement.classList.remove(u)):(o(r,s),r.setAttribute("data-collapsed","true"),e.setAttribute("aria-expanded","false"),e.parentElement.classList.add(u)),L(e)}function x(){var e=this;Array.from(d).forEach((function(t){t.classList.add(u)}));var r=e.nextElementSibling,i="true"===r.getAttribute("data-collapsed");!function(t){for(var e=t.querySelectorAll(".eb-accordion-icon"),r=0;r<e.length;r++)e[r].classList.contains(E)&&(e[r].classList.remove(A,E),e[r].classList.add(b,g))}(t),a(t,s),i?(n(r,s),r.setAttribute("data-collapsed","false"),e.setAttribute("aria-expanded","true"),e.parentElement.classList.remove(u)):(o(r,s),r.setAttribute("data-collapsed","true"),e.setAttribute("aria-expanded","false"),L(e),e.parentElement.classList.add(u)),L(e)}"toggle"===f?function(t){for(var e=0;e<t.length;e++)!function(t){t.addEventListener("click",P),t.addEventListener("keydown",(function(e){" "!==e.key&&"Enter"!==e.key||(e.preventDefault(),P.call(t))}))}(t[e])}(c):function(t){for(var e=0;e<t.length;e++)!function(t){t.addEventListener("click",x),t.addEventListener("keydown",(function(e){" "!==e.key&&"Enter"!==e.key||(e.preventDefault(),x.call(t))}))}(t[e])}(c)},l=0;l<i.length;l++)s()}));var a=function(t,e){var r=[];Array.from(t.children).forEach((function(t){r=t.querySelectorAll(".eb-accordion-content-wrapper")}));for(var a=0;a<r.length;a++)"false"===r[a].getAttribute("data-collapsed")&&(o(r[a],e),r[a].setAttribute("data-collapsed",!0),r[a].setAttribute("aria-expanded","false"))},o=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500;t.style.transitionProperty="height, margin, padding",t.style.transitionDuration=e+"ms",t.style.boxSizing="border-box",t.style.height=t.offsetHeight+"px",t.offsetHeight,t.style.overflow="hidden",t.style.height=0,t.style.paddingTop=0,t.style.paddingBottom=0,t.style.marginTop=0,t.style.marginBottom=0,window.setTimeout((function(){t.style.display="none",t.style.removeProperty("height"),t.style.removeProperty("padding-top"),t.style.removeProperty("padding-bottom"),t.style.removeProperty("margin-top"),t.style.removeProperty("margin-bottom"),t.style.removeProperty("overflow"),t.style.removeProperty("transition-duration"),t.style.removeProperty("transition-property")}),e)},n=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500;t.style.removeProperty("display");var r=window.getComputedStyle(t).display;"none"===r&&(r="block"),t.style.display=r;var a=t.offsetHeight;t.style.overflow="hidden",t.style.height=0,t.style.paddingTop=0,t.style.paddingBottom=0,t.style.marginTop=0,t.style.marginBottom=0,t.offsetHeight,t.style.boxSizing="border-box",t.style.transitionProperty="height, margin, padding",t.style.transitionDuration=e+"ms",t.style.height=a+"px",t.style.removeProperty("padding-top"),t.style.removeProperty("padding-bottom"),t.style.removeProperty("margin-top"),t.style.removeProperty("margin-bottom"),window.setTimeout((function(){t.style.removeProperty("height"),t.style.removeProperty("overflow"),t.style.removeProperty("transition-duration"),t.style.removeProperty("transition-property")}),e)}})();