khoj 1.36.7.dev7__py3-none-any.whl → 1.36.7.dev18__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. khoj/database/adapters/__init__.py +15 -0
  2. khoj/interface/compiled/404/index.html +2 -2
  3. khoj/interface/compiled/_next/static/chunks/app/agents/{layout-64b81f8eeac13427.js → layout-4a0e32561d6b1e27.js} +1 -1
  4. khoj/interface/compiled/_next/static/chunks/app/agents/{page-2f55f9d0da49bf31.js → page-fbe2c1c661cd14ac.js} +1 -1
  5. khoj/interface/compiled/_next/static/chunks/app/automations/{page-d0a630a2b4ecc41d.js → page-ad620b194fd508fe.js} +1 -1
  6. khoj/interface/compiled/_next/static/chunks/app/chat/{page-53ba9f1424043383.js → page-24bf7a5c917dbaff.js} +1 -1
  7. khoj/interface/compiled/_next/static/chunks/app/{page-642bd02fc4f16606.js → page-528e96d17e520304.js} +1 -1
  8. khoj/interface/compiled/_next/static/chunks/app/search/{layout-ff081947c70ea9b7.js → layout-66f736b858b38c2c.js} +1 -1
  9. khoj/interface/compiled/_next/static/chunks/app/search/{page-7c80e369ee1cdfad.js → page-30e231665f1f3796.js} +1 -1
  10. khoj/interface/compiled/_next/static/chunks/app/settings/{page-c961681e308a334b.js → page-c580520d59d92267.js} +1 -1
  11. khoj/interface/compiled/_next/static/chunks/app/share/chat/{layout-94a33aa0eae034fc.js → layout-2ce0cb95b1219d97.js} +1 -1
  12. khoj/interface/compiled/_next/static/chunks/app/share/chat/{page-6253896a84300e9b.js → page-975934b12916f3d4.js} +1 -1
  13. khoj/interface/compiled/_next/static/chunks/{webpack-f813971dd4615afd.js → webpack-32b7cc428f0d015b.js} +1 -1
  14. khoj/interface/compiled/_next/static/css/017016e6eff88fdc.css +1 -0
  15. khoj/interface/compiled/_next/static/css/440ae0f0f650dc35.css +1 -0
  16. khoj/interface/compiled/_next/static/css/f29752d6e1be7624.css +1 -0
  17. khoj/interface/compiled/agents/index.html +2 -2
  18. khoj/interface/compiled/agents/index.txt +3 -3
  19. khoj/interface/compiled/automations/index.html +2 -2
  20. khoj/interface/compiled/automations/index.txt +3 -3
  21. khoj/interface/compiled/chat/index.html +2 -2
  22. khoj/interface/compiled/chat/index.txt +2 -2
  23. khoj/interface/compiled/index.html +2 -2
  24. khoj/interface/compiled/index.txt +2 -2
  25. khoj/interface/compiled/search/index.html +2 -2
  26. khoj/interface/compiled/search/index.txt +3 -3
  27. khoj/interface/compiled/settings/index.html +2 -2
  28. khoj/interface/compiled/settings/index.txt +5 -5
  29. khoj/interface/compiled/share/chat/index.html +2 -2
  30. khoj/interface/compiled/share/chat/index.txt +3 -3
  31. khoj/processor/conversation/google/gemini_chat.py +7 -7
  32. khoj/processor/conversation/prompts.py +100 -19
  33. khoj/processor/tools/run_code.py +163 -21
  34. khoj/utils/constants.py +2 -1
  35. khoj/utils/helpers.py +11 -2
  36. khoj/utils/initialization.py +24 -7
  37. {khoj-1.36.7.dev7.dist-info → khoj-1.36.7.dev18.dist-info}/METADATA +3 -2
  38. {khoj-1.36.7.dev7.dist-info → khoj-1.36.7.dev18.dist-info}/RECORD +49 -49
  39. khoj/interface/compiled/_next/static/css/55d4a822f8d94b67.css +0 -1
  40. khoj/interface/compiled/_next/static/css/804ceddd6c935d4a.css +0 -1
  41. khoj/interface/compiled/_next/static/css/b15666ef52060cd0.css +0 -1
  42. /khoj/interface/compiled/_next/static/{bzWTm19u6qe1y98Xfrqoo → SaAC14w_LNITF1YZanO67}/_buildManifest.js +0 -0
  43. /khoj/interface/compiled/_next/static/{bzWTm19u6qe1y98Xfrqoo → SaAC14w_LNITF1YZanO67}/_ssgManifest.js +0 -0
  44. /khoj/interface/compiled/_next/static/chunks/{1915-233ac8a122732d6b.js → 1915-4b7980a58fb630d6.js} +0 -0
  45. /khoj/interface/compiled/_next/static/chunks/{2117-ce1f0a4598f5e4fe.js → 2117-f99825f0a867a42d.js} +0 -0
  46. /khoj/interface/compiled/_next/static/chunks/{4363-9870bda67c2cf031.js → 4363-ac51bce40b6fc313.js} +0 -0
  47. /khoj/interface/compiled/_next/static/chunks/{4447-6e47461d1100c3cc.js → 4447-30959771ff58d99d.js} +0 -0
  48. /khoj/interface/compiled/_next/static/chunks/{8667-8136f74e9a086fca.js → 8667-adbe6017a66cef10.js} +0 -0
  49. /khoj/interface/compiled/_next/static/chunks/{9259-fa40e7cf2ca28e04.js → 9259-5be50737cfe989bc.js} +0 -0
  50. {khoj-1.36.7.dev7.dist-info → khoj-1.36.7.dev18.dist-info}/WHEEL +0 -0
  51. {khoj-1.36.7.dev7.dist-info → khoj-1.36.7.dev18.dist-info}/entry_points.txt +0 -0
  52. {khoj-1.36.7.dev7.dist-info → khoj-1.36.7.dev18.dist-info}/licenses/LICENSE +0 -0
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1929],{39929:function(e,s,t){Promise.resolve().then(t.bind(t,42780))},42780:function(e,s,t){"use strict";t.r(s),t.d(s,{default:function(){return eo}});var a=t(57437),n=t(63136),l=t.n(n),i=t(2265),o=t(74986),r=t(99376),d=t(14308),c=t(59199);t(2446);var u=t(7436),m=t(5477),h=t(56937),x=t(55287),f=t(60729),p=t(34124),g=t(6512),j=t(37104),v=t(62869),N=t(632),b=t(47615),y=t(96108),w=t(36360),_=t(60906),S=t(36720),C=t(61563),k=t(82123),O=t(76818),I=t(78299),M=t(38513),E=t(94508),T=t(23518),z=t(57054),B=t(16605);let R=B.fC,L=B.xz,F=i.forwardRef((e,s)=>{let{className:t,align:n="center",sideOffset:l=4,...i}=e;return(0,a.jsx)(B.VY,{ref:s,align:n,sideOffset:l,className:(0,E.cn)("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...i})});F.displayName=B.VY.displayName;var Z=t(93022);function P(e){var s;let{...t}=e,[n,l]=i.useState(!1),[o,r]=(0,i.useState)(void 0),[d,c]=(0,i.useState)(void 0),{data:m,error:x,isLoading:f}=(0,h.h2)(!0),[p,g]=(0,i.useState)([]),j=(0,u.IC)();return((0,i.useEffect)(()=>{if(!f&&m){if(g(m.chat_model_options),t.initialModel)c(m.chat_model_options.find(e=>e.name===t.initialModel));else{let e=m.chat_model_options.find(e=>e.id===m.selected_chat_model_config);if(e)c(e);else{c(m.chat_model_options[0]);return}}}},[m,t.initialModel,f]),(0,i.useEffect)(()=>{if(t.selectedModel&&d&&t.selectedModel!==d.name)c(p.find(e=>e.name===t.selectedModel));else if(null===t.selectedModel&&m){let e=m.chat_model_options.find(e=>e.id===m.selected_chat_model_config);if(e)t.onSelect(e,!1);else{t.onSelect(m.chat_model_options[0],!1);return}}},[t.selectedModel,p]),(0,i.useEffect)(()=>{if(d){let e=d.id!==(null==m?void 0:m.selected_chat_model_config);t.selectedModel!==d.name&&t.onSelect(d,e)}},[d]),f)?(0,a.jsx)(Z.O,{className:"w-full h-10"}):x?(0,a.jsx)("div",{className:"text-sm text-error",children:x.message}):(0,a.jsx)("div",{className:"grid gap-2 w-[250px]",children:(0,a.jsxs)(z.J2,{open:n,onOpenChange:l,...t,children:[(0,a.jsx)(z.xo,{asChild:!0,children:(0,a.jsxs)(v.z,{variant:"outline",role:"combobox","aria-expanded":n,"aria-label":"Select a model",className:"w-full justify-between text-left",disabled:null!==(s=t.disabled)&&void 0!==s&&s,children:[(0,a.jsx)("p",{className:"truncate",children:d?d.name.substring(0,20):"Select a model..."}),(0,a.jsx)(I.K,{className:"opacity-50"})]})}),(0,a.jsx)(z.yk,{align:"end",className:"w-[250px] p-0",children:j?(0,a.jsx)("div",{children:(0,a.jsx)(T.mY,{loop:!0,children:(0,a.jsxs)(T.e8,{className:"h-[var(--cmdk-list-height)]",children:[(0,a.jsx)(T.sZ,{placeholder:"Search Models..."}),(0,a.jsx)(T.rb,{children:"No Models found."}),(0,a.jsx)(T.fu,{heading:"Models",children:p&&p.length>0&&p.map(e=>(0,a.jsx)(W,{model:e,isSelected:(null==d?void 0:d.id)===e.id,onPeek:e=>r(e),onSelect:()=>{c(e),l(!1)}},e.id))},"models")]})})}):(0,a.jsxs)(R,{children:[(0,a.jsx)(F,{side:"left",align:"start",forceMount:!0,className:"min-h-[280px]",children:(0,a.jsxs)("div",{className:"grid gap-2",children:[(0,a.jsx)("h4",{className:"font-medium leading-none",children:null==o?void 0:o.name}),(0,a.jsx)("div",{className:"text-sm text-muted-foreground",children:null==o?void 0:o.description}),(null==o?void 0:o.strengths)?(0,a.jsxs)("div",{className:"mt-4 grid gap-2",children:[(0,a.jsx)("h5",{className:"text-sm font-medium leading-none",children:"Strengths"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:o.strengths})]}):null]})}),(0,a.jsxs)("div",{children:[(0,a.jsx)(L,{}),(0,a.jsx)(T.mY,{loop:!0,children:(0,a.jsxs)(T.e8,{className:"h-[var(--cmdk-list-height)]",children:[(0,a.jsx)(T.sZ,{placeholder:"Search Models..."}),(0,a.jsx)(T.rb,{children:"No Models found."}),(0,a.jsx)(T.fu,{heading:"Models",children:p&&p.length>0&&p.map(e=>(0,a.jsx)(W,{model:e,isSelected:(null==d?void 0:d.id)===e.id,onPeek:e=>r(e),onSelect:()=>{c(e),l(!1)}},e.id))},"models")]})})]})]})})]})})}function W(e){let{model:s,isSelected:t,onSelect:n,onPeek:l}=e,o=i.useRef(null);return(0,u.Iy)(o,e=>{e.forEach(e=>{var t;"attributes"===e.type&&"aria-selected"===e.attributeName&&(null===(t=o.current)||void 0===t?void 0:t.getAttribute("aria-selected"))==="true"&&l(s)})}),(0,a.jsxs)(T.di,{onSelect:n,ref:o,className:"data-[selected=true]:bg-muted data-[selected=true]:text-secondary-foreground",children:[s.name,(0,a.jsx)(M.J,{className:(0,E.cn)("ml-auto",t?"opacity-100":"opacity-0")})]},s.id)}var A=t(63861),D=t(69304),J=t(42225),K=t(26815),U=t(9270),V=t(30401);let G=i.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,a.jsx)(U.fC,{ref:s,className:(0,E.cn)("peer h-4 w-4 shrink-0 rounded-sm border border-secondary-foreground ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-gray-500 data-[state=checked]:text-primary-foreground",t),...n,children:(0,a.jsx)(U.z$,{className:(0,E.cn)("flex items-center justify-center text-current"),children:(0,a.jsx)(V.Z,{className:"h-4 w-4"})})})});G.displayName=U.fC.displayName;var H=t(81103),Q=t(61312),Y=t(26110),$=t(53647),q=t(84671),X=t(95186),ee=t(27648),es=t(40521);let et=e=>fetch(e).then(e=>e.json());function ea(e){let{...s}=e;return s.isMobileWidth?(0,a.jsx)(D.yo,{open:s.isOpen,onOpenChange:s.onOpenChange,children:(0,a.jsx)(D.ue,{className:"w-[300px] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",children:(0,a.jsx)(el,{...s})})}):(0,a.jsx)("div",{className:"relative",children:(0,a.jsx)(el,{...s})})}function en(e){let s=(0,J.BI)(),t=q.xF,[n,l]=(0,i.useState)(!1),[o,r]=(0,i.useState)(),[d,c]=(0,i.useState)(),[u,m]=(0,i.useState)(),[h,x]=(0,i.useState)(!1),[f,p]=(0,i.useState)(),[g,j]=(0,i.useState)(!1),[N,S]=(0,i.useState)();return(0,i.useEffect)(()=>{o&&d&&u?j(!0):j(!1)},[o,d,u]),(0,a.jsxs)(Y.Vq,{children:[(0,a.jsx)(Y.hg,{asChild:!0,children:(0,a.jsx)(v.z,{className:"w-full",variant:"secondary",children:"Create Agent"})}),(0,a.jsxs)(Y.cZ,{children:[(0,a.jsxs)(Y.fK,{children:[h&&f?(0,a.jsxs)(Y.$N,{children:["Created ",o]}):(0,a.jsx)(Y.$N,{children:"Create a New Agent"}),(0,a.jsx)(Y.GG,{}),(0,a.jsx)(Y.Be,{children:"If these settings have been helpful, create a dedicated agent you can re-use across conversations."})]}),(0,a.jsx)("div",{className:"py-4",children:h&&f?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center gap-4 py-8",children:[(0,a.jsx)(es.E.div,{initial:{scale:0},animate:{scale:1},transition:{type:"spring",stiffness:260,damping:20},children:(0,a.jsx)(b.f,{className:"w-16 h-16 text-green-500",weight:"fill"})}),(0,a.jsx)(es.E.p,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.2},className:"text-center text-lg font-medium text-accent-foreground",children:"Created successfully!"}),(0,a.jsx)(es.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.4},children:(0,a.jsx)(ee.default,{href:"/agents?agent=".concat(f),children:(0,a.jsx)(v.z,{variant:"secondary",className:"mt-2",children:"Manage Agent"})})})]}):(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(K._,{htmlFor:"agent_name",children:"Name"}),(0,a.jsx)(X.I,{id:"agent_name",className:"w-full p-2 border mt-4 border-slate-500 rounded-lg",disabled:n,value:o,onChange:e=>r(e.target.value)})]}),(0,a.jsxs)("div",{className:"flex gap-4",children:[(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsxs)($.Ph,{onValueChange:m,defaultValue:u,children:[(0,a.jsx)($.i4,{className:"w-full dark:bg-muted",disabled:n,children:(0,a.jsx)($.ki,{placeholder:"Color"})}),(0,a.jsx)($.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:t.map(e=>(0,a.jsx)($.Ql,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(y.C,{className:"w-6 h-6 mr-2 ".concat((0,q.oz)(e)),weight:"fill"}),e]})},e))})]})}),(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsxs)($.Ph,{onValueChange:c,defaultValue:d,children:[(0,a.jsx)($.i4,{className:"w-full dark:bg-muted",disabled:n,children:(0,a.jsx)($.ki,{placeholder:"Icon"})}),(0,a.jsx)($.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:s.map(e=>(0,a.jsx)($.Ql,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,J.TI)(e,null!=u?u:"gray","w-6","h-6"),e]})},e))})]})})]})]})}),(0,a.jsxs)(Y.cN,{children:[N&&(0,a.jsx)("div",{className:"text-red-500 text-sm",children:N}),!h&&(0,a.jsxs)(v.z,{type:"submit",onClick:()=>void(!n&&(l(!0),fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:o,icon:d,color:u,persona:e.customPrompt,chat_model:e.selectedModel,input_tools:e.inputTools,output_modes:e.outputModes,privacy_level:"private"})}).then(e=>e.json()).then(e=>{if(console.log("Success:",e),"detail"in e){S("Error creating agent: ".concat(e.detail)),l(!1);return}x(!0),p(e.slug),l(!1)}).catch(e=>{console.error("Error:",e),S("Error creating agent: ".concat(e)),l(!1)}))),disabled:n||!g,children:[n?(0,a.jsx)(w.U,{className:"animate-spin"}):(0,a.jsx)(_.R,{}),"Create"]}),(0,a.jsx)(Y.GG,{})]})]})]})}function el(e){var s,t,n,l;let{...o}=e,[r,d]=(0,i.useState)(!1),{data:c,error:u}=(0,A.ZP)("/api/agents/options",et),{data:m,isLoading:p,error:g}=(0,A.ZP)("/api/agents/conversation?conversation_id=".concat(o.conversationId),et),{data:j,error:N,isLoading:b}=(0,h.GW)(),[y,_]=(0,i.useState)(""),[I,M]=(0,i.useState)(),[E,T]=(0,i.useState)(),[B,R]=(0,i.useState)(),[L,F]=(0,i.useState)(!1),[Z,W]=(0,i.useState)((null==m?void 0:m.slug.toLowerCase())==="khoj"),[D,U]=(0,i.useState)(!1),V=null!==(s=null==j?void 0:j.is_active)&&void 0!==s&&s;function Y(){m&&(T(m.input_tools),(void 0===m.input_tools||0===m.input_tools.length)&&T((null==c?void 0:c.input_tools)?Object.keys(c.input_tools):[]),R(m.output_modes),(void 0===m.output_modes||0===m.output_modes.length)&&R((null==c?void 0:c.output_modes)?Object.keys(c.output_modes):[]),("khoj"===m.name.toLowerCase()||!0===m.is_hidden)&&d(!0),"khoj"===m.slug.toLowerCase()?(M(void 0),_(void 0),W(!0)):(W(!1),_(m.persona),M(m.chat_model)))}function $(e,s){return(F(!0),s.includes(e))?s.filter(s=>s!==e):[...s,e]}return(0,i.useEffect)(()=>{Y()},[m]),(0,a.jsxs)(f.DD,{collapsible:"none",className:"ml-auto opacity-30 rounded-lg p-2 transition-all transform duration-300 ease-in-out\n ".concat(o.isOpen?"translate-x-0 opacity-100 w-[300px] relative":"translate-x-full opacity-100 w-0 p-0 m-0","\n "),variant:"floating",children:[(0,a.jsxs)(f.TZ,{children:[(0,a.jsx)(f.$l,{children:m&&!r?(0,a.jsx)("div",{className:"flex items-center relative text-sm",children:(0,a.jsxs)("a",{className:"text-lg font-bold flex flex-row items-center",href:"/agents?agent=".concat(m.slug),children:[(0,J.TI)(m.icon,m.color),m.name]})}):(0,a.jsx)("div",{className:"flex items-center relative text-sm justify-between",children:(0,a.jsx)("p",{children:"Chat Options"})})}),(0,a.jsx)(f.Hz,{className:"border-b last:border-none",children:(0,a.jsx)(f.Ks,{className:"gap-0",children:(0,a.jsx)(f.w3,{className:"p-0 m-0",children:m&&m.has_files?(0,a.jsx)(f.LO,{className:"list-none",children:(0,a.jsxs)("div",{className:"flex items-center space-x-2 rounded-full",children:[(0,a.jsx)("div",{className:"text-muted-foreground",children:(0,a.jsx)(S.J,{})}),(0,a.jsx)("div",{className:"text-muted-foreground text-sm",children:"Using custom knowledge base"})]})},"agent_knowledge"):null})})},"knowledge"),(0,a.jsx)(f.Hz,{children:(0,a.jsxs)(f.Ks,{children:[(0,a.jsx)(f.nO,{children:"Instructions"}),(0,a.jsx)(f.w3,{className:"p-0 m-0",children:(0,a.jsx)(f.LO,{className:"list-none",children:(0,a.jsx)(O.g,{className:"w-full h-32 resize-none hover:resize-y",value:y,onChange:e=>{_(e.target.value),F(!0)},readOnly:!r,disabled:!r})})})]})},"instructions"),!p&&m&&(0,a.jsx)(f.Hz,{children:(0,a.jsxs)(f.Ks,{children:[(0,a.jsxs)(f.nO,{children:["Model",!V&&(0,a.jsx)("a",{href:"/settings",className:"hover:font-bold text-accent-foreground m-2 bg-accent bg-opacity-10 p-1 rounded-lg",children:"Upgrade"})]}),(0,a.jsx)(f.w3,{className:"p-0 m-0",children:(0,a.jsx)(f.LO,{className:"list-none",children:(0,a.jsx)(P,{disabled:!r||!V,onSelect:(e,s)=>(function(e){let s=!(arguments.length>1)||void 0===arguments[1]||arguments[1];M(e),s&&F(!0)})(e.name,s),initialModel:Z?void 0:null==m?void 0:m.chat_model,selectedModel:I})},"model")})]})},"model"),(0,a.jsx)(z.J2,{defaultOpen:!1,children:(0,a.jsxs)(f.Hz,{children:[(0,a.jsx)(f.nO,{asChild:!0,children:(0,a.jsxs)(z.xo,{children:["Tools",(0,a.jsx)(C._,{className:"ml-auto transition-transform group-data-[state=open]/collapsible:rotate-180"})]})}),(0,a.jsx)(z.yk,{children:(0,a.jsx)(f.Ks,{children:(0,a.jsxs)(f.w3,{className:"p-1 m-0",children:[Object.entries(null!==(t=null==c?void 0:c.input_tools)&&void 0!==t?t:{}).map(e=>{let[s,t]=e;return(0,a.jsx)(f.LO,{className:"list-none",children:(0,a.jsxs)(H.u,{children:[(0,a.jsx)(H.aJ,{asChild:!0,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2 py-1 justify-between",children:[(0,a.jsxs)(K._,{htmlFor:s,className:"flex items-center gap-2 text-accent-foreground p-1 cursor-pointer",children:[(0,J.vH)(s),(0,a.jsx)("p",{className:"text-sm my-auto flex items-center",children:s})]}),(0,a.jsx)(G,{id:s,className:"".concat(r?"cursor-pointer":""),checked:(null!=E?E:[]).includes(s),onCheckedChange:()=>T($(s,null!=E?E:[])),disabled:!r,children:s})]})},s),(0,a.jsx)(Q._v,{sideOffset:5,side:"left",align:"start",className:"text-sm bg-background text-foreground shadow-sm border border-slate-500 border-opacity-20 p-2 rounded-lg",children:t})]})},s)}),Object.entries(null!==(n=null==c?void 0:c.output_modes)&&void 0!==n?n:{}).map(e=>{let[s,t]=e;return(0,a.jsx)(f.LO,{className:"list-none",children:(0,a.jsxs)(H.u,{children:[(0,a.jsx)(H.aJ,{asChild:!0,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2 py-1 justify-between",children:[(0,a.jsxs)(K._,{htmlFor:s,className:"flex items-center gap-2 p-1 rounded-lg cursor-pointer",children:[(0,J.vH)(s),(0,a.jsx)("p",{className:"text-sm my-auto flex items-center",children:s})]}),(0,a.jsx)(G,{id:s,className:"".concat(r?"cursor-pointer":""),checked:(null!=B?B:[]).includes(s),onCheckedChange:()=>R($(s,null!=B?B:[])),disabled:!r,children:s})]})},s),(0,a.jsx)(Q._v,{sideOffset:5,side:"left",align:"start",className:"text-sm bg-background text-foreground shadow-sm border border-slate-500 border-opacity-20 p-2 rounded-lg",children:t})]})},s)})]})})})]})}),(0,a.jsx)(f.Hz,{children:(0,a.jsxs)(f.Ks,{children:[(0,a.jsx)(f.nO,{children:"Files"}),(0,a.jsx)(f.w3,{className:"p-0 m-0",children:(0,a.jsx)(f.LO,{className:"list-none",children:(0,a.jsx)(x.J_,{conversationId:o.conversationId,uploadedFiles:[],isMobileWidth:null!==(l=o.isMobileWidth)&&void 0!==l&&l})},"files-conversation")})]})},"files")]}),o.isOpen&&(0,a.jsx)(f.ZW,{children:(0,a.jsx)(f.w3,{className:"p-0 m-0",children:m&&!r&&m.is_creator?(0,a.jsx)(f.LO,{children:(0,a.jsx)(f.bb,{asChild:!0,children:(0,a.jsx)(v.z,{className:"w-full",variant:"ghost",onClick:()=>window.location.href="/agents?agent=".concat(null==m?void 0:m.slug),children:"Manage"})})}):(0,a.jsxs)(a.Fragment,{children:[!L&&r&&y&&!Z&&I&&(0,a.jsx)(f.LO,{children:(0,a.jsx)(f.bb,{asChild:!0,children:(0,a.jsx)(en,{customPrompt:y,selectedModel:I,inputTools:null!=E?E:[],outputModes:null!=B?B:[]})})}),(0,a.jsx)(f.LO,{children:(0,a.jsx)(f.bb,{asChild:!0,children:(0,a.jsx)(v.z,{className:"w-full",onClick:()=>void(Y(),F(!1)),variant:"ghost",disabled:!r||!L,children:"Reset"})})}),(0,a.jsx)(f.LO,{children:(0,a.jsx)(f.bb,{asChild:!0,children:(0,a.jsxs)(v.z,{className:"w-full ".concat(L?"bg-accent-foreground text-accent":""),variant:"secondary",onClick:()=>(function(){if(L){if(!Z&&(null==m?void 0:m.is_hidden)===!1){alert("This agent is not a hidden agent. It cannot be modified from this interface.");return}let e="PATCH";Z&&(e="POST");let s={persona:y,chat_model:I,input_tools:E,output_modes:B,...Z?{}:{slug:null==m?void 0:m.slug}};U(!0),fetch(Z?"/api/agents/hidden?conversation_id=".concat(o.conversationId):"/api/agents/hidden",{method:e,headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}).then(e=>{U(!1),e.json()}).then(e=>{(0,A.JG)("/api/agents/conversation?conversation_id=".concat(o.conversationId)),F(!1)}).catch(e=>{console.error("Error:",e),U(!1)})}})(),disabled:!r||!L||D,children:[D?(0,a.jsx)(w.U,{className:"animate-spin"}):(0,a.jsx)(k.Z,{}),D?"Saving":"Save"]})})})]})})},"actions")]})}function ei(e){let s=(0,r.useSearchParams)().get("conversationId"),[t,n]=(0,i.useState)(""),[d,c]=(0,i.useState)([]),[u,h]=(0,i.useState)(!1),[x,f]=(0,i.useState)(null),[p,g]=(0,i.useState)(!1),j=(0,i.useRef)(null),v=e.setQueryToProcess,N=e.onConversationIdChange,b=e.isMobileWidth?"w-full":"w-4/6";if((0,i.useEffect)(()=>{if(d.length>0){let s=d.map(e=>encodeURIComponent(e));e.setImages(s)}},[d,e.setImages]),(0,i.useEffect)(()=>{let s=localStorage.getItem("images");if(s){let t=JSON.parse(s);c(t);let a=t.map(e=>encodeURIComponent(e));e.setImages(a),localStorage.removeItem("images")}let t=localStorage.getItem("message");t&&(h(!0),v(t),t.trim().startsWith("/research")&&g(!0));let a=localStorage.getItem("uploadedFiles");if(a){let s=a?JSON.parse(a):[],t=[];for(let e of s)t.push({name:e.name,file_type:e.file_type,content:e.content,size:e.size});localStorage.removeItem("uploadedFiles"),e.setUploadedFiles(t)}},[v,e.setImages,s]),(0,i.useEffect)(()=>{t&&(h(!0),v(t))},[t,v]),(0,i.useEffect)(()=>{s&&(null==N||N(s))},[s,N]),(0,i.useEffect)(()=>{e.streamedMessages&&e.streamedMessages.length>0&&e.streamedMessages[e.streamedMessages.length-1].completed?(h(!1),c([]),e.setUploadedFiles(void 0)):n("")},[e.streamedMessages]),!s){window.location.href="/";return}return(0,a.jsxs)("div",{className:"flex flex-row h-full w-full",children:[(0,a.jsxs)("div",{className:"flex flex-col h-full w-full",children:[(0,a.jsx)("div",{className:l().chatBodyFull,children:(0,a.jsx)(o.Z,{conversationId:s,setTitle:e.setTitle,setAgent:f,pendingMessage:u?t:"",incomingMessages:e.streamedMessages,setIncomingMessages:e.setStreamedMessages,customClassName:b,setIsChatSideBarOpen:e.setIsChatSideBarOpen})}),(0,a.jsx)("div",{className:"".concat(l().inputBox," p-1 md:px-2 shadow-md bg-background align-middle items-center justify-center dark:bg-neutral-700 dark:border-0 dark:shadow-sm rounded-2xl md:rounded-xl h-fit ").concat(b," mr-auto ml-auto mt-auto"),children:(0,a.jsx)(m.a,{agentColor:null==x?void 0:x.color,isLoggedIn:e.isLoggedIn,sendMessage:e=>n(e),sendImage:e=>c(s=>[...s,e]),sendDisabled:u,chatOptionsData:e.chatOptionsData,conversationId:s,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,ref:j,isResearchModeEnabled:p,setTriggeredAbort:e.setTriggeredAbort})})]}),(0,a.jsx)(ea,{conversationId:s,isOpen:e.isChatSideBarOpen,onOpenChange:e.setIsChatSideBarOpen,isMobileWidth:e.isMobileWidth})]})}function eo(){let e="Khoj AI - Chat",[s,t]=(0,i.useState)(null),[n,o]=(0,i.useState)(!0),[r,m]=(0,i.useState)(e),[b,y]=(0,i.useState)(null),[w,_]=(0,i.useState)([]),[S,C]=(0,i.useState)(""),[k,O]=(0,i.useState)(!1),[I,M]=(0,i.useState)(void 0),[E,T]=(0,i.useState)([]),[z,B]=(0,i.useState)(null),[R,L]=(0,i.useState)(!1),{locationData:F,locationDataError:Z,locationDataLoading:P}=(0,u.k6)()||{locationData:{timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}},{data:W,error:A,isLoading:D}=(0,h.GW)(),J=(0,u.IC)(),[K,U]=(0,i.useState)(!1);async function V(e){if(!e.ok)throw Error(e.statusText);if(!e.body)throw Error("Response body is null");let s=e.body.getReader(),t=new TextDecoder,a="␃\uD83D\uDD1A␗",n="",l=[],i={},o={};for(;;){let e;let{done:r,value:d}=await s.read();if(r){C(""),O(!1),T([]),b&&(0,c.tQ)(b,m);break}for(n+=t.decode(d,{stream:!0});-1!==(e=n.indexOf(a));){let s=n.slice(0,e);if(n=n.slice(e+a.length),s){let e=w.find(e=>!e.completed);if(!e){console.error("No current message found");return}({context:l,onlineContext:i,codeContext:o}=(0,c.VK)(s,e,l,i,o)),_([...w])}}}}async function G(){if(localStorage.removeItem("message"),!S||!b)return;let e={q:S,conversation_id:b,stream:!0,...F&&{city:F.city,region:F.region,country:F.country,country_code:F.countryCode,timezone:F.timezone},...E.length>0&&{images:E},...I&&{files:I}},s=await fetch("/api/chat?client=web",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:null==z?void 0:z.signal});try{await V(s)}catch(l){let e;try{e=await s.json()}catch(s){e={streamError:"Error reading API error response stream. Expected JSON response."}}console.error(e);let t=w.find(e=>!e.completed);if(!t)return;let a=l.message,n=l.name;a.includes("Error in input stream")?t.rawResponse="Woops! The connection broke while I was writing my thoughts down. Maybe try again in a bit or dislike this message if the issue persists?":e.streamError?t.rawResponse="Umm, not sure what just happened but I lost my train of thought. Could you try again or ask my developers to look into this if the issue persists? They can be contacted at the Khoj Github, Discord or team@khoj.dev.":429===s.status?"detail"in e?t.rawResponse="".concat(e.detail):t.rawResponse="I'm a bit overwhelmed at the moment. Could you try again in a bit or dislike this message if the issue persists?":"AbortError"===n?t.rawResponse="I've stopped processing this message. If you'd like to continue, please send the message again.":t.rawResponse="Umm, not sure what just happened. I see this error message: ".concat(a,". Could you try again or dislike this message if the issue persists?"),t.completed=!0,_([...w]),C(""),O(!1)}}return(0,i.useEffect)(()=>{fetch("/api/chat/options").then(e=>e.json()).then(e=>{o(!1),e&&t(e)}).catch(e=>{console.error(e)}),(0,u.EK)()},[]),(0,i.useEffect)(()=>{R&&(null==z||z.abort(),function(){let e=w.find(e=>!e.completed);e&&(e.completed=!0,_([...w]),C(""),O(!1))}(),L(!1))}),(0,i.useEffect)(()=>{if(S){let e={rawResponse:"",trainOfThought:[],context:[],onlineContext:{},codeContext:{},completed:!1,timestamp:new Date().toISOString(),rawQuery:S||"",images:E,queryFiles:I};_(s=>[...s,e]),O(!0),B(new AbortController)}},[S]),(0,i.useEffect)(()=>{k&&!P&&G()},[k,P]),n?(0,a.jsx)(d.Z,{}):(0,a.jsxs)(f.Hn,{children:[(0,a.jsx)(p.S,{conversationId:b||""}),(0,a.jsxs)(f.kV,{children:[(0,a.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,a.jsx)(f.vP,{className:"-ml-1"}),(0,a.jsx)(g.Z,{orientation:"vertical",className:"mr-2 h-4"}),b&&(0,a.jsx)("div",{className:"".concat(l().chatTitleWrapper," text-nowrap text-ellipsis overflow-hidden max-w-screen-md grid items-top font-bold mx-2 md:mr-8 col-auto h-fit"),children:J?(0,a.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,a.jsx)(j.VO,{className:"h-auto w-16"})}):r&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h2",{className:"text-lg text-ellipsis whitespace-nowrap overflow-x-hidden mr-4",children:r}),(0,a.jsx)(x.En,{conversationId:b,setTitle:m,sizing:"md"})]})}),(0,a.jsx)("div",{className:"flex justify-end items-start gap-2 text-sm ml-auto",children:(0,a.jsx)(v.z,{variant:"ghost",size:"icon",className:"h-12 w-12 data-[state=open]:bg-accent",onClick:()=>U(!K),children:(0,a.jsx)(N.T,{className:"w-6 h-6"})})})]}),(0,a.jsxs)("div",{className:"".concat(l().main," ").concat(l().chatLayout),children:[(0,a.jsx)("title",{children:"".concat(e).concat(r&&r!==e?": ".concat(r):"")}),(0,a.jsx)("div",{className:l().chatBox,children:(0,a.jsx)("div",{className:l().chatBoxBody,children:(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(d.Z,{}),children:(0,a.jsx)(ei,{isLoggedIn:!!W,streamedMessages:w,setStreamedMessages:_,chatOptionsData:s,setTitle:m,setQueryToProcess:C,setUploadedFiles:M,isMobileWidth:J,onConversationIdChange:e=>{y(e)},setImages:T,setTriggeredAbort:L,isChatSideBarOpen:K,setIsChatSideBarOpen:U})})})})]})]})]})}},26815:function(e,s,t){"use strict";t.d(s,{_:function(){return d}});var a=t(57437),n=t(2265),l=t(6394),i=t(90535),o=t(94508);let r=(0,i.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,a.jsx)(l.f,{ref:s,className:(0,o.cn)(r(),t),...n})});d.displayName=l.f.displayName},53647:function(e,s,t){"use strict";t.d(s,{Bw:function(){return f},Ph:function(){return c},Ql:function(){return p},i4:function(){return m},ki:function(){return u}});var a=t(57437),n=t(2265),l=t(56873),i=t(40875),o=t(22135),r=t(30401),d=t(94508);let c=l.fC;l.ZA;let u=l.B4,m=n.forwardRef((e,s)=>{let{className:t,children:n,...o}=e;return(0,a.jsxs)(l.xz,{ref:s,className:(0,d.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...o,children:[n,(0,a.jsx)(l.JO,{asChild:!0,children:(0,a.jsx)(i.Z,{className:"h-4 w-4 opacity-50"})})]})});m.displayName=l.xz.displayName;let h=n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,a.jsx)(l.u_,{ref:s,className:(0,d.cn)("flex cursor-default items-center justify-center py-1",t),...n,children:(0,a.jsx)(o.Z,{className:"h-4 w-4"})})});h.displayName=l.u_.displayName;let x=n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,a.jsx)(l.$G,{ref:s,className:(0,d.cn)("flex cursor-default items-center justify-center py-1",t),...n,children:(0,a.jsx)(i.Z,{className:"h-4 w-4"})})});x.displayName=l.$G.displayName;let f=n.forwardRef((e,s)=>{let{className:t,children:n,position:i="popper",...o}=e;return(0,a.jsx)(l.h_,{children:(0,a.jsxs)(l.VY,{ref:s,className:(0,d.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===i&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:i,...o,children:[(0,a.jsx)(h,{}),(0,a.jsx)(l.l_,{className:(0,d.cn)("p-1","popper"===i&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),(0,a.jsx)(x,{})]})})});f.displayName=l.VY.displayName,n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,a.jsx)(l.__,{ref:s,className:(0,d.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...n})}).displayName=l.__.displayName;let p=n.forwardRef((e,s)=>{let{className:t,children:n,...i}=e;return(0,a.jsxs)(l.ck,{ref:s,className:(0,d.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...i,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(l.wU,{children:(0,a.jsx)(r.Z,{className:"h-4 w-4"})})}),(0,a.jsx)(l.eT,{children:n})]})});p.displayName=l.ck.displayName,n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,a.jsx)(l.Z0,{ref:s,className:(0,d.cn)("-mx-1 my-1 h-px bg-muted",t),...n})}).displayName=l.Z0.displayName},63136:function(e){e.exports={main:"chat_main__8xQu5",suggestions:"chat_suggestions__m8n2t",inputBox:"chat_inputBox__LOFws",chatBodyFull:"chat_chatBodyFull__FfKEK",chatBody:"chat_chatBody__sS1LX",chatLayout:"chat_chatLayout__pR203",chatBox:"chat_chatBox__FBct_",titleBar:"chat_titleBar__R5QlK",chatBoxBody:"chat_chatBoxBody__qT_SC",agentIndicator:"chat_agentIndicator__8V55w",chatTitleWrapper:"chat_chatTitleWrapper__6ChWq"}}},function(e){e.O(0,[8255,1607,3954,1919,3861,9259,8667,4363,4447,4357,8155,9334,2327,5477,4986,2971,2117,1744],function(){return e(e.s=39929)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1929],{39929:function(e,s,t){Promise.resolve().then(t.bind(t,42780))},42780:function(e,s,t){"use strict";t.r(s),t.d(s,{default:function(){return eo}});var a=t(57437),n=t(63136),l=t.n(n),i=t(2265),o=t(74986),r=t(99376),d=t(14308),c=t(59199);t(2446);var u=t(7436),m=t(5477),h=t(56937),x=t(55287),f=t(60729),p=t(34124),g=t(6512),j=t(37104),v=t(62869),N=t(632),b=t(47615),y=t(96108),w=t(36360),_=t(60906),S=t(36720),C=t(61563),k=t(82123),O=t(76818),I=t(78299),M=t(38513),E=t(94508),T=t(23518),z=t(57054),B=t(16605);let R=B.fC,L=B.xz,F=i.forwardRef((e,s)=>{let{className:t,align:n="center",sideOffset:l=4,...i}=e;return(0,a.jsx)(B.VY,{ref:s,align:n,sideOffset:l,className:(0,E.cn)("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...i})});F.displayName=B.VY.displayName;var Z=t(93022);function P(e){var s;let{...t}=e,[n,l]=i.useState(!1),[o,r]=(0,i.useState)(void 0),[d,c]=(0,i.useState)(void 0),{data:m,error:x,isLoading:f}=(0,h.h2)(!0),[p,g]=(0,i.useState)([]),j=(0,u.IC)();return((0,i.useEffect)(()=>{if(!f&&m){if(g(m.chat_model_options),t.initialModel)c(m.chat_model_options.find(e=>e.name===t.initialModel));else{let e=m.chat_model_options.find(e=>e.id===m.selected_chat_model_config);if(e)c(e);else{c(m.chat_model_options[0]);return}}}},[m,t.initialModel,f]),(0,i.useEffect)(()=>{if(t.selectedModel&&d&&t.selectedModel!==d.name)c(p.find(e=>e.name===t.selectedModel));else if(null===t.selectedModel&&m){let e=m.chat_model_options.find(e=>e.id===m.selected_chat_model_config);if(e)t.onSelect(e,!1);else{t.onSelect(m.chat_model_options[0],!1);return}}},[t.selectedModel,p]),(0,i.useEffect)(()=>{if(d){let e=d.id!==(null==m?void 0:m.selected_chat_model_config);t.selectedModel!==d.name&&t.onSelect(d,e)}},[d]),f)?(0,a.jsx)(Z.O,{className:"w-full h-10"}):x?(0,a.jsx)("div",{className:"text-sm text-error",children:x.message}):(0,a.jsx)("div",{className:"grid gap-2 w-[250px]",children:(0,a.jsxs)(z.J2,{open:n,onOpenChange:l,...t,children:[(0,a.jsx)(z.xo,{asChild:!0,children:(0,a.jsxs)(v.z,{variant:"outline",role:"combobox","aria-expanded":n,"aria-label":"Select a model",className:"w-full justify-between text-left",disabled:null!==(s=t.disabled)&&void 0!==s&&s,children:[(0,a.jsx)("p",{className:"truncate",children:d?d.name.substring(0,20):"Select a model..."}),(0,a.jsx)(I.K,{className:"opacity-50"})]})}),(0,a.jsx)(z.yk,{align:"end",className:"w-[250px] p-0",children:j?(0,a.jsx)("div",{children:(0,a.jsx)(T.mY,{loop:!0,children:(0,a.jsxs)(T.e8,{className:"h-[var(--cmdk-list-height)]",children:[(0,a.jsx)(T.sZ,{placeholder:"Search Models..."}),(0,a.jsx)(T.rb,{children:"No Models found."}),(0,a.jsx)(T.fu,{heading:"Models",children:p&&p.length>0&&p.map(e=>(0,a.jsx)(W,{model:e,isSelected:(null==d?void 0:d.id)===e.id,onPeek:e=>r(e),onSelect:()=>{c(e),l(!1)}},e.id))},"models")]})})}):(0,a.jsxs)(R,{children:[(0,a.jsx)(F,{side:"left",align:"start",forceMount:!0,className:"min-h-[280px]",children:(0,a.jsxs)("div",{className:"grid gap-2",children:[(0,a.jsx)("h4",{className:"font-medium leading-none",children:null==o?void 0:o.name}),(0,a.jsx)("div",{className:"text-sm text-muted-foreground",children:null==o?void 0:o.description}),(null==o?void 0:o.strengths)?(0,a.jsxs)("div",{className:"mt-4 grid gap-2",children:[(0,a.jsx)("h5",{className:"text-sm font-medium leading-none",children:"Strengths"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:o.strengths})]}):null]})}),(0,a.jsxs)("div",{children:[(0,a.jsx)(L,{}),(0,a.jsx)(T.mY,{loop:!0,children:(0,a.jsxs)(T.e8,{className:"h-[var(--cmdk-list-height)]",children:[(0,a.jsx)(T.sZ,{placeholder:"Search Models..."}),(0,a.jsx)(T.rb,{children:"No Models found."}),(0,a.jsx)(T.fu,{heading:"Models",children:p&&p.length>0&&p.map(e=>(0,a.jsx)(W,{model:e,isSelected:(null==d?void 0:d.id)===e.id,onPeek:e=>r(e),onSelect:()=>{c(e),l(!1)}},e.id))},"models")]})})]})]})})]})})}function W(e){let{model:s,isSelected:t,onSelect:n,onPeek:l}=e,o=i.useRef(null);return(0,u.Iy)(o,e=>{e.forEach(e=>{var t;"attributes"===e.type&&"aria-selected"===e.attributeName&&(null===(t=o.current)||void 0===t?void 0:t.getAttribute("aria-selected"))==="true"&&l(s)})}),(0,a.jsxs)(T.di,{onSelect:n,ref:o,className:"data-[selected=true]:bg-muted data-[selected=true]:text-secondary-foreground",children:[s.name,(0,a.jsx)(M.J,{className:(0,E.cn)("ml-auto",t?"opacity-100":"opacity-0")})]},s.id)}var A=t(63861),D=t(69304),J=t(42225),K=t(26815),U=t(9270),V=t(30401);let G=i.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,a.jsx)(U.fC,{ref:s,className:(0,E.cn)("peer h-4 w-4 shrink-0 rounded-sm border border-secondary-foreground ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-gray-500 data-[state=checked]:text-primary-foreground",t),...n,children:(0,a.jsx)(U.z$,{className:(0,E.cn)("flex items-center justify-center text-current"),children:(0,a.jsx)(V.Z,{className:"h-4 w-4"})})})});G.displayName=U.fC.displayName;var H=t(81103),Q=t(61312),Y=t(26110),$=t(53647),q=t(84671),X=t(95186),ee=t(27648),es=t(40521);let et=e=>fetch(e).then(e=>e.json());function ea(e){let{...s}=e;return s.isMobileWidth?(0,a.jsx)(D.yo,{open:s.isOpen,onOpenChange:s.onOpenChange,children:(0,a.jsx)(D.ue,{className:"w-[300px] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",children:(0,a.jsx)(el,{...s})})}):(0,a.jsx)("div",{className:"relative",children:(0,a.jsx)(el,{...s})})}function en(e){let s=(0,J.BI)(),t=q.xF,[n,l]=(0,i.useState)(!1),[o,r]=(0,i.useState)(),[d,c]=(0,i.useState)(),[u,m]=(0,i.useState)(),[h,x]=(0,i.useState)(!1),[f,p]=(0,i.useState)(),[g,j]=(0,i.useState)(!1),[N,S]=(0,i.useState)();return(0,i.useEffect)(()=>{o&&d&&u?j(!0):j(!1)},[o,d,u]),(0,a.jsxs)(Y.Vq,{children:[(0,a.jsx)(Y.hg,{asChild:!0,children:(0,a.jsx)(v.z,{className:"w-full",variant:"secondary",children:"Create Agent"})}),(0,a.jsxs)(Y.cZ,{children:[(0,a.jsxs)(Y.fK,{children:[h&&f?(0,a.jsxs)(Y.$N,{children:["Created ",o]}):(0,a.jsx)(Y.$N,{children:"Create a New Agent"}),(0,a.jsx)(Y.GG,{}),(0,a.jsx)(Y.Be,{children:"If these settings have been helpful, create a dedicated agent you can re-use across conversations."})]}),(0,a.jsx)("div",{className:"py-4",children:h&&f?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center gap-4 py-8",children:[(0,a.jsx)(es.E.div,{initial:{scale:0},animate:{scale:1},transition:{type:"spring",stiffness:260,damping:20},children:(0,a.jsx)(b.f,{className:"w-16 h-16 text-green-500",weight:"fill"})}),(0,a.jsx)(es.E.p,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.2},className:"text-center text-lg font-medium text-accent-foreground",children:"Created successfully!"}),(0,a.jsx)(es.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.4},children:(0,a.jsx)(ee.default,{href:"/agents?agent=".concat(f),children:(0,a.jsx)(v.z,{variant:"secondary",className:"mt-2",children:"Manage Agent"})})})]}):(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(K._,{htmlFor:"agent_name",children:"Name"}),(0,a.jsx)(X.I,{id:"agent_name",className:"w-full p-2 border mt-4 border-slate-500 rounded-lg",disabled:n,value:o,onChange:e=>r(e.target.value)})]}),(0,a.jsxs)("div",{className:"flex gap-4",children:[(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsxs)($.Ph,{onValueChange:m,defaultValue:u,children:[(0,a.jsx)($.i4,{className:"w-full dark:bg-muted",disabled:n,children:(0,a.jsx)($.ki,{placeholder:"Color"})}),(0,a.jsx)($.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:t.map(e=>(0,a.jsx)($.Ql,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(y.C,{className:"w-6 h-6 mr-2 ".concat((0,q.oz)(e)),weight:"fill"}),e]})},e))})]})}),(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsxs)($.Ph,{onValueChange:c,defaultValue:d,children:[(0,a.jsx)($.i4,{className:"w-full dark:bg-muted",disabled:n,children:(0,a.jsx)($.ki,{placeholder:"Icon"})}),(0,a.jsx)($.Bw,{className:"items-center space-y-1 inline-flex flex-col",children:s.map(e=>(0,a.jsx)($.Ql,{value:e,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,J.TI)(e,null!=u?u:"gray","w-6","h-6"),e]})},e))})]})})]})]})}),(0,a.jsxs)(Y.cN,{children:[N&&(0,a.jsx)("div",{className:"text-red-500 text-sm",children:N}),!h&&(0,a.jsxs)(v.z,{type:"submit",onClick:()=>void(!n&&(l(!0),fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:o,icon:d,color:u,persona:e.customPrompt,chat_model:e.selectedModel,input_tools:e.inputTools,output_modes:e.outputModes,privacy_level:"private"})}).then(e=>e.json()).then(e=>{if(console.log("Success:",e),"detail"in e){S("Error creating agent: ".concat(e.detail)),l(!1);return}x(!0),p(e.slug),l(!1)}).catch(e=>{console.error("Error:",e),S("Error creating agent: ".concat(e)),l(!1)}))),disabled:n||!g,children:[n?(0,a.jsx)(w.U,{className:"animate-spin"}):(0,a.jsx)(_.R,{}),"Create"]}),(0,a.jsx)(Y.GG,{})]})]})]})}function el(e){var s,t,n,l;let{...o}=e,[r,d]=(0,i.useState)(!1),{data:c,error:u}=(0,A.ZP)("/api/agents/options",et),{data:m,isLoading:p,error:g}=(0,A.ZP)("/api/agents/conversation?conversation_id=".concat(o.conversationId),et),{data:j,error:N,isLoading:b}=(0,h.GW)(),[y,_]=(0,i.useState)(""),[I,M]=(0,i.useState)(),[E,T]=(0,i.useState)(),[B,R]=(0,i.useState)(),[L,F]=(0,i.useState)(!1),[Z,W]=(0,i.useState)((null==m?void 0:m.slug.toLowerCase())==="khoj"),[D,U]=(0,i.useState)(!1),V=null!==(s=null==j?void 0:j.is_active)&&void 0!==s&&s;function Y(){m&&(T(m.input_tools),(void 0===m.input_tools||0===m.input_tools.length)&&T((null==c?void 0:c.input_tools)?Object.keys(c.input_tools):[]),R(m.output_modes),(void 0===m.output_modes||0===m.output_modes.length)&&R((null==c?void 0:c.output_modes)?Object.keys(c.output_modes):[]),("khoj"===m.name.toLowerCase()||!0===m.is_hidden)&&d(!0),"khoj"===m.slug.toLowerCase()?(M(void 0),_(void 0),W(!0)):(W(!1),_(m.persona),M(m.chat_model)))}function $(e,s){return(F(!0),s.includes(e))?s.filter(s=>s!==e):[...s,e]}return(0,i.useEffect)(()=>{Y()},[m]),(0,a.jsxs)(f.DD,{collapsible:"none",className:"ml-auto opacity-30 rounded-lg p-2 transition-all transform duration-300 ease-in-out\n ".concat(o.isOpen?"translate-x-0 opacity-100 w-[300px] relative":"translate-x-full opacity-100 w-0 p-0 m-0","\n "),variant:"floating",children:[(0,a.jsxs)(f.TZ,{children:[(0,a.jsx)(f.$l,{children:m&&!r?(0,a.jsx)("div",{className:"flex items-center relative text-sm",children:(0,a.jsxs)("a",{className:"text-lg font-bold flex flex-row items-center",href:"/agents?agent=".concat(m.slug),children:[(0,J.TI)(m.icon,m.color),m.name]})}):(0,a.jsx)("div",{className:"flex items-center relative text-sm justify-between",children:(0,a.jsx)("p",{children:"Chat Options"})})}),(0,a.jsx)(f.Hz,{className:"border-b last:border-none",children:(0,a.jsx)(f.Ks,{className:"gap-0",children:(0,a.jsx)(f.w3,{className:"p-0 m-0",children:m&&m.has_files?(0,a.jsx)(f.LO,{className:"list-none",children:(0,a.jsxs)("div",{className:"flex items-center space-x-2 rounded-full",children:[(0,a.jsx)("div",{className:"text-muted-foreground",children:(0,a.jsx)(S.J,{})}),(0,a.jsx)("div",{className:"text-muted-foreground text-sm",children:"Using custom knowledge base"})]})},"agent_knowledge"):null})})},"knowledge"),(0,a.jsx)(f.Hz,{children:(0,a.jsxs)(f.Ks,{children:[(0,a.jsx)(f.nO,{children:"Instructions"}),(0,a.jsx)(f.w3,{className:"p-0 m-0",children:(0,a.jsx)(f.LO,{className:"list-none",children:(0,a.jsx)(O.g,{className:"w-full h-32 resize-none hover:resize-y",value:y,onChange:e=>{_(e.target.value),F(!0)},readOnly:!r,disabled:!r})})})]})},"instructions"),!p&&m&&(0,a.jsx)(f.Hz,{children:(0,a.jsxs)(f.Ks,{children:[(0,a.jsxs)(f.nO,{children:["Model",!V&&(0,a.jsx)("a",{href:"/settings",className:"hover:font-bold text-accent-foreground m-2 bg-accent bg-opacity-10 p-1 rounded-lg",children:"Upgrade"})]}),(0,a.jsx)(f.w3,{className:"p-0 m-0",children:(0,a.jsx)(f.LO,{className:"list-none",children:(0,a.jsx)(P,{disabled:!r||!V,onSelect:(e,s)=>(function(e){let s=!(arguments.length>1)||void 0===arguments[1]||arguments[1];M(e),s&&F(!0)})(e.name,s),initialModel:Z?void 0:null==m?void 0:m.chat_model,selectedModel:I})},"model")})]})},"model"),(0,a.jsx)(z.J2,{defaultOpen:!1,children:(0,a.jsxs)(f.Hz,{children:[(0,a.jsx)(f.nO,{asChild:!0,children:(0,a.jsxs)(z.xo,{children:["Tools",(0,a.jsx)(C._,{className:"ml-auto transition-transform group-data-[state=open]/collapsible:rotate-180"})]})}),(0,a.jsx)(z.yk,{children:(0,a.jsx)(f.Ks,{children:(0,a.jsxs)(f.w3,{className:"p-1 m-0",children:[Object.entries(null!==(t=null==c?void 0:c.input_tools)&&void 0!==t?t:{}).map(e=>{let[s,t]=e;return(0,a.jsx)(f.LO,{className:"list-none",children:(0,a.jsxs)(H.u,{children:[(0,a.jsx)(H.aJ,{asChild:!0,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2 py-1 justify-between",children:[(0,a.jsxs)(K._,{htmlFor:s,className:"flex items-center gap-2 text-accent-foreground p-1 cursor-pointer",children:[(0,J.vH)(s),(0,a.jsx)("p",{className:"text-sm my-auto flex items-center",children:s})]}),(0,a.jsx)(G,{id:s,className:"".concat(r?"cursor-pointer":""),checked:(null!=E?E:[]).includes(s),onCheckedChange:()=>T($(s,null!=E?E:[])),disabled:!r,children:s})]})},s),(0,a.jsx)(Q._v,{sideOffset:5,side:"left",align:"start",className:"text-sm bg-background text-foreground shadow-sm border border-slate-500 border-opacity-20 p-2 rounded-lg",children:t})]})},s)}),Object.entries(null!==(n=null==c?void 0:c.output_modes)&&void 0!==n?n:{}).map(e=>{let[s,t]=e;return(0,a.jsx)(f.LO,{className:"list-none",children:(0,a.jsxs)(H.u,{children:[(0,a.jsx)(H.aJ,{asChild:!0,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2 py-1 justify-between",children:[(0,a.jsxs)(K._,{htmlFor:s,className:"flex items-center gap-2 p-1 rounded-lg cursor-pointer",children:[(0,J.vH)(s),(0,a.jsx)("p",{className:"text-sm my-auto flex items-center",children:s})]}),(0,a.jsx)(G,{id:s,className:"".concat(r?"cursor-pointer":""),checked:(null!=B?B:[]).includes(s),onCheckedChange:()=>R($(s,null!=B?B:[])),disabled:!r,children:s})]})},s),(0,a.jsx)(Q._v,{sideOffset:5,side:"left",align:"start",className:"text-sm bg-background text-foreground shadow-sm border border-slate-500 border-opacity-20 p-2 rounded-lg",children:t})]})},s)})]})})})]})}),(0,a.jsx)(f.Hz,{children:(0,a.jsxs)(f.Ks,{children:[(0,a.jsx)(f.nO,{children:"Files"}),(0,a.jsx)(f.w3,{className:"p-0 m-0",children:(0,a.jsx)(f.LO,{className:"list-none",children:(0,a.jsx)(x.J_,{conversationId:o.conversationId,uploadedFiles:[],isMobileWidth:null!==(l=o.isMobileWidth)&&void 0!==l&&l})},"files-conversation")})]})},"files")]}),o.isOpen&&(0,a.jsx)(f.ZW,{children:(0,a.jsx)(f.w3,{className:"p-0 m-0",children:m&&!r&&m.is_creator?(0,a.jsx)(f.LO,{children:(0,a.jsx)(f.bb,{asChild:!0,children:(0,a.jsx)(v.z,{className:"w-full",variant:"ghost",onClick:()=>window.location.href="/agents?agent=".concat(null==m?void 0:m.slug),children:"Manage"})})}):(0,a.jsxs)(a.Fragment,{children:[!L&&r&&y&&!Z&&I&&(0,a.jsx)(f.LO,{children:(0,a.jsx)(f.bb,{asChild:!0,children:(0,a.jsx)(en,{customPrompt:y,selectedModel:I,inputTools:null!=E?E:[],outputModes:null!=B?B:[]})})}),(0,a.jsx)(f.LO,{children:(0,a.jsx)(f.bb,{asChild:!0,children:(0,a.jsx)(v.z,{className:"w-full",onClick:()=>void(Y(),F(!1)),variant:"ghost",disabled:!r||!L,children:"Reset"})})}),(0,a.jsx)(f.LO,{children:(0,a.jsx)(f.bb,{asChild:!0,children:(0,a.jsxs)(v.z,{className:"w-full ".concat(L?"bg-accent-foreground text-accent":""),variant:"secondary",onClick:()=>(function(){if(L){if(!Z&&(null==m?void 0:m.is_hidden)===!1){alert("This agent is not a hidden agent. It cannot be modified from this interface.");return}let e="PATCH";Z&&(e="POST");let s={persona:y,chat_model:I,input_tools:E,output_modes:B,...Z?{}:{slug:null==m?void 0:m.slug}};U(!0),fetch(Z?"/api/agents/hidden?conversation_id=".concat(o.conversationId):"/api/agents/hidden",{method:e,headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}).then(e=>{U(!1),e.json()}).then(e=>{(0,A.JG)("/api/agents/conversation?conversation_id=".concat(o.conversationId)),F(!1)}).catch(e=>{console.error("Error:",e),U(!1)})}})(),disabled:!r||!L||D,children:[D?(0,a.jsx)(w.U,{className:"animate-spin"}):(0,a.jsx)(k.Z,{}),D?"Saving":"Save"]})})})]})})},"actions")]})}function ei(e){let s=(0,r.useSearchParams)().get("conversationId"),[t,n]=(0,i.useState)(""),[d,c]=(0,i.useState)([]),[u,h]=(0,i.useState)(!1),[x,f]=(0,i.useState)(null),[p,g]=(0,i.useState)(!1),j=(0,i.useRef)(null),v=e.setQueryToProcess,N=e.onConversationIdChange,b=e.isMobileWidth?"w-full":"w-4/6";if((0,i.useEffect)(()=>{if(d.length>0){let s=d.map(e=>encodeURIComponent(e));e.setImages(s)}},[d,e.setImages]),(0,i.useEffect)(()=>{let s=localStorage.getItem("images");if(s){let t=JSON.parse(s);c(t);let a=t.map(e=>encodeURIComponent(e));e.setImages(a),localStorage.removeItem("images")}let t=localStorage.getItem("message");t&&(h(!0),v(t),t.trim().startsWith("/research")&&g(!0));let a=localStorage.getItem("uploadedFiles");if(a){let s=a?JSON.parse(a):[],t=[];for(let e of s)t.push({name:e.name,file_type:e.file_type,content:e.content,size:e.size});localStorage.removeItem("uploadedFiles"),e.setUploadedFiles(t)}},[v,e.setImages,s]),(0,i.useEffect)(()=>{t&&(h(!0),v(t))},[t,v]),(0,i.useEffect)(()=>{s&&(null==N||N(s))},[s,N]),(0,i.useEffect)(()=>{e.streamedMessages&&e.streamedMessages.length>0&&e.streamedMessages[e.streamedMessages.length-1].completed?(h(!1),c([]),e.setUploadedFiles(void 0)):n("")},[e.streamedMessages]),!s){window.location.href="/";return}return(0,a.jsxs)("div",{className:"flex flex-row h-full w-full",children:[(0,a.jsxs)("div",{className:"flex flex-col h-full w-full",children:[(0,a.jsx)("div",{className:l().chatBodyFull,children:(0,a.jsx)(o.Z,{conversationId:s,setTitle:e.setTitle,setAgent:f,pendingMessage:u?t:"",incomingMessages:e.streamedMessages,setIncomingMessages:e.setStreamedMessages,customClassName:b,setIsChatSideBarOpen:e.setIsChatSideBarOpen})}),(0,a.jsx)("div",{className:"".concat(l().inputBox," p-1 md:px-2 shadow-md bg-background align-middle items-center justify-center dark:bg-neutral-700 dark:border-0 dark:shadow-sm rounded-2xl md:rounded-xl h-fit ").concat(b," mr-auto ml-auto mt-auto"),children:(0,a.jsx)(m.a,{agentColor:null==x?void 0:x.color,isLoggedIn:e.isLoggedIn,sendMessage:e=>n(e),sendImage:e=>c(s=>[...s,e]),sendDisabled:u,chatOptionsData:e.chatOptionsData,conversationId:s,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,ref:j,isResearchModeEnabled:p,setTriggeredAbort:e.setTriggeredAbort})})]}),(0,a.jsx)(ea,{conversationId:s,isOpen:e.isChatSideBarOpen,onOpenChange:e.setIsChatSideBarOpen,isMobileWidth:e.isMobileWidth})]})}function eo(){let e="Khoj AI - Chat",[s,t]=(0,i.useState)(null),[n,o]=(0,i.useState)(!0),[r,m]=(0,i.useState)(e),[b,y]=(0,i.useState)(null),[w,_]=(0,i.useState)([]),[S,C]=(0,i.useState)(""),[k,O]=(0,i.useState)(!1),[I,M]=(0,i.useState)(void 0),[E,T]=(0,i.useState)([]),[z,B]=(0,i.useState)(null),[R,L]=(0,i.useState)(!1),{locationData:F,locationDataError:Z,locationDataLoading:P}=(0,u.k6)()||{locationData:{timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}},{data:W,error:A,isLoading:D}=(0,h.GW)(),J=(0,u.IC)(),[K,U]=(0,i.useState)(!1);async function V(e){if(!e.ok)throw Error(e.statusText);if(!e.body)throw Error("Response body is null");let s=e.body.getReader(),t=new TextDecoder,a="␃\uD83D\uDD1A␗",n="",l=[],i={},o={};for(;;){let e;let{done:r,value:d}=await s.read();if(r){C(""),O(!1),T([]),b&&(0,c.tQ)(b,m);break}for(n+=t.decode(d,{stream:!0});-1!==(e=n.indexOf(a));){let s=n.slice(0,e);if(n=n.slice(e+a.length),s){let e=w.find(e=>!e.completed);if(!e){console.error("No current message found");return}({context:l,onlineContext:i,codeContext:o}=(0,c.VK)(s,e,l,i,o)),_([...w])}}}}async function G(){if(localStorage.removeItem("message"),!S||!b)return;let e={q:S,conversation_id:b,stream:!0,...F&&{city:F.city,region:F.region,country:F.country,country_code:F.countryCode,timezone:F.timezone},...E.length>0&&{images:E},...I&&{files:I}},s=await fetch("/api/chat?client=web",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:null==z?void 0:z.signal});try{await V(s)}catch(l){let e;try{e=await s.json()}catch(s){e={streamError:"Error reading API error response stream. Expected JSON response."}}console.error(e);let t=w.find(e=>!e.completed);if(!t)return;let a=l.message,n=l.name;a.includes("Error in input stream")?t.rawResponse="Woops! The connection broke while I was writing my thoughts down. Maybe try again in a bit or dislike this message if the issue persists?":e.streamError?t.rawResponse="Umm, not sure what just happened but I lost my train of thought. Could you try again or ask my developers to look into this if the issue persists? They can be contacted at the Khoj Github, Discord or team@khoj.dev.":429===s.status?"detail"in e?t.rawResponse="".concat(e.detail):t.rawResponse="I'm a bit overwhelmed at the moment. Could you try again in a bit or dislike this message if the issue persists?":"AbortError"===n?t.rawResponse="I've stopped processing this message. If you'd like to continue, please send the message again.":t.rawResponse="Umm, not sure what just happened. I see this error message: ".concat(a,". Could you try again or dislike this message if the issue persists?"),t.completed=!0,_([...w]),C(""),O(!1)}}return(0,i.useEffect)(()=>{fetch("/api/chat/options").then(e=>e.json()).then(e=>{o(!1),e&&t(e)}).catch(e=>{console.error(e)}),(0,u.EK)()},[]),(0,i.useEffect)(()=>{R&&(null==z||z.abort(),function(){let e=w.find(e=>!e.completed);e&&(e.completed=!0,_([...w]),C(""),O(!1))}(),L(!1))}),(0,i.useEffect)(()=>{if(S){let e={rawResponse:"",trainOfThought:[],context:[],onlineContext:{},codeContext:{},completed:!1,timestamp:new Date().toISOString(),rawQuery:S||"",images:E,queryFiles:I};_(s=>[...s,e]),O(!0),B(new AbortController)}},[S]),(0,i.useEffect)(()=>{k&&!P&&G()},[k,P]),n?(0,a.jsx)(d.Z,{}):(0,a.jsxs)(f.Hn,{children:[(0,a.jsx)(p.S,{conversationId:b||""}),(0,a.jsxs)(f.kV,{children:[(0,a.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,a.jsx)(f.vP,{className:"-ml-1"}),(0,a.jsx)(g.Z,{orientation:"vertical",className:"mr-2 h-4"}),b&&(0,a.jsx)("div",{className:"".concat(l().chatTitleWrapper," text-nowrap text-ellipsis overflow-hidden max-w-screen-md grid items-top font-bold mx-2 md:mr-8 col-auto h-fit"),children:J?(0,a.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,a.jsx)(j.VO,{className:"h-auto w-16"})}):r&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h2",{className:"text-lg text-ellipsis whitespace-nowrap overflow-x-hidden mr-4",children:r}),(0,a.jsx)(x.En,{conversationId:b,setTitle:m,sizing:"md"})]})}),(0,a.jsx)("div",{className:"flex justify-end items-start gap-2 text-sm ml-auto",children:(0,a.jsx)(v.z,{variant:"ghost",size:"icon",className:"h-12 w-12 data-[state=open]:bg-accent",onClick:()=>U(!K),children:(0,a.jsx)(N.T,{className:"w-6 h-6"})})})]}),(0,a.jsxs)("div",{className:"".concat(l().main," ").concat(l().chatLayout),children:[(0,a.jsx)("title",{children:"".concat(e).concat(r&&r!==e?": ".concat(r):"")}),(0,a.jsx)("div",{className:l().chatBox,children:(0,a.jsx)("div",{className:l().chatBoxBody,children:(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(d.Z,{}),children:(0,a.jsx)(ei,{isLoggedIn:!!W,streamedMessages:w,setStreamedMessages:_,chatOptionsData:s,setTitle:m,setQueryToProcess:C,setUploadedFiles:M,isMobileWidth:J,onConversationIdChange:e=>{y(e)},setImages:T,setTriggeredAbort:L,isChatSideBarOpen:K,setIsChatSideBarOpen:U})})})})]})]})]})}},26815:function(e,s,t){"use strict";t.d(s,{_:function(){return d}});var a=t(57437),n=t(2265),l=t(6394),i=t(90535),o=t(94508);let r=(0,i.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,a.jsx)(l.f,{ref:s,className:(0,o.cn)(r(),t),...n})});d.displayName=l.f.displayName},53647:function(e,s,t){"use strict";t.d(s,{Bw:function(){return f},Ph:function(){return c},Ql:function(){return p},i4:function(){return m},ki:function(){return u}});var a=t(57437),n=t(2265),l=t(56873),i=t(40875),o=t(22135),r=t(30401),d=t(94508);let c=l.fC;l.ZA;let u=l.B4,m=n.forwardRef((e,s)=>{let{className:t,children:n,...o}=e;return(0,a.jsxs)(l.xz,{ref:s,className:(0,d.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...o,children:[n,(0,a.jsx)(l.JO,{asChild:!0,children:(0,a.jsx)(i.Z,{className:"h-4 w-4 opacity-50"})})]})});m.displayName=l.xz.displayName;let h=n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,a.jsx)(l.u_,{ref:s,className:(0,d.cn)("flex cursor-default items-center justify-center py-1",t),...n,children:(0,a.jsx)(o.Z,{className:"h-4 w-4"})})});h.displayName=l.u_.displayName;let x=n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,a.jsx)(l.$G,{ref:s,className:(0,d.cn)("flex cursor-default items-center justify-center py-1",t),...n,children:(0,a.jsx)(i.Z,{className:"h-4 w-4"})})});x.displayName=l.$G.displayName;let f=n.forwardRef((e,s)=>{let{className:t,children:n,position:i="popper",...o}=e;return(0,a.jsx)(l.h_,{children:(0,a.jsxs)(l.VY,{ref:s,className:(0,d.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===i&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:i,...o,children:[(0,a.jsx)(h,{}),(0,a.jsx)(l.l_,{className:(0,d.cn)("p-1","popper"===i&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),(0,a.jsx)(x,{})]})})});f.displayName=l.VY.displayName,n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,a.jsx)(l.__,{ref:s,className:(0,d.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...n})}).displayName=l.__.displayName;let p=n.forwardRef((e,s)=>{let{className:t,children:n,...i}=e;return(0,a.jsxs)(l.ck,{ref:s,className:(0,d.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...i,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(l.wU,{children:(0,a.jsx)(r.Z,{className:"h-4 w-4"})})}),(0,a.jsx)(l.eT,{children:n})]})});p.displayName=l.ck.displayName,n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,a.jsx)(l.Z0,{ref:s,className:(0,d.cn)("-mx-1 my-1 h-px bg-muted",t),...n})}).displayName=l.Z0.displayName},63136:function(e){e.exports={main:"chat_main__8xQu5",suggestions:"chat_suggestions__m8n2t",inputBox:"chat_inputBox__LOFws",chatBodyFull:"chat_chatBodyFull__FfKEK",chatBody:"chat_chatBody__sS1LX",chatLayout:"chat_chatLayout__pR203",chatBox:"chat_chatBox__FBct_",titleBar:"chat_titleBar__R5QlK",chatBoxBody:"chat_chatBoxBody__qT_SC",agentIndicator:"chat_agentIndicator__8V55w",chatTitleWrapper:"chat_chatTitleWrapper__6ChWq"}}},function(e){e.O(0,[9202,216,2663,3954,1919,3861,9259,8667,4363,4447,4357,8155,9334,2327,5477,4986,2971,2117,1744],function(){return e(e.s=39929)}),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1931],{1507:function(e,t,a){Promise.resolve().then(a.bind(a,88507))},88507:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return eE}});var n,o,i=a(57437);a(47960);var r=a(76777),l=a.n(r);a(2446);var s=a(2265),c=a(63861),p=a(49656);let d=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M168.49,191.51a12,12,0,0,1,0,17l-32,32a12,12,0,0,1-17,0l-32-32a12,12,0,0,1,17-17L116,203V53L104.49,64.49a12,12,0,1,1-17-17l32-32a12,12,0,0,1,17,0l32,32a12,12,0,0,1-17,17L140,53V203l11.51-11.52A12,12,0,0,1,168.49,191.51Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M160,56V200l-32,32L96,200V56l32-32Z",opacity:"0.2"}),s.createElement("path",{d:"M165.66,194.34a8,8,0,0,1,0,11.32l-32,32a8,8,0,0,1-11.32,0l-32-32a8,8,0,0,1,11.32-11.32L120,212.69V43.31L101.66,61.66A8,8,0,0,1,90.34,50.34l32-32a8,8,0,0,1,11.32,0l32,32a8,8,0,0,1-11.32,11.32L136,43.31V212.69l18.34-18.35A8,8,0,0,1,165.66,194.34Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M167.39,196.94a8,8,0,0,1-1.73,8.72l-32,32a8,8,0,0,1-11.32,0l-32-32A8,8,0,0,1,96,192h24V64H96a8,8,0,0,1-5.66-13.66l32-32a8,8,0,0,1,11.32,0l32,32A8,8,0,0,1,160,64H136V192h24A8,8,0,0,1,167.39,196.94Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M164.24,195.76a6,6,0,0,1,0,8.48l-32,32a6,6,0,0,1-8.48,0l-32-32a6,6,0,0,1,8.48-8.48L122,217.51v-179L100.24,60.24a6,6,0,0,1-8.48-8.48l32-32a6,6,0,0,1,8.48,0l32,32a6,6,0,1,1-8.48,8.48L134,38.49v179l21.76-21.75A6,6,0,0,1,164.24,195.76Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M165.66,194.34a8,8,0,0,1,0,11.32l-32,32a8,8,0,0,1-11.32,0l-32-32a8,8,0,0,1,11.32-11.32L120,212.69V43.31L101.66,61.66A8,8,0,0,1,90.34,50.34l32-32a8,8,0,0,1,11.32,0l32,32a8,8,0,0,1-11.32,11.32L136,43.31V212.69l18.34-18.35A8,8,0,0,1,165.66,194.34Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M162.83,197.17a4,4,0,0,1,0,5.66l-32,32a4,4,0,0,1-5.66,0l-32-32a4,4,0,0,1,5.66-5.66L124,222.34V33.66L98.83,58.83a4,4,0,0,1-5.66-5.66l32-32a4,4,0,0,1,5.66,0l32,32a4,4,0,0,1-5.66,5.66L132,33.66V222.34l25.17-25.17A4,4,0,0,1,162.83,197.17Z"}))]]);var m=Object.defineProperty,h=Object.defineProperties,u=Object.getOwnPropertyDescriptors,g=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable,w=(e,t,a)=>t in e?m(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,v=(e,t)=>{for(var a in t||(t={}))f.call(t,a)&&w(e,a,t[a]);if(g)for(var a of g(t))x.call(t,a)&&w(e,a,t[a]);return e},b=(e,t)=>h(e,u(t));let y=(0,s.forwardRef)((e,t)=>s.createElement(p.Z,b(v({ref:t},e),{weights:d})));y.displayName="ArrowsVertical";var j=a(66070),L=a(64670),E=a.n(L),M=a(42225),S=a(5477);(n=o||(o={})).Paint="Paint",n.Travel="Travel",n.Health="Health",n.Learning="Learning",n.Math="Mathematics",n.Language="Language",n.PopCulture="Pop Culture",n.Food="Food",n.Interviewing="Interviewing",n.Home="Home",n.Fun="Fun",n.Code="Code",n.Finance="Finance",n.Document="Document",n.Image="Image";let I={};I.Paint="indigo",I.Travel="yellow",I.Health="teal",I.Learning="purple",I.Language="blue",I["Pop Culture"]="red",I.Food="yellow",I.Interviewing="orange",I.Home="green",I.Fun="fuchsia",I.Code="teal",I.Finance="green",I.Mathematics="blue",I.Image="red",I.Document="orange";let Z="orange";function A(e,t){return"Paint"===e?(0,M.TI)("Palette",t,"w-6","h-6"):"Pop Culture"===e?(0,M.TI)("Confetti",t,"w-6","h-6"):"Travel"===e?(0,M.TI)("Jeep",t,"w-6","h-6"):"Learning"===e?(0,M.TI)("Book",t,"w-6","h-6"):"Health"===e?(0,M.TI)("Asclepius",t,"w-6","h-6"):"Fun"===e?(0,M.TI)("Island",t,"w-6","h-6"):"Home"===e?(0,M.TI)("House",t,"w-6","h-6"):"Language"===e?(0,M.TI)("Translate",t,"w-6","h-6"):"Code"===e?(0,M.TI)("Code",t,"w-6","h-6"):"Food"===e?(0,M.TI)("BowlFood",t,"w-6","h-6"):"Interviewing"===e?(0,M.TI)("Lectern",t,"w-6","h-6"):"Finance"===e?(0,M.TI)("Wallet",t,"w-6","h-6"):"Mathematics"===e?(0,M.TI)("MathOperations",t,"w-6","h-6"):"Image"===e?(0,M.TI)("Image",t,"w-6","h-6"):"Document"===e?(0,M.TI)("File",t,"w-6","h-6"):(0,M.TI)("Lightbulb",t,"w-6","h-6")}let C=[{type:"Document",actionTagline:"Analyze document",color:I.Document||Z,focus:S.$.FILE,intent:"Read this document and explain"},{type:"Code",actionTagline:"Write code",color:I.Code||Z,focus:S.$.MESSAGE,intent:"Write a program that"},{type:"Learning",actionTagline:"Explain concept",color:I.Learning||Z,focus:S.$.MESSAGE,intent:"I want to understand a concept"},{type:"Paint",actionTagline:"Create image",color:I.Paint||Z,focus:S.$.MESSAGE,intent:"Paint a picture of"},{type:"Language",actionTagline:"Translate text",color:I.Language||Z,focus:S.$.MESSAGE,intent:"Translate this text"},{type:"Finance",actionTagline:"Explain finance",color:I.Finance||Z,focus:S.$.MESSAGE,intent:"Help me build mental models for finance"},{type:"Mathematics",actionTagline:"Explain math",color:I.Mathematics||Z,focus:S.$.MESSAGE,intent:"Help me understand the math behind"},{type:"Image",actionTagline:"Analyze image",color:I.Image||Z,focus:S.$.FILE,intent:"Explain the significance of this image"},{type:"Health",actionTagline:"Improve health",color:I.Health||Z,focus:S.$.MESSAGE,intent:"Help me improve my health"}],k={Paint:[{prompt:"Paint a picture of a sunset but it's made of stained glass tiles."},{prompt:"Paint a futuristic cityscape with flying cars."},{prompt:"Paint a neon-lit street scene with reflections in the rain."},{prompt:"Paint a portrait of a person with a unique hairstyle."},{prompt:"Paint a landscape of a forest with a hidden waterfall."}],Travel:[{prompt:"Search for the best attractions in Austria Hungary."},{prompt:"Find the top-rated coffee shops in Seattle."},{prompt:"Research the best hiking trails in the Swiss Alps."},{prompt:"What is the best time of year to visit Bali?"},{prompt:"Find the best hidden gems in Nairobi."}],Health:[{prompt:"Explain to me how to improve my posture."},{prompt:"Tell me how what I eat affects my insulin levels."},{prompt:"Suggest healthy meal prep ideas for a busy work week."},{prompt:"Recommend good exercises to improve my flexibility."},{prompt:"Explain the benefits of a plant-based diet"}],Learning:[{prompt:"/research look up how Alpha Fold works and explain it to me."},{prompt:"Explain the key equations of general relativity."},{prompt:"Explain the concept of 'machine learning' in simple terms."},{prompt:"What are the key principles of Stoicism?"},{prompt:"/research what are the causes behind the breakthroughs in AI in the last 5 years."}],Language:[{prompt:"Translate the following text into Spanish: 'Hello, how are you?'"},{prompt:"Tell me how to greet someone in Arabic."},{prompt:"Explain the difference between the words 'ser' and 'estar' in Spanish."},{prompt:"Translate the following text into French: 'Where is the nearest metro station?'"},{prompt:"Translate the following text into Japanese: 'I am learning Japanese.'"}],"Pop Culture":[{prompt:"Find the best-rated science fiction books of the last decade."},{prompt:"Research the latest trends in K-pop and its global influence."},{prompt:"Explain the plot of the movie 'Doctor Zhivago' in detail."},{prompt:"What fashion is trending in jackets this season?"},{prompt:"Find the best indie movies of the last year"}],Food:[{prompt:"Find the best empanada recipe from Colombia."},{prompt:"Suggest a healthy alternative to a popular fast food dish."},{prompt:"Find the best recipe for a vegan chocolate cake."},{prompt:"Suggest a recipe for a quick and easy weeknight dinner."},{prompt:"Create a diagram that explains how to make a traditional Italian lasagna."}],Interviewing:[{prompt:"Create interview prep questions for a consulting job."},{prompt:"What information should I include in a CV for a PhD application?"},{prompt:"Suggest questions to ask during a job interview."},{prompt:"What are the best ways to prepare for a technical interview?"},{prompt:"How can I improve my public speaking skills for an interview?"}],Home:[{prompt:"Recommend plants that can grow well indoors."},{prompt:"Suggest ways to reduce plastic waste in daily life."},{prompt:"Create a list of eco-friendly home cleaning products."},{prompt:"Suggest ways to make a small apartment feel more spacious."},{prompt:"Recommend ways to reduce energy consumption in a home."}],Fun:[{prompt:"List creative date ideas for couples on a budget."},{prompt:"Create a list of fun activities for a family game night."},{prompt:"Give me three questions that can help me get to know someone better."},{prompt:"Suggest fun activities for a group of friends on a rainy day."},{prompt:"How can I improve my drawing skills?"}],Code:[{prompt:"Teach me how to write a simple 'Hello World' program in Python."},{prompt:"Write a single page application using vanilla HTML, CSS, and JavaScript that displays a list of items."},{prompt:"Explain the concept of recursion with a simple coding example."},{prompt:"Create a simple calculator app using React."},{prompt:"Write a function that takes an array of numbers and returns the sum of all the numbers."}],Finance:[{prompt:"Create a chart to explain the concept of compound interest and its importance in long-term savings."},{prompt:"Provide an overview of different types of retirement accounts (e.g., 401(k), IRA, Roth IRA)."},{prompt:"Explain the concept of diversification and its importance in investing."},{prompt:"Create a budgeting plan for someone who wants to save money for a vacation."},{prompt:"Explain the difference between a stock and a bond."}],Mathematics:[{prompt:"Create a series of questions to help a student discover the principles of basic economics."},{prompt:"Develop a hands-on experiment to demonstrate the concept of density to middle schoolers."},{prompt:"Explain the concept of a derivative and its applications in real life."},{prompt:"Create a lesson plan to teach students about the Pythagorean theorem."},{prompt:"Explain the concept of a limit in calculus and its importance in mathematics."}],Image:[{prompt:"Explain what is happening in this photograph"},{prompt:"Show me how I can improve this UI design"},{prompt:"Explain the significance of this historical painting"},{prompt:"Can you explain this physics diagram to me?"},{prompt:"Explain this meme to me"}],Document:[{prompt:"Summarize the key concepts in this document."},{prompt:"Provide a detailed explanation about the topic of this document."},{prompt:"Create a visual representation of the information in this document."},{prompt:"Find the main arguments in this document."},{prompt:"Explain the relevance of this document to various other disciplines."}]},H=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M252,152a12,12,0,0,1-12,12H228v12a12,12,0,0,1-24,0V164H192a12,12,0,0,1,0-24h12V128a12,12,0,0,1,24,0v12h12A12,12,0,0,1,252,152ZM56,76H68V88a12,12,0,0,0,24,0V76h12a12,12,0,1,0,0-24H92V40a12,12,0,0,0-24,0V52H56a12,12,0,0,0,0,24ZM184,188h-4v-4a12,12,0,0,0-24,0v4h-4a12,12,0,0,0,0,24h4v4a12,12,0,0,0,24,0v-4h4a12,12,0,0,0,0-24ZM222.14,82.83,82.82,222.14a20,20,0,0,1-28.28,0L33.85,201.46a20,20,0,0,1,0-28.29L173.17,33.86a20,20,0,0,1,28.28,0l20.69,20.68A20,20,0,0,1,222.14,82.83ZM159,112,144,97,53.65,187.31l15,15Zm43.31-43.31-15-15L161,80l15,15Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M176,112,74.34,213.66a8,8,0,0,1-11.31,0L42.34,193a8,8,0,0,1,0-11.31L144,80Z",opacity:"0.2"}),s.createElement("path",{d:"M248,152a8,8,0,0,1-8,8H224v16a8,8,0,0,1-16,0V160H192a8,8,0,0,1,0-16h16V128a8,8,0,0,1,16,0v16h16A8,8,0,0,1,248,152ZM56,72H72V88a8,8,0,0,0,16,0V72h16a8,8,0,0,0,0-16H88V40a8,8,0,0,0-16,0V56H56a8,8,0,0,0,0,16ZM184,192h-8v-8a8,8,0,0,0-16,0v8h-8a8,8,0,0,0,0,16h8v8a8,8,0,0,0,16,0v-8h8a8,8,0,0,0,0-16ZM219.31,80,80,219.31a16,16,0,0,1-22.62,0L36.68,198.63a16,16,0,0,1,0-22.63L176,36.69a16,16,0,0,1,22.63,0l20.68,20.68A16,16,0,0,1,219.31,80Zm-54.63,32L144,91.31l-96,96L68.68,208ZM208,68.69,187.31,48l-32,32L176,100.69Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M248,152a8,8,0,0,1-8,8H224v16a8,8,0,0,1-16,0V160H192a8,8,0,0,1,0-16h16V128a8,8,0,0,1,16,0v16h16A8,8,0,0,1,248,152ZM56,72H72V88a8,8,0,0,0,16,0V72h16a8,8,0,0,0,0-16H88V40a8,8,0,0,0-16,0V56H56a8,8,0,0,0,0,16ZM184,192h-8v-8a8,8,0,0,0-16,0v8h-8a8,8,0,0,0,0,16h8v8a8,8,0,0,0,16,0v-8h8a8,8,0,0,0,0-16ZM219.31,80,80,219.31a16,16,0,0,1-22.62,0L36.68,198.63a16,16,0,0,1,0-22.63L176,36.69a16,16,0,0,1,22.63,0l20.68,20.68A16,16,0,0,1,219.31,80ZM208,68.69,187.31,48l-32,32L176,100.69Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M246,152a6,6,0,0,1-6,6H222v18a6,6,0,0,1-12,0V158H192a6,6,0,0,1,0-12h18V128a6,6,0,0,1,12,0v18h18A6,6,0,0,1,246,152ZM56,70H74V88a6,6,0,0,0,12,0V70h18a6,6,0,0,0,0-12H86V40a6,6,0,0,0-12,0V58H56a6,6,0,0,0,0,12ZM184,194H174V184a6,6,0,0,0-12,0v10H152a6,6,0,0,0,0,12h10v10a6,6,0,0,0,12,0V206h10a6,6,0,0,0,0-12ZM217.9,78.59,78.58,217.9a14,14,0,0,1-19.8,0L38.09,197.21a14,14,0,0,1,0-19.8L177.41,38.1a14,14,0,0,1,19.8,0L217.9,58.79A14,14,0,0,1,217.9,78.59ZM167.51,112,144,88.49,46.58,185.9a2,2,0,0,0,0,2.83l20.69,20.68a2,2,0,0,0,2.82,0h0Zm41.9-44.73L188.73,46.59a2,2,0,0,0-2.83,0L152.48,80,176,103.52,209.41,70.1A2,2,0,0,0,209.41,67.27Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M48,64a8,8,0,0,1,8-8H72V40a8,8,0,0,1,16,0V56h16a8,8,0,0,1,0,16H88V88a8,8,0,0,1-16,0V72H56A8,8,0,0,1,48,64ZM184,192h-8v-8a8,8,0,0,0-16,0v8h-8a8,8,0,0,0,0,16h8v8a8,8,0,0,0,16,0v-8h8a8,8,0,0,0,0-16Zm56-48H224V128a8,8,0,0,0-16,0v16H192a8,8,0,0,0,0,16h16v16a8,8,0,0,0,16,0V160h16a8,8,0,0,0,0-16ZM219.31,80,80,219.31a16,16,0,0,1-22.62,0L36.68,198.63a16,16,0,0,1,0-22.63L176,36.69a16,16,0,0,1,22.63,0l20.68,20.68A16,16,0,0,1,219.31,80Zm-54.63,32L144,91.31l-96,96L68.68,208ZM208,68.69,187.31,48l-32,32L176,100.69Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M244,152a4,4,0,0,1-4,4H220v20a4,4,0,0,1-8,0V156H192a4,4,0,0,1,0-8h20V128a4,4,0,0,1,8,0v20h20A4,4,0,0,1,244,152ZM56,68H76V88a4,4,0,0,0,8,0V68h20a4,4,0,0,0,0-8H84V40a4,4,0,0,0-8,0V60H56a4,4,0,0,0,0,8ZM184,196H172V184a4,4,0,0,0-8,0v12H152a4,4,0,0,0,0,8h12v12a4,4,0,0,0,8,0V204h12a4,4,0,0,0,0-8ZM216.48,77.17,77.17,216.49a12,12,0,0,1-17,0L39.51,195.8a12,12,0,0,1,0-17L178.83,39.51a12,12,0,0,1,17,0L216.48,60.2A12,12,0,0,1,216.48,77.17ZM170.34,112,144,85.66,45.17,184.49a4,4,0,0,0,0,5.65l20.68,20.69a4,4,0,0,0,5.66,0Zm40.49-46.14L190.14,45.17a4,4,0,0,0-5.66,0L149.65,80,176,106.34l34.83-34.83A4,4,0,0,0,210.83,65.86Z"}))]]);var N=Object.defineProperty,F=Object.defineProperties,V=Object.getOwnPropertyDescriptors,T=Object.getOwnPropertySymbols,P=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable,O=(e,t,a)=>t in e?N(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,W=(e,t)=>{for(var a in t||(t={}))P.call(t,a)&&O(e,a,t[a]);if(T)for(var a of T(t))_.call(t,a)&&O(e,a,t[a]);return e},B=(e,t)=>F(e,V(t));let D=(0,s.forwardRef)((e,t)=>s.createElement(p.Z,B(W({ref:t},e),{weights:H})));D.displayName="MagicWand";let R=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M168.49,104.49,145,128l23.52,23.51a12,12,0,0,1-17,17L128,145l-23.51,23.52a12,12,0,0,1-17-17L111,128,87.51,104.49a12,12,0,0,1,17-17L128,111l23.51-23.52a12,12,0,0,1,17,17ZM236,128A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),s.createElement("path",{d:"M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm37.66,130.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M164.24,100.24,136.48,128l27.76,27.76a6,6,0,1,1-8.48,8.48L128,136.48l-27.76,27.76a6,6,0,0,1-8.48-8.48L119.52,128,91.76,100.24a6,6,0,0,1,8.48-8.48L128,119.52l27.76-27.76a6,6,0,0,1,8.48,8.48ZM230,128A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M162.83,98.83,133.66,128l29.17,29.17a4,4,0,0,1-5.66,5.66L128,133.66,98.83,162.83a4,4,0,0,1-5.66-5.66L122.34,128,93.17,98.83a4,4,0,0,1,5.66-5.66L128,122.34l29.17-29.17a4,4,0,1,1,5.66,5.66ZM228,128A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z"}))]]);var G=Object.defineProperty,U=Object.defineProperties,$=Object.getOwnPropertyDescriptors,q=Object.getOwnPropertySymbols,z=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable,Y=(e,t,a)=>t in e?G(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,K=(e,t)=>{for(var a in t||(t={}))z.call(t,a)&&Y(e,a,t[a]);if(q)for(var a of q(t))J.call(t,a)&&Y(e,a,t[a]);return e},Q=(e,t)=>U(e,$(t));let X=(0,s.forwardRef)((e,t)=>s.createElement(p.Z,Q(K({ref:t},e),{weights:R})));function ee(e){let t="".concat(E().card," md:w-full md:h-fit sm:w-full h-fit md:w-[200px] cursor-pointer md:p-2"),a="".concat(E().text," dark:text-white");return(0,i.jsx)(j.Zb,{className:t,children:(0,i.jsx)("div",{className:"flex w-full",children:(0,i.jsxs)(j.aY,{className:"m-0 p-2 w-full flex flex-row",children:[A(e.title,e.color.toLowerCase()),(0,i.jsx)(j.SZ,{className:"".concat(a," sm:line-clamp-2 md:line-clamp-4 pt-1 break-words whitespace-pre-wrap max-w-full"),children:e.body})]})})})}function et(e){let t="".concat(E().card," md:h-fit sm:w-full h-fit cursor-pointer md:p-2");return(0,i.jsx)(j.Zb,{className:t,children:(0,i.jsx)("div",{className:"flex w-full items-center",children:(0,i.jsxs)(j.aY,{className:"m-0 p-1 w-full flex flex-row items-center",children:[(0,i.jsx)(D,{weight:"thin",className:"w-4 h-4 text-muted-foreground inline-flex mr-1 text-opacity-40"}),(0,i.jsx)(j.SZ,{className:"sm:line-clamp-2 md:line-clamp-4 break-words whitespace-pre-wrap max-w-full text-sm text-wrap text-black dark:text-white",children:e.prompt})]})})})}function ea(e){let t="".concat(E().card," md:w-full md:h-fit sm:w-full h-fit md:w-fit cursor-pointer m-2 md:p-1 animate-fade-in-up border-opacity-50 shadow-none"),a="".concat(E().text," dark:text-white");return(0,i.jsx)(j.Zb,{className:t,onClick:e.onClick,children:(0,i.jsx)("div",{className:"flex w-full h-full items-center justify-center",children:(0,i.jsxs)(j.aY,{className:"m-0 p-2 w-full flex flex-row items-center justify-center",children:[A(e.title,e.color.toLowerCase()),(0,i.jsx)(j.SZ,{className:"".concat(a," sm:line-clamp-2 md:line-clamp-4 pt-1 break-words whitespace-pre-wrap max-w-full text-center"),children:e.body}),(0,i.jsx)(X,{className:"w-6 h-6 text-muted-foreground inline-flex ml-1"})]})})})}X.displayName="XCircle";var en=a(14308),eo=a(33494),ei=a(56937),er=a(84671),el=a(59199),es=a(7436),ec=a(99376),ep=a(19378),ed=a(25427),em=a(57054),eh=a(62869),eu=a(37104),eg=a(17814);function ef(e){return e.isMobileWidth?(0,i.jsx)(eg.dy,{open:!0,onClose:()=>e.setShowLoginPrompt(!1),children:(0,i.jsx)(eg.sc,{children:(0,i.jsx)(ex,{...e})})}):(0,i.jsx)("div",{className:"fixed inset-x-0 bottom-8 z-30 flex items-center justify-center",children:(0,i.jsx)(ex,{...e})})}function ex(e){return(0,i.jsxs)(j.Zb,{className:"rounded-lg p-6 flex flex-col items-center justify-between gap-8 md:w-fit border-none md:flex-row md:z-30 md:shadow-lg",children:[!e.isMobileWidth&&(0,i.jsx)(eu.S6,{className:"w-12 h-auto"}),(0,i.jsxs)("div",{className:"flex flex-col items-start justify-center gap-8 md:gap-2",children:[(0,i.jsx)(j.Ol,{className:"p-0 text-xl font-bold",children:"Welcome to Khoj!"}),(0,i.jsx)(j.SZ,{children:"Sign in to get started with Khoj, your AI research assistant."})]}),(0,i.jsx)(eh.z,{variant:"default",className:"p-6 text-lg",onClick:()=>e.setShowLoginPrompt(!0),children:"Get started for free"})]})}var ew=a(60729),ev=a(34124),eb=a(6512),ey=a(84190);function ej(e){let{agents:t,agentIcons:a,selectedAgent:n,isPopoverOpen:o,debouncedHoveredAgent:r,setHoveredAgent:l,setIsPopoverOpen:s,setSelectedAgent:c,chatInputRef:p,openAgentEditCard:d,userConfig:m,isMobileWidth:h}=e;return(0,i.jsxs)(ep.x,{className:"w-full max-w-[600px] mx-auto",children:[(0,i.jsx)("div",{className:"flex pb-2 gap-2 items-center justify-center",children:t.map((e,t)=>(0,i.jsxs)(em.J2,{open:o&&r===e.slug,onOpenChange:e=>{e||(l(null),s(!1))},children:[(0,i.jsx)(em.xo,{asChild:!0,children:(0,i.jsx)(j.Zb,{className:"".concat(n===e.slug?(0,er.Iu)(e.color):"border-stone-100 dark:border-neutral-700 text-muted-foreground","\n hover:cursor-pointer rounded-lg px-2 py-2"),onDoubleClick:()=>d(e.slug),onClick:()=>{var t;c(e.slug),null===(t=p.current)||void 0===t||t.focus(),l(null),s(!1)},onMouseEnter:()=>l(e.slug),onMouseLeave:()=>{l(null),s(!1)},children:(0,i.jsxs)(j.ll,{className:"text-center text-md font-medium flex justify-center items-center whitespace-nowrap",children:[a[t]," ",e.name]})})}),(0,i.jsx)(em.yk,{className:"w-80 p-0 border-none bg-transparent shadow-none",onMouseLeave:()=>{l(null),s(!1)},children:(0,i.jsx)(ed.EY,{data:e,userProfile:null,isMobileWidth:h||!1,showChatButton:!1,editCard:!1,filesOptions:[],selectedChatModelOption:"",agentSlug:"",isSubscribed:(0,ei.T8)(m),setAgentChangeTriggered:()=>{},modelOptions:[],inputToolOptions:{},outputModeOptions:{}})})]},"".concat(t,"-").concat(e.slug)))}),(0,i.jsx)(ep.B,{orientation:"horizontal"})]})}function eL(e){var t,a,n,o,r,p,d;let[m,h]=(0,s.useState)(""),[u,g]=(0,s.useState)(""),[f,x]=(0,s.useState)(S.$.MESSAGE),[w,v]=(0,s.useState)([]),[b,j]=(0,s.useState)(!1),[L,E]=(0,s.useState)(""),[I,Z]=(0,s.useState)(C.slice(0,3)),[A,H]=(0,s.useState)([]),[N,F]=(0,s.useState)(null),[V,T]=(0,s.useState)(null),P=(0,es.Nr)(V,500),[_,O]=(0,s.useState)(!1),[W,B]=(0,s.useState)("khoj"),[D,R]=(0,s.useState)([]),[G,U]=(0,s.useState)([]),$=(0,s.useRef)(null),[q,z]=(0,s.useState)(!1),J=(0,ec.useRouter)(),Y=(0,ec.useSearchParams)().get("q");(0,s.useEffect)(()=>{Y&&h(decodeURIComponent(Y))},[Y]),(0,s.useEffect)(()=>{P&&O(!0)},[P]);let K=e.onConversationIdChange,{data:Q,error:X}=(0,c.ZP)("agents",()=>window.fetch("/api/agents").then(e=>e.json()).catch(e=>console.log(e)),{revalidateOnFocus:!1});return(0,s.useEffect)(()=>{var t,a;if(e.isLoadingUserConfig)return;let n=new Date,o=n.getDay(),i=n.getHours()>=17||4>n.getHours()?"evening":n.getHours()>=12?"afternoon":"morning",r=(null===(t=e.userConfig)||void 0===t?void 0:t.given_name)?", ".concat(null===(a=e.userConfig)||void 0===a?void 0:a.given_name):"",l=["What would you like to get done".concat(r,"?"),"Hey".concat(r,"! How can I help?"),"Good ".concat(i).concat(r,"! What's on your mind?"),"Ready to breeze through ".concat(["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][o],"?"),"Let's navigate your ".concat(["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][o]," workload")];E(l[Math.floor(Math.random()*l.length)])},[e.isLoadingUserConfig,e.userConfig]),(0,s.useEffect)(()=>{let e=(Q||[]).filter(e=>null!=e);U(e),B(e.length>1?e[0].slug:"khoj"),R(e.map(e=>(0,M.TI)(e.icon,e.color)))},[Q]),(0,s.useEffect)(()=>{(async()=>{if(m&&!b){j(!0);try{let e=await (0,el.A0)(W||"khoj");null==K||K(e),localStorage.setItem("message",m),w.length>0&&localStorage.setItem("images",JSON.stringify(w)),window.location.href="/chat?conversationId=".concat(e)}catch(e){console.error("Error creating new conversation:",e),j(!1)}h(""),v([])}})(),(m||w.length>0)&&j(!0)},[W,m,b,K]),(0,s.useEffect)(()=>{let e=document.querySelector("[data-radix-scroll-area-viewport]"),t=()=>{T(null),O(!1)};return null==e||e.addEventListener("scroll",t),()=>null==e?void 0:e.removeEventListener("scroll",t)},[]),(0,i.jsxs)("div",{className:"".concat(l().homeGreetings," w-full md:w-auto"),children:[q&&(0,i.jsx)(eo.Z,{onOpenChange:z,isMobileWidth:e.isMobileWidth}),!e.isLoggedIn&&(0,i.jsx)(ef,{isMobileWidth:e.isMobileWidth,setShowLoginPrompt:z}),(0,i.jsxs)("div",{className:"w-full text-center justify-end content-end",children:[(0,i.jsx)("div",{className:"items-center",children:(0,i.jsx)("h1",{className:"text-2xl md:text-3xl text-center w-fit pb-6 pt-4 px-4 mx-auto",children:L})}),!e.isMobileWidth&&(0,i.jsx)(ej,{agents:G,agentIcons:D,selectedAgent:W,isPopoverOpen:_,debouncedHoveredAgent:P,setHoveredAgent:T,setIsPopoverOpen:O,setSelectedAgent:B,chatInputRef:$,openAgentEditCard:e=>{J.push("/agents?agent=".concat(e))},userConfig:e.userConfig})]}),(0,i.jsxs)("div",{className:"mx-auto ".concat(e.isMobileWidth?"w-full":"w-full max-w-screen-md"),children:[!e.isMobileWidth&&(0,i.jsx)("div",{className:"w-full ".concat(l().inputBox," shadow-lg bg-background align-middle items-center justify-center px-3 py-1 dark:bg-neutral-700 border-stone-100 dark:border-none dark:shadow-none rounded-2xl"),children:(0,i.jsx)(S.a,{isLoggedIn:e.isLoggedIn,prefillMessage:u,focus:f,sendMessage:e=>h(e),sendImage:e=>v(t=>[...t,e]),sendDisabled:b,chatOptionsData:e.chatOptionsData,conversationId:null,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,agentColor:null===(t=G.find(e=>e.slug===W))||void 0===t?void 0:t.color,ref:$,setTriggeredAbort:()=>{}})}),0==A.length&&(0,i.jsx)("div",{className:"".concat(l().suggestions," w-full ").concat(e.isMobileWidth&&C.length>3?"grid grid-cols-2":"grid grid-cols-3",' "justify-center items-center"'),children:I.map((t,a)=>(0,i.jsx)("div",{onClick:a=>{e.isLoggedIn?function(e){g(e.intent);let t=k[e.type]||[];F(e),H(t),x(e.focus)}(t):(a.preventDefault(),a.stopPropagation(),z(!0))},children:(0,i.jsx)(ee,{title:t.type,body:t.actionTagline,color:t.color},t.type+Math.random())},"".concat(t.type," ").concat(t.actionTagline)))}),0==A.length&&I.length<C.length&&(0,i.jsx)("div",{className:"flex items-center justify-center margin-auto",children:(0,i.jsxs)("button",{onClick:function(){Z(C)},className:"m-2 p-1.5 rounded-lg dark:hover:bg-[var(--background-color)] hover:bg-stone-100 border border-stone-100 text-sm text-stone-500 dark:text-stone-300 dark:border-neutral-700",children:["Show All ",(0,i.jsx)(y,{className:"h-4 w-4 inline"})]})}),N&&(0,i.jsx)(ea,{title:N.type,body:N.actionTagline,color:N.color,onClick:()=>{g(""),F(null),H([]),x(S.$.MESSAGE)}}),A.length>0&&(0,i.jsx)("div",{className:"w-full ".concat(e.isMobileWidth?"grid":"grid grid-cols-1"," justify-center items-center gap-2 p-2"),children:A.map((e,t)=>(0,i.jsx)("div",{className:"w-full cursor-pointer animate-fade-in-up",onClick:t=>{h(e.prompt)},children:(0,i.jsx)(et,{prompt:e.prompt},e.prompt)},"".concat(e.prompt," ").concat(t)))})]}),e.isMobileWidth&&(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{className:"".concat(l().inputBox," align-middle items-center justify-center pb-3 mx-1 mb-2 border-none"),children:[(0,i.jsxs)(ey.h_,{children:[(0,i.jsx)(ey.$F,{children:(0,i.jsxs)(eh.z,{className:"w-full m-2 p-0",variant:"outline",children:[W?(0,M.TI)(null!==(p=null===(a=G.find(e=>e.slug===W))||void 0===a?void 0:a.icon)&&void 0!==p?p:"",null!==(d=null===(n=G.find(e=>e.slug===W))||void 0===n?void 0:n.color)&&void 0!==d?d:""):(0,i.jsx)(y,{className:"h-5 w-5"}),W?"".concat(null===(o=G.find(e=>e.slug===W))||void 0===o?void 0:o.name):"Select Agent"]})}),(0,i.jsx)(ey.AW,{align:"end",className:"overflow-y-scroll h-96",children:D.map((e,t)=>(0,i.jsxs)(ey.Xi,{onClick:()=>{var e;B(G[t].slug),null===(e=$.current)||void 0===e||e.focus()},children:[e," ",G[t].name]},"".concat(t,"-").concat(G[t].slug)))})]}),(0,i.jsx)("div",{className:"".concat(l().inputBox," pt-4 shadow-[0_-20px_25px_-5px_rgba(0,0,0,0.1)] dark:bg-neutral-700 bg-background rounded-2xl mb-2 border-none"),children:(0,i.jsx)(S.a,{isLoggedIn:e.isLoggedIn,sendMessage:e=>h(e),sendImage:e=>v(t=>[...t,e]),sendDisabled:b,chatOptionsData:e.chatOptionsData,conversationId:null,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,agentColor:null===(r=G.find(e=>e.slug===W))||void 0===r?void 0:r.color,ref:$,setTriggeredAbort:()=>{}})})]})})]})}function eE(){let[e,t]=(0,s.useState)(null),[a,n]=(0,s.useState)(!0),[o,r]=(0,s.useState)(null),[c,p]=(0,s.useState)(null),d=(0,es.IC)(),{data:m,isLoading:h}=(0,ei.h2)(!0),[u,g]=(0,s.useState)(null),{data:f,error:x,isLoading:w}=(0,ei.GW)();return((0,s.useEffect)(()=>{g(m)},[m]),(0,s.useEffect)(()=>{c&&localStorage.setItem("uploadedFiles",JSON.stringify(c))},[c]),(0,s.useEffect)(()=>{fetch("/api/chat/options").then(e=>e.json()).then(e=>{n(!1),e&&t(e)}).catch(e=>{console.error(e)})},[]),a)?(0,i.jsx)(en.Z,{}):(0,i.jsxs)(ew.Hn,{children:[(0,i.jsx)(ev.S,{conversationId:o}),(0,i.jsxs)(ew.kV,{children:[(0,i.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,i.jsx)(ew.vP,{className:"-ml-1"}),(0,i.jsx)(eb.Z,{orientation:"vertical",className:"mr-2 h-4"}),d?(0,i.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,i.jsx)(eu.VO,{className:"h-auto w-16"})}):(0,i.jsx)("h2",{className:"text-lg",children:"Ask Anything"})]}),(0,i.jsxs)("div",{className:"".concat(l().main," ").concat(l().chatLayout),children:[(0,i.jsx)("title",{children:"Khoj AI - Your Second Brain"}),(0,i.jsx)("div",{className:"".concat(l().chatBox),children:(0,i.jsx)("div",{className:"".concat(l().chatBoxBody),children:!w&&(0,i.jsx)(eL,{isLoggedIn:!!f,chatOptionsData:e,setUploadedFiles:p,isMobileWidth:d,onConversationIdChange:e=>{r(e)},userConfig:u,isLoadingUserConfig:h})})})]})]})]})}},99376:function(e,t,a){"use strict";var n=a(35475);a.o(n,"useRouter")&&a.d(t,{useRouter:function(){return n.useRouter}}),a.o(n,"useSearchParams")&&a.d(t,{useSearchParams:function(){return n.useSearchParams}})},47960:function(){},64670:function(e){e.exports={card:"suggestions_card__fbiZo",title:"suggestions_title__vNozc",text:"suggestions_text__J_IfY"}},76777:function(e){e.exports={main:"page_main__nw1Wk",suggestions:"page_suggestions__Y8EqU",inputBox:"page_inputBox__LrcZ4",chatBodyFull:"page_chatBodyFull__Qu2T2",chatBody:"page_chatBody__IirQQ",chatLayout:"page_chatLayout__bJUjP",chatBox:"page_chatBox__gsR6V",titleBar:"page_titleBar__3btUI",chatBoxBody:"page_chatBoxBody__xORKr",homeGreetings:"page_homeGreetings__VjQhh"}}},function(e){e.O(0,[3587,6250,8255,1607,3861,9259,8667,4363,4447,6663,4357,7647,2327,5477,5427,2971,2117,1744],function(){return e(e.s=1507)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1931],{1507:function(e,t,a){Promise.resolve().then(a.bind(a,88507))},88507:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return eE}});var n,o,i=a(57437);a(47960);var r=a(76777),l=a.n(r);a(2446);var s=a(2265),c=a(63861),p=a(49656);let d=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M168.49,191.51a12,12,0,0,1,0,17l-32,32a12,12,0,0,1-17,0l-32-32a12,12,0,0,1,17-17L116,203V53L104.49,64.49a12,12,0,1,1-17-17l32-32a12,12,0,0,1,17,0l32,32a12,12,0,0,1-17,17L140,53V203l11.51-11.52A12,12,0,0,1,168.49,191.51Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M160,56V200l-32,32L96,200V56l32-32Z",opacity:"0.2"}),s.createElement("path",{d:"M165.66,194.34a8,8,0,0,1,0,11.32l-32,32a8,8,0,0,1-11.32,0l-32-32a8,8,0,0,1,11.32-11.32L120,212.69V43.31L101.66,61.66A8,8,0,0,1,90.34,50.34l32-32a8,8,0,0,1,11.32,0l32,32a8,8,0,0,1-11.32,11.32L136,43.31V212.69l18.34-18.35A8,8,0,0,1,165.66,194.34Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M167.39,196.94a8,8,0,0,1-1.73,8.72l-32,32a8,8,0,0,1-11.32,0l-32-32A8,8,0,0,1,96,192h24V64H96a8,8,0,0,1-5.66-13.66l32-32a8,8,0,0,1,11.32,0l32,32A8,8,0,0,1,160,64H136V192h24A8,8,0,0,1,167.39,196.94Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M164.24,195.76a6,6,0,0,1,0,8.48l-32,32a6,6,0,0,1-8.48,0l-32-32a6,6,0,0,1,8.48-8.48L122,217.51v-179L100.24,60.24a6,6,0,0,1-8.48-8.48l32-32a6,6,0,0,1,8.48,0l32,32a6,6,0,1,1-8.48,8.48L134,38.49v179l21.76-21.75A6,6,0,0,1,164.24,195.76Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M165.66,194.34a8,8,0,0,1,0,11.32l-32,32a8,8,0,0,1-11.32,0l-32-32a8,8,0,0,1,11.32-11.32L120,212.69V43.31L101.66,61.66A8,8,0,0,1,90.34,50.34l32-32a8,8,0,0,1,11.32,0l32,32a8,8,0,0,1-11.32,11.32L136,43.31V212.69l18.34-18.35A8,8,0,0,1,165.66,194.34Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M162.83,197.17a4,4,0,0,1,0,5.66l-32,32a4,4,0,0,1-5.66,0l-32-32a4,4,0,0,1,5.66-5.66L124,222.34V33.66L98.83,58.83a4,4,0,0,1-5.66-5.66l32-32a4,4,0,0,1,5.66,0l32,32a4,4,0,0,1-5.66,5.66L132,33.66V222.34l25.17-25.17A4,4,0,0,1,162.83,197.17Z"}))]]);var m=Object.defineProperty,h=Object.defineProperties,u=Object.getOwnPropertyDescriptors,g=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable,w=(e,t,a)=>t in e?m(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,v=(e,t)=>{for(var a in t||(t={}))f.call(t,a)&&w(e,a,t[a]);if(g)for(var a of g(t))x.call(t,a)&&w(e,a,t[a]);return e},b=(e,t)=>h(e,u(t));let y=(0,s.forwardRef)((e,t)=>s.createElement(p.Z,b(v({ref:t},e),{weights:d})));y.displayName="ArrowsVertical";var j=a(66070),L=a(64670),E=a.n(L),M=a(42225),S=a(5477);(n=o||(o={})).Paint="Paint",n.Travel="Travel",n.Health="Health",n.Learning="Learning",n.Math="Mathematics",n.Language="Language",n.PopCulture="Pop Culture",n.Food="Food",n.Interviewing="Interviewing",n.Home="Home",n.Fun="Fun",n.Code="Code",n.Finance="Finance",n.Document="Document",n.Image="Image";let I={};I.Paint="indigo",I.Travel="yellow",I.Health="teal",I.Learning="purple",I.Language="blue",I["Pop Culture"]="red",I.Food="yellow",I.Interviewing="orange",I.Home="green",I.Fun="fuchsia",I.Code="teal",I.Finance="green",I.Mathematics="blue",I.Image="red",I.Document="orange";let Z="orange";function A(e,t){return"Paint"===e?(0,M.TI)("Palette",t,"w-6","h-6"):"Pop Culture"===e?(0,M.TI)("Confetti",t,"w-6","h-6"):"Travel"===e?(0,M.TI)("Jeep",t,"w-6","h-6"):"Learning"===e?(0,M.TI)("Book",t,"w-6","h-6"):"Health"===e?(0,M.TI)("Asclepius",t,"w-6","h-6"):"Fun"===e?(0,M.TI)("Island",t,"w-6","h-6"):"Home"===e?(0,M.TI)("House",t,"w-6","h-6"):"Language"===e?(0,M.TI)("Translate",t,"w-6","h-6"):"Code"===e?(0,M.TI)("Code",t,"w-6","h-6"):"Food"===e?(0,M.TI)("BowlFood",t,"w-6","h-6"):"Interviewing"===e?(0,M.TI)("Lectern",t,"w-6","h-6"):"Finance"===e?(0,M.TI)("Wallet",t,"w-6","h-6"):"Mathematics"===e?(0,M.TI)("MathOperations",t,"w-6","h-6"):"Image"===e?(0,M.TI)("Image",t,"w-6","h-6"):"Document"===e?(0,M.TI)("File",t,"w-6","h-6"):(0,M.TI)("Lightbulb",t,"w-6","h-6")}let C=[{type:"Document",actionTagline:"Analyze document",color:I.Document||Z,focus:S.$.FILE,intent:"Read this document and explain"},{type:"Code",actionTagline:"Write code",color:I.Code||Z,focus:S.$.MESSAGE,intent:"Write a program that"},{type:"Learning",actionTagline:"Explain concept",color:I.Learning||Z,focus:S.$.MESSAGE,intent:"I want to understand a concept"},{type:"Paint",actionTagline:"Create image",color:I.Paint||Z,focus:S.$.MESSAGE,intent:"Paint a picture of"},{type:"Language",actionTagline:"Translate text",color:I.Language||Z,focus:S.$.MESSAGE,intent:"Translate this text"},{type:"Finance",actionTagline:"Explain finance",color:I.Finance||Z,focus:S.$.MESSAGE,intent:"Help me build mental models for finance"},{type:"Mathematics",actionTagline:"Explain math",color:I.Mathematics||Z,focus:S.$.MESSAGE,intent:"Help me understand the math behind"},{type:"Image",actionTagline:"Analyze image",color:I.Image||Z,focus:S.$.FILE,intent:"Explain the significance of this image"},{type:"Health",actionTagline:"Improve health",color:I.Health||Z,focus:S.$.MESSAGE,intent:"Help me improve my health"}],k={Paint:[{prompt:"Paint a picture of a sunset but it's made of stained glass tiles."},{prompt:"Paint a futuristic cityscape with flying cars."},{prompt:"Paint a neon-lit street scene with reflections in the rain."},{prompt:"Paint a portrait of a person with a unique hairstyle."},{prompt:"Paint a landscape of a forest with a hidden waterfall."}],Travel:[{prompt:"Search for the best attractions in Austria Hungary."},{prompt:"Find the top-rated coffee shops in Seattle."},{prompt:"Research the best hiking trails in the Swiss Alps."},{prompt:"What is the best time of year to visit Bali?"},{prompt:"Find the best hidden gems in Nairobi."}],Health:[{prompt:"Explain to me how to improve my posture."},{prompt:"Tell me how what I eat affects my insulin levels."},{prompt:"Suggest healthy meal prep ideas for a busy work week."},{prompt:"Recommend good exercises to improve my flexibility."},{prompt:"Explain the benefits of a plant-based diet"}],Learning:[{prompt:"/research look up how Alpha Fold works and explain it to me."},{prompt:"Explain the key equations of general relativity."},{prompt:"Explain the concept of 'machine learning' in simple terms."},{prompt:"What are the key principles of Stoicism?"},{prompt:"/research what are the causes behind the breakthroughs in AI in the last 5 years."}],Language:[{prompt:"Translate the following text into Spanish: 'Hello, how are you?'"},{prompt:"Tell me how to greet someone in Arabic."},{prompt:"Explain the difference between the words 'ser' and 'estar' in Spanish."},{prompt:"Translate the following text into French: 'Where is the nearest metro station?'"},{prompt:"Translate the following text into Japanese: 'I am learning Japanese.'"}],"Pop Culture":[{prompt:"Find the best-rated science fiction books of the last decade."},{prompt:"Research the latest trends in K-pop and its global influence."},{prompt:"Explain the plot of the movie 'Doctor Zhivago' in detail."},{prompt:"What fashion is trending in jackets this season?"},{prompt:"Find the best indie movies of the last year"}],Food:[{prompt:"Find the best empanada recipe from Colombia."},{prompt:"Suggest a healthy alternative to a popular fast food dish."},{prompt:"Find the best recipe for a vegan chocolate cake."},{prompt:"Suggest a recipe for a quick and easy weeknight dinner."},{prompt:"Create a diagram that explains how to make a traditional Italian lasagna."}],Interviewing:[{prompt:"Create interview prep questions for a consulting job."},{prompt:"What information should I include in a CV for a PhD application?"},{prompt:"Suggest questions to ask during a job interview."},{prompt:"What are the best ways to prepare for a technical interview?"},{prompt:"How can I improve my public speaking skills for an interview?"}],Home:[{prompt:"Recommend plants that can grow well indoors."},{prompt:"Suggest ways to reduce plastic waste in daily life."},{prompt:"Create a list of eco-friendly home cleaning products."},{prompt:"Suggest ways to make a small apartment feel more spacious."},{prompt:"Recommend ways to reduce energy consumption in a home."}],Fun:[{prompt:"List creative date ideas for couples on a budget."},{prompt:"Create a list of fun activities for a family game night."},{prompt:"Give me three questions that can help me get to know someone better."},{prompt:"Suggest fun activities for a group of friends on a rainy day."},{prompt:"How can I improve my drawing skills?"}],Code:[{prompt:"Teach me how to write a simple 'Hello World' program in Python."},{prompt:"Write a single page application using vanilla HTML, CSS, and JavaScript that displays a list of items."},{prompt:"Explain the concept of recursion with a simple coding example."},{prompt:"Create a simple calculator app using React."},{prompt:"Write a function that takes an array of numbers and returns the sum of all the numbers."}],Finance:[{prompt:"Create a chart to explain the concept of compound interest and its importance in long-term savings."},{prompt:"Provide an overview of different types of retirement accounts (e.g., 401(k), IRA, Roth IRA)."},{prompt:"Explain the concept of diversification and its importance in investing."},{prompt:"Create a budgeting plan for someone who wants to save money for a vacation."},{prompt:"Explain the difference between a stock and a bond."}],Mathematics:[{prompt:"Create a series of questions to help a student discover the principles of basic economics."},{prompt:"Develop a hands-on experiment to demonstrate the concept of density to middle schoolers."},{prompt:"Explain the concept of a derivative and its applications in real life."},{prompt:"Create a lesson plan to teach students about the Pythagorean theorem."},{prompt:"Explain the concept of a limit in calculus and its importance in mathematics."}],Image:[{prompt:"Explain what is happening in this photograph"},{prompt:"Show me how I can improve this UI design"},{prompt:"Explain the significance of this historical painting"},{prompt:"Can you explain this physics diagram to me?"},{prompt:"Explain this meme to me"}],Document:[{prompt:"Summarize the key concepts in this document."},{prompt:"Provide a detailed explanation about the topic of this document."},{prompt:"Create a visual representation of the information in this document."},{prompt:"Find the main arguments in this document."},{prompt:"Explain the relevance of this document to various other disciplines."}]},H=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M252,152a12,12,0,0,1-12,12H228v12a12,12,0,0,1-24,0V164H192a12,12,0,0,1,0-24h12V128a12,12,0,0,1,24,0v12h12A12,12,0,0,1,252,152ZM56,76H68V88a12,12,0,0,0,24,0V76h12a12,12,0,1,0,0-24H92V40a12,12,0,0,0-24,0V52H56a12,12,0,0,0,0,24ZM184,188h-4v-4a12,12,0,0,0-24,0v4h-4a12,12,0,0,0,0,24h4v4a12,12,0,0,0,24,0v-4h4a12,12,0,0,0,0-24ZM222.14,82.83,82.82,222.14a20,20,0,0,1-28.28,0L33.85,201.46a20,20,0,0,1,0-28.29L173.17,33.86a20,20,0,0,1,28.28,0l20.69,20.68A20,20,0,0,1,222.14,82.83ZM159,112,144,97,53.65,187.31l15,15Zm43.31-43.31-15-15L161,80l15,15Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M176,112,74.34,213.66a8,8,0,0,1-11.31,0L42.34,193a8,8,0,0,1,0-11.31L144,80Z",opacity:"0.2"}),s.createElement("path",{d:"M248,152a8,8,0,0,1-8,8H224v16a8,8,0,0,1-16,0V160H192a8,8,0,0,1,0-16h16V128a8,8,0,0,1,16,0v16h16A8,8,0,0,1,248,152ZM56,72H72V88a8,8,0,0,0,16,0V72h16a8,8,0,0,0,0-16H88V40a8,8,0,0,0-16,0V56H56a8,8,0,0,0,0,16ZM184,192h-8v-8a8,8,0,0,0-16,0v8h-8a8,8,0,0,0,0,16h8v8a8,8,0,0,0,16,0v-8h8a8,8,0,0,0,0-16ZM219.31,80,80,219.31a16,16,0,0,1-22.62,0L36.68,198.63a16,16,0,0,1,0-22.63L176,36.69a16,16,0,0,1,22.63,0l20.68,20.68A16,16,0,0,1,219.31,80Zm-54.63,32L144,91.31l-96,96L68.68,208ZM208,68.69,187.31,48l-32,32L176,100.69Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M248,152a8,8,0,0,1-8,8H224v16a8,8,0,0,1-16,0V160H192a8,8,0,0,1,0-16h16V128a8,8,0,0,1,16,0v16h16A8,8,0,0,1,248,152ZM56,72H72V88a8,8,0,0,0,16,0V72h16a8,8,0,0,0,0-16H88V40a8,8,0,0,0-16,0V56H56a8,8,0,0,0,0,16ZM184,192h-8v-8a8,8,0,0,0-16,0v8h-8a8,8,0,0,0,0,16h8v8a8,8,0,0,0,16,0v-8h8a8,8,0,0,0,0-16ZM219.31,80,80,219.31a16,16,0,0,1-22.62,0L36.68,198.63a16,16,0,0,1,0-22.63L176,36.69a16,16,0,0,1,22.63,0l20.68,20.68A16,16,0,0,1,219.31,80ZM208,68.69,187.31,48l-32,32L176,100.69Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M246,152a6,6,0,0,1-6,6H222v18a6,6,0,0,1-12,0V158H192a6,6,0,0,1,0-12h18V128a6,6,0,0,1,12,0v18h18A6,6,0,0,1,246,152ZM56,70H74V88a6,6,0,0,0,12,0V70h18a6,6,0,0,0,0-12H86V40a6,6,0,0,0-12,0V58H56a6,6,0,0,0,0,12ZM184,194H174V184a6,6,0,0,0-12,0v10H152a6,6,0,0,0,0,12h10v10a6,6,0,0,0,12,0V206h10a6,6,0,0,0,0-12ZM217.9,78.59,78.58,217.9a14,14,0,0,1-19.8,0L38.09,197.21a14,14,0,0,1,0-19.8L177.41,38.1a14,14,0,0,1,19.8,0L217.9,58.79A14,14,0,0,1,217.9,78.59ZM167.51,112,144,88.49,46.58,185.9a2,2,0,0,0,0,2.83l20.69,20.68a2,2,0,0,0,2.82,0h0Zm41.9-44.73L188.73,46.59a2,2,0,0,0-2.83,0L152.48,80,176,103.52,209.41,70.1A2,2,0,0,0,209.41,67.27Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M48,64a8,8,0,0,1,8-8H72V40a8,8,0,0,1,16,0V56h16a8,8,0,0,1,0,16H88V88a8,8,0,0,1-16,0V72H56A8,8,0,0,1,48,64ZM184,192h-8v-8a8,8,0,0,0-16,0v8h-8a8,8,0,0,0,0,16h8v8a8,8,0,0,0,16,0v-8h8a8,8,0,0,0,0-16Zm56-48H224V128a8,8,0,0,0-16,0v16H192a8,8,0,0,0,0,16h16v16a8,8,0,0,0,16,0V160h16a8,8,0,0,0,0-16ZM219.31,80,80,219.31a16,16,0,0,1-22.62,0L36.68,198.63a16,16,0,0,1,0-22.63L176,36.69a16,16,0,0,1,22.63,0l20.68,20.68A16,16,0,0,1,219.31,80Zm-54.63,32L144,91.31l-96,96L68.68,208ZM208,68.69,187.31,48l-32,32L176,100.69Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M244,152a4,4,0,0,1-4,4H220v20a4,4,0,0,1-8,0V156H192a4,4,0,0,1,0-8h20V128a4,4,0,0,1,8,0v20h20A4,4,0,0,1,244,152ZM56,68H76V88a4,4,0,0,0,8,0V68h20a4,4,0,0,0,0-8H84V40a4,4,0,0,0-8,0V60H56a4,4,0,0,0,0,8ZM184,196H172V184a4,4,0,0,0-8,0v12H152a4,4,0,0,0,0,8h12v12a4,4,0,0,0,8,0V204h12a4,4,0,0,0,0-8ZM216.48,77.17,77.17,216.49a12,12,0,0,1-17,0L39.51,195.8a12,12,0,0,1,0-17L178.83,39.51a12,12,0,0,1,17,0L216.48,60.2A12,12,0,0,1,216.48,77.17ZM170.34,112,144,85.66,45.17,184.49a4,4,0,0,0,0,5.65l20.68,20.69a4,4,0,0,0,5.66,0Zm40.49-46.14L190.14,45.17a4,4,0,0,0-5.66,0L149.65,80,176,106.34l34.83-34.83A4,4,0,0,0,210.83,65.86Z"}))]]);var N=Object.defineProperty,F=Object.defineProperties,V=Object.getOwnPropertyDescriptors,T=Object.getOwnPropertySymbols,P=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable,O=(e,t,a)=>t in e?N(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,W=(e,t)=>{for(var a in t||(t={}))P.call(t,a)&&O(e,a,t[a]);if(T)for(var a of T(t))_.call(t,a)&&O(e,a,t[a]);return e},B=(e,t)=>F(e,V(t));let D=(0,s.forwardRef)((e,t)=>s.createElement(p.Z,B(W({ref:t},e),{weights:H})));D.displayName="MagicWand";let R=new Map([["bold",s.createElement(s.Fragment,null,s.createElement("path",{d:"M168.49,104.49,145,128l23.52,23.51a12,12,0,0,1-17,17L128,145l-23.51,23.52a12,12,0,0,1-17-17L111,128,87.51,104.49a12,12,0,0,1,17-17L128,111l23.51-23.52a12,12,0,0,1,17,17ZM236,128A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Z"}))],["duotone",s.createElement(s.Fragment,null,s.createElement("path",{d:"M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z",opacity:"0.2"}),s.createElement("path",{d:"M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["fill",s.createElement(s.Fragment,null,s.createElement("path",{d:"M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm37.66,130.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["light",s.createElement(s.Fragment,null,s.createElement("path",{d:"M164.24,100.24,136.48,128l27.76,27.76a6,6,0,1,1-8.48,8.48L128,136.48l-27.76,27.76a6,6,0,0,1-8.48-8.48L119.52,128,91.76,100.24a6,6,0,0,1,8.48-8.48L128,119.52l27.76-27.76a6,6,0,0,1,8.48,8.48ZM230,128A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z"}))],["regular",s.createElement(s.Fragment,null,s.createElement("path",{d:"M165.66,101.66,139.31,128l26.35,26.34a8,8,0,0,1-11.32,11.32L128,139.31l-26.34,26.35a8,8,0,0,1-11.32-11.32L116.69,128,90.34,101.66a8,8,0,0,1,11.32-11.32L128,116.69l26.34-26.35a8,8,0,0,1,11.32,11.32ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"}))],["thin",s.createElement(s.Fragment,null,s.createElement("path",{d:"M162.83,98.83,133.66,128l29.17,29.17a4,4,0,0,1-5.66,5.66L128,133.66,98.83,162.83a4,4,0,0,1-5.66-5.66L122.34,128,93.17,98.83a4,4,0,0,1,5.66-5.66L128,122.34l29.17-29.17a4,4,0,1,1,5.66,5.66ZM228,128A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z"}))]]);var G=Object.defineProperty,U=Object.defineProperties,$=Object.getOwnPropertyDescriptors,q=Object.getOwnPropertySymbols,z=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable,Y=(e,t,a)=>t in e?G(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,K=(e,t)=>{for(var a in t||(t={}))z.call(t,a)&&Y(e,a,t[a]);if(q)for(var a of q(t))J.call(t,a)&&Y(e,a,t[a]);return e},Q=(e,t)=>U(e,$(t));let X=(0,s.forwardRef)((e,t)=>s.createElement(p.Z,Q(K({ref:t},e),{weights:R})));function ee(e){let t="".concat(E().card," md:w-full md:h-fit sm:w-full h-fit md:w-[200px] cursor-pointer md:p-2"),a="".concat(E().text," dark:text-white");return(0,i.jsx)(j.Zb,{className:t,children:(0,i.jsx)("div",{className:"flex w-full",children:(0,i.jsxs)(j.aY,{className:"m-0 p-2 w-full flex flex-row",children:[A(e.title,e.color.toLowerCase()),(0,i.jsx)(j.SZ,{className:"".concat(a," sm:line-clamp-2 md:line-clamp-4 pt-1 break-words whitespace-pre-wrap max-w-full"),children:e.body})]})})})}function et(e){let t="".concat(E().card," md:h-fit sm:w-full h-fit cursor-pointer md:p-2");return(0,i.jsx)(j.Zb,{className:t,children:(0,i.jsx)("div",{className:"flex w-full items-center",children:(0,i.jsxs)(j.aY,{className:"m-0 p-1 w-full flex flex-row items-center",children:[(0,i.jsx)(D,{weight:"thin",className:"w-4 h-4 text-muted-foreground inline-flex mr-1 text-opacity-40"}),(0,i.jsx)(j.SZ,{className:"sm:line-clamp-2 md:line-clamp-4 break-words whitespace-pre-wrap max-w-full text-sm text-wrap text-black dark:text-white",children:e.prompt})]})})})}function ea(e){let t="".concat(E().card," md:w-full md:h-fit sm:w-full h-fit md:w-fit cursor-pointer m-2 md:p-1 animate-fade-in-up border-opacity-50 shadow-none"),a="".concat(E().text," dark:text-white");return(0,i.jsx)(j.Zb,{className:t,onClick:e.onClick,children:(0,i.jsx)("div",{className:"flex w-full h-full items-center justify-center",children:(0,i.jsxs)(j.aY,{className:"m-0 p-2 w-full flex flex-row items-center justify-center",children:[A(e.title,e.color.toLowerCase()),(0,i.jsx)(j.SZ,{className:"".concat(a," sm:line-clamp-2 md:line-clamp-4 pt-1 break-words whitespace-pre-wrap max-w-full text-center"),children:e.body}),(0,i.jsx)(X,{className:"w-6 h-6 text-muted-foreground inline-flex ml-1"})]})})})}X.displayName="XCircle";var en=a(14308),eo=a(33494),ei=a(56937),er=a(84671),el=a(59199),es=a(7436),ec=a(99376),ep=a(19378),ed=a(25427),em=a(57054),eh=a(62869),eu=a(37104),eg=a(17814);function ef(e){return e.isMobileWidth?(0,i.jsx)(eg.dy,{open:!0,onClose:()=>e.setShowLoginPrompt(!1),children:(0,i.jsx)(eg.sc,{children:(0,i.jsx)(ex,{...e})})}):(0,i.jsx)("div",{className:"fixed inset-x-0 bottom-8 z-30 flex items-center justify-center",children:(0,i.jsx)(ex,{...e})})}function ex(e){return(0,i.jsxs)(j.Zb,{className:"rounded-lg p-6 flex flex-col items-center justify-between gap-8 md:w-fit border-none md:flex-row md:z-30 md:shadow-lg",children:[!e.isMobileWidth&&(0,i.jsx)(eu.S6,{className:"w-12 h-auto"}),(0,i.jsxs)("div",{className:"flex flex-col items-start justify-center gap-8 md:gap-2",children:[(0,i.jsx)(j.Ol,{className:"p-0 text-xl font-bold",children:"Welcome to Khoj!"}),(0,i.jsx)(j.SZ,{children:"Sign in to get started with Khoj, your AI research assistant."})]}),(0,i.jsx)(eh.z,{variant:"default",className:"p-6 text-lg",onClick:()=>e.setShowLoginPrompt(!0),children:"Get started for free"})]})}var ew=a(60729),ev=a(34124),eb=a(6512),ey=a(84190);function ej(e){let{agents:t,agentIcons:a,selectedAgent:n,isPopoverOpen:o,debouncedHoveredAgent:r,setHoveredAgent:l,setIsPopoverOpen:s,setSelectedAgent:c,chatInputRef:p,openAgentEditCard:d,userConfig:m,isMobileWidth:h}=e;return(0,i.jsxs)(ep.x,{className:"w-full max-w-[600px] mx-auto",children:[(0,i.jsx)("div",{className:"flex pb-2 gap-2 items-center justify-center",children:t.map((e,t)=>(0,i.jsxs)(em.J2,{open:o&&r===e.slug,onOpenChange:e=>{e||(l(null),s(!1))},children:[(0,i.jsx)(em.xo,{asChild:!0,children:(0,i.jsx)(j.Zb,{className:"".concat(n===e.slug?(0,er.Iu)(e.color):"border-stone-100 dark:border-neutral-700 text-muted-foreground","\n hover:cursor-pointer rounded-lg px-2 py-2"),onDoubleClick:()=>d(e.slug),onClick:()=>{var t;c(e.slug),null===(t=p.current)||void 0===t||t.focus(),l(null),s(!1)},onMouseEnter:()=>l(e.slug),onMouseLeave:()=>{l(null),s(!1)},children:(0,i.jsxs)(j.ll,{className:"text-center text-md font-medium flex justify-center items-center whitespace-nowrap",children:[a[t]," ",e.name]})})}),(0,i.jsx)(em.yk,{className:"w-80 p-0 border-none bg-transparent shadow-none",onMouseLeave:()=>{l(null),s(!1)},children:(0,i.jsx)(ed.EY,{data:e,userProfile:null,isMobileWidth:h||!1,showChatButton:!1,editCard:!1,filesOptions:[],selectedChatModelOption:"",agentSlug:"",isSubscribed:(0,ei.T8)(m),setAgentChangeTriggered:()=>{},modelOptions:[],inputToolOptions:{},outputModeOptions:{}})})]},"".concat(t,"-").concat(e.slug)))}),(0,i.jsx)(ep.B,{orientation:"horizontal"})]})}function eL(e){var t,a,n,o,r,p,d;let[m,h]=(0,s.useState)(""),[u,g]=(0,s.useState)(""),[f,x]=(0,s.useState)(S.$.MESSAGE),[w,v]=(0,s.useState)([]),[b,j]=(0,s.useState)(!1),[L,E]=(0,s.useState)(""),[I,Z]=(0,s.useState)(C.slice(0,3)),[A,H]=(0,s.useState)([]),[N,F]=(0,s.useState)(null),[V,T]=(0,s.useState)(null),P=(0,es.Nr)(V,500),[_,O]=(0,s.useState)(!1),[W,B]=(0,s.useState)("khoj"),[D,R]=(0,s.useState)([]),[G,U]=(0,s.useState)([]),$=(0,s.useRef)(null),[q,z]=(0,s.useState)(!1),J=(0,ec.useRouter)(),Y=(0,ec.useSearchParams)().get("q");(0,s.useEffect)(()=>{Y&&h(decodeURIComponent(Y))},[Y]),(0,s.useEffect)(()=>{P&&O(!0)},[P]);let K=e.onConversationIdChange,{data:Q,error:X}=(0,c.ZP)("agents",()=>window.fetch("/api/agents").then(e=>e.json()).catch(e=>console.log(e)),{revalidateOnFocus:!1});return(0,s.useEffect)(()=>{var t,a;if(e.isLoadingUserConfig)return;let n=new Date,o=n.getDay(),i=n.getHours()>=17||4>n.getHours()?"evening":n.getHours()>=12?"afternoon":"morning",r=(null===(t=e.userConfig)||void 0===t?void 0:t.given_name)?", ".concat(null===(a=e.userConfig)||void 0===a?void 0:a.given_name):"",l=["What would you like to get done".concat(r,"?"),"Hey".concat(r,"! How can I help?"),"Good ".concat(i).concat(r,"! What's on your mind?"),"Ready to breeze through ".concat(["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][o],"?"),"Let's navigate your ".concat(["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][o]," workload")];E(l[Math.floor(Math.random()*l.length)])},[e.isLoadingUserConfig,e.userConfig]),(0,s.useEffect)(()=>{let e=(Q||[]).filter(e=>null!=e);U(e),B(e.length>1?e[0].slug:"khoj"),R(e.map(e=>(0,M.TI)(e.icon,e.color)))},[Q]),(0,s.useEffect)(()=>{(async()=>{if(m&&!b){j(!0);try{let e=await (0,el.A0)(W||"khoj");null==K||K(e),localStorage.setItem("message",m),w.length>0&&localStorage.setItem("images",JSON.stringify(w)),window.location.href="/chat?conversationId=".concat(e)}catch(e){console.error("Error creating new conversation:",e),j(!1)}h(""),v([])}})(),(m||w.length>0)&&j(!0)},[W,m,b,K]),(0,s.useEffect)(()=>{let e=document.querySelector("[data-radix-scroll-area-viewport]"),t=()=>{T(null),O(!1)};return null==e||e.addEventListener("scroll",t),()=>null==e?void 0:e.removeEventListener("scroll",t)},[]),(0,i.jsxs)("div",{className:"".concat(l().homeGreetings," w-full md:w-auto"),children:[q&&(0,i.jsx)(eo.Z,{onOpenChange:z,isMobileWidth:e.isMobileWidth}),!e.isLoggedIn&&(0,i.jsx)(ef,{isMobileWidth:e.isMobileWidth,setShowLoginPrompt:z}),(0,i.jsxs)("div",{className:"w-full text-center justify-end content-end",children:[(0,i.jsx)("div",{className:"items-center",children:(0,i.jsx)("h1",{className:"text-2xl md:text-3xl text-center w-fit pb-6 pt-4 px-4 mx-auto",children:L})}),!e.isMobileWidth&&(0,i.jsx)(ej,{agents:G,agentIcons:D,selectedAgent:W,isPopoverOpen:_,debouncedHoveredAgent:P,setHoveredAgent:T,setIsPopoverOpen:O,setSelectedAgent:B,chatInputRef:$,openAgentEditCard:e=>{J.push("/agents?agent=".concat(e))},userConfig:e.userConfig})]}),(0,i.jsxs)("div",{className:"mx-auto ".concat(e.isMobileWidth?"w-full":"w-full max-w-screen-md"),children:[!e.isMobileWidth&&(0,i.jsx)("div",{className:"w-full ".concat(l().inputBox," shadow-lg bg-background align-middle items-center justify-center px-3 py-1 dark:bg-neutral-700 border-stone-100 dark:border-none dark:shadow-none rounded-2xl"),children:(0,i.jsx)(S.a,{isLoggedIn:e.isLoggedIn,prefillMessage:u,focus:f,sendMessage:e=>h(e),sendImage:e=>v(t=>[...t,e]),sendDisabled:b,chatOptionsData:e.chatOptionsData,conversationId:null,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,agentColor:null===(t=G.find(e=>e.slug===W))||void 0===t?void 0:t.color,ref:$,setTriggeredAbort:()=>{}})}),0==A.length&&(0,i.jsx)("div",{className:"".concat(l().suggestions," w-full ").concat(e.isMobileWidth&&C.length>3?"grid grid-cols-2":"grid grid-cols-3",' "justify-center items-center"'),children:I.map((t,a)=>(0,i.jsx)("div",{onClick:a=>{e.isLoggedIn?function(e){g(e.intent);let t=k[e.type]||[];F(e),H(t),x(e.focus)}(t):(a.preventDefault(),a.stopPropagation(),z(!0))},children:(0,i.jsx)(ee,{title:t.type,body:t.actionTagline,color:t.color},t.type+Math.random())},"".concat(t.type," ").concat(t.actionTagline)))}),0==A.length&&I.length<C.length&&(0,i.jsx)("div",{className:"flex items-center justify-center margin-auto",children:(0,i.jsxs)("button",{onClick:function(){Z(C)},className:"m-2 p-1.5 rounded-lg dark:hover:bg-[var(--background-color)] hover:bg-stone-100 border border-stone-100 text-sm text-stone-500 dark:text-stone-300 dark:border-neutral-700",children:["Show All ",(0,i.jsx)(y,{className:"h-4 w-4 inline"})]})}),N&&(0,i.jsx)(ea,{title:N.type,body:N.actionTagline,color:N.color,onClick:()=>{g(""),F(null),H([]),x(S.$.MESSAGE)}}),A.length>0&&(0,i.jsx)("div",{className:"w-full ".concat(e.isMobileWidth?"grid":"grid grid-cols-1"," justify-center items-center gap-2 p-2"),children:A.map((e,t)=>(0,i.jsx)("div",{className:"w-full cursor-pointer animate-fade-in-up",onClick:t=>{h(e.prompt)},children:(0,i.jsx)(et,{prompt:e.prompt},e.prompt)},"".concat(e.prompt," ").concat(t)))})]}),e.isMobileWidth&&(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{className:"".concat(l().inputBox," align-middle items-center justify-center pb-3 mx-1 mb-2 border-none"),children:[(0,i.jsxs)(ey.h_,{children:[(0,i.jsx)(ey.$F,{children:(0,i.jsxs)(eh.z,{className:"w-full m-2 p-0",variant:"outline",children:[W?(0,M.TI)(null!==(p=null===(a=G.find(e=>e.slug===W))||void 0===a?void 0:a.icon)&&void 0!==p?p:"",null!==(d=null===(n=G.find(e=>e.slug===W))||void 0===n?void 0:n.color)&&void 0!==d?d:""):(0,i.jsx)(y,{className:"h-5 w-5"}),W?"".concat(null===(o=G.find(e=>e.slug===W))||void 0===o?void 0:o.name):"Select Agent"]})}),(0,i.jsx)(ey.AW,{align:"end",className:"overflow-y-scroll h-96",children:D.map((e,t)=>(0,i.jsxs)(ey.Xi,{onClick:()=>{var e;B(G[t].slug),null===(e=$.current)||void 0===e||e.focus()},children:[e," ",G[t].name]},"".concat(t,"-").concat(G[t].slug)))})]}),(0,i.jsx)("div",{className:"".concat(l().inputBox," pt-4 shadow-[0_-20px_25px_-5px_rgba(0,0,0,0.1)] dark:bg-neutral-700 bg-background rounded-2xl mb-2 border-none"),children:(0,i.jsx)(S.a,{isLoggedIn:e.isLoggedIn,sendMessage:e=>h(e),sendImage:e=>v(t=>[...t,e]),sendDisabled:b,chatOptionsData:e.chatOptionsData,conversationId:null,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,agentColor:null===(r=G.find(e=>e.slug===W))||void 0===r?void 0:r.color,ref:$,setTriggeredAbort:()=>{}})})]})})]})}function eE(){let[e,t]=(0,s.useState)(null),[a,n]=(0,s.useState)(!0),[o,r]=(0,s.useState)(null),[c,p]=(0,s.useState)(null),d=(0,es.IC)(),{data:m,isLoading:h}=(0,ei.h2)(!0),[u,g]=(0,s.useState)(null),{data:f,error:x,isLoading:w}=(0,ei.GW)();return((0,s.useEffect)(()=>{g(m)},[m]),(0,s.useEffect)(()=>{c&&localStorage.setItem("uploadedFiles",JSON.stringify(c))},[c]),(0,s.useEffect)(()=>{fetch("/api/chat/options").then(e=>e.json()).then(e=>{n(!1),e&&t(e)}).catch(e=>{console.error(e)})},[]),a)?(0,i.jsx)(en.Z,{}):(0,i.jsxs)(ew.Hn,{children:[(0,i.jsx)(ev.S,{conversationId:o}),(0,i.jsxs)(ew.kV,{children:[(0,i.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,i.jsx)(ew.vP,{className:"-ml-1"}),(0,i.jsx)(eb.Z,{orientation:"vertical",className:"mr-2 h-4"}),d?(0,i.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,i.jsx)(eu.VO,{className:"h-auto w-16"})}):(0,i.jsx)("h2",{className:"text-lg",children:"Ask Anything"})]}),(0,i.jsxs)("div",{className:"".concat(l().main," ").concat(l().chatLayout),children:[(0,i.jsx)("title",{children:"Khoj AI - Your Second Brain"}),(0,i.jsx)("div",{className:"".concat(l().chatBox),children:(0,i.jsx)("div",{className:"".concat(l().chatBoxBody),children:!w&&(0,i.jsx)(eL,{isLoggedIn:!!f,chatOptionsData:e,setUploadedFiles:p,isMobileWidth:d,onConversationIdChange:e=>{r(e)},userConfig:u,isLoadingUserConfig:h})})})]})]})]})}},99376:function(e,t,a){"use strict";var n=a(35475);a.o(n,"useRouter")&&a.d(t,{useRouter:function(){return n.useRouter}}),a.o(n,"useSearchParams")&&a.d(t,{useSearchParams:function(){return n.useSearchParams}})},47960:function(){},64670:function(e){e.exports={card:"suggestions_card__fbiZo",title:"suggestions_title__vNozc",text:"suggestions_text__J_IfY"}},76777:function(e){e.exports={main:"page_main__nw1Wk",suggestions:"page_suggestions__Y8EqU",inputBox:"page_inputBox__LrcZ4",chatBodyFull:"page_chatBodyFull__Qu2T2",chatBody:"page_chatBody__IirQQ",chatLayout:"page_chatLayout__bJUjP",chatBox:"page_chatBox__gsR6V",titleBar:"page_titleBar__3btUI",chatBoxBody:"page_chatBoxBody__xORKr",homeGreetings:"page_homeGreetings__VjQhh"}}},function(e){e.O(0,[3587,6250,216,2663,3861,9259,8667,4363,4447,6663,4357,7647,2327,5477,5427,2971,2117,1744],function(){return e(e.s=1507)}),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[244,3317,8459,7138],{34780:function(e,t,n){Promise.resolve().then(n.bind(n,85147))},7436:function(e,t,n){"use strict";n.d(t,{EK:function(){return i},Gv:function(){return l},IC:function(){return _},Iy:function(){return s},LF:function(){return u},Nr:function(){return m},k6:function(){return a},o0:function(){return f},xq:function(){return d}});var r=n(2265),o=n(63861);let c=()=>window.fetch("https://ipapi.co/json").then(e=>e.json()).catch(e=>console.log(e)),u=e=>e.replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase());function i(){console.log("%c %s","font-family:monospace",'\n __ __ __ __ ______ __ _____ __\n/\\ \\/ / /\\ \\_\\ \\ /\\ __ \\ /\\ \\ /\\ __ \\ /\\ \\\n\\ \\ _"-. \\ \\ __ \\ \\ \\ \\/\\ \\ _\\_\\ \\ \\ \\ __ \\ \\ \\ \\\n \\ \\_\\ \\_\\ \\ \\_\\ \\_\\ \\ \\_____\\ /\\_____\\ \\ \\_\\ \\_\\ \\ \\_\\\n \\/_/\\/_/ \\/_/\\/_/ \\/_____/ \\/_____/ \\/_/\\/_/ \\/_/\n\n\nGreetings traveller,\n\nI am ✨Khoj✨, your open-source, personal AI copilot.\n\nSee my source code at https://github.com/khoj-ai/khoj\nRead my operating manual at https://docs.khoj.dev\n')}function a(){let{data:e,error:t,isLoading:n}=(0,o.ZP)("/api/ip",c,{revalidateOnFocus:!1});return{locationData:e,locationDataError:t,locationDataLoading:n}}function _(){let[e,t]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{let e=()=>{window.innerWidth<=768?t(!0):t(!1)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}let s=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{attributes:!0,characterData:!0,childList:!0,subtree:!0};r.useEffect(()=>{if(e.current){let r=new MutationObserver(t);return r.observe(e.current,n),()=>r.disconnect()}},[e,t,n])};function l(){let[e,t]=(0,r.useState)(!1),[n,o]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{"dark"===localStorage.getItem("theme")?(document.documentElement.classList.add("dark"),t(!0)):"light"===localStorage.getItem("theme")?(document.documentElement.classList.remove("dark"),t(!1)):window.matchMedia("(prefers-color-scheme: dark)").matches&&(document.documentElement.classList.add("dark"),t(!0)),o(!0)},[]),(0,r.useEffect)(()=>{n&&(e?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),localStorage.setItem("theme",e?"dark":"light"))},[e,n]),[e,t]}let d=e=>e<1024?"".concat(e," B"):e<1048576?"".concat((e/1024).toFixed(2)," KB"):"".concat((e/1048576).toFixed(2)," MB");function m(e,t){let[n,o]=(0,r.useState)(e);return(0,r.useEffect)(()=>{let n=setTimeout(()=>{o(e)},t);return()=>{clearTimeout(n)}},[e,t]),n}let f=e=>{try{let t=new Date(e),n=new Date,r=Math.floor((n.getTime()-t.getTime())/6e4);if(r<1)return"just now";if(r<60)return"".concat(r," minutes ago");if(r<120)return"1 hour ago";if(r<1440)return"".concat(Math.floor(r/60)," hours ago");return new Intl.DateTimeFormat("en-US",{month:"long",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0,timeZoneName:"short"}).format(t)}catch(t){return console.error("Error formatting date:",t),e}}},85147:function(e,t,n){"use strict";n.d(t,{ThemeProvider:function(){return c}});var r=n(57437),o=n(7436);function c(e){let{children:t}=e,[n,c]=(0,o.Gv)();return(0,r.jsx)(r.Fragment,{children:t})}}},function(e){e.O(0,[3861,2971,2117,1744],function(){return e(e.s=34780)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[244,8459,7138,3317],{34780:function(e,t,n){Promise.resolve().then(n.bind(n,85147))},7436:function(e,t,n){"use strict";n.d(t,{EK:function(){return i},Gv:function(){return l},IC:function(){return _},Iy:function(){return s},LF:function(){return u},Nr:function(){return m},k6:function(){return a},o0:function(){return f},xq:function(){return d}});var r=n(2265),o=n(63861);let c=()=>window.fetch("https://ipapi.co/json").then(e=>e.json()).catch(e=>console.log(e)),u=e=>e.replace(/\w\S*/g,e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase());function i(){console.log("%c %s","font-family:monospace",'\n __ __ __ __ ______ __ _____ __\n/\\ \\/ / /\\ \\_\\ \\ /\\ __ \\ /\\ \\ /\\ __ \\ /\\ \\\n\\ \\ _"-. \\ \\ __ \\ \\ \\ \\/\\ \\ _\\_\\ \\ \\ \\ __ \\ \\ \\ \\\n \\ \\_\\ \\_\\ \\ \\_\\ \\_\\ \\ \\_____\\ /\\_____\\ \\ \\_\\ \\_\\ \\ \\_\\\n \\/_/\\/_/ \\/_/\\/_/ \\/_____/ \\/_____/ \\/_/\\/_/ \\/_/\n\n\nGreetings traveller,\n\nI am ✨Khoj✨, your open-source, personal AI copilot.\n\nSee my source code at https://github.com/khoj-ai/khoj\nRead my operating manual at https://docs.khoj.dev\n')}function a(){let{data:e,error:t,isLoading:n}=(0,o.ZP)("/api/ip",c,{revalidateOnFocus:!1});return{locationData:e,locationDataError:t,locationDataLoading:n}}function _(){let[e,t]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{let e=()=>{window.innerWidth<=768?t(!0):t(!1)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e}let s=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{attributes:!0,characterData:!0,childList:!0,subtree:!0};r.useEffect(()=>{if(e.current){let r=new MutationObserver(t);return r.observe(e.current,n),()=>r.disconnect()}},[e,t,n])};function l(){let[e,t]=(0,r.useState)(!1),[n,o]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{"dark"===localStorage.getItem("theme")?(document.documentElement.classList.add("dark"),t(!0)):"light"===localStorage.getItem("theme")?(document.documentElement.classList.remove("dark"),t(!1)):window.matchMedia("(prefers-color-scheme: dark)").matches&&(document.documentElement.classList.add("dark"),t(!0)),o(!0)},[]),(0,r.useEffect)(()=>{n&&(e?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),localStorage.setItem("theme",e?"dark":"light"))},[e,n]),[e,t]}let d=e=>e<1024?"".concat(e," B"):e<1048576?"".concat((e/1024).toFixed(2)," KB"):"".concat((e/1048576).toFixed(2)," MB");function m(e,t){let[n,o]=(0,r.useState)(e);return(0,r.useEffect)(()=>{let n=setTimeout(()=>{o(e)},t);return()=>{clearTimeout(n)}},[e,t]),n}let f=e=>{try{let t=new Date(e),n=new Date,r=Math.floor((n.getTime()-t.getTime())/6e4);if(r<1)return"just now";if(r<60)return"".concat(r," minutes ago");if(r<120)return"1 hour ago";if(r<1440)return"".concat(Math.floor(r/60)," hours ago");return new Intl.DateTimeFormat("en-US",{month:"long",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",hour12:!0,timeZoneName:"short"}).format(t)}catch(t){return console.error("Error formatting date:",t),e}}},85147:function(e,t,n){"use strict";n.d(t,{ThemeProvider:function(){return c}});var r=n(57437),o=n(7436);function c(e){let{children:t}=e,[n,c]=(0,o.Gv)();return(0,r.jsx)(r.Fragment,{children:t})}}},function(e){e.O(0,[3861,2971,2117,1744],function(){return e(e.s=34780)}),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2797],{94114:function(e,s,t){Promise.resolve().then(t.bind(t,98537))},98537:function(e,s,t){"use strict";t.r(s),t.d(s,{default:function(){return el}});var l=t(57437),a=t(95186),n=t(2265),i=t(41816),r=t.n(i),c=t(19378),o=t(66070),d=t(73925),u=t(75216),h=t(91521),x=t(41648),m=t(41317),f=t(19841),j=t(45178),p=t(58619),N=t(2452),g=t(77168),v=t(87296),w=t(89203),b=t(11167),y=t(38513),S=t(35099),E=t(64697),T=t(74915),k=t(62869),C=t(27648),_=t(7436),D=t(60729),F=t(34124),I=t(6512),A=t(37104),O=t(14308),L=t(26110),R=t(77992),z=t(84190),M=t(92451),P=t(10407),Z=t(67782),W=t(94508);let U=e=>{let{className:s,...t}=e;return(0,l.jsx)("nav",{role:"navigation","aria-label":"pagination",className:(0,W.cn)("mx-auto flex w-full justify-center",s),...t})};U.displayName="Pagination";let Y=n.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,l.jsx)("ul",{ref:s,className:(0,W.cn)("flex flex-row items-center gap-1",t),...a})});Y.displayName="PaginationContent";let K=n.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,l.jsx)("li",{ref:s,className:(0,W.cn)("",t),...a})});K.displayName="PaginationItem";let B=e=>{let{className:s,isActive:t,size:a="icon",...n}=e;return(0,l.jsx)("a",{"aria-current":t?"page":void 0,className:(0,W.cn)((0,k.d)({variant:t?"outline":"ghost",size:a}),"no-underline",s),...n})};B.displayName="PaginationLink";let V=e=>{let{className:s,...t}=e;return(0,l.jsxs)(B,{"aria-label":"Go to previous page",size:"default",className:(0,W.cn)("gap-1 pl-2.5",s),...t,children:[(0,l.jsx)(M.Z,{className:"h-4 w-4"}),(0,l.jsx)("span",{children:"Previous"})]})};V.displayName="PaginationPrevious";let G=e=>{let{className:s,...t}=e;return(0,l.jsxs)(B,{"aria-label":"Go to next page",size:"default",className:(0,W.cn)("gap-1 pr-2.5",s),...t,children:[(0,l.jsx)("span",{children:"Next"}),(0,l.jsx)(P.Z,{className:"h-4 w-4"})]})};G.displayName="PaginationNext";let X=e=>{let{className:s,...t}=e;return(0,l.jsxs)("span",{"aria-hidden":!0,className:(0,W.cn)("flex h-9 w-9 items-center justify-center",s),...t,children:[(0,l.jsx)(Z.Z,{className:"h-4 w-4"}),(0,l.jsx)("span",{className:"sr-only",children:"More pages"})]})};X.displayName="PaginationEllipsis";var $=t(23518),q=t(57054),J=t(59199),H=t(32759);function Q(e){let{file:s,setSelectedFile:t,setSelectedFileFullText:a,handleDownload:n,handleDelete:i,isDeleting:r,selectedFileFullText:d}=e;return(0,l.jsxs)(o.Zb,{className:"animate-fade-in-up bg-secondary h-52",children:[(0,l.jsx)(o.Ol,{className:"p-2",children:(0,l.jsxs)(o.ll,{className:"flex items-center gap-2 justify-between",title:s.file_name,children:[(0,l.jsxs)(L.Vq,{children:[(0,l.jsx)(L.hg,{asChild:!0,children:(0,l.jsx)("div",{className:"text-sm font-medium truncate hover:text-clip hover:whitespace-normal cursor-pointer",onClick:()=>{a(""),t(s.file_name)},children:s.file_name.split("/").pop()})}),(0,l.jsxs)(L.cZ,{className:"max-w-fit",children:[(0,l.jsx)(L.fK,{children:(0,l.jsx)(L.$N,{children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[s.file_name.split("/").pop(),(0,l.jsx)(k.z,{variant:"ghost",title:"Download as plaintext",onClick:()=>n(s.file_name,s.raw_text),children:(0,l.jsx)(x.U,{className:"h-4 w-4"})})]})})}),(0,l.jsx)(c.x,{className:"h-[50vh] w-[80vw]",children:(0,l.jsxs)("p",{className:"whitespace-pre-wrap break-words text-sm font-normal word-wrap",children:[!d&&(0,l.jsx)(O.l,{className:"mt-4",message:"Loading",iconClassName:"h-5 w-5"}),d]})})]})]}),(0,l.jsxs)(z.h_,{children:[(0,l.jsx)(z.$F,{children:(0,l.jsx)(k.z,{variant:"ghost",children:(0,l.jsx)(m.F,{className:"h-4 w-4"})})}),(0,l.jsx)(z.AW,{className:"flex flex-col gap-0 w-fit",children:(0,l.jsx)(z.Xi,{className:"p-0",children:(0,l.jsxs)(k.z,{variant:"ghost",className:"flex items-center gap-2 p-1 text-sm",onClick:()=>{i(s.file_name)},children:[(0,l.jsx)(f.r,{className:"h-4 w-4"}),(0,l.jsx)("span",{className:"text-xs",children:r?"Deleting...":"Delete"})]})})})]})]})}),(0,l.jsx)(o.aY,{className:"p-2",children:(0,l.jsx)(c.x,{className:"h-24 bg-background rounded-lg",children:(0,l.jsxs)("p",{className:"whitespace-pre-wrap break-words text-sm font-normal text-muted-foreground p-2 h-full",children:[s.raw_text.slice(0,100),"..."]})})}),(0,l.jsx)(o.eW,{className:"flex justify-end gap-2 p-2",children:(0,l.jsx)("div",{className:"text-muted-foreground text-xs",children:(0,_.o0)(s.updated_at)})})]})}function ee(e){var s;let t=e.note,a=(t.additional.file||"").startsWith("http"),n=a?t.additional.heading:t.additional.file.split("/").pop();return(0,l.jsxs)(o.Zb,{className:"bg-secondary h-full shadow-sm rounded-lg border border-muted mb-4 animate-fade-in-up",children:[(0,l.jsx)(o.Ol,{children:(0,l.jsxs)(o.ll,{className:"inline-flex gap-2",children:["notion"===(s=t.additional.source)?(0,l.jsx)(d.F,{className:"text-muted-foreground"}):"github"===s?(0,l.jsx)(u.b,{className:"text-muted-foreground"}):(0,l.jsx)(h.S,{className:"text-muted-foreground"}),n]})}),(0,l.jsxs)(o.aY,{children:[(0,l.jsx)("div",{className:"line-clamp-4 text-muted-foreground",children:t.entry}),(0,l.jsxs)(k.z,{onClick:()=>e.setFocusSearchResult(t),variant:"ghost",className:"p-0 mt-2 text-orange-400 hover:bg-inherit",children:["See content",(0,l.jsx)(j.o,{className:"inline ml-2"})]})]}),a&&(0,l.jsx)(o.eW,{children:(0,l.jsxs)("a",{href:t.additional.file,target:"_blank",className:"underline text-sm bg-muted p-1 rounded-lg text-muted-foreground",children:[(0,l.jsx)(p.a,{className:"inline m-2"}),t.additional.file]})})]})}let es=e=>{let{setUploadedFiles:s}=e,[t,a]=(0,n.useState)(!1),[i,r]=(0,n.useState)(null),[c,o]=(0,n.useState)(null),[d,u]=(0,n.useState)(!1),[h,x]=(0,n.useState)(0),m=(0,n.useRef)(null);function f(e){(0,J.ko)(e,r,u,o,s)}return(0,n.useEffect)(()=>{if(!d&&(x(0),!i&&!c)){let e=new KeyboardEvent("keydown",{key:"Escape"});document.dispatchEvent(e)}if(d){let e=setInterval(()=>{x(e=>{let s=e+(Math.floor(5*Math.random())+1);return s<100?s:100})},800);return()=>clearInterval(e)}},[d]),(0,l.jsxs)(L.Vq,{children:[(0,l.jsx)(L.hg,{asChild:!0,children:(0,l.jsxs)(k.z,{variant:"secondary",className:"mt-4",children:[(0,l.jsx)(N.a,{className:"h-4 w-4 mr-2"}),"Add Documents"]})}),(0,l.jsxs)(L.cZ,{children:[(0,l.jsxs)(L.fK,{children:[(0,l.jsx)(L.$N,{children:"Build Your Knowledge Base"}),(0,l.jsx)(L.Be,{children:"Add context for your Khoj knowledge base. Quickly search and get personalized answers from your documents."})]}),(0,l.jsxs)("div",{className:"flex flex-col h-full",onDragOver:function(e){e.preventDefault(),a(!0)},onDragLeave:function(e){e.preventDefault(),a(!1)},onDrop:function(e){e.preventDefault(),a(!1),e.dataTransfer.files&&f(e.dataTransfer.files)},onClick:function(){m&&m.current&&m.current.click()},children:[(0,l.jsx)("input",{type:"file",multiple:!0,ref:m,style:{display:"none"},onChange:function(e){e.target.files&&f(e.target.files)}}),(0,l.jsx)("div",{className:"flex-none p-4",children:d&&(0,l.jsx)(H.E,{indicatorColor:"bg-slate-500",className:"w-full h-2 rounded-full",value:h})}),i&&(0,l.jsxs)("div",{className:"flex-none p-4 border-b rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(g.v,{className:"h-6 w-6"}),(0,l.jsx)("span",{children:i})]}),(0,l.jsx)(k.z,{onClick:()=>r(null),className:"mt-2",variant:"ghost",children:"Dismiss"})]}),c&&(0,l.jsxs)("div",{className:"flex-none p-4 border-b rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(g.v,{className:"h-6 w-6"}),(0,l.jsx)("span",{children:c})]}),(0,l.jsx)(k.z,{onClick:()=>o(null),className:"mt-2",variant:"ghost",children:"Dismiss"})]}),(0,l.jsx)("div",{className:"flex-none p-4 border-b ".concat(t?"animate-pulse border-blue-500 bg-blue-500 bg-opacity-25":"bg-secondary"," rounded-lg"),children:(0,l.jsx)("div",{className:"flex items-center justify-center w-full h-32 border-2 border-dashed border-gray-300 rounded-lg",children:t?(0,l.jsxs)("div",{className:"flex items-center justify-center w-full h-full",children:[(0,l.jsx)(v.u,{className:"h-6 w-6 mr-2"}),(0,l.jsx)("span",{children:"Drop files to upload"})]}):(0,l.jsxs)("div",{className:"flex items-center justify-center w-full h-full",children:[(0,l.jsx)(w.v,{className:"h-6 w-6 mr-2"}),(0,l.jsx)("span",{children:"Drag and drop files here"})]})})})]})]})]})};function et(e){let[s,t]=(0,n.useState)(!1),[a,i]=(0,n.useState)(e.inputText||""),[r,c]=(0,n.useState)(!1),[o,d]=(0,n.useState)("");return(0,n.useEffect)(()=>{e.inputText?"INITIALIZE"===e.inputText?(t(!0),d("")):(d(e.inputText),e.allFiles.includes(e.inputText)&&i(e.inputText)):d("")},[e.inputText]),(0,n.useEffect)(()=>{o&&!e.allFiles.includes(o)?(c(!0),i("")):o?(c(!1),i(o)):(c(!1),i(""))},[o,e.allFiles]),(0,n.useEffect)(()=>{s||e.onClose()},[s]),(0,l.jsxs)(q.J2,{open:s||r&&!!o,onOpenChange:t,children:[(0,l.jsx)(q.xo,{asChild:!0,children:(0,l.jsxs)(k.z,{variant:"outline",role:"combobox","aria-expanded":s,className:'justify-between" '.concat(e.isMobileWidth?"w-full":"w-[200px]"),children:[a?e.isMobileWidth?"✔️":"Selected":e.isMobileWidth?" ":"Select file",(0,l.jsx)(b.o,{className:"opacity-50"})]})}),(0,l.jsx)(q.yk,{className:"w-[200px] p-0",children:(0,l.jsxs)($.mY,{children:[(0,l.jsx)($.sZ,{placeholder:"Search files...",value:o,onInput:e=>d(e.currentTarget.value)}),(0,l.jsxs)($.e8,{children:[(0,l.jsx)($.rb,{children:"No files found."}),(0,l.jsx)($.fu,{children:e.allFiles.map(s=>(0,l.jsxs)($.di,{value:s,onSelect:s=>{i(s===a?"":s),t(!1),e.onChooseFile(s)},children:[s,(0,l.jsx)(y.J,{className:(0,W.cn)("ml-auto",a===s?"opacity-100":"opacity-0")})]},s))})]})]})})]})}function el(){let[e,s]=(0,n.useState)(""),[t,i]=(0,n.useState)(null),[d,u]=(0,n.useState)(!1),h=(0,n.useRef)(null),[x,m]=(0,n.useState)(null),[f,j]=(0,n.useState)([]),[N,g]=(0,n.useState)(null),[v,w]=(0,n.useState)(!0),[b,y]=(0,n.useState)([]),L=(0,n.useRef)(null),[z,M]=(0,n.useState)(null),[P,Z]=(0,n.useState)(void 0),[W,$]=(0,n.useState)(null),[q,J]=(0,n.useState)(!1),[H,el]=(0,n.useState)([]),[ea,en]=(0,n.useState)(0),[ei,er]=(0,n.useState)(1),{toast:ec}=(0,R.pm)(),eo=(0,_.IC)();function ed(e){if(s(e),!e.trim()){i(null);return}L.current&&clearTimeout(L.current),e.trim()&&(L.current=setTimeout(()=>{eu()},750))}function eu(){!d&&e.trim()&&(u(!0),fetch("/api/search?q=".concat(encodeURIComponent(e),"&client=web"),{method:"GET",headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{i(e),u(!1)}).catch(e=>{console.error("Error:",e)}))}(0,n.useEffect)(()=>{fetch("/api/content/computer",{method:"GET",headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{y(e)}).catch(e=>{console.error("Error loading files:",e)})},[]),(0,n.useEffect)(()=>{let s=e.match(/file:([^"\s]*|"[^"]*")?/);if(s){let e=s[1],t=null==e?void 0:e.replace(/"/g,"");t?Z(t):Z("INITIALIZE")}},[e]);let eh=async e=>{try{let s=await fetch("api/content/files?page=".concat(e));if(!s.ok)throw Error("Failed to fetch files");let t=await s.json(),l=t.files,a=t.num_pages;er(a),Array.isArray(l)&&j(l.toSorted())}catch(e){g("Failed to load files"),console.error("Error fetching files:",e)}finally{w(!1)}};(0,n.useEffect)(()=>{eh(ea)},[ea]);let ex=async e=>{try{let s=await fetch("/api/content/file?file_name=".concat(e));if(!s.ok)throw Error("Failed to fetch file");let t=await s.json();$(t.raw_text)}catch(e){g("Failed to load file"),console.error("Error fetching file:",e)}},em=(e,s)=>{let t=new Blob([s],{type:"text/plain"}),l=window.URL.createObjectURL(t),a=document.createElement("a");a.href=l,a.download="".concat(e.split("/").pop(),".txt"),document.body.appendChild(a),a.click(),document.body.removeChild(a),window.URL.revokeObjectURL(l)};(0,n.useEffect)(()=>{z&&ex(z)},[z]),(0,n.useEffect)(()=>{eh(ea)},[]),(0,n.useEffect)(()=>{H.length>0&&(en(0),eh(0))},[H]);let ef=async e=>{J(!0);try{if(!(await fetch("/api/content/file?filename=".concat(e),{method:"DELETE"})).ok)throw Error("Failed to delete file");ec({title:"File deleted",description:"File ".concat(e," has been deleted"),variant:"default"}),eh(ea)}catch(s){ec({title:"Error deleting file",description:"Failed to delete file ".concat(e),variant:"destructive"})}finally{J(!1)}};return(0,l.jsxs)(D.Hn,{children:[(0,l.jsx)(F.S,{conversationId:""}),(0,l.jsxs)(D.kV,{children:[(0,l.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,l.jsx)(D.vP,{className:"-ml-1"}),(0,l.jsx)(I.Z,{orientation:"vertical",className:"mr-2 h-4"}),eo?(0,l.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,l.jsx)(A.VO,{className:"h-auto w-16"})}):(0,l.jsx)("h2",{className:"text-lg",children:"Search Your Knowledge Base"})]}),(0,l.jsx)("div",{children:(0,l.jsx)("div",{className:"".concat(r().searchLayout),children:(0,l.jsx)("div",{className:"w-full md:w-5/6 mx-auto pt-6 md:pt-8",children:(0,l.jsxs)("div",{className:"p-4 w-full mx-auto",children:[(0,l.jsxs)("div",{className:"flex justify-between items-center border-2 border-muted p-1 gap-1 rounded-lg flex-col md:flex-row",children:[(0,l.jsx)("div",{className:"relative flex-1 w-full",children:(0,l.jsx)(a.I,{autoFocus:!0,className:"border-none pl-4 focus-visible:ring-transparent focus-visible:ring-offset-transparent",onChange:e=>ed(e.currentTarget.value),onKeyDown:e=>{"Enter"===e.key&&eu()},ref:h,type:"search",placeholder:"Search Documents",value:e})}),(0,l.jsxs)("div",{id:"actions",className:"flex gap-2",children:[(0,l.jsx)(et,{allFiles:b,onChooseFile:t=>(function(t){var l;let a=e.replace(/file:([^"\s]*|"[^"]*")?/i,"").trim();s('file:"'.concat(t,'" ').concat(a)),null===(l=h.current)||void 0===l||l.focus(),eu()})(t),isMobileWidth:eo,inputText:P,onClose:()=>{var e;return null===(e=h.current)||void 0===e?void 0:e.focus()}}),(0,l.jsxs)(k.z,{className:"px-2 gap-2 inline-flex rounded-none items-center border-l border-gray-300 hover:text-gray-500",variant:"ghost",onClick:()=>eu(),children:[(0,l.jsx)(S.Y,{className:"h-4 w-4"}),(0,l.jsx)("span",{children:"Find"})]})]})]}),null===t&&(0,l.jsx)(es,{setUploadedFiles:el}),d&&(0,l.jsx)("div",{className:"mt-4 flex items-center justify-center",children:(0,l.jsx)(O.l,{className:"mt-4",message:"Searching",iconClassName:"h-5 w-5"})}),x&&(0,l.jsxs)("div",{className:"mt-4",children:[(0,l.jsxs)(k.z,{onClick:()=>m(null),className:"mb-4",variant:"outline",children:[(0,l.jsx)(E.X,{className:"inline mr-2"}),"Back"]}),function(e){let s=(e.additional.file||"").startsWith("http"),t=s?e.additional.heading:e.additional.file.split("/").pop();return(0,l.jsxs)(o.Zb,{className:"bg-secondary h-full shadow-sm rounded-lg border border-muted mb-4 animate-fade-in-up",children:[(0,l.jsx)(o.Ol,{children:(0,l.jsx)(o.ll,{children:t})}),s&&(0,l.jsx)(o.eW,{children:(0,l.jsxs)("a",{href:e.additional.file,target:"_blank",className:"underline text-sm bg-muted p-3 rounded-lg text-muted-foreground flex items-center gap-2",children:[(0,l.jsx)(p.a,{className:"inline"}),e.additional.file]})}),(0,l.jsx)(o.aY,{children:(0,l.jsx)("div",{className:"text-m",children:e.entry})})]})}(x)]}),!x&&!d&&t&&t.length>0&&(0,l.jsxs)("div",{className:"mt-4 max-w-[92vw] break-all",children:[(0,l.jsxs)(k.z,{onClick:()=>ed(""),className:"mb-4",variant:"outline",children:[(0,l.jsx)(E.X,{className:"inline mr-2"}),"See All"]}),(0,l.jsx)(c.x,{className:"h-[80vh]",children:t.map((e,s)=>(0,l.jsx)(ee,{note:e,setFocusSearchResult:m},e["corpus-id"]))})]}),!d&&null===t&&!e.trim()&&(0,l.jsxs)("div",{className:"w-full mt-4",children:[v&&(0,l.jsx)("div",{className:"mt-4 flex items-center justify-center",children:(0,l.jsx)(O.l,{className:"mt-4",message:"Loading",iconClassName:"h-5 w-5"})}),N&&(0,l.jsx)("div",{className:"text-red-500",children:N}),!t&&!v&&0===f.length&&(0,l.jsxs)(o.Zb,{className:"flex flex-col items-center justify-center border-none shadow-none",children:[(0,l.jsxs)(o.Ol,{className:"flex flex-col items-center justify-center",children:[(0,l.jsx)(o.SZ,{className:"border-muted-foreground border w-fit rounded-lg mb-2 text-center text-lg p-4",children:(0,l.jsx)(T.D,{weight:"fill",className:"text-muted-foreground h-10 w-10"})}),(0,l.jsx)(o.ll,{className:"text-center",children:"Let's get started!"})]}),(0,l.jsxs)(o.aY,{children:[(0,l.jsx)("div",{className:"text-muted-foreground items-center justify-center text-center flex",children:'To use search, upload docs via the "Add Documents" button.'}),(0,l.jsx)(C.default,{href:"https://docs.khoj.dev/data-sources/share_your_data",className:"no-underline",children:(0,l.jsx)("div",{className:"mt-4 text-center text-secondary-foreground bg-secondary w-fit m-auto p-2 rounded-lg",children:"Learn More"})})]})]}),(0,l.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:f.map((e,s)=>(0,l.jsx)(Q,{file:e,index:s,setSelectedFile:M,setSelectedFileFullText:$,handleDownload:em,handleDelete:ef,isDeleting:q,selectedFileFullText:W},s))}),(0,l.jsx)(U,{children:(0,l.jsxs)(Y,{className:"p-0",children:[ea>0&&(0,l.jsx)(K,{className:"list-none",children:(0,l.jsx)(V,{onClick:()=>en(ea-1)})}),ea>1&&(0,l.jsx)(K,{className:"list-none",children:(0,l.jsx)(B,{onClick:()=>en(0),children:"1"})}),ea>2&&(0,l.jsx)(K,{className:"list-none",children:(0,l.jsx)(X,{})}),ea>0&&(0,l.jsx)(K,{className:"list-none",children:(0,l.jsx)(B,{onClick:()=>en(ea-1),children:ea})}),(0,l.jsx)(K,{className:"list-none",children:(0,l.jsx)(B,{isActive:!0,children:ea+1})}),ea<ei-1&&(0,l.jsx)(K,{className:"list-none",children:(0,l.jsx)(B,{onClick:()=>en(ea+1),children:ea+2})}),ea<ei-3&&(0,l.jsx)(K,{className:"list-none",children:(0,l.jsx)(X,{})}),ea<ei-2&&(0,l.jsx)(K,{className:"list-none",children:(0,l.jsx)(B,{onClick:()=>en(ei-1),children:ei})}),ea<ei-1&&(0,l.jsx)(K,{className:"list-none",children:(0,l.jsx)(G,{onClick:()=>en(ea+1)})})]})})]})]})})})})]})]})}},32759:function(e,s,t){"use strict";t.d(s,{E:function(){return r}});var l=t(57437),a=t(2265),n=t(60610),i=t(94508);let r=a.forwardRef((e,s)=>{let{className:t,value:a,indicatorColor:r,...c}=e;return(0,l.jsx)(n.fC,{ref:s,className:(0,i.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...c,children:(0,l.jsx)(n.z$,{className:"h-full w-full flex-1 bg-primary transition-all ".concat(r),style:{transform:"translateX(-".concat(100-(a||0),"%)")}})})});r.displayName=n.fC.displayName},77992:function(e,s,t){"use strict";t.d(s,{pm:function(){return h}});var l=t(2265);let a=0,n=new Map,i=e=>{if(n.has(e))return;let s=setTimeout(()=>{n.delete(e),d({type:"REMOVE_TOAST",toastId:e})},1e6);n.set(e,s)},r=(e,s)=>{switch(s.type){case"ADD_TOAST":return{...e,toasts:[s.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===s.toast.id?{...e,...s.toast}:e)};case"DISMISS_TOAST":{let{toastId:t}=s;return t?i(t):e.toasts.forEach(e=>{i(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===t||void 0===t?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===s.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==s.toastId)}}},c=[],o={toasts:[]};function d(e){o=r(o,e),c.forEach(e=>{e(o)})}function u(e){let{...s}=e,t=(a=(a+1)%Number.MAX_SAFE_INTEGER).toString(),l=()=>d({type:"DISMISS_TOAST",toastId:t});return d({type:"ADD_TOAST",toast:{...s,id:t,open:!0,onOpenChange:e=>{e||l()}}}),{id:t,dismiss:l,update:e=>d({type:"UPDATE_TOAST",toast:{...e,id:t}})}}function h(){let[e,s]=l.useState(o);return l.useEffect(()=>(c.push(s),()=>{let e=c.indexOf(s);e>-1&&c.splice(e,1)}),[e]),{...e,toast:u,dismiss:e=>d({type:"DISMISS_TOAST",toastId:e})}}},41816:function(e){e.exports={searchLayout:"search_searchLayout__fP3m0"}}},function(e){e.O(0,[2026,1607,3861,9259,8667,4363,6244,2509,2327,2971,2117,1744],function(){return e(e.s=94114)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2797],{94114:function(e,s,t){Promise.resolve().then(t.bind(t,98537))},98537:function(e,s,t){"use strict";t.r(s),t.d(s,{default:function(){return el}});var l=t(57437),a=t(95186),n=t(2265),i=t(41816),r=t.n(i),c=t(19378),o=t(66070),d=t(73925),u=t(75216),h=t(91521),x=t(41648),m=t(41317),f=t(19841),j=t(45178),p=t(58619),N=t(2452),g=t(77168),v=t(87296),w=t(89203),b=t(11167),y=t(38513),S=t(35099),E=t(64697),T=t(74915),k=t(62869),C=t(27648),_=t(7436),D=t(60729),F=t(34124),I=t(6512),A=t(37104),O=t(14308),L=t(26110),R=t(77992),z=t(84190),M=t(92451),P=t(10407),Z=t(67782),W=t(94508);let U=e=>{let{className:s,...t}=e;return(0,l.jsx)("nav",{role:"navigation","aria-label":"pagination",className:(0,W.cn)("mx-auto flex w-full justify-center",s),...t})};U.displayName="Pagination";let Y=n.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,l.jsx)("ul",{ref:s,className:(0,W.cn)("flex flex-row items-center gap-1",t),...a})});Y.displayName="PaginationContent";let K=n.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,l.jsx)("li",{ref:s,className:(0,W.cn)("",t),...a})});K.displayName="PaginationItem";let B=e=>{let{className:s,isActive:t,size:a="icon",...n}=e;return(0,l.jsx)("a",{"aria-current":t?"page":void 0,className:(0,W.cn)((0,k.d)({variant:t?"outline":"ghost",size:a}),"no-underline",s),...n})};B.displayName="PaginationLink";let V=e=>{let{className:s,...t}=e;return(0,l.jsxs)(B,{"aria-label":"Go to previous page",size:"default",className:(0,W.cn)("gap-1 pl-2.5",s),...t,children:[(0,l.jsx)(M.Z,{className:"h-4 w-4"}),(0,l.jsx)("span",{children:"Previous"})]})};V.displayName="PaginationPrevious";let G=e=>{let{className:s,...t}=e;return(0,l.jsxs)(B,{"aria-label":"Go to next page",size:"default",className:(0,W.cn)("gap-1 pr-2.5",s),...t,children:[(0,l.jsx)("span",{children:"Next"}),(0,l.jsx)(P.Z,{className:"h-4 w-4"})]})};G.displayName="PaginationNext";let X=e=>{let{className:s,...t}=e;return(0,l.jsxs)("span",{"aria-hidden":!0,className:(0,W.cn)("flex h-9 w-9 items-center justify-center",s),...t,children:[(0,l.jsx)(Z.Z,{className:"h-4 w-4"}),(0,l.jsx)("span",{className:"sr-only",children:"More pages"})]})};X.displayName="PaginationEllipsis";var $=t(23518),q=t(57054),J=t(59199),H=t(32759);function Q(e){let{file:s,setSelectedFile:t,setSelectedFileFullText:a,handleDownload:n,handleDelete:i,isDeleting:r,selectedFileFullText:d}=e;return(0,l.jsxs)(o.Zb,{className:"animate-fade-in-up bg-secondary h-52",children:[(0,l.jsx)(o.Ol,{className:"p-2",children:(0,l.jsxs)(o.ll,{className:"flex items-center gap-2 justify-between",title:s.file_name,children:[(0,l.jsxs)(L.Vq,{children:[(0,l.jsx)(L.hg,{asChild:!0,children:(0,l.jsx)("div",{className:"text-sm font-medium truncate hover:text-clip hover:whitespace-normal cursor-pointer",onClick:()=>{a(""),t(s.file_name)},children:s.file_name.split("/").pop()})}),(0,l.jsxs)(L.cZ,{className:"max-w-fit",children:[(0,l.jsx)(L.fK,{children:(0,l.jsx)(L.$N,{children:(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[s.file_name.split("/").pop(),(0,l.jsx)(k.z,{variant:"ghost",title:"Download as plaintext",onClick:()=>n(s.file_name,s.raw_text),children:(0,l.jsx)(x.U,{className:"h-4 w-4"})})]})})}),(0,l.jsx)(c.x,{className:"h-[50vh] w-[80vw]",children:(0,l.jsxs)("p",{className:"whitespace-pre-wrap break-words text-sm font-normal word-wrap",children:[!d&&(0,l.jsx)(O.l,{className:"mt-4",message:"Loading",iconClassName:"h-5 w-5"}),d]})})]})]}),(0,l.jsxs)(z.h_,{children:[(0,l.jsx)(z.$F,{children:(0,l.jsx)(k.z,{variant:"ghost",children:(0,l.jsx)(m.F,{className:"h-4 w-4"})})}),(0,l.jsx)(z.AW,{className:"flex flex-col gap-0 w-fit",children:(0,l.jsx)(z.Xi,{className:"p-0",children:(0,l.jsxs)(k.z,{variant:"ghost",className:"flex items-center gap-2 p-1 text-sm",onClick:()=>{i(s.file_name)},children:[(0,l.jsx)(f.r,{className:"h-4 w-4"}),(0,l.jsx)("span",{className:"text-xs",children:r?"Deleting...":"Delete"})]})})})]})]})}),(0,l.jsx)(o.aY,{className:"p-2",children:(0,l.jsx)(c.x,{className:"h-24 bg-background rounded-lg",children:(0,l.jsxs)("p",{className:"whitespace-pre-wrap break-words text-sm font-normal text-muted-foreground p-2 h-full",children:[s.raw_text.slice(0,100),"..."]})})}),(0,l.jsx)(o.eW,{className:"flex justify-end gap-2 p-2",children:(0,l.jsx)("div",{className:"text-muted-foreground text-xs",children:(0,_.o0)(s.updated_at)})})]})}function ee(e){var s;let t=e.note,a=(t.additional.file||"").startsWith("http"),n=a?t.additional.heading:t.additional.file.split("/").pop();return(0,l.jsxs)(o.Zb,{className:"bg-secondary h-full shadow-sm rounded-lg border border-muted mb-4 animate-fade-in-up",children:[(0,l.jsx)(o.Ol,{children:(0,l.jsxs)(o.ll,{className:"inline-flex gap-2",children:["notion"===(s=t.additional.source)?(0,l.jsx)(d.F,{className:"text-muted-foreground"}):"github"===s?(0,l.jsx)(u.b,{className:"text-muted-foreground"}):(0,l.jsx)(h.S,{className:"text-muted-foreground"}),n]})}),(0,l.jsxs)(o.aY,{children:[(0,l.jsx)("div",{className:"line-clamp-4 text-muted-foreground",children:t.entry}),(0,l.jsxs)(k.z,{onClick:()=>e.setFocusSearchResult(t),variant:"ghost",className:"p-0 mt-2 text-orange-400 hover:bg-inherit",children:["See content",(0,l.jsx)(j.o,{className:"inline ml-2"})]})]}),a&&(0,l.jsx)(o.eW,{children:(0,l.jsxs)("a",{href:t.additional.file,target:"_blank",className:"underline text-sm bg-muted p-1 rounded-lg text-muted-foreground",children:[(0,l.jsx)(p.a,{className:"inline m-2"}),t.additional.file]})})]})}let es=e=>{let{setUploadedFiles:s}=e,[t,a]=(0,n.useState)(!1),[i,r]=(0,n.useState)(null),[c,o]=(0,n.useState)(null),[d,u]=(0,n.useState)(!1),[h,x]=(0,n.useState)(0),m=(0,n.useRef)(null);function f(e){(0,J.ko)(e,r,u,o,s)}return(0,n.useEffect)(()=>{if(!d&&(x(0),!i&&!c)){let e=new KeyboardEvent("keydown",{key:"Escape"});document.dispatchEvent(e)}if(d){let e=setInterval(()=>{x(e=>{let s=e+(Math.floor(5*Math.random())+1);return s<100?s:100})},800);return()=>clearInterval(e)}},[d]),(0,l.jsxs)(L.Vq,{children:[(0,l.jsx)(L.hg,{asChild:!0,children:(0,l.jsxs)(k.z,{variant:"secondary",className:"mt-4",children:[(0,l.jsx)(N.a,{className:"h-4 w-4 mr-2"}),"Add Documents"]})}),(0,l.jsxs)(L.cZ,{children:[(0,l.jsxs)(L.fK,{children:[(0,l.jsx)(L.$N,{children:"Build Your Knowledge Base"}),(0,l.jsx)(L.Be,{children:"Add context for your Khoj knowledge base. Quickly search and get personalized answers from your documents."})]}),(0,l.jsxs)("div",{className:"flex flex-col h-full",onDragOver:function(e){e.preventDefault(),a(!0)},onDragLeave:function(e){e.preventDefault(),a(!1)},onDrop:function(e){e.preventDefault(),a(!1),e.dataTransfer.files&&f(e.dataTransfer.files)},onClick:function(){m&&m.current&&m.current.click()},children:[(0,l.jsx)("input",{type:"file",multiple:!0,ref:m,style:{display:"none"},onChange:function(e){e.target.files&&f(e.target.files)}}),(0,l.jsx)("div",{className:"flex-none p-4",children:d&&(0,l.jsx)(H.E,{indicatorColor:"bg-slate-500",className:"w-full h-2 rounded-full",value:h})}),i&&(0,l.jsxs)("div",{className:"flex-none p-4 border-b rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(g.v,{className:"h-6 w-6"}),(0,l.jsx)("span",{children:i})]}),(0,l.jsx)(k.z,{onClick:()=>r(null),className:"mt-2",variant:"ghost",children:"Dismiss"})]}),c&&(0,l.jsxs)("div",{className:"flex-none p-4 border-b rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(g.v,{className:"h-6 w-6"}),(0,l.jsx)("span",{children:c})]}),(0,l.jsx)(k.z,{onClick:()=>o(null),className:"mt-2",variant:"ghost",children:"Dismiss"})]}),(0,l.jsx)("div",{className:"flex-none p-4 border-b ".concat(t?"animate-pulse border-blue-500 bg-blue-500 bg-opacity-25":"bg-secondary"," rounded-lg"),children:(0,l.jsx)("div",{className:"flex items-center justify-center w-full h-32 border-2 border-dashed border-gray-300 rounded-lg",children:t?(0,l.jsxs)("div",{className:"flex items-center justify-center w-full h-full",children:[(0,l.jsx)(v.u,{className:"h-6 w-6 mr-2"}),(0,l.jsx)("span",{children:"Drop files to upload"})]}):(0,l.jsxs)("div",{className:"flex items-center justify-center w-full h-full",children:[(0,l.jsx)(w.v,{className:"h-6 w-6 mr-2"}),(0,l.jsx)("span",{children:"Drag and drop files here"})]})})})]})]})]})};function et(e){let[s,t]=(0,n.useState)(!1),[a,i]=(0,n.useState)(e.inputText||""),[r,c]=(0,n.useState)(!1),[o,d]=(0,n.useState)("");return(0,n.useEffect)(()=>{e.inputText?"INITIALIZE"===e.inputText?(t(!0),d("")):(d(e.inputText),e.allFiles.includes(e.inputText)&&i(e.inputText)):d("")},[e.inputText]),(0,n.useEffect)(()=>{o&&!e.allFiles.includes(o)?(c(!0),i("")):o?(c(!1),i(o)):(c(!1),i(""))},[o,e.allFiles]),(0,n.useEffect)(()=>{s||e.onClose()},[s]),(0,l.jsxs)(q.J2,{open:s||r&&!!o,onOpenChange:t,children:[(0,l.jsx)(q.xo,{asChild:!0,children:(0,l.jsxs)(k.z,{variant:"outline",role:"combobox","aria-expanded":s,className:'justify-between" '.concat(e.isMobileWidth?"w-full":"w-[200px]"),children:[a?e.isMobileWidth?"✔️":"Selected":e.isMobileWidth?" ":"Select file",(0,l.jsx)(b.o,{className:"opacity-50"})]})}),(0,l.jsx)(q.yk,{className:"w-[200px] p-0",children:(0,l.jsxs)($.mY,{children:[(0,l.jsx)($.sZ,{placeholder:"Search files...",value:o,onInput:e=>d(e.currentTarget.value)}),(0,l.jsxs)($.e8,{children:[(0,l.jsx)($.rb,{children:"No files found."}),(0,l.jsx)($.fu,{children:e.allFiles.map(s=>(0,l.jsxs)($.di,{value:s,onSelect:s=>{i(s===a?"":s),t(!1),e.onChooseFile(s)},children:[s,(0,l.jsx)(y.J,{className:(0,W.cn)("ml-auto",a===s?"opacity-100":"opacity-0")})]},s))})]})]})})]})}function el(){let[e,s]=(0,n.useState)(""),[t,i]=(0,n.useState)(null),[d,u]=(0,n.useState)(!1),h=(0,n.useRef)(null),[x,m]=(0,n.useState)(null),[f,j]=(0,n.useState)([]),[N,g]=(0,n.useState)(null),[v,w]=(0,n.useState)(!0),[b,y]=(0,n.useState)([]),L=(0,n.useRef)(null),[z,M]=(0,n.useState)(null),[P,Z]=(0,n.useState)(void 0),[W,$]=(0,n.useState)(null),[q,J]=(0,n.useState)(!1),[H,el]=(0,n.useState)([]),[ea,en]=(0,n.useState)(0),[ei,er]=(0,n.useState)(1),{toast:ec}=(0,R.pm)(),eo=(0,_.IC)();function ed(e){if(s(e),!e.trim()){i(null);return}L.current&&clearTimeout(L.current),e.trim()&&(L.current=setTimeout(()=>{eu()},750))}function eu(){!d&&e.trim()&&(u(!0),fetch("/api/search?q=".concat(encodeURIComponent(e),"&client=web"),{method:"GET",headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{i(e),u(!1)}).catch(e=>{console.error("Error:",e)}))}(0,n.useEffect)(()=>{fetch("/api/content/computer",{method:"GET",headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{y(e)}).catch(e=>{console.error("Error loading files:",e)})},[]),(0,n.useEffect)(()=>{let s=e.match(/file:([^"\s]*|"[^"]*")?/);if(s){let e=s[1],t=null==e?void 0:e.replace(/"/g,"");t?Z(t):Z("INITIALIZE")}},[e]);let eh=async e=>{try{let s=await fetch("api/content/files?page=".concat(e));if(!s.ok)throw Error("Failed to fetch files");let t=await s.json(),l=t.files,a=t.num_pages;er(a),Array.isArray(l)&&j(l.toSorted())}catch(e){g("Failed to load files"),console.error("Error fetching files:",e)}finally{w(!1)}};(0,n.useEffect)(()=>{eh(ea)},[ea]);let ex=async e=>{try{let s=await fetch("/api/content/file?file_name=".concat(e));if(!s.ok)throw Error("Failed to fetch file");let t=await s.json();$(t.raw_text)}catch(e){g("Failed to load file"),console.error("Error fetching file:",e)}},em=(e,s)=>{let t=new Blob([s],{type:"text/plain"}),l=window.URL.createObjectURL(t),a=document.createElement("a");a.href=l,a.download="".concat(e.split("/").pop(),".txt"),document.body.appendChild(a),a.click(),document.body.removeChild(a),window.URL.revokeObjectURL(l)};(0,n.useEffect)(()=>{z&&ex(z)},[z]),(0,n.useEffect)(()=>{eh(ea)},[]),(0,n.useEffect)(()=>{H.length>0&&(en(0),eh(0))},[H]);let ef=async e=>{J(!0);try{if(!(await fetch("/api/content/file?filename=".concat(e),{method:"DELETE"})).ok)throw Error("Failed to delete file");ec({title:"File deleted",description:"File ".concat(e," has been deleted"),variant:"default"}),eh(ea)}catch(s){ec({title:"Error deleting file",description:"Failed to delete file ".concat(e),variant:"destructive"})}finally{J(!1)}};return(0,l.jsxs)(D.Hn,{children:[(0,l.jsx)(F.S,{conversationId:""}),(0,l.jsxs)(D.kV,{children:[(0,l.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,l.jsx)(D.vP,{className:"-ml-1"}),(0,l.jsx)(I.Z,{orientation:"vertical",className:"mr-2 h-4"}),eo?(0,l.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,l.jsx)(A.VO,{className:"h-auto w-16"})}):(0,l.jsx)("h2",{className:"text-lg",children:"Search Your Knowledge Base"})]}),(0,l.jsx)("div",{children:(0,l.jsx)("div",{className:"".concat(r().searchLayout),children:(0,l.jsx)("div",{className:"w-full md:w-5/6 mx-auto pt-6 md:pt-8",children:(0,l.jsxs)("div",{className:"p-4 w-full mx-auto",children:[(0,l.jsxs)("div",{className:"flex justify-between items-center border-2 border-muted p-1 gap-1 rounded-lg flex-col md:flex-row",children:[(0,l.jsx)("div",{className:"relative flex-1 w-full",children:(0,l.jsx)(a.I,{autoFocus:!0,className:"border-none pl-4 focus-visible:ring-transparent focus-visible:ring-offset-transparent",onChange:e=>ed(e.currentTarget.value),onKeyDown:e=>{"Enter"===e.key&&eu()},ref:h,type:"search",placeholder:"Search Documents",value:e})}),(0,l.jsxs)("div",{id:"actions",className:"flex gap-2",children:[(0,l.jsx)(et,{allFiles:b,onChooseFile:t=>(function(t){var l;let a=e.replace(/file:([^"\s]*|"[^"]*")?/i,"").trim();s('file:"'.concat(t,'" ').concat(a)),null===(l=h.current)||void 0===l||l.focus(),eu()})(t),isMobileWidth:eo,inputText:P,onClose:()=>{var e;return null===(e=h.current)||void 0===e?void 0:e.focus()}}),(0,l.jsxs)(k.z,{className:"px-2 gap-2 inline-flex rounded-none items-center border-l border-gray-300 hover:text-gray-500",variant:"ghost",onClick:()=>eu(),children:[(0,l.jsx)(S.Y,{className:"h-4 w-4"}),(0,l.jsx)("span",{children:"Find"})]})]})]}),null===t&&(0,l.jsx)(es,{setUploadedFiles:el}),d&&(0,l.jsx)("div",{className:"mt-4 flex items-center justify-center",children:(0,l.jsx)(O.l,{className:"mt-4",message:"Searching",iconClassName:"h-5 w-5"})}),x&&(0,l.jsxs)("div",{className:"mt-4",children:[(0,l.jsxs)(k.z,{onClick:()=>m(null),className:"mb-4",variant:"outline",children:[(0,l.jsx)(E.X,{className:"inline mr-2"}),"Back"]}),function(e){let s=(e.additional.file||"").startsWith("http"),t=s?e.additional.heading:e.additional.file.split("/").pop();return(0,l.jsxs)(o.Zb,{className:"bg-secondary h-full shadow-sm rounded-lg border border-muted mb-4 animate-fade-in-up",children:[(0,l.jsx)(o.Ol,{children:(0,l.jsx)(o.ll,{children:t})}),s&&(0,l.jsx)(o.eW,{children:(0,l.jsxs)("a",{href:e.additional.file,target:"_blank",className:"underline text-sm bg-muted p-3 rounded-lg text-muted-foreground flex items-center gap-2",children:[(0,l.jsx)(p.a,{className:"inline"}),e.additional.file]})}),(0,l.jsx)(o.aY,{children:(0,l.jsx)("div",{className:"text-m",children:e.entry})})]})}(x)]}),!x&&!d&&t&&t.length>0&&(0,l.jsxs)("div",{className:"mt-4 max-w-[92vw] break-all",children:[(0,l.jsxs)(k.z,{onClick:()=>ed(""),className:"mb-4",variant:"outline",children:[(0,l.jsx)(E.X,{className:"inline mr-2"}),"See All"]}),(0,l.jsx)(c.x,{className:"h-[80vh]",children:t.map((e,s)=>(0,l.jsx)(ee,{note:e,setFocusSearchResult:m},e["corpus-id"]))})]}),!d&&null===t&&!e.trim()&&(0,l.jsxs)("div",{className:"w-full mt-4",children:[v&&(0,l.jsx)("div",{className:"mt-4 flex items-center justify-center",children:(0,l.jsx)(O.l,{className:"mt-4",message:"Loading",iconClassName:"h-5 w-5"})}),N&&(0,l.jsx)("div",{className:"text-red-500",children:N}),!t&&!v&&0===f.length&&(0,l.jsxs)(o.Zb,{className:"flex flex-col items-center justify-center border-none shadow-none",children:[(0,l.jsxs)(o.Ol,{className:"flex flex-col items-center justify-center",children:[(0,l.jsx)(o.SZ,{className:"border-muted-foreground border w-fit rounded-lg mb-2 text-center text-lg p-4",children:(0,l.jsx)(T.D,{weight:"fill",className:"text-muted-foreground h-10 w-10"})}),(0,l.jsx)(o.ll,{className:"text-center",children:"Let's get started!"})]}),(0,l.jsxs)(o.aY,{children:[(0,l.jsx)("div",{className:"text-muted-foreground items-center justify-center text-center flex",children:'To use search, upload docs via the "Add Documents" button.'}),(0,l.jsx)(C.default,{href:"https://docs.khoj.dev/data-sources/share_your_data",className:"no-underline",children:(0,l.jsx)("div",{className:"mt-4 text-center text-secondary-foreground bg-secondary w-fit m-auto p-2 rounded-lg",children:"Learn More"})})]})]}),(0,l.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:f.map((e,s)=>(0,l.jsx)(Q,{file:e,index:s,setSelectedFile:M,setSelectedFileFullText:$,handleDownload:em,handleDelete:ef,isDeleting:q,selectedFileFullText:W},s))}),(0,l.jsx)(U,{children:(0,l.jsxs)(Y,{className:"p-0",children:[ea>0&&(0,l.jsx)(K,{className:"list-none",children:(0,l.jsx)(V,{onClick:()=>en(ea-1)})}),ea>1&&(0,l.jsx)(K,{className:"list-none",children:(0,l.jsx)(B,{onClick:()=>en(0),children:"1"})}),ea>2&&(0,l.jsx)(K,{className:"list-none",children:(0,l.jsx)(X,{})}),ea>0&&(0,l.jsx)(K,{className:"list-none",children:(0,l.jsx)(B,{onClick:()=>en(ea-1),children:ea})}),(0,l.jsx)(K,{className:"list-none",children:(0,l.jsx)(B,{isActive:!0,children:ea+1})}),ea<ei-1&&(0,l.jsx)(K,{className:"list-none",children:(0,l.jsx)(B,{onClick:()=>en(ea+1),children:ea+2})}),ea<ei-3&&(0,l.jsx)(K,{className:"list-none",children:(0,l.jsx)(X,{})}),ea<ei-2&&(0,l.jsx)(K,{className:"list-none",children:(0,l.jsx)(B,{onClick:()=>en(ei-1),children:ei})}),ea<ei-1&&(0,l.jsx)(K,{className:"list-none",children:(0,l.jsx)(G,{onClick:()=>en(ea+1)})})]})})]})]})})})})]})]})}},32759:function(e,s,t){"use strict";t.d(s,{E:function(){return r}});var l=t(57437),a=t(2265),n=t(60610),i=t(94508);let r=a.forwardRef((e,s)=>{let{className:t,value:a,indicatorColor:r,...c}=e;return(0,l.jsx)(n.fC,{ref:s,className:(0,i.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...c,children:(0,l.jsx)(n.z$,{className:"h-full w-full flex-1 bg-primary transition-all ".concat(r),style:{transform:"translateX(-".concat(100-(a||0),"%)")}})})});r.displayName=n.fC.displayName},77992:function(e,s,t){"use strict";t.d(s,{pm:function(){return h}});var l=t(2265);let a=0,n=new Map,i=e=>{if(n.has(e))return;let s=setTimeout(()=>{n.delete(e),d({type:"REMOVE_TOAST",toastId:e})},1e6);n.set(e,s)},r=(e,s)=>{switch(s.type){case"ADD_TOAST":return{...e,toasts:[s.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===s.toast.id?{...e,...s.toast}:e)};case"DISMISS_TOAST":{let{toastId:t}=s;return t?i(t):e.toasts.forEach(e=>{i(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===t||void 0===t?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===s.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==s.toastId)}}},c=[],o={toasts:[]};function d(e){o=r(o,e),c.forEach(e=>{e(o)})}function u(e){let{...s}=e,t=(a=(a+1)%Number.MAX_SAFE_INTEGER).toString(),l=()=>d({type:"DISMISS_TOAST",toastId:t});return d({type:"ADD_TOAST",toast:{...s,id:t,open:!0,onOpenChange:e=>{e||l()}}}),{id:t,dismiss:l,update:e=>d({type:"UPDATE_TOAST",toast:{...e,id:t}})}}function h(){let[e,s]=l.useState(o);return l.useEffect(()=>(c.push(s),()=>{let e=c.indexOf(s);e>-1&&c.splice(e,1)}),[e]),{...e,toast:u,dismiss:e=>d({type:"DISMISS_TOAST",toastId:e})}}},41816:function(e){e.exports={searchLayout:"search_searchLayout__fP3m0"}}},function(e){e.O(0,[2026,2663,3861,9259,8667,4363,6244,2509,2327,2971,2117,1744],function(){return e(e.s=94114)}),_N_E=e.O()}]);