'use strict';(function(d){function D(a,b){var m=d('<div class="tfminicolors" />'),e=d.tfminicolors.defaults,k;if(!a.data("tfminicolors-initialized")){b=d.extend(!0,{},e,b);m.addClass("tfminicolors-theme-"+b.theme).addClass(b.opacity?"tfminicolors-with-opacity":"tfminicolors-without-opacity");void 0!==b.position&&d.each(b.position.split(" "),function(){m.addClass("tfminicolors-position-"+this)});e="rgb"===b.format?b.opacity?"25":"20":b.keywords?"11":"7";a.addClass("tfminicolors-input").data("tfminicolors-initialized",
!1).data("tfminicolors-settings",b).prop("size",e).attr("autocomplete","off").wrap(m).after('<div class="tfminicolors-panel tfminicolors-slider-'+b.control+'"><div class="tfminicolors-slider tfminicolors-sprite"><div class="tfminicolors-picker"></div></div><div class="tfminicolors-opacity-slider tfminicolors-sprite"><div class="tfminicolors-picker"></div></div><div class="tfminicolors-grid tfminicolors-sprite"><div class="tfminicolors-grid-inner"></div><div class="tfminicolors-picker"><div></div></div></div></div>');
b.inline||a.after('<span class="tfminicolors-swatch tfminicolors-sprite tfminicolors-input-swatch"><span class="tfminicolors-swatch-color tf_abs"></span></span>');a.on("focus.tfminicolors blur.tfminicolors keydown.tfminicolors keyup.tfminicolors paste.tfminicolors",function(b){var e=b.type;if("focus"===e)t(a);else if("blur"===e){if(b=a.data("tfminicolors-settings"),a.data("tfminicolors-initialized")){e=b.keywords?d.map(b.keywords.split(","),function(a){return d.trim(a.toLowerCase())}):[];if(""!==
a.val()&&-1<d.inArray(a.val().toLowerCase(),e))var m=a.val();else e=y(a.val())?r(a.val(),!0):(e=x(a.val(),!0))?u(e):null,m=null===e?b.defaultValue:"rgb"===b.format?b.opacity?r("rgba("+e.r+","+e.g+","+e.b+","+a.attr("data-opacity")+")"):r("rgb("+e.r+","+e.g+","+e.b+")"):E(e);e=b.opacity?a.attr("data-opacity"):1;"transparent"===m.toLowerCase()&&(e=0);a.closest(".tfminicolors").find(".tfminicolors-input-swatch > span").css("opacity",e);a.val(m);""===a.val()&&a.val(F(b.defaultValue,!0));a.val(A(a.val(),
b.letterCase))}}else if("keydown"===e)switch(b.which){case 9:c();break;case 13:case 27:c(),a.blur()}else if("keyup"===e||"paste"===e)"keyup"===e?g(a,!0):setTimeout(function(){g(a,!0)},1)}).closest(".tfminicolors").on("mousedown.tfminicolors touchstart.tfminicolors",".tfminicolors-grid, .tfminicolors-slider, .tfminicolors-opacity-slider",function(a){if(1===a.which){a.preventDefault();var b=d(this),e=document.body.contains(this)?document:top.document;f(b,a,!0);d(e).on("mousemove.tfminicolors touchmove.tfminicolors",
function(a){f(b,a)}).one("mouseup.tfminicolors touchend.tfminicolors",function(){d(e).off("mousemove.tfminicolors touchmove.tfminicolors")})}}).on("click.tfminicolors",".tfminicolors-swatches li",function(a){a.preventDefault();var b=d(this);a=b.parents(".tfminicolors").find(".tfminicolors-input");b=b.data("swatch-color");n(a,b,G(b));g(a)}).find(".tfminicolors-input-swatch").on("click mousedown.tfminicolors touchstart.tfminicolors",function(e){if("click"===e.type)b.inline||a.focus();else if(1===e.which)t(a);
else return;e.preventDefault()});e=a.parent().find(".tfminicolors-panel");e.on("selectstart",function(){return!1}).end();if(b.swatches&&0!==b.swatches.length){e.addClass("tfminicolors-with-swatches");var h=d('<ul class="tfminicolors-swatches tf_scrollbar"></ul>').appendTo(e);for(k=0;k<b.swatches.length;++k){if("object"===typeof b.swatches[k]){e=b.swatches[k].name;var B=b.swatches[k].color}else e="",B=b.swatches[k];var l=B;B=y(B)?r(B,!0):u(x(B,!0));d('<li class="tfminicolors-swatch tfminicolors-sprite"><span class="tfminicolors-swatch-color tf_abs" title="'+
e+'"></span></li>').appendTo(h).data("swatch-color",l).find(".tfminicolors-swatch-color").css({backgroundColor:E(B),opacity:B.a});b.swatches[k]=B}}b.inline&&a.parent().addClass("tfminicolors-inline");g(a,!1);a.data("tfminicolors-initialized",!0)}}function q(a){var b=a.parent();a.removeData("tfminicolors-initialized").removeData("tfminicolors-settings").removeProp("size").removeClass("tfminicolors-input");b.before(a).remove()}function t(a){var b=a.parent(),m=b.find(".tfminicolors-panel"),e=a.data("tfminicolors-settings"),
k=document.body.contains(a[0])?document:top.document;!a.data("tfminicolors-initialized")||a.prop("disabled")||b.hasClass("tfminicolors-inline")||b.hasClass("tfminicolors-focus")||(c(window.top.document),b.addClass("tfminicolors-focus"),m.animate?m.stop(!0,!0).fadeIn(e.showSpeed,function(){e.show&&e.show.call(a.get(0))}):(m.show(),e.show&&e.show.call(a.get(0))),d(k).on("mousedown.tfminicolors touchstart.tfminicolors",function(a){1===a.which&&0===d(a.target).closest(".tfminicolors,.tfminicolors_wrapper").length&&
(d(this).off("mousemove.tfminicolors touchmove.tfminicolors mousedown.tfminicolors touchstart.tfminicolors mouseup.tfminicolors touchend.tfminicolors"),c(this),k=null)}))}function c(a){d(".tfminicolors-focus",a).each(function(){var a=d(this),m=a.find(".tfminicolors-input"),e=a.find(".tfminicolors-panel"),k=m.data("tfminicolors-settings");e.animate?e.fadeOut(k.hideSpeed,function(){k.hide&&k.hide.call(m.get(0));a.removeClass("tfminicolors-focus")}):(e.hide(),k.hide&&k.hide.call(m.get(0)),a.removeClass("tfminicolors-focus"))})}
function f(a,b,m){var e=a.parents(".tfminicolors").find(".tfminicolors-input"),k=e.data("tfminicolors-settings"),d=a.find("[class$=-picker]"),c=a.offset().left,f=a.offset().top,l=Math.round(b.pageX-c),p=Math.round(b.pageY-f);m=m?k.animationSpeed:0;b.originalEvent.changedTouches&&(l=b.originalEvent.changedTouches[0].pageX-c,p=b.originalEvent.changedTouches[0].pageY-f);0>l&&(l=0);0>p&&(p=0);l>a.width()&&(l=a.width());p>a.height()&&(p=a.height());a.parent().is(".tfminicolors-slider-wheel")&&d.parent().is(".tfminicolors-grid")&&
(c=75-l,f=75-p,b=Math.sqrt(c*c+f*f),c=Math.atan2(f,c),0>c&&(c+=2*Math.PI),75<b&&(b=75,l=75-75*Math.cos(c),p=75-75*Math.sin(c)),l=Math.round(l),p=Math.round(p));p={top:p+"px"};a.is(".tfminicolors-grid")&&(p.left=l+"px");d.animate?d.stop(!0).animate(p,m,k.animationEasing,function(){h(e,a)}):(d.css(p),h(e,a))}function h(a,b){function m(a,b){if(!a.length||!b)return null;var e=a.offset().left;var m=a.offset().top;return{x:e-b.offset().left+a.outerWidth()/2,y:m-b.offset().top+a.outerHeight()/2}}var e=a.val();
var k=a.attr("data-opacity");var c=a.parent();var d=a.data("tfminicolors-settings"),f=c.find(".tfminicolors-input-swatch");var h=c.find(".tfminicolors-grid");var p=c.find(".tfminicolors-slider"),A=c.find(".tfminicolors-opacity-slider");var g=h.find("[class$=-picker]");var r=p.find("[class$=-picker]"),x=A.find("[class$=-picker]");g=m(g,h);r=m(r,p);x=m(x,A);if(b.is(".tfminicolors-grid, .tfminicolors-slider, .tfminicolors-opacity-slider")){switch(d.control){case "wheel":e=h.width()/2-g.x;c=h.height()/
2-g.y;h=Math.sqrt(e*e+c*c);e=Math.atan2(c,e);0>e&&(e+=2*Math.PI);75<h&&(h=75,g.x=69-75*Math.cos(e),g.y=69-75*Math.sin(e));b=l(h/.75,0,100);k=l(180*e/Math.PI,0,360);g=l(100-Math.floor(r.y*(100/p.height())),0,100);e=w({h:k,s:b,b:g});p.css("backgroundColor",w({h:k,s:b,b:100}));break;case "saturation":k=l(parseInt(g.x*(360/h.width()),10),0,360);b=l(100-Math.floor(r.y*(100/p.height())),0,100);g=l(100-Math.floor(g.y*(100/h.height())),0,100);e=w({h:k,s:b,b:g});p.css("backgroundColor",w({h:k,s:100,b:g}));
c.find(".tfminicolors-grid-inner").css("opacity",b/100);break;case "brightness":k=l(parseInt(g.x*(360/h.width()),10),0,360);b=l(100-Math.floor(g.y*(100/h.height())),0,100);g=l(100-Math.floor(r.y*(100/p.height())),0,100);e=w({h:k,s:b,b:g});p.css("backgroundColor",w({h:k,s:b,b:100}));c.find(".tfminicolors-grid-inner").css("opacity",1-g/100);break;default:k=l(360-parseInt(r.y*(360/p.height()),10),0,360),b=l(Math.floor(g.x*(100/h.width())),0,100),g=l(100-Math.floor(g.y*(100/h.height())),0,100),e=w({h:k,
s:b,b:g}),h.css("backgroundColor",w({h:k,s:100,b:100}))}k=d.opacity?parseFloat(1-x.y/A.height()).toFixed(2):1;n(a,e,k)}else f.find("span").css({backgroundColor:e,opacity:k}),C(a,e,k)}function n(a,b,m){var e=a.parent(),c=a.data("tfminicolors-settings");e=e.find(".tfminicolors-input-swatch");c.opacity&&a.attr("data-opacity",m);if("rgb"===c.format){b=y(b)?r(b,!0):u(x(b,!0));m=""===a.attr("data-opacity")?1:l(parseFloat(a.attr("data-opacity")).toFixed(2),0,1);if(isNaN(m)||!c.opacity)m=1;b=1>=a.tfminicolors("rgbObject").a&&
b&&c.opacity?"rgba("+b.r+", "+b.g+", "+b.b+", "+parseFloat(m)+")":"rgb("+b.r+", "+b.g+", "+b.b+")"}else y(b)&&(b=H(b)),b=A(b,c.letterCase);a.val(b);e.find("span").css({backgroundColor:b,opacity:m});C(a,b,m)}function g(a,b){var c;var e=a.parent();var k=a.data("tfminicolors-settings");var h=e.find(".tfminicolors-input-swatch");var f=e.find(".tfminicolors-grid"),g=e.find(".tfminicolors-slider"),n=e.find(".tfminicolors-opacity-slider"),p=f.find("[class$=-picker]"),q=g.find("[class$=-picker]"),z=n.find("[class$=-picker]");
if(y(a.val())){var v=H(a.val());(c=l(parseFloat(G(a.val())).toFixed(2),0,1))&&a.attr("data-opacity",c)}else v=A(x(a.val(),!0),k.letterCase);v||(v=A(F(k.defaultValue,!0),k.letterCase));c=I(v);var t=k.keywords?d.map(k.keywords.split(","),function(a){return d.trim(a.toLowerCase())}):[];t=""!==a.val()&&-1<d.inArray(a.val().toLowerCase(),t)?A(a.val()):y(a.val())?r(a.val()):v;b||a.val(t);if(k.opacity){var u=""===a.attr("data-opacity")?1:l(parseFloat(a.attr("data-opacity")).toFixed(2),0,1);isNaN(u)&&(u=
1);a.attr("data-opacity",u);h.find("span").css("opacity",u);b=l(n.height()-n.height()*u,0,n.height());z.css("top",b+"px")}"transparent"===a.val().toLowerCase()&&h.find("span").css("opacity",0);h.find("span").css("backgroundColor",v);switch(k.control){case "wheel":e=l(Math.ceil(.75*c.s),0,f.height()/2);h=c.h*Math.PI/180;k=l(75-Math.cos(h)*e,0,f.width());b=l(75-Math.sin(h)*e,0,f.height());p.css({top:b+"px",left:k+"px"});b=150-c.b/(100/f.height());""===v&&(b=0);q.css("top",b+"px");g.css("backgroundColor",
w({h:c.h,s:c.s,b:100}));break;case "saturation":k=l(5*c.h/12,0,150);b=l(f.height()-Math.ceil(c.b/(100/f.height())),0,f.height());p.css({top:b+"px",left:k+"px"});b=l(g.height()-c.s*(g.height()/100),0,g.height());q.css("top",b+"px");g.css("backgroundColor",w({h:c.h,s:100,b:c.b}));e.find(".tfminicolors-grid-inner").css("opacity",c.s/100);break;case "brightness":k=l(5*c.h/12,0,150);b=l(f.height()-Math.ceil(c.s/(100/f.height())),0,f.height());p.css({top:b+"px",left:k+"px"});b=l(g.height()-c.b*(g.height()/
100),0,g.height());q.css("top",b+"px");g.css("backgroundColor",w({h:c.h,s:c.s,b:100}));e.find(".tfminicolors-grid-inner").css("opacity",1-c.b/100);break;default:k=l(Math.ceil(c.s/(100/f.width())),0,f.width()),b=l(f.height()-Math.ceil(c.b/(100/f.height())),0,f.height()),p.css({top:b+"px",left:k+"px"}),b=l(g.height()-c.h/(360/g.height()),0,g.height()),q.css("top",b+"px"),f.css("backgroundColor",w({h:c.h,s:100,b:100}))}a.data("tfminicolors-initialized")&&C(a,t,u)}function C(a,b,c){var e=a.data("tfminicolors-settings"),
f=a.data("tfminicolors-lastChange"),d;if(!f||f.value!==b||f.opacity!==c){a.data("tfminicolors-lastChange",{value:b,opacity:c});if(e.swatches&&0!==e.swatches.length){f=y(b)?r(b,!0):u(b);var h=-1;for(d=0;d<e.swatches.length;++d)if(f.r===e.swatches[d].r&&f.g===e.swatches[d].g&&f.b===e.swatches[d].b&&f.a===e.swatches[d].a){h=d;break}a.parent().find(".tfminicolors-swatches .tfminicolors-swatch").removeClass("selected");-1!==h&&a.parent().find(".tfminicolors-swatches .tfminicolors-swatch").eq(d).addClass("selected")}e.change&&
(e.changeDelay?(clearTimeout(a.data("tfminicolors-changeTimeout")),a.data("tfminicolors-changeTimeout",setTimeout(function(){e.change.call(a.get(0),b,c)},e.changeDelay))):e.change.call(a.get(0),b,c));a.trigger("change").trigger("input")}}function v(a){var b=d(a).attr("data-opacity");y(d(a).val())?a=r(d(a).val(),!0):(a=x(d(a).val(),!0),a=u(a));if(!a)return null;void 0!==b&&d.extend(a,{a:parseFloat(b)});return a}function z(a,b){var c=d(a).attr("data-opacity");y(d(a).val())?a=r(d(a).val(),!0):(a=x(d(a).val(),
!0),a=u(a));if(!a)return null;void 0===c&&(c=1);return b?"rgba("+a.r+", "+a.g+", "+a.b+", "+parseFloat(c)+")":"rgb("+a.r+", "+a.g+", "+a.b+")"}function A(a,b){return"uppercase"===b?a.toUpperCase():a.toLowerCase()}function x(a,b){a=a.replace(/^#/g,"");if(!a.match(/^[A-F0-9]{3,6}/ig)||3!==a.length&&6!==a.length)return"";3===a.length&&b&&(a=a[0]+a[0]+a[1]+a[1]+a[2]+a[2]);return"#"+a}function r(a,b){a=a.replace(/[^\d,.]/g,"").split(",");a[0]=l(parseInt(a[0],10),0,255);a[1]=l(parseInt(a[1],10),0,255);
a[2]=l(parseInt(a[2],10),0,255);void 0!==a[3]&&(a[3]=l(parseFloat(a[3],10),0,1));return b?void 0!==a[3]?{r:a[0],g:a[1],b:a[2],a:a[3]}:{r:a[0],g:a[1],b:a[2]}:"undefined"!==typeof a[3]&&1>=a[3]?"rgba("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")":"rgb("+a[0]+", "+a[1]+", "+a[2]+")"}function F(a,b){return y(a)?r(a):x(a,b)}function l(a,b,c){a<b&&(a=b);a>c&&(a=c);return a}function y(a){return(a=a.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i))&&4===a.length?!0:!1}function G(a){return(a=
a.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+(\.\d{1,2})?|\.\d{1,2})[\s+]?/i))&&6===a.length?a[4]:"1"}function H(a){return(a=a.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i))&&4===a.length?"#"+("0"+parseInt(a[1],10).toString(16)).slice(-2)+("0"+parseInt(a[2],10).toString(16)).slice(-2)+("0"+parseInt(a[3],10).toString(16)).slice(-2):""}function E(a){var b=[a.r.toString(16),a.g.toString(16),a.b.toString(16)];d.each(b,function(a,
c){1===c.length&&(b[a]="0"+c)});return"#"+b.join("")}function w(a){var b,c;var e=Math.round(a.h);var f=Math.round(255*a.s/100);a=Math.round(255*a.b/100);if(0===f)e=b=c=a;else{f=(255-f)*a/255;var d=e%60*(a-f)/60;360===e&&(e=0);60>e?(e=a,c=f,b=f+d):120>e?(b=a,c=f,e=a-d):180>e?(b=a,e=f,c=f+d):240>e?(c=a,e=f,b=a-d):300>e?(c=a,b=f,e=f+d):360>e?(e=a,b=f,c=a-d):c=b=e=0}return E({r:Math.round(e),g:Math.round(b),b:Math.round(c)})}function I(a){a=u(a);var b={h:0,s:0,b:0},c=Math.max(a.r,a.g,a.b),e=c-Math.min(a.r,
a.g,a.b);b.b=c;b.s=0!==c?255*e/c:0;b.h=0!==b.s?a.r===c?(a.g-a.b)/e:a.g===c?2+(a.b-a.r)/e:4+(a.r-a.g)/e:-1;b.h*=60;0>b.h&&(b.h+=360);b.s*=100/255;b.b*=100/255;0===b.s&&(b.h=360);return b}function u(a){a=parseInt(-1<a.indexOf("#")?a.substring(1):a,16);return{r:a>>16,g:(a&65280)>>8,b:a&255}}d.tfminicolors={defaults:{animationSpeed:50,animationEasing:"swing",change:null,changeDelay:0,control:"hue",defaultValue:"",format:"hex",hide:null,hideSpeed:100,inline:!1,keywords:"",letterCase:"lowercase",opacity:!1,
position:"bottom",show:null,showSpeed:100,theme:"default",swatches:[]}};d.extend(d.fn,{tfminicolors:function(a,b){switch(a){case "destroy":return d(this).each(function(){q(d(this))}),d(this);case "hide":return c(),d(this);case "opacity":if(void 0===b)return d(this).attr("data-opacity");d(this).each(function(){g(d(this).attr("data-opacity",b))});return d(this);case "rgbObject":return v(d(this),"rgbaObject"===a);case "rgbString":case "rgbaString":return z(d(this),"rgbaString"===a);case "settings":if(void 0===
b)return d(this).data("tfminicolors-settings");d(this).each(function(){var a=d(this).data("tfminicolors-settings")||{};q(d(this));d(this).tfminicolors(d.extend(!0,a,b))});return d(this);case "show":return t(d(this).eq(0)),d(this);case "value":if(void 0===b)return d(this).val();d(this).each(function(){"object"===typeof b&&null!==b?(void 0!==b.opacity&&d(this).attr("data-opacity",l(b.opacity,0,1)),b.color&&d(this).val(b.color)):d(this).val(b);g(d(this))});return d(this);default:return"create"!==a&&
(b=a),d(this).each(function(){D(d(this),b)}),d(this)}}})})(jQuery);
(function(d,D,q){const t=D.top.document;D.themifyColorManager={colorSwatches:{},initilized:!1,init:function(){if(!this.initilized&&"undefined"!==typeof themifyCM){for(let c=Object.keys(themifyCM.colors),f=0,d=c.length;f<d;f++)this.colorSwatches[c[f]]=themifyCM.colors[c[f]];this.initilized=!0}},toRgba:function(c){return c.color.replace("rgb","rgba").replace(")",","+c.opacity+")")},toColorsArray:function(){let c=[];for(let f=Object.keys(this.colorSwatches),d=f.length-1;0<=d;--d)c.push(this.toRgba(this.colorSwatches[f[d]]));
c.length||(c=["#FFF"]);return c},initColorPicker:function(){const c=t.querySelector(".tfminicolors-focus .tfminicolors-panel");if(!c.getElementsByClassName("tf_swatches_container")[0]){var f=q.createElement("div"),d=f.getElementsByClassName("tfminicolors-swatch"),n=Object.keys(this.colorSwatches).reverse(),g=q.createElement("a"),C=q.createElement("span"),v=q.createElement("span"),z=q.createElement("div");f.className="tf_swatches_container";f.addEventListener("click",this.initClick.bind(this));f.appendChild(c.getElementsByClassName("tfminicolors-swatches")[0]);
for(let c=d.length-1;-1<c;--c){if(!n.length){d[c].parentNode.removeChild(d[c]);break}let f=q.createElement("span"),g="undefined"!==typeof this.colorSwatches[n[c]].uid?this.colorSwatches[n[c]].uid:this.UID()+c;f.className="tb_delete_swatch tf_close";d[c].appendChild(f);d[c].dataset.uid=this.colorSwatches[n[c]].uid=g}v.className=C.className="tf_cm_tooltip";C.innerText=themifyCM.labels.save;g.appendChild(C);g.className="tb_add_swatch tf_plus_icon";f.appendChild(g);v.innerText=themifyCM.labels.ie;z.appendChild(v);
z.className="tb_cm_dropdown_icon";z.appendChild(this.getIcon("ti-import"));z.setAttribute("tabIndex","-1");z.appendChild(this.makeImportExportDropdown());f.appendChild(z);c.appendChild(f)}},makeImportExportDropdown:function(){const c=q.createElement("div"),f=q.createElement("ul"),d=q.createElement("li"),n=q.createElement("li");c.className="tb_cm_dropdown";d.className="tb_cm_import";d.textContent=themifyCM.labels.import;d.appendChild(this.getIcon("ti-import"));f.appendChild(d);n.className="tb_cm_export";
n.textContent=themifyCM.labels.export;n.appendChild(this.getIcon("ti-export"));f.appendChild(n);c.appendChild(f);return c},getIcon:function(c,d){c="tf-"+c.trim().replace(" ","-");const f=q.createElementNS("http://www.w3.org/2000/svg","use"),n=q.createElementNS("http://www.w3.org/2000/svg","svg");let g="tf_fa "+c;d&&(g+=" "+d);n.setAttribute("class",g);f.setAttributeNS(null,"href","#"+c);n.appendChild(f);return n},UID:function(){return(Math.random().toString(36).substring(2)+(new Date).getTime().toString(36)).substring(0,
5)},initClick:function(c){c.preventDefault();const d=c.target,h=d.classList;h.contains("tb_delete_swatch")?this.deleteSwatch(c):h.contains("tb_add_swatch")?this.addSwatch():h.contains("tb_cm_export")?(d.parentNode.parentNode.parentNode.blur(),q.location.assign(themifyCM.exportColorsURL)):h.contains("tb_cm_import")&&(d.parentNode.parentNode.parentNode.blur(),this.importColors("colors"))},importColors:function(c){let f=t.getElementsByClassName("themify_cm_input");if(f.length)f=f[0],f.dataset.type=c;
else{f=q.createElement("input");f.type="file";f.dataset.type=c;f.className="themify_cm_input";const h=this;f.addEventListener("change",function(c){const f=c.target.files[0],n=new FormData,q=c.target.dataset.type;n.append("file",f,f.name);n.append("action","themify_import_colors");n.append("tb_load_nonce",themifyCM.nonce);n.append("type",q);d.ajax({url:themifyCM.ajax_url,type:"POST",data:n,cache:!1,dataType:"json",processData:!1,contentType:!1,success:function(c){if("SUCCESS"===c.status)if("colors"===
q){h.colorSwatches=c.colors;for(let c=t.querySelectorAll(".tf_swatches_container .tfminicolors-swatch"),d=c.length-1;-1<d;--d)c[d].parentNode.removeChild(c[d]);for(let c=Object.keys(h.colorSwatches),d=c.length,f=0;f<d;f++)h.addSwatchHtml(h.colorSwatches[c[f]].color,h.colorSwatches[c[f]].opacity,c[f])}else if("gradients"===q){const d=ThemifyBuilderCommon.Lightbox.$lightbox.find(".tb_gradient_container").first().data("themifyGradient");for(let c=Object.keys(themifyCM.gradients),f=c.length-1;-1<f;--f)d.removeSwatch(c[f]);
themifyCM.gradients=c.colors;for(let c=Object.keys(themifyCM.gradients),f=0,g=c.length;f<g;f++)d.addSwatch(themifyCM.gradients[c[f]])}alert(c.msg)}})})}f.click()},deleteSwatch:function(c){c.preventDefault();c.stopPropagation();c=c.target.parentNode.dataset.uid;for(let d=t.querySelectorAll('[data-uid="'+c+'"]'),h=d.length-1;0<=h;--h)d[h].parentNode.removeChild(d[h]);delete this.colorSwatches[c];this.updateColorSwatches("colors")},updateColorSwatches:function(c){d.ajax({type:"POST",url:themifyCM.ajax_url,
dataType:"json",data:{action:"themify_save_colors",type:c,tb_load_nonce:themifyCM.nonce,colors:"colors"===c?this.colorSwatches:themifyCM.gradients}})},addSwatch:function(){var c=t.querySelector(".tfminicolors-focus .tfminicolors-input");const d=this.hex2Rgb(c.value);c=c.dataset.opacity;if(null===d)return!1;var h=!1;for(let f=Object.keys(this.colorSwatches),g=f.length-1;0<=g;--g)if(this.colorSwatches[f[g]].color.replace(/\s/g,"")===d&&parseFloat(this.colorSwatches[f[g]].opacity)===parseFloat(c)){h=
!0;break}h||(h=this.UID(),this.addSwatchHtml(d,c,h),this.colorSwatches[h]={color:d,opacity:c,uid:h},this.updateColorSwatches("colors"))},addSwatchHtml:function(c,d,h){function f(f){const g=q.createElement("li"),h=q.createElement("span"),n=q.createElement("span");g.className="tfminicolors-swatch tfminicolors-sprite";g.dataset.uid=f;g.dataset.swatchColor=c.replace(")",", "+d+")").replace("rgb","rgba");h.className="tfminicolors-swatch-color tf_abs";h.style.backgroundColor=c;h.style.opacity=d;g.appendChild(h);
n.className="tb_delete_swatch tf_close";g.appendChild(n);return g}for(let c=t.querySelectorAll(".tf_swatches_container .tfminicolors-swatches"),d=c.length-1;0<=d;--d)c[d].insertBefore(f(h),c[d].firstChild)},hex2Rgb:function(c){return(c=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(c))?"rgb("+parseInt(c[1],16)+","+parseInt(c[2],16)+","+parseInt(c[3],16)+")":null}};D.themifyColorManager.init()})(jQuery,window,document);
