!function(){var e,n,t;wp.customize.bind("pane-contents-reflowed",function(){var e=[];wp.customize.panel.each(function(n){"kirki-nested"!==n.params.type||_.isUndefined(n.params.panel)||e.push(n)}),e.sort(wp.customize.utils.prioritySort).reverse(),e.forEach(function(e){var n=document.getElementById("sub-accordion-panel-"+e.params.panel);if(n){var t=n.querySelector(".panel-meta");if(t&&e.headContainer){var a=e.headContainer[0]||e.headContainer;a&&(t.nextSibling?n.insertBefore(a,t.nextSibling):n.appendChild(a))}}})}),e=wp.customize.Panel.prototype.embed,n=wp.customize.Panel.prototype.isContextuallyActive,t=wp.customize.Panel.prototype.attachEvents,wp.customize.Panel=wp.customize.Panel.extend({attachEvents:function(){var e=this;"kirki-nested"!==this.params.type||_.isUndefined(this.params.panel)?t.call(this):(t.call(this),e.expanded.bind(function(n){n?wp.customize.panel(e.params.panel).contentContainer.addClass("current-panel-parent"):wp.customize.panel(e.params.panel).contentContainer.removeClass("current-panel-parent")}),e.container.find(".customize-panel-back").off("click keydown").on("click keydown",function(n){!wp.customize.utils.isKeydownButNotEnterEvent(n)&&(n.preventDefault(),e.expanded()&&wp.customize.panel(e.params.panel).expand())}))},embed:function(){var n;if("kirki-nested"!==this.params.type||_.isUndefined(this.params.panel))return void e.call(this);if(e.call(this),(n=document.getElementById("sub-accordion-panel-"+this.params.panel))&&this.headContainer){var t=this.headContainer[0]||this.headContainer;t&&n.appendChild(t)}},isContextuallyActive:function(){var e,t=this,a=0;return"kirki-nested"!==this.params.type?n.call(this):(e=this._children("panel","section"),wp.customize.panel.each(function(n){n.params.panel&&n.params.panel===t.id&&e.push(n)}),e.sort(wp.customize.utils.prioritySort),_(e).each(function(e){e.active()&&e.isContextuallyActive()&&(a+=1)}),0!==a)}})}();