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UC,GACJ9B,GAAuC8B,EAAY1C,OAM7D2C,OAAOC,UAAUC,OAAM,WACrBC,EAAEC,KAAKC,yBAAyB,SAAUhD,GACxCD,EAA8CC,GAE9CG,GAAGC,UAAUJ,GAAI,SAAUC,GACzBA,EAAMgD,MAAK,SAAUC,GACnBnD,EAA8CC,EAAIkD","sources":["src/control.js"],"sourcesContent":["import \"./control.scss\";\n\n/* global kirkiTypographyControls, kirkiGoogleFonts, kirkiFontVariants */\nfunction kirkiTypographyCompositeControlFontProperties(id, value) {\n const control = wp.customize.control(id);\n\n if (\"undefined\" === typeof control) {\n return;\n }\n\n value = value || control.setting.get();\n\n const isGoogle =\n value[\"font-family\"] && kirkiGoogleFonts.items[value[\"font-family\"]];\n const variantValue = value[\"variant\"]\n ? value[\"variant\"].toString()\n : \"regular\";\n const variantControl = wp.customize.control(id + \"[variant]\");\n\n const sortVariants = function (a, b) {\n if (a < b) return -1;\n if (a > b) return 1;\n return 0;\n };\n\n let variants = [];\n\n if (isGoogle) {\n let gFontVariants = kirkiGoogleFonts.items[value[\"font-family\"]].variants;\n gFontVariants.sort(sortVariants);\n\n kirkiFontVariants.complete.forEach(function (variant) {\n if (-1 !== gFontVariants.indexOf(variant.value)) {\n variants.push({\n value: variant.value,\n label: variant.label,\n });\n }\n });\n } else {\n\t\tlet customVariantKey = id.replace(/]/g, '');\n\t\tcustomVariantKey = customVariantKey.replace(/\\[/g, '_');\n\n\t\tif (kirkiCustomVariants[customVariantKey][value[\"font-family\"]]) {\n variants = kirkiCustomVariants[customVariantKey][value[\"font-family\"]];\n } else {\n variants = kirkiFontVariants.standard;\n }\n }\n\n // Set the font-style value.\n if (-1 !== variantValue.indexOf(\"i\")) {\n value[\"font-style\"] = \"italic\";\n } else {\n value[\"font-style\"] = \"normal\";\n }\n\n // Set the font-weight value.\n value[\"font-weight\"] =\n \"regular\" === variantValue || \"italic\" === variantValue\n ? 400\n : parseInt(variantValue, 10);\n\n if (variantControl) {\n // Hide/show variant options depending on which are available for this font-family.\n if (1 < variants.length && control.active()) {\n variantControl.activate();\n } else {\n // If there's only 1 variant to choose from, we can hide the control.\n variantControl.deactivate();\n }\n\n variantControl.params.choices = variants;\n variantControl.formattedOptions = [];\n variantControl.destroy();\n\n if (!variants.includes(variantValue)) {\n // If the selected font-family doesn't support the currently selected variant, switch to \"regular\".\n variantControl.doSelectAction(\"selectOption\", \"regular\");\n } else {\n variantControl.doSelectAction(\"selectOption\", variantValue);\n }\n }\n\n wp.hooks.addAction(\n \"kirki.dynamicControl.initKirkiControl\",\n \"kirki\",\n function (controlInit) {\n if (variantControl && id + \"[variant]\" === controlInit.id) {\n }\n }\n );\n}\n\njQuery(document).ready(function () {\n _.each(kirkiTypographyControls, function (id) {\n kirkiTypographyCompositeControlFontProperties(id);\n\n wp.customize(id, function (value) {\n value.bind(function (newval) {\n kirkiTypographyCompositeControlFontProperties(id, newval);\n });\n });\n });\n});\n"],"names":["$1abc80d3e2df1201$var$kirkiTypographyCompositeControlFontProperties","id","value","control","wp","customize","isGoogle","setting","get","kirkiGoogleFonts","items","variantValue","toString","variantControl","variants","gFontVariants","sort","a","b","kirkiFontVariants","complete","forEach","variant","indexOf","push","label","customVariantKey","replace","kirkiCustomVariants","standard","parseInt","length","active","activate","deactivate","params","choices","formattedOptions","destroy","includes","doSelectAction","hooks","addAction","controlInit","jQuery","document","ready","_","each","kirkiTypographyControls","bind","newval"],"version":3,"file":"control.js.map"}