import{u as E}from"./vendor-vue-runtime-dom-B2rky8vu.js";import{u as D}from"./admin-8MB3iCV_.js";import{u as N,f as w}from"./EmbedPopup-D-ZgVQoP.js";import{u as z,a as I}from"./useAppearanceTypography-BBl5RU11.js";import{d as M,e as m,f as n,i,F as $,r as G,x as l,z as L,t as R}from"./vendor-vue-runtime-core-DwK6Ry68.js";import{u as c}from"./vendor-vue-reactivity-CheHbvBM.js";import{t as u}from"./vendor-vue-shared-DrzsEcag.js";import{_ as W}from"./vendor-vue3-html2pdf-KR020wX8.js";import"./convert-case-to-camel-case.utils-CK5dBN7n.js";import"./vendor-pinia-BSPefQhS.js";import"./vendor-axios-xsH4HHeE.js";import"./vendor-vue3-toastify-DBGjcIyK.js";/* empty css               */import"./settings.consts-BmuAyinH.js";import"./vendor-vueform-slider-CCH9_7pb.js";import"./useAppearanceStore-IzenP-G4.js";import"./vendor-vue-flow-CRbOssRZ.js";import"./vendor-html2pdf.js-B-tok4Ns.js";import"./vendor-jspdf-UFhKzYHA.js";import"./vendor-bootstrap-CCU-90um.js";import"./vendor-html2canvas-BfYXEYrK.js";const j={class:"ccb-summary-totals"},q={class:"ccb-summary-totals__label"},H={key:0,class:"ccb-summary-totals__discount"},J={class:"ccb-summary-totals__value"},K={key:1,class:"ccb-summary-totals__row"},O={class:"ccb-summary-totals__label"},P=M({__name:"Totals",setup(Q){E(t=>({"4f5fb10f":c(v),"1ac4b730":c(F),"17771f26":c(T),"09053038":c(C),ac61ad5c:c(x)}));const g=D(),h=N(),p=m(()=>g.getTranslations),{textColor:v,borderColor:F,accentColor:x}=z(),B=w(),{totalFieldFontSize:T,totalFieldFontWeight:C}=I(),S=m(()=>{const t=new Map;for(const o of B.getDiscounts)if(o.discount_status==="active")for(const s of o.conditions){if(s.discount_type!=="percent_of_amount")continue;const e=s.field_alias.split(",").map(a=>a.trim()).filter(Boolean);for(const a of e){const r=t.get(a),b=Number(s.discount_amount)||0;(r===void 0||b>r)&&t.set(a,b)}}return t});function f(t){const o=S.value.get(t);return o!==void 0?o:null}function A(t){return"groupElements"in t&&Array.isArray(t.groupElements)}function d(t){return t.type==="total"}function _(t){return{alias:t.alias,label:t.label}}const y=m(()=>{const t=[];for(const o of h.getBuilderFields)for(const s of o.groupElements)for(const e of s.fields){if(d(e)){t.push(_(e));continue}if(A(e)){const a=e;for(const r of a.groupElements)d(r)&&t.push(_(r))}}return t});function k(t){let o=0;for(let s=0;s<t.length;s+=1)o=(o<<5)-o+t.charCodeAt(s),o|=0;return Math.abs(o%1001)}function V(t){return t.toFixed(2)}return(t,o)=>(i(),n("div",j,[y.value.length?(i(!0),n($,{key:0},G(y.value,s=>(i(),n("div",{key:s.alias,class:"ccb-summary-totals__row"},[l("span",q,[L(u(s.label||p.value.total)+" ",1),f(s.alias)?(i(),n("span",H," -"+u(f(s.alias))+"% ",1)):R("",!0)]),l("span",J," $ "+u(V(k(s.alias))),1)]))),128)):(i(),n("div",K,[l("span",O,u(p.value.total),1),o[0]||(o[0]=l("span",{class:"ccb-summary-totals__value"},"$ 0.00",-1))]))]))}}),bt=W(P,[["__scopeId","data-v-4572482c"]]);export{bt as default};
//# sourceMappingURL=Totals-46iLZuMo.js.map
