PageSourceSearch

https://repsshield.com/assets/properties-new-DhCu9AGM.js

js repsshield.com collected 2026-09-24 14:18:43 UTC 38,001 bytes, 12 lines download raw bytes

1import{y as ge,j as e,C as ae,H as C,f as Z,d as ne,bi as pe,be as $,B as h,af as Ae,bT as he,bU as be,bV as ye,bW as fe,bX as ve,bY as je,bZ as we,b_ as Ne,L as xe,K as le,cD as $e,a as ke,aJ as Ce,aC as O,az as G,cE as Se,bh as H,ab as ie,bH as Oe,l as De,aK as Ie,n as Re,br as V,aZ as Je,bI as qe,a_ as Be,a$ as Ve,b0 as Ge,b1 as Ze,e as A,am as He}from"./index-Byg2HWAE.js";import{u as oe,r as o}from"./vendor-Qgthw7N1.js";import{m as z,L as Qe}from"./mapbox-gl-B5AkQ11C.js";import{M as We}from"./minus-BIk_cVu7.js";/**
2 * @license lucide-react v0.453.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Ke=ge("Map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);/**
7 * @license lucide-react v0.453.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const Ue=ge("Umbrella",[["path",{d:"M22 12a10.06 10.06 1 0 0-20 0Z",key:"1teyop"}],["path",{d:"M12 12v8a2 2 0 0 0 4 0",key:"ulpmoc"}],["path",{d:"M12 2v1",key:"11qlp1"}]]);function Ye({property:s,onViewOnMap:c,getStaticMapUrl:m,onDelete:f,isDeleting:u=!1}){const[,x]=oe(),[r,p]=o.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsxs(ae,{className:"mb-4 overflow-hidden rounded-3xl border border-gray-100 bg-white shadow-sm active:scale-[0.99] transition-transform touch-manipulation dark:border-gray-800 dark:bg-gray-900",children:[e.jsxs("div",{className:"relative h-44 bg-gray-100 dark:bg-gray-800",children:[s.latitude&&s.longitude?e.jsx("img",{src:m(parseFloat(s.longitude),parseFloat(s.latitude),600,320),alt:`Map location for ${s.nickname}`,className:"w-full h-full object-cover",loading:"lazy"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-gray-300 dark:text-gray-600",children:e.jsx(C,{className:"h-12 w-12"})}),e.jsxs("div",{className:"absolute top-3 left-3 flex flex-col gap-1.5",children:[s.costSegStatus==="complete"&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-green-600 px-3 py-1 text-xs font-bold text-white shadow-sm",children:[e.jsx(Z,{className:"h-3 w-3"}),"Estimate Ready"]}),e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-gray-200 bg-white/90 px-3 py-1 text-xs font-semibold text-gray-700 shadow-sm backdrop-blur-sm dark:border-gray-600 dark:bg-gray-800/90 dark:text-gray-300",children:[e.jsx(C,{className:"h-3 w-3"}),s.propertyType]})]})]}),e.jsxs(ne,{className:"p-4",children:[e.jsxs("div",{className:"flex justify-between items-start mb-1",children:[e.jsx("h3",{className:"flex-1 mr-2 text-lg font-bold text-gray-900 line-clamp-1 dark:text-gray-100",children:s.nickname}),e.jsx("div",{className:"flex flex-shrink-0 gap-1",children:f&&e.jsx("button",{type:"button",onClick:()=>p(!0),disabled:u,"aria-label":"Delete property",className:"flex h-8 w-8 items-center justify-center rounded-full bg-red-50 text-red-500 transition hover:bg-red-100 hover:text-red-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-red-500 focus-visible:ring-offset-2 active:scale-95 disabled:cursor-not-allowed disabled:opacity-50 dark:bg-red-900/20 dark:text-red-400 dark:hover:bg-red-900/30",children:e.jsx(pe,{className:"h-3.5 w-3.5"})})})]}),e.jsxs("div",{className:"mb-4 flex items-start gap-1.5",children:[e.jsx($,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-gray-400 dark:text-gray-500"}),e.jsxs("p",{className:"text-sm leading-snug text-gray-500 dark:text-gray-400",children:[s.address,", ",s.city,", ",s.state," ",s.zipCode]})]}),e.jsxs(h,{className:"relative w-full bg-green-600 text-xs font-bold uppercase tracking-wider text-white transition hover:bg-green-700 focus-visible:ring-green-500 active:bg-green-800 dark:bg-green-600 dark:text-white dark:hover:bg-green-700",variant:"default",onClick:()=>x(`/properties/${s.id}`),children:[e.jsx("span",{children:"View Tax Savings"}),e.jsx(Ae,{className:"absolute right-4 h-4 w-4"})]})]})]}),f&&e.jsx(he,{open:r,onOpenChange:p,children:e.jsxs(be,{children:[e.jsxs(ye,{children:[e.jsx(fe,{children:"Delete property?"}),e.jsxs(ve,{children:[e.jsx("strong",{children:s.nickname})," will be permanently deleted. This cannot be undone."]})]}),e.jsxs(je,{children:[e.jsx(we,{disabled:u,children:"Cancel"}),e.jsx(Ne,{onClick:()=>{f(s.id),p(!1)},disabled:u,className:"bg-red-600 hover:bg-red-700 focus:ring-red-600",children:u?"Deleting…":"Delete"})]})]})})]})}function Le({formData:s,setFormData:c,handleSubmit:m,isPending:f,onCancel:u}){return e.jsxs("form",{onSubmit:m,className:"space-y-6",children:[e.jsxs("div",{className:"bg-muted/30 rounded-xl border border-border/60 p-5 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"flex items-center justify-center h-6 w-6 rounded-md bg-primary/10",children:e.jsx(C,{className:"h-3.5 w-3.5 text-primary"})}),e.jsx("span",{className:"text-sm font-semibold tracking-tight",children:"Property Identity"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(xe,{htmlFor:"nickname",children:"Property Nickname *"}),e.jsx(le,{id:"nickname",value:s.nickname,onChange:x=>c(r=>({...r,nickname:x.target.value})),placeholder:"e.g., Downtown Apartment, Beach House",required:!0}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Give it a name you'll recognize"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(xe,{children:"Property Type *"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("button",{type:"button",onClick:()=>c(x=>({...x,propertyType:"Long-term Rental"})),className:`relative border-2 rounded-xl p-4 cursor-pointer transition-all duration-200 text-left hover:border-primary/50 hover:shadow-sm ${s.propertyType==="Long-term Rental"?"border-primary bg-primary/5 shadow-sm ring-1 ring-primary/20":"border-border hover:bg-muted/30"}`,children:[s.propertyType==="Long-term Rental"&&e.jsx("div",{className:"absolute top-2 right-2",children:e.jsx(Z,{className:"h-4 w-4 text-primary"})}),e.jsx(C,{className:"h-5 w-5 mb-2 text-muted-foreground"}),e.jsx("div",{className:"text-sm font-medium",children:"Long-term Rental"})]}),e.jsxs("button",{type:"button",onClick:()=>c(x=>({...x,propertyType:"Short-term Rental"})),className:`relative border-2 rounded-xl p-4 cursor-pointer transition-all duration-200 text-left hover:border-primary/50 hover:shadow-sm ${s.propertyType==="Short
11-term Rental"?"border-primary bg-primary/5 shadow-sm ring-1 ring-primary/20":"border-border hover:bg-muted/30"}`,children:[s.propertyType==="Short-term Rental"&&e.jsx("div",{className:"absolute top-2 right-2",children:e.jsx(Z,{className:"h-4 w-4 text-primary"})}),e.jsx(Ue,{className:"h-5 w-5 mb-2 text-muted-foreground"}),e.jsx("div",{className:"text-sm font-medium",children:"Short-term Rental"})]})]})]})]}),e.jsxs("div",{className:"bg-muted/30 rounded-xl border border-border/60 p-5 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"flex items-center justify-center h-6 w-6 rounded-md bg-blue-500/10",children:e.jsx($,{className:"h-3.5 w-3.5 text-blue-600 dark:text-blue-400"})}),e.jsx("span",{className:"text-sm font-semibold tracking-tight",children:"Location"})]}),e.jsx($e,{value:s.address,onChange:x=>c(r=>({...r,address:x})),onSelect:({address:x,city:r,state:p,zipCode:S})=>c(g=>({...g,address:x,city:r,state:p,zipCode:S})),required:!0}),(s.city||s.state||s.zipCode)&&e.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:[s.city,s.state,s.zipCode].filter(Boolean).join(", ")})]}),e.jsxs("div",{className:"flex justify-end gap-3 pt-4 pb-4 mt-2 border-t border-border",children:[e.jsx(h,{type:"button",variant:"outline",onClick:u,children:"Cancel"}),e.jsx(h,{type:"submit",disabled:f,children:f?"Adding...":"Add Property"})]})]})}const _e=(s,c,m=600,f=320)=>`https://api.mapbox.com/styles/v1/mapbox/streets-v12/static/pin-s+3B82F6(${s},${c})/${s},${c},14,0/${m}x${f}@2x?access_token=pk.eyJ1IjoiZWVzdHJhZGEyMzQiLCJhIjoiY21kNmExOWFvMDc5dTJrb20ybGEzejB0MCJ9.hzyNiCdO4hJAgqOfFyJraw`;function Xe({properties:s,isLoading:c,onRefresh:m}){const[,f]=oe(),{toast:u}=ke(),x=Ce(),[r,p]=o.useState(""),[S,g]=o.useState(!1),[v,L]=o.useState({nickname:"",address:"",city:"",state:"",zipCode:"",propertyType:"Long-term Rental"}),P=s.filter(a=>a.nickname.toLowerCase().includes(r.toLowerCase())||a.address.toLowerCase().includes(r.toLowerCase())||a.city.toLowerCase().includes(r.toLowerCase())),T=O({mutationFn:async a=>await G("POST","/api/properties",a),onSuccess:()=>{u({title:"Property Added",description:"Your property has been successfully added."}),x.invalidateQueries({queryKey:["/api/properties"]}),g(!1),L({nickname:"",address:"",city:"",state:"",zipCode:"",propertyType:"Long-term Rental"}),m==null||m()},onError:a=>{u({title:"Error",description:a.message||"Failed to add property. Please try again.",variant:"destructive"})}}),D=O({mutationFn:a=>Se(a),onSuccess:()=>{x.invalidateQueries({queryKey:["/api/properties"]}),u({title:"Property deleted"}),m==null||m()},onError:a=>{u({title:"Error",description:a.message||"Failed to delete property.",variant:"destructive"})}}),F=a=>{if(!a.latitude||!a.longitude){u({title:"Location Not Found",description:"This property's location is not available on the map."});return}f(`/properties-new?view=map&property=${a.id}`)},N=a=>{if(a.preventDefault(),!v.nickname||!v.address||!v.state||!v.zipCode||!v.propertyType){u({title:"Missing Fields",description:"Please fill in all required fields.",variant:"destructive"});return}T.mutate(v)},J=s.filter(a=>a.costSegStatus==="complete").length;return e.jsx("div",{className:"min-h-screen bg-gray-50 pt-3 dark:bg-gray-900",children:e.jsxs("div",{className:"w-full container-mobile",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900 m-0 dark:text-gray-100",children:"Your Properties"}),e.jsx("button",{type:"button",onClick:()=>g(!0),"aria-label":"Add property",className:"flex h-11 w-11 items-center justify-center rounded-full border border-green-300 bg-white text-green-500 shadow-sm transition hover:bg-green-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-green-500 focus-visible:ring-offset-2 active:scale-95",children:e.jsx(H,{className:"h-5 w-5"})})]}),e.jsx("div",{className:"mb-4",children:e.jsx("div",{className:"rounded-2xl border border-gray-100 bg-white p-4 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:e.jsxs("div",{className:"flex items-center",children:[e.jsxs("div",{className:"flex flex-1 flex-col items-center gap-1.5 text-center",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-green-100",children:e.jsx(C,{className:"h-5 w-5 text-green-600"})}),e.jsx("span",{className:"text-xs font-medium text-gray-500",children:"Total Properties"}),e.jsx("span",{className:"text-xl font-bold text-gray-900 dark:text-gray-100",children:P.length})]}),e.jsx("div",{className:"mx-2 h-12 w-px bg-gray-200 dark:bg-gray-700"}),e.jsxs("div",{className:"flex flex-1 flex-col items-center gap-1.5 text-center",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-green-100",children:e.jsx(Z,{className:"h-5 w-5 text-green-600"})}),e.jsx("span",{className:"text-xs font-medium text-gray-500",children:"Estimate Ready"}),e.jsx("span",{className:"text-xl font-bold text-gray-900 dark:text-gray-100",children:J})]})]})})}),e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"relative",children:[e.jsx(ie,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-4 w-4"}),e.jsx("input",{type:"text",placeholder:"Search properties...",value:r,onChange:a=>p(a.target.value),className:"w-full pl-10 pr-4 py-3 rounded-xl border border-gray-200 bg-white text-gray-900 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent dark:border-gray-700 dark:bg-gray-800 dark:text-gray-100 dark:placeholder-gray-500"})]})}),e.jsx("div",{className:"space-y-4",children:c?e.jsxs("div",{className:"flex items-center justify-center p-8",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"}),e.jsx("span",{className:"ml-2 text-gray-500",children:"Loading properties..."})]}):P.length===0?e.jsxs("div",{className:"mx-0 rounded-2xl border border-gray-100 bg-white p-8 text-center shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[e.jsx(C,{className:"mx-auto mb-3 h-12 w-12 text-gray-300 dark:text-gray-600"}),e.jsx("p",{className:"mb-4 text-sm font-medium text-gray-500 dark:text-gray-400",children:r?"No properties match your search.":"No properties found. Add your first property!"}),e.jsxs("button",{type:"button",onClick:()=>g(!0),className:"inline-flex items-center gap-1.5 rounded-xl border border-gray-200 bg-white px-4 py-2.5 text-sm font-semibold text-gray-700 transition hover:bg-gray-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-green-500 focus-visible:ring-offset-2 active:scale-95 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-750",children:[e.jsx(H,{className:"h-4 w-4"}),"Add Property"]})]}):e.jsx("div",{children:P.map(a=>e.jsx(Ye,{property:a,onViewOnMap:F,getStaticMapUrl:_e,onDelete:I=>D.mutate(I),isDeleting:D.isPending&&D.variables===a.id},a.id))})}),e.jsx(Oe,{open:S,onOpenChange:g,title:"Add New Property",children:e.jsx("div",{className:"px-4 pb-6 pt-4",children:e.jsx(Le,{formData:v,setFormData:L,handleSubmit:N,isPending:T.isPending,onCancel:()=>g(!1)})})})]})})}const et=(s,c,m=300,f=200)=>`https://api.mapbox.com/styles/v1/mapbox/streets-v12/static/pin-s+3B82F6(${s},${c})/${s},${c},14,0/${m}x${f}@2x?access_token=pk.eyJ1IjoiZWVzdHJhZGEyMzQiLCJhIjoiY21kNmExOWFvMDc5dTJrb20ybGEzejB0MCJ9.hzyNiCdO4hJAgqOfFyJraw`;function nt(){var ue;const{user:s}=De(),{toast:c}=ke(),m=Ce(),[f,u]=oe(),x=o.useRef(null),r=o.useRef(null),[p,S]=o.useState(null),[g,v]=o.useState(!1),[L,P]=o.useState(!1),T=o.useRef(new Map),[D,F]=o.use
11State(!1),[N,J]=o.useState(""),[a,I]=o.useState("list"),[q,Q]=o.useState(1),[E]=o.useState(5),[B,W]=o.useState(!1),[R,Pe]=o.useState("streets-v12"),[K,U]=o.useState(null),Me=Ie(),Y=[{id:"streets-v12",name:"Default",style:"mapbox://styles/mapbox/streets-v12"},{id:"satellite-v9",name:"Satellite",style:"mapbox://styles/mapbox/satellite-v9"},{id:"outdoors-v12",name:"Terrain",style:"mapbox://styles/mapbox/outdoors-v12"},{id:"light-v11",name:"Light",style:"mapbox://styles/mapbox/light-v11"},{id:"dark-v11",name:"Dark",style:"mapbox://styles/mapbox/dark-v11"},{id:"satellite-streets-v12",name:"Satellite Streets",style:"mapbox://styles/mapbox/satellite-streets-v12"},{id:"navigation-day-v1",name:"Navigation",style:"mapbox://styles/mapbox/navigation-day-v1"},{id:"navigation-night-v1",name:"Navigation Night",style:"mapbox://styles/mapbox/navigation-night-v1"}],[M,de]=o.useState({nickname:"",address:"",city:"",state:"",zipCode:"",propertyType:"Long-term Rental"}),{data:k=[],isLoading:_}=Re({queryKey:["/api/properties"],enabled:!!s}),y=k.filter(t=>t.nickname.toLowerCase().includes(N.toLowerCase())||t.address.toLowerCase().includes(N.toLowerCase())||t.city.toLowerCase().includes(N.toLowerCase())),ze=O({mutationFn:async({propertyId:t,latitude:n,longitude:i})=>await G("PATCH",`/api/properties/${t}`,{latitude:n,longitude:i}),onSuccess:()=>{c({title:"Geocode Updated",description:"Property location has been updated successfully."}
11),m.invalidateQueries({queryKey:["/api/properties"]})},onError:t=>{c({title:"Error",description:t.message||"Failed to update geocode",variant:"destructive"})}}),ce=O({mutationFn:async t=>await G("POST","/api/properties",t),onSuccess:()=>{c({title:"Property Added",description:"Your property has been successfully added."}),m.invalidateQueries({queryKey:["/api/properties"]}),V.isRunning&&V.refreshGeofences().catch(console.error),F(!1),de({nickname:"",address:"",city:"",state:"",zipCode:"",propertyType:"Long-term Rental"})},onError:t=>{c({title:"Error",description:t.message||"Failed to add property. Please try again.",variant:"destructive"})}});O({mutationFn:async t=>await G("POST",`/api/properties/${t}/geocode`),onSuccess:()=>{c({title:"Property Geocoded",description:"Property location has been updated on the map."}),m.invalidateQueries({queryKey:["/api/properties"]}),V.isRunning&&V.refreshGeofences().catch(console.error)},onError:t=>{c({title:"Geocoding Failed",description:t.message||"Failed to geocode property location.",variant:"destructive"})}});const X=O({mutationFn:t=>Se(t),onSuccess:()=>{m.invalidateQueries({queryKey:["/api/properties"]}),c({title:"Property deleted"})},onError:t=>{c({title:"Error",description:t.message||"Failed to delete property.",variant:"destructive"})}}),Te=t=>{if(t.preventDefault(),!M.nickname||!M.address||!M.state||!M.zipCode||!M.propertyType){c({title:"Missing Fields",description:"Please fill in all required fields.",variant:"destructive"});return}ce.mutate(M)};o.useEffect(()=>{localStorage.getItem("add-property-from-dashboard")==="true"&&(F(!0),localStorage.removeItem("add-property-from-dashboard"))},[]),o.useEffect(()=>{var n;if(!x.current||r.current||a!=="map")return;const t="pk.eyJ1IjoiZWVzdHJhZGEyMzQiLCJhIjoiY21kNmExOWFvMDc5dTJrb20ybGEzejB0MCJ9.hzyNiCdO4hJAgqOfFyJraw";z.accessToken=t;try{r.current=new z.Map({container:x.current,style:((n=Y.find(l=>l.id===R))==null?void 0:n.style)||"mapbox://styles/mapbox/streets-v12",center:[-94.4155,39.0911],zoom:.1});const i=new z.NavigationControl({visualizePitch:!0,showZoom:!1,showCompass:!0});r.current.addControl(i,"top-right"),r.current.on("load",()=>{v(!0)}),r.current.on("error",l=>{console.error("Mapbox error:",l),P(!0),v(!1)})}catch(i){console.error("Failed to initialize map:",i),P(!0),v(!1)}return()=>{re.current&&(re.current.remove(),re.current=null),j.current&&(j.current.remove(),j.current=null),r.current&&(r.current.remove(),r.current=null,v(!1))}},[a]),o.useEffect(()=>{!r.current||!g||!k.length||a!=="map"||se()},[k,g,a]),o.useEffect(()=>{if(!r.current||!g||!p||a!=="map")return;const t=k.find(n=>n.id===p);t&&t.latitude&&t.longitude&&r.current.flyTo({center:[parseFloat(t.longitude),parseFloat(t.latitude)],zoom:Math.max(r.current.getZoom(),15),duration:1e3,essential:!0})},[p,g,k,a]),o.useEffect(()=>{var l,d,w,b;if(!r.current||!g)return;const t=Y.find(Ee=>Ee.id===R);if(!t)return;const n=((w=(d=(l=r.current.getStyle())==null?void 0:l.sources)==null?void 0:d["mapbox-streets"])==null?void 0:w.url)||((b=r.current.getStyle())==null?void 0:b.sprite);if(n&&n.includes(R))return;r.current.setStyle(t.style);const i=()=>{se()};return r.current.once("style.load",i),()=>{r.current&&r.current.off("style.load",i)}},[R,g]),o.useEffect(()=>{if(!r.current||!g||!p||a!=="map")return;const t=k.find(n=>n.id===p);if(t&&t.latitude&&t.longitude){const n=setTimeout(()=>{me(t)},600);return()=>clearTimeout(n)}},[p,g,a,k]);const ee=o.useRef(null),te=o.useRef(null);o.useEffect(()=>{const t=n=>{B&&ee.current&&te.current&&!ee.current.contains(n.target)&&!te.current.contains(n.target)&&W(!1)};return document.addEventListener("mousedown",t),()=>{document.removeEventListener("mousedown",t)}},[B]);const j=o.useRef(null),re=o.useRef(null),me=t=>{if(!r.current||!t.latitude||!t.longitude)return;j.current&&j.current.remove();const n=document.createElement("div");n.className="p-4 bg-white rounded-lg shadow-lg border border-gray-200 min-w-[200px]";const i=document.createElement("h3");i.className="font-semibold text-base text-gray-900 mb-2",i.textContent=t.nickname;const l=document.createElement("p");l.className="text-sm text-gray-600 mb-2",l.textContent=t.address||"Address not provided";const d=document.createElement("div");d.className="flex items-center space-x-2";const w=document.createElement("div");w.className="w-2 h-2 bg-green-500 rounded-full";const b=document.createElement("span");b.className="text-xs text-gray-500 uppercase tracking-wide",b.textContent="Active Property",d.appendChild(w),d.appendChild(b),n.appendChild(i),n.appendChild(l),n.appendChild(d),j.current=ne
11w z.Popup({offset:15,closeOnClick:!0,className:"property-popup"}).setLngLat([parseFloat(t.longitude),parseFloat(t.latitude)]).setDOMContent(n).addTo(r.current)},se=()=>{if(!r.current||!k.length)return;const t=y.filter(i=>i.latitude&&i.longitude);if(t.length===0)return;T.current.forEach(i=>i.remove()),T.current.clear(),j.current&&(j.current.remove(),j.current=null),r.current.getSource("properties")&&(r.current.getLayer("property-markers")&&r.current.removeLayer("property-markers"),r.current.getLayer("property-numbers")&&r.current.removeLayer("property-numbers"),r.current.removeSource("properties"));const n=new z.LngLatBounds;if(t.forEach((i,l)=>{const d=document.createElement("div");d.className="custom-marker",d.style.backgroundColor="#3B82F6",d.style.width="24px",d.style.height="24px",d.style.borderRadius="50%",d.style.border="3px solid white",d.style.display="flex",d.style.alignItems="center",d.style.justifyContent="center",d.style.color="white",d.style.fontWeight="bold",d.style.fontSize="12px",d.style.cursor="move",d.style.boxShadow="0 2px 4px rgba(0,0,0,0.2)",d.innerHTML=`<span style="margin-top: -1px; pointer-events: none;">${l+1}</span>`;const w=new z.Marker({element:d,draggable:!0}).setLngLat([parseFloat(i.longitude),parseFloat(i.latitude)]).addTo(r.current);w.on("dragend",()=>{const b=w.getLngLat();ze.mutate({propertyId:i.id,latitude:b.lat.toString(),longitude:b.lng.toString()})}),d.addEventListener("click",b=>{b.stopPropagation(),me(i),S(i.id)}),T.current.set(i.id,w),n.extend([parseFloat(i.longitude),parseFloat(i.latitude)])}),t.length===1){const i=t[0];r.current.setCenter([parseFloat(i.longitude),parseFloat(i.latitude)]),r.current.setZoom(12)}else t.length>1&&r.current.fitBounds(n,{padding:50})},Fe=t=>{if(p===t.id){if(S(null),j.current&&(j.current.remove(),j.current=null),r.current){const n=new z.LngLatBounds;let i=!1;k.forEach(l=>{l.latitude&&l.longitude&&(n.extend([parseFloat(l.longitude),parseFloat(l.latitude)]),i=!0)}),i&&r.current.fitBounds(n,{padding:{top:50,bottom:50,left:50,right:50},maxZoom:15,duration:1e3})}return}if(S(t.id),I("map"),!t.latitude||!t.longitude){c({title:"Location Not Found",description:"This property's location is not available on the map."});return}};return e.jsx(e.Fragment,{children:Me?e.jsx(Xe,{properties:y,isLoading:_}):e.jsx("div",{className:"bg-gray-50 dark:bg-gray-900",children:e.jsxs("div",{className:"container-mobile",children:[e.jsxs("div",{className:"mb-0",children:[e.jsxs("div",{className:"flex flex-col lg:flex-row lg:justify-between lg:items-center gap-4 mb-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold text-gray-900 dark:text-gray-100 mb-2",children:"Property Portfolio"}),e.jsx("p",{className:"text-sm sm:text-base text-gray-600 dark:text-gray-400",children:"Manage your real estate properties with interactive map visualization"})]}),e.jsx("div",{className:"flex items-center justify-between lg:justify-end gap-2 w-full lg:w-auto",children:e.jsxs("div",{className:"hidden md:flex flex-col sm:flex-row gap-2 w-full sm:w-auto",children:[e.jsxs(h,{variant:a==="list"?"default":"outline",size:"sm",onClick:()=>I("list"),className:"w-full sm:w-auto touch-target",children:[e.jsx(C,{className:"h-4 w-4 mr-2"}),"List View"]}),e.jsxs(h,{variant:a==="map"?"default":"outline",size:"sm",onClick:()=>I("map"),className:"w-full sm:w-auto touch-target",children:[e.jsx(Ke,{className:"h-4 w-4 mr-2"}),"Map View"]}
11)]})})]}),e.jsxs("div",{className:`flex flex-col lg:flex-row lg:justify-between lg:items-center gap-4 relative ${a==="map"?"lg:justify-end":""}`,children:[a==="list"&&e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-4 w-full lg:w-auto",children:[e.jsxs("div",{className:"relative flex-1 sm:flex-none",children:[e.jsx(ie,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-4 w-4"}),e.jsx(le,{placeholder:"Search properties...",value:N,onChange:t=>J(t.target.value),className:"pl-10 w-full sm:w-64 no-zoom"})]}),e.jsxs("span",{className:"text-sm text-gray-500 text-center sm:text-left",children:[y.length," properties"]})]}),e.jsx("div",{children:e.jsxs(Je,{open:D,onOpenChange:F,children:[e.jsx(qe,{asChild:!0,children:e.jsxs(h,{size:"sm",children:[e.jsx(H,{className:"h-4 w-4 mr-2"}),"Add Property"]})}),e.jsxs(Be,{className:"sm:max-w-[520px]",children:[e.jsxs(Ve,{className:"pb-4 border-b border-border",children:[e.jsxs(Ge,{className:"flex items-center gap-2.5 text-lg",children:[e.jsx("div",{className:"flex items-center justify-center h-8 w-8 rounded-lg bg-primary/10",children:e.jsx(C,{className:"h-4 w-4 text-primary"})}),"Add New Property"]}),e.jsx(Ze,{children:"Add your investment property details"})]}),e.jsx(Le,{formData:M,setFormData:de,handleSubmit:Te,isPending:ce.isPending,onCancel:()=>F(!1)})]})]})})]})]}),a==="list"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-800 dark:text-gray-200 mb-4",children:"Your Properties"}),_?e.jsxs("div",{className:"flex items-center justify-center p-8",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"}),e.jsx("span",{className:"ml-2 text-gray-500",children:"Loading properties..."})]}):y.length===0?e.jsx("div",{className:"text-center p-8 text-gray-500",children:N?"No properties match your search.":"No properties found. Add your first property!"}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6","data-tour":"properties-page",children:y.map(t=>e.jsx(ae,{className:"transition-all duration-300 hover:shadow-lg cursor-pointer transform hover:-translate-y-1 hover:shadow-md",children:e.jsxs(ne,{className:"p-6",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"w-full mb-4",children:t.latitude&&t.longitude?e.jsx("img",{src:et(parseFloat(t.longitude),parseFloat(t.latitude),300,200),alt:`Map location for ${t.nickname}`,className:"w-full h-48 object-cover rounded-lg border border-gray-200 dark:border-gray-700",loading:"lazy"}):e.jsx("div",{className:"w-full h-48 bg-gray-200 dark:bg-gray-700 rounded-lg border border-gray-200 dark:border-gray-700 flex items-center justify-center",children:e.jsx($,{className:"h-8 w-8 text-gray-400"})})}),e.jsxs("div",{className:"flex justify-between items-start mb-2",children:[e.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100",children:t.nickname}),e.jsx(h,{size:"sm",variant:"ghost",onClick:n=>{n.stopPropagation(),U(t.id)},className:"h-8 w-8 p-0 text-red-400 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20",children:e.jsx(pe,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"flex items-center text-gray-600 dark:text-gray-400 mb-2",children:[e.jsx($,{className:"h-4 w-4 mr-2"}),e.jsxs("span",{className:"text-sm",children:[t.address,", ",t.city,","," ",t.state," ",t.zipCode]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"px-3 py-1 bg-blue-100 dark:bg-blue-800 text-blue-800 dark:text-blue-200 text-xs font-medium rounded-full",children:t.propertyType}),t.costSegStatus==="complete"?e.jsx(A,{variant:"outline",className:"text-xs gap-1 px-2 py-0.5 bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 border-green-200 dark:border-green-700",children:"Estimate Ready"}):e.jsx(A,{variant:"outline",className:"text-xs gap-1 px-2 py-0.5 text-gray-400 border-gray-200 dark:border-gray-700",children:"No Estimate"})]})]}),e.jsx(h,{onClick:n=>{n.stopPropagation(),u(`/properties/${t.id}`)},className:"w-full mt-4 bg-blue-600 hover:bg-blue-700 text-white transition-colors duration-200",children:"View Tax Savings"})]})},t.id))})]}),K!==null&&e.jsx(he,{open:!0,onOpenChange:t=>{t||U(null)},children:e.jsxs(be,{children:[e.jsxs(ye,{children:[e.jsx(fe,{children:"Delete property?"}),e.jsxs(ve,{children:[e.jsx("strong",{children:((ue=y.find(t=>
11t.id===K))==null?void 0:ue.nickname)??"This property"})," will be permanently deleted. This cannot be undone."]})]}),e.jsxs(je,{children:[e.jsx(we,{disabled:X.isPending,children:"Cancel"}),e.jsx(Ne,{onClick:()=>{X.mutate(K),U(null)},disabled:X.isPending,className:"bg-red-600 hover:bg-red-700 focus:ring-red-600",children:"Delete"})]})]})})]}):e.jsxs("div",{className:"flex flex-col lg:flex-row h-[calc(100vh-200px)] bg-white dark:bg-gray-900 rounded-lg shadow-lg overflow-hidden",children:[e.jsxs("div",{className:"w-full lg:w-[10%] lg:min-w-[320px] h-1/3 lg:h-full bg-white dark:bg-gray-800 border-b lg:border-b-0 lg:border-r border-gray-200 dark:border-gray-700 flex flex-col",children:[e.jsx("div",{className:"p-4 border-b border-gray-200 dark:border-gray-700",children:e.jsxs("div",{className:"relative",children:[e.jsx(ie,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 h-4 w-4"}),e.jsx(le,{"data-testid":"input-search-properties",placeholder:"Search properties...",value:N,onChange:t=>{J(t.target.value),Q(1)},className:"pl-10 w-full no-zoom"})]})}),e.jsxs("p",{className:"text-center text-base font-semibold text-white px-3 py-1",style:{backgroundColor:"#44958C"},children:["Properties"," ",e.jsxs("span",{className:`ml-1 inline-block text-sm font-semibold px-3 py-1 rounded-md
12                  bg-[#44958C] text-white border border-white`,children:[y.length," total"]})]}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[e.jsx("div",{className:"flex-1 overflow-y-auto","data-testid":"properties-list",children:_?e.jsxs("div",{className:"flex items-center justify-center p-8",children:[e.jsx("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-blue-600"}),e.jsx("span",{className:"ml-2 text-sm text-gray-500",children:"Loading..."})]}):y.length===0?e.jsxs("div",{className:"text-center p-6 text-gray-500",children:[e.jsx(C,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{className:"text-sm",children:N?"No properties match your search.":"No properties found."})]}):e.jsx("div",{className:"space-y-3 p-4",children:(()=>{const t=(q-1)*E,n=t+E;return y.slice(t,n).map((l,d)=>{const w=y.findIndex(b=>b.id===l.id)+1;return e.jsx(ae,{"data-testid":`card-property-${l.id}`,className:`cursor-pointer transition-all duration-500 hover:shadow-lg rounded-lg border transform ${p===l.id?"ring-2 ring-green-500 bg-green-50 dark:bg-green-900/20 shadow-lg border-green-200 dark:border-green-700 scale-[1.02]":"hover:bg-gray-50 dark:hover:bg-gray-700 bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600 hover:scale-[1.01]"}`,onClick:()=>Fe(l),children:e.jsxs(ne,{className:"p-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-3",children:[e.jsxs("h4",{className:"font-semibold text-base text-gray-900 dark:text-gray-100 truncate leading-snug flex-1",children:[e.jsx("span",{className:"inline-flex items-center justify-center w-6 h-6 bg-blue-600 text-white text-xs font-bold rounded-full mr-2",children:w}),l.nickname]}),e.jsx("div",{className:"flex-shrink-0",children:e.jsx(h,{size:"sm",variant:"outline",onClick:b=>{b.stopPropagation(),u(`/properties/${l.id}`)},className:"text-xs h-7 px-2",children:"View"})})]}),e.jsxs("div",{className:"flex items-start gap-2 mb-3",children:[e.jsx($,{className:"h-3 w-3 text-gray-400 flex-shrink-0 mt-0.5"}),e.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400 leading-relaxed break-words",children:[l.address,", ",l.city,","," ",l.state," ",l.zipCode]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(A,{variant:"secondary",className:"text-xs font-normal px-3 py-1 bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300 rounded-md whitespace-nowrap",children:l.propertyType}),l.latitude&&l.longitude?e.jsxs(A,{variant:"outline",className:"text-xs font-normal flex items-center gap-1 px-2 py-0.5 bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 border-green-200 dark:border-green-700 rounded-md",children:[e.jsx($,{className:"h-2.5 w-2.5"}),"Located"]}):e.jsxs(A,{variant:"outline",className:"text-xs font-normal flex items-center gap-1 px-2 py-0.5 text-gray-400 border-gray-200 dark:border-gray-700 rounded-md",children:[e.jsx(He,{className:"h-2.5 w-2.5"}),"No Location"]}),l.costSegStatus==="complete"&&e.jsx(A,{variant:"outline",className:"text-xs font-normal px-2 py-0.5 bg-blue-50 dark:bg-blue-900/20 text-blue-600 dar
12k:text-blue-400 border-blue-200 dark:border-blue-700 rounded-md whitespace-nowrap",children:"Estimate Ready"})]})]})},l.id)})})()})}),y.length>E&&e.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 p-4 bg-gray-50 dark:bg-gray-700/50",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(h,{"data-testid":"button-previous-page",variant:"outline",size:"sm",onClick:()=>Q(t=>Math.max(t-1,1)),disabled:q===1,className:"flex-1 mr-2",children:"Previous"}),e.jsxs("span",{className:"text-xs text-gray-500 dark:text-gray-400 px-3",children:[q," /"," ",Math.ceil(y.length/E)]}),e.jsx(h,{"data-testid":"button-next-page",variant:"outline",size:"sm",onClick:()=>Q(t=>Math.min(t+1,Math.ceil(y.length/E))),disabled:q>=Math.ceil(y.length/E),className:"flex-1 ml-2",children:"Next"})]})})]})]}),e.jsxs("div",{className:"flex-1 relative bg-gray-100 dark:bg-gray-800 min-h-0",children:[e.jsx("div",{className:"absolute top-0 left-0 right-0 z-10 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 px-4 py-4 pt-10",children:e.jsx("div",{className:"flex items-center justify-between h-12",children:e.jsxs("div",{className:"flex-1 flex flex-col justify-center",children:[e.jsx("h2",{className:"text-xl font-bold text-gray-900 dark:text-gray-100 leading-tight",children:"Property Locations"}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 leading-tight",children:"Interactive map showing all your properties"})]})})}),L&&e.jsx("div",{className:"absolute inset-0 bg-yellow-50 dark:bg-yellow-900/20 border-2 border-yellow-400 rounded-lg m-4 flex items-center justify-center z-20",children:e.jsxs("div",{className:"text-center p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-yellow-800 dark:text-yellow-200 mb-2",children:"Map Service Unavailable"}),e.jsx("p",{className:"text-sm text-yellow-700 dark:text-yellow-300 mb-4",children:"Interactive map is temporarily unavailable. Static thumbnails are still available in property cards."}),e.jsx(h,{onClick:()=>P(!1),variant:"outline",className:"border-yellow-400 text-yellow-800 dark:text-yellow-200",children:"Got it"})]})}),!g&&!L&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-white dark:bg-gray-800 z-10",style:{to
12p:"64px"},children:e.jsxs("div",{className:"text-center p-8",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-500",children:"Loading interactive map..."})]})}),g&&!L&&e.jsxs("div",{className:"absolute top-32 right-4 z-20 flex flex-col gap-2",children:[e.jsx(h,{"data-testid":"button-zoom-in",size:"sm",variant:"secondary",className:"w-10 h-10 p-0 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 shadow-lg hover:shadow-xl transition-all duration-200",onClick:()=>{var t;return(t=r.current)==null?void 0:t.zoomIn()},children:e.jsx(H,{className:"h-4 w-4"})}),e.jsx(h,{"data-testid":"button-zoom-out",size:"sm",variant:"secondary",className:"w-10 h-10 p-0 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 shadow-lg hover:shadow-xl transition-all duration-200",onClick:()=>{var t;return(t=r.current)==null?void 0:t.zoomOut()},children:e.jsx(We,{className:"h-4 w-4"})}),e.jsx(h,{"data-testid":"button-access-location",size:"sm",variant:"secondary",className:"w-10 h-10 p-0 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 shadow-lg hover:shadow-xl transition-all duration-200",onClick:()=>{navigator.geolocation&&navigator.geolocation.getCurrentPosition(t=>{var l;const{latitude:n,longitude:i}=t.coords;(l=r.current)==null||l.flyTo({center:[i,n],zoom:14})},t=>{console.error("Error getting location:",t)})},children:e.jsxs("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"}),e.jsx("circle",{cx:"12",cy:"10",r:"3"})]})}),e.jsxs("div",{className:"relative",children:[e.jsx(h,{ref:ee,"data-testid":"button-map-layers",size:"sm",variant:"secondary",className:"w-10 h-10 p-0 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 shadow-lg hover:shadow-xl transition-all duration-200",onClick:()=>W(!B),children:e.jsx(Qe,{className:"h-4 w-4"})}),B&&e.jsx("div",{ref:te,"data-testid":"dropdown-map-layers",className:"absolute top-full right-0 mt-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg shadow-lg min-w-[120px] z-30",children:Y.map(t=>e.jsx("button",{"data-testid":`button-map-style-${t.id}`,className:`w-full px-3 py-2 text-sm text-left hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors duration-200 first:rounded-t-lg last:rounded-b-lg ${R===t.id?"bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 font-medium":"text-gray-700 dark:text-gray-300"}`,onClick:()=>{const n=t.style;Pe(t.id),r.current&&(r.current.setStyle(n),r.current.once("style.load",()=>{se()})),W(!1)},children:t.name},t.id))})]})]}),!L&&e.jsx("div",{ref:x,"data-testid":"map-container",className:"w-full h-full pt-16",style:{minHeight:"400px"}})]})]})]})})})}export{nt 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.