!function(){var t={isStandardFont:function(t){return""==t.trim()||Object.keys(CustomizeTypographyObject.standardFonts).includes(t.trim())},hideStyle:function(t){""==t.trim()?this.container.hide():this.container.show()},hideSubset:function(t){this.isStandardFont(t.trim())?this.container.hide():this.container.show()},changeStyle:function(t){var e=this;wp.customize.control("".concat(this.params.extras.id,"[style]"),(function(i){var o=jQuery(".customize-control-typography-input",i.container),n=[];if(o.select2().select2("destroy"),o.find("option").each((function(){jQuery(this).remove()})),e.isStandardFont(t.trim()))n=Object.keys(CustomizeTypographyObject.standardFontStyles).reduce((function(t,e){return t.push({id:e,text:CustomizeTypographyObject.standardFontStyles[e]}),t}),[]);else{var s=_.isUndefined(CustomizeTypographyObject.googleFonts[t.trim()])?{}:CustomizeTypographyObject.googleFonts[t.trim()].variants;n=Object.keys(s).reduce((function(e,i){return e.push({id:i,text:CustomizeTypographyObject.googleFonts[t.trim()].variants[i]}),e}),[])}o.select2({data:n,allowClear:!0,placeholder:i.params.placeholder}).val(i.setting.get()).trigger("change")}))},changeSubset:function(t){var e=this;wp.customize.control("".concat(this.params.extras.id,"[subset]"),(function(i){var o=jQuery(".customize-control-typography-input",i.container),n=[];if(o.select2().select2("destroy"),o.find("option").each((function(){jQuery(this).remove()})),!e.isStandardFont(t.trim())){var s=_.isUndefined(CustomizeTypographyObject.googleFonts[t.trim()])?{}:CustomizeTypographyObject.googleFonts[t.trim()].subsets;n=Object.keys(s).reduce((function(e,i){return e.push({id:i,text:CustomizeTypographyObject.googleFonts[t.trim()].subsets[i]}),e}),[])}o.select2({data:n,allowClear:!0,placeholder:i.params.placeholder}).val(i.setting.get()).trigger("change")}))},ready:function(){var t=this;jQuery(".customize-control-typography-input",this.container).select2({allowClear:!0,placeholder:this.params.placeholder}).on("select2:unselecting",(function(){t.setting.set("")})),this.id=="".concat(this.params.extras.id,"[family]")&&wp.customize(this.id,(function(e){t.changeStyle(e.get()),t.changeSubset(e.get()),e.bind((function(e){t.changeStyle(e),t.changeSubset(e)}))})),this.id=="".concat(this.params.extras.id,"[style]")&&wp.customize("".concat(this.params.extras.id,"[family]"),(function(e){t.hideStyle(e.get()),e.bind((function(e){t.hideStyle(e)}))})),this.id=="".concat(this.params.extras.id,"[subset]")&&wp.customize("".concat(this.params.extras.id,"[family]"),(function(e){t.hideSubset(e.get()),e.bind((function(e){t.hideSubset(e)}))}))}};wp.customize.controlConstructor.typography=wp.customize.Control.extend(t)}();