!function(){var e,t,n;function i(){wp.customize.section.each(function(e){var t=document.querySelector("#sub-accordion-section-"+e.id),n=document.querySelector("#accordion-section-"+e.id);t&&n&&n.classList.contains("control-section-kirki-expanded")&&t.parentNode!==n&&n.appendChild(t)})}function o(){setTimeout(i,0)}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",o):o(),wp.customize.bind("pane-contents-reflowed",o),wp.customize.sectionConstructor["kirki-link"]=wp.customize.Section.extend({attachEvents:function(){},isContextuallyActive:function(){return!0}}),wp.customize.bind("pane-contents-reflowed",function(){var e=[];wp.customize.section.each(function(t){"kirki-nested"!==t.params.type||_.isUndefined(t.params.section)||e.push(t)}),e.sort(wp.customize.utils.prioritySort).reverse(),e.forEach(function(e){var t,n,i=document.querySelector("#sub-accordion-section-"+e.params.section);i&&e.headContainer&&(t=i.querySelector(".section-meta"),n=e.headContainer.jquery?e.headContainer[0]:e.headContainer,t&&n&&t.insertAdjacentElement("afterend",n))})}),e=wp.customize.Section.prototype.embed,t=wp.customize.Section.prototype.isContextuallyActive,n=wp.customize.Section.prototype.attachEvents,wp.customize.Section=wp.customize.Section.extend({attachEvents:function(){var e=this;if("kirki-nested"!==this.params.type||_.isUndefined(this.params.section))return void n.call(e);n.call(e),e.expanded.bind(function(t){var n,i=wp.customize.section(e.params.section);i&&i.contentContainer&&(n=i.contentContainer.jquery?i.contentContainer[0]:i.contentContainer)&&(t?n.classList.add("current-section-parent"):n.classList.remove("current-section-parent"))});var t=e.container,i=t&&t.jquery?t[0]:t,o=i?i.querySelector(".customize-section-back"):null,c=function(t){!wp.customize.utils.isKeydownButNotEnterEvent(t)&&(t.preventDefault(),e.expanded()&&wp.customize.section(e.params.section).expand())};if(o){var s=o.cloneNode(!0);o.parentNode&&(o.parentNode.replaceChild(s,o),o=s),o.addEventListener("click",c),o.addEventListener("keydown",c)}},embed:function(){var t;if("kirki-nested"!==this.params.type||_.isUndefined(this.params.section))return void e.call(this);if(e.call(this),(t=document.querySelector("#sub-accordion-section-"+this.params.section))&&this.headContainer){var n=this.headContainer.jquery?this.headContainer[0]:this.headContainer;n&&t.appendChild(n)}},isContextuallyActive:function(){var e,n=this,i=0;return"kirki-nested"!==this.params.type?t.call(this):(e=this._children("section","control"),wp.customize.section.each(function(t){t.params.section&&t.params.section===n.id&&e.push(t)}),e.sort(wp.customize.utils.prioritySort),_(e).each(function(e){void 0!==e.isContextuallyActive?e.active()&&e.isContextuallyActive()&&(i+=1):e.active()&&(i+=1)}),0!==i)}})}();