import{i as m,a as V,c as g,o as _,f as u,b as C,t as f,u as h,d as k,g as y,w,a2 as S}from"./vue.esm-bundler-DZdE0M9V.js";import{u as b}from"./useElementPlusComponents-B_fOPHjO.js";import{t as v}from"./Translator-Bios5QX5.js";import{_ as A}from"./AddProductItemModal-BW_L_XlB.js";import{_ as x}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./index-D0R5Hqh1.js";import"./index-I6zcAgit.js";import"./index-Db9JpFxU.js";import"./dayjs.min-2rai63wT.js";import"./Arr-MwYQQ3qa.js";import"./DynamicIcon-D-LZibaK.js";import"./CaretRight-2tV7VHCK.js";import"./Str-Ckn63bs5.js";import"./productService-BVWCmR6j.js";import"./Model-B7FTF6mI.js";import"./Rest-DEQMhckH.js";import"./Asset-DDfERlE5.js";import"./Url-D4lOoZOf.js";const B={class:"fluent-cart-add-to-cart-app"},E={class:"fluent-cart-add-to-cart-app-title"},I={key:0,class:"fluent-cart-add-to-cart-app-content"},j=["title"],F={class:"fluent-cart-add-to-cart-app-product-id"},N=["innerHTML"],Q={__name:"App",props:{variantId:{type:String,default:""},variantTitle:{type:String,default:""},variantPrice:{type:String,default:""}},setup(e){const a=e;m(0);const s=m(a.variantId),d=m(a.variantTitle),l=m(a.variantPrice),T=()=>{s.value="",d.value="",l.value="",setTimeout(()=>{var n,i,o,r;const c=(n=elementor.getPanelView())==null?void 0:n.getCurrentPageView(),t=c==null?void 0:c.model;t&&((i=t.setSetting)==null||i.call(t,"variant_id",""),(r=(o=elementor==null?void 0:elementor.saver)==null?void 0:o.setFlagEditorChange)==null||r.call(o,!0))},100)},P=c=>{s.value=c,setTimeout(()=>{var i,o,r,p;const t=(i=elementor.getPanelView())==null?void 0:i.getCurrentPageView(),n=t==null?void 0:t.model;n&&((o=n.setSetting)==null||o.call(n,"variant_id",c.toString()),(p=(r=elementor==null?void 0:elementor.saver)==null?void 0:r.setFlagEditorChange)==null||p.call(r,!0))},100)};return(c,t)=>{const n=V("el-button");return _(),g("div",null,[u("div",B,[u("h3",E,f(h(v)("Add To Cart Button")),1),s.value?(_(),g("div",I,[u("div",{class:"fluent-cart-add-to-cart-app-product-title",title:d.value},[u("span",F,"#"+f(s.value),1),y(f(d.value),1)],8,j),u("div",{class:"fluent-cart-add-to-cart-app-product-price",innerHTML:l.value},null,8,N),k(n,{class:"fluent-cart-add-to-cart-app-reset-button",type:"primary",onClick:T},{default:w(()=>[y(f(h(v)("Reset")),1)]),_:1})])):(_(),C(A,{key:1,scopes:["cartable"],onOnVariationSelectionUpdated:t[0]||(t[0]=(i,o)=>{P(i[0]),o.forEach(r=>{for(const p of r.variants)if(p.id===i[0])return d.value=p.variation_title,l.value=p.formatted_total,!1})})}))])])}}},D=x(Q,[["__scopeId","data-v-37abec9b"]]),H=e=>{const a=e.dataset.variantId,s=e.dataset.variantTitle,d=e.dataset.variantPrice,l=S(D,{variantId:a,variantTitle:s,variantPrice:d});b(l),l.mixin({methods:{$t:v}}).mount(e)};jQuery(document).ready(function(){elementor.hooks.addAction("panel/open_editor/widget/fluent_cart_add_to_cart",function(e,a,s){a.get("settings")})});jQuery(window).on("elementor/frontend/init",function(){elementorFrontend.hooks.addAction("frontend/element_ready/fluent_cart_add_to_cart.default",function(e){const a=jQuery(e[0]).find("[data-fluent-cart-add-to-cart-app]")[0];H(a)})});
