import{g as p,o as h,c as g,e as w,d as f,u as l,f as b}from"../../assets/runtime-dom.esm-bundler-Dxy_DEvW.js";import{d as B,c as A}from"../../assets/pinia-C4Yr3Hdu.js";import{_ as O}from"../../assets/Templates-Bw4KNC2s.js";import{d as y}from"../../assets/html-BWr-OkGC.js";const u=B("insights",{state:()=>({insights:null}),getters:{daily_revenue_customer_calendar_chart:r=>{if(!r.insights?.daily_revenue_customer)return null;const{labels:o}=window.FAB_WC_METABOX_ORDER,{premium:a}=window.FAB_PLUGIN;let{daily_revenue_customer:i}=r.insights;a||(i=Object.fromEntries(Object.entries(i).slice(-7)));const c=Object.entries(i).reduce((e,[s,t])=>{const n=s.split("-")[0];return e[n]||(e[n]={}),e[n][s]=t,e},{}),_=y(o.currency_symbol);return Object.entries(c).sort((e,s)=>s[0]-e[0]).map(([e,s])=>({title:o.daily_revenue_customer+" "+e,data:Object.entries(s).map(([t,n])=>[t,n]),year:parseInt(e),threshold:Object.values(o.threshold),tooltip:{position:"top",formatter:function(t){return`${t.data[0]}: ${_}${t.data[1]}`}}}))}},actions:{setInsights(r){this.insights=r}}}),E={class:"fab-container"},v={__name:"App",setup(r){const{labels:o,templates:a}=window.FAB_WC_METABOX_ORDER,{woocommerce_tips:i}=window.FAB_WC_METABOX_ORDER.urls,{premium:c}=window.FAB_PLUGIN,{upgrade:_,loading_gif:m}=window.FAB_PLUGIN.urls,{plugin_url:e}=window.FAB_PLUGIN.path,s=u();return p(()=>s.insights?.daily_revenue_customer),h(async()=>{const{insights:t}=window.FAB_WC_METABOX_ORDER;await u().setInsights(t)}),(t,n)=>(w(),g("div",E,[f(O,{labels:l(o),templates:l(a)},null,8,["labels","templates"])]))}},d=b(v);d.use(A());d.mount("#fab-wc-metabox-order-dom");
//# sourceMappingURL=bundle.KyCeffqq.js.map
