!function(a){var b=wp.customize;b.bind("pane-contents-reflowed",function(){var c=[];b.section.each(function(a){"ast_section"===a.params.type&&"undefined"!=typeof a.params.section&&c.push(a)}),c.sort(b.utils.prioritySort).reverse(),a.each(c,function(b,c){var d=a("#sub-accordion-section-"+c.params.section);d.children(".section-meta").after(c.headContainer)});var d=[];b.panel.each(function(a){"ast_panel"===a.params.type&&"undefined"!=typeof a.params.panel&&d.push(a)}),d.sort(b.utils.prioritySort).reverse(),a.each(d,function(b,c){var d=a("#sub-accordion-panel-"+c.params.panel);d.children(".panel-meta").after(c.headContainer)})});var c=wp.customize.Panel.prototype.embed,d=wp.customize.Panel.prototype.isContextuallyActive,e=wp.customize.Panel.prototype.attachEvents;wp.customize.Panel=wp.customize.Panel.extend({attachEvents:function(){if("ast_panel"!==this.params.type||"undefined"==typeof this.params.panel)return void e.call(this);e.call(this);var a=this;a.expanded.bind(function(c){var d=b.panel(a.params.panel);c?d.contentContainer.addClass("current-panel-parent"):d.contentContainer.removeClass("current-panel-parent")}),a.container.find(".customize-panel-back").off("click keydown").on("click keydown",function(c){b.utils.isKeydownButNotEnterEvent(c)||(c.preventDefault(),a.expanded()&&b.panel(a.params.panel).expand())})},embed:function(){if("ast_panel"!==this.params.type||"undefined"==typeof this.params.panel)return void c.call(this);c.call(this);var b=this,d=a("#sub-accordion-panel-"+this.params.panel);d.append(b.headContainer)},isContextuallyActive:function(){if("ast_panel"!==this.params.type)return d.call(this);var a=this,c=this._children("panel","section");b.panel.each(function(b){b.params.panel&&b.params.panel===a.id&&c.push(b)}),c.sort(b.utils.prioritySort);var e=0;return _(c).each(function(a){a.active()&&a.isContextuallyActive()&&(e+=1)}),0!==e}});var f=wp.customize.Section.prototype.embed,g=wp.customize.Section.prototype.isContextuallyActive,h=wp.customize.Section.prototype.attachEvents;wp.customize.Section=wp.customize.Section.extend({attachEvents:function(){if("ast_section"!==this.params.type||"undefined"==typeof this.params.section)return void h.call(this);h.call(this);var a=this;a.expanded.bind(function(c){var d=b.section(a.params.section);c?d.contentContainer.addClass("current-section-parent"):d.contentContainer.removeClass("current-section-parent")}),a.container.find(".customize-section-back").off("click keydown").on("click keydown",function(c){b.utils.isKeydownButNotEnterEvent(c)||(c.preventDefault(),a.expanded()&&b.section(a.params.section).expand())})},embed:function(){if("ast_section"!==this.params.type||"undefined"==typeof this.params.section)return void f.call(this);f.call(this);var b=this,c=a("#sub-accordion-section-"+this.params.section);c.append(b.headContainer)},isContextuallyActive:function(){if("ast_section"!==this.params.type)return g.call(this);var a=this,c=this._children("section","control");b.section.each(function(b){b.params.section&&b.params.section===a.id&&c.push(b)}),c.sort(b.utils.prioritySort);var d=0;return _(c).each(function(a){"undefined"!=typeof a.isContextuallyActive?a.active()&&a.isContextuallyActive()&&(d+=1):a.active()&&(d+=1)}),0!==d}})}(jQuery);