(function(k,h){XF.TextStylePreview=XF.extend(XF.StylePreview,{getPreview:function(a,b){var c={};return c[b]=a,c.inner_text_animation=a.querySelector(".previewInnerTextAnimation"),c.sparkle=a.querySelector(".previewSparkle"),c},getExtraPreview:function(a){return{icon_fa:a.querySelector("#previewIcon--fa"),icon_img:a.querySelector("#previewIcon--image")}},createColor:function(a){var b=a.element,c=a.preview;1==b[0].querySelector(":checked").value?(c[a.styleType].style.color="unset",this.createGradient(c.inner_text_animation,
b)):(this.createTextFromClip(c),c[a.styleType].style.color=b[2].value)},createGradient:function(a,b){Object.assign(a.style,{background:"linear-gradient(to right, "+b[4].value+", "+b[5].value+")","-webkit-background-clip":"text","background-clip":"text","-webkit-text-fill-color":"transparent","text-fill-color":"transparent"})},createTextFromClip:function(a){Object.assign(a.inner_text_animation.style,{background:"unset","-webkit-background-clip":"unset","background-clip":"unset","-webkit-text-fill-color":"unset",
"text-fill-color":"unset","background-size":"",animation:""});a.text&&Object.assign(a[options.styleType].style,{"-webkit-text-fill-color":"unset","text-fill-color":"unset",background:"unset"})},createClipFromText:function(a,b){a.style.backgroundImage="url("+b+")";a.id="ap-ss-innerTextAnimation"},setColorType:function(a){var b=this,c=a.element,d=a.preview;["change","input"].forEach(function(f){c.forEach(function(g){XF.on(g,f,function(e){"inputChoices"!==g.className&&((e=g.getAttribute("name"))&&e.includes("selectable_color")?
d[a.styleType].style.color=g.dataset.color:b.createColor(a))})})})},setGlowStrength:function(a){var b=this,c=a.element,d=a.preview[a.styleType];["change","input"].forEach(function(f){c.forEach(function(g){XF.on(g,f,function(e){Object.assign(d.style,{animation:"none"});e=c[0].value;switch(parseInt(c[1].querySelector(":checked").value)){case 0:return Object.assign(d.style,{"text-shadow":"0px 0px"});case 1:return Object.assign(d.style,{"text-shadow":"0px 0px 8px "+e});case 2:return Object.assign(d.style,
{"text-shadow":"0 0 2px "+e+", 0 0 2px "+e+", 0 0 4px "+e+", 0 0 6px "+e});case 3:return Object.assign(d.style,{"text-shadow":"0 0 2px "+e+", 0 0 4px "+e+", 0 0 6px "+e+", 0 0 8px "+e+", 0 0 10px "+e});case 4:return b.setAnimatedGlow(a);case 5:return b.waitForCodeEditor(c[9],function(){c[9].nextSibling.CodeMirror.on("change",function(){Object.assign(d.style,{"text-shadow":c[9].nextSibling.CodeMirror.getValue()})})})}})})})},setAnimatedGlow:function(a){h.getElementById("animatedGlow")&&h.getElementById("animatedGlow").remove();
var b=a.element;b=[b[0].value,b[7].value];var c=h.createElement("style");c.id="animatedGlow";c.type="text/css";c.innerHTML=" @keyframes animatedGlow { from { text-shadow: 0 0 2px "+b[0]+", 0 0 4px "+b[0]+", 0 0 6px "+b[0]+", 0 0 8px "+b[0]+", 0 0 10px "+b[0]+"; } to { text-shadow: 0 0 1px "+b[1]+", 0 0 2px "+b[1]+", 0 0 4px "+b[1]+", 0 0 6px "+b[1]+", 0 0 8px "+
b[1]+", 0 0 10px "+b[1]+", 0 0 12px "+b[1]+"; } }";h.head.appendChild(c);a.preview[a.styleType].style.animation="animatedGlow 2s ease-in-out infinite alternate"},setIconColor:function(a){var b=a.element[0];["change","input"].forEach(function(c){XF.on(b,c,function(d){a.preview.icon_fa.style.color=b.value})})},setIconPosition:function(a){var b,c=a.element[0],d=a.preview;XF.on(c,"change",function(f){switch(c.querySelector(":checked").value){case "left":b=d.inner_text_animation;
break;case "right":b=d.inner_text_animation.nextSibling}d[a.styleType].insertBefore(d.icon_fa,b);d[a.styleType].insertBefore(d.icon_img,b)})},setIconType:function(a){var b=a.element,c=a.preview;a=XF.config.url.basePath+"js/apathy/StyleSuite/vendor/icon-sets";(new IconPicker(".iconpicker",{iconSource:["Font Awesome 5 Brands",{key:"fa-brands",prefix:"fab fa-",url:a+"/fa-brands.json"},"Font Awesome 5 Regular",{key:"fa-regular",prefix:"far fa-",url:a+"/fa-regular.json"},"Font Awesome 5 Solid",{key:"fa-solid",
prefix:"fas fa-",url:a+"/fa-solid.json"}],closeOnSelect:!0,i18n:{"input:placeholder":XF.phrase.icon_picker_placeholder,"text:title":XF.phrase.icon_picker_title,"text:empty":XF.phrase.icon_picker_empty,"btn:save":XF.phrase.save}})).on("select",function(d){var f="";switch(d.value.split(" ")[0]){case "fab":f="brands";break;case "far":f="regular";break;case "fas":f="solid"}XF.Icon.getInlineIcon(f,d.value.split(" ")[1]).then(function(g){g=XF.createElementFromString(g);h.querySelector("#previewIcon--fa").parentElement.replaceWith(g);
g.children[0].id="previewIcon--fa"})});["change","input"].forEach(function(d){b.forEach(function(f){XF.on(f,d,function(g){c.icon_fa.style.display="none";c.icon_img.style.display="none";switch(b[0].querySelector(":checked").value){case "fontawesome":c.icon_fa.style.display="inline-block";break;case "upload":c.icon_img.style.display="block";break;case "preset":c.icon_img.style.display="inline-block",c.icon_img.src=XF.config.dataDir+"icons/l/"+b[7].value+".png",c.icon_img.height=XF.config.iconHeight,
c.icon_img.width=XF.config.iconWidth}})})})},setInnerTextAnimation:function(a){var b=this,c=a.element[0],d=a.preview;XF.on(c,"input",function(f){c.value?(d.inner_text_animation.style="",b.createClipFromText(d.inner_text_animation,c.value)):b.createTextFromClip(d)})},setSparkle:function(a){var b=a.element[0],c=a.preview.sparkle;XF.on(b,"change",function(d){c.className="";c.classList.add("previewSparkle");b.value&&c.classList.add("ap-ss-sparkle--"+b.value)})}});XF.Element.register("text-style-preview",
"XF.TextStylePreview")})(window,document);