!function(f){var i,e,t,m=wp.customize;m.Setting=m.Value.extend({initialize:function(e,t,n){m.Value.prototype.initialize.call(this,t,n),this.id=e,this.transport=this.transport||"refresh",this._dirty=n.dirty||!1,this.notifications=new m.Values({defaultConstructor:m.Notification}),this.bind(this.preview)},preview:function(){switch(this.transport){case"refresh":return this.previewer.refresh();case"postMessage":return this.previewer.send("setting",[this.id,this()])}},findControls:function(){var n=this,i=[];return m.control.each(function(t){_.each(t.settings,function(e){e.id===n.id&&i.push(t)})}),i}}),m.utils={},m.utils.bubbleChildValueChanges=function(n,e){f.each(e,function(e,t){n[t].bind(function(e,t){n.parent&&e!==t&&n.parent.trigger("change",n)})})},e=function(e){var t,n,i=this,o=function(){var e=i.extended(m.Panel)&&i.expanded&&i.expanded()?i.container.find("ul.control-panel-content"):i.extended(m.Section)&&i.expanded&&i.expanded()?i.container.find("ul.accordion-section-content"):i.container;(n=0===(n=e.find(".control-focus:first")).length?e.find("input, select, textarea, button, object, a[href], [tabindex]").filter(":visible").first():n).focus()};(e=e||{}).completeCallback?(t=e.completeCallback,e.completeCallback=function(){o(),t()}):e.completeCallback=o,i.expand?i.expand(e):e.completeCallback()},m.utils.prioritySort=function(e,t){return e.priority()===t.priority()&&"number"==typeof e.params.instanceNumber&&"number"==typeof t.params.instanceNumber?e.params.instanceNumber-t.params.instanceNumber:e.priority()-t.priority()},m.utils.isKeydownButNotEnterEvent=function(e){return"keydown"===e.type&&13!==e.which},m.utils.areElementListsEqual=function(e,t){return e.length===t.length&&-1===_.indexOf(_.map(_.zip(e,t),function(e){return f(e[0]).is(e[1])}),!1)},i=m.Class.extend({defaultActiveArguments:{duration:"fast",completeCallback:f.noop},defaultExpandedArguments:{duration:"fast",completeCallback:f.noop},containerType:"container",defaults:{title:"",description:"",priority:100,type:"default",content:null,active:!0,instanceNumber:null},initialize:function(e,t){var n=this;n.id=e,(t=t||{}).params=_.defaults(t.params||{},n.defaults),f.extend(n,t),n.templateSelector="customize-"+n.containerType+"-"+n.params.type,n.container=f(n.params.content),0===n.container.length&&(n.container=f(n.getContainer())),n.deferred={embedded:new f.Deferred},n.priority=new m.Value,n.active=new m.Value,n.activeArgumentsQueue=[],n.expanded=new m.Value,n.expandedArgumentsQueue=[],n.active.bind(function(e){var t=n.activeArgumentsQueue.shift(),t=f.extend({},n.defaultActiveArguments,t);e=e&&n.isContextuallyActive(),n.onChangeActive(e,t)}),n.expanded.bind(function(e){var t=n.expandedArgumentsQueue.shift(),t=f.extend({},n.defaultExpandedArguments,t);n.onChangeExpanded(e,t)}),n.deferred.embedded.done(function(){n.attachEvents()}),m.utils.bubbleChildValueChanges(n,["priority","active"]),n.priority.set(n.params.priority),n.active.set(n.params.active),n.expanded.set(!1)},ready:function(){},_children:function(t,e){var n=this,i=[];return m[e].each(function(e){e[t].get()===n.id&&i.push(e)}),i.sort(m.utils.prioritySort),i},isContextuallyActive:function(){throw new Error("Container.isContextuallyActive() must be overridden in a subclass.")},onChangeActive:function(e,t){var n,i,o=this;t.unchanged?t.completeCallback&&t.completeCallback():(n="resolved"===m.previewer.deferred.active.state()?t.duration:0,o.extended(m.Panel)&&(m.panel.each(function(e){e!==o&&e.expanded()&&(i=e,n=0)}),e||_.each(o.sections(),function(e){e.collapse({duration:0})})),f.contains(document,o.container[0])?e?o.container.stop(!0,!0).slideDown(n,t.completeCallback):o.expanded()?o.collapse({duration:n,completeCallback:function(){o.container.stop(!0,!0).slideUp(n,t.completeCallback)}}):o.container.stop(!0,!0).slideUp(n,t.completeCallback):(o.container.toggle(e),t.completeCallback&&t.completeCallback()),i&&i._recalculateTopMargin())},_toggleActive:function(e,t){return t=t||{},e&&this.active.get()||!e&&!this.active.get()?(t.unchanged=!0,this.onChangeActive(this.active.get(),t),!1):(t.unchanged=!1,this.activeArgumentsQueue.push(t),this.active.set(e),!0)},activate:function(e){return this._toggleActive(!0,e)},deactivate:function(e){return this._toggleActive(!1,e)},onChangeExpanded:function(){throw new Error("Must override with subclass.")},_toggleExpanded:function(e,t){var n,i=this;return n=(t=t||{}).completeCallback,!(e&&!i.active())&&(t.completeCallback=function(){n&&n.apply(i,arguments),e?i.container.trigger("expanded"):i.container.trigger("collapsed")},e&&i.expanded.get()||!e&&!i.expanded.get()?(t.unchanged=!0,i.onChangeExpanded(i.expanded.get(),t),!1):(t.unchanged=!1,i.expandedArgumentsQueue.push(t),i.expanded.set(e),!0))},expand:function(e){return this._toggleExpanded(!0,e)},collapse:function(e){return this._toggleExpanded(!1,e)},focus:e,getContainer:function(){var e=this,t=0!==f("#tmpl-"+e.templateSelector).length?wp.template(e.templateSelector):wp.template("customize-"+e.containerType+"-default");return t&&e.container?f.trim(t(e.params)):"
  • "}}),m.Section=i.extend({containerType:"section",defaults:{title:"",description:"",priority:100,type:"default",content:null,active:!0,instanceNumber:null,panel:null,customizeAction:""},initialize:function(e,t){var n=this;i.prototype.initialize.call(n,e,t),n.id=e,n.panel=new m.Value,n.panel.bind(function(e){f(n.container).toggleClass("control-subsection",!!e)}),n.panel.set(n.params.panel||""),m.utils.bubbleChildValueChanges(n,["panel"]),n.embed(),n.deferred.embedded.done(function(){n.ready()})},embed:function(){var n=this,e=function(e){var t;e?m.panel(e,function(e){e.deferred.embedded.done(function(){t=e.container.find("ul:first"),n.container.parent().is(t)||t.append(n.container),n.deferred.embedded.resolve()})}):(t=f("#customize-theme-controls").children("ul"),n.container.parent().is(t)||t.append(n.container),n.deferred.embedded.resolve())};n.panel.bind(e),e(n.panel.get()),n.deferred.embedded.done(function(){m.bind("pane-contents-reflowed",_.debounce(function(){n._recalculateTopMargin()},100))})},attachEvents:function(){var t=this;t.container.find(".accordion-section-title, .customize-section-back").on("click keydown",function(e){m.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),t.expanded()?t.collapse():t.expand())})},isContextuallyActive:function(){var e=this.controls(),t=0;return _(e).each(function(e){e.active()&&(t+=1)}),0!==t},controls:function(){return this._children("section","control")},onChangeExpanded:function(e,t){var n,i,o,a,r=this,s=r.container.closest(".wp-full-overlay-sidebar-content"),c=r.container.find(".accordion-section-content"),l=r.container.closest(".wp-full-overlay"),d=r.container.find(".customize-section-back"),u=r.container.find(".accordion-section-title").first(),p=f("#customize-header-actions").height();e&&!r.container.hasClass("open")?(i=t.unchanged?t.completeCallback:(s.scrollTop(0),n=function(){var e=window.matchMedia||window.msMatchMedia,t=90;e&&e("(max-width: 640px)").matches&&(t=45),c.css("height",window.innerHeight-t)},function(){r.container.addClass("open"),l.addClass("section-open"),o=c.offset().top,a=s.scrollTop(),c.css("margin-top",p-o-a),n(),u.attr("tabindex","-1"),d.attr("tabindex","0"),d.focus(),t.completeCallback&&t.completeCallback(),f(window).on("resize.customizer-section",_.debounce(n,100)),setTimeout(_.bind(r._recalculateTopMargin,r),0)}),t.allowMultiple||m.section.each(function(e){e!==r&&e.collapse({duration:t.duration})}),r.panel()?m.panel(r.panel()).expand({duration:t.duration,completeCallback:i}):(m.panel.each(function(e){e.collapse()}),i())):!e&&r.container.hasClass("open")?(r.container.removeClass("open"),l.removeClass("section-open"),c.css("margin-top",""),s.scrollTop(0),d.attr("tabindex","-1"),u.attr("tabindex","0"),u.focus(),t.completeCallback&&t.completeCallback(),f(window).off("resize.customizer-section")):t.completeCallback&&t.completeCallback()},_recalculateTopMargin:function(){var e,t=this.container.find(".accordion-section-content");0!==t.length&&(e=f("#customize-header-actions").height(),0<(e=t.offset().top-e)&&t.css("margin-top",parseInt(t.css("margin-top"),10)-e))}}),m.ThemesSection=m.Section.extend({currentTheme:"",overlay:"",template:"",screenshotQueue:null,$window:f(window),initialize:function(){return this.$customizeSidebar=f(".wp-full-overlay-sidebar-content:first"),m.Section.prototype.initialize.apply(this,arguments)},ready:function(){var t=this;t.overlay=t.container.find(".theme-overlay"),t.template=wp.template("customize-themes-details-view"),f("body").on("keyup",function(e){t.overlay.find(".theme-wrap").is(":visible")&&(39===e.keyCode&&t.nextTheme(),37===e.keyCode&&t.previousTheme(),27===e.keyCode&&t.closeDetails())}),_.bindAll(this,"renderScreenshots")},isContextuallyActive:function(){return this.active()},attachEvents:function(){var n=this;n.container.find(".change-theme, .customize-theme").on("click keydown",function(e){m.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),n.expanded()?n.collapse():n.expand())}),n.container.on("click keydown",".left",function(e){m.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),n.previousTheme())}),n.container.on("click keydown",".right",function(e){m.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),n.nextTheme())}),n.container.on("click keydown",".theme-backdrop, .close",function(e){m.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),n.closeDetails())});var i=_.throttle(_.bind(n.renderScreenshots,this),100);n.container.on("input","#themes-filter",function(e){var t=e.currentTarget.value.toLowerCase().trim().replace("-"," "),e=n.controls();_.each(e,function(e){e.filter(t)}),i(),e=n.container.find("li.customize-control:visible").length,n.container.find(".theme-count").text(e)}),m.bind("ready",function(){_.each(n.controls().slice(0,3),function(e){e=e.params.theme.screenshot[0];e&&((new Image).src=e)})})},onChangeExpanded:function(e,t){var n,i,o,a,r,s,c,l,d,u;t.unchanged?t.completeCallback&&t.completeCallback():(a=(o=this).container.closest(".accordion-section"),r=a.closest(".wp-full-overlay"),c=(s=a.closest(".wp-full-overlay-sidebar-content")).find(".open"),l=a.find(".customize-theme"),d=a.find(".change-theme"),u=a.find(".control-panel-content"),e?(m.section.each(function(e){e!==o&&e.collapse({duration:t.duration})}),m.panel.each(function(e){e.collapse({duration:0})}),u.show(0,function(){n=u.offset().top,i=s.scrollTop(),u.css("margin-top",f("#customize-header-actions").height()-n-i),a.addClass("current-panel"),r.addClass("in-themes-panel"),s.scrollTop(0),_.delay(o.renderScreenshots,10),o.$customizeSidebar.on("scroll.customize-themes-section",_.throttle(o.renderScreenshots,300)),t.completeCallback&&t.completeCallback()}),l.focus()):(c.removeClass("open"),a.removeClass("current-panel"),r.removeClass("in-themes-panel"),o.$customizeSidebar.off("scroll.customize-themes-section"),u.delay(180).hide(0,function(){u.css("margin-top","inherit"),t.completeCallback&&t.completeCallback()}),l.attr("tabindex","0"),d.focus(),s.scrollTop(0)))},_recalculateTopMargin:function(){m.Panel.prototype._recalculateTopMargin.call(this)},renderScreenshots:function(){var r=this;null===r.screenshotQueue&&(r.screenshotQueue=r.controls()),r.screenshotQueue.length&&(r.screenshotQueue=_.filter(r.screenshotQueue,function(e){var t=e.container.find(".theme-screenshot"),n=t.find("img");if(!n.length)return!1;if(n.is(":hidden"))return!0;var i=r.$window.scrollTop(),o=i+r.$window.height(),a=n.offset().top,n=t.height(),t=3*n,t=i-t<=a+n&&a<=o+t;return t&&e.container.trigger("render-screenshot"),!t}))},nextTheme:function(){var e=this;e.getNextTheme()&&e.showDetails(e.getNextTheme(),function(){e.overlay.find(".right").focus()})},getNextTheme:function(){var e=m.control("theme_"+this.currentTheme),t=e.container.next("li.customize-control-theme");return!!t.length&&(t=t[0].id.replace("customize-control-",""),(e=m.control(t)).params.theme)},previousTheme:function(){var e=this;e.getPreviousTheme()&&e.showDetails(e.getPreviousTheme(),function(){e.overlay.find(".left").focus()})},getPreviousTheme:function(){var e=m.control("theme_"+this.currentTheme),t=e.container.prev("li.customize-control-theme");return!!t.length&&(t=t[0].id.replace("customize-control-",""),(e=m.control(t)).params.theme)},updateLimits:function(){this.getNextTheme()||this.overlay.find(".right").addClass("disabled"),this.getPreviousTheme()||this.overlay.find(".left").addClass("disabled")},showDetails:function(e,t){var n=this;t=t||function(){},n.currentTheme=e.id,n.overlay.html(n.template(e)).fadeIn("fast").focus(),f("body").addClass("modal-open"),n.containFocus(n.overlay),n.updateLimits(),t()},closeDetails:function(){f("body").removeClass("modal-open"),this.overlay.fadeOut("fast"),m.control("theme_"+this.currentTheme).focus()},containFocus:function(t){var n;t.on("keydown",function(e){if(9===e.keyCode)return(n=f(":tabbable",t)).last()[0]!==e.target||e.shiftKey?n.first()[0]===e.target&&e.shiftKey?(n.last().focus(),!1):void 0:(n.first().focus(),!1)})}}),m.Panel=i.extend({containerType:"panel",initialize:function(e,t){var n=this;i.prototype.initialize.call(n,e,t),n.embed(),n.deferred.embedded.done(function(){n.ready()})},embed:function(){var e=this,t=f("#customize-theme-controls > ul");e.container.parent().is(t)||(t.append(e.container),e.renderContent()),m.bind("pane-contents-reflowed",_.debounce(function(){e._recalculateTopMargin()},100)),e.deferred.embedded.resolve()},attachEvents:function(){var t,n=this;n.container.find(".accordion-section-title").on("click keydown",function(e){m.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),n.expanded()||n.expand())}),n.container.find(".customize-panel-back").on("click keydown",function(e){m.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),n.expanded()&&n.collapse())}),(t=n.container.find(".panel-meta:first")).find("> .accordion-section-title .customize-help-toggle").on("click keydown",function(e){m.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),(t=n.container.find(".panel-meta")).hasClass("cannot-expand")||(e=t.find(".customize-panel-description:first"),t.hasClass("open")?(t.toggleClass("open"),e.slideUp(n.defaultExpandedArguments.duration),f(this).attr("aria-expanded",!1)):(e.slideDown(n.defaultExpandedArguments.duration),t.toggleClass("open"),f(this).attr("aria-expanded",!0))))})},sections:function(){return this._children("panel","section")},isContextuallyActive:function(){var e=this.sections(),t=0;return _(e).each(function(e){e.active()&&e.isContextuallyActive()&&(t+=1)}),0!==t},onChangeExpanded:function(e,t){var n,i,o,a,r,s,c,l,d,u,p,h;t.unchanged?t.completeCallback&&t.completeCallback():(a=(o=this).container.closest(".accordion-section"),r=a.closest(".wp-full-overlay"),c=(s=a.closest(".wp-full-overlay-sidebar-content")).find(".open"),l=r.find("#customize-theme-controls > ul > .accordion-section > .accordion-section-title"),d=a.find(".customize-panel-back"),u=a.find(".accordion-section-title").first(),p=a.find(".control-panel-content"),h=f("#customize-header-actions").height(),e?(m.section.each(function(e){o.id!==e.panel()&&e.collapse({duration:0})}),m.panel.each(function(e){o!==e&&e.collapse({duration:0})}),p.show(0,function(){p.parent().show(),n=p.offset().top,i=s.scrollTop(),p.css("margin-top",h-n-i),a.addClass("current-panel"),r.addClass("in-sub-panel"),s.scrollTop(0),t.completeCallback&&t.completeCallback()}),l.attr("tabindex","-1"),d.attr("tabindex","0"),d.focus(),o._recalculateTopMargin()):(c.removeClass("open"),a.removeClass("current-panel"),r.removeClass("in-sub-panel"),p.delay(180).hide(0,function(){p.css("margin-top","inherit"),t.completeCallback&&t.completeCallback()}),l.attr("tabindex","0"),d.attr("tabindex","-1"),u.focus(),s.scrollTop(0)))},_recalculateTopMargin:function(){var e=f("#customize-header-actions").height(),t=this.container.closest(".accordion-section").find(".control-panel-content");t.css("margin-top",parseInt(t.css("margin-top"),10)-(t.offset().top-e))},renderContent:function(){var e=this,t=0!==f("#tmpl-"+e.templateSelector+"-content").length?wp.template(e.templateSelector+"-content"):wp.template("customize-panel-default-content");t&&e.container&&e.container.find(".accordion-sub-container").html(t(e.params))}}),m.Control=m.Class.extend({defaultActiveArguments:{duration:"fast",completeCallback:f.noop},initialize:function(e,t){var i,o,a=this;a.params={},f.extend(a,t||{}),a.id=e,a.selector="#customize-control-"+e.replace(/\]/g,"").replace(/\[/g,"-"),a.templateSelector="customize-control-"+a.params.type+"-content",a.container=a.params.content?f(a.params.content):f(a.selector),a.deferred={embedded:new f.Deferred},a.section=new m.Value,a.priority=new m.Value,a.active=new m.Value,a.activeArgumentsQueue=[],a.notifications=new m.Values({defaultConstructor:m.Notification}),a.elements=[],i=a.container.find("[data-customize-setting-link]"),o={},i.each(function(){var e,n=f(this);if(n.is(":radio")){if(e=n.prop("name"),o[e])return;o[e]=!0,n=i.filter('[name="'+e+'"]')}m(n.data("customizeSettingLink"),function(e){var t=new m.Element(n);a.elements.push(t),t.sync(e),t.set(e())})}),a.active.bind(function(e){var t=a.activeArgumentsQueue.shift(),t=f.extend({},a.defaultActiveArguments,t);a.onChangeActive(e,t)}),a.section.set(a.params.section),a.priority.set(isNaN(a.params.priority)?10:a.params.priority),a.active.set(a.params.active),m.utils.bubbleChildValueChanges(a,["section","priority","active"]),0===(e=f.map(a.params.settings,function(e){return e})).length?(a.setting=null,a.settings={},a.embed()):m.apply(m,e.concat(function(){for(var e in a.settings={},a.params.settings)a.settings[e]=m(a.params.settings[e]);a.setting=a.settings["default"]||null,_.each(a.settings,function(n){n.notifications.bind("add",function(e){var t=n.id+":"+e.code,e=_.extend({},e,{setting:n.id}),e=new m.Notification(t,e);a.notifications.add(e.code,e)}),n.notifications.bind("remove",function(e){a.notifications.remove(n.id+":"+e.code)})}),a.embed()})),a.deferred.embedded.done(function(){var t=_.debounce(function(){a.renderNotifications()});a.notifications.bind("add",function(e){wp.a11y.speak(e.message,"assertive"),t()}),a.notifications.bind("remove",t),a.renderNotifications(),a.ready()})},embed:function(){var n=this,e=function(e){var t;e&&m.section(e,function(e){e.deferred.embedded.done(function(){t=e.container.find("ul:first"),n.container.parent().is(t)||(t.append(n.container),n.renderContent()),n.deferred.embedded.resolve()})})};n.section.bind(e),e(n.section.get())},ready:function(){},getNotificationsContainerElement:function(){var e,t=this,n=t.container.find(".customize-control-notifications-container:first");return n.length||(n=f('
    '),t.container.hasClass("customize-control-nav_menu_item")?t.container.find(".menu-item-settings:first").prepend(n):t.container.hasClass("customize-control-widget_form")?t.container.find(".widget-inside:first").prepend(n):(e=t.container.find(".customize-control-title")).length?e.after(n):t.container.prepend(n)),n},renderNotifications:function(){var t,e=this,n=!1,i=e.getNotificationsContainerElement();i&&i.length&&(t=[],e.notifications.each(function(e){t.push(e),"error"===e.type&&(n=!0)}),0===t.length?i.stop().slideUp("fast"):i.stop().slideDown("fast",null,function(){f(this).css("height","auto")}),e.notificationsTemplate||(e.notificationsTemplate=wp.template("customize-control-notifications")),e.container.toggleClass("has-notifications",0!==t.length),e.container.toggleClass("has-error",n),i.empty().append(f.trim(e.notificationsTemplate({notifications:t,altNotice:Boolean(e.altNotice)}))))},expand:function(e){m.section(this.section()).expand(e)},focus:e,onChangeActive:function(e,t){t.unchanged?t.completeCallback&&t.completeCallback():f.contains(document,this.container[0])?e?this.container.slideDown(t.duration,t.completeCallback):this.container.slideUp(t.duration,t.completeCallback):(this.container.toggle(e),t.completeCallback&&t.completeCallback())},toggle:function(e){return this.onChangeActive(e,this.defaultActiveArguments)},activate:i.prototype.activate,deactivate:i.prototype.deactivate,_toggleActive:i.prototype._toggleActive,dropdownInit:function(){function e(e){"string"==typeof e&&i.statuses&&i.statuses[e]?n.html(i.statuses[e]).show():n.hide()}var t=this,n=this.container.find(".dropdown-status"),i=this.params,o=!1;this.container.on("click keydown",".dropdown",function(e){m.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),o||t.container.toggleClass("open"),t.container.hasClass("open")&&t.container.parent().parent().find("li.library-selected").focus(),o=!0,setTimeout(function(){o=!1},400))}),this.setting.bind(e),e(this.setting())},renderContent:function(){var e,t=this;0!==f("#tmpl-"+t.templateSelector).length&&(e=wp.template(t.templateSelector))&&t.container&&t.container.html(e(t.params))}}),m.ColorControl=m.Control.extend({ready:function(){var e=this,t=this.container.find(".color-picker-hex");t.val(e.setting()).wpColorPicker({change:function(){e.setting.set(t.wpColorPicker("color"))},clear:function(){e.setting.set("")}}),this.setting.bind(function(e){t.val(e),t.wpColorPicker("color",e)})}}),m.MediaControl=m.Control.extend({ready:function(){var n=this;function e(e){var t=f.Deferred();n.extended(m.UploadControl)?t.resolve():(e=parseInt(e,10),_.isNaN(e)||e<=0?(delete n.params.attachment,t.resolve()):n.params.attachment&&n.params.attachment.id===e&&t.resolve()),"pending"===t.state()&&wp.media.attachment(e).fetch().done(function(){n.params.attachment=this.attributes,t.resolve(),wp.customize.previewer.send(n.setting.id+"-attachment-data",this.attributes)}),t.done(function(){n.renderContent()})}_.bindAll(n,"restoreDefault","removeFile","openFrame","select","pausePlayer"),n.container.on("click keydown",".upload-button",n.openFrame),n.container.on("click keydown",".upload-button",n.pausePlayer),n.container.on("click keydown",".thumbnail-image img",n.openFrame),n.container.on("click keydown",".default-button",n.restoreDefault),n.container.on("click keydown",".remove-button",n.pausePlayer),n.container.on("click keydown",".remove-button",n.removeFile),n.container.on("click keydown",".remove-button",n.cleanupPlayer),m.section(n.section()).container.on("expanded",function(){n.player&&n.player.setControlsSize()}).on("collapsed",function(){n.pausePlayer()}),e(n.setting()),n.setting.bind(e)},pausePlayer:function(){this.player&&this.player.pause()},cleanupPlayer:function(){this.player&&wp.media.mixin.removePlayer(this.player)},openFrame:function(e){m.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),this.frame||this.initFrame(),this.frame.open())},initFrame:function(){this.frame=wp.media({button:{text:this.params.button_labels.frame_button},states:[new wp.media.controller.Library({title:this.params.button_labels.frame_title,library:wp.media.query({type:this.params.mime_type}),multiple:!1,date:!1})]}),this.frame.on("select",this.select)},select:function(){var e=this.frame.state().get("selection").first().toJSON(),t=window._wpmejsSettings||{};this.params.attachment=e,this.setting(e.id),(e=this.container.find("audio, video").get(0))?this.player=new MediaElementPlayer(e,t):this.cleanupPlayer()},restoreDefault:function(e){m.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),this.params.attachment=this.params.defaultAttachment,this.setting(this.params.defaultAttachment.url))},removeFile:function(e){m.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),this.params.attachment={},this.setting(""),this.renderContent())}}),m.UploadControl=m.MediaControl.extend({select:function(){var e=this.frame.state().get("selection").first().toJSON(),t=window._wpmejsSettings||{};this.params.attachment=e,this.setting(e.url),(e=this.container.find("audio, video").get(0))?this.player=new MediaElementPlayer(e,t):this.cleanupPlayer()},success:function(){},removerVisibility:function(){}}),m.ImageControl=m.UploadControl.extend({thumbnailSrc:function(){}}),m.BackgroundControl=m.UploadControl.extend({ready:function(){m.UploadControl.prototype.ready.apply(this,arguments)},select:function(){m.UploadControl.prototype.select.apply(this,arguments),wp.ajax.post("custom-background-add",{nonce:_wpCustomizeBackground.nonces.add,wp_customize:"on",theme:m.settings.theme.stylesheet,attachment_id:this.params.attachment.id})}}),m.CroppedImageControl=m.MediaControl.extend({openFrame:function(e){m.utils.isKeydownButNotEnterEvent(e)||(this.initFrame(),this.frame.setState("library").open())},initFrame:function(){var e=_wpMediaViewsL10n;this.frame=wp.media({button:{text:e.select,close:!1},states:[new wp.media.controller.Library({title:this.params.button_labels.frame_title,library:wp.media.query({type:"image"}),multiple:!1,date:!1,priority:20,suggestedWidth:this.params.width,suggestedHeight:this.params.height}),new wp.media.controller.CustomizeImageCropper({imgSelectOptions:this.calculateImageSelectOptions,control:this})]}),this.frame.on("select",this.onSelect,this),this.frame.on("cropped",this.onCropped,this),this.frame.on("skippedcrop",this.onSkippedCrop,this)},onSelect:function(){var e=this.frame.state().get("selection").first().toJSON();this.params.width!==e.width||this.params.height!==e.height||this.params.flex_width||this.params.flex_height?this.frame.setState("cropper"):(this.setImageFromAttachment(e),this.frame.close())},onCropped:function(e){this.setImageFromAttachment(e)},calculateImageSelectOptions:function(e,t){var n=t.get("control"),i=!!parseInt(n.params.flex_width,10),o=!!parseInt(n.params.flex_height,10),a=e.get("width"),r=e.get("height"),s=parseInt(n.params.width,10),c=parseInt(n.params.height,10),l=s/c,d=s,e=c;return t.set("canSkipCrop",!n.mustBeCropped(i,o,s,c,a,r)),l")?i.rejectWith(o,["unsigned"]):(e=e.slice(0,t)+e.slice(t+n.length),o.iframe=f("