!function(m){var i,e,t,f=wp.customize;f.Setting=f.Value.extend({initialize:function(e,t,n){f.Value.prototype.initialize.call(this,t,n),this.id=e,this.transport=this.transport||"refresh",this._dirty=n.dirty||!1,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()])}}}),f.utils={},f.utils.bubbleChildValueChanges=function(n,e){m.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(f.Panel)&&i.expanded&&i.expanded()?i.container.find("ul.control-panel-content"):i.extended(f.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()},f.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()},f.utils.isKeydownButNotEnterEvent=function(e){return"keydown"===e.type&&13!==e.which},f.utils.areElementListsEqual=function(e,t){return e.length===t.length&&-1===_.indexOf(_.map(_.zip(e,t),function(e){return m(e[0]).is(e[1])}),!1)},i=f.Class.extend({defaultActiveArguments:{duration:"fast",completeCallback:m.noop},defaultExpandedArguments:{duration:"fast",completeCallback:m.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),m.extend(n,t),n.templateSelector="customize-"+n.containerType+"-"+n.params.type,n.container=m(n.params.content),0===n.container.length&&(n.container=m(n.getContainer())),n.deferred={embedded:new m.Deferred},n.priority=new f.Value,n.active=new f.Value,n.activeArgumentsQueue=[],n.expanded=new f.Value,n.expandedArgumentsQueue=[],n.active.bind(function(e){var t=n.activeArgumentsQueue.shift(),t=m.extend({},n.defaultActiveArguments,t);e=e&&n.isContextuallyActive(),n.onChangeActive(e,t)}),n.expanded.bind(function(e){var t=n.expandedArgumentsQueue.shift(),t=m.extend({},n.defaultExpandedArguments,t);n.onChangeExpanded(e,t)}),n.deferred.embedded.done(function(){n.attachEvents()}),f.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 f[e].each(function(e){e[t].get()===n.id&&i.push(e)}),i.sort(f.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"===f.previewer.deferred.active.state()?t.duration:0,o.extended(f.Panel)&&(f.panel.each(function(e){e!==o&&e.expanded()&&(i=e,n=0)}),e||_.each(o.sections(),function(e){e.collapse({duration:0})})),m.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!==m("#tmpl-"+e.templateSelector).length?wp.template(e.templateSelector):wp.template("customize-"+e.containerType+"-default");return t&&e.container?m.trim(t(e.params)):"
  • "}}),f.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 f.Value,n.panel.bind(function(e){m(n.container).toggleClass("control-subsection",!!e)}),n.panel.set(n.params.panel||""),f.utils.bubbleChildValueChanges(n,["panel"]),n.embed(),n.deferred.embedded.done(function(){n.ready()})},embed:function(){var n=this,e=function(e){var t;e?f.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=m("#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(){f.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){f.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=m("#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(),m(window).on("resize.customizer-section",_.debounce(n,100)),setTimeout(_.bind(r._recalculateTopMargin,r),0)}),t.allowMultiple||f.section.each(function(e){e!==r&&e.collapse({duration:t.duration})}),r.panel()?f.panel(r.panel()).expand({duration:t.duration,completeCallback:i}):(f.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(),m(window).off("resize.customizer-section")):t.completeCallback&&t.completeCallback()},_recalculateTopMargin:function(){var e,t=this.container.find(".accordion-section-content");0!==t.length&&(e=m("#customize-header-actions").height(),0<(e=t.offset().top-e)&&t.css("margin-top",parseInt(t.css("margin-top"),10)-e))}}),f.ThemesSection=f.Section.extend({currentTheme:"",overlay:"",template:"",screenshotQueue:null,$window:m(window),initialize:function(){return this.$customizeSidebar=m(".wp-full-overlay-sidebar-content:first"),f.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"),m("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){f.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),n.expanded()?n.collapse():n.expand())}),n.container.on("click keydown",".left",function(e){f.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),n.previousTheme())}),n.container.on("click keydown",".right",function(e){f.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),n.nextTheme())}),n.container.on("click keydown",".theme-backdrop, .close",function(e){f.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)}),f.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?(f.section.each(function(e){e!==o&&e.collapse({duration:t.duration})}),f.panel.each(function(e){e.collapse({duration:0})}),u.show(0,function(){n=u.offset().top,i=s.scrollTop(),u.css("margin-top",m("#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(){f.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=f.control("theme_"+this.currentTheme),t=e.container.next("li.customize-control-theme");return!!t.length&&(t=t[0].id.replace("customize-control-",""),(e=f.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=f.control("theme_"+this.currentTheme),t=e.container.prev("li.customize-control-theme");return!!t.length&&(t=t[0].id.replace("customize-control-",""),(e=f.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(),m("body").addClass("modal-open"),n.containFocus(n.overlay),n.updateLimits(),t()},closeDetails:function(){m("body").removeClass("modal-open"),this.overlay.fadeOut("fast"),f.control("theme_"+this.currentTheme).focus()},containFocus:function(t){var n;t.on("keydown",function(e){if(9===e.keyCode)return(n=m(":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)})}}),f.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=m("#customize-theme-controls > ul");e.container.parent().is(t)||(t.append(e.container),e.renderContent()),f.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){f.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),n.expanded()||n.expand())}),n.container.find(".customize-panel-back").on("click keydown",function(e){f.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){f.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),m(this).attr("aria-expanded",!1)):(e.slideDown(n.defaultExpandedArguments.duration),t.toggleClass("open"),m(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=m("#customize-header-actions").height(),e?(f.section.each(function(e){o.id!==e.panel()&&e.collapse({duration:0})}),f.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=m("#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!==m("#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))}}),f.Control=f.Class.extend({defaultActiveArguments:{duration:"fast",completeCallback:m.noop},initialize:function(e,t){var i,o,a=this;a.params={},m.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?m(a.params.content):m(a.selector),a.deferred={embedded:new m.Deferred},a.section=new f.Value,a.priority=new f.Value,a.active=new f.Value,a.activeArgumentsQueue=[],a.elements=[],i=a.container.find("[data-customize-setting-link]"),o={},i.each(function(){var e,n=m(this);if(n.is(":radio")){if(e=n.prop("name"),o[e])return;o[e]=!0,n=i.filter('[name="'+e+'"]')}f(n.data("customizeSettingLink"),function(e){var t=new f.Element(n);a.elements.push(t),t.sync(e),t.set(e())})}),a.active.bind(function(e){var t=a.activeArgumentsQueue.shift(),t=m.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),f.utils.bubbleChildValueChanges(a,["section","priority","active"]),0===(e=m.map(a.params.settings,function(e){return e})).length?(a.setting=null,a.settings={},a.embed()):f.apply(f,e.concat(function(){for(var e in a.settings={},a.params.settings)a.settings[e]=f(a.params.settings[e]);a.setting=a.settings["default"]||null,a.embed()})),a.deferred.embedded.done(function(){a.ready()})},embed:function(){var n=this,e=function(e){var t;e&&f.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(){},expand:function(e){f.section(this.section()).expand(e)},focus:e,onChangeActive:function(e,t){t.unchanged?t.completeCallback&&t.completeCallback():m.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){f.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!==m("#tmpl-"+t.templateSelector).length&&(e=wp.template(t.templateSelector))&&t.container&&t.container.html(e(t.params))}}),f.ColorControl=f.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)})}}),f.MediaControl=f.Control.extend({ready:function(){var t=this;_.bindAll(t,"restoreDefault","removeFile","openFrame","select","pausePlayer"),t.container.on("click keydown",".upload-button",t.openFrame),t.container.on("click keydown",".upload-button",t.pausePlayer),t.container.on("click keydown",".thumbnail-image img",t.openFrame),t.container.on("click keydown",".default-button",t.restoreDefault),t.container.on("click keydown",".remove-button",t.pausePlayer),t.container.on("click keydown",".remove-button",t.removeFile),t.container.on("click keydown",".remove-button",t.cleanupPlayer),f.section(t.section()).container.on("expanded",function(){t.player&&t.player.setControlsSize()}).on("collapsed",function(){t.pausePlayer()}),t.setting.bind(function(e){wp.media.attachment(e).fetch().done(function(){wp.customize.previewer.send(t.setting.id+"-attachment-data",this.attributes)}),t.renderContent()})},pausePlayer:function(){this.player&&this.player.pause()},cleanupPlayer:function(){this.player&&wp.media.mixin.removePlayer(this.player)},openFrame:function(e){f.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){f.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),this.params.attachment=this.params.defaultAttachment,this.setting(this.params.defaultAttachment.url))},removeFile:function(e){f.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),this.params.attachment={},this.setting(""),this.renderContent())}}),f.UploadControl=f.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(){}}),f.ImageControl=f.UploadControl.extend({thumbnailSrc:function(){}}),f.BackgroundControl=f.UploadControl.extend({ready:function(){f.UploadControl.prototype.ready.apply(this,arguments)},select:function(){f.UploadControl.prototype.select.apply(this,arguments),wp.ajax.post("custom-background-add",{nonce:_wpCustomizeBackground.nonces.add,wp_customize:"on",theme:f.settings.theme.stylesheet,attachment_id:this.params.attachment.id})}}),f.CroppedImageControl=f.MediaControl.extend({openFrame:function(e){f.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=m("