1import{m as q,as as ee,j as e,aZ as He,a_ as Ee,a$ as Re,b0 as Le,e as A,aY as L,b1 as Pe,Z as Fe,g as Ge,aA as Oe,b3 as Ie,B as r,ac as U,aW as ze,bO as We,bP as Ve,aI as M,am as ce,cA as de,bQ as $e,b6 as Be,af as Qe,i as _,b5 as _e,b7 as pe,b8 as be,b9 as fe,aF as je,E as ve,G as ye,I as N,J as Ne,b2 as we,p as Ce,q as ke,r as Me,cB as De,s as Ae,a5 as c,b4 as g,a4 as me,C as H,b as E,K as J,d as R,l as Ye,W as qe,aM as Ke,Q as Ze,R as Ue,c as V,bh as xe,aO as he,L as $,_ as Je,$ as Xe,a0 as es,a1 as ss,a2 as T,aD as as}from"./index-Byg2HWAE.js";import{r as i}from"./vendor-Qgthw7N1.js";import{u as ts}from"./useIntegrations-CUanp7GW.js";import{S as Se,a as X}from"./index-Bs2JGf-v.js";import{P as rs,C as ge}from"./CalendarStatusLegend-BpVkF9GW.js";import{F as ns,i as is,a as ls,b as os,c as cs}from"./index-COtV6X2D.js";import{C as D}from"./checkbox-Cqr9jids.js";import{G as ds}from"./grid-3x3-Dl22D3mL.js";import{F as Y}from"./filter-ejjrE0l5.js";import{I as ms}from"./info-B94Hlx1u.js";import{A as xs}from"./activity-DlNiJWQy.js";import{M as hs}from"./message-circle-CEbsxAUX.js";import"./calendarService-CrpjTGeC.js";const gs={gmail:{name:"Gmail",icon:X,color:"text-red-600",bgColor:"bg-red-50",borderColor:"border-red-200",description:"Connect your Gmail account to automatically track email activities",features:["Automatic email activity detection","AI-powered categorization","Secure OAuth 2.0 authentication","Real-time sync"]},"google-calendar":{name:"Google Calendar",icon:Se,color:"text-blue-600",bgColor:"bg-blue-50",borderColor:"border-blue-200",description:"Sync your Google Calendar to track scheduled real estate activities",features:["Calendar event tracking","Automatic time entry creation","AI activity classification","Seamless integration"]},"microsoft-mail":{name:"Microsoft Outlook",icon:ee,color:"text-blue-700",bgColor:"bg-blue-50",borderColor:"border-blue-200",description:"Connect Outlook to track email communications",features:["Email activity monitoring","Smart categorization","Enterprise-grade security","Real-time updates"]},"microsoft-calendar":{name:"Microsoft Calendar",icon:q,color:"text-blue-700",bgColor:"bg-blue-50",borderColor:"border-blue-200",description:"Sync Microsoft Calendar for comprehensive activity tracking",features:["Event-based tracking","Auto time logging","AI-powered insights","Bi-directional sync"]}};function B({open:t,onOpenChange:n,integrationType:m,isConnected:l,isLoading:x,onConnect:d,onDisconnect:b}){const a=gs[m],f=a.icon;return e.jsx(He,{open:t,onOpenChange:n,children:e.jsxs(Ee,{className:"sm:max-w-[500px]",children:[e.jsxs(Re,{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:`w-12 h-12 rounded-xl ${a.bgColor} border ${a.borderColor} flex items-center justify-center`,children:e.jsx(f,{className:`w-6 h-6 ${a.color}`})}),e.jsxs("div",{children:[e.jsxs(Le,{className:"text-xl",children:[l?"Disconnect":"Connect"," ",a.name]}),l&&e.jsxs(A,{variant:"outline",className:"mt-1 bg-green-50 text-green-700 border-green-300",children:[e.jsx(L,{className:"w-3 h-3 mr-1"}),"Connected"]})]})]}),e.jsx(Pe,{className:"text-base pt-2",children:a.description})]}),!l&&e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{className:"text-sm font-semibold text-gray-700 dark:text-gray-300 flex items-center gap-2",children:[e.jsx(Fe,{className:"w-4 h-4 text-yellow-500"}),"What you'll get:"]}),e.jsx("ul",{className:"space-y-2",children:a.features.map((o,w)=>e.jsxs("li",{className:"flex items-start gap-2 text-sm text-gray-600 dark:text-gray-400",children:[e.jsx(L,{className:"w-4 h-4 text-green-600 mt-0.5 flex-shrink-0"}),e.jsx("span",{children:o})]},w))})]}),e.jsx("div",{className:"bg-slate-50 dark:bg-slate-900 border border-slate-200 dark:border-slate-700 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-slate-100 dark:bg-slate-800 flex items-center justify-center flex-shrink-0",children:e.jsx(Ge,{className:"w-4 h-4 text-slate-600 dar
1k:text-slate-400"})}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{className:"text-sm font-medium text-slate-900 dark:text-slate-100 flex items-center gap-2",children:[e.jsx(Oe,{className:"w-3 h-3"}),"Secure OAuth 2.0"]}),e.jsx("p",{className:"text-xs text-slate-600 dark:text-slate-400",children:"Your credentials are never stored. All data is encrypted end-to-end."})]})]})})]}),l&&e.jsx("div",{className:"py-6",children:e.jsx("div",{className:"bg-amber-50 dark:bg-amber-950 border border-amber-200 dark:border-amber-800 rounded-lg p-4",children:e.jsxs("p",{className:"text-sm text-amber-800 dark:text-amber-200",children:[e.jsx("strong",{children:"Warning:"})," Disconnecting will stop automatic tracking from this integration. Your existing time entries will not be affected."]})})}),e.jsxs(Ie,{children:[e.jsx(r,{variant:"outline",onClick:()=>n(!1),disabled:x,children:"Cancel"}),l?e.jsx(r,{variant:"destructive",onClick:b,disabled:x,children:x?e.jsxs(e.Fragment,{children:[e.jsx(U,{className:"w-4 h-4 mr-2 animate-spin"}),"Disconnecting..."]}):"Disconnect"}):e.jsx(r,{onClick:d,disabled:x,className:"bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-700 hover:to-blue-800",children:x?e.jsxs(e.Fragment,{children:[e.jsx(U,{className:"w-4 h-4 mr-2 animate-spin"}),"Connecting..."]}):e.jsxs(e.Fragment,{children:[e.jsx(f,{className:"w-4 h-4 mr-2"}),"Connect ",a.name]})})]})]})})}const us={gmail:{name:"Gmail",icon:X,color:"text-red-600",bgConnected:"bg-red-50 hover:bg-red-100",bgDisconnected:"bg-gray-50 hover:bg-gray-100",borderConnected:"border-red-200",borderDisconnected:"border-gray-200"},"google-calendar":{name:"Google Calendar",icon:Se,color:"text-blue-600",bgConnected:"bg-blue-50 hover:bg-blue-100",bgDisconnected:"bg-gray-50 hover:bg-gray-100",borderConnected:"border-blue-200",borderDisconnected:"border-gray-200"},"microsoft-mail":{name:"Outlook Mail",icon:ee,color:"text-blue-700",bgConnected:"bg-blue-50 hover:bg-blue-100",bgDisconnected:"bg-gray-50 hover:bg-gray-100",borderConnected:"border-blue-200",borderDisconnected:"border-gray-200"},"microsoft-calendar":{name:"Microsoft Calendar",icon:q,color:"text-blue-700",bgConnected:"bg-blue-50 hover:bg-blue-100",bgDisconnected:"bg-gray-50 hover:bg-gray-100",borderConnected:"border-blue-200",borderDisconnected:"border-gray-200"},imap:{name:"Gmail (IMAP)",icon:X,color:"text-red-600",bgConnected:"bg-red-50 hover:bg-red-100",bgDisconnected:"bg-gray-50 hover:bg-gray-100",borderConnected:"border-red-200",borderDisconnected:"border-gray-200"}};function Q({type:t,isConnected:n,isLoading:m,onClick:l,className:x,iconOnly:d=!1,credentialValid:b=!0}){const a=us[t],f=a.icon,o=n&&!b;return e.jsx(ze,{children:e.jsxs(We,{delayDuration:200,children:[e.jsx(Ve,{asChild:!0,children:e.jsxs(r,{variant:"ghost",size:"sm",onClick:l,disabled:m,className:M("relative group transition-all duration-200",o?"bg-amber-50 hover:bg-amber-100 border-amber-200":n?a.bgConnected:a.bgDisconnected,o?"border-amber-200":n?a.borderConnected:a.borderDisconnected,"border",d&&"p-2",x),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:M("relative",m&&"animate-pulse"),children:[e.jsx(f,{className:M(d?"w-5 h-5":"w-4 h-4",o?"text-amber-600":n?a.color:"text-gray-400")}),!m&&!o&&e.jsx("div",{className:M("absolute -top-1 -right-1 w-2 h-2 rounded-full border-2 border-white",n?"bg-green-500":"bg-gray-300")}),!m&&o&&e.jsx("div",{className:"absolute -top-1.5 -right-1.5 w-3 h-3 rounded-full bg-amber-400 border-2 border-white flex items-center justify-center",children:e.jsx("span",{className:"text-[8px] font-bold text-white leading-none",children:"!"})})]}),m&&!d&&e.jsx(U,{className:"w-3 h-3 animate-spin text-gray-500"}),!m&&!d&&e.jsx(A,{variant:"outline",className:M("text-xs font-medium border-0",o?"bg-amber-100 text-amber-700":n?"bg-green-100 text-green-700":"bg-gray-100 text-gray-600"),children:o?e.jsxs(e.Fragment,{children:[e.jsx(ce,{className:"w-3 h-3 mr-1"}),"Reconnect"]}):n?e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"w-3 h-3 mr-1"}),"Connected"]}):e.jsxs(e.Fragment,{children:[e.jsx(de,{className:"w-3 h-3 mr-1"}),"Connect"]})})]}),!m&&e.jsx("div",{className:M("absolute inset-0 rounded-md opacity-0 group-hover:opacity-100 transition-opacity","bg-gradient-to-r",o?"from-amber-400/10 to-orange-400/10":n?"from-green-400/10 to-blue-400/10":"from-blue-400/10 to-purple-400/10")})]})}),e.jsx($e,{side:"top",className:"max-w-xs",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"font-semibold text-sm flex items-center gap-2",children:o?e.jsxs(e.Fragment,{children:[e.jsx(ce,{className:"w-4 h-4 text-amber-500"}),a.name," â Credentials Expired"]}):n?e.jsxs(e.Fragment,{children:[e.jsx(rs,{className:"w-4 h-4 text-green-500"}),a.name," Connected"]}):e.jsxs(e.Fragment,{children:[e.jsx(de,{className:"w-4 h-4 text-gray-400"}),"Connect ",a.name]})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:o?"Your stored Gmail App Password was revoked. Click to reconnect.":n?"Click to disconnect or manage settings":"Click to connect and start automatic tracking"})]})})]})})}const v=[{id:"1",title:"Property Showing - 123 Main St",start:c(new Date,"yyyy-MM-dd HH:mm:ss"),duration:2.5,description:"Showing property to potential tenants",aiConfidence:95,status:"approved",hasLedgerEntry:!0,location:"123 Main St"},{id:"2",title:"Tenant Meeting - Oak Ave Apartments",start:c(g(new Date,1),"yyyy-MM-dd HH:mm:ss"),duration:1.5,description:"Monthly tenant check-in meeting",aiConfidence:87,status:"approved",hasLedgerEntry:!1},{id:"3",title:"Maintenance Review",start:c(g(new Date,2),"yyyy-MM-dd HH:mm:ss"),duration:3,description:"Reviewing maintenance requests and scheduling repairs",aiConfidence:72,status:"pending",hasLedgerEntry:!0},{id:"4",title:"Vendor Meeting - HVAC Contractor",start:c(g(new Date,3),"yyyy-MM-dd HH:mm:ss"),duration:1,description:"Discussing HVAC replacement quotes",aiConfidence:68,status:"pending",hasLedgerEntry:!1}
1,{id:"5",title:"Property Inspection - Elm Street",start:c(me(new Date,1),"yyyy-MM-dd HH:mm:ss"),duration:2,description:"Annual property inspection",aiConfidence:45,status:"available",hasLedgerEntry:!1},{id:"6",title:"Lease Signing Appointment",start:c(me(new Date,2),"yyyy-MM-dd HH:mm:ss"),duration:1.5,description:"New tenant lease signing",aiConfidence:38,status:"available",hasLedgerEntry:!1},{id:"7",title:"Budget Review Meeting",start:c(g(new Date,5),"yyyy-MM-dd HH:mm:ss"),duration:2.5,description:"Quarterly budget and expense review",aiConfidence:92,status:"approved",hasLedgerEntry:!0},{id:"8",title:"Property Walk-through",start:c(g(new Date,7),"yyyy-MM-dd HH:mm:ss"),duration:1.5,description:"Walk-through with potential buyer",aiConfidence:25,status:"available",hasLedgerEntry:!1}],ue=[{id:"1",name:"Google Calendar - Primary",backgroundColor:"#1e88e5",isPrimary:!0},{id:"2",name:"Microsoft Calendar - Work",backgroundColor:"#0078d4",isPrimary:!1}];function ps(){const t=i.useRef(null),[n,m]=i.useState("approved"),[l,x]=i.useState("dayGridMonth"),[d,b]=i.useState(!0),[a,f]=i.useState([]),[o,w]=i.useState(!1),[K,j]=i.useState(""),P=i.useMemo(()=>v.map(s=>({id:s.id,title:s.title,start:s.start,end:new Date(new Date(s.start).getTime()+s.duration*60*60*1e3).toISOString(),extendedProps:{...s,aiConfidence:s.aiConfidence,status:s.status,hasLedgerEntry:s.hasLedgerEntry,description:s.description},backgroundColor:s.status==="approved"?"#10b981":s.status==="pending"?"#f59e0b":"#3b82f6",borderColor:s.status==="approved"?"#059669":s.status==="pending"?"#d97706":"#2563eb"})),[]);i.useEffect(()=>{if(t.current){const s=t.current.getApi();j(s.view.title)}},[l]);const C=i.useMemo(()=>({all:v.length,approved:v.filter(s=>s.status==="approved").length,pending:v.filter(s=>s.status==="pending").length,available:v.filter(s=>s.status==="available").length}),[]),S=i.useMemo(()=>{switch(n){case"approved":return v.filter(s=>s.status==="approved");case"pending":return v.filter(s=>s.status==="pending");case"available":return v.filter(s=>s.status==="available");case"all":default:return v}},[n]),F=()=>{if(t.current){const s=t.current.getApi();s.prev(),j(s.view.title)}},Z=()=>{if(t.current){const s=t.current.getApi();s.next(),j(s.view.title)}},G=()=>{if(t.current){const s=t.current.getApi();s.today(),j(s.view.title)}},k=s=>{if(x(s),t.current){const u=t.current.getApi();u.changeView(s),j(u.view.title)}},O=()=>{b(!d)},I=s=>{if(d){b(!1);const u=ue.map(h=>h.id);f(u.filter(h=>h!==s))}else f(u=>u.includes(s)?u.filter(h=>h!==s):[...u,s])},z=()=>{w(!0),setTimeout(()=>w(!1),1e3)};return e.jsxs("div",{className:"flex flex-col h-full space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 pb-2 border-b",children:[e.jsxs("div",{className:"flex items-center gap-1 border rounded-md p-0.5",children:[e.jsx(r,{variant:"ghost",size:"sm",onClick:G,className:"h-7 px-2 text-xs",children:"Today"}),e.jsx("div",{className:"w-px h-4 bg-border"}),e.jsx(r,{variant:"ghost",size:"icon",onClick:F,className:"h-7 w-7",children:e.jsx(Be,{className:"h-4 w-4"})}),e.jsx(r,{variant:"ghost",size:"icon",onClick:Z,className:"h-7 w-7",children:e.jsx(Qe,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex items-center gap-1 border rounded-md p-0.5",children:[e.jsxs(r,{variant:l==="dayGridMonth"?"secondary":"ghost",size:"sm",onClick:()=>k("dayGridMonth"),className:"h-7 px-2 text-xs",children:[e.jsx(ds,{className:"h-3.5 w-3.5 mr-1"}),"Month"]}),e.jsxs(r,{variant:l==="timeGridWeek"?"secondary":"ghost",size:"sm",onClick:()=>k("timeGridWeek"),className:"h-7 px-2 text-xs",children:[e.jsx(q,{className:"h-3.5 w-3.5 mr-1"}),"Week"]}),e.jsxs(r,{variant:l==="timeGridDay"?"secondary":"ghost",size:"sm",onClick:()=>k("timeGridDay"),className:"h-7 px-2 text-xs",children:[e.jsx(_,{className:"h-3.5 w-3.5 mr-1"}),"Day"]}),e.jsxs(r,{variant:l==="listWeek"?"secondary":"ghost",size:"sm",onClick:()=>k("listWeek"),className:"h-7 px-2 text-xs",children:[e.jsx(_e,{className:"h-3.5 w-3.5 mr-1"}),"List"]})]}),e.jsxs(pe,{children:[e.jsx(be,{asChild:!0,children:e.jsxs(r,{variant:"outline",size:"sm",className:"h-7 px-2 gap-1.5 text-xs",children:[e.jsx(Y,{className:"h-3.5 w-3.5"}),"Calendars",!d&&a.length>0&&e.jsx(A,{variant:"secondary",className:"ml-1 h-4 px-1 text-xs",children:a.length})]})}),e.jsx(fe,{className:"w-80",align:"end",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"font-semibold text-sm",children:"Select Calendars"}),e.jsxs("div",{className:"flex items-center space-x-2 pb-2 border-b",children:[e.jsx(D,{id:"show-all",checked:d,onCheckedChange:O}),e.jsx("label",{htmlFor:"show-all",className:"text-sm cursor-pointer flex-1",children:"Show all calendars"})]}),e.jsx("div",{className:"space-y-1",children:ue.map(s=>e.jsxs("div",{className:"flex items-center space-x-2 p-2 hover:bg-muted rounded cursor-pointer",onClick:()=>
1I(s.id),children:[e.jsx(D,{id:s.id,checked:d||a.includes(s.id),onCheckedChange:()=>I(s.id)}),e.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0",style:{backgroundColor:s.backgroundColor}}),e.jsxs("label",{htmlFor:s.id,className:"text-sm cursor-pointer flex-1",children:[s.name,s.isPrimary&&e.jsx(A,{variant:"outline",className:"ml-1.5 text-xs h-4 px-1",children:"Primary"})]})]},s.id))})]})})]}),e.jsxs(r,{variant:"outline",size:"sm",onClick:z,disabled:o,className:"h-7 px-2 gap-1.5 text-xs",children:[e.jsx(je,{className:`h-3.5 w-3.5 ${o?"animate-spin":""}`}),"Refresh"]})]}),l!=="listWeek"?e.jsx("div",{className:"flex-1",children:e.jsx(ns,{ref:t,plugins:[is,ls,os,cs],initialView:"dayGridMonth",headerToolbar:!1,height:"auto",events:P,eventClick:s=>{},datesSet:s=>{j(s.view.title)},aspectRatio:1.8,expandRows:!1,fixedWeekCount:!1,showNonCurrentDates:!1,handleWindowResize:!0,eventDisplay:"block",dayMaxEvents:3,moreLinkClick:"popover",eventTimeFormat:{hour:"numeric",minute:"2-digit",meridiem:"short"},slotLabelFormat:{hour:"numeric",minute:"2-digit",meridiem:"short"},eventContent:s=>e.jsx("div",{className:"flex items-center overflow-hidden px-1",children:e.jsxs("span",{className:"truncate text-xs",children:[s.timeText&&e.jsxs("span",{className:"font-semibold",children:[s.timeText," "]}),s.event.title]})})})}):e.jsx("div",{className:"flex-1 flex flex-col h-full overflow-auto",children:e.jsxs(ve,{value:n,onValueChange:s=>m(s),className:"w-full flex flex-col flex-1",children:[e.jsxs(ye,{className:"rounded-xl p-6",children:[e.jsxs(N,{value:"approved",className:"text-xs normal-case p-2 rounded-sm data-[state=active]:bg-white data-[state=active]:text-black data-[state=active]:shadow-black text-gray-600 hover:text-gray-800",children:["Approved (",C.approved,")"]}),e.jsxs(N,{value:"pending",className:"text-xs normal-case p-2 rounded-sm data-[state=active]:bg-white data-[state=active]:text-black data-[state=active]:shadow-black text-gray-600 hover:text-gray-800",children:["Pending Approval (",C.pending,")"]}),e.jsxs(N,{value:"available",className:"text-xs normal-case p-2 rounded-sm data-[state=active]:bg-white data-[state=active]:text-black data-[state=active]:shadow-black text-gray-600 hover:text-gray-800",children:["Available to Convert (",C.available,")"]}),e.jsxs(N,{value:"all",className:"text-xs normal-case p-2 rounded-md data-[state=active]:bg-white data-[state=active]:text-black data-[state=active]:shadow-black text-gray-600 hover:text-gray-800",children:["All Events (",C.all,")"]})]}),e.jsx(Ne,{value:n,className:"mt-3 flex-1 overflow-hidden",children:e.jsx(we,{className:"h-full w-full",children:e.jsx("div",{className:"space-y-1.5 pr-4",children:S.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground text-sm",children:"No events found for this filter"}):e.jsx(Ce,{type:"single",collapsible:!0,className:"w-full",children:S.map(s=>e.jsxs(ke,{value:s.id,className:"[&_h3]:m-2 text-xs hover:bg-muted/50 rounded-md cursor-pointer transition-colors border border-border/30 mb-2",children:[e.jsxs(Me,{className:"normal-case text-left px-2 py-1 hover:no-underline gap-3",children:[e.jsx("div",{className:"grow-0",children:e.jsx("div",{className:`h-2 w-2 rounded-full ${s.status==="approved"?"bg-green-500":s.status==="pending"?"bg-amber-500":"bg-blue-500"}`})}),e.jsxs("div",{className:"grow flex items-center overflow-hidden",children:[e.jsx("span",{className:"font-semibold text-xs mr-1 flex-shrink-0",children:s.title}),e.jsxs("span",{className:"text-xs text-muted-foreground flex-shrink-0 data-[state=open]:text-white",children:["-"," ",s.description]})]}),e.jsxs("div",{className:"grow-0",children:[s.status==="approved"&&e.jsx(L,{className:"h-4 w-4 text-green-600"}),s.status==="pending"&&e.jsx(_,{className:"h-4 w-4 text-amber-600"}),s.status==="available"&&e.jsx(Y,{className:"h-4 w-4 text-blue-600"})]}),e.jsx("div",{className:"grow-0 text-xs text-muted-foreground flex-shrink-0",children:De(s.start)})]}),e.jsxs(Ae,{className:"px-4 py-1 text-xs",children:[e.jsxs("p",{children:[e.jsx("span",{className:"font-semibold mr-1",children:"Event Title:"}),s.title]}),e.jsxs("p",{children:[e.jsx("span",{className:"font-semibold mr-1",children:"Description:"}),s.description]}),e.jsxs("div",{className:"w-full flex justify-end gap-3 mb-2",children:[e.jsx(r,{size:"sm",className:"h-7 px-2 gap-1.5 text-xs bg-green-600",children:"Approved"}),e.jsx(r,{size:"sm",className:"h-7 px-2 gap-1.5 text-xs bg-red-600",children:"Reject"}),e.jsx(r,{size:"sm",className:"h-7 px-2 gap-1.5 text-xs bg-blue-600",children:"Convert"})]})]})]},s.id))})})})})]})})]})}const y=[{id:"1",subject:"Re: Lease renewal for 456 Oak Avenue",snippet:"Thank y
1ou for the lease renewal documents. I have reviewed the terms and am happy to proceed...",participants:["[email protected]"],lastMessageDate:c(new Date,"yyyy-MM-dd HH:mm:ss"),timeHoursEstimate:.5,aiConfidence:94,status:"approved",hasLedgerEntry:!0,aiReasoning:"High confidence: Lease renewal discussion with tenant",source:"gmail"},{id:"2",subject:"Maintenance Request - Water Heater",snippet:"The water heater in unit 3B is making strange noises and not heating properly...",participants:["[email protected]"],lastMessageDate:c(g(new Date,1),"yyyy-MM-dd HH:mm:ss"),timeHoursEstimate:1,aiConfidence:91,status:"approved",hasLedgerEntry:!1,aiReasoning:"High confidence: Maintenance coordination",source:"gmail"},{id:"3",subject:"Invoice for Property Management - March 2025",snippet:"Please find attached the invoice for property management services for the month of March...",participants:["[email protected]"],lastMessageDate:c(g(new Date,2),"yyyy-MM-dd HH:mm:ss"),timeHoursEstimate:.75,aiConfidence:75,status:"pending",hasLedgerEntry:!0,aiReasoning:"Moderate confidence: Invoice review and processing",source:"outlook"},{id:"4",subject:"Tenant Application - Unit 7A",snippet:"I am interested in renting unit 7A. Attached is my completed application and references...",participants:["[email protected]"],lastMessageDate:c(g(new Date,3),"yyyy-MM-dd HH:mm:ss"),timeHoursEstimate:1.5,aiConfidence:68,status:"pending",hasLedgerEntry:!1,aiReasoning:"Moderate confidence: Tenant screening and application review",source:"gmail"}
1,{id:"5",subject:"Property Inspection Report",snippet:"The annual inspection has been completed. Here is the detailed report with photos...",participants:["[email protected]"],lastMessageDate:c(g(new Date,4),"yyyy-MM-dd HH:mm:ss"),timeHoursEstimate:2,aiConfidence:42,status:"available",hasLedgerEntry:!1,aiReasoning:"Low-moderate confidence: Property inspection follow-up",source:"outlook"},{id:"6",subject:"Contractor Quote - Roof Repair",snippet:"Based on our site visit, here is the quote for the roof repair work...",participants:["[email protected]"],lastMessageDate:c(g(new Date,5),"yyyy-MM-dd HH:mm:ss"),timeHoursEstimate:.5,aiConfidence:38,status:"available",hasLedgerEntry:!1,aiReasoning:"Low-moderate confidence: Contractor communication",source:"gmail"},{id:"7",subject:"Monthly Rent Payment Received",snippet:"This is to confirm that we have received your rent payment for April 2025...",participants:["[email protected]"],lastMessageDate:c(g(new Date,6),"yyyy-MM-dd HH:mm:ss"),timeHoursEstimate:.25,aiConfidence:88,status:"approved",hasLedgerEntry:!0,aiReasoning:"High confidence: Rent payment confirmation",source:"gmail"},{id:"8",subject:"HOA Meeting Minutes",snippet:"Please find attached the minutes from last month's HOA meeting...",participants:["[email protected]"],lastMessageDate:c(g(new Date,7),"yyyy-MM-dd HH:mm:ss"),timeHoursEstimate:1,aiConfidence:32,status:"available",hasLedgerEntry:!1,aiReasoning:"Low confidence: HOA administrative task",source:"outlook"},{id:"9",subject:"Eviction Notice Follow-up",snippet:"Following up on the eviction notice sent last week. Please confirm receipt...",participants:["[email protected]"],lastMessageDate:c(g(new Date,8),"yyyy-MM-dd HH:mm:ss"),timeHoursEstimate:2.5,aiConfidence:96,status:"approved",hasLedgerEntry:!1,aiReasoning:"High confidence: Legal matter related to property management",source:"gmail"}];function bs(){const[t,n]=i.useState("approved"),[m,l]=i.useState(!1),x=i.useMemo(()=>({all:y.length,approved:y.filter(a=>a.status==="approved").length,pending:y.filter(a=>a.status==="pending").length,available:y.filter(a=>a.status==="available").length}),[]),d=i.useMemo(()=>{switch(t){case"approved":return y.filter(a=>a.status==="approved");case"pending":return y.filter(a=>a.status==="pending");case"available":return y.filter(a=>a.status==="available");case"all":default:return y}},[t]),b=()=>{l(!0),setTimeout(()=>l(!1),1e3)};return e.jsxs(H,{className:"border-none shadow-none",children:[e.jsx(E,{className:"pb-3",children:e.jsx("div",{className:"flex items-center justify-between mb-3",children:e.jsxs("div",{className:"w-full flex items-center gap-2",children:[e.jsx(J,{type:"text",className:"h-7 text-sm px-2",placeholder:"Search mail..."}),e.jsxs(pe,{children:[e.jsx(be,{asChild:!0,children:e.jsx(r,{variant:"outline",size:"sm",className:"h-7 px-2 gap-1.5 text-xs",children:e.jsx(Y,{className:"h-3.5 w-3.5"})})}),e.jsx(fe,{className:"w-80",align:"end",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"font-semibold text-sm",children:"Select Filters"}),e.jsxs("div",{className:"flex items-center space-x-2 pb-2 border-b",children:[e.jsx(D,{id:"show-all"}),e.jsx("label",{htmlFor:"show-all",className:"text-sm cursor-pointer flex-1",children:"Show all"})]}),e.jsxs("div",{className:"flex items-center space-x-2 pb-2 border-b",children:[e.jsx(D,{id:"unread"}),e.jsx("label",{htmlFor:"unread",className:"text-sm cursor-pointer flex-1",children:"Unread"})]}),e.jsxs("div",{className:"flex items-center space-x-2 pb-2 border-b",children:[e.jsx(D,{id:"with-attachments"}),e.jsx("label",{htmlFor:"with-attachments",className:"text-sm cursor-pointer flex-1",children:"With Attachments"})]}),e.jsxs("div",{className:"flex items-center space-x-2 pb-2 border-b",children:[e.jsx(D,{id:"synced-only"}),e.jsx("label",{htmlFor:"synced-only",className:"text-sm cursor-pointer flex-1",children:"Synced Only"})]})]})})]}),e.jsx(r,{variant:"outline",size:"sm",onClick:b,disabled:m,className:"h-7 px-2 gap-1.5 text-xs",children:e.jsx(je,{className:`h-3.5 w-3.5 ${m?"animate-spin":""}`})})]})})}),e.jsx(R,{className:"flex flex-col h-full overflow-auto",children:e.jsxs(ve,{value:t,onValueChange:a=>n(a),className:"w-full flex flex-col flex-1",children:[e.jsxs(ye,{className:"rounded-xl p-6",children:[e.jsxs(N,{value:"approved",className:"text-xs normal-case p-2 rounded-sm data-[state=active]:bg-white data-[state=active]:text-black data-[state=active]:shadow-black text-gray-600 hover:text-gray-800",children:["Approved (",x.approved,")"]}),e.jsxs(N,{value:"pending",className:"text-xs normal-case p-2 rounded-sm data-[state=active]:bg-white data-[state=active]:text-black data-[state=active]:shadow-black text-gray-600 hover:text-gray-800",children:["Pending Approval (",x.pending,")"]}),e.jsxs(N,{value:"available",className:"text-xs normal-case p-2 rounded-sm data-[state=active]:bg-white data-[state=active]:text-black data-[state=active]:shadow-black text-gray-600 hover:text-gray-800",children:["Available to Convert (",x.available,")"]}),e.jsxs(N,{value:"all",className:"text-xs normal-case p-2 rounded-md data-[state=active]:bg-white data-[state=active]:text-black data-[state=active]:shadow-black text-gray-600 hover:text-gray-800",children:["All Mails (",x.all,")"]})]}),e.jsx(Ne,{value:t,className:"mt-3 flex-1 overflow-hidden",children:e.jsx(we,{className:"h-full w-full",children:e.jsx("div",{className:"space-y-1.5 pr-4",children:d.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground text-sm",children:"No emails found for this filter"}):e.jsx(Ce,{type:"single",collapsible:!0,className:"w-full",children:d.map(a=>e.jsxs(ke,{value:a.id,className:"[&_h3]:m-2 text-xs hover:bg-muted/50 rounded-md cursor-pointer transition-colors border border-border/30 mb-2",children:[e.jsxs(Me,{className:"normal-case text-left px-2 py-1 hover:no-underline gap-3",children:[e.jsx("div",{className:"grow-0",children:e.jsx("div",{className:`h-2 w-2 rounded-full ${a.status==="approved"?"bg-green-500":a.status==="pending"?"bg-amber-500":"bg-blue-500"}`})}),e.jsxs("div",{className:"grow flex items-center overflow-hidden",children:[e.jsx("span",{className:"font-semibold text-xs mr-1 flex-shrink-0",children:a.subject}),e.jsxs("span",{className:"text-xs text-muted-foreground flex-shrink-0 data-[state=open]:text-white",children:["- ",a.snippet]})]}),e.jsxs("div",{className:"grow-0",children:[a.status==="approved"&&e.jsx(L,{className:"h-4 w-4 text-green-600"}),a.status==="pending"&&e.jsx(_,{className:"h-4 w-4 text-amber-600"}),a.status==="available"&&e.jsx(Y,{className:"h-4 w-4 text-blue-600"}),!a.status&&e.jsx(ee,{className:"h-4 w-4 text-gray-400"})]}),e.jsx("div",{className:"grow-0 text-xs text-muted-foreground flex-shrink-0",children:De(a.lastMessageDate)})]}),e.jsxs(Ae,{className:"px-4 py-1 text-xs",children:[e.jsxs("p",{children:[e.jsx("span",{className:"font-semibold mr-1",children:"Subject:"}),a.subject]}),e.jsxs("p",{children:[e.jsx("span",{className:"font-semibold mr-1",children:"Participants:"}
1),a.participants.join(", ")]}),e.jsxs("p",{children:[e.jsx("span",{className:"font-semibold mr-1",children:"Body:"}),a.snippet]}),e.jsxs("div",{className:"w-full flex justify-end gap-3 mb-2",children:[e.jsx(r,{size:"sm",className:"h-7 px-2 gap-1.5 text-xs bg-green-600",children:"Approved"}),e.jsx(r,{size:"sm",className:"h-7 px-2 gap-1.5 text-xs bg-red-600",children:"Reject"}),e.jsx(r,{size:"sm",className:"h-7 px-2 gap-1.5 text-xs bg-blue-600",children:"Convert"})]})]})]},a.id))})})})})]})})]})}function Hs(){var ne,ie,le,oe;const{user:t}=Ye(),{gmailStatusQuery:n,microsoftMailStatusQuery:m,googleCalendarStatusQuery:l,microsoftCalendarStatusQuery:x,handleGmailConnect:d,handleMicrosoftMailConnect:b,handleGoogleCalendarConnect:a,handleMicrosoftCalendarConnect:f,disconnectGmailMutation:o,disconnectMicrosoftMailMutation:w,disconnectGoogleCalendarMutation:K,disconnectMicrosoftCalendarMutation:j,isGmailConnecting:P,isMicrosoftMailConnecting:C,isGoogleCalendarConnecting:S,isMicrosoftCalendarConnecting:F}=ts(),[Z,G]=i.useState(!1),[k,O]=i.useState(!1),[I,z]=i.useState(!1),[s,u]=i.useState(!1),[h,W]=i.useState({date:c(new Date,"yyyy-MM-dd"),hours:"",activityType:"",description:""}),se=((ne=n.data)==null?void 0:ne.connected)||!1,ae=((ie=m.data)==null?void 0:ie.connected)||!1,te=((le=l.data)==null?void 0:le.connected)||!1,re=((oe=x.data)==null?void 0:oe.connected)||!1;return e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-blue-50 to-indigo-50 dark:from-slate-950 dark:via-slate-900 dark:to-slate-950",children:[e.jsxs("div",{className:"container mx-auto p-6 space-y-6",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h1",{className:"text-4xl font-bold bg-gradient-to-r from-blue-600 to-indigo-600 bg-clip-text text-transparent",children:"Dashboard Preview"}),e.jsxs(A,{variant:"outline",className:"bg-blue-50 text-blue-700 border-blue-300",children:[e.jsx(qe,{className:"w-3 h-3 mr-1"}),"Test Mode"]})]}),e.jsxs("p",{className:"text-muted-foreground mt-2",children:["Welcome back, ",(t==null?void 0:t.firstName)||"User","! Test the new integration flow."]})]}),e.jsx(r,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs("a",{href:"/dashboard",children:[e.jsx(Ke,{className:"w-4 h-4 mr-2"}),"Back to Production"]})})]}),e.jsxs(Ze,{className:"bg-blue-50 dark:bg-blue-950 border-blue-200 dark:border-blue-800",children:[e.jsx(ms,{className:"h-4 w-4 text-blue-600"}),e.jsx(Ue,{className:"text-blue-800 dark:text-blue-200",children:"This is a test environment. Click the integration icons on Calendar and Mail cards to connect your accounts directly from the dashboard."})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs(H,{
1className:"group hover:shadow-xl transition-all duration-300 border-2 hover:border-blue-300 bg-white/80 dark:bg-slate-900/80 backdrop-blur",children:[e.jsxs(E,{className:"pb-4 bg-gradient-to-r from-blue-50 to-indigo-50 dark:from-blue-950 dark:to-indigo-950 rounded-t-lg border-b",children:[e.jsxs(V,{className:"flex items-center gap-2 text-xl",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-blue-100 dark:bg-blue-900 flex items-center justify-center",children:e.jsx(xe,{className:"h-5 w-5 text-blue-600 dark:text-blue-400"})}),"Log Time Entry"]}),e.jsx(he,{children:"Track your real estate activities"})]}),e.jsxs(R,{className:"pt-6 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx($,{htmlFor:"date",className:"text-sm font-medium",children:"Date"}),e.jsx(J,{id:"date",type:"date",value:h.date,onChange:p=>W({...h,date:p.target.value}),className:"border-2 focus:border-blue-400"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx($,{htmlFor:"hours",className:"text-sm font-medium",children:"Hours"}),e.jsx(J,{id:"hours",type:"number",step:"0.5",placeholder:"2.5",value:h.hours,onChange:p=>W({...h,hours:p.target.value}),className:"border-2 focus:border-blue-400"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx($,{htmlFor:"activityType",className:"text-sm font-medium",children:"Activity Type"}),e.jsxs(Je,{value:h.activityType,onValueChange:p=>W({...h,activityType:p}),children:[e.jsx(Xe,{className:"border-2 focus:border-blue-400",children:e.jsx(es,{placeholder:"Select activity..."})}),e.jsxs(ss,{children:[e.jsx(T,{value:"property-showing",children:"Property Showing"}),e.jsx(T,{value:"tenant-communication",children:"Tenant Communication"}),e.jsx(T,{value:"maintenance",children:"Maintenance"}),e.jsx(T,{value:"inspection",children:"Inspection"}),e.jsx(T,{value:"paperwork",children:"Paperwork"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx($,{htmlFor:"description",className:"text-sm font-medium",children:"Description"}),e.jsx(as,{id:"description",rows:3,placeholder:"Brief description of the activity...",value:h.description,onChange:p=>W({...h,description:p.target.value}),className:"border-2 focus:border-blue-400 resize-none"})]}),e.jsxs(r,{className:"w-full bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 text-white shadow-lg",children:[e.jsx(xe,{className:"w-4 h-4 mr-2"}),"Log Time Entry"]})]})]}
1),e.jsxs(H,{className:"group hover:shadow-xl transition-all duration-300 border-2 hover:border-purple-300 bg-white/80 dark:bg-slate-900/80 backdrop-blur",children:[e.jsx(E,{className:"pb-4 bg-gradient-to-r from-purple-50 to-pink-50 dark:from-purple-950 dark:to-pink-950 rounded-t-lg border-b",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-100 dark:bg-purple-900 flex items-center justify-center",children:e.jsx(q,{className:"h-5 w-5 text-purple-600 dark:text-purple-400"})}),e.jsx("div",{children:e.jsx(V,{className:"text-xl",children:"Calendar Sync"})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Q,{type:"google-calendar",isConnected:te,isLoading:S,onClick:()=>O(!0)}),e.jsx(Q,{type:"microsoft-calendar",isConnected:re,isLoading:F,onClick:()=>u(!0)})]})]})}),e.jsxs(R,{className:"p-0",children:[e.jsx("div",{className:"p-6",children:e.jsx(ps,{})}),e.jsx("div",{className:"pt-4 mt-4 border-t border-gray-200 dark:border-gray-700",children:e.jsx(ge,{})})]})]}
1),e.jsxs(H,{className:"group hover:shadow-xl transition-all duration-300 border-2 hover:border-green-300 bg-white/80 dark:bg-slate-900/80 backdrop-blur",children:[e.jsxs(E,{className:"pb-4 bg-gradient-to-r from-green-50 to-emerald-50 dark:from-green-950 dark:to-emerald-950 rounded-t-lg border-b",children:[e.jsxs(V,{className:"flex items-center gap-2 text-xl",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-green-100 dark:bg-green-900 flex items-center justify-center",children:e.jsx(_,{className:"h-5 w-5 text-green-600 dark:text-green-400"})}),"Recent Activity"]}),e.jsx(he,{children:"Your latest time entries"})]}),e.jsx(R,{className:"pt-6",children:e.jsx("div",{className:"space-y-3",children:[{type:"Property Showing",hours:2.5,date:"Today"},{type:"Tenant Communication",hours:1,date:"Yesterday"},{type:"Maintenance Review",hours:3.5,date:"2 days ago"}].map((p,Te)=>e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border border-green-200 dark:border-green-800 bg-green-50/50 dark:bg-green-950/50 hover:bg-green-100 dark:hover:bg-green-900 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-green-200 dark:bg-green-800 flex items-center justify-center",children:e.jsx(xs,{className:"w-4 h-4 text-green-700 dark:text-green-300"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm",children:p.type}),e.jsx("p",{className:"text-xs text-muted-foreground",children:p.date})]})]}),e.jsxs(A,{variant:"outline",className:"bg-green-100 text-green-700 border-green-300",children:[p.hours," hrs"]})]},Te))})})]}
1),e.jsxs(H,{className:"group hover:shadow-xl transition-all duration-300 border-2 hover:border-orange-300 bg-white/80 dark:bg-slate-900/80 backdrop-blur",children:[e.jsx(E,{className:"pb-4 bg-gradient-to-r from-orange-50 to-red-50 dark:from-orange-950 dark:to-red-950 rounded-t-lg border-b",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-orange-100 dark:bg-orange-900 flex items-center justify-center",children:e.jsx(hs,{className:"h-5 w-5 text-orange-600 dark:text-orange-400"})}),e.jsx("div",{children:e.jsx(V,{className:"text-xl",children:"Mail Sync"})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(Q,{type:"gmail",isConnected:se,isLoading:P,onClick:()=>G(!0)}),e.jsx(Q,{type:"microsoft-mail",isConnected:ae,isLoading:C,onClick:()=>z(!0)})]})]})}),e.jsxs(R,{className:"p-0",children:[e.jsx(bs,{}),e.jsx("div",{className:"pt-4 mt-4 border-t border-gray-200 dark:border-gray-700",children:e.jsx(ge,{})})]})]})]})]}),e.jsx(B,{open:Z,onOpenChange:G,integrationType:"gmail",isConnected:se,isLoading:P||o.isPending,onConnect:d,onDisconnect:()=>o.mutate()}),e.jsx(B,{open:k,onOpenChange:O,integrationType:"google-calendar",isConnected:te,isLoading:S||K.isPending,onConnect:a,onDisconnect:()=>K.mutate()}),e.jsx(B,{open:I,onOpenChange:z,integrationType:"microsoft-mail",isConnected:ae,isLoading:C||w.isPending,onConnect:b,onDisconnect:()=>w.mutate()}),e.jsx(B,{open:s,onOpenChange:u,integrationType:"microsoft-calendar",isConnected:re,isLoading:F||j.isPending,onConnect:f,onDisconnect:()=>j.mutate()})]})}export{Hs 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.