1import{r as d,j as e}from"./vendor-react-TXDxJ4pL.js";import{L as N}from"./leaflet-src-CQwB3M6p.js";import{M as J,T as K}from"./leaflet-DBSIo_XY.js";import{v as $,X as Q,cg as H,m as ee,aH as te,bs as oe,cH as re,V as ie,P as se}from"./vendor-icons--IBbgi4o.js";import{b as le,F as ne,M as W}from"./index-DSQ6kcyn.js";import{u as ae,C as de}from"./CadHeader-Cjh972dt.js";import{u as ce}from"./useIsMobile-BwL-IuM8.js";import{g as pe,l as ge}from"./livemapStyles-BpvOOSgQ.js";import{M as fe}from"./mapGeometry-CHWrEvAH.js";import{a as ue}from"./safeUrl-DOkjlKUY.js";import{a as xe}from"./vendor-router-BfSjmGu8.js";import{M as he}from"./Marker-DZPskalJ.js";import{T as me}from"./Tooltip-DmDH40uI.js";import{u as be}from"./hooks-DdP8AsRG.js";import"./vendor-i18n-ZeuoPmU-.js";import"./vendor-axios-BCn5QfZZ.js";import"./vendor-toastify-zImE3QEX.js";import"./vendor-CYhC9tBg.js";import"./vendor-socket-Kk_l3rvZ.js";import"./vendor-helmet-COw7OOqs.js";import"./brandTheme-D_FUAiDP.js";import"./departmentConfig-D0qdBJcF.js";const ye=fe,D=(o,l,a=ye)=>({lat:a.originLat+l*a.scaleY,lng:a.originLng+o*a.scaleX}),h={for_sale:{color:"#22c55e",label:"For Sale"},approved:{color:"#3b82f6",label:"Owned"},foreclosure_pending:{color:"#f59e0b",label:"Foreclosure"},foreclosed:{color:"#ef4444",label:"Foreclosed"}},E=o=>o.status==="for_sale"?h.for_sale.color:ue(o.markerColor,h[o.status]?.color||"#3b82f6"),C={},je=(o,l=!1)=>{const a=`${o}|${l}`;if(C[a])return C[a];const s=l?22:15,i=N.divIcon({className:"cde-prop-marker",html:`<div style="width:${s}px;height:${s}px;border-radius:50%;background:${o};border:2px solid #fff;box-shadow:0 0 0 1px rgba(0,0,0,.5)${l?",0 0 0 4px rgba(34,197,94,.35)":""};"></div>`,iconSize:[s,s],iconAnchor:[s/2,s/2]});return C[a]=i,i},F=o=>Number.isFinite(Number(o))&&Number(o)>0?`$${Number(o).toLocaleString()}`:"-",R=o=>o.businessName||o.ownerName||(o.civilianId?`${o.civilianId.firstName||""} ${o.civilianId.lastName||""}`.trim():"")||"Unknown",v=o=>Number.isFinite(o?.coordinates?.x)&&Number.isFinite(o?.coordinates?.y),_=o=>!o||typeof o!="string"?null:o.startsWith("data:")||o.startsWith("http")?o:`data:image/png;base64,${o}`;function ve({points:o,selected:l}){const a=be();return d.useEffect(()=>{if(l&&v(l)){const s=D(l.coordinates.x,l.coordinates.y);a.flyTo([s.lat,s.lng],Math.max(a.getZoom(),6),{duration:.6})}},[l,a]),d.useEffect(()=>{if(!(l||!o.length))try{const s=N.latLngBounds(o.map(i=>[i.lat,i.lng]));a.fitBounds(s,{padding:[40,40],maxZoom:6})}catch{}},[o.length]),null}const Ge=()=>{const o=xe(),{user:l,logout:a}=le(),{activeCommunity:s}=ne(),[i,f]=ae(),c=ce(900),k=s?._id,[g,O]=d.useState([]),[z,w]=d.useState(!0),[S,L]=d.useState(null),[m,T]=d.useState("all"),[I,U]=d.useState(""),[p,u]=d.useState(null),[b,y]=d.useState({id:null,src:null,loading:!1}),[G,j]=d.useState(!1),Y=pe(ge()),Z=async()=>{try{await a?.()}finally{o("/")}};d.useEffect(()=>{if(!k)return;let r=!1;return w(!0),L(null),W.get(`/properties/community/${k}/map`).then(({data:n})=>{r||(O(Array.isArray(n)?n:[]),w(!1))}).catch(n=>{r||(L(n.response?.data?.error||"Failed to load properties"),w(!1))}),()=>{r=!0}},[k]),d.useEffect(()=>{if(!p?._id){y({id:null,src:null,loading:!1});return}let r=!1;return y({id:p._id,src:null,loading:!0}),W.get(`/properties/${p._id}/screenshot`).then(({data:n})=>{r||y({id:p._id,src:n?.screenshot||null,loading:!1})}).catch(()=>{r||y({id:p._id,src:null,loading:!1})}),()=>{r=!0}},[p?._id]);const x=d.useMemo(()=>{const r=I.trim().toLowerCase();return g.filter(n=>m==="for_sale"&&n.status!=="for_sale"?!1:r?[n.road,n.postal,R(n),n.businessName].filter(Boolean).some(q=>String(q).toLowerCase().includes(r)):!0)},[g,m,I]),M=d.useMemo(()=>x.filter(v).map(r=>{const n=D(r.coordinates.x,r.coordinates.y);return{...r,lat:n.lat,lng:n.lng}}),[x]),V=d.useMemo(()=>g.filter(r=>r.status==="for_sale").length,[g]),X=d.useMemo(()=>x.filter(r=>!v(r)).length,[x]),P=d.useMemo(()=>{const r=new Set(g.map(n=>n.status));return Object.entries(h).filter(([n])=>r.has(n))},[g]);return e.jsxs("div",{className:"property-dir-root",style:t.page,children:[l&&e.jsx(de,{themeMode:i,setThemeMode:f,onLogout:Z}),e.jsx("header",{style:{...t.hero,padding:c?"18px 16px":"24px 24px"},children:e.jsxs("div",{style:t.heroInner,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,marginBottom:6},children:[s?.logo?e.jsx("img",{src:s.logo,alt:s?.name||"Community",style:{width:c?38:46,height:c?38:46,borderRadius:10,objectFit:"cover",flexShrink:0,border:"1px solid #1e293b",background:"#0b0e14"},onError:r=>{r.currentTarget.style.display="none"}}):e.jsx($,{style:{color:"#22c55e",fontSize:c?20:26}}),e.jsxs("div",{style:{minWidth:0},children:[e.jsxs("h1",{style:{...t.title,fontSize:c?20:26},children:["Property Directory",s?.name?` - ${s.name}`:""]}),e.jsxs("p",{style:t.subtitle,children:[g.length," registered · ",e.jsxs("span",{style:{color:"#22c55e"},children:[V," for sale"]})]})]})]}),e.jsxs("div",{style:t.filterRow,children:[e.jsxs("div",{style:t.searchWra
1p,children:[e.jsx(Q,{style:t.searchIcon}),e.jsx("input",{style:t.searchInput,placeholder:"Search road, postal, or owner...",value:I,onChange:r=>U(r.target.value)})]}),e.jsxs("div",{style:t.toggleGroup,children:[e.jsx("button",{onClick:()=>T("all"),style:{...t.toggleBtn,...m==="all"?t.toggleBtnActive:{}},children:"All"}),e.jsxs("button",{onClick:()=>T("for_sale"),style:{...t.toggleBtn,...m==="for_sale"?t.toggleBtnActiveSale:{}},children:[e.jsx(H,{style:{fontSize:11}})," For Sale"]})]})]})]})}),e.jsxs("div",{style:{...t.body,flexDirection:c?"column":"row"},children:[e.jsxs("div",{style:{...t.mapWrap,height:c?"48vh":"auto"},children:[z?e.jsx("div",{style:t.centerFill,children:e.jsx("div",{style:t.spinner})}):S?e.jsx("div",{style:t.centerFill,children:e.jsx("p",{style:{color:"#f87171"},children:S})}):e.jsxs(J,{center:[0,0],zoom:3,minZoom:1,maxZoom:8,style:{height:"100%",width:"100%"},attributionControl:!1,worldCopyJump:!1,children:[e.jsx(K,{url:Y.tileUrl,noWrap:!0}),e.jsx(ve,{points:M,selected:p}),M.map(r=>e.jsx(he,{position:[r.lat,r.lng],icon:je(E(r),p?._id===r._id),eventHandlers:{click:()=>u(r)},zIndexOffset:p?._id===r._id?1e3:0,children:e.jsxs(me,{direction:"top",offset:[0,-8],children:[e.jsx("strong",{children:r.road||"Unknown road"}),r.postal?` · #${r.postal}`:"",r.status==="for_sale"?` · ${F(r.askingPrice||r.value)}`:""]})},r._id))]}),!z&&!S&&P.length>0&&e.jsx("div",{style:t.legend,children:P.map(([r,n])=>e.jsxs("span",{style:t.legendItem,children:[e.jsx("span",{style:{...t.legendDot,background:n.color}})," ",n.label]},r))})]}),e.jsx("aside",{style:{...t.panel,width:c?"100%":380,borderLeft:c?"none":"1px solid #1e293b"},children:p&&!c?e.jsx(A,{property:p,shot:b,onClose:()=>u(null),onOpenImage:()=>j(!0)}):e.jsx(ke,{items:x,selectedId:p?._id,onSelect:u,noCoordsCount:X})})]}),c&&p&&e.jsx("div",{role:"dialog","aria-modal":"true","data-owns-bottom-bar":!0,style:t.sheetBackdrop,onClick:()=>u(null),children:e.jsxs("div",{style:t.sheet,onClick:r=>r.stopPropagation(),children:[e.jsx("div",{style:t.sheetGrab}),e.jsx(A,{property:p,shot:b,onClose:()=>u(null),onOpenImage:()=>j(!0)})]})}),G&&_(b.src)&&e.jsxs("div",{role:"dialog","aria-modal":"true","data-owns-bottom-bar":!0,style:t.lightbox,onClick:()=>j(!1),children:[e.jsx("img",{src:_(b.src),alt:"Property",style:t.lightboxImg,onClick:r=>r.stopPropagation()}),e.jsx("button",{style:t.lightboxClose,onClick:()=>j(!1),children:e.jsx(ee,{})})]}),e.jsx("style",{children:` 2 @keyframes spin { to { transform: rotate(360deg); } } 3 .property-dir-root svg { vertical-align: middle; display: inline-block; } 4 .cde-prop-marker { background: transparent; border: none; } 5 .leaflet-container { background: #0b0e14; } 6 `})]})},A=({property:o,shot:l,onClose:a,onOpenImage:s})=>{const i=h[o.status]||{color:"#3b82f6",label:o.status},f=o.status==="for_sale"&&o.askingPrice||o.value,c=_(l.id===o._id?l.src:null);return e.jsxs("div",{style:t.detail,children:[e.jsxs("div",{style:t.detailHeader,children:[e.jsx("span",{style:{...t.statusPill,background:`${i.color}22`,color:i.color,border:`1px solid ${i.color}55`},children:i.label}),e.jsx("button",{style:t.iconBtn,onClick:a,"aria-label":"Back to list",children:e.jsx(te,{})})]}),e.jsx("div",{style:t.imageBox,children:l.loading?e.jsx("div",{style:t.centerFill,children:e.jsx("div",{style:t.spinner})}):c?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:c,alt:o.road||"Property",style:t.image}),e.jsx("button",{style:t.expandBtn,onClick:s,"aria-label":"Expand image",children:e.jsx(oe,{})})]}):e.jsxs("div",{style:t.imagePlaceholder,children:[e.jsx(re,{style:{fontSize:26,marginBottom:6}}),e.jsx("span",{children:"No image on file"})]})}),e.jsx("h2",{style:t.detailTitle,children:o.road||"Unknown road"}),e.jsxs("div",{style:t.detailPrice,children:[F(f),o.status==="for_sale"&&e.jsx("span",{style:t.priceHint,children:" asking"})]}),e.jsxs("div",{style:t.detailRows,children:[e.jsx(B,{icon:e.jsx(ie,{}),label:"Postal",value:o.postal||"-"}),e.jsx(B,{icon:e.jsx(se,{}),label:"Owner",value:R(o)}),o.businessName&&e.jsx(B,{icon:e.jsx(H,{}),label:"Business",value:o.businessName})]}),o.saleDescription&&e.jsxs("div",{style:t.descBox,children:[e.jsx("div",{style:t.descLabel,children:"Description"}),e.jsx("p",{style:t.descText,children:o.saleDescription})]})]})},B=({icon:o,label:l,value:a})=>e.jsxs("div",{style:t.row,children:[e.jsx("span",{style:t.rowIcon,children:o}),e.jsx("span",{style:t.rowLabel,children:l}),e.jsx("span",{style:t.rowValue,children:a})]}),ke=({items:o,selectedId:l,onSelect:a,noCoordsCount:s})=>o.length?e.jsxs("div",{style:t.list,children:[e.jsxs("div",{style:t.listHint,children:[o.length," propert",o.length===1?"y":"ies"," · click a marker or row for details"]}
6),o.map(i=>{h[i.status]||i.status;const f=i.status==="for_sale"&&i.askingPrice||i.value;return e.jsxs("button",{onClick:()=>a(i),style:{...t.listItem,...l===i._id?t.listItemActive:{}},children:[e.jsx("span",{style:{...t.listDot,background:E(i)}}),e.jsxs("span",{style:{flex:1,minWidth:0,textAlign:"left"},children:[e.jsx("span",{style:t.listRoad,children:i.road||"Unknown road"}),e.jsxs("span",{style:t.listSub,children:[i.postal?`#${i.postal} · `:"",R(i),v(i)?"":" · (no map pin)"]})]}),e.jsx("span",{style:{...t.listPrice,color:i.status==="for_sale"?"#22c55e":"#9ca3af"},children:F(f)})]},i._id)}),s>0&&e.jsxs("div",{style:t.listFootnote,children:[s," of these have no map coordinates and only appear in this list."]})]}):e.jsxs("div",{style:t.emptyList,children:[e.jsx($,{style:{fontSize:40,color:"#2d3748",marginBottom:12}}),e.jsx("p",{style:{color:"#6b7280",margin:0},children:"No properties match your search."})]}),t={page:{minHeight:"100vh",display:"flex",flexDirection:"column",background:"#000",color:"#e2e8f0",overflowX:"hidden",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},hero:{background:"linear-gradient(180deg, #141822 0%, #000 100%)",borderBottom:"1px solid #1e293b",flexShrink:0},heroInner:{maxWidth:1400,margin:"0 auto"},title:{margin:"0 0 2px",fontWeight:700,color:"#f8fafc"},subtitle:{margin:0,color:"#9ca3af",fontSize:14},filterRow:{display:"flex",gap:12,marginTop:14,flexWrap:"wrap"},searchWrap:{position:"relative",flex:1,minWidth:220},searchIcon:{color:"#6b7280",position:"absolute",left:14,top:"50%",transform:"translateY(-50%)"},searchInput:{width:"100%",padding:"10px 14px 10px 40px",background:"#141822",border:"1px solid #2d3748",borderRadius:8,color:"#e2e8f0",fontSize:14,outline:"none",boxSizing:"border-box"},toggleGroup:{display:"flex",background:"#141822",border:"1px solid #2d3748",borderRadius:8,overflow:"hidden"},toggleBtn:{display:"inline-flex",alignItems:"center",gap:6,padding:"10px 16px",background:"transparent",border:"none",color:"#9ca3af",fontSize:13,fontWeight:600,cursor:"pointer"},toggleBtnActive:{background:"#1e293b",color:"#fff"},toggleBtnActiveSale:{background:"rgba(34,197,94,.15)",color:"#22c55e"},body:{flex:1,display:"flex",minHeight:0,maxWidth:1400,width:"100%",margin:"0 auto"},mapWrap:{position:"relative",flex:1,minWidth:0,minHeight:0,background:"#0b0e14"},centerFill:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"},spinner:{width:36,height:36,border:"3px solid #2d3748",borderTop:"3px solid #22c55e",borderRadius:"50%",animation:"spin 1s linear infinite"},legend:{position:"absolute",bottom:12,left:12,zIndex:500,display:"flex",gap:12,flexWrap:"wrap",background:"rgba(11,14,20,.85)",border:"1px solid #1e293b",borderRadius:8,padding:"8px 12px",fontSize:12},legendItem:{display:"inline-flex",alignItems:"center",gap:6,color:"#cbd5e1"},legendDot:{width:10,height:10,borderRadius:"50%",display:"inline-block",border:"1px solid #fff"},panel:{flexShrink:0,background:"#0b0e14",overflowY:"auto"},detail:{padding:16},detailHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},statusPill:{display:"inline-flex",alignItems:"center",padding:"4px 12px",borderRadius:20,fontSize:12,fontWeight:700},iconBtn:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:32,height:32,borderRadius:8,background:"#141822",border:"1px solid #2d3748",color:"#9ca3af",cursor:"pointer"},imageBox:{position:"relative",width:"100%",aspectRatio:"16 / 10",background:"#141822",border:"1px solid #1e293b",borderRadius:10,overflow:"hidden",marginBottom:14},image:{width:"100%",height:"100%",objectFit:"cover",display:"block"},imagePlaceholder:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#4b5563",fontSize:13},expandBtn:{position:"absolute",top:8,right:8,width:30,height:30,borderRadius:8,background:"rgba(0,0,0,.55)",border:"1px solid #2d3748",color:"#e2e8f0",cursor:"pointer"},detailTitle:{margin:"0 0 4px",fontSize:20,fontWeight:700,color:"#f8fafc"},detailPrice:{fontSize:22,fontWeight:800,color:"#22c55e",marginBottom:14},priceHint:{fontSize:13,fontWeight:600,color:"#6b7280"},detailRows:{display:"flex",flexDirection:"column",gap:2,marginBottom:14},row:{display:"flex",alignItems:"center",gap:10,padding:"10px 0",borderBottom:"1px solid #141822"},rowIcon:{color:"#6b7280",width:16,textAlign:"center",flexShrink:0},rowLabel:{color:"#9ca3af",fontSize:13,width:72,flexShrink:0},rowValue:{color:"#f1f5f9",fontSize:14,fontWeight:600,marginLeft:"auto",textAlign:"right",wordBreak:"break-word"},descBox:{background:"#141822",border:"1px solid #1e293b",borderRadius:10,padding:12},descLabel:{color:"#6b7280",fontSize:11,textTransform:"uppercase",letterSpacing:".5px",marginBottom:6},descText:{margin:0,color:"#cbd5e1",fontSize:13,lineHeight:1.5,whiteSpace:"pre-wrap"},list:{padding:12},listHint:{color:"#6b7280",fontSize:12,padding:"4px 6px 10px"},listItem:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"10px 10px",marginBottom:6,background:"#141822",border:"1px solid #1e293b",borderRadius:10,cursor:"pointer",color:"#e2e8f0"},listItemActive:{borderColor:"#22c55e",background:"#16211a"},listDot:{width:10,height:10,borderRadius:"50%",flexShrink:0,border:"1px solid #fff"},listRoad:{display:"block",fontSize:14,fontWeight:600,color:"#f8fafc",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},listSub:{display:"block",fontSize:12,color:"#94a3b8",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},listPrice:{fontSize:13,fontWeight:700,flexShrink:0},listFootnote:{color:"#6b7280",fontSize:11,padding:"8px 6px",lineHeight:1.5},emptyList:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",textAlign:"center",padding:"60px 20px"},sheetBackdrop:{position:"fixed",inset:0,zIndex:9e3,background:"rgba(0,0,0,.5)",display:"flex",alignItems:"flex-end"},sheet:{width:"100%",maxHeight:"85vh",overflowY:"auto",background:"#0b0e14",borderTopLeftRadius:16,borderTopRightRadius:16,borderTop:"1px solid #1e293b",boxShadow:"0 -12px 40px rgba(0,0,0,.55)"},sheetGrab:{width:40,height:4,borderRadius:2,background:"#334155",margin:"10px auto 2px"},lightbox:{position:"fixed",inset:0,zIndex:1e4,background:"rgba(0,0,0,.85)",display:"flex",alignItems:"center",justifyContent:"center",padding:24},lightboxImg:{maxWidth:"92vw",maxHeight:"88vh",borderRadius:8,boxShadow:"0 20px 60px rgba(0,0,0,.6)"},lightboxClose:{position:"absolute",top:20,right:20,width:40,height:40,borderRadius:10,background:"rgba(20,24,34,.9)",border:"1px solid #2d3748",color:"#fff",fontSize:18,cursor:"pointer"}};export{Ge 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.