PageSourceSearch

https://jhasolutions.com/assets/ShowcaseMap-RvKRSzp5.js

js jhasolutions.com collected 2026-09-24 14:46:45 UTC 25,871 bytes, 1 lines download raw bytes

1import{r as h,j as e}from"./query-vendor-Dp9tfhuh.js";import{u as I,x as G,B as x,h as R,m as z,E as ue,f as je,c as D,D as H,p as U,q as W,r as K,L as P,v as q}from"./index-CgOeqv80.js";import{I as T}from"./input-go5takyh.js";import{E as fe,u as ge}from"./use-mobile-CojsY12Z.js";import{D as Ne}from"./DashboardLayout-v_SFEx5M.js";import{F as ve}from"./FeatureGate-Dy39LW4d.js";import{T as B}from"./textarea-BSB7eVDL.js";import{B as J}from"./badge-CarGzGVG.js";import{S as ie}from"./scroll-area-DpCy8yLM.js";import{D as we,a as be,b as Ce,c as O}from"./dropdown-menu-BeZf8kFV.js";import{A as ke,a as Se,b as ye,c as Pe,d as De,e as Le,f as _e,g as Ee}from"./alert-dialog-BvM39fc1.js";import{u as Fe,a as ae}from"./useShowcasePortfolios-DwmfPO1L.js";import{P as Y}from"./plus-CYnN_kFu.js";import{F as Te}from"./tree-pine-CouWAS-6.js";import{P as Me}from"./pencil-d1bR18nI.js";import{S as re}from"./share-2-sKHj2vjO.js";import{T as le}from"./trash-2-DAqLpVlV.js";import{u as Oe,G as Ae,M as Z,P as Re,I as ze}from"./esm-BHLdRt99.js";import{G as Be,a as Ie,b as Ge}from"./googleMaps-CnGBkgZD.js";import{u as oe}from"./useRouteCalculation-BhAVtfOt.js";import{R as ne}from"./route-Df-61sSI.js";import{M as $}from"./map-pin-B63H-upO.js";import{C as ce}from"./clock-BmPJ466V.js";import{S as $e}from"./save-DF6x0jpO.js";import{N as Ve}from"./navigation-mR6QetLo.js";import{A as He}from"./arrow-down-CIVFAk8G.js";import{S as Q,a as Ue,b as X}from"./sheet-bqYui_d3.js";import{a as We}from"./react-vendor-DfslLuwi.js";import{A as Ke}from"./arrow-left-BmX2tYO6.js";import{L as qe}from"./list-BJoWfKXY.js";import{M as ee}from"./map-C8rxfYCS.js";import{S as Je}from"./search-Dx_o7OfG.js";import"./ui-vendor-DW4RoVmg.js";import"./chart-vendor-BoynbIzZ.js";import"./separator-DP1KYTpB.js";import"./skeleton-U7PtyM3w.js";import"./tooltip-CSLOX5Ak.js";import"./Logo-Dty4QCqO.js";import"./calendar-days-Cbs598pa.js";import"./building-2-BMIYvzwG.js";import"./users-9XO_ctWv.js";import"./wrench-CDdvezGQ.js";import"./wifi-off-BfVaxzCl.js";import"./message-square-B81woyC-.js";import"./file-text-CuOiBfSM.js";import"./credit-card-B-2xvAjl.js";import"./panel-top-BGv8mfXo.js";import"./mail-CObWevXE.js";import"./log-out-SS0g6Uak.js";import"./bell-D0vTOuek.js";import"./check-check-2zE5w8gN.js";import"./formatDistanceToNow-DExfhm_y.js";import"./en-US-5rFTtd83.js";import"./LanguageSwitcher-DHMsopEY.js";import"./languages-DOZFgZ9Q.js";import"./check-v4vwqlB-.js";import"./message-circle-BYe5rrWz.js";import"./activity-CfnIewRD.js";import"./arrow-right-left-DF8EQ874.js";import"./arrow-right-ksEPM703.js";import"./banknote-CdW1Jv9F.js";import"./bed-B88pYHvh.js";import"./list-ordered-hB6RbGtG.js";import"./book-open-check-DYZCLGLv.js";import"./book-open-D0Y1dKqG.js";import"./brain-BohJitgU.js";import"./building-DasY5zOg.js";import"./calculator-ByooPTmb.js";import"./calendar-D4RFJDPY.js";import"./car-D3b4R55M.js";import"./landmark-BwZdzl4J.js";import"./chart-no-axes-column-increasing-C6Bh1bTG.js";import"./chart-pie-7jztI-xg.js";import"./chevron-down-Bm2Y15mk.js";import"./chevron-left-DCDYd6CA.js";import"./chevron-right-BdUdHP_I.js";import"./chevron-up-DVBQQKr7.js";import"./circle-check-big-CQmmVCDK.js";import"./circle-check-CLkepror.js";import"./message-square-text-W-2xUYbe.js";import"./circle-help-Cpt-rFJF.js";import"./circle-x-CMEjdGNX.js";import"./circle-pSWMGBM_.js";import"./clipboard-check-Cvc1fMv5.js";import"./clipboard-list-FvLR_NG8.js";import"./clipboard-viWVwQwk.js";import"./copy-BEDU18te.js";import"./database-kv95WpLa.js";import"./dollar-sign-D0iC4HrG.js";import"./download-B3iahoQg.js";import"./zoom-out-zrJfLdu9.js";import"./external-link-BIGsQXrz.js";import"./twitter-BaxQU1X8.js";import"./file-chart-column-increasing-DEN9Rsed.js";import"./file-check-cM7E4NaC.js";import"./file-spreadsheet-ZK-q7Zgc.js";import"./filter-Bs-PYMIY.js";import"./folder-open-DFmVGiUq.js";import"./globe-C_UDh3Yp.js";import"./video-DaS8rS9K.js";import"./hammer-691LkvTd.js";import"./heart-Dv9Odr8c.js";import"./hotel-C1w3GOsr.js";import"./house-5R4LHGOP.js";import"./image-plus-xT5L-tET.js";import"./image-CayqqQKD.js";import"./infinity-wq20aEtI.js";import"./key-round-Dh3U7Shh.js";import"./pen-tool-_n2hBO7N.js";import"./keyboard-CSqz3mRU.js";import"./layers-D0VRol72.js";import"./lightbulb-DlRuWc33.js";import"./list-checks-coQAK2sr.js";import"./lock-B0M9hAnN.js";import"./map-pinned-B-fJbXg-.js";import"./maximize-2-CZGGiq67.js";import"./maximize-DHDDLx00.js";import"./menu-DuKtMQlr.js";import"./minus-04ztrfH_.js";import"./mouse-pointer-click-Bc_ivnf4.js";import"./mouse-CUCnDlYq.js";import"./pause-DWfQPC5O.js";import"./ruler-BoWqmUga.js";import"./phone-I9m-09C5.js";import"./play-CVPqrcf1.js";import"./printer-DjW2gpx9.js";import"./refresh-ccw-BR8hKK-Q.js";
1import"./rocket-DxjHbFsp.js";import"./rotate-ccw-CE2HFYnH.js";import"./rotate-cw-n6J_8Piu.js";import"./scale-CZXGlUhc.js";import"./send-Blf9Z7mq.js";import"./square-plus-Dp1sCmj5.js";import"./skip-forward-eFm9X_4U.js";import"./smartphone-CBjqwShe.js";import"./square-check-big-DF0dFzei.js";import"./square-pen-Bg7uj701.js";import"./square-MsVDU0g-.js";import"./star-DlIZz9Im.js";import"./trending-down-COltpy2W.js";import"./trending-up-CRE5UWZg.js";import"./upload-55xlfOPi.js";import"./user-check-XkucE5f8.js";import"./user-DV5oCLCs.js";import"./volume-2-DTT7l7C1.js";import"./volume-x-BBMkTIRp.js";import"./wallet-_cnDvlQk.js";import"./workflow-Bfwpj-zP.js";import"./zap-BKGpOGd1.js";import"./useIsRTL-D_a81cVb.js";import"./useOrganization-msM7McOc.js";import"./UpgradePrompt-BocCWdcP.js";import"./usePaddle-CWtEfRja.js";import"./paddleJs-D6vCOr2I.js";import"./index-BdQq_4o_.js";function se({selectedPortfolio:o,onSelectPortfolio:g,className:j}){const{t:i}=I(),{portfolios:r,isLoading:N,createPortfolio:C,updatePortfolio:b,deletePortfolio:S}=Fe(),{toast:l}=G(),[d,c]=h.useState(!1),[v,a]=h.useState(null),[n,f]=h.useState(null),[m,u]=h.useState({title:"",description:""}),L=()=>{m.title.trim()&&C.mutate(m,{onSuccess:s=>{c(!1),u({title:"",description:""}),g(s)}})},_=()=>{!v||!m.title.trim()||b.mutate({id:v.id,title:m.title,description:m.description||null},{onSuccess:()=>{a(null),u({title:"",description:""})}})},E=()=>{n&&S.mutate(n.id,{onSuccess:()=>{(o==null?void 0:o.id)===n.id&&g(null),f(null)}})},y=s=>{const w=`https://jhasolutions.com/showcase-view/${s.public_token}`;navigator.clipboard.writeText(w),l({title:i("showcase.linkCopied","Link copied to clipboard")})},p=s=>{b.mutate({id:s.id,is_published:!s.is_published})};return e.jsxs("div",{className:D("flex flex-col h-full bg-background border-r",j),children:[e.jsxs("div",{className:"p-3 border-b",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h2",{className:"font-semibold text-sm",children:i("showcase.myPortfolios","My Portfolios")}),e.jsx(x,{size:"sm",variant:"ghost",onClick:()=>{u({title:"",description:""}),c(!0)},children:e.jsx(Y,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[r.length," ",r.length!==1?i("showcase.portfolios","portfolios"):i("showcase.portfolio","portfolio")]})]}),e.jsx(ie,{className:"flex-1",children:e.jsx("div",{className:"p-2 space-y-1",children:N?e.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:i("showcase.loading","Loading...")}):r.length===0?e.jsxs("div",{className:"p-4 text-center",children:[e.jsx(Te,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i("showcase.noPortfolios","No portfolios yet")}),e.jsxs(x,{size:"sm",className:"mt-2",onClick:()=>{u({title:"",description:""}),c(!0)},children:[e.jsx(Y,{className:"h-4 w-4 mr-1"}),i("showcase.createFirst","Create First")]})]}):r.map(s=>e.jsx(R,{className:D("cursor-pointer transition-all hover:bg-accent/50",(o==null?void 0:o.id)===s.id&&"ring-2 ring-primary bg-accent"),onClick:()=>g(s),children:e.jsx(z,{className:"p-2.5",children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[e.jsx("span",{className:"font-medium text-sm truncate",children:s.title}),s.is_published?e.jsx(J,{variant:"default",className:"text-[10px] px-1 py-0 h-4",children:i("showcase.live","Live")}):e.jsx(J,{variant:"secondary",className:"text-[10px] px-1 py-0 h-4",children:i("showcase.draft","Draft")})]}),s.description&&e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description}),e.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1",children:[s.view_count," ",i("showcase.views","views")]})]}),e.jsxs(we,{children:[e.jsx(be,{asChild:!0,onClick:w=>w.stopPropagation(),children:e.jsx(x,{variant:"ghost",size:"icon",className:"h-6 w-6",children:e.jsx(fe,{className:"h-3.5 w-3.5"})})}),e.jsxs(Ce,{align:"end",children:[e.jsxs(O,{onClick:w=>
1{w.stopPropagation(),u({title:s.title,description:s.description||""}),a(s)},children:[e.jsx(Me,{className:"h-3.5 w-3.5 mr-2"}),i("showcase.edit","Edit")]}),e.jsx(O,{onClick:w=>{w.stopPropagation(),p(s)},children:s.is_published?e.jsxs(e.Fragment,{children:[e.jsx(ue,{className:"h-3.5 w-3.5 mr-2"}),i("showcase.unpublish","Unpublish")]}):e.jsxs(e.Fragment,{children:[e.jsx(je,{className:"h-3.5 w-3.5 mr-2"}),i("showcase.publish","Publish")]})}),s.is_published&&e.jsxs(O,{onClick:w=>{w.stopPropagation(),y(s)},children:[e.jsx(re,{className:"h-3.5 w-3.5 mr-2"}),i("showcase.shareLink","Share Link")]}),e.jsxs(O,{className:"text-destructive",onClick:w=>{w.stopPropagation(),f(s)},children:[e.jsx(le,{className:"h-3.5 w-3.5 mr-2"}),i("showcase.delete","Delete")]})]})]})]})})},s.id))})}),e.jsx(H,{open:d,onOpenChange:c,children:e.jsxs(U,{children:[e.jsx(W,{children:e.jsx(K,{children:i("showcase.createPortfolio","Create Portfolio")})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(P,{htmlFor:"title",children:i("showcase.title","Title")}),e.jsx(T,{id:"title",value:m.title,onChange:s=>u({...m,title:s.target.value}),placeholder:i("showcase.titlePlaceholder","My Property Portfolio")})]}),e.jsxs("div",{children:[e.jsx(P,{htmlFor:"description",children:i("showcase.descriptionOptional","Description (optional)")}),e.jsx(B,{id:"description",value:m.description,onChange:s=>u({...m,description:s.target.value}),placeholder:i("showcase.descriptionPlaceholder","A collection of properties..."),rows:3})]})]}),e.jsxs(q,{children:[e.jsx(x,{variant:"outline",onClick:()=>c(!1),children:i("common.cancel","Cancel")}),e.jsx(x,{onClick:L,disabled:C.isPending,children:i("common.create","Create")})]})]})}),e.jsx(H,{open:!!v,onOpenChange:s=>!s&&a(null),children:e.jsxs(U,{children:[e.jsx(W,{children:e.jsx(K,{children:i("showcase.editPortfolio","Edit Portfolio")})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(P,{htmlFor:"edit-title",children:i("showcase.title","Title")}),e.jsx(T,{id:"edit-title",value:m.title,onChange:s=>u({...m,title:s.target.value})})]}),e.jsxs("div",{children:[e.jsx(P,{htmlFor:"edit-description",children:i("showcase.description","Description")}),e.jsx(B,{id:"edit-description",value:m.description,onChange:s=>u({...m,description:s.target.value}),rows:3})]})]}),e.jsxs(q,{children:[e.jsx(x,{variant:"outline",onClick:()=>a(null),children:i("common.cancel","Cancel")}),e.jsx(x,{onClick:_,disabled:b.isPending,children:i("common.save","Save")})]})]})}),e.jsx(ke,{open:!!n,onOpenChange:s=>!s&&f(null),children:e.jsxs(Se,{children:[e.jsxs(ye,{children:[e.jsx(Pe,{children:i("showcase.deletePortfolio","Delete Portfolio?")}),e.jsx(De,{children:i("showcase.deletePortfolioDesc",'This will permanently delete "{title}" and all its pins.').replace("{title}",(n==null?void 0:n.title)||"")})]}),e.jsxs(Le,{children:[e.jsx(_e,{children:i("common.cancel","Cancel")}),e.jsx(Ee,{onClick:E,className:"bg-destructive text-destructive-foreground",children:i("common.delete","Delete")})]})]})})]})}const Ye={width:"100%",height:"100%"},Ze={lat:32.0853,lng:34.7818},F=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"],A=["#3B82F6","#EF4444","#10B981","#F59E0B","#8B5CF6","#EC4899","#06B6D4","#F97316","#84CC16","#6366F1"],Qe=h.forwardRef(({portfolioId:o,onPinSelect:g,onAddingPinChange:j,onMapLoad:i},r)=>{const{pins:N,createPin:C,updatePin:b,deletePin:S}=ae(o),{toast:l}=G(),d=h.useRef(null),[c,v]=h.useState(null),[a,n]=h.useState(null),[f,m]=h.useState(!1),[u,L]=h.useState(!0),[_,E]=h.useState(!1),{isLoaded:y,loadError:p}=Oe({id:Be,googleMapsApiKey:Ie,libraries:Ge}),{routeInfo:s,isCalculating:w}=oe(N,_),de=h.useCallback(t=>{if(d.current=t,E(!0),i==null||i(),N.length>0&&typeof google<"u"&&google.maps){const k=new google.maps.LatLngBounds;N.forEach(M=>{k.extend({lat:M.latitude,lng:M.longitude})}),t.fitBounds(k)}},[N,i]);h.useImperativeHandle(r,()=>({goToLocation:t=>{d.current&&(d.current.panTo({lat:t.lat,lng:t.lng}),d.current.setZoom(15)),f&&(n({latitude:t.lat,longitude:t.lng,title:"",description:"",address:t.address||"",pin_color:F[0]}),m(!1),j==null||j(!1))},setAddingPinMode:t=>{m(t),j==null||j(t)},isAddingPin:f,isLoaded:y}),[f,y,j]);const me=t=>{if(!f||!t.latLng)return;const k=t.latLng.lat(),M=t.latLng.lng();n({latitude:k,longitude:M,title:"",description:"",pin_color:F[0]}),m(!1),j==null||j(!1)},pe=()=>{var t;if(!((t=a==null?void 0:a.title)!=null&&t.trim())){l({title:"Please enter a title",variant:"destructive"});return}
1a.id?b.mutate({id:a.id,title:a.title,description:a.description,address:a.address,pin_color:a.pin_color}):C.mutate({portfolio_id:o,title:a.title,description:a.description||void 0,address:a.address||void 0,latitude:a.latitude,longitude:a.longitude,pin_color:a.pin_color||F[0]}),n(null),v(null)},he=t=>{S.mutate(t.id),v(null),n(null)},xe=t=>{v(t),n(null),g==null||g(t),d.current&&d.current.panTo({lat:t.latitude,lng:t.longitude})},V=h.useCallback(t=>{if(typeof google<"u"&&google.maps)return{path:google.maps.SymbolPath.CIRCLE,scale:12,fillColor:t,fillOpacity:1,strokeColor:"#ffffff",strokeWeight:2}},[]);return p?e.jsx("div",{className:"flex items-center justify-center h-full text-destructive",children:"Error loading map"}):y?e.jsxs("div",{className:"relative w-full h-full",children:[f&&e.jsx("div",{className:"absolute top-4 left-4 z-10",children:e.jsx("p",{className:"text-xs bg-background/90 p-2 rounded shadow",children:"Click on the map to place a pin"})}),e.jsxs(Ae,{mapContainerStyle:Ye,center:Ze,zoom:10,onLoad:de,onClick:me,options:{fullscreenControl:!1,streetViewControl:!1,mapTypeControl:!0,zoomControl:!0},children:[N.map(t=>e.jsx(Z,{position:{lat:t.latitude,lng:t.longitude},icon:V(t.pin_color),onClick:()=>xe(t)},t.id)),a&&!a.id&&e.jsx(Z,{position:{lat:a.latitude,lng:a.longitude},icon:V(a.pin_color||F[0])}),u&&(s==null?void 0:s.segments.map((t,k)=>e.jsx(Re,{path:t.polyline,options:{strokeColor:A[k%A.length],strokeOpacity:.8,strokeWeight:4}},`route-${t.from.id}-${t.to.id}`))),c&&!a&&e.jsx(ze,{position:{lat:c.latitude,lng:c.longitude},onCloseClick:()=>v(null),children:e.jsxs("div",{className:"p-2 max-w-[250px]",children:[e.jsx("h3",{className:"font-semibold mb-1",children:c.title}),c.description&&e.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:c.description}),c.address&&e.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:c.address}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(x,{size:"sm",variant:"outline",onClick:()=>n(c),children:"Edit"}),e.jsx(x,{size:"sm",variant:"destructive",onClick:()=>he(c),children:e.jsx(le,{className:"h-3.5 w-3.5"})})]})]})})]}),s&&s.segments.length>0&&!a&&e.jsx("div",{className:"absolute top-4 right-4 z-10 max-w-xs",children:e.jsx(R,{className:"bg-background/95 backdrop-blur-sm",children:e.jsxs(z,{className:"p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"font-semibold text-sm",children:"Routes"})]}),e.jsx(x,{variant:u?"default":"outline",size:"sm",className:"h-7 text-xs",onClick:()=>L(!u),children:u?"On":"Off"})]}),u&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex gap-4 mb-3 p-2 bg-primary/10 rounded text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx($,{className:"h-3 w-3"}),e.jsx("span",{children:s.totalDistance})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ce,{className:"h-3 w-3"}),e.jsx("span",{children:s.totalDuration})]})]}),e.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:s.segments.map((t,k)=>e.jsxs("div",{className:"text-xs border-l-2 pl-2 py-1",style:{borderColor:A[k%A.length]},children:[e.jsx("div",{className:"font-medium truncate",children:t.from.title}),e.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[e.jsx("span",{children:"→"}),e.jsx("span",{children:t.distance}),e.jsx("span",{children:"•"}),e.jsx("span",{children:t.duration})]}),e.jsx("div",{className:"font-medium truncate",children:t.to.title})]},`segment-${k}`))})]}),w&&e.jsx("div",{className:"text-xs text-muted-foreground",children:"Calculating routes..."})]})})}),a&&e.jsx("div",{className:"absolute bottom-4 left-4 right-4 z-10",children:e.jsx(R,{children:e.jsxs(z,{className:"p-4",children:[e.jsx("h4",{className:"font-semibold mb-3",children:a.id?"Edit Pin":"New Pin"}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx(P,{htmlFor:"pin-title",children:"Title *"}),e.jsx(T,{id:"pin-title",value:a.title||"",onChange:t=>n({...a,title:t.target.value}),placeholder:"Pin title"})]}),e.jsxs("div",{children:[e.jsx(P,{htmlFor:"pin-address",children:"Address"}),e.jsx(T,{id:"pin-address",value:a.address||"",onChange:t=>n({...a,address:t.target.value}),placeholder:"123 Main St"})]}),e.jsxs("div",{className:"sm:col-span-2",children:[e.jsx(P,{htmlFor:"pin-description",children:"Description"}),e.jsx(B,{id:"pin-description",value:a.description||"",onChange:t=>n({...a,description:t.target.value}),placeholder:"Optional description",rows:2})]}),e.jsxs("div",{children:[e.jsx(P,{children:"Pin Color"}),e.jsx("div",{className:"flex gap-1.5 mt-1",children:F.map(t=>e.jsx("button",{type:"button",className:`w-6 h-6 rounded-full border-2 transition-transform ${a.pin_color===t?"border-foreground scale-110":"border-transparent"}`,style:{backgroundColor:t},onClick:()=>n({...a,pin_color:t})},t))})]}),e.jsxs("div",{className:"flex items-end gap-2 justify-end sm:col-span-1",children:[e.jsx(x,{variant:"outline",size:"sm",onClick:()=>{n(null),v(null)},children:"Cancel"}),e.jsxs(x,{size:"sm",onClick:pe,disabled:C.isPending||b.isPending,children:[e.jsx($e,{className:"h-4 w-4 mr-1"}),"Save"]})]})]})]})})})]}):e.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:"Loading map..."})});function te({pins:o,selectedPin:g,onPinSelect:j,routeInfo:i,className:r}){const{t:N}=I(),C=l=>{const d=`https://www.google.com/maps/dir/?api=1&destination=${l.latitude},${l.longitude}`;window.open(d,"_blank")},b=[...o].sort((l,d)=>
1l.display_order!==d.display_order?(l.display_order||0)-(d.display_order||0):new Date(l.created_at||0).getTime()-new Date(d.created_at||0).getTime()),S=l=>!i||l>=b.length-1?null:i.segments[l];return o.length===0?e.jsxs("div",{className:D("flex flex-col items-center justify-center p-6 text-center",r),children:[e.jsx($,{className:"h-10 w-10 text-muted-foreground mb-3"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:N("showcase.noPins",'No pins yet. Click "Add Pin" on the map to get started.')})]}):e.jsx(ie,{className:D("h-full",r),children:e.jsxs("div",{className:"p-2 space-y-1",children:[i&&i.segments.length>0&&e.jsxs("div",{className:"mx-2 mb-3 p-2 bg-primary/10 rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium",children:[e.jsx(ne,{className:"h-3.5 w-3.5 text-primary"}),e.jsx("span",{children:N("showcase.totalRoute","Total Route")})]}),e.jsxs("div",{className:"flex gap-3 mt-1 text-xs text-muted-foreground",children:[e.jsx("span",{children:i.totalDistance}),e.jsx("span",{children:"•"}),e.jsx("span",{children:i.totalDuration})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground px-2 mb-2",children:N("showcase.clickPinToView","Click a pin to view on map")}),b.map((l,d)=>{const c=S(d);return e.jsx(R,{className:D("cursor-pointer transition-all hover:shadow-md mb-1",(g==null?void 0:g.id)===l.id&&"ring-2 ring-primary"),onClick:()=>j(l),children:e.jsxs(z,{className:"p-3",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-8 h-8 rounded-full flex items-center justify-center text-white text-sm font-medium shrink-0",style:{backgroundColor:l.pin_color},children:d+1}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h4",{className:"font-medium text-sm truncate",children:l.title}),l.address&&e.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:l.address}),l.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 mt-1",children:l.description}),e.jsx("div",{className:"flex gap-1 mt-2",children:e.jsxs(x,{size:"xs",variant:"outline",onClick:v=>{v.stopPropagation(),C(l)},children:[e.jsx(Ve,{className:"h-3 w-3 mr-1"}),N("showcase.navigate","Navigate")]})})]})]}),c&&e.jsxs("div",{className:"mt-3 pt-3 border-t flex items-center justify-center gap-2 text-xs text-muted-foreground",children:[e.jsx(He,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"font-medium",children:c.distance}),e.jsx("span",{children:"•"}),e.jsx(ce,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"font-medium",children:c.duration})]})]})},l.id)})]})})}const Xe=({onLocationSelect:o,placeholder:g})=>e.jsxs("div",{className:"relative",children:[e.jsx(Je,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-muted-foreground"}),e.jsx(T,{placeholder:g,className:"pl-10",disabled:!0})]}),Ki=()=>{const{t:o}=I(),g=We(),{toast:j}=G(),i=ge(),[r,N]=h.useState(null),[C,b]=h.useState(null),[S,l]=h.useState(!1),[d,c]=h.useState(!1),[v,a]=h.useState(!1),n=h.useRef(null),{pins:f}=ae(r==null?void 0:r.id),{routeInfo:m}=oe(f,v),u=()=>{if(!r)return;const p=`https://jhasolutions.com/showcase-view/${r.public_token}`;navigator.clipboard.writeText(p),j({title:o("showcase.linkCopied","Link copied to clipboard")})},L=p=>{var s;(s=n.current)==null||s.goToLocation(p)},_=()=>{var s;const p=!d;c(p),(s=n.current)==null||s.setAddingPinMode(p)},E=p=>{c(p)},y=p=>{var s;b(p),(s=n.current)==null||s.goToLocation({lat:p.latitude,lng:p.longitude})};return e.jsx(ve,{feature:"property-view",showOverlay:!1,children:e.jsx(Ne,{className:"p-0",children:e.jsxs("div",{className:"flex h-[calc(100vh-4rem)] overflow-hidden",children:[!i&&e.jsx(se,{selectedPortfolio:r,onSelectPortfolio:N,className:"w-64 shrink-0"}),e.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[e.jsxs("div",{className:"flex flex-col gap-2 p-3 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x,{variant:"ghost",size:"icon",onClick:()=>g("/property-view"),className:"shrink-0",children:e.jsx(Ke,{className:"h-4 w-4"})}),i&&e.jsxs(Q,{children:[e.jsx(Ue,{asChild:!0,children:e.jsxs(x,{variant:"outline",size:"sm",className:"shrink-0",children:[e.jsx(qe,{className:"h-4 w-4 mr-1"}),(r==null?void 0:r.title)||o("showcase.selectPortfolio","Select Portfolio")]})}),e.jsx(X,{side:"left",className:"p-0 w-72",children:e.jsx(se,{selectedPortfolio:r,onSelectPortfolio:p=>{N(p)},className:"h-full"})})]}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("h1",{className:D("font-semibold truncate",i?"text-sm":"text-lg"),children:(r==null?void 0:r.title)||o("showcase.title","Property Showcase")})}),e.jsxs("div",{className:"flex gap-2",children:[(r==null?void 0:r.is_published)&&e.jsxs(x,{size:"sm",variant:"outline",onClick:u,children:[e.jsx(re,{className:"h-4 w-4"}),!i&&e.jsx("span",{className:"ml-1",children:o("showcase.share","Share")})]}),i&&r&&e.jsx(x,{size:"sm",variant:"outline",onClick:()=>l(!S),children:e.jsx(ee,{className:"h-4 w-4"})})]})]}),r&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1 max-w-md",children:e.jsx(Xe,{onLocationSelect:L,placeholder:o("showcase.searchLocation","Search location...")})}),e.jsxs(x,{variant:d?"destructive":"default",size:"sm",onClick:_,className:"shrink-0",children:[e.jsx($,{className:"h-4 w-4 mr-1"}),d?o("showcase.cancel","Cancel"):o("showcase.addPin","Add Pin")]}),e.jsxs("div",{className:"bg-muted px-3 py-1.5 rounded text-sm shrink-0",children:[f.length," ",f.length!==1?o("showcase.pins","pins"):o("showcase.pin","pin")]})]})]}),e.jsxs("div",{className:"flex-1 relative",children:[r?e.jsxs("div",{className:"flex h-full",children:[e.jsx("div",{className:D("flex-1",!i&&"border-r"),children:e.jsx(Qe,{ref:n,portfolioId:r.id,onPinSelect:b,onAddingPinChange:E,onMapLoad:()=>a(!0)})}),!i&&e.jsx(te,{pins:f,selectedPin:C,onPinSelect:y,routeInfo:m,className:"w-72 shrink-0"})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center p-6",children:[e.jsx(ee,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h2",{className:"text-lg font-semibold mb-2",children:o("showcase.selectPortfolio","Select a Portfolio")}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-sm",children:o("showcase.selectPortfolioDesc","Choose a portfolio from the sidebar to start adding and managing pins on the map.")})]}),i&&r&&e.jsx(Q,{open:S,onOpenChange:l,children:e.jsxs(X,{side:"bottom",className:"h-[60vh] p-0",children:[e.jsx("div",{className:"p-3 border-b",children:e.jsxs("h3",{className:"font-semibold",children:[o("showcase.pins","Pins")," (",f.length,")"]})}),e.jsx(te,{pins:f,selectedPin:C,onPinSelect:p=>{y(p),l(!1)},routeInfo:m})]})})]})]})]})})})};export{Ki 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.