1import{c as M,b4 as Q,r as n,j as e,G as z,F as I,B as T,I as E,Q as F,$ as O}from"./index-BFYamPZN.js";import{A as S}from"./alert-circle-Cy-MNOhZ.js";/** 2 * @license lucide-react v0.344.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const R=M("Compass",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"16.24 7.76 14.12 14.12 7.76 16.24 9.88 9.88 16.24 7.76",key:"m9r19z"}]]);/** 7 * @license lucide-react v0.344.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const Y=M("DatabaseZap",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 15 21.84",key:"14ibmq"}],["path",{d:"M21 5V8",key:"1marbg"}],["path",{d:"M21 12L18 17H22L19 22",key:"zafso"}],["path",{d:"M3 12A9 3 0 0 0 14.59 14.87",key:"1y4wr8"}]]);function $(){const{ready:a,error:l,getByPincode:i,search:d,suggestCities:r,suggestDistricts:x,suggestStates:o,didYouMeanCity:f,didYouMeanDistrict:m,didYouMeanState:h}=Q(),[t,D]=n.useState(""),[p,v]=n.useState(""),[u,w]=n.useState(""),[g,k]=n.useState(""),c=n.useMemo(()=>t.length===6?i(t):null,[t,i]),P=n.useMemo(()=>p.trim().length>=2?r(p,25):[],[p,r]),L=n.useMemo(()=>u.trim().length>=2?x(u,25):[],[u,x]),A=n.useMemo(()=>g.trim().length>=2?o(g,25):[],[g,o]),y=p||u||g,C=n.useMemo(()=>y.trim().length<2?[]:d(y,50),[y,d]);return e.jsxs("div",{className:"max-w-6xl mx-auto p-6 space-y-8",children:[e.jsxs("header",{className:"flex items-center gap-3",children:[e.jsx(Y,{className:"h-6 w-6 text-indigo-600"}),e.jsx("h1",{className:"text-2xl font-semibold",children:"Test Lab"})]}),e.jsxs("div",{className:"grid sm:grid-cols-3 gap-4",children:[e.jsx(N,{title:"Dataset",value:a?"Loaded":"Loadingâ¦",sub:l?"Failed to load":"From /public/pincodes.json",ok:a&&!l}),e.jsx(N,{title:"Index build",value:a?"OK":"â",sub:"In-memory maps for instant lookups",ok:a}),e.jsx(N,{title:"Health",value:l?"Error":a?"Ready":"Initializing",sub:l??"",ok:!l})]}),e.jsxs("section",{className:"p-5 rounded-2xl border bg-white shadow-sm space-y-4",children:[e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(z,{className:"h-5 w-5"})," Pincode â Autofill"]}),e.jsxs("div",{className:"flex gap-3 items-start",children:[e.jsx("input",{value:t,onChange:s=>D(s.target.value.replace(/\D/g,"").slice(0,6)),placeholder:"Enter 6-digit pincode",className:"w-48 rounded-lg border px-3 py-2 text-sm",inputMode:"numeric",maxLength:6}),t&&t.length===6&&!c&&e.jsxs("div",{className:"flex items-center gap-2 text-red-600 text-sm",children:[e.jsx(S,{className:"h-4 w-4"})," Unknown pincode"]})]}),e.jsx(I,{children:c&&e.jsxs(T.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},className:"grid sm:grid-cols-5 gap-3 text-sm",children:[e.jsx(j,{label:"Pincode",value:c.pincode}),e.jsx(j,{label:"City",value:c.city}),e.jsx(j,{label:"District",value:c.district??c.city}),e.jsx(j,{label:"State",value:c.state}),e.jsx(j,{label:"Zone",value:c.zone})]})})]}),e.jsxs("section",{className:"p-5 rounded-2xl border bg-white shadow-sm space-y-5",children:[e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(E,{className:"h-5 w-5"})," Local Autocomplete (no network)"]}),e.jsx(b,{label:"City",placeholder:"Try: dwarka, devbhu, bhubaneshwar, bengaluruâ¦",value:p,onChange:v,options:P,onPick:v,didYouMean:s=>s.trim().length>=2?f(s):null}),e.jsx(b,{label:"District",placeholder:"Type a districtâ¦",value:u,onChange:w,options:L,onPick:w,didYouMean:s=>s.trim().length>=2?m(s):null}),e.jsx(b,{label:"State",placeholder:"Type a stateâ¦",value:g,onChange:k,options:A,onPick:k,didYouMean:s=>s.trim().length>=2?h(s):null}),e.jsxs("div",{className:"mt-4",children:[e.jsxs("div",{className:"text-sm text-slate-500 mb-2",children:["Results for"," ",e.jsx("span",{className:"font-medium",children:y.trim()||"â¦"})]}),C.length?e.jsx("div",{className:"rounded-lg border border-slate-200 overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-slate-50 text-slate-600",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-3 py-2 text-left w-24",children:"Pincode"}),e.jsx("th",{className:"px-3 py-2 text-left",children:"City"}),e.jsx("th",{className:"px-3 py-2 text-left",children:"District"}),e.jsx("th",{className:"px-3 py-2 text-left",children:"State"}),e.jsx("th",{className:"px-3 py-2 text-left w-20",children:"Zone"})]})}),e.jsx("tbody",{children:C.map(s=>e.jsxs("tr",{className:"border-t border-slate-100",children:[e.jsx("td",{className:"px-3 py-2 font-mono",children:s.pincode}),e.jsx("td",{className:"px-3 py-2",children:s.city}),e.jsx("td",{className:"px-3 py-2",children:s.district??s.city}),e.jsx("td",{className:"px-3 py-2",children:s.state}),e.jsx("td",{className:"px-3 py-2",children:s.zone})]},`${s.pincode}-${s.city}`))})]})}):e.jsx("div",{className:"text-sm text-slate-500",children:"No results yet."})]})]}),e.jsxs("section",{className:"p-5 rounded-2xl border bg-white shadow-sm space-y-3",children:[e.jsxs("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[e.jsx(R,{className:"h-5 w-5"})," Distance logic (placeholder)"]}),e.jsx("p",{className:"text-sm text-slate-600",children:"Stub for later lat/lng or vendor distance API wiring."})]})]})}function N({title:a,value:l,sub:i,ok:d}){return e.jsxs("div",{className:"p-4 rounded-2xl border bg-white shadow-sm",children:[e.jsx("div",{className:"text-sm text-slate-500",children:a}),e.jsxs("div",{className:"text-lg font-medium flex items-center gap-2",children:[d?e.jsx(F,{className:"h-5 w-5 text-emerald-500"}):e.jsx(S,{className:"h-5 w-5 text-red-500"}),l]}),i&&e.jsx("div",{className:"text-xs text-slate-400 mt-1",children:i})]})}function j({label:a,value:l}){return e.jsxs("div",{className:"p-3 rounded-xl border bg-slate-50",children:[e.jsx("div",{className:"text-xs uppercase tracking-wide text-slate-500",children:a}),e.jsx("div",{className:"text-sm font-medium text-slate-800",children:l})]})}function b({label:a,placeholder:l,value:i,onChange:d,options:r,onPick:x,didYouMean:o}){const m=i.trim().length>=2,h=n.useMemo(()=>m&&r.length===0&&o?o(i):null,[m,r.length,o,i]);return e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-slate-600 mb-1",children:a}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{value:i,onChange:t=>d(t.target.value),placeholder:l,className:"w-full rounded-lg border px-3 py-2 text-sm"}),e.jsx("div",{className:"absolute right-2 top-2",children:!1})]}),m?r.length?e.jsx("div",{className:"mt-2 max-h-56 overflow-auto rounded-lg border border-slate-200 bg-white shadow-sm",children:r.map(t=>e.jsx("button",{type:"button",onClick:()=>x(t),className:"block w-full text-left px-3 py-2 hover:bg-slate-50",children:t},t))}):e.jsxs("div",{className:"text-sm text-slate-500 mt-2 flex items-center gap-2",children:["No matches."," ",h&&e.jsxs("button",{type:"button",onClick:()=>x(h),className:"inline-flex items-center gap-1 text-indigo-600 hover:underline",title:"Ap
11ply suggestion",children:[e.jsx(O,{className:"h-4 w-4"}),"Did you mean ",e.jsx("span",{className:"font-medium",children:h}),"?"]})]}):e.jsx("div",{className:"text-sm text-slate-400 mt-2",children:"Type ⥠2 charactersâ¦"})]})}export{$ 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.