1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9739],{27639:(e,t,a)=>{a.d(t,{I:()=>s});function s(e){return!!e&&"object"==typeof e&&"number"==typeof e.finalScore&&Array.isArray(e.breakdown)&&null!=e.summary&&"object"==typeof e.summary&&"string"==typeof e.summary.overall}},37787:(e,t,a)=>{a.d(t,{ShowContactDialog:()=>U});var s=a(95155),r=a(12115),n=a(73321),l=a(74350),i=a(4474),o=a(6296),d=a(21362),c=a(44478),x=a(5872),m=a(25777),p=a(53961),u=a(21628),h=a(94514),f=a(67635),b=a(85118),g=a(42869),j=a(13545),y=a(91337),v=a(26650),w=a(4235);let N=[{value:"notReachable",label:"Not reachable"},{value:"wrongLocation",label:"Wrong number"},{value:"unavailable",label:"Already closed"},{value:"indirectLead",label:"Not relevant"},{value:"polite",label:"Helpful"},{value:"planningVisit",label:"Planning visit"},{value:"rude",label:"Rude"},{value:"others",label:"Other"}];function k(){return{polite:!1,rude:!1,planningVisit:!1,unavailable:!1,indirectLead:!1,notReachable:!1,wrongLocation:!1,others:!1}}async function A(e){let t=await fetch(`/api/lead-feedback/${encodeURIComponent(e)}`,{credentials:"include",headers:{Accept:"application/json"}}),a=await t.json().catch(()=>({}));if(!t.ok)return{ok:!1,error:a.message??"Could not load feedback"};if("success"===a.result&&a.feedbackData){let e=function(e){if(!e||"object"!=typeof e)return null;let t=Number(e.rating);if(!Number.isFinite(t)||t<1||t>5)return null;let a=k(),s=e.options;if(s&&"object"==typeof s)for(let[e,t]of Object.entries(s))("polite"===e||"rude"===e||"planningVisit"===e||"unavailable"===e||"indirectLead"===e||"notReachable"===e||"wrongLocation"===e||"others"===e)&&(a[e]=!!t);return{rating:t,options:a,comments:"string"==typeof e.comments?e.comments:String(e.comments??"")}}(a.feedbackData);if(e)return{ok:!0,hasExisting:!0,data:e}}return{ok:!0,hasExisting:!1}}async function C(e){let t=await fetch("/api/lead-feedback/save",{method:"POST",credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({adId:e.adId,adType:e.adType,feedbackData:e.feedbackData})}),a=await t.json().catch(()=>({}));return t.ok&&"success"===a.result?{ok:!0}:{ok:!1,error:a.message??"Could not save feedback",code:a.result}}function S(e){let t=String(e??"").trim().toLowerCase();return"pro"===t||"premium"===t}function T({onUnlock:e}){let t=(0,r.useRef)(null),a=(0,r.useRef)(null),n=(0,r.useRef)(0),[l,i]=(0,r.useState)(0),[c,x]=(0,r.useState)(!1),m=()=>Math.max((t.current?.clientWidth??0)-(a.current?.clientWidth??56)-8,1),p=e=>{c||(n.current=e)},u=t=>{if(c)return;let a=Math.min(Math.max(t-n.current,0)/m(),1);i(a),a>=.82&&(x(!0),i(1),e())},h=()=>{c||i(0)};return(0,s.jsxs)("div",{ref:t,className:"relative flex h-16 w-full select-none items-center overflow-hidden rounded-2xl bg-gradient-to-r from-[var(--ph-primary)] to-[var(--ph-primary-dark)] px-1 shadow-lg shadow-[rgba(25,155,255,0.3)] touch-none cursor-pointer",onMouseDown:e=>p(e.clientX),onMouseMove:e=>{1===e.buttons&&u(e.clientX)},onMouseUp:h,onMouseLeave:h,onTouchStart:e=>p(e.touches[0].clientX),onTouchMove:e=>u(e.touches[0].clientX),onTouchEnd:h,children:[(0,s.jsx)("div",{className:"absolute inset-y-1 left-1 rounded-xl bg-white/15 transition-none",style:{width:`calc(${100*l}% - 4px)`}}),(0,s.jsx)("span",{className:"absolute inset-0 flex items-center justify-center text-[15px] font-bold text-white/80 tracking-wide pointer-events-none select-none transition-opacity duration-150",style:{opacity:c?0:Math.max(0,1-1.6*l)},children:"Slide to view contact"}),(0,s.jsx)("div",{ref:a,className:"relative z-10 flex h-12 w-[3.75rem] shrink-0 items-center justify-center rounded-xl bg-white shadow-md shadow-black/20 cursor-grab active:cursor-grabbing transition-none",style:{transform:`translateX(${l*m()}px)`},children:c?(0,s.jsx)(o.A,{className:"h-5 w-5 animate-spin text-[var(--ph-primary)]"}):(0,s.jsx)(d.A,{className:"h-5 w-5 text-[var(--ph-primary)]",strokeWidth:2.5})})]})}function L({onUnlock:e,isProLead:t,isLoggedIn:a,contactsRemaining:r,isCheckingCredits:n,creditsUnavailable:l}){let i="number"==typeof r,o=i&&r<=3,d=i&&r<=0;return(0,s.jsxs)("div",{className:"flex flex-col gap-5 max-sm:gap-6 py-1 animate-in fade-in slide-in-from-bottom-3 duration-400",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-[15px] max-sm:text-[17px] font-bold tracking-tight text-slate-900",children:"View Member Details"}),(0,s.jsx)("p",{className:"mt-0.5 text-[12px] max-sm:text-[13px] text-slate-400",children:"Unlock direct contact info instantly"})]}),(0,s.jsx)("div",{className:"flex h-9 w-9 max-sm:h-10 max-sm:w-10 shrink-0 items-center justify-center rounded-full bg-[var(--ph-primary-50)] border border-[var(--ph-primary-100)]",children:(0,s.jsx)(c.A,{className:"h-4 w-4 max-sm:h-[18px] max-sm:w-[18px] text-[var(--ph-primary)]",strokeWidth:2})})]}),a&&!t&&(0,s.jsxs)("div",{className:(0,y.cn)("flex items-center gap-2 rounded-xl border px-3.5 py-2.5",d?"border-red-200 bg-red-50":o?"border-amber-200 bg-amber-50":"border-slate-200 bg-slate-50"),children:[(0,s.jsx)(x.A,{className:(0,y.cn)("h-4 w-4 shrink-0",d?"text-red-500":o?"text-amber-500":"text-slate-400"),strokeWidth:2}),(0,s.jsx)("span",{className:(0,y.cn)("text-[12.5px] max-sm:text-[13.5px] font-semibold flex-1",d?"text-red-600":o?"text-amber-700":"text-slate-600"),children:d?"No credits remaining":i?`${r} contact credit${1!==r?"s":""} remaining`:n?"Checking creditsâ¦":l?"Credits unavailable right now":"Checking creditsâ¦"}),o&&!d&&(0,s.jsx)("span",{className:"text-[11px] font-bold text-amber-600 bg-amber-100 border border-amber-200 rounded-full px-2 py-0.5",children:"Low"})]}),(0,s.jsxs)("div",{className:"relative overflow-hidden rounded-2xl border-2 border-slate-200 bg-white shadow-sm",children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-gradient-to-r from-white/0 via-white/60 to-white/0 z-10 pointer-events-none"}),(0,s.jsxs)("div",{className:"relative z-20 flex min-h-[5.5rem] max-sm:min-h-[6.25rem] items-center justify-center px-5 py-5 max-sm:py-6",children:[(0,s.jsx)("p",{className:"font-mono text-[26px] max-sm:text-[32px] font-bold tracking-[0.08em] text-slate-900 select-none leading-none text-center",style:{filter:"blur(5px)"}
1,"aria-hidden":!0,children:"+91 98765 43210"}),(0,s.jsxs)("div",{className:"pointer-events-none absolute left-1/2 top-1/2 z-30 flex -translate-x-1/2 -translate-y-1/2 items-center gap-2 rounded-full border border-amber-200/90 bg-amber-50/95 px-3.5 py-2 shadow-md backdrop-blur-[2px]",children:[(0,s.jsx)(m.A,{className:"h-3 w-3 max-sm:h-3.5 max-sm:w-3.5 text-amber-600",strokeWidth:2.2}),(0,s.jsx)("span",{className:"text-[11px] max-sm:text-[12.5px] font-bold text-amber-700",children:"Locked"})]})]})]}),t?(0,s.jsxs)("div",{className:"flex items-center justify-between rounded-xl border border-emerald-200 bg-emerald-50 px-4 py-3.5 max-sm:px-4 max-sm:py-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 max-sm:gap-2.5",children:[(0,s.jsx)("div",{className:"flex h-8 w-8 max-sm:h-9 max-sm:w-9 items-center justify-center rounded-full bg-emerald-100",children:(0,s.jsx)(p.A,{className:"h-4 w-4 max-sm:h-[18px] max-sm:w-[18px] text-emerald-600",strokeWidth:2})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-[12px] max-sm:text-[13.5px] font-semibold text-emerald-800 leading-tight",children:"Free Unlock"}),(0,s.jsx)("p",{className:"text-[11px] max-sm:text-[12px] text-emerald-600 leading-tight mt-0.5",children:"Pro listing â no credit used"})]})]}),(0,s.jsx)("span",{className:"rounded-full border border-emerald-300 bg-emerald-100 px-3 py-1 max-sm:px-3.5 max-sm:py-1.5 text-[12px] max-sm:text-[13px] font-bold text-emerald-700",children:"Free"})]}):(0,s.jsx)("div",{className:"flex items-center justify-between rounded-xl border border-amber-200 bg-gradient-to-r from-amber-50 to-orange-50 px-4 py-3.5 max-sm:py-4",children:(0,s.jsxs)("div",{className:"flex items-center gap-2.5 max-sm:gap-3",children:[(0,s.jsx)("div",{className:"flex h-8 w-8 max-sm:h-9 max-sm:w-9 items-center justify-center rounded-full border border-amber-200 bg-white shadow-sm",children:(0,s.jsx)(p.A,{className:"h-4 w-4 max-sm:h-[18px] max-sm:w-[18px] fill-amber-400 text-amber-500",strokeWidth:1.5})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-[12.5px] max-sm:text-[14px] font-bold text-slate-800 leading-tight",children:"1 Credit to Unlock"}),(0,s.jsx)("p",{className:"text-[11px] max-sm:text-[12px] text-slate-500 leading-tight mt-0.5",children:"Deducted from your monthly allowance"})]})]})}),(0,s.jsx)("div",{className:"sm:hidden mt-0.5",children:(0,s.jsx)(T,{onUnlock:e})}),(0,s.jsxs)("button",{onClick:e,className:"hidden sm:flex group relative w-full overflow-hidden rounded-[13px] bg-gradient-to-br from-[var(--ph-primary)] to-[var(--ph-primary-dark)] px-4 py-[14px] text-[14.5px] font-bold text-white shadow-lg shadow-[rgba(25,155,255,0.32)] transition-all duration-200 hover:-translate-y-0.5 hover:shadow-xl active:translate-y-0 items-center justify-center gap-2 mt-0.5",children:[(0,s.jsx)("span",{className:"pointer-events-none absolute inset-0 -translate-x-full bg-gradient-to-r from-transparent via-white/15 to-transparent transition-transform duration-500 group-hover:translate-x-full"}),(0,s.jsx)(m.A,{className:"h-4 w-4",strokeWidth:2}),"View Contact Details",(0,s.jsx)(u.A,{className:"h-4 w-4 transition-transform duration-200 group-hover:translate-x-0.5"})]})]})}function R(){return(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center gap-5 py-12",children:[(0,s.jsxs)("div",{className:"relative flex h-16 w-16 items-center justify-center",children:[(0,s.jsx)("span",{className:"absolute inset-0 animate-spin rounded-full border-[2.5px] border-transparent border-t-[var(--ph-primary)]"}),(0,s.jsx)("span",{className:"absolute inset-2 animate-[spin_1.2s_linear_infinite_reverse] rounded-full border-2 border-transparent border-t-[rgba(25,155,255,0.35)]"}),(0,s.jsx)(o.A,{className:"h-5 w-5 animate-pulse text-[var(--ph-primary)]"})]}),(0,s.jsx)("p",{className:"animate-pulse text-[13px] max-sm:text-[14px] font-medium text-slate-400",children:"Verifying secure connectionâ¦"}),(0,s.jsx)("div",{className:"flex gap-1.5",children:[0,1,2].map(e=>(0,s.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-slate-200",style:{animation:`dotPop 1.5s ${.2*e}s ease-in-out infinite`}},e))}),(0,s.jsx)("style",{children:` 2 @keyframes dotPop { 3 0%,100% { background-color:#e2e8f0; transform:scale(1); } 4 50% { background-color:var(--ph-primary); transform:scale(1.5); } 5 } 6 `})]})}function E({contact:e,permissions:t,phoneForHref:a,whatsappHref:n,existingRating:l,onRateLead:i}){let[o,d]=(0,r.useState)(0),[c,m]=(0,r.useState)(!1),p=e?.firstName||"Verified User",u=!!t?.subscribedAdOwner,g="number"==typeof l&&l>=1&&l<=5?l:0,j=p.split(" ").map(e=>e[0]??"").join("").slice(0,2).toUpperCase(),v=t?.contactsRemaining,N=a??e?.phone??null,k=async()=>
6{if(!N||"u"<typeof navigator||!navigator.clipboard)return void(0,w.c)("Unable to copy number","error");try{await navigator.clipboard.writeText(N),m(!0),window.setTimeout(()=>m(!1),1200)}catch{(0,w.c)("Unable to copy number","error")}};return(0,s.jsxs)("div",{className:"flex flex-col gap-6 max-sm:gap-7 py-1 animate-in zoom-in-95 fade-in duration-350",children:[(0,s.jsxs)("div",{className:"relative overflow-hidden rounded-2xl bg-[#080C14] p-6",children:[(0,s.jsx)("div",{className:"pointer-events-none absolute -right-10 -top-10 h-48 w-48 rounded-full bg-[radial-gradient(circle,rgba(59,130,246,0.2),transparent_65%)]"}),(0,s.jsx)("div",{className:"pointer-events-none absolute -bottom-8 -left-8 h-32 w-32 rounded-full bg-[radial-gradient(circle,rgba(16,185,129,0.1),transparent_65%)]"}),(0,s.jsxs)("div",{className:"relative z-10 flex items-center gap-4 mb-6",children:[(0,s.jsx)("div",{className:"flex h-13 w-13 shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-[rgba(25,155,255,0.35)] to-[rgba(25,155,255,0.12)] border border-white/10",style:{width:52,height:52},children:(0,s.jsx)("span",{className:"text-[15px] font-bold text-white/90 leading-none tracking-tight",children:j})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,s.jsx)("p",{className:"text-[19px] max-sm:text-[21px] font-bold tracking-tight text-white leading-tight truncate",children:p}),u&&(0,s.jsx)("span",{className:"shrink-0 rounded-md border border-[rgba(212,168,83,0.35)] bg-[rgba(212,168,83,0.12)] px-1.5 py-0.5 text-[10px] font-extrabold tracking-widest text-[var(--ph-gold)]",children:"PRO"})]}),(0,s.jsxs)("div",{className:"mt-1.5 flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:"h-[6px] w-[6px] rounded-full bg-emerald-400 shadow-[0_0_0_2px_rgba(52,211,153,0.2)] animate-pulse shrink-0"}),(0,s.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-[0.1em] text-emerald-400",children:"Verified"})]})]})]}),(0,s.jsxs)("div",{className:"relative z-10 mb-1 flex items-center gap-2",children:[(0,s.jsx)("a",{href:`tel:${a}`,className:"font-mono text-[28px] max-sm:text-[32px] font-medium tracking-wide text-white leading-none transition-opacity hover:opacity-70 active:scale-95",children:e?.phone||a}),(0,s.jsx)("button",{type:"button",onClick:k,className:"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-white/15 bg-white/5 text-white/55 transition-all hover:bg-white/10 hover:text-white/80","aria-label":"Copy phone number",title:"Copy number",children:c?(0,s.jsx)(h.A,{className:"h-3.5 w-3.5 text-emerald-300"}):(0,s.jsx)(f.A,{className:"h-3.5 w-3.5"})})]}),(0,s.jsx)("p",{className:"relative z-10 text-[11.5px] max-sm:text-[12.5px] text-white/30 mt-1",children:"Tap to call directly"}),"number"==typeof v&&(0,s.jsxs)("div",{className:"relative z-10 mt-4 flex items-center gap-1.5 border-t border-white/[0.07] pt-4",children:[(0,s.jsx)(x.A,{className:"h-3.5 w-3.5 text-white/30",strokeWidth:2}),(0,s.jsx)("span",{className:"text-[11.5px] max-sm:text-[13px] text-white/35",children:v>0?`${v} credit${1!==v?"s":""} remaining`:"No credits remaining"})]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,s.jsxs)("a",{href:`tel:${a}`,className:"flex h-13 items-center justify-center gap-2 rounded-[13px] bg-gradient-to-br from-[var(--ph-primary)] to-[var(--ph-primary-dark)] text-[13.5px] max-sm:text-[14.5px] font-bold text-white shadow-md shadow-[rgba(25,155,255,0.28)] transition-all hover:-translate-y-0.5 hover:shadow-lg max-sm:min-h-[3.5rem]",style:{height:52},children:[(0,s.jsx)(b.A,{className:"h-4 w-4 max-sm:h-[18px] max-sm:w-[18px]",strokeWidth:2}),"Call Now"]}),(0,s.jsxs)("a",{href:n??"#",target:"_blank",rel:"noopener noreferrer",className:"group flex items-center justify-center gap-2 rounded-[13px] border-2 border-slate-200 bg-white text-[13.5px] max-sm:text-[14.5px] font-bold text-slate-700 transition-all hover:-translate-y-0.5 hover:border-[#25D366] hover:text-[#25D366] hover:bg-[#F0FFF8] max-sm:min-h-[3.5rem]",style:{height:52},children:[(0,s.jsx)("img",{src:"/icons/wa-icon-filled.svg",alt:"",className:"h-4 w-4","aria-hidden":!0}),"WhatsApp"]})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between rounded-xl border border-slate-100 bg-slate-50 px-4 py-4 max-sm:px-4 max-sm:py-[1.125rem]",children:[(0,s.jsx)("span",{className:"text-[12.5px] max-sm:text-[13.5px] font-semibold text-slate-400",children:"Was this lead helpful?"}),(0,s.jsx)("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(e=>(0,s.jsx)("button",{onMouseEnter:()=>d(e),onMouseLeave:()=>d(0),onClick:()=>i(e),"aria-label":`Rate ${e} star${e>1?"s":""}`,className:"text-[22px] max-sm:text-[24px] leading-none transition-transform duration-100 hover:scale-125 active:scale-110 focus:outline-none",children:(0,s.jsx)("span",{className:(0,y.cn)("block transition-colors duration-100",e<=(o||g)?"text-amber-400":"text-slate-200"),children:"â
"})},e))})]})]})}let I=["Not useful","Somewhat useful","Good lead","Great lead","Perfect match"];function _(e,t){return e>=1&&e<=5?e:t.polite||t.planningVisit?5:t.rude||t.notReachable||t.wrongLocation||t.unavailable?2:t.indirectLead||t.others?3:null}function P({initialStars:e,adId:t,adType:a,onDone:n}){let[l,i]=(0,r.useState)(e),[d,c]=(0,r.useState)(0),[x,m]=(0,r.useState)(""),[p,u]=(0,r.useState)(()=>k()),[h,f]=(0,r.useState)(!1),[b,g]=(0,r.useState)(!1),j=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{j.current&&clearTimeout(j.current)},[]),(0,r.useEffect)(()=>{let a=!1;return(async()=>{let s=await A(t);a||(s.ok&&s.hasExisting?(i(s.data.rating),u(s.data.options),m(s.data.comments??"")):s.ok&&!s.hasExisting&&(i(e),u(k()),m("")))})(),()=>{a=!0}},[t,e]);let v=async e=>{let s=_(e.stars,e.options);if(null==s)return;f(!0);let r=await C({adId:t,adType:a,feedbackData:{rating:s,options:e.options,comments:e.comments.slice(0,256)}});(f(!1),r.ok)?(g(!0),window.setTimeout(()=>g(!1),2500)):(0,w.c)(r.error||"Could not save feedback","error")},S=async()=>{await v({stars:l,options:p,comments:x.trim()}),n()};return(0,s.jsxs)("div",{className:"flex flex-col gap-5 py-1 animate-in fade-in slide-in-from-right-4 duration-350",children:[(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("h3",{className:"text-[17px] font-bold tracking-tight text-slate-900",children:"Rate this lead"}),(0,s.jsx)("p",{className:"text-[13px] text-slate-400 leading-relaxed",children:"Give quick feedback in 1â2 seconds."})]}),(0,s.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,s.jsx)("div",{className:"flex gap-2",children:[1,2,3,4,5].map(e=>(0,s.jsx)("button",{onMouseEnter:()=>c(e),onMouseLeave:()=>c(0),onClick:()=>i(e),"aria-label":`${e} star${e>1?"s":""}`,className:(0,y.cn)("text-[38px] leading-none transition-all duration-150 focus:outline-none","hover:scale-110 active:scale-95",e<=(d||l)?"text-amber-400 drop-shadow-[0_2px_6px_rgba(245,158,11,0.5)]":"text-slate-200"),children:"â
"},e))}),(0,s.jsx)("span",{className:(0,y.cn)("text-[13px] font-semibold transition-all duration-200",l>0?"text-slate-600 opacity-100":"opacity-0"),children:l>0?I[l-1]:""})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-widest text-slate-400",children:"Qu
6ick tags"}),b&&(0,s.jsx)("span",{className:"text-[11px] font-semibold text-emerald-600",children:"Saved"})]}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:N.map(({value:e,label:t})=>{let a=p[e];return(0,s.jsx)("button",{type:"button",disabled:h,onClick:()=>{let t;u(t={...p,[e]:!p[e]}),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{v({stars:l,options:t,comments:x.trim()})},280)},className:(0,y.cn)("rounded-full border px-3 py-1.5 text-[12px] font-semibold transition-colors","border-slate-200 bg-white text-slate-700 hover:bg-slate-50","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[rgba(25,155,255,0.25)]",a&&"border-[rgba(25,155,255,0.45)] bg-[var(--ph-primary-8)] text-slate-900"),"aria-pressed":a,children:t},e)})})]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsxs)("label",{className:"text-[11px] font-semibold uppercase tracking-widest text-slate-400",children:["Additional comments"," ",(0,s.jsx)("span",{className:"normal-case tracking-normal font-normal text-slate-300",children:"(optional)"})]}),(0,s.jsx)("textarea",{value:x,onChange:e=>m(e.target.value),placeholder:"e.g. Wrong number, not serious buyerâ¦",rows:3,className:"w-full resize-none rounded-xl border border-slate-200 bg-slate-50 px-3.5 py-3 text-[13.5px] text-slate-700 placeholder:text-slate-300 outline-none focus:border-[var(--ph-primary)] focus:bg-white focus:ring-2 focus:ring-[rgba(25,155,255,0.1)] transition"})]}),(0,s.jsxs)("div",{className:"flex gap-2.5",children:[(0,s.jsxs)("button",{onClick:S,disabled:h||null==_(l,p),className:"flex flex-1 items-center justify-center gap-2 rounded-[13px] bg-gradient-to-br from-[var(--ph-primary)] to-[var(--ph-primary-dark)] py-[13px] text-[14px] font-bold text-white shadow-md shadow-[rgba(25,155,255,0.28)] transition-all hover:-translate-y-0.5 hover:shadow-lg disabled:opacity-50 disabled:cursor-not-allowed disabled:translate-y-0",children:[h&&(0,s.jsx)(o.A,{className:"h-4 w-4 animate-spin"}),"Done"]}),(0,s.jsx)("button",{onClick:n,className:"rounded-[13px] border-[1.5px] border-slate-200 px-5 py-[13px] text-[13.5px] font-semibold text-slate-400 transition hover:bg-slate-50 hover:text-slate-600 hover:border-slate-300",children:"Skip"})]})]})}function O({onClose:e}){return(0,s.jsxs)("div",{className:"flex flex-col items-center gap-5 py-8 text-center animate-in zoom-in-95 fade-in duration-350",children:[(0,s.jsx)("div",{className:"flex h-16 w-16 items-center justify-center rounded-full bg-emerald-50 border-2 border-emerald-200 shadow-[0_0_0_6px_rgba(16,185,129,0.07)]",children:(0,s.jsx)("span",{className:"text-3xl",children:"\uD83D\uDE4F"})}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)("h3",{className:"text-[17px] font-bold tracking-tight text-slate-900",children:"Thanks for your feedback"}),(0,s.jsx)("p",{className:"text-[13px] text-slate-400 leading-relaxed max-w-[240px]",children:"It helps us surface better leads for you next time."})]}),(0,s.jsx)("button",{onClick:e,className:"rounded-[13px] border-[1.5px] border-slate-200 px-8 py-[11px] text-[13.5px] font-semibold text-slate-500 transition hover:bg-slate-50 hover:text-slate-700 hover:border-slate-300",children:"Close"})]})}function M({message:e,authRequired:t,showUpgrade:a,isOwnPost:r,ownPostTypeLabel:n,onLogin:l,onUpgrade:i,onClose:o}){let d=a&&!t;return(0,s.jsxs)("div",{className:"flex flex-col items-center gap-5 py-4 text-center animate-in fade-in duration-200",children:[(0,s.jsx)("div",{className:(0,y.cn)("flex h-14 w-14 items-center justify-center rounded-full border-2",r?"border-sky-200 bg-sky-50":d?"border-amber-200 bg-amber-50 shadow-[0_0_0_6px_rgba(217,119,6,0.06)]":"border-red-200 bg-red-50"),children:r?(0,s.jsx)(g.A,{className:"h-6 w-6 text-sky-600",strokeWidth:1.8}):d?(0,s.jsx)(p.A,{className:"h-6 w-6 text-amber-600",strokeWidth:1.8}):(0,s.jsx)(j.A,{className:"h-6 w-6 text-red-500",strokeWidth:1.8})}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)("h3",{className:"text-[16px] font-bold tracking-tight text-slate-900",children:r?`This is your own ${n}`:t?"Sign In Required":d?"Out of Credits":"Something Went Wrong"}),(0,s.jsx)("p",{className:"text-[13px] leading-relaxed text-slate-500 max-w-[260px] mx-auto",children:e})]}),(0,s.jsxs)("div",{className:"flex w-full flex-col gap-2.5",children:[t&&(0,s.jsxs)("button",{onClick:l,className:"group relative w-full overflow-hidden rounded-[13px] bg-gradient-to-br from-[var(--ph-primary)] to-[var(--ph-primary-dark)] py-[13px] text-[14px] font-bold text-white shadow-md transition-all hover:-translate-y-0.5 hover:shadow-lg",children:[(0,s.jsx)("span",{className:"pointer-events-none absolute inset-0 -translate-x-full bg-gradient-to-r from-transparent via-white/15 to-transparent transition-transform duration-500 group-hover:translate-x-full"}),"Sign In to Unlock"]}),a&&(0,s.jsxs)("button",{onClick:i,className:"group relative w-full overflow-hidden rounded-[13px] bg-gradient-to-br from-amber-600 to-amber-700 py-[13px] text-[14px] font-bold text-white shadow-md transition-all hover:-translate-y-0.5 hover:shadow-lg",children:[(0,s.jsx)("span",{className:"pointer-events-none absolute inset-0 -translate-x-full bg-gradient-to-r from-transparent via-white/15 to-transparent transition-transform duration-500 group-hover:translate-x-full"}),"⦠View Membership Plans"]}),r?(0,s.jsx)("button",{onClick:o,className:"w-full rounded-[13px] border-[1.5px] border-slate-200 bg-transparent py-[11px] text-[13.5px] font-semibold text-slate-500 transition hover:border-slate-300 hover:bg-slate-50 hover:text-slate-700",children:"Ok, understood"}):t||a?null:(0,s.jsx)("button",{onClick:()=>window.location.reload(),className:"w-full rounded-[13px] border-[1.5px] border-slate-200 bg-transparent py-[11px] text-[13.5px] font-semibold text-slate-500 transition hover:border-slate-300 hover:bg-slate-50 hover:text-slate-700",children:"Try Again"})]})]})}
6function U({contactNumber:e,contactRequest:t,open:a,onOpenChange:o,hideTrigger:d=!1,children:c,isLoggedIn:x,dialogIntentKey:m,contactsRemaining:p}){let u,h,f=(0,n.useRouter)(),g=(0,v.fZ)(),[j,N]=(0,r.useState)(!1);(0,r.useEffect)(()=>N(!0),[]);let[k,C]=(0,r.useState)(!1),[T,I]=(0,r.useState)("idle"),[_,W]=(0,r.useState)(null),[$,D]=(0,r.useState)(null),[F,V]=(0,r.useState)(!1),[z,B]=(0,r.useState)(null),[G,H]=(0,r.useState)(null),[q,X]=(0,r.useState)(0),[Z,J]=(0,r.useState)(null),[Q,Y]=(0,r.useState)(null),[K,ee]=(0,r.useState)("idle"),et=(0,r.useRef)(!1),ea=(0,r.useRef)(null),es=(0,r.useRef)(0),er=(0,r.useMemo)(()=>{let a=m?.trim()||t?.adId?.trim()||e?.trim()||"generic";return`contact-dialog-${a.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")}`},[m,t?.adId,e]),en=a??k,el=g?g.isLoggedIn:!1!==x,ei=e=>{o?.(e),void 0===a&&C(e),e||(W(null),D(null),V(!1))};(0,r.useEffect)(()=>{H(null),B(null),W(null),D(null),V(!1),I("idle"),X(0),J(null),Y(null),ee("idle"),et.current=!1},[t?.adId]),(0,r.useEffect)(()=>{if(!en||!t?.adId||!el||S(t?.targetPlanName)||"number"==typeof p||"idle"!==K)return;if("function"!=typeof fetch)return void ee("error");let e=!1,a=new AbortController;return ee("loading"),(async()=>{try{let t=setTimeout(()=>a.abort(),8e3),s=await fetch("/api/contacts/credits",{cache:"no-store",credentials:"include",signal:a.signal});clearTimeout(t);let r=await s.json().catch(()=>({}));if(e)return;if(!s.ok||"success"!==r.result)return void ee("error");if("number"==typeof r.contactsRemaining){Y(r.contactsRemaining),ee("ready");return}ee("error")}catch{if(e)return;ee("error")}})(),()=>{e=!0,a.abort()}},[en,t?.adId,t?.targetPlanName,el,p,K]),(0,r.useEffect)(()=>{if(!en||!t?.adId||!(g?g.isLoggedIn:!1!==x))return;let e=!1;return(async()=>{let a=await A(t.adId);e||(a.ok&&a.hasExisting?J(a.data.rating):J(null))})(),()=>{e=!0}},[en,t?.adId,g,x]);let eo=async e=>{if(!t)return;let a=++es.current,s=()=>a!==es.current,r=e=>{s()||e()},n=e?.postLoginRecovery?4:1,l=[500,750,1e3];if(r(()=>{I("loading"),W(null),D(null),V(!1)}),!(e?.postLoginRecovery&&(await new Promise(e=>setTimeout(e,480)),s())))for(let a=0;a<n;a++){if(a>0&&(await new Promise(e=>setTimeout(e,l[a-1]??900)),s()))return;try{let l=await fetch("/api/contacts/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),credentials:"include"}),i=await l.json().catch(()=>({}));if(!l.ok||"success"!==i.result){if(e?.postLoginRecovery&&a<n-1&&("UNAUTHORIZED"===i.code||401===l.status||l.status>=500))continue;let t="UNAUTHORIZED"===i.code?"Sign in to unlock verified lead information.":"NO_CREDITS"===i.code?"Your monthly credits are exhausted. Upgrade to unlock more leads.":"UPGRADE_REQUIRED"===i.code?"This lead type is exclusive to higher plans. Upgrade your membership.":i.message??"Unable to connect right now. Please try again.";r(()=>{D(i.code??"REVEAL_FAILED"),V("UNAUTHORIZED"===i.code),W(t),I("error")}),"SELF_CONTACT"===i.code&&(0,w.c)(t,"success"),e?.consumePendingAfter&&g&&!s()&&g.consumePendingAction("REVEAL_CONTACT");return}r(()=>{H(i.contact??null),B(i.permissions??null),I("revealed")});let o=`${m??"default"}:${t.adId}`;s()||ea.current===o||((0,w.c)("Lead details unlocked","success"),ea.current=o),e?.consumePendingAfter&&g&&!s()&&g.consumePendingAction("REVEAL_CONTACT");return}catch{if(e?.postLoginRecovery&&a<n-1)continue;r(()=>{D("REVEAL_FAILED"),W("A network error occurred. Please try again."),I("error")}),e?.consumePendingAfter&&g&&!s()&&g.consumePendingAction("REVEAL_CONTACT");return}}};(0,r.useEffect)(()=>{if(!g?.isLoggedIn||!t?.adId||!g.pendingAction||"REVEAL_CONTACT"!==g.pendingAction.type||g.pendingAction.payload?.adId!==t.adId)return;let e=g.pendingAction.ui?.dialogIntentKey;e&&e!==m||et.current||(g.pendingAction.ui?.openDialog&&ei(!0),et.current=!0,eo({consumePendingAfter:!0,postLoginRecovery:!0}).finally(()=>{et.current=!1}))},[g?.isLoggedIn,g?.pendingAction,t?.adId]);let ed=(0,r.useMemo)(()=>String(e??"").trim()||null,[e]),ec=G?.phone??ed,ex=ec?ec.replace(/\s+/g,""):null,em=String(G?.countryCode??"91").replace("+",""),ep=ex?`https://wa.me/${em}${ex}?text=${encodeURIComponent("Hi, I saw your listing on PropHunt and would like to connect.")}`:null,eu=S(t?.targetPlanName),eh=t?.adId&&t.adType&&(h=(u=t.adType.trim())?"listForRent"===u||"listForSale"===u||"lookingToRent"===u||"lookingToBuy"===u?u:"rent"===u?"lookingToRent":"buy"===u?"lookingToBuy":null:null)?{adId:t.adId,adType:h}:null,ef=async()=>
6{if(t&&"loading"!==T){if(!(g?g.isLoggedIn:!1!==x))return void(g?g.requireAuth({reason:"Sign in to unlock verified leads",onAuthenticated:()=>{},pendingAction:{type:"REVEAL_CONTACT",payload:{...t},ui:{openDialog:!0,dialogIntentKey:m}}}):f.push("/login"));ei(!0),await eo()}},eb="loading"===T?"loading":"error"===T?"error":"feedback"===T?"feedback":"feedback-done"===T?"feedback-done":ec&&!t||"revealed"===T?"revealed":"idle",eg=!!("SELF_CONTACT"!==$&&(_?.toLowerCase().includes("upgrade")||_?.toLowerCase().includes("exhausted"))),ej=t?.adType==="listForRent"||t?.adType==="listForSale"?"listing":"requirement",ey="number"==typeof z?.contactsRemaining?z.contactsRemaining:"number"==typeof Q?Q:p??null,ev=el&&!eu&&"number"!=typeof ey&&"loading"===K,ew=el&&!eu&&"number"!=typeof ey&&"error"===K;return j?(0,s.jsxs)(l.lG,{open:en,onOpenChange:ei,children:[!d&&(0,s.jsx)(l.zM,{asChild:!0,children:c??(0,s.jsxs)(i.Button,{"aria-controls":er,className:"w-full sm:w-auto font-bold gap-2 border-0 bg-gradient-to-br from-[var(--ph-primary)] to-[var(--ph-primary-dark)] text-white shadow-md shadow-[rgba(25,155,255,0.28)] transition-all hover:-translate-y-0.5 hover:from-[var(--ph-primary-hover)] hover:to-[#0066bb]",children:[(0,s.jsx)(b.A,{className:"h-4 w-4"}),"Connect with Member"]})}),(0,s.jsxs)(l.Cf,{id:er,className:(0,y.cn)("gap-0 border-0 bg-white p-0 shadow-2xl shadow-black/15 overflow-hidden ring-1 ring-black/[0.06]","flex flex-col","sm:max-w-[390px] sm:rounded-2xl","max-sm:fixed max-sm:inset-x-0 max-sm:bottom-0 max-sm:top-auto max-sm:w-full","max-sm:min-h-[58dvh]","max-sm:rounded-t-[28px] max-sm:rounded-b-none","max-sm:!translate-x-0 max-sm:!translate-y-0","max-sm:data-[state=open]:animate-in max-sm:data-[state=open]:slide-in-from-bottom","max-sm:data-[state=closed]:animate-out max-sm:data-[state=closed]:slide-out-to-bottom","max-sm:duration-300 max-sm:ease-out"),children:["loading"!==eb&&(0,s.jsx)("div",{className:"mx-auto mt-2.5 h-[5px] w-10 rounded-full bg-slate-200 sm:hidden"}),"loading"===eb?(0,s.jsx)(l.L3,{className:"sr-only",children:"Loading contact details"}):(0,s.jsx)("div",{className:"flex items-center justify-between px-6 pt-4 pb-0 max-sm:px-5 max-sm:pt-2.5 max-sm:pb-1",children:(0,s.jsx)(l.L3,{className:"text-[22px] max-sm:text-[24px] font-bold tracking-tight text-slate-900",children:"feedback"===eb?"Feedback":"feedback-done"===eb?"Thank You":"Contact"})}),(0,s.jsxs)("div",{className:(0,y.cn)("px-6 pb-8 pt-4 max-sm:px-5 max-sm:pb-[max(0.75rem,env(safe-area-inset-bottom,0px))] max-sm:pt-5","loading"===eb&&"flex flex-1 flex-col justify-center pt-6 pb-8 max-sm:pt-8 max-sm:pb-[max(1.5rem,env(safe-area-inset-bottom,0px))]"),children:["idle"===eb&&(0,s.jsx)(L,{onUnlock:ef,isProLead:eu,isLoggedIn:el,contactsRemaining:ey,isCheckingCredits:ev,creditsUnavailable:ew}),"loading"===eb&&(0,s.jsx)(R,{}),"revealed"===eb&&(0,s.jsx)(E,{contact:G,permissions:z,phoneForHref:ex,whatsappHref:ep,existingRating:Z,onRateLead:e=>{X(e),I("feedback")}}),"feedback"===eb&&eh&&(0,s.jsx)(P,{initialStars:q,adId:eh.adId,adType:eh.adType,onDone:()=>I("feedback-done")}),"feedback-done"===eb&&(0,s.jsx)(O,{onClose:()=>ei(!1)}),"error"===eb&&_&&(0,s.jsx)(M,{message:_,authRequired:F,showUpgrade:eg,isOwnPost:"SELF_CONTACT"===$,ownPostTypeLabel:ej,onLogin:()=>{g?(ei(!1),g.requireAuth({reason:"Sign in to unlock verified leads",onAuthenticated:()=>{},pendingAction:t?{type:"REVEAL_CONTACT",payload:{...t},ui:{openDialog:!0,dialogIntentKey:m}}:void 0})):f.push("/login")},onUpgrade:()=>{ei(!1),f.push("/dashboard/membership")},onClose:()=>ei(!1)})]})]})]}):d?null:c??null}},68475:(e,t,a)=>{a.d(t,{d:()=>I});var s=a(95155),r=a(12115),n=a(74350),l=a(91337),i=a(24538),o=a(50049),d=a(71275),c=a(14693),x=a(37595),m=a(82977),p=a(127),u=a(33210),h=a(12651),f=a(41585),b=a(94290),g=a(86901),j=a(21628),y=a(80723),v=a(6296);let w={Location:{icon:(0,s.jsx)(i.A,{className:"h-3.5 w-3.5"}),color:"#3b82f6",bg:"#eff6ff",label:"Location"},Project:{icon:(0,s.jsx)(o.A,{className:"h-3.5 w-3.5"}),color:"#8b5cf6",bg:"#f5f3ff",label:"Project"},Budget:{icon:(0,s.jsx)(d.A,{className:"h-3.5 w-3.5"}),color:"#d97706",bg:"#fffbeb",label:"Budget"},Bedrooms:{icon:(0,s.jsx)(c.A,{className:"h-3.5 w-3.5"}
6),color:"#16a34a",bg:"#f0fdf4",label:"Bedrooms"},Area:{icon:(0,s.jsx)(x.A,{className:"h-3.5 w-3.5"}),color:"#0ea5e9",bg:"#f0f9ff",label:"Area"},Furnishing:{icon:(0,s.jsx)(m.A,{className:"h-3.5 w-3.5"}),color:"#ec4899",bg:"#fdf2f8",label:"Furnishing"}};function N(e){return e.maxPoints?Math.max(0,Math.min(100,Math.round(e.earnedPoints/e.maxPoints*100))):0}function k(e){return e>=75?"linear-gradient(90deg, #10b981, #34d399)":e>=50?"linear-gradient(90deg, #f59e0b, #fbbf24)":"linear-gradient(90deg, #ef4444, #f87171)"}function A(e){return e>=75?"#059669":e>=50?"#d97706":"#dc2626"}function C(e){return e>=75?"#ecfdf5":e>=50?"#fffbeb":"#fef2f2"}function S(e){return e>=85?"Excellent":e>=75?"Strong":e>=60?"Good":e>=50?"Fair":"Weak"}function T(e){return e>=75?"#10b981":e>=50?"#f59e0b":"#ef4444"}function L(e){let t=e.indexOf(":");return t>0&&t<40?{label:e.slice(0,t).trim(),detail:e.slice(t+1).trim()}:{label:e,detail:""}}function R({analysis:e,onExplore:t,onClose:a}){let r=e.finalScore,{strongPoints:n=[],weakPoints:l=[],suggestions:i=[]}=e.summary??{},o=n.map(L),d=l.map(L);return(0,s.jsxs)("div",{className:"flex flex-col h-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 px-5 py-4 border-b border-slate-100 shrink-0",children:[(0,s.jsx)("span",{className:"flex h-9 w-9 items-center justify-center rounded-xl bg-blue-50",children:(0,s.jsx)(p.A,{className:"h-4.5 w-4.5 text-blue-500",strokeWidth:2.5})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-[15px] font-extrabold text-slate-800 tracking-[-0.01em]",children:"Match Analysis"}),(0,s.jsx)("p",{className:"text-[12px] text-slate-400",children:"Indepth project insights"})]}),(0,s.jsx)("button",{onClick:a,className:"flex h-8 w-8 items-center justify-center rounded-full text-slate-400 hover:text-slate-600 hover:bg-slate-100 transition-colors","aria-label":"Close analysis",children:(0,s.jsx)(u.A,{className:"w-4 h-4"})})]}),(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto min-h-0",children:[(0,s.jsxs)("div",{className:"px-5 pt-5 pb-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("span",{className:"text-[13px] font-semibold text-slate-600",children:"Overall Score"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"text-[11px] font-bold px-2.5 py-1 rounded-full",style:{background:C(r),color:A(r)},children:S(r)}),(0,s.jsxs)("span",{className:"text-[22px] font-extrabold",style:{color:A(r)},children:[r,"%"]})]})]}),(0,s.jsx)("div",{className:"h-2.5 rounded-full bg-slate-100 overflow-hidden",children:(0,s.jsx)("div",{className:"h-full rounded-full transition-all duration-700",style:{width:`${r}%`,background:k(r)}})}),e.summary?.overall&&(0,s.jsx)("p",{className:"mt-3 text-[12.5px] text-slate-500 leading-relaxed",children:e.summary.overall})]}),o.length>0&&(0,s.jsxs)("div",{className:"px-5 pb-4",children:[(0,s.jsx)("p",{className:"text-[10px] font-bold uppercase tracking-wider text-emerald-600 mb-2.5",children:"Strong Points"}),(0,s.jsx)("div",{className:"space-y-2",children:o.map((e,t)=>(0,s.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,s.jsx)(h.A,{className:"h-4 w-4 text-emerald-500 shrink-0",strokeWidth:2.5}),(0,s.jsx)("span",{className:"text-[12.5px] text-slate-700 font-semibold flex-1",children:e.label}),e.detail&&(0,s.jsx)("span",{className:"text-[12px] text-slate-400 shrink-0",children:e.detail})]},t))})]}),d.length>0&&(0,s.jsxs)("div",{className:"px-5 pb-4",children:[(0,s.jsx)("p",{className:"text-[10px] font-bold uppercase tracking-wider text-amber-600 mb-2.5",children:"Needs Attention"}),(0,s.jsx)("div",{className:"space-y-2",children:d.map((e,t)=>(0,s.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,s.jsx)(f.A,{className:"h-4 w-4 text-amber-500 shrink-0",strokeWidth:2.5}),(0,s.jsx)("span",{className:"text-[12.5px] text-slate-700 font-semibold flex-1",children:e.label}),e.detail&&(0,s.jsx)("span",{className:"text-[12px] text-slate-400 shrink-0",children:e.detail})]},t))})]}),i.length>0&&(0,s.jsxs)("div",{className:"mx-5 mb-4 rounded-2xl px-4 py-3 flex items-start gap-3",style:{background:"rgba(25,155,255,0.06)"},children:[(0,s.jsx)(b.A,{className:"h-4 w-4 text-blue-500 shrink-0 mt-0.5",strokeWidth:2.5}),(0,s.jsx)("p",{className:"text-[12px] text-blue-700 leading-snug font-semibold",children:i[0]})]})]}),e.breakdown.length>0&&(0,s.jsx)("div",{className:"shrink-0 px-5 pb-5 pt-2",children:(0,s.jsxs)("button",{onClick:t,className:"w-full flex items-center justify-center gap-2 rounded-2xl py-3 text-[13.5px] font-semibold text-white transition-all hover:brightness-110 active:scale-[0.98]",style:{background:"linear-gradient(135deg, #3b82f6 0%, #2563eb 100%)",boxShadow:"0 4px 14px rgba(59,130,246,0.25)"},children:[(0,s.jsx)(g.A,{className:"w-4 h-4"}),"Explore Category Breakdown",(0,s.jsx)(j.A,{className:"w-4 h-4"})]})}),(0,s.jsx)("div",{className:"shrink-0 border-t border-slate-100 text-center py-3 px-5",children:(0,s.jsx)("p",{className:"text-[11px] text-slate-400",children:"Analysis based on your saved preferences & filters"})})]})}function E({analysis:e,initialCategory:t,onBack:a,onClose:n}){let[l,i]=(0,r.useState)(t),o=(0,r.useRef)(null),d=e.breakdown.map(e=>e.category),c=e.breakdown.find(e=>e.category===l);if((0,r.useEffect)(()=>
6{let e=o.current?.querySelector(`[data-pill="${l}"]`);e?.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[l]),!c)return null;let m=N(c),p=w[c.category]??{icon:(0,s.jsx)(x.A,{className:"h-3.5 w-3.5"}),color:"#64748b",bg:"#f1f5f9",label:c.category},h=Object.entries(c.details??{}).filter(([,e])=>null!=e&&""!==String(e).trim());return(0,s.jsxs)("div",{className:"flex flex-col h-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2.5 px-5 py-3.5 border-b border-slate-100 shrink-0",children:[(0,s.jsx)("button",{onClick:a,className:"flex h-8 w-8 items-center justify-center rounded-full text-slate-500 hover:text-slate-700 hover:bg-slate-100 transition-colors","aria-label":"Back to summary",children:(0,s.jsx)(y.A,{className:"w-4 h-4"})}),(0,s.jsx)("p",{className:"text-[13.5px] font-extrabold text-slate-800 flex-1",children:"Category Breakdown"}),(0,s.jsxs)("span",{className:"text-[12px] font-bold px-3 py-1.5 rounded-full tabular-nums",style:{background:C(e.finalScore),color:A(e.finalScore)},children:[e.finalScore,"% overall"]}),(0,s.jsx)("button",{onClick:n,className:"flex h-8 w-8 items-center justify-center rounded-full text-slate-400 hover:text-slate-600 hover:bg-slate-100 transition-colors","aria-label":"Close analysis",children:(0,s.jsx)(u.A,{className:"w-4 h-4"})})]}),(0,s.jsx)("div",{ref:o,className:"flex gap-2.5 px-5 py-4 overflow-x-auto shrink-0 border-b border-slate-50",style:{scrollbarWidth:"none"},children:d.map(t=>{let a=t===l,r=e.breakdown.find(e=>e.category===t),n=r?N(r):0,o=w[t];return(0,s.jsxs)("button",{"data-pill":t,onClick:()=>i(t),className:"flex items-center gap-2 rounded-full px-3.5 py-2 text-[13px] font-semibold whitespace-nowrap shrink-0 border transition-all duration-150",style:{background:a?p.bg:"white",color:a?o?.color??"#64748b":"#64748b",borderColor:a?(o?.color??"#64748b")+"40":"#e2e8f0",boxShadow:a?`0 0 0 1px ${o?.color??"#64748b"}15`:"none"},children:[(0,s.jsx)("span",{className:"flex h-6 w-6 items-center justify-center rounded-full shrink-0",style:{background:o?.bg??"#f1f5f9",color:o?.color??"#64748b"},"aria-hidden":"true",children:o?.icon??(0,s.jsx)("span",{className:"w-1.5 h-1.5 rounded-full",style:{background:T(n)}})}),t]},t)}
6)}),(0,s.jsx)("div",{className:"flex-1 overflow-y-auto min-h-0 px-5 py-5",children:(0,s.jsxs)("div",{className:"rounded-2xl border overflow-hidden",style:{borderColor:p.color+"20"},children:[(0,s.jsxs)("div",{className:"px-4 py-3.5 flex items-center gap-3",style:{background:p.bg},children:[(0,s.jsx)("span",{className:"flex h-9 w-9 items-center justify-center rounded-xl",style:{background:"white",color:p.color},children:p.icon}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-[14px] font-bold",style:{color:p.color},children:c.category}),(0,s.jsxs)("p",{className:"text-[11px] text-slate-500",children:[S(m)," match"]})]}),(0,s.jsx)("div",{className:"text-right shrink-0",children:(0,s.jsxs)("p",{className:"text-[22px] font-extrabold leading-none tabular-nums",style:{color:A(m)},children:[m,"%"]})})]}),(0,s.jsx)("div",{className:"px-4 pt-3 pb-1",children:(0,s.jsx)("div",{className:"h-2 rounded-full bg-slate-100 overflow-hidden",children:(0,s.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${m}%`,background:k(m)}})})}),c.explanation&&(0,s.jsx)("div",{className:"px-4 py-3",children:(0,s.jsx)("p",{className:"text-[12.5px] leading-relaxed text-slate-600",children:c.explanation})}),h.length>0&&(0,s.jsx)("div",{className:"mx-4 mb-3 rounded-xl bg-slate-50 border border-slate-100 divide-y divide-slate-100",children:h.map(([e,t])=>(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3 px-3.5 py-2",children:[(0,s.jsx)("span",{className:"text-[11px] text-slate-500 capitalize",children:e.replace(/_/g," ")}),(0,s.jsx)("span",{className:"text-[11.5px] font-semibold text-slate-700 text-right",children:String(t)})]},e))}),(0,s.jsx)("div",{className:"px-4 pb-3.5",children:(0,s.jsxs)("div",{className:"flex items-center gap-2 rounded-lg bg-slate-50 px-3 py-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 rounded-full shrink-0",style:{background:T(m)}}),(0,s.jsxs)("p",{className:"text-[11px] text-slate-500",children:["Scored"," ",(0,s.jsx)("span",{className:"font-semibold text-slate-700",children:c.earnedPoints})," ","of ",c.maxPoints," points",c.weight?(0,s.jsxs)("span",{className:"text-slate-400",children:[" ","\xb7 ",c.weight,"% weight"]}):null]})]})})]})}),(0,s.jsx)("div",{className:"shrink-0 border-t border-slate-100 text-center py-3 px-5",children:(0,s.jsx)("p",{className:"text-[11px] text-slate-400",children:"Analysis based on your saved preferences & filters"})})]})}function I({open:e,onOpenChange:t,analysis:a,loading:i=!1}){let[o,d]=(0,r.useState)("summary");(0,r.useEffect)(()=>{e&&d("summary")},[e]);let c=(0,l.cn)("gap-0 border-0 bg-white p-0 overflow-hidden ring-1 ring-black/[0.06]","flex flex-col","sm:max-w-[min(540px,calc(100vw-24px))] sm:rounded-2xl","max-sm:fixed max-sm:inset-x-0 max-sm:bottom-0 max-sm:top-auto max-sm:w-full","max-sm:rounded-t-2xl max-sm:rounded-b-none","max-sm:!translate-x-0 max-sm:!translate-y-0","max-sm:max-h-[88dvh]","max-sm:data-[state=open]:animate-in max-sm:data-[state=open]:slide-in-from-bottom","max-sm:data-[state=closed]:animate-out max-sm:data-[state=closed]:slide-out-to-bottom","max-sm:duration-300 max-sm:ease-out","shadow-2xl shadow-black/15");if(!a)return e?(0,s.jsx)(n.lG,{open:e,onOpenChange:t,children:(0,s.jsxs)(n.Cf,{hideClose:!0,className:c,style:{boxShadow:"0 25px 60px -12px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.04)"},children:[(0,s.jsx)(n.L3,{className:"sr-only",children:"Match Analysis"}),(0,s.jsx)("div",{className:"mx-auto mt-2.5 h-[5px] w-10 rounded-full bg-slate-200 sm:hidden"}),(0,s.jsxs)("div",{className:"flex items-center gap-3 px-6 py-4.5 border-b border-slate-100 shrink-0",children:[(0,s.jsx)("span",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-blue-50",children:(0,s.jsx)(p.A,{className:"h-4 w-4 text-blue-500",strokeWidth:2.5})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-[14px] font-bold text-slate-800",children:"Match Analysis"}),(0,s.jsx)("p",{className:"text-[11px] text-slate-400",children:"Indepth project insights"})]}),(0,s.jsx)("button",{onClick:()=>t(!1),className:"flex h-8 w-8 items-center justify-center rounded-full text-slate-400 hover:text-slate-600 hover:bg-slate-100 transition-colors","aria-label":"Close analysis",children:(0,s.jsx)(u.A,{className:"w-4 h-4"})})]}),(0,s.jsx)("div",{className:"flex-1 min-h-0 flex items-center justify-center px-6 py-10 text-center",children:i?(0,s.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,s.jsx)(v.A,{className:"h-9 w-9 text-blue-500 animate-spin","aria-hidden":!0}),(0,s.jsx)("p",{className:"text-[14px] font-semibold text-slate-800",children:"Loading match analysisâ¦"})]}):(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-[14px] font-semibold text-slate-800",children:"Match analysis isnât available yet"}),(0,s.jsx)("p",{className:"mt-1 text-[12px] text-slate-500 leading-relaxed max-w-[320px]",children:"This result doesnât include explainable match data. Try another listing, or refine your filters for higher-confidence matches."})]})}),(0,s.jsx)("div",{className:"shrink-0 border-t border-slate-100 text-center py-3.5 px-6",children:(0,s.jsx)("p",{className:"text-[11px] text-slate-400",children:"Analysis based on your saved preferences & filters"})})]})}):null;let x=a.breakdown[0]?.category??"Location";return(0,s.jsx)(n.lG,{open:e,onOpenChange:t,children:(0,s.jsxs)(n.Cf,{hideClose:!0,className:c,style:{boxShadow:"0 25px 60px -12px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.04)"},children:[(0,s.jsx)(n.L3,{className:"sr-only",children:"Match Analysis"}),(0,s.jsx)("div",{className:"mx-auto mt-2.5 h-[5px] w-10 rounded-full bg-slate-200 sm:hidden"}),"summary"===o?(0,s.jsx)(R,{analysis:a,onExplore:()=>d("detail"),onClose:()=>t(!1)}):(0,s.jsx)(E,{analysis:a,initialCategory:x,onBack:()=>d("summary"),onClose:()=>t(!1)})]})})}}}]);
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.