window.awbStudioPreview={onReady:function(){var e=this;this.colorPalette=this.getColorPallete(),this.typoSets=this.getTypoSets(),this.invertedColorPaletter=this.getInvertedColorPalette(this.colorPalette),jQuery("body").on("change",'.awb-import-style input[name="overwrite-type"], .awb-import-inversion input[name="invert"]',function(t){t.preventDefault(),e.triggerPreviewChanges()}),jQuery(window).on("awb-studio-update-preview",function(t){t.preventDefault(),e.triggerPreviewChanges()})},getColorPallete:function(){var e=jQuery("#awb-global-colors").html();return void 0!==e&&e.length?(e=this.cleanData(e),e=this.ConvertToKeyValuePair(e)):{}},getTypoSets:function(){var e=jQuery("#awb-global-typography").html();return void 0!==e&&e.length?(e=this.cleanData(e),this.ConvertToKeyValuePair(e)):{}},cleanData:function(e){return e=(e=(e=e.replace(/^\s*\:root\s*{\s*/,"")).replace(/\s*}\s*$/,"")).split(";")},ConvertToKeyValuePair:function(e){var t={},o=["--primary_color"];for(let r=0;r<=e.length;r++){let i=e[r];"string"==typeof i&&""!==i&&(i=i.split(":"),this.valueExists(i[0])&&this.valueExists(i[1])&&!o.includes(i[0])&&(t[i[0]]=i[1]))}return t},getInvertedColorPalette:function(e){var t,o,r={};for(t=1,o=8;8>=t;t++,o--)void 0!==e["--awb-color"+o]&&(r["--awb-color"+t]=e["--awb-color"+o],r["--awb-color"+t+"-h"]=e["--awb-color"+o+"-h"],r["--awb-color"+t+"-s"]=e["--awb-color"+o+"-s"],r["--awb-color"+t+"-l"]=e["--awb-color"+o+"-l"],r["--awb-color"+t+"-a"]=e["--awb-color"+o+"-a"]);return r},valueExists:function(e){return void 0!==e&&""!==e},triggerPreviewChanges:function(){var e=jQuery('.awb-import-options input[name="overwrite-type"]:checked').val(),t=jQuery('.awb-import-options input[name="invert"]:checked').val(),o={color_palette:{},typo_sets:{},shouldInvert:t};"inherit"===e&&(o.color_palette="do-invert"===t?this.invertedColorPaletter:this.colorPalette,o.typo_sets=this.typoSets),"undefined"!=typeof awbStudio?document.getElementsByTagName("iframe")[0].contentWindow.postMessage(o,"*"):jQuery(".awb-studio-preview-frame")[0].contentWindow.postMessage(o,"*")}},function(e){"use strict";e(document).ready(function(){e(document).ready(function(){window.awbStudioPreview.onReady()})})}(jQuery);