import{j as e,_ as s,r as g,s as L,d as T}from"./wp-i18n-shim-DUX0OV_V.js";import{L as N,B as f,D as P,C as B,a as E,b as $,P as M,c as U,d as O,A as z,p as I,e as Y,f as q,i as H}from"./index-qBIihVyl.js";import{a as h,s as n,u as c}from"./store-rDqSxbzb.js";import{D as y}from"./dollar-sign-Bnksw8VW.js";import{C as K}from"./calendar-Cz3-D5io.js";import{U as V}from"./withIconDefaults-BJCqj2oX.js";import{l as C,j as R,m as W}from"./index-D01LF5Le.js";import{c as v}from"./utils-Bl0WAcve.js";import{R as X}from"./refresh-cw-DB5brqih.js";import{C as k}from"./calendar-check-BnxK3HlR.js";import{B as D}from"./briefcase-BPMaZmF0.js";import{P as G}from"./ProUpgradeBanner-B_761Fa7.js";import"./vendor-DDjlQeP6.js";import"./lodash-Bd-B7UeG.js";import"./defineProperty-DbXIQDXj.js";import"./typeof-QjJsDpFa.js";import"./apiConfig-BA13wrqF.js";import"./index-CLZ4-rw6.js";import"./toast-1-c8k_LJ.js";import"./preload-helper-Dp1pzeXC.js";import"./CalenderCheck-2TB2QVYq.js";import"./tag-8m_NofXN.js";import"./shield-DVSNyXBB.js";import"./proxy-CtW-P0pQ.js";import"./circle-check-big-Bxgqw2u9.js";import"./crown-CcV7MJml.js";/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const J=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Q=v("arrow-down",J);/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Z=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],ee=v("arrow-up",Z);/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const se=[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],S=v("user-check",se);/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const te=[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]],A=v("users-round",te),re=[{key:"this_month",label:s("This Month","radius-booking")},{key:"30d",label:s("Last 30 Days","radius-booking")},{key:"90d",label:s("Last 90 Days","radius-booking")},{key:"1y",label:s("1 Year","radius-booking")},{key:"all",label:s("All","radius-booking")}];function _(a){return a.toISOString().split("T")[0]}function ae(a){const r=new Date;let t=new Date,l=new Date;switch(a){case"this_month":t=new Date(r.getFullYear(),r.getMonth(),1),l=new Date(r.getFullYear(),r.getMonth()+1,0);break;case"30d":t.setDate(t.getDate()-30);break;case"90d":t.setDate(t.getDate()-90);break;case"1y":t.setFullYear(t.getFullYear()-1);break;case"all":t.setDate(t.getDate()-90),l.setDate(l.getDate()+90);break;default:t.setDate(t.getDate()-90),l.setDate(l.getDate()+90)}return{date_from:_(t),date_to:_(l),preset:a}}function ie(){const a=h(n),r=c(o=>o(n).getAnalyticsPeriod(),[]);function t(o){a.setAnalyticsPeriod(ae(o))}function l(o,i){a.setAnalyticsPeriod({...r,[o]:i,preset:"custom"})}return e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[re.map(o=>e.jsx("button",{onClick:()=>t(o.key),className:`px-3 py-1.5 text-xs font-medium rounded-md border transition-colors ${r.preset===o.key?"bg-primary text-white border-primary":"bg-white text-title border-border hover:bg-gray-50"}`,children:o.label},o.key)),e.jsxs("div",{className:"flex items-center gap-1.5 ml-2",children:[e.jsx("input",{type:"date",value:r.date_from,onChange:o=>l("date_from",o.target.value),className:"px-2 py-1.5 text-xs border border-border rounded-md bg-white"}),e.jsx("span",{className:"text-xs text-title2",children:s("to","radius-booking")}),e.jsx("input",{type:"date",value:r.date_to,onChange:o=>l("date_to",o.target.value),className:"px-2 py-1.5 text-xs border border-border rounded-md bg-white"})]})]})}const oe=[{key:"total_revenue",label:s("Total Revenue","radius-booking"),icon:y,isCurrency:!0,color:"text-emerald-600",bg:"bg-emerald-50"},{key:"total_appointments",label:s("Appointments","radius-booking"),icon:K,color:"text-blue-600",bg:"bg-blue-50"},{key:"new_customers",label:s("New Customers","radius-booking"),icon:V,color:"text-violet-600",bg:"bg-violet-50"},{key:"avg_revenue_per_appt",label:s("Avg Revenue","radius-booking"),icon:C,isCurrency:!0,color:"text-amber-600",bg:"bg-amber-50"},{key:"cancellation_rate",label:s("Cancellation Rate","radius-booking"),icon:R,suffix:"%",invertColor:!0,color:"text-red-600",bg:"bg-red-50"}];function ne(){const a=h(n),r=c(i=>i(n).getAnalyticsPeriod(),[]),t=c(i=>i(n).getKpiSummary(),[]),l=c(i=>i(n).getAnalyticsLoading(),[]);g.useEffect(()=>{a.loadKpiSummary({date_from:r.date_from,date_to:r.date_to})},[r.date_from,r.date_to]);const o=(t==null?void 0:t.currency_symbol)||"$";return e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-5 gap-4",children:oe.map(i=>{const m=(t==null?void 0:t[i.key])||{},d=m.value??0,p=m.change_pct??0,x=i.invertColor?p<=0:p>=0,b=i.icon;return e.jsxs("div",{className:"bg-white rounded-xl border border-border p-5 flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-medium text-title2",children:i.label}),e.jsx("div",{className:`w-8 h-8 rounded-lg ${i.bg} flex items-center justify-center`,children:e.jsx(b,{className:`w-4 h-4 ${i.color}`})})]}),e.jsx("div",{className:"text-2xl font-bold text-title",children:l.kpi?e.jsx("div",{className:"h-8 w-24 bg-gray-100 rounded animate-pulse"}):e.jsxs(e.Fragment,{children:[i.isCurrency&&o,typeof d=="number"?d.toLocaleString():d,i.suffix||""]})}),!l.kpi&&e.jsxs("div",{className:`flex items-center gap-1 text-xs font-medium ${x?"text-emerald-600":"text-red-500"}`,children:[x?e.jsx(ee,{className:"w-3 h-3"}):e.jsx(Q,{className:"w-3 h-3"}),Math.abs(p),"%",e.jsx("span",{className:"text-title2 font-normal ml-1",children:s("vs prev period","radius-booking")})]})]},i.key)})})}function le(){const a=h(n),r=c(d=>d(n).getAnalyticsPeriod(),[]),t=c(d=>d(n).getRevenueAnalytics(),[]),l=c(d=>d(n).getAnalyticsLoading(),[]);g.useEffect(()=>{a.loadRevenueAnalytics({date_from:r.date_from,date_to:r.date_to})},[r.date_from,r.date_to]);const o=(t==null?void 0:t.trend)||{labels:[],data:[]},i={labels:o.labels||[],datasets:[{label:s("Revenue","radius-booking"),data:o.data||[],borderColor:"#4F46E5",backgroundColor:"rgba(79, 70, 229, 0.08)",fill:!0,tension:.4,pointRadius:2,pointHoverRadius:5}]},m={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{mode:"index",intersect:!1}},scales:{x:{grid:{display:!1},ticks:{color:"#9CA3AF",maxTicksLimit:10}},y:{grid:{color:"rgba(156,163,175,0.1)"},ticks:{color:"#9CA3AF",precision:0}}}};return l.revenue?e.jsx("div",{className:"bg-white rounded-xl border border-border p-6",children:e.jsx("div",{className:"h-[280px] bg-gray-50 rounded animate-pulse"})}):e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-4",children:s("Revenue Trend","radius-booking")}),e.jsx("div",{className:"h-[280px]",children:e.jsx(N,{data:i,options:m})})]})}function de(){const a=c(i=>i(n).getRevenueAnalytics(),[]),r=c(i=>i(n).getAnalyticsLoading(),[]),t=(a==null?void 0:a.by_service)||[],l={labels:t.map(i=>i.service_name),datasets:[{label:s("Revenue","radius-booking"),data:t.map(i=>i.revenue),backgroundColor:"#818CF8",borderRadius:4,barThickness:18}]},o={indexAxis:"y",responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1}},scales:{x:{grid:{color:"rgba(156,163,175,0.1)"},ticks:{color:"#9CA3AF",precision:0}},y:{grid:{display:!1},ticks:{color:"#374151",font:{size:11}}}}};return r.revenue?e.jsx("div",{className:"bg-white rounded-xl border border-border p-6",children:e.jsx("div",{className:"h-[200px] bg-gray-50 rounded animate-pulse"})}):e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-4",children:s("Revenue by Service","radius-booking")}),e.jsx("div",{className:"h-[200px]",children:t.length?e.jsx(f,{data:l,options:o}):e.jsx("p",{className:"text-sm text-title2",children:s("No data","radius-booking")})})]})}function ce(){const a=c(i=>i(n).getRevenueAnalytics(),[]),r=c(i=>i(n).getAnalyticsLoading(),[]),t=(a==null?void 0:a.by_employee)||[],l={labels:t.map(i=>i.employee_name),datasets:[{label:s("Revenue","radius-booking"),data:t.map(i=>i.revenue),backgroundColor:"#34D399",borderRadius:4,barThickness:18}]},o={indexAxis:"y",responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1}},scales:{x:{grid:{color:"rgba(156,163,175,0.1)"},ticks:{color:"#9CA3AF",precision:0}},y:{grid:{display:!1},ticks:{color:"#374151",font:{size:11}}}}};return r.revenue?e.jsx("div",{className:"bg-white rounded-xl border border-border p-6",children:e.jsx("div",{className:"h-[200px] bg-gray-50 rounded animate-pulse"})}):e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-4",children:s("Revenue by Staff","radius-booking")}),e.jsx("div",{className:"h-[200px]",children:t.length?e.jsx(f,{data:l,options:o}):e.jsx("p",{className:"text-sm text-title2",children:s("No data","radius-booking")})})]})}const w={pending:"#FBBF24",confirmed:"#60A5FA",completed:"#34D399",cancelled:"#F87171"},me={pending:s("Pending","radius-booking"),confirmed:s("Confirmed","radius-booking"),completed:s("Completed","radius-booking"),cancelled:s("Cancelled","radius-booking")};function xe(){const a=h(n),r=c(b=>b(n).getAnalyticsPeriod(),[]),t=c(b=>b(n).getAppointmentAnalytics(),[]),l=c(b=>b(n).getAnalyticsLoading(),[]);g.useEffect(()=>{a.loadAppointmentAnalytics({date_from:r.date_from,date_to:r.date_to})},[r.date_from,r.date_to]);const o=(t==null?void 0:t.by_status)||{},i=Object.keys(w),m=i.map(b=>o[b]||0),d=m.reduce((b,u)=>b+u,0),p={labels:i.map(b=>me[b]||b),datasets:[{data:m,backgroundColor:i.map(b=>w[b]),borderWidth:0,hoverOffset:6}]},x={responsive:!0,maintainAspectRatio:!1,cutout:"65%",plugins:{legend:{position:"bottom",labels:{usePointStyle:!0,pointStyle:"circle",padding:12,font:{size:11}}}}};return l.appointments?e.jsx("div",{className:"bg-white rounded-xl border border-border p-6",children:e.jsx("div",{className:"h-[260px] bg-gray-50 rounded animate-pulse"})}):e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-1",children:s("By Status","radius-booking")}),e.jsx("p",{className:"text-xs text-title2 mb-4",children:L(T("%s total appointment","%s total appointments",d,"radius-booking"),d)}),e.jsx("div",{className:"h-[220px]",children:d>0?e.jsx(P,{data:p,options:x}):e.jsx("p",{className:"text-sm text-title2 text-center pt-16",children:s("No data","radius-booking")})})]})}function be(){const a=c(i=>i(n).getAppointmentAnalytics(),[]),r=c(i=>i(n).getAnalyticsLoading(),[]),t=(a==null?void 0:a.over_time)||{labels:[],data:[]},l={labels:t.labels||[],datasets:[{label:s("Appointments","radius-booking"),data:t.data||[],borderColor:"#6366F1",backgroundColor:"rgba(99, 102, 241, 0.08)",fill:!0,tension:.4,pointRadius:2,pointHoverRadius:5}]},o={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1}},scales:{x:{grid:{display:!1},ticks:{color:"#9CA3AF",maxTicksLimit:8}},y:{grid:{color:"rgba(156,163,175,0.1)"},ticks:{color:"#9CA3AF",precision:0}}}};return r.appointments?e.jsx("div",{className:"bg-white rounded-xl border border-border p-6",children:e.jsx("div",{className:"h-[260px] bg-gray-50 rounded animate-pulse"})}):e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-4",children:s("Appointments Over Time","radius-booking")}),e.jsx("div",{className:"h-[220px]",children:e.jsx(N,{data:l,options:o})})]})}function ue(){const a=c(m=>m(n).getAppointmentAnalytics(),[]),r=c(m=>m(n).getAnalyticsLoading(),[]),l=((a==null?void 0:a.peak_hours)||[]).filter(m=>m.count>0),o={labels:l.map(m=>m.label),datasets:[{label:s("Bookings","radius-booking"),data:l.map(m=>m.count),backgroundColor:"#A78BFA",borderRadius:4,barThickness:14}]},i={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1}},scales:{x:{grid:{display:!1},ticks:{color:"#9CA3AF",font:{size:10}}},y:{grid:{color:"rgba(156,163,175,0.1)"},ticks:{color:"#9CA3AF",precision:0}}}};return r.appointments?e.jsx("div",{className:"bg-white rounded-xl border border-border p-6",children:e.jsx("div",{className:"h-[260px] bg-gray-50 rounded animate-pulse"})}):e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-4",children:s("Peak Hours","radius-booking")}),e.jsx("div",{className:"h-[220px]",children:l.length?e.jsx(f,{data:o,options:i}):e.jsx("p",{className:"text-sm text-title2",children:s("No data","radius-booking")})})]})}function pe(){const a=c(i=>i(n).getAppointmentAnalytics(),[]),r=c(i=>i(n).getAnalyticsLoading(),[]),t=(a==null?void 0:a.busiest_days)||[],l={labels:t.map(i=>i.day),datasets:[{label:s("Bookings","radius-booking"),data:t.map(i=>i.count),backgroundColor:"#38BDF8",borderRadius:4,barThickness:20}]},o={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1}},scales:{x:{grid:{display:!1},ticks:{color:"#374151",font:{size:11}}},y:{grid:{color:"rgba(156,163,175,0.1)"},ticks:{color:"#9CA3AF",precision:0}}}};return r.appointments?e.jsx("div",{className:"bg-white rounded-xl border border-border p-6",children:e.jsx("div",{className:"h-[260px] bg-gray-50 rounded animate-pulse"})}):e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-4",children:s("Busiest Days","radius-booking")}),e.jsx("div",{className:"h-[220px]",children:t.length?e.jsx(f,{data:l,options:o}):e.jsx("p",{className:"text-sm text-title2",children:s("No data","radius-booking")})})]})}function ge(){const a=h(n),r=c(d=>d(n).getAnalyticsPeriod(),[]),t=c(d=>d(n).getEmployeeAnalytics(),[]),l=c(d=>d(n).getAnalyticsLoading(),[]),o=c(d=>d(n).getKpiSummary(),[]),i=(o==null?void 0:o.currency_symbol)||"$";g.useEffect(()=>{a.loadEmployeeAnalytics({date_from:r.date_from,date_to:r.date_to})},[r.date_from,r.date_to]);const m=(t==null?void 0:t.performance)||[];return l.employees?e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("div",{className:"h-8 w-48 bg-gray-100 rounded animate-pulse mb-4"}),e.jsx("div",{className:"space-y-3",children:[1,2,3].map(d=>e.jsx("div",{className:"h-10 bg-gray-50 rounded animate-pulse"},d))})]}):e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-4",children:s("Staff Performance","radius-booking")}),m.length===0?e.jsx("p",{className:"text-sm text-title2",children:s("No employee data for this period.","radius-booking")}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border text-left",children:[e.jsx("th",{className:"py-2.5 pr-4 text-xs font-medium text-title2",children:s("Staff","radius-booking")}),e.jsx("th",{className:"py-2.5 px-4 text-xs font-medium text-title2 text-center",children:s("Appointments","radius-booking")}),e.jsx("th",{className:"py-2.5 px-4 text-xs font-medium text-title2 text-right",children:s("Revenue","radius-booking")}),e.jsx("th",{className:"py-2.5 px-4 text-xs font-medium text-title2 text-center",children:s("Completion","radius-booking")}),e.jsx("th",{className:"py-2.5 pl-4 text-xs font-medium text-title2 text-center",children:s("Cancelled","radius-booking")})]})}),e.jsx("tbody",{children:m.map(d=>e.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[e.jsx("td",{className:"py-2.5 pr-4 font-medium text-title",children:d.employee_name}),e.jsx("td",{className:"py-2.5 px-4 text-center text-title",children:d.total_appointments}),e.jsxs("td",{className:"py-2.5 px-4 text-right text-title",children:[i,Number(d.revenue).toLocaleString()]}),e.jsx("td",{className:"py-2.5 px-4 text-center",children:e.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-50 text-emerald-700",children:[d.completion_rate,"%"]})}),e.jsx("td",{className:"py-2.5 pl-4 text-center",children:e.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-red-50 text-red-600",children:[d.cancellation_rate,"%"]})})]},d.employee_id))})]})})]})}function he(){const a=h(n),r=c(x=>x(n).getAnalyticsPeriod(),[]),t=c(x=>x(n).getServiceAnalytics(),[]),l=c(x=>x(n).getAnalyticsLoading(),[]);g.useEffect(()=>{a.loadServiceAnalytics({date_from:r.date_from,date_to:r.date_to})},[r.date_from,r.date_to]);const o=(t==null?void 0:t.popular)||[],i=(t==null?void 0:t.revenue)||[],m={labels:o.map(x=>x.service_name),datasets:[{label:s("Bookings","radius-booking"),data:o.map(x=>x.appointment_count),backgroundColor:"#6366F1",borderRadius:4,barThickness:18}]},d={labels:i.map(x=>x.service_name),datasets:[{label:s("Revenue","radius-booking"),data:i.map(x=>x.total_revenue),backgroundColor:"#F59E0B",borderRadius:4,barThickness:18}]},p=(x=!1)=>({indexAxis:x?"y":"x",responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1}},scales:{x:{grid:{display:x,color:"rgba(156,163,175,0.1)"},ticks:{color:"#9CA3AF",precision:0,font:{size:11}}},y:{grid:{display:!x,color:"rgba(156,163,175,0.1)"},ticks:{color:"#374151",font:{size:11}}}}});return l.services?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[1,2].map(x=>e.jsx("div",{className:"bg-white rounded-xl border border-border p-6",children:e.jsx("div",{className:"h-[240px] bg-gray-50 rounded animate-pulse"})},x))}):e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-4",children:s("Most Popular Services","radius-booking")}),e.jsx("div",{className:"h-[240px]",children:o.length?e.jsx(f,{data:m,options:p(!0)}):e.jsx("p",{className:"text-sm text-title2",children:s("No data","radius-booking")})})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-4",children:s("Revenue per Service","radius-booking")}),e.jsx("div",{className:"h-[240px]",children:i.length?e.jsx(f,{data:d,options:p(!0)}):e.jsx("p",{className:"text-sm text-title2",children:s("No data","radius-booking")})})]})]})}function fe(){const a=h(n),r=c(u=>u(n).getAnalyticsPeriod(),[]),t=c(u=>u(n).getCustomerAnalytics(),[]),l=c(u=>u(n).getAnalyticsLoading(),[]),o=c(u=>u(n).getKpiSummary(),[]),i=(o==null?void 0:o.currency_symbol)||"$";g.useEffect(()=>{a.loadCustomerAnalytics({date_from:r.date_from,date_to:r.date_to})},[r.date_from,r.date_to]);const m=(t==null?void 0:t.new_vs_returning)||{labels:[],new:[],returning:[]},d=(t==null?void 0:t.top_by_revenue)||[],p=(t==null?void 0:t.retention_rate)??0,x={labels:m.labels||[],datasets:[{label:s("New","radius-booking"),data:m.new||[],borderColor:"#6366F1",backgroundColor:"rgba(99, 102, 241, 0.08)",fill:!0,tension:.4,pointRadius:2},{label:s("Returning","radius-booking"),data:m.returning||[],borderColor:"#F59E0B",backgroundColor:"rgba(245, 158, 11, 0.08)",fill:!0,tension:.4,pointRadius:2}]},b={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{position:"top",labels:{usePointStyle:!0,pointStyle:"circle",padding:16,font:{size:11}}}},scales:{x:{grid:{display:!1},ticks:{color:"#9CA3AF",maxTicksLimit:8}},y:{grid:{color:"rgba(156,163,175,0.1)"},ticks:{color:"#9CA3AF",precision:0}}}};return l.customers?e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsx("div",{className:"lg:col-span-2 bg-white rounded-xl border border-border p-6",children:e.jsx("div",{className:"h-[260px] bg-gray-50 rounded animate-pulse"})}),e.jsx("div",{className:"bg-white rounded-xl border border-border p-6",children:e.jsx("div",{className:"h-[260px] bg-gray-50 rounded animate-pulse"})})]}):e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-4",children:s("New vs Returning Customers","radius-booking")}),e.jsx("div",{className:"h-[260px]",children:e.jsx(N,{data:x,options:b})})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6 flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(X,{className:"w-4 h-4 text-primary"}),e.jsx("h3",{className:"text-sm font-semibold text-title",children:s("Retention Rate","radius-booking")})]}),e.jsxs("div",{className:"text-4xl font-bold text-primary mb-1",children:[p,"%"]}),e.jsx("p",{className:"text-xs text-title2 mb-6",children:s("customers returned from previous period","radius-booking")}),e.jsx("h4",{className:"text-xs font-medium text-title2 mb-2",children:s("Top Customers by Revenue","radius-booking")}),e.jsxs("div",{className:"flex-1 overflow-y-auto space-y-2",children:[d.length===0&&e.jsx("p",{className:"text-xs text-title2",children:s("No data","radius-booking")}),d.map((u,F)=>e.jsxs("div",{className:"flex items-center justify-between py-1.5 border-b border-border/50 last:border-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-5 h-5 rounded-full bg-primary/10 text-primary text-[10px] font-bold flex items-center justify-center",children:F+1}),e.jsx("span",{className:"text-xs font-medium text-title truncate max-w-[100px]",children:u.customer_name})]}),e.jsxs("span",{className:"text-xs font-semibold text-title",children:[i,Number(u.total_revenue).toLocaleString()]})]},u.customer_id))]})]})]})}B.register(E,$,M,U,O,z,I,Y,q,H);const ye=[{id:"revenue",label:s("Revenue","radius-booking"),icon:y},{id:"appointments",label:s("Appointments","radius-booking"),icon:k},{id:"staff",label:s("Staff","radius-booking"),icon:A},{id:"services",label:s("Services","radius-booking"),icon:D},{id:"customers",label:s("Customers","radius-booking"),icon:S}];function ve(){const[a,r]=g.useState("revenue");return e.jsxs("div",{className:"space-y-5",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(ie,{})}),e.jsx(ne,{}),e.jsxs("div",{className:"bg-white rounded-xl border border-border",children:[e.jsx("div",{className:"flex border-b border-border overflow-x-auto",children:ye.map(t=>{const l=t.icon,o=a===t.id;return e.jsxs("button",{onClick:()=>r(t.id),className:`flex items-center gap-2 px-5 py-3 text-sm font-medium whitespace-nowrap border-b-2 transition-colors ${o?"border-primary text-primary":"border-transparent text-title2 hover:text-title hover:border-gray-200"}`,children:[e.jsx(l,{className:"w-4 h-4"}),t.label]},t.id)})}),e.jsxs("div",{className:"p-5",children:[a==="revenue"&&e.jsxs("div",{className:"space-y-5",children:[e.jsx(le,{}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:[e.jsx(de,{}),e.jsx(ce,{})]})]}),a==="appointments"&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-5",children:[e.jsx(xe,{}),e.jsx("div",{className:"lg:col-span-2",children:e.jsx(be,{})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:[e.jsx(ue,{}),e.jsx(pe,{})]})]}),a==="staff"&&e.jsx(ge,{}),a==="services"&&e.jsx(he,{}),a==="customers"&&e.jsx(fe,{})]})]})]})}const je=[{label:s("Total Revenue","radius-booking"),icon:y,value:"$12,450",color:"text-emerald-600",bg:"bg-emerald-50"},{label:s("Appointments","radius-booking"),icon:k,value:"248",color:"text-blue-600",bg:"bg-blue-50"},{label:s("New Customers","radius-booking"),icon:A,value:"36",color:"text-violet-600",bg:"bg-violet-50"},{label:s("Avg Revenue","radius-booking"),icon:C,value:"$50.20",color:"text-amber-600",bg:"bg-amber-50"},{label:s("Cancellation Rate","radius-booking"),icon:R,value:"4.8%",color:"text-red-600",bg:"bg-red-50"}],Ne=[{id:"revenue",label:s("Revenue","radius-booking"),icon:y},{id:"appointments",label:s("Appointments","radius-booking"),icon:k},{id:"staff",label:s("Staff","radius-booking"),icon:A},{id:"services",label:s("Services","radius-booking"),icon:D},{id:"customers",label:s("Customers","radius-booking"),icon:S}],ke=[s("This Month","radius-booking"),s("Last 30 Days","radius-booking"),s("Last 90 Days","radius-booking"),s("1 Year","radius-booking"),s("All","radius-booking")];function j({heights:a}){return e.jsx("div",{className:"flex items-end gap-2 h-[200px] pt-6",children:a.map((r,t)=>e.jsx("div",{className:"flex-1 bg-gray-200 rounded-t",style:{height:`${r}%`}},t))})}function Ae(){return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-9 h-9 rounded-lg bg-primary/10 flex items-center justify-center",children:e.jsx(W,{className:"w-5 h-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-title",children:s("Analytics","radius-booking")}),e.jsx("p",{className:"text-xs text-title2",children:s("360° view of your business performance","radius-booking")})]})]}),e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:ke.map((a,r)=>e.jsx("span",{className:`px-3 py-1.5 text-xs font-medium rounded-md border ${r===0?"bg-primary text-white border-primary":"bg-white text-title border-border"}`,children:a},r))})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-5 gap-4",children:je.map(a=>{const r=a.icon;return e.jsxs("div",{className:"bg-white rounded-xl border border-border p-5 flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-medium text-title2",children:a.label}),e.jsx("div",{className:`w-8 h-8 rounded-lg ${a.bg} flex items-center justify-center`,children:e.jsx(r,{className:`w-4 h-4 ${a.color}`})})]}),e.jsx("div",{className:"text-2xl font-bold text-title",children:a.value}),e.jsxs("div",{className:"flex items-center gap-1 text-xs font-medium text-emerald-600",children:["+12.5% ",e.jsx("span",{className:"text-title2 font-normal ml-1",children:s("vs prev period","radius-booking")})]})]},a.label)})}),e.jsxs("div",{className:"bg-white rounded-xl border border-border",children:[e.jsx("div",{className:"flex border-b border-border overflow-x-auto",children:Ne.map((a,r)=>{const t=a.icon;return e.jsxs("span",{className:`flex items-center gap-2 px-5 py-3 text-sm font-medium whitespace-nowrap border-b-2 ${r===0?"border-primary text-primary":"border-transparent text-title2"}`,children:[e.jsx(t,{className:"w-4 h-4"}),a.label]},a.id)})}),e.jsxs("div",{className:"p-5 space-y-5",children:[e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-4",children:s("Revenue Trend","radius-booking")}),e.jsx(j,{heights:[30,45,55,40,65,70,50,80,60,75,55,90]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:[e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-4",children:s("Revenue by Service","radius-booking")}),e.jsx(j,{heights:[90,70,55,40,25]})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-4",children:s("Revenue by Staff","radius-booking")}),e.jsx(j,{heights:[85,65,50,35]})]})]})]})]})]})}function Je(){var r;return!((r=window.radius_booking_param)!=null&&r.is_pro)?e.jsxs("div",{children:[e.jsx(G,{title:s("Analytics","radius-booking"),type:"setting"}),e.jsx("div",{className:"pointer-events-none select-none opacity-50 mt-4",children:e.jsx(Ae,{})})]}):e.jsx(ve,{})}export{Je as default};
//# sourceMappingURL=Analytics-DfRNnDrh.js.map
