1import{aj as c,aN as xe,aX as ke,aW as he,aQ as G,ae as e,B as o,j as De,b6 as Ce,aC as Se,b5 as Ae,aK as Le,aJ as $e,L as Me,l as Te,H as Pe,C as n,x as X,b as S}from"./index-0vfpQ6sQ.js";import{L as Z}from"./label-5UQSZdKp.js";import{B as E}from"./badge-shz91ghq.js";import{T as Fe}from"./transaction-timeline-CHTixynT.js";import{S as Ie}from"./seller-journey-tracker-DiRwrZN2.js";import{P as Oe,b as Ee,a as Re}from"./popover-BZGFCgJH.js";import{S as B}from"./scroll-area-BUoxw9an.js";import{B as ee}from"./bell-B_wx6iox.js";import{C as ze}from"./check-check-BSGdfxkb.js";import{T as _}from"./trending-up-C3we5Xu5.js";import{D as $}from"./dollar-sign-BuQPTitX.js";import{C as q}from"./calendar-AALjK2uk.js";import{a as Be,S as _e}from"./seller-showings-popup-BEA7JcZV.js";import{A as qe,c as Ue,f as He,g as Ke,d as Qe,e as Ye,b as Je,a as Ve}from"./alert-dialog-CJt097oT.js";import{D as se,a as te,d as ae,e as le,b as re}from"./dialog-BY8HecYn.js";import{S as We}from"./settings-Bkw2edvl.js";import{L as Ge}from"./log-out-CiSV8hNY.js";import{M as R}from"./mail-DGjrVpGi.js";import{C as ie}from"./circle-check-B9vamsvn.js";import{U as ne}from"./users-CuTXMu3Z.js";import{M as L}from"./message-square-AqisGxgw.js";import{a as ce,M as oe,T as de}from"./thumbs-up-CE1j8rPK.js";import{C as me}from"./circle-user-C-Z_LJYo.js";import{P as Xe}from"./phone-Q6Y5ZiCV.js";import{A as z}from"./activity-gYpvLKYt.js";import{E as Ze}from"./eye-ByEWbZGh.js";import"./circle-D64z46fi.js";import"./user-plus-21gFClnZ.js";import"./building-BF_FcHdI.js";import"./index-b33l5z-_.js";import"./index-DnrETJsm.js";import"./index-BdQq_4o_.js";import"./isPast-Cn4Dlo3h.js";import"./en-US-1srLPrpk.js";import"./parseISO-Dq8JIGVe.js";import"./format-DtTxoKvd.js";import"./key-round-_AhFfYf5.js";import"./clipboard-check-zu6l-LH0.js";import"./clock-BZB5K70R.js";import"./isToday-Cks5encx.js";import"./constructNow-pmChnuEE.js";import"./isSameDay-BmCNULz0.js";import"./addDays-vusRGPxV.js";import"./user-BETAZlzQ.js";import"./index-Dm2oguen.js";function es(){const[t,j]=c.useState(!1),[,m]=xe(),i=ke(),{data:f,isLoading:x}=he({queryKey:["notifications"],queryFn:async()=>{const l=await fetch("/api/notifications?limit=20",{credentials:"include"});if(!l.ok)throw new Error("Failed to fetch notifications");return l.json()},refetchInterval:3e4}),M=G({mutationFn:async l=>{const u=await fetch(`/api/notifications/${l}/read`,{method:"PATCH",credentials:"include"});if(!u.ok)throw new Error("Failed to mark as read");return u.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["notifications"]})}}),h=G({mutationFn:async()=>{const l=await fetch("/api/notifications/read-all",{method:"POST",credentials:"include"});if(!l.ok)throw new Error("Failed to mark all as read");return l.json()},onSuccess:()=>{i.invalidateQueries({queryKey:["notifications"]})}}),w=f?.notifications||[],p=f?.unreadCount||0,T=l=>{switch(l){case"showing_scheduled":return e.jsx(q,{className:"w-4 h-4 text-blue-500"});case"offer_received":return e.jsx($,{className:"w-4 h-4 text-green-500"});case"stage_update":return e.jsx(_,{className:"w-4 h-4 text-amber-500"});default:return e.jsx(De,{className:"w-4 h-4 text-slate-500"})}},P=l=>{const u=new Date(l),y=new Date().getTime()-u.getTime(),k=Math.floor(y/6e4),D=Math.floor(y/36e5),A=Math.floor(y/864e5);return k<1?"Just now":k<60?`${k}m ago`:D<24?`${D}h ago`:A<7?`${A}d ago`:u.toLocaleDateString()},N=l=>{l.isRead||M.mutate(l.id),l.link&&(j(!1),m(l.link))};return e.jsxs(Oe,{open:t,onOpenChange:j,children:[e.jsx(Ee,{asChild:!0,children:e.jsxs(o,{variant:"ghost",size:"icon",className:"relative","data-testid":"button-notifications",children:[e.jsx(ee,{className:"w-5 h-5"}),p>0&&e.jsx("span",{className:"absolute -top-1 -right-1 w-5 h-5 bg-red-500 text-white text-xs rounded-full flex items-center justify-center font-medium",children:p>9?"9+":p})]})}),e.jsxs(Re,{align:"end",className:"w-80 max-w-[calc(100vw-2rem)] p-0 z-50","data-testid":"popover-notifications",children:[e.jsxs("div",{className:"flex items-center justify-between p-3 border-b",children:[e.jsx("h3",{className:"font-semibold text-sm",children:"Notifications"}),e.jsx("div",{className:"flex items-center gap-1",children:p>0&&e.jsxs(o,{variant:"ghost",size:"sm",onClick:()=>h.mutate(),className:"text-xs h-7","data-testid":"button-mark-all-read",children:[e.jsx(ze,{className:"w-3 h-3 mr-1"}),"Mark all read"]})})]}),e.jsx(B,{className:"max-h-[350px]",children:x?e.jsx("div",{className:"p-4 text-center text-sm text-slate-500",children:"Loading..."}):w.length===0?e.jsxs("div",{className:"p-8 text-center",children:[e.jsx(ee,{className:"w-8 h-8 text-slate-300 mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-slate-500",children:"No notifications yet"})]}):e.jsx("div",{className:"divide-y",children:w.slice(0,10).map(l
1=>e.jsx("button",{onClick:()=>N(l),className:`w-full p-3 text-left hover:bg-slate-50 transition-colors ${l.isRead?"":"bg-blue-50/50"}`,"data-testid":`notification-${l.id}`,children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:T(l.type)}),e.jsxs("div",{className:"flex-1 min-w-0 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("p",{className:`text-sm truncate ${l.isRead?"":"font-medium"}`,children:l.title}),!l.isRead&&e.jsx("span",{className:"w-2 h-2 bg-blue-500 rounded-full flex-shrink-0"})]}),e.jsx("p",{className:"text-xs text-slate-500 line-clamp-2 mt-0.5 break-words",children:l.message}),e.jsx("p",{className:"text-xs text-slate-400 mt-1",children:P(l.createdAt)})]})]})},l.id))})}),w.length>0&&e.jsx("div",{className:"p-2 border-t",children:e.jsx(o,{variant:"ghost",size:"sm",className:"w-full text-xs text-primary hover:text-primary/80",onClick:()=>{j(!1),m("/seller/notifications")},"data-testid":"button-view-all-notifications",children:"View all notifications"})})]})]})}function Ys(){const{t}=Ce(),{data:j,isLoading:m}=Se(),[,i]=xe(),{toast:f}=Ae(),x=j?.user,M=j?.isMagicLink,[h,w]=c.useState([]),[p,T]=c.useState(!0),[P,N]=c.useState(!1),[l,u]=c.useState([]),[d,y]=c.useState(null),[k,D]=c.useState(!1),[A,U]=c.useState(!1),H=h[0]?.id,{data:K,fetchNextPage:pe,hasNextPage:ge,isFetchingNextPage:Q}=Le(H),{data:Y,fetchNextPage:fe,hasNextPage:ue,isFetchingNextPage:J}=$e(H),b=K?.pages.flatMap(s=>s.offers)??[],F=K?.pages[0]?.total??b.length,g=Y?.pages.flatMap(s=>s.feedback)??[],I=Y?.pages[0]?.total??g.length;c.useEffect(()=>{if(!m){if(!x){i("/seller/login");return}if(x.role==="agent"){i("/agent/dashboard");return}if(x.emailVerified===!1){i("/verification-pending");return}je(),Ne()}},[x,m]);const je=async()=>{try{const s=await fetch("/api/sellers/properties",{credentials:"include"});if(!s.ok)throw new Error("Failed to load properties");const C=(await s.json()).properties||[];w(C)}catch(s){f({variant:"destructive",title:"Error",description:s.message||"Could not load properties"})}finally{T(!1)}},Ne=async()=>{try{const s=await fetch("/api/agents",{credentials:"include"});if(s.ok){const r=await s.json();u(r.agents||[])}}catch(s){console.error("Error fetching agents:",s)}},be=async s=>{try{const r=await fetch(`/api/agents/${s}`,{credentials:"include"});if(r.ok){const C=await r.json();y(C.agent||null)}}catch(r){console.error("Error fetching agent details:",r)}};c.useEffect(()=>{h.length>0&&h[0].agentId&&be(h[0].agentId)},[h]);const V=async()=>{try{await fetch("/api/auth/logout",{method:"POST",credentials:"include"}),localStorage.clear(),sessionStorage.clear(),window.location.href="/"}catch(s){console.error("Logout failed:",s)}},ve=()=>{M?N(!0):V()},a=h[0];c.useEffect(()=>{!p&&!m&&x&&!a&&i("/seller/discovery")},[p,m,x,a,i]);const{data:O}=he({queryKey:["activity-feed",a?.id],queryFn:async()=>{const s=await fetch(`/api/listings/${a?.id}/activity-feed?limit=10`,{credentials:"include"});return s.ok?(await s.json()).activities||[]:[]},enabled:!!a?.id,refetchInterval:3e4});return p||m?e.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center",children:e.jsx("div",{className:"text-slate-600",children:t("sellerDashboard.loading")})}):a?e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 via-white to-slate-100",children:[e.jsx("header",{className:"bg-white border-b border-slate-200 sticky top-0 z-10",children:e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(Me,{href:"/",className:"flex items-center gap-3 cursor-pointer hover:opacity-80 transition-opacity","data-testid":"link-home-logo",children:[e.jsx(Te,{size:"lg"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-serif font-bold text-slate-900",children:t("sellerDashboard.title")}),e.jsx("p",{className:"text-sm text-slate-600",children:t("sellerDashboard.subtitle")})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(o,{variant:"outline",className:"min-h-[44px]",onClick:()=>i("/seller/discovery"),"data-testid":"button-home",children:[e.jsx(Pe,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Home"})]}),e.jsxs(o,{variant:"outline",className:"min-h-[44px]",onClick:()=>i("/seller/settings"),"data-testid":"button-settings",children:[e.jsx(We,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Settings"})]}),e.jsx(es,{}),e.jsxs(o,{variant:"outline",className:"min-h-[44px]",onClick:ve,"data-testid":"button-logout",children:[e.jsx(Ge,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Logout"})]})]})]})})}),e.jsxs("main",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[a.isShadow&&!a.isClaimed&&e.jsx(n,{className:"p-6 mb-8 border-amber-200 bg-gradient-to-r from-amber-50/50 to-white",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(X,{className:"w-6 h-6 text-amber-600 flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:"Your Dashboard Is Being Set Up"}),e.jsx("p",{className:"text-sm text-slate-600 mt-1",children:"Your listing agent has been notified about this property and is setting up your full dashboard. In the meantime, you can view the showing feedback and activity below."}),a.tempListingAgentEmail&&e.jsx("div",{className:"mt-3 p-3 bg-white rounded-lg border border-amber-100",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(R,{className:"w-4 h-4 text-slate-500"}),e.jsx("span",{className:"text-slate-600",children:"Notification sent to:"}),e.jsx("span",{className:"font-medium text-slate-800",children:a.tempListingAgentEmail.replace(/(.{2})(.*)(@.*)/,"$1***$3")})]})}),e.jsxs("p",{className:"text-xs text-slate-500 mt-3",children:["Not your agent? ",e.jsx("a",{href:"/help",className:"text-amber-700 underline hover:text-amber-800",children:"Contact support"})," and we'll help connect you with the right person."]})]})]})}),(!a.isShadow||a.isClaimed)&&e.jsxs(n,{className:"p-6 mb-8 border-green-200 bg-gradient-to-r from-green-50/50 to-white",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx(ie,{className:"w-6 h-6 text-green-600"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:t("sellerDashboard.listingIsLive")}),e.jsx("p",{className:"text-sm text-slate-600",children:t("sellerDashboard.trackShowingsFeedbackOffers")})]})]}),e.jsx(Ie,{currentStep:3,agentName:d?.name||l.find(s=>
1s.id===a.agentId)?.name||null,agentEmail:d?.email||null,hasListing:!0,isComplete:!0})]}),e.jsx(Be,{propertyId:a.id}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 sm:gap-4 mb-8",children:[a.listingType!=="rental"&&e.jsx(n,{className:"p-3 sm:p-4 min-h-[100px] cursor-pointer hover:bg-slate-50 transition-colors",onClick:()=>{b.length===0?f({title:t("sellerDashboard.noOffersYet"),description:t("sellerDashboard.offersNotification")}):D(!0)},"data-testid":"card-offers-tile",children:e.jsxs(S,{className:"p-0",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[e.jsx("div",{className:"bg-green-100 rounded-full p-2 flex-shrink-0",children:e.jsx($,{className:"h-4 w-4 sm:h-5 sm:w-5 text-green-600"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-xl sm:text-2xl font-bold text-slate-900",children:F}),e.jsx("p",{className:"text-xs sm:text-sm text-slate-600 truncate",children:t("sellerDashboard.offers")})]})]}),b.length>0&&e.jsxs("div",{className:"mt-2 pt-2 border-t border-slate-100",children:[e.jsx("p",{className:"text-xs text-slate-500",children:"Highest:"}),e.jsxs("p",{className:"text-xs sm:text-sm font-semibold text-green-600 truncate",children:["$",Math.max(...b.map(s=>s.price)).toLocaleString()]})]})]})}),a.listingType==="rental"&&e.jsx(n,{className:"p-3 sm:p-4 min-h-[100px] cursor-pointer hover:bg-slate-50 transition-colors",onClick:()=>{a.rentalApplicationUrl?window.open(a.rentalApplicationUrl,"_blank"):f({title:t("rental.applicationsInfo","Rental Applications"),description:t("rental.applicationsDescription","Applications are managed through your property management system")})},"data-testid":"card-applications-tile",children:e.jsx(S,{className:"p-0",children:e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[e.jsx("div",{className:"bg-blue-100 rounded-full p-2 flex-shrink-0",children:e.jsx(ne,{className:"h-4 w-4 sm:h-5 sm:w-5 text-blue-600"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-xl sm:text-2xl font-bold text-slate-900",children:t("rental.applications","Applications")}),e.jsx("p",{className:"text-xs sm:text-sm text-slate-600 truncate",children:t("rental.manageApps","Manage")})]})]})})}),e.jsx(n,{className:"p-3 sm:p-4 min-h-[100px] cursor-pointer hover:bg-slate-50 transition-colors",onClick:()=>{g.length===0?f({title:t("sellerDashboard.noFeedbackYet"),description:t("sellerDashboard.feedbackNotification")}):U(!0)},"data-testid":"card-feedback-tile",children:e.jsxs(S,{className:"p-0",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[e.jsx("div",{className:"bg-blue-100 rounded-full p-2 flex-shrink-0",children:e.jsx(L,{className:"h-4 w-4 sm:h-5 sm:w-5 text-blue-600"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-xl sm:text-2xl font-bold text-slate-900",children:I}),e.jsx("p",{className:"text-xs sm:text-sm text-slate-600 truncate",children:t("sellerDashboard.feedback")})]})]}),g.length>0&&e.jsxs("div",{className:"mt-2 pt-2 border-t border-slate-100 flex flex-wrap items-center gap-1 sm:gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx(ce,{className:"h-3 w-3 text-green-500"}),e.jsx("span",{children:g.filter(s=>s.sentiment?.toLowerCase()==="positive").length})]}),e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx(oe,{className:"h-3 w-3 text-slate-400"}),e.jsx("span",{children:g.filter(s=>s.sentiment?.toLowerCase()==="neutral").length})]}),e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx(de,{className:"h-3 w-3 text-red-500"}),e.jsx("span",{children:g.filter(s=>s.sentiment?.toLowerCase()==="negative").length})]})]})]})}),e.jsx(_e,{propertyId:a.id,closingDate:a.closingDate??null,inspectionDeadline:a.inspectionDeadline??null,trigger:e.jsx(n,{className:"p-3 sm:p-4 min-h-[100px] cursor-pointer hover:bg-slate-50 transition-colors",children:e.jsx(S,{className:"p-0",children:e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[e.jsx("div",{className:"bg-purple-100 rounded-full p-2 flex-shrink-0",children:e.jsx(q,{className:"h-4 w-4 sm:h-5 sm:w-5 text-purple-600"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-xl sm:text-2xl font-bold text-slate-900",children:t("sellerDashboard.viewShowings")}),e.jsx("p",{className:"text-xs sm:text-sm text-slate-600 truncate",children:t("sellerDashboard.showings")})]})]})})})}),e.jsx(n,{className:"p-3 sm:p-4 min-h-[100px]",children:e.jsx(S,{className:"p-0",children:e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[e.jsx("div",{className:"bg-amber-100 rounded-full p-2 flex-shrink-0",children:e.jsx(_,{className:"h-4 w-4 sm:h-5 sm:w-5 text-amber-600"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-lg sm:text-2xl font-bold text-slate-900 break-words",children:a.currentStage==="Listed"?t("sellerDashboard.active"):t("sellerDashboard.inProgress")}),e.jsx("p",{className:"text-xs sm:text-sm text-slate-600 truncate",children:t("sellerDashboard.status")})]})]})})})]}),e.jsx("div",{className:"space-y-8",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(n,{className:"p-6",children:e.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[e.jsx("div",{children:e.jsx("img",{src:a.image||"https://images.unsplash.com/photo-1600596542815-ffad4c1539a9?auto=format&fit=crop&q=80&w=1000",alt:a.address,className:"w-full h-64 object-cover rounded-lg"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-serif font-bold text-slate-900",children:a.address}),e.jsxs("p",{className:"text-slate-600",children:[a.city,", ",a.state," ",a.zip]})]}),e.jsxs("div",{children:[e.jsx(Z,{className:"text-sm text-slate-600",children:a.listingType==="rental"?"Monthly Rent":"Price"}),e.jsx("p",{className:"text-3xl font-bold text-primary",children:a.listingType==="rental"?a.monthlyRent!=null?`$${a.monthlyRent.toLocaleStr
1ing()}/mo`:"â":a.price!=null?`$${a.price.toLocaleString()}`:"â"})]}),e.jsxs("div",{children:[e.jsx(Z,{className:"text-sm text-slate-600",children:"Status"}),e.jsx("p",{className:"text-lg font-medium text-slate-900",children:a.currentStage})]}),e.jsxs("div",{className:"pt-4 border-t border-slate-200 bg-slate-50 -mx-6 -mb-6 p-6 rounded-b-lg",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(me,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"text-sm font-semibold text-slate-900",children:t("sellerDashboard.yourAgent")})]}),e.jsx(o,{variant:"ghost",size:"sm",onClick:()=>i("/seller/settings?tab=agent"),"data-testid":"button-manage-agent",className:"text-primary hover:text-primary/80",children:t("sellerDashboard.manageInSettings")})]}),a.agentId&&d?e.jsxs("div",{className:"mt-3 space-y-2",children:[e.jsx("p",{className:"text-sm font-medium text-slate-900",children:d.name}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-600",children:[e.jsx(R,{className:"h-3 w-3 text-slate-400"}),e.jsx("a",{href:`mailto:${d.email}`,className:"hover:text-primary","data-testid":"link-agent-email",children:d.email})]}),d.phone&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-600",children:[e.jsx(Xe,{className:"h-3 w-3 text-slate-400"}),e.jsx("a",{href:`tel:${d.phone}`,className:"hover:text-primary","data-testid":"link-agent-phone",children:d.phone})]})]}):a.agentId&&l.find(s=>
1s.id===a.agentId)?e.jsx("p",{className:"text-sm text-slate-600 mt-2",children:l.find(s=>s.id===a.agentId)?.name}):e.jsx("p",{className:"text-sm text-slate-500 mt-2",children:t("sellerDashboard.noAgentAssigned")})]})]})]})}),e.jsxs(n,{className:"p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-slate-900 mb-4",children:t("sellerDashboard.transactionTimeline")}),e.jsx(Fe,{property:a,readonly:!0})]}),O&&O.length>0&&e.jsxs(n,{className:"p-6",children:[e.jsxs("h3",{className:"text-lg font-semibold text-slate-900 mb-4 flex items-center gap-2","data-testid":"text-activity-feed-title",children:[e.jsx(z,{className:"h-5 w-5 text-amber-600"}),"Recent Activity"]}),e.jsx("div",{className:"space-y-3","data-testid":"activity-feed-list",children:O.map(s=>{const r={showing:q,feedback:L,offer:$,stage_change:_,open_house:ne,lead:me,email_log:R,task:ie,note:L,custom:z},C={showing:"text-blue-600 bg-blue-50",feedback:"text-purple-600 bg-purple-50",offer:"text-green-600 bg-green-50",stage_change:"text-amber-600 bg-amber-50",open_house:"text-orange-600 bg-orange-50",lead:"text-indigo-600 bg-indigo-50",email_log:"text-slate-600 bg-slate-50",task:"text-teal-600 bg-teal-50",note:"text-slate-500 bg-slate-50",custom:"text-slate-500 bg-slate-50"},we=r[s.activityType]||z,W=(C[s.activityType]||"text-slate-500 bg-slate-50").split(" "),ye=(()=>{const v=Math.floor((Date.now()-new Date(s.occurredAt).getTime())/1e3);return v<60?"Just now":v<3600?`${Math.floor(v/60)}m ago`:v<86400?`${Math.floor(v/3600)}h ago`:`${Math.floor(v/86400)}d ago`})();return e.jsxs("div",{className:"flex items-start gap-3 py-2 border-b border-slate-100 last:border-0","data-testid":`activity-item-${s.id}`,children:[e.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 ${W[1]||"bg-slate-50"}`,children:e.jsx(we,{className:`h-4 w-4 ${W[0]||"text-slate-500"}`})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm text-slate-800","data-testid":`activity-summary-${s.id}`,children:s.summary}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[e.jsx("span",{className:"text-xs text-slate-400",children:ye}),s.provider!=="system"&&e.jsx(E,{variant:"outline",className:"text-xs px-1.5 py-0",children:s.provider})]})]})]},s.id)})})]}),e.jsxs(o,{variant:"default",size:"lg",className:"w-full",onClick:()=>i(`/seller/${a.id}`),"data-testid":"button-view-details",children:[e.jsx(Ze,{className:"h-5 w-5 mr-2"}),t("sellerDashboard.viewFullPropertyDetails")]})]})})]}),e.jsx(qe,{open:P,onOpenChange:N,children:e.jsxs(Ue,{children:[e.jsxs(He,{children:[e.jsxs(Ke,{className:"flex items-center gap-2",children:[e.jsx(X,{className:"h-5 w-5 text-amber-500"}),t("sellerDashboard.beforeYouGo")]}),e.jsxs(Qe,{className:"space-y-2",children:[e.jsx("p",{children:t("sellerDashboard.magicLinkWarning")}),e.jsx("p",{className:"font-medium text-slate-700",children:t("sellerDashboard.createAccountPrompt")})]})]}),e.jsxs(Ye,{className:"flex-col sm:flex-row gap-2",children:[e.jsx(Je,{onClick:()=>N(!1),children:t("sellerDashboard.stayLoggedIn")}),e.jsx(o,{variant:"outline",onClick:()=>{N(!1),i("/seller/settings?tab=account")},"data-testid":"button-create-account",children:t("auth.createAccount")}),e.jsx(Ve,{onClick:V,className:"bg-red-600 hover:bg-red-700",children:t("sellerDashboard.logOutAnyway")})]})]})}),e.jsx(se,{open:k,onOpenChange:D,children:e.jsxs(te,{className:"max-w-2xl max-h-[80vh]",children:[e.jsxs(ae,{children:[e.jsxs(le,{className:"flex items-center gap-2",children:[e.jsx($,{className:"h-5 w-5 text-green-600"}),t("sellerDashboard.allOffers")," (",F,")"]}),e.jsx(re,{children:t("sellerDashboard.viewAllOffersDescription")})]}),e.jsx(B,{className:"max-h-[60vh] pr-4",children:e.jsxs("div",{className:"space-y-4",children:[b.map((s,r)=>e.jsx(n,{className:"p-4","data-testid":`modal-offer-${s.id}`,children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("p",{className:"text-lg font-bold text-slate-900",children:["$",s.price.toLocaleString()]}),e.jsx("p",{className:"text-sm text-slate-600 truncate",children:s.buyerName||`Offer #${r+1}`}),s.buyerAgentName&&e.jsxs("p",{className:"text-xs text-slate-500 mt-1",children:[t("sellerDashboard.representedBy")," ",s.buyerAgentName]})]}),e.jsx(E,{variant:s.status==="active"?"default":"secondary",className:"flex-shrink-0",children:s.status})]})},s.id)),ge&&e.jsx("div",{className:"flex justify-center pt-2",children:e.jsx(o,{variant:"outline",size:"sm",onClick:()=>pe(),disabled:Q,"data-testid":"button-load-more-offers",children:Q?"Loadingâ¦":`Load more (${b.length} of ${F})`})})]})})]})}),e.jsx(se,{open:A,onOpenChange:U,children:e.jsxs(te,{className:"max-w-2xl max-h-[80vh]",children:[e.jsxs(ae,{children:[e.jsxs(le,{className:"flex items-center gap-2",children:[e.jsx(L,{className:"h-5 w-5 text-blue-600"}),t("sellerDashboard.allFeedback")," (",I,")"]}),e.jsx(re,{children:t("sellerDashboard.viewFeedbackDescription")})]}),e.jsx(B,{className:"max-h-[60vh] pr-4",children:e.jsxs("div",{className:"space-y-4",children:[g.map((s,r)=>e.jsx(n,{className:"p-4","data-testid":`modal-feedback-${s.id}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`rounded-full p-2 flex-shrink-0 ${s.sentiment==="positive"?"bg-green-100":s.sentiment==="negative"?"bg-red-100":"bg-slate-100"}`,children:s.sentiment==="positive"?e.jsx(ce,{className:"h-4 w-4 text-green-600"}):s.sentiment==="negative"?e.jsx(de,{className:"h-4 w-4 text-red-600"}):e.jsx(oe,{className:"h-4 w-4 text-slate-600"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-1",children:[e.jsx(E,{variant:s.sentiment==="positive"?"default":s.sentiment==="negative"?"destructive":"secondary",className:"flex-shrink-0",children:s.sentiment||t("sellerDashboard.neutral")}),e.jsxs("span",{className:"text-xs text-slate-500",children:[t("sellerDashboard.feedback")," #",r+1]})]}),e.jsx("p",{className:"text-sm text-slate-700 break-words",children:s.comment||t("sellerDashboard.noCommentProvided")})]})]})},s.id)),ue&&e.jsx("div",{className:"flex justify-center pt-2",children:e.jsx(o,{variant:"outline",size:"sm",onClick:()=>fe(),disabled:J,"data-testid":"button-load-more-feedback",children:J?"Loadingâ¦":`Load more (${g.length} of ${I})`})})]})})]})})]}):e.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center",children:e.jsx("div",{className:"text-slate-600",children:t("sellerDashboard.redirecting")})})}export{Ys 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.