(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[185],{23028:function(e,t,s){Promise.resolve().then(s.t.bind(s,72853,23)),Promise.resolve().then(s.bind(s,42480)),Promise.resolve().then(s.t.bind(s,32933,23)),Promise.resolve().then(s.bind(s,84520)),Promise.resolve().then(s.bind(s,87700))},43164:function(e,t,s){"use strict";s.d(t,{h:function(){return ButtonGroup},o:function(){return CustomButton}});var n=s(57437),o=s(2265);let CustomButton=e=>{let{onClick:t,type:s,className:a,title:l,languageBtn:i,isLargeBtn:r,isSmallBtn:d,iconBtn:c,roundedIconBtn:u,icon:h,children:m,blockBtn:x,btnWithLink:v,link:f,iconSize:b,isLeftIcon:p,isOutlineBtn:g,isGhostBtn:y,btnType:j,redBtn:w,yellowBtn:C,secondaryBtn:N,darkBtn:S,iconClass:k,disabled:I,isPill:B,isBadge:_,isReactIcon:L,whiteBtn:z,successBtn:E}=e;return(0,n.jsxs)("button",{type:s,disabled:I||!1,onClick:t,className:(y&&c&&m||c&&m&&L?" flex items-center ":"")+(r?"px-8 py-3 text-lg ":d?"px-2 py-2 text-sm ":"px-5 py-2 text-base ")+(u&&r?" rounded-full w-9 h-9 !px-0 !py-0 ":u&&d?" rounded-full w-5 h-5 !px-0 !py-0 ":u?" rounded-full w-7 h-7 !px-0 !py-0 ":" rounded ")+(B&&" rounded-full py-1 ")+(_?" leading-none ":" font-heading ")+(i&&"relative bg-transparent px-0 text-xs text-primary-900 z-0 transition ease-in-out leading-none focus:font-bold hover:bg-transparent active:font-bold before:hidden before:content-[''] before:bg-yellow-600 before:w-4/5 before:h-4/5 before:absolute before:-left-1 before:top-1 before:-z-1 hover:before:block active:before:block focus:before:block ")+(g?" border border-solid !bg-transparent ".concat(w||"redBtn"===j?" text-red-800 hover:text-red-900 border-red-800 hover:border-red-900 ":C||"yellowBtn"===j?" text-yellow-700 hover:text-yellow-600 border-yellow-700 hover:border-yellow-600 ":N||"secondaryBtn"===j?" text-linen border-linen hover:text-deep-earthy-brown hover:border-deep-earthy-brown ":E||"successBtn"===j?" text-teal-800 hover:text-teal-900 border-teal-800 hover:border-teal-900 ":S||"darkBtn"===j?" text-deep-earthy-brown hover:text-black border-deep-earthy-brown hover:border-black ":z||"whiteBtn"===j?" text-linen hover:text-white border-linen hover:border-white ":" border-primary-900 text-primary-900 hover:text-primary-800 hover:border-primary-800 "):y?" border-0 !bg-none bg-transparent !p-0 ".concat(w||"redBtn"===j?" text-red-800 hover:text-red-900 ":C||"yellowBtn"===j?" text-yellow-800 hover:text-yellow-600 ":N||"secondaryBtn"===j?" text-linen hover:text-deep-earthy-brown ":E||"successBtn"===j?" text-teal-800 hover:text-teal-900 ":S||"darkBtn"===j?" text-deep-earthy-brown hover:text-black ":z||"whiteBtn"===j?" text-linen hover:text-white ":" !bg-none text-primary-900 hover:text-underline "):w||"redBtn"===j?" from-red-700 to-red-800 bg-gradient-to-tr text-white hover:from-red-800 hover:to-red-900":C||"yellowBtn"===j?" from-yellow-500 to-yellow-600 text-white hover:from-yellow-600 hover:to-yellow-700 bg-gradient-to-tr ":N||"secondaryBtn"===j?" bg-linen text-deep-earthy-brown hover:bg-khadi ":E||"successBtn"===j?" from-teal-700 to-teal-800 bg-gradient-to-tr text-white hover:from-teal-800 hover:to-teal-900 ":S||"darkBtn"===j?" bg-deep-earthy-brown text-white hover:bg-black ":z||"whiteBtn"===j?" bg-white border-solid border border-deep-earthy-brown text-deep-earthy-brown hover:border-black hover:shadow ":" bg-primary-900 text-white hover:bg-primary-800 ")+(x?" w-full block ":" ")+" transition ease-in-out font-medium leading-none ".concat(a||""," \n ").concat(I&&"opacity-70 !cursor-not-allowed"," "),title:l||"",children:[p&&(u||c)&&(0,n.jsx)(n.Fragment,{children:o.createElement(h,{className:"mr-2 ".concat(k||" w-6 h-6 "),size:"".concat(b)})}),m,!p&&(u||c)&&(0,n.jsx)(n.Fragment,{children:o.createElement(h,{className:"ml-2 ".concat(k||" w-6 h-6 "),size:"".concat(b)})})]})},ButtonGroup=e=>{let{className:t,children:s,withGap:o,gap:a}=e;return(0,n.jsx)("div",{className:"flex\n ".concat(o&&a?" gap-".concat(a," "):o&&!a?" gap-1 ":o?"":" buttonGroup ","\n ").concat(t||""," "),children:s})}},4741:function(e,t,s){"use strict";s.r(t),s.d(t,{CustomImage:function(){return CustomImage}});var n=s(57437),o=s(2265),a=s(16691),l=s.n(a);let CustomImage=e=>{let{alt:t,title:s,src:a,className:i,style:r,height:d,width:c,layout:u,objectFit:h,fill:m,fallBackUrl:x}=e,[v,f]=(0,o.useState)(a);return(0,o.useEffect)(()=>{f(a)},[a]),(0,n.jsx)(l(),{className:"border-0 ".concat(i||""),src:v,alt:t,width:c,height:d,title:s,style:r||{},layout:u,fill:m,onError:()=>{f("/images/placeholder.png")},objectFit:h})}},31782:function(e,t,s){"use strict";var n=s(57437),o=s(2265),a=s(43164),l=s(58910),i=s(11064),r=s(91133);t.Z=e=>{let{children:t,isOpen:s,handleCloseModal:d,onCancel:c=()=>{},onSubmit:u,title:h,icon:m,footerButtons:x,showCloseIcon:v,handleTopCloseIcon:f,hideSubmitBtn:b,hideCancelBtn:p,iconClass:g,submitBtnText:y,cancelBtnText:j,submitBtnType:w,cancelBtnType:C,submitBtnVariant:N,disableSubmitBtn:S,disableCancelBtn:k}=e,[I,B]=(0,o.useState)(!1),handleClose=()=>{var e,t;null===(t=document)||void 0===t||null===(e=t.body)||void 0===e||e.classList.remove("overflow-hidden"),d()};return(0,r.Z)(s),(0,n.jsx)(n.Fragment,{children:(0,n.jsx)("div",{className:" h-screen w-screen bg-black/20 fixed top-0 left-0 z-[50] ".concat(s?"opacity-100 ":"opacity-0 hidden"," transform transition-all ease-in-out "),children:(0,n.jsx)("div",{className:" flex flex-col items-center justify-center h-full",children:(0,n.jsxs)("div",{className:" relative bg-white rounded-lg shadow w-[90%] md:w-auto md:max-w-[60%] lg:min-w-[30%] max-h-[80vh] ",onClick:e=>e.stopPropagation(),children:[(h||v)&&(0,n.jsx)("div",{className:"absolute top-0 w-full",children:(0,n.jsxs)("div",{className:"px-6 py-4 bg-gray-50 flex flex-1 rounded-t-lg ".concat(h?"items-center justify-between":"items-center justify-end"," "),children:[h&&(0,n.jsx)("h2",{className:" font-heading font-semibold",children:h}),v&&(0,n.jsx)(l.FU5,{size:20,className:"cursor-pointer",onClick:f})]})}),(0,n.jsxs)("div",{className:"h-full overflow-y-auto",children:[(0,n.jsxs)("div",{className:"p-6 mt-6 text-center",children:[m?o.createElement(m,{className:"mx-auto w-10 h-10 mb-3 ".concat(g||" text-cyan-800 ")}):null,(0,n.jsx)("h3",{className:" font-normal text-gray-800 ",children:t})]}),(!p||!b)&&(0,n.jsx)("div",{className:"bg-gray-100 border-0 p-4 flex justify-center rounded-b-lg",children:x||(0,n.jsxs)(a.h,{withGap:!0,gap:"2",className:(b||p?" justify-center":" justify-between")+" w-full",children:[!p&&(0,n.jsx)(a.o,{disabled:k,whiteBtn:!0,type:C||"button",className:b?"flex-none":"flex-1",onClick:()=>{handleClose(),c()},children:j||"No"}),!b&&(0,n.jsxs)(a.o,{disabled:S,onClick:()=>{u()},type:w||"button",btnType:N,className:p?"flex-none":"flex-1",darkBtn:!0,children:[y||"Yes",I&&(0,n.jsx)(i.Z,{})]})]})})]})]})})})})}},42480:function(e,t,s){"use strict";s.r(t),s.d(t,{Layout:function(){return Layout},default:function(){return S},siteTitle:function(){return N}});var n=s(57437),o=s(2265),a=s(43164),Layout_Footer=()=>(0,n.jsx)("footer",{className:"block w-full absolute bottom-0 relative before:absolute before:left-0 before:bg-transparent before:bottom-[100px] before:h-[100px] before:w-[50px] before:rounded-tl-3xl before:shadow-[0_0_0px_-50px_rgba(0,0,0,0.3)] before:shadow--primary-900 ",children:(0,n.jsxs)("div",{className:"mt-2 px-5 text-white text-xs text-center pb-3",children:[(0,n.jsxs)("span",{className:"block mb-1 text-xs text-gray-500 leading-none",children:["v-","1.0.56"]}),(0,n.jsxs)("span",{className:"block mb-1 text-xs text-gray-500 leading-none",children:["Copyright \xa9 ",new Date().getFullYear()," ",(0,n.jsx)("a",{href:"".concat("https://aistore.myscheme.in"),className:"text-gray-500 hover:underline py-1",children:"GovAI"})]})]})}),l=s(36820),i=s(78311),r=s(4741),d=s(24026),c=s(24033),u=s(74769);let Logo=e=>{let{big:t,withBorder:s,className:o,isWhiteLogo:a,appName:l,customLogo:h}=e;(0,c.usePathname)();let{state:m}=(0,d.j_)();return t?(0,n.jsxs)(i.kC,{isFlexOnResponsive:!0,className:(0,u.m6)("!justify-start items-end mb-6 w-full h-full !gap-2",o),children:[(0,n.jsx)("div",{className:"flex-none relative h-[2rem] max-w-[100px]",children:h?(0,n.jsx)(r.CustomImage,{src:h,alt:"MyScheme Chat",title:"MyScheme Chat",fill:!0,objectFit:"contain"}):(0,n.jsx)(r.CustomImage,{src:a?"/images/logo-white.svg":"/images/logo.svg",alt:"MyScheme Chat",title:"MyScheme Chat",objectFit:"contain",fill:!0})}),(0,n.jsx)("div",{className:"flex-none ",children:(0,n.jsx)("p",{className:"bg-secondary-200 text-sm text-secondary-medium px-2 py-1 font-medium font-heading leading-tight rounded",children:l||"Chat"})})]}):(0,n.jsxs)("div",{className:"flex whitespace-nowrap mt-1 gap-2 ".concat("items-center"," ").concat(s&&" border-0 md:border-b border-solid border-linen "),children:[(0,n.jsx)(n.Fragment,{children:h?(0,n.jsx)("div",{className:" relative overflow-hidden flex items-center justify-center",children:(0,n.jsx)(r.CustomImage,{src:h,className:" mx-auto my-auto object-contain max-h-[32px] max-w-[100px]",alt:"GovAI Chat",title:"GovAI Chat",width:128,height:32})}):(0,n.jsx)("div",{className:"relative overflow-hidden flex items-center justify-center ",children:(0,n.jsx)(r.CustomImage,{src:a?"/images/logo-white.svg":"/images/logo.svg",className:"mx-auto my-auto object-contain max-h-[32px] max-w-[100px]",alt:"GovAI Chat",title:"GovAI Chat",objectFit:"contain",width:128,height:32})})}),(0,n.jsxs)("div",{className:"flex flex-row justify-start items-start gap-1 line-clamp-1",children:[(0,n.jsx)("span",{className:"font-medium text-sm sm:text-base",children:l}),(0,n.jsx)("span",{className:"bg-secondary-200 text-xs text-secondary-medium px-1 py-1 font-medium font-heading rounded ",children:(null==m?void 0:m.assistant)?"Chat":"Store"})]})]})};var h=s(61396),m=s.n(h),x=s(58910),v=s(3498),f=s(87700),b=s(53159),p=s(88920),g=s(21421),chat_ChatHistoryList=e=>{var t;let{title:s,session:l}=e,[i,r]=(0,o.useState)(!1),[u,h]=(0,o.useState)(!1),[m,v]=(0,o.useState)(s),{actions:y}=(0,d.j_)({setSelectedChatSession:f.setSelectedChatSession,updateChatSession:f.updateChatSession}),{getChatSessionData:j,deleteChatSessionData:w,updateSessionTitle:C}=(0,g.Z)();(0,c.useRouter)();let{state:N}=(0,d.j_)(),handleDelete=async()=>{if(l&&N.assistant){var e;await w(null==l?void 0:l._id,null===(e=N.assistant)||void 0===e?void 0:e.domainId),r(!1)}},handleInputBlur=async()=>{u&&l&&(await C(null==l?void 0:l._id,m),h(!1))},handleOnClick=async()=>{if(l&&N.assistant){var e;await j(null==l?void 0:l._id,null===(e=N.assistant)||void 0===e?void 0:e.domainId)}};return(0,n.jsxs)("div",{className:"flex justify-between items-center px-2 md:px-5 hover:bg-gray-100 rounded-md py-2 ".concat(l._id===(null===(t=N.selectedChatSession)||void 0===t?void 0:t._id)?"bg-gray-100":""),children:[(0,n.jsx)("div",{className:"w-[90%]",children:u?(0,n.jsx)("input",{type:"text",value:m,onChange:e=>v(e.target.value),onBlur:handleInputBlur,onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),handleInputBlur())},autoFocus:!0,className:"px-2 py-1 text-sm"}):(0,n.jsx)("div",{title:m,className:"text-sm line-clamp-1 cursor-pointer",onClick:handleOnClick,children:m})}),(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)("button",{className:"menu-button",onClick:()=>{r(!i)},children:(0,n.jsx)(b.EAB,{})}),i&&(0,n.jsxs)("div",{className:"z-50 absolute right-0 mt-2 w-48 bg-gray-100 shadow-lg rounded px-2 py-2",children:[(0,n.jsx)(a.o,{isSmallBtn:!0,isGhostBtn:!0,isLeftIcon:!0,icon:p.vPQ,iconBtn:!0,className:"block w-full !py-2 hover:bg-gray-200",onClick:()=>{r(!1),h(!0)},children:"Rename"}),(0,n.jsx)(a.o,{isSmallBtn:!0,isGhostBtn:!0,isLeftIcon:!0,icon:x.ZkW,iconBtn:!0,className:"block w-full !py-2 hover:bg-gray-200",onClick:handleDelete,children:"Delete"})]})]})]})},y=s(36468);let MenuItem=e=>{let{icon:t,children:s,className:o=""}=e;return(0,n.jsxs)("div",{className:"flex fle-row items-center justify-start gap-2 hover:bg-gray-100 w-full px-2 md:px-5 rounded-md ".concat(o),children:[(0,n.jsx)("div",{className:"flex h-7 w-7 justify-center items-center rounded-full bg-black text-white",children:t}),s]})};var chat_ChatHistory=e=>{var t,s;let{state:o}=(0,d.j_)(),{actions:a}=(0,d.j_)({createChatSession:f.createChatSession}),l=(0,c.useRouter)(),{createNewChatSession:i}=(0,g.Z)();return(0,n.jsxs)("div",{className:"w-full",children:[(null==o?void 0:o.assistant)&&(null==o?void 0:o.savedChatSessions)&&(null==o?void 0:o.savedChatSessions.length)>0&&(0,n.jsx)(n.Fragment,{children:null==o?void 0:null===(t=o.savedChatSessions)||void 0===t?void 0:t.filter(e=>{var t;return e.domainId===(null==o?void 0:null===(t=o.assistant)||void 0===t?void 0:t.domainId)}).map((e,t)=>(0,n.jsx)(chat_ChatHistoryList,{title:null==e?void 0:e.title,session:e},t))}),(null==o?void 0:o.assistant)&&(null==o?void 0:null===(s=o.assistant)||void 0===s?void 0:s.saveHistory)&&(0,n.jsx)(MenuItem,{icon:(0,n.jsx)(y.xcL,{size:20}),className:"mt-4",children:(0,n.jsx)("span",{className:"text-sm cursor-pointer",onClick:()=>{var e,t,s,n,a;(null==o?void 0:null===(e=o.assistant)||void 0===e?void 0:e.domainId)&&((null==o?void 0:null===(t=o.assistant)||void 0===t?void 0:t.saveHistory)?(i({domainId:null==o?void 0:null===(s=o.assistant)||void 0===s?void 0:s.domainId}),l.push("/".concat(null==o?void 0:null===(n=o.assistant)||void 0===n?void 0:n.domainId))):l.push("/".concat(null==o?void 0:null===(a=o.assistant)||void 0===a?void 0:a.domainId)))},children:"New Conversation"})})]})};let Sidebar_MenuItem=e=>{let{icon:t,children:s}=e;return(0,n.jsxs)("div",{className:"flex fle-row items-center justify-start gap-2 hover:bg-gray-100 w-full px-2 md:px-5 rounded-md",children:[(0,n.jsx)("div",{className:"flex h-7 w-7 justify-center items-center rounded-full bg-black text-white",children:t}),s]})};function Sidebar(e){var t,s,o,i,r,c;let{handleNav:u,showNav:h,isMyScheme:f=!1}=e,{state:b}=(0,d.j_)(),{decodedToken:p,setShowLogoutConfirmation:g}=(0,v.aC)();return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("nav",{className:"left-0 border-r fixed overflow-x-hidden overflow-y-auto flex flex-col bg-gray-50 flex-nowrap items-center justify-start w-72 z-[14] h-screen transform transition duration-300 ease-in "+(h?" translate-x-0 ":" -translate-x-72 "),children:[(0,n.jsx)("div",{className:"hidden md:flex w-full rounded-br-3xl px-2 md:px-5 pt-1 md:pt-4 relative before:absolute before:left-0 before:bg-transparent before:-bottom-[100px] before:h-[100px] before:w-[50px] before:rounded-tl-3xl ",children:(0,n.jsx)(Logo,{customLogo:f?"/images/myScheme-logo.svg":(null==b?void 0:null===(t=b.provider)||void 0===t?void 0:t.logoIcon)||(null==b?void 0:null===(s=b.assistant)||void 0===s?void 0:s.logo)&&"".concat("https://cdngovai.myscheme.in/").concat(null==b?void 0:null===(o=b.assistant)||void 0===o?void 0:o.logo)})}),(0,n.jsxs)("div",{className:"h-full w-full z-30 flex-1 overflow-y-auto flex justify-between flex-col",children:[(0,n.jsxs)("div",{className:"flex flex-col",children:[(0,n.jsx)("div",{className:"md:w-full md:hidden block",children:(0,n.jsxs)("div",{className:"flex justify-between flex-1 rounded-br-3xl px-2 pt-4 relative before:absolute before:left-0 before:bg-transparent before:-bottom-[100px] before:h-[100px] before:w-[50px] before:rounded-tl-3xl ",children:[(0,n.jsx)(m(),{href:"/",onClick:u,children:(0,n.jsx)(Logo,{customLogo:f?"/images/myScheme-logo.svg":(null==b?void 0:null===(i=b.provider)||void 0===i?void 0:i.logoIcon)||(null==b?void 0:null===(r=b.assistant)||void 0===r?void 0:r.logo)&&"".concat("https://cdngovai.myscheme.in/").concat(null==b?void 0:null===(c=b.assistant)||void 0===c?void 0:c.logo)})}),(0,n.jsx)(a.o,{iconBtn:!0,isGhostBtn:!0,className:"!p-0",iconSize:"xl",icon:l.czh,whiteBtn:!0,iconClass:"text-right w-6 h-6 !ml-0 !text-gray-500",isReactIcon:!0,onClick:u})]})}),(0,n.jsxs)("div",{className:"flex flex-col items-start gap-4 mt-4",children:[(0,n.jsx)(Sidebar_MenuItem,{icon:(0,n.jsx)(x.JZ9,{size:15}),children:(0,n.jsx)(m(),{href:"/",className:"text-sm",onClick:u,children:"Explore Assistants"})}),(0,n.jsx)(chat_ChatHistory,{})]})]}),(0,n.jsx)("div",{className:"flex flex-col gap-4 mb-4",children:p&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(Sidebar_MenuItem,{icon:(0,n.jsx)(x.J8I,{size:15}),children:(0,n.jsx)("span",{className:"text-sm line-clamp-1",title:null==p?void 0:p.name,children:null==p?void 0:p.name})}),(0,n.jsx)(Sidebar_MenuItem,{icon:(0,n.jsx)(x.lE7,{size:15}),children:(0,n.jsx)("span",{className:"text-sm cursor-pointer",onClick:()=>g(!0),children:"Logout"})})]})})]}),(0,n.jsx)(Layout_Footer,{})]})})}var j=s(40311),w=s(19736),closeActionComponent=(e,t,s)=>{if(e)return window.addEventListener("mousedown",handleClick),()=>window.removeEventListener("mousedown",handleClick);function handleClick(e){s.current&&!s.current.contains(e.target)&&t(!1)}},C=s(31782);function Navbar(e){var t,s,r,u,h,m,b,p;let{bgColor:g,pageName:y,showNav:j,handleNav:N,isMyScheme:S=!1}=e;(0,c.useRouter)();let{login:k,loginStatus:I,logout:B,decodedToken:_,setShowLogoutConfirmation:L,showLogoutConfirmation:z}=(0,v.aC)(),[E,F]=(0,o.useState)(!1),{state:A}=(0,d.j_)(),{actions:P}=(0,d.j_)({createChatSession:f.createChatSession}),G=(0,c.useSearchParams)(),M=(0,o.useRef)(null);return(0,o.useEffect)(()=>{closeActionComponent(E,F,M)},[E,F,M]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(C.Z,{isOpen:z,iconClass:"text-red-600",icon:x.lE7,cancelBtnText:"Cancel",submitBtnText:"Logout",handleCloseModal:()=>L(!1),onSubmit:()=>{B(),L(!1)},children:(0,n.jsx)("p",{className:"",children:"Are you sure you want to sign out?"})}),(0,n.jsx)(i.kC,{isFlexOnResponsive:!0,className:"!justify-start bg-white !items-start w-full py-3 mb-2 ".concat((null==G?void 0:G.get("isEmbed"))?"px-2 ":"px-2 md:px-0"," sticky top-0 shadow-sm z-10"),children:(0,n.jsxs)("div",{className:"w-full md:max-w-3xl mx-auto flex flex-row justify-between",children:[(0,n.jsxs)(i.JX,{className:"flex justify-start items-center",children:[!(null==G?void 0:G.get("isEmbed"))&&(0,n.jsx)(a.o,{iconBtn:!0,isGhostBtn:!0,iconSize:"xl",className:"md:hidden flex-none text-left mr-1 ",icon:l.HjU,iconClass:"text-right w-6 h-6 !m-0",isReactIcon:!0,onClick:N}),j?(0,n.jsx)("div",{className:"",children:(0,n.jsx)(w.Z,{customLogo:S?"/images/myscheme-favicon.png":(null==A?void 0:null===(t=A.provider)||void 0===t?void 0:t.logoIcon)||(null==A?void 0:null===(s=A.assistant)||void 0===s?void 0:s.icon)&&"".concat("https://cdngovai.myscheme.in/").concat(null==A?void 0:null===(r=A.assistant)||void 0===r?void 0:r.icon)})}):(0,n.jsx)("div",{className:"flex flex-1 md:flex-none",children:(0,n.jsx)(Logo,{customLogo:S?"/images/myScheme-logo.svg":(null==A?void 0:null===(u=A.provider)||void 0===u?void 0:u.logoIcon)||(null==A?void 0:null===(h=A.assistant)||void 0===h?void 0:h.logo)&&"".concat("https://cdngovai.myscheme.in/").concat(null==A?void 0:null===(m=A.assistant)||void 0===m?void 0:m.logo)})})]}),(0,n.jsx)(i.JX,{className:"flex",children:(0,n.jsxs)("div",{ref:M,className:"relative",children:[_?(0,n.jsx)("div",{className:"cursor-pointer h-8 w-8 mr-2 border-2 border-solid border-secondary-700 flex items-center justify-center rounded-full flex-shrink-0",onClick:()=>{F(e=>!e)},children:(0,n.jsx)("span",{className:"text-secondary-700",children:null==_?void 0:null===(p=_.name)||void 0===p?void 0:null===(b=p.charAt(0))||void 0===b?void 0:b.toUpperCase()})}):(0,n.jsx)(n.Fragment,{}),E&&(0,n.jsx)("div",{className:"z-50 absolute top-10 right-0 bg-white min-w-[150px] max-w-fit shadow-lg rounded-lg border border-solid border-gray-100 px-4 py-3",children:(0,n.jsxs)("div",{className:"flex flex-row items-center justify-start gap-2 hover:cursor-pointer hover:text-blue-700 text-gray-600",onClick:()=>{F(!1),L(!0)},children:[(0,n.jsx)(x.lE7,{}),(0,n.jsx)("span",{children:"Log Out"})]})})]})})]})})]})}let N="myScheme",Layout=e=>{let{children:t,pageName:s,breadCrumbRoutes:l,isMyScheme:i=!1}=e,[r,d]=(0,o.useState)(!1),[u,h]=(0,o.useState)({path:"dashboard",name:"Dashboard"}),[m,x]=(0,o.useState)(!1);(0,c.usePathname)();let handleNav=()=>{d(!r)},v=(0,c.useSearchParams)(),f=r?" after:bg-black md:after:bg-transparent after:opacity-50 after:absolute after:top-0 after:left-0 after:w-full after:h-full after:z-[12] md:after:-z-[12] z-30":null;return(0,n.jsxs)("div",{className:"".concat(f),children:[(0,n.jsx)(Sidebar,{showNav:r,setShowNav:d,handleNav:handleNav,selectedTab:u,setSelectedTab:h,isLoading:m,setIsLoading:x,isMyScheme:i}),(0,n.jsxs)("div",{className:"flex flex-col relative h-screen duration-300 animate-fadeIn transition-all ease-in-out "+(r?" m-0 md:ml-72 ":" m-0 "),children:[!(null==v?void 0:v.get("isEmbed"))&&(0,n.jsx)("div",{className:"hidden md:block fixed top-1/2 -translate-y-1/2 ".concat(r?" md:z-10 ":"z-10"),children:(0,n.jsx)(a.o,{iconBtn:!0,isGhostBtn:!0,iconSize:"xl",className:"!p-0",icon:r?j.Lrt:j.h2L,iconClass:"w-6 h-6 !m-0",isReactIcon:!0,onClick:handleNav,title:r?"Close Sidebar ":"Open Sidebar"})}),(0,n.jsx)(Navbar,{showNav:r,handleNav:handleNav,isMyScheme:i}),(0,n.jsx)("div",{className:"relative px-2 sm:px-4 flex-1 max-h-[95vh] md:max-h-[95vh]",children:(0,n.jsx)("main",{className:"w-full h-full",children:t})})]})]})};var S=Layout},84520:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return AuthProvider}});var n=s(57437),o=s(2265),a=s(3498),l=s(54829),i=s(24033),r=s(53771);function AuthProvider(e){let{children:t,refreshTime:s=1e4}=e,[d,c]=(0,o.useState)(null),[u,h]=(0,o.useState)(null),[m,x]=(0,o.useState)(null),[v,f]=(0,o.useState)("loading"),[b,p]=(0,o.useState)(!1),g=(0,i.useRouter)(),y=(0,i.usePathname)(),getUserData=async()=>{m||f("loading");try{var e,t,s;let n=await l.Z.get("".concat("https://api.myscheme.gov.in/accounts/v1","/users/profile"),{headers:{Authorization:"Bearer ".concat(d),"x-api-key":"tYTy5eEhlu9rFjyxuCr7ra7ACp4dv1RH8gWuHTDc"}});(null===(e=n.data)||void 0===e?void 0:e.statusCode)===200?x(n.data.data):((null===(t=n.data)||void 0===t?void 0:t.statusCode)===401||(null===(s=n.data)||void 0===s?void 0:s.statusCode)===403)&&(f("loggedOut"),x(null),logout())}catch(e){f("loggedOut"),x(null)}},getToken=async()=>{try{var e;let t=await l.Z.get("".concat("https://aistore.myscheme.in","/api/auth/digilocker/session"));if(null===(e=t.data)||void 0===e?void 0:e.token)return c(t.data.token),h((0,r.o)(t.data.token)),f("loggedIn"),t.data.token;return c(null),x(null),h(null),f("loggedOut"),null}catch(e){return h(null),f("loggedOut"),c(null),null}},logout=()=>{g.push("/api/auth/digilocker/signout")},login=async e=>{let t="https://aistore.myscheme.in"+y,s="".concat("https://aistore.myscheme.in").concat(e);g.replace("/api/auth/digilocker/signin?callback=".concat(e?s:t))};return(0,o.useEffect)(()=>{let initialize=async()=>{await getToken()};initialize()},[]),(0,o.useEffect)(()=>{d&&getUserData()},[d]),(0,o.useEffect)(()=>{d&&getToken()},[y,d]),(0,n.jsx)(a.Vo.Provider,{value:{token:d,getSession:getToken,decodedToken:u,user:m,setUser:x,loginStatus:v,setLoginStatus:f,logout:logout,login:login,showLogoutConfirmation:b,setShowLogoutConfirmation:p},children:t})}},87700:function(e,t,s){"use strict";s.r(t),s.d(t,{createChatSession:function(){return createChatSession},deleteChatSession:function(){return deleteChatSession},saveChatSessions:function(){return saveChatSessions},setSelectedChatSession:function(){return setSelectedChatSession},store:function(){return l},updateAssistant:function(){return updateAssistant},updateChatSession:function(){return updateChatSession},updateFeedback:function(){return updateFeedback},updateProvider:function(){return updateProvider}});var n=s(57437),o=s(24026),a=s(37350);let l={provider:null,assistant:null,savedChatSessions:null,selectedChatSession:null,feedbacks:null};(0,o.MT)(l);let updateFeedback=(e,t)=>{var s;let n=null===(s=e.feedbacks)||void 0===s?void 0:s.findIndex(e=>e.chatContentId===t.chatContentId);if(-1!==n&&void 0!==n)return{...e};{let s=e.feedbacks||[];return null==s||s.push(t),{...e,feedbacks:s}}},updateProvider=(e,t)=>({...e,provider:t}),updateAssistant=(e,t)=>({...e,assistant:t}),setSelectedChatSession=(e,t)=>({...e,selectedChatSession:t}),createChatSession=(e,t)=>{let s={domainId:t.domainId,_id:(null==t?void 0:t._id)||(0,a.x0)(),title:t.title||"Untitled",messages:t.messages||[]},n=null==e?void 0:e.savedChatSessions;return n?n.push(s):n=[s],{...e,savedChatSessions:n,selectedChatSession:s}},deleteChatSession=(e,t)=>{var s;return{...e,savedChatSessions:null==e?void 0:null===(s=e.savedChatSessions)||void 0===s?void 0:s.filter(e=>e._id!==t)}},updateChatSession=(e,t)=>{var s,n,o,a;let l=null===(s=e.savedChatSessions)||void 0===s?void 0:s.findIndex(e=>e._id===t.id);if(void 0!==l&&-1!==l&&e.savedChatSessions){let s=[...e.savedChatSessions],i={_id:t.id,domainId:null===(n=s[l])||void 0===n?void 0:n.domainId,title:(null==t?void 0:t.title)||(null===(o=s[l])||void 0===o?void 0:o.title),messages:t.messages||(null===(a=s[l])||void 0===a?void 0:a.messages)};return s[l]=i,{...e,savedChatSessions:s,selectedChatSession:i}}return{...e}},saveChatSessions=(e,t)=>({...e,savedChatSessions:t});t.default=e=>{let{children:t}=e;return(0,n.jsx)(o.hc,{children:t})}},72853:function(){}},function(e){e.O(0,[420,582,190,787,115,603,998,769,251,674,409,971,472,744],function(){return e(e.s=23028)}),_N_E=e.O()}]);