var ut=o=>{throw TypeError(o)};var st=(o,t,e)=>t.has(o)||ut("Cannot "+e);var n=(o,t,e)=>(st(o,t,"read from private field"),e?e.call(o):t.get(o)),h=(o,t,e)=>t.has(o)?ut("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(o):t.set(o,e),y=(o,t,e,a)=>(st(o,t,"write to private field"),a?a.call(o,e):t.set(o,e),e),l=(o,t,e)=>(st(o,t,"access private method"),e);class et{constructor(t={}){this.storageKey=t.storageKey||"fc_utm_data",this.expirationDays=t.expirationDays||30,this.utmKeys=t.utmKeys||et.getUtmParams(),this.collectFromURL()}collectFromURL(){const t=this.getURLParams();document.referrer&&new URL(document.referrer).hostname!==window.location.hostname&&(t.refer_url=document.referrer),Object.keys(t).length>0&&this.store(t)}getURLParams(){const t=new URLSearchParams(window.location.search),e={};return this.utmKeys.forEach(a=>{const r=t.get(a);r&&(e[a]=r)}),e}store(t){const e=this.getStoredData(),a=Date.now(),c={params:{...e.params,...t},timestamp:a};try{localStorage.setItem(this.storageKey,JSON.stringify(c))}catch{}}getStoredData(){try{const t=localStorage.getItem(this.storageKey);if(t){let e=JSON.parse(t);if(e&&e.timestamp)return e}}catch{}return{params:{},timestamp:null}}get(){return this.getStoredData().params||{}}clear(){try{localStorage.removeItem(this.storageKey)}catch(t){console.warn("UTMManager: Unable to clear localStorage",t)}}static getUtmParams(){return window.fluentcart_utm_vars.allowed_keys||["utm_source","utm_medium","utm_campaign","utm_term","utm_content","utm_id"]}}var ft,ht,U,v,V,X,H,N,G,C,x,Q,d,D,yt,pt,bt,vt,R,Et,St,_t,Lt;const M=class M{constructor(){h(this,d);h(this,v,[]);h(this,V,"?action=fluent_cart_checkout_routes&fc_checkout_action=fluent_cart_cart_status");h(this,X,"?action=fluent_cart_checkout_routes&fc_checkout_action=fluent_cart_cart_update");h(this,H,window.fluentCartRestVars.ajaxurl);h(this,N,!1);h(this,G,(ft=window.fluentcart_drawer_vars)==null?void 0:ft.is_admin_bar_showing);h(this,C,"open");h(this,x,"active");h(this,Q,((ht=window.fluentcart_drawer_vars)==null?void 0:ht.is_drawer_hidden)=="1")}init(){return n(M,U)!==null?n(M,U):(y(M,U,this),l(this,d,Lt).call(this),n(this,Q)||l(this,d,_t).call(this),l(this,d,St).call(this),l(this,d,yt).call(this),l(this,d,pt).call(this),l(this,d,bt).call(this),l(this,d,vt).call(this),this)}async getCart(){let t=await new Promise((e,a)=>{fetch(n(this,H)+n(this,V),{method:"GET",headers:{"Content-Type":"application/json"}}).then(r=>{if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}).then(r=>{r&&r.cart_data?e(r.cart_data):e([])}).catch(r=>{a([])})});return y(this,v,t),window.dispatchEvent(new Event("fluentCartNotifyCartDrawerItemChanged")),t}async addProduct(t,e=1,a=!1,r=!1,c=!1){return l(this,d,D).call(this,t,e,a,r,c)}async removeProduct(t,e=!1){return t=t.toString(),await l(this,d,D).call(this,t,0,!1,e)}async incrementProduct(t,e=1){const a=document.querySelector("[data-fluent-cart-cart-drawer-overlay]");return a&&a.classList.contains("active")&&y(this,N,!0),t=t.toString(),e=Math.abs(parseInt(e.toString())),await l(this,d,D).call(this,t,e)}async decrementProduct(t,e=1){const a=document.querySelector("[data-fluent-cart-cart-drawer-overlay]");return a&&a.classList.contains("active")&&y(this,N,!0),t=t.toString(),e=Math.abs(parseInt(e.toString())),await l(this,d,D).call(this,t,e*-1)}async updateProductQuantity(t,e=1,a=!1){return e=parseInt(e.toString(),10),(isNaN(e)||e<1)&&(e=1),t=t.toString(),await l(this,d,D).call(this,t,e,a)}closeModal(){const t=document.querySelector("[data-fluent-cart-cart-drawer-overlay]"),e=document.querySelector("[data-fluent-cart-cart-drawer]"),a=document.body;t&&t.classList.remove(n(this,x)),e&&e.classList.remove(n(this,C)),a.style.overflow=""}openModal(){const t=document.querySelector("[data-fluent-cart-cart-drawer-overlay]"),e=document.querySelector("[data-fluent-cart-cart-drawer]"),a=document.body;t&&t.classList.add(n(this,x)),e&&e.classList.add(n(this,C)),a.style.overflow="hidden"}appendUtmSource(t){const e=new URLSearchParams(window.location.search);return et.getUtmParams().forEach(a=>{e.has(a)&&(t[a]=e.get(a))}),t}getState(){return n(this,v)}updateCartTotalPrice(t=[]){var s,i;let e=0;const a=((i=(s=window.fluentcart_drawer_vars)==null?void 0:s.currency_settings)==null?void 0:i.currency_sign)||"$";t.forEach(w=>{w.subtotal&&(e+=w.subtotal)});const r=(e/100).toFixed(2),c=`${a}${r}`;return document.querySelectorAll("[data-fluent-cart-cart-total-price]").forEach(w=>{w.textContent=c}),c}};U=new WeakMap,v=new WeakMap,V=new WeakMap,X=new WeakMap,H=new WeakMap,N=new WeakMap,G=new WeakMap,C=new WeakMap,x=new WeakMap,Q=new WeakMap,d=new WeakSet,D=async function(t=null,e=1,a=!1,r=!1,c=!1){if(t==null)return;const s=document.querySelector("[data-fluent-cart-cart-drawer]");let i="";s&&(i=s.querySelector("[data-fluent-cart-cart-drawer-loader]"),i&&i.classList.add("show"));const w=this;let b={item_id:t,quantity:e,is_custom:c};a&&(b.by_input=!0),(n(this,N)||r||a)&&(b.open_cart=!0),b.is_admin_bar_enabled=n(this,G),b=this.appendUtmSource(b);let u=await new Promise((g,O)=>{const S=new URL(n(this,H)+n(this,X));Object.entries(b).forEach(([W,$])=>{S.searchParams.append(W,$)});const _=new XMLHttpRequest;_.open("GET",S.toString(),!0),_.setRequestHeader("Content-Type","application/json"),_.setRequestHeader("X-WP-Nonce",window.fluentCartRestVars.rest.nonce),_.onreadystatechange=function(){var W,$,it,lt;if(_.readyState===XMLHttpRequest.DONE)try{if(_.status>=200&&_.status<300){const f=JSON.parse(_.responseText),at=($=(W=f.data)==null?void 0:W.cart)==null?void 0:$.cart_data;let rt=0;if(Array.isArray(at)&&(rt=at.length,document.querySelectorAll("[data-cart-badge-count], .fct-cart-badge-count").forEach(F=>{F.textContent=rt.toString(),window.fluentcart_drawer_vars.cart_item_count=rt}),w.updateCartTotalPrice(at)),f&&(f!=null&&f.fragments)){if(f.fragments)if(Array.isArray(f.fragments))f.fragments.forEach(L=>{const nt=document.querySelector(L.selector);!nt&&L.selector==="[data-fluent-cart-cart-drawer-container]"&&document.body.insertAdjacentHTML("beforeend",L.content),nt&&L.type==="replace"&&(nt.outerHTML=L.content)});else{const L=document.querySelector(f.fragments.selector);!L&&f.fragments.selector==="[data-fluent-cart-cart-drawer-container]"&&document.body.insertAdjacentHTML("beforeend",f.fragments.content),L&&f.fragments.type==="replace"&&(L.outerHTML=f.fragments.content)}const F=document.querySelector("[data-fluent-cart-cart-drawer]");F&&F.classList.contains(n(w,C))&&w.openModal()}f&&((lt=(it=f==null?void 0:f.data)==null?void 0:it.cart)!=null&&lt.cart_data)?g(f.data.cart.cart_data):(f.message&&new Toastify({text:f.message,className:"warning",duration:3e3,gravity:"top",position:"right",slideFrom:"right",type:"warning"}).showToast(),g([])),i&&i.classList.remove("show")}else{const f=_.responseText&&JSON.parse(_.responseText).message||"An error occurred";new Toastify({text:f,className:"info",duration:2e3,style:{background:"#eabe11"}}).showToast(),i&&i.classList.remove("show"),O(new Error(f))}}catch(f){f.message&&new Toastify({text:f.message,className:"info",duration:2e3,style:{background:"#eabe11"}}).showToast(),i&&i.classList.remove("show"),O(f)}},_.send()});return u.length,y(this,v,u),new URLSearchParams(window.location.search).has("fct_cart_hash")||window.dispatchEvent(new CustomEvent("fluentCartNotifyCartDrawerItemChanged",{detail:{response:u}})),u},yt=function(){const t=this;document.addEventListener("click",async function(e){var r;const a=e.target.closest("[data-fluent-cart-cart-list-item-delete-button]");if(a){const c=a.dataset.itemId,s=await t.removeProduct(c,!0);s!=null&&(y(t,v,s),l(r=t,d,R).call(r))}})},pt=function(){const t=this;document.addEventListener("click",async function(e){var r;const a=e.target.closest("[data-fluent-cart-cart-list-item-increase-button]");if(a){const c=a.dataset.itemId,s=await t.incrementProduct(c);s!=null&&(y(t,v,s),l(r=t,d,R).call(r))}})},bt=function(){const t=this;document.addEventListener("click",async function(e){var r;const a=e.target.closest("[data-fluent-cart-cart-list-item-decrease-button]");if(a){const c=a.dataset.itemId,s=await t.decrementProduct(c);s!=null&&(y(t,v,s),l(r=t,d,R).call(r))}})},vt=function(){const t=this;document.addEventListener("change",async function(e){var r;const a=e.target.closest("[data-fluent-cart-cart-list-item-quantity-input]");if(a){const c=a.dataset.itemId;let s=parseInt(event.target.value,10);parseInt(event.target.dataset.oldValue||"0",10),s<1&&(s=1);let i=s;const w=await t.updateProductQuantity(c,i,!0);w!=null&&(y(t,v,w),l(r=t,d,R).call(r))}})},R=function(){if(l(this,d,Et).call(this)){const t=document.querySelectorAll("[data-fluent-cart-cart-total-item]"),e=document.querySelectorAll("[data-fluent-cart-checkout-page-cart-item-count]"),a=document.querySelectorAll("[data-fluent-cart-cart-total-wrapper]"),r=document.querySelectorAll("[data-fluent-cart-cart-expand-button]"),c=document.querySelectorAll("[data-fluent-cart-cart-checkout-button-wrap]");t&&t.forEach(s=>s.textContent="0"),e&&e.forEach(s=>s.textContent="0"),a&&a.forEach(s=>s.style.display="none"),c&&c.forEach(s=>s.style.display="none"),r&&r.forEach(s=>s.classList.add("is-hidden")),setTimeout(()=>{this.closeModal()},300)}},Et=function(){return n(this,v)===void 0||n(this,v)==null||Object.keys(n(this,v)).length===0},St=function(){const t=this;document.addEventListener("click",function(e){const a=document.querySelector("[data-fluent-cart-cart-drawer-overlay]");a&&a.contains(e.target)&&t.closeModal()})},_t=function(){const t=this,e=document.body;document.addEventListener("click",a=>{document.querySelector("[data-fluent-cart-cart-drawer-container]");const r=document.querySelector("[data-fluent-cart-cart-drawer]"),c=document.querySelector("[data-fluent-cart-cart-drawer-overlay]"),s=a.target.closest("[data-fluent-cart-cart-toggle-button]"),i=a.target.closest("[data-fluent-cart-cart-expand-button], .fcart-cart-toggle-button"),w=a.target.closest("[data-fluent-cart-cart-collapse-button]");if(s){r&&r.classList.toggle(n(t,C));return}if(i){r&&(r.classList.add(n(t,C)),e.style.overflow="hidden"),c&&c.classList.add(n(t,x));return}if(w){r&&r.classList.remove(n(t,C)),c&&c.classList.remove(n(t,x)),e.style.overflow="";return}})},Lt=function(){document.querySelectorAll("[data-cart-badge-count], .fct-cart-badge-count").forEach(e=>{var a;e.textContent=((a=window.fluentcart_drawer_vars)==null?void 0:a.cart_item_count)||0});const t=document.querySelector(".fluent-cart-menu-cart-open-button-container");if(t){const e=t.closest("li"),a=e==null?void 0:e.previousElementSibling;if(a&&e){const r=a.cloneNode(!0);r.removeAttribute("id"),r.innerHTML="",r.appendChild(t.cloneNode(!0)),e.parentNode.replaceChild(r,e)}}},h(M,U,null);let ot=M;class Ut{static init(){document.addEventListener("click",function(t){var w;const e=t.target.closest("[data-fluent-cart-add-to-cart-button]");if(!e||(t.preventDefault(),e.classList.contains("fct-loading")))return;e.classList.add("fct-loading");const a=e.getAttribute("data-cart-id");if(!a)return;let r=parseInt(e.getAttribute("data-quantity"),10)||1;const c=e.getAttribute("data-action-name"),s=e.getAttribute("data-error-action-name");e.setAttribute("data-quantity","1");const i=e.getAttribute("data-is-custom");(w=window.fluentCartCart)==null||w.addProduct(a,r,!1,!0,i).then(b=>{setTimeout(()=>{e.classList.remove("fct-loading")},300),document.dispatchEvent(new Event(c))}).catch(b=>{console.log(b,"error"),e.classList.remove("fct-loading"),document.dispatchEvent(new Event(s))})})}}var k,A,p,E,q,Y,B,P,m,Ct,Tt,At,qt,J,Pt,z,j,Z,K,tt,xt,kt,Ot,Dt;const T=class T{constructor(){h(this,m);h(this,A,null);h(this,p,null);h(this,E,null);h(this,q,null);h(this,Y,300);h(this,B,null);h(this,P,null);h(this,z,()=>{l(this,m,Ot).call(this),n(this,j).call(this),n(this,Z).call(this)});h(this,j,()=>{try{const t=n(this,p).contentDocument||n(this,p).contentWindow.document,e=t.querySelector("[data-fct-modal-checkout-form-inner]");let a=t.body.scrollHeight;if(e)for(const c of e.children)a=Math.max(a,c.scrollHeight);a+=20;const r=a+"px";n(this,p).style.height!==r&&(n(this,p).style.height=r)}catch{}});h(this,Z,()=>{n(this,K).call(this);try{const t=n(this,p).contentDocument||n(this,p).contentWindow.document;let e=null;y(this,P,new MutationObserver(()=>{e||(e=requestAnimationFrame(()=>{e=null,n(this,j).call(this)}))})),n(this,P).observe(t.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style"]})}catch{}});h(this,K,()=>{n(this,P)&&(n(this,P).disconnect(),y(this,P,null))});h(this,tt,t=>{var e;t.origin===window.location.origin&&((e=t.data)==null?void 0:e.type)==="fluentCartCheckoutComplete"&&(t.data.redirectUrl?window.location.href=t.data.redirectUrl:this.closeModal())});var t;this.translate=((t=window.fluentcart)==null?void 0:t.$t)||(e=>e),l(this,m,Ct).call(this),l(this,m,Tt).call(this)}static init(){return n(T,k)||y(T,k,new T),n(T,k)}openModal(t){if(n(this,A)||!n(this,E)||!n(this,p)){(!n(this,E)||!n(this,p))&&l(this,m,xt).call(this);return}y(this,A,n(this,E)),l(this,m,kt).call(this),n(this,p).src=t,n(this,p).addEventListener("load",()=>{n(this,z).call(this),l(this,m,Dt).call(this,n(this,p))},{once:!0}),n(this,B)||(y(this,B,!0),window.addEventListener("message",n(this,tt))),n(this,E).classList.add("fct-checkout-modal-open"),n(this,E).style.opacity="1",n(this,E).style.visibility="visible",window.dispatchEvent(new CustomEvent("fluentCartModalCheckoutOpened",{detail:{checkoutUrl:t}}))}closeModal(){n(this,A)&&(n(this,A).classList.remove("fct-checkout-modal-open"),n(this,E).style.opacity="0",n(this,E).style.visibility="hidden",setTimeout(()=>{n(this,K).call(this),n(this,p)&&(n(this,p).src=""),y(this,A,null),window.dispatchEvent(new CustomEvent("fluentCartModalCheckoutClosed"))},n(this,Y)))}};k=new WeakMap,A=new WeakMap,p=new WeakMap,E=new WeakMap,q=new WeakMap,Y=new WeakMap,B=new WeakMap,P=new WeakMap,m=new WeakSet,Ct=function(){y(this,q,document.querySelector("[data-fct-checkout-modal-loader]")),y(this,E,document.querySelector("[data-fct-checkout-modal-container]")),y(this,p,document.querySelector("[data-fct-checkout-modal-iframe]"))},Tt=function(){l(this,m,At).call(this),document.addEventListener("click",l(this,m,Pt).bind(this)),l(this,m,qt).call(this)},At=function(){document.querySelectorAll("[data-fct-instant-checkout-button]").forEach(e=>{e.addEventListener("click",l(this,m,J).bind(this))})},qt=function(){new MutationObserver(e=>{e.forEach(a=>{a.addedNodes.forEach(r=>{var c;r.nodeType===1&&((c=r.hasAttribute)!=null&&c.call(r,"data-fct-instant-checkout-button")&&r.addEventListener("click",l(this,m,J).bind(this)),r.querySelectorAll&&r.querySelectorAll("[data-fct-instant-checkout-button]").forEach(i=>{i.addEventListener("click",l(this,m,J).bind(this))}))})})}).observe(document.body,{childList:!0,subtree:!0})},J=function(t){t.preventDefault();const a=t.currentTarget.getAttribute("href"),r=new URL(a,window.location.origin);r.searchParams.set("fluent-cart","modal_checkout"),this.openModal(r.toString())},Pt=function(t){t.target.closest("[data-fct-checkout-modal-close]")&&(t.preventDefault(),this.closeModal())},z=new WeakMap,j=new WeakMap,Z=new WeakMap,K=new WeakMap,tt=new WeakMap,xt=function(){typeof Toastify<"u"?new Toastify({text:this.translate("Modal checkout is not available. Please try again."),className:"info",duration:3e3,style:{background:"linear-gradient(to right, rgb(255 30 30), rgb(252 133 101))",color:"#fff"}}).showToast():alert(this.translate("Modal checkout is not available. Please try again."))},kt=function(){n(this,q)&&(n(this,q).style.display="")},Ot=function(){n(this,q)&&(n(this,q).style.display="none")},Dt=function(t){var e;try{const a=t.contentDocument||((e=t.contentWindow)==null?void 0:e.document);if(!a||!a.body)return;const r=s=>{if(s.tagName!=="A")return;const i=s.getAttribute("href")||"";i.startsWith("#")||i.startsWith("mailto:")||i.startsWith("tel:")||(s.hasAttribute("target")||(s.target="_blank"),s.rel||(s.rel="noopener noreferrer"))};a.querySelectorAll("a").forEach(r),new MutationObserver(s=>{var i,w;for(const b of s)for(const u of b.addedNodes)u.nodeType===1&&((i=u.matches)!=null&&i.call(u,"a")&&r(u),(w=u.querySelectorAll)==null||w.call(u,"a").forEach(r))}).observe(a.body,{childList:!0,subtree:!0})}catch{}},h(T,k,null);let ct=T;var mt,wt,gt;const Nt={...((mt=window.fluentcart_checkout_vars)==null?void 0:mt.trans)||{},...((wt=window.fluentcart_checkout_vars)==null?void 0:wt.payments_trans)||{},...((gt=window.fluentcart_shop_vars)==null?void 0:gt.trans)||{}};window.fluentcart={$t:function(o){let t=Nt[o]||o;const e=Array.prototype.slice.call(arguments,1);if(e.length===0)return t;const a=/%(\d*\$?)s|%d/g;let r=0;return t=t.replace(a,(c,s)=>{if(s){const i=parseInt(s,10)-1;return i<e.length?e[i]:c}else return r<e.length?e[r++]:c}),t}};const Mt=function(o,t){return Object.keys(o).reduce(function(e,a){const r=t+"["+a+"]";return o[a]!==null&&typeof o[a]=="object"&&!Array.isArray(o[a])?Object.assign(e,Mt(o[a],r)):e[r]=o[a],e},{})},dt=function(o,t={},e){const a=`${window.fluentCartRestVars.ajaxurl}`,r=new AbortController,c=r.signal,s={"X-WP-Nonce":window.fluentCartRestVars.rest.nonce};["PUT","PATCH","DELETE"].indexOf(o.toUpperCase())!==-1&&(s["X-HTTP-Method-Override"]=o,o="POST"),t.query_timestamp=Date.now();const i=new Promise((w,b)=>{const u=new XMLHttpRequest;let I=a;if(o.toUpperCase()==="GET"){let g={};Object.keys(t).forEach(S=>{t[S]===null||t[S]===!1?delete t[S]:typeof t[S]=="object"?g=Object.assign(g,Mt(t[S],S)):g[S]=t[S]});let O=new URLSearchParams(g).toString();I.indexOf("?")!==-1?I+="&"+O:I+="?"+O}u.open(o,I,!0),c.addEventListener("abort",()=>{u.abort(),b({aborted:!0,message:"Request aborted"})}),Object.keys(s).forEach(g=>{u.setRequestHeader(g,s[g])}),u.onload=function(){let g;try{g=JSON.parse(u.responseText)}catch{g=null}this.status>=200&&this.status<300?w(g):(g&&(typeof g=="object"&&(g.xhr_status=u.status),g.code=="rest_cookie_invalid_nonce"&&document.dispatchEvent(new CustomEvent("fcart_renew_rest_nonce",{detail:g}))),b(g))},u.onerror=function(){console.info("Your server firewall blocked the request or it's a plugin conflict. Please check the detailed error."),console.log({status:u.status,statusText:u.statusText,responseText:u.responseText}),b({status:u.status,statusText:u.statusText})},o.toUpperCase()==="GET"?u.send():(u.setRequestHeader("Content-Type","application/json;charset=UTF-8"),u.send(JSON.stringify(t)))});return e?{request:i,controller:r}:i};document.addEventListener("DOMContentLoaded",function(){window.fluentCartCart=new ot().init(),window.fluentCartUtmManager=new et,Ut.init(),window.fluentCartAjax={get:function(o={},t=!1){return dt("GET",o,t)},post:function(o={},t=!1){return dt("POST",o,t)}},window.fluentcart.ajax=window.fluentCartAjax,ct.init(),window.dispatchEvent(new CustomEvent("fluent_cart_app_loaded",{})),document.addEventListener("click",function(o){const t=o.target.closest("[data-fluent-cart-collapsible-toggle]");if(!t)return;o.preventDefault(),t.closest("[data-fluent-cart-collapsibles]").classList.toggle("show-all")})});