(()=>{"use strict";const t="undefined"!=typeof window&&"function"==typeof window.jQuery?window.jQuery:null;!function(t,e,c){function n(){var n=t.location.href,o=void 0!==e.title?e.title:"";const r=e.querySelector(".ht-ctc-chat");let s={},a={};const i=function(){let t="",e=9999;try{t=navigator.userAgent||"",e=screen.width||9999}catch(t){}return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(t)||e<=1025?"yes":"no"}();var _=new Map;const l=["__proto__","prototype","constructor","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],d=t=>!("string"!=typeof t||0===t.length||!/^[a-zA-Z0-9_-]+$/.test(t)||l.includes(t));function u(t,e){let c=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t&&"object"==typeof t&&d(e)&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:c}function h(t,e,c){return!(!t||"object"!=typeof t||!d(e)||(t[e]=c,0))}function p(){if(localStorage.getItem("ht_ctc_storage"))try{const t=JSON.parse(localStorage.getItem("ht_ctc_storage"));_=new Map(Object.entries(t||{}))}catch{_=new Map}else _=new Map}function y(t){return!(!d(t)||!_.has(t))&&_.get(t)}function f(t,e){if(p(),!d(t))return;_.set(t,e);const c=JSON.stringify(Object.fromEntries(_));localStorage.setItem("ht_ctc_storage",c)}function g(t){return t instanceof Element?[t]:"string"==typeof t?Array.from(e.querySelectorAll(t)):[]}p();const v={show(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";const s=g(t);if(c)return".ctc_opt_in"===t?void c(t).fadeOut(200).fadeIn(200).fadeOut(200).fadeIn(200):void c(t).show(e||void 0);s.forEach(t=>{o&&o.split(/\s+/).forEach(e=>{e.trim()&&t.classList.add(e.trim())}),r&&r.split(/\s+/).forEach(e=>{e.trim()&&t.classList.remove(e.trim())}),e?t.style.setProperty("--ht-ctc-el-duration",`${e}ms`):t.style.removeProperty("--ht-ctc-el-duration"),n&&function(t,e){if(!t||!e)return;"none"===t.style.display&&(t.style.display="");const c=e.split(/\s+/).filter(Boolean);c.forEach(e=>{t.classList.remove(e),t.offsetWidth,t.classList.add(e)});const n=()=>{c.forEach(e=>t.classList.remove(e)),t.removeEventListener("animationend",n),clearTimeout(o)},o=setTimeout(n,2e3);t.addEventListener("animationend",n)}(t,n),o||r||e||n||(t.style.display="block")})},hide(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";const s=g(t);c?c(t).hide(e):s.forEach(t=>{o&&t.classList.add(o),r&&t.classList.remove(r),e?t.style.setProperty("--ht-ctc-el-duration",`${e}ms`):t.style.removeProperty("--ht-ctc-el-duration"),n&&t.classList.add(`ht-ctc-${n}`),o||r||e||n||(t.style.display="none")})}};function m(){e.dispatchEvent(new CustomEvent("ht_ctc_event_configure",{detail:{ctc:s,ctc_values:a}}));var t=e.querySelector(".ht_ctc_chat_data");t&&t.remove();const c={config:{ctc:s,ctc_values:a,is_mobile:i,url:n,post_title:o},api:{storage:{get:y,set:f,raw:_},ui:v,greetings:{open:E,close:S,closeAfterClick:w,initListeners:b,display:k},notifications:{display:j,stop:O},chat:{openLink:P,displaySettings:x},utils:{isSafeObjectKey:d,getSafeProperty:u,setSafeProperty:h}}};e.dispatchEvent(new CustomEvent("ht_ctc_event_init",{detail:c})),e.dispatchEvent(new CustomEvent("ht_ctc_event_settings",{detail:{ctc:s}})),function(){if(r){e.dispatchEvent(new CustomEvent("ht_ctc_event_chat")),x(r),r.addEventListener("click",function(){e.querySelector(".ht_ctc_chat_greetings_box")||P(r)}),b(),r&&r.addEventListener("click",function(t){if(t.target.closest(".ht_ctc_chat_greetings_box_link")){t.preventDefault();const c=e.querySelector("#ctc_opt");c?c.checked||y("g_optin")?(P(r),w()):v.show(".ctc_opt_in","","ht-ctc-fade-in","",""):(P(r),w()),e.dispatchEvent(new CustomEvent("ht_ctc_event_greetings"))}});const t=e.querySelector("#ctc_opt");t&&t.addEventListener("change",function(){t.checked&&(e.querySelector(".ctc_opt_in")&&v.hide(".ctc_opt_in",100),f("g_optin","y"),setTimeout(()=>{P(r),w()},500))})}}(),e.addEventListener("click",function(t){const e=t.target.closest(".ht-ctc-sc-chat");e&&P(e)}),e.addEventListener("click",function(t){const e=t.target.closest(".ctc_chat, #ctc_chat");e&&(P(e),e.classList.contains("ctc_woo_place")&&t.preventDefault());const c=t.target.closest('[href="#ctc_chat"]');c&&(t.preventDefault(),P(c))})}function b(){if(r){const t=e.querySelector(".ht_ctc_chat_greetings_box");t&&r.addEventListener("click",function(e){e.target.closest(".ht_ctc_chat_style")&&(t.classList.contains("ctc_greetings_opened")?S("user_closed"):E("user_opened"))}),r.addEventListener("click",function(t){t.target.closest(".ctc_greetings_close_btn")&&S("user_closed")})}}function k(){const t=e.querySelector(".ht_ctc_chat_greetings_box");if(t){if(s.g_device){if("yes"!==i&&"mobile"===s.g_device)return void t.remove();if("yes"===i&&"desktop"===s.g_device)return void t.remove()}e.dispatchEvent(new CustomEvent("ht_ctc_event_after_chat_displayed",{detail:{ctc:s,greetings_open:E,greetings_close:S}})),s.g_init&&"user_closed"!==y("g_user_action")&&("default"===s.g_init?"yes"!==i&&E("init"):"open"===s.g_init&&E("init"));const c=e.querySelectorAll('.ctc_greetings, #ctc_greetings, .ctc_greetings_now, [href="#ctc_greetings"]');c.length>0&&c.forEach(function(t){t.addEventListener("click",function(t){t.preventDefault(),S("element"),E("element")})})}}function E(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"open";O();const c=e.querySelector(".ht-ctc-chat .ctc_cta_stick");c&&c.remove();const n=e.querySelector(".ht_ctc_chat_greetings_box");n&&("init"===t?v.show(".ht_ctc_chat_greetings_box",70,"","ht_ctc_greetings_box_open",""):v.show(".ht_ctc_chat_greetings_box",400,"","ht_ctc_greetings_box_open",""),n.classList.add("ctc_greetings_opened"),n.classList.remove("ctc_greetings_closed")),f("g_action",t),"user_opened"===t&&f("g_user_action",t),function(){if(e.querySelector(".ctc_greetings_modal")&&!e.querySelector(".ht_ctc_modal_backdrop")){const t=e.createElement("div");function c(t){"Escape"===t.key&&(S("user_closed"),e.removeEventListener("keydown",c))}t.className="ht_ctc_modal_backdrop",e.body.appendChild(t),t.addEventListener("click",function(){S("user_closed")}),e.addEventListener("keydown",c)}}()}function w(){L(),setTimeout(()=>{S("chat_clicked")},500)}function S(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"close";L(),"element"===t?v.hide(".ht_ctc_chat_greetings_box",70,"","ht-ctc-display-unset",""):v.hide(".ht_ctc_chat_greetings_box",400,"","","ht_ctc_greetings_box_open");const c=e.querySelector(".ht_ctc_chat_greetings_box");c&&(c.classList.add("ctc_greetings_closed"),c.classList.remove("ctc_greetings_opened")),f("g_action",t),"user_closed"===t&&f("g_user_action",t)}function L(){const t=e.querySelector(".ht_ctc_modal_backdrop");t&&t.remove()}function x(t){s.schedule&&"yes"===s.schedule?e.dispatchEvent(new CustomEvent("ht_ctc_event_display",{detail:{ctc:s,display_chat:q,ht_ctc_chat:t,online_content:C}})):(q(t),C())}function q(t){if("yes"===i){if("show"===s.dis_m){const c=e.querySelector(".ht_ctc_desktop_chat");c&&c.remove(),t.style.cssText=s.pos_m+s.css,s.side_m&&t.style.setProperty("--side",s.side_m),A(t)}}else if("show"===s.dis_d){const c=e.querySelector(".ht_ctc_mobile_chat");c&&c.remove(),t.style.cssText=s.pos_d+s.css,s.side_d&&t.style.setProperty("--side",s.side_d),A(t)}}function A(t){var c=s.se;c=parseInt(s.se),isNaN(c)?v.show(t,"","","ht-ctc-display-unset",""):v.show(t,c,"","ht-ctc-display-unset",""),k(),j(),function(t){var c=t.classList.contains("ht_ctc_entry_animation")?1200:120;setTimeout(function(){t.classList.add("ht_ctc_animation",s.ani)},c);const n=e.querySelector(".ht-ctc-chat"),o=e.querySelector(".ht-ctc-chat .ht-ctc-cta-hover");n&&o&&(n.addEventListener("mouseenter",function(){v.show(".ht-ctc-chat .ht-ctc-cta-hover",120,"","ht-ctc-cta-stick","ht-ctc-opacity-hide")}),n.addEventListener("mouseleave",function(){v.hide(".ht-ctc-chat .ht-ctc-cta-hover",100,"","ht-ctc-opacity-hide","ht-ctc-cta-stick")}))}(t)}function C(){e.querySelector(".for_greetings_header_image_badge")&&(e.querySelectorAll(".for_greetings_header_image_badge").forEach(t=>{t.classList.add("g_header_badge_online")}),v.show(".for_greetings_header_image_badge","","","ht-ctc-display-unset",""))}function j(){const t=e.querySelector(".ht_ctc_notification");if(t&&"stop"!==y("n_badge")){const o=e.querySelector(".ctc_nb");if(o){const t=o.closest(".ht_ctc_style"),r=e.querySelector(".ht_ctc_badge");if(t&&r){var c,n;const e=null===(c=t.querySelector(".ctc_nb"))||void 0===c?void 0:c.getAttribute("data-nb_top"),o=null===(n=t.querySelector(".ctc_nb"))||void 0===n?void 0:n.getAttribute("data-nb_right");null!==e&&(r.style.top=e),null!==o&&(r.style.right=o)}}const r=s.n_time?1e3*s.n_time:150;setTimeout(()=>{t.style.display=""},r)}}function O(){const t=e.querySelector(".ht_ctc_notification");t&&(f("n_badge","stop"),t.remove())}function P(c){e.dispatchEvent(new CustomEvent("ht_ctc_event_number",{detail:{ctc:s}}));var r=s.number,_=s.pre_filled;if(c.hasAttribute("data-number")&&""!==c.getAttribute("data-number")&&(r=c.getAttribute("data-number")),c.hasAttribute("data-pre_filled")){const t=c.getAttribute("data-pre_filled")||"";_=(s.prefix_pre_filled?s.prefix_pre_filled:"")+t}try{_=_.replaceAll("%","%25");var l=t.location.href;_=_.replace(/\[url]/gi,l),_=encodeURIComponent(decodeURI(_))}catch(t){}if(""!==r||s.custom_url_m&&""!==s.custom_url_m||s.custom_url_d&&""!==s.custom_url_d){var p="https://wa.me/"+r+"?text="+_,y=s.url_target_d?s.url_target_d:"_blank";"yes"===i?(s.url_structure_m&&"wa_colon"===s.url_structure_m&&(p="whatsapp://send?phone="+r+"&text="+_,y="_self"),s.custom_url_m&&""!==s.custom_url_m&&(p=s.custom_url_m)):(s.url_structure_d&&"web"===s.url_structure_d&&(p="https://web.whatsapp.com/send?phone="+r+"&text="+_),s.custom_url_d&&""!==s.custom_url_d&&(p=s.custom_url_d));var f="popup"===y?"scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no,width=788,height=514,left=100,top=100":"noopener";t.open(p,y,f),s.chat_number=r,function(){if(s.analytics&&"session"===s.analytics){if(sessionStorage.getItem("ht_ctc_analytics"))return;sessionStorage.setItem("ht_ctc_analytics","done")}function c(c){var r=s.chat_number&&""!==s.chat_number?s.chat_number:s.number;try{e.dispatchEvent(new CustomEvent("ht_ctc_event_apply_variables",{detail:{templateString:c}})),c=(c=(c=(c=void 0!==t.apply_variables_value?t.apply_variables_value:c).replace("{number}",r)).replace("{title}",o)).replace("{url}",n)}catch(t){}return c}var r="event_"+Math.floor(1e4+9e4*Math.random());s.ctc_pixel_event_id=r,e.dispatchEvent(new CustomEvent("ht_ctc_event_analytics"));var i=s.chat_number&&""!==s.chat_number?s.chat_number:s.number,_=new Map;const l=()=>Object.fromEntries(_);var p="Click to Chat for WhatsApp",y="chat: "+i,f=o+", "+n;if(s.ga){var g=s.g_an_event_name&&""!==s.g_an_event_name?s.g_an_event_name:"click to chat";g=c(g);const q=a.g_an_params_v4||a.g_an_params;Array.isArray(q)&&q.forEach(t=>{if(t){var e,n;if("object"==typeof t)e=t.key,n=t.value;else if("string"==typeof t&&d(t)){const c=u(a,t);c&&"object"==typeof c&&(e=c.key,n=c.value)}"string"==typeof e&&(e=c(e),n=c(n),d(e)&&_.set(e,n))}});var v=0,m="no",b=[];if("undefined"!=typeof dataLayer)try{"undefined"==typeof gtag&&(t.gtag=function(){dataLayer.push(...arguments)},m="yes");var k=[];function A(t,e){t&&"string"==typeof t&&""!==t.trim()&&(b.includes(t)||b.push(t))}try{var E;const C=null===(E=t.google_tag_data)||void 0===E?void 0:E.tidr;null!=C&&C.destination&&"object"==typeof C.destination&&Object.keys(C.destination).forEach(t=>{A(t)})}catch(j){}try{var w;const O=null===(w=t.google_tag_data)||void 0===w||null===(w=w.tidr)||void 0===w?void 0:w.container;O&&"object"==typeof O&&Object.values(O).forEach(t=>{Array.isArray(t.destinations)&&t.destinations.forEach(t=>{"string"==typeof t&&t.startsWith("G-")&&A(t)})})}catch(P){}try{Array.isArray(t.dataLayer)&&t.dataLayer.forEach(t=>{Array.isArray(t)&&"config"===t[0]&&"string"==typeof t[1]?A(t[1]):null!=t&&t.send_to&&"string"==typeof t.send_to&&A(t.send_to)})}catch(T){}b.forEach(function(t){var e;e=(e=t).toUpperCase(),k.includes(e)||(k.push(e),(e.startsWith("G-")||e.startsWith("GT-"))&&(_.set("send_to",e),gtag("event",g,l()),v++))})}catch(I){}0===v&&"no"===m&&("undefined"!=typeof gtag?gtag("event",g,l()):"undefined"!=typeof ga&&void 0!==ga.getAll?ga.getAll()[0].send("event",p,y,f):"undefined"!=typeof __gaTracker&&__gaTracker("send","event",p,y,f))}if("undefined"!=typeof dataLayer&&s.gtm){let M=s.gtm_event_name||"Click to chat";M=c(M);const D={};D.event=M;const N=a.gtm_params_v4||a.gtm_params;Array.isArray(N)&&N.forEach(t=>{if(!t)return;let e,n;if("object"==typeof t)e=t.key,n=t.value;else if("string"==typeof t&&d(t)){const c=u(a,t);c&&"object"==typeof c&&(e=c.key,n=c.value)}if("string"!=typeof e)return;const o=c(e),r=c(n);d(o)&&h(D,o,r)}),dataLayer.push(D)}if(s.ads&&"undefined"!=typeof gtag_report_conversion&&gtag_report_conversion(),s.fb&&"undefined"!=typeof fbq){var S=s.pixel_event_name&&""!==s.pixel_event_name?s.pixel_event_name:"Click to Chat by HoliThemes",L=a.pixel_event_type&&""!==a.pixel_event_type?a.pixel_event_type:"trackCustom",x=new Map;const U=a.pixel_params_v4||a.pixel_params;Array.isArray(U)&&U.forEach(t=>{if(!t)return;let e,n;if("object"==typeof t)e=t.key,n=t.value;else if("string"==typeof t&&d(t)){const c=u(a,t);c&&"object"==typeof c&&(e=c.key,n=c.value)}"string"==typeof e&&(e=c(e),n=c(n),d(e)&&x.set(e,n))}),s.ctc_pixel_event_id="",fbq(L,S,Object.fromEntries(x),{eventID:r})}}(),function(t){var c=s&&s.hook_url;if(!c)return;if(Array.isArray(T)){const t={};T.forEach((e,c)=>{h(t,"value"+(c+1),e)}),s.hook_v=t}e.dispatchEvent(new CustomEvent("ht_ctc_event_hook",{detail:{ctc:s,number:t}}));var n=s.hook_v&&"object"==typeof s.hook_v?s.hook_v:{};let o;s.hook_url&&(c=s.hook_url);if("json"===s.webhook_format){var r=new URLSearchParams;Object.keys(n).forEach(t=>{const e=u(n,t);r.append(t,"object"==typeof e?JSON.stringify(e):e)}),o=r.toString()}else o=new URLSearchParams(n).toString();fetch(c,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},body:o}).catch(t=>{})}(r),O()}else if(s.no_number){const t=e.querySelector(".ctc-no-number-message");t&&(t.style.display="block")}}"undefined"!=typeof ht_ctc_chat_var&&(s=ht_ctc_chat_var),"undefined"!=typeof ht_ctc_variables&&(a=ht_ctc_variables),0===Object.keys(s).length||0===Object.keys(a).length?function(){const c=e.querySelector(".ht_ctc_chat_data");if(0===Object.keys(s).length&&c)try{const e=(null==c?void 0:c.getAttribute("data-settings"))||"";s=JSON.parse(e),t.ht_ctc_chat_var=s}catch(t){}0===Object.keys(a).length&&(a={g_an_event_name:"click to chat",pixel_event_name:"Click to Chat by HoliThemes",pixel_event_type:"trackCustom",g_an_params:[{key:"number",value:"{number}"},{key:"title",value:"{title}"},{key:"url",value:"{url}"}],pixel_params:[{key:"Category",value:"Click to Chat for WhatsApp"},{key:"return_type",value:"chat"},{key:"ID",value:"{number}"},{key:"Title",value:"{title}"}]},t.ht_ctc_variables=a),m()}():m();var T=s.hook_v?s.hook_v:""}c||function(){const t=e.querySelector(".ht_ctc_chat_greetings_box"),c=e.querySelector(".ht_ctc_greetings");t&&c&&(c.style.setProperty("pointer-events","none"),t.classList.add("ht_ctc_greetings_box"),t.style.removeProperty("display"),t.style.setProperty("pointer-events","auto"));const n=e.querySelector(".ht-ctc-chat .ht-ctc-cta-hover");n&&(n.classList.add("ht-ctc-opacity-hide"),n.style.removeProperty("display"))}(),"loading"!==e.readyState?n():e.addEventListener("DOMContentLoaded",n)}(window,document,t)})();