const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./useSticky-BKvKCIqm.css","./index-CgOvD9AB.css","./index-DAhRb9JY.css"])))=>i.map(i=>d[i]);
import{d as f,a as h,k as p,i as A,o as b,b as v,e as y,_ as C,f as I,q as E,g as T,r as P,h as w,j as H}from"./convert-case-to-camel-case.utils-DDUpNI96.js";import{u as j}from"./translationsStore-DBJu9sBR.js";const q=f("stickyApp",{state:()=>({settings:null,calcId:null,title:"",wooCheckoutSettings:null,currencySettings:null,isProActive:!1,hasEmbedCalc:!1}),getters:{getStickySettings:t=>t.settings,getCalcId:t=>t.calcId,getCalcTitle:t=>t.title,getWooCheckoutSettings:t=>t.wooCheckoutSettings,getCurrencySettings:t=>t.currencySettings,getIsProActive:t=>t.isProActive,getHasEmbedCalc:t=>t.hasEmbedCalc},actions:{initStickySettings(t){this.settings=t},initWooCheckoutSettings(t){this.wooCheckoutSettings=t},initCurrencySettings(t){this.currencySettings=t},initCalcId(t){this.calcId=+t||null},initTitle(t){this.title=t},setIsProActive(t){this.isProActive=t},setHasEmbedCalc(t){this.hasEmbedCalc=t}}}),D=t=>t.replace(/_([a-z])/g,(e,c)=>c.toUpperCase());function l(t){return Array.isArray(t)?t.map(l):t!==null&&typeof t=="object"?Object.keys(t).reduce((e,c)=>{const o=D(c);return e[o]=l(t[c]),e},{}):t}const L=h({__name:"App",setup(t){var u;const e=q(),c=j(),o=p(!1),k=A("calc_id"),a=(u=window.ccb_sticky_data)==null?void 0:u[k];if(a&&"stickySettings"in a){const i=l(a);e.setIsProActive(i.is_pro_active),e.setHasEmbedCalc(i.hasEmbedCalc),e.initTitle(i.title),e.initCalcId(i.calcId),e.initStickySettings(i.stickySettings),e.initWooCheckoutSettings(i.wooCheckoutSettings),e.initCurrencySettings(i.currency),c.initTranslations(a.translations)}const r=()=>{var s;let i=0;((s=e.getStickySettings)==null?void 0:s.displayType)!=="banner"&&(i=100),setTimeout(()=>{var g,d;!e.getHasEmbedCalc&&(((g=e.getStickySettings)==null?void 0:g.oneClickAction)==="pdf"||((d=e.getStickySettings)==null?void 0:d.oneClickAction)==="invoice")?o.value=!1:o.value=!0,setTimeout(()=>{var S,m;const n=document.querySelector("#ccb-sticky-floating-wrapper");(S=n==null?void 0:n.classList)!=null&&S.contains("ccb-show")||(m=n==null?void 0:n.classList)==null||m.add("ccb-show")},500)},i)};b(()=>{var i;if(((i=e.getStickySettings)==null?void 0:i.oneClickAction)==="scroll_to"){const s=document.querySelectorAll(`.ccb-main-widget[data-calc-id="${e.getCalcId}"]`);s!=null&&s.length&&r()}else r()});const _=v(()=>{var i;return((i=e.getStickySettings)==null?void 0:i.displayType)==="banner"?y(()=>C(()=>import("./index-BTO6WLBP.js"),__vite__mapDeps([0,1]),import.meta.url)):y(()=>C(()=>import("./index-B_seOW1V.js"),__vite__mapDeps([0,2]),import.meta.url))});return(i,s)=>o.value?(T(),I(P(_.value),{key:0})):E("",!0)}}),O=document.querySelectorAll(".ccb-sticky-calc");O.forEach(t=>{const e=p(null),c=w(L).provide("calc_id",t.getAttribute("data-calc-id"));e.value=c,c.use(H()),c.mount(t)});export{q as u};
//# sourceMappingURL=sticky-nmdN8DLF.js.map
