1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/UpcomingBookings-DqPQUogX.js","assets/index-CpSGH3si.js","assets/index-dOurFxdZ.css","assets/card--3jAFIY6.js","assets/skeleton-D7CKVNpx.js","assets/BookingDetailModal-DwCrTpYX.js","assets/dialog-DjQOlXK_.js","assets/label-mxM2ZpWz.js","assets/textarea-DnsCXU4p.js","assets/input-CJQwYE0h.js","assets/index-VOExC7zx.js","assets/loader-circle-CZ4nBqpt.js","assets/circle-check-zYGxtVka.js","assets/image-DhDYYEir.js","assets/user-DdcnLghC.js","assets/phone-B5j7AMqT.js","assets/mail-32WMcMo6.js","assets/pencil-DQhK_CFW.js","assets/circle-check-big-BfTSBK82.js","assets/format-DRR4LvZs.js","assets/differenceInCalendarDays-CFJcUmo7.js","assets/proxy-DFy_m_5J.js","assets/BookingRequests-OIH_5CNi.js","assets/calendar-DenphN4x.js","assets/addMonths-Dda1PylI.js","assets/isSameMonth-BJzWQGR2.js","assets/isBefore-DbbOBjMf.js","assets/isSameDay-CnIkoyse.js","assets/subDays-D-snu2mw.js","assets/addDays-DbcpP0x6.js","assets/setYear-CliJVh3o.js","assets/endOfWeek-CxH9v-Wb.js","assets/startOfMonth-DfJskKPr.js","assets/addWeeks-DCzH6OaQ.js","assets/isAfter-X1VCSQ-p.js","assets/chevron-left-Bt8IqULh.js","assets/select-DF7dIvp6.js","assets/index-BdQq_4o_.js","assets/index-Bs3UMnWC.js","assets/index-Cy91vPlr.js","assets/chevron-up-xOaegNmi.js","assets/calendar-clock-AePWPS20.js","assets/circle-alert-CRwkKVNs.js","assets/JobRequestsList-0OzHLH10.js","assets/AvailabilityCalendar-CfzpJpoq.js","assets/switch-DZOHvmxy.js","assets/save-D9ShgAbO.js","assets/calendar-off-CT5fX1GH.js","assets/parseISO-Xi6EUFU9.js","assets/triangle-alert-Dji1vfjp.js","assets/refresh-cw-Wgel5wP6.js","assets/zap-DMV_c2aX.js","assets/BookingCalendarView-DuITWZ2P.js","assets/index-CtsrXVb9.js","assets/subMonths-MumjWLOH.js","assets/EarningsSummary-DKPpanMS.js","assets/arrow-up-right-CnqVUcsD.js","assets/arrow-down-right-DIAvm_xk.js","assets/BarChart-BB8s17z4.js","assets/tiny-invariant-BaFNuDhB.js","assets/LineChart-BUUpR55M.js","assets/isWithinInterval-CI9JRMng.js","assets/AccountManagement-BvutPDHP.js","assets/tabs-C2Ucxcpc.js","assets/AdvancedAvailability-BSQuMWw9.js","assets/StatePicker-daNglNSY.js","assets/upload-Cxbl-Jr2.js","assets/emailValidator-CgDbf28y.js","assets/camera-C7iKKA8Y.js","assets/building-BxQ7zmgQ.js","assets/wrench-BbTR8Tzx.js","assets/folder-open-CocgIq2W.js","assets/pen-line-CKwKkcVX.js","assets/repeat-BbfH4IHi.js","assets/shield-DdxYJIuW.js","assets/circle-x-BtX7uimO.js","assets/award-DKmag8Pk.js","assets/send-CpRLLNKN.js","assets/alert-dialog-BTQBRmzT.js","assets/file-image-4M7VnhMJ.js","assets/external-link-Di3_Dt5_.js","assets/credit-card-Cs4PMOek.js","assets/circle-play-BG5NqrQ3.js","assets/calendar-days-B7cRB7cl.js","assets/copy-CewTimSu.js","assets/ReviewsManager-CYDgKrlr.js","assets/thumbs-up-G2A7N3ku.js","assets/ProfilePerformance-EOrPyE_z.js","assets/eye-B1WA26hs.js","assets/ManageAvailabilitySlots-CWiZwq2B.js","assets/isPast-DOqFiOqV.js","assets/isToday-BVLSP7-1.js","assets/isTomorrow-2hkyI4Bz.js","assets/InviteContractorModal-Zu73WSH1.js","assets/MatchedLeadsPanel-LoWFCb7V.js","assets/video-BtzPO_re.js","assets/arrow-right-wWO7VtP3.js","assets/inbox-CC8eM3to.js","assets/DashboardMapWidget-UHns1ijH.js","assets/leaflet-DGXHz3bg.js","assets/leaflet-Dgihpmma.css","assets/layers-BrLtODAJ.js","assets/Polyline-Bicuu4ZU.js","assets/ContractorAnalytics-CfJvBwUi.js","assets/AreaChart-StwCVTyb.js","assets/trending-down-INzkedG6.js","assets/differenceInMinutes-CwAp1Ryz.js"])))=>i.map(i=>d[i]); 2import{m as e,L as j,a5 as ie,a4 as Y,u as ye,v as ne,x as C,r as l,s as P,w as D,T as oe,D as de,C as V,G as W,B,i as Le,F as ue,a2 as G,n as _,I as we,U as Se,a9 as K,aa as Re,aX as Ae,X as Ee,aY as qe,o as X,M as Oe,ac as Pe,p as Be,ab as v}from"./index-CpSGH3si.js";import{T as Te,a as De,b as N,c as y}from"./tabs-C2Ucxcpc.js";import{S as q}from"./skeleton-D7CKVNpx.js";import{L as Ie}from"./Logo-DmRSeVwj.js";import{S as ze}from"./switch-DZOHvmxy.js";import{Z as $}from"./zap-DMV_c2aX.js";import{C as H,b as Z,a as ee,c as pe}from"./card--3jAFIY6.js";import{a as Je}from"./AIMatchingService-7xGEI2cb.js";import{S as ge}from"./sparkles-Dcvw6KO-.js";import{m as S}from"./proxy-DFy_m_5J.js";import{A as Q}from"./arrow-right-wWO7VtP3.js";import{a as z}from"./format-DRR4LvZs.js";import{Q as Ve}from"./QuoteRequestCard-ChxVCewN.js";import{A as $e}from"./AddJobModal-BRyeNmrz.js";import{s as je}from"./subMonths-MumjWLOH.js";import{s as Fe}from"./startOfMonth-DfJskKPr.js";import{i as Ue}from"./isWithinInterval-CI9JRMng.js";import{p as I}from"./parseISO-Xi6EUFU9.js";import{R as se,a as be,X as fe,Y as ve,T as te,B as Ke,b as Qe,C as We}from"./BarChart-BB8s17z4.js";import{A as Ye,a as Ge}from"./AreaChart-StwCVTyb.js";import{C as _e}from"./circle-check-zYGxtVka.js";import{W as Xe}from"./wrench-BbTR8Tzx.js";import{P as He,a as Ze}from"./PieChart-DqMVOeYk.js";import{i as ke}from"./isToday-BVLSP7-1.js";import{i as Ce}from"./isTomorrow-2hkyI4Bz.js";import{a as es}from"./isThisWeek-C9Gd03Kp.js";import{C as ce}from"./calendar-days-B7cRB7cl.js";import{P as ss}
2from"./phone-B5j7AMqT.js";import{E as ts}from"./eye-B1WA26hs.js";import{C as Ne}from"./chart-column-CT0GaeEQ.js";import{S as as}from"./settings-CgpP5zcL.js";import"./index-Bs3UMnWC.js";import"./differenceInCalendarDays-CFJcUmo7.js";import"./input-CJQwYE0h.js";import"./label-mxM2ZpWz.js";import"./textarea-DnsCXU4p.js";import"./dialog-DjQOlXK_.js";import"./addDays-DbcpP0x6.js";import"./user-DdcnLghC.js";import"./chevron-up-xOaegNmi.js";import"./send-CpRLLNKN.js";import"./loader-circle-CZ4nBqpt.js";import"./select-DF7dIvp6.js";import"./index-BdQq_4o_.js";import"./index-Cy91vPlr.js";import"./index-VOExC7zx.js";import"./numericValidators-CORrfhZy.js";import"./triangle-alert-Dji1vfjp.js";import"./addMonths-Dda1PylI.js";import"./tiny-invariant-BaFNuDhB.js";import"./isSameDay-CnIkoyse.js";function ls({items:n=[]}){return e.jsxs("nav",{className:"flex items-center gap-1 text-sm text-slate-500 mb-4 flex-wrap",children:[e.jsx(j,{to:"/",className:"flex items-center gap-1 hover:text-slate-900 transition-colors",children:e.jsx(ie,{className:"w-3.5 h-3.5"})}),n.map((r,o)=>e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Y,{className:"w-3.5 h-3.5 text-slate-300"}),r.href?e.jsx(j,{to:r.href,className:"hover:text-slate-900 transition-colors",children:r.label}):e.jsx("span",{className:"text-slate-900 font-medium",children:r.label})]},o))]})}function rs({contractor:n,contractorId:r}){const o=ye(),i=ne({mutationFn:t=>C.entities.Contractor.update(r,{fill_schedule_mode:t}),onSuccess:()=>o.invalidateQueries({queryKey:["contractor",r]})}),p=(n==null?void 0:n.fill_schedule_mode)??!1;return e.jsx("div",{className:`rounded-xl border-2 p-5 transition-all ${p?"border-green-400 bg-green-50":"border-slate-200 bg-white"}`,children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`w-10 h-10 rounded-lg flex items-center justify-center shrink-0 ${p?"bg-green-500":"bg-slate-100"}`,children:e.jsx($,{className:`w-5 h-5 ${p?"text-white":"text-slate-400"}`})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-slate-900",children:"Fill My Schedule"}),e.jsx("p",{className:"text-sm text-slate-500 mt-0.5",children:"Turn this on when you have open time in your schedule and want to receive more project requests."}),p&&e.jsx("p",{className:"text-sm text-green-600 font-medium mt-2",children:"â You're boosted in search results and showing as ready to start."})]})]}),e.jsx(ze,{checked:p,onCheckedChange:t=>i.mutate(t),disabled:i.isPending,className:"shrink-0"})]})})}const is={high:{bg:"bg-green-100",text:"text-green-700",label:"High Match"},medium:{bg:"bg-amber-100",text:"text-amber-700",label:"Good Match"},low:{bg:"bg-slate-100",text:"text-slate-600",label:"Possible Match"}};function ns({contractor:n}){const[r,o]=l.useState([]),{data:i,isLoading:p}=P({queryKey:["all-job-requests"],queryFn:()=>C.entities.JobRequest.filter({status:"open"},"-created_date",100),enabled:!!n});return l.useEffect(()=>{i&&n&&Je(n,i).then(o).catch(()=>o([]))},[i,n]),p?e.jsxs(H,{children:[e.jsx(Z,{children:e.jsx(q,{className:"h-6 w-48"})}),e.jsx(ee,{children:e.jsx("div",{className:"space-y-3",children:[...Array(3)].map((t,b)=>e.jsx(q,{className:"h-24 rounded-lg"},b))})})]}):!r||r.length===0?e.jsxs(H,{children:[e.jsx(Z,{children:e.jsxs(pe,{className:"flex items-center gap-2 text-lg",children:[e.jsx(ge,{className:"w-5 h-5 text-purple-600"}),"AI Job Suggestions"]})}),e.jsx(ee,{children:e.jsxs("div",{className:"text-center py-6 text-slate-500",children:[e.jsx($,{className:"w-10 h-10 text-slate-300 mx-auto mb-3"}),e.jsx("p",{children:"No matching jobs found right now."}),e.jsx("p",{className:"text-sm",children:"We'll notify you when relevant jobs are posted."})]})})]}):e.jsxs(H,{children:[e.jsxs(Z,{children:[e.jsxs(pe,{className:"flex items-center gap-2 text-lg",children:[e.jsx(ge,{className:"w-5 h-5 text-purple-600"}),"AI-Recommended Jobs for You"]}),e.jsx("p",{className:"text-sm text-slate-500",children:"Based on your profile, location, and expertise"})]}),e.jsx(ee,{children:e.jsx("div",{className:"space-y-4",children:r.map((t,b)=>{var u;const m=is[t.aiMatch.relevance];return e.jsx(S.div,{initial:{opacity:0,x:-20}
2,animate:{opacity:1,x:0},transition:{delay:b*.1},className:"border border-slate-200 rounded-xl p-4 hover:border-purple-300 hover:shadow-md transition-all",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("h4",{className:"font-semibold text-slate-900",children:t.title}),e.jsxs(D,{className:`${m.bg} ${m.text} border-0`,children:[e.jsx(oe,{className:"w-3 h-3 mr-1"}),t.aiMatch.score,"% Match"]})]}),e.jsxs("div",{className:"flex flex-wrap gap-3 text-sm text-slate-600 mb-3",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(de,{className:"w-3.5 h-3.5"}),t.location_city,", ",t.location_state]}),t.preferred_date&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(V,{className:"w-3.5 h-3.5"}),z(new Date(t.preferred_date),"MMM d")]}),t.budget_max&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(W,{className:"w-3.5 h-3.5"}),"Up to $",t.budget_max]})]}),((u=t.aiMatch.reasons)==null?void 0:u.length)>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.aiMatch.reasons.slice(0,3).map((h,f)=>e.jsx("span",{className:"text-xs bg-purple-50 text-purple-700 px-2 py-0.5 rounded-full",children:h},f))})]}),e.jsx("a",{href:`mailto:${t.homeowner_email}?subject=Re: ${t.title}`,children:e.jsxs(B,{size:"sm",className:"bg-purple-600 hover:bg-purple-700",children:["Contact",e.jsx(Q,{className:"w-3.5 h-3.5 ml-1"})]})})]})},t.id)})})})]})}const T=["#16a34a","#2563eb","#d97706","#9333ea","#dc2626","#0891b2","#c2410c"];function ae({title:n,icon:r,children:o}){return e.jsxs("div",{className:"bg-white rounded-2xl border border-slate-200 p-5",children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-4",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-slate-100 flex items-center justify-center",children:e.jsx(r,{className:"w-4 h-4 text-slate-600"})}),e.jsx("h3",{className:"font-semibold text-slate-900 text-sm",children:n})]}),o]})}const le=({active:n,payload:r,label:o,prefix:i="",suffix:p=""})=>!n||!(r!=null&&r.length)?null:e.jsxs("div",{className:"bg-white border border-slate-200 rounded-lg shadow-lg px-3 py-2 text-xs",children:[e.jsx("p",{className:"font-semibold text-slate-700 mb-1",children:o}),r.map(t=>e.jsxs("p",{style:{color:t.color},className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:t.color}}),t.name,": ",i,typeof t.value=="number"?t.value.toLocaleString():t.value,p]},t.name))]});function cs({jobs:n=[]}){const r=l.useMemo(()=>Array.from({length:6},(m,u)=>{const h=je(new Date,5-u);return{key:z(h,"yyyy-MM"),label:z(h,"MMM"),start:Fe(h),end:Le(h)}}),[]),o=l.useMemo(()=>r.map(({key:m,label:u,start:h,end:f})=>{const M=n.filter(a=>{if(!a.scheduled_date)return!1;try{return Ue(I(a.scheduled_date),{start:h,end:f})}catch{return!1}}),d=M.filter(a=>a.status==="completed"),O=d.reduce((a,E)=>a+(E.revenue||E.estimated_revenue||0),0),A=M.length>0?Math.round(d.length/M.length*100):0;return{month:u,revenue:O,completionRate:A,total:M.length,completed:d.length}}),[n,r]),i=l.useMemo(()=>{const m=je(new Date,6),u={};return n.forEach(h=>{if(!(!h.service_type||!h.scheduled_date)){try{if(I(h.scheduled_date)<m)return}catch{return}u[h.service_type]=(u[h.service_type]||0)+1}}),Object.entries(u).sort((h,f)=>f[1]-h[1]).slice(0,6).map(([h,f])=>({name:h,value:f}))},[n]),p=o.some(m=>m.revenue>0),t=o.some(m=>m.total>0),b=i.length>0;return!p&&!t&&!b?null:e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-base font-semibold text-slate-800",children:"Business Insights · Last 6 Months"}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[e.jsx(ae,{title:"Monthly Revenue",icon:oe,children:p?e.jsx(se,{width:"100%",height:180,children:e.jsxs(Ye,{data:o,margin:{top:4,right:4,left:0,bottom:0},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"revenueGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:"#16a34a",stopOpacity:.2}),e.jsx("stop",{offset:"95%",stopColor:"#16a34a",stopOpacity:0})]})}),e.jsx(be,{strokeDasharray:"3 3",stroke:"#f1f5f9"}),e.jsx(fe,{dataKey:"month",tick:{fontSize:11,fill:"#94a3b8"}
2,axisLine:!1,tickLine:!1}),e.jsx(ve,{tick:{fontSize:11,fill:"#94a3b8"},axisLine:!1,tickLine:!1,tickFormatter:m=>`$${m>=1e3?`${(m/1e3).toFixed(0)}k`:m}`}),e.jsx(te,{content:e.jsx(le,{prefix:"$"})}),e.jsx(Ge,{type:"monotone",dataKey:"revenue",name:"Revenue",stroke:"#16a34a",strokeWidth:2,fill:"url(#revenueGrad)",dot:{r:3,fill:"#16a34a"}})]})}):e.jsx("div",{className:"h-[180px] flex items-center justify-center text-sm text-slate-400",children:"No revenue data yet"})}),e.jsx(ae,{title:"Job Completion Rate",icon:_e,children:t?e.jsx(se,{width:"100%",height:180,children:e.jsxs(Ke,{data:o,margin:{top:4,right:4,left:0,bottom:0},children:[e.jsx(be,{strokeDasharray:"3 3",stroke:"#f1f5f9"}),e.jsx(fe,{dataKey:"month",tick:{fontSize:11,fill:"#94a3b8"},axisLine:!1,tickLine:!1}),e.jsx(ve,{tick:{fontSize:11,fill:"#94a3b8"},axisLine:!1,tickLine:!1,domain:[0,100],tickFormatter:m=>`${m}%`}),e.jsx(te,{content:e.jsx(le,{suffix:"%"})}),e.jsx(Qe,{dataKey:"completionRate",name:"Completion",fill:"#2563eb",radius:[4,4,0,0],maxBarSize:32})]})}):e.jsx("div",{className:"h-[180px] flex items-center justify-center text-sm text-slate-400",children:"No job data yet"})})]}),b&&e.jsx(ae,{title:"Top Service Types",icon:Xe,children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-6",children:[e.jsx(se,{width:180,height:180,children:e.jsxs(He,{children:[e.jsx(Ze,{data:i,cx:"50%",cy:"50%",innerRadius:48,outerRadius:72,dataKey:"value",paddingAngle:2,children:i.map((m,u)=>e.jsx(We,{fill:T[u%T.length]},u))}),e.jsx(te,{content:e.jsx(le,{})})]})}),e.jsx("div",{className:"flex-1 space-y-2 w-full",children:i.map((m,u)=>{const h=i.reduce((M,d)=>M+d.value,0),f=Math.round(m.value/h*100);return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full shrink-0",style:{background:T[u%T.length]}}),e.jsx("span",{className:"text-xs text-slate-700 flex-1 truncate",children:m.name}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-16 h-1.5 bg-slate-100 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full",style:{width:`${f}%`,background:T[u%T.length]}})}),e.jsx("span",{className:"text-xs font-medium text-slate-500 w-8 text-right",children:m.value})]})]},m.name)})})]})})]})}const os={lead:"bg-slate-100 text-slate-700",scheduled:"bg-blue-100 text-blue-700",in_progress:"bg-amber-100 text-amber-700",completed:"bg-green-100 text-green-700",cancelled:"bg-red-100 text-red-700"};function ds(n){if(!n)return"";const r=I(n);return ke(r)?"Today":Ce(r)?"Tomorrow":z(r,"EEE, MMM d")}function U({title:n,icon:r,count:o,linkTo:i,linkLabel:p,children:t,delay:b=0}){return e.jsxs(S.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:b},className:"bg-white rounded-2xl border border-slate-200 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-slate-100",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-slate-100 flex items-center justify-center",children:e.jsx(r,{className:"w-4 h-4 text-slate-600"})}),e.jsx("h3",{className:"font-semibold text-slate-900",children:n}),o!==void 0&&e.jsx(D,{className:"bg-slate-100 text-slate-600",children:o})]}),i&&e.jsxs(j,{to:i,className:"text-xs text-green-600 hover:text-green-700 font-medium flex items-center gap-1",children:[p||"View all"," ",e.jsx(Y,{className:"w-3.5 h-3.5"})]})]}),e.jsx("div",{className:"p-4",children:t})]})}function xs({contractor:n,bookings:r=[],onSwitchTab:o}){const i=n==null?void 0:n.id,[p,t]=l.useState(!1),{data:b,isLoading:m}=P({queryKey:["jobs",i],queryFn:()=>C.entities.Job.filter({contractor_id:i},"scheduled_date",50),enabled:!!i}),{data:u,isLoading:h}=P({queryKey:["leads",i],queryFn:()=>C.entities.Lead.filter({contractor_id:i},"-created_date",20),enabled:!!i}),{data:f,isLoading:M}=P({queryKey:["crewSlots",i],queryFn:()=>C.entities.CrewSlot.filter({contractor_id:i,status:"available"},"available_from",10),enabled:!!i}),{data:d,isLoading:O}=P({queryKey:["quoteRequests",i],queryFn:()=>C.entities.Bid.filter({contractor_id:i,status:"quote_requested"},"-created_date",10),enabled:!!i}),A=(b||[]).filter(s=>s.scheduled_date&&!["cancelled","completed"].includes(s.status)).filter(s=>{const c=I(s.scheduled_date);return ke(c)||Ce(c)||es(c)}).slice(0,5),a=(u||[]).filter(s=>["new","contacted","auto_responded"].includes(s.status)).slice(0,5),E=(u||[]).reduce((s,c)=>{const L=c.source||"other";return s[L]||(s[L]={total:0,won:0,revenue:0}),s[L].total++,c.status==="won"&&(s[L].won++,s[L].revenue+=c.actual_revenue||0),s},{}),w=r.filter(s=>s.status==="completed").length,g=(b||[]).filter(s=>s.status==="completed").reduce((s,c)=>s+(c.revenue||0),0);return r.filter(s=>s.status==="pending").length,e.jsxs("div",{className:"space-y-6",children:[e.jsx(S.div,{initial:{opacity:0,y:12}
2,animate:{opacity:1,y:0},className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[{label:"Quote Requests",value:(d||[]).length,icon:ue,bg:"bg-amber-50",color:"text-amber-600",hoverBorder:"hover:border-amber-400 hover:bg-amber-50",onClick:()=>window.location.href="/CRM?tab=bids"},{label:"Upcoming Jobs",value:A.length,icon:V,bg:"bg-blue-50",color:"text-blue-600",hoverBorder:"hover:border-blue-400 hover:bg-blue-50",onClick:()=>o==null?void 0:o("upcoming")},{label:"Completed",value:w,icon:_e,bg:"bg-green-50",color:"text-green-600",hoverBorder:"hover:border-green-400 hover:bg-green-50",onClick:()=>o==null?void 0:o("completed")},{label:"Revenue",value:`$${g.toLocaleString()}`,icon:W,bg:"bg-emerald-50",color:"text-emerald-600",hoverBorder:"hover:border-emerald-400 hover:bg-emerald-50",onClick:()=>o==null?void 0:o("earnings")}].map(s=>e.jsxs("button",{onClick:s.onClick,className:`bg-white rounded-xl p-4 border border-slate-200 flex items-center gap-3 transition-all hover:shadow-md ${s.hoverBorder} cursor-pointer text-left w-full`,children:[e.jsx("div",{className:`w-10 h-10 rounded-lg ${s.bg} flex items-center justify-center shrink-0`,children:e.jsx(s.icon,{className:`w-5 h-5 ${s.color}`})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xl font-bold text-slate-900",children:s.value}),e.jsx("p",{className:"text-xs text-slate-500",children:s.label})]})]},s.label))}),e.jsxs(S.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:.05},className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[e.jsxs("button",{onClick:()=>t(!0),className:"bg-green-600 text-white rounded-xl p-4 flex items-center gap-3 hover:bg-green-700 transition-colors",children:[e.jsx(G,{className:"w-5 h-5 shrink-0"}),e.jsxs("div",{className:"text-left",children:[e.jsx("p",{className:"font-semibold text-sm",children:"Add Job"}),e.jsx("p",{className:"text-xs text-green-100",children:"New appointment"})]})]}),e.jsxs(j,{to:_("JobSchedule"),className:"bg-white rounded-xl p-4 border border-slate-200 flex items-center gap-3 hover:border-blue-300 hover:shadow-sm transition-all",children:[e.jsx(ce,{className:"w-5 h-5 text-blue-600 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-sm text-slate-900",children:"Schedule"}),e.jsx("p",{className:"text-xs text-slate-500",children:"View calendar"})]})]}),e.jsxs(j,{to:_("CRM"),className:"bg-white rounded-xl p-4 border border-slate-200 flex items-center gap-3 hover:border-purple-300 hover:shadow-sm transition-all",children:[e.jsx(we,{className:"w-5 h-5 text-purple-600 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-sm text-slate-900",children:"CRM"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Leads & bids"})]})]}),e.jsxs(j,{to:_("CrewMarketplace"),className:"bg-white rounded-xl p-4 border border-slate-200 flex items-center gap-3 hover:border-amber-300 hover:shadow-sm transition-all",children:[e.jsx(Se,{className:"w-5 h-5 text-amber-600 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-sm text-slate-900",children:"Crew Slots"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Exchange"})]})]})]}),e.jsx(cs,{jobs:b||[]}),(O||d&&d.length>0)&&e.jsxs(S.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:.08},className:"bg-white rounded-2xl border border-amber-200 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-amber-100 bg-amber-50",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-amber-100 flex items-center justify-center",children:e.jsx(ue,{className:"w-4 h-4 text-amber-600"})}),e.jsx("h3",{className:"font-semibold text-slate-900",children:"Incoming Quote Requests"}),d&&d.length>0&&e.jsxs(D,{className:"bg-amber-500 text-white",children:[d.length," new"]})]}),e.jsxs(j,{to:_("CRM")+"?tab=bids",className:"text-xs text-amber-700 hover:text-amber-800 font-medium flex items-center gap-1",children:["View all ",e.jsx(Y,{className:"w-3.5 h-3.5"})]})]}),e.jsx("div",{className:"p-4 space-y-3",children:O?[...Array(2)].map((s,c)=>e.jsx(q,{className:"h-28"},c)):d==null?void 0:d.slice(0,3).map(s=>e.jsx(Ve,{bid:s,contractorId:i},s.id))})]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[e.jsx(U,{title:"Upcoming Jobs",icon:ce,count:A.length,linkTo:_("JobSchedule"),delay:.1,children:m?e.jsx("div",{className:"space-y-2",children:[...Array(3)].map((s,c)=>e.jsx(q,{className:"h-14"},c))}):A.length===0?e.jsxs("div",{className:"text-center py-6",children:[e.jsx("p",{className:"text-sm text-slate-400",children:"No jobs scheduled this week"}),e.jsxs(B,{size:"sm",className:"mt-3 bg-green-600 hover:bg-green-700 gap-1",onClick:()=>t(!0),children:[e.jsx(G,{className:"w-3.5 h-3.5"})," Add Job"]})]}):e.jsxs("div",{className:"space-y-2",children:[A.map(s=>e.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg hover:bg-slate-50 transition-colors",children:[e.jsxs("div",{className:"shrink-0 w-12 text-center",children:[e.jsx("p",{className:"text-xs font-bold text-green-600",children:ds(s.scheduled_date)}),s.scheduled_time&&e.jsx("p",{className:"text-xs text-slate-500",children:s.scheduled_time})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-slate-900 text-sm truncate",children:s.customer_name}),e.jsx("p",{className:"text-xs text-slate-500 truncate",children:s.service_type}),s.service_address&&e.jsxs("p",{className:"text-xs text-slate-400 flex items-center gap-1 mt-0.5 truncate",children:[e.jsx(de,{className:"w-3 h-3 shrink-0"}),s.service_address]})]}),e.jsx(D,{className:`${os[s.status]} text-xs shrink-0`,children:s.status.replace("_"," ")})]},s.id)),e.jsxs(j,{to:_("JobSchedule"),className:"flex items-center justify-center gap-1 text-xs text-green-600 hover:text-green-700 pt-1 font-medium",children:["View full schedule ",e.jsx(Q,{className:"w-3.5 h-3.5"})]})]})}),e.jsx(U,{title:"New Leads",icon:K,count:a.length,linkTo:_("CRM"),delay:.15,children:h?e.jsx("div",{className:"space-y-2",children:[...Array(3)].map((s,c)=>e.jsx(q,{className:"h-14"},c))}):a.length===0?e.jsx("p",{className:"text-sm text-slate-400 text-center py-6",children:"No new leads right now"}):e.jsxs("div",{className:"space-y-2",children:[a.map(s=>{var c;return e.jsxs(j,{to:`/CRM?lead=${s.id}`,className:"flex items-start gap-3 p-3 rounded-lg hover:bg-amber-50 hover:border hover:border-amber-200 border border-transparent transition-all cursor-pointer",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-green-100 flex items-center justify-center shrink-0",children:e.jsx("span",{className:"text-xs font-bold text-green-700",children:(c=s.name)==null?void 0:c.charAt(0)})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-slate-900 text-sm truncate",children:s.name}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-0.5",children:[s.project_type&&e.jsx("p",{className:"text-xs text-slate-500",children:s.project_type}),s.source&&e.jsx(D,{variant:"outline",className:"text-xs",children:s.source.replace(/_/g," ")})]})]}),e.jsxs("div",{className:"text-right shrink-0",children:[e.jsx(D,{className:s.status==="new"?"bg-red-100 text-red-700 text-xs":"bg-blue-100 text-blue-700 text-xs",children:s.status}),s.phone&&e.jsxs("p",{className:"text-xs text-slate-400 mt-1 flex items-center gap-1",children:[e.jsx(ss,{className:"w-3 h-3"}),s.phone]})]})]},s.id)}),e.jsxs(j,{to:_("CRM"),className:"flex items-center justify-center gap-1 text-xs text-green-600 hover:text-green-700 pt-1 font-medium",children:["Manage all leads ",e.jsx(Q,{className:"w-3.5 h-3.5"})]})]})}),e.jsx(U,{title:"Open Crew Slots",icon:$,count:(f||[]).length,linkTo:_("CrewMarketplace"),delay:.2,children:M?e.jsx("div",{className:"space-y-2",children:[...Array(2)].map((s,c)=>e.jsx(q,{className:"h-12"},c))}):(f||[]).length===0?e.jsxs("div",{className:"text-center py-6",children:[e.jsx("p",{className:"text-sm text-slate-400",children:"No open crew slots posted"}),e.jsx(j,{to:_("CrewMarketplace"),children:e.jsxs(B,{size:"sm",variant:"outline",className:"mt-3 gap-1",children:[e.jsx(G,{className:"w-3.5 h-3.5"})," Post a Slot"]})})]}):e.jsxs("div",{className:"space-y-2",children:[f.map(s=>e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-amber-50 border border-amber-100",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-slate-900 text-sm",children:s.trade}),e.jsxs("p",{className:"text-xs text-slate-500",children:[s.available_from&&z(I(s.available_from),"MMM d"),s.available_to&&` â ${z(I(s.available_to),"MMM d")}`,s.crew_size&&` · ${s.crew_size} crew`]})]}),s.daily_rate&&e.jsxs("p",{className:"text-sm font-semibold text-amber-700 shrink-0",children:["$",s.daily_rate,"/day"]})]},s.id)),e.jsxs(j,{to:_("CrewMarketplace"),className:"flex items-center justify-center gap-1 text-xs text-green-600 hover:text-green-700 pt-1 font-medium",children:["Crew Exchange ",e.jsx(Q,{className:"w-3.5 h-3.5"})]})]})}),e.jsx(U,{title:"Lead Performance",icon:oe,linkTo:_("CRM"),linkLabel:"Full analytics",delay:.25,children:h?e.jsx("div",{className:"space-y-2",children:[...Array(3)].map((s,c)=>e.jsx(q,{className:"h-10"},c))}):Object.keys(E).length===0?e.jsx("p",{className:"text-sm text-slate-400 text-center py-6",children:"No lead data yet"}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-3 text-xs font-semibold text-slate-500 px-1 pb-1 border-b",children:[e.jsx("span",{children:"Source"}),e.jsx("span",{className:"text-center",children:"Leads"}),e.jsx("span",{className:"text-right",children:"Won"})]}),Object.entries(E).sort((s,c)=>c[1].total-s[1].total).slice(0,5).map(([s,c])=>e.jsxs("div",{className:"grid grid-cols-3 items-center text-sm px-1",children:[e.jsx("span",{className:"capitalize text-slate-700",children:s.replace(/_/g," ")}),e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx("div",{className:"flex-1 bg-slate-100 rounded-full h-1.5 max-w-16",children:e.jsx("div",{className:"bg-green-500 h-1.5 rounded-full",style:{width:`${Math.min(100,c.total/Math.max(...Object.values(E).map(L=>L.total))*100)}%`}})}),e.jsx("span",{className:"text-slate-900 font-medium w-6 text-center",children:c.total})]}),e.jsx("span",{className:"text-right",children:c.won>0?e.jsx("span",{className:"text-green-600 font-semibold",children:c.won}):e.jsx("span",{className:"text-slate-300",children:"â"})})]},s)),e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t text-sm",children:[e.jsx("span",{className:"text-slate-500",children:"Total leads"}),e.jsx("span",{className:"font-bold text-slate-900",children:(u||[]).length})]})]})})]}),e.jsx($e,{open:p,onOpenChange:t,contractorId:i})]})}const ms=l.lazy(()=>v(()=>
2import("./UpcomingBookings-DqPQUogX.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]))),re=l.lazy(()=>v(()=>import("./BookingRequests-OIH_5CNi.js"),__vite__mapDeps([22,1,2,3,4,6,8,7,23,20,24,25,26,27,28,29,30,31,19,32,33,34,35,36,37,38,39,40,10,11,41,5,9,12,13,14,15,16,17,18,42,21]))),hs=l.lazy(()=>v(()=>import("./JobRequestsList-0OzHLH10.js"),__vite__mapDeps([43,1,2,3,4,21,13,14,16,15,19,20]))),us=l.lazy(()=>v(()=>import("./AvailabilityCalendar-CfzpJpoq.js"),__vite__mapDeps([44,1,2,3,23,20,24,25,26,27,28,29,30,31,19,32,33,34,35,45,38,7,9,8,36,37,39,40,10,11,46,47,48,21,49,12,50,51]))),ps=l.lazy(()=>v(()=>import("./BookingCalendarView-DuITWZ2P.js"),__vite__mapDeps([52,1,2,3,23,20,24,25,26,27,28,29,30,31,19,32,33,34,35,53,21,14,54]))),gs=l.lazy(()=>v(()=>import("./EarningsSummary-DKPpanMS.js"),__vite__mapDeps([55,1,2,3,21,56,57,18,58,59,60,32,61,54,24,19,20]))),js=l.lazy(()=>v(()=>import("./AccountManagement-BvutPDHP.js"),__vite__mapDeps([62,1,2,63,64,3,9,8,7,65,36,37,38,39,40,66,67,21,68,14,69,16,15,11,46,70,53,6,71,13,72,45,23,20,24,25,26,27,28,29,30,31,19,32,33,34,35,73,74,18,75,42,76,77,78,10,79,80,81,49,82,83,12,50,84]))),bs=l.lazy(()=>v(()=>import("./ReviewsManager-CYDgKrlr.js"),__vite__mapDeps([85,1,2,3,8,4,21,14,18,86,11]))),fs=l.lazy(()=>v(()=>import("./ProfilePerformance-EOrPyE_z.js"),__vite__mapDeps([87,1,2,3,88,18,21,56,57,76]))),vs=l.lazy(()=>v(()=>import("./ManageAvailabilitySlots-CWiZwq2B.js"),__vite__mapDeps([89,1,2,3,9,7,36,37,38,39,40,10,18,90,19,20,91,27,92,29]))),Ns=l.lazy(()=>v(()=>import("./InviteContractorModal-Zu73WSH1.js"),__vite__mapDeps([93,1,2,6,9,8,7,36,37,38,39,40,10,11,77]))),ys=l.lazy(()=>v(()=>import("./MatchedLeadsPanel-LoWFCb7V.js"),__vite__mapDeps([94,1,2,4,3,8,9,7,6,10,51,75,12,14,16,15,13,95,77,11,19,20,96,97]))),ws=l.lazy(()=>v(()=>import("./DashboardMapWidget-UHns1ijH.js"),__vite__mapDeps([98,1,2,99,100,101,50,102,42,15,19,20]))),_s=l.lazy(()=>v(()=>import("./ContractorAnalytics-CfJvBwUi.js"),__vite__mapDeps([103,1,2,4,51,12,58,59,104,60,105,19,20,106,54,24]))),ks=l.lazy(()=>v(()=>import("./BookingDetailModal-DwCrTpYX.js"),__vite__mapDeps([5,1,2,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]))),k=()=>e.jsx("div",{className:"py-12 flex justify-center",children:e.jsx("div",{className:"w-6 h-6 border-2 border-slate-200 border-t-slate-600 rounded-full animate-spin"})});function wt(){const n=new URLSearchParams(window.location.search),r=n.get("id"),o=n.get("booking"),i=n.get("tab")||(o?"requests":"overview"),[p,t]=l.useState(i),[b,m]=l.useState(!1),[u,h]=l.useState(null),[f,M]=l.useState(!1),[d,O]=l.useState(void 0),A=ye();l.useEffect(()=>{C.auth.me().then(O).catch(()=>O(null))},[]);const{data:a,isLoading:E}=P({queryKey:["contractor",r||(d==null?void 0:d.email)],queryFn:async()=>r?(await C.entities.Contractor.filter({id:r}))[0]:d!=null&&d.email?(await C.entities.Contractor.filter({email:d.email}))[0]:null,enabled:!!r||!!d}),w=(a==null?void 0:a.id)||r,{data:g,isLoading:s}=P({queryKey:["bookings",w],queryFn:()=>C.entities.Booking.filter({contractor_id:w},"-created_date"),enabled:!!w}),c=ne({mutationFn:({id:x,data:J})=>C.entities.Booking.update(x,J),onSuccess:()=>{A.invalidateQueries({queryKey:["bookings",w]})}}),L=ne({mutationFn:x=>C.entities.Contractor.update(w,x),onSuccess:()=>{A.invalidateQueries({queryKey:["contractor",r||(d==null?void 0:d.email)]})}});if(E||!r&&d===null)return e.jsxs("div",{className:"min-h-screen bg-slate-50",children:[e.jsx("div",{className:"h-16 bg-white border-b border-slate-200"}),e.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-8",children:[e.jsx(q,{className:"h-12 w-64 mb-8"}),e.jsx("div",{className:"grid md:grid-cols-4 gap-6",children:[...Array(4)].map((x,J)=>e.jsx(q,{className:"h-32 rounded-xl"},J))})]})]});if(!E&&!a&&(r||d))return e.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h2",{className:"text-xl font-semibold text-slate-900 mb-2",children:"No contractor profile found"}),e.jsx("p",{className:"text-slate-500 mb-4",children:"You haven't set up a contractor profile yet."}),e.jsx(j,{to:"/ContractorSignup",children:e.jsx(B,{className:"bg-green-600 hover:bg-green-700",children:"Create Your Profile"})})]})});const R=(g==null?void 0:g.filter(x=>x.status==="pending"))||[],xe=(g==null?void 0:g.filter(x=>x.status==="confirmed"))||[],F=(g==null?void 0:g.filter(x=>x.status==="completed"))||[],me=g||[],Me=(x,J)=>{c.mutate({id:x,data:{status:J}})},he=x=>{L.mutate(x)};return e.jsxs("div",{className:"min-h-screen bg-slate-50",children:[e.jsx("header",{className:"bg-white border-b border-slate-200 sticky top-0 z-30",children:e.jsx("div",{className:"max-w-7xl mx-auto px-3 sm:px-4 py-3 sm:py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(j,{to:"/",children:e.jsx(Ie,{size:"sm"})}),e.jsx("div",{className:"hidden md:block h-6 w-px bg-slate-200"}),e.jsx("span",{className:"hidden md:block text-sm font-medium text-slate-600",children:"Business Dashboard"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Re,{currentUser:a}),e.jsx(Ae,{contractorId:w}),e.jsx(j,{to:"/",children:e.jsx(B,{variant:"ghost",size:"icon",children:e.jsx(ie,{className:"w-5 h-5 text-slate-600"})})}),e.jsx(B,{variant:"ghost",size:"icon",className:"md:hidden",onClick:()=>m(!b),children:b?e.jsx(Ee,{className:"w-5 h-5"}):e.jsx(qe,{className:"w-5 h-5"})})]})]})})}),e.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-8",children:[e.jsx(ls,{items:[{label:"Contractor Dashboard"}]}),e.jsxs(S.div,{initial:{opacity:0,y:20}
2,animate:{opacity:1,y:0},className:"mb-4 sm:mb-8",children:[e.jsxs("h1",{className:"text-xl md:text-3xl font-bold text-slate-900 mb-1",children:["Welcome back, ",a==null?void 0:a.business_name]}),e.jsx("p",{className:"text-slate-600",children:"Manage your bookings, availability, and track your earnings."})]}),R.length>0&&e.jsxs(S.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},className:"mb-6 bg-amber-50 border border-amber-300 rounded-xl px-5 py-4 flex items-center justify-between gap-4 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-9 h-9 rounded-full bg-amber-100 flex items-center justify-center shrink-0",children:e.jsx(K,{className:"w-5 h-5 text-amber-600"})}),e.jsxs("div",{children:[e.jsxs("p",{className:"font-semibold text-amber-900",children:[R.length," booking",R.length!==1?"s":""," need",R.length===1?"s":""," your response"]}),e.jsx("p",{className:"text-sm text-amber-700",children:"Confirm, propose a new time, or decline each request."})]})]}),e.jsxs(B,{size:"sm",className:"bg-amber-500 hover:bg-amber-600 text-white font-semibold shrink-0",onClick:()=>{t("requests"),setTimeout(()=>{var x;(x=document.getElementById("dashboard-tabs"))==null||x.scrollIntoView({behavior:"smooth",block:"start"})},50)},children:["Review Now ",e.jsx(Y,{className:"w-4 h-4 ml-1"})]})]}),e.jsxs(S.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-8",children:[e.jsxs("button",{onClick:()=>t("requests"),className:"bg-white rounded-xl p-5 border border-slate-200 hover:border-amber-400 hover:shadow-md hover:bg-amber-50 transition-all text-left group cursor-pointer",children:[e.jsx("div",{className:"flex items-center gap-3 mb-2",children:e.jsx("div",{className:"w-10 h-10 rounded-lg bg-amber-100 flex items-center justify-center group-hover:bg-amber-200 transition-colors",children:e.jsx(K,{className:"w-5 h-5 text-amber-600"})})}),e.jsx("p",{className:"text-2xl font-bold text-slate-900",children:R.length}),e.jsx("p",{className:"text-sm text-slate-500",children:"Pending Requests"}),e.jsx("p",{className:"text-xs text-amber-600 font-medium mt-1 opacity-0 group-hover:opacity-100 transition-opacity",children:"View requests â"})]}),e.jsxs("button",{onClick:()=>t("upcoming"),className:"bg-white rounded-xl p-5 border border-slate-200 hover:border-green-400 hover:shadow-md hover:bg-green-50 transition-all text-left group cursor-pointer",children:[e.jsx("div",{className:"flex items-center gap-3 mb-2",children:e.jsx("div",{className:"w-10 h-10 rounded-lg bg-green-100 flex items-center justify-center group-hover:bg-green-200 transition-colors",children:e.jsx(V,{className:"w-5 h-5 text-green-600"})})}),e.jsx("p",{className:"text-2xl font-bold text-slate-900",children:xe.length}),e.jsx("p",{className:"text-sm text-slate-500",children:"Upcoming Jobs"}),e.jsx("p",{className:"text-xs text-green-600 font-medium mt-1 opacity-0 group-hover:opacity-100 transition-opacity",children:"View upcoming â"})]}),e.jsxs("button",{onClick:()=>t("completed"),className:"bg-white rounded-xl p-5 border border-slate-200 hover:border-blue-400 hover:shadow-md hover:bg-blue-50 transition-all text-left group cursor-pointer",children:[e.jsx("div",{className:"flex items-center gap-3 mb-2",children:e.jsx("div",{className:"w-10 h-10 rounded-lg bg-blue-100 flex items-center justify-center group-hover:bg-blue-200 transition-colors",children:e.jsx(X,{className:"w-5 h-5 text-blue-600"})})}),e.jsx("p",{className:"text-2xl font-bold text-slate-900",children:F.length}),e.jsx("p",{className:"text-sm text-slate-500",children:"Completed Jobs"}),e.jsx("p",{className:"text-xs text-blue-600 font-medium mt-1 opacity-0 group-hover:opacity-100 transition-opacity",children:"View completed â"})]}),e.jsxs("button",{onClick:()=>t("earnings"),className:"bg-white rounded-xl p-5 border border-slate-200 hover:border-purple-400 hover:shadow-md hover:bg-purple-50 transition-all text-left group cursor-pointer",children:[e.jsx("div",{className:"flex items-center gap-3 mb-2",children:e.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-100 flex items-center justify-center group-hover:bg-purple-200 transition-colors",children:e.jsx(W,{className:"w-5 h-5 text-purple-600"})})}),e.jsxs("p",{className:"text-2xl font-bold text-slate-900",children:["$",F.length*((a==null?void 0:a.hourly_rate_min)||50)*4]}),e.jsx("p",{className:"text-sm text-slate-500",children:"Est. Earnings"}
2),e.jsx("p",{className:"text-xs text-purple-600 font-medium mt-1 opacity-0 group-hover:opacity-100 transition-opacity",children:"View earnings â"})]})]}),e.jsxs(S.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4 mb-8",children:[e.jsxs("button",{onClick:()=>t("leads"),className:"bg-white rounded-xl p-4 border border-amber-200 hover:border-amber-400 hover:shadow-md transition-all flex items-center gap-3 text-left",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-amber-100 flex items-center justify-center",children:e.jsx($,{className:"w-5 h-5 text-amber-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-slate-900",children:"Matched Leads"}),e.jsx("p",{className:"text-xs text-slate-500",children:"New job matches"})]})]}),e.jsxs(j,{to:"/CRM",className:"bg-white rounded-xl p-4 border border-slate-200 hover:border-green-300 hover:shadow-md transition-all flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-green-100 flex items-center justify-center",children:e.jsx(we,{className:"w-5 h-5 text-green-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-slate-900",children:"CRM"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Leads & Bids"})]})]}),e.jsxs(j,{to:"/Messages",className:"bg-white rounded-xl p-4 border border-slate-200 hover:border-blue-300 hover:shadow-md transition-all flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-blue-100 flex items-center justify-center",children:e.jsx(Oe,{className:"w-5 h-5 text-blue-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-slate-900",children:"Messages"}),e.jsx("p",{className:"text-xs text-slate-500",children:"View conversations"})]})]}),e.jsxs(j,{to:`/ContractorProfile?id=${w}`,className:"bg-white rounded-xl p-4 border border-slate-200 hover:border-purple-300 hover:shadow-md transition-all flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-100 flex items-center justify-center",children:e.jsx(ts,{className:"w-5 h-5 text-purple-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-slate-900",children:"View Profile"}),e.jsx("p",{className:"text-xs text-slate-500",children:"See public view"})]})]}),e.jsxs("button",{onClick:()=>t("availability"),className:"bg-white rounded-xl p-4 border border-slate-200 hover:border-amber-300 hover:shadow-md transition-all flex items-center gap-3 text-left",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-amber-100 flex items-center justify-center",children:e.jsx(V,{className:"w-5 h-5 text-amber-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-slate-900",children:"Availability"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Update schedule"})]})]}),e.jsxs("button",{onClick:()=>M(!0),className:"bg-white rounded-xl p-4 border border-slate-200 hover:border-green-300 hover:shadow-md transition-all flex items-center gap-3 text-left",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-green-100 flex items-center justify-center",children:e.jsx(Pe,{className:"w-5 h-5 text-green-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-slate-900",children:"Invite a Contractor"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Grow your network"})]})]})]}),e.jsx(S.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.25},className:"mb-6",children:e.jsx(rs,{contractor:a,contractorId:w})}),e.jsx(S.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.3},className:"mb-8",children:e.jsx(ns,{contractor:a})}),e.jsxs(Te,{id:"dashboard-tabs",value:p,onValueChange:t,className:"space-y-6",children:[e.jsxs(De,{className:"bg-white border border-slate-200 p-1 h-auto flex overflow-x-auto w-full scrollbar-hide gap-1",children:[e.jsxs(N,{value:"overview",className:"data-[state=active]:bg-slate-100",children:[e.jsx(ie,{className:"w-4 h-4 mr-2"}),"Overview"]}),e.jsxs(N,{value:"leads",className:"data-[state=active]:bg-slate-100",children:[e.jsx($,{className:"w-4 h-4 mr-2 text-amber-500"}),"Matched Leads"]}),e.jsxs(N,{value:"upcoming",className:"data-[state=active]:bg-slate-100",children:[e.jsx(V,{className:"w-4 h-4 mr-2"}),"Upcoming"]}),e.jsxs(N,{value:"requests",className:"data-[state=active]:bg-slate-100 relative",children:[e.jsx(K,{className:"w-4 h-4 mr-2"}),"Requests",R.length>0&&e.jsx("span",{className:"ml-2 px-2 py-0.5 bg-red-500 text-white text-xs rounded-full",children:R.length})]}),e.jsxs(N,{value:"calendar",className:"data-[state=active]:bg-slate-100",children:[e.jsx(ce,{className:"w-4 h-4 mr-2"}),"Calendar"]}),e.jsxs(N,{value:"availability",className:"data-[state=active]:bg-slate-100",children:[e.jsx(X,{className:"w-4 h-4 mr-2"}),"Availability"]}),e.jsxs(N,{value:"earnings",className:"data-[state=active]:bg-slate-100",children:[e.jsx(W,{className:"w-4 h-4 mr-2"}),"Earnings"]}),e.jsxs(N,{value:"reviews",className:"data-[state=active]:bg-slate-100",children:[e.jsx(Be,{className:"w-4 h-4 mr-2"}),"Reviews"]}),e.jsxs(N,{value:"analytics",className:"data-[state=active]:bg-slate-100",children:[e.jsx(Ne,{className:"w-4 h-4 mr-2"}),"Analytics"]}),e.jsxs(N,{value:"performance",className:"data-[state=active]:bg-slate-100",children:[e.jsx(Ne,{className:"w-4 h-4 mr-2"}),"Performance"]}),e.jsxs(N,{value:"map",className:"data-[state=active]:bg-slate-100",children:[e.jsx(de,{className:"w-4 h-4 mr-2"}),"Job Map"]}),e.jsxs(N,{value:"completed",className:"data-[state=active]:bg-slate-100",children:[e.jsx(X,{className:"w-4 h-4 mr-2"}),"Completed"]}),e.jsxs(N,{value:"account",className:"data-[state=active]:bg-slate-100",children:[e.jsx(as,{className:"w-4 h-4 mr-2"}),"Account"]})]}),e.jsx(y,{value:"leads",children:e.jsx(l.Suspense,{fallback:e.jsx(k,{}),children:a&&e.jsx(ys,{contractor:a})})}),e.jsx(y,{value:"overview",children:e.jsx(xs,{contractor:a,bookings:g||[],onSwitchTab:t})}),e.jsx(y,{value:"upcoming",children:e.jsx(l.Suspense,{fallback:e.jsx(k,{}),children:e.jsx(ms,{bookings:xe,isLoading:s,onStatusChange:Me})})}),e.jsx(y,{value:"requests",children:e.jsx(l.Suspense,{fallback:e.jsx(k,{}),children:e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Pending Requests"}),R.length>0&&e.jsxs("span",{className:"px-2.5 py-0.5 bg-amber-100 text-amber-700 text-sm font-semibold rounded-full",children:[R.length," need response"]})]}),e.jsx(re,{bookings:R,isLoading:s,contractor:a})]}),me.filter(x=>x.status!=="pending").length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-slate-900 mb-4",children:"All Other Bookings"}),e.jsx(re,{bookings:me.filter(x=>x.status!=="pending"),isLoading:s,contractor:a})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-slate-900 mb-4",children:"Open Job Requests"}),e.jsx(hs,{contractor:a})]})]})})}),e.jsx(y,{value:"calendar",children:e.jsx(l.Suspense,{fallback:e.jsx(k,{}),children:e.jsx(ps,{bookings:g||[],onBookingClick:x=>{h(x),x.status==="pending"&&t("requests")}})})}),e.jsx(y,{value:"availability",children:e.jsx(l.Suspense,{fallback:e.jsx(k,{}),children:e.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[e.jsx(us,{contractor:a,bookings:g||[],onUpdate:he,isUpdating:L.isPending}),e.jsx(vs,{contractor:a})]})})}),e.jsx(y,{value:"earnings",children:e.jsx(l.Suspense,{fallback:e.jsx(k,{}),children:e.jsx(gs,{bookings:g||[],contractor:a})})}),e.jsx(y,{value:"reviews",children:e.jsx(l.Suspense,{fallback:e.jsx(k,{}),children:e.jsx(bs,{contractorId:w,contractor:a})})}),e.jsx(y,{value:"analytics",children:e.jsx(l.Suspense,{fallback:e.jsx(k,{}),children:e.jsx(_s,{contractor:a,bookings:g||[]})})}),e.jsx(y,{value:"performance",children:e.jsx(l.Suspense,{fallback:e.jsx(k,{}),children:e.jsx(fs,{contractor:a,bookings:g||[]})})}),e.jsx(y,{value:"map",children:e.jsx(l.Suspense,{fallback:e.jsx(k,{}),children:a&&e.jsx(ws,{contractorId:w,contractorEmail:a.email})})}),e.jsx(y,{value:"completed",children:e.jsx(l.Suspense,{fallback:e.jsx(k,{}),children:e.jsxs("div",{children:[e.jsxs("h3",{className:"text-lg font-semibold text-slate-900 mb-4",children:["Completed Jobs (",F.length,")"]}),e.jsx(re,{bookings:F,isLoading:s,contractor:a})]})})}),e.jsx(y,{value:"account",children:e.jsx(l.Suspense,{fallback:e.jsx(k,{}
2),children:e.jsx(js,{contractor:a,onUpdate:he,isUpdating:L.isPending})})})]})]}),e.jsxs(l.Suspense,{fallback:null,children:[e.jsx(Ns,{open:f,onOpenChange:M,inviterContractor:a}),e.jsx(ks,{booking:u,open:!!u,onOpenChange:x=>!x&&h(null)})]})]})}export{wt as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.