(window.yoastWebpackJsonp=window.yoastWebpackJsonp||[]).push([[18],{165:function(e,t){e.exports=window.wp.data},962:function(e,t,r){"use strict";var n=r(165);!function(e){var t,r,a=wpseoPrimaryCategoryL10n.taxonomies;function o(t){return e("#yoast-wpseo-primary-"+t).val()}function i(t,r){e("#yoast-wpseo-primary-"+t).val(r).trigger("change");var a=(0,n.dispatch)("yoast-seo/editor");if(a){var o=parseInt(r,10);a.setPrimaryTaxonomyId(t,o),"category"===t&&a.updateReplacementVariable("primary_category",function(t){var r=e("#category-all").find("#category-"+t+" > label");if(0===r.length)return"";var n=r.clone();return n.children().remove(),e.trim(n.text())}(o))}}function c(n){var i,c,s;i=e("#"+n+'checklist input[type="checkbox"]:checked');var p=e("#"+n+"checklist li");p.removeClass("wpseo-term-unchecked wpseo-primary-term wpseo-non-primary-term"),e(".wpseo-primary-category-label").remove(),p.addClass("wpseo-term-unchecked"),i.length<=1||i.each(function(i,p){p=e(p),(c=p.closest("li")).removeClass("wpseo-term-unchecked"),function(t){return 1===e(t).closest("li").children(".wpseo-make-primary-term").length}(p)||function(r,n){var o,i;o=e(n).closest("label"),i=t({taxonomy:a[r],term:o.text()}),o.after(i)}(n,p),p.val()===o(n)?(c.addClass("wpseo-primary-term"),(s=p.closest("label")).find(".wpseo-primary-category-label").remove(),s.append(r({taxonomy:a[n]}))):c.addClass("wpseo-non-primary-term")})}function s(t){i(t,e("#"+t+'checklist input[type="checkbox"]:checked:first').val()),c(t)}function p(e){""===o(e)&&s(e)}e.fn.initYstSEOPrimaryCategory=function(){return this.each(function(t,r){var n=e("#"+r.name+"div");c(r.name),n.on("click",'input[type="checkbox"]',function(t){return function(){!1===e(this).prop("checked")&&e(this).val()===o(t)&&s(t),p(t),c(t)}}(r.name)),n.on("wpListAddEnd","#"+r.name+"checklist",function(e){return function(){p(e),c(e)}}(r.name)),n.on("click",".wpseo-make-primary-term",function(t){return function(r){var n;n=e(r.currentTarget).siblings("label").find("input"),i(t,n.val()),c(t),n.focus()}}(r.name))})},e(function(){t=wp.template("primary-term-ui"),r=wp.template("primary-term-screen-reader"),e(_.values(a)).initYstSEOPrimaryCategory()})}(jQuery)}},[[962,0]]]);