PageSourceSearch

https://www.jansuraaj.org/_next/static/chunks/11.6361d9f816d0c120.js

js jansuraaj.org collected 2026-09-25 10:49:30 UTC 4,932 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[11],{38623:(e,t,a)=>{a.d(t,{A:()=>s});let s=(0,a(14294).A)("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]])},80011:(e,t,a)=>{a.r(t),a.d(t,{default:()=>d});var s=a(95155),r=a(12115),l=a(38623),i=a(26615),n=a(94979),o=a(30451);function d(){let{lang:e}=(0,o.o)(),[t,a]=(0,r.useState)(!1),[d,c]=(0,r.useState)(""),[x,b]=(0,r.useState)([]),[m,h]=(0,r.useState)(!1),u=()=>"undefined"!=typeof crypto&&"randomUUID"in crypto?crypto.randomUUID():"".concat(Date.now(),"-").concat(Math.random().toString(16).slice(2));(0,r.useEffect)(()=>{b([{id:"intro",role:"bot",text:"hi"===e?"नमस्ते! जन सुराज से जुड़े सवाल पूछिए, मैं उपलब्ध FAQ के आधार पर जवाब दूंगा।":"Hi! Ask a Jan Suraaj related question — I will answer using the available FAQs."}])},[e]);let f=e=>{b(t=>[...t,e])},g=async t=>{let a=(null!=t?t:d).trim();if(!a||m)return;let s=x.filter(e=>"user"===e.role||"bot"===e.role).slice(-6).map(e=>({role:"bot"===e.role?"assistant":"user",text:e.text}));b(e=>[...e,{id:u(),role:"user",text:a}]),c(""),h(!0);try{let t=await fetch("/api/chatbot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:a,history:s,lang:e})}),r=await t.json();f({id:u(),role:"bot",text:(null==r?void 0:r.answer)||("hi"===e?"माफ़ कीजिए, अभी जवाब नहीं मिल पाया।":"Sorry, I couldn't generate a response.")})}catch(t){f({id:u(),role:"bot",text:"hi"===e?"अभी तकनीकी समस्या है। कृपया थोड़ी देर बाद कोशिश करें।":"There was a technical issue. Please try again later."})}finally{h(!1)}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{className:"fixed bottom-6 right-6 z-40 flex h-12 w-12 items-center justify-center rounded-full bg-amber-300 text-black shadow-lg transition hover:bg-amber-300",onClick:()=>a(!0),"aria-label":"Open chat",children:(0,s.jsx)(l.A,{className:"h-5 w-5"})}),t&&(0,s.jsx)("div",{className:"fixed inset-0 z-50 bg-black/40 backdrop-blur-[2px]",children:(0,s.jsxs)("div",{className:"fixed bottom-0 right-0 w-full max-w-md 
1sm:bottom-6 sm:right-6 sm:rounded-2xl sm:border border-amber-200/20 bg-white shadow-2xl overflow-hidden",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between bg-gradient-to-r from-amber-300 to-amber-300 px-4 py-3 text-black",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"h-8 w-8 rounded-full bg-black/10 flex items-center justify-center",children:(0,s.jsx)(l.A,{className:"h-4 w-4"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-sm font-semibold",children:"hi"===e?"जन सुराज चैट":"Jan Suraaj Chat"}),(0,s.jsx)("p",{className:"text-[11px] text-black/70",children:"hi"===e?"FAQ आधारित सहायता":"FAQ based assistance"})]})]}),(0,s.jsx)("button",{className:"rounded-full p-1 hover:bg-black/10",onClick:()=>a(!1),"aria-label":"Close chat",children:(0,s.jsx)(i.A,{className:"h-4 w-4"})})]}),(0,s.jsxs)("div",{className:"max-h-[60vh] overflow-y-auto px-4 py-4 space-y-3 bg-[#fff7e6]",children:[x.map(e=>(0,s.jsx)("div",{className:"flex ".concat("user"===e.role?"justify-end":"justify-start"),children:(0,s.jsxs)("div",{className:"max-w-[80%] rounded-2xl px-3 py-2 text-sm leading-relaxed ".concat("user"===e.role?"bg-amber-300 text-black":"bg-white text-gray-800 border border-amber-200/60"),children:[(0,s.jsx)("p",{children:e.text}),e.suggestions&&e.suggestions.length>0&&(0,s.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:e.suggestions.map(e=>(0,s.jsx)("button",{className:"rounded-full border border-amber-200 bg-amber-50 px-3 py-1 text-[11px] text-amber-800 hover:bg-amber-100",onClick:()=>g(e),children:e},e))})]})},e.id)),m&&(0,s.jsx)("div",{className:"flex justify-start",children:(0,s.jsx)("div",{className:"max-w-[80%] rounded-2xl px-3 py-2 text-sm leading-relaxed bg-white text-gray-800 border border-amber-200/60",children:"hi"===e?"लिख रहे हैं...":"Typing..."})})]}),(0,s.jsx)("div",{className:"border-t border-amber-100 bg-white p-3",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("input",{value:d,onChange:e=>c(e.target.value),onKeyDown:e=>{"Enter"===e.key&&g()},className:"flex-1 rounded-full border border-amber-200 px-4 py-2 text-sm outline-none focus:ring-2 focus:ring-amber-300",placeholder:"hi"===e?"अपना सवाल लिखें...":"Type your question..."}),(0,s.jsx)("button",{className:"inline-flex h-10 w-10 items-center justify-center rounded-full bg-amber-300 text-black hover:bg-amber-300",onClick:()=>g(),"aria-label":"Send",children:(0,s.jsx)(n.A,{className:"h-4 w-4"})})]})})]})})]})}}}]);

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.