1import{ak as pe,w as ge,r as n,u as z,aj as ue,d as je,j as e,L as R,q as W,s as q,al as Ne,am as fe,ao as T}from"./vendor-ByXk4kz0.js";import{J as X}from"./JsonLd-CvP2jWzG.js";import{f as be,B as N,h as Z,p as L,C as d,d as x,n as p,o as g,a as ve,T as ee,e as se}from"./index-BOWIUa5W.js";import{M as ye,T as we,a as Se,L as Pe,P as Ce}from"./map-vendor-BeJUX238.js";import{I as y}from"./input-2ZAfIJ_8.js";import{L as c}from"./label-Dqu46QPK.js";import{S as k,a as I,b as M,c as F,d as r}from"./select-DeC5GLgW.js";import{S as w}from"./skeleton-CNoa3JMI.js";import{aA as V,A as Te,u as Le,q as ke,a as ae,b as te,aG as Ie,t as Me,aB as Fe,M as re,aC as Ee,aD as Ue,aE as Ae,am as $e,e as Be,T as ze,J as Re,aH as qe,Q as Ve,az as De,ac as le,X as ie}from"./icons-vendor-2uA-iZSn.js";import"./capacitor-vendor-8XoStP7I.js";import"./supabase-vendor-BZjl9asz.js";const Oe={casa:"Casa",departamento:"Departamento",terreno:"Terreno",oficina:"Oficina",local:"Local Comercial",bodega:"Bodega",estacionamiento:"Estacionamiento",parcela:"Parcela"},_e=new Pe.Icon({iconUrl:"https://unpkg.com/[email protected]/dist/images/marker-icon.png",iconRetinaUrl:"https://unpkg.com/[email protected]/dist/images/marker-icon-2x.png",shadowUrl:"https://unpkg.com/[email protected]/dist/images/marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],shadowSize:[41,41]});function D(o,E){const u=o.toLocaleString("es-CL",{maximumFractionDigits:0});return`${E?`${E} `:""}UF ${u}`}const He=fe({customerName:T().min(2,"Ingresa tu nombre"),customerPhone:T().min(8,"Ingresa un teléfono válido"),customerEmail:T().email("Ingresa un email válido"),interestType:T().optional(),message:T().optional()});function rs(){var Y;const{id:o}=pe(),[,E]=ge(),{toast:u}=be(),[f,S]=n.useState(0),[ne,A]=n.useState(!1),[$,ce]=n.useState(()=>JSON.parse(localStorage.getItem("immo_favorites")||"[]").includes(parseInt(o||"0"))),[O,P]=n.useState(!1),[oe,U]=n.useState(!1),me=n.useRef(null);n.useEffect(()=>(document.documentElement.classList.add("public-page"),()=>{document.documentElement.classList.remove("public-page")}),[]);const{data:s,isLoading:de}=z({queryKey:[`/api/immo/properties/${o}`],enabled:!!o}),{data:Qe}=z({queryKey:["/api/immo/form-config"]}),{data:l}=z({queryKey:[`/api/immo/properties/${o}/analysis`],enabled:!!o}),[h,B]=n.useState({downPaymentPercent:20,interestRateAnnual:5.5,termYears:20}),[b,xe]=n.useState(null),[he,_]=n.useState(!1);n.useEffect(()=>{s&&s.operationType==="venta"&&s.salePrice&&(async()=>{_(!0);try{const j=await(await se("/api/immo/mortgage-calculator",{method:"POST",body:JSON.stringify({propertyPriceUF:s.salePrice,downPaymentPercent:h.downPaymentPercent,interestRateAnnual:h.interestRateAnnual,termYears:h.termYears})})).json();xe(j)}catch(i){console.error("Error calculating mortgage:",i)}finally{_(!1)}})()},[s==null?void 0:s.salePrice,s==null?void 0:s.operationType,h]);const t=ue({resolver:Ne(He),defaultValues:{customerName:"",customerPhone:"",customerEmail:"",interestType:"comprar",message:""}}),C=je({mutationFn:async a=>se("/api/immo/leads",{method:"POST",body:JSON.stringify({propertyId:parseInt(o),...a,source:"storefront"})}),onSuccess:()=>{u({title:"¡Mensaje enviado!",description:"Nos pondremos en contacto contigo pronto."}),t.reset()},onError:()=>{u({title:"Error",description:"No se pudo enviar el mensaje. Intenta nuevamente.",variant:"destructive"})}}),H=a=>{C.mutate(a,{onSuccess:()=>{U(!1)}})};if(de)return e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx("header",{className:"bg-white shadow-sm sticky top-0 z-50",children:e.jsx("div",{className:"max-w-7xl mx-auto px-4 py-3",children:e.jsx("div",{className:"flex items-center gap-4",children:e.jsx(w,{className:"h-10 w-32"})})})}),e.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-8",children:[e.jsx(w,{className:"h-96 w-full rounded-2xl mb-8"}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsx(w,{className:"h-8 w-3/4"}),e.jsx(w,{className:"h-6 w-1/2"}),e.jsx(w,{className:"h-32 w-full"})]}),e.jsx(w,{className:"h-96 w-full"})]})]})]});if(!s)return e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(V,{className:"h-16 w-16 text-gray-300 mx-auto mb-4"}),e.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Propiedad no encontrada"}),e.jsx(R,{href:"/inmobiliario",children:e.jsx(N,{className:"bg-emerald-600 hover:bg-emerald-700",children:"Volver al inicio"})})]})});const v=s.operationType==="arriendo"?s.rentPrice:s.salePrice,m=s.mainImageUrl?[s.mainImageUrl,...s.gallery||[]]:s.gallery||[],Q=n.useMemo(()=>
1{if(!s)return null;const a=`https://selyt.cl/inmobiliario/propiedad/${s.id}`,i=s.propertyType==="departamento"?"Apartment":s.propertyType==="casa"?"House":s.propertyType==="oficina"?"OfficeBuilding":"RealEstateListing",j=s.operationType==="venta"?s.salePrice:s.rentPrice,K=j?String(j):void 0,G={"@context":"https://schema.org","@type":i,name:s.title,description:s.description||s.title,url:a,image:s.mainImageUrl||void 0,address:{"@type":"PostalAddress",streetAddress:s.address||void 0,addressLocality:s.commune||void 0,addressRegion:s.region||void 0,addressCountry:"CL"},numberOfRooms:s.bedrooms||void 0,numberOfBathroomsTotal:s.bathrooms||void 0,floorSize:s.squareMetersBuilt?{"@type":"QuantitativeValue",value:s.squareMetersBuilt,unitCode:"MTK"}:void 0};return K&&(G.offers={"@type":"Offer",price:K,priceCurrency:"CLF",availability:"https://schema.org/InStock"}),G},[s]),J=n.useMemo(()=>s?{"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:[{"@type":"ListItem",position:1,name:"Selyt Inmobiliario",item:"https://selyt.cl/inmobiliario"},{"@type":"ListItem",position:2,name:s.commune||s.title,item:`https://selyt.cl/inmobiliario/propiedad/${s.id}`}]}:null,[s]);return e.jsxs(e.Fragment,{children:[Q&&e.jsx(X,{data:Q,id:"json-ld-property"}),J&&e.jsx(X,{data:J,id:"json-ld-breadcrumb"}),e.jsxs("div",{className:"min-h-screen bg-gray-50 overflow-auto",children:[e.jsx("header",{className:"bg-white shadow-sm sticky top-0 z-50",children:e.jsx("div",{className:"max-w-7xl mx-auto px-4 py-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(N,{variant:"ghost",size:"icon",onClick:()=>E("/inmobiliario"),children:e.jsx(Te,{className:"h-5 w-5"})}),e.jsx(R,{href:"/inmobiliario",children:e.jsxs("div",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("img",{src:Z,alt:"Selyt",className:"h-8 object-contain"}),e.jsx("span",{className:"text-lg font-bold text-gray-900 hidden sm:block",children:"Inmobiliario"})]})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(N,{variant:"outline",size:"icon",onClick:()=>{const a=!$;ce(a);const i=JSON.parse(localStorage.getItem("immo_favorites")||"[]");if(a)i.includes(parseInt(o||"0"))||i.push(parseInt(o||"0")),u({title:"Agregado a favoritos"});else{const j=i.indexOf(parseInt(o||"0"));j>-1&&i.splice(j,1),u({title:"Eliminado de favoritos"})}localStorage.setItem("immo_favorites",JSON.stringify(i))},className:$?"text-red-500 border-red-200":"",children:e.jsx(Le,{className:`h-5 w-5 ${$?"fill-current":""}`})}),e.jsxs("div",{className:"relative",children:[e.jsx(N,{variant:"outline",size:"icon",onClick:()=>P(!O),children:e.jsx(ke,{className:"h-5 w-5"})}),O&&e.jsxs("div",{className:"absolute right-0 mt-2 w-48 bg-white rounded-lg shadow-lg border z-50",children:[e.jsxs("button",{onClick:()=>{window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(window.location.href)}`,"_blank"),P(!1)},className:"w-full px-4 py-2 text-left text-sm hover:bg-gray-50 flex items-center gap-2 rounded-t-lg",children:[e.jsx("svg",{className:"w-4 h-4 text-blue-600",fill:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{d:"M18.77 7.46H14.5v-1.9c0-.9.6-1.1 1-1.1h3V.5h-4.33C10.24.5 9.5 3.44 9.5 5.32v2.15h-3v4h3v12h5v-12h3.85l.42-4z"})}),"Facebook"]}),e.jsxs("button",{onClick:()=>{window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(window.location.href)}&text=${encodeURIComponent((s==null?void 0:s.title)||"")}`,"_blank"),P(!1)},className:"w-full px-4 py-2 text-left text-sm hover:bg-gray-50 flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})}),"X (Twitter)"]}),e.jsxs("button",{onClick:()=>{window.open(`https://api.whatsapp.com/send?text=${encodeURIComponent((s==null?void 0:s.title)+" "+window.location.href)}`,"_blank"),P(!1)},className:"w-full px-4 py-2 text-left text-sm hover:bg-gray-50 flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4 text-green-500",fill:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{d:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.
1198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z"})}),"WhatsApp"]}),e.jsxs("button",{onClick:()=>{navigator.clipboard.writeText(window.location.href),u({title:"Enlace copiado"}),P(!1)},className:"w-full px-4 py-2 text-left text-sm hover:bg-gray-50 flex items-center gap-2 rounded-b-lg",children:[e.jsx("svg",{className:"w-4 h-4 text-gray-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3"})}),"Copiar enlace"]})]})]})]})]})})}),e.jsx("section",{className:"bg-black",children:e.jsx("div",{className:"max-w-7xl mx-auto",children:e.jsx("div",{className:"relative h-[300px] md:h-[500px]",children:m.length>0?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:m[f],alt:s.title,className:"w-full h-full object-cover cursor-pointer",onClick:()=>A(!0)}),m.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>S(a=>a===0?m.length-1:a-1),className:"absolute left-4 top-1/2 -translate-y-1/2 bg-white/90 rounded-full p-2 shadow-lg hover:bg-white",children:e.jsx(ae,{className:"h-6 w-6"})}),e.jsx("button",{onClick:()=>S(a=>a===m.length-1?0:a+1),className:"absolute right-4 top-1/2 -translate-y-1/2 bg-white/90 rounded-full p-2 shadow-lg hover:bg-white",children:e.jsx(te,{className:"h-6 w-6"})}),e.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-1.5",children:m.map((a,i)=>e.jsx("button",{onClick:()=>S(i),className:`w-2 h-2 rounded-full transition-all ${i===f?"bg-white w-6":"bg-white/50"}`},i))})]}),e.jsxs("button",{onClick:()=>A(!0),className:"absolute bottom-4 right-4 bg-white/90 rounded-lg px-3 py-2 text-sm font-medium shadow-lg hover:bg-white flex items-center gap-2",children:[e.jsx(Ie,{className:"h-4 w-4"}),"Ver ",m.length," fotos"]})]}):e.jsx("div",{className:"w-full h-full flex items-center justify-center bg-gradient-to-br from-emerald-100 to-teal-100",children:e.jsx(V,{className:"h-24 w-24 text-emerald-300"})})})})}),e.jsx("main",{className:"max-w-7xl mx-auto px-4 py-8",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(L,{className:`${s.operationType==="venta"?"bg-emerald-500":"bg-blue-500"} text-white border-0`,children:s.operationType==="venta"?"Venta":"Arriendo"}),e.jsx(L,{variant:"secondary",children:Oe[s.propertyType]||s.propertyType}),s.featured&&e.jsxs(L,{className:"bg-amber-500 text-white border-0",children:[e.jsx(Me,{className:"h-3 w-3 mr-1"}),"Destacado"]})]}),s.developerName&&e.jsxs("div",{className:"flex items-center gap-1 text-emerald-600 text-sm font-semibold mb-2",children:[e.jsx(Fe,{className:"h-4 w-4"}),e.jsx("span",{children:s.developerName}),s.projectName&&e.jsxs("span",{className:"text-gray-400",children:["⢠",s.projectName]})]}),e.jsx("h1",{className:"text-2xl md:text-3xl font-bold text-gray-900 mb-2",children:s.title}),e.jsxs("div",{className:"flex items-center gap-1 text-gray-500",children:[e.jsx(re,{className:"h-4 w-4"}),e.jsxs("span",{children:[s.address&&`${s.address}, `,s.commune,s.region&&`, ${s.region}`]})]})]}),e.jsx(d,{className:"border-0 shadow-md",children:e.jsx(x,{className:"py-6",children:e.jsxs("div",{className:"text-3xl font-bold text-emerald-600",children:[v?D(v,s.pricePrefix):"Consultar precio",s.operationType==="arriendo"&&e.jsx("span",{className:"text-lg font-normal text-gray-500",children:"/mes"})]})})}),e.jsxs(d,{className:"border-0 shadow-md",children:[e.jsx(p,{children:e.jsx(g,{className:"text-lg",children:"CaracterÃsticas"})}),e.jsxs(x,{children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-6",children:[s.bedrooms&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-emerald-50 flex items-center justify-center",children:e.jsx(Ee,{className:"h-6 w-6 text-emerald-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:s.bedrooms}),e.jsx("p",{className:"text-sm text-gray-500",children:"Dormitorios"})]})]}),s.bathrooms&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-blue-50 flex items-center justify-center",children:e.jsx(Ue,{className:"h-6 w-6 text-blue-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:s.bathrooms}),e.jsx("p",{className:"text-sm text-gray-500",children:"Baños"})]})]}),s.squareMetersBuilt&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-purple-50 flex items-center justify-center",children:e.jsx(Ae,{className:"h-6 w-6 text-purple-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:s.squareMetersBuilt}),e.jsx("p",{className:"text-sm text-gray-500",children:"m² construidos"})]})]}),s.parkingSpaces&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-orange-50 flex items-center justify-center",children:e.jsx($e,{className:"h-6 w-6 text-orange-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:s.parkingSpaces}),e.jsx("p",{className:"text-sm text-gray-500",children:"Estacionamientos"})]})]})]}),s.squareMetersTotal&&s.squareMetersTotal!==s.squareMetersBuilt&&e.jsx("div",{className:"mt-4 pt-4 border-t",children:e.jsxs("p",{className:"text-sm text-gray-600",children:[e.jsx("strong",{children:"Superficie total:"})," ",s.squareMetersTotal," m²"]})})]})]}),s.description&&e.jsxs(d,{className:"border-0 shadow-md",children:[e.jsx(p,{children:e.jsx(g,{className:"text-lg",children:"Descripción"})}),e.jsx(x,{children:e.jsx("p",{className:"text-gray-600 whitespace-pre-wrap",children:s.description})})]}),s.amenities&&s.amenities.length>0&&e.jsxs(d,{className:"border-0 shadow-md",children:[e.jsx(p,{children:e.jsx(g,{className:"text-lg",children:"Amenidades"})}),e.jsx(x,{children:e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-3",children:s.amenities.map((a,i)=>e.jsxs("div",{className:"flex items-center gap-2 text-gray-600",children:[e.jsx(Be,{className:"h-4 w-4 text-emerald-500"}),e.jsx("span",{className:"text-sm",children:a})]},i))})})]}),l&&e.jsxs(d,{className:"border-0 shadow-md bg-gradient-to-br from-blue-50 to-indigo-50",children:[e.jsx(p,{children:e.jsxs(g,{className:"text-lg flex items-center gap-2",children:[e.jsx(ze,{className:"h-5 w-5 text-blue-600"}),"Análisis de Precio"]})}),e.jsxs(x,{className:"space-y-4",children:[e.jsxs("div",{className:"bg-white rounded-lg p-4 shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("span",{className:"text-sm text-gray-600 flex items-center gap-1",children:[e.jsx(Re,{className:"h-4 w-4"}),"Valor UF hoy"]}),e.jsxs(L,{variant:"secondary",className:"font-mono",children:["$",l.uf.toLocaleStr
1ing("es-CL")]})]}),l.priceInCLP&&e.jsxs("div",{className:"grid grid-cols-2 gap-4 mt-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-gray-500",children:"Precio en Pesos"}),e.jsxs("p",{className:"text-lg font-bold text-gray-900",children:["$",l.priceInCLP.toLocaleString("es-CL")]})]}),l.priceInUSD&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-gray-500",children:"Precio en USD"}),e.jsxs("p",{className:"text-lg font-bold text-gray-900",children:["USD $",l.priceInUSD.toLocaleString("es-CL")]})]})]})]}),l.analysis&&e.jsxs("div",{className:"bg-white rounded-lg p-4 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(qe,{className:"h-4 w-4 text-blue-600"}),e.jsx("span",{className:"font-medium text-gray-900",children:"Análisis de Mercado"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 mb-4",children:[l.analysis.pricePerM2Built!=null&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-gray-500",children:"UF/m² construido"}),e.jsx("p",{className:"text-xl font-bold text-blue-600",children:Number(l.analysis.pricePerM2Built).toFixed(1)})]}),((Y=l.marketInsights)==null?void 0:Y.avgPricePerM2InRegion)!=null&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-gray-500",children:"Promedio zona"}),e.jsx("p",{className:"text-xl font-bold text-gray-600",children:Number(l.marketInsights.avgPricePerM2InRegion).toFixed(1)})]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(L,{className:`${l.analysis.valueCategory==="economico"?"bg-green-500":l.analysis.valueCategory==="promedio"?"bg-blue-500":l.analysis.valueCategory==="premium"?"bg-purple-500":"bg-amber-500"} text-white`,children:l.analysis.valueCategory.charAt(0).toUpperCase()+l.analysis.valueCategory.slice(1)})}),e.jsx("p",{className:"text-xs text-gray-500 mt-2",children:l.analysis.marketPosition})]})]})]}),s.operationType==="venta"&&s.salePrice&&e.jsxs(d,{className:"border-0 shadow-md",children:[e.jsx(p,{children:e.jsxs(g,{className:"text-lg flex items-center gap-2",children:[e.jsx(Ve,{className:"h-5 w-5 text-emerald-600"}),"Simulador de Crédito Hipotecario"]})}),e.jsxs(x,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx(c,{className:"text-xs",children:"Pie (%)"}),e.jsxs(k,{value:h.downPaymentPercent.toString(),onValueChange:a=>B(i=>({...i,downPaymentPercent:parseInt(a)})),children:[e.jsx(I,{className:"mt-1",children:e.jsx(M,{})}),e.jsxs(F,{children:[e.jsx(r,{value:"10",children:"10%"}),e.jsx(r,{value:"15",children:"15%"}),e.jsx(r,{value:"20",children:"20%"}),e.jsx(r,{value:"25",children:"25%"}),e.jsx(r,{value:"30",children:"30%"})]})]})]}),e.jsxs("div",{children:[e.jsx(c,{className:"text-xs",children:"Tasa anual (%)"}),e.jsxs(k,{value:h.interestRateAnnual.toString(),onValueChange:a=>B(i=>({...i,interestRateAnnual:parseFloat(a)})),children:[e.jsx(I,{className:"mt-1",children:e.jsx(M,{})}),e.jsxs(F,{children:[e.jsx(r,{value:"4",children:"4%"}),e.jsx(r,{value:"4.5",children:"4.5%"}),e.jsx(r,{value:"5",children:"5%"}),e.jsx(r,{value:"5.5",children:"5.5%"}),e.jsx(r,{value:"6",children:"6%"}),e.jsx(r,{value:"6.5",children:"6.5%"}),e.jsx(r,{value:"7",children:"7%"})]})]})]}),e.jsxs("div",{children:[e.jsx(c,{className:"text-xs",children:"Plazo (años)"}),e.jsxs(k,{value:h.termYears.toString(),onValueChange:a=>B(i=>({...i,termYears:parseInt(a)})),children:[e.jsx(I,{className:"mt-1",children:e.jsx(M,{})}),e.jsxs(F,{children:[e.jsx(r,{value:"15",children:"15 años"}),e.jsx(r,{value:"20",children:"20 años"}),e.jsx(r,{value:"25",children:"25 años"}),e.jsx(r,{value:"30",children:"30 años"})]})]})]})]}),e.jsx("div",{className:"bg-emerald-50 rounded-lg p-4 mt-4",children:he?e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-emerald-600 mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-gray-500",children:"Calculando..."})]}):b?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-center mb-3",children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Dividendo mensual estimado"}),e.jsxs("p",{className:"text-3xl font-bold text-emerald-600",children:["UF"," ",Number(b.monthlyPaymentUF||0).toFixed(2)]}),e.jsxs("p",{className:"text-lg text-gray-700",children:["$",Number(b.monthlyPaymentCLP||0).toLocaleStr
1ing("es-CL")," ","/mes"]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-500",children:"Monto a financiar"}),e.jsxs("p",{className:"font-medium",children:["UF"," ",Number(b.loanAmountUF||0).toLocaleString("es-CL")]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-500",children:"Pie requerido"}),e.jsxs("p",{className:"font-medium",children:["UF"," ",Math.round((s.salePrice||0)*h.downPaymentPercent/100).toLocaleString("es-CL")]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm mt-3 pt-3 border-t border-emerald-100",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-500",children:"Total a pagar"}),e.jsxs("p",{className:"font-medium",children:["UF"," ",Number(b.totalPaymentUF||0).toLocaleString("es-CL")]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-500",children:"Total intereses"}),e.jsxs("p",{className:"font-medium text-amber-600",children:["UF"," ",Number(b.totalInterestUF||0).toLocaleString("es-CL")]})]})]}),e.jsx("p",{className:"text-xs text-gray-400 mt-3 text-center",children:"* Valores referenciales. Consulte con su banco para una simulación oficial."})]}):e.jsx("div",{className:"text-center text-gray-500",children:e.jsx("p",{className:"text-sm",children:"Selecciona los parámetros para ver el cálculo"})})})]})]}),(l==null?void 0:l.similarProperties)&&l.similarProperties.length>0&&e.jsxs(d,{className:"border-0 shadow-md",children:[e.jsx(p,{children:e.jsxs(g,{className:"text-lg flex items-center gap-2",children:[e.jsx(V,{className:"h-5 w-5 text-gray-600"}),"Propiedades Similares en la Zona"]})}),e.jsx(x,{children:e.jsx("div",{className:"space-y-3",children:l.similarProperties.map(a=>e.jsx(R,{href:`/inmobiliario/propiedad/${a.id}`,children:e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg hover:bg-gray-50 transition-colors cursor-pointer border",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-gray-900 text-sm line-clamp-1",children:a.title}),e.jsx("p",{className:"text-xs text-gray-500",children:a.commune})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"font-bold text-emerald-600",children:a.price?`UF ${a.price.toLocaleString("es-CL")}`:"Consultar"}),a.pricePerM2&&e.jsxs("p",{className:"text-xs text-gray-500",children:[a.pricePerM2," UF/m²"]})]})]})},a.id))})})]}),s.latitude&&s.longitude&&e.jsxs(d,{className:"border-0 shadow-md",children:[e.jsx(p,{children:e.jsxs(g,{className:"text-lg flex items-center gap-2",children:[e.jsx(De,{className:"h-5 w-5 text-emerald-600"}),"Ubicación"]})}),e.jsxs(x,{className:"p-0",children:[e.jsx("div",{className:"h-[300px] md:h-[400px] rounded-b-lg overflow-hidden",children:e.jsxs(ye,{center:[s.latitude,s.longitude],zoom:15,style:{height:"100%",width:"100%"},scrollWheelZoom:!1,children:[e.jsx(we,{attribution:'© <a href="https://www.geoapify.com/">Geoapify</a>',url:`https://maps.geoapify.com/v1/tile/osm-bright/{z}/{x}/{y}.png?apiKey=${ve("VITE_GEOAPIFY_API_KEY")||""}`}),e.jsx(Se,{position:[s.latitude,s.longitude],icon:_e,children:e.jsx(Ce,{children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"font-semibold",children:s.title}),s.address&&e.jsx("p",{className:"text-sm text-gray-500",children:s.address})]})})})]})}),s.address&&e.jsx("div",{className:"p-4 border-t",children:e.jsxs("p",{className:"text-sm text-gray-600 flex items-center gap-2",children:[e.jsx(re,{className:"h-4 w-4 text-emerald-600"}),s.address,s.commune&&`, ${s.commune}`,s.region&&`, ${s.region}`]})})]})]})]}),e.jsx("div",{className:"lg:col-span-1",ref:me,children:e.jsxs(d,{className:"border-0 shadow-lg sticky top-24",children:[e.jsx(p,{className:"bg-gradient-to-r from-emerald-50 to-teal-50 rounded-t-lg",children:e.jsxs(g,{className:"text-lg text-center flex items-center justify-center gap-2",children:[e.jsx(le,{className:"h-5 w-5 text-emerald-600"}),"¿Te interesa esta propiedad?"]})}),e.jsx(x,{className:"pt-6",children:e.jsxs("form",{onSubmit:t.handleSubmit(H),className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(c,{htmlFor:"customerName",children:"Nombre completo *"}),e.jsx(y,{id:"customerName",...t.register("customerName"),placeholder:"Tu nombre",className:"mt-1"}),t.formState.errors.customerName&&e.jsx("p",{className:"text-xs text-red-500 mt-1",children:t.formState.errors.customerName.message})]}),e.jsxs("div",{children:[e.jsx(c,{htmlFor:"customerEmail",children:"Email *"}),e.jsx(y,{id:"customerEmail",type:"email",...t.register("customerEmail"),placeholder:"[email protected]",className:"mt-1"}),t.formState.errors.customerEmail&&e.jsx("p",{className:"text-xs text-red-500 mt-1",children:t.formState.errors.customerEmail.message})]}),e.jsxs("div",{children:[e.jsx(c,{htmlFor:"customerPhone",children:"Teléfono *"}),e.jsx(y,{id:"customerPhone",...t.register("customerPhone"),placeholder:"+56 9 1234 5678",className:"mt-1"}),t.formState.errors.customerPhone&&e.jsx("p",{className:"text-xs text-red-500 mt-1",children:t.formState.errors.customerPhone.message})]}),e.jsxs("div",{children:[e.jsx(c,{htmlFor:"interestType",children:"¿Qué te interesa?"}),e.jsxs(k,{value:t.watch("interestType"),onValueChange:a=>t.setValue("interestType",a),children:[e.jsx(I,{className:"mt-1",children:e.jsx(M,{placeholder:"Selecciona"})}
1),e.jsxs(F,{children:[e.jsx(r,{value:"comprar",children:"Quiero comprar"}),e.jsx(r,{value:"arrendar",children:"Quiero arrendar"}),e.jsx(r,{value:"informacion",children:"Solo información"}),e.jsx(r,{value:"visita",children:"Agendar visita"})]})]})]}),e.jsxs("div",{children:[e.jsx(c,{htmlFor:"message",children:"Mensaje (opcional)"}),e.jsx(ee,{id:"message",...t.register("message"),placeholder:"¿Tienes alguna pregunta?",rows:3,className:"mt-1"})]}),e.jsx(N,{type:"submit",className:"w-full bg-emerald-600 hover:bg-emerald-700 h-12",disabled:C.isPending,children:C.isPending?"Enviando...":"Enviar consulta"}),e.jsx("p",{className:"text-xs text-gray-500 text-center",children:"Al enviar, aceptas que te contactemos sobre esta propiedad."})]})})]})})]})}),e.jsx(W,{children:ne&&e.jsxs(q.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black z-[100] flex items-center justify-center",children:[e.jsx("button",{onClick:()=>A(!1),className:"absolute top-4 right-4 text-white p-2 hover:bg-white/10 rounded-full z-10",children:e.jsx(ie,{className:"h-8 w-8"})}),e.jsx("button",{onClick:()=>S(a=>a===0?m.length-1:a-1),className:"absolute left-4 top-1/2 -translate-y-1/2 text-white p-2 hover:bg-white/10 rounded-full",children:e.jsx(ae,{className:"h-10 w-10"})}),e.jsx("img",{src:m[f],alt:`Imagen ${f+1}`,className:"max-h-[90vh] max-w-[90vw] object-contain"}),e.jsx("button",{onClick:()=>S(a=>a===m.length-1?0:a+1),className:"absolute right-4 top-1/2 -translate-y-1/2 text-white p-2 hover:bg-white/10 rounded-full",children:e.jsx(te,{className:"h-10 w-10"})}),e.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 text-white",children:[f+1," / ",m.length]})]})}),e.jsx("footer",{className:"bg-gray-900 text-white py-8 mt-16 mb-20 lg:mb-0",children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4 text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-2 mb-4",children:[e.jsx("img",{src:Z,alt:"Selyt",className:"h-8 object-contain brightness-0 invert"}),e.jsx("span",{className:"text-lg font-bold",children:"Inmobiliario"})]}),e.jsxs("p",{className:"text-gray-500 text-sm",children:["© ",new Date().getFullYear()," Selyt Inmobiliario. Todos los derechos reservados."]})]})}),e.jsx("div",{className:"fixed bottom-0 left-0 right-0 p-4 pb-[calc(1rem_+_env(safe-area-inset-bottom,0px))] bg-white border-t shadow-lg lg:hidden z-50",children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-lg font-bold text-emerald-600",children:v?D(v,s.pricePrefix):"Consultar"}),e.jsx("p",{className:"text-xs text-gray-500",children:s.operationType==="arriendo"?"/mes":"Precio de venta"})]}),e.jsxs(N,{onClick:()=>U(!0),className:"bg-emerald-600 hover:bg-emerald-700 h-12 px-6 flex items-center gap-2",children:[e.jsx(le,{className:"h-5 w-5"}),"Contactar"]})]})}),e.jsx(W,{children:oe&&e.jsx(q.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/50 z-[100] lg:hidden",onClick:()=>U(!1),children:e.jsxs(q.div,{initial:{y:"100%"},animate:{y:0},exit:{y:"100%"},transition:{type:"spring",damping:25,stiffness:300},className:"absolute bottom-0 left-0 right-0 bg-white rounded-t-3xl max-h-[90vh] overflow-y-auto",onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{className:"sticky top-0 bg-white pt-4 pb-2 px-6 border-b",children:[e.jsx("div",{className:"w-12 h-1.5 bg-gray-300 rounded-full mx-auto mb-4"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-bold",children:"Solicitar información"}),e.jsx("button",{onClick:()=>U(!1),className:"p-2 -mr-2",children:e.jsx(ie,{className:"h-5 w-5"})})]})]}),e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"bg-emerald-50 rounded-xl p-4 mb-6",children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Propiedad:"}),e.jsx("p",{className:"font-semibold text-gray-900",children:s.title}),e.jsx("p",{className:"text-emerald-600 font-bold mt-1",children:v?D(v,s.pricePrefix):"Consultar precio"})]}),e.jsxs("form",{onSubmit:t.handleSubmit(H),className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(c,{htmlFor:"m-customerName",children:"Nombre completo *"}),e.jsx(y,{id:"m-customerName",...t.register("customerName"),placeholder:"Tu nombre",className:"mt-1 h-12"}),t.formState.errors.customerName&&e.jsx("p",{className:"text-xs text-red-500 mt-1",children:t.formState.errors.customerName.message})]}),e.jsxs("div",{children:[e.jsx(c,{htmlFor:"m-customerEmail",children:"Email *"}),e.jsx(y,{id:"m-customerEmail",type:"email",...t.register("customerEmail"),placeholder:"[email protected]",className:"mt-1 h-12"}),t.formState.errors.customerEmail&&e.jsx("p",{className:"text-xs text-red-500 mt-1",children:t.formState.errors.customerEmail.message})]}),e.jsxs("div",{children:[e.jsx(c,{htmlFor:"m-customerPhone",children:"Teléfono *"}),e.jsx(y,{id:"m-customerPhone",...t.register("customerPhone"),placeholder:"+56 9 1234 5678",className:"mt-1 h-12"}),t.formState.errors.customerPhone&&e.jsx("p",{className:"text-xs text-red-500 mt-1",children:t.formState.errors.customerPhone.message})]}),e.jsxs("div",{children:[e.jsx(c,{htmlFor:"m-interestType",children:"¿Qué te interesa?"}),e.jsxs(k,{value:t.watch("interestType"),onValueChange:a=>t.setValue("interestType",a),children:[e.jsx(I,{className:"mt-1 h-12",children:e.jsx(M,{placeholder:"Selecciona"})}),e.jsxs(F,{children:[e.jsx(r,{value:"comprar",children:"Quiero comprar"}),e.jsx(r,{value:"arrendar",children:"Quiero arrendar"}),e.jsx(r,{value:"informacion",children:"Solo información"}),e.jsx(r,{value:"visita",children:"Agendar visita"})]})]})]}),e.jsxs("div",{children:[e.jsx(c,{htmlFor:"m-message",children:"Mensaje (opcional)"}),e.jsx(ee,{id:"m-message",...t.register("message"),placeholder:"¿Tienes alguna pregunta?",rows:3,className:"mt-1"})]}),e.jsx(N,{type:"submit",className:"w-full bg-emerald-600 hover:bg-emerald-700 h-14 text-lg",disabled:C.isPending,children:C.isPending?"Enviando...":"Enviar consulta"}),e.jsx("p",{className:"text-xs text-gray-500 text-center pb-4",children:"Al enviar, aceptas que te contactemos sobre esta propiedad."})]})]})]})})})]})]})}export{rs 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.