summaryrefslogtreecommitdiffstats
path: root/wp-admin/js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:57:30 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:57:30 +0000
commitfa9a33d818470a5796f0ff8797f98b510ed8de18 (patch)
treebde6a1eede376f9b5df5898ce812330152984d8e /wp-admin/js
parentReleasing progress-linux version 6.4.3+dfsg1-1~progress7.99u1. (diff)
downloadwordpress-fa9a33d818470a5796f0ff8797f98b510ed8de18.tar.xz
wordpress-fa9a33d818470a5796f0ff8797f98b510ed8de18.zip
Merging upstream version 6.5+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'wp-admin/js')
-rw-r--r--wp-admin/js/comment.js2
-rw-r--r--wp-admin/js/common.js17
-rw-r--r--wp-admin/js/common.min.js2
-rw-r--r--wp-admin/js/customize-controls.js2
-rw-r--r--wp-admin/js/customize-controls.min.js2
-rw-r--r--wp-admin/js/customize-nav-menus.js13
-rw-r--r--wp-admin/js/customize-nav-menus.min.js2
-rw-r--r--wp-admin/js/inline-edit-post.js41
-rw-r--r--wp-admin/js/inline-edit-post.min.js2
-rw-r--r--wp-admin/js/media.js2
-rw-r--r--wp-admin/js/media.min.js2
-rw-r--r--wp-admin/js/post.js10
-rw-r--r--wp-admin/js/post.min.js2
-rw-r--r--wp-admin/js/site-health.js2
-rw-r--r--wp-admin/js/site-health.min.js2
-rw-r--r--wp-admin/js/site-icon.js236
-rw-r--r--wp-admin/js/site-icon.min.js2
-rw-r--r--wp-admin/js/tags-suggest.js23
-rw-r--r--wp-admin/js/tags-suggest.min.js2
-rw-r--r--wp-admin/js/theme.js2
-rw-r--r--wp-admin/js/updates.js696
-rw-r--r--wp-admin/js/updates.min.js2
-rw-r--r--wp-admin/js/user-profile.js2
23 files changed, 907 insertions, 161 deletions
diff --git a/wp-admin/js/comment.js b/wp-admin/js/comment.js
index 4e4f3c5..188caab 100644
--- a/wp-admin/js/comment.js
+++ b/wp-admin/js/comment.js
@@ -70,7 +70,7 @@ jQuery( function($) {
* @param {Event} event The event object.
* @return {void}
*/
- $timestampdiv.find('.save-timestamp').on( 'click', function( event ) { // Crazyhorse - multiple OK cancels.
+ $timestampdiv.find('.save-timestamp').on( 'click', function( event ) { // Crazyhorse branch - multiple OK cancels.
var aa = $('#aa').val(), mm = $('#mm').val(), jj = $('#jj').val(), hh = $('#hh').val(), mn = $('#mn').val(),
newD = new Date( aa, mm - 1, jj, hh, mn );
diff --git a/wp-admin/js/common.js b/wp-admin/js/common.js
index 3de9447..af6cedc 100644
--- a/wp-admin/js/common.js
+++ b/wp-admin/js/common.js
@@ -354,6 +354,21 @@ window.setPostThumbnailL10n = window.setPostThumbnailL10n || {
window.setPostThumbnailL10n = deprecateL10nObject( 'setPostThumbnailL10n', window.setPostThumbnailL10n, '5.5.0' );
/**
+ * Removed in 6.5.0, needed for back-compatibility.
+ *
+ * @since 4.5.0
+ * @deprecated 6.5.0
+ */
+window.uiAutocompleteL10n = window.uiAutocompleteL10n || {
+ noResults: '',
+ oneResult: '',
+ manyResults: '',
+ itemSelected: ''
+};
+
+window.uiAutocompleteL10n = deprecateL10nObject( 'uiAutocompleteL10n', window.uiAutocompleteL10n, '6.5.0' );
+
+/**
* Removed in 3.3.0, needed for back-compatibility.
*
* @since 2.7.0
@@ -1154,7 +1169,7 @@ $( function() {
lastClicked = this;
// Toggle the "Select all" checkboxes depending if the other ones are all checked or not.
- var unchecked = $(this).closest('tbody').find(':checkbox').filter(':visible:enabled').not(':checked');
+ var unchecked = $(this).closest('tbody').find('tr.iedit').find(':checkbox').filter(':visible:enabled').not(':checked');
/**
* Determines if all checkboxes are checked.
diff --git a/wp-admin/js/common.min.js b/wp-admin/js/common.min.js
index 200bce1..c994b69 100644
--- a/wp-admin/js/common.min.js
+++ b/wp-admin/js/common.min.js
@@ -1,2 +1,2 @@
/*! This file is auto-generated */
-!function(W,$){var Q=W(document),V=W($),q=W(document.body),H=wp.i18n.__,i=wp.i18n.sprintf;function r(e,t,n){n=void 0!==n?i(H("%1$s is deprecated since version %2$s! Use %3$s instead."),e,t,n):i(H("%1$s is deprecated since version %2$s with no alternative available."),e,t);$.console.warn(n)}function e(i,o,a){var s={};return Object.keys(o).forEach(function(e){var t=o[e],n=i+"."+e;"object"==typeof t?Object.defineProperty(s,e,{get:function(){return r(n,a,t.alternative),t.func()}}):Object.defineProperty(s,e,{get:function(){return r(n,a,"wp.i18n"),t}})}),s}$.wp.deprecateL10nObject=e,$.commonL10n=$.commonL10n||{warnDelete:"",dismiss:"",collapseMenu:"",expandMenu:""},$.commonL10n=e("commonL10n",$.commonL10n,"5.5.0"),$.wpPointerL10n=$.wpPointerL10n||{dismiss:""},$.wpPointerL10n=e("wpPointerL10n",$.wpPointerL10n,"5.5.0"),$.userProfileL10n=$.userProfileL10n||{warn:"",warnWeak:"",show:"",hide:"",cancel:"",ariaShow:"",ariaHide:""},$.userProfileL10n=e("userProfileL10n",$.userProfileL10n,"5.5.0"),$.privacyToolsL10n=$.privacyToolsL10n||{noDataFound:"",foundAndRemoved:"",noneRemoved:"",someNotRemoved:"",removalError:"",emailSent:"",noExportFile:"",exportError:""},$.privacyToolsL10n=e("privacyToolsL10n",$.privacyToolsL10n,"5.5.0"),$.authcheckL10n={beforeunload:""},$.authcheckL10n=$.authcheckL10n||e("authcheckL10n",$.authcheckL10n,"5.5.0"),$.tagsl10n={noPerm:"",broken:""},$.tagsl10n=$.tagsl10n||e("tagsl10n",$.tagsl10n,"5.5.0"),$.adminCommentsL10n=$.adminCommentsL10n||{hotkeys_highlight_first:{alternative:"window.adminCommentsSettings.hotkeys_highlight_first",func:function(){return $.adminCommentsSettings.hotkeys_highlight_first}},hotkeys_highlight_last:{alternative:"window.adminCommentsSettings.hotkeys_highlight_last",func:function(){return $.adminCommentsSettings.hotkeys_highlight_last}},replyApprove:"",reply:"",warnQuickEdit:"",warnCommentChanges:"",docTitleComments:"",docTitleCommentsCount:""},$.adminCommentsL10n=e("adminCommentsL10n",$.adminCommentsL10n,"5.5.0"),$.tagsSuggestL10n=$.tagsSuggestL10n||{tagDelimiter:"",removeTerm:"",termSelected:"",termAdded:"",termRemoved:""},$.tagsSuggestL10n=e("tagsSuggestL10n",$.tagsSuggestL10n,"5.5.0"),$.wpColorPickerL10n=$.wpColorPickerL10n||{clear:"",clearAriaLabel:"",defaultString:"",defaultAriaLabel:"",pick:"",defaultLabel:""},$.wpColorPickerL10n=e("wpColorPickerL10n",$.wpColorPickerL10n,"5.5.0"),$.attachMediaBoxL10n=$.attachMediaBoxL10n||{error:""},$.attachMediaBoxL10n=e("attachMediaBoxL10n",$.attachMediaBoxL10n,"5.5.0"),$.postL10n=$.postL10n||{ok:"",cancel:"",publishOn:"",publishOnFuture:"",publishOnPast:"",dateFormat:"",showcomm:"",endcomm:"",publish:"",schedule:"",update:"",savePending:"",saveDraft:"",private:"",public:"",publicSticky:"",password:"",privatelyPublished:"",published:"",saveAlert:"",savingText:"",permalinkSaved:""},$.postL10n=e("postL10n",$.postL10n,"5.5.0"),$.inlineEditL10n=$.inlineEditL10n||{error:"",ntdeltitle:"",notitle:"",comma:"",saved:""},$.inlineEditL10n=e("inlineEditL10n",$.inlineEditL10n,"5.5.0"),$.plugininstallL10n=$.plugininstallL10n||{plugin_information:"",plugin_modal_label:"",ays:""},$.plugininstallL10n=e("plugininstallL10n",$.plugininstallL10n,"5.5.0"),$.navMenuL10n=$.navMenuL10n||{noResultsFound:"",warnDeleteMenu:"",saveAlert:"",untitled:""},$.navMenuL10n=e("navMenuL10n",$.navMenuL10n,"5.5.0"),$.commentL10n=$.commentL10n||{submittedOn:"",dateFormat:""},$.commentL10n=e("commentL10n",$.commentL10n,"5.5.0"),$.setPostThumbnailL10n=$.setPostThumbnailL10n||{setThumbnail:"",saving:"",error:"",done:""},$.setPostThumbnailL10n=e("setPostThumbnailL10n",$.setPostThumbnailL10n,"5.5.0"),$.adminMenu={init:function(){},fold:function(){},restoreMenuState:function(){},toggle:function(){},favorites:function(){}},$.columns={init:function(){var n=this;W(".hide-column-tog","#adv-settings").on("click",function(){var e=W(this),t=e.val();e.prop("checked")?n.checked(t):n.unchecked(t),columns.saveManageColumnsState()})},saveManageColumnsState:function(){var e=this.hidden();W.post(ajaxurl,{action:"hidden-columns",hidden:e,screenoptionnonce:W("#screenoptionnonce").val(),page:pagenow})},checked:function(e){W(".column-"+e).removeClass("hidden"),this.colSpanChange(1)},unchecked:function(e){W(".column-"+e).addClass("hidden"),this.colSpanChange(-1)},hidden:function(){return W(".manage-column[id]").filter(".hidden").map(function(){return this.id}).get().join(",")},useCheckboxesForHidden:function(){this.hidden=function(){return W(".hide-column-tog").not(":checked").map(function(){var e=this.id;return e.substring(e,e.length-5)}).get().join(",")}},colSpanChange:function(e){var t=W("table").find(".colspanchange");t.length&&(e=parseInt(t.attr("colspan"),10)+e,t.attr("colspan",e.toString()))}},W(function(){columns.init()}),$.validateForm=function(e){return!W(e).find(".form-required").filter(function(){return""===W(":input:visible",this).val()}).addClass("form-invalid").find(":input:visible").on("change",function(){W(this).closest(".form-invalid").removeClass("form-invalid")}).length},$.showNotice={warn:function(){return!!confirm(H("You are about to permanently delete these items from your site.\nThis action cannot be undone.\n'Cancel' to stop, 'OK' to delete."))},note:function(e){alert(e)}},$.screenMeta={element:null,toggles:null,page:null,init:function(){this.element=W("#screen-meta"),this.toggles=W("#screen-meta-links").find(".show-settings"),this.page=W("#wpcontent"),this.toggles.on("click",this.toggleEvent)},toggleEvent:function(){var e=W("#"+W(this).attr("aria-controls"));e.length&&(e.is(":visible")?screenMeta.close(e,W(this)):screenMeta.open(e,W(this)))},open:function(e,t){W("#screen-meta-links").find(".screen-meta-toggle").not(t.parent()).css("visibility","hidden"),e.parent().show(),e.slideDown("fast",function(){e.removeClass("hidden").trigger("focus"),t.addClass("screen-meta-active").attr("aria-expanded",!0)}),Q.trigger("screen:options:open")},close:function(e,t){e.slideUp("fast",function(){t.removeClass("screen-meta-active").attr("aria-expanded",!1),W(".screen-meta-toggle").css("visibility",""),e.parent().hide(),e.addClass("hidden")}),Q.trigger("screen:options:close")}},W(".contextual-help-tabs").on("click","a",function(e){var t=W(this);if(e.preventDefault(),t.is(".active a"))return!1;W(".contextual-help-tabs .active").removeClass("active"),t.parent("li").addClass("active"),e=W(t.attr("href")),W(".help-tab-content").not(e).removeClass("active").hide(),e.addClass("active").show()});var t,a=!1,s=W("#permalink_structure"),n=W(".permalink-structure input:radio"),l=W("#custom_selection"),o=W(".form-table.permalink-structure .available-structure-tags button");function c(e){-1!==s.val().indexOf(e.text().trim())?(e.attr("data-label",e.attr("aria-label")),e.attr("aria-label",e.attr("data-used")),e.attr("aria-pressed",!0),e.addClass("active")):e.attr("data-label")&&(e.attr("aria-label",e.attr("data-label")),e.attr("aria-pressed",!1),e.removeClass("active"))}function d(){Q.trigger("wp-window-resized")}n.on("change",function(){"custom"!==this.value&&(s.val(this.value),o.each(function(){c(W(this))}))}),s.on("click input",function(){l.prop("checked",!0)}),s.on("focus",function(e){a=!0,W(this).off(e)}),o.each(function(){c(W(this))}),s.on("change",function(){o.each(function(){c(W(this))})}),o.on("click",function(){var e=s.val(),t=s[0].selectionStart,n=s[0].selectionEnd,i=W(this).text().trim(),o=W(this).hasClass("active")?W(this).attr("data-removed"):W(this).attr("data-added");-1!==e.indexOf(i)?(e=e.replace(i+"/",""),s.val("/"===e?"":e),W("#custom_selection_updated").text(o),c(W(this))):(a||0!==t||0!==n||(t=n=e.length),l.prop("checked",!0),"/"!==e.substr(0,t).substr(-1)&&(i="/"+i),"/"!==e.substr(n,1)&&(i+="/"),s.val(e.substr(0,t)+i+e.substr(n)),W("#custom_selection_updated").text(o),c(W(this)),a&&s[0].setSelectionRange&&(n=(e.substr(0,t)+i).length,s[0].setSelectionRange(n,n),s.trigger("focus")))}),W(function(){var n,i,o,a,e,t,s,r,l,c,d=!1,u=W("input.current-page"),z=u.val(),p=/iPhone|iPad|iPod/.test(navigator.userAgent),N=-1!==navigator.userAgent.indexOf("Android"),m=W("#adminmenuwrap"),h=W("#wpwrap"),f=W("#adminmenu"),g=W("#wp-responsive-overlay"),v=W("#wp-toolbar"),b=v.find('a[aria-haspopup="true"]'),w=W(".meta-box-sortables"),k=!1,C=W("#wpadminbar"),y=0,L=!1,x=!1,S=0,P=!1,T={window:V.height(),wpwrap:h.height(),adminbar:C.height(),menu:m.height()},A=W(".wp-header-end");function M(){var e=W("a.wp-has-current-submenu");"folded"===s?e.attr("aria-haspopup","true"):e.attr("aria-haspopup","false")}function _(e){var t=e.find(".wp-submenu"),e=e.offset().top,n=V.scrollTop(),i=e-n-30,e=e+t.height()+1,o=60+e-h.height(),n=V.height()+n-50;1<(o=i<(o=n<e-o?e-n:o)?i:o)&&W("#wp-admin-bar-menu-toggle").is(":hidden")?t.css("margin-top","-"+o+"px"):t.css("margin-top","")}function D(){W(".notice.is-dismissible").each(function(){var t=W(this),e=W('<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>');t.find(".notice-dismiss").length||(e.find(".screen-reader-text").text(H("Dismiss this notice.")),e.on("click.wp-dismiss-notice",function(e){e.preventDefault(),t.fadeTo(100,0,function(){t.slideUp(100,function(){t.remove()})})}),t.append(e))})}function E(e,t,n,i){n.on("change",function(){e.val(W(this).val())}),e.on("change",function(){n.val(W(this).val())}),i.on("click",function(e){e.preventDefault(),e.stopPropagation(),t.trigger("click")})}function R(){r.prop("disabled",""===l.map(function(){return W(this).val()}).get().join(""))}function F(e){var t=V.scrollTop(),e=!e||"scroll"!==e.type;if(!p&&!f.data("wp-responsive"))if(T.menu+T.adminbar<T.window||T.menu+T.adminbar+20>T.wpwrap)j();else{if(P=!0,T.menu+T.adminbar>T.window){if(t<0)return void(L||(x=!(L=!0),m.css({position:"fixed",top:"",bottom:""})));if(t+T.window>Q.height()-1)return void(x||(L=!(x=!0),m.css({position:"fixed",top:"",bottom:0})));y<t?L?(L=!1,(S=m.offset().top-T.adminbar-(t-y))+T.menu+T.adminbar<t+T.window&&(S=t+T.window-T.menu-T.adminbar),m.css({position:"absolute",top:S,bottom:""})):!x&&m.offset().top+T.menu<t+T.window&&(x=!0,m.css({position:"fixed",top:"",bottom:0})):t<y?x?(x=!1,(S=m.offset().top-T.adminbar+(y-t))+T.menu>t+T.window&&(S=t),m.css({position:"absolute",top:S,bottom:""})):!L&&m.offset().top>=t+T.adminbar&&(L=!0,m.css({position:"fixed",top:"",bottom:""})):e&&(L=x=!1,0<(S=t+T.window-T.menu-T.adminbar-1)?m.css({position:"absolute",top:S,bottom:""}):j())}y=t}}function U(){T={window:V.height(),wpwrap:h.height(),adminbar:C.height(),menu:m.height()}}function j(){!p&&P&&(L=x=P=!1,m.css({position:"",top:"",bottom:""}))}function O(){U(),f.data("wp-responsive")?(q.removeClass("sticky-menu"),j()):T.menu+T.adminbar>T.window?(F(),q.removeClass("sticky-menu")):(q.addClass("sticky-menu"),j())}function K(){W(".aria-button-if-js").attr("role","button")}function I(){var e=!1;return e=$.innerWidth?Math.max($.innerWidth,document.documentElement.clientWidth):e}function B(){var e=I()||961;s=e<=782?"responsive":q.hasClass("folded")||q.hasClass("auto-fold")&&e<=960&&782<e?"folded":"open",Q.trigger("wp-menu-state-set",{state:s})}f.on("click.wp-submenu-head",".wp-submenu-head",function(e){W(e.target).parent().siblings("a").get(0).click()}),W("#collapse-button").on("click.collapse-menu",function(){var e=I()||961;W("#adminmenu div.wp-submenu").css("margin-top",""),s=e<=960?q.hasClass("auto-fold")?(q.removeClass("auto-fold").removeClass("folded"),setUserSetting("unfold",1),setUserSetting("mfold","o"),"open"):(q.addClass("auto-fold"),setUserSetting("unfold",0),"folded"):q.hasClass("folded")?(q.removeClass("folded"),setUserSetting("mfold","o"),"open"):(q.addClass("folded"),setUserSetting("mfold","f"),"folded"),Q.trigger("wp-collapse-menu",{state:s})}),Q.on("wp-menu-state-set wp-collapse-menu wp-responsive-activate wp-responsive-deactivate",M),("ontouchstart"in $||/IEMobile\/[1-9]/.test(navigator.userAgent))&&(q.on((c=p?"touchstart":"click")+".wp-mobile-hover",function(e){f.data("wp-responsive")||W(e.target).closest("#adminmenu").length||f.find("li.opensub").removeClass("opensub")}),f.find("a.wp-has-submenu").on(c+".wp-mobile-hover",function(e){var t=W(this).parent();f.data("wp-responsive")||t.hasClass("opensub")||t.hasClass("wp-menu-open")&&!(t.width()<40)||(e.preventDefault(),_(t),f.find("li.opensub").removeClass("opensub"),t.addClass("opensub"))})),p||N||(f.find("li.wp-has-submenu").hoverIntent({over:function(){var e=W(this),t=e.find(".wp-submenu"),t=parseInt(t.css("top"),10);isNaN(t)||-5<t||f.data("wp-responsive")||(_(e),f.find("li.opensub").removeClass("opensub"),e.addClass("opensub"))},out:function(){f.data("wp-responsive")||W(this).removeClass("opensub").find(".wp-submenu").css("margin-top","")},timeout:200,sensitivity:7,interval:90}),f.on("focus.adminmenu",".wp-submenu a",function(e){f.data("wp-responsive")||W(e.target).closest("li.menu-top").addClass("opensub")}).on("blur.adminmenu",".wp-submenu a",function(e){f.data("wp-responsive")||W(e.target).closest("li.menu-top").removeClass("opensub")}).find("li.wp-has-submenu.wp-not-current-submenu").on("focusin.adminmenu",function(){_(W(this))})),A.length||(A=W(".wrap h1, .wrap h2").first()),W("div.updated, div.error, div.notice").not(".inline, .below-h2").insertAfter(A),Q.on("wp-updates-notice-added wp-plugin-install-error wp-plugin-update-error wp-plugin-delete-error wp-theme-install-error wp-theme-delete-error",D),screenMeta.init(),q.on("click","tbody > tr > .check-column :checkbox",function(e){if("undefined"!=e.shiftKey){if(e.shiftKey){if(!d)return!0;n=W(d).closest("form").find(":checkbox").filter(":visible:enabled"),i=n.index(d),o=n.index(this),a=W(this).prop("checked"),0<i&&0<o&&i!=o&&(i<o?n.slice(i,o):n.slice(o,i)).prop("checked",function(){return!!W(this).closest("tr").is(":visible")&&a})}var t=W(d=this).closest("tbody").find(":checkbox").filter(":visible:enabled").not(":checked");W(this).closest("table").children("thead, tfoot").find(":checkbox").prop("checked",function(){return 0===t.length})}return!0}),q.on("click.wp-toggle-checkboxes","thead .check-column :checkbox, tfoot .check-column :checkbox",function(e){var t=W(this),n=t.closest("table"),i=t.prop("checked"),o=e.shiftKey||t.data("wp-toggle");n.children("tbody").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked",function(){return!W(this).is(":hidden,:disabled")&&(o?!W(this).prop("checked"):!!i)}),n.children("thead, tfoot").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked",function(){return!o&&!!i})}),E(W("#bulk-action-selector-top"),W("#doaction"),W("#bulk-action-selector-bottom"),W("#doaction2")),E(W("#new_role"),W("#changeit"),W("#new_role2"),W("#changeit2")),W("#wpbody-content").on({focusin:function(){clearTimeout(e),t=W(this).find(".row-actions"),W(".row-actions").not(this).removeClass("visible"),t.addClass("visible")},focusout:function(){e=setTimeout(function(){t.removeClass("visible")},30)}},".table-view-list .has-row-actions"),W("tbody").on("click",".toggle-row",function(){W(this).closest("tr").toggleClass("is-expanded")}),W("#default-password-nag-no").on("click",function(){return setUserSetting("default_password_nag","hide"),W("div.default-password-nag").hide(),!1}),W("#newcontent").on("keydown.wpevent_InsertTab",function(e){var t,n,i,o,a=e.target;27==e.keyCode?(e.preventDefault(),W(a).data("tab-out",!0)):9!=e.keyCode||e.ctrlKey||e.altKey||e.shiftKey||(W(a).data("tab-out")?W(a).data("tab-out",!1):(t=a.selectionStart,n=a.selectionEnd,i=a.value,document.selection?(a.focus(),document.selection.createRange().text="\t"):0<=t&&(o=this.scrollTop,a.value=i.substring(0,t).concat("\t",i.substring(n)),a.selectionStart=a.selectionEnd=t+1,this.scrollTop=o),e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()))}),u.length&&u.closest("form").on("submit",function(){-1==W('select[name="action"]').val()&&u.val()==z&&u.val("1")}),W('.search-box input[type="search"], .search-box input[type="submit"]').on("mousedown",function(){W('select[name^="action"]').val("-1")}),W("#contextual-help-link, #show-settings-link").on("focus.scroll-into-view",function(e){e.target.scrollIntoViewIfNeeded&&e.target.scrollIntoViewIfNeeded(!1)}),(c=W("form.wp-upload-form")).length&&(r=c.find('input[type="submit"]'),l=c.find('input[type="file"]'),R(),l.on("change",R)),p||(V.on("scroll.pin-menu",F),Q.on("tinymce-editor-init.pin-menu",function(e,t){t.on("wp-autoresize",U)})),$.wpResponsive={init:function(){var e=this;this.maybeDisableSortables=this.maybeDisableSortables.bind(this),Q.on("wp-responsive-activate.wp-responsive",function(){e.activate()}).on("wp-responsive-deactivate.wp-responsive",function(){e.deactivate()}),W("#wp-admin-bar-menu-toggle a").attr("aria-expanded","false"),W("#wp-admin-bar-menu-toggle").on("click.wp-responsive",function(e){e.preventDefault(),C.find(".hover").removeClass("hover"),h.toggleClass("wp-responsive-open"),h.hasClass("wp-responsive-open")?(W(this).find("a").attr("aria-expanded","true"),W("#adminmenu a:first").trigger("focus")):W(this).find("a").attr("aria-expanded","false")}),W(document).on("click",function(e){var t;h.hasClass("wp-responsive-open")&&document.hasFocus()&&(t=W.contains(W("#wp-admin-bar-menu-toggle")[0],e.target),e=W.contains(W("#adminmenuwrap")[0],e.target),t||e||W("#wp-admin-bar-menu-toggle").trigger("click.wp-responsive"))}),W(document).on("keyup",function(e){var n,i,o=W("#wp-admin-bar-menu-toggle")[0];h.hasClass("wp-responsive-open")&&(27===e.keyCode?(W(o).trigger("click.wp-responsive"),W(o).find("a").trigger("focus")):9===e.keyCode&&(n=W("#adminmenuwrap")[0],i=e.relatedTarget||document.activeElement,setTimeout(function(){var e=W.contains(o,i),t=W.contains(n,i);e||t||W(o).trigger("click.wp-responsive")},10)))}),f.on("click.wp-responsive","li.wp-has-submenu > a",function(e){f.data("wp-responsive")&&(W(this).parent("li").toggleClass("selected"),W(this).trigger("focus"),e.preventDefault())}),e.trigger(),Q.on("wp-window-resized.wp-responsive",this.trigger.bind(this)),V.on("load.wp-responsive",this.maybeDisableSortables),Q.on("postbox-toggled",this.maybeDisableSortables),W("#screen-options-wrap input").on("click",this.maybeDisableSortables)},maybeDisableSortables:function(){(-1<navigator.userAgent.indexOf("AppleWebKit/")?V.width():$.innerWidth)<=782||w.find(".ui-sortable-handle:visible").length<=1&&jQuery(".columns-prefs-1 input").prop("checked")?this.disableSortables():this.enableSortables()},activate:function(){O(),q.hasClass("auto-fold")||q.addClass("auto-fold"),f.data("wp-responsive",1),this.disableSortables()},deactivate:function(){O(),f.removeData("wp-responsive"),this.maybeDisableSortables()},trigger:function(){var e=I();e&&(e<=782?k||(Q.trigger("wp-responsive-activate"),k=!0):k&&(Q.trigger("wp-responsive-deactivate"),k=!1),e<=480?this.enableOverlay():this.disableOverlay(),this.maybeDisableSortables())},enableOverlay:function(){0===g.length&&(g=W('<div id="wp-responsive-overlay"></div>').insertAfter("#wpcontent").hide().on("click.wp-responsive",function(){v.find(".menupop.hover").removeClass("hover"),W(this).hide()})),b.on("click.wp-responsive",function(){g.show()})},disableOverlay:function(){b.off("click.wp-responsive"),g.hide()},disableSortables:function(){if(w.length)try{w.sortable("disable"),w.find(".ui-sortable-handle").addClass("is-non-sortable")}catch(e){}},enableSortables:function(){if(w.length)try{w.sortable("enable"),w.find(".ui-sortable-handle").removeClass("is-non-sortable")}catch(e){}}},W(document).on("ajaxComplete",function(){K()}),Q.on("wp-window-resized.set-menu-state",B),Q.on("wp-menu-state-set wp-collapse-menu",function(e,t){var n,i=W("#collapse-button"),t="folded"===t.state?(n="false",H("Expand Main menu")):(n="true",H("Collapse Main menu"));i.attr({"aria-expanded":n,"aria-label":t})}),$.wpResponsive.init(),O(),B(),M(),D(),K(),Q.on("wp-pin-menu wp-window-resized.pin-menu postboxes-columnchange.pin-menu postbox-toggled.pin-menu wp-collapse-menu.pin-menu wp-scroll-start.pin-menu",O),W(".wp-initial-focus").trigger("focus"),q.on("click",".js-update-details-toggle",function(){var e=W(this).closest(".js-update-details"),t=W("#"+e.data("update-details"));t.hasClass("update-details-moved")||t.insertAfter(e).addClass("update-details-moved"),t.toggle(),W(this).attr("aria-expanded",t.is(":visible"))})}),W(function(e){var t,n;q.hasClass("update-php")&&(t=e("a.update-from-upload-overwrite"),n=e(".update-from-upload-expired"),t.length)&&n.length&&$.setTimeout(function(){t.hide(),n.removeClass("hidden"),$.wp&&$.wp.a11y&&$.wp.a11y.speak(n.text())},714e4)}),V.on("resize.wp-fire-once",function(){$.clearTimeout(t),t=$.setTimeout(d,200)}),"-ms-user-select"in document.documentElement.style&&navigator.userAgent.match(/IEMobile\/10\.0/)&&((n=document.createElement("style")).appendChild(document.createTextNode("@-ms-viewport{width:auto!important}")),document.getElementsByTagName("head")[0].appendChild(n))}(jQuery,window),function(){var e,i={},o={};i.pauseAll=!1,!window.matchMedia||(e=window.matchMedia("(prefers-reduced-motion: reduce)"))&&!e.matches||(i.pauseAll=!0),i.freezeAnimatedPluginIcons=function(l){function e(){var e=l.width,t=l.height,n=document.createElement("canvas");if(n.width=e,n.height=t,n.className=l.className,l.closest("#update-plugins-table"))for(var i=window.getComputedStyle(l),o=0,a=i.length;o<a;o++){var s=i[o],r=i.getPropertyValue(s);n.style[s]=r}n.getContext("2d").drawImage(l,0,0,e,t),n.setAttribute("aria-hidden","true"),n.setAttribute("role","presentation"),l.parentNode.insertBefore(n,l),l.style.opacity=.01,l.style.width="0px",l.style.height="0px"}l.complete?e():l.addEventListener("load",e,!0)},o.freezeAll=function(){for(var e=document.querySelectorAll(".plugin-icon, #update-plugins-table img"),t=0;t<e.length;t++)/\.gif(?:\?|$)/i.test(e[t].src)&&i.freezeAnimatedPluginIcons(e[t])},!0===i.pauseAll&&o.freezeAll(),e=jQuery,"plugin-install"===window.pagenow&&e(document).ajaxComplete(function(e,t,n){n.data&&"string"==typeof n.data&&n.data.includes("action=search-install-plugins")&&(window.matchMedia?window.matchMedia("(prefers-reduced-motion: reduce)").matches&&o.freezeAll():!0===i.pauseAll&&o.freezeAll())})}(); \ No newline at end of file
+!function(W,$){var Q=W(document),V=W($),q=W(document.body),H=wp.i18n.__,i=wp.i18n.sprintf;function r(e,t,n){n=void 0!==n?i(H("%1$s is deprecated since version %2$s! Use %3$s instead."),e,t,n):i(H("%1$s is deprecated since version %2$s with no alternative available."),e,t);$.console.warn(n)}function e(i,o,a){var s={};return Object.keys(o).forEach(function(e){var t=o[e],n=i+"."+e;"object"==typeof t?Object.defineProperty(s,e,{get:function(){return r(n,a,t.alternative),t.func()}}):Object.defineProperty(s,e,{get:function(){return r(n,a,"wp.i18n"),t}})}),s}$.wp.deprecateL10nObject=e,$.commonL10n=$.commonL10n||{warnDelete:"",dismiss:"",collapseMenu:"",expandMenu:""},$.commonL10n=e("commonL10n",$.commonL10n,"5.5.0"),$.wpPointerL10n=$.wpPointerL10n||{dismiss:""},$.wpPointerL10n=e("wpPointerL10n",$.wpPointerL10n,"5.5.0"),$.userProfileL10n=$.userProfileL10n||{warn:"",warnWeak:"",show:"",hide:"",cancel:"",ariaShow:"",ariaHide:""},$.userProfileL10n=e("userProfileL10n",$.userProfileL10n,"5.5.0"),$.privacyToolsL10n=$.privacyToolsL10n||{noDataFound:"",foundAndRemoved:"",noneRemoved:"",someNotRemoved:"",removalError:"",emailSent:"",noExportFile:"",exportError:""},$.privacyToolsL10n=e("privacyToolsL10n",$.privacyToolsL10n,"5.5.0"),$.authcheckL10n={beforeunload:""},$.authcheckL10n=$.authcheckL10n||e("authcheckL10n",$.authcheckL10n,"5.5.0"),$.tagsl10n={noPerm:"",broken:""},$.tagsl10n=$.tagsl10n||e("tagsl10n",$.tagsl10n,"5.5.0"),$.adminCommentsL10n=$.adminCommentsL10n||{hotkeys_highlight_first:{alternative:"window.adminCommentsSettings.hotkeys_highlight_first",func:function(){return $.adminCommentsSettings.hotkeys_highlight_first}},hotkeys_highlight_last:{alternative:"window.adminCommentsSettings.hotkeys_highlight_last",func:function(){return $.adminCommentsSettings.hotkeys_highlight_last}},replyApprove:"",reply:"",warnQuickEdit:"",warnCommentChanges:"",docTitleComments:"",docTitleCommentsCount:""},$.adminCommentsL10n=e("adminCommentsL10n",$.adminCommentsL10n,"5.5.0"),$.tagsSuggestL10n=$.tagsSuggestL10n||{tagDelimiter:"",removeTerm:"",termSelected:"",termAdded:"",termRemoved:""},$.tagsSuggestL10n=e("tagsSuggestL10n",$.tagsSuggestL10n,"5.5.0"),$.wpColorPickerL10n=$.wpColorPickerL10n||{clear:"",clearAriaLabel:"",defaultString:"",defaultAriaLabel:"",pick:"",defaultLabel:""},$.wpColorPickerL10n=e("wpColorPickerL10n",$.wpColorPickerL10n,"5.5.0"),$.attachMediaBoxL10n=$.attachMediaBoxL10n||{error:""},$.attachMediaBoxL10n=e("attachMediaBoxL10n",$.attachMediaBoxL10n,"5.5.0"),$.postL10n=$.postL10n||{ok:"",cancel:"",publishOn:"",publishOnFuture:"",publishOnPast:"",dateFormat:"",showcomm:"",endcomm:"",publish:"",schedule:"",update:"",savePending:"",saveDraft:"",private:"",public:"",publicSticky:"",password:"",privatelyPublished:"",published:"",saveAlert:"",savingText:"",permalinkSaved:""},$.postL10n=e("postL10n",$.postL10n,"5.5.0"),$.inlineEditL10n=$.inlineEditL10n||{error:"",ntdeltitle:"",notitle:"",comma:"",saved:""},$.inlineEditL10n=e("inlineEditL10n",$.inlineEditL10n,"5.5.0"),$.plugininstallL10n=$.plugininstallL10n||{plugin_information:"",plugin_modal_label:"",ays:""},$.plugininstallL10n=e("plugininstallL10n",$.plugininstallL10n,"5.5.0"),$.navMenuL10n=$.navMenuL10n||{noResultsFound:"",warnDeleteMenu:"",saveAlert:"",untitled:""},$.navMenuL10n=e("navMenuL10n",$.navMenuL10n,"5.5.0"),$.commentL10n=$.commentL10n||{submittedOn:"",dateFormat:""},$.commentL10n=e("commentL10n",$.commentL10n,"5.5.0"),$.setPostThumbnailL10n=$.setPostThumbnailL10n||{setThumbnail:"",saving:"",error:"",done:""},$.setPostThumbnailL10n=e("setPostThumbnailL10n",$.setPostThumbnailL10n,"5.5.0"),$.uiAutocompleteL10n=$.uiAutocompleteL10n||{noResults:"",oneResult:"",manyResults:"",itemSelected:""},$.uiAutocompleteL10n=e("uiAutocompleteL10n",$.uiAutocompleteL10n,"6.5.0"),$.adminMenu={init:function(){},fold:function(){},restoreMenuState:function(){},toggle:function(){},favorites:function(){}},$.columns={init:function(){var n=this;W(".hide-column-tog","#adv-settings").on("click",function(){var e=W(this),t=e.val();e.prop("checked")?n.checked(t):n.unchecked(t),columns.saveManageColumnsState()})},saveManageColumnsState:function(){var e=this.hidden();W.post(ajaxurl,{action:"hidden-columns",hidden:e,screenoptionnonce:W("#screenoptionnonce").val(),page:pagenow})},checked:function(e){W(".column-"+e).removeClass("hidden"),this.colSpanChange(1)},unchecked:function(e){W(".column-"+e).addClass("hidden"),this.colSpanChange(-1)},hidden:function(){return W(".manage-column[id]").filter(".hidden").map(function(){return this.id}).get().join(",")},useCheckboxesForHidden:function(){this.hidden=function(){return W(".hide-column-tog").not(":checked").map(function(){var e=this.id;return e.substring(e,e.length-5)}).get().join(",")}},colSpanChange:function(e){var t=W("table").find(".colspanchange");t.length&&(e=parseInt(t.attr("colspan"),10)+e,t.attr("colspan",e.toString()))}},W(function(){columns.init()}),$.validateForm=function(e){return!W(e).find(".form-required").filter(function(){return""===W(":input:visible",this).val()}).addClass("form-invalid").find(":input:visible").on("change",function(){W(this).closest(".form-invalid").removeClass("form-invalid")}).length},$.showNotice={warn:function(){return!!confirm(H("You are about to permanently delete these items from your site.\nThis action cannot be undone.\n'Cancel' to stop, 'OK' to delete."))},note:function(e){alert(e)}},$.screenMeta={element:null,toggles:null,page:null,init:function(){this.element=W("#screen-meta"),this.toggles=W("#screen-meta-links").find(".show-settings"),this.page=W("#wpcontent"),this.toggles.on("click",this.toggleEvent)},toggleEvent:function(){var e=W("#"+W(this).attr("aria-controls"));e.length&&(e.is(":visible")?screenMeta.close(e,W(this)):screenMeta.open(e,W(this)))},open:function(e,t){W("#screen-meta-links").find(".screen-meta-toggle").not(t.parent()).css("visibility","hidden"),e.parent().show(),e.slideDown("fast",function(){e.removeClass("hidden").trigger("focus"),t.addClass("screen-meta-active").attr("aria-expanded",!0)}),Q.trigger("screen:options:open")},close:function(e,t){e.slideUp("fast",function(){t.removeClass("screen-meta-active").attr("aria-expanded",!1),W(".screen-meta-toggle").css("visibility",""),e.parent().hide(),e.addClass("hidden")}),Q.trigger("screen:options:close")}},W(".contextual-help-tabs").on("click","a",function(e){var t=W(this);if(e.preventDefault(),t.is(".active a"))return!1;W(".contextual-help-tabs .active").removeClass("active"),t.parent("li").addClass("active"),e=W(t.attr("href")),W(".help-tab-content").not(e).removeClass("active").hide(),e.addClass("active").show()});var t,a=!1,s=W("#permalink_structure"),n=W(".permalink-structure input:radio"),l=W("#custom_selection"),o=W(".form-table.permalink-structure .available-structure-tags button");function c(e){-1!==s.val().indexOf(e.text().trim())?(e.attr("data-label",e.attr("aria-label")),e.attr("aria-label",e.attr("data-used")),e.attr("aria-pressed",!0),e.addClass("active")):e.attr("data-label")&&(e.attr("aria-label",e.attr("data-label")),e.attr("aria-pressed",!1),e.removeClass("active"))}function d(){Q.trigger("wp-window-resized")}n.on("change",function(){"custom"!==this.value&&(s.val(this.value),o.each(function(){c(W(this))}))}),s.on("click input",function(){l.prop("checked",!0)}),s.on("focus",function(e){a=!0,W(this).off(e)}),o.each(function(){c(W(this))}),s.on("change",function(){o.each(function(){c(W(this))})}),o.on("click",function(){var e=s.val(),t=s[0].selectionStart,n=s[0].selectionEnd,i=W(this).text().trim(),o=W(this).hasClass("active")?W(this).attr("data-removed"):W(this).attr("data-added");-1!==e.indexOf(i)?(e=e.replace(i+"/",""),s.val("/"===e?"":e),W("#custom_selection_updated").text(o),c(W(this))):(a||0!==t||0!==n||(t=n=e.length),l.prop("checked",!0),"/"!==e.substr(0,t).substr(-1)&&(i="/"+i),"/"!==e.substr(n,1)&&(i+="/"),s.val(e.substr(0,t)+i+e.substr(n)),W("#custom_selection_updated").text(o),c(W(this)),a&&s[0].setSelectionRange&&(n=(e.substr(0,t)+i).length,s[0].setSelectionRange(n,n),s.trigger("focus")))}),W(function(){var n,i,o,a,e,t,s,r,l,c,d=!1,u=W("input.current-page"),R=u.val(),p=/iPhone|iPad|iPod/.test(navigator.userAgent),z=-1!==navigator.userAgent.indexOf("Android"),m=W("#adminmenuwrap"),h=W("#wpwrap"),f=W("#adminmenu"),g=W("#wp-responsive-overlay"),v=W("#wp-toolbar"),b=v.find('a[aria-haspopup="true"]'),w=W(".meta-box-sortables"),k=!1,C=W("#wpadminbar"),y=0,L=!1,x=!1,S=0,A=!1,P={window:V.height(),wpwrap:h.height(),adminbar:C.height(),menu:m.height()},T=W(".wp-header-end");function M(){var e=W("a.wp-has-current-submenu");"folded"===s?e.attr("aria-haspopup","true"):e.attr("aria-haspopup","false")}function _(e){var t=e.find(".wp-submenu"),e=e.offset().top,n=V.scrollTop(),i=e-n-30,e=e+t.height()+1,o=60+e-h.height(),n=V.height()+n-50;1<(o=i<(o=n<e-o?e-n:o)?i:o)&&W("#wp-admin-bar-menu-toggle").is(":hidden")?t.css("margin-top","-"+o+"px"):t.css("margin-top","")}function D(){W(".notice.is-dismissible").each(function(){var t=W(this),e=W('<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>');t.find(".notice-dismiss").length||(e.find(".screen-reader-text").text(H("Dismiss this notice.")),e.on("click.wp-dismiss-notice",function(e){e.preventDefault(),t.fadeTo(100,0,function(){t.slideUp(100,function(){t.remove()})})}),t.append(e))})}function E(e,t,n,i){n.on("change",function(){e.val(W(this).val())}),e.on("change",function(){n.val(W(this).val())}),i.on("click",function(e){e.preventDefault(),e.stopPropagation(),t.trigger("click")})}function N(){r.prop("disabled",""===l.map(function(){return W(this).val()}).get().join(""))}function F(e){var t=V.scrollTop(),e=!e||"scroll"!==e.type;if(!p&&!f.data("wp-responsive"))if(P.menu+P.adminbar<P.window||P.menu+P.adminbar+20>P.wpwrap)j();else{if(A=!0,P.menu+P.adminbar>P.window){if(t<0)return void(L||(x=!(L=!0),m.css({position:"fixed",top:"",bottom:""})));if(t+P.window>Q.height()-1)return void(x||(L=!(x=!0),m.css({position:"fixed",top:"",bottom:0})));y<t?L?(L=!1,(S=m.offset().top-P.adminbar-(t-y))+P.menu+P.adminbar<t+P.window&&(S=t+P.window-P.menu-P.adminbar),m.css({position:"absolute",top:S,bottom:""})):!x&&m.offset().top+P.menu<t+P.window&&(x=!0,m.css({position:"fixed",top:"",bottom:0})):t<y?x?(x=!1,(S=m.offset().top-P.adminbar+(y-t))+P.menu>t+P.window&&(S=t),m.css({position:"absolute",top:S,bottom:""})):!L&&m.offset().top>=t+P.adminbar&&(L=!0,m.css({position:"fixed",top:"",bottom:""})):e&&(L=x=!1,0<(S=t+P.window-P.menu-P.adminbar-1)?m.css({position:"absolute",top:S,bottom:""}):j())}y=t}}function U(){P={window:V.height(),wpwrap:h.height(),adminbar:C.height(),menu:m.height()}}function j(){!p&&A&&(L=x=A=!1,m.css({position:"",top:"",bottom:""}))}function O(){U(),f.data("wp-responsive")?(q.removeClass("sticky-menu"),j()):P.menu+P.adminbar>P.window?(F(),q.removeClass("sticky-menu")):(q.addClass("sticky-menu"),j())}function K(){W(".aria-button-if-js").attr("role","button")}function I(){var e=!1;return e=$.innerWidth?Math.max($.innerWidth,document.documentElement.clientWidth):e}function B(){var e=I()||961;s=e<=782?"responsive":q.hasClass("folded")||q.hasClass("auto-fold")&&e<=960&&782<e?"folded":"open",Q.trigger("wp-menu-state-set",{state:s})}f.on("click.wp-submenu-head",".wp-submenu-head",function(e){W(e.target).parent().siblings("a").get(0).click()}),W("#collapse-button").on("click.collapse-menu",function(){var e=I()||961;W("#adminmenu div.wp-submenu").css("margin-top",""),s=e<=960?q.hasClass("auto-fold")?(q.removeClass("auto-fold").removeClass("folded"),setUserSetting("unfold",1),setUserSetting("mfold","o"),"open"):(q.addClass("auto-fold"),setUserSetting("unfold",0),"folded"):q.hasClass("folded")?(q.removeClass("folded"),setUserSetting("mfold","o"),"open"):(q.addClass("folded"),setUserSetting("mfold","f"),"folded"),Q.trigger("wp-collapse-menu",{state:s})}),Q.on("wp-menu-state-set wp-collapse-menu wp-responsive-activate wp-responsive-deactivate",M),("ontouchstart"in $||/IEMobile\/[1-9]/.test(navigator.userAgent))&&(q.on((c=p?"touchstart":"click")+".wp-mobile-hover",function(e){f.data("wp-responsive")||W(e.target).closest("#adminmenu").length||f.find("li.opensub").removeClass("opensub")}),f.find("a.wp-has-submenu").on(c+".wp-mobile-hover",function(e){var t=W(this).parent();f.data("wp-responsive")||t.hasClass("opensub")||t.hasClass("wp-menu-open")&&!(t.width()<40)||(e.preventDefault(),_(t),f.find("li.opensub").removeClass("opensub"),t.addClass("opensub"))})),p||z||(f.find("li.wp-has-submenu").hoverIntent({over:function(){var e=W(this),t=e.find(".wp-submenu"),t=parseInt(t.css("top"),10);isNaN(t)||-5<t||f.data("wp-responsive")||(_(e),f.find("li.opensub").removeClass("opensub"),e.addClass("opensub"))},out:function(){f.data("wp-responsive")||W(this).removeClass("opensub").find(".wp-submenu").css("margin-top","")},timeout:200,sensitivity:7,interval:90}),f.on("focus.adminmenu",".wp-submenu a",function(e){f.data("wp-responsive")||W(e.target).closest("li.menu-top").addClass("opensub")}).on("blur.adminmenu",".wp-submenu a",function(e){f.data("wp-responsive")||W(e.target).closest("li.menu-top").removeClass("opensub")}).find("li.wp-has-submenu.wp-not-current-submenu").on("focusin.adminmenu",function(){_(W(this))})),T.length||(T=W(".wrap h1, .wrap h2").first()),W("div.updated, div.error, div.notice").not(".inline, .below-h2").insertAfter(T),Q.on("wp-updates-notice-added wp-plugin-install-error wp-plugin-update-error wp-plugin-delete-error wp-theme-install-error wp-theme-delete-error",D),screenMeta.init(),q.on("click","tbody > tr > .check-column :checkbox",function(e){if("undefined"!=e.shiftKey){if(e.shiftKey){if(!d)return!0;n=W(d).closest("form").find(":checkbox").filter(":visible:enabled"),i=n.index(d),o=n.index(this),a=W(this).prop("checked"),0<i&&0<o&&i!=o&&(i<o?n.slice(i,o):n.slice(o,i)).prop("checked",function(){return!!W(this).closest("tr").is(":visible")&&a})}var t=W(d=this).closest("tbody").find("tr.iedit").find(":checkbox").filter(":visible:enabled").not(":checked");W(this).closest("table").children("thead, tfoot").find(":checkbox").prop("checked",function(){return 0===t.length})}return!0}),q.on("click.wp-toggle-checkboxes","thead .check-column :checkbox, tfoot .check-column :checkbox",function(e){var t=W(this),n=t.closest("table"),i=t.prop("checked"),o=e.shiftKey||t.data("wp-toggle");n.children("tbody").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked",function(){return!W(this).is(":hidden,:disabled")&&(o?!W(this).prop("checked"):!!i)}),n.children("thead, tfoot").filter(":visible").children().children(".check-column").find(":checkbox").prop("checked",function(){return!o&&!!i})}),E(W("#bulk-action-selector-top"),W("#doaction"),W("#bulk-action-selector-bottom"),W("#doaction2")),E(W("#new_role"),W("#changeit"),W("#new_role2"),W("#changeit2")),W("#wpbody-content").on({focusin:function(){clearTimeout(e),t=W(this).find(".row-actions"),W(".row-actions").not(this).removeClass("visible"),t.addClass("visible")},focusout:function(){e=setTimeout(function(){t.removeClass("visible")},30)}},".table-view-list .has-row-actions"),W("tbody").on("click",".toggle-row",function(){W(this).closest("tr").toggleClass("is-expanded")}),W("#default-password-nag-no").on("click",function(){return setUserSetting("default_password_nag","hide"),W("div.default-password-nag").hide(),!1}),W("#newcontent").on("keydown.wpevent_InsertTab",function(e){var t,n,i,o,a=e.target;27==e.keyCode?(e.preventDefault(),W(a).data("tab-out",!0)):9!=e.keyCode||e.ctrlKey||e.altKey||e.shiftKey||(W(a).data("tab-out")?W(a).data("tab-out",!1):(t=a.selectionStart,n=a.selectionEnd,i=a.value,document.selection?(a.focus(),document.selection.createRange().text="\t"):0<=t&&(o=this.scrollTop,a.value=i.substring(0,t).concat("\t",i.substring(n)),a.selectionStart=a.selectionEnd=t+1,this.scrollTop=o),e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()))}),u.length&&u.closest("form").on("submit",function(){-1==W('select[name="action"]').val()&&u.val()==R&&u.val("1")}),W('.search-box input[type="search"], .search-box input[type="submit"]').on("mousedown",function(){W('select[name^="action"]').val("-1")}),W("#contextual-help-link, #show-settings-link").on("focus.scroll-into-view",function(e){e.target.scrollIntoViewIfNeeded&&e.target.scrollIntoViewIfNeeded(!1)}),(c=W("form.wp-upload-form")).length&&(r=c.find('input[type="submit"]'),l=c.find('input[type="file"]'),N(),l.on("change",N)),p||(V.on("scroll.pin-menu",F),Q.on("tinymce-editor-init.pin-menu",function(e,t){t.on("wp-autoresize",U)})),$.wpResponsive={init:function(){var e=this;this.maybeDisableSortables=this.maybeDisableSortables.bind(this),Q.on("wp-responsive-activate.wp-responsive",function(){e.activate()}).on("wp-responsive-deactivate.wp-responsive",function(){e.deactivate()}),W("#wp-admin-bar-menu-toggle a").attr("aria-expanded","false"),W("#wp-admin-bar-menu-toggle").on("click.wp-responsive",function(e){e.preventDefault(),C.find(".hover").removeClass("hover"),h.toggleClass("wp-responsive-open"),h.hasClass("wp-responsive-open")?(W(this).find("a").attr("aria-expanded","true"),W("#adminmenu a:first").trigger("focus")):W(this).find("a").attr("aria-expanded","false")}),W(document).on("click",function(e){var t;h.hasClass("wp-responsive-open")&&document.hasFocus()&&(t=W.contains(W("#wp-admin-bar-menu-toggle")[0],e.target),e=W.contains(W("#adminmenuwrap")[0],e.target),t||e||W("#wp-admin-bar-menu-toggle").trigger("click.wp-responsive"))}),W(document).on("keyup",function(e){var n,i,o=W("#wp-admin-bar-menu-toggle")[0];h.hasClass("wp-responsive-open")&&(27===e.keyCode?(W(o).trigger("click.wp-responsive"),W(o).find("a").trigger("focus")):9===e.keyCode&&(n=W("#adminmenuwrap")[0],i=e.relatedTarget||document.activeElement,setTimeout(function(){var e=W.contains(o,i),t=W.contains(n,i);e||t||W(o).trigger("click.wp-responsive")},10)))}),f.on("click.wp-responsive","li.wp-has-submenu > a",function(e){f.data("wp-responsive")&&(W(this).parent("li").toggleClass("selected"),W(this).trigger("focus"),e.preventDefault())}),e.trigger(),Q.on("wp-window-resized.wp-responsive",this.trigger.bind(this)),V.on("load.wp-responsive",this.maybeDisableSortables),Q.on("postbox-toggled",this.maybeDisableSortables),W("#screen-options-wrap input").on("click",this.maybeDisableSortables)},maybeDisableSortables:function(){(-1<navigator.userAgent.indexOf("AppleWebKit/")?V.width():$.innerWidth)<=782||w.find(".ui-sortable-handle:visible").length<=1&&jQuery(".columns-prefs-1 input").prop("checked")?this.disableSortables():this.enableSortables()},activate:function(){O(),q.hasClass("auto-fold")||q.addClass("auto-fold"),f.data("wp-responsive",1),this.disableSortables()},deactivate:function(){O(),f.removeData("wp-responsive"),this.maybeDisableSortables()},trigger:function(){var e=I();e&&(e<=782?k||(Q.trigger("wp-responsive-activate"),k=!0):k&&(Q.trigger("wp-responsive-deactivate"),k=!1),e<=480?this.enableOverlay():this.disableOverlay(),this.maybeDisableSortables())},enableOverlay:function(){0===g.length&&(g=W('<div id="wp-responsive-overlay"></div>').insertAfter("#wpcontent").hide().on("click.wp-responsive",function(){v.find(".menupop.hover").removeClass("hover"),W(this).hide()})),b.on("click.wp-responsive",function(){g.show()})},disableOverlay:function(){b.off("click.wp-responsive"),g.hide()},disableSortables:function(){if(w.length)try{w.sortable("disable"),w.find(".ui-sortable-handle").addClass("is-non-sortable")}catch(e){}},enableSortables:function(){if(w.length)try{w.sortable("enable"),w.find(".ui-sortable-handle").removeClass("is-non-sortable")}catch(e){}}},W(document).on("ajaxComplete",function(){K()}),Q.on("wp-window-resized.set-menu-state",B),Q.on("wp-menu-state-set wp-collapse-menu",function(e,t){var n,i=W("#collapse-button"),t="folded"===t.state?(n="false",H("Expand Main menu")):(n="true",H("Collapse Main menu"));i.attr({"aria-expanded":n,"aria-label":t})}),$.wpResponsive.init(),O(),B(),M(),D(),K(),Q.on("wp-pin-menu wp-window-resized.pin-menu postboxes-columnchange.pin-menu postbox-toggled.pin-menu wp-collapse-menu.pin-menu wp-scroll-start.pin-menu",O),W(".wp-initial-focus").trigger("focus"),q.on("click",".js-update-details-toggle",function(){var e=W(this).closest(".js-update-details"),t=W("#"+e.data("update-details"));t.hasClass("update-details-moved")||t.insertAfter(e).addClass("update-details-moved"),t.toggle(),W(this).attr("aria-expanded",t.is(":visible"))})}),W(function(e){var t,n;q.hasClass("update-php")&&(t=e("a.update-from-upload-overwrite"),n=e(".update-from-upload-expired"),t.length)&&n.length&&$.setTimeout(function(){t.hide(),n.removeClass("hidden"),$.wp&&$.wp.a11y&&$.wp.a11y.speak(n.text())},714e4)}),V.on("resize.wp-fire-once",function(){$.clearTimeout(t),t=$.setTimeout(d,200)}),"-ms-user-select"in document.documentElement.style&&navigator.userAgent.match(/IEMobile\/10\.0/)&&((n=document.createElement("style")).appendChild(document.createTextNode("@-ms-viewport{width:auto!important}")),document.getElementsByTagName("head")[0].appendChild(n))}(jQuery,window),function(){var e,i={},o={};i.pauseAll=!1,!window.matchMedia||(e=window.matchMedia("(prefers-reduced-motion: reduce)"))&&!e.matches||(i.pauseAll=!0),i.freezeAnimatedPluginIcons=function(l){function e(){var e=l.width,t=l.height,n=document.createElement("canvas");if(n.width=e,n.height=t,n.className=l.className,l.closest("#update-plugins-table"))for(var i=window.getComputedStyle(l),o=0,a=i.length;o<a;o++){var s=i[o],r=i.getPropertyValue(s);n.style[s]=r}n.getContext("2d").drawImage(l,0,0,e,t),n.setAttribute("aria-hidden","true"),n.setAttribute("role","presentation"),l.parentNode.insertBefore(n,l),l.style.opacity=.01,l.style.width="0px",l.style.height="0px"}l.complete?e():l.addEventListener("load",e,!0)},o.freezeAll=function(){for(var e=document.querySelectorAll(".plugin-icon, #update-plugins-table img"),t=0;t<e.length;t++)/\.gif(?:\?|$)/i.test(e[t].src)&&i.freezeAnimatedPluginIcons(e[t])},!0===i.pauseAll&&o.freezeAll(),e=jQuery,"plugin-install"===window.pagenow&&e(document).ajaxComplete(function(e,t,n){n.data&&"string"==typeof n.data&&n.data.includes("action=search-install-plugins")&&(window.matchMedia?window.matchMedia("(prefers-reduced-motion: reduce)").matches&&o.freezeAll():!0===i.pauseAll&&o.freezeAll())})}(); \ No newline at end of file
diff --git a/wp-admin/js/customize-controls.js b/wp-admin/js/customize-controls.js
index b6786b4..650ac8a 100644
--- a/wp-admin/js/customize-controls.js
+++ b/wp-admin/js/customize-controls.js
@@ -3866,7 +3866,7 @@
var control = this, container, notifications, hasError = false;
if ( 'undefined' !== typeof console && console.warn ) {
- console.warn( '[DEPRECATED] wp.customize.Control.prototype.renderNotifications() is deprecated in favor of instantating a wp.customize.Notifications and calling its render() method.' );
+ console.warn( '[DEPRECATED] wp.customize.Control.prototype.renderNotifications() is deprecated in favor of instantiating a wp.customize.Notifications and calling its render() method.' );
}
container = control.getNotificationsContainerElement();
diff --git a/wp-admin/js/customize-controls.min.js b/wp-admin/js/customize-controls.min.js
index 4f3efbf..3485f50 100644
--- a/wp-admin/js/customize-controls.min.js
+++ b/wp-admin/js/customize-controls.min.js
@@ -1,2 +1,2 @@
/*! This file is auto-generated */
-!function(J){var a,s,t,e,n,i,Y=wp.customize,o=window.matchMedia("(prefers-reduced-motion: reduce)"),r=o.matches;o.addEventListener("change",function(e){r=e.matches}),Y.OverlayNotification=Y.Notification.extend({loading:!1,initialize:function(e,t){var n=this;Y.Notification.prototype.initialize.call(n,e,t),n.containerClasses+=" notification-overlay",n.loading&&(n.containerClasses+=" notification-loading")},render:function(){var e=Y.Notification.prototype.render.call(this);return e.on("keydown",_.bind(this.handleEscape,this)),e},handleEscape:function(e){var t=this;27===e.which&&(e.stopPropagation(),t.dismissible)&&t.parent&&t.parent.remove(t.code)}}),Y.Notifications=Y.Values.extend({alt:!1,defaultConstructor:Y.Notification,initialize:function(e){var t=this;Y.Values.prototype.initialize.call(t,e),_.bindAll(t,"constrainFocus"),t._addedIncrement=0,t._addedOrder={},t.bind("add",function(e){t.trigger("change",e)}),t.bind("removed",function(e){t.trigger("change",e)})},count:function(){return _.size(this._value)},add:function(e,t){var n,i=this,t="string"==typeof e?(n=e,t):(n=e.code,e);return i.has(n)||(i._addedIncrement+=1,i._addedOrder[n]=i._addedIncrement),Y.Values.prototype.add.call(i,n,t)},remove:function(e){return delete this._addedOrder[e],Y.Values.prototype.remove.call(this,e)},get:function(e){var a,o=this,t=_.values(o._value);return _.extend({sort:!1},e).sort&&(a={error:4,warning:3,success:2,info:1},t.sort(function(e,t){var n=0,i=0;return(n=_.isUndefined(a[e.type])?n:a[e.type])!==(i=_.isUndefined(a[t.type])?i:a[t.type])?i-n:o._addedOrder[t.code]-o._addedOrder[e.code]})),t},render:function(){var e,t,n,i=this,a=!1,o=[],s={};i.container&&i.container.length&&(e=i.get({sort:!0}),i.container.toggle(0!==e.length),i.container.is(i.previousContainer)&&_.isEqual(e,i.previousNotifications)||((n=i.container.children("ul").first()).length||(n=J("<ul></ul>"),i.container.append(n)),n.find("> [data-code]").remove(),_.each(i.previousNotifications,function(e){s[e.code]=e}),_.each(e,function(e){var t;!wp.a11y||s[e.code]&&_.isEqual(e.message,s[e.code].message)||wp.a11y.speak(e.message,"assertive"),t=J(e.render()),e.container=t,n.append(t),e.extended(Y.OverlayNotification)&&o.push(e)}),(t=Boolean(o.length))!==(a=i.previousNotifications?Boolean(_.find(i.previousNotifications,function(e){return e.extended(Y.OverlayNotification)})):a)&&(J(document.body).toggleClass("customize-loading",t),i.container.toggleClass("has-overlay-notifications",t),t?(i.previousActiveElement=document.activeElement,J(document).on("keydown",i.constrainFocus)):J(document).off("keydown",i.constrainFocus)),t?(i.focusContainer=o[o.length-1].container,i.focusContainer.prop("tabIndex",-1),((a=i.focusContainer.find(":focusable")).length?a.first():i.focusContainer).focus()):i.previousActiveElement&&(J(i.previousActiveElement).trigger("focus"),i.previousActiveElement=null),i.previousNotifications=e,i.previousContainer=i.container,i.trigger("rendered")))},constrainFocus:function(e){var t,n=this;e.stopPropagation(),9===e.which&&(0===(t=n.focusContainer.find(":focusable")).length&&(t=n.focusContainer),!J.contains(n.focusContainer[0],e.target)||!J.contains(n.focusContainer[0],document.activeElement)||t.last().is(e.target)&&!e.shiftKey?(e.preventDefault(),t.first().focus()):t.first().is(e.target)&&e.shiftKey&&(e.preventDefault(),t.last().focus()))}}),Y.Setting=Y.Value.extend({defaults:{transport:"refresh",dirty:!1},initialize:function(e,t,n){var i=this,n=_.extend({previewer:Y.previewer},i.defaults,n||{});Y.Value.prototype.initialize.call(i,t,n),i.id=e,i._dirty=n.dirty,i.notifications=new Y.Notifications,i.bind(i.preview)},preview:function(){var e=this,t=e.transport;"postMessage"===(t="postMessage"!==t||Y.state("previewerAlive").get()?t:"refresh")?e.previewer.send("setting",[e.id,e()]):"refresh"===t&&e.previewer.refresh()},findControls:function(){var n=this,i=[];return Y.control.each(function(t){_.each(t.settings,function(e){e.id===n.id&&i.push(t)})}),i}}),Y._latestRevision=0,Y._lastSavedRevision=0,Y._latestSettingRevisions={},Y.bind("change",function(e){Y._latestRevision+=1,Y._latestSettingRevisions[e.id]=Y._latestRevision}),Y.bind("ready",function(){Y.bind("add",function(e){e._dirty&&(Y._latestRevision+=1,Y._latestSettingRevisions[e.id]=Y._latestRevision)})}),Y.dirtyValues=function(n){var i={};return Y.each(function(e){var t;e._dirty&&(t=Y._latestSettingRevisions[e.id],Y.state("changesetStatus").get()&&n&&n.unsaved&&(_.isUndefined(t)||t<=Y._lastSavedRevision)||(i[e.id]=e.get()))}),i},Y.requestChangesetUpdate=function(n,e){var t,i={},a=new J.Deferred;if(0!==Y.state("processing").get())a.reject("already_processing");else if(e=_.extend({title:null,date:null,autosave:!1,force:!1},e),n&&_.extend(i,n),_.each(Y.dirtyValues({unsaved:!0}),function(e,t){n&&null===n[t]||(i[t]=_.extend({},i[t]||{},{value:e}))}),Y.trigger("changeset-save",i,e),!e.force&&_.isEmpty(i)&&null===e.title&&null===e.date)a.resolve({});else{if(e.status)return a.reject({code:"illegal_status_in_changeset_update"}).promise();if(e.date&&e.autosave)return a.reject({code:"illegal_autosave_with_date_gmt"}).promise();Y.state("processing").set(Y.state("processing").get()+1),a.always(function(){Y.state("processing").set(Y.state("processing").get()-1)}),delete(t=Y.previewer.query({excludeCustomizedSaved:!0})).customized,_.extend(t,{nonce:Y.settings.nonce.save,customize_theme:Y.settings.theme.stylesheet,customize_changeset_data:JSON.stringify(i)}),null!==e.title&&(t.customize_changeset_title=e.title),null!==e.date&&(t.customize_changeset_date=e.date),!1!==e.autosave&&(t.customize_changeset_autosave="true"),Y.trigger("save-request-params",t),(e=wp.ajax.post("customize_save",t)).done(function(e){var n={};Y._lastSavedRevision=Math.max(Y._latestRevision,Y._lastSavedRevision),Y.state("changesetStatus").set(e.changeset_status),e.changeset_date&&Y.state("changesetDate").set(e.changeset_date),a.resolve(e),Y.trigger("changeset-saved",e),e.setting_validities&&_.each(e.setting_validities,function(e,t){!0===e&&_.isObject(i[t])&&!_.isUndefined(i[t].value)&&(n[t]=i[t].value)}),Y.previewer.send("changeset-saved",_.extend({},e,{saved_changeset_values:n}))}),e.fail(function(e){a.reject(e),Y.trigger("changeset-error",e)}),e.always(function(e){e.setting_validities&&Y._handleSettingValidities({settingValidities:e.setting_validities})})}return a.promise()},Y.utils.bubbleChildValueChanges=function(n,e){J.each(e,function(e,t){n[t].bind(function(e,t){n.parent&&e!==t&&n.parent.trigger("change",n)})})},o=function(e){var t,n,i=this,a=function(){var e;i.extended(Y.Panel)&&1<(n=i.sections()).length&&n.forEach(function(e){e.expanded()&&e.collapse()}),e=(i.extended(Y.Panel)||i.extended(Y.Section))&&i.expanded&&i.expanded()?i.contentContainer: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(){a(),t()}):e.completeCallback=a,Y.state("paneVisible").set(!0),i.expand?i.expand(e):e.completeCallback()},Y.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()},Y.utils.isKeydownButNotEnterEvent=function(e){return"keydown"===e.type&&13!==e.which},Y.utils.areElementListsEqual=function(e,t){return e.length===t.length&&-1===_.indexOf(_.map(_.zip(e,t),function(e){return J(e[0]).is(e[1])}),!1)},Y.utils.highlightButton=function(e,t){var n,i="button-see-me",a=!1;function o(){a=!0}return(n=_.extend({delay:0,focusTarget:e},t)).focusTarget.on("focusin",o),setTimeout(function(){n.focusTarget.off("focusin",o),a||(e.addClass(i),e.one("animationend",function(){e.removeClass(i)}))},n.delay),o},Y.utils.getCurrentTimestamp=function(){var e=_.now(),t=new Date(Y.settings.initialServerDate.replace(/-/g,"/")),e=e-Y.settings.initialClientTimestamp;return e+=Y.settings.initialClientTimestamp-Y.settings.initialServerTimestamp,t.setTime(t.getTime()+e),t.getTime()},Y.utils.getRemainingTime=function(e){e=e instanceof Date?e.getTime():"string"==typeof e?new Date(e.replace(/-/g,"/")).getTime():e,e-=Y.utils.getCurrentTimestamp();return Math.ceil(e/1e3)},t=document.createElement("div"),e={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"},n=_.find(_.keys(e),function(e){return!_.isUndefined(t.style[e])}),s=n?e[n]:null,a=Y.Class.extend({defaultActiveArguments:{duration:"fast",completeCallback:J.noop},defaultExpandedArguments:{duration:"fast",completeCallback:J.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,a.instanceCounter||(a.instanceCounter=0),a.instanceCounter++,J.extend(n,{params:_.defaults(t.params||t,n.defaults)}),n.params.instanceNumber||(n.params.instanceNumber=a.instanceCounter),n.notifications=new Y.Notifications,n.templateSelector=n.params.templateId||"customize-"+n.containerType+"-"+n.params.type,n.container=J(n.params.content),0===n.container.length&&(n.container=J(n.getContainer())),n.headContainer=n.container,n.contentContainer=n.getContent(),n.container=n.container.add(n.contentContainer),n.deferred={embedded:new J.Deferred},n.priority=new Y.Value,n.active=new Y.Value,n.activeArgumentsQueue=[],n.expanded=new Y.Value,n.expandedArgumentsQueue=[],n.active.bind(function(e){var t=n.activeArgumentsQueue.shift(),t=J.extend({},n.defaultActiveArguments,t);e=e&&n.isContextuallyActive(),n.onChangeActive(e,t)}),n.expanded.bind(function(e){var t=n.expandedArgumentsQueue.shift(),t=J.extend({},n.defaultExpandedArguments,t);n.onChangeExpanded(e,t)}),n.deferred.embedded.done(function(){n.setupNotifications(),n.attachEvents()}),Y.utils.bubbleChildValueChanges(n,["priority","active"]),n.priority.set(n.params.priority),n.active.set(n.params.active),n.expanded.set(!1)},getNotificationsContainerElement:function(){return this.contentContainer.find(".customize-control-notifications-container:first")},setupNotifications:function(){var e,t=this;t.notifications.container=t.getNotificationsContainerElement(),t.expanded.bind(e=function(){t.expanded.get()&&t.notifications.render()}),e(),t.notifications.bind("change",_.debounce(e))},ready:function(){},_children:function(t,e){var n=this,i=[];return Y[e].each(function(e){e[t].get()===n.id&&i.push(e)}),i.sort(Y.utils.prioritySort),i},isContextuallyActive:function(){throw new Error("Container.isContextuallyActive() must be overridden in a subclass.")},onChangeActive:function(e,t){var n,i=this,a=i.headContainer;t.unchanged?t.completeCallback&&t.completeCallback():(n="resolved"===Y.previewer.deferred.active.state()?t.duration:0,i.extended(Y.Panel)&&(Y.panel.each(function(e){e!==i&&e.expanded()&&(n=0)}),e||_.each(i.sections(),function(e){e.collapse({duration:0})})),J.contains(document,a.get(0))?e?a.slideDown(n,t.completeCallback):i.expanded()?i.collapse({duration:n,completeCallback:function(){a.slideUp(n,t.completeCallback)}}):a.slideUp(n,t.completeCallback):(a.toggle(e),t.completeCallback&&t.completeCallback()))},_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()||(Y.state("paneVisible").set(!0),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)},_animateChangeExpanded:function(t){var a,o,n,i;!s||r?_.defer(function(){t&&t()}):(o=(a=this).contentContainer,i=o.closest(".wp-full-overlay").add(o),a.panel&&""!==a.panel()&&!Y.panel(a.panel()).contentContainer.hasClass("skip-transition")||(i=i.add("#customize-info, .customize-pane-parent")),n=function(e){2===e.eventPhase&&J(e.target).is(o)&&(o.off(s,n),i.removeClass("busy"),t)&&t()},o.on(s,n),i.addClass("busy"),_.defer(function(){var e=o.closest(".wp-full-overlay-sidebar-content"),t=e.scrollTop(),n=o.data("previous-scrollTop")||0,i=a.expanded();i&&0<t?(o.css("top",t+"px"),o.data("previous-scrollTop",t)):!i&&0<t+n&&(o.css("top",n-t+"px"),e.scrollTop(n))}))},focus:o,getContainer:function(){var e=this,t=0!==J("#tmpl-"+e.templateSelector).length?wp.template(e.templateSelector):wp.template("customize-"+e.containerType+"-default");return t&&e.container?t(_.extend({id:e.id},e.params)).toString().trim():"<li></li>"},getContent:function(){var e=this.container,t=e.find(".accordion-section-content, .control-panel-content").first(),n="sub-"+e.attr("id"),i=n,a=e.attr("aria-owns");return e.attr("aria-owns",i=a?i+" "+a:i),t.detach().attr({id:n,class:"customize-pane-child "+t.attr("class")+" "+e.attr("class")})}}),Y.Section=a.extend({containerType:"section",containerParent:"#customize-theme-controls",containerPaneParent:".customize-pane-parent",defaults:{title:"",description:"",priority:100,type:"default",content:null,active:!0,instanceNumber:null,panel:null,customizeAction:""},initialize:function(e,t){var n=this,i=t.params||t;i.type||_.find(Y.sectionConstructor,function(e,t){return e===n.constructor&&(i.type=t,!0)}),a.prototype.initialize.call(n,e,i),n.id=e,n.panel=new Y.Value,n.panel.bind(function(e){J(n.headContainer).toggleClass("control-subsection",!!e)}),n.panel.set(n.params.panel||""),Y.utils.bubbleChildValueChanges(n,["panel"]),n.embed(),n.deferred.embedded.done(function(){n.ready()})},embed:function(){var e,n=this;n.containerParent=Y.ensure(n.containerParent),n.panel.bind(e=function(e){var t;e?Y.panel(e,function(e){e.deferred.embedded.done(function(){t=e.contentContainer,n.headContainer.parent().is(t)||t.append(n.headContainer),n.contentContainer.parent().is(n.headContainer)||n.containerParent.append(n.contentContainer),n.deferred.embedded.resolve()})}):(t=Y.ensure(n.containerPaneParent),n.headContainer.parent().is(t)||t.append(n.headContainer),n.contentContainer.parent().is(n.headContainer)||n.containerParent.append(n.contentContainer),n.deferred.embedded.resolve())}),e(n.panel.get())},attachEvents:function(){var e,t,n=this;n.container.hasClass("cannot-expand")||(n.container.find(".accordion-section-title, .customize-section-back").on("click keydown",function(e){Y.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),n.expanded()?n.collapse():n.expand())}),n.container.find(".customize-section-title .customize-help-toggle").on("click",function(){(e=n.container.find(".section-meta")).hasClass("cannot-expand")||((t=e.find(".customize-section-description:first")).toggleClass("open"),t.slideToggle(n.defaultExpandedArguments.duration,function(){t.trigger("toggled")}),J(this).attr("aria-expanded",function(e,t){return"true"===t?"false":"true"}))}))},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=this,a=i.headContainer.closest(".wp-full-overlay-sidebar-content"),o=i.contentContainer,s=i.headContainer.closest(".wp-full-overlay"),r=o.find(".customize-section-back"),c=i.headContainer.find(".accordion-section-title").first();e&&!o.hasClass("open")?(n=t.unchanged?t.completeCallback:function(){i._animateChangeExpanded(function(){c.attr("tabindex","-1"),r.attr("tabindex","0"),r.trigger("focus"),o.css("top",""),a.scrollTop(0),t.completeCallback&&t.completeCallback()}),o.addClass("open"),s.addClass("section-open"),Y.state("expandedSection").set(i)}.bind(this),t.allowMultiple||Y.section.each(function(e){e!==i&&e.collapse({duration:t.duration})}),i.panel()?Y.panel(i.panel()).expand({duration:t.duration,completeCallback:n}):(t.allowMultiple||Y.panel.each(function(e){e.collapse()}),n())):!e&&o.hasClass("open")?(i.panel()&&(n=Y.panel(i.panel())).contentContainer.hasClass("skip-transition")&&n.collapse(),i._animateChangeExpanded(function(){r.attr("tabindex","-1"),c.attr("tabindex","0"),c.trigger("focus"),o.css("top",""),t.completeCallback&&t.completeCallback()}),o.removeClass("open"),s.removeClass("section-open"),i===Y.state("expandedSection").get()&&Y.state("expandedSection").set(!1)):t.completeCallback&&t.completeCallback()}}),Y.ThemesSection=Y.Section.extend({currentTheme:"",overlay:"",template:"",screenshotQueue:null,$window:null,$body:null,loaded:0,loading:!1,fullyLoaded:!1,term:"",tags:"",nextTerm:"",nextTags:"",filtersHeight:0,headerContainer:null,updateCountDebounced:null,initialize:function(e,t){var n=this;n.headerContainer=J(),n.$window=J(window),n.$body=J(document.body),Y.Section.prototype.initialize.call(n,e,t),n.updateCountDebounced=_.debounce(n.updateCount,500)},embed:function(){var n=this,e=function(e){var t;Y.panel(e,function(e){e.deferred.embedded.done(function(){t=e.contentContainer,n.headContainer.parent().is(t)||t.find(".customize-themes-full-container-container").before(n.headContainer),n.contentContainer.parent().is(n.headContainer)||n.containerParent.append(n.contentContainer),n.deferred.embedded.resolve()})})};n.panel.bind(e),e(n.panel.get())},ready:function(){var t=this;t.overlay=t.container.find(".theme-overlay"),t.template=wp.template("customize-themes-details-view"),t.container.on("keydown",function(e){t.overlay.find(".theme-wrap").is(":visible")&&(39===e.keyCode&&t.nextTheme(),37===e.keyCode&&t.previousTheme(),27===e.keyCode)&&(t.$body.hasClass("modal-open")?t.closeDetails():t.headerContainer.find(".customize-themes-section-title").focus(),e.stopPropagation())}),t.renderScreenshots=_.throttle(t.renderScreenshots,100),_.bindAll(t,"renderScreenshots","loadMore","checkTerm","filtersChecked")},isContextuallyActive:function(){return this.active()},attachEvents:function(){var e,n=this;function t(){var e=n.headerContainer.find(".customize-themes-section-title");e.toggleClass("selected",n.expanded()),e.attr("aria-expanded",n.expanded()?"true":"false"),n.expanded()||e.removeClass("details-open")}n.container.find(".customize-section-back").on("click keydown",function(e){Y.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),n.collapse())}),n.headerContainer=J("#accordion-section-"+n.id),n.headerContainer.on("click",".customize-themes-section-title",function(){n.headerContainer.find(".filter-details").length&&(n.headerContainer.find(".customize-themes-section-title").toggleClass("details-open").attr("aria-expanded",function(e,t){return"true"===t?"false":"true"}),n.headerContainer.find(".filter-details").slideToggle(180)),n.expanded()||n.expand()}),n.container.on("click",".theme-actions .preview-theme",function(){Y.panel("themes").loadThemePreview(J(this).data("slug"))}),n.container.on("click",".left",function(){n.previousTheme()}),n.container.on("click",".right",function(){n.nextTheme()}),n.container.on("click",".theme-backdrop, .close",function(){n.closeDetails()}),"local"===n.params.filter_type?n.container.on("input",".wp-filter-search-themes",function(e){n.filterSearch(e.currentTarget.value)}):"remote"===n.params.filter_type&&(e=_.debounce(n.checkTerm,500),n.contentContainer.on("input",".wp-filter-search",function(){Y.panel("themes").expanded()&&(e(n),n.expanded()||n.expand())}),n.contentContainer.on("click",".filter-group input",function(){n.filtersChecked(),n.checkTerm(n)})),n.contentContainer.on("click",".feature-filter-toggle",function(e){var t=J(".customize-themes-full-container"),e=J(e.currentTarget);n.filtersHeight=e.parent().next(".filter-drawer").height(),0<t.scrollTop()&&(t.animate({scrollTop:0},400),e.hasClass("open"))||(e.toggleClass("open").attr("aria-expanded",function(e,t){return"true"===t?"false":"true"}).parent().next(".filter-drawer").slideToggle(180,"linear"),e.hasClass("open")?(t=1018<window.innerWidth?50:76,n.contentContainer.find(".themes").css("margin-top",n.filtersHeight+t)):n.contentContainer.find(".themes").css("margin-top",0))}),n.contentContainer.on("click",".no-themes-local .search-dotorg-themes",function(){Y.section("wporg_themes").focus()}),n.expanded.bind(t),t(),Y.bind("ready",function(){n.contentContainer=n.container.find(".customize-themes-section"),n.contentContainer.appendTo(J(".customize-themes-full-container")),n.container.add(n.headerContainer)})},onChangeExpanded:function(e,n){var i=this,t=i.contentContainer.closest(".customize-themes-full-container");function a(){0===i.loaded&&i.loadThemes(),Y.section.each(function(e){var t;e!==i&&"themes"===e.params.type&&(t=e.contentContainer.find(".wp-filter-search").val(),i.contentContainer.find(".wp-filter-search").val(t),""===t&&""!==i.term&&"local"!==i.params.filter_type?(i.term="",i.initializeNewQuery(i.term,i.tags)):"remote"===i.params.filter_type?i.checkTerm(i):"local"===i.params.filter_type&&i.filterSearch(t),e.collapse({duration:n.duration}))}),i.contentContainer.addClass("current-section"),t.scrollTop(),t.on("scroll",_.throttle(i.renderScreenshots,300)),t.on("scroll",_.throttle(i.loadMore,300)),n.completeCallback&&n.completeCallback(),i.updateCount()}n.unchanged?n.completeCallback&&n.completeCallback():e?i.panel()&&Y.panel.has(i.panel())?Y.panel(i.panel()).expand({duration:n.duration,completeCallback:a}):a():(i.contentContainer.removeClass("current-section"),i.headerContainer.find(".filter-details").slideUp(180),t.off("scroll"),n.completeCallback&&n.completeCallback())},getContent:function(){return this.container.find(".control-section-content")},loadThemes:function(){var n,e,i=this;i.loading||(n=Math.ceil(i.loaded/100)+1,e={nonce:Y.settings.nonce.switch_themes,wp_customize:"on",theme_action:i.params.action,customized_theme:Y.settings.theme.stylesheet,page:n},"remote"===i.params.filter_type&&(e.search=i.term,e.tags=i.tags),i.headContainer.closest(".wp-full-overlay").addClass("loading"),i.loading=!0,i.container.find(".no-themes").hide(),(e=wp.ajax.post("customize_load_themes",e)).done(function(e){var t=e.themes;""!==i.nextTerm||""!==i.nextTags?(i.nextTerm&&(i.term=i.nextTerm),i.nextTags&&(i.tags=i.nextTags),i.nextTerm="",i.nextTags="",i.loading=!1,i.loadThemes()):(0!==t.length?(i.loadControls(t,n),1===n&&(_.each(i.controls().slice(0,3),function(e){e=e.params.theme.screenshot[0];e&&((new Image).src=e)}),"local"!==i.params.filter_type)&&wp.a11y.speak(Y.settings.l10n.themeSearchResults.replace("%d",e.info.results)),_.delay(i.renderScreenshots,100),("local"===i.params.filter_type||t.length<100)&&(i.fullyLoaded=!0)):0===i.loaded?(i.container.find(".no-themes").show(),wp.a11y.speak(i.container.find(".no-themes").text())):i.fullyLoaded=!0,"local"===i.params.filter_type?i.updateCount():i.updateCount(e.info.results),i.container.find(".unexpected-error").hide(),i.headContainer.closest(".wp-full-overlay").removeClass("loading"),i.loading=!1)}),e.fail(function(e){void 0===e?(i.container.find(".unexpected-error").show(),wp.a11y.speak(i.container.find(".unexpected-error").text())):"undefined"!=typeof console&&console.error&&console.error(e),i.headContainer.closest(".wp-full-overlay").removeClass("loading"),i.loading=!1}))},loadControls:function(e,t){var n=[],i=this;_.each(e,function(e){e=new Y.controlConstructor.theme(i.params.action+"_theme_"+e.id,{type:"theme",section:i.params.id,theme:e,priority:i.loaded+1});Y.control.add(e),n.push(e),i.loaded=i.loaded+1}),1!==t&&Array.prototype.push.apply(i.screenshotQueue,n)},loadMore:function(){var e,t;this.fullyLoaded||this.loading||(t=(e=this.container.closest(".customize-themes-full-container")).scrollTop()+e.height(),e.prop("scrollHeight")-3e3<t&&this.loadThemes())},filterSearch:function(e){var t,n=0,i=this,a=Y.section.has("wporg_themes")&&"remote"!==i.params.filter_type?".no-themes-local":".no-themes",o=i.controls();i.loading||(t=e.toLowerCase().trim().replace(/-/g," ").split(" "),_.each(o,function(e){e.filter(t)&&(n+=1)}),0===n?(i.container.find(a).show(),wp.a11y.speak(i.container.find(a).text())):i.container.find(a).hide(),i.renderScreenshots(),Y.reflowPaneContents(),i.updateCountDebounced(n))},checkTerm:function(e){var t;"remote"===e.params.filter_type&&(t=e.contentContainer.find(".wp-filter-search").val(),e.term!==t.trim())&&e.initializeNewQuery(t,e.tags)},filtersChecked:function(){var e=this,t=e.container.find(".filter-group").find(":checkbox"),n=[];_.each(t.filter(":checked"),function(e){n.push(J(e).prop("value"))}),0===n.length?(n="",e.contentContainer.find(".feature-filter-toggle .filter-count-0").show(),e.contentContainer.find(".feature-filter-toggle .filter-count-filters").hide()):(e.contentContainer.find(".feature-filter-toggle .theme-filter-count").text(n.length),e.contentContainer.find(".feature-filter-toggle .filter-count-0").hide(),e.contentContainer.find(".feature-filter-toggle .filter-count-filters").show()),_.isEqual(e.tags,n)||(e.loading?e.nextTags=n:"remote"===e.params.filter_type?e.initializeNewQuery(e.term,n):"local"===e.params.filter_type&&e.filterSearch(n.join(" ")))},initializeNewQuery:function(e,t){var n=this;_.each(n.controls(),function(e){e.container.remove(),Y.control.remove(e.id)}),n.loaded=0,n.fullyLoaded=!1,n.screenshotQueue=null,n.loading?(n.nextTerm=e,n.nextTags=t):(n.term=e,n.tags=t,n.loadThemes()),n.expanded()||n.expand()},renderScreenshots:function(){var o=this;null!==o.screenshotQueue&&0!==o.screenshotQueue.length||(o.screenshotQueue=_.filter(o.controls(),function(e){return!e.screenshotRendered})),o.screenshotQueue.length&&(o.screenshotQueue=_.filter(o.screenshotQueue,function(e){var t,n,i=e.container.find(".theme-screenshot"),a=i.find("img");return!(!a.length||!a.is(":hidden")&&(t=(n=o.$window.scrollTop())+o.$window.height(),a=a.offset().top,(n=n-(i=3*(n=i.height()))<=a+n&&a<=t+i)&&e.container.trigger("render-screenshot"),n))}))},getVisibleCount:function(){return this.contentContainer.find("li.customize-control:visible").length},updateCount:function(e){var t,n;e||0===e||(e=this.getVisibleCount()),n=this.contentContainer.find(".themes-displayed"),t=this.contentContainer.find(".theme-count"),0===e?t.text("0"):(n.fadeOut(180,function(){t.text(e),n.fadeIn(180)}),wp.a11y.speak(Y.settings.l10n.announceThemeCount.replace("%d",e)))},nextTheme:function(){var e=this;e.getNextTheme()&&e.showDetails(e.getNextTheme(),function(){e.overlay.find(".right").focus()})},getNextTheme:function(){var e=Y.control(this.params.action+"_theme_"+this.currentTheme),t=this.controls(),e=_.indexOf(t,e);return-1!==e&&!!(t=t[e+1])&&t.params.theme},previousTheme:function(){var e=this;e.getPreviousTheme()&&e.showDetails(e.getPreviousTheme(),function(){e.overlay.find(".left").focus()})},getPreviousTheme:function(){var e=Y.control(this.params.action+"_theme_"+this.currentTheme),t=this.controls(),e=_.indexOf(t,e);return-1!==e&&!!(t=t[e-1])&&t.params.theme},updateLimits:function(){this.getNextTheme()||this.overlay.find(".right").addClass("disabled"),this.getPreviousTheme()||this.overlay.find(".left").addClass("disabled")},loadThemePreview:function(e){return Y.ThemesPanel.prototype.loadThemePreview.call(this,e)},showDetails:function(e,t){var n=this,i=Y.panel("themes");function a(){return!i.canSwitchTheme(e.id)}n.currentTheme=e.id,n.overlay.html(n.template(e)).fadeIn("fast").focus(),n.overlay.find("button.preview, button.preview-theme").toggleClass("disabled",a()),n.overlay.find("button.theme-install").toggleClass("disabled",a()||!1===Y.settings.theme._canInstall||!0===Y.settings.theme._filesystemCredentialsNeeded),n.$body.addClass("modal-open"),n.containFocus(n.overlay),n.updateLimits(),wp.a11y.speak(Y.settings.l10n.announceThemeDetails.replace("%s",e.name)),t&&t()},closeDetails:function(){this.$body.removeClass("modal-open"),this.overlay.fadeOut("fast"),Y.control(this.params.action+"_theme_"+this.currentTheme).container.find(".theme").focus()},containFocus:function(t){var n;t.on("keydown",function(e){if(9===e.keyCode)return(n=J(":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)})}}),Y.OuterSection=Y.Section.extend({initialize:function(){this.containerParent="#customize-outer-theme-controls",this.containerPaneParent=".customize-outer-pane-parent",Y.Section.prototype.initialize.apply(this,arguments)},onChangeExpanded:function(e,t){var n,i=this,a=i.headContainer.closest(".wp-full-overlay-sidebar-content"),o=i.contentContainer,s=o.find(".customize-section-back"),r=i.headContainer.find(".accordion-section-title").first();J(document.body).toggleClass("outer-section-open",e),i.container.toggleClass("open",e),i.container.removeClass("busy"),Y.section.each(function(e){"outer"===e.params.type&&e.id!==i.id&&e.container.removeClass("open")}),e&&!o.hasClass("open")?(n=t.unchanged?t.completeCallback:function(){i._animateChangeExpanded(function(){r.attr("tabindex","-1"),s.attr("tabindex","0"),s.trigger("focus"),o.css("top",""),a.scrollTop(0),t.completeCallback&&t.completeCallback()}),o.addClass("open")}.bind(this),i.panel()?Y.panel(i.panel()).expand({duration:t.duration,completeCallback:n}):n()):!e&&o.hasClass("open")?(i.panel()&&(n=Y.panel(i.panel())).contentContainer.hasClass("skip-transition")&&n.collapse(),i._animateChangeExpanded(function(){s.attr("tabindex","-1"),r.attr("tabindex","0"),r.trigger("focus"),o.css("top",""),t.completeCallback&&t.completeCallback()}),o.removeClass("open")):t.completeCallback&&t.completeCallback()}}),Y.Panel=a.extend({containerType:"panel",initialize:function(e,t){var n=this,i=t.params||t;i.type||_.find(Y.panelConstructor,function(e,t){return e===n.constructor&&(i.type=t,!0)}),a.prototype.initialize.call(n,e,i),n.embed(),n.deferred.embedded.done(function(){n.ready()})},embed:function(){var e=this,t=J("#customize-theme-controls"),n=J(".customize-pane-parent");e.headContainer.parent().is(n)||n.append(e.headContainer),e.contentContainer.parent().is(e.headContainer)||t.append(e.contentContainer),e.renderContent(),e.deferred.embedded.resolve()},attachEvents:function(){var t,n=this;n.headContainer.find(".accordion-section-title").on("click keydown",function(e){Y.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),n.expanded())||n.expand()}),n.container.find(".customize-panel-back").on("click keydown",function(e){Y.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",function(){var e;t.hasClass("cannot-expand")||(e=t.find(".customize-panel-description:first"),t.hasClass("open")?(t.toggleClass("open"),e.slideUp(n.defaultExpandedArguments.duration,function(){e.trigger("toggled")}),J(this).attr("aria-expanded",!1)):(e.slideDown(n.defaultExpandedArguments.duration,function(){e.trigger("toggled")}),t.toggleClass("open"),J(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,a,o,s,r,c;t.unchanged?t.completeCallback&&t.completeCallback():(a=(i=(n=this).contentContainer).closest(".wp-full-overlay"),o=i.closest(".wp-full-overlay-sidebar-content"),s=n.headContainer.find(".accordion-section-title"),r=i.find(".customize-panel-back"),c=n.sections(),e&&!i.hasClass("current-panel")?(Y.section.each(function(e){n.id!==e.panel()&&e.collapse({duration:0})}),Y.panel.each(function(e){n!==e&&e.collapse({duration:0})}),n.params.autoExpandSoleSection&&1===c.length&&c[0].active.get()?(i.addClass("current-panel skip-transition"),a.addClass("in-sub-panel"),c[0].expand({completeCallback:t.completeCallback})):(n._animateChangeExpanded(function(){s.attr("tabindex","-1"),r.attr("tabindex","0"),r.trigger("focus"),i.css("top",""),o.scrollTop(0),t.completeCallback&&t.completeCallback()}),i.addClass("current-panel"),a.addClass("in-sub-panel")),Y.state("expandedPanel").set(n)):!e&&i.hasClass("current-panel")&&(i.hasClass("skip-transition")?i.removeClass("skip-transition"):n._animateChangeExpanded(function(){s.attr("tabindex","0"),r.attr("tabindex","-1"),s.focus(),i.css("top",""),t.completeCallback&&t.completeCallback()}),a.removeClass("in-sub-panel"),i.removeClass("current-panel"),n===Y.state("expandedPanel").get())&&Y.state("expandedPanel").set(!1))},renderContent:function(){var e=this,t=0!==J("#tmpl-"+e.templateSelector+"-content").length?wp.template(e.templateSelector+"-content"):wp.template("customize-panel-default-content");t&&e.headContainer&&e.contentContainer.html(t(_.extend({id:e.id},e.params)))}}),Y.ThemesPanel=Y.Panel.extend({initialize:function(e,t){this.installingThemes=[],Y.Panel.prototype.initialize.call(this,e,t)},canSwitchTheme:function(e){return!(!e||e!==Y.settings.theme.stylesheet)||"publish"===Y.state("selectedChangesetStatus").get()&&(""===Y.state("changesetStatus").get()||"auto-draft"===Y.state("changesetStatus").get())},attachEvents:function(){var t=this;function e(){t.canSwitchTheme()?t.notifications.remove("theme_switch_unavailable"):t.notifications.add(new Y.Notification("theme_switch_unavailable",{message:Y.l10n.themePreviewUnavailable,type:"warning"}))}Y.Panel.prototype.attachEvents.apply(t),Y.settings.theme._canInstall&&Y.settings.theme._filesystemCredentialsNeeded&&t.notifications.add(new Y.Notification("theme_install_unavailable",{message:Y.l10n.themeInstallUnavailable,type:"info",dismissible:!0})),e(),Y.state("selectedChangesetStatus").bind(e),Y.state("changesetStatus").bind(e),t.contentContainer.on("click",".customize-theme",function(){t.collapse()}),t.contentContainer.on("click",".customize-themes-section-title, .customize-themes-mobile-back",function(){J(".wp-full-overlay").toggleClass("showing-themes")}),t.contentContainer.on("click",".theme-install",function(e){t.installTheme(e)}),t.contentContainer.on("click",".update-theme, #update-theme",function(e){e.preventDefault(),e.stopPropagation(),t.updateTheme(e)}),t.contentContainer.on("click",".delete-theme",function(e){t.deleteTheme(e)}),_.bindAll(t,"installTheme","updateTheme")},onChangeExpanded:function(e,t){var n,i=!1;Y.Panel.prototype.onChangeExpanded.apply(this,[e,t]),t.unchanged?t.completeCallback&&t.completeCallback():(n=this.headContainer.closest(".wp-full-overlay"),e?(n.addClass("in-themes-panel").delay(200).find(".customize-themes-full-container").addClass("animate"),_.delay(function(){n.addClass("themes-panel-expanded")},200),600<window.innerWidth&&(t=this.sections(),_.each(t,function(e){e.expanded()&&(i=!0)}),!i)&&0<t.length&&t[0].expand()):n.removeClass("in-themes-panel themes-panel-expanded").find(".customize-themes-full-container").removeClass("animate"))},installTheme:function(e){var t,i=this,a=J(e.target).data("slug"),o=J.Deferred(),s=J(e.target).hasClass("preview");return Y.settings.theme._filesystemCredentialsNeeded?o.reject({errorCode:"theme_install_unavailable"}):i.canSwitchTheme(a)?_.contains(i.installingThemes,a)?o.reject({errorCode:"theme_already_installing"}):(wp.updates.maybeRequestFilesystemCredentials(e),e=function(t){var e,n=!1;if(s)Y.notifications.remove("theme_installing"),i.loadThemePreview(a);else{if(Y.control.each(function(e){"theme"===e.params.type&&e.params.theme.id===t.slug&&(n=e.params.theme,e.rerenderAsInstalled(!0))}),!n||Y.control.has("installed_theme_"+n.id))return void o.resolve(t);n.type="installed",e=new Y.controlConstructor.theme("installed_theme_"+n.id,{type:"theme",section:"installed_themes",theme:n,priority:0}),Y.control.add(e),Y.control(e.id).container.trigger("render-screenshot"),Y.section.each(function(e){"themes"===e.params.type&&n.id===e.currentTheme&&e.closeDetails()})}o.resolve(t)},i.installingThemes.push(a),t=wp.updates.installTheme({slug:a}),s&&Y.notifications.add(new Y.OverlayNotification("theme_installing",{message:Y.l10n.themeDownloading,type:"info",loading:!0})),t.done(e),t.fail(function(){Y.notifications.remove("theme_installing")})):o.reject({errorCode:"theme_switch_unavailable"}),o.promise()},loadThemePreview:function(e){var t,n,i=J.Deferred();return this.canSwitchTheme(e)?((n=document.createElement("a")).href=location.href,e=_.extend(Y.utils.parseQueryString(n.search.substr(1)),{theme:e,changeset_uuid:Y.settings.changeset.uuid,return:Y.settings.url.return}),Y.state("saved").get()||(e.customize_autosaved="on"),n.search=J.param(e),Y.notifications.add(new Y.OverlayNotification("theme_previewing",{message:Y.l10n.themePreviewWait,type:"info",loading:!0})),t=function(){var e;0<Y.state("processing").get()||(Y.state("processing").unbind(t),(e=Y.requestChangesetUpdate({},{autosave:!0})).done(function(){i.resolve(),J(window).off("beforeunload.customize-confirm"),location.replace(n.href)}),e.fail(function(){Y.notifications.remove("theme_previewing"),i.reject()}))},0===Y.state("processing").get()?t():Y.state("processing").bind(t)):i.reject({errorCode:"theme_switch_unavailable"}),i.promise()},updateTheme:function(e){wp.updates.maybeRequestFilesystemCredentials(e),J(document).one("wp-theme-update-success",function(e,t){Y.control.each(function(e){"theme"===e.params.type&&e.params.theme.id===t.slug&&(e.params.theme.hasUpdate=!1,e.params.theme.version=t.newVersion,setTimeout(function(){e.rerenderAsInstalled(!0)},2e3))})}),wp.updates.updateTheme({slug:J(e.target).closest(".notice").data("slug")})},deleteTheme:function(e){var t=J(e.target).data("slug"),n=Y.section("installed_themes");e.preventDefault(),Y.settings.theme._filesystemCredentialsNeeded||window.confirm(Y.settings.l10n.confirmDeleteTheme)&&(wp.updates.maybeRequestFilesystemCredentials(e),J(document).one("wp-theme-delete-success",function(){var e=Y.control("installed_theme_"+t);e.container.remove(),Y.control.remove(e.id),n.loaded=n.loaded-1,n.updateCount(),Y.control.each(function(e){"theme"===e.params.type&&e.params.theme.id===t&&e.rerenderAsInstalled(!1)})}),wp.updates.deleteTheme({slug:t}),n.closeDetails(),n.focus())}}),Y.Control=Y.Class.extend({defaultActiveArguments:{duration:"fast",completeCallback:J.noop},defaults:{label:"",description:"",active:!0,priority:10},initialize:function(e,t){var n,i=this,a=[];i.params=_.extend({},i.defaults,i.params||{},t.params||t||{}),Y.Control.instanceCounter||(Y.Control.instanceCounter=0),Y.Control.instanceCounter++,i.params.instanceNumber||(i.params.instanceNumber=Y.Control.instanceCounter),i.params.type||_.find(Y.controlConstructor,function(e,t){return e===i.constructor&&(i.params.type=t,!0)}),i.params.content||(i.params.content=J("<li></li>",{id:"customize-control-"+e.replace(/]/g,"").replace(/\[/g,"-"),class:"customize-control customize-control-"+i.params.type})),i.id=e,i.selector="#customize-control-"+e.replace(/\]/g,"").replace(/\[/g,"-"),i.params.content?i.container=J(i.params.content):i.container=J(i.selector),i.params.templateId?i.templateSelector=i.params.templateId:i.templateSelector="customize-control-"+i.params.type+"-content",i.deferred=_.extend(i.deferred||{},{embedded:new J.Deferred}),i.section=new Y.Value,i.priority=new Y.Value,i.active=new Y.Value,i.activeArgumentsQueue=[],i.notifications=new Y.Notifications({alt:i.altNotice}),i.elements=[],i.active.bind(function(e){var t=i.activeArgumentsQueue.shift(),t=J.extend({},i.defaultActiveArguments,t);i.onChangeActive(e,t)}),i.section.set(i.params.section),i.priority.set(isNaN(i.params.priority)?10:i.params.priority),i.active.set(i.params.active),Y.utils.bubbleChildValueChanges(i,["section","priority","active"]),i.settings={},n={},i.params.setting&&(n.default=i.params.setting),_.extend(n,i.params.settings),_.each(n,function(e,t){var n;_.isObject(e)&&_.isFunction(e.extended)&&e.extended(Y.Value)?i.settings[t]=e:_.isString(e)&&((n=Y(e))?i.settings[t]=n:a.push(e))}),t=function(){_.each(n,function(e,t){!i.settings[t]&&_.isString(e)&&(i.settings[t]=Y(e))}),i.settings[0]&&!i.settings.default&&(i.settings.default=i.settings[0]),i.setting=i.settings.default||null,i.linkElements(),i.embed()},0===a.length?t():Y.apply(Y,a.concat(t)),i.deferred.embedded.done(function(){i.linkElements(),i.setupNotifications(),i.ready()})},linkElements:function(){var i,a=this,o=a.container.find("[data-customize-setting-link], [data-customize-setting-key-link]"),s={};o.each(function(){var e,t,n=J(this);if(!n.data("customizeSettingLinked")){if(n.data("customizeSettingLinked",!0),n.is(":radio")){if(e=n.prop("name"),s[e])return;s[e]=!0,n=o.filter('[name="'+e+'"]')}n.data("customizeSettingLink")?t=Y(n.data("customizeSettingLink")):n.data("customizeSettingKeyLink")&&(t=a.settings[n.data("customizeSettingKeyLink")]),t&&(i=new Y.Element(n),a.elements.push(i),i.sync(t),i.set(t()))}})},embed:function(){var n=this,e=function(e){var t;e&&Y.section(e,function(e){e.deferred.embedded.done(function(){t=e.contentContainer.is("ul")?e.contentContainer:e.contentContainer.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(){var t,n=this;"dropdown-pages"===n.params.type&&n.params.allow_addition&&((t=n.container.find(".new-content-item")).hide(),n.container.on("click",".add-new-toggle",function(e){J(e.currentTarget).slideUp(180),t.slideDown(180),t.find(".create-item-input").focus()}),n.container.on("click",".add-content",function(){n.addNewPage()}),n.container.on("keydown",".create-item-input",function(e){13===e.which&&n.addNewPage()}))},getNotificationsContainerElement:function(){var e,t=this,n=t.container.find(".customize-control-notifications-container:first");return n.length||(n=J('<div class="customize-control-notifications-container"></div>'),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},setupNotifications:function(){var n,e,i=this;_.each(i.settings,function(n){n.notifications&&(n.notifications.bind("add",function(e){var t=_.extend({},e,{setting:n.id});i.notifications.add(new Y.Notification(n.id+":"+e.code,t))}),n.notifications.bind("remove",function(e){i.notifications.remove(n.id+":"+e.code)}))}),n=function(){var e=i.section();(!e||Y.section.has(e)&&Y.section(e).expanded())&&i.notifications.render()},i.notifications.bind("rendered",function(){var e=i.notifications.get();i.container.toggleClass("has-notifications",0!==e.length),i.container.toggleClass("has-error",0!==_.where(e,{type:"error"}).length)}),i.section.bind(e=function(e,t){t&&Y.section.has(t)&&Y.section(t).expanded.unbind(n),e&&Y.section(e,function(e){e.expanded.bind(n),n()})}),e(i.section.get()),i.notifications.bind("change",_.debounce(n))},renderNotifications:function(){var e,t,n=this,i=!1;"undefined"!=typeof console&&console.warn&&console.warn("[DEPRECATED] wp.customize.Control.prototype.renderNotifications() is deprecated in favor of instantating a wp.customize.Notifications and calling its render() method."),(e=n.getNotificationsContainerElement())&&e.length&&(t=[],n.notifications.each(function(e){t.push(e),"error"===e.type&&(i=!0)}),0===t.length?e.stop().slideUp("fast"):e.stop().slideDown("fast",null,function(){J(this).css("height","auto")}),n.notificationsTemplate||(n.notificationsTemplate=wp.template("customize-control-notifications")),n.container.toggleClass("has-notifications",0!==t.length),n.container.toggleClass("has-error",i),e.empty().append(n.notificationsTemplate({notifications:t,altNotice:Boolean(n.altNotice)}).trim()))},expand:function(e){Y.section(this.section()).expand(e)},focus:o,onChangeActive:function(e,t){t.unchanged?t.completeCallback&&t.completeCallback():J.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:a.prototype.activate,deactivate:a.prototype.deactivate,_toggleActive:a.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,a=!1;this.container.on("click keydown",".dropdown",function(e){Y.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),a||t.container.toggleClass("open"),t.container.hasClass("open")&&t.container.parent().parent().find("li.library-selected").focus(),a=!0,setTimeout(function(){a=!1},400))}),this.setting.bind(e),e(this.setting())},renderContent:function(){var e=this,t=e.templateSelector;t==="customize-control-"+e.params.type+"-content"&&_.contains(["button","checkbox","date","datetime-local","email","month","number","password","radio","range","search","select","tel","time","text","textarea","week","url"],e.params.type)&&!document.getElementById("tmpl-"+t)&&0===e.container.children().length&&(t="customize-control-default-content"),document.getElementById("tmpl-"+t)&&(t=wp.template(t))&&e.container&&e.container.html(t(e.params)),e.notifications.container=e.getNotificationsContainerElement(),(!(t=e.section())||Y.section.has(t)&&Y.section(t).expanded())&&e.notifications.render()},addNewPage:function(){var e,a,o,t,s,r,c=this;"dropdown-pages"===c.params.type&&c.params.allow_addition&&Y.Menus&&(a=c.container.find(".add-new-toggle"),o=c.container.find(".new-content-item"),t=c.container.find(".create-item-input"),s=t.val(),r=c.container.find("select"),s?(t.removeClass("invalid"),t.attr("disabled","disabled"),(e=Y.Menus.insertAutoDraftPost({post_title:s,post_type:"page"})).done(function(e){var t,n,i=new Y.Menus.AvailableItemModel({id:"post-"+e.post_id,title:s,type:"post_type",type_label:Y.Menus.data.l10n.page_label,object:"page",object_id:e.post_id,url:e.url});Y.Menus.availableMenuItemsPanel.collection.add(i),t=J("#available-menu-items-post_type-page").find(".available-menu-items-list"),n=wp.template("available-menu-item"),t.prepend(n(i.attributes)),r.focus(),c.setting.set(String(e.post_id)),o.slideUp(180),a.slideDown(180)}),e.always(function(){t.val("").removeAttr("disabled")})):t.addClass("invalid"))}}),Y.ColorControl=Y.Control.extend({ready:function(){var t,n=this,e="hue"===this.params.mode,i=!1;e?(t=this.container.find(".color-picker-hue")).val(n.setting()).wpColorPicker({change:function(e,t){i=!0,n.setting(t.color.h()),i=!1}}):(t=this.container.find(".color-picker-hex")).val(n.setting()).wpColorPicker({change:function(){i=!0,n.setting.set(t.wpColorPicker("color")),i=!1},clear:function(){i=!0,n.setting.set(""),i=!1}}),n.setting.bind(function(e){i||(t.val(e),t.wpColorPicker("color",e))}),n.container.on("keydown",function(e){27===e.which&&n.container.find(".wp-picker-container").hasClass("wp-picker-active")&&(t.wpColorPicker("close"),n.container.find(".wp-color-result").focus(),e.stopPropagation())})}}),Y.MediaControl=Y.Control.extend({ready:function(){var n=this;function e(e){var t=J.Deferred();n.extended(Y.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),Y.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){Y.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){Y.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),this.params.attachment=this.params.defaultAttachment,this.setting(this.params.defaultAttachment.url))},removeFile:function(e){Y.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),this.params.attachment={},this.setting(""),this.renderContent())}}),Y.UploadControl=Y.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(){}}),Y.ImageControl=Y.UploadControl.extend({thumbnailSrc:function(){}}),Y.BackgroundControl=Y.UploadControl.extend({ready:function(){Y.UploadControl.prototype.ready.apply(this,arguments)},select:function(){Y.UploadControl.prototype.select.apply(this,arguments),wp.ajax.post("custom-background-add",{nonce:_wpCustomizeBackground.nonces.add,wp_customize:"on",customize_theme:Y.settings.theme.stylesheet,attachment_id:this.params.attachment.id})}}),Y.BackgroundPositionControl=Y.Control.extend({ready:function(){var e,n=this;n.container.on("change",'input[name="background-position"]',function(){var e=J(this).val().split(" ");n.settings.x(e[0]),n.settings.y(e[1])}),e=_.debounce(function(){var e=n.settings.x.get(),t=n.settings.y.get(),e=String(e)+" "+String(t);n.container.find('input[name="background-position"][value="'+e+'"]').trigger("click")}),n.settings.x.bind(e),n.settings.y.bind(e),e()}}),Y.CroppedImageControl=Y.MediaControl.extend({openFrame:function(e){Y.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),a=!!parseInt(n.params.flex_height,10),o=e.get("width"),e=e.get("height"),s=parseInt(n.params.width,10),r=parseInt(n.params.height,10),c=s/r,l=s,d=r;return t.set("canSkipCrop",!n.mustBeCropped(i,a,s,r,o,e)),c<o/e?s=(r=e)*c:r=(s=o)/c,!(c={handles:!0,keys:!0,instance:!0,persistent:!0,imageWidth:o,imageHeight:e,minWidth:s<l?s:l,minHeight:r<d?r:d,x1:t=(o-s)/2,y1:n=(e-r)/2,x2:s+t,y2:r+n})==a&&!1==i&&(c.aspectRatio=s+":"+r),!0==a&&(delete c.minHeight,c.maxWidth=o),!0==i&&(delete c.minWidth,c.maxHeight=e),c},mustBeCropped:function(e,t,n,i,a,o){return(!0!==e||!0!==t)&&!(!0===e&&i===o||!0===t&&n===a||n===a&&i===o||a<=n)},onSkippedCrop:function(){var e=this.frame.state().get("selection").first().toJSON();this.setImageFromAttachment(e)},setImageFromAttachment:function(e){this.params.attachment=e,this.setting(e.id)}}),Y.SiteIconControl=Y.CroppedImageControl.extend({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.SiteIconCropper({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(),t=this;this.params.width!==e.width||this.params.height!==e.height||this.params.flex_width||this.params.flex_height?this.frame.setState("cropper"):wp.ajax.post("crop-image",{nonce:e.nonces.edit,id:e.id,context:"site-icon",cropDetails:{x1:0,y1:0,width:this.params.width,height:this.params.height,dst_width:this.params.width,dst_height:this.params.height}}).done(function(e){t.setImageFromAttachment(e),t.frame.close()}).fail(function(){t.frame.trigger("content:error:crop")})},setImageFromAttachment:function(t){var n;_.each(["site_icon-32","thumbnail","full"],function(e){n||_.isUndefined(t.sizes[e])||(n=t.sizes[e])}),this.params.attachment=t,this.setting(t.id),n&&J('link[rel="icon"][sizes="32x32"]').attr("href",n.url)},removeFile:function(e){Y.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),this.params.attachment={},this.setting(""),this.renderContent(),J('link[rel="icon"][sizes="32x32"]').attr("href","/favicon.ico"))}}),Y.HeaderControl=Y.Control.extend({ready:function(){this.btnRemove=J("#customize-control-header_image .actions .remove"),this.btnNew=J("#customize-control-header_image .actions .new"),_.bindAll(this,"openMedia","removeImage"),this.btnNew.on("click",this.openMedia),this.btnRemove.on("click",this.removeImage),Y.HeaderTool.currentHeader=this.getInitialHeaderImage(),new Y.HeaderTool.CurrentView({model:Y.HeaderTool.currentHeader,el:"#customize-control-header_image .current .container"}),new Y.HeaderTool.ChoiceListView({collection:Y.HeaderTool.UploadsList=new Y.HeaderTool.ChoiceList,el:"#customize-control-header_image .choices .uploaded .list"}),new Y.HeaderTool.ChoiceListView({collection:Y.HeaderTool.DefaultsList=new Y.HeaderTool.DefaultsList,el:"#customize-control-header_image .choices .default .list"}),Y.HeaderTool.combinedList=Y.HeaderTool.CombinedList=new Y.HeaderTool.CombinedList([Y.HeaderTool.UploadsList,Y.HeaderTool.DefaultsList]),wp.media.controller.Cropper.prototype.defaults.doCropArgs.wp_customize="on",wp.media.controller.Cropper.prototype.defaults.doCropArgs.customize_theme=Y.settings.theme.stylesheet},getInitialHeaderImage:function(){var e;return Y.get().header_image&&Y.get().header_image_data&&!_.contains(["remove-header","random-default-image","random-uploaded-image"],Y.get().header_image)?(e=(e=_.find(_wpCustomizeHeader.uploads,function(e){return e.attachment_id===Y.get().header_image_data.attachment_id}))||{url:Y.get().header_image,thumbnail_url:Y.get().header_image,attachment_id:Y.get().header_image_data.attachment_id},new Y.HeaderTool.ImageModel({header:e,choice:e.url.split("/").pop()})):new Y.HeaderTool.ImageModel},calculateImageSelectOptions:function(e,t){var n=parseInt(_wpCustomizeHeader.data.width,10),i=parseInt(_wpCustomizeHeader.data.height,10),a=!!parseInt(_wpCustomizeHeader.data["flex-width"],10),o=!!parseInt(_wpCustomizeHeader.data["flex-height"],10),s=e.get("width"),e=e.get("height");return this.headerImage=new Y.HeaderTool.ImageModel,this.headerImage.set({themeWidth:n,themeHeight:i,themeFlexWidth:a,themeFlexHeight:o,imageWidth:s,imageHeight:e}),t.set("canSkipCrop",!this.headerImage.shouldBeCropped()),(t=n/i)<s/e?n=(i=e)*t:i=(n=s)/t,!(t={handles:!0,keys:!0,instance:!0,persistent:!0,imageWidth:s,imageHeight:e,x1:0,y1:0,x2:n,y2:i})==o&&!1==a&&(t.aspectRatio=n+":"+i),!1==o&&(t.maxHeight=i),!1==a&&(t.maxWidth=n),t},openMedia:function(e){var t=_wpMediaViewsL10n;e.preventDefault(),this.frame=wp.media({button:{text:t.selectAndCrop,close:!1},states:[new wp.media.controller.Library({title:t.chooseImage,library:wp.media.query({type:"image"}),multiple:!1,date:!1,priority:20,suggestedWidth:_wpCustomizeHeader.data.width,suggestedHeight:_wpCustomizeHeader.data.height}),new wp.media.controller.Cropper({imgSelectOptions:this.calculateImageSelectOptions})]}),this.frame.on("select",this.onSelect,this),this.frame.on("cropped",this.onCropped,this),this.frame.on("skippedcrop",this.onSkippedCrop,this),this.frame.open()},onSelect:function(){this.frame.setState("cropper")},onCropped:function(e){var t=e.url,n=e.attachment_id,i=e.width,e=e.height;this.setImageFromURL(t,n,i,e)},onSkippedCrop:function(e){var t=e.get("url"),n=e.get("width"),i=e.get("height");this.setImageFromURL(t,e.id,n,i)},setImageFromURL:function(e,t,n,i){var a={};a.url=e,a.thumbnail_url=e,a.timestamp=_.now(),t&&(a.attachment_id=t),n&&(a.width=n),i&&(a.height=i),t=new Y.HeaderTool.ImageModel({header:a,choice:e.split("/").pop()}),Y.HeaderTool.UploadsList.add(t),Y.HeaderTool.currentHeader.set(t.toJSON()),t.save(),t.importImage()},removeImage:function(){Y.HeaderTool.currentHeader.trigger("hide"),Y.HeaderTool.CombinedList.trigger("control:removeImage")}}),Y.ThemeControl=Y.Control.extend({touchDrag:!1,screenshotRendered:!1,ready:function(){var n=this,e=Y.panel("themes");function t(){return!e.canSwitchTheme(n.params.theme.id)}function i(){n.container.find("button.preview, button.preview-theme").toggleClass("disabled",t()),n.container.find("button.theme-install").toggleClass("disabled",t()||!1===Y.settings.theme._canInstall||!0===Y.settings.theme._filesystemCredentialsNeeded)}Y.state("selectedChangesetStatus").bind(i),Y.state("changesetStatus").bind(i),i(),n.container.on("touchmove",".theme",function(){n.touchDrag=!0}),n.container.on("click keydown touchend",".theme",function(e){var t;if(!Y.utils.isKeydownButNotEnterEvent(e))return!0===n.touchDrag?n.touchDrag=!1:void(J(e.target).is(".theme-actions .button, .update-theme")||(e.preventDefault(),(t=Y.section(n.section())).showDetails(n.params.theme,function(){Y.settings.theme._filesystemCredentialsNeeded&&t.overlay.find(".theme-actions .delete-theme").remove()})))}),n.container.on("render-screenshot",function(){var e=J(this).find("img"),t=e.data("src");t&&e.attr("src",t),n.screenshotRendered=!0})},filter:function(e){var t=this,n=0,i=(i=t.params.theme.name+" "+t.params.theme.description+" "+t.params.theme.tags+" "+t.params.theme.author+" ").toLowerCase().replace("-"," ");return _.isArray(e)||(e=[e]),t.params.theme.name.toLowerCase()===e.join(" ")?n=100:(n+=10*(i.split(e.join(" ")).length-1),_.each(e,function(e){n=(n+=2*(i.split(e+" ").length-1))+i.split(e).length-1}),99<n&&(n=99)),0!==n?(t.activate(),t.params.priority=101-n,!0):(t.deactivate(),!(t.params.priority=101))},rerenderAsInstalled:function(e){var t=this;e?t.params.theme.type="installed":(e=Y.section(t.params.section),t.params.theme.type=e.params.action),t.renderContent(),t.container.trigger("render-screenshot")}}),Y.CodeEditorControl=Y.Control.extend({initialize:function(e,t){var n=this;n.deferred=_.extend(n.deferred||{},{codemirror:J.Deferred()}),Y.Control.prototype.initialize.call(n,e,t),n.notifications.bind("add",function(e){var t;e.code===n.setting.id+":csslint_error"&&(e.templateId="customize-code-editor-lint-error-notification",e.render=(t=e.render,function(){var e=t.call(this);return e.find("input[type=checkbox]").on("click",function(){n.setting.notifications.remove("csslint_error")}),e}))})},ready:function(){var i=this;i.section()?Y.section(i.section(),function(n){n.deferred.embedded.done(function(){var t;n.expanded()?i.initEditor():n.expanded.bind(t=function(e){e&&(i.initEditor(),n.expanded.unbind(t))})})}):i.initEditor()},initEditor:function(){var e,t=this,n=!1;wp.codeEditor&&(_.isUndefined(t.params.editor_settings)||!1!==t.params.editor_settings)&&((n=wp.codeEditor.defaultSettings?_.clone(wp.codeEditor.defaultSettings):{}).codemirror=_.extend({},n.codemirror,{indentUnit:2,tabSize:2}),_.isObject(t.params.editor_settings))&&_.each(t.params.editor_settings,function(e,t){_.isObject(e)&&(n[t]=_.extend({},n[t],e))}),e=new Y.Element(t.container.find("textarea")),t.elements.push(e),e.sync(t.setting),e.set(t.setting()),n?t.initSyntaxHighlightingEditor(n):t.initPlainTextareaEditor()},focus:function(e){var t=this,e=_.extend({},e),n=e.completeCallback;e.completeCallback=function(){n&&n(),t.editor&&t.editor.codemirror.focus()},Y.Control.prototype.focus.call(t,e)},initSyntaxHighlightingEditor:function(e){var t=this,n=t.container.find("textarea"),i=!1,e=_.extend({},e,{onTabNext:_.bind(t.onTabNext,t),onTabPrevious:_.bind(t.onTabPrevious,t),onUpdateErrorNotice:_.bind(t.onUpdateErrorNotice,t)});t.editor=wp.codeEditor.initialize(n,e),J(t.editor.codemirror.display.lineDiv).attr({role:"textbox","aria-multiline":"true","aria-label":t.params.label,"aria-describedby":"editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"}),t.container.find("label").on("click",function(){t.editor.codemirror.focus()}),t.editor.codemirror.on("change",function(e){i=!0,n.val(e.getValue()).trigger("change"),i=!1}),t.setting.bind(function(e){i||t.editor.codemirror.setValue(e)}),t.editor.codemirror.on("keydown",function(e,t){27===t.keyCode&&t.stopPropagation()}),t.deferred.codemirror.resolveWith(t,[t.editor.codemirror])},onTabNext:function(){var e=Y.section(this.section()).controls(),t=e.indexOf(this);e.length===t+1?J("#customize-footer-actions .collapse-sidebar").trigger("focus"):e[t+1].container.find(":focusable:first").focus()},onTabPrevious:function(){var e=Y.section(this.section()),t=e.controls(),n=t.indexOf(this);(0===n?e.contentContainer.find(".customize-section-title .customize-help-toggle, .customize-section-title .customize-section-description.open .section-description-close").last():t[n-1].contentContainer.find(":focusable:first")).focus()},onUpdateErrorNotice:function(e){this.setting.notifications.remove("csslint_error"),0!==e.length&&(e=1===e.length?Y.l10n.customCssError.singular.replace("%d","1"):Y.l10n.customCssError.plural.replace("%d",String(e.length)),this.setting.notifications.add(new Y.Notification("csslint_error",{message:e,type:"error"})))},initPlainTextareaEditor:function(){var a=this.container.find("textarea"),o=a[0];a.on("blur",function(){a.data("next-tab-blurs",!1)}),a.on("keydown",function(e){var t,n,i;27===e.keyCode?a.data("next-tab-blurs")||(a.data("next-tab-blurs",!0),e.stopPropagation()):9!==e.keyCode||e.ctrlKey||e.altKey||e.shiftKey||a.data("next-tab-blurs")||(t=o.selectionStart,n=o.selectionEnd,i=o.value,0<=t&&(o.value=i.substring(0,t).concat("\t",i.substring(n)),a.selectionStart=o.selectionEnd=t+1),e.stopPropagation(),e.preventDefault())}),this.deferred.codemirror.rejectWith(this)}}),Y.DateTimeControl=Y.Control.extend({ready:function(){var i=this;if(i.inputElements={},i.invalidDate=!1,_.bindAll(i,"populateSetting","updateDaysForMonth","populateDateInputs"),!i.setting)throw new Error("Missing setting");i.container.find(".date-input").each(function(){var e=J(this),t=e.data("component"),n=new Y.Element(e);i.inputElements[t]=n,i.elements.push(n),e.on("change",function(){i.invalidDate&&i.notifications.add(new Y.Notification("invalid_date",{message:Y.l10n.invalidDate}))}),e.on("input",_.debounce(function(){i.invalidDate||i.notifications.remove("invalid_date")})),e.on("blur",_.debounce(function(){i.invalidDate||i.populateDateInputs()}))}),i.inputElements.month.bind(i.updateDaysForMonth),i.inputElements.year.bind(i.updateDaysForMonth),i.populateDateInputs(),i.setting.bind(i.populateDateInputs),_.each(i.inputElements,function(e){e.bind(i.populateSetting)})},parseDateTime:function(e){var t;return(t=e?e.match(/^(\d\d\d\d)-(\d\d)-(\d\d)(?: (\d\d):(\d\d)(?::(\d\d))?)?$/):t)?(t.shift(),e={year:t.shift(),month:t.shift(),day:t.shift(),hour:t.shift()||"00",minute:t.shift()||"00",second:t.shift()||"00"},this.params.includeTime&&this.params.twelveHourFormat&&(e.hour=parseInt(e.hour,10),e.meridian=12<=e.hour?"pm":"am",e.hour=e.hour%12?String(e.hour%12):String(12),delete e.second),e):null},validateInputs:function(){var e,i,a=this;return a.invalidDate=!1,e=["year","day"],a.params.includeTime&&e.push("hour","minute"),_.find(e,function(e){var t,n,e=a.inputElements[e];return i=e.element.get(0),t=parseInt(e.element.attr("max"),10),n=parseInt(e.element.attr("min"),10),e=parseInt(e(),10),a.invalidDate=isNaN(e)||t<e||e<n,a.invalidDate||i.setCustomValidity(""),a.invalidDate}),a.inputElements.meridian&&!a.invalidDate&&(i=a.inputElements.meridian.element.get(0),"am"!==a.inputElements.meridian.get()&&"pm"!==a.inputElements.meridian.get()?a.invalidDate=!0:i.setCustomValidity("")),a.invalidDate?i.setCustomValidity(Y.l10n.invalidValue):i.setCustomValidity(""),(!a.section()||Y.section.has(a.section())&&Y.section(a.section()).expanded())&&_.result(i,"reportValidity"),a.invalidDate},updateDaysForMonth:function(){var e=this,t=parseInt(e.inputElements.month(),10),n=parseInt(e.inputElements.year(),10),i=parseInt(e.inputElements.day(),10);t&&n&&(n=new Date(n,t,0).getDate(),e.inputElements.day.element.attr("max",n),n<i)&&e.inputElements.day(String(n))},populateSetting:function(){var e,t=this;return!(t.validateInputs()||!t.params.allowPastDate&&!t.isFutureDate()||(e=t.convertInputDateToString(),t.setting.set(e),0))},convertInputDateToString:function(){var e,n=this,t="",i=function(e,t){return String(e).length<t&&(t=t-String(e).length,e=Math.pow(10,t).toString().substr(1)+String(e)),e},a=function(e){var t=parseInt(n.inputElements[e].get(),10);return _.contains(["month","day","hour","minute"],e)?t=i(t,2):"year"===e&&(t=i(t,4)),t},o=["year","-","month","-","day"];return n.params.includeTime&&(e=n.inputElements.meridian?n.convertHourToTwentyFourHourFormat(n.inputElements.hour(),n.inputElements.meridian()):n.inputElements.hour(),o=o.concat([" ",i(e,2),":","minute",":","00"])),_.each(o,function(e){t+=n.inputElements[e]?a(e):e}),t},isFutureDate:function(){return 0<Y.utils.getRemainingTime(this.convertInputDateToString())},convertHourToTwentyFourHourFormat:function(e,t){e=parseInt(e,10);return isNaN(e)?"":(t="pm"===t&&e<12?e+12:"am"===t&&12===e?e-12:e,String(t))},populateDateInputs:function(){var i=this.parseDateTime(this.setting.get());return!!i&&(_.each(this.inputElements,function(e,t){var n=i[t];"month"===t||"meridian"===t?(n=n.replace(/^0/,""),e.set(n)):(n=parseInt(n,10),e.element.is(document.activeElement)?n!==parseInt(e(),10)&&e.set(String(n)):e.set(i[t]))}),!0)},toggleFutureDateNotification:function(e){var t="not_future_date";return e?(e=new Y.Notification(t,{type:"error",message:Y.l10n.futureDateError}),this.notifications.add(e)):this.notifications.remove(t),this}}),Y.PreviewLinkControl=Y.Control.extend({defaults:_.extend({},Y.Control.prototype.defaults,{templateId:"customize-preview-link-control"}),ready:function(){var e,t,n,i,a,o=this;_.bindAll(o,"updatePreviewLink"),o.setting||(o.setting=new Y.Value),o.previewElements={},o.container.find(".preview-control-element").each(function(){t=J(this),e=t.data("component"),t=new Y.Element(t),o.previewElements[e]=t,o.elements.push(t)}),n=o.previewElements.url,i=o.previewElements.input,a=o.previewElements.button,i.link(o.setting),n.link(o.setting),n.bind(function(e){n.element.parent().attr({href:e,target:Y.settings.changeset.uuid})}),Y.bind("ready",o.updatePreviewLink),Y.state("saved").bind(o.updatePreviewLink),Y.state("changesetStatus").bind(o.updatePreviewLink),Y.state("activated").bind(o.updatePreviewLink),Y.previewer.previewUrl.bind(o.updatePreviewLink),a.element.on("click",function(e){e.preventDefault(),o.setting()&&(i.element.select(),document.execCommand("copy"),a(a.element.data("copied-text")))}),n.element.parent().on("click",function(e){J(this).hasClass("disabled")&&e.preventDefault()}),a.element.on("mouseenter",function(){o.setting()&&a(a.element.data("copy-text"))})},updatePreviewLink:function(){var e=!Y.state("saved").get()||""===Y.state("changesetStatus").get()||"auto-draft"===Y.state("changesetStatus").get();this.toggleSaveNotification(e),this.previewElements.url.element.parent().toggleClass("disabled",e),this.previewElements.button.element.prop("disabled",e),this.setting.set(Y.previewer.getFrontendPreviewUrl())},toggleSaveNotification:function(e){var t="changes_not_saved";e?(e=new Y.Notification(t,{type:"info",message:Y.l10n.saveBeforeShare}),this.notifications.add(e)):this.notifications.remove(t)}}),Y.defaultConstructor=Y.Setting,Y.control=new Y.Values({defaultConstructor:Y.Control}),Y.section=new Y.Values({defaultConstructor:Y.Section}),Y.panel=new Y.Values({defaultConstructor:Y.Panel}),Y.notifications=new Y.Notifications,Y.PreviewFrame=Y.Messenger.extend({sensitivity:null,initialize:function(e,t){var n=J.Deferred();n.promise(this),this.container=e.container,J.extend(e,{channel:Y.PreviewFrame.uuid()}),Y.Messenger.prototype.initialize.call(this,e,t),this.add("previewUrl",e.previewUrl),this.query=J.extend(e.query||{},{customize_messenger_channel:this.channel()}),this.run(n)},run:function(t){var e,n,i,a=this,o=!1,s=!1,r=null,c="{}"!==a.query.customized;a._ready&&a.unbind("ready",a._ready),a._ready=function(e){s=!0,r=e,a.container.addClass("iframe-ready"),e&&o&&t.resolveWith(a,[e])},a.bind("ready",a._ready),(e=document.createElement("a")).href=a.previewUrl(),n=_.extend(Y.utils.parseQueryString(e.search.substr(1)),{customize_changeset_uuid:a.query.customize_changeset_uuid,customize_theme:a.query.customize_theme,customize_messenger_channel:a.query.customize_messenger_channel}),!Y.settings.changeset.autosaved&&Y.state("saved").get()||(n.customize_autosaved="on"),e.search=J.param(n),a.iframe=J("<iframe />",{title:Y.l10n.previewIframeTitle,name:"customize-"+a.channel()}),a.iframe.attr("onmousewheel",""),a.iframe.attr("sandbox","allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-presentation allow-same-origin allow-scripts"),c?a.iframe.attr("data-src",e.href):a.iframe.attr("src",e.href),a.iframe.appendTo(a.container),a.targetWindow(a.iframe[0].contentWindow),c&&((i=J("<form>",{action:e.href,target:a.iframe.attr("name"),method:"post",hidden:"hidden"})).append(J("<input>",{type:"hidden",name:"_method",value:"GET"})),_.each(a.query,function(e,t){i.append(J("<input>",{type:"hidden",name:t,value:e}))}),a.container.append(i),i.trigger("submit"),i.remove()),a.bind("iframe-loading-error",function(e){a.iframe.remove(),0===e?a.login(t):-1===e?t.rejectWith(a,["cheatin"]):t.rejectWith(a,["request failure"])}),a.iframe.one("load",function(){o=!0,s?t.resolveWith(a,[r]):setTimeout(function(){t.rejectWith(a,["ready timeout"])},a.sensitivity)})},login:function(n){var i=this,a=function(){n.rejectWith(i,["logged out"])};if(this.triedLogin)return a();J.get(Y.settings.url.ajax,{action:"logged-in"}).fail(a).done(function(e){var t;"1"!==e&&a(),(t=J("<iframe />",{src:i.previewUrl(),title:Y.l10n.previewIframeTitle}).hide()).appendTo(i.container),t.on("load",function(){i.triedLogin=!0,t.remove(),i.run(n)})})},destroy:function(){Y.Messenger.prototype.destroy.call(this),this.iframe&&this.iframe.remove(),delete this.iframe,delete this.targetWindow}}),i=0,Y.PreviewFrame.uuid=function(){return"preview-"+String(i++)},Y.setDocumentTitle=function(e){e=Y.settings.documentTitleTmpl.replace("%s",e);document.title=e,Y.trigger("title",e)},Y.Previewer=Y.Messenger.extend({refreshBuffer:null,initialize:function(e,t){var n,o=this,i=document.createElement("a");J.extend(o,t||{}),o.deferred={active:J.Deferred()},o.refresh=_.debounce((n=o.refresh,function(){var e,t=function(){return 0===Y.state("processing").get()};t()?n.call(o):(e=function(){t()&&(n.call(o),Y.state("processing").unbind(e))},Y.state("processing").bind(e))}),o.refreshBuffer),o.container=Y.ensure(e.container),o.allowedUrls=e.allowedUrls,e.url=window.location.href,Y.Messenger.prototype.initialize.call(o,e),i.href=o.origin(),o.add("scheme",i.protocol.replace(/:$/,"")),o.add("previewUrl",e.previewUrl).setter(function(e){var n,i=null,t=[],a=document.createElement("a");return a.href=e,/\/wp-(admin|includes|content)(\/|$)/.test(a.pathname)?null:(1<a.search.length&&(delete(e=Y.utils.parseQueryString(a.search.substr(1))).customize_changeset_uuid,delete e.customize_theme,delete e.customize_messenger_channel,delete e.customize_autosaved,_.isEmpty(e)?a.search="":a.search=J.param(e)),t.push(a),o.scheme.get()+":"!==a.protocol&&((a=document.createElement("a")).href=t[0].href,a.protocol=o.scheme.get()+":",t.unshift(a)),n=document.createElement("a"),_.find(t,function(t){return!_.isUndefined(_.find(o.allowedUrls,function(e){if(n.href=e,a.protocol===n.protocol&&a.host===n.host&&0===a.pathname.indexOf(n.pathname.replace(/\/$/,"")))return i=t.href,!0}))}),i)}),o.bind("ready",o.ready),o.deferred.active.done(_.bind(o.keepPreviewAlive,o)),o.bind("synced",function(){o.send("active")}),o.previewUrl.bind(o.refresh),o.scroll=0,o.bind("scroll",function(e){o.scroll=e}),o.bind("url",function(e){var t,n=!1;o.scroll=0,o.previewUrl.bind(t=function(){n=!0}),o.previewUrl.set(e),o.previewUrl.unbind(t),n||o.refresh()}),o.bind("documentTitle",function(e){Y.setDocumentTitle(e)})},ready:function(e){var t=this,n={};n.settings=Y.get(),n["settings-modified-while-loading"]=t.settingsModifiedWhileLoading,"resolved"===t.deferred.active.state()&&!t.loading||(n.scroll=t.scroll),n["edit-shortcut-visibility"]=Y.state("editShortcutVisibility").get(),t.send("sync",n),e.currentUrl&&(t.previewUrl.unbind(t.refresh),t.previewUrl.set(e.currentUrl),t.previewUrl.bind(t.refresh)),n={panel:e.activePanels,section:e.activeSections,control:e.activeControls},_(n).each(function(n,i){Y[i].each(function(e,t){_.isUndefined(Y.settings[i+"s"][t])&&_.isUndefined(n[t])||(n[t]?e.activate():e.deactivate())})}),e.settingValidities&&Y._handleSettingValidities({settingValidities:e.settingValidities,focusInvalidControl:!1})},keepPreviewAlive:function(){var e,t=function(){e=setTimeout(i,Y.settings.timeouts.keepAliveCheck)},n=function(){Y.state("previewerAlive").set(!0),clearTimeout(e),t()},i=function(){Y.state("previewerAlive").set(!1)};t(),this.bind("ready",n),this.bind("keep-alive",n)},query:function(){},abort:function(){this.loading&&(this.loading.destroy(),delete this.loading)},refresh:function(){var e,i=this;i.send("loading-initiated"),i.abort(),i.loading=new Y.PreviewFrame({url:i.url(),previewUrl:i.previewUrl(),query:i.query({excludeCustomizedSaved:!0})||{},container:i.container}),i.settingsModifiedWhileLoading={},Y.bind("change",e=function(e){i.settingsModifiedWhileLoading[e.id]=!0}),i.loading.always(function(){Y.unbind("change",e)}),i.loading.done(function(e){var t,n=this;i.preview=n,i.targetWindow(n.targetWindow()),i.channel(n.channel()),t=function(){n.unbind("synced",t),i._previousPreview&&i._previousPreview.destroy(),i._previousPreview=i.preview,i.deferred.active.resolve(),delete i.loading},n.bind("synced",t),i.trigger("ready",e)}),i.loading.fail(function(e){i.send("loading-failed"),"logged out"===e&&(i.preview&&(i.preview.destroy(),delete i.preview),i.login().done(i.refresh)),"cheatin"===e&&i.cheatin()})},login:function(){var t,n,i,a=this;return this._login||(t=J.Deferred(),this._login=t.promise(),n=new Y.Messenger({channel:"login",url:Y.settings.url.login}),i=J("<iframe />",{src:Y.settings.url.login,title:Y.l10n.loginIframeTitle}).appendTo(this.container),n.targetWindow(i[0].contentWindow),n.bind("login",function(){var e=a.refreshNonces();e.always(function(){i.remove(),n.destroy(),delete a._login}),e.done(function(){t.resolve()}),e.fail(function(){a.cheatin(),t.reject()})})),this._login},cheatin:function(){J(document.body).empty().addClass("cheatin").append("<h1>"+Y.l10n.notAllowedHeading+"</h1><p>"+Y.l10n.notAllowed+"</p>")},refreshNonces:function(){var e,t=J.Deferred();return t.promise(),(e=wp.ajax.post("customize_refresh_nonces",{wp_customize:"on",customize_theme:Y.settings.theme.stylesheet})).done(function(e){Y.trigger("nonce-refresh",e),t.resolve()}),e.fail(function(){t.reject()}),t}}),Y.settingConstructor={},Y.controlConstructor={color:Y.ColorControl,media:Y.MediaControl,upload:Y.UploadControl,image:Y.ImageControl,cropped_image:Y.CroppedImageControl,site_icon:Y.SiteIconControl,header:Y.HeaderControl,background:Y.BackgroundControl,background_position:Y.BackgroundPositionControl,theme:Y.ThemeControl,date_time:Y.DateTimeControl,code_editor:Y.CodeEditorControl},Y.panelConstructor={themes:Y.ThemesPanel},Y.sectionConstructor={themes:Y.ThemesSection,outer:Y.OuterSection},Y._handleSettingValidities=function(e){var o=[],n=!1;_.each(e.settingValidities,function(t,e){var a=Y(e);a&&(_.isObject(t)&&_.each(t,function(e,t){var n=!1,e=new Y.Notification(t,_.extend({fromServer:!0},e)),i=a.notifications(e.code);(n=i?e.type!==i.type||e.message!==i.message||!_.isEqual(e.data,i.data):n)&&a.notifications.remove(t),a.notifications.has(e.code)||a.notifications.add(e),o.push(a.id)}),a.notifications.each(function(e){!e.fromServer||"error"!==e.type||!0!==t&&t[e.code]||a.notifications.remove(e.code)}))}),e.focusInvalidControl&&(e=Y.findControlsForSettings(o),_(_.values(e)).find(function(e){return _(e).find(function(e){var t=e.section()&&Y.section.has(e.section())&&Y.section(e.section()).expanded();return(t=t&&e.expanded?e.expanded():t)&&(e.focus(),n=!0),n})}),n||_.isEmpty(e)||_.values(e)[0][0].focus())},Y.findControlsForSettings=function(e){var n,i={};return _.each(_.unique(e),function(e){var t=Y(e);t&&(n=t.findControls())&&0<n.length&&(i[e]=n)}),i},Y.reflowPaneContents=_.bind(function(){var i,e,t,a=[],o=!1;document.activeElement&&(e=J(document.activeElement)),Y.panel.each(function(e){var t,n;"themes"===e.id||(t=e.sections(),n=_.pluck(t,"headContainer"),a.push(e),i=e.contentContainer.is("ul")?e.contentContainer:e.contentContainer.find("ul:first"),Y.utils.areElementListsEqual(n,i.children("[id]")))||(_(t).each(function(e){i.append(e.headContainer)}),o=!0)}),Y.section.each(function(e){var t=e.controls(),n=_.pluck(t,"container");e.panel()||a.push(e),i=e.contentContainer.is("ul")?e.contentContainer:e.contentContainer.find("ul:first"),Y.utils.areElementListsEqual(n,i.children("[id]"))||(_(t).each(function(e){i.append(e.container)}),o=!0)}),a.sort(Y.utils.prioritySort),t=_.pluck(a,"headContainer"),i=J("#customize-theme-controls .customize-pane-parent"),Y.utils.areElementListsEqual(t,i.children())||(_(a).each(function(e){i.append(e.headContainer)}),o=!0),Y.panel.each(function(e){var t=e.active();e.active.callbacks.fireWith(e.active,[t,t])}),Y.section.each(function(e){var t=e.active();e.active.callbacks.fireWith(e.active,[t,t])}),o&&e&&e.trigger("focus"),Y.trigger("pane-contents-reflowed")},Y),Y.state=new Y.Values,_.each(["saved","saving","trashing","activated","processing","paneVisible","expandedPanel","expandedSection","changesetDate","selectedChangesetDate","changesetStatus","selectedChangesetStatus","remainingTimeToPublish","previewerAlive","editShortcutVisibility","changesetLocked","previewedDevice"],function(e){Y.state.create(e)}),J(function(){var h,o,t,n,i,d,u,p,a,s,r,c,l,f,m,H,L,g,v,w,b,M,O,C,j,y,e,x,k,z,S,T,E,R,B,W,D,N,P,I,U,A;function F(e){e&&e.lockUser&&(Y.settings.changeset.lockUser=e.lockUser),Y.state("changesetLocked").set(!0),Y.notifications.add(new j("changeset_locked",{lockUser:Y.settings.changeset.lockUser,allowOverride:Boolean(e&&e.allowOverride)}))}function q(){var e,t=document.createElement("a");return t.href=location.href,e=Y.utils.parseQueryString(t.search.substr(1)),Y.settings.changeset.latestAutoDraftUuid?e.changeset_uuid=Y.settings.changeset.latestAutoDraftUuid:e.customize_autosaved="on",e.return=Y.settings.url.return,t.search=J.param(e),t.href}function Q(){T||(wp.ajax.post("customize_dismiss_autosave_or_lock",{wp_customize:"on",customize_theme:Y.settings.theme.stylesheet,customize_changeset_uuid:Y.settings.changeset.uuid,nonce:Y.settings.nonce.dismiss_autosave_or_lock,dismiss_autosave:!0}),T=!0)}function K(){var e;return Y.state("activated").get()?(""!==(e=Y.state("changesetStatus").get())&&"auto-draft"!==e||(e="publish"),Y.state("selectedChangesetStatus").get()===e&&("future"!==Y.state("selectedChangesetStatus").get()||Y.state("selectedChangesetDate").get()===Y.state("changesetDate").get())&&Y.state("saved").get()&&"auto-draft"!==Y.state("changesetStatus").get()):0===Y._latestRevision}function V(){Y.unbind("change",V),Y.state("selectedChangesetStatus").unbind(V),Y.state("selectedChangesetDate").unbind(V),J(window).on("beforeunload.customize-confirm",function(){if(!K()&&!Y.state("changesetLocked").get())return setTimeout(function(){t.removeClass("customize-loading")},1),Y.l10n.saveAlert})}function $(){var e=J.Deferred(),t=!1,n=!1;return K()?n=!0:confirm(Y.l10n.saveAlert)?(n=!0,Y.each(function(e){e._dirty=!1}),J(document).off("visibilitychange.wp-customize-changeset-update"),J(window).off("beforeunload.wp-customize-changeset-update"),i.css("cursor","progress"),""!==Y.state("changesetStatus").get()&&(t=!0)):e.reject(),(n||t)&&wp.ajax.send("customize_dismiss_autosave_or_lock",{timeout:500,data:{wp_customize:"on",customize_theme:Y.settings.theme.stylesheet,customize_changeset_uuid:Y.settings.changeset.uuid,nonce:Y.settings.nonce.dismiss_autosave_or_lock,dismiss_autosave:t,dismiss_lock:n}}).always(function(){e.resolve()}),e.promise()}Y.settings=window._wpCustomizeSettings,Y.l10n=window._wpCustomizeControlsL10n,Y.settings&&J.support.postMessage&&(J.support.cors||!Y.settings.isCrossDomain)&&(null===Y.PreviewFrame.prototype.sensitivity&&(Y.PreviewFrame.prototype.sensitivity=Y.settings.timeouts.previewFrameSensitivity),null===Y.Previewer.prototype.refreshBuffer&&(Y.Previewer.prototype.refreshBuffer=Y.settings.timeouts.windowRefresh),o=J(document.body),t=o.children(".wp-full-overlay"),n=J("#customize-info .panel-title.site-title"),i=J(".customize-controls-close"),d=J("#save"),u=J("#customize-save-button-wrapper"),p=J("#publish-settings"),a=J("#customize-footer-actions"),Y.bind("ready",function(){Y.section.add(new Y.OuterSection("publish_settings",{title:Y.l10n.publishSettings,priority:0,active:Y.settings.theme.active}))}),Y.section("publish_settings",function(t){var e,n,i,a,o,s,r;function c(){r=r||Y.utils.highlightButton(u,{delay:1e3,focusTarget:d})}function l(){r&&(r(),r=null)}e=new Y.Control("trash_changeset",{type:"button",section:t.id,priority:30,input_attrs:{class:"button-link button-link-delete",value:Y.l10n.discardChanges}}),Y.control.add(e),e.deferred.embedded.done(function(){e.container.find(".button-link").on("click",function(){confirm(Y.l10n.trashConfirm)&&wp.customize.previewer.trash()})}),Y.control.add(new Y.PreviewLinkControl("changeset_preview_link",{section:t.id,priority:100})),t.active.validate=n=function(){return!!Y.state("activated").get()&&!(Y.state("trashing").get()||"trash"===Y.state("changesetStatus").get()||""===Y.state("changesetStatus").get()&&Y.state("saved").get())},s=function(){t.active.set(n())},Y.state("activated").bind(s),Y.state("trashing").bind(s),Y.state("saved").bind(s),Y.state("changesetStatus").bind(s),s(),(s=function(){p.toggle(t.active.get()),d.toggleClass("has-next-sibling",t.active.get())})(),t.active.bind(s),Y.state("selectedChangesetStatus").bind(l),t.contentContainer.find(".customize-action").text(Y.l10n.updating),t.contentContainer.find(".customize-section-back").removeAttr("tabindex"),p.prop("disabled",!1),p.on("click",function(e){e.preventDefault(),t.expanded.set(!t.expanded.get())}),t.expanded.bind(function(e){p.attr("aria-expanded",String(e)),p.toggleClass("active",e),e?l():(""!==(e=Y.state("changesetStatus").get())&&"auto-draft"!==e||(e="publish"),(Y.state("selectedChangesetStatus").get()!==e||"future"===Y.state("selectedChangesetStatus").get()&&Y.state("selectedChangesetDate").get()!==Y.state("changesetDate").get())&&c())}),s=new Y.Control("changeset_status",{priority:10,type:"radio",section:"publish_settings",setting:Y.state("selectedChangesetStatus"),templateId:"customize-selected-changeset-status-control",label:Y.l10n.action,choices:Y.settings.changeset.statusChoices}),Y.control.add(s),(i=new Y.DateTimeControl("changeset_scheduled_date",{priority:20,section:"publish_settings",setting:Y.state("selectedChangesetDate"),minYear:(new Date).getFullYear(),allowPastDate:!1,includeTime:!0,twelveHourFormat:/a/i.test(Y.settings.timeFormat),description:Y.l10n.scheduleDescription})).notifications.alt=!0,Y.control.add(i),a=function(){Y.state("selectedChangesetStatus").set("publish"),Y.previewer.save()},s=function(){var e="future"===Y.state("changesetStatus").get()&&"future"===Y.state("selectedChangesetStatus").get()&&Y.state("changesetDate").get()&&Y.state("selectedChangesetDate").get()===Y.state("changesetDate").get()&&0<=Y.utils.getRemainingTime(Y.state("changesetDate").get());e&&!o?o=setInterval(function(){var e=Y.utils.getRemainingTime(Y.state("changesetDate").get());Y.state("remainingTimeToPublish").set(e),e<=0&&(clearInterval(o),o=0,a())},1e3):!e&&o&&(clearInterval(o),o=0)},Y.state("changesetDate").bind(s),Y.state("selectedChangesetDate").bind(s),Y.state("changesetStatus").bind(s),Y.state("selectedChangesetStatus").bind(s),s(),i.active.validate=function(){return"future"===Y.state("selectedChangesetStatus").get()},(s=function(e){i.active.set("future"===e)})(Y.state("selectedChangesetStatus").get()),Y.state("selectedChangesetStatus").bind(s),Y.state("saving").bind(function(e){e&&"future"===Y.state("selectedChangesetStatus").get()&&i.toggleFutureDateNotification(!i.isFutureDate())})}),J("#customize-controls").on("keydown",function(e){var t=13===e.which,n=J(e.target);t&&(n.is("input:not([type=button])")||n.is("select"))&&e.preventDefault()}),J(".customize-info").find("> .accordion-section-title .customize-help-toggle").on("click",function(){var e=J(this).closest(".accordion-section"),t=e.find(".customize-panel-description:first");e.hasClass("cannot-expand")||(e.hasClass("open")?(e.toggleClass("open"),t.slideUp(Y.Panel.prototype.defaultExpandedArguments.duration,function(){t.trigger("toggled")}),J(this).attr("aria-expanded",!1)):(t.slideDown(Y.Panel.prototype.defaultExpandedArguments.duration,function(){t.trigger("toggled")}),e.toggleClass("open"),J(this).attr("aria-expanded",!0)))}),Y.previewer=new Y.Previewer({container:"#customize-preview",form:"#customize-controls",previewUrl:Y.settings.url.preview,allowedUrls:Y.settings.url.allowed},{nonce:Y.settings.nonce,query:function(e){var t={wp_customize:"on",customize_theme:Y.settings.theme.stylesheet,nonce:this.nonce.preview,customize_changeset_uuid:Y.settings.changeset.uuid};return!Y.settings.changeset.autosaved&&Y.state("saved").get()||(t.customize_autosaved="on"),t.customized=JSON.stringify(Y.dirtyValues({unsaved:e&&e.excludeCustomizedSaved})),t},save:function(i){var e,t,a=this,o=J.Deferred(),s=Y.state("selectedChangesetStatus").get(),r=Y.state("selectedChangesetDate").get(),n=Y.state("processing"),c={},l=[],d=[],u=[];function p(e){c[e.id]=!0}return i&&i.status&&(s=i.status),Y.state("saving").get()&&(o.reject("already_saving"),o.promise()),Y.state("saving").set(!0),t=function(){var n={},t=Y._latestRevision,e="client_side_error";if(Y.bind("change",p),Y.notifications.remove(e),Y.each(function(t){t.notifications.each(function(e){"error"!==e.type||e.fromServer||(l.push(t.id),n[t.id]||(n[t.id]={}),n[t.id][e.code]=e)})}),Y.control.each(function(t){t.setting&&(t.setting.id||!t.active.get())||t.notifications.each(function(e){"error"===e.type&&u.push([t])})}),d=_.union(u,_.values(Y.findControlsForSettings(l))),!_.isEmpty(d))return d[0][0].focus(),Y.unbind("change",p),l.length&&Y.notifications.add(new Y.Notification(e,{message:(1===l.length?Y.l10n.saveBlockedError.singular:Y.l10n.saveBlockedError.plural).replace(/%s/g,String(l.length)),type:"error",dismissible:!0,saveFailure:!0})),o.rejectWith(a,[{setting_invalidities:n}]),Y.state("saving").set(!1),o.promise();e=J.extend(a.query({excludeCustomizedSaved:!1}),{nonce:a.nonce.save,customize_changeset_status:s}),i&&i.date?e.customize_changeset_date=i.date:"future"===s&&r&&(e.customize_changeset_date=r),i&&i.title&&(e.customize_changeset_title=i.title),Y.trigger("save-request-params",e),e=wp.ajax.post("customize_save",e),Y.state("processing").set(Y.state("processing").get()+1),Y.trigger("save",e),e.always(function(){Y.state("processing").set(Y.state("processing").get()-1),Y.state("saving").set(!1),Y.unbind("change",p)}),Y.notifications.each(function(e){e.saveFailure&&Y.notifications.remove(e.code)}),e.fail(function(e){var t,n={type:"error",dismissible:!0,fromServer:!0,saveFailure:!0};"0"===e?e="not_logged_in":"-1"===e&&(e="invalid_nonce"),"invalid_nonce"===e?a.cheatin():"not_logged_in"===e?(a.preview.iframe.hide(),a.login().done(function(){a.save(),a.preview.iframe.show()})):e.code?"not_future_date"===e.code&&Y.section.has("publish_settings")&&Y.section("publish_settings").active.get()&&Y.control.has("changeset_scheduled_date")?Y.control("changeset_scheduled_date").toggleFutureDateNotification(!0).focus():"changeset_locked"!==e.code&&(t=new Y.Notification(e.code,_.extend(n,{message:e.message}))):t=new Y.Notification("unknown_error",_.extend(n,{message:Y.l10n.unknownRequestFail})),t&&Y.notifications.add(t),e.setting_validities&&Y._handleSettingValidities({settingValidities:e.setting_validities,focusInvalidControl:!0}),o.rejectWith(a,[e]),Y.trigger("error",e),"changeset_already_published"===e.code&&e.next_changeset_uuid&&(Y.settings.changeset.uuid=e.next_changeset_uuid,Y.state("changesetStatus").set(""),Y.settings.changeset.branching&&h.send("changeset-uuid",Y.settings.changeset.uuid),Y.previewer.send("changeset-uuid",Y.settings.changeset.uuid))}),e.done(function(e){a.send("saved",e),Y.state("changesetStatus").set(e.changeset_status),e.changeset_date&&Y.state("changesetDate").set(e.changeset_date),"publish"===e.changeset_status&&(Y.each(function(e){e._dirty&&(_.isUndefined(Y._latestSettingRevisions[e.id])||Y._latestSettingRevisions[e.id]<=t)&&(e._dirty=!1)}),Y.state("changesetStatus").set(""),Y.settings.changeset.uuid=e.next_changeset_uuid,Y.settings.changeset.branching)&&h.send("changeset-uuid",Y.settings.changeset.uuid),Y._lastSavedRevision=Math.max(t,Y._lastSavedRevision),e.setting_validities&&Y._handleSettingValidities({settingValidities:e.setting_validities,focusInvalidControl:!0}),o.resolveWith(a,[e]),Y.trigger("saved",e),_.isEmpty(c)||Y.state("saved").set(!1)})},0===n()?t():(e=function(){0===n()&&(Y.state.unbind("change",e),t())},Y.state.bind("change",e)),o.promise()},trash:function(){var e,n,i;Y.state("trashing").set(!0),Y.state("processing").set(Y.state("processing").get()+1),e=wp.ajax.post("customize_trash",{customize_changeset_uuid:Y.settings.changeset.uuid,nonce:Y.settings.nonce.trash}),Y.notifications.add(new Y.OverlayNotification("changeset_trashing",{type:"info",message:Y.l10n.revertingChanges,loading:!0})),n=function(){var e,t=document.createElement("a");Y.state("changesetStatus").set("trash"),Y.each(function(e){e._dirty=!1}),Y.state("saved").set(!0),t.href=location.href,delete(e=Y.utils.parseQueryString(t.search.substr(1))).changeset_uuid,e.return=Y.settings.url.return,t.search=J.param(e),location.replace(t.href)},i=function(e,t){e=e||"unknown_error";Y.state("processing").set(Y.state("processing").get()-1),Y.state("trashing").set(!1),Y.notifications.remove("changeset_trashing"),Y.notifications.add(new Y.Notification(e,{message:t||Y.l10n.unknownError,dismissible:!0,type:"error"}))},e.done(function(e){n(e.message)}),e.fail(function(e){var t=e.code||"trashing_failed";e.success||"non_existent_changeset"===t||"changeset_already_trashed"===t?n(e.message):i(t,e.message)})},getFrontendPreviewUrl:function(){var e,t=document.createElement("a");return t.href=this.previewUrl.get(),e=Y.utils.parseQueryString(t.search.substr(1)),Y.state("changesetStatus").get()&&"publish"!==Y.state("changesetStatus").get()&&(e.customize_changeset_uuid=Y.settings.changeset.uuid),Y.state("activated").get()||(e.customize_theme=Y.settings.theme.stylesheet),t.search=J.param(e),t.href}}),J.ajaxPrefilter(function(e){/wp_customize=on/.test(e.data)&&(e.data+="&"+J.param({customize_preview_nonce:Y.settings.nonce.preview}))}),Y.previewer.bind("nonce",function(e){J.extend(this.nonce,e)}),Y.bind("nonce-refresh",function(e){J.extend(Y.settings.nonce,e),J.extend(Y.previewer.nonce,e),Y.previewer.send("nonce-refresh",e)}),J.each(Y.settings.settings,function(e,t){var n=Y.settingConstructor[t.type]||Y.Setting;Y.add(new n(e,t.value,{transport:t.transport,previewer:Y.previewer,dirty:!!t.dirty}))}),J.each(Y.settings.panels,function(e,t){var n=Y.panelConstructor[t.type]||Y.Panel,t=_.extend({params:t},t);Y.panel.add(new n(e,t))}),J.each(Y.settings.sections,function(e,t){var n=Y.sectionConstructor[t.type]||Y.Section,t=_.extend({params:t},t);Y.section.add(new n(e,t))}),J.each(Y.settings.controls,function(e,t){var n=Y.controlConstructor[t.type]||Y.Control,t=_.extend({params:t},t);Y.control.add(new n(e,t))}),_.each(["panel","section","control"],function(e){var t=Y.settings.autofocus[e];t&&Y[e](t,function(e){e.deferred.embedded.done(function(){Y.previewer.deferred.active.done(function(){e.focus()})})})}),Y.bind("ready",Y.reflowPaneContents),J([Y.panel,Y.section,Y.control]).each(function(e,t){var n=_.debounce(Y.reflowPaneContents,Y.settings.timeouts.reflowPaneContents);t.bind("add",n),t.bind("change",n),t.bind("remove",n)}),Y.bind("ready",function(){var e,t,n;Y.notifications.container=J("#customize-notifications-area"),Y.notifications.bind("change",_.debounce(function(){Y.notifications.render()})),e=J(".wp-full-overlay-sidebar-content"),Y.notifications.bind("rendered",function(){e.css("top",""),0!==Y.notifications.count()&&(t=Y.notifications.container.outerHeight()+1,n=parseInt(e.css("top"),10),e.css("top",n+t+"px")),Y.notifications.trigger("sidebarTopUpdated")}),Y.notifications.render()}),s=Y.state,c=s.instance("saved"),l=s.instance("saving"),f=s.instance("trashing"),m=s.instance("activated"),e=s.instance("processing"),I=s.instance("paneVisible"),H=s.instance("expandedPanel"),L=s.instance("expandedSection"),g=s.instance("changesetStatus"),v=s.instance("selectedChangesetStatus"),w=s.instance("changesetDate"),b=s.instance("selectedChangesetDate"),M=s.instance("previewerAlive"),O=s.instance("editShortcutVisibility"),C=s.instance("changesetLocked"),s.bind("change",function(){var e;m()?""===g.get()&&c()?(Y.settings.changeset.currentUserCanPublish?d.val(Y.l10n.published):d.val(Y.l10n.saved),i.find(".screen-reader-text").text(Y.l10n.close)):("draft"===v()?c()&&v()===g()?d.val(Y.l10n.draftSaved):d.val(Y.l10n.saveDraft):"future"===v()?!c()||v()!==g()||w.get()!==b.get()?d.val(Y.l10n.schedule):d.val(Y.l10n.scheduled):Y.settings.changeset.currentUserCanPublish&&d.val(Y.l10n.publish),i.find(".screen-reader-text").text(Y.l10n.cancel)):(d.val(Y.l10n.activate),i.find(".screen-reader-text").text(Y.l10n.cancel)),e=!l()&&!f()&&!C()&&(!m()||!c()||g()!==v()&&""!==g()||"future"===v()&&w.get()!==b.get()),d.prop("disabled",!e)}),v.validate=function(e){return""===e||"auto-draft"===e?null:e},S=Y.settings.changeset.currentUserCanPublish?"publish":"draft",g(Y.settings.changeset.status),C(Boolean(Y.settings.changeset.lockUser)),w(Y.settings.changeset.publishDate),b(Y.settings.changeset.publishDate),v(""===Y.settings.changeset.status||"auto-draft"===Y.settings.changeset.status?S:Y.settings.changeset.status),v.link(g),c(!0),""===g()&&Y.each(function(e){e._dirty&&c(!1)}),l(!1),m(Y.settings.theme.active),e(0),I(!0),H(!1),L(!1),M(!0),O("visible"),Y.bind("change",function(){s("saved").get()&&s("saved").set(!1)}),Y.settings.changeset.branching&&c.bind(function(e){e||r(!0)}),l.bind(function(e){o.toggleClass("saving",e)}),f.bind(function(e){o.toggleClass("trashing",e)}),Y.bind("saved",function(e){s("saved").set(!0),"publish"===e.changeset_status&&s("activated").set(!0)}),m.bind(function(e){e&&Y.trigger("activated")}),r=function(e){var t,n;if(history.replaceState){if((t=document.createElement("a")).href=location.href,n=Y.utils.parseQueryString(t.search.substr(1)),e){if(n.changeset_uuid===Y.settings.changeset.uuid)return;n.changeset_uuid=Y.settings.changeset.uuid}else{if(!n.changeset_uuid)return;delete n.changeset_uuid}t.search=J.param(n),history.replaceState({},document.title,t.href)}},Y.settings.changeset.branching&&g.bind(function(e){r(""!==e&&"publish"!==e&&"trash"!==e)}),j=Y.OverlayNotification.extend({templateId:"customize-changeset-locked-notification",lockUser:null,initialize:function(e,t){e=e||"changeset_locked",t=_.extend({message:"",type:"warning",containerClasses:"",lockUser:{}},t);t.containerClasses+=" notification-changeset-locked",Y.OverlayNotification.prototype.initialize.call(this,e,t)},render:function(){var t,n,i=this,e=_.extend({allowOverride:!1,returnUrl:Y.settings.url.return,previewUrl:Y.previewer.previewUrl.get(),frontendPreviewUrl:Y.previewer.getFrontendPreviewUrl()},this),a=Y.OverlayNotification.prototype.render.call(e);return Y.requestChangesetUpdate({},{autosave:!0}).fail(function(e){e.autosaved||a.find(".notice-error").prop("hidden",!1).text(e.message||Y.l10n.unknownRequestFail)}),(t=a.find(".customize-notice-take-over-button")).on("click",function(e){e.preventDefault(),n||(t.addClass("disabled"),(n=wp.ajax.post("customize_override_changeset_lock",{wp_customize:"on",customize_theme:Y.settings.theme.stylesheet,customize_changeset_uuid:Y.settings.changeset.uuid,nonce:Y.settings.nonce.override_lock})).done(function(){Y.notifications.remove(i.code),Y.state("changesetLocked").set(!1)}),n.fail(function(e){e=e.message||Y.l10n.unknownRequestFail;a.find(".notice-error").prop("hidden",!1).text(e),n.always(function(){t.removeClass("disabled")})}),n.always(function(){n=null}))}),a}}),Y.settings.changeset.lockUser&&F({allowOverride:!0}),J(document).on("heartbeat-send.update_lock_notice",function(e,t){t.check_changeset_lock=!0,t.changeset_uuid=Y.settings.changeset.uuid}),J(document).on("heartbeat-tick.update_lock_notice",function(e,t){var n,i="changeset_locked";t.customize_changeset_lock_user&&((n=Y.notifications(i))&&n.lockUser.id!==Y.settings.changeset.lockUser.id&&Y.notifications.remove(i),F({lockUser:t.customize_changeset_lock_user}))}),Y.bind("error",function(e){"changeset_locked"===e.code&&e.lock_user&&F({lockUser:e.lock_user})}),T=!(S=[]),Y.settings.changeset.autosaved&&(Y.state("saved").set(!1),S.push("customize_autosaved")),Y.settings.changeset.branching||Y.settings.changeset.status&&"auto-draft"!==Y.settings.changeset.status||S.push("changeset_uuid"),0<S.length&&(S=S,e=document.createElement("a"),x=0,e.href=location.href,y=Y.utils.parseQueryString(e.search.substr(1)),_.each(S,function(e){void 0!==y[e]&&(x+=1,delete y[e])}),0!==x)&&(e.search=J.param(y),history.replaceState({},document.title,e.href)),(Y.settings.changeset.latestAutoDraftUuid||Y.settings.changeset.hasAutosaveRevision)&&(z="autosave_available",Y.notifications.add(new Y.Notification(z,{message:Y.l10n.autosaveNotice,type:"warning",dismissible:!0,render:function(){var e=Y.Notification.prototype.render.call(this),t=e.find("a");return t.prop("href",q()),t.on("click",function(e){e.preventDefault(),location.replace(q())}),e.find(".notice-dismiss").on("click",Q),e}})),Y.bind("change",k=function(){Q(),Y.notifications.remove(z),Y.unbind("change",k),Y.state("changesetStatus").unbind(k)}),Y.state("changesetStatus").bind(k)),parseInt(J("#customize-info").data("block-theme"),10)&&(S=Y.l10n.blockThemeNotification,Y.notifications.add(new Y.Notification("site_editor_block_theme_notice",{message:S,type:"info",dismissible:!1,render:function(){var e=Y.Notification.prototype.render.call(this),t=e.find("button.switch-to-editor");return t.on("click",function(e){e.preventDefault(),location.assign(t.data("action"))}),e}}))),Y.previewer.previewUrl()?Y.previewer.refresh():Y.previewer.previewUrl(Y.settings.url.home),d.on("click",function(e){Y.previewer.save(),e.preventDefault()}).on("keydown",function(e){9!==e.which&&(13===e.which&&Y.previewer.save(),e.preventDefault())}),i.on("keydown",function(e){9!==e.which&&(13===e.which&&this.click(),e.preventDefault())}),J(".collapse-sidebar").on("click",function(){Y.state("paneVisible").set(!Y.state("paneVisible").get())}),Y.state("paneVisible").bind(function(e){t.toggleClass("preview-only",!e),t.toggleClass("expanded",e),t.toggleClass("collapsed",!e),e?J(".collapse-sidebar").attr({"aria-expanded":"true","aria-label":Y.l10n.collapseSidebar}):J(".collapse-sidebar").attr({"aria-expanded":"false","aria-label":Y.l10n.expandSidebar})}),o.on("keydown",function(e){var t,n=[],i=[],a=[];27===e.which&&(J(e.target).is("body")||J.contains(J("#customize-controls")[0],e.target))&&null===e.target.closest(".block-editor-writing-flow")&&null===e.target.closest(".block-editor-block-list__block-popover")&&(Y.control.each(function(e){e.expanded&&e.expanded()&&_.isFunction(e.collapse)&&n.push(e)}),Y.section.each(function(e){e.expanded()&&i.push(e)}),Y.panel.each(function(e){e.expanded()&&a.push(e)}),0<n.length&&0===i.length&&(n.length=0),t=n[0]||i[0]||a[0])&&("themes"===t.params.type?o.hasClass("modal-open")?t.closeDetails():Y.panel.has("themes")&&Y.panel("themes").collapse():(t.collapse(),e.preventDefault()))}),J(".customize-controls-preview-toggle").on("click",function(){Y.state("paneVisible").set(!Y.state("paneVisible").get())}),P=J(".wp-full-overlay-sidebar-content"),I=function(e){var t=Y.state("expandedSection").get(),n=Y.state("expandedPanel").get();if(D&&D.element&&(R(D.element),D.element.find(".description").off("toggled",E)),!e)if(!t&&n&&n.contentContainer)e=n;else{if(n||!t||!t.contentContainer)return void(D=!1);e=t}(n=e.contentContainer.find(".customize-section-title, .panel-meta").first()).length?((D={instance:e,element:n,parent:n.closest(".customize-pane-child"),height:n.outerHeight()}).element.find(".description").on("toggled",E),t&&B(D.element,D.parent)):D=!1},Y.state("expandedSection").bind(I),Y.state("expandedPanel").bind(I),P.on("scroll",_.throttle(function(){var e,t;D&&(e=P.scrollTop(),t=N?e===N?0:N<e?1:-1:1,N=e,0!==t)&&W(D,e,t)},8)),Y.notifications.bind("sidebarTopUpdated",function(){D&&D.element.hasClass("is-sticky")&&D.element.css("top",P.css("top"))}),R=function(e){e.hasClass("is-sticky")&&e.removeClass("is-sticky").addClass("maybe-sticky is-in-view").css("top",P.scrollTop()+"px")},B=function(e,t){e.hasClass("is-in-view")&&(e.removeClass("maybe-sticky is-in-view").css({width:"",top:""}),t.css("padding-top",""))},E=function(){D.height=D.element.outerHeight()},W=function(e,t,n){var i=e.element,a=e.parent,e=e.height,o=parseInt(i.css("top"),10),s=i.hasClass("maybe-sticky"),r=i.hasClass("is-sticky"),c=i.hasClass("is-in-view");if(-1===n){if(!s&&e<=t)s=!0,i.addClass("maybe-sticky");else if(0===t)return i.removeClass("maybe-sticky is-in-view is-sticky").css({top:"",width:""}),void a.css("padding-top","");c&&!r?t<=o&&i.addClass("is-sticky").css({top:P.css("top"),width:a.outerWidth()+"px"}):s&&!c&&(i.addClass("is-in-view").css("top",t-e+"px"),a.css("padding-top",e+"px"))}else r&&(o=t,i.removeClass("is-sticky").css({top:o+"px",width:""})),c&&o+e<t&&(i.removeClass("is-in-view"),a.css("padding-top",""))},Y.previewedDevice=Y.state("previewedDevice"),Y.bind("ready",function(){_.find(Y.settings.previewableDevices,function(e,t){if(!0===e.default)return Y.previewedDevice.set(t),!0})}),a.find(".devices button").on("click",function(e){Y.previewedDevice.set(J(e.currentTarget).data("device"))}),Y.previewedDevice.bind(function(e){var t=J(".wp-full-overlay"),n="";a.find(".devices button").removeClass("active").attr("aria-pressed",!1),a.find(".devices .preview-"+e).addClass("active").attr("aria-pressed",!0),J.each(Y.settings.previewableDevices,function(e){n+=" preview-"+e}),t.removeClass(n).addClass("preview-"+e)}),n.length&&Y("blogname",function(t){function e(){var e=t()||"";n.text(e.toString().trim()||Y.l10n.untitledBlogName)}t.bind(e),e()}),h=new Y.Messenger({url:Y.settings.url.parent,channel:"loader"}),U=!1,h.bind("back",function(){U=!0}),Y.bind("change",V),Y.state("selectedChangesetStatus").bind(V),Y.state("selectedChangesetDate").bind(V),h.bind("confirm-close",function(){$().done(function(){h.send("confirmed-close",!0)}).fail(function(){h.send("confirmed-close",!1)})}),i.on("click.customize-controls-close",function(e){e.preventDefault(),U?h.send("close"):$().done(function(){J(window).off("beforeunload.customize-confirm"),window.location.href=i.prop("href")})}),J.each(["saved","change"],function(e,t){Y.bind(t,function(){h.send(t)})}),Y.bind("title",function(e){h.send("title",e)}),Y.settings.changeset.branching&&h.send("changeset-uuid",Y.settings.changeset.uuid),h.send("ready"),J.each({background_image:{controls:["background_preset","background_position","background_size","background_repeat","background_attachment"],callback:function(e){return!!e}},show_on_front:{controls:["page_on_front","page_for_posts"],callback:function(e){return"page"===e}},header_textcolor:{controls:["header_textcolor"],callback:function(e){return"blank"!==e}}},function(e,i){Y(e,function(n){J.each(i.controls,function(e,t){Y.control(t,function(t){function e(e){t.container.toggle(i.callback(e))}e(n.get()),n.bind(e)})})})}),Y.control("background_preset",function(e){var i={default:[!1,!1,!1,!1],fill:[!0,!1,!1,!1],fit:[!0,!1,!0,!1],repeat:[!0,!1,!1,!0],custom:[!0,!0,!0,!0]},a={default:[_wpCustomizeBackground.defaults["default-position-x"],_wpCustomizeBackground.defaults["default-position-y"],_wpCustomizeBackground.defaults["default-size"],_wpCustomizeBackground.defaults["default-repeat"],_wpCustomizeBackground.defaults["default-attachment"]],fill:["left","top","cover","no-repeat","fixed"],fit:["left","top","contain","no-repeat","fixed"],repeat:["left","top","auto","repeat","scroll"]},t=function(n){_.each(["background_position","background_size","background_repeat","background_attachment"],function(e,t){e=Y.control(e);e&&e.container.toggle(i[n][t])})},n=function(n){_.each(["background_position_x","background_position_y","background_size","background_repeat","background_attachment"],function(e,t){e=Y(e);e&&e.set(a[n][t])})},o=e.setting.get();t(o),e.setting.bind("change",function(e){t(e),"custom"!==e&&n(e)})}),Y.control("background_repeat",function(t){t.elements[0].unsync(Y("background_repeat")),t.element=new Y.Element(t.container.find("input")),t.element.set("no-repeat"!==t.setting()),t.element.bind(function(e){t.setting.set(e?"repeat":"no-repeat")}),t.setting.bind(function(e){t.element.set("no-repeat"!==e)})}),Y.control("background_attachment",function(t){t.elements[0].unsync(Y("background_attachment")),t.element=new Y.Element(t.container.find("input")),t.element.set("fixed"!==t.setting()),t.element.bind(function(e){t.setting.set(e?"scroll":"fixed")}),t.setting.bind(function(e){t.element.set("fixed"!==e)})}),Y.control("display_header_text",function(t){var n="";t.elements[0].unsync(Y("header_textcolor")),t.element=new Y.Element(t.container.find("input")),t.element.set("blank"!==t.setting()),t.element.bind(function(e){e||(n=Y("header_textcolor").get()),t.setting.set(e?n:"blank")}),t.setting.bind(function(e){t.element.set("blank"!==e)})}),Y("show_on_front","page_on_front","page_for_posts",function(i,a,o){function e(){var e="show_on_front_page_collision",t=parseInt(a(),10),n=parseInt(o(),10);"page"===i()&&(this===a&&0<t&&Y.previewer.previewUrl.set(Y.settings.url.home),this===o)&&0<n&&Y.previewer.previewUrl.set(Y.settings.url.home+"?page_id="+n),"page"===i()&&t&&n&&t===n?i.notifications.add(new Y.Notification(e,{type:"error",message:Y.l10n.pageOnFrontError})):i.notifications.remove(e)}i.bind(e),a.bind(e),o.bind(e),e.call(i,i()),Y.control("show_on_front",function(e){e.deferred.embedded.done(function(){e.container.append(e.getNotificationsContainerElement())})})}),A=J.Deferred(),Y.section("custom_css",function(t){t.deferred.embedded.done(function(){t.expanded()?A.resolve(t):t.expanded.bind(function(e){e&&A.resolve(t)})})}),A.done(function(e){var t=Y.control("custom_css");t.container.find(".customize-control-title:first").addClass("screen-reader-text"),e.container.find(".section-description-buttons .section-description-close").on("click",function(){e.container.find(".section-meta .customize-section-description:first").removeClass("open").slideUp(),e.container.find(".customize-help-toggle").attr("aria-expanded","false").focus()}),t&&!t.setting.get()&&(e.container.find(".section-meta .customize-section-description:first").addClass("open").show().trigger("toggled"),e.container.find(".customize-help-toggle").attr("aria-expanded","true"))}),Y.control("header_video",function(n){n.deferred.embedded.done(function(){function e(){var e=Y.section(n.section()),t="video_header_not_available";e&&(n.active.get()?e.notifications.remove(t):e.notifications.add(new Y.Notification(t,{type:"info",message:Y.l10n.videoHeaderNotice})))}e(),n.active.bind(e)})}),Y.previewer.bind("selective-refresh-setting-validities",function(e){Y._handleSettingValidities({settingValidities:e,focusInvalidControl:!1})}),Y.previewer.bind("focus-control-for-setting",function(n){var i=[];Y.control.each(function(e){var t=_.pluck(e.settings,"id");-1!==_.indexOf(t,n)&&i.push(e)}),i.length&&(i.sort(function(e,t){return e.priority()-t.priority()}),i[0].focus())}),Y.previewer.bind("refresh",function(){Y.previewer.refresh()}),Y.state("paneVisible").bind(function(e){var t=window.matchMedia?window.matchMedia("screen and ( max-width: 640px )").matches:J(window).width()<=640;Y.state("editShortcutVisibility").set(e||t?"visible":"hidden")}),window.matchMedia&&window.matchMedia("screen and ( max-width: 640px )").addListener(function(){var e=Y.state("paneVisible");e.callbacks.fireWith(e,[e.get(),e.get()])}),Y.previewer.bind("edit-shortcut-visibility",function(e){Y.state("editShortcutVisibility").set(e)}),Y.state("editShortcutVisibility").bind(function(e){Y.previewer.send("edit-shortcut-visibility",e)}),Y.bind("change",function e(){var t,n,i,a=!1;function o(e){e||Y.settings.changeset.autosaved||(Y.settings.changeset.autosaved=!0,Y.previewer.send("autosaving"))}Y.unbind("change",e),Y.state("saved").bind(o),o(Y.state("saved").get()),n=function(){a||(a=!0,Y.requestChangesetUpdate({},{autosave:!0}).always(function(){a=!1})),i()},(i=function(){clearTimeout(t),t=setTimeout(function(){n()},Y.settings.timeouts.changesetAutoSave)})(),J(document).on("visibilitychange.wp-customize-changeset-update",function(){document.hidden&&n()}),J(window).on("beforeunload.wp-customize-changeset-update",function(){n()})}),J(document).one("tinymce-editor-setup",function(){window.tinymce.ui.FloatPanel&&(!window.tinymce.ui.FloatPanel.zIndex||window.tinymce.ui.FloatPanel.zIndex<500001)&&(window.tinymce.ui.FloatPanel.zIndex=500001)}),o.addClass("ready"),Y.trigger("ready"))})}((wp,jQuery)); \ No newline at end of file
+!function(J){var a,s,t,e,n,i,Y=wp.customize,o=window.matchMedia("(prefers-reduced-motion: reduce)"),r=o.matches;o.addEventListener("change",function(e){r=e.matches}),Y.OverlayNotification=Y.Notification.extend({loading:!1,initialize:function(e,t){var n=this;Y.Notification.prototype.initialize.call(n,e,t),n.containerClasses+=" notification-overlay",n.loading&&(n.containerClasses+=" notification-loading")},render:function(){var e=Y.Notification.prototype.render.call(this);return e.on("keydown",_.bind(this.handleEscape,this)),e},handleEscape:function(e){var t=this;27===e.which&&(e.stopPropagation(),t.dismissible)&&t.parent&&t.parent.remove(t.code)}}),Y.Notifications=Y.Values.extend({alt:!1,defaultConstructor:Y.Notification,initialize:function(e){var t=this;Y.Values.prototype.initialize.call(t,e),_.bindAll(t,"constrainFocus"),t._addedIncrement=0,t._addedOrder={},t.bind("add",function(e){t.trigger("change",e)}),t.bind("removed",function(e){t.trigger("change",e)})},count:function(){return _.size(this._value)},add:function(e,t){var n,i=this,t="string"==typeof e?(n=e,t):(n=e.code,e);return i.has(n)||(i._addedIncrement+=1,i._addedOrder[n]=i._addedIncrement),Y.Values.prototype.add.call(i,n,t)},remove:function(e){return delete this._addedOrder[e],Y.Values.prototype.remove.call(this,e)},get:function(e){var a,o=this,t=_.values(o._value);return _.extend({sort:!1},e).sort&&(a={error:4,warning:3,success:2,info:1},t.sort(function(e,t){var n=0,i=0;return(n=_.isUndefined(a[e.type])?n:a[e.type])!==(i=_.isUndefined(a[t.type])?i:a[t.type])?i-n:o._addedOrder[t.code]-o._addedOrder[e.code]})),t},render:function(){var e,t,n,i=this,a=!1,o=[],s={};i.container&&i.container.length&&(e=i.get({sort:!0}),i.container.toggle(0!==e.length),i.container.is(i.previousContainer)&&_.isEqual(e,i.previousNotifications)||((n=i.container.children("ul").first()).length||(n=J("<ul></ul>"),i.container.append(n)),n.find("> [data-code]").remove(),_.each(i.previousNotifications,function(e){s[e.code]=e}),_.each(e,function(e){var t;!wp.a11y||s[e.code]&&_.isEqual(e.message,s[e.code].message)||wp.a11y.speak(e.message,"assertive"),t=J(e.render()),e.container=t,n.append(t),e.extended(Y.OverlayNotification)&&o.push(e)}),(t=Boolean(o.length))!==(a=i.previousNotifications?Boolean(_.find(i.previousNotifications,function(e){return e.extended(Y.OverlayNotification)})):a)&&(J(document.body).toggleClass("customize-loading",t),i.container.toggleClass("has-overlay-notifications",t),t?(i.previousActiveElement=document.activeElement,J(document).on("keydown",i.constrainFocus)):J(document).off("keydown",i.constrainFocus)),t?(i.focusContainer=o[o.length-1].container,i.focusContainer.prop("tabIndex",-1),((a=i.focusContainer.find(":focusable")).length?a.first():i.focusContainer).focus()):i.previousActiveElement&&(J(i.previousActiveElement).trigger("focus"),i.previousActiveElement=null),i.previousNotifications=e,i.previousContainer=i.container,i.trigger("rendered")))},constrainFocus:function(e){var t,n=this;e.stopPropagation(),9===e.which&&(0===(t=n.focusContainer.find(":focusable")).length&&(t=n.focusContainer),!J.contains(n.focusContainer[0],e.target)||!J.contains(n.focusContainer[0],document.activeElement)||t.last().is(e.target)&&!e.shiftKey?(e.preventDefault(),t.first().focus()):t.first().is(e.target)&&e.shiftKey&&(e.preventDefault(),t.last().focus()))}}),Y.Setting=Y.Value.extend({defaults:{transport:"refresh",dirty:!1},initialize:function(e,t,n){var i=this,n=_.extend({previewer:Y.previewer},i.defaults,n||{});Y.Value.prototype.initialize.call(i,t,n),i.id=e,i._dirty=n.dirty,i.notifications=new Y.Notifications,i.bind(i.preview)},preview:function(){var e=this,t=e.transport;"postMessage"===(t="postMessage"!==t||Y.state("previewerAlive").get()?t:"refresh")?e.previewer.send("setting",[e.id,e()]):"refresh"===t&&e.previewer.refresh()},findControls:function(){var n=this,i=[];return Y.control.each(function(t){_.each(t.settings,function(e){e.id===n.id&&i.push(t)})}),i}}),Y._latestRevision=0,Y._lastSavedRevision=0,Y._latestSettingRevisions={},Y.bind("change",function(e){Y._latestRevision+=1,Y._latestSettingRevisions[e.id]=Y._latestRevision}),Y.bind("ready",function(){Y.bind("add",function(e){e._dirty&&(Y._latestRevision+=1,Y._latestSettingRevisions[e.id]=Y._latestRevision)})}),Y.dirtyValues=function(n){var i={};return Y.each(function(e){var t;e._dirty&&(t=Y._latestSettingRevisions[e.id],Y.state("changesetStatus").get()&&n&&n.unsaved&&(_.isUndefined(t)||t<=Y._lastSavedRevision)||(i[e.id]=e.get()))}),i},Y.requestChangesetUpdate=function(n,e){var t,i={},a=new J.Deferred;if(0!==Y.state("processing").get())a.reject("already_processing");else if(e=_.extend({title:null,date:null,autosave:!1,force:!1},e),n&&_.extend(i,n),_.each(Y.dirtyValues({unsaved:!0}),function(e,t){n&&null===n[t]||(i[t]=_.extend({},i[t]||{},{value:e}))}),Y.trigger("changeset-save",i,e),!e.force&&_.isEmpty(i)&&null===e.title&&null===e.date)a.resolve({});else{if(e.status)return a.reject({code:"illegal_status_in_changeset_update"}).promise();if(e.date&&e.autosave)return a.reject({code:"illegal_autosave_with_date_gmt"}).promise();Y.state("processing").set(Y.state("processing").get()+1),a.always(function(){Y.state("processing").set(Y.state("processing").get()-1)}),delete(t=Y.previewer.query({excludeCustomizedSaved:!0})).customized,_.extend(t,{nonce:Y.settings.nonce.save,customize_theme:Y.settings.theme.stylesheet,customize_changeset_data:JSON.stringify(i)}),null!==e.title&&(t.customize_changeset_title=e.title),null!==e.date&&(t.customize_changeset_date=e.date),!1!==e.autosave&&(t.customize_changeset_autosave="true"),Y.trigger("save-request-params",t),(e=wp.ajax.post("customize_save",t)).done(function(e){var n={};Y._lastSavedRevision=Math.max(Y._latestRevision,Y._lastSavedRevision),Y.state("changesetStatus").set(e.changeset_status),e.changeset_date&&Y.state("changesetDate").set(e.changeset_date),a.resolve(e),Y.trigger("changeset-saved",e),e.setting_validities&&_.each(e.setting_validities,function(e,t){!0===e&&_.isObject(i[t])&&!_.isUndefined(i[t].value)&&(n[t]=i[t].value)}),Y.previewer.send("changeset-saved",_.extend({},e,{saved_changeset_values:n}))}),e.fail(function(e){a.reject(e),Y.trigger("changeset-error",e)}),e.always(function(e){e.setting_validities&&Y._handleSettingValidities({settingValidities:e.setting_validities})})}return a.promise()},Y.utils.bubbleChildValueChanges=function(n,e){J.each(e,function(e,t){n[t].bind(function(e,t){n.parent&&e!==t&&n.parent.trigger("change",n)})})},o=function(e){var t,n,i=this,a=function(){var e;i.extended(Y.Panel)&&1<(n=i.sections()).length&&n.forEach(function(e){e.expanded()&&e.collapse()}),e=(i.extended(Y.Panel)||i.extended(Y.Section))&&i.expanded&&i.expanded()?i.contentContainer: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(){a(),t()}):e.completeCallback=a,Y.state("paneVisible").set(!0),i.expand?i.expand(e):e.completeCallback()},Y.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()},Y.utils.isKeydownButNotEnterEvent=function(e){return"keydown"===e.type&&13!==e.which},Y.utils.areElementListsEqual=function(e,t){return e.length===t.length&&-1===_.indexOf(_.map(_.zip(e,t),function(e){return J(e[0]).is(e[1])}),!1)},Y.utils.highlightButton=function(e,t){var n,i="button-see-me",a=!1;function o(){a=!0}return(n=_.extend({delay:0,focusTarget:e},t)).focusTarget.on("focusin",o),setTimeout(function(){n.focusTarget.off("focusin",o),a||(e.addClass(i),e.one("animationend",function(){e.removeClass(i)}))},n.delay),o},Y.utils.getCurrentTimestamp=function(){var e=_.now(),t=new Date(Y.settings.initialServerDate.replace(/-/g,"/")),e=e-Y.settings.initialClientTimestamp;return e+=Y.settings.initialClientTimestamp-Y.settings.initialServerTimestamp,t.setTime(t.getTime()+e),t.getTime()},Y.utils.getRemainingTime=function(e){e=e instanceof Date?e.getTime():"string"==typeof e?new Date(e.replace(/-/g,"/")).getTime():e,e-=Y.utils.getCurrentTimestamp();return Math.ceil(e/1e3)},t=document.createElement("div"),e={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"},n=_.find(_.keys(e),function(e){return!_.isUndefined(t.style[e])}),s=n?e[n]:null,a=Y.Class.extend({defaultActiveArguments:{duration:"fast",completeCallback:J.noop},defaultExpandedArguments:{duration:"fast",completeCallback:J.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,a.instanceCounter||(a.instanceCounter=0),a.instanceCounter++,J.extend(n,{params:_.defaults(t.params||t,n.defaults)}),n.params.instanceNumber||(n.params.instanceNumber=a.instanceCounter),n.notifications=new Y.Notifications,n.templateSelector=n.params.templateId||"customize-"+n.containerType+"-"+n.params.type,n.container=J(n.params.content),0===n.container.length&&(n.container=J(n.getContainer())),n.headContainer=n.container,n.contentContainer=n.getContent(),n.container=n.container.add(n.contentContainer),n.deferred={embedded:new J.Deferred},n.priority=new Y.Value,n.active=new Y.Value,n.activeArgumentsQueue=[],n.expanded=new Y.Value,n.expandedArgumentsQueue=[],n.active.bind(function(e){var t=n.activeArgumentsQueue.shift(),t=J.extend({},n.defaultActiveArguments,t);e=e&&n.isContextuallyActive(),n.onChangeActive(e,t)}),n.expanded.bind(function(e){var t=n.expandedArgumentsQueue.shift(),t=J.extend({},n.defaultExpandedArguments,t);n.onChangeExpanded(e,t)}),n.deferred.embedded.done(function(){n.setupNotifications(),n.attachEvents()}),Y.utils.bubbleChildValueChanges(n,["priority","active"]),n.priority.set(n.params.priority),n.active.set(n.params.active),n.expanded.set(!1)},getNotificationsContainerElement:function(){return this.contentContainer.find(".customize-control-notifications-container:first")},setupNotifications:function(){var e,t=this;t.notifications.container=t.getNotificationsContainerElement(),t.expanded.bind(e=function(){t.expanded.get()&&t.notifications.render()}),e(),t.notifications.bind("change",_.debounce(e))},ready:function(){},_children:function(t,e){var n=this,i=[];return Y[e].each(function(e){e[t].get()===n.id&&i.push(e)}),i.sort(Y.utils.prioritySort),i},isContextuallyActive:function(){throw new Error("Container.isContextuallyActive() must be overridden in a subclass.")},onChangeActive:function(e,t){var n,i=this,a=i.headContainer;t.unchanged?t.completeCallback&&t.completeCallback():(n="resolved"===Y.previewer.deferred.active.state()?t.duration:0,i.extended(Y.Panel)&&(Y.panel.each(function(e){e!==i&&e.expanded()&&(n=0)}),e||_.each(i.sections(),function(e){e.collapse({duration:0})})),J.contains(document,a.get(0))?e?a.slideDown(n,t.completeCallback):i.expanded()?i.collapse({duration:n,completeCallback:function(){a.slideUp(n,t.completeCallback)}}):a.slideUp(n,t.completeCallback):(a.toggle(e),t.completeCallback&&t.completeCallback()))},_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()||(Y.state("paneVisible").set(!0),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)},_animateChangeExpanded:function(t){var a,o,n,i;!s||r?_.defer(function(){t&&t()}):(o=(a=this).contentContainer,i=o.closest(".wp-full-overlay").add(o),a.panel&&""!==a.panel()&&!Y.panel(a.panel()).contentContainer.hasClass("skip-transition")||(i=i.add("#customize-info, .customize-pane-parent")),n=function(e){2===e.eventPhase&&J(e.target).is(o)&&(o.off(s,n),i.removeClass("busy"),t)&&t()},o.on(s,n),i.addClass("busy"),_.defer(function(){var e=o.closest(".wp-full-overlay-sidebar-content"),t=e.scrollTop(),n=o.data("previous-scrollTop")||0,i=a.expanded();i&&0<t?(o.css("top",t+"px"),o.data("previous-scrollTop",t)):!i&&0<t+n&&(o.css("top",n-t+"px"),e.scrollTop(n))}))},focus:o,getContainer:function(){var e=this,t=0!==J("#tmpl-"+e.templateSelector).length?wp.template(e.templateSelector):wp.template("customize-"+e.containerType+"-default");return t&&e.container?t(_.extend({id:e.id},e.params)).toString().trim():"<li></li>"},getContent:function(){var e=this.container,t=e.find(".accordion-section-content, .control-panel-content").first(),n="sub-"+e.attr("id"),i=n,a=e.attr("aria-owns");return e.attr("aria-owns",i=a?i+" "+a:i),t.detach().attr({id:n,class:"customize-pane-child "+t.attr("class")+" "+e.attr("class")})}}),Y.Section=a.extend({containerType:"section",containerParent:"#customize-theme-controls",containerPaneParent:".customize-pane-parent",defaults:{title:"",description:"",priority:100,type:"default",content:null,active:!0,instanceNumber:null,panel:null,customizeAction:""},initialize:function(e,t){var n=this,i=t.params||t;i.type||_.find(Y.sectionConstructor,function(e,t){return e===n.constructor&&(i.type=t,!0)}),a.prototype.initialize.call(n,e,i),n.id=e,n.panel=new Y.Value,n.panel.bind(function(e){J(n.headContainer).toggleClass("control-subsection",!!e)}),n.panel.set(n.params.panel||""),Y.utils.bubbleChildValueChanges(n,["panel"]),n.embed(),n.deferred.embedded.done(function(){n.ready()})},embed:function(){var e,n=this;n.containerParent=Y.ensure(n.containerParent),n.panel.bind(e=function(e){var t;e?Y.panel(e,function(e){e.deferred.embedded.done(function(){t=e.contentContainer,n.headContainer.parent().is(t)||t.append(n.headContainer),n.contentContainer.parent().is(n.headContainer)||n.containerParent.append(n.contentContainer),n.deferred.embedded.resolve()})}):(t=Y.ensure(n.containerPaneParent),n.headContainer.parent().is(t)||t.append(n.headContainer),n.contentContainer.parent().is(n.headContainer)||n.containerParent.append(n.contentContainer),n.deferred.embedded.resolve())}),e(n.panel.get())},attachEvents:function(){var e,t,n=this;n.container.hasClass("cannot-expand")||(n.container.find(".accordion-section-title, .customize-section-back").on("click keydown",function(e){Y.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),n.expanded()?n.collapse():n.expand())}),n.container.find(".customize-section-title .customize-help-toggle").on("click",function(){(e=n.container.find(".section-meta")).hasClass("cannot-expand")||((t=e.find(".customize-section-description:first")).toggleClass("open"),t.slideToggle(n.defaultExpandedArguments.duration,function(){t.trigger("toggled")}),J(this).attr("aria-expanded",function(e,t){return"true"===t?"false":"true"}))}))},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=this,a=i.headContainer.closest(".wp-full-overlay-sidebar-content"),o=i.contentContainer,s=i.headContainer.closest(".wp-full-overlay"),r=o.find(".customize-section-back"),c=i.headContainer.find(".accordion-section-title").first();e&&!o.hasClass("open")?(n=t.unchanged?t.completeCallback:function(){i._animateChangeExpanded(function(){c.attr("tabindex","-1"),r.attr("tabindex","0"),r.trigger("focus"),o.css("top",""),a.scrollTop(0),t.completeCallback&&t.completeCallback()}),o.addClass("open"),s.addClass("section-open"),Y.state("expandedSection").set(i)}.bind(this),t.allowMultiple||Y.section.each(function(e){e!==i&&e.collapse({duration:t.duration})}),i.panel()?Y.panel(i.panel()).expand({duration:t.duration,completeCallback:n}):(t.allowMultiple||Y.panel.each(function(e){e.collapse()}),n())):!e&&o.hasClass("open")?(i.panel()&&(n=Y.panel(i.panel())).contentContainer.hasClass("skip-transition")&&n.collapse(),i._animateChangeExpanded(function(){r.attr("tabindex","-1"),c.attr("tabindex","0"),c.trigger("focus"),o.css("top",""),t.completeCallback&&t.completeCallback()}),o.removeClass("open"),s.removeClass("section-open"),i===Y.state("expandedSection").get()&&Y.state("expandedSection").set(!1)):t.completeCallback&&t.completeCallback()}}),Y.ThemesSection=Y.Section.extend({currentTheme:"",overlay:"",template:"",screenshotQueue:null,$window:null,$body:null,loaded:0,loading:!1,fullyLoaded:!1,term:"",tags:"",nextTerm:"",nextTags:"",filtersHeight:0,headerContainer:null,updateCountDebounced:null,initialize:function(e,t){var n=this;n.headerContainer=J(),n.$window=J(window),n.$body=J(document.body),Y.Section.prototype.initialize.call(n,e,t),n.updateCountDebounced=_.debounce(n.updateCount,500)},embed:function(){var n=this,e=function(e){var t;Y.panel(e,function(e){e.deferred.embedded.done(function(){t=e.contentContainer,n.headContainer.parent().is(t)||t.find(".customize-themes-full-container-container").before(n.headContainer),n.contentContainer.parent().is(n.headContainer)||n.containerParent.append(n.contentContainer),n.deferred.embedded.resolve()})})};n.panel.bind(e),e(n.panel.get())},ready:function(){var t=this;t.overlay=t.container.find(".theme-overlay"),t.template=wp.template("customize-themes-details-view"),t.container.on("keydown",function(e){t.overlay.find(".theme-wrap").is(":visible")&&(39===e.keyCode&&t.nextTheme(),37===e.keyCode&&t.previousTheme(),27===e.keyCode)&&(t.$body.hasClass("modal-open")?t.closeDetails():t.headerContainer.find(".customize-themes-section-title").focus(),e.stopPropagation())}),t.renderScreenshots=_.throttle(t.renderScreenshots,100),_.bindAll(t,"renderScreenshots","loadMore","checkTerm","filtersChecked")},isContextuallyActive:function(){return this.active()},attachEvents:function(){var e,n=this;function t(){var e=n.headerContainer.find(".customize-themes-section-title");e.toggleClass("selected",n.expanded()),e.attr("aria-expanded",n.expanded()?"true":"false"),n.expanded()||e.removeClass("details-open")}n.container.find(".customize-section-back").on("click keydown",function(e){Y.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),n.collapse())}),n.headerContainer=J("#accordion-section-"+n.id),n.headerContainer.on("click",".customize-themes-section-title",function(){n.headerContainer.find(".filter-details").length&&(n.headerContainer.find(".customize-themes-section-title").toggleClass("details-open").attr("aria-expanded",function(e,t){return"true"===t?"false":"true"}),n.headerContainer.find(".filter-details").slideToggle(180)),n.expanded()||n.expand()}),n.container.on("click",".theme-actions .preview-theme",function(){Y.panel("themes").loadThemePreview(J(this).data("slug"))}),n.container.on("click",".left",function(){n.previousTheme()}),n.container.on("click",".right",function(){n.nextTheme()}),n.container.on("click",".theme-backdrop, .close",function(){n.closeDetails()}),"local"===n.params.filter_type?n.container.on("input",".wp-filter-search-themes",function(e){n.filterSearch(e.currentTarget.value)}):"remote"===n.params.filter_type&&(e=_.debounce(n.checkTerm,500),n.contentContainer.on("input",".wp-filter-search",function(){Y.panel("themes").expanded()&&(e(n),n.expanded()||n.expand())}),n.contentContainer.on("click",".filter-group input",function(){n.filtersChecked(),n.checkTerm(n)})),n.contentContainer.on("click",".feature-filter-toggle",function(e){var t=J(".customize-themes-full-container"),e=J(e.currentTarget);n.filtersHeight=e.parent().next(".filter-drawer").height(),0<t.scrollTop()&&(t.animate({scrollTop:0},400),e.hasClass("open"))||(e.toggleClass("open").attr("aria-expanded",function(e,t){return"true"===t?"false":"true"}).parent().next(".filter-drawer").slideToggle(180,"linear"),e.hasClass("open")?(t=1018<window.innerWidth?50:76,n.contentContainer.find(".themes").css("margin-top",n.filtersHeight+t)):n.contentContainer.find(".themes").css("margin-top",0))}),n.contentContainer.on("click",".no-themes-local .search-dotorg-themes",function(){Y.section("wporg_themes").focus()}),n.expanded.bind(t),t(),Y.bind("ready",function(){n.contentContainer=n.container.find(".customize-themes-section"),n.contentContainer.appendTo(J(".customize-themes-full-container")),n.container.add(n.headerContainer)})},onChangeExpanded:function(e,n){var i=this,t=i.contentContainer.closest(".customize-themes-full-container");function a(){0===i.loaded&&i.loadThemes(),Y.section.each(function(e){var t;e!==i&&"themes"===e.params.type&&(t=e.contentContainer.find(".wp-filter-search").val(),i.contentContainer.find(".wp-filter-search").val(t),""===t&&""!==i.term&&"local"!==i.params.filter_type?(i.term="",i.initializeNewQuery(i.term,i.tags)):"remote"===i.params.filter_type?i.checkTerm(i):"local"===i.params.filter_type&&i.filterSearch(t),e.collapse({duration:n.duration}))}),i.contentContainer.addClass("current-section"),t.scrollTop(),t.on("scroll",_.throttle(i.renderScreenshots,300)),t.on("scroll",_.throttle(i.loadMore,300)),n.completeCallback&&n.completeCallback(),i.updateCount()}n.unchanged?n.completeCallback&&n.completeCallback():e?i.panel()&&Y.panel.has(i.panel())?Y.panel(i.panel()).expand({duration:n.duration,completeCallback:a}):a():(i.contentContainer.removeClass("current-section"),i.headerContainer.find(".filter-details").slideUp(180),t.off("scroll"),n.completeCallback&&n.completeCallback())},getContent:function(){return this.container.find(".control-section-content")},loadThemes:function(){var n,e,i=this;i.loading||(n=Math.ceil(i.loaded/100)+1,e={nonce:Y.settings.nonce.switch_themes,wp_customize:"on",theme_action:i.params.action,customized_theme:Y.settings.theme.stylesheet,page:n},"remote"===i.params.filter_type&&(e.search=i.term,e.tags=i.tags),i.headContainer.closest(".wp-full-overlay").addClass("loading"),i.loading=!0,i.container.find(".no-themes").hide(),(e=wp.ajax.post("customize_load_themes",e)).done(function(e){var t=e.themes;""!==i.nextTerm||""!==i.nextTags?(i.nextTerm&&(i.term=i.nextTerm),i.nextTags&&(i.tags=i.nextTags),i.nextTerm="",i.nextTags="",i.loading=!1,i.loadThemes()):(0!==t.length?(i.loadControls(t,n),1===n&&(_.each(i.controls().slice(0,3),function(e){e=e.params.theme.screenshot[0];e&&((new Image).src=e)}),"local"!==i.params.filter_type)&&wp.a11y.speak(Y.settings.l10n.themeSearchResults.replace("%d",e.info.results)),_.delay(i.renderScreenshots,100),("local"===i.params.filter_type||t.length<100)&&(i.fullyLoaded=!0)):0===i.loaded?(i.container.find(".no-themes").show(),wp.a11y.speak(i.container.find(".no-themes").text())):i.fullyLoaded=!0,"local"===i.params.filter_type?i.updateCount():i.updateCount(e.info.results),i.container.find(".unexpected-error").hide(),i.headContainer.closest(".wp-full-overlay").removeClass("loading"),i.loading=!1)}),e.fail(function(e){void 0===e?(i.container.find(".unexpected-error").show(),wp.a11y.speak(i.container.find(".unexpected-error").text())):"undefined"!=typeof console&&console.error&&console.error(e),i.headContainer.closest(".wp-full-overlay").removeClass("loading"),i.loading=!1}))},loadControls:function(e,t){var n=[],i=this;_.each(e,function(e){e=new Y.controlConstructor.theme(i.params.action+"_theme_"+e.id,{type:"theme",section:i.params.id,theme:e,priority:i.loaded+1});Y.control.add(e),n.push(e),i.loaded=i.loaded+1}),1!==t&&Array.prototype.push.apply(i.screenshotQueue,n)},loadMore:function(){var e,t;this.fullyLoaded||this.loading||(t=(e=this.container.closest(".customize-themes-full-container")).scrollTop()+e.height(),e.prop("scrollHeight")-3e3<t&&this.loadThemes())},filterSearch:function(e){var t,n=0,i=this,a=Y.section.has("wporg_themes")&&"remote"!==i.params.filter_type?".no-themes-local":".no-themes",o=i.controls();i.loading||(t=e.toLowerCase().trim().replace(/-/g," ").split(" "),_.each(o,function(e){e.filter(t)&&(n+=1)}),0===n?(i.container.find(a).show(),wp.a11y.speak(i.container.find(a).text())):i.container.find(a).hide(),i.renderScreenshots(),Y.reflowPaneContents(),i.updateCountDebounced(n))},checkTerm:function(e){var t;"remote"===e.params.filter_type&&(t=e.contentContainer.find(".wp-filter-search").val(),e.term!==t.trim())&&e.initializeNewQuery(t,e.tags)},filtersChecked:function(){var e=this,t=e.container.find(".filter-group").find(":checkbox"),n=[];_.each(t.filter(":checked"),function(e){n.push(J(e).prop("value"))}),0===n.length?(n="",e.contentContainer.find(".feature-filter-toggle .filter-count-0").show(),e.contentContainer.find(".feature-filter-toggle .filter-count-filters").hide()):(e.contentContainer.find(".feature-filter-toggle .theme-filter-count").text(n.length),e.contentContainer.find(".feature-filter-toggle .filter-count-0").hide(),e.contentContainer.find(".feature-filter-toggle .filter-count-filters").show()),_.isEqual(e.tags,n)||(e.loading?e.nextTags=n:"remote"===e.params.filter_type?e.initializeNewQuery(e.term,n):"local"===e.params.filter_type&&e.filterSearch(n.join(" ")))},initializeNewQuery:function(e,t){var n=this;_.each(n.controls(),function(e){e.container.remove(),Y.control.remove(e.id)}),n.loaded=0,n.fullyLoaded=!1,n.screenshotQueue=null,n.loading?(n.nextTerm=e,n.nextTags=t):(n.term=e,n.tags=t,n.loadThemes()),n.expanded()||n.expand()},renderScreenshots:function(){var o=this;null!==o.screenshotQueue&&0!==o.screenshotQueue.length||(o.screenshotQueue=_.filter(o.controls(),function(e){return!e.screenshotRendered})),o.screenshotQueue.length&&(o.screenshotQueue=_.filter(o.screenshotQueue,function(e){var t,n,i=e.container.find(".theme-screenshot"),a=i.find("img");return!(!a.length||!a.is(":hidden")&&(t=(n=o.$window.scrollTop())+o.$window.height(),a=a.offset().top,(n=n-(i=3*(n=i.height()))<=a+n&&a<=t+i)&&e.container.trigger("render-screenshot"),n))}))},getVisibleCount:function(){return this.contentContainer.find("li.customize-control:visible").length},updateCount:function(e){var t,n;e||0===e||(e=this.getVisibleCount()),n=this.contentContainer.find(".themes-displayed"),t=this.contentContainer.find(".theme-count"),0===e?t.text("0"):(n.fadeOut(180,function(){t.text(e),n.fadeIn(180)}),wp.a11y.speak(Y.settings.l10n.announceThemeCount.replace("%d",e)))},nextTheme:function(){var e=this;e.getNextTheme()&&e.showDetails(e.getNextTheme(),function(){e.overlay.find(".right").focus()})},getNextTheme:function(){var e=Y.control(this.params.action+"_theme_"+this.currentTheme),t=this.controls(),e=_.indexOf(t,e);return-1!==e&&!!(t=t[e+1])&&t.params.theme},previousTheme:function(){var e=this;e.getPreviousTheme()&&e.showDetails(e.getPreviousTheme(),function(){e.overlay.find(".left").focus()})},getPreviousTheme:function(){var e=Y.control(this.params.action+"_theme_"+this.currentTheme),t=this.controls(),e=_.indexOf(t,e);return-1!==e&&!!(t=t[e-1])&&t.params.theme},updateLimits:function(){this.getNextTheme()||this.overlay.find(".right").addClass("disabled"),this.getPreviousTheme()||this.overlay.find(".left").addClass("disabled")},loadThemePreview:function(e){return Y.ThemesPanel.prototype.loadThemePreview.call(this,e)},showDetails:function(e,t){var n=this,i=Y.panel("themes");function a(){return!i.canSwitchTheme(e.id)}n.currentTheme=e.id,n.overlay.html(n.template(e)).fadeIn("fast").focus(),n.overlay.find("button.preview, button.preview-theme").toggleClass("disabled",a()),n.overlay.find("button.theme-install").toggleClass("disabled",a()||!1===Y.settings.theme._canInstall||!0===Y.settings.theme._filesystemCredentialsNeeded),n.$body.addClass("modal-open"),n.containFocus(n.overlay),n.updateLimits(),wp.a11y.speak(Y.settings.l10n.announceThemeDetails.replace("%s",e.name)),t&&t()},closeDetails:function(){this.$body.removeClass("modal-open"),this.overlay.fadeOut("fast"),Y.control(this.params.action+"_theme_"+this.currentTheme).container.find(".theme").focus()},containFocus:function(t){var n;t.on("keydown",function(e){if(9===e.keyCode)return(n=J(":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)})}}),Y.OuterSection=Y.Section.extend({initialize:function(){this.containerParent="#customize-outer-theme-controls",this.containerPaneParent=".customize-outer-pane-parent",Y.Section.prototype.initialize.apply(this,arguments)},onChangeExpanded:function(e,t){var n,i=this,a=i.headContainer.closest(".wp-full-overlay-sidebar-content"),o=i.contentContainer,s=o.find(".customize-section-back"),r=i.headContainer.find(".accordion-section-title").first();J(document.body).toggleClass("outer-section-open",e),i.container.toggleClass("open",e),i.container.removeClass("busy"),Y.section.each(function(e){"outer"===e.params.type&&e.id!==i.id&&e.container.removeClass("open")}),e&&!o.hasClass("open")?(n=t.unchanged?t.completeCallback:function(){i._animateChangeExpanded(function(){r.attr("tabindex","-1"),s.attr("tabindex","0"),s.trigger("focus"),o.css("top",""),a.scrollTop(0),t.completeCallback&&t.completeCallback()}),o.addClass("open")}.bind(this),i.panel()?Y.panel(i.panel()).expand({duration:t.duration,completeCallback:n}):n()):!e&&o.hasClass("open")?(i.panel()&&(n=Y.panel(i.panel())).contentContainer.hasClass("skip-transition")&&n.collapse(),i._animateChangeExpanded(function(){s.attr("tabindex","-1"),r.attr("tabindex","0"),r.trigger("focus"),o.css("top",""),t.completeCallback&&t.completeCallback()}),o.removeClass("open")):t.completeCallback&&t.completeCallback()}}),Y.Panel=a.extend({containerType:"panel",initialize:function(e,t){var n=this,i=t.params||t;i.type||_.find(Y.panelConstructor,function(e,t){return e===n.constructor&&(i.type=t,!0)}),a.prototype.initialize.call(n,e,i),n.embed(),n.deferred.embedded.done(function(){n.ready()})},embed:function(){var e=this,t=J("#customize-theme-controls"),n=J(".customize-pane-parent");e.headContainer.parent().is(n)||n.append(e.headContainer),e.contentContainer.parent().is(e.headContainer)||t.append(e.contentContainer),e.renderContent(),e.deferred.embedded.resolve()},attachEvents:function(){var t,n=this;n.headContainer.find(".accordion-section-title").on("click keydown",function(e){Y.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),n.expanded())||n.expand()}),n.container.find(".customize-panel-back").on("click keydown",function(e){Y.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",function(){var e;t.hasClass("cannot-expand")||(e=t.find(".customize-panel-description:first"),t.hasClass("open")?(t.toggleClass("open"),e.slideUp(n.defaultExpandedArguments.duration,function(){e.trigger("toggled")}),J(this).attr("aria-expanded",!1)):(e.slideDown(n.defaultExpandedArguments.duration,function(){e.trigger("toggled")}),t.toggleClass("open"),J(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,a,o,s,r,c;t.unchanged?t.completeCallback&&t.completeCallback():(a=(i=(n=this).contentContainer).closest(".wp-full-overlay"),o=i.closest(".wp-full-overlay-sidebar-content"),s=n.headContainer.find(".accordion-section-title"),r=i.find(".customize-panel-back"),c=n.sections(),e&&!i.hasClass("current-panel")?(Y.section.each(function(e){n.id!==e.panel()&&e.collapse({duration:0})}),Y.panel.each(function(e){n!==e&&e.collapse({duration:0})}),n.params.autoExpandSoleSection&&1===c.length&&c[0].active.get()?(i.addClass("current-panel skip-transition"),a.addClass("in-sub-panel"),c[0].expand({completeCallback:t.completeCallback})):(n._animateChangeExpanded(function(){s.attr("tabindex","-1"),r.attr("tabindex","0"),r.trigger("focus"),i.css("top",""),o.scrollTop(0),t.completeCallback&&t.completeCallback()}),i.addClass("current-panel"),a.addClass("in-sub-panel")),Y.state("expandedPanel").set(n)):!e&&i.hasClass("current-panel")&&(i.hasClass("skip-transition")?i.removeClass("skip-transition"):n._animateChangeExpanded(function(){s.attr("tabindex","0"),r.attr("tabindex","-1"),s.focus(),i.css("top",""),t.completeCallback&&t.completeCallback()}),a.removeClass("in-sub-panel"),i.removeClass("current-panel"),n===Y.state("expandedPanel").get())&&Y.state("expandedPanel").set(!1))},renderContent:function(){var e=this,t=0!==J("#tmpl-"+e.templateSelector+"-content").length?wp.template(e.templateSelector+"-content"):wp.template("customize-panel-default-content");t&&e.headContainer&&e.contentContainer.html(t(_.extend({id:e.id},e.params)))}}),Y.ThemesPanel=Y.Panel.extend({initialize:function(e,t){this.installingThemes=[],Y.Panel.prototype.initialize.call(this,e,t)},canSwitchTheme:function(e){return!(!e||e!==Y.settings.theme.stylesheet)||"publish"===Y.state("selectedChangesetStatus").get()&&(""===Y.state("changesetStatus").get()||"auto-draft"===Y.state("changesetStatus").get())},attachEvents:function(){var t=this;function e(){t.canSwitchTheme()?t.notifications.remove("theme_switch_unavailable"):t.notifications.add(new Y.Notification("theme_switch_unavailable",{message:Y.l10n.themePreviewUnavailable,type:"warning"}))}Y.Panel.prototype.attachEvents.apply(t),Y.settings.theme._canInstall&&Y.settings.theme._filesystemCredentialsNeeded&&t.notifications.add(new Y.Notification("theme_install_unavailable",{message:Y.l10n.themeInstallUnavailable,type:"info",dismissible:!0})),e(),Y.state("selectedChangesetStatus").bind(e),Y.state("changesetStatus").bind(e),t.contentContainer.on("click",".customize-theme",function(){t.collapse()}),t.contentContainer.on("click",".customize-themes-section-title, .customize-themes-mobile-back",function(){J(".wp-full-overlay").toggleClass("showing-themes")}),t.contentContainer.on("click",".theme-install",function(e){t.installTheme(e)}),t.contentContainer.on("click",".update-theme, #update-theme",function(e){e.preventDefault(),e.stopPropagation(),t.updateTheme(e)}),t.contentContainer.on("click",".delete-theme",function(e){t.deleteTheme(e)}),_.bindAll(t,"installTheme","updateTheme")},onChangeExpanded:function(e,t){var n,i=!1;Y.Panel.prototype.onChangeExpanded.apply(this,[e,t]),t.unchanged?t.completeCallback&&t.completeCallback():(n=this.headContainer.closest(".wp-full-overlay"),e?(n.addClass("in-themes-panel").delay(200).find(".customize-themes-full-container").addClass("animate"),_.delay(function(){n.addClass("themes-panel-expanded")},200),600<window.innerWidth&&(t=this.sections(),_.each(t,function(e){e.expanded()&&(i=!0)}),!i)&&0<t.length&&t[0].expand()):n.removeClass("in-themes-panel themes-panel-expanded").find(".customize-themes-full-container").removeClass("animate"))},installTheme:function(e){var t,i=this,a=J(e.target).data("slug"),o=J.Deferred(),s=J(e.target).hasClass("preview");return Y.settings.theme._filesystemCredentialsNeeded?o.reject({errorCode:"theme_install_unavailable"}):i.canSwitchTheme(a)?_.contains(i.installingThemes,a)?o.reject({errorCode:"theme_already_installing"}):(wp.updates.maybeRequestFilesystemCredentials(e),e=function(t){var e,n=!1;if(s)Y.notifications.remove("theme_installing"),i.loadThemePreview(a);else{if(Y.control.each(function(e){"theme"===e.params.type&&e.params.theme.id===t.slug&&(n=e.params.theme,e.rerenderAsInstalled(!0))}),!n||Y.control.has("installed_theme_"+n.id))return void o.resolve(t);n.type="installed",e=new Y.controlConstructor.theme("installed_theme_"+n.id,{type:"theme",section:"installed_themes",theme:n,priority:0}),Y.control.add(e),Y.control(e.id).container.trigger("render-screenshot"),Y.section.each(function(e){"themes"===e.params.type&&n.id===e.currentTheme&&e.closeDetails()})}o.resolve(t)},i.installingThemes.push(a),t=wp.updates.installTheme({slug:a}),s&&Y.notifications.add(new Y.OverlayNotification("theme_installing",{message:Y.l10n.themeDownloading,type:"info",loading:!0})),t.done(e),t.fail(function(){Y.notifications.remove("theme_installing")})):o.reject({errorCode:"theme_switch_unavailable"}),o.promise()},loadThemePreview:function(e){var t,n,i=J.Deferred();return this.canSwitchTheme(e)?((n=document.createElement("a")).href=location.href,e=_.extend(Y.utils.parseQueryString(n.search.substr(1)),{theme:e,changeset_uuid:Y.settings.changeset.uuid,return:Y.settings.url.return}),Y.state("saved").get()||(e.customize_autosaved="on"),n.search=J.param(e),Y.notifications.add(new Y.OverlayNotification("theme_previewing",{message:Y.l10n.themePreviewWait,type:"info",loading:!0})),t=function(){var e;0<Y.state("processing").get()||(Y.state("processing").unbind(t),(e=Y.requestChangesetUpdate({},{autosave:!0})).done(function(){i.resolve(),J(window).off("beforeunload.customize-confirm"),location.replace(n.href)}),e.fail(function(){Y.notifications.remove("theme_previewing"),i.reject()}))},0===Y.state("processing").get()?t():Y.state("processing").bind(t)):i.reject({errorCode:"theme_switch_unavailable"}),i.promise()},updateTheme:function(e){wp.updates.maybeRequestFilesystemCredentials(e),J(document).one("wp-theme-update-success",function(e,t){Y.control.each(function(e){"theme"===e.params.type&&e.params.theme.id===t.slug&&(e.params.theme.hasUpdate=!1,e.params.theme.version=t.newVersion,setTimeout(function(){e.rerenderAsInstalled(!0)},2e3))})}),wp.updates.updateTheme({slug:J(e.target).closest(".notice").data("slug")})},deleteTheme:function(e){var t=J(e.target).data("slug"),n=Y.section("installed_themes");e.preventDefault(),Y.settings.theme._filesystemCredentialsNeeded||window.confirm(Y.settings.l10n.confirmDeleteTheme)&&(wp.updates.maybeRequestFilesystemCredentials(e),J(document).one("wp-theme-delete-success",function(){var e=Y.control("installed_theme_"+t);e.container.remove(),Y.control.remove(e.id),n.loaded=n.loaded-1,n.updateCount(),Y.control.each(function(e){"theme"===e.params.type&&e.params.theme.id===t&&e.rerenderAsInstalled(!1)})}),wp.updates.deleteTheme({slug:t}),n.closeDetails(),n.focus())}}),Y.Control=Y.Class.extend({defaultActiveArguments:{duration:"fast",completeCallback:J.noop},defaults:{label:"",description:"",active:!0,priority:10},initialize:function(e,t){var n,i=this,a=[];i.params=_.extend({},i.defaults,i.params||{},t.params||t||{}),Y.Control.instanceCounter||(Y.Control.instanceCounter=0),Y.Control.instanceCounter++,i.params.instanceNumber||(i.params.instanceNumber=Y.Control.instanceCounter),i.params.type||_.find(Y.controlConstructor,function(e,t){return e===i.constructor&&(i.params.type=t,!0)}),i.params.content||(i.params.content=J("<li></li>",{id:"customize-control-"+e.replace(/]/g,"").replace(/\[/g,"-"),class:"customize-control customize-control-"+i.params.type})),i.id=e,i.selector="#customize-control-"+e.replace(/\]/g,"").replace(/\[/g,"-"),i.params.content?i.container=J(i.params.content):i.container=J(i.selector),i.params.templateId?i.templateSelector=i.params.templateId:i.templateSelector="customize-control-"+i.params.type+"-content",i.deferred=_.extend(i.deferred||{},{embedded:new J.Deferred}),i.section=new Y.Value,i.priority=new Y.Value,i.active=new Y.Value,i.activeArgumentsQueue=[],i.notifications=new Y.Notifications({alt:i.altNotice}),i.elements=[],i.active.bind(function(e){var t=i.activeArgumentsQueue.shift(),t=J.extend({},i.defaultActiveArguments,t);i.onChangeActive(e,t)}),i.section.set(i.params.section),i.priority.set(isNaN(i.params.priority)?10:i.params.priority),i.active.set(i.params.active),Y.utils.bubbleChildValueChanges(i,["section","priority","active"]),i.settings={},n={},i.params.setting&&(n.default=i.params.setting),_.extend(n,i.params.settings),_.each(n,function(e,t){var n;_.isObject(e)&&_.isFunction(e.extended)&&e.extended(Y.Value)?i.settings[t]=e:_.isString(e)&&((n=Y(e))?i.settings[t]=n:a.push(e))}),t=function(){_.each(n,function(e,t){!i.settings[t]&&_.isString(e)&&(i.settings[t]=Y(e))}),i.settings[0]&&!i.settings.default&&(i.settings.default=i.settings[0]),i.setting=i.settings.default||null,i.linkElements(),i.embed()},0===a.length?t():Y.apply(Y,a.concat(t)),i.deferred.embedded.done(function(){i.linkElements(),i.setupNotifications(),i.ready()})},linkElements:function(){var i,a=this,o=a.container.find("[data-customize-setting-link], [data-customize-setting-key-link]"),s={};o.each(function(){var e,t,n=J(this);if(!n.data("customizeSettingLinked")){if(n.data("customizeSettingLinked",!0),n.is(":radio")){if(e=n.prop("name"),s[e])return;s[e]=!0,n=o.filter('[name="'+e+'"]')}n.data("customizeSettingLink")?t=Y(n.data("customizeSettingLink")):n.data("customizeSettingKeyLink")&&(t=a.settings[n.data("customizeSettingKeyLink")]),t&&(i=new Y.Element(n),a.elements.push(i),i.sync(t),i.set(t()))}})},embed:function(){var n=this,e=function(e){var t;e&&Y.section(e,function(e){e.deferred.embedded.done(function(){t=e.contentContainer.is("ul")?e.contentContainer:e.contentContainer.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(){var t,n=this;"dropdown-pages"===n.params.type&&n.params.allow_addition&&((t=n.container.find(".new-content-item")).hide(),n.container.on("click",".add-new-toggle",function(e){J(e.currentTarget).slideUp(180),t.slideDown(180),t.find(".create-item-input").focus()}),n.container.on("click",".add-content",function(){n.addNewPage()}),n.container.on("keydown",".create-item-input",function(e){13===e.which&&n.addNewPage()}))},getNotificationsContainerElement:function(){var e,t=this,n=t.container.find(".customize-control-notifications-container:first");return n.length||(n=J('<div class="customize-control-notifications-container"></div>'),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},setupNotifications:function(){var n,e,i=this;_.each(i.settings,function(n){n.notifications&&(n.notifications.bind("add",function(e){var t=_.extend({},e,{setting:n.id});i.notifications.add(new Y.Notification(n.id+":"+e.code,t))}),n.notifications.bind("remove",function(e){i.notifications.remove(n.id+":"+e.code)}))}),n=function(){var e=i.section();(!e||Y.section.has(e)&&Y.section(e).expanded())&&i.notifications.render()},i.notifications.bind("rendered",function(){var e=i.notifications.get();i.container.toggleClass("has-notifications",0!==e.length),i.container.toggleClass("has-error",0!==_.where(e,{type:"error"}).length)}),i.section.bind(e=function(e,t){t&&Y.section.has(t)&&Y.section(t).expanded.unbind(n),e&&Y.section(e,function(e){e.expanded.bind(n),n()})}),e(i.section.get()),i.notifications.bind("change",_.debounce(n))},renderNotifications:function(){var e,t,n=this,i=!1;"undefined"!=typeof console&&console.warn&&console.warn("[DEPRECATED] wp.customize.Control.prototype.renderNotifications() is deprecated in favor of instantiating a wp.customize.Notifications and calling its render() method."),(e=n.getNotificationsContainerElement())&&e.length&&(t=[],n.notifications.each(function(e){t.push(e),"error"===e.type&&(i=!0)}),0===t.length?e.stop().slideUp("fast"):e.stop().slideDown("fast",null,function(){J(this).css("height","auto")}),n.notificationsTemplate||(n.notificationsTemplate=wp.template("customize-control-notifications")),n.container.toggleClass("has-notifications",0!==t.length),n.container.toggleClass("has-error",i),e.empty().append(n.notificationsTemplate({notifications:t,altNotice:Boolean(n.altNotice)}).trim()))},expand:function(e){Y.section(this.section()).expand(e)},focus:o,onChangeActive:function(e,t){t.unchanged?t.completeCallback&&t.completeCallback():J.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:a.prototype.activate,deactivate:a.prototype.deactivate,_toggleActive:a.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,a=!1;this.container.on("click keydown",".dropdown",function(e){Y.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),a||t.container.toggleClass("open"),t.container.hasClass("open")&&t.container.parent().parent().find("li.library-selected").focus(),a=!0,setTimeout(function(){a=!1},400))}),this.setting.bind(e),e(this.setting())},renderContent:function(){var e=this,t=e.templateSelector;t==="customize-control-"+e.params.type+"-content"&&_.contains(["button","checkbox","date","datetime-local","email","month","number","password","radio","range","search","select","tel","time","text","textarea","week","url"],e.params.type)&&!document.getElementById("tmpl-"+t)&&0===e.container.children().length&&(t="customize-control-default-content"),document.getElementById("tmpl-"+t)&&(t=wp.template(t))&&e.container&&e.container.html(t(e.params)),e.notifications.container=e.getNotificationsContainerElement(),(!(t=e.section())||Y.section.has(t)&&Y.section(t).expanded())&&e.notifications.render()},addNewPage:function(){var e,a,o,t,s,r,c=this;"dropdown-pages"===c.params.type&&c.params.allow_addition&&Y.Menus&&(a=c.container.find(".add-new-toggle"),o=c.container.find(".new-content-item"),t=c.container.find(".create-item-input"),s=t.val(),r=c.container.find("select"),s?(t.removeClass("invalid"),t.attr("disabled","disabled"),(e=Y.Menus.insertAutoDraftPost({post_title:s,post_type:"page"})).done(function(e){var t,n,i=new Y.Menus.AvailableItemModel({id:"post-"+e.post_id,title:s,type:"post_type",type_label:Y.Menus.data.l10n.page_label,object:"page",object_id:e.post_id,url:e.url});Y.Menus.availableMenuItemsPanel.collection.add(i),t=J("#available-menu-items-post_type-page").find(".available-menu-items-list"),n=wp.template("available-menu-item"),t.prepend(n(i.attributes)),r.focus(),c.setting.set(String(e.post_id)),o.slideUp(180),a.slideDown(180)}),e.always(function(){t.val("").removeAttr("disabled")})):t.addClass("invalid"))}}),Y.ColorControl=Y.Control.extend({ready:function(){var t,n=this,e="hue"===this.params.mode,i=!1;e?(t=this.container.find(".color-picker-hue")).val(n.setting()).wpColorPicker({change:function(e,t){i=!0,n.setting(t.color.h()),i=!1}}):(t=this.container.find(".color-picker-hex")).val(n.setting()).wpColorPicker({change:function(){i=!0,n.setting.set(t.wpColorPicker("color")),i=!1},clear:function(){i=!0,n.setting.set(""),i=!1}}),n.setting.bind(function(e){i||(t.val(e),t.wpColorPicker("color",e))}),n.container.on("keydown",function(e){27===e.which&&n.container.find(".wp-picker-container").hasClass("wp-picker-active")&&(t.wpColorPicker("close"),n.container.find(".wp-color-result").focus(),e.stopPropagation())})}}),Y.MediaControl=Y.Control.extend({ready:function(){var n=this;function e(e){var t=J.Deferred();n.extended(Y.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),Y.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){Y.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){Y.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),this.params.attachment=this.params.defaultAttachment,this.setting(this.params.defaultAttachment.url))},removeFile:function(e){Y.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),this.params.attachment={},this.setting(""),this.renderContent())}}),Y.UploadControl=Y.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(){}}),Y.ImageControl=Y.UploadControl.extend({thumbnailSrc:function(){}}),Y.BackgroundControl=Y.UploadControl.extend({ready:function(){Y.UploadControl.prototype.ready.apply(this,arguments)},select:function(){Y.UploadControl.prototype.select.apply(this,arguments),wp.ajax.post("custom-background-add",{nonce:_wpCustomizeBackground.nonces.add,wp_customize:"on",customize_theme:Y.settings.theme.stylesheet,attachment_id:this.params.attachment.id})}}),Y.BackgroundPositionControl=Y.Control.extend({ready:function(){var e,n=this;n.container.on("change",'input[name="background-position"]',function(){var e=J(this).val().split(" ");n.settings.x(e[0]),n.settings.y(e[1])}),e=_.debounce(function(){var e=n.settings.x.get(),t=n.settings.y.get(),e=String(e)+" "+String(t);n.container.find('input[name="background-position"][value="'+e+'"]').trigger("click")}),n.settings.x.bind(e),n.settings.y.bind(e),e()}}),Y.CroppedImageControl=Y.MediaControl.extend({openFrame:function(e){Y.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),a=!!parseInt(n.params.flex_height,10),o=e.get("width"),e=e.get("height"),s=parseInt(n.params.width,10),r=parseInt(n.params.height,10),c=s/r,l=s,d=r;return t.set("canSkipCrop",!n.mustBeCropped(i,a,s,r,o,e)),c<o/e?s=(r=e)*c:r=(s=o)/c,!(c={handles:!0,keys:!0,instance:!0,persistent:!0,imageWidth:o,imageHeight:e,minWidth:s<l?s:l,minHeight:r<d?r:d,x1:t=(o-s)/2,y1:n=(e-r)/2,x2:s+t,y2:r+n})==a&&!1==i&&(c.aspectRatio=s+":"+r),!0==a&&(delete c.minHeight,c.maxWidth=o),!0==i&&(delete c.minWidth,c.maxHeight=e),c},mustBeCropped:function(e,t,n,i,a,o){return(!0!==e||!0!==t)&&!(!0===e&&i===o||!0===t&&n===a||n===a&&i===o||a<=n)},onSkippedCrop:function(){var e=this.frame.state().get("selection").first().toJSON();this.setImageFromAttachment(e)},setImageFromAttachment:function(e){this.params.attachment=e,this.setting(e.id)}}),Y.SiteIconControl=Y.CroppedImageControl.extend({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.SiteIconCropper({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(),t=this;this.params.width!==e.width||this.params.height!==e.height||this.params.flex_width||this.params.flex_height?this.frame.setState("cropper"):wp.ajax.post("crop-image",{nonce:e.nonces.edit,id:e.id,context:"site-icon",cropDetails:{x1:0,y1:0,width:this.params.width,height:this.params.height,dst_width:this.params.width,dst_height:this.params.height}}).done(function(e){t.setImageFromAttachment(e),t.frame.close()}).fail(function(){t.frame.trigger("content:error:crop")})},setImageFromAttachment:function(t){var n;_.each(["site_icon-32","thumbnail","full"],function(e){n||_.isUndefined(t.sizes[e])||(n=t.sizes[e])}),this.params.attachment=t,this.setting(t.id),n&&J('link[rel="icon"][sizes="32x32"]').attr("href",n.url)},removeFile:function(e){Y.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),this.params.attachment={},this.setting(""),this.renderContent(),J('link[rel="icon"][sizes="32x32"]').attr("href","/favicon.ico"))}}),Y.HeaderControl=Y.Control.extend({ready:function(){this.btnRemove=J("#customize-control-header_image .actions .remove"),this.btnNew=J("#customize-control-header_image .actions .new"),_.bindAll(this,"openMedia","removeImage"),this.btnNew.on("click",this.openMedia),this.btnRemove.on("click",this.removeImage),Y.HeaderTool.currentHeader=this.getInitialHeaderImage(),new Y.HeaderTool.CurrentView({model:Y.HeaderTool.currentHeader,el:"#customize-control-header_image .current .container"}),new Y.HeaderTool.ChoiceListView({collection:Y.HeaderTool.UploadsList=new Y.HeaderTool.ChoiceList,el:"#customize-control-header_image .choices .uploaded .list"}),new Y.HeaderTool.ChoiceListView({collection:Y.HeaderTool.DefaultsList=new Y.HeaderTool.DefaultsList,el:"#customize-control-header_image .choices .default .list"}),Y.HeaderTool.combinedList=Y.HeaderTool.CombinedList=new Y.HeaderTool.CombinedList([Y.HeaderTool.UploadsList,Y.HeaderTool.DefaultsList]),wp.media.controller.Cropper.prototype.defaults.doCropArgs.wp_customize="on",wp.media.controller.Cropper.prototype.defaults.doCropArgs.customize_theme=Y.settings.theme.stylesheet},getInitialHeaderImage:function(){var e;return Y.get().header_image&&Y.get().header_image_data&&!_.contains(["remove-header","random-default-image","random-uploaded-image"],Y.get().header_image)?(e=(e=_.find(_wpCustomizeHeader.uploads,function(e){return e.attachment_id===Y.get().header_image_data.attachment_id}))||{url:Y.get().header_image,thumbnail_url:Y.get().header_image,attachment_id:Y.get().header_image_data.attachment_id},new Y.HeaderTool.ImageModel({header:e,choice:e.url.split("/").pop()})):new Y.HeaderTool.ImageModel},calculateImageSelectOptions:function(e,t){var n=parseInt(_wpCustomizeHeader.data.width,10),i=parseInt(_wpCustomizeHeader.data.height,10),a=!!parseInt(_wpCustomizeHeader.data["flex-width"],10),o=!!parseInt(_wpCustomizeHeader.data["flex-height"],10),s=e.get("width"),e=e.get("height");return this.headerImage=new Y.HeaderTool.ImageModel,this.headerImage.set({themeWidth:n,themeHeight:i,themeFlexWidth:a,themeFlexHeight:o,imageWidth:s,imageHeight:e}),t.set("canSkipCrop",!this.headerImage.shouldBeCropped()),(t=n/i)<s/e?n=(i=e)*t:i=(n=s)/t,!(t={handles:!0,keys:!0,instance:!0,persistent:!0,imageWidth:s,imageHeight:e,x1:0,y1:0,x2:n,y2:i})==o&&!1==a&&(t.aspectRatio=n+":"+i),!1==o&&(t.maxHeight=i),!1==a&&(t.maxWidth=n),t},openMedia:function(e){var t=_wpMediaViewsL10n;e.preventDefault(),this.frame=wp.media({button:{text:t.selectAndCrop,close:!1},states:[new wp.media.controller.Library({title:t.chooseImage,library:wp.media.query({type:"image"}),multiple:!1,date:!1,priority:20,suggestedWidth:_wpCustomizeHeader.data.width,suggestedHeight:_wpCustomizeHeader.data.height}),new wp.media.controller.Cropper({imgSelectOptions:this.calculateImageSelectOptions})]}),this.frame.on("select",this.onSelect,this),this.frame.on("cropped",this.onCropped,this),this.frame.on("skippedcrop",this.onSkippedCrop,this),this.frame.open()},onSelect:function(){this.frame.setState("cropper")},onCropped:function(e){var t=e.url,n=e.attachment_id,i=e.width,e=e.height;this.setImageFromURL(t,n,i,e)},onSkippedCrop:function(e){var t=e.get("url"),n=e.get("width"),i=e.get("height");this.setImageFromURL(t,e.id,n,i)},setImageFromURL:function(e,t,n,i){var a={};a.url=e,a.thumbnail_url=e,a.timestamp=_.now(),t&&(a.attachment_id=t),n&&(a.width=n),i&&(a.height=i),t=new Y.HeaderTool.ImageModel({header:a,choice:e.split("/").pop()}),Y.HeaderTool.UploadsList.add(t),Y.HeaderTool.currentHeader.set(t.toJSON()),t.save(),t.importImage()},removeImage:function(){Y.HeaderTool.currentHeader.trigger("hide"),Y.HeaderTool.CombinedList.trigger("control:removeImage")}}),Y.ThemeControl=Y.Control.extend({touchDrag:!1,screenshotRendered:!1,ready:function(){var n=this,e=Y.panel("themes");function t(){return!e.canSwitchTheme(n.params.theme.id)}function i(){n.container.find("button.preview, button.preview-theme").toggleClass("disabled",t()),n.container.find("button.theme-install").toggleClass("disabled",t()||!1===Y.settings.theme._canInstall||!0===Y.settings.theme._filesystemCredentialsNeeded)}Y.state("selectedChangesetStatus").bind(i),Y.state("changesetStatus").bind(i),i(),n.container.on("touchmove",".theme",function(){n.touchDrag=!0}),n.container.on("click keydown touchend",".theme",function(e){var t;if(!Y.utils.isKeydownButNotEnterEvent(e))return!0===n.touchDrag?n.touchDrag=!1:void(J(e.target).is(".theme-actions .button, .update-theme")||(e.preventDefault(),(t=Y.section(n.section())).showDetails(n.params.theme,function(){Y.settings.theme._filesystemCredentialsNeeded&&t.overlay.find(".theme-actions .delete-theme").remove()})))}),n.container.on("render-screenshot",function(){var e=J(this).find("img"),t=e.data("src");t&&e.attr("src",t),n.screenshotRendered=!0})},filter:function(e){var t=this,n=0,i=(i=t.params.theme.name+" "+t.params.theme.description+" "+t.params.theme.tags+" "+t.params.theme.author+" ").toLowerCase().replace("-"," ");return _.isArray(e)||(e=[e]),t.params.theme.name.toLowerCase()===e.join(" ")?n=100:(n+=10*(i.split(e.join(" ")).length-1),_.each(e,function(e){n=(n+=2*(i.split(e+" ").length-1))+i.split(e).length-1}),99<n&&(n=99)),0!==n?(t.activate(),t.params.priority=101-n,!0):(t.deactivate(),!(t.params.priority=101))},rerenderAsInstalled:function(e){var t=this;e?t.params.theme.type="installed":(e=Y.section(t.params.section),t.params.theme.type=e.params.action),t.renderContent(),t.container.trigger("render-screenshot")}}),Y.CodeEditorControl=Y.Control.extend({initialize:function(e,t){var n=this;n.deferred=_.extend(n.deferred||{},{codemirror:J.Deferred()}),Y.Control.prototype.initialize.call(n,e,t),n.notifications.bind("add",function(e){var t;e.code===n.setting.id+":csslint_error"&&(e.templateId="customize-code-editor-lint-error-notification",e.render=(t=e.render,function(){var e=t.call(this);return e.find("input[type=checkbox]").on("click",function(){n.setting.notifications.remove("csslint_error")}),e}))})},ready:function(){var i=this;i.section()?Y.section(i.section(),function(n){n.deferred.embedded.done(function(){var t;n.expanded()?i.initEditor():n.expanded.bind(t=function(e){e&&(i.initEditor(),n.expanded.unbind(t))})})}):i.initEditor()},initEditor:function(){var e,t=this,n=!1;wp.codeEditor&&(_.isUndefined(t.params.editor_settings)||!1!==t.params.editor_settings)&&((n=wp.codeEditor.defaultSettings?_.clone(wp.codeEditor.defaultSettings):{}).codemirror=_.extend({},n.codemirror,{indentUnit:2,tabSize:2}),_.isObject(t.params.editor_settings))&&_.each(t.params.editor_settings,function(e,t){_.isObject(e)&&(n[t]=_.extend({},n[t],e))}),e=new Y.Element(t.container.find("textarea")),t.elements.push(e),e.sync(t.setting),e.set(t.setting()),n?t.initSyntaxHighlightingEditor(n):t.initPlainTextareaEditor()},focus:function(e){var t=this,e=_.extend({},e),n=e.completeCallback;e.completeCallback=function(){n&&n(),t.editor&&t.editor.codemirror.focus()},Y.Control.prototype.focus.call(t,e)},initSyntaxHighlightingEditor:function(e){var t=this,n=t.container.find("textarea"),i=!1,e=_.extend({},e,{onTabNext:_.bind(t.onTabNext,t),onTabPrevious:_.bind(t.onTabPrevious,t),onUpdateErrorNotice:_.bind(t.onUpdateErrorNotice,t)});t.editor=wp.codeEditor.initialize(n,e),J(t.editor.codemirror.display.lineDiv).attr({role:"textbox","aria-multiline":"true","aria-label":t.params.label,"aria-describedby":"editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"}),t.container.find("label").on("click",function(){t.editor.codemirror.focus()}),t.editor.codemirror.on("change",function(e){i=!0,n.val(e.getValue()).trigger("change"),i=!1}),t.setting.bind(function(e){i||t.editor.codemirror.setValue(e)}),t.editor.codemirror.on("keydown",function(e,t){27===t.keyCode&&t.stopPropagation()}),t.deferred.codemirror.resolveWith(t,[t.editor.codemirror])},onTabNext:function(){var e=Y.section(this.section()).controls(),t=e.indexOf(this);e.length===t+1?J("#customize-footer-actions .collapse-sidebar").trigger("focus"):e[t+1].container.find(":focusable:first").focus()},onTabPrevious:function(){var e=Y.section(this.section()),t=e.controls(),n=t.indexOf(this);(0===n?e.contentContainer.find(".customize-section-title .customize-help-toggle, .customize-section-title .customize-section-description.open .section-description-close").last():t[n-1].contentContainer.find(":focusable:first")).focus()},onUpdateErrorNotice:function(e){this.setting.notifications.remove("csslint_error"),0!==e.length&&(e=1===e.length?Y.l10n.customCssError.singular.replace("%d","1"):Y.l10n.customCssError.plural.replace("%d",String(e.length)),this.setting.notifications.add(new Y.Notification("csslint_error",{message:e,type:"error"})))},initPlainTextareaEditor:function(){var a=this.container.find("textarea"),o=a[0];a.on("blur",function(){a.data("next-tab-blurs",!1)}),a.on("keydown",function(e){var t,n,i;27===e.keyCode?a.data("next-tab-blurs")||(a.data("next-tab-blurs",!0),e.stopPropagation()):9!==e.keyCode||e.ctrlKey||e.altKey||e.shiftKey||a.data("next-tab-blurs")||(t=o.selectionStart,n=o.selectionEnd,i=o.value,0<=t&&(o.value=i.substring(0,t).concat("\t",i.substring(n)),a.selectionStart=o.selectionEnd=t+1),e.stopPropagation(),e.preventDefault())}),this.deferred.codemirror.rejectWith(this)}}),Y.DateTimeControl=Y.Control.extend({ready:function(){var i=this;if(i.inputElements={},i.invalidDate=!1,_.bindAll(i,"populateSetting","updateDaysForMonth","populateDateInputs"),!i.setting)throw new Error("Missing setting");i.container.find(".date-input").each(function(){var e=J(this),t=e.data("component"),n=new Y.Element(e);i.inputElements[t]=n,i.elements.push(n),e.on("change",function(){i.invalidDate&&i.notifications.add(new Y.Notification("invalid_date",{message:Y.l10n.invalidDate}))}),e.on("input",_.debounce(function(){i.invalidDate||i.notifications.remove("invalid_date")})),e.on("blur",_.debounce(function(){i.invalidDate||i.populateDateInputs()}))}),i.inputElements.month.bind(i.updateDaysForMonth),i.inputElements.year.bind(i.updateDaysForMonth),i.populateDateInputs(),i.setting.bind(i.populateDateInputs),_.each(i.inputElements,function(e){e.bind(i.populateSetting)})},parseDateTime:function(e){var t;return(t=e?e.match(/^(\d\d\d\d)-(\d\d)-(\d\d)(?: (\d\d):(\d\d)(?::(\d\d))?)?$/):t)?(t.shift(),e={year:t.shift(),month:t.shift(),day:t.shift(),hour:t.shift()||"00",minute:t.shift()||"00",second:t.shift()||"00"},this.params.includeTime&&this.params.twelveHourFormat&&(e.hour=parseInt(e.hour,10),e.meridian=12<=e.hour?"pm":"am",e.hour=e.hour%12?String(e.hour%12):String(12),delete e.second),e):null},validateInputs:function(){var e,i,a=this;return a.invalidDate=!1,e=["year","day"],a.params.includeTime&&e.push("hour","minute"),_.find(e,function(e){var t,n,e=a.inputElements[e];return i=e.element.get(0),t=parseInt(e.element.attr("max"),10),n=parseInt(e.element.attr("min"),10),e=parseInt(e(),10),a.invalidDate=isNaN(e)||t<e||e<n,a.invalidDate||i.setCustomValidity(""),a.invalidDate}),a.inputElements.meridian&&!a.invalidDate&&(i=a.inputElements.meridian.element.get(0),"am"!==a.inputElements.meridian.get()&&"pm"!==a.inputElements.meridian.get()?a.invalidDate=!0:i.setCustomValidity("")),a.invalidDate?i.setCustomValidity(Y.l10n.invalidValue):i.setCustomValidity(""),(!a.section()||Y.section.has(a.section())&&Y.section(a.section()).expanded())&&_.result(i,"reportValidity"),a.invalidDate},updateDaysForMonth:function(){var e=this,t=parseInt(e.inputElements.month(),10),n=parseInt(e.inputElements.year(),10),i=parseInt(e.inputElements.day(),10);t&&n&&(n=new Date(n,t,0).getDate(),e.inputElements.day.element.attr("max",n),n<i)&&e.inputElements.day(String(n))},populateSetting:function(){var e,t=this;return!(t.validateInputs()||!t.params.allowPastDate&&!t.isFutureDate()||(e=t.convertInputDateToString(),t.setting.set(e),0))},convertInputDateToString:function(){var e,n=this,t="",i=function(e,t){return String(e).length<t&&(t=t-String(e).length,e=Math.pow(10,t).toString().substr(1)+String(e)),e},a=function(e){var t=parseInt(n.inputElements[e].get(),10);return _.contains(["month","day","hour","minute"],e)?t=i(t,2):"year"===e&&(t=i(t,4)),t},o=["year","-","month","-","day"];return n.params.includeTime&&(e=n.inputElements.meridian?n.convertHourToTwentyFourHourFormat(n.inputElements.hour(),n.inputElements.meridian()):n.inputElements.hour(),o=o.concat([" ",i(e,2),":","minute",":","00"])),_.each(o,function(e){t+=n.inputElements[e]?a(e):e}),t},isFutureDate:function(){return 0<Y.utils.getRemainingTime(this.convertInputDateToString())},convertHourToTwentyFourHourFormat:function(e,t){e=parseInt(e,10);return isNaN(e)?"":(t="pm"===t&&e<12?e+12:"am"===t&&12===e?e-12:e,String(t))},populateDateInputs:function(){var i=this.parseDateTime(this.setting.get());return!!i&&(_.each(this.inputElements,function(e,t){var n=i[t];"month"===t||"meridian"===t?(n=n.replace(/^0/,""),e.set(n)):(n=parseInt(n,10),e.element.is(document.activeElement)?n!==parseInt(e(),10)&&e.set(String(n)):e.set(i[t]))}),!0)},toggleFutureDateNotification:function(e){var t="not_future_date";return e?(e=new Y.Notification(t,{type:"error",message:Y.l10n.futureDateError}),this.notifications.add(e)):this.notifications.remove(t),this}}),Y.PreviewLinkControl=Y.Control.extend({defaults:_.extend({},Y.Control.prototype.defaults,{templateId:"customize-preview-link-control"}),ready:function(){var e,t,n,i,a,o=this;_.bindAll(o,"updatePreviewLink"),o.setting||(o.setting=new Y.Value),o.previewElements={},o.container.find(".preview-control-element").each(function(){t=J(this),e=t.data("component"),t=new Y.Element(t),o.previewElements[e]=t,o.elements.push(t)}),n=o.previewElements.url,i=o.previewElements.input,a=o.previewElements.button,i.link(o.setting),n.link(o.setting),n.bind(function(e){n.element.parent().attr({href:e,target:Y.settings.changeset.uuid})}),Y.bind("ready",o.updatePreviewLink),Y.state("saved").bind(o.updatePreviewLink),Y.state("changesetStatus").bind(o.updatePreviewLink),Y.state("activated").bind(o.updatePreviewLink),Y.previewer.previewUrl.bind(o.updatePreviewLink),a.element.on("click",function(e){e.preventDefault(),o.setting()&&(i.element.select(),document.execCommand("copy"),a(a.element.data("copied-text")))}),n.element.parent().on("click",function(e){J(this).hasClass("disabled")&&e.preventDefault()}),a.element.on("mouseenter",function(){o.setting()&&a(a.element.data("copy-text"))})},updatePreviewLink:function(){var e=!Y.state("saved").get()||""===Y.state("changesetStatus").get()||"auto-draft"===Y.state("changesetStatus").get();this.toggleSaveNotification(e),this.previewElements.url.element.parent().toggleClass("disabled",e),this.previewElements.button.element.prop("disabled",e),this.setting.set(Y.previewer.getFrontendPreviewUrl())},toggleSaveNotification:function(e){var t="changes_not_saved";e?(e=new Y.Notification(t,{type:"info",message:Y.l10n.saveBeforeShare}),this.notifications.add(e)):this.notifications.remove(t)}}),Y.defaultConstructor=Y.Setting,Y.control=new Y.Values({defaultConstructor:Y.Control}),Y.section=new Y.Values({defaultConstructor:Y.Section}),Y.panel=new Y.Values({defaultConstructor:Y.Panel}),Y.notifications=new Y.Notifications,Y.PreviewFrame=Y.Messenger.extend({sensitivity:null,initialize:function(e,t){var n=J.Deferred();n.promise(this),this.container=e.container,J.extend(e,{channel:Y.PreviewFrame.uuid()}),Y.Messenger.prototype.initialize.call(this,e,t),this.add("previewUrl",e.previewUrl),this.query=J.extend(e.query||{},{customize_messenger_channel:this.channel()}),this.run(n)},run:function(t){var e,n,i,a=this,o=!1,s=!1,r=null,c="{}"!==a.query.customized;a._ready&&a.unbind("ready",a._ready),a._ready=function(e){s=!0,r=e,a.container.addClass("iframe-ready"),e&&o&&t.resolveWith(a,[e])},a.bind("ready",a._ready),(e=document.createElement("a")).href=a.previewUrl(),n=_.extend(Y.utils.parseQueryString(e.search.substr(1)),{customize_changeset_uuid:a.query.customize_changeset_uuid,customize_theme:a.query.customize_theme,customize_messenger_channel:a.query.customize_messenger_channel}),!Y.settings.changeset.autosaved&&Y.state("saved").get()||(n.customize_autosaved="on"),e.search=J.param(n),a.iframe=J("<iframe />",{title:Y.l10n.previewIframeTitle,name:"customize-"+a.channel()}),a.iframe.attr("onmousewheel",""),a.iframe.attr("sandbox","allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-presentation allow-same-origin allow-scripts"),c?a.iframe.attr("data-src",e.href):a.iframe.attr("src",e.href),a.iframe.appendTo(a.container),a.targetWindow(a.iframe[0].contentWindow),c&&((i=J("<form>",{action:e.href,target:a.iframe.attr("name"),method:"post",hidden:"hidden"})).append(J("<input>",{type:"hidden",name:"_method",value:"GET"})),_.each(a.query,function(e,t){i.append(J("<input>",{type:"hidden",name:t,value:e}))}),a.container.append(i),i.trigger("submit"),i.remove()),a.bind("iframe-loading-error",function(e){a.iframe.remove(),0===e?a.login(t):-1===e?t.rejectWith(a,["cheatin"]):t.rejectWith(a,["request failure"])}),a.iframe.one("load",function(){o=!0,s?t.resolveWith(a,[r]):setTimeout(function(){t.rejectWith(a,["ready timeout"])},a.sensitivity)})},login:function(n){var i=this,a=function(){n.rejectWith(i,["logged out"])};if(this.triedLogin)return a();J.get(Y.settings.url.ajax,{action:"logged-in"}).fail(a).done(function(e){var t;"1"!==e&&a(),(t=J("<iframe />",{src:i.previewUrl(),title:Y.l10n.previewIframeTitle}).hide()).appendTo(i.container),t.on("load",function(){i.triedLogin=!0,t.remove(),i.run(n)})})},destroy:function(){Y.Messenger.prototype.destroy.call(this),this.iframe&&this.iframe.remove(),delete this.iframe,delete this.targetWindow}}),i=0,Y.PreviewFrame.uuid=function(){return"preview-"+String(i++)},Y.setDocumentTitle=function(e){e=Y.settings.documentTitleTmpl.replace("%s",e);document.title=e,Y.trigger("title",e)},Y.Previewer=Y.Messenger.extend({refreshBuffer:null,initialize:function(e,t){var n,o=this,i=document.createElement("a");J.extend(o,t||{}),o.deferred={active:J.Deferred()},o.refresh=_.debounce((n=o.refresh,function(){var e,t=function(){return 0===Y.state("processing").get()};t()?n.call(o):(e=function(){t()&&(n.call(o),Y.state("processing").unbind(e))},Y.state("processing").bind(e))}),o.refreshBuffer),o.container=Y.ensure(e.container),o.allowedUrls=e.allowedUrls,e.url=window.location.href,Y.Messenger.prototype.initialize.call(o,e),i.href=o.origin(),o.add("scheme",i.protocol.replace(/:$/,"")),o.add("previewUrl",e.previewUrl).setter(function(e){var n,i=null,t=[],a=document.createElement("a");return a.href=e,/\/wp-(admin|includes|content)(\/|$)/.test(a.pathname)?null:(1<a.search.length&&(delete(e=Y.utils.parseQueryString(a.search.substr(1))).customize_changeset_uuid,delete e.customize_theme,delete e.customize_messenger_channel,delete e.customize_autosaved,_.isEmpty(e)?a.search="":a.search=J.param(e)),t.push(a),o.scheme.get()+":"!==a.protocol&&((a=document.createElement("a")).href=t[0].href,a.protocol=o.scheme.get()+":",t.unshift(a)),n=document.createElement("a"),_.find(t,function(t){return!_.isUndefined(_.find(o.allowedUrls,function(e){if(n.href=e,a.protocol===n.protocol&&a.host===n.host&&0===a.pathname.indexOf(n.pathname.replace(/\/$/,"")))return i=t.href,!0}))}),i)}),o.bind("ready",o.ready),o.deferred.active.done(_.bind(o.keepPreviewAlive,o)),o.bind("synced",function(){o.send("active")}),o.previewUrl.bind(o.refresh),o.scroll=0,o.bind("scroll",function(e){o.scroll=e}),o.bind("url",function(e){var t,n=!1;o.scroll=0,o.previewUrl.bind(t=function(){n=!0}),o.previewUrl.set(e),o.previewUrl.unbind(t),n||o.refresh()}),o.bind("documentTitle",function(e){Y.setDocumentTitle(e)})},ready:function(e){var t=this,n={};n.settings=Y.get(),n["settings-modified-while-loading"]=t.settingsModifiedWhileLoading,"resolved"===t.deferred.active.state()&&!t.loading||(n.scroll=t.scroll),n["edit-shortcut-visibility"]=Y.state("editShortcutVisibility").get(),t.send("sync",n),e.currentUrl&&(t.previewUrl.unbind(t.refresh),t.previewUrl.set(e.currentUrl),t.previewUrl.bind(t.refresh)),n={panel:e.activePanels,section:e.activeSections,control:e.activeControls},_(n).each(function(n,i){Y[i].each(function(e,t){_.isUndefined(Y.settings[i+"s"][t])&&_.isUndefined(n[t])||(n[t]?e.activate():e.deactivate())})}),e.settingValidities&&Y._handleSettingValidities({settingValidities:e.settingValidities,focusInvalidControl:!1})},keepPreviewAlive:function(){var e,t=function(){e=setTimeout(i,Y.settings.timeouts.keepAliveCheck)},n=function(){Y.state("previewerAlive").set(!0),clearTimeout(e),t()},i=function(){Y.state("previewerAlive").set(!1)};t(),this.bind("ready",n),this.bind("keep-alive",n)},query:function(){},abort:function(){this.loading&&(this.loading.destroy(),delete this.loading)},refresh:function(){var e,i=this;i.send("loading-initiated"),i.abort(),i.loading=new Y.PreviewFrame({url:i.url(),previewUrl:i.previewUrl(),query:i.query({excludeCustomizedSaved:!0})||{},container:i.container}),i.settingsModifiedWhileLoading={},Y.bind("change",e=function(e){i.settingsModifiedWhileLoading[e.id]=!0}),i.loading.always(function(){Y.unbind("change",e)}),i.loading.done(function(e){var t,n=this;i.preview=n,i.targetWindow(n.targetWindow()),i.channel(n.channel()),t=function(){n.unbind("synced",t),i._previousPreview&&i._previousPreview.destroy(),i._previousPreview=i.preview,i.deferred.active.resolve(),delete i.loading},n.bind("synced",t),i.trigger("ready",e)}),i.loading.fail(function(e){i.send("loading-failed"),"logged out"===e&&(i.preview&&(i.preview.destroy(),delete i.preview),i.login().done(i.refresh)),"cheatin"===e&&i.cheatin()})},login:function(){var t,n,i,a=this;return this._login||(t=J.Deferred(),this._login=t.promise(),n=new Y.Messenger({channel:"login",url:Y.settings.url.login}),i=J("<iframe />",{src:Y.settings.url.login,title:Y.l10n.loginIframeTitle}).appendTo(this.container),n.targetWindow(i[0].contentWindow),n.bind("login",function(){var e=a.refreshNonces();e.always(function(){i.remove(),n.destroy(),delete a._login}),e.done(function(){t.resolve()}),e.fail(function(){a.cheatin(),t.reject()})})),this._login},cheatin:function(){J(document.body).empty().addClass("cheatin").append("<h1>"+Y.l10n.notAllowedHeading+"</h1><p>"+Y.l10n.notAllowed+"</p>")},refreshNonces:function(){var e,t=J.Deferred();return t.promise(),(e=wp.ajax.post("customize_refresh_nonces",{wp_customize:"on",customize_theme:Y.settings.theme.stylesheet})).done(function(e){Y.trigger("nonce-refresh",e),t.resolve()}),e.fail(function(){t.reject()}),t}}),Y.settingConstructor={},Y.controlConstructor={color:Y.ColorControl,media:Y.MediaControl,upload:Y.UploadControl,image:Y.ImageControl,cropped_image:Y.CroppedImageControl,site_icon:Y.SiteIconControl,header:Y.HeaderControl,background:Y.BackgroundControl,background_position:Y.BackgroundPositionControl,theme:Y.ThemeControl,date_time:Y.DateTimeControl,code_editor:Y.CodeEditorControl},Y.panelConstructor={themes:Y.ThemesPanel},Y.sectionConstructor={themes:Y.ThemesSection,outer:Y.OuterSection},Y._handleSettingValidities=function(e){var o=[],n=!1;_.each(e.settingValidities,function(t,e){var a=Y(e);a&&(_.isObject(t)&&_.each(t,function(e,t){var n=!1,e=new Y.Notification(t,_.extend({fromServer:!0},e)),i=a.notifications(e.code);(n=i?e.type!==i.type||e.message!==i.message||!_.isEqual(e.data,i.data):n)&&a.notifications.remove(t),a.notifications.has(e.code)||a.notifications.add(e),o.push(a.id)}),a.notifications.each(function(e){!e.fromServer||"error"!==e.type||!0!==t&&t[e.code]||a.notifications.remove(e.code)}))}),e.focusInvalidControl&&(e=Y.findControlsForSettings(o),_(_.values(e)).find(function(e){return _(e).find(function(e){var t=e.section()&&Y.section.has(e.section())&&Y.section(e.section()).expanded();return(t=t&&e.expanded?e.expanded():t)&&(e.focus(),n=!0),n})}),n||_.isEmpty(e)||_.values(e)[0][0].focus())},Y.findControlsForSettings=function(e){var n,i={};return _.each(_.unique(e),function(e){var t=Y(e);t&&(n=t.findControls())&&0<n.length&&(i[e]=n)}),i},Y.reflowPaneContents=_.bind(function(){var i,e,t,a=[],o=!1;document.activeElement&&(e=J(document.activeElement)),Y.panel.each(function(e){var t,n;"themes"===e.id||(t=e.sections(),n=_.pluck(t,"headContainer"),a.push(e),i=e.contentContainer.is("ul")?e.contentContainer:e.contentContainer.find("ul:first"),Y.utils.areElementListsEqual(n,i.children("[id]")))||(_(t).each(function(e){i.append(e.headContainer)}),o=!0)}),Y.section.each(function(e){var t=e.controls(),n=_.pluck(t,"container");e.panel()||a.push(e),i=e.contentContainer.is("ul")?e.contentContainer:e.contentContainer.find("ul:first"),Y.utils.areElementListsEqual(n,i.children("[id]"))||(_(t).each(function(e){i.append(e.container)}),o=!0)}),a.sort(Y.utils.prioritySort),t=_.pluck(a,"headContainer"),i=J("#customize-theme-controls .customize-pane-parent"),Y.utils.areElementListsEqual(t,i.children())||(_(a).each(function(e){i.append(e.headContainer)}),o=!0),Y.panel.each(function(e){var t=e.active();e.active.callbacks.fireWith(e.active,[t,t])}),Y.section.each(function(e){var t=e.active();e.active.callbacks.fireWith(e.active,[t,t])}),o&&e&&e.trigger("focus"),Y.trigger("pane-contents-reflowed")},Y),Y.state=new Y.Values,_.each(["saved","saving","trashing","activated","processing","paneVisible","expandedPanel","expandedSection","changesetDate","selectedChangesetDate","changesetStatus","selectedChangesetStatus","remainingTimeToPublish","previewerAlive","editShortcutVisibility","changesetLocked","previewedDevice"],function(e){Y.state.create(e)}),J(function(){var h,o,t,n,i,d,u,p,a,s,r,c,l,f,m,H,L,g,v,w,b,M,O,C,j,y,e,x,k,z,S,T,E,R,B,W,D,N,P,I,U,A;function F(e){e&&e.lockUser&&(Y.settings.changeset.lockUser=e.lockUser),Y.state("changesetLocked").set(!0),Y.notifications.add(new j("changeset_locked",{lockUser:Y.settings.changeset.lockUser,allowOverride:Boolean(e&&e.allowOverride)}))}function q(){var e,t=document.createElement("a");return t.href=location.href,e=Y.utils.parseQueryString(t.search.substr(1)),Y.settings.changeset.latestAutoDraftUuid?e.changeset_uuid=Y.settings.changeset.latestAutoDraftUuid:e.customize_autosaved="on",e.return=Y.settings.url.return,t.search=J.param(e),t.href}function Q(){T||(wp.ajax.post("customize_dismiss_autosave_or_lock",{wp_customize:"on",customize_theme:Y.settings.theme.stylesheet,customize_changeset_uuid:Y.settings.changeset.uuid,nonce:Y.settings.nonce.dismiss_autosave_or_lock,dismiss_autosave:!0}),T=!0)}function K(){var e;return Y.state("activated").get()?(""!==(e=Y.state("changesetStatus").get())&&"auto-draft"!==e||(e="publish"),Y.state("selectedChangesetStatus").get()===e&&("future"!==Y.state("selectedChangesetStatus").get()||Y.state("selectedChangesetDate").get()===Y.state("changesetDate").get())&&Y.state("saved").get()&&"auto-draft"!==Y.state("changesetStatus").get()):0===Y._latestRevision}function V(){Y.unbind("change",V),Y.state("selectedChangesetStatus").unbind(V),Y.state("selectedChangesetDate").unbind(V),J(window).on("beforeunload.customize-confirm",function(){if(!K()&&!Y.state("changesetLocked").get())return setTimeout(function(){t.removeClass("customize-loading")},1),Y.l10n.saveAlert})}function $(){var e=J.Deferred(),t=!1,n=!1;return K()?n=!0:confirm(Y.l10n.saveAlert)?(n=!0,Y.each(function(e){e._dirty=!1}),J(document).off("visibilitychange.wp-customize-changeset-update"),J(window).off("beforeunload.wp-customize-changeset-update"),i.css("cursor","progress"),""!==Y.state("changesetStatus").get()&&(t=!0)):e.reject(),(n||t)&&wp.ajax.send("customize_dismiss_autosave_or_lock",{timeout:500,data:{wp_customize:"on",customize_theme:Y.settings.theme.stylesheet,customize_changeset_uuid:Y.settings.changeset.uuid,nonce:Y.settings.nonce.dismiss_autosave_or_lock,dismiss_autosave:t,dismiss_lock:n}}).always(function(){e.resolve()}),e.promise()}Y.settings=window._wpCustomizeSettings,Y.l10n=window._wpCustomizeControlsL10n,Y.settings&&J.support.postMessage&&(J.support.cors||!Y.settings.isCrossDomain)&&(null===Y.PreviewFrame.prototype.sensitivity&&(Y.PreviewFrame.prototype.sensitivity=Y.settings.timeouts.previewFrameSensitivity),null===Y.Previewer.prototype.refreshBuffer&&(Y.Previewer.prototype.refreshBuffer=Y.settings.timeouts.windowRefresh),o=J(document.body),t=o.children(".wp-full-overlay"),n=J("#customize-info .panel-title.site-title"),i=J(".customize-controls-close"),d=J("#save"),u=J("#customize-save-button-wrapper"),p=J("#publish-settings"),a=J("#customize-footer-actions"),Y.bind("ready",function(){Y.section.add(new Y.OuterSection("publish_settings",{title:Y.l10n.publishSettings,priority:0,active:Y.settings.theme.active}))}),Y.section("publish_settings",function(t){var e,n,i,a,o,s,r;function c(){r=r||Y.utils.highlightButton(u,{delay:1e3,focusTarget:d})}function l(){r&&(r(),r=null)}e=new Y.Control("trash_changeset",{type:"button",section:t.id,priority:30,input_attrs:{class:"button-link button-link-delete",value:Y.l10n.discardChanges}}),Y.control.add(e),e.deferred.embedded.done(function(){e.container.find(".button-link").on("click",function(){confirm(Y.l10n.trashConfirm)&&wp.customize.previewer.trash()})}),Y.control.add(new Y.PreviewLinkControl("changeset_preview_link",{section:t.id,priority:100})),t.active.validate=n=function(){return!!Y.state("activated").get()&&!(Y.state("trashing").get()||"trash"===Y.state("changesetStatus").get()||""===Y.state("changesetStatus").get()&&Y.state("saved").get())},s=function(){t.active.set(n())},Y.state("activated").bind(s),Y.state("trashing").bind(s),Y.state("saved").bind(s),Y.state("changesetStatus").bind(s),s(),(s=function(){p.toggle(t.active.get()),d.toggleClass("has-next-sibling",t.active.get())})(),t.active.bind(s),Y.state("selectedChangesetStatus").bind(l),t.contentContainer.find(".customize-action").text(Y.l10n.updating),t.contentContainer.find(".customize-section-back").removeAttr("tabindex"),p.prop("disabled",!1),p.on("click",function(e){e.preventDefault(),t.expanded.set(!t.expanded.get())}),t.expanded.bind(function(e){p.attr("aria-expanded",String(e)),p.toggleClass("active",e),e?l():(""!==(e=Y.state("changesetStatus").get())&&"auto-draft"!==e||(e="publish"),(Y.state("selectedChangesetStatus").get()!==e||"future"===Y.state("selectedChangesetStatus").get()&&Y.state("selectedChangesetDate").get()!==Y.state("changesetDate").get())&&c())}),s=new Y.Control("changeset_status",{priority:10,type:"radio",section:"publish_settings",setting:Y.state("selectedChangesetStatus"),templateId:"customize-selected-changeset-status-control",label:Y.l10n.action,choices:Y.settings.changeset.statusChoices}),Y.control.add(s),(i=new Y.DateTimeControl("changeset_scheduled_date",{priority:20,section:"publish_settings",setting:Y.state("selectedChangesetDate"),minYear:(new Date).getFullYear(),allowPastDate:!1,includeTime:!0,twelveHourFormat:/a/i.test(Y.settings.timeFormat),description:Y.l10n.scheduleDescription})).notifications.alt=!0,Y.control.add(i),a=function(){Y.state("selectedChangesetStatus").set("publish"),Y.previewer.save()},s=function(){var e="future"===Y.state("changesetStatus").get()&&"future"===Y.state("selectedChangesetStatus").get()&&Y.state("changesetDate").get()&&Y.state("selectedChangesetDate").get()===Y.state("changesetDate").get()&&0<=Y.utils.getRemainingTime(Y.state("changesetDate").get());e&&!o?o=setInterval(function(){var e=Y.utils.getRemainingTime(Y.state("changesetDate").get());Y.state("remainingTimeToPublish").set(e),e<=0&&(clearInterval(o),o=0,a())},1e3):!e&&o&&(clearInterval(o),o=0)},Y.state("changesetDate").bind(s),Y.state("selectedChangesetDate").bind(s),Y.state("changesetStatus").bind(s),Y.state("selectedChangesetStatus").bind(s),s(),i.active.validate=function(){return"future"===Y.state("selectedChangesetStatus").get()},(s=function(e){i.active.set("future"===e)})(Y.state("selectedChangesetStatus").get()),Y.state("selectedChangesetStatus").bind(s),Y.state("saving").bind(function(e){e&&"future"===Y.state("selectedChangesetStatus").get()&&i.toggleFutureDateNotification(!i.isFutureDate())})}),J("#customize-controls").on("keydown",function(e){var t=13===e.which,n=J(e.target);t&&(n.is("input:not([type=button])")||n.is("select"))&&e.preventDefault()}),J(".customize-info").find("> .accordion-section-title .customize-help-toggle").on("click",function(){var e=J(this).closest(".accordion-section"),t=e.find(".customize-panel-description:first");e.hasClass("cannot-expand")||(e.hasClass("open")?(e.toggleClass("open"),t.slideUp(Y.Panel.prototype.defaultExpandedArguments.duration,function(){t.trigger("toggled")}),J(this).attr("aria-expanded",!1)):(t.slideDown(Y.Panel.prototype.defaultExpandedArguments.duration,function(){t.trigger("toggled")}),e.toggleClass("open"),J(this).attr("aria-expanded",!0)))}),Y.previewer=new Y.Previewer({container:"#customize-preview",form:"#customize-controls",previewUrl:Y.settings.url.preview,allowedUrls:Y.settings.url.allowed},{nonce:Y.settings.nonce,query:function(e){var t={wp_customize:"on",customize_theme:Y.settings.theme.stylesheet,nonce:this.nonce.preview,customize_changeset_uuid:Y.settings.changeset.uuid};return!Y.settings.changeset.autosaved&&Y.state("saved").get()||(t.customize_autosaved="on"),t.customized=JSON.stringify(Y.dirtyValues({unsaved:e&&e.excludeCustomizedSaved})),t},save:function(i){var e,t,a=this,o=J.Deferred(),s=Y.state("selectedChangesetStatus").get(),r=Y.state("selectedChangesetDate").get(),n=Y.state("processing"),c={},l=[],d=[],u=[];function p(e){c[e.id]=!0}return i&&i.status&&(s=i.status),Y.state("saving").get()&&(o.reject("already_saving"),o.promise()),Y.state("saving").set(!0),t=function(){var n={},t=Y._latestRevision,e="client_side_error";if(Y.bind("change",p),Y.notifications.remove(e),Y.each(function(t){t.notifications.each(function(e){"error"!==e.type||e.fromServer||(l.push(t.id),n[t.id]||(n[t.id]={}),n[t.id][e.code]=e)})}),Y.control.each(function(t){t.setting&&(t.setting.id||!t.active.get())||t.notifications.each(function(e){"error"===e.type&&u.push([t])})}),d=_.union(u,_.values(Y.findControlsForSettings(l))),!_.isEmpty(d))return d[0][0].focus(),Y.unbind("change",p),l.length&&Y.notifications.add(new Y.Notification(e,{message:(1===l.length?Y.l10n.saveBlockedError.singular:Y.l10n.saveBlockedError.plural).replace(/%s/g,String(l.length)),type:"error",dismissible:!0,saveFailure:!0})),o.rejectWith(a,[{setting_invalidities:n}]),Y.state("saving").set(!1),o.promise();e=J.extend(a.query({excludeCustomizedSaved:!1}),{nonce:a.nonce.save,customize_changeset_status:s}),i&&i.date?e.customize_changeset_date=i.date:"future"===s&&r&&(e.customize_changeset_date=r),i&&i.title&&(e.customize_changeset_title=i.title),Y.trigger("save-request-params",e),e=wp.ajax.post("customize_save",e),Y.state("processing").set(Y.state("processing").get()+1),Y.trigger("save",e),e.always(function(){Y.state("processing").set(Y.state("processing").get()-1),Y.state("saving").set(!1),Y.unbind("change",p)}),Y.notifications.each(function(e){e.saveFailure&&Y.notifications.remove(e.code)}),e.fail(function(e){var t,n={type:"error",dismissible:!0,fromServer:!0,saveFailure:!0};"0"===e?e="not_logged_in":"-1"===e&&(e="invalid_nonce"),"invalid_nonce"===e?a.cheatin():"not_logged_in"===e?(a.preview.iframe.hide(),a.login().done(function(){a.save(),a.preview.iframe.show()})):e.code?"not_future_date"===e.code&&Y.section.has("publish_settings")&&Y.section("publish_settings").active.get()&&Y.control.has("changeset_scheduled_date")?Y.control("changeset_scheduled_date").toggleFutureDateNotification(!0).focus():"changeset_locked"!==e.code&&(t=new Y.Notification(e.code,_.extend(n,{message:e.message}))):t=new Y.Notification("unknown_error",_.extend(n,{message:Y.l10n.unknownRequestFail})),t&&Y.notifications.add(t),e.setting_validities&&Y._handleSettingValidities({settingValidities:e.setting_validities,focusInvalidControl:!0}),o.rejectWith(a,[e]),Y.trigger("error",e),"changeset_already_published"===e.code&&e.next_changeset_uuid&&(Y.settings.changeset.uuid=e.next_changeset_uuid,Y.state("changesetStatus").set(""),Y.settings.changeset.branching&&h.send("changeset-uuid",Y.settings.changeset.uuid),Y.previewer.send("changeset-uuid",Y.settings.changeset.uuid))}),e.done(function(e){a.send("saved",e),Y.state("changesetStatus").set(e.changeset_status),e.changeset_date&&Y.state("changesetDate").set(e.changeset_date),"publish"===e.changeset_status&&(Y.each(function(e){e._dirty&&(_.isUndefined(Y._latestSettingRevisions[e.id])||Y._latestSettingRevisions[e.id]<=t)&&(e._dirty=!1)}),Y.state("changesetStatus").set(""),Y.settings.changeset.uuid=e.next_changeset_uuid,Y.settings.changeset.branching)&&h.send("changeset-uuid",Y.settings.changeset.uuid),Y._lastSavedRevision=Math.max(t,Y._lastSavedRevision),e.setting_validities&&Y._handleSettingValidities({settingValidities:e.setting_validities,focusInvalidControl:!0}),o.resolveWith(a,[e]),Y.trigger("saved",e),_.isEmpty(c)||Y.state("saved").set(!1)})},0===n()?t():(e=function(){0===n()&&(Y.state.unbind("change",e),t())},Y.state.bind("change",e)),o.promise()},trash:function(){var e,n,i;Y.state("trashing").set(!0),Y.state("processing").set(Y.state("processing").get()+1),e=wp.ajax.post("customize_trash",{customize_changeset_uuid:Y.settings.changeset.uuid,nonce:Y.settings.nonce.trash}),Y.notifications.add(new Y.OverlayNotification("changeset_trashing",{type:"info",message:Y.l10n.revertingChanges,loading:!0})),n=function(){var e,t=document.createElement("a");Y.state("changesetStatus").set("trash"),Y.each(function(e){e._dirty=!1}),Y.state("saved").set(!0),t.href=location.href,delete(e=Y.utils.parseQueryString(t.search.substr(1))).changeset_uuid,e.return=Y.settings.url.return,t.search=J.param(e),location.replace(t.href)},i=function(e,t){e=e||"unknown_error";Y.state("processing").set(Y.state("processing").get()-1),Y.state("trashing").set(!1),Y.notifications.remove("changeset_trashing"),Y.notifications.add(new Y.Notification(e,{message:t||Y.l10n.unknownError,dismissible:!0,type:"error"}))},e.done(function(e){n(e.message)}),e.fail(function(e){var t=e.code||"trashing_failed";e.success||"non_existent_changeset"===t||"changeset_already_trashed"===t?n(e.message):i(t,e.message)})},getFrontendPreviewUrl:function(){var e,t=document.createElement("a");return t.href=this.previewUrl.get(),e=Y.utils.parseQueryString(t.search.substr(1)),Y.state("changesetStatus").get()&&"publish"!==Y.state("changesetStatus").get()&&(e.customize_changeset_uuid=Y.settings.changeset.uuid),Y.state("activated").get()||(e.customize_theme=Y.settings.theme.stylesheet),t.search=J.param(e),t.href}}),J.ajaxPrefilter(function(e){/wp_customize=on/.test(e.data)&&(e.data+="&"+J.param({customize_preview_nonce:Y.settings.nonce.preview}))}),Y.previewer.bind("nonce",function(e){J.extend(this.nonce,e)}),Y.bind("nonce-refresh",function(e){J.extend(Y.settings.nonce,e),J.extend(Y.previewer.nonce,e),Y.previewer.send("nonce-refresh",e)}),J.each(Y.settings.settings,function(e,t){var n=Y.settingConstructor[t.type]||Y.Setting;Y.add(new n(e,t.value,{transport:t.transport,previewer:Y.previewer,dirty:!!t.dirty}))}),J.each(Y.settings.panels,function(e,t){var n=Y.panelConstructor[t.type]||Y.Panel,t=_.extend({params:t},t);Y.panel.add(new n(e,t))}),J.each(Y.settings.sections,function(e,t){var n=Y.sectionConstructor[t.type]||Y.Section,t=_.extend({params:t},t);Y.section.add(new n(e,t))}),J.each(Y.settings.controls,function(e,t){var n=Y.controlConstructor[t.type]||Y.Control,t=_.extend({params:t},t);Y.control.add(new n(e,t))}),_.each(["panel","section","control"],function(e){var t=Y.settings.autofocus[e];t&&Y[e](t,function(e){e.deferred.embedded.done(function(){Y.previewer.deferred.active.done(function(){e.focus()})})})}),Y.bind("ready",Y.reflowPaneContents),J([Y.panel,Y.section,Y.control]).each(function(e,t){var n=_.debounce(Y.reflowPaneContents,Y.settings.timeouts.reflowPaneContents);t.bind("add",n),t.bind("change",n),t.bind("remove",n)}),Y.bind("ready",function(){var e,t,n;Y.notifications.container=J("#customize-notifications-area"),Y.notifications.bind("change",_.debounce(function(){Y.notifications.render()})),e=J(".wp-full-overlay-sidebar-content"),Y.notifications.bind("rendered",function(){e.css("top",""),0!==Y.notifications.count()&&(t=Y.notifications.container.outerHeight()+1,n=parseInt(e.css("top"),10),e.css("top",n+t+"px")),Y.notifications.trigger("sidebarTopUpdated")}),Y.notifications.render()}),s=Y.state,c=s.instance("saved"),l=s.instance("saving"),f=s.instance("trashing"),m=s.instance("activated"),e=s.instance("processing"),I=s.instance("paneVisible"),H=s.instance("expandedPanel"),L=s.instance("expandedSection"),g=s.instance("changesetStatus"),v=s.instance("selectedChangesetStatus"),w=s.instance("changesetDate"),b=s.instance("selectedChangesetDate"),M=s.instance("previewerAlive"),O=s.instance("editShortcutVisibility"),C=s.instance("changesetLocked"),s.bind("change",function(){var e;m()?""===g.get()&&c()?(Y.settings.changeset.currentUserCanPublish?d.val(Y.l10n.published):d.val(Y.l10n.saved),i.find(".screen-reader-text").text(Y.l10n.close)):("draft"===v()?c()&&v()===g()?d.val(Y.l10n.draftSaved):d.val(Y.l10n.saveDraft):"future"===v()?!c()||v()!==g()||w.get()!==b.get()?d.val(Y.l10n.schedule):d.val(Y.l10n.scheduled):Y.settings.changeset.currentUserCanPublish&&d.val(Y.l10n.publish),i.find(".screen-reader-text").text(Y.l10n.cancel)):(d.val(Y.l10n.activate),i.find(".screen-reader-text").text(Y.l10n.cancel)),e=!l()&&!f()&&!C()&&(!m()||!c()||g()!==v()&&""!==g()||"future"===v()&&w.get()!==b.get()),d.prop("disabled",!e)}),v.validate=function(e){return""===e||"auto-draft"===e?null:e},S=Y.settings.changeset.currentUserCanPublish?"publish":"draft",g(Y.settings.changeset.status),C(Boolean(Y.settings.changeset.lockUser)),w(Y.settings.changeset.publishDate),b(Y.settings.changeset.publishDate),v(""===Y.settings.changeset.status||"auto-draft"===Y.settings.changeset.status?S:Y.settings.changeset.status),v.link(g),c(!0),""===g()&&Y.each(function(e){e._dirty&&c(!1)}),l(!1),m(Y.settings.theme.active),e(0),I(!0),H(!1),L(!1),M(!0),O("visible"),Y.bind("change",function(){s("saved").get()&&s("saved").set(!1)}),Y.settings.changeset.branching&&c.bind(function(e){e||r(!0)}),l.bind(function(e){o.toggleClass("saving",e)}),f.bind(function(e){o.toggleClass("trashing",e)}),Y.bind("saved",function(e){s("saved").set(!0),"publish"===e.changeset_status&&s("activated").set(!0)}),m.bind(function(e){e&&Y.trigger("activated")}),r=function(e){var t,n;if(history.replaceState){if((t=document.createElement("a")).href=location.href,n=Y.utils.parseQueryString(t.search.substr(1)),e){if(n.changeset_uuid===Y.settings.changeset.uuid)return;n.changeset_uuid=Y.settings.changeset.uuid}else{if(!n.changeset_uuid)return;delete n.changeset_uuid}t.search=J.param(n),history.replaceState({},document.title,t.href)}},Y.settings.changeset.branching&&g.bind(function(e){r(""!==e&&"publish"!==e&&"trash"!==e)}),j=Y.OverlayNotification.extend({templateId:"customize-changeset-locked-notification",lockUser:null,initialize:function(e,t){e=e||"changeset_locked",t=_.extend({message:"",type:"warning",containerClasses:"",lockUser:{}},t);t.containerClasses+=" notification-changeset-locked",Y.OverlayNotification.prototype.initialize.call(this,e,t)},render:function(){var t,n,i=this,e=_.extend({allowOverride:!1,returnUrl:Y.settings.url.return,previewUrl:Y.previewer.previewUrl.get(),frontendPreviewUrl:Y.previewer.getFrontendPreviewUrl()},this),a=Y.OverlayNotification.prototype.render.call(e);return Y.requestChangesetUpdate({},{autosave:!0}).fail(function(e){e.autosaved||a.find(".notice-error").prop("hidden",!1).text(e.message||Y.l10n.unknownRequestFail)}),(t=a.find(".customize-notice-take-over-button")).on("click",function(e){e.preventDefault(),n||(t.addClass("disabled"),(n=wp.ajax.post("customize_override_changeset_lock",{wp_customize:"on",customize_theme:Y.settings.theme.stylesheet,customize_changeset_uuid:Y.settings.changeset.uuid,nonce:Y.settings.nonce.override_lock})).done(function(){Y.notifications.remove(i.code),Y.state("changesetLocked").set(!1)}),n.fail(function(e){e=e.message||Y.l10n.unknownRequestFail;a.find(".notice-error").prop("hidden",!1).text(e),n.always(function(){t.removeClass("disabled")})}),n.always(function(){n=null}))}),a}}),Y.settings.changeset.lockUser&&F({allowOverride:!0}),J(document).on("heartbeat-send.update_lock_notice",function(e,t){t.check_changeset_lock=!0,t.changeset_uuid=Y.settings.changeset.uuid}),J(document).on("heartbeat-tick.update_lock_notice",function(e,t){var n,i="changeset_locked";t.customize_changeset_lock_user&&((n=Y.notifications(i))&&n.lockUser.id!==Y.settings.changeset.lockUser.id&&Y.notifications.remove(i),F({lockUser:t.customize_changeset_lock_user}))}),Y.bind("error",function(e){"changeset_locked"===e.code&&e.lock_user&&F({lockUser:e.lock_user})}),T=!(S=[]),Y.settings.changeset.autosaved&&(Y.state("saved").set(!1),S.push("customize_autosaved")),Y.settings.changeset.branching||Y.settings.changeset.status&&"auto-draft"!==Y.settings.changeset.status||S.push("changeset_uuid"),0<S.length&&(S=S,e=document.createElement("a"),x=0,e.href=location.href,y=Y.utils.parseQueryString(e.search.substr(1)),_.each(S,function(e){void 0!==y[e]&&(x+=1,delete y[e])}),0!==x)&&(e.search=J.param(y),history.replaceState({},document.title,e.href)),(Y.settings.changeset.latestAutoDraftUuid||Y.settings.changeset.hasAutosaveRevision)&&(z="autosave_available",Y.notifications.add(new Y.Notification(z,{message:Y.l10n.autosaveNotice,type:"warning",dismissible:!0,render:function(){var e=Y.Notification.prototype.render.call(this),t=e.find("a");return t.prop("href",q()),t.on("click",function(e){e.preventDefault(),location.replace(q())}),e.find(".notice-dismiss").on("click",Q),e}})),Y.bind("change",k=function(){Q(),Y.notifications.remove(z),Y.unbind("change",k),Y.state("changesetStatus").unbind(k)}),Y.state("changesetStatus").bind(k)),parseInt(J("#customize-info").data("block-theme"),10)&&(S=Y.l10n.blockThemeNotification,Y.notifications.add(new Y.Notification("site_editor_block_theme_notice",{message:S,type:"info",dismissible:!1,render:function(){var e=Y.Notification.prototype.render.call(this),t=e.find("button.switch-to-editor");return t.on("click",function(e){e.preventDefault(),location.assign(t.data("action"))}),e}}))),Y.previewer.previewUrl()?Y.previewer.refresh():Y.previewer.previewUrl(Y.settings.url.home),d.on("click",function(e){Y.previewer.save(),e.preventDefault()}).on("keydown",function(e){9!==e.which&&(13===e.which&&Y.previewer.save(),e.preventDefault())}),i.on("keydown",function(e){9!==e.which&&(13===e.which&&this.click(),e.preventDefault())}),J(".collapse-sidebar").on("click",function(){Y.state("paneVisible").set(!Y.state("paneVisible").get())}),Y.state("paneVisible").bind(function(e){t.toggleClass("preview-only",!e),t.toggleClass("expanded",e),t.toggleClass("collapsed",!e),e?J(".collapse-sidebar").attr({"aria-expanded":"true","aria-label":Y.l10n.collapseSidebar}):J(".collapse-sidebar").attr({"aria-expanded":"false","aria-label":Y.l10n.expandSidebar})}),o.on("keydown",function(e){var t,n=[],i=[],a=[];27===e.which&&(J(e.target).is("body")||J.contains(J("#customize-controls")[0],e.target))&&null===e.target.closest(".block-editor-writing-flow")&&null===e.target.closest(".block-editor-block-list__block-popover")&&(Y.control.each(function(e){e.expanded&&e.expanded()&&_.isFunction(e.collapse)&&n.push(e)}),Y.section.each(function(e){e.expanded()&&i.push(e)}),Y.panel.each(function(e){e.expanded()&&a.push(e)}),0<n.length&&0===i.length&&(n.length=0),t=n[0]||i[0]||a[0])&&("themes"===t.params.type?o.hasClass("modal-open")?t.closeDetails():Y.panel.has("themes")&&Y.panel("themes").collapse():(t.collapse(),e.preventDefault()))}),J(".customize-controls-preview-toggle").on("click",function(){Y.state("paneVisible").set(!Y.state("paneVisible").get())}),P=J(".wp-full-overlay-sidebar-content"),I=function(e){var t=Y.state("expandedSection").get(),n=Y.state("expandedPanel").get();if(D&&D.element&&(R(D.element),D.element.find(".description").off("toggled",E)),!e)if(!t&&n&&n.contentContainer)e=n;else{if(n||!t||!t.contentContainer)return void(D=!1);e=t}(n=e.contentContainer.find(".customize-section-title, .panel-meta").first()).length?((D={instance:e,element:n,parent:n.closest(".customize-pane-child"),height:n.outerHeight()}).element.find(".description").on("toggled",E),t&&B(D.element,D.parent)):D=!1},Y.state("expandedSection").bind(I),Y.state("expandedPanel").bind(I),P.on("scroll",_.throttle(function(){var e,t;D&&(e=P.scrollTop(),t=N?e===N?0:N<e?1:-1:1,N=e,0!==t)&&W(D,e,t)},8)),Y.notifications.bind("sidebarTopUpdated",function(){D&&D.element.hasClass("is-sticky")&&D.element.css("top",P.css("top"))}),R=function(e){e.hasClass("is-sticky")&&e.removeClass("is-sticky").addClass("maybe-sticky is-in-view").css("top",P.scrollTop()+"px")},B=function(e,t){e.hasClass("is-in-view")&&(e.removeClass("maybe-sticky is-in-view").css({width:"",top:""}),t.css("padding-top",""))},E=function(){D.height=D.element.outerHeight()},W=function(e,t,n){var i=e.element,a=e.parent,e=e.height,o=parseInt(i.css("top"),10),s=i.hasClass("maybe-sticky"),r=i.hasClass("is-sticky"),c=i.hasClass("is-in-view");if(-1===n){if(!s&&e<=t)s=!0,i.addClass("maybe-sticky");else if(0===t)return i.removeClass("maybe-sticky is-in-view is-sticky").css({top:"",width:""}),void a.css("padding-top","");c&&!r?t<=o&&i.addClass("is-sticky").css({top:P.css("top"),width:a.outerWidth()+"px"}):s&&!c&&(i.addClass("is-in-view").css("top",t-e+"px"),a.css("padding-top",e+"px"))}else r&&(o=t,i.removeClass("is-sticky").css({top:o+"px",width:""})),c&&o+e<t&&(i.removeClass("is-in-view"),a.css("padding-top",""))},Y.previewedDevice=Y.state("previewedDevice"),Y.bind("ready",function(){_.find(Y.settings.previewableDevices,function(e,t){if(!0===e.default)return Y.previewedDevice.set(t),!0})}),a.find(".devices button").on("click",function(e){Y.previewedDevice.set(J(e.currentTarget).data("device"))}),Y.previewedDevice.bind(function(e){var t=J(".wp-full-overlay"),n="";a.find(".devices button").removeClass("active").attr("aria-pressed",!1),a.find(".devices .preview-"+e).addClass("active").attr("aria-pressed",!0),J.each(Y.settings.previewableDevices,function(e){n+=" preview-"+e}),t.removeClass(n).addClass("preview-"+e)}),n.length&&Y("blogname",function(t){function e(){var e=t()||"";n.text(e.toString().trim()||Y.l10n.untitledBlogName)}t.bind(e),e()}),h=new Y.Messenger({url:Y.settings.url.parent,channel:"loader"}),U=!1,h.bind("back",function(){U=!0}),Y.bind("change",V),Y.state("selectedChangesetStatus").bind(V),Y.state("selectedChangesetDate").bind(V),h.bind("confirm-close",function(){$().done(function(){h.send("confirmed-close",!0)}).fail(function(){h.send("confirmed-close",!1)})}),i.on("click.customize-controls-close",function(e){e.preventDefault(),U?h.send("close"):$().done(function(){J(window).off("beforeunload.customize-confirm"),window.location.href=i.prop("href")})}),J.each(["saved","change"],function(e,t){Y.bind(t,function(){h.send(t)})}),Y.bind("title",function(e){h.send("title",e)}),Y.settings.changeset.branching&&h.send("changeset-uuid",Y.settings.changeset.uuid),h.send("ready"),J.each({background_image:{controls:["background_preset","background_position","background_size","background_repeat","background_attachment"],callback:function(e){return!!e}},show_on_front:{controls:["page_on_front","page_for_posts"],callback:function(e){return"page"===e}},header_textcolor:{controls:["header_textcolor"],callback:function(e){return"blank"!==e}}},function(e,i){Y(e,function(n){J.each(i.controls,function(e,t){Y.control(t,function(t){function e(e){t.container.toggle(i.callback(e))}e(n.get()),n.bind(e)})})})}),Y.control("background_preset",function(e){var i={default:[!1,!1,!1,!1],fill:[!0,!1,!1,!1],fit:[!0,!1,!0,!1],repeat:[!0,!1,!1,!0],custom:[!0,!0,!0,!0]},a={default:[_wpCustomizeBackground.defaults["default-position-x"],_wpCustomizeBackground.defaults["default-position-y"],_wpCustomizeBackground.defaults["default-size"],_wpCustomizeBackground.defaults["default-repeat"],_wpCustomizeBackground.defaults["default-attachment"]],fill:["left","top","cover","no-repeat","fixed"],fit:["left","top","contain","no-repeat","fixed"],repeat:["left","top","auto","repeat","scroll"]},t=function(n){_.each(["background_position","background_size","background_repeat","background_attachment"],function(e,t){e=Y.control(e);e&&e.container.toggle(i[n][t])})},n=function(n){_.each(["background_position_x","background_position_y","background_size","background_repeat","background_attachment"],function(e,t){e=Y(e);e&&e.set(a[n][t])})},o=e.setting.get();t(o),e.setting.bind("change",function(e){t(e),"custom"!==e&&n(e)})}),Y.control("background_repeat",function(t){t.elements[0].unsync(Y("background_repeat")),t.element=new Y.Element(t.container.find("input")),t.element.set("no-repeat"!==t.setting()),t.element.bind(function(e){t.setting.set(e?"repeat":"no-repeat")}),t.setting.bind(function(e){t.element.set("no-repeat"!==e)})}),Y.control("background_attachment",function(t){t.elements[0].unsync(Y("background_attachment")),t.element=new Y.Element(t.container.find("input")),t.element.set("fixed"!==t.setting()),t.element.bind(function(e){t.setting.set(e?"scroll":"fixed")}),t.setting.bind(function(e){t.element.set("fixed"!==e)})}),Y.control("display_header_text",function(t){var n="";t.elements[0].unsync(Y("header_textcolor")),t.element=new Y.Element(t.container.find("input")),t.element.set("blank"!==t.setting()),t.element.bind(function(e){e||(n=Y("header_textcolor").get()),t.setting.set(e?n:"blank")}),t.setting.bind(function(e){t.element.set("blank"!==e)})}),Y("show_on_front","page_on_front","page_for_posts",function(i,a,o){function e(){var e="show_on_front_page_collision",t=parseInt(a(),10),n=parseInt(o(),10);"page"===i()&&(this===a&&0<t&&Y.previewer.previewUrl.set(Y.settings.url.home),this===o)&&0<n&&Y.previewer.previewUrl.set(Y.settings.url.home+"?page_id="+n),"page"===i()&&t&&n&&t===n?i.notifications.add(new Y.Notification(e,{type:"error",message:Y.l10n.pageOnFrontError})):i.notifications.remove(e)}i.bind(e),a.bind(e),o.bind(e),e.call(i,i()),Y.control("show_on_front",function(e){e.deferred.embedded.done(function(){e.container.append(e.getNotificationsContainerElement())})})}),A=J.Deferred(),Y.section("custom_css",function(t){t.deferred.embedded.done(function(){t.expanded()?A.resolve(t):t.expanded.bind(function(e){e&&A.resolve(t)})})}),A.done(function(e){var t=Y.control("custom_css");t.container.find(".customize-control-title:first").addClass("screen-reader-text"),e.container.find(".section-description-buttons .section-description-close").on("click",function(){e.container.find(".section-meta .customize-section-description:first").removeClass("open").slideUp(),e.container.find(".customize-help-toggle").attr("aria-expanded","false").focus()}),t&&!t.setting.get()&&(e.container.find(".section-meta .customize-section-description:first").addClass("open").show().trigger("toggled"),e.container.find(".customize-help-toggle").attr("aria-expanded","true"))}),Y.control("header_video",function(n){n.deferred.embedded.done(function(){function e(){var e=Y.section(n.section()),t="video_header_not_available";e&&(n.active.get()?e.notifications.remove(t):e.notifications.add(new Y.Notification(t,{type:"info",message:Y.l10n.videoHeaderNotice})))}e(),n.active.bind(e)})}),Y.previewer.bind("selective-refresh-setting-validities",function(e){Y._handleSettingValidities({settingValidities:e,focusInvalidControl:!1})}),Y.previewer.bind("focus-control-for-setting",function(n){var i=[];Y.control.each(function(e){var t=_.pluck(e.settings,"id");-1!==_.indexOf(t,n)&&i.push(e)}),i.length&&(i.sort(function(e,t){return e.priority()-t.priority()}),i[0].focus())}),Y.previewer.bind("refresh",function(){Y.previewer.refresh()}),Y.state("paneVisible").bind(function(e){var t=window.matchMedia?window.matchMedia("screen and ( max-width: 640px )").matches:J(window).width()<=640;Y.state("editShortcutVisibility").set(e||t?"visible":"hidden")}),window.matchMedia&&window.matchMedia("screen and ( max-width: 640px )").addListener(function(){var e=Y.state("paneVisible");e.callbacks.fireWith(e,[e.get(),e.get()])}),Y.previewer.bind("edit-shortcut-visibility",function(e){Y.state("editShortcutVisibility").set(e)}),Y.state("editShortcutVisibility").bind(function(e){Y.previewer.send("edit-shortcut-visibility",e)}),Y.bind("change",function e(){var t,n,i,a=!1;function o(e){e||Y.settings.changeset.autosaved||(Y.settings.changeset.autosaved=!0,Y.previewer.send("autosaving"))}Y.unbind("change",e),Y.state("saved").bind(o),o(Y.state("saved").get()),n=function(){a||(a=!0,Y.requestChangesetUpdate({},{autosave:!0}).always(function(){a=!1})),i()},(i=function(){clearTimeout(t),t=setTimeout(function(){n()},Y.settings.timeouts.changesetAutoSave)})(),J(document).on("visibilitychange.wp-customize-changeset-update",function(){document.hidden&&n()}),J(window).on("beforeunload.wp-customize-changeset-update",function(){n()})}),J(document).one("tinymce-editor-setup",function(){window.tinymce.ui.FloatPanel&&(!window.tinymce.ui.FloatPanel.zIndex||window.tinymce.ui.FloatPanel.zIndex<500001)&&(window.tinymce.ui.FloatPanel.zIndex=500001)}),o.addClass("ready"),Y.trigger("ready"))})}((wp,jQuery)); \ No newline at end of file
diff --git a/wp-admin/js/customize-nav-menus.js b/wp-admin/js/customize-nav-menus.js
index 8930f15..9dad3e1 100644
--- a/wp-admin/js/customize-nav-menus.js
+++ b/wp-admin/js/customize-nav-menus.js
@@ -1664,6 +1664,8 @@
$reorderNav = control.container.find( '.menu-item-reorder-nav' );
$reorderNav.find( '.menus-move-up, .menus-move-down, .menus-move-left, .menus-move-right' ).on( 'click', function() {
var moveBtn = $( this );
+ control.params.depth = control.getDepth();
+
moveBtn.focus();
var isMoveUp = moveBtn.is( '.menus-move-up' ),
@@ -1677,8 +1679,19 @@
control.moveDown();
} else if ( isMoveLeft ) {
control.moveLeft();
+ if ( 1 === control.params.depth ) {
+ control.container.find( '.is-submenu' ).hide();
+ } else {
+ control.container.find( '.is-submenu' ).show();
+ }
} else if ( isMoveRight ) {
control.moveRight();
+ control.params.depth += 1;
+ if ( 0 === control.params.depth ) {
+ control.container.find( '.is-submenu' ).hide();
+ } else {
+ control.container.find( '.is-submenu' ).show();
+ }
}
moveBtn.focus(); // Re-focus after the container was moved.
diff --git a/wp-admin/js/customize-nav-menus.min.js b/wp-admin/js/customize-nav-menus.min.js
index bf20d50..56d54b3 100644
--- a/wp-admin/js/customize-nav-menus.min.js
+++ b/wp-admin/js/customize-nav-menus.min.js
@@ -1,2 +1,2 @@
/*! This file is auto-generated */
-!function(c,l,m){"use strict";function u(e){return(e=(e=l.sanitize.stripTagsAndEncodeText(e=e||"")).toString().trim())||c.Menus.data.l10n.unnamed}wpNavMenu.originalInit=wpNavMenu.init,wpNavMenu.options.menuItemDepthPerLevel=20,wpNavMenu.options.sortableItems="> .customize-control-nav_menu_item",wpNavMenu.options.targetTolerance=10,wpNavMenu.init=function(){this.jQueryExtensions()},c.Menus=c.Menus||{},c.Menus.data={itemTypes:[],l10n:{},settingTransport:"refresh",phpIntMax:0,defaultSettingValues:{nav_menu:{},nav_menu_item:{}},locationSlugMappedToName:{}},"undefined"!=typeof _wpCustomizeNavMenusSettings&&m.extend(c.Menus.data,_wpCustomizeNavMenusSettings),c.Menus.generatePlaceholderAutoIncrementId=function(){return-Math.ceil(c.Menus.data.phpIntMax*Math.random())},c.Menus.AvailableItemModel=Backbone.Model.extend(m.extend({id:null},c.Menus.data.defaultSettingValues.nav_menu_item)),c.Menus.AvailableItemCollection=Backbone.Collection.extend({model:c.Menus.AvailableItemModel,sort_key:"order",comparator:function(e){return-e.get(this.sort_key)},sortByField:function(e){this.sort_key=e,this.sort()}}),c.Menus.availableMenuItems=new c.Menus.AvailableItemCollection(c.Menus.data.availableMenuItems),c.Menus.insertAutoDraftPost=function(n){var i=m.Deferred(),e=l.ajax.post("customize-nav-menus-insert-auto-draft",{"customize-menus-nonce":c.settings.nonce["customize-menus"],wp_customize:"on",customize_changeset_uuid:c.settings.changeset.uuid,params:n});return e.done(function(t){t.post_id&&(c("nav_menus_created_posts").set(c("nav_menus_created_posts").get().concat([t.post_id])),"page"===n.post_type&&(c.section.has("static_front_page")&&c.section("static_front_page").activate(),c.control.each(function(e){"dropdown-pages"===e.params.type&&e.container.find('select[name^="_customize-dropdown-pages-"]').append(new Option(n.post_title,t.post_id))})),i.resolve(t))}),e.fail(function(e){var t=e||"";void 0!==e.message&&(t=e.message),console.error(t),i.rejectWith(t)}),i.promise()},c.Menus.AvailableMenuItemsPanelView=l.Backbone.View.extend({el:"#available-menu-items",events:{"input #menu-items-search":"debounceSearch","focus .menu-item-tpl":"focus","click .menu-item-tpl":"_submit","click #custom-menu-item-submit":"_submitLink","keypress #custom-menu-item-name":"_submitLink","click .new-content-item .add-content":"_submitNew","keypress .create-item-input":"_submitNew",keydown:"keyboardAccessible"},selected:null,currentMenuControl:null,debounceSearch:null,$search:null,$clearResults:null,searchTerm:"",rendered:!1,pages:{},sectionContent:"",loading:!1,addingNew:!1,initialize:function(){var n=this;c.panel.has("nav_menus")&&(this.$search=m("#menu-items-search"),this.$clearResults=this.$el.find(".clear-results"),this.sectionContent=this.$el.find(".available-menu-items-list"),this.debounceSearch=_.debounce(n.search,500),_.bindAll(this,"close"),m("#customize-controls, .customize-section-back").on("click keydown",function(e){var t=m(e.target).is(".item-delete, .item-delete *"),e=m(e.target).is(".add-new-menu-item, .add-new-menu-item *");!m("body").hasClass("adding-menu-items")||t||e||n.close()}),this.$clearResults.on("click",function(){n.$search.val("").trigger("focus").trigger("input")}),this.$el.on("input","#custom-menu-item-name.invalid, #custom-menu-item-url.invalid",function(){m(this).removeClass("invalid")}),c.panel("nav_menus").container.on("expanded",function(){n.rendered||(n.initList(),n.rendered=!0)}),this.sectionContent.on("scroll",function(){var e=n.$el.find(".accordion-section.open .available-menu-items-list").prop("scrollHeight"),t=n.$el.find(".accordion-section.open").height();!n.loading&&m(this).scrollTop()>.75*e-t&&(e=m(this).data("type"),t=m(this).data("object"),"search"===e?n.searchTerm&&n.doSearch(n.pages.search):n.loadItems([{type:e,object:t}]))}),c.previewer.bind("url",this.close),n.delegateEvents())},search:function(e){var t=m("#available-menu-items-search"),n=m("#available-menu-items .accordion-section").not(t);e&&this.searchTerm!==e.target.value&&(""===e.target.value||t.hasClass("open")?""===e.target.value&&(t.removeClass("open"),n.show(),this.$clearResults.removeClass("is-visible")):(n.fadeOut(100),t.find(".accordion-section-content").slideDown("fast"),t.addClass("open"),this.$clearResults.addClass("is-visible")),this.searchTerm=e.target.value,this.pages.search=1,this.doSearch(1))},doSearch:function(t){var e,n=this,i=m("#available-menu-items-search"),a=i.find(".accordion-section-content"),o=l.template("available-menu-item");if(n.currentRequest&&n.currentRequest.abort(),!(t<0)){if(1<t)i.addClass("loading-more"),a.attr("aria-busy","true"),l.a11y.speak(c.Menus.data.l10n.itemsLoadingMore);else if(""===n.searchTerm)return a.html(""),void l.a11y.speak("");i.addClass("loading"),n.loading=!0,e=c.previewer.query({excludeCustomizedSaved:!0}),_.extend(e,{"customize-menus-nonce":c.settings.nonce["customize-menus"],wp_customize:"on",search:n.searchTerm,page:t}),n.currentRequest=l.ajax.post("search-available-menu-items-customizer",e),n.currentRequest.done(function(e){1===t&&a.empty(),i.removeClass("loading loading-more"),a.attr("aria-busy","false"),i.addClass("open"),n.loading=!1,e=new c.Menus.AvailableItemCollection(e.items),n.collection.add(e.models),e.each(function(e){a.append(o(e.attributes))}),e.length<20?n.pages.search=-1:n.pages.search=n.pages.search+1,e&&1<t?l.a11y.speak(c.Menus.data.l10n.itemsFoundMore.replace("%d",e.length)):e&&1===t&&l.a11y.speak(c.Menus.data.l10n.itemsFound.replace("%d",e.length))}),n.currentRequest.fail(function(e){e.message&&(a.empty().append(m('<li class="nothing-found"></li>').text(e.message)),l.a11y.speak(e.message)),n.pages.search=-1}),n.currentRequest.always(function(){i.removeClass("loading loading-more"),a.attr("aria-busy","false"),n.loading=!1,n.currentRequest=null})}},initList:function(){var t=this;_.each(c.Menus.data.itemTypes,function(e){t.pages[e.type+":"+e.object]=0}),t.loadItems(c.Menus.data.itemTypes)},loadItems:function(e,t){var i=this,a=[],o={},s=l.template("available-menu-item"),t=_.isString(e)&&_.isString(t)?[{type:e,object:t}]:e;_.each(t,function(e){var t,n=e.type+":"+e.object;-1!==i.pages[n]&&((t=m("#available-menu-items-"+e.type+"-"+e.object)).find(".accordion-section-title").addClass("loading"),o[n]=t,a.push({object:e.object,type:e.type,page:i.pages[n]}))}),0!==a.length&&(i.loading=!0,e=c.previewer.query({excludeCustomizedSaved:!0}),_.extend(e,{"customize-menus-nonce":c.settings.nonce["customize-menus"],wp_customize:"on",item_types:a}),(t=l.ajax.post("load-available-menu-items-customizer",e)).done(function(e){var n;_.each(e.items,function(e,t){0===e.length?(0===i.pages[t]&&o[t].find(".accordion-section-title").addClass("cannot-expand").removeClass("loading").find(".accordion-section-title > button").prop("tabIndex",-1),i.pages[t]=-1):("post_type:page"!==t||o[t].hasClass("open")||o[t].find(".accordion-section-title > button").trigger("click"),e=new c.Menus.AvailableItemCollection(e),i.collection.add(e.models),n=o[t].find(".available-menu-items-list"),e.each(function(e){n.append(s(e.attributes))}),i.pages[t]+=1)})}),t.fail(function(e){"undefined"!=typeof console&&console.error&&console.error(e)}),t.always(function(){_.each(o,function(e){e.find(".accordion-section-title").removeClass("loading")}),i.loading=!1}))},itemSectionHeight:function(){var e=window.innerHeight,t=this.$el.find(".accordion-section:not( #available-menu-items-search ) .accordion-section-content"),n=this.$el.find('.accordion-section:not( #available-menu-items-search ) .available-menu-items-list:not(":only-child")'),e=e-(46*(1+t.length)+14);120<e&&e<290&&(t.css("max-height",e),n.css("max-height",e-60))},select:function(e){this.selected=m(e),this.selected.siblings(".menu-item-tpl").removeClass("selected"),this.selected.addClass("selected")},focus:function(e){this.select(m(e.currentTarget))},_submit:function(e){"keypress"===e.type&&13!==e.which&&32!==e.which||this.submit(m(e.currentTarget))},submit:function(e){var t;(e=e||this.selected)&&this.currentMenuControl&&(this.select(e),t=m(this.selected).data("menu-item-id"),t=this.collection.findWhere({id:t}))&&(this.currentMenuControl.addItemToMenu(t.attributes),m(e).find(".menu-item-handle").addClass("item-added"))},_submitLink:function(e){"keypress"===e.type&&13!==e.which||this.submitLink()},submitLink:function(){var e,t=m("#custom-menu-item-name"),n=m("#custom-menu-item-url"),i=n.val().trim();this.currentMenuControl&&(e=/^((\w+:)?\/\/\w.*|\w+:(?!\/\/$)|\/|\?|#)/,""===t.val()?t.addClass("invalid"):e.test(i)?(e={title:t.val(),url:i,type:"custom",type_label:c.Menus.data.l10n.custom_label,object:"custom"},this.currentMenuControl.addItemToMenu(e),n.val("").attr("placeholder","https://"),t.val("")):n.addClass("invalid"))},_submitNew:function(e){"keypress"===e.type&&13!==e.which||this.addingNew||(e=m(e.target).closest(".accordion-section"),this.submitNew(e))},submitNew:function(n){var i=this,a=n.find(".create-item-input"),e=a.val(),t=n.find(".available-menu-items-list"),o=t.data("type"),s=t.data("object"),r=t.data("type_label");this.currentMenuControl&&"post_type"===o&&(""===a.val().trim()?(a.addClass("invalid"),a.focus()):(a.removeClass("invalid"),n.find(".accordion-section-title").addClass("loading"),i.addingNew=!0,a.attr("disabled","disabled"),c.Menus.insertAutoDraftPost({post_title:e,post_type:s}).done(function(e){var t,e=new c.Menus.AvailableItemModel({id:"post-"+e.post_id,title:a.val(),type:o,type_label:r,object:s,object_id:e.post_id,url:e.url});i.currentMenuControl.addItemToMenu(e.attributes),c.Menus.availableMenuItemsPanel.collection.add(e),t=n.find(".available-menu-items-list"),(e=m(l.template("available-menu-item")(e.attributes))).find(".menu-item-handle:first").addClass("item-added"),t.prepend(e),t.scrollTop(),a.val("").removeAttr("disabled"),i.addingNew=!1,n.find(".accordion-section-title").removeClass("loading")})))},open:function(e){var t,n=this;this.currentMenuControl=e,this.itemSectionHeight(),c.section.has("publish_settings")&&c.section("publish_settings").collapse(),m("body").addClass("adding-menu-items"),t=function(){n.close(),m(this).off("click",t)},m("#customize-preview").on("click",t),_(this.currentMenuControl.getMenuItemControls()).each(function(e){e.collapseForm()}),this.$el.find(".selected").removeClass("selected"),this.$search.trigger("focus")},close:function(e){(e=e||{}).returnFocus&&this.currentMenuControl&&this.currentMenuControl.container.find(".add-new-menu-item").focus(),this.currentMenuControl=null,this.selected=null,m("body").removeClass("adding-menu-items"),m("#available-menu-items .menu-item-handle.item-added").removeClass("item-added"),this.$search.val("").trigger("input")},keyboardAccessible:function(e){var t=13===e.which,n=27===e.which,i=9===e.which&&e.shiftKey,a=m(e.target).is(this.$search);t&&!this.$search.val()||(a&&i?(this.currentMenuControl.container.find(".add-new-menu-item").focus(),e.preventDefault()):n&&this.close({returnFocus:!0}))}}),c.Menus.MenusPanel=c.Panel.extend({attachEvents:function(){c.Panel.prototype.attachEvents.call(this);var t=this.container.find(".panel-meta"),n=t.find(".customize-help-toggle"),i=t.find(".customize-panel-description"),a=m("#screen-options-wrap"),o=t.find(".customize-screen-options-toggle");o.on("click keydown",function(e){if(!c.utils.isKeydownButNotEnterEvent(e))return e.preventDefault(),i.not(":hidden")&&(i.slideUp("fast"),n.attr("aria-expanded","false")),"true"===o.attr("aria-expanded")?(o.attr("aria-expanded","false"),t.removeClass("open"),t.removeClass("active-menu-screen-options"),a.slideUp("fast")):(o.attr("aria-expanded","true"),t.addClass("open"),t.addClass("active-menu-screen-options"),a.slideDown("fast")),!1}),n.on("click keydown",function(e){c.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),"true"===o.attr("aria-expanded")&&(o.attr("aria-expanded","false"),n.attr("aria-expanded","true"),t.addClass("open"),t.removeClass("active-menu-screen-options"),a.slideUp("fast"),i.slideDown("fast")))})},ready:function(){var e=this;e.container.find(".hide-column-tog").on("click",function(){e.saveManageColumnsState()}),c.section("menu_locations",function(e){e.headContainer.prepend(l.template("nav-menu-locations-header")(c.Menus.data))})},saveManageColumnsState:_.debounce(function(){var e=this;e._updateHiddenColumnsRequest&&e._updateHiddenColumnsRequest.abort(),e._updateHiddenColumnsRequest=l.ajax.post("hidden-columns",{hidden:e.hidden(),screenoptionnonce:m("#screenoptionnonce").val(),page:"nav-menus"}),e._updateHiddenColumnsRequest.always(function(){e._updateHiddenColumnsRequest=null})},2e3),checked:function(){},unchecked:function(){},hidden:function(){return m(".hide-column-tog").not(":checked").map(function(){var e=this.id;return e.substring(0,e.length-5)}).get().join(",")}}),c.Menus.MenuSection=c.Section.extend({initialize:function(e,t){c.Section.prototype.initialize.call(this,e,t),this.deferred.initSortables=m.Deferred()},ready:function(){var e,t,n=this;if(void 0===n.params.menu_id)throw new Error("params.menu_id was not defined");n.active.validate=function(){return!!c.has(n.id)&&!!c(n.id).get()},n.populateControls(),n.navMenuLocationSettings={},n.assignedLocations=new c.Value([]),c.each(function(e,t){t=t.match(/^nav_menu_locations\[(.+?)]/);t&&(n.navMenuLocationSettings[t[1]]=e).bind(function(){n.refreshAssignedLocations()})}),n.assignedLocations.bind(function(e){n.updateAssignedLocationsInSectionTitle(e)}),n.refreshAssignedLocations(),c.bind("pane-contents-reflowed",function(){n.contentContainer.parent().length&&(n.container.find(".menu-item .menu-item-reorder-nav button").attr({tabindex:"0","aria-hidden":"false"}),n.container.find(".menu-item.move-up-disabled .menus-move-up").attr({tabindex:"-1","aria-hidden":"true"}),n.container.find(".menu-item.move-down-disabled .menus-move-down").attr({tabindex:"-1","aria-hidden":"true"}),n.container.find(".menu-item.move-left-disabled .menus-move-left").attr({tabindex:"-1","aria-hidden":"true"}),n.container.find(".menu-item.move-right-disabled .menus-move-right").attr({tabindex:"-1","aria-hidden":"true"}))}),t=function(){var e="field-"+m(this).val()+"-active";n.contentContainer.toggleClass(e,m(this).prop("checked"))},(e=c.panel("nav_menus").contentContainer.find(".metabox-prefs:first").find(".hide-column-tog")).each(t),e.on("click",t)},populateControls:function(){var e,t=this,n=t.id+"[name]",i=c.control(n);i||(i=new c.controlConstructor.nav_menu_name(n,{type:"nav_menu_name",label:c.Menus.data.l10n.menuNameLabel,section:t.id,priority:0,settings:{default:t.id}}),c.control.add(i),i.active.set(!0)),(n=c.control(t.id))||(n=new c.controlConstructor.nav_menu(t.id,{type:"nav_menu",section:t.id,priority:998,settings:{default:t.id},menu_id:t.params.menu_id}),c.control.add(n),n.active.set(!0)),i=t.id+"[locations]",c.control(i)||(i=new c.controlConstructor.nav_menu_locations(i,{section:t.id,priority:999,settings:{default:t.id},menu_id:t.params.menu_id}),c.control.add(i.id,i),n.active.set(!0)),i=t.id+"[auto_add]",(n=c.control(i))||(n=new c.controlConstructor.nav_menu_auto_add(i,{type:"nav_menu_auto_add",label:"",section:t.id,priority:1e3,settings:{default:t.id}}),c.control.add(n),n.active.set(!0)),i=t.id+"[delete]",(e=c.control(i))||(e=new c.Control(i,{section:t.id,priority:1001,templateId:"nav-menu-delete-button"}),c.control.add(e.id,e),e.active.set(!0),e.deferred.embedded.done(function(){e.container.find("button").on("click",function(){var e=t.params.menu_id;c.Menus.getMenuControl(e).setting.set(!1)})}))},refreshAssignedLocations:function(){var n=this.params.menu_id,i=[];_.each(this.navMenuLocationSettings,function(e,t){e()===n&&i.push(t)}),this.assignedLocations.set(i)},updateAssignedLocationsInSectionTitle:function(e){var n=this.container.find(".accordion-section-title:first");n.find(".menu-in-location").remove(),_.each(e,function(e){var t=m('<span class="menu-in-location"></span>'),e=c.Menus.data.locationSlugMappedToName[e];t.text(c.Menus.data.l10n.menuLocation.replace("%s",e)),n.append(t)}),this.container.toggleClass("assigned-to-menu-location",0!==e.length)},onChangeExpanded:function(e,t){var n,i=this;e&&(wpNavMenu.menuList=i.contentContainer,wpNavMenu.targetList=wpNavMenu.menuList,m("#menu-to-edit").removeAttr("id"),wpNavMenu.menuList.attr("id","menu-to-edit").addClass("menu"),_.each(c.section(i.id).controls(),function(e){"nav_menu_item"===e.params.type&&e.actuallyEmbed()}),t.completeCallback&&(n=t.completeCallback),t.completeCallback=function(){"resolved"!==i.deferred.initSortables.state()&&(wpNavMenu.initSortables(),i.deferred.initSortables.resolve(wpNavMenu.menuList),c.control("nav_menu["+String(i.params.menu_id)+"]").reflowMenuItems()),_.isFunction(n)&&n()}),c.Section.prototype.onChangeExpanded.call(i,e,t)},highlightNewItemButton:function(){c.utils.highlightButton(this.contentContainer.find(".add-new-menu-item"),{delay:2e3})}}),c.Menus.createNavMenu=function(e){var t=c.Menus.generatePlaceholderAutoIncrementId(),n="nav_menu["+String(t)+"]";return c.create(n,n,{},{type:"nav_menu",transport:c.Menus.data.settingTransport,previewer:c.previewer}).set(m.extend({},c.Menus.data.defaultSettingValues.nav_menu,{name:e||""})),c.section.add(new c.Menus.MenuSection(n,{panel:"nav_menus",title:u(e),customizeAction:c.Menus.data.l10n.customizingMenus,priority:10,menu_id:t}))},c.Menus.NewMenuSection=c.Section.extend({attachEvents:function(){var t=this,e=t.container,n=t.contentContainer,i=/^nav_menu\[/;function a(){var t;e.find(".add-new-menu-notice").prop("hidden",(t=0,c.each(function(e){i.test(e.id)&&!1!==e.get()&&(t+=1)}),0<t))}function o(e){i.test(e.id)&&(e.bind(a),a())}t.headContainer.find(".accordion-section-title").replaceWith(l.template("nav-menu-create-menu-section-title")),e.on("click",".customize-add-menu-button",function(){t.expand()}),n.on("keydown",".menu-name-field",function(e){13===e.which&&t.submit()}),n.on("click","#customize-new-menu-submit",function(e){t.submit(),e.stopPropagation(),e.preventDefault()}),c.each(o),c.bind("add",o),c.bind("removed",function(e){i.test(e.id)&&(e.unbind(a),a())}),a(),c.Section.prototype.attachEvents.apply(t,arguments)},ready:function(){this.populateControls()},populateControls:function(){var e=this,t=e.id+"[name]",n=c.control(t);n||(n=new c.controlConstructor.nav_menu_name(t,{label:c.Menus.data.l10n.menuNameLabel,description:c.Menus.data.l10n.newMenuNameDescription,section:e.id,priority:0}),c.control.add(n.id,n),n.active.set(!0)),t=e.id+"[locations]",(n=c.control(t))||(n=new c.controlConstructor.nav_menu_locations(t,{section:e.id,priority:1,menu_id:"",isCreating:!0}),c.control.add(t,n),n.active.set(!0)),t=e.id+"[submit]",(n=c.control(t))||(n=new c.Control(t,{section:e.id,priority:1,templateId:"nav-menu-submit-new-button"}),c.control.add(t,n),n.active.set(!0))},submit:function(){var t,e=this.contentContainer,n=e.find(".menu-name-field").first(),i=n.val();i?(t=c.Menus.createNavMenu(i),n.val(""),n.removeClass("invalid"),e.find(".assigned-menu-location input[type=checkbox]").each(function(){var e=m(this);e.prop("checked")&&(c("nav_menu_locations["+e.data("location-id")+"]").set(t.params.menu_id),e.prop("checked",!1))}),l.a11y.speak(c.Menus.data.l10n.menuAdded),t.focus({completeCallback:function(){t.highlightNewItemButton()}})):(n.addClass("invalid"),n.focus())},selectDefaultLocation:function(e){var t=c.control(this.id+"[locations]"),n={};null!==e&&(n[e]=!0),t.setSelections(n)}}),c.Menus.MenuLocationControl=c.Control.extend({initialize:function(e,t){var n=e.match(/^nav_menu_locations\[(.+?)]/);this.themeLocation=n[1],c.Control.prototype.initialize.call(this,e,t)},ready:function(){var n=this,i=/^nav_menu\[(-?\d+)]/;n.setting.validate=function(e){return""===e?0:parseInt(e,10)},n.container.find(".create-menu").on("click",function(){var e=c.section("add_menu");e.selectDefaultLocation(this.dataset.locationId),e.focus()}),n.container.find(".edit-menu").on("click",function(){var e=n.setting();c.section("nav_menu["+e+"]").focus()}),n.setting.bind("change",function(){var e=0!==n.setting();n.container.find(".create-menu").toggleClass("hidden",e),n.container.find(".edit-menu").toggleClass("hidden",!e)}),c.bind("add",function(e){var t=e.id.match(i);t&&!1!==e()&&(t=t[1],e=new Option(u(e().name),t),n.container.find("select").append(e))}),c.bind("remove",function(e){var e=e.id.match(i);e&&(e=parseInt(e[1],10),n.setting()===e&&n.setting.set(""),n.container.find("option[value="+e+"]").remove())}),c.bind("change",function(e){var t=e.id.match(i);t&&(t=parseInt(t[1],10),!1===e()?(n.setting()===t&&n.setting.set(""),n.container.find("option[value="+t+"]").remove()):n.container.find("option[value="+t+"]").text(u(e().name)))})}}),c.Menus.MenuItemControl=c.Control.extend({initialize:function(e,t){var n=this;n.expanded=new c.Value(!1),n.expandedArgumentsQueue=[],n.expanded.bind(function(e){var t=n.expandedArgumentsQueue.shift(),t=m.extend({},n.defaultExpandedArguments,t);n.onChangeExpanded(e,t)}),c.Control.prototype.initialize.call(n,e,t),n.active.validate=function(){var e=c.section(n.section()),e=!!e&&e.active();return e}},embed:function(){var e=this.section();e&&((e=c.section(e))&&e.expanded()||c.settings.autofocus.control===this.id)&&this.actuallyEmbed()},actuallyEmbed:function(){"resolved"!==this.deferred.embedded.state()&&(this.renderContent(),this.deferred.embedded.resolve())},ready:function(){if(void 0===this.params.menu_item_id)throw new Error("params.menu_item_id was not defined");this._setupControlToggle(),this._setupReorderUI(),this._setupUpdateUI(),this._setupRemoveUI(),this._setupLinksUI(),this._setupTitleUI()},_setupControlToggle:function(){var i=this;this.container.find(".menu-item-handle").on("click",function(e){e.preventDefault(),e.stopPropagation();var t=i.getMenuControl(),n=m(e.target).is(".item-delete, .item-delete *"),e=m(e.target).is(".add-new-menu-item, .add-new-menu-item *");!m("body").hasClass("adding-menu-items")||n||e||c.Menus.availableMenuItemsPanel.close(),t.isReordering||t.isSorting||i.toggleForm()})},_setupReorderUI:function(){var o=this,e=l.template("menu-item-reorder-nav");o.container.find(".item-controls").after(e),o.container.find(".menu-item-reorder-nav").find(".menus-move-up, .menus-move-down, .menus-move-left, .menus-move-right").on("click",function(){var e=m(this),t=(e.focus(),e.is(".menus-move-up")),n=e.is(".menus-move-down"),i=e.is(".menus-move-left"),a=e.is(".menus-move-right");t?o.moveUp():n?o.moveDown():i?o.moveLeft():a&&o.moveRight(),e.focus()})},_setupUpdateUI:function(){var e,s=this,t=s.setting();s.elements={},s.elements.url=new c.Element(s.container.find(".edit-menu-item-url")),s.elements.title=new c.Element(s.container.find(".edit-menu-item-title")),s.elements.attr_title=new c.Element(s.container.find(".edit-menu-item-attr-title")),s.elements.target=new c.Element(s.container.find(".edit-menu-item-target")),s.elements.classes=new c.Element(s.container.find(".edit-menu-item-classes")),s.elements.xfn=new c.Element(s.container.find(".edit-menu-item-xfn")),s.elements.description=new c.Element(s.container.find(".edit-menu-item-description")),_.each(s.elements,function(n,i){n.bind(function(e){n.element.is("input[type=checkbox]")&&(e=e?n.element.val():"");var t=s.setting();t&&t[i]!==e&&((t=_.clone(t))[i]=e,s.setting.set(t))}),t&&("classes"!==i&&"xfn"!==i||!_.isArray(t[i])?n.set(t[i]):n.set(t[i].join(" ")))}),s.setting.bind(function(n,i){var e,t=s.params.menu_item_id,a=[],o=[];!1===n?(e=c.control("nav_menu["+String(i.nav_menu_term_id)+"]"),s.container.remove(),_.each(e.getMenuItemControls(),function(e){i.menu_item_parent===e.setting().menu_item_parent&&e.setting().position>i.position?a.push(e):e.setting().menu_item_parent===t&&o.push(e)}),_.each(a,function(e){var t=_.clone(e.setting());t.position+=o.length,e.setting.set(t)}),_.each(o,function(e,t){var n=_.clone(e.setting());n.position=i.position+t,n.menu_item_parent=i.menu_item_parent,e.setting.set(n)}),e.debouncedReflowMenuItems()):(_.each(n,function(e,t){s.elements[t]&&s.elements[t].set(n[t])}),s.container.find(".menu-item-data-parent-id").val(n.menu_item_parent),n.position===i.position&&n.menu_item_parent===i.menu_item_parent||s.getMenuControl().debouncedReflowMenuItems())}),s.setting.notifications.bind("add",e=function(){s.elements.url.element.toggleClass("invalid",s.setting.notifications.has("invalid_url"))}),s.setting.notifications.bind("removed",e)},_setupRemoveUI:function(){var r=this;r.container.find(".item-delete").on("click",function(){var e,t,n,i=!0,a=0,o=r.params.original_item_id,s=r.getMenuControl().$sectionContent.find(".menu-item");m("body").hasClass("adding-menu-items")||(i=!1),n=r.container.nextAll(".customize-control-nav_menu_item:visible").first(),t=r.container.prevAll(".customize-control-nav_menu_item:visible").first(),e=(n.length?n.find(!1===i?".item-edit":".item-delete"):t.length?t.find(!1===i?".item-edit":".item-delete"):r.container.nextAll(".customize-control-nav_menu").find(".add-new-menu-item")).first(),_.each(s,function(e){m(e).is(":visible")&&(e=e.getAttribute("id").match(/^customize-control-nav_menu_item-(-?\d+)$/,""))&&(e=parseInt(e[1],10),e=c.control("nav_menu_item["+String(e)+"]"))&&o==e.params.original_item_id&&a++}),a<=1&&((n=m("#menu-item-tpl-"+r.params.original_item_id)).removeClass("selected"),n.find(".menu-item-handle").removeClass("item-added")),r.container.slideUp(function(){r.setting.set(!1),l.a11y.speak(c.Menus.data.l10n.itemDeleted),e.focus()}),r.setting.set(!1)})},_setupLinksUI:function(){this.container.find("a.original-link").on("click",function(e){e.preventDefault(),c.previewer.previewUrl(e.target.toString())})},_setupTitleUI:function(){var i;this.container.find(".edit-menu-item-title").on("blur",function(){m(this).val(m(this).val().trim())}),i=this.container.find(".menu-item-title"),this.setting.bind(function(e){var t,n;e&&(e.title=e.title||"",n=(t=e.title.trim())||e.original_title||c.Menus.data.l10n.untitled,e._invalid&&(n=c.Menus.data.l10n.invalidTitleTpl.replace("%s",n)),t||e.original_title?i.text(n).removeClass("no-title"):i.text(n).addClass("no-title"))})},getDepth:function(){var e=this,t=e.setting(),n=0;if(!t)return 0;for(;t&&t.menu_item_parent&&(n+=1,e=c.control("nav_menu_item["+t.menu_item_parent+"]"));)t=e.setting();return n},renderContent:function(){var e,t=this,n=t.setting();t.params.title=n.title||"",t.params.depth=t.getDepth(),t.container.data("item-depth",t.params.depth),e=["menu-item","menu-item-depth-"+String(t.params.depth),"menu-item-"+n.object,"menu-item-edit-inactive"],n._invalid?(e.push("menu-item-invalid"),t.params.title=c.Menus.data.l10n.invalidTitleTpl.replace("%s",t.params.title)):"draft"===n.status&&(e.push("pending"),t.params.title=c.Menus.data.pendingTitleTpl.replace("%s",t.params.title)),t.params.el_classes=e.join(" "),t.params.item_type_label=n.type_label,t.params.item_type=n.type,t.params.url=n.url,t.params.target=n.target,t.params.attr_title=n.attr_title,t.params.classes=_.isArray(n.classes)?n.classes.join(" "):n.classes,t.params.xfn=n.xfn,t.params.description=n.description,t.params.parent=n.menu_item_parent,t.params.original_title=n.original_title||"",t.container.addClass(t.params.el_classes),c.Control.prototype.renderContent.call(t)},getMenuControl:function(){var e=this.setting();return e&&e.nav_menu_term_id?c.control("nav_menu["+e.nav_menu_term_id+"]"):null},expandControlSection:function(){var e=this.container.closest(".accordion-section");e.hasClass("open")||e.find(".accordion-section-title:first").trigger("click")},_toggleExpanded:c.Section.prototype._toggleExpanded,expand:c.Section.prototype.expand,expandForm:function(e){this.expand(e)},collapse:c.Section.prototype.collapse,collapseForm:function(e){this.collapse(e)},toggleForm:function(e,t){(e=void 0===e?!this.expanded():e)?this.expand(t):this.collapse(t)},onChangeExpanded:function(e,t){var n,i=this,a=this.container,o=a.find(".menu-item-settings:first");void 0===e&&(e=!o.is(":visible")),o.is(":visible")===e?t&&t.completeCallback&&t.completeCallback():e?(c.control.each(function(e){i.params.type===e.params.type&&i!==e&&e.collapseForm()}),n=function(){a.removeClass("menu-item-edit-inactive").addClass("menu-item-edit-active"),i.container.trigger("expanded"),t&&t.completeCallback&&t.completeCallback()},a.find(".item-edit").attr("aria-expanded","true"),o.slideDown("fast",n),i.container.trigger("expand")):(n=function(){a.addClass("menu-item-edit-inactive").removeClass("menu-item-edit-active"),i.container.trigger("collapsed"),t&&t.completeCallback&&t.completeCallback()},i.container.trigger("collapse"),a.find(".item-edit").attr("aria-expanded","false"),o.slideUp("fast",n))},focus:function(e){var t=this,n=(e=e||{}).completeCallback,i=function(){t.expandControlSection(),e.completeCallback=function(){t.container.find(".menu-item-settings").find("input, select, textarea, button, object, a[href], [tabindex]").filter(":visible").first().focus(),n&&n()},t.expandForm(e)};c.section.has(t.section())?c.section(t.section()).expand({completeCallback:i}):i()},moveUp:function(){this._changePosition(-1),l.a11y.speak(c.Menus.data.l10n.movedUp)},moveDown:function(){this._changePosition(1),l.a11y.speak(c.Menus.data.l10n.movedDown)},moveLeft:function(){this._changeDepth(-1),l.a11y.speak(c.Menus.data.l10n.movedLeft)},moveRight:function(){this._changeDepth(1),l.a11y.speak(c.Menus.data.l10n.movedRight)},_changePosition:function(e){var t,n=this,i=_.clone(n.setting()),a=[];if(1!==e&&-1!==e)throw new Error("Offset changes by 1 are only supported.");if(n.setting()){if(_(n.getMenuControl().getMenuItemControls()).each(function(e){e.setting().menu_item_parent===i.menu_item_parent&&a.push(e.setting)}),a.sort(function(e,t){return e().position-t().position}),-1===(t=_.indexOf(a,n.setting)))throw new Error("Expected setting to be among siblings.");0===t&&e<0||t===a.length-1&&0<e||((t=a[t+e])&&t.set(m.extend(_.clone(t()),{position:i.position})),i.position+=e,n.setting.set(i))}},_changeDepth:function(e){if(1!==e&&-1!==e)throw new Error("Offset changes by 1 are only supported.");var t,n,i=this,a=_.clone(i.setting()),o=[];if(_(i.getMenuControl().getMenuItemControls()).each(function(e){e.setting().menu_item_parent===a.menu_item_parent&&o.push(e)}),o.sort(function(e,t){return e.setting().position-t.setting().position}),-1===(t=_.indexOf(o,i)))throw new Error("Expected control to be among siblings.");-1===e?a.menu_item_parent&&(n=c.control("nav_menu_item["+a.menu_item_parent+"]"),_(o).chain().slice(t).each(function(e,t){e.setting.set(m.extend({},e.setting(),{menu_item_parent:i.params.menu_item_id,position:t}))}),_(i.getMenuControl().getMenuItemControls()).each(function(e){var t;e.setting().menu_item_parent===n.setting().menu_item_parent&&e.setting().position>n.setting().position&&(t=_.clone(e.setting()),e.setting.set(m.extend(t,{position:t.position+1})))}),a.position=n.setting().position+1,a.menu_item_parent=n.setting().menu_item_parent,i.setting.set(a)):1===e&&0!==t&&(a.menu_item_parent=o[t-1].params.menu_item_id,a.position=0,_(i.getMenuControl().getMenuItemControls()).each(function(e){e.setting().menu_item_parent===a.menu_item_parent&&(a.position=Math.max(a.position,e.setting().position))}),a.position+=1,i.setting.set(a))}}),c.Menus.MenuNameControl=c.Control.extend({ready:function(){var e,n=this;n.setting&&(e=n.setting(),n.nameElement=new c.Element(n.container.find(".menu-name-field")),n.nameElement.bind(function(e){var t=n.setting();t&&t.name!==e&&((t=_.clone(t)).name=e,n.setting.set(t))}),e&&n.nameElement.set(e.name),n.setting.bind(function(e){e&&n.nameElement.set(e.name)}))}}),c.Menus.MenuLocationsControl=c.Control.extend({ready:function(){var d=this;d.container.find(".assigned-menu-location").each(function(){function t(e){var t=c("nav_menu["+String(e)+"]");e&&t&&t()?n.find(".theme-location-set").show().find("span").text(u(t().name)):n.find(".theme-location-set").hide()}var n=m(this),e=n.find("input[type=checkbox]"),i=new c.Element(e),a=c("nav_menu_locations["+e.data("location-id")+"]"),o=""===d.params.menu_id,s=o?_.noop:function(e){i.set(e)},r=o?_.noop:function(e){a.set(e?d.params.menu_id:0)};s(a.get()===d.params.menu_id),e.on("change",function(){r(this.checked)}),a.bind(function(e){s(e===d.params.menu_id),t(e)}),t(a.get())})},setSelections:function(i){this.container.find(".menu-location").each(function(e,t){var n=t.dataset.locationId;t.checked=n in i&&i[n]})}}),c.Menus.MenuAutoAddControl=c.Control.extend({ready:function(){var n=this,e=n.setting();n.active.validate=function(){var e=c.section(n.section()),e=!!e&&e.active();return e},n.autoAddElement=new c.Element(n.container.find("input[type=checkbox].auto_add")),n.autoAddElement.bind(function(e){var t=n.setting();t&&t.name!==e&&((t=_.clone(t)).auto_add=e,n.setting.set(t))}),e&&n.autoAddElement.set(e.auto_add),n.setting.bind(function(e){e&&n.autoAddElement.set(e.auto_add)})}}),c.Menus.MenuControl=c.Control.extend({ready:function(){var t,n,i=this,a=c.section(i.section()),o=i.params.menu_id,e=i.setting();if(void 0===this.params.menu_id)throw new Error("params.menu_id was not defined");i.active.validate=function(){var e=!!a&&a.active();return e},i.$controlSection=a.headContainer,i.$sectionContent=i.container.closest(".accordion-section-content"),this._setupModel(),c.section(i.section(),function(e){e.deferred.initSortables.done(function(e){i._setupSortable(e)})}),this._setupAddition(),this._setupTitle(),e&&(t=u(e.name),c.control.each(function(e){e.extended(c.controlConstructor.widget_form)&&"nav_menu"===e.params.widget_id_base&&(e.container.find(".nav-menu-widget-form-controls:first").show(),e.container.find(".nav-menu-widget-no-menus-message:first").hide(),0===(n=e.container.find("select")).find("option[value="+String(o)+"]").length)&&n.append(new Option(t,o))}),(e=m("#available-widgets-list .widget-tpl:has( input.id_base[ value=nav_menu ] )")).find(".nav-menu-widget-form-controls:first").show(),e.find(".nav-menu-widget-no-menus-message:first").hide(),0===(n=e.find(".widget-inside select:first")).find("option[value="+String(o)+"]").length)&&n.append(new Option(t,o)),_.defer(function(){i.updateInvitationVisibility()})},_setupModel:function(){var n=this,i=n.params.menu_id;n.setting.bind(function(e){var t;!1===e?n._handleDeletion():(t=u(e.name),c.control.each(function(e){e.extended(c.controlConstructor.widget_form)&&"nav_menu"===e.params.widget_id_base&&e.container.find("select").find("option[value="+String(i)+"]").text(t)}))})},_setupSortable:function(e){var a=this;if(!e.is(a.$sectionContent))throw new Error("Unexpected menuList.");e.on("sortstart",function(){a.isSorting=!0}),e.on("sortstop",function(){setTimeout(function(){var e=a.$sectionContent.sortable("toArray"),t=[],n=0,i=10;a.isSorting=!1,a.$sectionContent.scrollLeft(0),_.each(e,function(e){var e=e.match(/^customize-control-nav_menu_item-(-?\d+)$/,"");e&&(e=parseInt(e[1],10),e=c.control("nav_menu_item["+String(e)+"]"))&&t.push(e)}),_.each(t,function(e){var t;!1!==e.setting()&&(t=_.clone(e.setting()),n+=1,i+=1,t.position=n,e.priority(i),t.menu_item_parent=parseInt(e.container.find(".menu-item-data-parent-id").val(),10),t.menu_item_parent||(t.menu_item_parent=0),e.setting.set(t))})})}),a.isReordering=!1,this.container.find(".reorder-toggle").on("click",function(){a.toggleReordering(!a.isReordering)})},_setupAddition:function(){var t=this;this.container.find(".add-new-menu-item").on("click",function(e){t.$sectionContent.hasClass("reordering")||(m("body").hasClass("adding-menu-items")?(m(this).attr("aria-expanded","false"),c.Menus.availableMenuItemsPanel.close(),e.stopPropagation()):(m(this).attr("aria-expanded","true"),c.Menus.availableMenuItemsPanel.open(t)))})},_handleDeletion:function(){var e,n=this.params.menu_id,i=0,t=c.section(this.section()),a=function(){t.container.remove(),c.section.remove(t.id)};t&&t.expanded()?t.collapse({completeCallback:function(){a(),l.a11y.speak(c.Menus.data.l10n.menuDeleted),c.panel("nav_menus").focus()}}):a(),c.each(function(e){/^nav_menu\[/.test(e.id)&&!1!==e()&&(i+=1)}),c.control.each(function(e){var t;e.extended(c.controlConstructor.widget_form)&&"nav_menu"===e.params.widget_id_base&&((t=e.container.find("select")).val()===String(n)&&t.prop("selectedIndex",0).trigger("change"),e.container.find(".nav-menu-widget-form-controls:first").toggle(0!==i),e.container.find(".nav-menu-widget-no-menus-message:first").toggle(0===i),e.container.find("option[value="+String(n)+"]").remove())}),(e=m("#available-widgets-list .widget-tpl:has( input.id_base[ value=nav_menu ] )")).find(".nav-menu-widget-form-controls:first").toggle(0!==i),e.find(".nav-menu-widget-no-menus-message:first").toggle(0===i),e.find("option[value="+String(n)+"]").remove()},_setupTitle:function(){var d=this;d.setting.bind(function(e){var t,n,i,a,o,s,r;e&&(t=c.section(d.section()),n=d.params.menu_id,i=t.headContainer.find(".accordion-section-title"),a=t.contentContainer.find(".customize-section-title h3"),o=t.headContainer.find(".menu-in-location"),s=a.find(".customize-action"),r=u(e.name),i.text(r),o.length&&o.appendTo(i),a.text(r),s.length&&s.prependTo(a),c.control.each(function(e){/^nav_menu_locations\[/.test(e.id)&&e.container.find("option[value="+n+"]").text(r)}),t.contentContainer.find(".customize-control-checkbox input").each(function(){m(this).prop("checked")&&m(".current-menu-location-name-"+m(this).data("location-id")).text(r)}))})},toggleReordering:function(e){var t=this.container.find(".add-new-menu-item"),n=this.container.find(".reorder-toggle"),i=this.$sectionContent.find(".item-title");(e=Boolean(e))!==this.$sectionContent.hasClass("reordering")&&(this.isReordering=e,this.$sectionContent.toggleClass("reordering",e),this.$sectionContent.sortable(this.isReordering?"disable":"enable"),this.isReordering?(t.attr({tabindex:"-1","aria-hidden":"true"}),n.attr("aria-label",c.Menus.data.l10n.reorderLabelOff),l.a11y.speak(c.Menus.data.l10n.reorderModeOn),i.attr("aria-hidden","false")):(t.removeAttr("tabindex aria-hidden"),n.attr("aria-label",c.Menus.data.l10n.reorderLabelOn),l.a11y.speak(c.Menus.data.l10n.reorderModeOff),i.attr("aria-hidden","true")),e)&&_(this.getMenuItemControls()).each(function(e){e.collapseForm()})},getMenuItemControls:function(){var t=[],n=this.params.menu_id;return c.control.each(function(e){"nav_menu_item"===e.params.type&&e.setting()&&n===e.setting().nav_menu_term_id&&t.push(e)}),t},reflowMenuItems:function(){var e=this.getMenuItemControls(),a=function(n){var t=[],i=n.currentParent;_.each(n.menuItemControls,function(e){i===e.setting().menu_item_parent&&t.push(e)}),t.sort(function(e,t){return e.setting().position-t.setting().position}),_.each(t,function(t){n.currentAbsolutePosition+=1,t.priority.set(n.currentAbsolutePosition),t.container.hasClass("menu-item-depth-"+String(n.currentDepth))||(_.each(t.container.prop("className").match(/menu-item-depth-\d+/g),function(e){t.container.removeClass(e)}),t.container.addClass("menu-item-depth-"+String(n.currentDepth))),t.container.data("item-depth",n.currentDepth),n.currentDepth+=1,n.currentParent=t.params.menu_item_id,a(n),--n.currentDepth,n.currentParent=i}),t.length&&(_(t).each(function(e){e.container.removeClass("move-up-disabled move-down-disabled move-left-disabled move-right-disabled"),0===n.currentDepth?e.container.addClass("move-left-disabled"):10===n.currentDepth&&e.container.addClass("move-right-disabled")}),t[0].container.addClass("move-up-disabled").addClass("move-right-disabled").toggleClass("move-down-disabled",1===t.length),t[t.length-1].container.addClass("move-down-disabled").toggleClass("move-up-disabled",1===t.length))};a({menuItemControls:e,currentParent:0,currentDepth:0,currentAbsolutePosition:0}),this.updateInvitationVisibility(e),this.container.find(".reorder-toggle").toggle(1<e.length)},debouncedReflowMenuItems:_.debounce(function(){this.reflowMenuItems.apply(this,arguments)},0),addItemToMenu:function(e){var t,n,i,a=0,o=10,s=e.id||"";return _.each(this.getMenuItemControls(),function(e){!1!==e.setting()&&(o=Math.max(o,e.priority()),0===e.setting().menu_item_parent)&&(a=Math.max(a,e.setting().position))}),a+=1,o+=1,delete(e=m.extend({},c.Menus.data.defaultSettingValues.nav_menu_item,e,{nav_menu_term_id:this.params.menu_id,original_title:e.title,position:a})).id,i=c.Menus.generatePlaceholderAutoIncrementId(),t="nav_menu_item["+String(i)+"]",n={type:"nav_menu_item",transport:c.Menus.data.settingTransport,previewer:c.previewer},(n=c.create(t,t,{},n)).set(e),e=new c.controlConstructor.nav_menu_item(t,{type:"nav_menu_item",section:this.id,priority:o,settings:{default:t},menu_item_id:i,original_item_id:s}),c.control.add(e),n.preview(),this.debouncedReflowMenuItems(),l.a11y.speak(c.Menus.data.l10n.itemAdded),e},updateInvitationVisibility:function(e){e=e||this.getMenuItemControls();this.container.find(".new-menu-item-invitation").toggle(0===e.length)}}),m.extend(c.controlConstructor,{nav_menu_location:c.Menus.MenuLocationControl,nav_menu_item:c.Menus.MenuItemControl,nav_menu:c.Menus.MenuControl,nav_menu_name:c.Menus.MenuNameControl,nav_menu_locations:c.Menus.MenuLocationsControl,nav_menu_auto_add:c.Menus.MenuAutoAddControl}),m.extend(c.panelConstructor,{nav_menus:c.Menus.MenusPanel}),m.extend(c.sectionConstructor,{nav_menu:c.Menus.MenuSection,new_menu:c.Menus.NewMenuSection}),c.bind("ready",function(){c.Menus.availableMenuItemsPanel=new c.Menus.AvailableMenuItemsPanelView({collection:c.Menus.availableMenuItems}),c.bind("saved",function(e){(e.nav_menu_updates||e.nav_menu_item_updates)&&c.Menus.applySavedData(e)}),c.state("changesetStatus").bind(function(e){"publish"===e&&(c("nav_menus_created_posts")._value=[])}),c.previewer.bind("focus-nav-menu-item-control",c.Menus.focusMenuItemControl)}),c.Menus.applySavedData=function(e){var u={},r={};_(e.nav_menu_updates).each(function(n){var e,t,i,a,o,s,r,d;if("inserted"===n.status){if(!n.previous_term_id)throw new Error("Expected previous_term_id");if(!n.term_id)throw new Error("Expected term_id");if(e="nav_menu["+String(n.previous_term_id)+"]",!c.has(e))throw new Error("Expected setting to exist: "+e);if(i=c(e),!c.section.has(e))throw new Error("Expected control to exist: "+e);if(o=c.section(e),!(s=i.get()))throw new Error("Did not expect setting to be empty (deleted).");s=m.extend(_.clone(s),n.saved_value),u[n.previous_term_id]=n.term_id,a="nav_menu["+String(n.term_id)+"]",t=c.create(a,a,s,{type:"nav_menu",transport:c.Menus.data.settingTransport,previewer:c.previewer}),(d=o.expanded())&&o.collapse(),a=new c.Menus.MenuSection(a,{panel:"nav_menus",title:s.name,customizeAction:c.Menus.data.l10n.customizingMenus,type:"nav_menu",priority:o.priority.get(),menu_id:n.term_id}),c.section.add(a),c.control.each(function(e){var t;e.extended(c.controlConstructor.widget_form)&&"nav_menu"===e.params.widget_id_base&&(t=(e=e.container.find("select")).find("option[value="+String(n.previous_term_id)+"]"),e.find("option[value="+String(n.term_id)+"]").prop("selected",t.prop("selected")),t.remove())}),i.callbacks.disable(),i.set(!1),i.preview(),t.preview(),i._dirty=!1,o.container.remove(),c.section.remove(e),r=0,c.each(function(e){/^nav_menu\[/.test(e.id)&&!1!==e()&&(r+=1)}),(s=m("#available-widgets-list .widget-tpl:has( input.id_base[ value=nav_menu ] )")).find(".nav-menu-widget-form-controls:first").toggle(0!==r),s.find(".nav-menu-widget-no-menus-message:first").toggle(0===r),s.find("option[value="+String(n.previous_term_id)+"]").remove(),l.customize.control.each(function(e){/^nav_menu_locations\[/.test(e.id)&&e.container.find("option[value="+String(n.previous_term_id)+"]").remove()}),c.each(function(e){var t=c.state("saved").get();/^nav_menu_locations\[/.test(e.id)&&e.get()===n.previous_term_id&&(e.set(n.term_id),e._dirty=!1,c.state("saved").set(t),e.preview())}),d&&a.expand()}else if("updated"===n.status){if(t="nav_menu["+String(n.term_id)+"]",!c.has(t))throw new Error("Expected setting to exist: "+t);i=c(t),_.isEqual(n.saved_value,i.get())||(o=c.state("saved").get(),i.set(n.saved_value),i._dirty=!1,c.state("saved").set(o))}}),_(e.nav_menu_item_updates).each(function(e){e.previous_post_id&&(r[e.previous_post_id]=e.post_id)}),_(e.nav_menu_item_updates).each(function(e){var t,n,i,a,o,s;if("inserted"===e.status){if(!e.previous_post_id)throw new Error("Expected previous_post_id");if(!e.post_id)throw new Error("Expected post_id");if(t="nav_menu_item["+String(e.previous_post_id)+"]",!c.has(t))throw new Error("Expected setting to exist: "+t);if(i=c(t),!c.control.has(t))throw new Error("Expected control to exist: "+t);if(o=c.control(t),!(s=i.get()))throw new Error("Did not expect setting to be empty (deleted).");if((s=_.clone(s)).menu_item_parent<0){if(!r[s.menu_item_parent])throw new Error("inserted ID for menu_item_parent not available");s.menu_item_parent=r[s.menu_item_parent]}u[s.nav_menu_term_id]&&(s.nav_menu_term_id=u[s.nav_menu_term_id]),n="nav_menu_item["+String(e.post_id)+"]",a=c.create(n,n,s,{type:"nav_menu_item",transport:c.Menus.data.settingTransport,previewer:c.previewer}),s=new c.controlConstructor.nav_menu_item(n,{type:"nav_menu_item",menu_id:e.post_id,section:"nav_menu["+String(s.nav_menu_term_id)+"]",priority:o.priority.get(),settings:{default:n},menu_item_id:e.post_id}),o.container.remove(),c.control.remove(t),c.control.add(s),i.callbacks.disable(),i.set(!1),i.preview(),a.preview(),i._dirty=!1,s.container.toggleClass("menu-item-edit-inactive",o.container.hasClass("menu-item-edit-inactive"))}}),_.each(e.widget_nav_menu_updates,function(e,t){t=c(t);t&&(t._value=e,t.preview())})},c.Menus.focusMenuItemControl=function(e){e=c.Menus.getMenuItemControl(e);e&&e.focus()},c.Menus.getMenuControl=function(e){return c.control("nav_menu["+e+"]")},c.Menus.getMenuItemControl=function(e){return c.control("nav_menu_item["+e+"]")}}(wp.customize,wp,jQuery); \ No newline at end of file
+!function(c,l,m){"use strict";function u(e){return(e=(e=l.sanitize.stripTagsAndEncodeText(e=e||"")).toString().trim())||c.Menus.data.l10n.unnamed}wpNavMenu.originalInit=wpNavMenu.init,wpNavMenu.options.menuItemDepthPerLevel=20,wpNavMenu.options.sortableItems="> .customize-control-nav_menu_item",wpNavMenu.options.targetTolerance=10,wpNavMenu.init=function(){this.jQueryExtensions()},c.Menus=c.Menus||{},c.Menus.data={itemTypes:[],l10n:{},settingTransport:"refresh",phpIntMax:0,defaultSettingValues:{nav_menu:{},nav_menu_item:{}},locationSlugMappedToName:{}},"undefined"!=typeof _wpCustomizeNavMenusSettings&&m.extend(c.Menus.data,_wpCustomizeNavMenusSettings),c.Menus.generatePlaceholderAutoIncrementId=function(){return-Math.ceil(c.Menus.data.phpIntMax*Math.random())},c.Menus.AvailableItemModel=Backbone.Model.extend(m.extend({id:null},c.Menus.data.defaultSettingValues.nav_menu_item)),c.Menus.AvailableItemCollection=Backbone.Collection.extend({model:c.Menus.AvailableItemModel,sort_key:"order",comparator:function(e){return-e.get(this.sort_key)},sortByField:function(e){this.sort_key=e,this.sort()}}),c.Menus.availableMenuItems=new c.Menus.AvailableItemCollection(c.Menus.data.availableMenuItems),c.Menus.insertAutoDraftPost=function(n){var i=m.Deferred(),e=l.ajax.post("customize-nav-menus-insert-auto-draft",{"customize-menus-nonce":c.settings.nonce["customize-menus"],wp_customize:"on",customize_changeset_uuid:c.settings.changeset.uuid,params:n});return e.done(function(t){t.post_id&&(c("nav_menus_created_posts").set(c("nav_menus_created_posts").get().concat([t.post_id])),"page"===n.post_type&&(c.section.has("static_front_page")&&c.section("static_front_page").activate(),c.control.each(function(e){"dropdown-pages"===e.params.type&&e.container.find('select[name^="_customize-dropdown-pages-"]').append(new Option(n.post_title,t.post_id))})),i.resolve(t))}),e.fail(function(e){var t=e||"";void 0!==e.message&&(t=e.message),console.error(t),i.rejectWith(t)}),i.promise()},c.Menus.AvailableMenuItemsPanelView=l.Backbone.View.extend({el:"#available-menu-items",events:{"input #menu-items-search":"debounceSearch","focus .menu-item-tpl":"focus","click .menu-item-tpl":"_submit","click #custom-menu-item-submit":"_submitLink","keypress #custom-menu-item-name":"_submitLink","click .new-content-item .add-content":"_submitNew","keypress .create-item-input":"_submitNew",keydown:"keyboardAccessible"},selected:null,currentMenuControl:null,debounceSearch:null,$search:null,$clearResults:null,searchTerm:"",rendered:!1,pages:{},sectionContent:"",loading:!1,addingNew:!1,initialize:function(){var n=this;c.panel.has("nav_menus")&&(this.$search=m("#menu-items-search"),this.$clearResults=this.$el.find(".clear-results"),this.sectionContent=this.$el.find(".available-menu-items-list"),this.debounceSearch=_.debounce(n.search,500),_.bindAll(this,"close"),m("#customize-controls, .customize-section-back").on("click keydown",function(e){var t=m(e.target).is(".item-delete, .item-delete *"),e=m(e.target).is(".add-new-menu-item, .add-new-menu-item *");!m("body").hasClass("adding-menu-items")||t||e||n.close()}),this.$clearResults.on("click",function(){n.$search.val("").trigger("focus").trigger("input")}),this.$el.on("input","#custom-menu-item-name.invalid, #custom-menu-item-url.invalid",function(){m(this).removeClass("invalid")}),c.panel("nav_menus").container.on("expanded",function(){n.rendered||(n.initList(),n.rendered=!0)}),this.sectionContent.on("scroll",function(){var e=n.$el.find(".accordion-section.open .available-menu-items-list").prop("scrollHeight"),t=n.$el.find(".accordion-section.open").height();!n.loading&&m(this).scrollTop()>.75*e-t&&(e=m(this).data("type"),t=m(this).data("object"),"search"===e?n.searchTerm&&n.doSearch(n.pages.search):n.loadItems([{type:e,object:t}]))}),c.previewer.bind("url",this.close),n.delegateEvents())},search:function(e){var t=m("#available-menu-items-search"),n=m("#available-menu-items .accordion-section").not(t);e&&this.searchTerm!==e.target.value&&(""===e.target.value||t.hasClass("open")?""===e.target.value&&(t.removeClass("open"),n.show(),this.$clearResults.removeClass("is-visible")):(n.fadeOut(100),t.find(".accordion-section-content").slideDown("fast"),t.addClass("open"),this.$clearResults.addClass("is-visible")),this.searchTerm=e.target.value,this.pages.search=1,this.doSearch(1))},doSearch:function(t){var e,n=this,i=m("#available-menu-items-search"),a=i.find(".accordion-section-content"),o=l.template("available-menu-item");if(n.currentRequest&&n.currentRequest.abort(),!(t<0)){if(1<t)i.addClass("loading-more"),a.attr("aria-busy","true"),l.a11y.speak(c.Menus.data.l10n.itemsLoadingMore);else if(""===n.searchTerm)return a.html(""),void l.a11y.speak("");i.addClass("loading"),n.loading=!0,e=c.previewer.query({excludeCustomizedSaved:!0}),_.extend(e,{"customize-menus-nonce":c.settings.nonce["customize-menus"],wp_customize:"on",search:n.searchTerm,page:t}),n.currentRequest=l.ajax.post("search-available-menu-items-customizer",e),n.currentRequest.done(function(e){1===t&&a.empty(),i.removeClass("loading loading-more"),a.attr("aria-busy","false"),i.addClass("open"),n.loading=!1,e=new c.Menus.AvailableItemCollection(e.items),n.collection.add(e.models),e.each(function(e){a.append(o(e.attributes))}),e.length<20?n.pages.search=-1:n.pages.search=n.pages.search+1,e&&1<t?l.a11y.speak(c.Menus.data.l10n.itemsFoundMore.replace("%d",e.length)):e&&1===t&&l.a11y.speak(c.Menus.data.l10n.itemsFound.replace("%d",e.length))}),n.currentRequest.fail(function(e){e.message&&(a.empty().append(m('<li class="nothing-found"></li>').text(e.message)),l.a11y.speak(e.message)),n.pages.search=-1}),n.currentRequest.always(function(){i.removeClass("loading loading-more"),a.attr("aria-busy","false"),n.loading=!1,n.currentRequest=null})}},initList:function(){var t=this;_.each(c.Menus.data.itemTypes,function(e){t.pages[e.type+":"+e.object]=0}),t.loadItems(c.Menus.data.itemTypes)},loadItems:function(e,t){var i=this,a=[],o={},s=l.template("available-menu-item"),t=_.isString(e)&&_.isString(t)?[{type:e,object:t}]:e;_.each(t,function(e){var t,n=e.type+":"+e.object;-1!==i.pages[n]&&((t=m("#available-menu-items-"+e.type+"-"+e.object)).find(".accordion-section-title").addClass("loading"),o[n]=t,a.push({object:e.object,type:e.type,page:i.pages[n]}))}),0!==a.length&&(i.loading=!0,e=c.previewer.query({excludeCustomizedSaved:!0}),_.extend(e,{"customize-menus-nonce":c.settings.nonce["customize-menus"],wp_customize:"on",item_types:a}),(t=l.ajax.post("load-available-menu-items-customizer",e)).done(function(e){var n;_.each(e.items,function(e,t){0===e.length?(0===i.pages[t]&&o[t].find(".accordion-section-title").addClass("cannot-expand").removeClass("loading").find(".accordion-section-title > button").prop("tabIndex",-1),i.pages[t]=-1):("post_type:page"!==t||o[t].hasClass("open")||o[t].find(".accordion-section-title > button").trigger("click"),e=new c.Menus.AvailableItemCollection(e),i.collection.add(e.models),n=o[t].find(".available-menu-items-list"),e.each(function(e){n.append(s(e.attributes))}),i.pages[t]+=1)})}),t.fail(function(e){"undefined"!=typeof console&&console.error&&console.error(e)}),t.always(function(){_.each(o,function(e){e.find(".accordion-section-title").removeClass("loading")}),i.loading=!1}))},itemSectionHeight:function(){var e=window.innerHeight,t=this.$el.find(".accordion-section:not( #available-menu-items-search ) .accordion-section-content"),n=this.$el.find('.accordion-section:not( #available-menu-items-search ) .available-menu-items-list:not(":only-child")'),e=e-(46*(1+t.length)+14);120<e&&e<290&&(t.css("max-height",e),n.css("max-height",e-60))},select:function(e){this.selected=m(e),this.selected.siblings(".menu-item-tpl").removeClass("selected"),this.selected.addClass("selected")},focus:function(e){this.select(m(e.currentTarget))},_submit:function(e){"keypress"===e.type&&13!==e.which&&32!==e.which||this.submit(m(e.currentTarget))},submit:function(e){var t;(e=e||this.selected)&&this.currentMenuControl&&(this.select(e),t=m(this.selected).data("menu-item-id"),t=this.collection.findWhere({id:t}))&&(this.currentMenuControl.addItemToMenu(t.attributes),m(e).find(".menu-item-handle").addClass("item-added"))},_submitLink:function(e){"keypress"===e.type&&13!==e.which||this.submitLink()},submitLink:function(){var e,t=m("#custom-menu-item-name"),n=m("#custom-menu-item-url"),i=n.val().trim();this.currentMenuControl&&(e=/^((\w+:)?\/\/\w.*|\w+:(?!\/\/$)|\/|\?|#)/,""===t.val()?t.addClass("invalid"):e.test(i)?(e={title:t.val(),url:i,type:"custom",type_label:c.Menus.data.l10n.custom_label,object:"custom"},this.currentMenuControl.addItemToMenu(e),n.val("").attr("placeholder","https://"),t.val("")):n.addClass("invalid"))},_submitNew:function(e){"keypress"===e.type&&13!==e.which||this.addingNew||(e=m(e.target).closest(".accordion-section"),this.submitNew(e))},submitNew:function(n){var i=this,a=n.find(".create-item-input"),e=a.val(),t=n.find(".available-menu-items-list"),o=t.data("type"),s=t.data("object"),r=t.data("type_label");this.currentMenuControl&&"post_type"===o&&(""===a.val().trim()?(a.addClass("invalid"),a.focus()):(a.removeClass("invalid"),n.find(".accordion-section-title").addClass("loading"),i.addingNew=!0,a.attr("disabled","disabled"),c.Menus.insertAutoDraftPost({post_title:e,post_type:s}).done(function(e){var t,e=new c.Menus.AvailableItemModel({id:"post-"+e.post_id,title:a.val(),type:o,type_label:r,object:s,object_id:e.post_id,url:e.url});i.currentMenuControl.addItemToMenu(e.attributes),c.Menus.availableMenuItemsPanel.collection.add(e),t=n.find(".available-menu-items-list"),(e=m(l.template("available-menu-item")(e.attributes))).find(".menu-item-handle:first").addClass("item-added"),t.prepend(e),t.scrollTop(),a.val("").removeAttr("disabled"),i.addingNew=!1,n.find(".accordion-section-title").removeClass("loading")})))},open:function(e){var t,n=this;this.currentMenuControl=e,this.itemSectionHeight(),c.section.has("publish_settings")&&c.section("publish_settings").collapse(),m("body").addClass("adding-menu-items"),t=function(){n.close(),m(this).off("click",t)},m("#customize-preview").on("click",t),_(this.currentMenuControl.getMenuItemControls()).each(function(e){e.collapseForm()}),this.$el.find(".selected").removeClass("selected"),this.$search.trigger("focus")},close:function(e){(e=e||{}).returnFocus&&this.currentMenuControl&&this.currentMenuControl.container.find(".add-new-menu-item").focus(),this.currentMenuControl=null,this.selected=null,m("body").removeClass("adding-menu-items"),m("#available-menu-items .menu-item-handle.item-added").removeClass("item-added"),this.$search.val("").trigger("input")},keyboardAccessible:function(e){var t=13===e.which,n=27===e.which,i=9===e.which&&e.shiftKey,a=m(e.target).is(this.$search);t&&!this.$search.val()||(a&&i?(this.currentMenuControl.container.find(".add-new-menu-item").focus(),e.preventDefault()):n&&this.close({returnFocus:!0}))}}),c.Menus.MenusPanel=c.Panel.extend({attachEvents:function(){c.Panel.prototype.attachEvents.call(this);var t=this.container.find(".panel-meta"),n=t.find(".customize-help-toggle"),i=t.find(".customize-panel-description"),a=m("#screen-options-wrap"),o=t.find(".customize-screen-options-toggle");o.on("click keydown",function(e){if(!c.utils.isKeydownButNotEnterEvent(e))return e.preventDefault(),i.not(":hidden")&&(i.slideUp("fast"),n.attr("aria-expanded","false")),"true"===o.attr("aria-expanded")?(o.attr("aria-expanded","false"),t.removeClass("open"),t.removeClass("active-menu-screen-options"),a.slideUp("fast")):(o.attr("aria-expanded","true"),t.addClass("open"),t.addClass("active-menu-screen-options"),a.slideDown("fast")),!1}),n.on("click keydown",function(e){c.utils.isKeydownButNotEnterEvent(e)||(e.preventDefault(),"true"===o.attr("aria-expanded")&&(o.attr("aria-expanded","false"),n.attr("aria-expanded","true"),t.addClass("open"),t.removeClass("active-menu-screen-options"),a.slideUp("fast"),i.slideDown("fast")))})},ready:function(){var e=this;e.container.find(".hide-column-tog").on("click",function(){e.saveManageColumnsState()}),c.section("menu_locations",function(e){e.headContainer.prepend(l.template("nav-menu-locations-header")(c.Menus.data))})},saveManageColumnsState:_.debounce(function(){var e=this;e._updateHiddenColumnsRequest&&e._updateHiddenColumnsRequest.abort(),e._updateHiddenColumnsRequest=l.ajax.post("hidden-columns",{hidden:e.hidden(),screenoptionnonce:m("#screenoptionnonce").val(),page:"nav-menus"}),e._updateHiddenColumnsRequest.always(function(){e._updateHiddenColumnsRequest=null})},2e3),checked:function(){},unchecked:function(){},hidden:function(){return m(".hide-column-tog").not(":checked").map(function(){var e=this.id;return e.substring(0,e.length-5)}).get().join(",")}}),c.Menus.MenuSection=c.Section.extend({initialize:function(e,t){c.Section.prototype.initialize.call(this,e,t),this.deferred.initSortables=m.Deferred()},ready:function(){var e,t,n=this;if(void 0===n.params.menu_id)throw new Error("params.menu_id was not defined");n.active.validate=function(){return!!c.has(n.id)&&!!c(n.id).get()},n.populateControls(),n.navMenuLocationSettings={},n.assignedLocations=new c.Value([]),c.each(function(e,t){t=t.match(/^nav_menu_locations\[(.+?)]/);t&&(n.navMenuLocationSettings[t[1]]=e).bind(function(){n.refreshAssignedLocations()})}),n.assignedLocations.bind(function(e){n.updateAssignedLocationsInSectionTitle(e)}),n.refreshAssignedLocations(),c.bind("pane-contents-reflowed",function(){n.contentContainer.parent().length&&(n.container.find(".menu-item .menu-item-reorder-nav button").attr({tabindex:"0","aria-hidden":"false"}),n.container.find(".menu-item.move-up-disabled .menus-move-up").attr({tabindex:"-1","aria-hidden":"true"}),n.container.find(".menu-item.move-down-disabled .menus-move-down").attr({tabindex:"-1","aria-hidden":"true"}),n.container.find(".menu-item.move-left-disabled .menus-move-left").attr({tabindex:"-1","aria-hidden":"true"}),n.container.find(".menu-item.move-right-disabled .menus-move-right").attr({tabindex:"-1","aria-hidden":"true"}))}),t=function(){var e="field-"+m(this).val()+"-active";n.contentContainer.toggleClass(e,m(this).prop("checked"))},(e=c.panel("nav_menus").contentContainer.find(".metabox-prefs:first").find(".hide-column-tog")).each(t),e.on("click",t)},populateControls:function(){var e,t=this,n=t.id+"[name]",i=c.control(n);i||(i=new c.controlConstructor.nav_menu_name(n,{type:"nav_menu_name",label:c.Menus.data.l10n.menuNameLabel,section:t.id,priority:0,settings:{default:t.id}}),c.control.add(i),i.active.set(!0)),(n=c.control(t.id))||(n=new c.controlConstructor.nav_menu(t.id,{type:"nav_menu",section:t.id,priority:998,settings:{default:t.id},menu_id:t.params.menu_id}),c.control.add(n),n.active.set(!0)),i=t.id+"[locations]",c.control(i)||(i=new c.controlConstructor.nav_menu_locations(i,{section:t.id,priority:999,settings:{default:t.id},menu_id:t.params.menu_id}),c.control.add(i.id,i),n.active.set(!0)),i=t.id+"[auto_add]",(n=c.control(i))||(n=new c.controlConstructor.nav_menu_auto_add(i,{type:"nav_menu_auto_add",label:"",section:t.id,priority:1e3,settings:{default:t.id}}),c.control.add(n),n.active.set(!0)),i=t.id+"[delete]",(e=c.control(i))||(e=new c.Control(i,{section:t.id,priority:1001,templateId:"nav-menu-delete-button"}),c.control.add(e.id,e),e.active.set(!0),e.deferred.embedded.done(function(){e.container.find("button").on("click",function(){var e=t.params.menu_id;c.Menus.getMenuControl(e).setting.set(!1)})}))},refreshAssignedLocations:function(){var n=this.params.menu_id,i=[];_.each(this.navMenuLocationSettings,function(e,t){e()===n&&i.push(t)}),this.assignedLocations.set(i)},updateAssignedLocationsInSectionTitle:function(e){var n=this.container.find(".accordion-section-title:first");n.find(".menu-in-location").remove(),_.each(e,function(e){var t=m('<span class="menu-in-location"></span>'),e=c.Menus.data.locationSlugMappedToName[e];t.text(c.Menus.data.l10n.menuLocation.replace("%s",e)),n.append(t)}),this.container.toggleClass("assigned-to-menu-location",0!==e.length)},onChangeExpanded:function(e,t){var n,i=this;e&&(wpNavMenu.menuList=i.contentContainer,wpNavMenu.targetList=wpNavMenu.menuList,m("#menu-to-edit").removeAttr("id"),wpNavMenu.menuList.attr("id","menu-to-edit").addClass("menu"),_.each(c.section(i.id).controls(),function(e){"nav_menu_item"===e.params.type&&e.actuallyEmbed()}),t.completeCallback&&(n=t.completeCallback),t.completeCallback=function(){"resolved"!==i.deferred.initSortables.state()&&(wpNavMenu.initSortables(),i.deferred.initSortables.resolve(wpNavMenu.menuList),c.control("nav_menu["+String(i.params.menu_id)+"]").reflowMenuItems()),_.isFunction(n)&&n()}),c.Section.prototype.onChangeExpanded.call(i,e,t)},highlightNewItemButton:function(){c.utils.highlightButton(this.contentContainer.find(".add-new-menu-item"),{delay:2e3})}}),c.Menus.createNavMenu=function(e){var t=c.Menus.generatePlaceholderAutoIncrementId(),n="nav_menu["+String(t)+"]";return c.create(n,n,{},{type:"nav_menu",transport:c.Menus.data.settingTransport,previewer:c.previewer}).set(m.extend({},c.Menus.data.defaultSettingValues.nav_menu,{name:e||""})),c.section.add(new c.Menus.MenuSection(n,{panel:"nav_menus",title:u(e),customizeAction:c.Menus.data.l10n.customizingMenus,priority:10,menu_id:t}))},c.Menus.NewMenuSection=c.Section.extend({attachEvents:function(){var t=this,e=t.container,n=t.contentContainer,i=/^nav_menu\[/;function a(){var t;e.find(".add-new-menu-notice").prop("hidden",(t=0,c.each(function(e){i.test(e.id)&&!1!==e.get()&&(t+=1)}),0<t))}function o(e){i.test(e.id)&&(e.bind(a),a())}t.headContainer.find(".accordion-section-title").replaceWith(l.template("nav-menu-create-menu-section-title")),e.on("click",".customize-add-menu-button",function(){t.expand()}),n.on("keydown",".menu-name-field",function(e){13===e.which&&t.submit()}),n.on("click","#customize-new-menu-submit",function(e){t.submit(),e.stopPropagation(),e.preventDefault()}),c.each(o),c.bind("add",o),c.bind("removed",function(e){i.test(e.id)&&(e.unbind(a),a())}),a(),c.Section.prototype.attachEvents.apply(t,arguments)},ready:function(){this.populateControls()},populateControls:function(){var e=this,t=e.id+"[name]",n=c.control(t);n||(n=new c.controlConstructor.nav_menu_name(t,{label:c.Menus.data.l10n.menuNameLabel,description:c.Menus.data.l10n.newMenuNameDescription,section:e.id,priority:0}),c.control.add(n.id,n),n.active.set(!0)),t=e.id+"[locations]",(n=c.control(t))||(n=new c.controlConstructor.nav_menu_locations(t,{section:e.id,priority:1,menu_id:"",isCreating:!0}),c.control.add(t,n),n.active.set(!0)),t=e.id+"[submit]",(n=c.control(t))||(n=new c.Control(t,{section:e.id,priority:1,templateId:"nav-menu-submit-new-button"}),c.control.add(t,n),n.active.set(!0))},submit:function(){var t,e=this.contentContainer,n=e.find(".menu-name-field").first(),i=n.val();i?(t=c.Menus.createNavMenu(i),n.val(""),n.removeClass("invalid"),e.find(".assigned-menu-location input[type=checkbox]").each(function(){var e=m(this);e.prop("checked")&&(c("nav_menu_locations["+e.data("location-id")+"]").set(t.params.menu_id),e.prop("checked",!1))}),l.a11y.speak(c.Menus.data.l10n.menuAdded),t.focus({completeCallback:function(){t.highlightNewItemButton()}})):(n.addClass("invalid"),n.focus())},selectDefaultLocation:function(e){var t=c.control(this.id+"[locations]"),n={};null!==e&&(n[e]=!0),t.setSelections(n)}}),c.Menus.MenuLocationControl=c.Control.extend({initialize:function(e,t){var n=e.match(/^nav_menu_locations\[(.+?)]/);this.themeLocation=n[1],c.Control.prototype.initialize.call(this,e,t)},ready:function(){var n=this,i=/^nav_menu\[(-?\d+)]/;n.setting.validate=function(e){return""===e?0:parseInt(e,10)},n.container.find(".create-menu").on("click",function(){var e=c.section("add_menu");e.selectDefaultLocation(this.dataset.locationId),e.focus()}),n.container.find(".edit-menu").on("click",function(){var e=n.setting();c.section("nav_menu["+e+"]").focus()}),n.setting.bind("change",function(){var e=0!==n.setting();n.container.find(".create-menu").toggleClass("hidden",e),n.container.find(".edit-menu").toggleClass("hidden",!e)}),c.bind("add",function(e){var t=e.id.match(i);t&&!1!==e()&&(t=t[1],e=new Option(u(e().name),t),n.container.find("select").append(e))}),c.bind("remove",function(e){var e=e.id.match(i);e&&(e=parseInt(e[1],10),n.setting()===e&&n.setting.set(""),n.container.find("option[value="+e+"]").remove())}),c.bind("change",function(e){var t=e.id.match(i);t&&(t=parseInt(t[1],10),!1===e()?(n.setting()===t&&n.setting.set(""),n.container.find("option[value="+t+"]").remove()):n.container.find("option[value="+t+"]").text(u(e().name)))})}}),c.Menus.MenuItemControl=c.Control.extend({initialize:function(e,t){var n=this;n.expanded=new c.Value(!1),n.expandedArgumentsQueue=[],n.expanded.bind(function(e){var t=n.expandedArgumentsQueue.shift(),t=m.extend({},n.defaultExpandedArguments,t);n.onChangeExpanded(e,t)}),c.Control.prototype.initialize.call(n,e,t),n.active.validate=function(){var e=c.section(n.section()),e=!!e&&e.active();return e}},embed:function(){var e=this.section();e&&((e=c.section(e))&&e.expanded()||c.settings.autofocus.control===this.id)&&this.actuallyEmbed()},actuallyEmbed:function(){"resolved"!==this.deferred.embedded.state()&&(this.renderContent(),this.deferred.embedded.resolve())},ready:function(){if(void 0===this.params.menu_item_id)throw new Error("params.menu_item_id was not defined");this._setupControlToggle(),this._setupReorderUI(),this._setupUpdateUI(),this._setupRemoveUI(),this._setupLinksUI(),this._setupTitleUI()},_setupControlToggle:function(){var i=this;this.container.find(".menu-item-handle").on("click",function(e){e.preventDefault(),e.stopPropagation();var t=i.getMenuControl(),n=m(e.target).is(".item-delete, .item-delete *"),e=m(e.target).is(".add-new-menu-item, .add-new-menu-item *");!m("body").hasClass("adding-menu-items")||n||e||c.Menus.availableMenuItemsPanel.close(),t.isReordering||t.isSorting||i.toggleForm()})},_setupReorderUI:function(){var o=this,e=l.template("menu-item-reorder-nav");o.container.find(".item-controls").after(e),o.container.find(".menu-item-reorder-nav").find(".menus-move-up, .menus-move-down, .menus-move-left, .menus-move-right").on("click",function(){var e=m(this),t=(o.params.depth=o.getDepth(),e.focus(),e.is(".menus-move-up")),n=e.is(".menus-move-down"),i=e.is(".menus-move-left"),a=e.is(".menus-move-right");t?o.moveUp():n?o.moveDown():i?(o.moveLeft(),1===o.params.depth?o.container.find(".is-submenu").hide():o.container.find(".is-submenu").show()):a&&(o.moveRight(),o.params.depth+=1,0===o.params.depth?o.container.find(".is-submenu").hide():o.container.find(".is-submenu").show()),e.focus()})},_setupUpdateUI:function(){var e,s=this,t=s.setting();s.elements={},s.elements.url=new c.Element(s.container.find(".edit-menu-item-url")),s.elements.title=new c.Element(s.container.find(".edit-menu-item-title")),s.elements.attr_title=new c.Element(s.container.find(".edit-menu-item-attr-title")),s.elements.target=new c.Element(s.container.find(".edit-menu-item-target")),s.elements.classes=new c.Element(s.container.find(".edit-menu-item-classes")),s.elements.xfn=new c.Element(s.container.find(".edit-menu-item-xfn")),s.elements.description=new c.Element(s.container.find(".edit-menu-item-description")),_.each(s.elements,function(n,i){n.bind(function(e){n.element.is("input[type=checkbox]")&&(e=e?n.element.val():"");var t=s.setting();t&&t[i]!==e&&((t=_.clone(t))[i]=e,s.setting.set(t))}),t&&("classes"!==i&&"xfn"!==i||!_.isArray(t[i])?n.set(t[i]):n.set(t[i].join(" ")))}),s.setting.bind(function(n,i){var e,t=s.params.menu_item_id,a=[],o=[];!1===n?(e=c.control("nav_menu["+String(i.nav_menu_term_id)+"]"),s.container.remove(),_.each(e.getMenuItemControls(),function(e){i.menu_item_parent===e.setting().menu_item_parent&&e.setting().position>i.position?a.push(e):e.setting().menu_item_parent===t&&o.push(e)}),_.each(a,function(e){var t=_.clone(e.setting());t.position+=o.length,e.setting.set(t)}),_.each(o,function(e,t){var n=_.clone(e.setting());n.position=i.position+t,n.menu_item_parent=i.menu_item_parent,e.setting.set(n)}),e.debouncedReflowMenuItems()):(_.each(n,function(e,t){s.elements[t]&&s.elements[t].set(n[t])}),s.container.find(".menu-item-data-parent-id").val(n.menu_item_parent),n.position===i.position&&n.menu_item_parent===i.menu_item_parent||s.getMenuControl().debouncedReflowMenuItems())}),s.setting.notifications.bind("add",e=function(){s.elements.url.element.toggleClass("invalid",s.setting.notifications.has("invalid_url"))}),s.setting.notifications.bind("removed",e)},_setupRemoveUI:function(){var r=this;r.container.find(".item-delete").on("click",function(){var e,t,n,i=!0,a=0,o=r.params.original_item_id,s=r.getMenuControl().$sectionContent.find(".menu-item");m("body").hasClass("adding-menu-items")||(i=!1),n=r.container.nextAll(".customize-control-nav_menu_item:visible").first(),t=r.container.prevAll(".customize-control-nav_menu_item:visible").first(),e=(n.length?n.find(!1===i?".item-edit":".item-delete"):t.length?t.find(!1===i?".item-edit":".item-delete"):r.container.nextAll(".customize-control-nav_menu").find(".add-new-menu-item")).first(),_.each(s,function(e){m(e).is(":visible")&&(e=e.getAttribute("id").match(/^customize-control-nav_menu_item-(-?\d+)$/,""))&&(e=parseInt(e[1],10),e=c.control("nav_menu_item["+String(e)+"]"))&&o==e.params.original_item_id&&a++}),a<=1&&((n=m("#menu-item-tpl-"+r.params.original_item_id)).removeClass("selected"),n.find(".menu-item-handle").removeClass("item-added")),r.container.slideUp(function(){r.setting.set(!1),l.a11y.speak(c.Menus.data.l10n.itemDeleted),e.focus()}),r.setting.set(!1)})},_setupLinksUI:function(){this.container.find("a.original-link").on("click",function(e){e.preventDefault(),c.previewer.previewUrl(e.target.toString())})},_setupTitleUI:function(){var i;this.container.find(".edit-menu-item-title").on("blur",function(){m(this).val(m(this).val().trim())}),i=this.container.find(".menu-item-title"),this.setting.bind(function(e){var t,n;e&&(e.title=e.title||"",n=(t=e.title.trim())||e.original_title||c.Menus.data.l10n.untitled,e._invalid&&(n=c.Menus.data.l10n.invalidTitleTpl.replace("%s",n)),t||e.original_title?i.text(n).removeClass("no-title"):i.text(n).addClass("no-title"))})},getDepth:function(){var e=this,t=e.setting(),n=0;if(!t)return 0;for(;t&&t.menu_item_parent&&(n+=1,e=c.control("nav_menu_item["+t.menu_item_parent+"]"));)t=e.setting();return n},renderContent:function(){var e,t=this,n=t.setting();t.params.title=n.title||"",t.params.depth=t.getDepth(),t.container.data("item-depth",t.params.depth),e=["menu-item","menu-item-depth-"+String(t.params.depth),"menu-item-"+n.object,"menu-item-edit-inactive"],n._invalid?(e.push("menu-item-invalid"),t.params.title=c.Menus.data.l10n.invalidTitleTpl.replace("%s",t.params.title)):"draft"===n.status&&(e.push("pending"),t.params.title=c.Menus.data.pendingTitleTpl.replace("%s",t.params.title)),t.params.el_classes=e.join(" "),t.params.item_type_label=n.type_label,t.params.item_type=n.type,t.params.url=n.url,t.params.target=n.target,t.params.attr_title=n.attr_title,t.params.classes=_.isArray(n.classes)?n.classes.join(" "):n.classes,t.params.xfn=n.xfn,t.params.description=n.description,t.params.parent=n.menu_item_parent,t.params.original_title=n.original_title||"",t.container.addClass(t.params.el_classes),c.Control.prototype.renderContent.call(t)},getMenuControl:function(){var e=this.setting();return e&&e.nav_menu_term_id?c.control("nav_menu["+e.nav_menu_term_id+"]"):null},expandControlSection:function(){var e=this.container.closest(".accordion-section");e.hasClass("open")||e.find(".accordion-section-title:first").trigger("click")},_toggleExpanded:c.Section.prototype._toggleExpanded,expand:c.Section.prototype.expand,expandForm:function(e){this.expand(e)},collapse:c.Section.prototype.collapse,collapseForm:function(e){this.collapse(e)},toggleForm:function(e,t){(e=void 0===e?!this.expanded():e)?this.expand(t):this.collapse(t)},onChangeExpanded:function(e,t){var n,i=this,a=this.container,o=a.find(".menu-item-settings:first");void 0===e&&(e=!o.is(":visible")),o.is(":visible")===e?t&&t.completeCallback&&t.completeCallback():e?(c.control.each(function(e){i.params.type===e.params.type&&i!==e&&e.collapseForm()}),n=function(){a.removeClass("menu-item-edit-inactive").addClass("menu-item-edit-active"),i.container.trigger("expanded"),t&&t.completeCallback&&t.completeCallback()},a.find(".item-edit").attr("aria-expanded","true"),o.slideDown("fast",n),i.container.trigger("expand")):(n=function(){a.addClass("menu-item-edit-inactive").removeClass("menu-item-edit-active"),i.container.trigger("collapsed"),t&&t.completeCallback&&t.completeCallback()},i.container.trigger("collapse"),a.find(".item-edit").attr("aria-expanded","false"),o.slideUp("fast",n))},focus:function(e){var t=this,n=(e=e||{}).completeCallback,i=function(){t.expandControlSection(),e.completeCallback=function(){t.container.find(".menu-item-settings").find("input, select, textarea, button, object, a[href], [tabindex]").filter(":visible").first().focus(),n&&n()},t.expandForm(e)};c.section.has(t.section())?c.section(t.section()).expand({completeCallback:i}):i()},moveUp:function(){this._changePosition(-1),l.a11y.speak(c.Menus.data.l10n.movedUp)},moveDown:function(){this._changePosition(1),l.a11y.speak(c.Menus.data.l10n.movedDown)},moveLeft:function(){this._changeDepth(-1),l.a11y.speak(c.Menus.data.l10n.movedLeft)},moveRight:function(){this._changeDepth(1),l.a11y.speak(c.Menus.data.l10n.movedRight)},_changePosition:function(e){var t,n=this,i=_.clone(n.setting()),a=[];if(1!==e&&-1!==e)throw new Error("Offset changes by 1 are only supported.");if(n.setting()){if(_(n.getMenuControl().getMenuItemControls()).each(function(e){e.setting().menu_item_parent===i.menu_item_parent&&a.push(e.setting)}),a.sort(function(e,t){return e().position-t().position}),-1===(t=_.indexOf(a,n.setting)))throw new Error("Expected setting to be among siblings.");0===t&&e<0||t===a.length-1&&0<e||((t=a[t+e])&&t.set(m.extend(_.clone(t()),{position:i.position})),i.position+=e,n.setting.set(i))}},_changeDepth:function(e){if(1!==e&&-1!==e)throw new Error("Offset changes by 1 are only supported.");var t,n,i=this,a=_.clone(i.setting()),o=[];if(_(i.getMenuControl().getMenuItemControls()).each(function(e){e.setting().menu_item_parent===a.menu_item_parent&&o.push(e)}),o.sort(function(e,t){return e.setting().position-t.setting().position}),-1===(t=_.indexOf(o,i)))throw new Error("Expected control to be among siblings.");-1===e?a.menu_item_parent&&(n=c.control("nav_menu_item["+a.menu_item_parent+"]"),_(o).chain().slice(t).each(function(e,t){e.setting.set(m.extend({},e.setting(),{menu_item_parent:i.params.menu_item_id,position:t}))}),_(i.getMenuControl().getMenuItemControls()).each(function(e){var t;e.setting().menu_item_parent===n.setting().menu_item_parent&&e.setting().position>n.setting().position&&(t=_.clone(e.setting()),e.setting.set(m.extend(t,{position:t.position+1})))}),a.position=n.setting().position+1,a.menu_item_parent=n.setting().menu_item_parent,i.setting.set(a)):1===e&&0!==t&&(a.menu_item_parent=o[t-1].params.menu_item_id,a.position=0,_(i.getMenuControl().getMenuItemControls()).each(function(e){e.setting().menu_item_parent===a.menu_item_parent&&(a.position=Math.max(a.position,e.setting().position))}),a.position+=1,i.setting.set(a))}}),c.Menus.MenuNameControl=c.Control.extend({ready:function(){var e,n=this;n.setting&&(e=n.setting(),n.nameElement=new c.Element(n.container.find(".menu-name-field")),n.nameElement.bind(function(e){var t=n.setting();t&&t.name!==e&&((t=_.clone(t)).name=e,n.setting.set(t))}),e&&n.nameElement.set(e.name),n.setting.bind(function(e){e&&n.nameElement.set(e.name)}))}}),c.Menus.MenuLocationsControl=c.Control.extend({ready:function(){var d=this;d.container.find(".assigned-menu-location").each(function(){function t(e){var t=c("nav_menu["+String(e)+"]");e&&t&&t()?n.find(".theme-location-set").show().find("span").text(u(t().name)):n.find(".theme-location-set").hide()}var n=m(this),e=n.find("input[type=checkbox]"),i=new c.Element(e),a=c("nav_menu_locations["+e.data("location-id")+"]"),o=""===d.params.menu_id,s=o?_.noop:function(e){i.set(e)},r=o?_.noop:function(e){a.set(e?d.params.menu_id:0)};s(a.get()===d.params.menu_id),e.on("change",function(){r(this.checked)}),a.bind(function(e){s(e===d.params.menu_id),t(e)}),t(a.get())})},setSelections:function(i){this.container.find(".menu-location").each(function(e,t){var n=t.dataset.locationId;t.checked=n in i&&i[n]})}}),c.Menus.MenuAutoAddControl=c.Control.extend({ready:function(){var n=this,e=n.setting();n.active.validate=function(){var e=c.section(n.section()),e=!!e&&e.active();return e},n.autoAddElement=new c.Element(n.container.find("input[type=checkbox].auto_add")),n.autoAddElement.bind(function(e){var t=n.setting();t&&t.name!==e&&((t=_.clone(t)).auto_add=e,n.setting.set(t))}),e&&n.autoAddElement.set(e.auto_add),n.setting.bind(function(e){e&&n.autoAddElement.set(e.auto_add)})}}),c.Menus.MenuControl=c.Control.extend({ready:function(){var t,n,i=this,a=c.section(i.section()),o=i.params.menu_id,e=i.setting();if(void 0===this.params.menu_id)throw new Error("params.menu_id was not defined");i.active.validate=function(){var e=!!a&&a.active();return e},i.$controlSection=a.headContainer,i.$sectionContent=i.container.closest(".accordion-section-content"),this._setupModel(),c.section(i.section(),function(e){e.deferred.initSortables.done(function(e){i._setupSortable(e)})}),this._setupAddition(),this._setupTitle(),e&&(t=u(e.name),c.control.each(function(e){e.extended(c.controlConstructor.widget_form)&&"nav_menu"===e.params.widget_id_base&&(e.container.find(".nav-menu-widget-form-controls:first").show(),e.container.find(".nav-menu-widget-no-menus-message:first").hide(),0===(n=e.container.find("select")).find("option[value="+String(o)+"]").length)&&n.append(new Option(t,o))}),(e=m("#available-widgets-list .widget-tpl:has( input.id_base[ value=nav_menu ] )")).find(".nav-menu-widget-form-controls:first").show(),e.find(".nav-menu-widget-no-menus-message:first").hide(),0===(n=e.find(".widget-inside select:first")).find("option[value="+String(o)+"]").length)&&n.append(new Option(t,o)),_.defer(function(){i.updateInvitationVisibility()})},_setupModel:function(){var n=this,i=n.params.menu_id;n.setting.bind(function(e){var t;!1===e?n._handleDeletion():(t=u(e.name),c.control.each(function(e){e.extended(c.controlConstructor.widget_form)&&"nav_menu"===e.params.widget_id_base&&e.container.find("select").find("option[value="+String(i)+"]").text(t)}))})},_setupSortable:function(e){var a=this;if(!e.is(a.$sectionContent))throw new Error("Unexpected menuList.");e.on("sortstart",function(){a.isSorting=!0}),e.on("sortstop",function(){setTimeout(function(){var e=a.$sectionContent.sortable("toArray"),t=[],n=0,i=10;a.isSorting=!1,a.$sectionContent.scrollLeft(0),_.each(e,function(e){var e=e.match(/^customize-control-nav_menu_item-(-?\d+)$/,"");e&&(e=parseInt(e[1],10),e=c.control("nav_menu_item["+String(e)+"]"))&&t.push(e)}),_.each(t,function(e){var t;!1!==e.setting()&&(t=_.clone(e.setting()),n+=1,i+=1,t.position=n,e.priority(i),t.menu_item_parent=parseInt(e.container.find(".menu-item-data-parent-id").val(),10),t.menu_item_parent||(t.menu_item_parent=0),e.setting.set(t))})})}),a.isReordering=!1,this.container.find(".reorder-toggle").on("click",function(){a.toggleReordering(!a.isReordering)})},_setupAddition:function(){var t=this;this.container.find(".add-new-menu-item").on("click",function(e){t.$sectionContent.hasClass("reordering")||(m("body").hasClass("adding-menu-items")?(m(this).attr("aria-expanded","false"),c.Menus.availableMenuItemsPanel.close(),e.stopPropagation()):(m(this).attr("aria-expanded","true"),c.Menus.availableMenuItemsPanel.open(t)))})},_handleDeletion:function(){var e,n=this.params.menu_id,i=0,t=c.section(this.section()),a=function(){t.container.remove(),c.section.remove(t.id)};t&&t.expanded()?t.collapse({completeCallback:function(){a(),l.a11y.speak(c.Menus.data.l10n.menuDeleted),c.panel("nav_menus").focus()}}):a(),c.each(function(e){/^nav_menu\[/.test(e.id)&&!1!==e()&&(i+=1)}),c.control.each(function(e){var t;e.extended(c.controlConstructor.widget_form)&&"nav_menu"===e.params.widget_id_base&&((t=e.container.find("select")).val()===String(n)&&t.prop("selectedIndex",0).trigger("change"),e.container.find(".nav-menu-widget-form-controls:first").toggle(0!==i),e.container.find(".nav-menu-widget-no-menus-message:first").toggle(0===i),e.container.find("option[value="+String(n)+"]").remove())}),(e=m("#available-widgets-list .widget-tpl:has( input.id_base[ value=nav_menu ] )")).find(".nav-menu-widget-form-controls:first").toggle(0!==i),e.find(".nav-menu-widget-no-menus-message:first").toggle(0===i),e.find("option[value="+String(n)+"]").remove()},_setupTitle:function(){var d=this;d.setting.bind(function(e){var t,n,i,a,o,s,r;e&&(t=c.section(d.section()),n=d.params.menu_id,i=t.headContainer.find(".accordion-section-title"),a=t.contentContainer.find(".customize-section-title h3"),o=t.headContainer.find(".menu-in-location"),s=a.find(".customize-action"),r=u(e.name),i.text(r),o.length&&o.appendTo(i),a.text(r),s.length&&s.prependTo(a),c.control.each(function(e){/^nav_menu_locations\[/.test(e.id)&&e.container.find("option[value="+n+"]").text(r)}),t.contentContainer.find(".customize-control-checkbox input").each(function(){m(this).prop("checked")&&m(".current-menu-location-name-"+m(this).data("location-id")).text(r)}))})},toggleReordering:function(e){var t=this.container.find(".add-new-menu-item"),n=this.container.find(".reorder-toggle"),i=this.$sectionContent.find(".item-title");(e=Boolean(e))!==this.$sectionContent.hasClass("reordering")&&(this.isReordering=e,this.$sectionContent.toggleClass("reordering",e),this.$sectionContent.sortable(this.isReordering?"disable":"enable"),this.isReordering?(t.attr({tabindex:"-1","aria-hidden":"true"}),n.attr("aria-label",c.Menus.data.l10n.reorderLabelOff),l.a11y.speak(c.Menus.data.l10n.reorderModeOn),i.attr("aria-hidden","false")):(t.removeAttr("tabindex aria-hidden"),n.attr("aria-label",c.Menus.data.l10n.reorderLabelOn),l.a11y.speak(c.Menus.data.l10n.reorderModeOff),i.attr("aria-hidden","true")),e)&&_(this.getMenuItemControls()).each(function(e){e.collapseForm()})},getMenuItemControls:function(){var t=[],n=this.params.menu_id;return c.control.each(function(e){"nav_menu_item"===e.params.type&&e.setting()&&n===e.setting().nav_menu_term_id&&t.push(e)}),t},reflowMenuItems:function(){var e=this.getMenuItemControls(),a=function(n){var t=[],i=n.currentParent;_.each(n.menuItemControls,function(e){i===e.setting().menu_item_parent&&t.push(e)}),t.sort(function(e,t){return e.setting().position-t.setting().position}),_.each(t,function(t){n.currentAbsolutePosition+=1,t.priority.set(n.currentAbsolutePosition),t.container.hasClass("menu-item-depth-"+String(n.currentDepth))||(_.each(t.container.prop("className").match(/menu-item-depth-\d+/g),function(e){t.container.removeClass(e)}),t.container.addClass("menu-item-depth-"+String(n.currentDepth))),t.container.data("item-depth",n.currentDepth),n.currentDepth+=1,n.currentParent=t.params.menu_item_id,a(n),--n.currentDepth,n.currentParent=i}),t.length&&(_(t).each(function(e){e.container.removeClass("move-up-disabled move-down-disabled move-left-disabled move-right-disabled"),0===n.currentDepth?e.container.addClass("move-left-disabled"):10===n.currentDepth&&e.container.addClass("move-right-disabled")}),t[0].container.addClass("move-up-disabled").addClass("move-right-disabled").toggleClass("move-down-disabled",1===t.length),t[t.length-1].container.addClass("move-down-disabled").toggleClass("move-up-disabled",1===t.length))};a({menuItemControls:e,currentParent:0,currentDepth:0,currentAbsolutePosition:0}),this.updateInvitationVisibility(e),this.container.find(".reorder-toggle").toggle(1<e.length)},debouncedReflowMenuItems:_.debounce(function(){this.reflowMenuItems.apply(this,arguments)},0),addItemToMenu:function(e){var t,n,i,a=0,o=10,s=e.id||"";return _.each(this.getMenuItemControls(),function(e){!1!==e.setting()&&(o=Math.max(o,e.priority()),0===e.setting().menu_item_parent)&&(a=Math.max(a,e.setting().position))}),a+=1,o+=1,delete(e=m.extend({},c.Menus.data.defaultSettingValues.nav_menu_item,e,{nav_menu_term_id:this.params.menu_id,original_title:e.title,position:a})).id,i=c.Menus.generatePlaceholderAutoIncrementId(),t="nav_menu_item["+String(i)+"]",n={type:"nav_menu_item",transport:c.Menus.data.settingTransport,previewer:c.previewer},(n=c.create(t,t,{},n)).set(e),e=new c.controlConstructor.nav_menu_item(t,{type:"nav_menu_item",section:this.id,priority:o,settings:{default:t},menu_item_id:i,original_item_id:s}),c.control.add(e),n.preview(),this.debouncedReflowMenuItems(),l.a11y.speak(c.Menus.data.l10n.itemAdded),e},updateInvitationVisibility:function(e){e=e||this.getMenuItemControls();this.container.find(".new-menu-item-invitation").toggle(0===e.length)}}),m.extend(c.controlConstructor,{nav_menu_location:c.Menus.MenuLocationControl,nav_menu_item:c.Menus.MenuItemControl,nav_menu:c.Menus.MenuControl,nav_menu_name:c.Menus.MenuNameControl,nav_menu_locations:c.Menus.MenuLocationsControl,nav_menu_auto_add:c.Menus.MenuAutoAddControl}),m.extend(c.panelConstructor,{nav_menus:c.Menus.MenusPanel}),m.extend(c.sectionConstructor,{nav_menu:c.Menus.MenuSection,new_menu:c.Menus.NewMenuSection}),c.bind("ready",function(){c.Menus.availableMenuItemsPanel=new c.Menus.AvailableMenuItemsPanelView({collection:c.Menus.availableMenuItems}),c.bind("saved",function(e){(e.nav_menu_updates||e.nav_menu_item_updates)&&c.Menus.applySavedData(e)}),c.state("changesetStatus").bind(function(e){"publish"===e&&(c("nav_menus_created_posts")._value=[])}),c.previewer.bind("focus-nav-menu-item-control",c.Menus.focusMenuItemControl)}),c.Menus.applySavedData=function(e){var u={},r={};_(e.nav_menu_updates).each(function(n){var e,t,i,a,o,s,r,d;if("inserted"===n.status){if(!n.previous_term_id)throw new Error("Expected previous_term_id");if(!n.term_id)throw new Error("Expected term_id");if(e="nav_menu["+String(n.previous_term_id)+"]",!c.has(e))throw new Error("Expected setting to exist: "+e);if(i=c(e),!c.section.has(e))throw new Error("Expected control to exist: "+e);if(o=c.section(e),!(s=i.get()))throw new Error("Did not expect setting to be empty (deleted).");s=m.extend(_.clone(s),n.saved_value),u[n.previous_term_id]=n.term_id,a="nav_menu["+String(n.term_id)+"]",t=c.create(a,a,s,{type:"nav_menu",transport:c.Menus.data.settingTransport,previewer:c.previewer}),(d=o.expanded())&&o.collapse(),a=new c.Menus.MenuSection(a,{panel:"nav_menus",title:s.name,customizeAction:c.Menus.data.l10n.customizingMenus,type:"nav_menu",priority:o.priority.get(),menu_id:n.term_id}),c.section.add(a),c.control.each(function(e){var t;e.extended(c.controlConstructor.widget_form)&&"nav_menu"===e.params.widget_id_base&&(t=(e=e.container.find("select")).find("option[value="+String(n.previous_term_id)+"]"),e.find("option[value="+String(n.term_id)+"]").prop("selected",t.prop("selected")),t.remove())}),i.callbacks.disable(),i.set(!1),i.preview(),t.preview(),i._dirty=!1,o.container.remove(),c.section.remove(e),r=0,c.each(function(e){/^nav_menu\[/.test(e.id)&&!1!==e()&&(r+=1)}),(s=m("#available-widgets-list .widget-tpl:has( input.id_base[ value=nav_menu ] )")).find(".nav-menu-widget-form-controls:first").toggle(0!==r),s.find(".nav-menu-widget-no-menus-message:first").toggle(0===r),s.find("option[value="+String(n.previous_term_id)+"]").remove(),l.customize.control.each(function(e){/^nav_menu_locations\[/.test(e.id)&&e.container.find("option[value="+String(n.previous_term_id)+"]").remove()}),c.each(function(e){var t=c.state("saved").get();/^nav_menu_locations\[/.test(e.id)&&e.get()===n.previous_term_id&&(e.set(n.term_id),e._dirty=!1,c.state("saved").set(t),e.preview())}),d&&a.expand()}else if("updated"===n.status){if(t="nav_menu["+String(n.term_id)+"]",!c.has(t))throw new Error("Expected setting to exist: "+t);i=c(t),_.isEqual(n.saved_value,i.get())||(o=c.state("saved").get(),i.set(n.saved_value),i._dirty=!1,c.state("saved").set(o))}}),_(e.nav_menu_item_updates).each(function(e){e.previous_post_id&&(r[e.previous_post_id]=e.post_id)}),_(e.nav_menu_item_updates).each(function(e){var t,n,i,a,o,s;if("inserted"===e.status){if(!e.previous_post_id)throw new Error("Expected previous_post_id");if(!e.post_id)throw new Error("Expected post_id");if(t="nav_menu_item["+String(e.previous_post_id)+"]",!c.has(t))throw new Error("Expected setting to exist: "+t);if(i=c(t),!c.control.has(t))throw new Error("Expected control to exist: "+t);if(o=c.control(t),!(s=i.get()))throw new Error("Did not expect setting to be empty (deleted).");if((s=_.clone(s)).menu_item_parent<0){if(!r[s.menu_item_parent])throw new Error("inserted ID for menu_item_parent not available");s.menu_item_parent=r[s.menu_item_parent]}u[s.nav_menu_term_id]&&(s.nav_menu_term_id=u[s.nav_menu_term_id]),n="nav_menu_item["+String(e.post_id)+"]",a=c.create(n,n,s,{type:"nav_menu_item",transport:c.Menus.data.settingTransport,previewer:c.previewer}),s=new c.controlConstructor.nav_menu_item(n,{type:"nav_menu_item",menu_id:e.post_id,section:"nav_menu["+String(s.nav_menu_term_id)+"]",priority:o.priority.get(),settings:{default:n},menu_item_id:e.post_id}),o.container.remove(),c.control.remove(t),c.control.add(s),i.callbacks.disable(),i.set(!1),i.preview(),a.preview(),i._dirty=!1,s.container.toggleClass("menu-item-edit-inactive",o.container.hasClass("menu-item-edit-inactive"))}}),_.each(e.widget_nav_menu_updates,function(e,t){t=c(t);t&&(t._value=e,t.preview())})},c.Menus.focusMenuItemControl=function(e){e=c.Menus.getMenuItemControl(e);e&&e.focus()},c.Menus.getMenuControl=function(e){return c.control("nav_menu["+e+"]")},c.Menus.getMenuItemControl=function(e){return c.control("nav_menu_item["+e+"]")}}(wp.customize,wp,jQuery); \ No newline at end of file
diff --git a/wp-admin/js/inline-edit-post.js b/wp-admin/js/inline-edit-post.js
index e7d4496..65cd342 100644
--- a/wp-admin/js/inline-edit-post.js
+++ b/wp-admin/js/inline-edit-post.js
@@ -178,6 +178,8 @@ window.wp = window.wp || {};
*/
setBulk : function(){
var te = '', type = this.type, c = true;
+ var checkedPosts = $( 'tbody th.check-column input[type="checkbox"]:checked' );
+ var categories = {};
this.revert();
$( '#bulk-edit td' ).attr( 'colspan', $( 'th:visible, td:visible', '.widefat:first thead' ).length );
@@ -217,6 +219,44 @@ window.wp = window.wp || {};
// Populate the list of items to bulk edit.
$( '#bulk-titles' ).html( '<ul id="bulk-titles-list" role="list">' + te + '</ul>' );
+ // Gather up some statistics on which of these checked posts are in which categories.
+ checkedPosts.each( function() {
+ var id = $( this ).val();
+ var checked = $( '#category_' + id ).text().split( ',' );
+
+ checked.map( function( cid ) {
+ categories[ cid ] || ( categories[ cid ] = 0 );
+ // Just record that this category is checked.
+ categories[ cid ]++;
+ } );
+ } );
+
+ // Compute initial states.
+ $( '.inline-edit-categories input[name="post_category[]"]' ).each( function() {
+ if ( categories[ $( this ).val() ] == checkedPosts.length ) {
+ // If the number of checked categories matches the number of selected posts, then all posts are in this category.
+ $( this ).prop( 'checked', true );
+ } else if ( categories[ $( this ).val() ] > 0 ) {
+ // If the number is less than the number of selected posts, then it's indeterminate.
+ $( this ).prop( 'indeterminate', true );
+ if ( ! $( this ).parent().find( 'input[name="indeterminate_post_category[]"]' ).length ) {
+ // Get the term label text.
+ var label = $( this ).parent().text();
+ // Set indeterminate states for the backend. Add accessible text for indeterminate inputs.
+ $( this ).after( '<input type="hidden" name="indeterminate_post_category[]" value="' + $( this ).val() + '">' ).attr( 'aria-label', label.trim() + ': ' + wp.i18n.__( 'Some selected posts have this category' ) );
+ }
+ }
+ } );
+
+ $( '.inline-edit-categories input[name="post_category[]"]:indeterminate' ).on( 'change', function() {
+ // Remove accessible label text. Remove the indeterminate flags as there was a specific state change.
+ $( this ).removeAttr( 'aria-label' ).parent().find( 'input[name="indeterminate_post_category[]"]' ).remove();
+ } );
+
+ $( '.inline-edit-save button' ).on( 'click', function() {
+ $( '.inline-edit-categories input[name="post_category[]"]' ).prop( 'indeterminate', false );
+ } );
+
/**
* Binds on click events to handle the list of items to bulk edit.
*
@@ -228,6 +268,7 @@ window.wp = window.wp || {};
$prev = $this.parent().prev().children( '.ntdelbutton' ),
$next = $this.parent().next().children( '.ntdelbutton' );
+ $( 'input#cb-select-all-1, input#cb-select-all-2' ).prop( 'checked', false );
$( 'table.widefat input[value="' + id + '"]' ).prop( 'checked', false );
$( '#_' + id ).parent().remove();
wp.a11y.speak( wp.i18n.__( 'Item removed.' ), 'assertive' );
diff --git a/wp-admin/js/inline-edit-post.min.js b/wp-admin/js/inline-edit-post.min.js
index 6956f57..fbe1d2e 100644
--- a/wp-admin/js/inline-edit-post.min.js
+++ b/wp-admin/js/inline-edit-post.min.js
@@ -1,2 +1,2 @@
/*! This file is auto-generated */
-window.wp=window.wp||{},function(u,h){window.inlineEditPost={init:function(){var i=this,t=u("#inline-edit"),e=u("#bulk-edit");i.type=u("table.widefat").hasClass("pages")?"page":"post",i.what="#post-",t.on("keyup",function(t){if(27===t.which)return inlineEditPost.revert()}),e.on("keyup",function(t){if(27===t.which)return inlineEditPost.revert()}),u(".cancel",t).on("click",function(){return inlineEditPost.revert()}),u(".save",t).on("click",function(){return inlineEditPost.save(this)}),u("td",t).on("keydown",function(t){if(13===t.which&&!u(t.target).hasClass("cancel"))return inlineEditPost.save(this)}),u(".cancel",e).on("click",function(){return inlineEditPost.revert()}),u('#inline-edit .inline-edit-private input[value="private"]').on("click",function(){var t=u("input.inline-edit-password-input");u(this).prop("checked")?t.val("").prop("disabled",!0):t.prop("disabled",!1)}),u("#the-list").on("click",".editinline",function(){u(this).attr("aria-expanded","true"),inlineEditPost.edit(this)}),u("#bulk-edit").find("fieldset:first").after(u("#inline-edit fieldset.inline-edit-categories").clone()).siblings("fieldset:last").prepend(u("#inline-edit .inline-edit-tags-wrap").clone()),u('select[name="_status"] option[value="future"]',e).remove(),u("#doaction").on("click",function(t){var e;i.whichBulkButtonId=u(this).attr("id"),e=i.whichBulkButtonId.substr(2),"edit"===u('select[name="'+e+'"]').val()?(t.preventDefault(),i.setBulk()):0<u("form#posts-filter tr.inline-editor").length&&i.revert()})},toggle:function(t){var e=this;"none"===u(e.what+e.getId(t)).css("display")?e.revert():e.edit(t)},setBulk:function(){var n="",t=this.type,a=!0;if(this.revert(),u("#bulk-edit td").attr("colspan",u("th:visible, td:visible",".widefat:first thead").length),u("table.widefat tbody").prepend(u("#bulk-edit")).prepend('<tr class="hidden"></tr>'),u("#bulk-edit").addClass("inline-editor").show(),u('tbody th.check-column input[type="checkbox"]').each(function(){var t,e,i;u(this).prop("checked")&&(a=!1,t=u(this).val(),e=u("#inline_"+t+" .post_title").html()||h.i18n.__("(no title)"),i=h.i18n.sprintf(h.i18n.__("Remove &#8220;%s&#8221; from Bulk Edit"),e),n+='<li class="ntdelitem"><button type="button" id="_'+t+'" class="button-link ntdelbutton"><span class="screen-reader-text">'+i+'</span></button><span class="ntdeltitle" aria-hidden="true">'+e+"</span></li>")}),a)return this.revert();u("#bulk-titles").html('<ul id="bulk-titles-list" role="list">'+n+"</ul>"),u("#bulk-titles .ntdelbutton").click(function(){var t=u(this),e=t.attr("id").substr(1),i=t.parent().prev().children(".ntdelbutton"),t=t.parent().next().children(".ntdelbutton");u('table.widefat input[value="'+e+'"]').prop("checked",!1),u("#_"+e).parent().remove(),h.a11y.speak(h.i18n.__("Item removed."),"assertive"),t.length?t.focus():i.length?i.focus():(u("#bulk-titles-list").remove(),inlineEditPost.revert(),h.a11y.speak(h.i18n.__("All selected items have been removed. Select new items to use Bulk Actions.")))}),"post"===t&&u("tr.inline-editor textarea[data-wp-taxonomy]").each(function(t,e){u(e).autocomplete("instance")||u(e).wpTagsSuggest()}),u("#bulk-edit .inline-edit-wrapper").attr("tabindex","-1").focus(),u("html, body").animate({scrollTop:0},"fast")},edit:function(n){var t,a,e,i,s,r,l,o,d=this,p=!0;for(d.revert(),"object"==typeof n&&(n=d.getId(n)),t=["post_title","post_name","post_author","_status","jj","mm","aa","hh","mn","ss","post_password","post_format","menu_order","page_template"],"page"===d.type&&t.push("post_parent"),a=u("#inline-edit").clone(!0),u("td",a).attr("colspan",u("th:visible, td:visible",".widefat:first thead").length),u("td",a).find("#quick-edit-legend").removeAttr("id"),u("td",a).find('p[id^="quick-edit-"]').removeAttr("id"),u(d.what+n).removeClass("is-expanded").hide().after(a).after('<tr class="hidden"></tr>'),e=u("#inline_"+n),u(':input[name="post_author"] option[value="'+u(".post_author",e).text()+'"]',a).val()||u(':input[name="post_author"]',a).prepend('<option value="'+u(".post_author",e).text()+'">'+u("#post-"+n+" .author").text()+"</option>"),1===u(':input[name="post_author"] option',a).length&&u("label.inline-edit-author",a).hide(),l=0;l<t.length;l++)(o=u("."+t[l],e)).find("img").replaceWith(function(){return this.alt}),o=o.text(),u(':input[name="'+t[l]+'"]',a).val(o);"open"===u(".comment_status",e).text()&&u('input[name="comment_status"]',a).prop("checked",!0),"open"===u(".ping_status",e).text()&&u('input[name="ping_status"]',a).prop("checked",!0),"sticky"===u(".sticky",e).text()&&u('input[name="sticky"]',a).prop("checked",!0),u(".post_category",e).each(function(){var t,e=u(this).text();e&&(t=u(this).attr("id").replace("_"+n,""),u("ul."+t+"-checklist :checkbox",a).val(e.split(",")))}),u(".tags_input",e).each(function(){var t=u(this),e=u(this).attr("id").replace("_"+n,""),e=u("textarea.tax_input_"+e,a),i=h.i18n._x(",","tag delimiter").trim();e.length&&(t.find("img").replaceWith(function(){return this.alt}),(t=t.text())&&(","!==i&&(t=t.replace(/,/g,i)),e.val(t)),e.wpTagsSuggest())});var c,d=u(':input[name="aa"]').val()+"-"+u(':input[name="mm"]').val()+"-"+u(':input[name="jj"]').val(),d=(d+=" "+u(':input[name="hh"]').val()+":"+u(':input[name="mn"]').val()+":"+u(':input[name="ss"]').val(),new Date(d));if(("future"!==(c=u("._status",e).text())&&Date.now()>d?u('select[name="_status"] option[value="future"]',a):u('select[name="_status"] option[value="publish"]',a)).remove(),d=u(".inline-edit-password-input").prop("disabled",!1),"private"===c&&(u('input[name="keep_private"]',a).prop("checked",!0),d.val("").prop("disabled",!0)),0<(i=u('select[name="post_parent"] option[value="'+n+'"]',a)).length){for(s=i[0].className.split("-")[1],r=i;p&&0!==(r=r.next("option")).length;)r[0].className.split("-")[1]<=s?p=!1:(r.remove(),r=i);i.remove()}return u(a).attr("id","edit-"+n).addClass("inline-editor").show(),u(".ptitle",a).trigger("focus"),!1},save:function(n){var t=u(".post_status_page").val()||"";return"object"==typeof n&&(n=this.getId(n)),u("table.widefat .spinner").addClass("is-active"),t={action:"inline-save",post_type:typenow,post_ID:n,edit_date:"true",post_status:t},t=u("#edit-"+n).find(":input").serialize()+"&"+u.param(t),u.post(ajaxurl,t,function(t){var e=u("#edit-"+n+" .inline-edit-save .notice-error"),i=e.find(".error");u("table.widefat .spinner").removeClass("is-active"),t?-1!==t.indexOf("<tr")?(u(inlineEditPost.what+n).siblings("tr.hidden").addBack().remove(),u("#edit-"+n).before(t).remove(),u(inlineEditPost.what+n).hide().fadeIn(400,function(){u(this).find(".editinline").attr("aria-expanded","false").trigger("focus"),h.a11y.speak(h.i18n.__("Changes saved."))})):(t=t.replace(/<.[^<>]*?>/g,""),e.removeClass("hidden"),i.html(t),h.a11y.speak(i.text())):(e.removeClass("hidden"),i.text(h.i18n.__("Error while saving the changes.")),h.a11y.speak(h.i18n.__("Error while saving the changes.")))},"html"),!1},revert:function(){var t=u(".widefat"),e=u(".inline-editor",t).attr("id");return e&&(u(".spinner",t).removeClass("is-active"),("bulk-edit"===e?(u("#bulk-edit",t).removeClass("inline-editor").hide().siblings(".hidden").remove(),u("#bulk-titles").empty(),u("#inlineedit").append(u("#bulk-edit")),u("#"+inlineEditPost.whichBulkButtonId)):(u("#"+e).siblings("tr.hidden").addBack().remove(),e=e.substr(e.lastIndexOf("-")+1),u(this.what+e).show().find(".editinline").attr("aria-expanded","false"))).trigger("focus")),!1},getId:function(t){t=u(t).closest("tr").attr("id").split("-");return t[t.length-1]}},u(function(){inlineEditPost.init()}),u(function(){void 0!==h&&h.heartbeat&&h.heartbeat.interval(15)}).on("heartbeat-tick.wp-check-locked-posts",function(t,e){var n=e["wp-check-locked-posts"]||{};u("#the-list tr").each(function(t,e){var i=e.id,e=u(e);n.hasOwnProperty(i)?e.hasClass("wp-locked")||(i=n[i],e.find(".column-title .locked-text").text(i.text),e.find(".check-column checkbox").prop("checked",!1),i.avatar_src&&(i=u("<img />",{class:"avatar avatar-18 photo",width:18,height:18,alt:"",src:i.avatar_src,srcset:i.avatar_src_2x?i.avatar_src_2x+" 2x":void 0}),e.find(".column-title .locked-avatar").empty().append(i)),e.addClass("wp-locked")):e.hasClass("wp-locked")&&e.removeClass("wp-locked").find(".locked-info span").empty()})}).on("heartbeat-send.wp-check-locked-posts",function(t,e){var i=[];u("#the-list tr").each(function(t,e){e.id&&i.push(e.id)}),i.length&&(e["wp-check-locked-posts"]=i)})}(jQuery,window.wp); \ No newline at end of file
+window.wp=window.wp||{},function(u,h){window.inlineEditPost={init:function(){var i=this,t=u("#inline-edit"),e=u("#bulk-edit");i.type=u("table.widefat").hasClass("pages")?"page":"post",i.what="#post-",t.on("keyup",function(t){if(27===t.which)return inlineEditPost.revert()}),e.on("keyup",function(t){if(27===t.which)return inlineEditPost.revert()}),u(".cancel",t).on("click",function(){return inlineEditPost.revert()}),u(".save",t).on("click",function(){return inlineEditPost.save(this)}),u("td",t).on("keydown",function(t){if(13===t.which&&!u(t.target).hasClass("cancel"))return inlineEditPost.save(this)}),u(".cancel",e).on("click",function(){return inlineEditPost.revert()}),u('#inline-edit .inline-edit-private input[value="private"]').on("click",function(){var t=u("input.inline-edit-password-input");u(this).prop("checked")?t.val("").prop("disabled",!0):t.prop("disabled",!1)}),u("#the-list").on("click",".editinline",function(){u(this).attr("aria-expanded","true"),inlineEditPost.edit(this)}),u("#bulk-edit").find("fieldset:first").after(u("#inline-edit fieldset.inline-edit-categories").clone()).siblings("fieldset:last").prepend(u("#inline-edit .inline-edit-tags-wrap").clone()),u('select[name="_status"] option[value="future"]',e).remove(),u("#doaction").on("click",function(t){var e;i.whichBulkButtonId=u(this).attr("id"),e=i.whichBulkButtonId.substr(2),"edit"===u('select[name="'+e+'"]').val()?(t.preventDefault(),i.setBulk()):0<u("form#posts-filter tr.inline-editor").length&&i.revert()})},toggle:function(t){var e=this;"none"===u(e.what+e.getId(t)).css("display")?e.revert():e.edit(t)},setBulk:function(){var n="",t=this.type,a=!0,e=u('tbody th.check-column input[type="checkbox"]:checked'),i={};if(this.revert(),u("#bulk-edit td").attr("colspan",u("th:visible, td:visible",".widefat:first thead").length),u("table.widefat tbody").prepend(u("#bulk-edit")).prepend('<tr class="hidden"></tr>'),u("#bulk-edit").addClass("inline-editor").show(),u('tbody th.check-column input[type="checkbox"]').each(function(){var t,e,i;u(this).prop("checked")&&(a=!1,t=u(this).val(),e=u("#inline_"+t+" .post_title").html()||h.i18n.__("(no title)"),i=h.i18n.sprintf(h.i18n.__("Remove &#8220;%s&#8221; from Bulk Edit"),e),n+='<li class="ntdelitem"><button type="button" id="_'+t+'" class="button-link ntdelbutton"><span class="screen-reader-text">'+i+'</span></button><span class="ntdeltitle" aria-hidden="true">'+e+"</span></li>")}),a)return this.revert();u("#bulk-titles").html('<ul id="bulk-titles-list" role="list">'+n+"</ul>"),e.each(function(){var t=u(this).val();u("#category_"+t).text().split(",").map(function(t){i[t]||(i[t]=0),i[t]++})}),u('.inline-edit-categories input[name="post_category[]"]').each(function(){var t;i[u(this).val()]==e.length?u(this).prop("checked",!0):0<i[u(this).val()]&&(u(this).prop("indeterminate",!0),u(this).parent().find('input[name="indeterminate_post_category[]"]').length||(t=u(this).parent().text(),u(this).after('<input type="hidden" name="indeterminate_post_category[]" value="'+u(this).val()+'">').attr("aria-label",t.trim()+": "+h.i18n.__("Some selected posts have this category"))))}),u('.inline-edit-categories input[name="post_category[]"]:indeterminate').on("change",function(){u(this).removeAttr("aria-label").parent().find('input[name="indeterminate_post_category[]"]').remove()}),u(".inline-edit-save button").on("click",function(){u('.inline-edit-categories input[name="post_category[]"]').prop("indeterminate",!1)}),u("#bulk-titles .ntdelbutton").click(function(){var t=u(this),e=t.attr("id").substr(1),i=t.parent().prev().children(".ntdelbutton"),t=t.parent().next().children(".ntdelbutton");u("input#cb-select-all-1, input#cb-select-all-2").prop("checked",!1),u('table.widefat input[value="'+e+'"]').prop("checked",!1),u("#_"+e).parent().remove(),h.a11y.speak(h.i18n.__("Item removed."),"assertive"),t.length?t.focus():i.length?i.focus():(u("#bulk-titles-list").remove(),inlineEditPost.revert(),h.a11y.speak(h.i18n.__("All selected items have been removed. Select new items to use Bulk Actions.")))}),"post"===t&&u("tr.inline-editor textarea[data-wp-taxonomy]").each(function(t,e){u(e).autocomplete("instance")||u(e).wpTagsSuggest()}),u("#bulk-edit .inline-edit-wrapper").attr("tabindex","-1").focus(),u("html, body").animate({scrollTop:0},"fast")},edit:function(n){var t,a,e,i,s,r,o,l,d=this,p=!0;for(d.revert(),"object"==typeof n&&(n=d.getId(n)),t=["post_title","post_name","post_author","_status","jj","mm","aa","hh","mn","ss","post_password","post_format","menu_order","page_template"],"page"===d.type&&t.push("post_parent"),a=u("#inline-edit").clone(!0),u("td",a).attr("colspan",u("th:visible, td:visible",".widefat:first thead").length),u("td",a).find("#quick-edit-legend").removeAttr("id"),u("td",a).find('p[id^="quick-edit-"]').removeAttr("id"),u(d.what+n).removeClass("is-expanded").hide().after(a).after('<tr class="hidden"></tr>'),e=u("#inline_"+n),u(':input[name="post_author"] option[value="'+u(".post_author",e).text()+'"]',a).val()||u(':input[name="post_author"]',a).prepend('<option value="'+u(".post_author",e).text()+'">'+u("#post-"+n+" .author").text()+"</option>"),1===u(':input[name="post_author"] option',a).length&&u("label.inline-edit-author",a).hide(),o=0;o<t.length;o++)(l=u("."+t[o],e)).find("img").replaceWith(function(){return this.alt}),l=l.text(),u(':input[name="'+t[o]+'"]',a).val(l);"open"===u(".comment_status",e).text()&&u('input[name="comment_status"]',a).prop("checked",!0),"open"===u(".ping_status",e).text()&&u('input[name="ping_status"]',a).prop("checked",!0),"sticky"===u(".sticky",e).text()&&u('input[name="sticky"]',a).prop("checked",!0),u(".post_category",e).each(function(){var t,e=u(this).text();e&&(t=u(this).attr("id").replace("_"+n,""),u("ul."+t+"-checklist :checkbox",a).val(e.split(",")))}),u(".tags_input",e).each(function(){var t=u(this),e=u(this).attr("id").replace("_"+n,""),e=u("textarea.tax_input_"+e,a),i=h.i18n._x(",","tag delimiter").trim();e.length&&(t.find("img").replaceWith(function(){return this.alt}),(t=t.text())&&(","!==i&&(t=t.replace(/,/g,i)),e.val(t)),e.wpTagsSuggest())});var c,d=u(':input[name="aa"]').val()+"-"+u(':input[name="mm"]').val()+"-"+u(':input[name="jj"]').val(),d=(d+=" "+u(':input[name="hh"]').val()+":"+u(':input[name="mn"]').val()+":"+u(':input[name="ss"]').val(),new Date(d));if(("future"!==(c=u("._status",e).text())&&Date.now()>d?u('select[name="_status"] option[value="future"]',a):u('select[name="_status"] option[value="publish"]',a)).remove(),d=u(".inline-edit-password-input").prop("disabled",!1),"private"===c&&(u('input[name="keep_private"]',a).prop("checked",!0),d.val("").prop("disabled",!0)),0<(i=u('select[name="post_parent"] option[value="'+n+'"]',a)).length){for(s=i[0].className.split("-")[1],r=i;p&&0!==(r=r.next("option")).length;)r[0].className.split("-")[1]<=s?p=!1:(r.remove(),r=i);i.remove()}return u(a).attr("id","edit-"+n).addClass("inline-editor").show(),u(".ptitle",a).trigger("focus"),!1},save:function(n){var t=u(".post_status_page").val()||"";return"object"==typeof n&&(n=this.getId(n)),u("table.widefat .spinner").addClass("is-active"),t={action:"inline-save",post_type:typenow,post_ID:n,edit_date:"true",post_status:t},t=u("#edit-"+n).find(":input").serialize()+"&"+u.param(t),u.post(ajaxurl,t,function(t){var e=u("#edit-"+n+" .inline-edit-save .notice-error"),i=e.find(".error");u("table.widefat .spinner").removeClass("is-active"),t?-1!==t.indexOf("<tr")?(u(inlineEditPost.what+n).siblings("tr.hidden").addBack().remove(),u("#edit-"+n).before(t).remove(),u(inlineEditPost.what+n).hide().fadeIn(400,function(){u(this).find(".editinline").attr("aria-expanded","false").trigger("focus"),h.a11y.speak(h.i18n.__("Changes saved."))})):(t=t.replace(/<.[^<>]*?>/g,""),e.removeClass("hidden"),i.html(t),h.a11y.speak(i.text())):(e.removeClass("hidden"),i.text(h.i18n.__("Error while saving the changes.")),h.a11y.speak(h.i18n.__("Error while saving the changes.")))},"html"),!1},revert:function(){var t=u(".widefat"),e=u(".inline-editor",t).attr("id");return e&&(u(".spinner",t).removeClass("is-active"),("bulk-edit"===e?(u("#bulk-edit",t).removeClass("inline-editor").hide().siblings(".hidden").remove(),u("#bulk-titles").empty(),u("#inlineedit").append(u("#bulk-edit")),u("#"+inlineEditPost.whichBulkButtonId)):(u("#"+e).siblings("tr.hidden").addBack().remove(),e=e.substr(e.lastIndexOf("-")+1),u(this.what+e).show().find(".editinline").attr("aria-expanded","false"))).trigger("focus")),!1},getId:function(t){t=u(t).closest("tr").attr("id").split("-");return t[t.length-1]}},u(function(){inlineEditPost.init()}),u(function(){void 0!==h&&h.heartbeat&&h.heartbeat.interval(15)}).on("heartbeat-tick.wp-check-locked-posts",function(t,e){var n=e["wp-check-locked-posts"]||{};u("#the-list tr").each(function(t,e){var i=e.id,e=u(e);n.hasOwnProperty(i)?e.hasClass("wp-locked")||(i=n[i],e.find(".column-title .locked-text").text(i.text),e.find(".check-column checkbox").prop("checked",!1),i.avatar_src&&(i=u("<img />",{class:"avatar avatar-18 photo",width:18,height:18,alt:"",src:i.avatar_src,srcset:i.avatar_src_2x?i.avatar_src_2x+" 2x":void 0}),e.find(".column-title .locked-avatar").empty().append(i)),e.addClass("wp-locked")):e.hasClass("wp-locked")&&e.removeClass("wp-locked").find(".locked-info span").empty()})}).on("heartbeat-send.wp-check-locked-posts",function(t,e){var i=[];u("#the-list tr").each(function(t,e){e.id&&i.push(e.id)}),i.length&&(e["wp-check-locked-posts"]=i)})}(jQuery,window.wp); \ No newline at end of file
diff --git a/wp-admin/js/media.js b/wp-admin/js/media.js
index 648ade5..ddc8a6c 100644
--- a/wp-admin/js/media.js
+++ b/wp-admin/js/media.js
@@ -223,8 +223,6 @@
// Clear the selection and move focus back to the trigger.
event.clearSelection();
- // Handle ClipboardJS focus bug, see https://github.com/zenorocha/clipboard.js/issues/680.
- triggerElement.trigger( 'focus' );
// Show success visual feedback.
clearTimeout( copyAttachmentURLSuccessTimeout );
diff --git a/wp-admin/js/media.min.js b/wp-admin/js/media.min.js
index 72eca61..b3404fe 100644
--- a/wp-admin/js/media.min.js
+++ b/wp-admin/js/media.min.js
@@ -1,2 +1,2 @@
/*! This file is auto-generated */
-!function(s){window.findPosts={open:function(n,e){var i=s(".ui-find-overlay");return 0===i.length&&(s("body").append('<div class="ui-find-overlay"></div>'),findPosts.overlay()),i.show(),n&&e&&s("#affected").attr("name",n).val(e),s("#find-posts").show(),s("#find-posts-input").trigger("focus").on("keyup",function(n){27==n.which&&findPosts.close()}),findPosts.send(),!1},close:function(){s("#find-posts-response").empty(),s("#find-posts").hide(),s(".ui-find-overlay").hide()},overlay:function(){s(".ui-find-overlay").on("click",function(){findPosts.close()})},send:function(){var n={ps:s("#find-posts-input").val(),action:"find_posts",_ajax_nonce:s("#_ajax_nonce").val()},e=s(".find-box-search .spinner");e.addClass("is-active"),s.ajax(ajaxurl,{type:"POST",data:n,dataType:"json"}).always(function(){e.removeClass("is-active")}).done(function(n){n.success||s("#find-posts-response").text(wp.i18n.__("An error has occurred. Please reload the page and try again.")),s("#find-posts-response").html(n.data)}).fail(function(){s("#find-posts-response").text(wp.i18n.__("An error has occurred. Please reload the page and try again."))})}},s(function(){var o,n,e=s("#wp-media-grid"),i=new ClipboardJS(".copy-attachment-url.media-library");e.length&&window.wp&&window.wp.media&&(n=_wpMediaGridSettings,n=window.wp.media({frame:"manage",container:e,library:n.queryVars}).open(),e.trigger("wp-media-grid-ready",n)),s("#find-posts-submit").on("click",function(n){s('#find-posts-response input[type="radio"]:checked').length||n.preventDefault()}),s("#find-posts .find-box-search :input").on("keypress",function(n){if(13==n.which)return findPosts.send(),!1}),s("#find-posts-search").on("click",findPosts.send),s("#find-posts-close").on("click",findPosts.close),s("#doaction").on("click",function(e){s('select[name="action"]').each(function(){var n=s(this).val();"attach"===n?(e.preventDefault(),findPosts.open()):"delete"!==n||showNotice.warn()||e.preventDefault()})}),s(".find-box-inside").on("click","tr",function(){s(this).find(".found-radio input").prop("checked",!0)}),i.on("success",function(n){var e=s(n.trigger),i=s(".success",e.closest(".copy-to-clipboard-container"));n.clearSelection(),e.trigger("focus"),clearTimeout(o),i.removeClass("hidden"),o=setTimeout(function(){i.addClass("hidden")},3e3),wp.a11y.speak(wp.i18n.__("The file URL has been copied to your clipboard"))})})}(jQuery); \ No newline at end of file
+!function(s){window.findPosts={open:function(n,e){var i=s(".ui-find-overlay");return 0===i.length&&(s("body").append('<div class="ui-find-overlay"></div>'),findPosts.overlay()),i.show(),n&&e&&s("#affected").attr("name",n).val(e),s("#find-posts").show(),s("#find-posts-input").trigger("focus").on("keyup",function(n){27==n.which&&findPosts.close()}),findPosts.send(),!1},close:function(){s("#find-posts-response").empty(),s("#find-posts").hide(),s(".ui-find-overlay").hide()},overlay:function(){s(".ui-find-overlay").on("click",function(){findPosts.close()})},send:function(){var n={ps:s("#find-posts-input").val(),action:"find_posts",_ajax_nonce:s("#_ajax_nonce").val()},e=s(".find-box-search .spinner");e.addClass("is-active"),s.ajax(ajaxurl,{type:"POST",data:n,dataType:"json"}).always(function(){e.removeClass("is-active")}).done(function(n){n.success||s("#find-posts-response").text(wp.i18n.__("An error has occurred. Please reload the page and try again.")),s("#find-posts-response").html(n.data)}).fail(function(){s("#find-posts-response").text(wp.i18n.__("An error has occurred. Please reload the page and try again."))})}},s(function(){var o,n,e=s("#wp-media-grid"),i=new ClipboardJS(".copy-attachment-url.media-library");e.length&&window.wp&&window.wp.media&&(n=_wpMediaGridSettings,n=window.wp.media({frame:"manage",container:e,library:n.queryVars}).open(),e.trigger("wp-media-grid-ready",n)),s("#find-posts-submit").on("click",function(n){s('#find-posts-response input[type="radio"]:checked').length||n.preventDefault()}),s("#find-posts .find-box-search :input").on("keypress",function(n){if(13==n.which)return findPosts.send(),!1}),s("#find-posts-search").on("click",findPosts.send),s("#find-posts-close").on("click",findPosts.close),s("#doaction").on("click",function(e){s('select[name="action"]').each(function(){var n=s(this).val();"attach"===n?(e.preventDefault(),findPosts.open()):"delete"!==n||showNotice.warn()||e.preventDefault()})}),s(".find-box-inside").on("click","tr",function(){s(this).find(".found-radio input").prop("checked",!0)}),i.on("success",function(n){var e=s(n.trigger),i=s(".success",e.closest(".copy-to-clipboard-container"));n.clearSelection(),clearTimeout(o),i.removeClass("hidden"),o=setTimeout(function(){i.addClass("hidden")},3e3),wp.a11y.speak(wp.i18n.__("The file URL has been copied to your clipboard"))})})}(jQuery); \ No newline at end of file
diff --git a/wp-admin/js/post.js b/wp-admin/js/post.js
index a86ea4c..557465b 100644
--- a/wp-admin/js/post.js
+++ b/wp-admin/js/post.js
@@ -889,7 +889,7 @@ jQuery( function($) {
});
// Set the selected visibility as current.
- $postVisibilitySelect.find('.save-post-visibility').on( 'click', function( event ) { // Crazyhorse - multiple OK cancels.
+ $postVisibilitySelect.find('.save-post-visibility').on( 'click', function( event ) { // Crazyhorse branch - multiple OK cancels.
var visibilityLabel = '', selectedVisibility = $postVisibilitySelect.find('input:radio:checked').val();
$postVisibilitySelect.slideUp('fast');
@@ -945,7 +945,7 @@ jQuery( function($) {
});
// Save the changed timestamp.
- $timestampdiv.find('.save-timestamp').on( 'click', function( event ) { // Crazyhorse - multiple OK cancels.
+ $timestampdiv.find('.save-timestamp').on( 'click', function( event ) { // Crazyhorse branch - multiple OK cancels.
if ( updateText() ) {
$timestampdiv.slideUp('fast');
$timestampdiv.siblings('a.edit-timestamp').show().trigger( 'focus' );
@@ -1173,7 +1173,7 @@ jQuery( function($) {
}
/**
- * When the dragging stopped make sure we return focus and do a sanity check on the height.
+ * When the dragging stopped make sure we return focus and do a confidence check on the height.
*/
function endDrag() {
var height, toolbarHeight;
@@ -1198,7 +1198,7 @@ jQuery( function($) {
$document.off( '.wp-editor-resize' );
- // Sanity check: normalize height to stay within acceptable ranges.
+ // Confidence check: normalize height to stay within acceptable ranges.
if ( height && height > 50 && height < 5000 ) {
setUserSetting( 'ed_size', height );
}
@@ -1303,8 +1303,6 @@ jQuery( function($) {
// Clear the selection and move focus back to the trigger.
event.clearSelection();
- // Handle ClipboardJS focus bug, see https://github.com/zenorocha/clipboard.js/issues/680
- triggerElement.trigger( 'focus' );
// Show success visual feedback.
clearTimeout( copyAttachmentURLSuccessTimeout );
diff --git a/wp-admin/js/post.min.js b/wp-admin/js/post.min.js
index 1bbdd27..f3329aa 100644
--- a/wp-admin/js/post.min.js
+++ b/wp-admin/js/post.min.js
@@ -1,2 +1,2 @@
/*! This file is auto-generated */
-window.makeSlugeditClickable=window.editPermalink=function(){},window.wp=window.wp||{},function(s){var t=!1,a=wp.i18n.__;window.commentsBox={st:0,get:function(t,e){var i=this.st;return this.st+=e=e||20,this.total=t,s("#commentsdiv .spinner").addClass("is-active"),t={action:"get-comments",mode:"single",_ajax_nonce:s("#add_comment_nonce").val(),p:s("#post_ID").val(),start:i,number:e},s.post(ajaxurl,t,function(t){t=wpAjax.parseAjaxResponse(t),s("#commentsdiv .widefat").show(),s("#commentsdiv .spinner").removeClass("is-active"),"object"==typeof t&&t.responses[0]?(s("#the-comment-list").append(t.responses[0].data),theList=theExtraList=null,s("a[className*=':']").off(),commentsBox.st>commentsBox.total?s("#show-comments").hide():s("#show-comments").show().children("a").text(a("Show more comments"))):1==t?s("#show-comments").text(a("No more comments found.")):s("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")}),!1},load:function(t){this.st=jQuery("#the-comment-list tr.comment:visible").length,this.get(t)}},window.WPSetThumbnailHTML=function(t){s(".inside","#postimagediv").html(t)},window.WPSetThumbnailID=function(t){var e=s('input[value="_thumbnail_id"]',"#list-table");0<e.length&&s("#meta\\["+e.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(t)},window.WPRemoveThumbnail=function(t){s.post(ajaxurl,{action:"set-post-thumbnail",post_id:s("#post_ID").val(),thumbnail_id:-1,_ajax_nonce:t,cookie:encodeURIComponent(document.cookie)},function(t){"0"==t?alert(a("Could not set that as the thumbnail image. Try a different attachment.")):WPSetThumbnailHTML(t)})},s(document).on("heartbeat-send.refresh-lock",function(t,e){var i=s("#active_post_lock").val(),a=s("#post_ID").val(),n={};a&&s("#post-lock-dialog").length&&(n.post_id=a,i&&(n.lock=i),e["wp-refresh-post-lock"]=n)}).on("heartbeat-tick.refresh-lock",function(t,e){var i,a;e["wp-refresh-post-lock"]&&((e=e["wp-refresh-post-lock"]).lock_error?(i=s("#post-lock-dialog")).length&&!i.is(":visible")&&(wp.autosave&&(s(document).one("heartbeat-tick",function(){wp.autosave.server.suspend(),i.removeClass("saving").addClass("saved"),s(window).off("beforeunload.edit-post")}),i.addClass("saving"),wp.autosave.server.triggerSave()),e.lock_error.avatar_src&&(a=s("<img />",{class:"avatar avatar-64 photo",width:64,height:64,alt:"",src:e.lock_error.avatar_src,srcset:e.lock_error.avatar_src_2x?e.lock_error.avatar_src_2x+" 2x":void 0}),i.find("div.post-locked-avatar").empty().append(a)),i.show().find(".currently-editing").text(e.lock_error.text),i.find(".wp-tab-first").trigger("focus")):e.new_lock&&s("#active_post_lock").val(e.new_lock))}).on("before-autosave.update-post-slug",function(){t=document.activeElement&&"title"===document.activeElement.id}).on("after-autosave.update-post-slug",function(){s("#edit-slug-box > *").length||t||s.post(ajaxurl,{action:"sample-permalink",post_id:s("#post_ID").val(),new_title:s("#title").val(),samplepermalinknonce:s("#samplepermalinknonce").val()},function(t){"-1"!=t&&s("#edit-slug-box").html(t)})})}(jQuery),function(a){var n,t;function i(){n=!1,window.clearTimeout(t),t=window.setTimeout(function(){n=!0},3e5)}a(function(){i()}).on("heartbeat-send.wp-refresh-nonces",function(t,e){var i=a("#wp-auth-check-wrap");(n||i.length&&!i.hasClass("hidden"))&&(i=a("#post_ID").val())&&a("#_wpnonce").val()&&(e["wp-refresh-post-nonces"]={post_id:i})}).on("heartbeat-tick.wp-refresh-nonces",function(t,e){e=e["wp-refresh-post-nonces"];e&&(i(),e.replace&&a.each(e.replace,function(t,e){a("#"+t).val(e)}),e.heartbeatNonce)&&(window.heartbeatSettings.nonce=e.heartbeatNonce)})}(jQuery),jQuery(function(h){var p,e,i,a,n,s,o,l,r,t,c,d,u=h("#content"),f=h(document),v=h("#post_ID").val()||0,m=h("#submitpost"),g=!0,w=h("#post-visibility-select"),b=h("#timestampdiv"),k=h("#post-status-select"),_=!!window.navigator.platform&&-1!==window.navigator.platform.indexOf("Mac"),y=new ClipboardJS(".copy-attachment-url.edit-media"),x=wp.i18n.__,C=wp.i18n._x;function D(t){c.hasClass("wp-editor-expand")||(r?o.theme.resizeTo(null,l+t.pageY):u.height(Math.max(50,l+t.pageY)),t.preventDefault())}function j(){var t;c.hasClass("wp-editor-expand")||(t=r?(o.focus(),((t=parseInt(h("#wp-content-editor-container .mce-toolbar-grp").height(),10))<10||200<t)&&(t=30),parseInt(h("#content_ifr").css("height"),10)+t-28):(u.trigger("focus"),parseInt(u.css("height"),10)),f.off(".wp-editor-resize"),t&&50<t&&t<5e3&&setUserSetting("ed_size",t))}postboxes.add_postbox_toggles(pagenow),window.name="",h("#post-lock-dialog .notification-dialog").on("keydown",function(t){var e;9==t.which&&((e=h(t.target)).hasClass("wp-tab-first")&&t.shiftKey?(h(this).find(".wp-tab-last").trigger("focus"),t.preventDefault()):e.hasClass("wp-tab-last")&&!t.shiftKey&&(h(this).find(".wp-tab-first").trigger("focus"),t.preventDefault()))}).filter(":visible").find(".wp-tab-first").trigger("focus"),wp.heartbeat&&h("#post-lock-dialog").length&&wp.heartbeat.interval(15),i=m.find(":submit, a.submitdelete, #post-preview").on("click.edit-post",function(t){var e=h(this);e.hasClass("disabled")?t.preventDefault():e.hasClass("submitdelete")||e.is("#post-preview")||h("form#post").off("submit.edit-post").on("submit.edit-post",function(t){if(!t.isDefaultPrevented()){if(wp.autosave&&wp.autosave.server.suspend(),"undefined"!=typeof commentReply){if(!commentReply.discardCommentChanges())return!1;commentReply.close()}g=!1,h(window).off("beforeunload.edit-post"),i.addClass("disabled"),("publish"===e.attr("id")?m.find("#major-publishing-actions .spinner"):m.find("#minor-publishing .spinner")).addClass("is-active")}})}),h("#post-preview").on("click.post-preview",function(t){var e=h(this),i=h("form#post"),a=h("input#wp-preview"),n=e.attr("target")||"wp-preview",s=navigator.userAgent.toLowerCase();t.preventDefault(),e.hasClass("disabled")||(wp.autosave&&wp.autosave.server.tempBlockSave(),a.val("dopreview"),i.attr("target",n).trigger("submit").attr("target",""),-1!==s.indexOf("safari")&&-1===s.indexOf("chrome")&&i.attr("action",function(t,e){return e+"?t="+(new Date).getTime()}),a.val(""))}),h("#title").on("keydown.editor-focus",function(t){var e;if(9===t.keyCode&&!t.ctrlKey&&!t.altKey&&!t.shiftKey){if((e="undefined"!=typeof tinymce&&tinymce.get("content"))&&!e.isHidden())e.focus();else{if(!u.length)return;u.trigger("focus")}t.preventDefault()}}),h("#auto_draft").val()&&h("#title").on("blur",function(){var t;this.value&&!h("#edit-slug-box > *").length&&(h("form#post").one("submit",function(){t=!0}),window.setTimeout(function(){!t&&wp.autosave&&wp.autosave.server.triggerSave()},200))}),f.on("autosave-disable-buttons.edit-post",function(){i.addClass("disabled")}).on("autosave-enable-buttons.edit-post",function(){wp.heartbeat&&wp.heartbeat.hasConnectionError()||i.removeClass("disabled")}).on("before-autosave.edit-post",function(){h(".autosave-message").text(x("Saving Draft\u2026"))}).on("after-autosave.edit-post",function(t,e){h(".autosave-message").text(e.message),h(document.body).hasClass("post-new-php")&&h(".submitbox .submitdelete").show()}),h(window).on("beforeunload.edit-post",function(t){var e=window.tinymce&&window.tinymce.get("content"),i=!1;if(wp.autosave?i=wp.autosave.server.postChanged():e&&(i=!e.isHidden()&&e.isDirty()),i)return t.preventDefault(),x("The changes you made will be lost if you navigate away from this page.")}).on("pagehide.edit-post",function(t){if(g&&(!t.target||"#document"==t.target.nodeName)){var t=h("#post_ID").val(),e=h("#active_post_lock").val();if(t&&e){t={action:"wp-remove-post-lock",_wpnonce:h("#_wpnonce").val(),post_ID:t,active_post_lock:e};if(window.FormData&&window.navigator.sendBeacon){var i=new window.FormData;if(h.each(t,function(t,e){i.append(t,e)}),window.navigator.sendBeacon(ajaxurl,i))return}h.post({async:!1,data:t,url:ajaxurl})}}}),h("#tagsdiv-post_tag").length?window.tagBox&&window.tagBox.init():h(".meta-box-sortables").children("div.postbox").each(function(){if(0===this.id.indexOf("tagsdiv-"))return window.tagBox&&window.tagBox.init(),!1}),h(".categorydiv").each(function(){var t,a,e,i=h(this).attr("id").split("-");i.shift(),a=i.join("-"),e="category"==a?"cats":a+"_tab",h("a","#"+a+"-tabs").on("click",function(t){t.preventDefault();t=h(this).attr("href");h(this).parent().addClass("tabs").siblings("li").removeClass("tabs"),h("#"+a+"-tabs").siblings(".tabs-panel").hide(),h(t).show(),"#"+a+"-all"==t?deleteUserSetting(e):setUserSetting(e,"pop")}),getUserSetting(e)&&h('a[href="#'+a+'-pop"]',"#"+a+"-tabs").trigger("click"),h("#new"+a).one("focus",function(){h(this).val("").removeClass("form-input-tip")}),h("#new"+a).on("keypress",function(t){13===t.keyCode&&(t.preventDefault(),h("#"+a+"-add-submit").trigger("click"))}),h("#"+a+"-add-submit").on("click",function(){h("#new"+a).trigger("focus")}),i=function(t){return!!h("#new"+a).val()&&(t.data+="&"+h(":checked","#"+a+"checklist").serialize(),h("#"+a+"-add-submit").prop("disabled",!0),t)},t=function(t,e){var i=h("#new"+a+"_parent");h("#"+a+"-add-submit").prop("disabled",!1),"undefined"!=e.parsed.responses[0]&&(e=e.parsed.responses[0].supplemental.newcat_parent)&&(i.before(e),i.remove())},h("#"+a+"checklist").wpList({alt:"",response:a+"-ajax-response",addBefore:i,addAfter:t}),h("#"+a+"-add-toggle").on("click",function(t){t.preventDefault(),h("#"+a+"-adder").toggleClass("wp-hidden-children"),h('a[href="#'+a+'-all"]',"#"+a+"-tabs").trigger("click"),h("#new"+a).trigger("focus")}),h("#"+a+"checklist, #"+a+"checklist-pop").on("click",'li.popular-category > label input[type="checkbox"]',function(){var t=h(this),e=t.is(":checked"),i=t.val();i&&t.parents("#taxonomy-"+a).length&&h("#in-"+a+"-"+i+", #in-popular-"+a+"-"+i).prop("checked",e)})}),h("#postcustom").length&&h("#the-list").wpList({addBefore:function(t){return t.data+="&post_id="+h("#post_ID").val(),t},addAfter:function(){h("table#list-table").show()}}),h("#submitdiv").length&&(p=h("#timestamp").html(),e=h("#post-visibility-display").html(),a=function(){"public"!=w.find("input:radio:checked").val()?(h("#sticky").prop("checked",!1),h("#sticky-span").hide()):h("#sticky-span").show(),"password"!=w.find("input:radio:checked").val()?h("#password-span").hide():h("#password-span").show()},n=function(){if(b.length){var t,e=h("#post_status"),i=h('option[value="publish"]',e),a=h("#aa").val(),n=h("#mm").val(),s=h("#jj").val(),o=h("#hh").val(),l=h("#mn").val(),r=new Date(a,n-1,s,o,l),c=new Date(h("#hidden_aa").val(),h("#hidden_mm").val()-1,h("#hidden_jj").val(),h("#hidden_hh").val(),h("#hidden_mn").val()),d=new Date(h("#cur_aa").val(),h("#cur_mm").val()-1,h("#cur_jj").val(),h("#cur_hh").val(),h("#cur_mn").val());if(r.getFullYear()!=a||1+r.getMonth()!=n||r.getDate()!=s||r.getMinutes()!=l)return b.find(".timestamp-wrap").addClass("form-invalid"),!1;b.find(".timestamp-wrap").removeClass("form-invalid"),d<r?(t=x("Schedule for:"),h("#publish").val(C("Schedule","post action/button label"))):r<=d&&"publish"!=h("#original_post_status").val()?(t=x("Publish on:"),h("#publish").val(x("Publish"))):(t=x("Published on:"),h("#publish").val(x("Update"))),c.toUTCString()==r.toUTCString()?h("#timestamp").html(p):h("#timestamp").html("\n"+t+" <b>"+x("%1$s %2$s, %3$s at %4$s:%5$s").replace("%1$s",h('option[value="'+n+'"]',"#mm").attr("data-text")).replace("%2$s",parseInt(s,10)).replace("%3$s",a).replace("%4$s",("00"+o).slice(-2)).replace("%5$s",("00"+l).slice(-2))+"</b> "),"private"==w.find("input:radio:checked").val()?(h("#publish").val(x("Update")),0===i.length?e.append('<option value="publish">'+x("Privately Published")+"</option>"):i.html(x("Privately Published")),h('option[value="publish"]',e).prop("selected",!0),h("#misc-publishing-actions .edit-post-status").hide()):("future"==h("#original_post_status").val()||"draft"==h("#original_post_status").val()?i.length&&(i.remove(),e.val(h("#hidden_post_status").val())):i.html(x("Published")),e.is(":hidden")&&h("#misc-publishing-actions .edit-post-status").show()),h("#post-status-display").text(wp.sanitize.stripTagsAndEncodeText(h("option:selected",e).text())),"private"==h("option:selected",e).val()||"publish"==h("option:selected",e).val()?h("#save-post").hide():(h("#save-post").show(),"pending"==h("option:selected",e).val()?h("#save-post").show().val(x("Save as Pending")):h("#save-post").show().val(x("Save Draft")))}return!0},h("#visibility .edit-visibility").on("click",function(t){t.preventDefault(),w.is(":hidden")&&(a(),w.slideDown("fast",function(){w.find('input[type="radio"]').first().trigger("focus")}),h(this).hide())}),w.find(".cancel-post-visibility").on("click",function(t){w.slideUp("fast"),h("#visibility-radio-"+h("#hidden-post-visibility").val()).prop("checked",!0),h("#post_password").val(h("#hidden-post-password").val()),h("#sticky").prop("checked",h("#hidden-post-sticky").prop("checked")),h("#post-visibility-display").html(e),h("#visibility .edit-visibility").show().trigger("focus"),n(),t.preventDefault()}),w.find(".save-post-visibility").on("click",function(t){var e="",i=w.find("input:radio:checked").val();switch(w.slideUp("fast"),h("#visibility .edit-visibility").show().trigger("focus"),n(),"public"!==i&&h("#sticky").prop("checked",!1),i){case"public":e=h("#sticky").prop("checked")?x("Public, Sticky"):x("Public");break;case"private":e=x("Private");break;case"password":e=x("Password Protected")}h("#post-visibility-display").text(e),t.preventDefault()}),w.find("input:radio").on("change",function(){a()}),b.siblings("a.edit-timestamp").on("click",function(t){b.is(":hidden")&&(b.slideDown("fast",function(){h("input, select",b.find(".timestamp-wrap")).first().trigger("focus")}),h(this).hide()),t.preventDefault()}),b.find(".cancel-timestamp").on("click",function(t){b.slideUp("fast").siblings("a.edit-timestamp").show().trigger("focus"),h("#mm").val(h("#hidden_mm").val()),h("#jj").val(h("#hidden_jj").val()),h("#aa").val(h("#hidden_aa").val()),h("#hh").val(h("#hidden_hh").val()),h("#mn").val(h("#hidden_mn").val()),n(),t.preventDefault()}),b.find(".save-timestamp").on("click",function(t){n()&&(b.slideUp("fast"),b.siblings("a.edit-timestamp").show().trigger("focus")),t.preventDefault()}),h("#post").on("submit",function(t){n()||(t.preventDefault(),b.show(),wp.autosave&&wp.autosave.enableButtons(),h("#publishing-action .spinner").removeClass("is-active"))}),k.siblings("a.edit-post-status").on("click",function(t){k.is(":hidden")&&(k.slideDown("fast",function(){k.find("select").trigger("focus")}),h(this).hide()),t.preventDefault()}),k.find(".save-post-status").on("click",function(t){k.slideUp("fast").siblings("a.edit-post-status").show().trigger("focus"),n(),t.preventDefault()}),k.find(".cancel-post-status").on("click",function(t){k.slideUp("fast").siblings("a.edit-post-status").show().trigger("focus"),h("#post_status").val(h("#hidden_post_status").val()),n(),t.preventDefault()})),h("#titlediv").on("click",".edit-slug",function(){var t,e,a,i,n=0,s=h("#post_name"),o=s.val(),l=h("#sample-permalink"),r=l.html(),c=h("#sample-permalink a").html(),d=h("#edit-slug-buttons"),p=d.html(),u=h("#editable-post-name-full");for(u.find("img").replaceWith(function(){return this.alt}),u=u.html(),l.html(c),a=h("#editable-post-name"),i=a.html(),d.html('<button type="button" class="save button button-small">'+x("OK")+'</button> <button type="button" class="cancel button-link">'+x("Cancel")+"</button>"),d.children(".save").on("click",function(){var i=a.children("input").val();i==h("#editable-post-name-full").text()?d.children(".cancel").trigger("click"):h.post(ajaxurl,{action:"sample-permalink",post_id:v,new_slug:i,new_title:h("#title").val(),samplepermalinknonce:h("#samplepermalinknonce").val()},function(t){var e=h("#edit-slug-box");e.html(t),e.hasClass("hidden")&&e.fadeIn("fast",function(){e.removeClass("hidden")}),d.html(p),l.html(r),s.val(i),h(".edit-slug").trigger("focus"),wp.a11y.speak(x("Permalink saved"))})}),d.children(".cancel").on("click",function(){h("#view-post-btn").show(),a.html(i),d.html(p),l.html(r),s.val(o),h(".edit-slug").trigger("focus")}),t=0;t<u.length;++t)"%"==u.charAt(t)&&n++;c=n>u.length/4?"":u,e=x("URL Slug"),a.html('<label for="new-post-slug" class="screen-reader-text">'+e+'</label><input type="text" id="new-post-slug" value="'+c+'" autocomplete="off" spellcheck="false" />').children("input").on("keydown",function(t){var e=t.which;13===e&&(t.preventDefault(),d.children(".save").trigger("click")),27===e&&d.children(".cancel").trigger("click")}).on("keyup",function(){s.val(this.value)}).trigger("focus")}),window.wptitlehint=function(t){var e=h("#"+(t=t||"title")),i=h("#"+t+"-prompt-text");""===e.val()&&i.removeClass("screen-reader-text"),e.on("input",function(){""===this.value?i.removeClass("screen-reader-text"):i.addClass("screen-reader-text")})},wptitlehint(),t=h("#post-status-info"),c=h("#postdivrich"),!u.length||"ontouchstart"in window?h("#content-resize-handle").hide():t.on("mousedown.wp-editor-resize",function(t){(o="undefined"!=typeof tinymce?tinymce.get("content"):o)&&!o.isHidden()?(r=!0,l=h("#content_ifr").height()-t.pageY):(r=!1,l=u.height()-t.pageY,u.trigger("blur")),f.on("mousemove.wp-editor-resize",D).on("mouseup.wp-editor-resize mouseleave.wp-editor-resize",j),t.preventDefault()}).on("mouseup.wp-editor-resize",j),"undefined"!=typeof tinymce&&(h("#post-formats-select input.post-format").on("change.set-editor-class",function(){var t,e,i=this.id;i&&h(this).prop("checked")&&(t=tinymce.get("content"))&&((e=t.getBody()).className=e.className.replace(/\bpost-format-[^ ]+/,""),t.dom.addClass(e,"post-format-0"==i?"post-format-standard":i),h(document).trigger("editor-classchange"))}),h("#page_template").on("change.set-editor-class",function(){var t,e,i=h(this).val()||"";(i=i.substr(i.lastIndexOf("/")+1,i.length).replace(/\.php$/,"").replace(/\./g,"-"))&&(t=tinymce.get("content"))&&((e=t.getBody()).className=e.className.replace(/\bpage-template-[^ ]+/,""),t.dom.addClass(e,"page-template-"+i),h(document).trigger("editor-classchange"))})),u.on("keydown.wp-autosave",function(t){83!==t.which||t.shiftKey||t.altKey||_&&(!t.metaKey||t.ctrlKey)||!_&&!t.ctrlKey||(wp.autosave&&wp.autosave.server.triggerSave(),t.preventDefault())}),"auto-draft"===h("#original_post_status").val()&&window.history.replaceState&&h("#publish").on("click",function(){d=(d=window.location.href)+(-1!==d.indexOf("?")?"&":"?")+"wp-post-new-reload=true",window.history.replaceState(null,null,d)}),y.on("success",function(t){var e=h(t.trigger),i=h(".success",e.closest(".copy-to-clipboard-container"));t.clearSelection(),e.trigger("focus"),clearTimeout(s),i.removeClass("hidden"),s=setTimeout(function(){i.addClass("hidden")},3e3),wp.a11y.speak(x("The file URL has been copied to your clipboard"))})}),function(t,o){t(function(){var i,e=t("#content"),a=t("#wp-word-count").find(".word-count"),n=0;function s(){var t=!i||i.isHidden()?e.val():i.getContent({format:"raw"}),t=o.count(t);t!==n&&a.text(t),n=t}t(document).on("tinymce-editor-init",function(t,e){"content"===e.id&&(i=e).on("nodechange keyup",_.debounce(s,1e3))}),e.on("input keyup",_.debounce(s,1e3)),s()})}(jQuery,new wp.utils.WordCounter); \ No newline at end of file
+window.makeSlugeditClickable=window.editPermalink=function(){},window.wp=window.wp||{},function(s){var t=!1,a=wp.i18n.__;window.commentsBox={st:0,get:function(t,e){var i=this.st;return this.st+=e=e||20,this.total=t,s("#commentsdiv .spinner").addClass("is-active"),t={action:"get-comments",mode:"single",_ajax_nonce:s("#add_comment_nonce").val(),p:s("#post_ID").val(),start:i,number:e},s.post(ajaxurl,t,function(t){t=wpAjax.parseAjaxResponse(t),s("#commentsdiv .widefat").show(),s("#commentsdiv .spinner").removeClass("is-active"),"object"==typeof t&&t.responses[0]?(s("#the-comment-list").append(t.responses[0].data),theList=theExtraList=null,s("a[className*=':']").off(),commentsBox.st>commentsBox.total?s("#show-comments").hide():s("#show-comments").show().children("a").text(a("Show more comments"))):1==t?s("#show-comments").text(a("No more comments found.")):s("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")}),!1},load:function(t){this.st=jQuery("#the-comment-list tr.comment:visible").length,this.get(t)}},window.WPSetThumbnailHTML=function(t){s(".inside","#postimagediv").html(t)},window.WPSetThumbnailID=function(t){var e=s('input[value="_thumbnail_id"]',"#list-table");0<e.length&&s("#meta\\["+e.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(t)},window.WPRemoveThumbnail=function(t){s.post(ajaxurl,{action:"set-post-thumbnail",post_id:s("#post_ID").val(),thumbnail_id:-1,_ajax_nonce:t,cookie:encodeURIComponent(document.cookie)},function(t){"0"==t?alert(a("Could not set that as the thumbnail image. Try a different attachment.")):WPSetThumbnailHTML(t)})},s(document).on("heartbeat-send.refresh-lock",function(t,e){var i=s("#active_post_lock").val(),a=s("#post_ID").val(),n={};a&&s("#post-lock-dialog").length&&(n.post_id=a,i&&(n.lock=i),e["wp-refresh-post-lock"]=n)}).on("heartbeat-tick.refresh-lock",function(t,e){var i,a;e["wp-refresh-post-lock"]&&((e=e["wp-refresh-post-lock"]).lock_error?(i=s("#post-lock-dialog")).length&&!i.is(":visible")&&(wp.autosave&&(s(document).one("heartbeat-tick",function(){wp.autosave.server.suspend(),i.removeClass("saving").addClass("saved"),s(window).off("beforeunload.edit-post")}),i.addClass("saving"),wp.autosave.server.triggerSave()),e.lock_error.avatar_src&&(a=s("<img />",{class:"avatar avatar-64 photo",width:64,height:64,alt:"",src:e.lock_error.avatar_src,srcset:e.lock_error.avatar_src_2x?e.lock_error.avatar_src_2x+" 2x":void 0}),i.find("div.post-locked-avatar").empty().append(a)),i.show().find(".currently-editing").text(e.lock_error.text),i.find(".wp-tab-first").trigger("focus")):e.new_lock&&s("#active_post_lock").val(e.new_lock))}).on("before-autosave.update-post-slug",function(){t=document.activeElement&&"title"===document.activeElement.id}).on("after-autosave.update-post-slug",function(){s("#edit-slug-box > *").length||t||s.post(ajaxurl,{action:"sample-permalink",post_id:s("#post_ID").val(),new_title:s("#title").val(),samplepermalinknonce:s("#samplepermalinknonce").val()},function(t){"-1"!=t&&s("#edit-slug-box").html(t)})})}(jQuery),function(a){var n,t;function i(){n=!1,window.clearTimeout(t),t=window.setTimeout(function(){n=!0},3e5)}a(function(){i()}).on("heartbeat-send.wp-refresh-nonces",function(t,e){var i=a("#wp-auth-check-wrap");(n||i.length&&!i.hasClass("hidden"))&&(i=a("#post_ID").val())&&a("#_wpnonce").val()&&(e["wp-refresh-post-nonces"]={post_id:i})}).on("heartbeat-tick.wp-refresh-nonces",function(t,e){e=e["wp-refresh-post-nonces"];e&&(i(),e.replace&&a.each(e.replace,function(t,e){a("#"+t).val(e)}),e.heartbeatNonce)&&(window.heartbeatSettings.nonce=e.heartbeatNonce)})}(jQuery),jQuery(function(h){var p,e,i,a,n,s,o,l,r,t,c,d,u=h("#content"),f=h(document),v=h("#post_ID").val()||0,m=h("#submitpost"),g=!0,w=h("#post-visibility-select"),b=h("#timestampdiv"),k=h("#post-status-select"),_=!!window.navigator.platform&&-1!==window.navigator.platform.indexOf("Mac"),y=new ClipboardJS(".copy-attachment-url.edit-media"),x=wp.i18n.__,C=wp.i18n._x;function D(t){c.hasClass("wp-editor-expand")||(r?o.theme.resizeTo(null,l+t.pageY):u.height(Math.max(50,l+t.pageY)),t.preventDefault())}function j(){var t;c.hasClass("wp-editor-expand")||(t=r?(o.focus(),((t=parseInt(h("#wp-content-editor-container .mce-toolbar-grp").height(),10))<10||200<t)&&(t=30),parseInt(h("#content_ifr").css("height"),10)+t-28):(u.trigger("focus"),parseInt(u.css("height"),10)),f.off(".wp-editor-resize"),t&&50<t&&t<5e3&&setUserSetting("ed_size",t))}postboxes.add_postbox_toggles(pagenow),window.name="",h("#post-lock-dialog .notification-dialog").on("keydown",function(t){var e;9==t.which&&((e=h(t.target)).hasClass("wp-tab-first")&&t.shiftKey?(h(this).find(".wp-tab-last").trigger("focus"),t.preventDefault()):e.hasClass("wp-tab-last")&&!t.shiftKey&&(h(this).find(".wp-tab-first").trigger("focus"),t.preventDefault()))}).filter(":visible").find(".wp-tab-first").trigger("focus"),wp.heartbeat&&h("#post-lock-dialog").length&&wp.heartbeat.interval(15),i=m.find(":submit, a.submitdelete, #post-preview").on("click.edit-post",function(t){var e=h(this);e.hasClass("disabled")?t.preventDefault():e.hasClass("submitdelete")||e.is("#post-preview")||h("form#post").off("submit.edit-post").on("submit.edit-post",function(t){if(!t.isDefaultPrevented()){if(wp.autosave&&wp.autosave.server.suspend(),"undefined"!=typeof commentReply){if(!commentReply.discardCommentChanges())return!1;commentReply.close()}g=!1,h(window).off("beforeunload.edit-post"),i.addClass("disabled"),("publish"===e.attr("id")?m.find("#major-publishing-actions .spinner"):m.find("#minor-publishing .spinner")).addClass("is-active")}})}),h("#post-preview").on("click.post-preview",function(t){var e=h(this),i=h("form#post"),a=h("input#wp-preview"),n=e.attr("target")||"wp-preview",s=navigator.userAgent.toLowerCase();t.preventDefault(),e.hasClass("disabled")||(wp.autosave&&wp.autosave.server.tempBlockSave(),a.val("dopreview"),i.attr("target",n).trigger("submit").attr("target",""),-1!==s.indexOf("safari")&&-1===s.indexOf("chrome")&&i.attr("action",function(t,e){return e+"?t="+(new Date).getTime()}),a.val(""))}),h("#title").on("keydown.editor-focus",function(t){var e;if(9===t.keyCode&&!t.ctrlKey&&!t.altKey&&!t.shiftKey){if((e="undefined"!=typeof tinymce&&tinymce.get("content"))&&!e.isHidden())e.focus();else{if(!u.length)return;u.trigger("focus")}t.preventDefault()}}),h("#auto_draft").val()&&h("#title").on("blur",function(){var t;this.value&&!h("#edit-slug-box > *").length&&(h("form#post").one("submit",function(){t=!0}),window.setTimeout(function(){!t&&wp.autosave&&wp.autosave.server.triggerSave()},200))}),f.on("autosave-disable-buttons.edit-post",function(){i.addClass("disabled")}).on("autosave-enable-buttons.edit-post",function(){wp.heartbeat&&wp.heartbeat.hasConnectionError()||i.removeClass("disabled")}).on("before-autosave.edit-post",function(){h(".autosave-message").text(x("Saving Draft\u2026"))}).on("after-autosave.edit-post",function(t,e){h(".autosave-message").text(e.message),h(document.body).hasClass("post-new-php")&&h(".submitbox .submitdelete").show()}),h(window).on("beforeunload.edit-post",function(t){var e=window.tinymce&&window.tinymce.get("content"),i=!1;if(wp.autosave?i=wp.autosave.server.postChanged():e&&(i=!e.isHidden()&&e.isDirty()),i)return t.preventDefault(),x("The changes you made will be lost if you navigate away from this page.")}).on("pagehide.edit-post",function(t){if(g&&(!t.target||"#document"==t.target.nodeName)){var t=h("#post_ID").val(),e=h("#active_post_lock").val();if(t&&e){t={action:"wp-remove-post-lock",_wpnonce:h("#_wpnonce").val(),post_ID:t,active_post_lock:e};if(window.FormData&&window.navigator.sendBeacon){var i=new window.FormData;if(h.each(t,function(t,e){i.append(t,e)}),window.navigator.sendBeacon(ajaxurl,i))return}h.post({async:!1,data:t,url:ajaxurl})}}}),h("#tagsdiv-post_tag").length?window.tagBox&&window.tagBox.init():h(".meta-box-sortables").children("div.postbox").each(function(){if(0===this.id.indexOf("tagsdiv-"))return window.tagBox&&window.tagBox.init(),!1}),h(".categorydiv").each(function(){var t,a,e,i=h(this).attr("id").split("-");i.shift(),a=i.join("-"),e="category"==a?"cats":a+"_tab",h("a","#"+a+"-tabs").on("click",function(t){t.preventDefault();t=h(this).attr("href");h(this).parent().addClass("tabs").siblings("li").removeClass("tabs"),h("#"+a+"-tabs").siblings(".tabs-panel").hide(),h(t).show(),"#"+a+"-all"==t?deleteUserSetting(e):setUserSetting(e,"pop")}),getUserSetting(e)&&h('a[href="#'+a+'-pop"]',"#"+a+"-tabs").trigger("click"),h("#new"+a).one("focus",function(){h(this).val("").removeClass("form-input-tip")}),h("#new"+a).on("keypress",function(t){13===t.keyCode&&(t.preventDefault(),h("#"+a+"-add-submit").trigger("click"))}),h("#"+a+"-add-submit").on("click",function(){h("#new"+a).trigger("focus")}),i=function(t){return!!h("#new"+a).val()&&(t.data+="&"+h(":checked","#"+a+"checklist").serialize(),h("#"+a+"-add-submit").prop("disabled",!0),t)},t=function(t,e){var i=h("#new"+a+"_parent");h("#"+a+"-add-submit").prop("disabled",!1),"undefined"!=e.parsed.responses[0]&&(e=e.parsed.responses[0].supplemental.newcat_parent)&&(i.before(e),i.remove())},h("#"+a+"checklist").wpList({alt:"",response:a+"-ajax-response",addBefore:i,addAfter:t}),h("#"+a+"-add-toggle").on("click",function(t){t.preventDefault(),h("#"+a+"-adder").toggleClass("wp-hidden-children"),h('a[href="#'+a+'-all"]',"#"+a+"-tabs").trigger("click"),h("#new"+a).trigger("focus")}),h("#"+a+"checklist, #"+a+"checklist-pop").on("click",'li.popular-category > label input[type="checkbox"]',function(){var t=h(this),e=t.is(":checked"),i=t.val();i&&t.parents("#taxonomy-"+a).length&&h("#in-"+a+"-"+i+", #in-popular-"+a+"-"+i).prop("checked",e)})}),h("#postcustom").length&&h("#the-list").wpList({addBefore:function(t){return t.data+="&post_id="+h("#post_ID").val(),t},addAfter:function(){h("table#list-table").show()}}),h("#submitdiv").length&&(p=h("#timestamp").html(),e=h("#post-visibility-display").html(),a=function(){"public"!=w.find("input:radio:checked").val()?(h("#sticky").prop("checked",!1),h("#sticky-span").hide()):h("#sticky-span").show(),"password"!=w.find("input:radio:checked").val()?h("#password-span").hide():h("#password-span").show()},n=function(){if(b.length){var t,e=h("#post_status"),i=h('option[value="publish"]',e),a=h("#aa").val(),n=h("#mm").val(),s=h("#jj").val(),o=h("#hh").val(),l=h("#mn").val(),r=new Date(a,n-1,s,o,l),c=new Date(h("#hidden_aa").val(),h("#hidden_mm").val()-1,h("#hidden_jj").val(),h("#hidden_hh").val(),h("#hidden_mn").val()),d=new Date(h("#cur_aa").val(),h("#cur_mm").val()-1,h("#cur_jj").val(),h("#cur_hh").val(),h("#cur_mn").val());if(r.getFullYear()!=a||1+r.getMonth()!=n||r.getDate()!=s||r.getMinutes()!=l)return b.find(".timestamp-wrap").addClass("form-invalid"),!1;b.find(".timestamp-wrap").removeClass("form-invalid"),d<r?(t=x("Schedule for:"),h("#publish").val(C("Schedule","post action/button label"))):r<=d&&"publish"!=h("#original_post_status").val()?(t=x("Publish on:"),h("#publish").val(x("Publish"))):(t=x("Published on:"),h("#publish").val(x("Update"))),c.toUTCString()==r.toUTCString()?h("#timestamp").html(p):h("#timestamp").html("\n"+t+" <b>"+x("%1$s %2$s, %3$s at %4$s:%5$s").replace("%1$s",h('option[value="'+n+'"]',"#mm").attr("data-text")).replace("%2$s",parseInt(s,10)).replace("%3$s",a).replace("%4$s",("00"+o).slice(-2)).replace("%5$s",("00"+l).slice(-2))+"</b> "),"private"==w.find("input:radio:checked").val()?(h("#publish").val(x("Update")),0===i.length?e.append('<option value="publish">'+x("Privately Published")+"</option>"):i.html(x("Privately Published")),h('option[value="publish"]',e).prop("selected",!0),h("#misc-publishing-actions .edit-post-status").hide()):("future"==h("#original_post_status").val()||"draft"==h("#original_post_status").val()?i.length&&(i.remove(),e.val(h("#hidden_post_status").val())):i.html(x("Published")),e.is(":hidden")&&h("#misc-publishing-actions .edit-post-status").show()),h("#post-status-display").text(wp.sanitize.stripTagsAndEncodeText(h("option:selected",e).text())),"private"==h("option:selected",e).val()||"publish"==h("option:selected",e).val()?h("#save-post").hide():(h("#save-post").show(),"pending"==h("option:selected",e).val()?h("#save-post").show().val(x("Save as Pending")):h("#save-post").show().val(x("Save Draft")))}return!0},h("#visibility .edit-visibility").on("click",function(t){t.preventDefault(),w.is(":hidden")&&(a(),w.slideDown("fast",function(){w.find('input[type="radio"]').first().trigger("focus")}),h(this).hide())}),w.find(".cancel-post-visibility").on("click",function(t){w.slideUp("fast"),h("#visibility-radio-"+h("#hidden-post-visibility").val()).prop("checked",!0),h("#post_password").val(h("#hidden-post-password").val()),h("#sticky").prop("checked",h("#hidden-post-sticky").prop("checked")),h("#post-visibility-display").html(e),h("#visibility .edit-visibility").show().trigger("focus"),n(),t.preventDefault()}),w.find(".save-post-visibility").on("click",function(t){var e="",i=w.find("input:radio:checked").val();switch(w.slideUp("fast"),h("#visibility .edit-visibility").show().trigger("focus"),n(),"public"!==i&&h("#sticky").prop("checked",!1),i){case"public":e=h("#sticky").prop("checked")?x("Public, Sticky"):x("Public");break;case"private":e=x("Private");break;case"password":e=x("Password Protected")}h("#post-visibility-display").text(e),t.preventDefault()}),w.find("input:radio").on("change",function(){a()}),b.siblings("a.edit-timestamp").on("click",function(t){b.is(":hidden")&&(b.slideDown("fast",function(){h("input, select",b.find(".timestamp-wrap")).first().trigger("focus")}),h(this).hide()),t.preventDefault()}),b.find(".cancel-timestamp").on("click",function(t){b.slideUp("fast").siblings("a.edit-timestamp").show().trigger("focus"),h("#mm").val(h("#hidden_mm").val()),h("#jj").val(h("#hidden_jj").val()),h("#aa").val(h("#hidden_aa").val()),h("#hh").val(h("#hidden_hh").val()),h("#mn").val(h("#hidden_mn").val()),n(),t.preventDefault()}),b.find(".save-timestamp").on("click",function(t){n()&&(b.slideUp("fast"),b.siblings("a.edit-timestamp").show().trigger("focus")),t.preventDefault()}),h("#post").on("submit",function(t){n()||(t.preventDefault(),b.show(),wp.autosave&&wp.autosave.enableButtons(),h("#publishing-action .spinner").removeClass("is-active"))}),k.siblings("a.edit-post-status").on("click",function(t){k.is(":hidden")&&(k.slideDown("fast",function(){k.find("select").trigger("focus")}),h(this).hide()),t.preventDefault()}),k.find(".save-post-status").on("click",function(t){k.slideUp("fast").siblings("a.edit-post-status").show().trigger("focus"),n(),t.preventDefault()}),k.find(".cancel-post-status").on("click",function(t){k.slideUp("fast").siblings("a.edit-post-status").show().trigger("focus"),h("#post_status").val(h("#hidden_post_status").val()),n(),t.preventDefault()})),h("#titlediv").on("click",".edit-slug",function(){var t,e,a,i,n=0,s=h("#post_name"),o=s.val(),l=h("#sample-permalink"),r=l.html(),c=h("#sample-permalink a").html(),d=h("#edit-slug-buttons"),p=d.html(),u=h("#editable-post-name-full");for(u.find("img").replaceWith(function(){return this.alt}),u=u.html(),l.html(c),a=h("#editable-post-name"),i=a.html(),d.html('<button type="button" class="save button button-small">'+x("OK")+'</button> <button type="button" class="cancel button-link">'+x("Cancel")+"</button>"),d.children(".save").on("click",function(){var i=a.children("input").val();i==h("#editable-post-name-full").text()?d.children(".cancel").trigger("click"):h.post(ajaxurl,{action:"sample-permalink",post_id:v,new_slug:i,new_title:h("#title").val(),samplepermalinknonce:h("#samplepermalinknonce").val()},function(t){var e=h("#edit-slug-box");e.html(t),e.hasClass("hidden")&&e.fadeIn("fast",function(){e.removeClass("hidden")}),d.html(p),l.html(r),s.val(i),h(".edit-slug").trigger("focus"),wp.a11y.speak(x("Permalink saved"))})}),d.children(".cancel").on("click",function(){h("#view-post-btn").show(),a.html(i),d.html(p),l.html(r),s.val(o),h(".edit-slug").trigger("focus")}),t=0;t<u.length;++t)"%"==u.charAt(t)&&n++;c=n>u.length/4?"":u,e=x("URL Slug"),a.html('<label for="new-post-slug" class="screen-reader-text">'+e+'</label><input type="text" id="new-post-slug" value="'+c+'" autocomplete="off" spellcheck="false" />').children("input").on("keydown",function(t){var e=t.which;13===e&&(t.preventDefault(),d.children(".save").trigger("click")),27===e&&d.children(".cancel").trigger("click")}).on("keyup",function(){s.val(this.value)}).trigger("focus")}),window.wptitlehint=function(t){var e=h("#"+(t=t||"title")),i=h("#"+t+"-prompt-text");""===e.val()&&i.removeClass("screen-reader-text"),e.on("input",function(){""===this.value?i.removeClass("screen-reader-text"):i.addClass("screen-reader-text")})},wptitlehint(),t=h("#post-status-info"),c=h("#postdivrich"),!u.length||"ontouchstart"in window?h("#content-resize-handle").hide():t.on("mousedown.wp-editor-resize",function(t){(o="undefined"!=typeof tinymce?tinymce.get("content"):o)&&!o.isHidden()?(r=!0,l=h("#content_ifr").height()-t.pageY):(r=!1,l=u.height()-t.pageY,u.trigger("blur")),f.on("mousemove.wp-editor-resize",D).on("mouseup.wp-editor-resize mouseleave.wp-editor-resize",j),t.preventDefault()}).on("mouseup.wp-editor-resize",j),"undefined"!=typeof tinymce&&(h("#post-formats-select input.post-format").on("change.set-editor-class",function(){var t,e,i=this.id;i&&h(this).prop("checked")&&(t=tinymce.get("content"))&&((e=t.getBody()).className=e.className.replace(/\bpost-format-[^ ]+/,""),t.dom.addClass(e,"post-format-0"==i?"post-format-standard":i),h(document).trigger("editor-classchange"))}),h("#page_template").on("change.set-editor-class",function(){var t,e,i=h(this).val()||"";(i=i.substr(i.lastIndexOf("/")+1,i.length).replace(/\.php$/,"").replace(/\./g,"-"))&&(t=tinymce.get("content"))&&((e=t.getBody()).className=e.className.replace(/\bpage-template-[^ ]+/,""),t.dom.addClass(e,"page-template-"+i),h(document).trigger("editor-classchange"))})),u.on("keydown.wp-autosave",function(t){83!==t.which||t.shiftKey||t.altKey||_&&(!t.metaKey||t.ctrlKey)||!_&&!t.ctrlKey||(wp.autosave&&wp.autosave.server.triggerSave(),t.preventDefault())}),"auto-draft"===h("#original_post_status").val()&&window.history.replaceState&&h("#publish").on("click",function(){d=(d=window.location.href)+(-1!==d.indexOf("?")?"&":"?")+"wp-post-new-reload=true",window.history.replaceState(null,null,d)}),y.on("success",function(t){var e=h(t.trigger),i=h(".success",e.closest(".copy-to-clipboard-container"));t.clearSelection(),clearTimeout(s),i.removeClass("hidden"),s=setTimeout(function(){i.addClass("hidden")},3e3),wp.a11y.speak(x("The file URL has been copied to your clipboard"))})}),function(t,o){t(function(){var i,e=t("#content"),a=t("#wp-word-count").find(".word-count"),n=0;function s(){var t=!i||i.isHidden()?e.val():i.getContent({format:"raw"}),t=o.count(t);t!==n&&a.text(t),n=t}t(document).on("tinymce-editor-init",function(t,e){"content"===e.id&&(i=e).on("nodechange keyup",_.debounce(s,1e3))}),e.on("input keyup",_.debounce(s,1e3)),s()})}(jQuery,new wp.utils.WordCounter); \ No newline at end of file
diff --git a/wp-admin/js/site-health.js b/wp-admin/js/site-health.js
index 5b59771..416295d 100644
--- a/wp-admin/js/site-health.js
+++ b/wp-admin/js/site-health.js
@@ -26,8 +26,6 @@ jQuery( function( $ ) {
// Clear the selection and move focus back to the trigger.
e.clearSelection();
- // Handle ClipboardJS focus bug, see https://github.com/zenorocha/clipboard.js/issues/680
- triggerElement.trigger( 'focus' );
// Show success visual feedback.
clearTimeout( successTimeout );
diff --git a/wp-admin/js/site-health.min.js b/wp-admin/js/site-health.min.js
index 53b14d7..efe202e 100644
--- a/wp-admin/js/site-health.min.js
+++ b/wp-admin/js/site-health.min.js
@@ -1,2 +1,2 @@
/*! This file is auto-generated */
-jQuery(function(o){var a,r=wp.i18n.__,n=wp.i18n._n,l=wp.i18n.sprintf,e=new ClipboardJS(".site-health-copy-buttons .copy-button"),c=o(".health-check-body.health-check-status-tab").length,t=o(".health-check-body.health-check-debug-tab").length,i=o("#health-check-accordion-block-wp-paths-sizes"),h=o("#adminmenu .site-health-counter"),u=o("#adminmenu .site-health-counter .count");function d(e){var t,s,a=wp.template("health-check-issue"),i=o("#health-check-issues-"+e.status);!function(e){var t,s,a,i,n={test:"string",label:"string",description:"string"},o=!0;if("object"==typeof e){for(t in n)if("object"==typeof(s=n[t]))for(a in s)i=s[a],void 0!==e[t]&&void 0!==e[t][a]&&i===typeof e[t][a]||(o=!1);else void 0!==e[t]&&s===typeof e[t]||(o=!1);return o}}(e)||(SiteHealth.site_status.issues[e.status]++,s=SiteHealth.site_status.issues[e.status],void 0===e.test&&(e.test=e.status+s),"critical"===e.status?t=l(n("%s critical issue","%s critical issues",s),'<span class="issue-count">'+s+"</span>"):"recommended"===e.status?t=l(n("%s recommended improvement","%s recommended improvements",s),'<span class="issue-count">'+s+"</span>"):"good"===e.status&&(t=l(n("%s item with no issues detected","%s items with no issues detected",s),'<span class="issue-count">'+s+"</span>")),t&&o(".site-health-issue-count-title",i).html(t),u.text(SiteHealth.site_status.issues.critical),0<parseInt(SiteHealth.site_status.issues.critical,0)?(o("#health-check-issues-critical").removeClass("hidden"),h.removeClass("count-0")):h.addClass("count-0"),0<parseInt(SiteHealth.site_status.issues.recommended,0)&&o("#health-check-issues-recommended").removeClass("hidden"),o(".issues","#health-check-issues-"+e.status).append(a(e)))}function p(){var e=o(".site-health-progress"),t=e.closest(".site-health-progress-wrapper"),s=o(".site-health-progress-label",t),a=o(".site-health-progress svg #bar"),i=parseInt(SiteHealth.site_status.issues.good,0)+parseInt(SiteHealth.site_status.issues.recommended,0)+1.5*parseInt(SiteHealth.site_status.issues.critical,0),n=.5*parseInt(SiteHealth.site_status.issues.recommended,0)+1.5*parseInt(SiteHealth.site_status.issues.critical,0),n=100-Math.ceil(n/i*100);0===i?e.addClass("hidden"):(t.removeClass("loading"),i=a.attr("r"),e=Math.PI*(2*i),a.css({strokeDashoffset:(100-(n=100<(n=n<0?0:n)?100:n))/100*e+"px"}),80<=n&&0===parseInt(SiteHealth.site_status.issues.critical,0)?(t.addClass("green").removeClass("orange"),s.text(r("Good")),m("good")):(t.addClass("orange").removeClass("green"),s.text(r("Should be improved")),m("improvable")),c&&(o.post(ajaxurl,{action:"health-check-site-status-result",_wpnonce:SiteHealth.nonce.site_status_result,counts:SiteHealth.site_status.issues}),100===n)&&(o(".site-status-all-clear").removeClass("hide"),o(".site-status-has-issues").addClass("hide")))}function g(e,t){e={status:"recommended",label:r("A test is unavailable"),badge:{color:"red",label:r("Unavailable")},description:"<p>"+e+"</p><p>"+t+"</p>",actions:""};d(wp.hooks.applyFilters("site_status_test_result",e))}function s(){var t=(new Date).getTime(),s=window.setTimeout(function(){m("waiting-for-directory-sizes")},3e3);wp.apiRequest({path:"/wp-site-health/v1/directory-sizes"}).done(function(e){var a,s;a=e||{},e=o("button.button.copy-button"),s=e.attr("data-clipboard-text"),o.each(a,function(e,t){t=t.debug||t.size;void 0!==t&&(s=s.replace(e+": loading...",e+": "+t))}),e.attr("data-clipboard-text",s),i.find("td[class]").each(function(e,t){var t=o(t),s=t.attr("class");a.hasOwnProperty(s)&&a[s].size&&t.text(a[s].size)})}).always(function(){var e=(new Date).getTime()-t;o(".health-check-wp-paths-sizes.spinner").css("visibility","hidden"),3e3<e?(e=6e3<e?0:6500-e,window.setTimeout(function(){p()},e)):window.clearTimeout(s),o(document).trigger("site-health-info-dirsizes-done")})}function m(e){if("site-health"===SiteHealth.screen)switch(e){case"good":wp.a11y.speak(r("All site health tests have finished running. Your site is looking good."));break;case"improvable":wp.a11y.speak(r("All site health tests have finished running. There are items that should be addressed."));break;case"waiting-for-directory-sizes":wp.a11y.speak(r("Running additional tests... please wait."))}}e.on("success",function(e){var t=o(e.trigger),s=o(".success",t.closest("div"));e.clearSelection(),t.trigger("focus"),clearTimeout(a),s.removeClass("hidden"),a=setTimeout(function(){s.addClass("hidden")},3e3),wp.a11y.speak(r("Site information has been copied to your clipboard."))}),o(".health-check-accordion").on("click",".health-check-accordion-trigger",function(){"true"===o(this).attr("aria-expanded")?(o(this).attr("aria-expanded","false"),o("#"+o(this).attr("aria-controls")).attr("hidden",!0)):(o(this).attr("aria-expanded","true"),o("#"+o(this).attr("aria-controls")).attr("hidden",!1))}),o(".site-health-view-passed").on("click",function(){var e=o("#health-check-issues-good");e.toggleClass("hidden"),o(this).attr("aria-expanded",!e.hasClass("hidden"))}),"undefined"!=typeof SiteHealth&&(0===SiteHealth.site_status.direct.length&&0===SiteHealth.site_status.async.length?p():SiteHealth.site_status.issues={good:0,recommended:0,critical:0},0<SiteHealth.site_status.direct.length&&o.each(SiteHealth.site_status.direct,function(){d(this)}),(0<SiteHealth.site_status.async.length?function t(){var s=!0;1<=SiteHealth.site_status.async.length&&o.each(SiteHealth.site_status.async,function(){var e={action:"health-check-"+this.test.replace("_","-"),_wpnonce:SiteHealth.nonce.site_status};return!!this.completed||(s=!1,this.completed=!0,(void 0!==this.has_rest&&this.has_rest?wp.apiRequest({url:wp.url.addQueryArgs(this.test,{_locale:"user"}),headers:this.headers}).done(function(e){d(wp.hooks.applyFilters("site_status_test_result",e))}).fail(function(e){e=void 0!==e.responseJSON&&void 0!==e.responseJSON.message?e.responseJSON.message:r("No details available"),g(this.url,e)}):o.post(ajaxurl,e).done(function(e){d(wp.hooks.applyFilters("site_status_test_result",e.data))}).fail(function(e){e=void 0!==e.responseJSON&&void 0!==e.responseJSON.message?e.responseJSON.message:r("No details available"),g(this.url,e)})).always(function(){t()}),!1)}),s&&p()}:p)()),t&&(i.length?s:p)(),o(".health-check-offscreen-nav-wrapper").on("click",function(){o(this).toggleClass("visible")})}); \ No newline at end of file
+jQuery(function(o){var a,l=wp.i18n.__,n=wp.i18n._n,r=wp.i18n.sprintf,e=new ClipboardJS(".site-health-copy-buttons .copy-button"),c=o(".health-check-body.health-check-status-tab").length,t=o(".health-check-body.health-check-debug-tab").length,i=o("#health-check-accordion-block-wp-paths-sizes"),h=o("#adminmenu .site-health-counter"),u=o("#adminmenu .site-health-counter .count");function d(e){var t,s,a=wp.template("health-check-issue"),i=o("#health-check-issues-"+e.status);!function(e){var t,s,a,i,n={test:"string",label:"string",description:"string"},o=!0;if("object"==typeof e){for(t in n)if("object"==typeof(s=n[t]))for(a in s)i=s[a],void 0!==e[t]&&void 0!==e[t][a]&&i===typeof e[t][a]||(o=!1);else void 0!==e[t]&&s===typeof e[t]||(o=!1);return o}}(e)||(SiteHealth.site_status.issues[e.status]++,s=SiteHealth.site_status.issues[e.status],void 0===e.test&&(e.test=e.status+s),"critical"===e.status?t=r(n("%s critical issue","%s critical issues",s),'<span class="issue-count">'+s+"</span>"):"recommended"===e.status?t=r(n("%s recommended improvement","%s recommended improvements",s),'<span class="issue-count">'+s+"</span>"):"good"===e.status&&(t=r(n("%s item with no issues detected","%s items with no issues detected",s),'<span class="issue-count">'+s+"</span>")),t&&o(".site-health-issue-count-title",i).html(t),u.text(SiteHealth.site_status.issues.critical),0<parseInt(SiteHealth.site_status.issues.critical,0)?(o("#health-check-issues-critical").removeClass("hidden"),h.removeClass("count-0")):h.addClass("count-0"),0<parseInt(SiteHealth.site_status.issues.recommended,0)&&o("#health-check-issues-recommended").removeClass("hidden"),o(".issues","#health-check-issues-"+e.status).append(a(e)))}function p(){var e=o(".site-health-progress"),t=e.closest(".site-health-progress-wrapper"),s=o(".site-health-progress-label",t),a=o(".site-health-progress svg #bar"),i=parseInt(SiteHealth.site_status.issues.good,0)+parseInt(SiteHealth.site_status.issues.recommended,0)+1.5*parseInt(SiteHealth.site_status.issues.critical,0),n=.5*parseInt(SiteHealth.site_status.issues.recommended,0)+1.5*parseInt(SiteHealth.site_status.issues.critical,0),n=100-Math.ceil(n/i*100);0===i?e.addClass("hidden"):(t.removeClass("loading"),i=a.attr("r"),e=Math.PI*(2*i),a.css({strokeDashoffset:(100-(n=100<(n=n<0?0:n)?100:n))/100*e+"px"}),80<=n&&0===parseInt(SiteHealth.site_status.issues.critical,0)?(t.addClass("green").removeClass("orange"),s.text(l("Good")),g("good")):(t.addClass("orange").removeClass("green"),s.text(l("Should be improved")),g("improvable")),c&&(o.post(ajaxurl,{action:"health-check-site-status-result",_wpnonce:SiteHealth.nonce.site_status_result,counts:SiteHealth.site_status.issues}),100===n)&&(o(".site-status-all-clear").removeClass("hide"),o(".site-status-has-issues").addClass("hide")))}function m(e,t){e={status:"recommended",label:l("A test is unavailable"),badge:{color:"red",label:l("Unavailable")},description:"<p>"+e+"</p><p>"+t+"</p>",actions:""};d(wp.hooks.applyFilters("site_status_test_result",e))}function s(){var t=(new Date).getTime(),s=window.setTimeout(function(){g("waiting-for-directory-sizes")},3e3);wp.apiRequest({path:"/wp-site-health/v1/directory-sizes"}).done(function(e){var a,s;a=e||{},e=o("button.button.copy-button"),s=e.attr("data-clipboard-text"),o.each(a,function(e,t){t=t.debug||t.size;void 0!==t&&(s=s.replace(e+": loading...",e+": "+t))}),e.attr("data-clipboard-text",s),i.find("td[class]").each(function(e,t){var t=o(t),s=t.attr("class");a.hasOwnProperty(s)&&a[s].size&&t.text(a[s].size)})}).always(function(){var e=(new Date).getTime()-t;o(".health-check-wp-paths-sizes.spinner").css("visibility","hidden"),3e3<e?(e=6e3<e?0:6500-e,window.setTimeout(function(){p()},e)):window.clearTimeout(s),o(document).trigger("site-health-info-dirsizes-done")})}function g(e){if("site-health"===SiteHealth.screen)switch(e){case"good":wp.a11y.speak(l("All site health tests have finished running. Your site is looking good."));break;case"improvable":wp.a11y.speak(l("All site health tests have finished running. There are items that should be addressed."));break;case"waiting-for-directory-sizes":wp.a11y.speak(l("Running additional tests... please wait."))}}e.on("success",function(e){var t=o(e.trigger),s=o(".success",t.closest("div"));e.clearSelection(),clearTimeout(a),s.removeClass("hidden"),a=setTimeout(function(){s.addClass("hidden")},3e3),wp.a11y.speak(l("Site information has been copied to your clipboard."))}),o(".health-check-accordion").on("click",".health-check-accordion-trigger",function(){"true"===o(this).attr("aria-expanded")?(o(this).attr("aria-expanded","false"),o("#"+o(this).attr("aria-controls")).attr("hidden",!0)):(o(this).attr("aria-expanded","true"),o("#"+o(this).attr("aria-controls")).attr("hidden",!1))}),o(".site-health-view-passed").on("click",function(){var e=o("#health-check-issues-good");e.toggleClass("hidden"),o(this).attr("aria-expanded",!e.hasClass("hidden"))}),"undefined"!=typeof SiteHealth&&(0===SiteHealth.site_status.direct.length&&0===SiteHealth.site_status.async.length?p():SiteHealth.site_status.issues={good:0,recommended:0,critical:0},0<SiteHealth.site_status.direct.length&&o.each(SiteHealth.site_status.direct,function(){d(this)}),(0<SiteHealth.site_status.async.length?function t(){var s=!0;1<=SiteHealth.site_status.async.length&&o.each(SiteHealth.site_status.async,function(){var e={action:"health-check-"+this.test.replace("_","-"),_wpnonce:SiteHealth.nonce.site_status};return!!this.completed||(s=!1,this.completed=!0,(void 0!==this.has_rest&&this.has_rest?wp.apiRequest({url:wp.url.addQueryArgs(this.test,{_locale:"user"}),headers:this.headers}).done(function(e){d(wp.hooks.applyFilters("site_status_test_result",e))}).fail(function(e){e=void 0!==e.responseJSON&&void 0!==e.responseJSON.message?e.responseJSON.message:l("No details available"),m(this.url,e)}):o.post(ajaxurl,e).done(function(e){d(wp.hooks.applyFilters("site_status_test_result",e.data))}).fail(function(e){e=void 0!==e.responseJSON&&void 0!==e.responseJSON.message?e.responseJSON.message:l("No details available"),m(this.url,e)})).always(function(){t()}),!1)}),s&&p()}:p)()),t&&(i.length?s:p)(),o(".health-check-offscreen-nav-wrapper").on("click",function(){o(this).toggleClass("visible")})}); \ No newline at end of file
diff --git a/wp-admin/js/site-icon.js b/wp-admin/js/site-icon.js
new file mode 100644
index 0000000..d032d89
--- /dev/null
+++ b/wp-admin/js/site-icon.js
@@ -0,0 +1,236 @@
+/**
+ * Handle the site icon setting in options-general.php.
+ *
+ * @since 6.5.0
+ * @output wp-admin/js/site-icon.js
+ */
+
+/* global jQuery, wp */
+
+( function ( $ ) {
+ var $chooseButton = $( '#choose-from-library-button' ),
+ $iconPreview = $( '#site-icon-preview' ),
+ $browserIconPreview = $( '#browser-icon-preview' ),
+ $appIconPreview = $( '#app-icon-preview' ),
+ $hiddenDataField = $( '#site_icon_hidden_field' ),
+ $removeButton = $( '#js-remove-site-icon' ),
+ frame;
+
+ /**
+ * Calculate image selection options based on the attachment dimensions.
+ *
+ * @since 6.5.0
+ *
+ * @param {Object} attachment The attachment object representing the image.
+ * @return {Object} The image selection options.
+ */
+ function calculateImageSelectOptions( attachment ) {
+ var realWidth = attachment.get( 'width' ),
+ realHeight = attachment.get( 'height' ),
+ xInit = 512,
+ yInit = 512,
+ ratio = xInit / yInit,
+ xImg = xInit,
+ yImg = yInit,
+ x1,
+ y1,
+ imgSelectOptions;
+
+ if ( realWidth / realHeight > ratio ) {
+ yInit = realHeight;
+ xInit = yInit * ratio;
+ } else {
+ xInit = realWidth;
+ yInit = xInit / ratio;
+ }
+
+ x1 = ( realWidth - xInit ) / 2;
+ y1 = ( realHeight - yInit ) / 2;
+
+ imgSelectOptions = {
+ aspectRatio: xInit + ':' + yInit,
+ handles: true,
+ keys: true,
+ instance: true,
+ persistent: true,
+ imageWidth: realWidth,
+ imageHeight: realHeight,
+ minWidth: xImg > xInit ? xInit : xImg,
+ minHeight: yImg > yInit ? yInit : yImg,
+ x1: x1,
+ y1: y1,
+ x2: xInit + x1,
+ y2: yInit + y1,
+ };
+
+ return imgSelectOptions;
+ }
+
+ /**
+ * Initializes the media frame for selecting or cropping an image.
+ *
+ * @since 6.5.0
+ */
+ $chooseButton.on( 'click', function () {
+ var $el = $( this );
+
+ // Create the media frame.
+ frame = wp.media( {
+ button: {
+ // Set the text of the button.
+ text: $el.data( 'update' ),
+
+ // Don't close, we might need to crop.
+ close: false,
+ },
+ states: [
+ new wp.media.controller.Library( {
+ title: $el.data( 'choose-text' ),
+ library: wp.media.query( { type: 'image' } ),
+ date: false,
+ suggestedWidth: $el.data( 'size' ),
+ suggestedHeight: $el.data( 'size' ),
+ } ),
+ new wp.media.controller.SiteIconCropper( {
+ control: {
+ params: {
+ width: $el.data( 'size' ),
+ height: $el.data( 'size' ),
+ },
+ },
+ imgSelectOptions: calculateImageSelectOptions,
+ } ),
+ ],
+ } );
+
+ frame.on( 'cropped', function ( attachment ) {
+ $hiddenDataField.val( attachment.id );
+ switchToUpdate( attachment );
+ frame.close();
+
+ // Start over with a frame that is so fresh and so clean clean.
+ frame = null;
+ } );
+
+ // When an image is selected, run a callback.
+ frame.on( 'select', function () {
+ // Grab the selected attachment.
+ var attachment = frame.state().get( 'selection' ).first();
+
+ if (
+ attachment.attributes.height === $el.data( 'size' ) &&
+ $el.data( 'size' ) === attachment.attributes.width
+ ) {
+ switchToUpdate( attachment.attributes );
+ frame.close();
+
+ // Set the value of the hidden input to the attachment id.
+ $hiddenDataField.val( attachment.id );
+ } else {
+ frame.setState( 'cropper' );
+ }
+ } );
+
+ frame.open();
+ } );
+
+ /**
+ * Update the UI when a site icon is selected.
+ *
+ * @since 6.5.0
+ *
+ * @param {array} attributes The attributes for the attachment.
+ */
+ function switchToUpdate( attributes ) {
+ var i18nAppAlternativeString, i18nBrowserAlternativeString;
+
+ if ( attributes.alt ) {
+ i18nAppAlternativeString = wp.i18n.sprintf(
+ /* translators: %s: The selected image alt text. */
+ wp.i18n.__( 'App icon preview: Current image: %s' ),
+ attributes.alt
+ );
+ i18nBrowserAlternativeString = wp.i18n.sprintf(
+ /* translators: %s: The selected image alt text. */
+ wp.i18n.__( 'Browser icon preview: Current image: %s' ),
+ attributes.alt
+ );
+ } else {
+ i18nAppAlternativeString = wp.i18n.sprintf(
+ /* translators: %s: The selected image filename. */
+ wp.i18n.__(
+ 'App icon preview: The current image has no alternative text. The file name is: %s'
+ ),
+ attributes.filename
+ );
+ i18nBrowserAlternativeString = wp.i18n.sprintf(
+ /* translators: %s: The selected image filename. */
+ wp.i18n.__(
+ 'Browser icon preview: The current image has no alternative text. The file name is: %s'
+ ),
+ attributes.filename
+ );
+ }
+
+ // Set site-icon-img src and alternative text to app icon preview.
+ $appIconPreview.attr( {
+ src: attributes.url,
+ alt: i18nAppAlternativeString,
+ } );
+
+ // Set site-icon-img src and alternative text to browser preview.
+ $browserIconPreview.attr( {
+ src: attributes.url,
+ alt: i18nBrowserAlternativeString,
+ } );
+
+ // Remove hidden class from icon preview div and remove button.
+ $iconPreview.removeClass( 'hidden' );
+ $removeButton.removeClass( 'hidden' );
+
+ // If the choose button is not in the update state, swap the classes.
+ if ( $chooseButton.attr( 'data-state' ) !== '1' ) {
+ $chooseButton.attr( {
+ class: $chooseButton.attr( 'data-alt-classes' ),
+ 'data-alt-classes': $chooseButton.attr( 'class' ),
+ 'data-state': '1',
+ } );
+ }
+
+ // Swap the text of the choose button.
+ $chooseButton.text( $chooseButton.attr( 'data-update-text' ) );
+ }
+
+ /**
+ * Handles the click event of the remove button.
+ *
+ * @since 6.5.0
+ */
+ $removeButton.on( 'click', function () {
+ $hiddenDataField.val( 'false' );
+ $( this ).toggleClass( 'hidden' );
+ $iconPreview.toggleClass( 'hidden' );
+ $browserIconPreview.attr( {
+ src: '',
+ alt: '',
+ } );
+ $appIconPreview.attr( {
+ src: '',
+ alt: '',
+ } );
+
+ /**
+ * Resets state to the button, for correct visual style and state.
+ * Updates the text of the button.
+ * Sets focus state to the button.
+ */
+ $chooseButton
+ .attr( {
+ class: $chooseButton.attr( 'data-alt-classes' ),
+ 'data-alt-classes': $chooseButton.attr( 'class' ),
+ 'data-state': '',
+ } )
+ .text( $chooseButton.attr( 'data-choose-text' ) )
+ .trigger( 'focus' );
+ } );
+} )( jQuery );
diff --git a/wp-admin/js/site-icon.min.js b/wp-admin/js/site-icon.min.js
new file mode 100644
index 0000000..e7e04b1
--- /dev/null
+++ b/wp-admin/js/site-icon.min.js
@@ -0,0 +1,2 @@
+/*! This file is auto-generated */
+!function(t){var a,i=t("#choose-from-library-button"),s=t("#site-icon-preview"),r=t("#browser-icon-preview"),n=t("#app-icon-preview"),l=t("#site_icon_hidden_field"),o=t("#js-remove-site-icon");function c(t){var e=t.get("width"),t=t.get("height"),a=512,i=512,s=a/i,r=a,n=i;return s<e/t?a=(i=t)*s:i=(a=e)/s,{aspectRatio:a+":"+i,handles:!0,keys:!0,instance:!0,persistent:!0,imageWidth:e,imageHeight:t,minWidth:a<r?a:r,minHeight:i<n?i:n,x1:s=(e-a)/2,y1:r=(t-i)/2,x2:a+s,y2:i+r}}function d(t){var e,a=t.alt?(e=wp.i18n.sprintf(wp.i18n.__("App icon preview: Current image: %s"),t.alt),wp.i18n.sprintf(wp.i18n.__("Browser icon preview: Current image: %s"),t.alt)):(e=wp.i18n.sprintf(wp.i18n.__("App icon preview: The current image has no alternative text. The file name is: %s"),t.filename),wp.i18n.sprintf(wp.i18n.__("Browser icon preview: The current image has no alternative text. The file name is: %s"),t.filename));n.attr({src:t.url,alt:e}),r.attr({src:t.url,alt:a}),s.removeClass("hidden"),o.removeClass("hidden"),"1"!==i.attr("data-state")&&i.attr({class:i.attr("data-alt-classes"),"data-alt-classes":i.attr("class"),"data-state":"1"}),i.text(i.attr("data-update-text"))}i.on("click",function(){var e=t(this);(a=wp.media({button:{text:e.data("update"),close:!1},states:[new wp.media.controller.Library({title:e.data("choose-text"),library:wp.media.query({type:"image"}),date:!1,suggestedWidth:e.data("size"),suggestedHeight:e.data("size")}),new wp.media.controller.SiteIconCropper({control:{params:{width:e.data("size"),height:e.data("size")}},imgSelectOptions:c})]})).on("cropped",function(t){l.val(t.id),d(t),a.close(),a=null}),a.on("select",function(){var t=a.state().get("selection").first();t.attributes.height===e.data("size")&&e.data("size")===t.attributes.width?(d(t.attributes),a.close(),l.val(t.id)):a.setState("cropper")}),a.open()}),o.on("click",function(){l.val("false"),t(this).toggleClass("hidden"),s.toggleClass("hidden"),r.attr({src:"",alt:""}),n.attr({src:"",alt:""}),i.attr({class:i.attr("data-alt-classes"),"data-alt-classes":i.attr("class"),"data-state":""}).text(i.attr("data-choose-text")).trigger("focus")})}(jQuery); \ No newline at end of file
diff --git a/wp-admin/js/tags-suggest.js b/wp-admin/js/tags-suggest.js
index f93396a..d439f06 100644
--- a/wp-admin/js/tags-suggest.js
+++ b/wp-admin/js/tags-suggest.js
@@ -4,12 +4,11 @@
* @output wp-admin/js/tags-suggest.js
*/
( function( $ ) {
- if ( typeof window.uiAutocompleteL10n === 'undefined' ) {
- return;
- }
-
var tempID = 0;
var separator = wp.i18n._x( ',', 'tag delimiter' ) || ',';
+ var __ = wp.i18n.__,
+ _n = wp.i18n._n,
+ sprintf = wp.i18n.sprintf;
function split( val ) {
return val.split( new RegExp( separator + '\\s*' ) );
@@ -139,13 +138,17 @@
collision: 'none'
},
messages: {
- noResults: window.uiAutocompleteL10n.noResults,
+ noResults: __( 'No results found.' ),
results: function( number ) {
- if ( number > 1 ) {
- return window.uiAutocompleteL10n.manyResults.replace( '%d', number );
- }
-
- return window.uiAutocompleteL10n.oneResult;
+ return sprintf(
+ /* translators: %d: Number of search results found. */
+ _n(
+ '%d result found. Use up and down arrow keys to navigate.',
+ '%d results found. Use up and down arrow keys to navigate.',
+ number
+ ),
+ number
+ );
}
}
}, options );
diff --git a/wp-admin/js/tags-suggest.min.js b/wp-admin/js/tags-suggest.min.js
index bbea7bb..af3d4dc 100644
--- a/wp-admin/js/tags-suggest.min.js
+++ b/wp-admin/js/tags-suggest.min.js
@@ -1,2 +1,2 @@
/*! This file is auto-generated */
-!function(u){var s,a;function l(e){return e.split(new RegExp(a+"\\s*"))}void 0!==window.uiAutocompleteL10n&&(s=0,a=wp.i18n._x(",","tag delimiter")||",",u.fn.wpTagsSuggest=function(e){var i,o,n,r=u(this);return r.length&&(n=(e=e||{}).taxonomy||r.attr("data-wp-taxonomy")||"post_tag",delete e.taxonomy,e=u.extend({source:function(e,a){var t;o===e.term?a(i):(t=l(e.term).pop(),u.get(window.ajaxurl,{action:"ajax-tag-search",tax:n,q:t,number:20}).always(function(){r.removeClass("ui-autocomplete-loading")}).done(function(e){var t,o=[];if(e){for(t in e=e.split("\n")){var n=++s;o.push({id:n,name:e[t]})}a(i=o)}else a(o)}),o=e.term)},focus:function(e,t){r.attr("aria-activedescendant","wp-tags-autocomplete-"+t.item.id),e.preventDefault()},select:function(e,t){var o=l(r.val());return o.pop(),o.push(t.item.name,""),r.val(o.join(a+" ")),u.ui.keyCode.TAB===e.keyCode?(window.wp.a11y.speak(wp.i18n.__("Term selected."),"assertive"),e.preventDefault()):u.ui.keyCode.ENTER===e.keyCode&&(window.tagBox&&(window.tagBox.userAction="add",window.tagBox.flushTags(u(this).closest(".tagsdiv"))),e.preventDefault(),e.stopPropagation()),!1},open:function(){r.attr("aria-expanded","true")},close:function(){r.attr("aria-expanded","false")},minLength:2,position:{my:"left top+2",at:"left bottom",collision:"none"},messages:{noResults:window.uiAutocompleteL10n.noResults,results:function(e){return 1<e?window.uiAutocompleteL10n.manyResults.replace("%d",e):window.uiAutocompleteL10n.oneResult}}},e),r.on("keydown",function(){r.removeAttr("aria-activedescendant")}),r.autocomplete(e),r.autocomplete("instance"))&&(r.autocomplete("instance")._renderItem=function(e,t){return u('<li role="option" id="wp-tags-autocomplete-'+t.id+'">').text(t.name).appendTo(e)},r.attr({role:"combobox","aria-autocomplete":"list","aria-expanded":"false","aria-owns":r.autocomplete("widget").attr("id")}).on("focus",function(){l(r.val()).pop()&&r.autocomplete("search")}),r.autocomplete("widget").addClass("wp-tags-autocomplete").attr("role","listbox").removeAttr("tabindex").on("menufocus",function(e,t){t.item.attr("aria-selected","true")}).on("menublur",function(){u(this).find('[aria-selected="true"]').removeAttr("aria-selected")})),this})}(jQuery); \ No newline at end of file
+!function(s){var u=0,n=wp.i18n._x(",","tag delimiter")||",",t=wp.i18n.__,d=wp.i18n._n,l=wp.i18n.sprintf;function p(e){return e.split(new RegExp(n+"\\s*"))}s.fn.wpTagsSuggest=function(e){var i,o,a,r=s(this);return r.length&&(a=(e=e||{}).taxonomy||r.attr("data-wp-taxonomy")||"post_tag",delete e.taxonomy,e=s.extend({source:function(e,n){var t;o===e.term?n(i):(t=p(e.term).pop(),s.get(window.ajaxurl,{action:"ajax-tag-search",tax:a,q:t,number:20}).always(function(){r.removeClass("ui-autocomplete-loading")}).done(function(e){var t,o=[];if(e){for(t in e=e.split("\n")){var a=++u;o.push({id:a,name:e[t]})}n(i=o)}else n(o)}),o=e.term)},focus:function(e,t){r.attr("aria-activedescendant","wp-tags-autocomplete-"+t.item.id),e.preventDefault()},select:function(e,t){var o=p(r.val());return o.pop(),o.push(t.item.name,""),r.val(o.join(n+" ")),s.ui.keyCode.TAB===e.keyCode?(window.wp.a11y.speak(wp.i18n.__("Term selected."),"assertive"),e.preventDefault()):s.ui.keyCode.ENTER===e.keyCode&&(window.tagBox&&(window.tagBox.userAction="add",window.tagBox.flushTags(s(this).closest(".tagsdiv"))),e.preventDefault(),e.stopPropagation()),!1},open:function(){r.attr("aria-expanded","true")},close:function(){r.attr("aria-expanded","false")},minLength:2,position:{my:"left top+2",at:"left bottom",collision:"none"},messages:{noResults:t("No results found."),results:function(e){return l(d("%d result found. Use up and down arrow keys to navigate.","%d results found. Use up and down arrow keys to navigate.",e),e)}}},e),r.on("keydown",function(){r.removeAttr("aria-activedescendant")}),r.autocomplete(e),r.autocomplete("instance"))&&(r.autocomplete("instance")._renderItem=function(e,t){return s('<li role="option" id="wp-tags-autocomplete-'+t.id+'">').text(t.name).appendTo(e)},r.attr({role:"combobox","aria-autocomplete":"list","aria-expanded":"false","aria-owns":r.autocomplete("widget").attr("id")}).on("focus",function(){p(r.val()).pop()&&r.autocomplete("search")}),r.autocomplete("widget").addClass("wp-tags-autocomplete").attr("role","listbox").removeAttr("tabindex").on("menufocus",function(e,t){t.item.attr("aria-selected","true")}).on("menublur",function(){s(this).find('[aria-selected="true"]').removeAttr("aria-selected")})),this}}(jQuery); \ No newline at end of file
diff --git a/wp-admin/js/theme.js b/wp-admin/js/theme.js
index 5daf04f..13ed5aa 100644
--- a/wp-admin/js/theme.js
+++ b/wp-admin/js/theme.js
@@ -1300,7 +1300,7 @@ themes.view.Themes = wp.Backbone.View.extend({
// Find the next model within the collection.
nextModel = self.collection.at( self.collection.indexOf( model ) + 1 );
- // Sanity check which also serves as a boundary test.
+ // Confidence check which also serves as a boundary test.
if ( nextModel !== undefined ) {
// We have a new theme...
diff --git a/wp-admin/js/updates.js b/wp-admin/js/updates.js
index a994fda..bca7de6 100644
--- a/wp-admin/js/updates.js
+++ b/wp-admin/js/updates.js
@@ -414,6 +414,31 @@
};
/**
+ * Sends a message from a modal to the main screen to update buttons in plugin cards.
+ *
+ * @since 6.5.0
+ *
+ * @param {Object} data An object of data to use for the button.
+ * @param {string} data.slug The plugin's slug.
+ * @param {string} data.text The text to use for the button.
+ * @param {string} data.ariaLabel The value for the button's aria-label attribute. An empty string removes the attribute.
+ * @param {string=} data.status Optional. An identifier for the status.
+ * @param {string=} data.removeClasses Optional. A space-separated list of classes to remove from the button.
+ * @param {string=} data.addClasses Optional. A space-separated list of classes to add to the button.
+ * @param {string=} data.href Optional. The button's URL.
+ * @param {string=} data.pluginName Optional. The plugin's name.
+ * @param {string=} data.plugin Optional. The plugin file, relative to the plugins directory.
+ */
+ wp.updates.setCardButtonStatus = function( data ) {
+ var target = window.parent === window ? null : window.parent;
+
+ $.support.postMessage = !! window.postMessage;
+ if ( false !== $.support.postMessage && null !== target && -1 === window.parent.location.pathname.indexOf( 'index.php' ) ) {
+ target.postMessage( JSON.stringify( data ), window.location.origin );
+ }
+ };
+
+ /**
* Decrements the update counts throughout the various menus.
*
* This includes the toolbar, the "Updates" menu item and the menu items
@@ -452,7 +477,9 @@
*/
wp.updates.updatePlugin = function( args ) {
var $updateRow, $card, $message, message,
- $adminBarUpdates = $( '#wp-admin-bar-updates' );
+ $adminBarUpdates = $( '#wp-admin-bar-updates' ),
+ buttonText = __( 'Updating...' ),
+ isPluginInstall = 'plugin-install' === pagenow || 'plugin-install-network' === pagenow;
args = _.extend( {
success: wp.updates.updatePluginSuccess,
@@ -467,8 +494,8 @@
_x( 'Updating %s...', 'plugin' ),
$updateRow.find( '.plugin-title strong' ).text()
);
- } else if ( 'plugin-install' === pagenow || 'plugin-install-network' === pagenow ) {
- $card = $( '.plugin-card-' + args.slug );
+ } else if ( isPluginInstall ) {
+ $card = $( '.plugin-card-' + args.slug + ', #plugin-information-footer' );
$message = $card.find( '.update-now' ).addClass( 'updating-message' );
message = sprintf(
/* translators: %s: Plugin name and version. */
@@ -488,10 +515,22 @@
$message
.attr( 'aria-label', message )
- .text( __( 'Updating...' ) );
+ .text( buttonText );
$document.trigger( 'wp-plugin-updating', args );
+ if ( isPluginInstall && 'plugin-information-footer' === $card.attr( 'id' ) ) {
+ wp.updates.setCardButtonStatus(
+ {
+ status: 'updating-plugin',
+ slug: args.slug,
+ addClasses: 'updating-message',
+ text: buttonText,
+ ariaLabel: message
+ }
+ );
+ }
+
return wp.updates.ajax( 'update-plugin', args );
};
@@ -511,7 +550,13 @@
*/
wp.updates.updatePluginSuccess = function( response ) {
var $pluginRow, $updateMessage, newText,
- $adminBarUpdates = $( '#wp-admin-bar-updates' );
+ $adminBarUpdates = $( '#wp-admin-bar-updates' ),
+ buttonText = _x( 'Updated!', 'plugin' ),
+ ariaLabel = sprintf(
+ /* translators: %s: Plugin name and version. */
+ _x( '%s updated!', 'plugin' ),
+ response.pluginName
+ );
if ( 'plugins' === pagenow || 'plugins-network' === pagenow ) {
$pluginRow = $( 'tr[data-plugin="' + response.plugin + '"]' )
@@ -528,7 +573,7 @@
// Clear the "time to next auto-update" text.
$pluginRow.find( '.auto-update-time' ).empty();
} else if ( 'plugin-install' === pagenow || 'plugin-install-network' === pagenow ) {
- $updateMessage = $( '.plugin-card-' + response.slug ).find( '.update-now' )
+ $updateMessage = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' ).find( '.update-now' )
.removeClass( 'updating-message' )
.addClass( 'button-disabled updated-message' );
}
@@ -536,19 +581,25 @@
$adminBarUpdates.removeClass( 'spin' );
$updateMessage
- .attr(
- 'aria-label',
- sprintf(
- /* translators: %s: Plugin name and version. */
- _x( '%s updated!', 'plugin' ),
- response.pluginName
- )
- )
- .text( _x( 'Updated!', 'plugin' ) );
+ .attr( 'aria-label', ariaLabel )
+ .text( buttonText );
wp.a11y.speak( __( 'Update completed successfully.' ) );
- wp.updates.decrementCount( 'plugin' );
+ if ( 'plugin_install_from_iframe' !== $updateMessage.attr( 'id' ) ) {
+ wp.updates.decrementCount( 'plugin' );
+ } else {
+ wp.updates.setCardButtonStatus(
+ {
+ status: 'updated-plugin',
+ slug: response.slug,
+ removeClasses: 'updating-message',
+ addClasses: 'button-disabled updated-message',
+ text: buttonText,
+ ariaLabel: ariaLabel
+ }
+ );
+ }
$document.trigger( 'wp-plugin-update-success', response );
};
@@ -567,7 +618,7 @@
* @param {string} response.errorMessage The error that occurred.
*/
wp.updates.updatePluginError = function( response ) {
- var $pluginRow, $card, $message, errorMessage,
+ var $pluginRow, $card, $message, errorMessage, buttonText, ariaLabel,
$adminBarUpdates = $( '#wp-admin-bar-updates' );
if ( ! wp.updates.isValidResponse( response, 'update' ) ) {
@@ -608,28 +659,32 @@
$message.find( 'p' ).removeAttr( 'aria-label' );
}
} else if ( 'plugin-install' === pagenow || 'plugin-install-network' === pagenow ) {
- $card = $( '.plugin-card-' + response.slug )
- .addClass( 'plugin-card-update-failed' )
+ buttonText = __( 'Update failed.' );
+
+ $card = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' )
.append( wp.updates.adminNotice( {
className: 'update-message notice-error notice-alt is-dismissible',
message: errorMessage
} ) );
+ if ( $card.hasClass( 'plugin-card-' + response.slug ) ) {
+ $card.addClass( 'plugin-card-update-failed' );
+ }
+
$card.find( '.update-now' )
- .text( __( 'Update failed.' ) )
+ .text( buttonText )
.removeClass( 'updating-message' );
if ( response.pluginName ) {
- $card.find( '.update-now' )
- .attr(
- 'aria-label',
- sprintf(
- /* translators: %s: Plugin name and version. */
- _x( '%s update failed.', 'plugin' ),
- response.pluginName
- )
- );
+ ariaLabel = sprintf(
+ /* translators: %s: Plugin name and version. */
+ _x( '%s update failed.', 'plugin' ),
+ response.pluginName
+ );
+
+ $card.find( '.update-now' ).attr( 'aria-label', ariaLabel );
} else {
+ ariaLabel = '';
$card.find( '.update-now' ).removeAttr( 'aria-label' );
}
@@ -652,6 +707,18 @@
wp.a11y.speak( errorMessage, 'assertive' );
+ if ( 'plugin-information-footer' === $card.attr('id' ) ) {
+ wp.updates.setCardButtonStatus(
+ {
+ status: 'plugin-update-failed',
+ slug: response.slug,
+ removeClasses: 'updating-message',
+ text: buttonText,
+ ariaLabel: ariaLabel
+ }
+ );
+ }
+
$document.trigger( 'wp-plugin-update-error', response );
};
@@ -668,8 +735,10 @@
* decorated with an abort() method.
*/
wp.updates.installPlugin = function( args ) {
- var $card = $( '.plugin-card-' + args.slug ),
- $message = $card.find( '.install-now' );
+ var $card = $( '.plugin-card-' + args.slug + ', #plugin-information-footer' ),
+ $message = $card.find( '.install-now' ),
+ buttonText = __( 'Installing...' ),
+ ariaLabel;
args = _.extend( {
success: wp.updates.installPluginSuccess,
@@ -684,17 +753,16 @@
$message.data( 'originaltext', $message.html() );
}
+ ariaLabel = sprintf(
+ /* translators: %s: Plugin name and version. */
+ _x( 'Installing %s...', 'plugin' ),
+ $message.data( 'name' )
+ );
+
$message
.addClass( 'updating-message' )
- .attr(
- 'aria-label',
- sprintf(
- /* translators: %s: Plugin name and version. */
- _x( 'Installing %s...', 'plugin' ),
- $message.data( 'name' )
- )
- )
- .text( __( 'Installing...' ) );
+ .attr( 'aria-label', ariaLabel )
+ .text( buttonText );
wp.a11y.speak( __( 'Installing... please wait.' ) );
@@ -703,6 +771,18 @@
$document.trigger( 'wp-plugin-installing', args );
+ if ( 'plugin-information-footer' === $message.parent().attr( 'id' ) ) {
+ wp.updates.setCardButtonStatus(
+ {
+ status: 'installing-plugin',
+ slug: args.slug,
+ addClasses: 'updating-message',
+ text: buttonText,
+ ariaLabel: ariaLabel
+ }
+ );
+ }
+
return wp.updates.ajax( 'install-plugin', args );
};
@@ -717,20 +797,19 @@
* @param {string} response.activateUrl URL to activate the just installed plugin.
*/
wp.updates.installPluginSuccess = function( response ) {
- var $message = $( '.plugin-card-' + response.slug ).find( '.install-now' );
+ var $message = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' ).find( '.install-now' ),
+ buttonText = _x( 'Installed!', 'plugin' ),
+ ariaLabel = sprintf(
+ /* translators: %s: Plugin name and version. */
+ _x( '%s installed!', 'plugin' ),
+ response.pluginName
+ );
$message
.removeClass( 'updating-message' )
.addClass( 'updated-message installed button-disabled' )
- .attr(
- 'aria-label',
- sprintf(
- /* translators: %s: Plugin name and version. */
- _x( '%s installed!', 'plugin' ),
- response.pluginName
- )
- )
- .text( _x( 'Installed!', 'plugin' ) );
+ .attr( 'aria-label', ariaLabel )
+ .text( buttonText );
wp.a11y.speak( __( 'Installation completed successfully.' ) );
@@ -738,36 +817,23 @@
if ( response.activateUrl ) {
setTimeout( function() {
+ wp.updates.checkPluginDependencies( {
+ slug: response.slug
+ } );
+ }, 1000 );
+ }
- // Transform the 'Install' button into an 'Activate' button.
- $message.removeClass( 'install-now installed button-disabled updated-message' )
- .addClass( 'activate-now button-primary' )
- .attr( 'href', response.activateUrl );
-
- if ( 'plugins-network' === pagenow ) {
- $message
- .attr(
- 'aria-label',
- sprintf(
- /* translators: %s: Plugin name. */
- _x( 'Network Activate %s', 'plugin' ),
- response.pluginName
- )
- )
- .text( __( 'Network Activate' ) );
- } else {
- $message
- .attr(
- 'aria-label',
- sprintf(
- /* translators: %s: Plugin name. */
- _x( 'Activate %s', 'plugin' ),
- response.pluginName
- )
- )
- .text( __( 'Activate' ) );
+ if ( 'plugin-information-footer' === $message.parent().attr( 'id' ) ) {
+ wp.updates.setCardButtonStatus(
+ {
+ status: 'installed-plugin',
+ slug: response.slug,
+ removeClasses: 'updating-message',
+ addClasses: 'updated-message installed button-disabled',
+ text: buttonText,
+ ariaLabel: ariaLabel
}
- }, 1000 );
+ );
}
};
@@ -783,8 +849,14 @@
* @param {string} response.errorMessage The error that occurred.
*/
wp.updates.installPluginError = function( response ) {
- var $card = $( '.plugin-card-' + response.slug ),
+ var $card = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' ),
$button = $card.find( '.install-now' ),
+ buttonText = __( 'Installation failed.' ),
+ ariaLabel = sprintf(
+ /* translators: %s: Plugin name and version. */
+ _x( '%s installation failed', 'plugin' ),
+ $button.data( 'name' )
+ ),
errorMessage;
if ( ! wp.updates.isValidResponse( response, 'install' ) ) {
@@ -817,22 +889,335 @@
$button
.removeClass( 'updating-message' ).addClass( 'button-disabled' )
- .attr(
- 'aria-label',
- sprintf(
- /* translators: %s: Plugin name and version. */
- _x( '%s installation failed', 'plugin' ),
- $button.data( 'name' )
- )
- )
- .text( __( 'Installation failed.' ) );
+ .attr( 'aria-label', ariaLabel )
+ .text( buttonText );
wp.a11y.speak( errorMessage, 'assertive' );
+ wp.updates.setCardButtonStatus(
+ {
+ status: 'plugin-install-failed',
+ slug: response.slug,
+ removeClasses: 'updating-message',
+ addClasses: 'button-disabled',
+ text: buttonText,
+ ariaLabel: ariaLabel
+ }
+ );
+
$document.trigger( 'wp-plugin-install-error', response );
};
/**
+ * Sends an Ajax request to the server to check a plugin's dependencies.
+ *
+ * @since 6.5.0
+ *
+ * @param {Object} args Arguments.
+ * @param {string} args.slug Plugin identifier in the WordPress.org Plugin repository.
+ * @param {checkPluginDependenciesSuccess=} args.success Optional. Success callback. Default: wp.updates.checkPluginDependenciesSuccess
+ * @param {checkPluginDependenciesError=} args.error Optional. Error callback. Default: wp.updates.checkPluginDependenciesError
+ * @return {$.promise} A jQuery promise that represents the request,
+ * decorated with an abort() method.
+ */
+ wp.updates.checkPluginDependencies = function( args ) {
+ args = _.extend( {
+ success: wp.updates.checkPluginDependenciesSuccess,
+ error: wp.updates.checkPluginDependenciesError
+ }, args );
+
+ wp.a11y.speak( __( 'Checking plugin dependencies... please wait.' ) );
+ $document.trigger( 'wp-checking-plugin-dependencies', args );
+
+ return wp.updates.ajax( 'check_plugin_dependencies', args );
+ };
+
+ /**
+ * Updates the UI appropriately after a successful plugin dependencies check.
+ *
+ * @since 6.5.0
+ *
+ * @param {Object} response Response from the server.
+ * @param {string} response.slug Slug of the checked plugin.
+ * @param {string} response.pluginName Name of the checked plugin.
+ * @param {string} response.plugin The plugin file, relative to the plugins directory.
+ * @param {string} response.activateUrl URL to activate the just checked plugin.
+ */
+ wp.updates.checkPluginDependenciesSuccess = function( response ) {
+ var $message = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' ).find( '.install-now' ),
+ buttonText, ariaLabel;
+
+ // Transform the 'Install' button into an 'Activate' button.
+ $message
+ .removeClass( 'install-now installed button-disabled updated-message' )
+ .addClass( 'activate-now button-primary' )
+ .attr( 'href', response.activateUrl );
+
+ wp.a11y.speak( __( 'Plugin dependencies check completed successfully.' ) );
+ $document.trigger( 'wp-check-plugin-dependencies-success', response );
+
+ if ( 'plugins-network' === pagenow ) {
+ buttonText = _x( 'Network Activate', 'plugin' );
+ ariaLabel = sprintf(
+ /* translators: %s: Plugin name. */
+ _x( 'Network Activate %s', 'plugin' ),
+ response.pluginName
+ );
+
+ $message
+ .attr( 'aria-label', ariaLabel )
+ .text( buttonText );
+ } else {
+ buttonText = _x( 'Activate', 'plugin' );
+ ariaLabel = sprintf(
+ /* translators: %s: Plugin name. */
+ _x( 'Activate %s', 'plugin' ),
+ response.pluginName
+ );
+
+ $message
+ .attr( 'aria-label', ariaLabel )
+ .attr( 'data-name', response.pluginName )
+ .attr( 'data-slug', response.slug )
+ .attr( 'data-plugin', response.plugin )
+ .text( buttonText );
+ }
+
+ if ( 'plugin-information-footer' === $message.parent().attr( 'id' ) ) {
+ wp.updates.setCardButtonStatus(
+ {
+ status: 'dependencies-check-success',
+ slug: response.slug,
+ removeClasses: 'install-now installed button-disabled updated-message',
+ addClasses: 'activate-now button-primary',
+ text: buttonText,
+ ariaLabel: ariaLabel,
+ pluginName: response.pluginName,
+ plugin: response.plugin,
+ href: response.activateUrl
+ }
+ );
+ }
+ };
+
+ /**
+ * Updates the UI appropriately after a failed plugin dependencies check.
+ *
+ * @since 6.5.0
+ *
+ * @param {Object} response Response from the server.
+ * @param {string} response.slug Slug of the plugin to be checked.
+ * @param {string=} response.pluginName Optional. Name of the plugin to be checked.
+ * @param {string} response.errorCode Error code for the error that occurred.
+ * @param {string} response.errorMessage The error that occurred.
+ */
+ wp.updates.checkPluginDependenciesError = function( response ) {
+ var $message = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' ).find( '.install-now' ),
+ buttonText = _x( 'Activate', 'plugin' ),
+ ariaLabel = sprintf(
+ /* translators: 1: Plugin name, 2. The reason the plugin cannot be activated. */
+ _x( 'Cannot activate %1$s. %2$s', 'plugin' ),
+ response.pluginName,
+ response.errorMessage
+ ),
+ errorMessage;
+
+ if ( ! wp.updates.isValidResponse( response, 'check-dependencies' ) ) {
+ return;
+ }
+
+ errorMessage = sprintf(
+ /* translators: %s: Error string for a failed activation. */
+ __( 'Activation failed: %s' ),
+ response.errorMessage
+ );
+
+ wp.a11y.speak( errorMessage, 'assertive' );
+ $document.trigger( 'wp-check-plugin-dependencies-error', response );
+
+ $message
+ .removeClass( 'install-now installed updated-message' )
+ .addClass( 'activate-now button-primary' )
+ .attr( 'aria-label', ariaLabel )
+ .text( buttonText );
+
+ if ( 'plugin-information-footer' === $message.parent().attr('id' ) ) {
+ wp.updates.setCardButtonStatus(
+ {
+ status: 'dependencies-check-failed',
+ slug: response.slug,
+ removeClasses: 'install-now installed updated-message',
+ addClasses: 'activate-now button-primary',
+ text: buttonText,
+ ariaLabel: ariaLabel
+ }
+ );
+ }
+ };
+
+ /**
+ * Sends an Ajax request to the server to activate a plugin.
+ *
+ * @since 6.5.0
+ *
+ * @param {Object} args Arguments.
+ * @param {string} args.name The name of the plugin.
+ * @param {string} args.slug Plugin identifier in the WordPress.org Plugin repository.
+ * @param {string} args.plugin The plugin file, relative to the plugins directory.
+ * @param {activatePluginSuccess=} args.success Optional. Success callback. Default: wp.updates.activatePluginSuccess
+ * @param {activatePluginError=} args.error Optional. Error callback. Default: wp.updates.activatePluginError
+ * @return {$.promise} A jQuery promise that represents the request,
+ * decorated with an abort() method.
+ */
+ wp.updates.activatePlugin = function( args ) {
+ var $message = $( '.plugin-card-' + args.slug + ', #plugin-information-footer' ).find( '.activate-now, .activating-message' );
+
+ args = _.extend( {
+ success: wp.updates.activatePluginSuccess,
+ error: wp.updates.activatePluginError
+ }, args );
+
+ wp.a11y.speak( __( 'Activating... please wait.' ) );
+ $document.trigger( 'wp-activating-plugin', args );
+
+ if ( 'plugin-information-footer' === $message.parent().attr( 'id' ) ) {
+ wp.updates.setCardButtonStatus(
+ {
+ status: 'activating-plugin',
+ slug: args.slug,
+ removeClasses: 'installed updated-message button-primary',
+ addClasses: 'activating-message',
+ text: __( 'Activating...' ),
+ ariaLabel: sprintf(
+ /* translators: %s: Plugin name. */
+ _x( 'Activating %s', 'plugin' ),
+ args.name
+ )
+ }
+ );
+ }
+
+ return wp.updates.ajax( 'activate-plugin', args );
+ };
+
+ /**
+ * Updates the UI appropriately after a successful plugin activation.
+ *
+ * @since 6.5.0
+ *
+ * @param {Object} response Response from the server.
+ * @param {string} response.slug Slug of the activated plugin.
+ * @param {string} response.pluginName Name of the activated plugin.
+ * @param {string} response.plugin The plugin file, relative to the plugins directory.
+ */
+ wp.updates.activatePluginSuccess = function( response ) {
+ var $message = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' ).find( '.activating-message' ),
+ buttonText = _x( 'Activated!', 'plugin' ),
+ ariaLabel = sprintf(
+ /* translators: %s: The plugin name. */
+ '%s activated successfully.',
+ response.pluginName
+ );
+
+ wp.a11y.speak( __( 'Activation completed successfully.' ) );
+ $document.trigger( 'wp-plugin-activate-success', response );
+
+ $message
+ .removeClass( 'activating-message' )
+ .addClass( 'activated-message button-disabled' )
+ .attr( 'aria-label', ariaLabel )
+ .text( buttonText );
+
+ if ( 'plugin-information-footer' === $message.parent().attr( 'id' ) ) {
+ wp.updates.setCardButtonStatus(
+ {
+ status: 'activated-plugin',
+ slug: response.slug,
+ removeClasses: 'activating-message',
+ addClasses: 'activated-message button-disabled',
+ text: buttonText,
+ ariaLabel: ariaLabel
+ }
+ );
+ }
+
+ setTimeout( function() {
+ $message.removeClass( 'activated-message' )
+ .text( _x( 'Active', 'plugin' ) );
+
+ if ( 'plugin-information-footer' === $message.parent().attr( 'id' ) ) {
+ wp.updates.setCardButtonStatus(
+ {
+ status: 'plugin-active',
+ slug: response.slug,
+ removeClasses: 'activated-message',
+ text: _x( 'Active', 'plugin' ),
+ ariaLabel: sprintf(
+ /* translators: %s: The plugin name. */
+ '%s is active.',
+ response.pluginName
+ )
+ }
+ );
+ }
+ }, 1000 );
+ };
+
+ /**
+ * Updates the UI appropriately after a failed plugin activation.
+ *
+ * @since 6.5.0
+ *
+ * @param {Object} response Response from the server.
+ * @param {string} response.slug Slug of the plugin to be activated.
+ * @param {string=} response.pluginName Optional. Name of the plugin to be activated.
+ * @param {string} response.errorCode Error code for the error that occurred.
+ * @param {string} response.errorMessage The error that occurred.
+ */
+ wp.updates.activatePluginError = function( response ) {
+ var $message = $( '.plugin-card-' + response.slug + ', #plugin-information-footer' ).find( '.activating-message' ),
+ buttonText = __( 'Activation failed.' ),
+ ariaLabel = sprintf(
+ /* translators: %s: Plugin name. */
+ _x( '%s activation failed', 'plugin' ),
+ response.pluginName
+ ),
+ errorMessage;
+
+ if ( ! wp.updates.isValidResponse( response, 'activate' ) ) {
+ return;
+ }
+
+ errorMessage = sprintf(
+ /* translators: %s: Error string for a failed activation. */
+ __( 'Activation failed: %s' ),
+ response.errorMessage
+ );
+
+ wp.a11y.speak( errorMessage, 'assertive' );
+ $document.trigger( 'wp-plugin-activate-error', response );
+
+ $message
+ .removeClass( 'install-now installed activating-message' )
+ .addClass( 'button-disabled' )
+ .attr( 'aria-label', ariaLabel )
+ .text( buttonText );
+
+ if ( 'plugin-information-footer' === $message.parent().attr( 'id' ) ) {
+ wp.updates.setCardButtonStatus(
+ {
+ status: 'plugin-activation-failed',
+ slug: response.slug,
+ removeClasses: 'install-now installed activating-message',
+ addClasses: 'button-disabled',
+ text: buttonText,
+ ariaLabel: ariaLabel
+ }
+ );
+ }
+ };
+
+ /**
* Updates the UI appropriately after a successful importer install.
*
* @since 4.6.0
@@ -915,7 +1300,7 @@
pluginName
)
)
- .text( __( 'Install Now' ) );
+ .text( _x( 'Install Now', 'plugin' ) );
wp.a11y.speak( errorMessage, 'assertive' );
@@ -1069,7 +1454,7 @@
$itemsCount.text(
sprintf(
/* translators: %s: The remaining number of plugins. */
- _nx( '%s item', '%s items', 'plugin/plugins', remainingCount ),
+ _nx( '%s item', '%s items', remainingCount, 'plugin/plugins' ),
remainingCount
)
);
@@ -1418,7 +1803,7 @@
response.themeName
)
)
- .text( __( 'Activate' ) );
+ .text( _x( 'Activate', 'theme' ) );
}
}
@@ -1970,6 +2355,16 @@
errorMessage = __( 'Installation failed: %s' );
break;
+ case 'check-dependencies':
+ /* translators: %s: Error string for a failed dependencies check. */
+ errorMessage = __( 'Dependencies check failed: %s' );
+ break;
+
+ case 'activate':
+ /* translators: %s: Error string for a failed activation. */
+ errorMessage = __( 'Activation failed: %s' );
+ break;
+
case 'delete':
/* translators: %s: Error string for a failed deletion. */
errorMessage = __( 'Deletion failed: %s' );
@@ -2025,7 +2420,7 @@
};
$( function() {
- var $pluginFilter = $( '#plugin-filter' ),
+ var $pluginFilter = $( '#plugin-filter, #plugin-information-footer' ),
$bulkActionForm = $( '#bulk-action-form' ),
$filesystemForm = $( '#request-filesystem-credentials-form' ),
$filesystemModal = $( '#request-filesystem-credentials-dialog' ),
@@ -2230,7 +2625,7 @@
$message
.removeClass( 'updating-message' )
- .text( __( 'Install Now' ) );
+ .text( _x( 'Install Now', 'plugin' ) );
wp.a11y.speak( __( 'Update canceled.' ) );
} );
@@ -2242,6 +2637,44 @@
} );
/**
+ * Click handler for plugin activations in plugin activation view.
+ *
+ * @since 6.5.0
+ *
+ * @param {Event} event Event interface.
+ */
+ $pluginFilter.on( 'click', '.activate-now', function( event ) {
+ var $activateButton = $( event.target );
+
+ event.preventDefault();
+
+ if ( $activateButton.hasClass( 'activating-message' ) || $activateButton.hasClass( 'button-disabled' ) ) {
+ return;
+ }
+
+ $activateButton
+ .removeClass( 'activate-now button-primary' )
+ .addClass( 'activating-message' )
+ .attr(
+ 'aria-label',
+ sprintf(
+ /* translators: %s: Plugin name. */
+ _x( 'Activating %s', 'plugin' ),
+ $activateButton.data( 'name' )
+ )
+ )
+ .text( __( 'Activating...' ) );
+
+ wp.updates.activatePlugin(
+ {
+ name: $activateButton.data( 'name' ),
+ slug: $activateButton.data( 'slug' ),
+ plugin: $activateButton.data( 'plugin' )
+ }
+ );
+ });
+
+ /**
* Click handler for importer plugins installs in the Import screen.
*
* @since 4.6.0
@@ -2273,7 +2706,7 @@
pluginName
)
)
- .text( __( 'Install Now' ) );
+ .text( _x( 'Install Now', 'plugin' ) );
wp.a11y.speak( __( 'Update canceled.' ) );
} );
@@ -2767,35 +3200,6 @@
} );
/**
- * Click handler for installing a plugin from the details modal on `plugin-install.php`.
- *
- * @since 4.6.0
- *
- * @param {Event} event Event interface.
- */
- $( '#plugin_install_from_iframe' ).on( 'click', function( event ) {
- var target = window.parent === window ? null : window.parent,
- install;
-
- $.support.postMessage = !! window.postMessage;
-
- if ( false === $.support.postMessage || null === target || -1 !== window.parent.location.pathname.indexOf( 'index.php' ) ) {
- return;
- }
-
- event.preventDefault();
-
- install = {
- action: 'install-plugin',
- data: {
- slug: $( this ).data( 'slug' )
- }
- };
-
- target.postMessage( JSON.stringify( install ), window.location.origin );
- } );
-
- /**
* Handles postMessage events.
*
* @since 4.2.0
@@ -2818,7 +3222,45 @@
return;
}
- if ( ! message || 'undefined' === typeof message.action ) {
+ if ( ! message ) {
+ return;
+ }
+
+ if (
+ 'undefined' !== typeof message.status &&
+ 'undefined' !== typeof message.slug &&
+ 'undefined' !== typeof message.text &&
+ 'undefined' !== typeof message.ariaLabel
+ ) {
+ var $card = $( '.plugin-card-' + message.slug ),
+ $message = $card.find( '[data-slug="' + message.slug + '"]' );
+
+ if ( 'undefined' !== typeof message.removeClasses ) {
+ $message.removeClass( message.removeClasses );
+ }
+
+ if ( 'undefined' !== typeof message.addClasses ) {
+ $message.addClass( message.addClasses );
+ }
+
+ if ( '' === message.ariaLabel ) {
+ $message.removeAttr( 'aria-label' );
+ } else {
+ $message.attr( 'aria-label', message.ariaLabel );
+ }
+
+ if ( 'dependencies-check-success' === message.status ) {
+ $message
+ .attr( 'data-name', message.pluginName )
+ .attr( 'data-slug', message.slug )
+ .attr( 'data-plugin', message.plugin )
+ .attr( 'href', message.href );
+ }
+
+ $message.text( message.text );
+ }
+
+ if ( 'undefined' === typeof message.action ) {
return;
}
@@ -2832,9 +3274,9 @@
case 'install-plugin':
case 'update-plugin':
- /* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
- window.tb_remove();
- /* jscs:enable */
+ if ( 'undefined' === typeof message.data || 'undefined' === typeof message.data.slug ) {
+ return;
+ }
message.data = wp.updates._addCallbacks( message.data, message.action );
diff --git a/wp-admin/js/updates.min.js b/wp-admin/js/updates.min.js
index 1c1bfbb..e9b65df 100644
--- a/wp-admin/js/updates.min.js
+++ b/wp-admin/js/updates.min.js
@@ -1,2 +1,2 @@
/*! This file is auto-generated */
-!function(c,g,m){var h=c(document),f=g.i18n.__,i=g.i18n._x,l=g.i18n._n,o=g.i18n._nx,r=g.i18n.sprintf;(g=g||{}).updates={},g.updates.l10n={searchResults:"",searchResultsLabel:"",noPlugins:"",noItemsSelected:"",updating:"",pluginUpdated:"",themeUpdated:"",update:"",updateNow:"",pluginUpdateNowLabel:"",updateFailedShort:"",updateFailed:"",pluginUpdatingLabel:"",pluginUpdatedLabel:"",pluginUpdateFailedLabel:"",updatingMsg:"",updatedMsg:"",updateCancel:"",beforeunload:"",installNow:"",pluginInstallNowLabel:"",installing:"",pluginInstalled:"",themeInstalled:"",installFailedShort:"",installFailed:"",pluginInstallingLabel:"",themeInstallingLabel:"",pluginInstalledLabel:"",themeInstalledLabel:"",pluginInstallFailedLabel:"",themeInstallFailedLabel:"",installingMsg:"",installedMsg:"",importerInstalledMsg:"",aysDelete:"",aysDeleteUninstall:"",aysBulkDelete:"",aysBulkDeleteThemes:"",deleting:"",deleteFailed:"",pluginDeleted:"",themeDeleted:"",livePreview:"",activatePlugin:"",activateTheme:"",activatePluginLabel:"",activateThemeLabel:"",activateImporter:"",activateImporterLabel:"",unknownError:"",connectionError:"",nonceError:"",pluginsFound:"",noPluginsFound:"",autoUpdatesEnable:"",autoUpdatesEnabling:"",autoUpdatesEnabled:"",autoUpdatesDisable:"",autoUpdatesDisabling:"",autoUpdatesDisabled:"",autoUpdatesError:""},g.updates.l10n=window.wp.deprecateL10nObject("wp.updates.l10n",g.updates.l10n,"5.5.0"),g.updates.ajaxNonce=m.ajax_nonce,g.updates.searchTerm="",g.updates.shouldRequestFilesystemCredentials=!1,g.updates.filesystemCredentials={ftp:{host:"",username:"",password:"",connectionType:""},ssh:{publicKey:"",privateKey:""},fsNonce:"",available:!1},g.updates.ajaxLocked=!1,g.updates.adminNotice=g.template("wp-updates-admin-notice"),g.updates.queue=[],g.updates.$elToReturnFocusToFromCredentialsModal=void 0,g.updates.addAdminNotice=function(e){var t,a=c(e.selector),s=c(".wp-header-end");delete e.selector,t=g.updates.adminNotice(e),(a=a.length?a:c("#"+e.id)).length?a.replaceWith(t):s.length?s.after(t):"customize"===pagenow?c(".customize-themes-notifications").append(t):c(".wrap").find("> h1").after(t),h.trigger("wp-updates-notice-added")},g.updates.ajax=function(e,t){var a={};return g.updates.ajaxLocked?(g.updates.queue.push({action:e,data:t}),c.Deferred()):(g.updates.ajaxLocked=!0,t.success&&(a.success=t.success,delete t.success),t.error&&(a.error=t.error,delete t.error),a.data=_.extend(t,{action:e,_ajax_nonce:g.updates.ajaxNonce,_fs_nonce:g.updates.filesystemCredentials.fsNonce,username:g.updates.filesystemCredentials.ftp.username,password:g.updates.filesystemCredentials.ftp.password,hostname:g.updates.filesystemCredentials.ftp.hostname,connection_type:g.updates.filesystemCredentials.ftp.connectionType,public_key:g.updates.filesystemCredentials.ssh.publicKey,private_key:g.updates.filesystemCredentials.ssh.privateKey}),g.ajax.send(a).always(g.updates.ajaxAlways))},g.updates.ajaxAlways=function(e){e.errorCode&&"unable_to_connect_to_filesystem"===e.errorCode||(g.updates.ajaxLocked=!1,g.updates.queueChecker()),void 0!==e.debug&&window.console&&window.console.log&&_.map(e.debug,function(e){window.console.log(g.sanitize.stripTagsAndEncodeText(e))})},g.updates.refreshCount=function(){var e,t=c("#wp-admin-bar-updates"),a=c('a[href="update-core.php"] .update-plugins'),s=c('a[href="plugins.php"] .update-plugins'),n=c('a[href="themes.php"] .update-plugins');t.find(".ab-label").text(m.totals.counts.total),t.find(".updates-available-text").text(r(l("%s update available","%s updates available",m.totals.counts.total),m.totals.counts.total)),0===m.totals.counts.total&&t.find(".ab-label").parents("li").remove(),a.each(function(e,t){t.className=t.className.replace(/count-\d+/,"count-"+m.totals.counts.total)}),0<m.totals.counts.total?a.find(".update-count").text(m.totals.counts.total):a.remove(),s.each(function(e,t){t.className=t.className.replace(/count-\d+/,"count-"+m.totals.counts.plugins)}),0<m.totals.counts.total?s.find(".plugin-count").text(m.totals.counts.plugins):s.remove(),n.each(function(e,t){t.className=t.className.replace(/count-\d+/,"count-"+m.totals.counts.themes)}),0<m.totals.counts.total?n.find(".theme-count").text(m.totals.counts.themes):n.remove(),"plugins"===pagenow||"plugins-network"===pagenow?e=m.totals.counts.plugins:"themes"!==pagenow&&"themes-network"!==pagenow||(e=m.totals.counts.themes),0<e?c(".subsubsub .upgrade .count").text("("+e+")"):(c(".subsubsub .upgrade").remove(),c(".subsubsub li:last").html(function(){return c(this).children()}))},g.updates.decrementCount=function(e){m.totals.counts.total=Math.max(--m.totals.counts.total,0),"plugin"===e?m.totals.counts.plugins=Math.max(--m.totals.counts.plugins,0):"theme"===e&&(m.totals.counts.themes=Math.max(--m.totals.counts.themes,0)),g.updates.refreshCount(e)},g.updates.updatePlugin=function(e){var t,a,s,n=c("#wp-admin-bar-updates");return e=_.extend({success:g.updates.updatePluginSuccess,error:g.updates.updatePluginError},e),"plugins"===pagenow||"plugins-network"===pagenow?(a=(s=c('tr[data-plugin="'+e.plugin+'"]')).find(".update-message").removeClass("notice-error").addClass("updating-message notice-warning").find("p"),s=r(i("Updating %s...","plugin"),s.find(".plugin-title strong").text())):"plugin-install"!==pagenow&&"plugin-install-network"!==pagenow||(a=(t=c(".plugin-card-"+e.slug)).find(".update-now").addClass("updating-message"),s=r(i("Updating %s...","plugin"),a.data("name")),t.removeClass("plugin-card-update-failed").find(".notice.notice-error").remove()),n.addClass("spin"),a.html()!==f("Updating...")&&a.data("originaltext",a.html()),a.attr("aria-label",s).text(f("Updating...")),h.trigger("wp-plugin-updating",e),g.updates.ajax("update-plugin",e)},g.updates.updatePluginSuccess=function(e){var t,a,s,n=c("#wp-admin-bar-updates");"plugins"===pagenow||"plugins-network"===pagenow?(a=(t=c('tr[data-plugin="'+e.plugin+'"]').removeClass("update is-enqueued").addClass("updated")).find(".update-message").removeClass("updating-message notice-warning").addClass("updated-message notice-success").find("p"),s=t.find(".plugin-version-author-uri").html().replace(e.oldVersion,e.newVersion),t.find(".plugin-version-author-uri").html(s),t.find(".auto-update-time").empty()):"plugin-install"!==pagenow&&"plugin-install-network"!==pagenow||(a=c(".plugin-card-"+e.slug).find(".update-now").removeClass("updating-message").addClass("button-disabled updated-message")),n.removeClass("spin"),a.attr("aria-label",r(i("%s updated!","plugin"),e.pluginName)).text(i("Updated!","plugin")),g.a11y.speak(f("Update completed successfully.")),g.updates.decrementCount("plugin"),h.trigger("wp-plugin-update-success",e)},g.updates.updatePluginError=function(e){var t,a,s,n=c("#wp-admin-bar-updates");g.updates.isValidResponse(e,"update")&&!g.updates.maybeHandleCredentialError(e,"update-plugin")&&(s=r(f("Update failed: %s"),e.errorMessage),"plugins"===pagenow||"plugins-network"===pagenow?(c('tr[data-plugin="'+e.plugin+'"]').removeClass("is-enqueued"),(a=(e.plugin?c('tr[data-plugin="'+e.plugin+'"]'):c('tr[data-slug="'+e.slug+'"]')).find(".update-message")).removeClass("updating-message notice-warning").addClass("notice-error").find("p").html(s),e.pluginName?a.find("p").attr("aria-label",r(i("%s update failed.","plugin"),e.pluginName)):a.find("p").removeAttr("aria-label")):"plugin-install"!==pagenow&&"plugin-install-network"!==pagenow||((t=c(".plugin-card-"+e.slug).addClass("plugin-card-update-failed").append(g.updates.adminNotice({className:"update-message notice-error notice-alt is-dismissible",message:s}))).find(".update-now").text(f("Update failed.")).removeClass("updating-message"),e.pluginName?t.find(".update-now").attr("aria-label",r(i("%s update failed.","plugin"),e.pluginName)):t.find(".update-now").removeAttr("aria-label"),t.on("click",".notice.is-dismissible .notice-dismiss",function(){setTimeout(function(){t.removeClass("plugin-card-update-failed").find(".column-name a").trigger("focus"),t.find(".update-now").attr("aria-label",!1).text(f("Update Now"))},200)})),n.removeClass("spin"),g.a11y.speak(s,"assertive"),h.trigger("wp-plugin-update-error",e))},g.updates.installPlugin=function(e){var t=c(".plugin-card-"+e.slug),a=t.find(".install-now");return e=_.extend({success:g.updates.installPluginSuccess,error:g.updates.installPluginError},e),(a="import"===pagenow?c('[data-slug="'+e.slug+'"]'):a).html()!==f("Installing...")&&a.data("originaltext",a.html()),a.addClass("updating-message").attr("aria-label",r(i("Installing %s...","plugin"),a.data("name"))).text(f("Installing...")),g.a11y.speak(f("Installing... please wait.")),t.removeClass("plugin-card-install-failed").find(".notice.notice-error").remove(),h.trigger("wp-plugin-installing",e),g.updates.ajax("install-plugin",e)},g.updates.installPluginSuccess=function(e){var t=c(".plugin-card-"+e.slug).find(".install-now");t.removeClass("updating-message").addClass("updated-message installed button-disabled").attr("aria-label",r(i("%s installed!","plugin"),e.pluginName)).text(i("Installed!","plugin")),g.a11y.speak(f("Installation completed successfully.")),h.trigger("wp-plugin-install-success",e),e.activateUrl&&setTimeout(function(){t.removeClass("install-now installed button-disabled updated-message").addClass("activate-now button-primary").attr("href",e.activateUrl),"plugins-network"===pagenow?t.attr("aria-label",r(i("Network Activate %s","plugin"),e.pluginName)).text(f("Network Activate")):t.attr("aria-label",r(i("Activate %s","plugin"),e.pluginName)).text(f("Activate"))},1e3)},g.updates.installPluginError=function(e){var t,a=c(".plugin-card-"+e.slug),s=a.find(".install-now");g.updates.isValidResponse(e,"install")&&!g.updates.maybeHandleCredentialError(e,"install-plugin")&&(t=r(f("Installation failed: %s"),e.errorMessage),a.addClass("plugin-card-update-failed").append('<div class="notice notice-error notice-alt is-dismissible"><p>'+t+"</p></div>"),a.on("click",".notice.is-dismissible .notice-dismiss",function(){setTimeout(function(){a.removeClass("plugin-card-update-failed").find(".column-name a").trigger("focus")},200)}),s.removeClass("updating-message").addClass("button-disabled").attr("aria-label",r(i("%s installation failed","plugin"),s.data("name"))).text(f("Installation failed.")),g.a11y.speak(t,"assertive"),h.trigger("wp-plugin-install-error",e))},g.updates.installImporterSuccess=function(e){g.updates.addAdminNotice({id:"install-success",className:"notice-success is-dismissible",message:r(f('Importer installed successfully. <a href="%s">Run importer</a>'),e.activateUrl+"&from=import")}),c('[data-slug="'+e.slug+'"]').removeClass("install-now updating-message").addClass("activate-now").attr({href:e.activateUrl+"&from=import","aria-label":r(f("Run %s"),e.pluginName)}).text(f("Run Importer")),g.a11y.speak(f("Installation completed successfully.")),h.trigger("wp-importer-install-success",e)},g.updates.installImporterError=function(e){var t=r(f("Installation failed: %s"),e.errorMessage),a=c('[data-slug="'+e.slug+'"]'),s=a.data("name");g.updates.isValidResponse(e,"install")&&!g.updates.maybeHandleCredentialError(e,"install-plugin")&&(g.updates.addAdminNotice({id:e.errorCode,className:"notice-error is-dismissible",message:t}),a.removeClass("updating-message").attr("aria-label",r(i("Install %s now","plugin"),s)).text(f("Install Now")),g.a11y.speak(t,"assertive"),h.trigger("wp-importer-install-error",e))},g.updates.deletePlugin=function(e){var t=c('[data-plugin="'+e.plugin+'"]').find(".row-actions a.delete");return e=_.extend({success:g.updates.deletePluginSuccess,error:g.updates.deletePluginError},e),t.html()!==f("Deleting...")&&t.data("originaltext",t.html()).text(f("Deleting...")),g.a11y.speak(f("Deleting...")),h.trigger("wp-plugin-deleting",e),g.updates.ajax("delete-plugin",e)},g.updates.deletePluginSuccess=function(u){c('[data-plugin="'+u.plugin+'"]').css({backgroundColor:"#faafaa"}).fadeOut(350,function(){var e=c("#bulk-action-form"),t=c(".subsubsub"),a=c(this),s=t.find('[aria-current="page"]'),n=c(".displaying-num"),l=e.find("thead th:not(.hidden), thead td").length,i=g.template("item-deleted-row"),d=m.plugins;a.hasClass("plugin-update-tr")||a.after(i({slug:u.slug,plugin:u.plugin,colspan:l,name:u.pluginName})),a.remove(),-1!==_.indexOf(d.upgrade,u.plugin)&&(d.upgrade=_.without(d.upgrade,u.plugin),g.updates.decrementCount("plugin")),-1!==_.indexOf(d.inactive,u.plugin)&&(d.inactive=_.without(d.inactive,u.plugin),d.inactive.length?t.find(".inactive .count").text("("+d.inactive.length+")"):t.find(".inactive").remove()),-1!==_.indexOf(d.active,u.plugin)&&(d.active=_.without(d.active,u.plugin),d.active.length?t.find(".active .count").text("("+d.active.length+")"):t.find(".active").remove()),-1!==_.indexOf(d.recently_activated,u.plugin)&&(d.recently_activated=_.without(d.recently_activated,u.plugin),d.recently_activated.length?t.find(".recently_activated .count").text("("+d.recently_activated.length+")"):t.find(".recently_activated").remove()),-1!==_.indexOf(d["auto-update-enabled"],u.plugin)&&(d["auto-update-enabled"]=_.without(d["auto-update-enabled"],u.plugin),d["auto-update-enabled"].length?t.find(".auto-update-enabled .count").text("("+d["auto-update-enabled"].length+")"):t.find(".auto-update-enabled").remove()),-1!==_.indexOf(d["auto-update-disabled"],u.plugin)&&(d["auto-update-disabled"]=_.without(d["auto-update-disabled"],u.plugin),d["auto-update-disabled"].length?t.find(".auto-update-disabled .count").text("("+d["auto-update-disabled"].length+")"):t.find(".auto-update-disabled").remove()),d.all=_.without(d.all,u.plugin),d.all.length?t.find(".all .count").text("("+d.all.length+")"):(e.find(".tablenav").css({visibility:"hidden"}),t.find(".all").remove(),e.find("tr.no-items").length||e.find("#the-list").append('<tr class="no-items"><td class="colspanchange" colspan="'+l+'">'+f("No plugins are currently available.")+"</td></tr>")),n.length&&s.length&&(i=d[s.parent("li").attr("class")].length,n.text(r(o("%s item","%s items","plugin/plugins",i),i)))}),g.a11y.speak(i("Deleted!","plugin")),h.trigger("wp-plugin-delete-success",u)},g.updates.deletePluginError=function(e){var t,a=g.template("item-update-row"),s=g.updates.adminNotice({className:"update-message notice-error notice-alt",message:e.errorMessage}),n=e.plugin?(t=c('tr.inactive[data-plugin="'+e.plugin+'"]')).siblings('[data-plugin="'+e.plugin+'"]'):(t=c('tr.inactive[data-slug="'+e.slug+'"]')).siblings('[data-slug="'+e.slug+'"]');g.updates.isValidResponse(e,"delete")&&!g.updates.maybeHandleCredentialError(e,"delete-plugin")&&(n.length?(n.find(".notice-error").remove(),n.find(".plugin-update").append(s)):t.addClass("update").after(a({slug:e.slug,plugin:e.plugin||e.slug,colspan:c("#bulk-action-form").find("thead th:not(.hidden), thead td").length,content:s})),h.trigger("wp-plugin-delete-error",e))},g.updates.updateTheme=function(e){var t;return e=_.extend({success:g.updates.updateThemeSuccess,error:g.updates.updateThemeError},e),(t=("themes-network"===pagenow?c('[data-slug="'+e.slug+'"]').find(".update-message").removeClass("notice-error").addClass("updating-message notice-warning"):(t="customize"===pagenow?((t=c('[data-slug="'+e.slug+'"].notice').removeClass("notice-large")).find("h3").remove(),t.add(c("#customize-control-installed_theme_"+e.slug).find(".update-message"))):((t=c("#update-theme").closest(".notice").removeClass("notice-large")).find("h3").remove(),t.add(c('[data-slug="'+e.slug+'"]').find(".update-message")))).addClass("updating-message")).find("p")).html()!==f("Updating...")&&t.data("originaltext",t.html()),g.a11y.speak(f("Updating... please wait.")),t.text(f("Updating...")),h.trigger("wp-theme-updating",e),g.updates.ajax("update-theme",e)},g.updates.updateThemeSuccess=function(e){var t,a,s=c("body.modal-open").length,n=c('[data-slug="'+e.slug+'"]'),l={className:"updated-message notice-success notice-alt",message:i("Updated!","theme")};"customize"===pagenow?((n=c(".updating-message").siblings(".theme-name")).length&&(a=n.html().replace(e.oldVersion,e.newVersion),n.html(a)),t=c(".theme-info .notice").add(g.customize.control("installed_theme_"+e.slug).container.find(".theme").find(".update-message"))):"themes-network"===pagenow?(t=n.find(".update-message"),a=n.find(".theme-version-author-uri").html().replace(e.oldVersion,e.newVersion),n.find(".theme-version-author-uri").html(a),n.find(".auto-update-time").empty()):(t=c(".theme-info .notice").add(n.find(".update-message")),s?(c(".load-customize:visible").trigger("focus"),c(".theme-info .theme-autoupdate").find(".auto-update-time").empty()):n.find(".load-customize").trigger("focus")),g.updates.addAdminNotice(_.extend({selector:t},l)),g.a11y.speak(f("Update completed successfully.")),g.updates.decrementCount("theme"),h.trigger("wp-theme-update-success",e),s&&"customize"!==pagenow&&c(".theme-info .theme-author").after(g.updates.adminNotice(l))},g.updates.updateThemeError=function(e){var t,a=c('[data-slug="'+e.slug+'"]'),s=r(f("Update failed: %s"),e.errorMessage);g.updates.isValidResponse(e,"update")&&!g.updates.maybeHandleCredentialError(e,"update-theme")&&("customize"===pagenow&&(a=g.customize.control("installed_theme_"+e.slug).container.find(".theme")),"themes-network"===pagenow?t=a.find(".update-message "):(t=c(".theme-info .notice").add(a.find(".notice")),(c("body.modal-open").length?c(".load-customize:visible"):a.find(".load-customize")).trigger("focus")),g.updates.addAdminNotice({selector:t,className:"update-message notice-error notice-alt is-dismissible",message:s}),g.a11y.speak(s),h.trigger("wp-theme-update-error",e))},g.updates.installTheme=function(e){var t=c('.theme-install[data-slug="'+e.slug+'"]');return e=_.extend({success:g.updates.installThemeSuccess,error:g.updates.installThemeError},e),t.addClass("updating-message"),t.parents(".theme").addClass("focus"),t.html()!==f("Installing...")&&t.data("originaltext",t.html()),t.attr("aria-label",r(i("Installing %s...","theme"),t.data("name"))).text(f("Installing...")),g.a11y.speak(f("Installing... please wait.")),c('.install-theme-info, [data-slug="'+e.slug+'"]').removeClass("theme-install-failed").find(".notice.notice-error").remove(),h.trigger("wp-theme-installing",e),g.updates.ajax("install-theme",e)},g.updates.installThemeSuccess=function(e){var t,a=c(".wp-full-overlay-header, [data-slug="+e.slug+"]");h.trigger("wp-theme-install-success",e),t=a.find(".button-primary").removeClass("updating-message").addClass("updated-message disabled").attr("aria-label",r(i("%s installed!","theme"),e.themeName)).text(i("Installed!","theme")),g.a11y.speak(f("Installation completed successfully.")),setTimeout(function(){e.activateUrl&&(t.attr("href",e.activateUrl).removeClass("theme-install updated-message disabled").addClass("activate"),"themes-network"===pagenow?t.attr("aria-label",r(i("Network Activate %s","theme"),e.themeName)).text(f("Network Enable")):t.attr("aria-label",r(i("Activate %s","theme"),e.themeName)).text(f("Activate"))),e.customizeUrl&&t.siblings(".preview").replaceWith(function(){return c("<a>").attr("href",e.customizeUrl).addClass("button load-customize").text(f("Live Preview"))})},1e3)},g.updates.installThemeError=function(e){var t,a=r(f("Installation failed: %s"),e.errorMessage),s=g.updates.adminNotice({className:"update-message notice-error notice-alt",message:a});g.updates.isValidResponse(e,"install")&&!g.updates.maybeHandleCredentialError(e,"install-theme")&&("customize"===pagenow?(h.find("body").hasClass("modal-open")?(t=c('.theme-install[data-slug="'+e.slug+'"]'),c(".theme-overlay .theme-info").prepend(s)):(t=c('.theme-install[data-slug="'+e.slug+'"]')).closest(".theme").addClass("theme-install-failed").append(s),g.customize.notifications.remove("theme_installing")):h.find("body").hasClass("full-overlay-active")?(t=c('.theme-install[data-slug="'+e.slug+'"]'),c(".install-theme-info").prepend(s)):t=c('[data-slug="'+e.slug+'"]').removeClass("focus").addClass("theme-install-failed").append(s).find(".theme-install"),t.removeClass("updating-message").attr("aria-label",r(i("%s installation failed","theme"),t.data("name"))).text(f("Installation failed.")),g.a11y.speak(a,"assertive"),h.trigger("wp-theme-install-error",e))},g.updates.deleteTheme=function(e){var t;return"themes"===pagenow?t=c(".theme-actions .delete-theme"):"themes-network"===pagenow&&(t=c('[data-slug="'+e.slug+'"]').find(".row-actions a.delete")),e=_.extend({success:g.updates.deleteThemeSuccess,error:g.updates.deleteThemeError},e),t&&t.html()!==f("Deleting...")&&t.data("originaltext",t.html()).text(f("Deleting...")),g.a11y.speak(f("Deleting...")),c(".theme-info .update-message").remove(),h.trigger("wp-theme-deleting",e),g.updates.ajax("delete-theme",e)},g.updates.deleteThemeSuccess=function(n){var e=c('[data-slug="'+n.slug+'"]');"themes-network"===pagenow&&e.css({backgroundColor:"#faafaa"}).fadeOut(350,function(){var e=c(".subsubsub"),t=c(this),a=m.themes,s=g.template("item-deleted-row");t.hasClass("plugin-update-tr")||t.after(s({slug:n.slug,colspan:c("#bulk-action-form").find("thead th:not(.hidden), thead td").length,name:t.find(".theme-title strong").text()})),t.remove(),-1!==_.indexOf(a.upgrade,n.slug)&&(a.upgrade=_.without(a.upgrade,n.slug),g.updates.decrementCount("theme")),-1!==_.indexOf(a.disabled,n.slug)&&(a.disabled=_.without(a.disabled,n.slug),a.disabled.length?e.find(".disabled .count").text("("+a.disabled.length+")"):e.find(".disabled").remove()),-1!==_.indexOf(a["auto-update-enabled"],n.slug)&&(a["auto-update-enabled"]=_.without(a["auto-update-enabled"],n.slug),a["auto-update-enabled"].length?e.find(".auto-update-enabled .count").text("("+a["auto-update-enabled"].length+")"):e.find(".auto-update-enabled").remove()),-1!==_.indexOf(a["auto-update-disabled"],n.slug)&&(a["auto-update-disabled"]=_.without(a["auto-update-disabled"],n.slug),a["auto-update-disabled"].length?e.find(".auto-update-disabled .count").text("("+a["auto-update-disabled"].length+")"):e.find(".auto-update-disabled").remove()),a.all=_.without(a.all,n.slug),e.find(".all .count").text("("+a.all.length+")")}),"themes"===pagenow&&_.find(_wpThemeSettings.themes,{id:n.slug}).hasUpdate&&g.updates.decrementCount("theme"),g.a11y.speak(i("Deleted!","theme")),h.trigger("wp-theme-delete-success",n)},g.updates.deleteThemeError=function(e){var t=c('tr.inactive[data-slug="'+e.slug+'"]'),a=c(".theme-actions .delete-theme"),s=g.template("item-update-row"),n=t.siblings("#"+e.slug+"-update"),l=r(f("Deletion failed: %s"),e.errorMessage),i=g.updates.adminNotice({className:"update-message notice-error notice-alt",message:l});g.updates.maybeHandleCredentialError(e,"delete-theme")||("themes-network"===pagenow?n.length?(n.find(".notice-error").remove(),n.find(".plugin-update").append(i)):t.addClass("update").after(s({slug:e.slug,colspan:c("#bulk-action-form").find("thead th:not(.hidden), thead td").length,content:i})):c(".theme-info .theme-description").before(i),a.html(a.data("originaltext")),g.a11y.speak(l,"assertive"),h.trigger("wp-theme-delete-error",e))},g.updates._addCallbacks=function(e,t){return"import"===pagenow&&"install-plugin"===t&&(e.success=g.updates.installImporterSuccess,e.error=g.updates.installImporterError),e},g.updates.queueChecker=function(){var e;if(!g.updates.ajaxLocked&&g.updates.queue.length)switch((e=g.updates.queue.shift()).action){case"install-plugin":g.updates.installPlugin(e.data);break;case"update-plugin":g.updates.updatePlugin(e.data);break;case"delete-plugin":g.updates.deletePlugin(e.data);break;case"install-theme":g.updates.installTheme(e.data);break;case"update-theme":g.updates.updateTheme(e.data);break;case"delete-theme":g.updates.deleteTheme(e.data)}},g.updates.requestFilesystemCredentials=function(e){!1===g.updates.filesystemCredentials.available&&(e&&!g.updates.$elToReturnFocusToFromCredentialsModal&&(g.updates.$elToReturnFocusToFromCredentialsModal=c(e.target)),g.updates.ajaxLocked=!0,g.updates.requestForCredentialsModalOpen())},g.updates.maybeRequestFilesystemCredentials=function(e){g.updates.shouldRequestFilesystemCredentials&&!g.updates.ajaxLocked&&g.updates.requestFilesystemCredentials(e)},g.updates.keydown=function(e){27===e.keyCode?g.updates.requestForCredentialsModalCancel():9===e.keyCode&&("upgrade"!==e.target.id||e.shiftKey?"hostname"===e.target.id&&e.shiftKey&&(c("#upgrade").trigger("focus"),e.preventDefault()):(c("#hostname").trigger("focus"),e.preventDefault()))},g.updates.requestForCredentialsModalOpen=function(){var e=c("#request-filesystem-credentials-dialog");c("body").addClass("modal-open"),e.show(),e.find("input:enabled:first").trigger("focus"),e.on("keydown",g.updates.keydown)},g.updates.requestForCredentialsModalClose=function(){c("#request-filesystem-credentials-dialog").hide(),c("body").removeClass("modal-open"),g.updates.$elToReturnFocusToFromCredentialsModal&&g.updates.$elToReturnFocusToFromCredentialsModal.trigger("focus")},g.updates.requestForCredentialsModalCancel=function(){(g.updates.ajaxLocked||g.updates.queue.length)&&(_.each(g.updates.queue,function(e){h.trigger("credential-modal-cancel",e)}),g.updates.ajaxLocked=!1,g.updates.queue=[],g.updates.requestForCredentialsModalClose())},g.updates.showErrorInCredentialsForm=function(e){var t=c("#request-filesystem-credentials-form");t.find(".notice").remove(),t.find("#request-filesystem-credentials-title").after('<div class="notice notice-alt notice-error"><p>'+e+"</p></div>")},g.updates.credentialError=function(e,t){e=g.updates._addCallbacks(e,t),g.updates.queue.unshift({action:t,data:e}),g.updates.filesystemCredentials.available=!1,g.updates.showErrorInCredentialsForm(e.errorMessage),g.updates.requestFilesystemCredentials()},g.updates.maybeHandleCredentialError=function(e,t){return!(!g.updates.shouldRequestFilesystemCredentials||!e.errorCode||"unable_to_connect_to_filesystem"!==e.errorCode||(g.updates.credentialError(e,t),0))},g.updates.isValidResponse=function(e,t){var a,s=f("Something went wrong.");if(_.isObject(e)&&!_.isFunction(e.always))return!0;switch(_.isString(e)&&"-1"===e?s=f("An error has occurred. Please reload the page and try again."):_.isString(e)?s=e:void 0!==e.readyState&&0===e.readyState?s=f("Connection lost or the server is busy. Please try again later."):_.isString(e.responseText)&&""!==e.responseText?s=e.responseText:_.isString(e.statusText)&&(s=e.statusText),t){case"update":a=f("Update failed: %s");break;case"install":a=f("Installation failed: %s");break;case"delete":a=f("Deletion failed: %s")}return s=s.replace(/<[\/a-z][^<>]*>/gi,""),a=a.replace("%s",s),g.updates.addAdminNotice({id:"unknown_error",className:"notice-error is-dismissible",message:_.escape(a)}),g.updates.ajaxLocked=!1,g.updates.queue=[],c(".button.updating-message").removeClass("updating-message").removeAttr("aria-label").prop("disabled",!0).text(f("Update failed.")),c(".updating-message:not(.button):not(.thickbox)").removeClass("updating-message notice-warning").addClass("notice-error").find("p").removeAttr("aria-label").text(a),g.a11y.speak(a,"assertive"),!1},g.updates.beforeunload=function(){if(g.updates.ajaxLocked)return f("Updates may not complete if you navigate away from this page.")},c(function(){var l=c("#plugin-filter"),o=c("#bulk-action-form"),e=c("#request-filesystem-credentials-form"),t=c("#request-filesystem-credentials-dialog"),a=c(".plugins-php .wp-filter-search"),s=c(".plugin-install-php .wp-filter-search");(m=_.extend(m,window._wpUpdatesItemCounts||{})).totals&&g.updates.refreshCount(),g.updates.shouldRequestFilesystemCredentials=0<t.length,t.on("submit","form",function(e){e.preventDefault(),g.updates.filesystemCredentials.ftp.hostname=c("#hostname").val(),g.updates.filesystemCredentials.ftp.username=c("#username").val(),g.updates.filesystemCredentials.ftp.password=c("#password").val(),g.updates.filesystemCredentials.ftp.connectionType=c('input[name="connection_type"]:checked').val(),g.updates.filesystemCredentials.ssh.publicKey=c("#public_key").val(),g.updates.filesystemCredentials.ssh.privateKey=c("#private_key").val(),g.updates.filesystemCredentials.fsNonce=c("#_fs_nonce").val(),g.updates.filesystemCredentials.available=!0,g.updates.ajaxLocked=!1,g.updates.queueChecker(),g.updates.requestForCredentialsModalClose()}),t.on("click",'[data-js-action="close"], .notification-dialog-background',g.updates.requestForCredentialsModalCancel),e.on("change",'input[name="connection_type"]',function(){c("#ssh-keys").toggleClass("hidden","ssh"!==c(this).val())}).trigger("change"),h.on("credential-modal-cancel",function(e,t){var a,s=c(".updating-message");"import"===pagenow?s.removeClass("updating-message"):"plugins"===pagenow||"plugins-network"===pagenow?"update-plugin"===t.action?a=c('tr[data-plugin="'+t.data.plugin+'"]').find(".update-message"):"delete-plugin"===t.action&&(a=c('[data-plugin="'+t.data.plugin+'"]').find(".row-actions a.delete")):"themes"===pagenow||"themes-network"===pagenow?"update-theme"===t.action?a=c('[data-slug="'+t.data.slug+'"]').find(".update-message"):"delete-theme"===t.action&&"themes-network"===pagenow?a=c('[data-slug="'+t.data.slug+'"]').find(".row-actions a.delete"):"delete-theme"===t.action&&"themes"===pagenow&&(a=c(".theme-actions .delete-theme")):a=s,a&&a.hasClass("updating-message")&&(void 0===(s=a.data("originaltext"))&&(s=c("<p>").html(a.find("p").data("originaltext"))),a.removeClass("updating-message").html(s),"plugin-install"!==pagenow&&"plugin-install-network"!==pagenow||("update-plugin"===t.action?a.attr("aria-label",r(i("Update %s now","plugin"),a.data("name"))):"install-plugin"===t.action&&a.attr("aria-label",r(i("Install %s now","plugin"),a.data("name"))))),g.a11y.speak(f("Update canceled."))}),o.on("click","[data-plugin] .update-link",function(e){var t=c(e.target),a=t.parents("tr");e.preventDefault(),t.hasClass("updating-message")||t.hasClass("button-disabled")||(g.updates.maybeRequestFilesystemCredentials(e),g.updates.$elToReturnFocusToFromCredentialsModal=a.find(".check-column input"),g.updates.updatePlugin({plugin:a.data("plugin"),slug:a.data("slug")}))}),l.on("click",".update-now",function(e){var t=c(e.target);e.preventDefault(),t.hasClass("updating-message")||t.hasClass("button-disabled")||(g.updates.maybeRequestFilesystemCredentials(e),g.updates.updatePlugin({plugin:t.data("plugin"),slug:t.data("slug")}))}),l.on("click",".install-now",function(e){var t=c(e.target);e.preventDefault(),t.hasClass("updating-message")||t.hasClass("button-disabled")||(g.updates.shouldRequestFilesystemCredentials&&!g.updates.ajaxLocked&&(g.updates.requestFilesystemCredentials(e),h.on("credential-modal-cancel",function(){c(".install-now.updating-message").removeClass("updating-message").text(f("Install Now")),g.a11y.speak(f("Update canceled."))})),g.updates.installPlugin({slug:t.data("slug")}))}),h.on("click",".importer-item .install-now",function(e){var t=c(e.target),a=c(this).data("name");e.preventDefault(),t.hasClass("updating-message")||(g.updates.shouldRequestFilesystemCredentials&&!g.updates.ajaxLocked&&(g.updates.requestFilesystemCredentials(e),h.on("credential-modal-cancel",function(){t.removeClass("updating-message").attr("aria-label",r(i("Install %s now","plugin"),a)).text(f("Install Now")),g.a11y.speak(f("Update canceled."))})),g.updates.installPlugin({slug:t.data("slug"),pagenow:pagenow,success:g.updates.installImporterSuccess,error:g.updates.installImporterError}))}),o.on("click","[data-plugin] a.delete",function(e){var t=c(e.target).parents("tr"),a=t.hasClass("is-uninstallable")?r(f("Are you sure you want to delete %s and its data?"),t.find(".plugin-title strong").text()):r(f("Are you sure you want to delete %s?"),t.find(".plugin-title strong").text());e.preventDefault(),window.confirm(a)&&(g.updates.maybeRequestFilesystemCredentials(e),g.updates.deletePlugin({plugin:t.data("plugin"),slug:t.data("slug")}))}),h.on("click",".themes-php.network-admin .update-link",function(e){var t=c(e.target),a=t.parents("tr");e.preventDefault(),t.hasClass("updating-message")||t.hasClass("button-disabled")||(g.updates.maybeRequestFilesystemCredentials(e),g.updates.$elToReturnFocusToFromCredentialsModal=a.find(".check-column input"),g.updates.updateTheme({slug:a.data("slug")}))}),h.on("click",".themes-php.network-admin a.delete",function(e){var t=c(e.target).parents("tr"),a=r(f("Are you sure you want to delete %s?"),t.find(".theme-title strong").text());e.preventDefault(),window.confirm(a)&&(g.updates.maybeRequestFilesystemCredentials(e),g.updates.deleteTheme({slug:t.data("slug")}))}),o.on("click",'[type="submit"]:not([name="clear-recent-list"])',function(e){var t,s,n=c(e.target).siblings("select").val(),a=o.find('input[name="checked[]"]:checked'),l=0,i=0,d=[];switch(pagenow){case"plugins":case"plugins-network":t="plugin";break;case"themes-network":t="theme";break;default:return}if(!a.length)return e.preventDefault(),c("html, body").animate({scrollTop:0}),g.updates.addAdminNotice({id:"no-items-selected",className:"notice-error is-dismissible",message:f("Please select at least one item to perform this action on.")});switch(n){case"update-selected":s=n.replace("selected",t);break;case"delete-selected":var u=f("plugin"===t?"Are you sure you want to delete the selected plugins and their data?":"Caution: These themes may be active on other sites in the network. Are you sure you want to proceed?");if(!window.confirm(u))return void e.preventDefault();s=n.replace("selected",t);break;default:return}g.updates.maybeRequestFilesystemCredentials(e),e.preventDefault(),o.find('.manage-column [type="checkbox"]').prop("checked",!1),h.trigger("wp-"+t+"-bulk-"+n,a),a.each(function(e,t){var t=c(t),a=t.parents("tr");"update-selected"!==n||a.hasClass("update")&&!a.find("notice-error").length?"update-selected"===n&&a.hasClass("is-enqueued")||(a.addClass("is-enqueued"),g.updates.queue.push({action:s,data:{plugin:a.data("plugin"),slug:a.data("slug")}})):t.prop("checked",!1)}),h.on("wp-plugin-update-success wp-plugin-update-error wp-theme-update-success wp-theme-update-error",function(e,t){var a,s=c('[data-slug="'+t.slug+'"]');"wp-"+t.update+"-update-success"===e.type?l++:(e=t.pluginName||s.find(".column-primary strong").text(),i++,d.push(e+": "+t.errorMessage)),s.find('input[name="checked[]"]:checked').prop("checked",!1),g.updates.adminNotice=g.template("wp-bulk-updates-admin-notice"),g.updates.addAdminNotice({id:"bulk-action-notice",className:"bulk-action-notice",successes:l,errors:i,errorMessages:d,type:t.update}),a=c("#bulk-action-notice").on("click","button",function(){c(this).toggleClass("bulk-action-errors-collapsed").attr("aria-expanded",!c(this).hasClass("bulk-action-errors-collapsed")),a.find(".bulk-action-errors").toggleClass("hidden")}),0<i&&!g.updates.queue.length&&c("html, body").animate({scrollTop:0})}),h.on("wp-updates-notice-added",function(){g.updates.adminNotice=g.template("wp-updates-admin-notice")}),g.updates.queueChecker()}),s.length&&s.attr("aria-describedby","live-search-desc"),s.on("keyup input",_.debounce(function(e,t){var a=c(".plugin-install-search"),s={_ajax_nonce:g.updates.ajaxNonce,s:encodeURIComponent(e.target.value),tab:"search",type:c("#typeselector").val(),pagenow:pagenow},n=location.href.split("?")[0]+"?"+c.param(_.omit(s,["_ajax_nonce","pagenow"]));"keyup"===e.type&&27===e.which&&(e.target.value=""),g.updates.searchTerm===s.s&&"typechange"!==t||(l.empty(),g.updates.searchTerm=s.s,window.history&&window.history.replaceState&&window.history.replaceState(null,"",n),a.length||(a=c('<li class="plugin-install-search" />').append(c("<a />",{class:"current",href:n,text:f("Search Results")})),c(".wp-filter .filter-links .current").removeClass("current").parents(".filter-links").prepend(a),l.prev("p").remove(),c(".plugins-popular-tags-wrapper").remove()),void 0!==g.updates.searchRequest&&g.updates.searchRequest.abort(),c("body").addClass("loading-content"),g.updates.searchRequest=g.ajax.post("search-install-plugins",s).done(function(e){c("body").removeClass("loading-content"),l.append(e.items),delete g.updates.searchRequest,0===e.count?g.a11y.speak(f("You do not appear to have any plugins available at this time.")):g.a11y.speak(r(f("Number of plugins found: %d"),e.count))}))},1e3)),a.length&&a.attr("aria-describedby","live-search-desc"),a.on("keyup input",_.debounce(function(e){var s={_ajax_nonce:g.updates.ajaxNonce,s:encodeURIComponent(e.target.value),pagenow:pagenow,plugin_status:"all"};"keyup"===e.type&&27===e.which&&(e.target.value=""),g.updates.searchTerm!==s.s&&(g.updates.searchTerm=s.s,e=_.object(_.compact(_.map(location.search.slice(1).split("&"),function(e){if(e)return e.split("=")}))),s.plugin_status=e.plugin_status||"all",window.history&&window.history.replaceState&&window.history.replaceState(null,"",location.href.split("?")[0]+"?s="+s.s+"&plugin_status="+s.plugin_status),void 0!==g.updates.searchRequest&&g.updates.searchRequest.abort(),o.empty(),c("body").addClass("loading-content"),c(".subsubsub .current").removeClass("current"),g.updates.searchRequest=g.ajax.post("search-plugins",s).done(function(e){var t=c("<span />").addClass("subtitle").html(r(f("Search results for: %s"),"<strong>"+_.escape(decodeURIComponent(s.s))+"</strong>")),a=c(".wrap .subtitle");s.s.length?a.length?a.replaceWith(t):c(".wp-header-end").before(t):(a.remove(),c(".subsubsub ."+s.plugin_status+" a").addClass("current")),c("body").removeClass("loading-content"),o.append(e.items),delete g.updates.searchRequest,0===e.count?g.a11y.speak(f("No plugins found. Try a different search.")):g.a11y.speak(r(f("Number of plugins found: %d"),e.count))}))},500)),h.on("submit",".search-plugins",function(e){e.preventDefault(),c("input.wp-filter-search").trigger("input")}),h.on("click",".try-again",function(e){e.preventDefault(),s.trigger("input")}),c("#typeselector").on("change",function(){var e=c('input[name="s"]');e.val().length&&e.trigger("input","typechange")}),c("#plugin_update_from_iframe").on("click",function(e){var t=window.parent===window?null:window.parent;c.support.postMessage=!!window.postMessage,!1!==c.support.postMessage&&null!==t&&-1===window.parent.location.pathname.indexOf("update-core.php")&&(e.preventDefault(),e={action:"update-plugin",data:{plugin:c(this).data("plugin"),slug:c(this).data("slug")}},t.postMessage(JSON.stringify(e),window.location.origin))}),c("#plugin_install_from_iframe").on("click",function(e){var t=window.parent===window?null:window.parent;c.support.postMessage=!!window.postMessage,!1!==c.support.postMessage&&null!==t&&-1===window.parent.location.pathname.indexOf("index.php")&&(e.preventDefault(),e={action:"install-plugin",data:{slug:c(this).data("slug")}},t.postMessage(JSON.stringify(e),window.location.origin))}),c(window).on("message",function(e){var t,e=e.originalEvent,a=document.location.protocol+"//"+document.location.host;if(e.origin===a){try{t=JSON.parse(e.data)}catch(e){return}if(t&&void 0!==t.action)switch(t.action){case"decrementUpdateCount":g.updates.decrementCount(t.upgradeType);break;case"install-plugin":case"update-plugin":window.tb_remove(),t.data=g.updates._addCallbacks(t.data,t.action),g.updates.queue.push(t),g.updates.queueChecker()}}}),c(window).on("beforeunload",g.updates.beforeunload),h.on("keydown",".column-auto-updates .toggle-auto-update, .theme-overlay .toggle-auto-update",function(e){32===e.which&&e.preventDefault()}),h.on("click keyup",".column-auto-updates .toggle-auto-update, .theme-overlay .toggle-auto-update",function(e){var i,d,u,o=c(this),r=o.attr("data-wp-action"),p=o.find(".label");if(("keyup"!==e.type||32===e.which)&&(u="themes"!==pagenow?o.closest(".column-auto-updates"):o.closest(".theme-autoupdate"),e.preventDefault(),"yes"!==o.attr("data-doing-ajax"))){switch(o.attr("data-doing-ajax","yes"),pagenow){case"plugins":case"plugins-network":d="plugin",i=o.closest("tr").attr("data-plugin");break;case"themes-network":d="theme",i=o.closest("tr").attr("data-slug");break;case"themes":d="theme",i=o.attr("data-slug")}u.find(".notice.notice-error").addClass("hidden"),"enable"===r?p.text(f("Enabling...")):p.text(f("Disabling...")),o.find(".dashicons-update").removeClass("hidden"),e={action:"toggle-auto-updates",_ajax_nonce:m.ajax_nonce,state:r,type:d,asset:i},c.post(window.ajaxurl,e).done(function(e){var t,a,s,n,l=o.attr("href");if(e.success){if("themes"!==pagenow){switch(n=c(".auto-update-enabled span"),t=c(".auto-update-disabled span"),a=parseInt(n.text().replace(/[^\d]+/g,""),10)||0,s=parseInt(t.text().replace(/[^\d]+/g,""),10)||0,r){case"enable":++a,--s;break;case"disable":--a,++s}a=Math.max(0,a),s=Math.max(0,s),n.text("("+a+")"),t.text("("+s+")")}"enable"===r?(o[0].hasAttribute("href")&&(l=l.replace("action=enable-auto-update","action=disable-auto-update"),o.attr("href",l)),o.attr("data-wp-action","disable"),p.text(f("Disable auto-updates")),u.find(".auto-update-time").removeClass("hidden"),g.a11y.speak(f("Auto-updates enabled"))):(o[0].hasAttribute("href")&&(l=l.replace("action=disable-auto-update","action=enable-auto-update"),o.attr("href",l)),o.attr("data-wp-action","enable"),p.text(f("Enable auto-updates")),u.find(".auto-update-time").addClass("hidden"),g.a11y.speak(f("Auto-updates disabled"))),h.trigger("wp-auto-update-setting-changed",{state:r,type:d,asset:i})}else n=e.data&&e.data.error?e.data.error:f("The request could not be completed."),u.find(".notice.notice-error").removeClass("hidden").find("p").text(n),g.a11y.speak(n,"assertive")}).fail(function(){u.find(".notice.notice-error").removeClass("hidden").find("p").text(f("The request could not be completed.")),g.a11y.speak(f("The request could not be completed."),"assertive")}).always(function(){o.removeAttr("data-doing-ajax").find(".dashicons-update").addClass("hidden")})}})})}(jQuery,window.wp,window._wpUpdatesSettings); \ No newline at end of file
+!function(c,g,m){var f=c(document),h=g.i18n.__,d=g.i18n._x,i=g.i18n._n,o=g.i18n._nx,r=g.i18n.sprintf;(g=g||{}).updates={},g.updates.l10n={searchResults:"",searchResultsLabel:"",noPlugins:"",noItemsSelected:"",updating:"",pluginUpdated:"",themeUpdated:"",update:"",updateNow:"",pluginUpdateNowLabel:"",updateFailedShort:"",updateFailed:"",pluginUpdatingLabel:"",pluginUpdatedLabel:"",pluginUpdateFailedLabel:"",updatingMsg:"",updatedMsg:"",updateCancel:"",beforeunload:"",installNow:"",pluginInstallNowLabel:"",installing:"",pluginInstalled:"",themeInstalled:"",installFailedShort:"",installFailed:"",pluginInstallingLabel:"",themeInstallingLabel:"",pluginInstalledLabel:"",themeInstalledLabel:"",pluginInstallFailedLabel:"",themeInstallFailedLabel:"",installingMsg:"",installedMsg:"",importerInstalledMsg:"",aysDelete:"",aysDeleteUninstall:"",aysBulkDelete:"",aysBulkDeleteThemes:"",deleting:"",deleteFailed:"",pluginDeleted:"",themeDeleted:"",livePreview:"",activatePlugin:"",activateTheme:"",activatePluginLabel:"",activateThemeLabel:"",activateImporter:"",activateImporterLabel:"",unknownError:"",connectionError:"",nonceError:"",pluginsFound:"",noPluginsFound:"",autoUpdatesEnable:"",autoUpdatesEnabling:"",autoUpdatesEnabled:"",autoUpdatesDisable:"",autoUpdatesDisabling:"",autoUpdatesDisabled:"",autoUpdatesError:""},g.updates.l10n=window.wp.deprecateL10nObject("wp.updates.l10n",g.updates.l10n,"5.5.0"),g.updates.ajaxNonce=m.ajax_nonce,g.updates.searchTerm="",g.updates.shouldRequestFilesystemCredentials=!1,g.updates.filesystemCredentials={ftp:{host:"",username:"",password:"",connectionType:""},ssh:{publicKey:"",privateKey:""},fsNonce:"",available:!1},g.updates.ajaxLocked=!1,g.updates.adminNotice=g.template("wp-updates-admin-notice"),g.updates.queue=[],g.updates.$elToReturnFocusToFromCredentialsModal=void 0,g.updates.addAdminNotice=function(e){var t,a=c(e.selector),s=c(".wp-header-end");delete e.selector,t=g.updates.adminNotice(e),(a=a.length?a:c("#"+e.id)).length?a.replaceWith(t):s.length?s.after(t):"customize"===pagenow?c(".customize-themes-notifications").append(t):c(".wrap").find("> h1").after(t),f.trigger("wp-updates-notice-added")},g.updates.ajax=function(e,t){var a={};return g.updates.ajaxLocked?(g.updates.queue.push({action:e,data:t}),c.Deferred()):(g.updates.ajaxLocked=!0,t.success&&(a.success=t.success,delete t.success),t.error&&(a.error=t.error,delete t.error),a.data=_.extend(t,{action:e,_ajax_nonce:g.updates.ajaxNonce,_fs_nonce:g.updates.filesystemCredentials.fsNonce,username:g.updates.filesystemCredentials.ftp.username,password:g.updates.filesystemCredentials.ftp.password,hostname:g.updates.filesystemCredentials.ftp.hostname,connection_type:g.updates.filesystemCredentials.ftp.connectionType,public_key:g.updates.filesystemCredentials.ssh.publicKey,private_key:g.updates.filesystemCredentials.ssh.privateKey}),g.ajax.send(a).always(g.updates.ajaxAlways))},g.updates.ajaxAlways=function(e){e.errorCode&&"unable_to_connect_to_filesystem"===e.errorCode||(g.updates.ajaxLocked=!1,g.updates.queueChecker()),void 0!==e.debug&&window.console&&window.console.log&&_.map(e.debug,function(e){window.console.log(g.sanitize.stripTagsAndEncodeText(e))})},g.updates.refreshCount=function(){var e,t=c("#wp-admin-bar-updates"),a=c('a[href="update-core.php"] .update-plugins'),s=c('a[href="plugins.php"] .update-plugins'),n=c('a[href="themes.php"] .update-plugins');t.find(".ab-label").text(m.totals.counts.total),t.find(".updates-available-text").text(r(i("%s update available","%s updates available",m.totals.counts.total),m.totals.counts.total)),0===m.totals.counts.total&&t.find(".ab-label").parents("li").remove(),a.each(function(e,t){t.className=t.className.replace(/count-\d+/,"count-"+m.totals.counts.total)}),0<m.totals.counts.total?a.find(".update-count").text(m.totals.counts.total):a.remove(),s.each(function(e,t){t.className=t.className.replace(/count-\d+/,"count-"+m.totals.counts.plugins)}),0<m.totals.counts.total?s.find(".plugin-count").text(m.totals.counts.plugins):s.remove(),n.each(function(e,t){t.className=t.className.replace(/count-\d+/,"count-"+m.totals.counts.themes)}),0<m.totals.counts.total?n.find(".theme-count").text(m.totals.counts.themes):n.remove(),"plugins"===pagenow||"plugins-network"===pagenow?e=m.totals.counts.plugins:"themes"!==pagenow&&"themes-network"!==pagenow||(e=m.totals.counts.themes),0<e?c(".subsubsub .upgrade .count").text("("+e+")"):(c(".subsubsub .upgrade").remove(),c(".subsubsub li:last").html(function(){return c(this).children()}))},g.updates.setCardButtonStatus=function(e){var t=window.parent===window?null:window.parent;c.support.postMessage=!!window.postMessage,!1!==c.support.postMessage&&null!==t&&-1===window.parent.location.pathname.indexOf("index.php")&&t.postMessage(JSON.stringify(e),window.location.origin)},g.updates.decrementCount=function(e){m.totals.counts.total=Math.max(--m.totals.counts.total,0),"plugin"===e?m.totals.counts.plugins=Math.max(--m.totals.counts.plugins,0):"theme"===e&&(m.totals.counts.themes=Math.max(--m.totals.counts.themes,0)),g.updates.refreshCount(e)},g.updates.updatePlugin=function(e){var t,a,s,n=c("#wp-admin-bar-updates"),i=h("Updating..."),l="plugin-install"===pagenow||"plugin-install-network"===pagenow;return e=_.extend({success:g.updates.updatePluginSuccess,error:g.updates.updatePluginError},e),"plugins"===pagenow||"plugins-network"===pagenow?(a=(s=c('tr[data-plugin="'+e.plugin+'"]')).find(".update-message").removeClass("notice-error").addClass("updating-message notice-warning").find("p"),s=r(d("Updating %s...","plugin"),s.find(".plugin-title strong").text())):l&&(a=(t=c(".plugin-card-"+e.slug+", #plugin-information-footer")).find(".update-now").addClass("updating-message"),s=r(d("Updating %s...","plugin"),a.data("name")),t.removeClass("plugin-card-update-failed").find(".notice.notice-error").remove()),n.addClass("spin"),a.html()!==h("Updating...")&&a.data("originaltext",a.html()),a.attr("aria-label",s).text(i),f.trigger("wp-plugin-updating",e),l&&"plugin-information-footer"===t.attr("id")&&g.updates.setCardButtonStatus({status:"updating-plugin",slug:e.slug,addClasses:"updating-message",text:i,ariaLabel:s}),g.updates.ajax("update-plugin",e)},g.updates.updatePluginSuccess=function(e){var t,a,s,n=c("#wp-admin-bar-updates"),i=d("Updated!","plugin"),l=r(d("%s updated!","plugin"),e.pluginName);"plugins"===pagenow||"plugins-network"===pagenow?(a=(t=c('tr[data-plugin="'+e.plugin+'"]').removeClass("update is-enqueued").addClass("updated")).find(".update-message").removeClass("updating-message notice-warning").addClass("updated-message notice-success").find("p"),s=t.find(".plugin-version-author-uri").html().replace(e.oldVersion,e.newVersion),t.find(".plugin-version-author-uri").html(s),t.find(".auto-update-time").empty()):"plugin-install"!==pagenow&&"plugin-install-network"!==pagenow||(a=c(".plugin-card-"+e.slug+", #plugin-information-footer").find(".update-now").removeClass("updating-message").addClass("button-disabled updated-message")),n.removeClass("spin"),a.attr("aria-label",l).text(i),g.a11y.speak(h("Update completed successfully.")),"plugin_install_from_iframe"!==a.attr("id")?g.updates.decrementCount("plugin"):g.updates.setCardButtonStatus({status:"updated-plugin",slug:e.slug,removeClasses:"updating-message",addClasses:"button-disabled updated-message",text:i,ariaLabel:l}),f.trigger("wp-plugin-update-success",e)},g.updates.updatePluginError=function(e){var t,a,s,n,i,l=c("#wp-admin-bar-updates");g.updates.isValidResponse(e,"update")&&!g.updates.maybeHandleCredentialError(e,"update-plugin")&&(s=r(h("Update failed: %s"),e.errorMessage),"plugins"===pagenow||"plugins-network"===pagenow?(c('tr[data-plugin="'+e.plugin+'"]').removeClass("is-enqueued"),(a=(e.plugin?c('tr[data-plugin="'+e.plugin+'"]'):c('tr[data-slug="'+e.slug+'"]')).find(".update-message")).removeClass("updating-message notice-warning").addClass("notice-error").find("p").html(s),e.pluginName?a.find("p").attr("aria-label",r(d("%s update failed.","plugin"),e.pluginName)):a.find("p").removeAttr("aria-label")):"plugin-install"!==pagenow&&"plugin-install-network"!==pagenow||(n=h("Update failed."),(t=c(".plugin-card-"+e.slug+", #plugin-information-footer").append(g.updates.adminNotice({className:"update-message notice-error notice-alt is-dismissible",message:s}))).hasClass("plugin-card-"+e.slug)&&t.addClass("plugin-card-update-failed"),t.find(".update-now").text(n).removeClass("updating-message"),e.pluginName?(i=r(d("%s update failed.","plugin"),e.pluginName),t.find(".update-now").attr("aria-label",i)):(i="",t.find(".update-now").removeAttr("aria-label")),t.on("click",".notice.is-dismissible .notice-dismiss",function(){setTimeout(function(){t.removeClass("plugin-card-update-failed").find(".column-name a").trigger("focus"),t.find(".update-now").attr("aria-label",!1).text(h("Update Now"))},200)})),l.removeClass("spin"),g.a11y.speak(s,"assertive"),"plugin-information-footer"===t.attr("id")&&g.updates.setCardButtonStatus({status:"plugin-update-failed",slug:e.slug,removeClasses:"updating-message",text:n,ariaLabel:i}),f.trigger("wp-plugin-update-error",e))},g.updates.installPlugin=function(e){var t,a=c(".plugin-card-"+e.slug+", #plugin-information-footer"),s=a.find(".install-now"),n=h("Installing...");return e=_.extend({success:g.updates.installPluginSuccess,error:g.updates.installPluginError},e),(s="import"===pagenow?c('[data-slug="'+e.slug+'"]'):s).html()!==h("Installing...")&&s.data("originaltext",s.html()),t=r(d("Installing %s...","plugin"),s.data("name")),s.addClass("updating-message").attr("aria-label",t).text(n),g.a11y.speak(h("Installing... please wait.")),a.removeClass("plugin-card-install-failed").find(".notice.notice-error").remove(),f.trigger("wp-plugin-installing",e),"plugin-information-footer"===s.parent().attr("id")&&g.updates.setCardButtonStatus({status:"installing-plugin",slug:e.slug,addClasses:"updating-message",text:n,ariaLabel:t}),g.updates.ajax("install-plugin",e)},g.updates.installPluginSuccess=function(e){var t=c(".plugin-card-"+e.slug+", #plugin-information-footer").find(".install-now"),a=d("Installed!","plugin"),s=r(d("%s installed!","plugin"),e.pluginName);t.removeClass("updating-message").addClass("updated-message installed button-disabled").attr("aria-label",s).text(a),g.a11y.speak(h("Installation completed successfully.")),f.trigger("wp-plugin-install-success",e),e.activateUrl&&setTimeout(function(){g.updates.checkPluginDependencies({slug:e.slug})},1e3),"plugin-information-footer"===t.parent().attr("id")&&g.updates.setCardButtonStatus({status:"installed-plugin",slug:e.slug,removeClasses:"updating-message",addClasses:"updated-message installed button-disabled",text:a,ariaLabel:s})},g.updates.installPluginError=function(e){var t,a=c(".plugin-card-"+e.slug+", #plugin-information-footer"),s=a.find(".install-now"),n=h("Installation failed."),i=r(d("%s installation failed","plugin"),s.data("name"));g.updates.isValidResponse(e,"install")&&!g.updates.maybeHandleCredentialError(e,"install-plugin")&&(t=r(h("Installation failed: %s"),e.errorMessage),a.addClass("plugin-card-update-failed").append('<div class="notice notice-error notice-alt is-dismissible"><p>'+t+"</p></div>"),a.on("click",".notice.is-dismissible .notice-dismiss",function(){setTimeout(function(){a.removeClass("plugin-card-update-failed").find(".column-name a").trigger("focus")},200)}),s.removeClass("updating-message").addClass("button-disabled").attr("aria-label",i).text(n),g.a11y.speak(t,"assertive"),g.updates.setCardButtonStatus({status:"plugin-install-failed",slug:e.slug,removeClasses:"updating-message",addClasses:"button-disabled",text:n,ariaLabel:i}),f.trigger("wp-plugin-install-error",e))},g.updates.checkPluginDependencies=function(e){return e=_.extend({success:g.updates.checkPluginDependenciesSuccess,error:g.updates.checkPluginDependenciesError},e),g.a11y.speak(h("Checking plugin dependencies... please wait.")),f.trigger("wp-checking-plugin-dependencies",e),g.updates.ajax("check_plugin_dependencies",e)},g.updates.checkPluginDependenciesSuccess=function(e){var t,a,s=c(".plugin-card-"+e.slug+", #plugin-information-footer").find(".install-now");s.removeClass("install-now installed button-disabled updated-message").addClass("activate-now button-primary").attr("href",e.activateUrl),g.a11y.speak(h("Plugin dependencies check completed successfully.")),f.trigger("wp-check-plugin-dependencies-success",e),("plugins-network"===pagenow?(t=d("Network Activate","plugin"),a=r(d("Network Activate %s","plugin"),e.pluginName),s.attr("aria-label",a)):(t=d("Activate","plugin"),a=r(d("Activate %s","plugin"),e.pluginName),s.attr("aria-label",a).attr("data-name",e.pluginName).attr("data-slug",e.slug).attr("data-plugin",e.plugin))).text(t),"plugin-information-footer"===s.parent().attr("id")&&g.updates.setCardButtonStatus({status:"dependencies-check-success",slug:e.slug,removeClasses:"install-now installed button-disabled updated-message",addClasses:"activate-now button-primary",text:t,ariaLabel:a,pluginName:e.pluginName,plugin:e.plugin,href:e.activateUrl})},g.updates.checkPluginDependenciesError=function(e){var t,a=c(".plugin-card-"+e.slug+", #plugin-information-footer").find(".install-now"),s=d("Activate","plugin"),n=r(d("Cannot activate %1$s. %2$s","plugin"),e.pluginName,e.errorMessage);g.updates.isValidResponse(e,"check-dependencies")&&(t=r(h("Activation failed: %s"),e.errorMessage),g.a11y.speak(t,"assertive"),f.trigger("wp-check-plugin-dependencies-error",e),a.removeClass("install-now installed updated-message").addClass("activate-now button-primary").attr("aria-label",n).text(s),"plugin-information-footer"===a.parent().attr("id"))&&g.updates.setCardButtonStatus({status:"dependencies-check-failed",slug:e.slug,removeClasses:"install-now installed updated-message",addClasses:"activate-now button-primary",text:s,ariaLabel:n})},g.updates.activatePlugin=function(e){var t=c(".plugin-card-"+e.slug+", #plugin-information-footer").find(".activate-now, .activating-message");return e=_.extend({success:g.updates.activatePluginSuccess,error:g.updates.activatePluginError},e),g.a11y.speak(h("Activating... please wait.")),f.trigger("wp-activating-plugin",e),"plugin-information-footer"===t.parent().attr("id")&&g.updates.setCardButtonStatus({status:"activating-plugin",slug:e.slug,removeClasses:"installed updated-message button-primary",addClasses:"activating-message",text:h("Activating..."),ariaLabel:r(d("Activating %s","plugin"),e.name)}),g.updates.ajax("activate-plugin",e)},g.updates.activatePluginSuccess=function(e){var t=c(".plugin-card-"+e.slug+", #plugin-information-footer").find(".activating-message"),a=d("Activated!","plugin"),s=r("%s activated successfully.",e.pluginName);g.a11y.speak(h("Activation completed successfully.")),f.trigger("wp-plugin-activate-success",e),t.removeClass("activating-message").addClass("activated-message button-disabled").attr("aria-label",s).text(a),"plugin-information-footer"===t.parent().attr("id")&&g.updates.setCardButtonStatus({status:"activated-plugin",slug:e.slug,removeClasses:"activating-message",addClasses:"activated-message button-disabled",text:a,ariaLabel:s}),setTimeout(function(){t.removeClass("activated-message").text(d("Active","plugin")),"plugin-information-footer"===t.parent().attr("id")&&g.updates.setCardButtonStatus({status:"plugin-active",slug:e.slug,removeClasses:"activated-message",text:d("Active","plugin"),ariaLabel:r("%s is active.",e.pluginName)})},1e3)},g.updates.activatePluginError=function(e){var t,a=c(".plugin-card-"+e.slug+", #plugin-information-footer").find(".activating-message"),s=h("Activation failed."),n=r(d("%s activation failed","plugin"),e.pluginName);g.updates.isValidResponse(e,"activate")&&(t=r(h("Activation failed: %s"),e.errorMessage),g.a11y.speak(t,"assertive"),f.trigger("wp-plugin-activate-error",e),a.removeClass("install-now installed activating-message").addClass("button-disabled").attr("aria-label",n).text(s),"plugin-information-footer"===a.parent().attr("id"))&&g.updates.setCardButtonStatus({status:"plugin-activation-failed",slug:e.slug,removeClasses:"install-now installed activating-message",addClasses:"button-disabled",text:s,ariaLabel:n})},g.updates.installImporterSuccess=function(e){g.updates.addAdminNotice({id:"install-success",className:"notice-success is-dismissible",message:r(h('Importer installed successfully. <a href="%s">Run importer</a>'),e.activateUrl+"&from=import")}),c('[data-slug="'+e.slug+'"]').removeClass("install-now updating-message").addClass("activate-now").attr({href:e.activateUrl+"&from=import","aria-label":r(h("Run %s"),e.pluginName)}).text(h("Run Importer")),g.a11y.speak(h("Installation completed successfully.")),f.trigger("wp-importer-install-success",e)},g.updates.installImporterError=function(e){var t=r(h("Installation failed: %s"),e.errorMessage),a=c('[data-slug="'+e.slug+'"]'),s=a.data("name");g.updates.isValidResponse(e,"install")&&!g.updates.maybeHandleCredentialError(e,"install-plugin")&&(g.updates.addAdminNotice({id:e.errorCode,className:"notice-error is-dismissible",message:t}),a.removeClass("updating-message").attr("aria-label",r(d("Install %s now","plugin"),s)).text(d("Install Now","plugin")),g.a11y.speak(t,"assertive"),f.trigger("wp-importer-install-error",e))},g.updates.deletePlugin=function(e){var t=c('[data-plugin="'+e.plugin+'"]').find(".row-actions a.delete");return e=_.extend({success:g.updates.deletePluginSuccess,error:g.updates.deletePluginError},e),t.html()!==h("Deleting...")&&t.data("originaltext",t.html()).text(h("Deleting...")),g.a11y.speak(h("Deleting...")),f.trigger("wp-plugin-deleting",e),g.updates.ajax("delete-plugin",e)},g.updates.deletePluginSuccess=function(u){c('[data-plugin="'+u.plugin+'"]').css({backgroundColor:"#faafaa"}).fadeOut(350,function(){var e=c("#bulk-action-form"),t=c(".subsubsub"),a=c(this),s=t.find('[aria-current="page"]'),n=c(".displaying-num"),i=e.find("thead th:not(.hidden), thead td").length,l=g.template("item-deleted-row"),d=m.plugins;a.hasClass("plugin-update-tr")||a.after(l({slug:u.slug,plugin:u.plugin,colspan:i,name:u.pluginName})),a.remove(),-1!==_.indexOf(d.upgrade,u.plugin)&&(d.upgrade=_.without(d.upgrade,u.plugin),g.updates.decrementCount("plugin")),-1!==_.indexOf(d.inactive,u.plugin)&&(d.inactive=_.without(d.inactive,u.plugin),d.inactive.length?t.find(".inactive .count").text("("+d.inactive.length+")"):t.find(".inactive").remove()),-1!==_.indexOf(d.active,u.plugin)&&(d.active=_.without(d.active,u.plugin),d.active.length?t.find(".active .count").text("("+d.active.length+")"):t.find(".active").remove()),-1!==_.indexOf(d.recently_activated,u.plugin)&&(d.recently_activated=_.without(d.recently_activated,u.plugin),d.recently_activated.length?t.find(".recently_activated .count").text("("+d.recently_activated.length+")"):t.find(".recently_activated").remove()),-1!==_.indexOf(d["auto-update-enabled"],u.plugin)&&(d["auto-update-enabled"]=_.without(d["auto-update-enabled"],u.plugin),d["auto-update-enabled"].length?t.find(".auto-update-enabled .count").text("("+d["auto-update-enabled"].length+")"):t.find(".auto-update-enabled").remove()),-1!==_.indexOf(d["auto-update-disabled"],u.plugin)&&(d["auto-update-disabled"]=_.without(d["auto-update-disabled"],u.plugin),d["auto-update-disabled"].length?t.find(".auto-update-disabled .count").text("("+d["auto-update-disabled"].length+")"):t.find(".auto-update-disabled").remove()),d.all=_.without(d.all,u.plugin),d.all.length?t.find(".all .count").text("("+d.all.length+")"):(e.find(".tablenav").css({visibility:"hidden"}),t.find(".all").remove(),e.find("tr.no-items").length||e.find("#the-list").append('<tr class="no-items"><td class="colspanchange" colspan="'+i+'">'+h("No plugins are currently available.")+"</td></tr>")),n.length&&s.length&&(l=d[s.parent("li").attr("class")].length,n.text(r(o("%s item","%s items",l,"plugin/plugins"),l)))}),g.a11y.speak(d("Deleted!","plugin")),f.trigger("wp-plugin-delete-success",u)},g.updates.deletePluginError=function(e){var t,a=g.template("item-update-row"),s=g.updates.adminNotice({className:"update-message notice-error notice-alt",message:e.errorMessage}),n=e.plugin?(t=c('tr.inactive[data-plugin="'+e.plugin+'"]')).siblings('[data-plugin="'+e.plugin+'"]'):(t=c('tr.inactive[data-slug="'+e.slug+'"]')).siblings('[data-slug="'+e.slug+'"]');g.updates.isValidResponse(e,"delete")&&!g.updates.maybeHandleCredentialError(e,"delete-plugin")&&(n.length?(n.find(".notice-error").remove(),n.find(".plugin-update").append(s)):t.addClass("update").after(a({slug:e.slug,plugin:e.plugin||e.slug,colspan:c("#bulk-action-form").find("thead th:not(.hidden), thead td").length,content:s})),f.trigger("wp-plugin-delete-error",e))},g.updates.updateTheme=function(e){var t;return e=_.extend({success:g.updates.updateThemeSuccess,error:g.updates.updateThemeError},e),(t=("themes-network"===pagenow?c('[data-slug="'+e.slug+'"]').find(".update-message").removeClass("notice-error").addClass("updating-message notice-warning"):(t="customize"===pagenow?((t=c('[data-slug="'+e.slug+'"].notice').removeClass("notice-large")).find("h3").remove(),t.add(c("#customize-control-installed_theme_"+e.slug).find(".update-message"))):((t=c("#update-theme").closest(".notice").removeClass("notice-large")).find("h3").remove(),t.add(c('[data-slug="'+e.slug+'"]').find(".update-message")))).addClass("updating-message")).find("p")).html()!==h("Updating...")&&t.data("originaltext",t.html()),g.a11y.speak(h("Updating... please wait.")),t.text(h("Updating...")),f.trigger("wp-theme-updating",e),g.updates.ajax("update-theme",e)},g.updates.updateThemeSuccess=function(e){var t,a,s=c("body.modal-open").length,n=c('[data-slug="'+e.slug+'"]'),i={className:"updated-message notice-success notice-alt",message:d("Updated!","theme")};"customize"===pagenow?((n=c(".updating-message").siblings(".theme-name")).length&&(a=n.html().replace(e.oldVersion,e.newVersion),n.html(a)),t=c(".theme-info .notice").add(g.customize.control("installed_theme_"+e.slug).container.find(".theme").find(".update-message"))):"themes-network"===pagenow?(t=n.find(".update-message"),a=n.find(".theme-version-author-uri").html().replace(e.oldVersion,e.newVersion),n.find(".theme-version-author-uri").html(a),n.find(".auto-update-time").empty()):(t=c(".theme-info .notice").add(n.find(".update-message")),s?(c(".load-customize:visible").trigger("focus"),c(".theme-info .theme-autoupdate").find(".auto-update-time").empty()):n.find(".load-customize").trigger("focus")),g.updates.addAdminNotice(_.extend({selector:t},i)),g.a11y.speak(h("Update completed successfully.")),g.updates.decrementCount("theme"),f.trigger("wp-theme-update-success",e),s&&"customize"!==pagenow&&c(".theme-info .theme-author").after(g.updates.adminNotice(i))},g.updates.updateThemeError=function(e){var t,a=c('[data-slug="'+e.slug+'"]'),s=r(h("Update failed: %s"),e.errorMessage);g.updates.isValidResponse(e,"update")&&!g.updates.maybeHandleCredentialError(e,"update-theme")&&("customize"===pagenow&&(a=g.customize.control("installed_theme_"+e.slug).container.find(".theme")),"themes-network"===pagenow?t=a.find(".update-message "):(t=c(".theme-info .notice").add(a.find(".notice")),(c("body.modal-open").length?c(".load-customize:visible"):a.find(".load-customize")).trigger("focus")),g.updates.addAdminNotice({selector:t,className:"update-message notice-error notice-alt is-dismissible",message:s}),g.a11y.speak(s),f.trigger("wp-theme-update-error",e))},g.updates.installTheme=function(e){var t=c('.theme-install[data-slug="'+e.slug+'"]');return e=_.extend({success:g.updates.installThemeSuccess,error:g.updates.installThemeError},e),t.addClass("updating-message"),t.parents(".theme").addClass("focus"),t.html()!==h("Installing...")&&t.data("originaltext",t.html()),t.attr("aria-label",r(d("Installing %s...","theme"),t.data("name"))).text(h("Installing...")),g.a11y.speak(h("Installing... please wait.")),c('.install-theme-info, [data-slug="'+e.slug+'"]').removeClass("theme-install-failed").find(".notice.notice-error").remove(),f.trigger("wp-theme-installing",e),g.updates.ajax("install-theme",e)},g.updates.installThemeSuccess=function(e){var t,a=c(".wp-full-overlay-header, [data-slug="+e.slug+"]");f.trigger("wp-theme-install-success",e),t=a.find(".button-primary").removeClass("updating-message").addClass("updated-message disabled").attr("aria-label",r(d("%s installed!","theme"),e.themeName)).text(d("Installed!","theme")),g.a11y.speak(h("Installation completed successfully.")),setTimeout(function(){e.activateUrl&&(t.attr("href",e.activateUrl).removeClass("theme-install updated-message disabled").addClass("activate"),"themes-network"===pagenow?t.attr("aria-label",r(d("Network Activate %s","theme"),e.themeName)).text(h("Network Enable")):t.attr("aria-label",r(d("Activate %s","theme"),e.themeName)).text(d("Activate","theme"))),e.customizeUrl&&t.siblings(".preview").replaceWith(function(){return c("<a>").attr("href",e.customizeUrl).addClass("button load-customize").text(h("Live Preview"))})},1e3)},g.updates.installThemeError=function(e){var t,a=r(h("Installation failed: %s"),e.errorMessage),s=g.updates.adminNotice({className:"update-message notice-error notice-alt",message:a});g.updates.isValidResponse(e,"install")&&!g.updates.maybeHandleCredentialError(e,"install-theme")&&("customize"===pagenow?(f.find("body").hasClass("modal-open")?(t=c('.theme-install[data-slug="'+e.slug+'"]'),c(".theme-overlay .theme-info").prepend(s)):(t=c('.theme-install[data-slug="'+e.slug+'"]')).closest(".theme").addClass("theme-install-failed").append(s),g.customize.notifications.remove("theme_installing")):f.find("body").hasClass("full-overlay-active")?(t=c('.theme-install[data-slug="'+e.slug+'"]'),c(".install-theme-info").prepend(s)):t=c('[data-slug="'+e.slug+'"]').removeClass("focus").addClass("theme-install-failed").append(s).find(".theme-install"),t.removeClass("updating-message").attr("aria-label",r(d("%s installation failed","theme"),t.data("name"))).text(h("Installation failed.")),g.a11y.speak(a,"assertive"),f.trigger("wp-theme-install-error",e))},g.updates.deleteTheme=function(e){var t;return"themes"===pagenow?t=c(".theme-actions .delete-theme"):"themes-network"===pagenow&&(t=c('[data-slug="'+e.slug+'"]').find(".row-actions a.delete")),e=_.extend({success:g.updates.deleteThemeSuccess,error:g.updates.deleteThemeError},e),t&&t.html()!==h("Deleting...")&&t.data("originaltext",t.html()).text(h("Deleting...")),g.a11y.speak(h("Deleting...")),c(".theme-info .update-message").remove(),f.trigger("wp-theme-deleting",e),g.updates.ajax("delete-theme",e)},g.updates.deleteThemeSuccess=function(n){var e=c('[data-slug="'+n.slug+'"]');"themes-network"===pagenow&&e.css({backgroundColor:"#faafaa"}).fadeOut(350,function(){var e=c(".subsubsub"),t=c(this),a=m.themes,s=g.template("item-deleted-row");t.hasClass("plugin-update-tr")||t.after(s({slug:n.slug,colspan:c("#bulk-action-form").find("thead th:not(.hidden), thead td").length,name:t.find(".theme-title strong").text()})),t.remove(),-1!==_.indexOf(a.upgrade,n.slug)&&(a.upgrade=_.without(a.upgrade,n.slug),g.updates.decrementCount("theme")),-1!==_.indexOf(a.disabled,n.slug)&&(a.disabled=_.without(a.disabled,n.slug),a.disabled.length?e.find(".disabled .count").text("("+a.disabled.length+")"):e.find(".disabled").remove()),-1!==_.indexOf(a["auto-update-enabled"],n.slug)&&(a["auto-update-enabled"]=_.without(a["auto-update-enabled"],n.slug),a["auto-update-enabled"].length?e.find(".auto-update-enabled .count").text("("+a["auto-update-enabled"].length+")"):e.find(".auto-update-enabled").remove()),-1!==_.indexOf(a["auto-update-disabled"],n.slug)&&(a["auto-update-disabled"]=_.without(a["auto-update-disabled"],n.slug),a["auto-update-disabled"].length?e.find(".auto-update-disabled .count").text("("+a["auto-update-disabled"].length+")"):e.find(".auto-update-disabled").remove()),a.all=_.without(a.all,n.slug),e.find(".all .count").text("("+a.all.length+")")}),"themes"===pagenow&&_.find(_wpThemeSettings.themes,{id:n.slug}).hasUpdate&&g.updates.decrementCount("theme"),g.a11y.speak(d("Deleted!","theme")),f.trigger("wp-theme-delete-success",n)},g.updates.deleteThemeError=function(e){var t=c('tr.inactive[data-slug="'+e.slug+'"]'),a=c(".theme-actions .delete-theme"),s=g.template("item-update-row"),n=t.siblings("#"+e.slug+"-update"),i=r(h("Deletion failed: %s"),e.errorMessage),l=g.updates.adminNotice({className:"update-message notice-error notice-alt",message:i});g.updates.maybeHandleCredentialError(e,"delete-theme")||("themes-network"===pagenow?n.length?(n.find(".notice-error").remove(),n.find(".plugin-update").append(l)):t.addClass("update").after(s({slug:e.slug,colspan:c("#bulk-action-form").find("thead th:not(.hidden), thead td").length,content:l})):c(".theme-info .theme-description").before(l),a.html(a.data("originaltext")),g.a11y.speak(i,"assertive"),f.trigger("wp-theme-delete-error",e))},g.updates._addCallbacks=function(e,t){return"import"===pagenow&&"install-plugin"===t&&(e.success=g.updates.installImporterSuccess,e.error=g.updates.installImporterError),e},g.updates.queueChecker=function(){var e;if(!g.updates.ajaxLocked&&g.updates.queue.length)switch((e=g.updates.queue.shift()).action){case"install-plugin":g.updates.installPlugin(e.data);break;case"update-plugin":g.updates.updatePlugin(e.data);break;case"delete-plugin":g.updates.deletePlugin(e.data);break;case"install-theme":g.updates.installTheme(e.data);break;case"update-theme":g.updates.updateTheme(e.data);break;case"delete-theme":g.updates.deleteTheme(e.data)}},g.updates.requestFilesystemCredentials=function(e){!1===g.updates.filesystemCredentials.available&&(e&&!g.updates.$elToReturnFocusToFromCredentialsModal&&(g.updates.$elToReturnFocusToFromCredentialsModal=c(e.target)),g.updates.ajaxLocked=!0,g.updates.requestForCredentialsModalOpen())},g.updates.maybeRequestFilesystemCredentials=function(e){g.updates.shouldRequestFilesystemCredentials&&!g.updates.ajaxLocked&&g.updates.requestFilesystemCredentials(e)},g.updates.keydown=function(e){27===e.keyCode?g.updates.requestForCredentialsModalCancel():9===e.keyCode&&("upgrade"!==e.target.id||e.shiftKey?"hostname"===e.target.id&&e.shiftKey&&(c("#upgrade").trigger("focus"),e.preventDefault()):(c("#hostname").trigger("focus"),e.preventDefault()))},g.updates.requestForCredentialsModalOpen=function(){var e=c("#request-filesystem-credentials-dialog");c("body").addClass("modal-open"),e.show(),e.find("input:enabled:first").trigger("focus"),e.on("keydown",g.updates.keydown)},g.updates.requestForCredentialsModalClose=function(){c("#request-filesystem-credentials-dialog").hide(),c("body").removeClass("modal-open"),g.updates.$elToReturnFocusToFromCredentialsModal&&g.updates.$elToReturnFocusToFromCredentialsModal.trigger("focus")},g.updates.requestForCredentialsModalCancel=function(){(g.updates.ajaxLocked||g.updates.queue.length)&&(_.each(g.updates.queue,function(e){f.trigger("credential-modal-cancel",e)}),g.updates.ajaxLocked=!1,g.updates.queue=[],g.updates.requestForCredentialsModalClose())},g.updates.showErrorInCredentialsForm=function(e){var t=c("#request-filesystem-credentials-form");t.find(".notice").remove(),t.find("#request-filesystem-credentials-title").after('<div class="notice notice-alt notice-error"><p>'+e+"</p></div>")},g.updates.credentialError=function(e,t){e=g.updates._addCallbacks(e,t),g.updates.queue.unshift({action:t,data:e}),g.updates.filesystemCredentials.available=!1,g.updates.showErrorInCredentialsForm(e.errorMessage),g.updates.requestFilesystemCredentials()},g.updates.maybeHandleCredentialError=function(e,t){return!(!g.updates.shouldRequestFilesystemCredentials||!e.errorCode||"unable_to_connect_to_filesystem"!==e.errorCode||(g.updates.credentialError(e,t),0))},g.updates.isValidResponse=function(e,t){var a,s=h("Something went wrong.");if(_.isObject(e)&&!_.isFunction(e.always))return!0;switch(_.isString(e)&&"-1"===e?s=h("An error has occurred. Please reload the page and try again."):_.isString(e)?s=e:void 0!==e.readyState&&0===e.readyState?s=h("Connection lost or the server is busy. Please try again later."):_.isString(e.responseText)&&""!==e.responseText?s=e.responseText:_.isString(e.statusText)&&(s=e.statusText),t){case"update":a=h("Update failed: %s");break;case"install":a=h("Installation failed: %s");break;case"check-dependencies":a=h("Dependencies check failed: %s");break;case"activate":a=h("Activation failed: %s");break;case"delete":a=h("Deletion failed: %s")}return s=s.replace(/<[\/a-z][^<>]*>/gi,""),a=a.replace("%s",s),g.updates.addAdminNotice({id:"unknown_error",className:"notice-error is-dismissible",message:_.escape(a)}),g.updates.ajaxLocked=!1,g.updates.queue=[],c(".button.updating-message").removeClass("updating-message").removeAttr("aria-label").prop("disabled",!0).text(h("Update failed.")),c(".updating-message:not(.button):not(.thickbox)").removeClass("updating-message notice-warning").addClass("notice-error").find("p").removeAttr("aria-label").text(a),g.a11y.speak(a,"assertive"),!1},g.updates.beforeunload=function(){if(g.updates.ajaxLocked)return h("Updates may not complete if you navigate away from this page.")},c(function(){var i=c("#plugin-filter, #plugin-information-footer"),o=c("#bulk-action-form"),e=c("#request-filesystem-credentials-form"),t=c("#request-filesystem-credentials-dialog"),a=c(".plugins-php .wp-filter-search"),s=c(".plugin-install-php .wp-filter-search");(m=_.extend(m,window._wpUpdatesItemCounts||{})).totals&&g.updates.refreshCount(),g.updates.shouldRequestFilesystemCredentials=0<t.length,t.on("submit","form",function(e){e.preventDefault(),g.updates.filesystemCredentials.ftp.hostname=c("#hostname").val(),g.updates.filesystemCredentials.ftp.username=c("#username").val(),g.updates.filesystemCredentials.ftp.password=c("#password").val(),g.updates.filesystemCredentials.ftp.connectionType=c('input[name="connection_type"]:checked').val(),g.updates.filesystemCredentials.ssh.publicKey=c("#public_key").val(),g.updates.filesystemCredentials.ssh.privateKey=c("#private_key").val(),g.updates.filesystemCredentials.fsNonce=c("#_fs_nonce").val(),g.updates.filesystemCredentials.available=!0,g.updates.ajaxLocked=!1,g.updates.queueChecker(),g.updates.requestForCredentialsModalClose()}),t.on("click",'[data-js-action="close"], .notification-dialog-background',g.updates.requestForCredentialsModalCancel),e.on("change",'input[name="connection_type"]',function(){c("#ssh-keys").toggleClass("hidden","ssh"!==c(this).val())}).trigger("change"),f.on("credential-modal-cancel",function(e,t){var a,s=c(".updating-message");"import"===pagenow?s.removeClass("updating-message"):"plugins"===pagenow||"plugins-network"===pagenow?"update-plugin"===t.action?a=c('tr[data-plugin="'+t.data.plugin+'"]').find(".update-message"):"delete-plugin"===t.action&&(a=c('[data-plugin="'+t.data.plugin+'"]').find(".row-actions a.delete")):"themes"===pagenow||"themes-network"===pagenow?"update-theme"===t.action?a=c('[data-slug="'+t.data.slug+'"]').find(".update-message"):"delete-theme"===t.action&&"themes-network"===pagenow?a=c('[data-slug="'+t.data.slug+'"]').find(".row-actions a.delete"):"delete-theme"===t.action&&"themes"===pagenow&&(a=c(".theme-actions .delete-theme")):a=s,a&&a.hasClass("updating-message")&&(void 0===(s=a.data("originaltext"))&&(s=c("<p>").html(a.find("p").data("originaltext"))),a.removeClass("updating-message").html(s),"plugin-install"!==pagenow&&"plugin-install-network"!==pagenow||("update-plugin"===t.action?a.attr("aria-label",r(d("Update %s now","plugin"),a.data("name"))):"install-plugin"===t.action&&a.attr("aria-label",r(d("Install %s now","plugin"),a.data("name"))))),g.a11y.speak(h("Update canceled."))}),o.on("click","[data-plugin] .update-link",function(e){var t=c(e.target),a=t.parents("tr");e.preventDefault(),t.hasClass("updating-message")||t.hasClass("button-disabled")||(g.updates.maybeRequestFilesystemCredentials(e),g.updates.$elToReturnFocusToFromCredentialsModal=a.find(".check-column input"),g.updates.updatePlugin({plugin:a.data("plugin"),slug:a.data("slug")}))}),i.on("click",".update-now",function(e){var t=c(e.target);e.preventDefault(),t.hasClass("updating-message")||t.hasClass("button-disabled")||(g.updates.maybeRequestFilesystemCredentials(e),g.updates.updatePlugin({plugin:t.data("plugin"),slug:t.data("slug")}))}),i.on("click",".install-now",function(e){var t=c(e.target);e.preventDefault(),t.hasClass("updating-message")||t.hasClass("button-disabled")||(g.updates.shouldRequestFilesystemCredentials&&!g.updates.ajaxLocked&&(g.updates.requestFilesystemCredentials(e),f.on("credential-modal-cancel",function(){c(".install-now.updating-message").removeClass("updating-message").text(d("Install Now","plugin")),g.a11y.speak(h("Update canceled."))})),g.updates.installPlugin({slug:t.data("slug")}))}),i.on("click",".activate-now",function(e){var t=c(e.target);e.preventDefault(),t.hasClass("activating-message")||t.hasClass("button-disabled")||(t.removeClass("activate-now button-primary").addClass("activating-message").attr("aria-label",r(d("Activating %s","plugin"),t.data("name"))).text(h("Activating...")),g.updates.activatePlugin({name:t.data("name"),slug:t.data("slug"),plugin:t.data("plugin")}))}),f.on("click",".importer-item .install-now",function(e){var t=c(e.target),a=c(this).data("name");e.preventDefault(),t.hasClass("updating-message")||(g.updates.shouldRequestFilesystemCredentials&&!g.updates.ajaxLocked&&(g.updates.requestFilesystemCredentials(e),f.on("credential-modal-cancel",function(){t.removeClass("updating-message").attr("aria-label",r(d("Install %s now","plugin"),a)).text(d("Install Now","plugin")),g.a11y.speak(h("Update canceled."))})),g.updates.installPlugin({slug:t.data("slug"),pagenow:pagenow,success:g.updates.installImporterSuccess,error:g.updates.installImporterError}))}),o.on("click","[data-plugin] a.delete",function(e){var t=c(e.target).parents("tr"),a=t.hasClass("is-uninstallable")?r(h("Are you sure you want to delete %s and its data?"),t.find(".plugin-title strong").text()):r(h("Are you sure you want to delete %s?"),t.find(".plugin-title strong").text());e.preventDefault(),window.confirm(a)&&(g.updates.maybeRequestFilesystemCredentials(e),g.updates.deletePlugin({plugin:t.data("plugin"),slug:t.data("slug")}))}),f.on("click",".themes-php.network-admin .update-link",function(e){var t=c(e.target),a=t.parents("tr");e.preventDefault(),t.hasClass("updating-message")||t.hasClass("button-disabled")||(g.updates.maybeRequestFilesystemCredentials(e),g.updates.$elToReturnFocusToFromCredentialsModal=a.find(".check-column input"),g.updates.updateTheme({slug:a.data("slug")}))}),f.on("click",".themes-php.network-admin a.delete",function(e){var t=c(e.target).parents("tr"),a=r(h("Are you sure you want to delete %s?"),t.find(".theme-title strong").text());e.preventDefault(),window.confirm(a)&&(g.updates.maybeRequestFilesystemCredentials(e),g.updates.deleteTheme({slug:t.data("slug")}))}),o.on("click",'[type="submit"]:not([name="clear-recent-list"])',function(e){var t,s,n=c(e.target).siblings("select").val(),a=o.find('input[name="checked[]"]:checked'),i=0,l=0,d=[];switch(pagenow){case"plugins":case"plugins-network":t="plugin";break;case"themes-network":t="theme";break;default:return}if(!a.length)return e.preventDefault(),c("html, body").animate({scrollTop:0}),g.updates.addAdminNotice({id:"no-items-selected",className:"notice-error is-dismissible",message:h("Please select at least one item to perform this action on.")});switch(n){case"update-selected":s=n.replace("selected",t);break;case"delete-selected":var u=h("plugin"===t?"Are you sure you want to delete the selected plugins and their data?":"Caution: These themes may be active on other sites in the network. Are you sure you want to proceed?");if(!window.confirm(u))return void e.preventDefault();s=n.replace("selected",t);break;default:return}g.updates.maybeRequestFilesystemCredentials(e),e.preventDefault(),o.find('.manage-column [type="checkbox"]').prop("checked",!1),f.trigger("wp-"+t+"-bulk-"+n,a),a.each(function(e,t){var t=c(t),a=t.parents("tr");"update-selected"!==n||a.hasClass("update")&&!a.find("notice-error").length?"update-selected"===n&&a.hasClass("is-enqueued")||(a.addClass("is-enqueued"),g.updates.queue.push({action:s,data:{plugin:a.data("plugin"),slug:a.data("slug")}})):t.prop("checked",!1)}),f.on("wp-plugin-update-success wp-plugin-update-error wp-theme-update-success wp-theme-update-error",function(e,t){var a,s=c('[data-slug="'+t.slug+'"]');"wp-"+t.update+"-update-success"===e.type?i++:(e=t.pluginName||s.find(".column-primary strong").text(),l++,d.push(e+": "+t.errorMessage)),s.find('input[name="checked[]"]:checked').prop("checked",!1),g.updates.adminNotice=g.template("wp-bulk-updates-admin-notice"),g.updates.addAdminNotice({id:"bulk-action-notice",className:"bulk-action-notice",successes:i,errors:l,errorMessages:d,type:t.update}),a=c("#bulk-action-notice").on("click","button",function(){c(this).toggleClass("bulk-action-errors-collapsed").attr("aria-expanded",!c(this).hasClass("bulk-action-errors-collapsed")),a.find(".bulk-action-errors").toggleClass("hidden")}),0<l&&!g.updates.queue.length&&c("html, body").animate({scrollTop:0})}),f.on("wp-updates-notice-added",function(){g.updates.adminNotice=g.template("wp-updates-admin-notice")}),g.updates.queueChecker()}),s.length&&s.attr("aria-describedby","live-search-desc"),s.on("keyup input",_.debounce(function(e,t){var a=c(".plugin-install-search"),s={_ajax_nonce:g.updates.ajaxNonce,s:encodeURIComponent(e.target.value),tab:"search",type:c("#typeselector").val(),pagenow:pagenow},n=location.href.split("?")[0]+"?"+c.param(_.omit(s,["_ajax_nonce","pagenow"]));"keyup"===e.type&&27===e.which&&(e.target.value=""),g.updates.searchTerm===s.s&&"typechange"!==t||(i.empty(),g.updates.searchTerm=s.s,window.history&&window.history.replaceState&&window.history.replaceState(null,"",n),a.length||(a=c('<li class="plugin-install-search" />').append(c("<a />",{class:"current",href:n,text:h("Search Results")})),c(".wp-filter .filter-links .current").removeClass("current").parents(".filter-links").prepend(a),i.prev("p").remove(),c(".plugins-popular-tags-wrapper").remove()),void 0!==g.updates.searchRequest&&g.updates.searchRequest.abort(),c("body").addClass("loading-content"),g.updates.searchRequest=g.ajax.post("search-install-plugins",s).done(function(e){c("body").removeClass("loading-content"),i.append(e.items),delete g.updates.searchRequest,0===e.count?g.a11y.speak(h("You do not appear to have any plugins available at this time.")):g.a11y.speak(r(h("Number of plugins found: %d"),e.count))}))},1e3)),a.length&&a.attr("aria-describedby","live-search-desc"),a.on("keyup input",_.debounce(function(e){var s={_ajax_nonce:g.updates.ajaxNonce,s:encodeURIComponent(e.target.value),pagenow:pagenow,plugin_status:"all"};"keyup"===e.type&&27===e.which&&(e.target.value=""),g.updates.searchTerm!==s.s&&(g.updates.searchTerm=s.s,e=_.object(_.compact(_.map(location.search.slice(1).split("&"),function(e){if(e)return e.split("=")}))),s.plugin_status=e.plugin_status||"all",window.history&&window.history.replaceState&&window.history.replaceState(null,"",location.href.split("?")[0]+"?s="+s.s+"&plugin_status="+s.plugin_status),void 0!==g.updates.searchRequest&&g.updates.searchRequest.abort(),o.empty(),c("body").addClass("loading-content"),c(".subsubsub .current").removeClass("current"),g.updates.searchRequest=g.ajax.post("search-plugins",s).done(function(e){var t=c("<span />").addClass("subtitle").html(r(h("Search results for: %s"),"<strong>"+_.escape(decodeURIComponent(s.s))+"</strong>")),a=c(".wrap .subtitle");s.s.length?a.length?a.replaceWith(t):c(".wp-header-end").before(t):(a.remove(),c(".subsubsub ."+s.plugin_status+" a").addClass("current")),c("body").removeClass("loading-content"),o.append(e.items),delete g.updates.searchRequest,0===e.count?g.a11y.speak(h("No plugins found. Try a different search.")):g.a11y.speak(r(h("Number of plugins found: %d"),e.count))}))},500)),f.on("submit",".search-plugins",function(e){e.preventDefault(),c("input.wp-filter-search").trigger("input")}),f.on("click",".try-again",function(e){e.preventDefault(),s.trigger("input")}),c("#typeselector").on("change",function(){var e=c('input[name="s"]');e.val().length&&e.trigger("input","typechange")}),c("#plugin_update_from_iframe").on("click",function(e){var t=window.parent===window?null:window.parent;c.support.postMessage=!!window.postMessage,!1!==c.support.postMessage&&null!==t&&-1===window.parent.location.pathname.indexOf("update-core.php")&&(e.preventDefault(),e={action:"update-plugin",data:{plugin:c(this).data("plugin"),slug:c(this).data("slug")}},t.postMessage(JSON.stringify(e),window.location.origin))}),c(window).on("message",function(e){var t,e=e.originalEvent,a=document.location.protocol+"//"+document.location.host;if(e.origin===a){try{t=JSON.parse(e.data)}catch(e){return}if(t)if(void 0!==t.status&&void 0!==t.slug&&void 0!==t.text&&void 0!==t.ariaLabel&&(a=c(".plugin-card-"+t.slug).find('[data-slug="'+t.slug+'"]'),void 0!==t.removeClasses&&a.removeClass(t.removeClasses),void 0!==t.addClasses&&a.addClass(t.addClasses),""===t.ariaLabel?a.removeAttr("aria-label"):a.attr("aria-label",t.ariaLabel),"dependencies-check-success"===t.status&&a.attr("data-name",t.pluginName).attr("data-slug",t.slug).attr("data-plugin",t.plugin).attr("href",t.href),a.text(t.text)),void 0!==t.action)switch(t.action){case"decrementUpdateCount":g.updates.decrementCount(t.upgradeType);break;case"install-plugin":case"update-plugin":void 0!==t.data&&void 0!==t.data.slug&&(t.data=g.updates._addCallbacks(t.data,t.action),g.updates.queue.push(t),g.updates.queueChecker())}}}),c(window).on("beforeunload",g.updates.beforeunload),f.on("keydown",".column-auto-updates .toggle-auto-update, .theme-overlay .toggle-auto-update",function(e){32===e.which&&e.preventDefault()}),f.on("click keyup",".column-auto-updates .toggle-auto-update, .theme-overlay .toggle-auto-update",function(e){var l,d,u,o=c(this),r=o.attr("data-wp-action"),p=o.find(".label");if(("keyup"!==e.type||32===e.which)&&(u="themes"!==pagenow?o.closest(".column-auto-updates"):o.closest(".theme-autoupdate"),e.preventDefault(),"yes"!==o.attr("data-doing-ajax"))){switch(o.attr("data-doing-ajax","yes"),pagenow){case"plugins":case"plugins-network":d="plugin",l=o.closest("tr").attr("data-plugin");break;case"themes-network":d="theme",l=o.closest("tr").attr("data-slug");break;case"themes":d="theme",l=o.attr("data-slug")}u.find(".notice.notice-error").addClass("hidden"),"enable"===r?p.text(h("Enabling...")):p.text(h("Disabling...")),o.find(".dashicons-update").removeClass("hidden"),e={action:"toggle-auto-updates",_ajax_nonce:m.ajax_nonce,state:r,type:d,asset:l},c.post(window.ajaxurl,e).done(function(e){var t,a,s,n,i=o.attr("href");if(e.success){if("themes"!==pagenow){switch(n=c(".auto-update-enabled span"),t=c(".auto-update-disabled span"),a=parseInt(n.text().replace(/[^\d]+/g,""),10)||0,s=parseInt(t.text().replace(/[^\d]+/g,""),10)||0,r){case"enable":++a,--s;break;case"disable":--a,++s}a=Math.max(0,a),s=Math.max(0,s),n.text("("+a+")"),t.text("("+s+")")}"enable"===r?(o[0].hasAttribute("href")&&(i=i.replace("action=enable-auto-update","action=disable-auto-update"),o.attr("href",i)),o.attr("data-wp-action","disable"),p.text(h("Disable auto-updates")),u.find(".auto-update-time").removeClass("hidden"),g.a11y.speak(h("Auto-updates enabled"))):(o[0].hasAttribute("href")&&(i=i.replace("action=disable-auto-update","action=enable-auto-update"),o.attr("href",i)),o.attr("data-wp-action","enable"),p.text(h("Enable auto-updates")),u.find(".auto-update-time").addClass("hidden"),g.a11y.speak(h("Auto-updates disabled"))),f.trigger("wp-auto-update-setting-changed",{state:r,type:d,asset:l})}else n=e.data&&e.data.error?e.data.error:h("The request could not be completed."),u.find(".notice.notice-error").removeClass("hidden").find("p").text(n),g.a11y.speak(n,"assertive")}).fail(function(){u.find(".notice.notice-error").removeClass("hidden").find("p").text(h("The request could not be completed.")),g.a11y.speak(h("The request could not be completed."),"assertive")}).always(function(){o.removeAttr("data-doing-ajax").find(".dashicons-update").addClass("hidden")})}})})}(jQuery,window.wp,window._wpUpdatesSettings); \ No newline at end of file
diff --git a/wp-admin/js/user-profile.js b/wp-admin/js/user-profile.js
index 466d115..e4f249f 100644
--- a/wp-admin/js/user-profile.js
+++ b/wp-admin/js/user-profile.js
@@ -311,7 +311,7 @@
$('#pass-strength-result').addClass('short').html( pwsL10n.mismatch );
break;
default:
- $('#pass-strength-result').addClass('short').html( pwsL10n['short'] );
+ $('#pass-strength-result').addClass('short').html( pwsL10n.short );
}
}