khoj 1.42.2.dev1__py3-none-any.whl → 1.42.2.dev16__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 (60) hide show
  1. khoj/configure.py +2 -0
  2. khoj/database/adapters/__init__.py +6 -6
  3. khoj/interface/compiled/404/index.html +2 -2
  4. khoj/interface/compiled/_next/static/chunks/{2327-f03b2a77f67b8f8c.js → 2327-aa22697ed9c8d54a.js} +1 -1
  5. khoj/interface/compiled/_next/static/chunks/7127-79a3af5138960272.js +1 -0
  6. khoj/interface/compiled/_next/static/chunks/{5138-81457f7f59956b56.js → 7211-7fedd2ee3655239c.js} +1 -1
  7. khoj/interface/compiled/_next/static/chunks/app/agents/layout-4e2a134ec26aa606.js +1 -0
  8. khoj/interface/compiled/_next/static/chunks/app/automations/page-ef89ac958e78aa81.js +1 -0
  9. khoj/interface/compiled/_next/static/chunks/app/chat/layout-ad4d1792ab1a4108.js +1 -0
  10. khoj/interface/compiled/_next/static/chunks/app/chat/page-db0fbea54ccea62f.js +1 -0
  11. khoj/interface/compiled/_next/static/chunks/app/share/chat/{page-9a167dc9b5fcd464.js → page-da90c78180a86040.js} +1 -1
  12. khoj/interface/compiled/_next/static/chunks/{webpack-1c900156837baf90.js → webpack-0f15e6b51732b337.js} +1 -1
  13. khoj/interface/compiled/_next/static/css/{c34713c98384ee87.css → 2945c4a857922f3b.css} +1 -1
  14. khoj/interface/compiled/_next/static/css/{9c223d337a984468.css → 7017ee76c2f2cd87.css} +1 -1
  15. khoj/interface/compiled/_next/static/css/9a460202d29476e5.css +1 -0
  16. khoj/interface/compiled/agents/index.html +2 -2
  17. khoj/interface/compiled/agents/index.txt +2 -2
  18. khoj/interface/compiled/automations/index.html +2 -2
  19. khoj/interface/compiled/automations/index.txt +3 -3
  20. khoj/interface/compiled/chat/index.html +2 -2
  21. khoj/interface/compiled/chat/index.txt +2 -2
  22. khoj/interface/compiled/index.html +2 -2
  23. khoj/interface/compiled/index.txt +2 -2
  24. khoj/interface/compiled/search/index.html +2 -2
  25. khoj/interface/compiled/search/index.txt +2 -2
  26. khoj/interface/compiled/settings/index.html +2 -2
  27. khoj/interface/compiled/settings/index.txt +4 -4
  28. khoj/interface/compiled/share/chat/index.html +2 -2
  29. khoj/interface/compiled/share/chat/index.txt +2 -2
  30. khoj/processor/conversation/anthropic/anthropic_chat.py +17 -132
  31. khoj/processor/conversation/anthropic/utils.py +1 -1
  32. khoj/processor/conversation/google/gemini_chat.py +18 -139
  33. khoj/processor/conversation/offline/chat_model.py +21 -151
  34. khoj/processor/conversation/openai/gpt.py +12 -126
  35. khoj/processor/conversation/prompts.py +2 -63
  36. khoj/routers/api.py +5 -533
  37. khoj/routers/api_automation.py +243 -0
  38. khoj/routers/api_chat.py +35 -116
  39. khoj/routers/helpers.py +329 -80
  40. khoj/routers/research.py +3 -33
  41. khoj/utils/helpers.py +0 -6
  42. {khoj-1.42.2.dev1.dist-info → khoj-1.42.2.dev16.dist-info}/METADATA +1 -1
  43. {khoj-1.42.2.dev1.dist-info → khoj-1.42.2.dev16.dist-info}/RECORD +54 -53
  44. khoj/interface/compiled/_next/static/chunks/7127-d3199617463d45f0.js +0 -1
  45. khoj/interface/compiled/_next/static/chunks/app/agents/layout-e00fb81dca656a10.js +0 -1
  46. khoj/interface/compiled/_next/static/chunks/app/automations/page-465741d9149dfd48.js +0 -1
  47. khoj/interface/compiled/_next/static/chunks/app/chat/layout-33934fc2d6ae6838.js +0 -1
  48. khoj/interface/compiled/_next/static/chunks/app/chat/page-1726184cf1c1b86e.js +0 -1
  49. khoj/interface/compiled/_next/static/css/fca983d49c3dd1a3.css +0 -1
  50. /khoj/interface/compiled/_next/static/{Dzg_ViqMwQEjqMgetZPRc → OTsOjbrtuaYMukpuJS4sy}/_buildManifest.js +0 -0
  51. /khoj/interface/compiled/_next/static/{Dzg_ViqMwQEjqMgetZPRc → OTsOjbrtuaYMukpuJS4sy}/_ssgManifest.js +0 -0
  52. /khoj/interface/compiled/_next/static/chunks/{1915-ab4353eaca76f690.js → 1915-1943ee8a628b893c.js} +0 -0
  53. /khoj/interface/compiled/_next/static/chunks/{2117-1c18aa2098982bf9.js → 2117-5a41630a2bd2eae8.js} +0 -0
  54. /khoj/interface/compiled/_next/static/chunks/{4363-4efaf12abe696251.js → 4363-e6ac2203564d1a3b.js} +0 -0
  55. /khoj/interface/compiled/_next/static/chunks/{4447-5d44807c40355b1a.js → 4447-e038b251d626c340.js} +0 -0
  56. /khoj/interface/compiled/_next/static/chunks/{8667-adbe6017a66cef10.js → 8667-8136f74e9a086fca.js} +0 -0
  57. /khoj/interface/compiled/_next/static/chunks/{9259-d8bcd9da9e80c81e.js → 9259-640fdd77408475df.js} +0 -0
  58. {khoj-1.42.2.dev1.dist-info → khoj-1.42.2.dev16.dist-info}/WHEEL +0 -0
  59. {khoj-1.42.2.dev1.dist-info → khoj-1.42.2.dev16.dist-info}/entry_points.txt +0 -0
  60. {khoj-1.42.2.dev1.dist-info → khoj-1.42.2.dev16.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8459,3317,7138,244],{63521:function(){}},function(n){n.O(0,[2971,2117,1744],function(){return n(n.s=63521)}),_N_E=n.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4371],{2743:function(e,t,a){Promise.resolve().then(a.bind(a,77837))},77837:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return eg}});var s=a(57437),n=a(17200),r=a(14308),o=a(66070),i=a(62869),l=a(53647),c=a(47107),d=a.n(c),u=a(13590),m=a(29501),h=a(31229),x=a(2265),f=a(15681),p=a(95186),g=a(26110),j=a(49027),y=a(76818),w=a(7436),v=a(30190),N=a.n(v),b=a(97673),k=a(99376),D=a(57054),S=a(41317),C=a(87332),_=a(19841),M=a(3634),I=a(97822),A=a(93435),T=a(27484),R=a(39353),z=a(66594),P=a(12443),L=a(89203),O=a(78527),W=a(56937),q=a(39535),E=a(77992),U=a(89534),V=a(65613),F=a(17814),B=a(60729),G=a(34124),Z=a(6512),J=a(37104);let Q=()=>window.fetch("/api/automation").then(e=>e.json()).catch(e=>console.log(e));function X(e){let t=e.split(" "),a=t[2],s=t[4];return"*"===a&&"*"===s?"Day":"*"!==s?"Week":"*"!==a?"Month":"Day"}function H(e){let t=e.split(" ");if("*"===t[3]&&"*"!==t[4])return Number(t[4])}function Y(e){let t=e.split(" "),a=t[1],s=t[0],n=Number(a)>=12?"PM":"AM",r=Number(a)>12?Number(a)-12:a;"00"===r&&(r="12");let o=s;return 10>Number(o)&&"00"!==o&&(o="0".concat(o)),"".concat(r,":").concat(o," ").concat(n)}function $(e){return String(e.split(" ")[2])}function K(e){return d().toString(e)}let ee=["Day","Week","Month"],et=Array.from({length:31},(e,t)=>String(t+1)),ea=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],es=[],en=["AM","PM"];for(var er=0;er<en.length;er++)for(var eo=0;eo<12;eo++)for(var ei=0;ei<60;ei+=15){let e=String(ei).padStart(2,"0"),t=0===eo?12:eo;es.push("".concat(t,":").concat(e," ").concat(en[er]))}let el=Date.now(),ec=[{subject:"Weekly Newsletter",scheduling_request:"/research Compile a message including: 1. A recap of news from last week 2. An at-home workout I can do before work 3. A quote to inspire me for the week ahead",schedule:"9AM every Monday",next:"Next run at 9AM on Monday",crontime:"0 9 * * 1",id:el,query_to_run:""},{subject:"Front Page of Hacker News",scheduling_request:"/research Summarize the top 5 posts from https://news.ycombinator.com/best and share them with me, including links",schedule:"9PM on every Wednesday",next:"Next run at 9PM on Wednesday",crontime:"0 21 * * 3",id:el+2,query_to_run:""},{subject:"Market Summary",scheduling_request:"/research Get the market summary for today and share it with me. Focus on tech stocks and the S&P 500.",schedule:"9AM on every weekday",next:"Next run at 9AM on Monday",crontime:"0 9 * * *",id:el+3,query_to_run:""},{subject:"Market Crash Notification",scheduling_request:"Notify me if the stock market fell by more than 5% today.",schedule:"5PM every evening",next:"Next run at 5PM today",crontime:"0 17 * * *",id:el+5,query_to_run:""},{subject:"Round-up of research papers about AI in healthcare",scheduling_request:"/research Summarize the top 3 research papers about AI in healthcare that were published in the last week. Include links to the full papers.",schedule:"9AM every Friday",next:"Next run at 9AM on Friday",crontime:"0 9 * * 5",id:el+4,query_to_run:""},{subject:"Daily Bedtime Story",scheduling_request:"Compose a bedtime story that a five-year-old might enjoy. It should not exceed five paragraphs. Appeal to the imagination, but weave in learnings.",schedule:"9PM every night",next:"Next run at 9PM today",crontime:"0 21 * * *",id:el+1,query_to_run:""}];function ed(e){let t=encodeURIComponent(e.subject),a=encodeURIComponent(e.scheduling_request),s=encodeURIComponent(e.crontime);return"".concat(window.location.origin,"/automations?subject=").concat(t,"&query=").concat(a,"&crontime=").concat(s)}function eu(e){let[t,a]=(0,x.useState)(!1),[n,r]=(0,x.useState)(null),[l,c]=(0,x.useState)(!1),d=e.automation,[u,m]=(0,x.useState)(""),[h,f]=(0,x.useState)("");return((0,x.useEffect)(()=>{let e=n||d;m(Y(e.crontime));let t=X(e.crontime);if("Day"===t)f("Daily");else if("Week"===t){let t=H(e.crontime);void 0===t?f("Weekly"):f("".concat(ea[t]))}else if("Month"===t){let t=$(e.crontime);f("Monthly on the ".concat(t))}},[n,d]),l)?null:(0,s.jsxs)(o.Zb,{className:"h-full shadow-md rounded-lg dark:bg-muted ".concat(N().automationCard),children:[(0,s.jsx)(o.Ol,{children:(0,s.jsxs)(o.ll,{className:"line-clamp-2 leading-normal flex justify-between",children:[(null==n?void 0:n.subject)||d.subject,(0,s.jsxs)(D.J2,{children:[(0,s.jsx)(D.xo,{asChild:!0,children:(0,s.jsx)(i.z,{className:"bg-background",variant:"ghost",children:(0,s.jsx)(S.F,{className:"h-4 w-4"})})}),(0,s.jsxs)(D.yk,{className:"w-auto grid gap-2 text-left bg-secondary",children:[!e.suggestedCard&&e.locationData&&(0,s.jsx)(ep,{isMobileWidth:e.isMobileWidth,callToAction:"Edit",createNew:!1,setIsCreating:a,setShowLoginPrompt:e.setShowLoginPrompt,setNewAutomationData:r,authenticatedData:e.authenticatedData,isCreating:t,automation:n||d,ipLocationData:e.locationData,setToastMessage:e.setToastMessage}),(0,s.jsx)(b.Z,{buttonTitle:"Share",includeIcon:!0,buttonClassName:"justify-start px-4 py-2 h-10",buttonVariant:"outline",title:"Share Automation",description:"Copy the link below and share it with your coworkers or friends.",url:ed(d),onShare:()=>{navigator.clipboard.writeText(ed(d))}}),!e.suggestedCard&&(0,s.jsxs)(i.z,{variant:"outline",className:"justify-start",onClick:()=>{!function(e,t){fetch("/api/automation/trigger?automation_id=".concat(e),{method:"POST"}).then(e=>{if(!e.ok)throw Error("Network response was not ok");return e}).then(e=>{t("Automation triggered. Check your inbox in a few minutes!")}).catch(e=>{t("Sorry, something went wrong. Try again later.")})}(d.id.toString(),e.setToastMessage)},children:[(0,s.jsx)(C.s,{className:"h-4 w-4 mr-2"}),"Run Now"]}),(0,s.jsxs)(i.z,{variant:"destructive",className:"justify-start",onClick:()=>{if(e.suggestedCard){c(!0);return}!function(e,t){fetch("/api/automation?automation_id=".concat(e),{method:"DELETE"}).then(e=>e.json()).then(e=>{t(!0)})}(d.id.toString(),c)},children:[(0,s.jsx)(_.r,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})}),(0,s.jsx)(o.aY,{className:"text-secondary-foreground break-all",children:(null==n?void 0:n.scheduling_request)||d.scheduling_request}),(0,s.jsxs)(o.eW,{className:"flex flex-col items-start md:flex-row md:justify-between md:items-center gap-2",children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)("div",{className:"flex items-center rounded-lg p-1.5 border-blue-200 border dark:border-blue-500",children:[(0,s.jsx)(M.T,{className:"h-4 w-4 mr-2 text-blue-700 dark:text-blue-300"}),(0,s.jsx)("div",{className:"text-s text-blue-700 dark:text-blue-300",children:u})]}),(0,s.jsxs)("div",{className:"flex items-center rounded-lg p-1.5 border-purple-200 border dark:border-purple-500",children:[(0,s.jsx)(I.u,{className:"h-4 w-4 mr-2 text-purple-700 dark:text-purple-300"}),(0,s.jsx)("div",{className:"text-s text-purple-700 dark:text-purple-300",children:h})]})]}),e.suggestedCard&&e.setNewAutomationData&&(0,s.jsx)(ep,{isMobileWidth:e.isMobileWidth,callToAction:"Add",createNew:!0,setIsCreating:a,setShowLoginPrompt:e.setShowLoginPrompt,setNewAutomationData:e.setNewAutomationData,authenticatedData:e.authenticatedData,isCreating:t,automation:d,ipLocationData:e.locationData,setToastMessage:e.setToastMessage})]})]})}function em(e){let t=(0,k.useSearchParams)(),[a,n]=(0,x.useState)(!0),r=t.get("subject"),o=t.get("query"),i=t.get("crontime");if(!r||!o||!i)return null;let l={id:0,subject:decodeURIComponent(r),scheduling_request:decodeURIComponent(o),query_to_run:"",schedule:K(decodeURIComponent(i)),crontime:decodeURIComponent(i),next:""};return a?(0,s.jsx)(ep,{isMobileWidth:e.isMobileWidth,callToAction:"Shared",createNew:!0,setIsCreating:n,setShowLoginPrompt:e.setShowLoginPrompt,setNewAutomationData:e.setNewAutomationData,authenticatedData:e.authenticatedData,isCreating:a,automation:l,ipLocationData:e.locationData,setToastMessage:e.setToastMessage}):null}let eh=h.z.object({subject:h.z.optional(h.z.string()),everyBlah:h.z.string({required_error:"Every is required"}),dayOfWeek:h.z.optional(h.z.number()),dayOfMonth:h.z.optional(h.z.string()),timeRecurrence:h.z.string({required_error:"Time Recurrence is required"}),schedulingRequest:h.z.string({required_error:"Query to Run is required"})});function ex(e){let t=e.automation,a=(0,m.cI)({resolver:(0,u.F)(eh),defaultValues:{subject:null==t?void 0:t.subject,everyBlah:(null==t?void 0:t.crontime)?X(t.crontime):"Day",dayOfWeek:(null==t?void 0:t.crontime)?H(t.crontime):void 0,timeRecurrence:(null==t?void 0:t.crontime)?Y(t.crontime):"12:00 PM",dayOfMonth:(null==t?void 0:t.crontime)?$(t.crontime):"1",schedulingRequest:null==t?void 0:t.scheduling_request}});return(0,s.jsx)(ef,{authenticatedData:e.authenticatedData,locationData:e.locationData||null,form:a,onSubmit:a=>{let s=function(e,t,a,s){let n="",r=t.split(":")[1].split(" ")[0],o=t.split(":")[1].split(" ")[1],i=Number(t.split(":")[0]),l="PM"===o&&i<12?String(i+12):i;switch(e){case"Day":n="".concat(r," ").concat(l," * * *");break;case"Week":n="".concat(r," ").concat(l," * * ").concat(void 0!==a?7===a?0:a:"*");break;case"Month":n="".concat(r," ").concat(l," ").concat(s," * *")}return n}(a.everyBlah,a.timeRecurrence,a.dayOfWeek,a.dayOfMonth),n="/api/automation?";n+="q=".concat(encodeURIComponent(a.schedulingRequest)),(null==t?void 0:t.id)&&!e.createNew&&(n+="&automation_id=".concat(encodeURIComponent(t.id))),a.subject&&(n+="&subject=".concat(encodeURIComponent(a.subject))),n+="&crontime=".concat(encodeURIComponent(s)),e.locationData&&e.locationData.city&&(n+="&city=".concat(encodeURIComponent(e.locationData.city))),e.locationData&&e.locationData.region&&(n+="&region=".concat(encodeURIComponent(e.locationData.region))),e.locationData&&e.locationData.country&&(n+="&country=".concat(encodeURIComponent(e.locationData.country))),e.locationData&&e.locationData.timezone&&(n+="&timezone=".concat(encodeURIComponent(e.locationData.timezone))),fetch(n,{method:e.createNew?"POST":"PUT"}).then(e=>e.json()).then(t=>{e.setIsEditing(!1),e.setUpdatedAutomationData({id:t.id,subject:t.subject||"",query_to_run:t.query_to_run,scheduling_request:t.scheduling_request,schedule:K(t.crontime),crontime:t.crontime,next:t.next})}).catch(t=>{console.error("Error saving automation:",t),e.setIsEditing(!1),e.setToastMessage("Sorry, something went wrong. Try again or contact team@khoj.dev.")})},create:e.createNew,isLoggedIn:e.isLoggedIn,setShowLoginPrompt:e.setShowLoginPrompt})}function ef(e){var t,a;let[n,r]=(0,x.useState)(!1),{errors:o}=e.form.formState,c=["Make a picture of","Generate a summary of","Create a newsletter of","Notify me when"];return(0,s.jsx)(f.l0,{...e.form,children:(0,s.jsxs)("form",{onSubmit:e.form.handleSubmit(t=>{e.onSubmit(t),r(!0)}),className:"space-y-6",children:[(0,s.jsx)(f.xJ,{className:"space-y-1",children:(0,s.jsxs)(f.pf,{children:["Emails will be sent to this address. Timezone and location data will be used to schedule automations.",e.locationData&&(t=e.locationData,a=e.authenticatedData,(0,s.jsxs)("div",{className:"flex flex-wrap gap-2 items-center justify-start",children:[a?(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(R.w,{className:"h-4 w-4 mr-2 inline text-orange-500 shadow-sm"}),a.email]}):null,t&&(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(z.x,{className:"h-4 w-4 mr-2 inline text-purple-500"}),t?"".concat(t.city,", ").concat(t.country):"Unknown"]}),t&&(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(P.S,{className:"h-4 w-4 mr-2 inline text-green-500"}),t?"".concat(t.timezone):"Unknown"]})]}))]})}),!e.create&&(0,s.jsx)(f.Wi,{control:e.form.control,name:"subject",render:e=>{var t;let{field:a}=e;return(0,s.jsxs)(f.xJ,{className:"space-y-1",children:[(0,s.jsx)(f.lX,{children:"Subject"}),(0,s.jsx)(f.pf,{children:"This is the subject of the email you will receive."}),(0,s.jsx)(f.NI,{children:(0,s.jsx)(p.I,{placeholder:"Digest of Healthcare AI trends",...a})}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(t=o.subject)||void 0===t?void 0:t.message})]})}}),(0,s.jsx)(f.Wi,{control:e.form.control,name:"everyBlah",render:e=>{var t;let{field:a}=e;return(0,s.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,s.jsx)(f.lX,{children:"Frequency"}),(0,s.jsx)(f.pf,{children:"How often should this automation run?"}),(0,s.jsxs)(l.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,s.jsx)(f.NI,{children:(0,s.jsxs)(l.i4,{className:"w-[200px]",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(A.W,{className:"h-4 w-4 mr-2 inline"}),"Every"]}),(0,s.jsx)(l.ki,{placeholder:""})]})}),(0,s.jsx)(l.Bw,{children:ee.map(e=>(0,s.jsx)(l.Ql,{value:e,children:e},e))})]}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(t=o.everyBlah)||void 0===t?void 0:t.message})]})}}),"Week"===e.form.watch("everyBlah")&&(0,s.jsx)(f.Wi,{control:e.form.control,name:"dayOfWeek",render:e=>{var t;let{field:a}=e;return(0,s.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,s.jsx)(f.pf,{children:"Every week, on which day should this automation run?"}),(0,s.jsxs)(l.Ph,{onValueChange:e=>a.onChange(Number(e)),defaultValue:String(a.value),children:[(0,s.jsx)(f.NI,{children:(0,s.jsxs)(l.i4,{className:"w-[200px]",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(T.n,{className:"h-4 w-4 mr-2 inline"}),"On"]}),(0,s.jsx)(l.ki,{placeholder:""})]})}),(0,s.jsx)(l.Bw,{children:ea.map((e,t)=>(0,s.jsx)(l.Ql,{value:String(t),children:e},e))})]}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(t=o.dayOfWeek)||void 0===t?void 0:t.message})]})}}),"Month"===e.form.watch("everyBlah")&&(0,s.jsx)(f.Wi,{control:e.form.control,name:"dayOfMonth",render:e=>{var t;let{field:a}=e;return(0,s.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,s.jsx)(f.pf,{children:"Every month, on which day should the automation run?"}),(0,s.jsxs)(l.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,s.jsx)(f.NI,{children:(0,s.jsxs)(l.i4,{className:"w-[200px]",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(T.n,{className:"h-4 w-4 mr-2 inline"}),"On the"]}),(0,s.jsx)(l.ki,{placeholder:""})]})}),(0,s.jsx)(l.Bw,{children:et.map(e=>(0,s.jsx)(l.Ql,{value:e,children:e},e))})]}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(t=o.dayOfMonth)||void 0===t?void 0:t.message})]})}}),("Day"===e.form.watch("everyBlah")||"Week"==e.form.watch("everyBlah")||"Month"==e.form.watch("everyBlah"))&&(0,s.jsx)(f.Wi,{control:e.form.control,name:"timeRecurrence",render:e=>{var t;let{field:a}=e;return(0,s.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,s.jsx)(f.lX,{children:"Time"}),(0,s.jsx)(f.pf,{children:"On the days this automation runs, at what time should it run?"}),(0,s.jsxs)(l.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,s.jsx)(f.NI,{children:(0,s.jsxs)(l.i4,{className:"w-[200px]",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(I.u,{className:"h-4 w-4 mr-2 inline"}),"At"]}),(0,s.jsx)(l.ki,{placeholder:""})]})}),(0,s.jsx)(l.Bw,{children:es.map(e=>(0,s.jsx)(l.Ql,{value:e,children:e},e))})]}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(t=o.timeRecurrence)||void 0===t?void 0:t.message})]})}}),(0,s.jsx)(f.Wi,{control:e.form.control,name:"schedulingRequest",render:t=>{var a;let{field:n}=t;return(0,s.jsxs)(f.xJ,{className:"space-y-1",children:[(0,s.jsx)(f.lX,{children:"Instructions"}),(0,s.jsx)(f.pf,{children:"What do you want Khoj to do?"}),e.create&&(0,s.jsx)("div",{children:c.map(e=>{var t;return t=n.onChange,(0,s.jsxs)(i.z,{className:"text-xs bg-slate-50 dark:bg-slate-950 h-auto p-1.5 m-1 rounded-full",variant:"ghost",onClick:a=>{a.preventDefault(),t({target:{value:e}},a)},children:[e,"..."]},e)})}),(0,s.jsx)(f.NI,{children:(0,s.jsx)(y.g,{placeholder:"Create a summary of the latest news about AI in healthcare.",value:n.value,onChange:n.onChange})}),(0,s.jsx)(f.zG,{}),o.subject&&(0,s.jsx)(f.zG,{children:null===(a=o.schedulingRequest)||void 0===a?void 0:a.message})]})}}),(0,s.jsx)("fieldset",{disabled:n,children:e.isLoggedIn?n?(0,s.jsx)(i.z,{type:"submit",disabled:!0,children:"Saving..."}):(0,s.jsx)(i.z,{type:"submit",children:"Save"}):(0,s.jsx)(i.z,{onClick:t=>{t.preventDefault(),e.setShowLoginPrompt(!0)},variant:"default",children:"Login to Save"})})]})})}function ep(e){return e.isMobileWidth?(0,s.jsxs)(F.dy,{open:e.isCreating,onOpenChange:t=>{e.setIsCreating(t)},children:[(0,s.jsx)(F.Qz,{asChild:!0,children:(0,s.jsxs)(i.z,{className:"shadow-sm justify-start",variant:"outline",children:[(0,s.jsx)(L.v,{className:"h-4 w-4 mr-2"}),e.callToAction]})}),(0,s.jsxs)(F.sc,{className:"p-2",children:[(0,s.jsx)(F.iI,{children:"Automation"}),(0,s.jsx)(ex,{createNew:e.createNew,automation:e.automation,setIsEditing:e.setIsCreating,isLoggedIn:!!e.authenticatedData,authenticatedData:e.authenticatedData,setShowLoginPrompt:e.setShowLoginPrompt,setUpdatedAutomationData:e.setNewAutomationData,locationData:e.ipLocationData,setToastMessage:e.setToastMessage})]})]}):(0,s.jsxs)(g.Vq,{open:e.isCreating,onOpenChange:t=>{e.setIsCreating(t)},children:[(0,s.jsx)(g.hg,{asChild:!0,children:(0,s.jsxs)(i.z,{className:"shadow-sm justify-start",variant:"outline",children:[(0,s.jsx)(L.v,{className:"h-4 w-4 mr-2"}),e.callToAction]})}),(0,s.jsxs)(g.cZ,{className:"max-h-[98vh] overflow-y-auto",children:[(0,s.jsx)(j.$N,{children:"Automation"}),(0,s.jsx)(ex,{automation:e.automation,createNew:e.createNew,setIsEditing:e.setIsCreating,isLoggedIn:!!e.authenticatedData,authenticatedData:e.authenticatedData,setShowLoginPrompt:e.setShowLoginPrompt,setUpdatedAutomationData:e.setNewAutomationData,locationData:e.ipLocationData,setToastMessage:e.setToastMessage})]})]})}function eg(){let{data:e,error:t,isLoading:a}=(0,W.GW)(),{data:o,error:l,isLoading:c}=(0,n.ZP)(e?"automations":null,Q,{revalidateOnFocus:!1}),[d,u]=(0,x.useState)(!1),[m,h]=(0,x.useState)(null),[f,p]=(0,x.useState)([]),[g,j]=(0,x.useState)([]),[y,v]=(0,x.useState)(!1),b=(0,w.IC)(),{locationData:k,locationDataError:D,locationDataLoading:S}=(0,w.k6)(),[C,_]=(0,x.useState)(""),{toast:M}=(0,E.pm)();return((0,x.useEffect)(()=>{m&&(p([...f,m]),h(null))},[m,f]),(0,x.useEffect)(()=>{let e=o?o.concat(f):f;e&&j(ec.filter(t=>void 0===e.find(e=>t.subject===e.subject)))},[o,f]),(0,x.useEffect)(()=>{C&&(M({title:"Automation",description:C,action:(0,s.jsx)(U.gD,{altText:"Dismiss",children:"Ok"}),variant:C.includes("Sorry")?"destructive":"default"}),_(""))},[C]),l)?(0,s.jsx)(r.l,{message:"Oops, something went wrong. Please refresh the page."}):(0,s.jsxs)(B.Hn,{children:[(0,s.jsx)(G.S,{conversationId:""}),(0,s.jsxs)(B.kV,{children:[(0,s.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,s.jsx)(B.vP,{className:"-ml-1"}),(0,s.jsx)(Z.Z,{orientation:"vertical",className:"mr-2 h-4"}),b?(0,s.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,s.jsx)(J.VO,{className:"h-auto w-16"})}):(0,s.jsx)("h2",{className:"text-lg",children:"Automations"})]}),(0,s.jsx)("main",{className:"w-full mx-auto",children:(0,s.jsx)("div",{className:"grid w-full mx-auto",children:(0,s.jsxs)("div",{className:"".concat(N().pageLayout," w-full"),children:[(0,s.jsxs)("div",{className:"pt-6 md:pt-8 grid gap-1 md:flex md:justify-between",children:[(0,s.jsx)("h1",{className:"text-3xl flex items-center",children:"Automations"}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2 items-center justify-start",children:[e?(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(R.w,{className:"h-4 w-4 mr-2 inline text-orange-500 shadow-sm"}),e.email]}):null,k&&(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(z.x,{className:"h-4 w-4 mr-2 inline text-purple-500"}),k?"".concat(k.city,", ").concat(k.country):"Unknown"]}),k&&(0,s.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm dark:bg-muted",children:[(0,s.jsx)(P.S,{className:"h-4 w-4 mr-2 inline text-green-500"}),k?"".concat(k.timezone):"Unknown"]})]})]}),y&&(0,s.jsx)(q.Z,{onOpenChange:v,isMobileWidth:b}),(0,s.jsx)(V.bZ,{className:"bg-secondary border-none my-4",children:(0,s.jsxs)(V.X,{children:[(0,s.jsx)(O.B,{weight:"fill",className:"h-4 w-4 text-purple-400 inline"}),(0,s.jsx)("span",{className:"font-bold",children:"How it works"})," Automations help you structure your time by automating tasks you do regularly. Build your own, or try out our presets. Get results straight to your inbox."]})}),(0,s.jsx)("div",{className:"flex justify-between items-center py-4",children:e?(0,s.jsx)(ep,{isMobileWidth:b,callToAction:"Create Automation",createNew:!0,setIsCreating:u,setShowLoginPrompt:v,setNewAutomationData:h,authenticatedData:e,isCreating:d,ipLocationData:k,setToastMessage:_}):(0,s.jsxs)(i.z,{className:"shadow-sm",onClick:()=>v(!0),variant:"outline",children:[(0,s.jsx)(L.v,{className:"h-4 w-4 mr-2"}),"Create Automation"]})}),(0,s.jsx)(x.Suspense,{children:(0,s.jsx)(em,{isMobileWidth:b,authenticatedData:e||null,locationData:k,isLoggedIn:!!e,setShowLoginPrompt:v,setNewAutomationData:h,setToastMessage:_})}),c&&(0,s.jsx)(r.l,{message:"booting up your automations"}),(0,s.jsxs)("div",{className:"".concat(N().automationsLayout),children:[e&&o&&o.map(t=>(0,s.jsx)(eu,{isMobileWidth:b,authenticatedData:e,automation:t,locationData:k,isLoggedIn:!!e,setShowLoginPrompt:v,setToastMessage:_},t.id)),e&&f.map(t=>(0,s.jsx)(eu,{isMobileWidth:b,authenticatedData:e,automation:t,locationData:k,isLoggedIn:!!e,setShowLoginPrompt:v,setToastMessage:_},t.id))]}),(0,s.jsx)("h3",{className:"text-xl py-4",children:"Explore"}),(0,s.jsx)("div",{className:"".concat(N().automationsLayout),children:g.map(t=>(0,s.jsx)(eu,{isMobileWidth:b,setNewAutomationData:h,authenticatedData:e||null,automation:t,locationData:k,isLoggedIn:!!e,setShowLoginPrompt:v,suggestedCard:!0,setToastMessage:_},t.id))})]})})})]})]})}},97673:function(e,t,a){"use strict";a.d(t,{Z:function(){return c}});var s=a(57437),n=a(26110),r=a(62869),o=a(95186),i=a(26815),l=a(92457);function c(e){var t;return(0,s.jsxs)(n.Vq,{children:[(0,s.jsx)(n.hg,{asChild:!0,onClick:e.onShare,children:(0,s.jsxs)(r.z,{size:"sm",className:"".concat(e.buttonClassName||"px-3"),variant:null!==(t=e.buttonVariant)&&void 0!==t?t:"default",children:[e.includeIcon&&(0,s.jsx)(l.m,{className:"w-4 h-4 mr-2"}),e.buttonTitle]})}),(0,s.jsxs)(n.cZ,{children:[(0,s.jsxs)(n.fK,{children:[(0,s.jsx)(n.$N,{children:e.title}),(0,s.jsx)(n.Be,{children:e.description})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsxs)("div",{className:"grid flex-1 gap-2",children:[(0,s.jsx)(i._,{htmlFor:"link",className:"sr-only",children:"Link"}),(0,s.jsx)(o.I,{id:"link",defaultValue:e.url,readOnly:!0})]}),(0,s.jsx)(r.z,{type:"submit",size:"sm",className:"px-3",onClick:()=>(function(e){let t=navigator.clipboard;t&&t.writeText(e)})(e.url),children:(0,s.jsx)("span",{children:"Copy"})})]})]})]})}},65613:function(e,t,a){"use strict";a.d(t,{X:function(){return c},bZ:function(){return l}});var s=a(57437),n=a(2265),r=a(90535),o=a(94508);let i=(0,r.j)("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),l=n.forwardRef((e,t)=>{let{className:a,variant:n,...r}=e;return(0,s.jsx)("div",{ref:t,role:"alert",className:(0,o.cn)(i({variant:n}),a),...r})});l.displayName="Alert",n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)("h5",{ref:t,className:(0,o.cn)("mb-1 font-medium leading-none tracking-tight",a),...n})}).displayName="AlertTitle";let c=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)("div",{ref:t,className:(0,o.cn)("text-sm [&_p]:leading-relaxed",a),...n})});c.displayName="AlertDescription"},15681:function(e,t,a){"use strict";a.d(t,{NI:function(){return p},Wi:function(){return u},l0:function(){return c},lX:function(){return f},pf:function(){return g},xJ:function(){return x},zG:function(){return j}});var s=a(57437),n=a(2265),r=a(37053),o=a(29501),i=a(94508),l=a(26815);let c=o.RV,d=n.createContext({}),u=e=>{let{...t}=e;return(0,s.jsx)(d.Provider,{value:{name:t.name},children:(0,s.jsx)(o.Qr,{...t})})},m=()=>{let e=n.useContext(d),t=n.useContext(h),{getFieldState:a,formState:s}=(0,o.Gc)(),r=a(e.name,s);if(!e)throw Error("useFormField should be used within <FormField>");let{id:i}=t;return{id:i,name:e.name,formItemId:"".concat(i,"-form-item"),formDescriptionId:"".concat(i,"-form-item-description"),formMessageId:"".concat(i,"-form-item-message"),...r}},h=n.createContext({}),x=n.forwardRef((e,t)=>{let{className:a,...r}=e,o=n.useId();return(0,s.jsx)(h.Provider,{value:{id:o},children:(0,s.jsx)("div",{ref:t,className:(0,i.cn)("space-y-2",a),...r})})});x.displayName="FormItem";let f=n.forwardRef((e,t)=>{let{className:a,...n}=e,{error:r,formItemId:o}=m();return(0,s.jsx)(l._,{ref:t,className:(0,i.cn)(r&&"text-destructive",a),htmlFor:o,...n})});f.displayName="FormLabel";let p=n.forwardRef((e,t)=>{let{...a}=e,{error:n,formItemId:o,formDescriptionId:i,formMessageId:l}=m();return(0,s.jsx)(r.g7,{ref:t,id:o,"aria-describedby":n?"".concat(i," ").concat(l):"".concat(i),"aria-invalid":!!n,...a})});p.displayName="FormControl";let g=n.forwardRef((e,t)=>{let{className:a,...n}=e,{formDescriptionId:r}=m();return(0,s.jsx)("p",{ref:t,id:r,className:(0,i.cn)("text-sm text-muted-foreground",a),...n})});g.displayName="FormDescription";let j=n.forwardRef((e,t)=>{let{className:a,children:n,...r}=e,{error:o,formMessageId:l}=m(),c=o?String(null==o?void 0:o.message):n;return c?(0,s.jsx)("p",{ref:t,id:l,className:(0,i.cn)("text-sm font-medium text-destructive",a),...r,children:c}):null});j.displayName="FormMessage"},26815:function(e,t,a){"use strict";a.d(t,{_:function(){return c}});var s=a(57437),n=a(2265),r=a(6394),o=a(90535),i=a(94508);let l=(0,o.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.f,{ref:t,className:(0,i.cn)(l(),a),...n})});c.displayName=r.f.displayName},53647:function(e,t,a){"use strict";a.d(t,{Bw:function(){return f},Ph:function(){return d},Ql:function(){return p},i4:function(){return m},ki:function(){return u}});var s=a(57437),n=a(2265),r=a(56873),o=a(40875),i=a(22135),l=a(30401),c=a(94508);let d=r.fC;r.ZA;let u=r.B4,m=n.forwardRef((e,t)=>{let{className:a,children:n,...i}=e;return(0,s.jsxs)(r.xz,{ref:t,className:(0,c.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",a),...i,children:[n,(0,s.jsx)(r.JO,{asChild:!0,children:(0,s.jsx)(o.Z,{className:"h-4 w-4 opacity-50"})})]})});m.displayName=r.xz.displayName;let h=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.u_,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",a),...n,children:(0,s.jsx)(i.Z,{className:"h-4 w-4"})})});h.displayName=r.u_.displayName;let x=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.$G,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",a),...n,children:(0,s.jsx)(o.Z,{className:"h-4 w-4"})})});x.displayName=r.$G.displayName;let f=n.forwardRef((e,t)=>{let{className:a,children:n,position:o="popper",...i}=e;return(0,s.jsx)(r.h_,{children:(0,s.jsxs)(r.VY,{ref:t,className:(0,c.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"===o&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),position:o,...i,children:[(0,s.jsx)(h,{}),(0,s.jsx)(r.l_,{className:(0,c.cn)("p-1","popper"===o&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),(0,s.jsx)(x,{})]})})});f.displayName=r.VY.displayName,n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.__,{ref:t,className:(0,c.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",a),...n})}).displayName=r.__.displayName;let p=n.forwardRef((e,t)=>{let{className:a,children:n,...o}=e;return(0,s.jsxs)(r.ck,{ref:t,className:(0,c.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",a),...o,children:[(0,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(r.wU,{children:(0,s.jsx)(l.Z,{className:"h-4 w-4"})})}),(0,s.jsx)(r.eT,{children:n})]})});p.displayName=r.ck.displayName,n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.Z0,{ref:t,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",a),...n})}).displayName=r.Z0.displayName},76818:function(e,t,a){"use strict";a.d(t,{g:function(){return o}});var s=a(57437),n=a(2265),r=a(94508);let o=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)("textarea",{className:(0,r.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",a),ref:t,...n})});o.displayName="Textarea"},89534:function(e,t,a){"use strict";a.d(t,{FN:function(){return m},Mi:function(){return f},VW:function(){return c},_i:function(){return d},gD:function(){return h},lj:function(){return p},sA:function(){return x}});var s=a(57437),n=a(2265),r=a(41915),o=a(90535),i=a(32489),l=a(94508);let c=r.zt,d=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.l_,{ref:t,className:(0,l.cn)("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",a),...n})});d.displayName=r.l_.displayName;let u=(0,o.j)("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),m=n.forwardRef((e,t)=>{let{className:a,variant:n,...o}=e;return(0,s.jsx)(r.fC,{ref:t,className:(0,l.cn)(u({variant:n}),a),...o})});m.displayName=r.fC.displayName;let h=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.aU,{ref:t,className:(0,l.cn)("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",a),...n})});h.displayName=r.aU.displayName;let x=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.x8,{ref:t,className:(0,l.cn)("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",a),"toast-close":"",...n,children:(0,s.jsx)(i.Z,{className:"h-4 w-4"})})});x.displayName=r.x8.displayName;let f=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.Dx,{ref:t,className:(0,l.cn)("text-sm font-semibold",a),...n})});f.displayName=r.Dx.displayName;let p=n.forwardRef((e,t)=>{let{className:a,...n}=e;return(0,s.jsx)(r.dk,{ref:t,className:(0,l.cn)("text-sm opacity-90",a),...n})});p.displayName=r.dk.displayName},77992:function(e,t,a){"use strict";a.d(t,{pm:function(){return m}});var s=a(2265);let n=0,r=new Map,o=e=>{if(r.has(e))return;let t=setTimeout(()=>{r.delete(e),d({type:"REMOVE_TOAST",toastId:e})},1e6);r.set(e,t)},i=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{let{toastId:a}=t;return a?o(a):e.toasts.forEach(e=>{o(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===a||void 0===a?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===t.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},l=[],c={toasts:[]};function d(e){c=i(c,e),l.forEach(e=>{e(c)})}function u(e){let{...t}=e,a=(n=(n+1)%Number.MAX_SAFE_INTEGER).toString(),s=()=>d({type:"DISMISS_TOAST",toastId:a});return d({type:"ADD_TOAST",toast:{...t,id:a,open:!0,onOpenChange:e=>{e||s()}}}),{id:a,dismiss:s,update:e=>d({type:"UPDATE_TOAST",toast:{...e,id:a}})}}function m(){let[e,t]=s.useState(c);return s.useEffect(()=>(l.push(t),()=>{let e=l.indexOf(t);e>-1&&l.splice(e,1)}),[e]),{...e,toast:u,dismiss:e=>d({type:"DISMISS_TOAST",toastId:e})}}},30190:function(e){e.exports={automationsLayout:"automations_automationsLayout__Atoh_",automationCard:"automations_automationCard__BKidA",pageLayout:"automations_pageLayout__OaoYA"}}},function(e){e.O(0,[5638,9259,7200,8667,4363,4447,6663,1915,5473,2327,2971,2117,1744],function(){return e(e.s=2743)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3317,8459,7138,244],{63521:function(){}},function(n){n.O(0,[2971,2117,1744],function(){return n(n.s=63521)}),_N_E=n.O()}]);
@@ -0,0 +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 er}});var a=t(57437),n=t(63136),i=t.n(n),l=t(2265),o=t(27127),r=t(99376),d=t(14308),c=t(59199);t(2446);var u=t(7436),h=t(5477),m=t(56937),x=t(55287),f=t(60729),p=t(34124),g=t(6512),j=t(37104),v=t(62869),y=t(632),N=t(47615),b=t(96108),w=t(36360),_=t(60906),S=t(36720),C=t(61563),O=t(82123),k=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=l.forwardRef((e,s)=>{let{className:t,align:n="center",sideOffset:i=4,...l}=e;return(0,a.jsx)(B.VY,{ref:s,align:n,sideOffset:i,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),...l})});F.displayName=B.VY.displayName;var A=t(93022);function P(e){var s;let{...t}=e,[n,i]=l.useState(!1),[o,r]=(0,l.useState)(void 0),[d,c]=(0,l.useState)(void 0),{data:h,error:x,isLoading:f}=(0,m.h2)(!0),[p,g]=(0,l.useState)([]),j=(0,u.IC)();return((0,l.useEffect)(()=>{if(!f&&h){if(g(h.chat_model_options),t.initialModel)c(h.chat_model_options.find(e=>e.name===t.initialModel));else{let e=h.chat_model_options.find(e=>e.id===h.selected_chat_model_config);!e&&h.chat_model_options.length>0?c(h.chat_model_options[0]):c(e)}}},[h,t.initialModel,f]),(0,l.useEffect)(()=>{d&&h&&t.onSelect(d)},[d,h,t.onSelect]),f)?(0,a.jsx)(A.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:i,...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)(Z,{model:e,isSelected:(null==d?void 0:d.id)===e.id,onPeek:e=>r(e),onSelect:()=>{c(e),i(!1)},isActive:t.isActive},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)(Z,{model:e,isSelected:(null==d?void 0:d.id)===e.id,onPeek:e=>r(e),onSelect:()=>{c(e),i(!1)},isActive:t.isActive},e.id))},"models")]})})]})]})})]})})}function Z(e){let{model:s,isSelected:t,onSelect:n,onPeek:i,isActive:o}=e,r=l.useRef(null);return(0,u.Iy)(r,e=>{e.forEach(e=>{var t;"attributes"===e.type&&"aria-selected"===e.attributeName&&(null===(t=r.current)||void 0===t?void 0:t.getAttribute("aria-selected"))==="true"&&i(s)})}),(0,a.jsxs)(T.di,{onSelect:n,ref:r,className:"data-[selected=true]:bg-muted data-[selected=true]:text-secondary-foreground",disabled:!o&&"free"!==s.tier,children:[s.name," ","standard"===s.tier&&(0,a.jsx)("span",{className:"text-green-500 ml-2",children:"(Futurist)"}),(0,a.jsx)(M.J,{className:(0,E.cn)("ml-auto",t?"opacity-100":"opacity-0")})]},s.id)}var J=t(17200),W=t(2602),D=t(69304),K=t(42225),U=t(26815),V=t(9270),G=t(30401);let H=l.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,a.jsx)(V.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)(V.z$,{className:(0,E.cn)("flex items-center justify-center text-current"),children:(0,a.jsx)(G.Z,{className:"h-4 w-4"})})})});H.displayName=V.fC.displayName;var Q=t(81103),q=t(61312),Y=t(26110),$=t(53647),X=t(84671),ee=t(95186),es=t(27648),et=t(99597);let ea=e=>fetch(e).then(e=>e.json());function en(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 ei(e){let s=(0,K.BI)(),t=X.xF,[n,i]=(0,l.useState)(!1),[o,r]=(0,l.useState)(),[d,c]=(0,l.useState)(),[u,h]=(0,l.useState)(),[m,x]=(0,l.useState)(!1),[f,p]=(0,l.useState)(),[g,j]=(0,l.useState)(!1),[y,S]=(0,l.useState)();return(0,l.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:[m&&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:m&&f?(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center gap-4 py-8",children:[(0,a.jsx)(et.E.div,{initial:{scale:0},animate:{scale:1},transition:{type:"spring",stiffness:260,damping:20},children:(0,a.jsx)(N.f,{className:"w-16 h-16 text-green-500",weight:"fill"})}),(0,a.jsx)(et.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)(et.E.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.4},children:(0,a.jsx)(es.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)(U._,{htmlFor:"agent_name",children:"Name"}),(0,a.jsx)(ee.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:h,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)(b.C,{className:"w-6 h-6 mr-2 ".concat((0,X.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,K.TI)(e,null!=u?u:"gray","w-6","h-6"),e]})},e))})]})})]})]})}),(0,a.jsxs)(Y.cN,{children:[y&&(0,a.jsx)("div",{className:"text-red-500 text-sm",children:y}),!m&&(0,a.jsxs)(v.z,{type:"submit",onClick:()=>void(!n&&(i(!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)),i(!1);return}x(!0),p(e.slug),i(!1)}).catch(e=>{console.error("Error:",e),S("Error creating agent: ".concat(e)),i(!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,i;let{...o}=e,[r,d]=(0,l.useState)(!1),{data:c,error:u}=(0,J.ZP)("/api/agents/options",ea),{data:h,isLoading:p,error:g}=(0,J.ZP)("/api/agents/conversation?conversation_id=".concat(o.conversationId),ea),{data:j,error:y,isLoading:N}=(0,m.GW)(),[b,_]=(0,l.useState)(),[I,M]=(0,l.useState)(),[E,T]=(0,l.useState)(),[B,R]=(0,l.useState)(),[L,F]=(0,l.useState)(!1),[A,Z]=(0,l.useState)(!h||(null==h?void 0:h.slug.toLowerCase())==="khoj"),[D,V]=(0,l.useState)(),[G,Y]=(0,l.useState)(),[$,X]=(0,l.useState)(!1),ee=null!==(s=null==j?void 0:j.is_active)&&void 0!==s&&s;function es(){h&&(T(h.input_tools),V(h.input_tools),(void 0===h.input_tools||0===h.input_tools.length)&&V((null==c?void 0:c.input_tools)?Object.keys(c.input_tools):[]),R(h.output_modes),Y(h.output_modes),(void 0===h.output_modes||0===h.output_modes.length)&&Y((null==c?void 0:c.output_modes)?Object.keys(c.output_modes):[]),("khoj"===h.name.toLowerCase()||!0===h.is_hidden)&&d(!0),"khoj"===h.slug.toLowerCase()?(M(void 0),_(void 0),Z(!0)):(Z(!1),_(h.persona),M(h.chat_model)))}function et(e,s){return s.includes(e)?s.filter(s=>s!==e):[...s,e]}return(0,l.useEffect)(()=>{es(),F(!1)},[h]),(0,l.useEffect)(()=>{var e,s;if(!h||p)return;let t=!!I&&I!==h.chat_model,a=!!b&&b!==h.persona,n=JSON.stringify((null==E?void 0:E.sort())||[])!==JSON.stringify(null===(e=h.input_tools)||void 0===e?void 0:e.sort()),i=JSON.stringify((null==B?void 0:B.sort())||[])!==JSON.stringify(null===(s=h.output_modes)||void 0===s?void 0:s.sort());F(t||a||n||i)},[I,b,E,B,h,p]),(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:h&&!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(h.slug),children:[(0,K.TI)(h.icon,h.color),h.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:h&&h.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)(k.g,{className:"w-full h-32 resize-none hover:resize-y",value:b||"",onChange:e=>{_(e.target.value)},readOnly:!r,disabled:!r})})})]})},"instructions"),!p&&h&&(0,a.jsx)(f.Hz,{children:(0,a.jsxs)(f.Ks,{children:[(0,a.jsxs)(f.nO,{children:["Model",!ee&&(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,onSelect:e=>{M(e.name)},initialModel:A?void 0:null==h?void 0:h.chat_model,isActive:o.isActive})},"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)(Q.u,{children:[(0,a.jsx)(Q.aJ,{asChild:!0,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2 py-1 justify-between",children:[(0,a.jsxs)(U._,{htmlFor:s,className:"flex items-center gap-2 text-accent-foreground p-1 cursor-pointer",children:[(0,K.vH)(s),(0,a.jsx)("p",{className:"text-sm my-auto flex items-center",children:s})]}),(0,a.jsx)(H,{id:s,className:"".concat(r?"cursor-pointer":""),checked:(null!=D?D:[]).includes(s),onCheckedChange:()=>{let e=et(s,null!=D?D:[]);T(e),V(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)(Q.u,{children:[(0,a.jsx)(Q.aJ,{asChild:!0,children:(0,a.jsxs)("div",{className:"flex items-center space-x-2 py-1 justify-between",children:[(0,a.jsxs)(U._,{htmlFor:s,className:"flex items-center gap-2 p-1 rounded-lg cursor-pointer",children:[(0,K.vH)(s),(0,a.jsx)("p",{className:"text-sm my-auto flex items-center",children:s})]}),(0,a.jsx)(H,{id:s,className:"".concat(r?"cursor-pointer":""),checked:(null!=G?G:[]).includes(s),onCheckedChange:()=>{let e=et(s,null!=G?G:[]);R(e),Y(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)})]})})})]})}),(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!==(i=o.isMobileWidth)&&void 0!==i&&i})},"files-conversation")})]})},"files")]}),o.isOpen&&(0,a.jsx)(f.ZW,{children:(0,a.jsx)(f.w3,{className:"p-0 m-0",children:h&&!r&&h.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==h?void 0:h.slug),children:"Manage"})})}):(0,a.jsxs)(a.Fragment,{children:[!L&&r&&b&&!A&&I&&(0,a.jsx)(f.LO,{children:(0,a.jsx)(f.bb,{asChild:!0,children:(0,a.jsx)(ei,{customPrompt:b,selectedModel:I,inputTools:null!=D?D:[],outputModes:null!=G?G:[]})})}),(0,a.jsx)(f.LO,{children:(0,a.jsx)(f.bb,{asChild:!0,children:(0,a.jsx)(v.z,{className:"w-full",onClick:()=>void(es(),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(!A&&(null==h?void 0:h.is_hidden)===!1){alert("This agent is not a hidden agent. It cannot be modified from this interface.");return}let e="PATCH";A&&(e="POST");let s={persona:b,chat_model:I,input_tools:E,output_modes:B,...A?{}:{slug:null==h?void 0:h.slug}};X(!0),fetch(A?"/api/agents/hidden?conversation_id=".concat(o.conversationId):"/api/agents/hidden",{method:e,headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}).then(e=>{X(!1),e.json()}).then(e=>{(0,W.j)("/api/agents/conversation?conversation_id=".concat(o.conversationId)),F(!1)}).catch(e=>{console.error("Error:",e),X(!1)})}})(),disabled:!r||!L||$,children:[$?(0,a.jsx)(w.U,{className:"animate-spin"}):(0,a.jsx)(O.Z,{}),$?"Saving":"Save"]})})})]})})},"actions")]})}function eo(e){let s=(0,r.useSearchParams)().get("conversationId"),[t,n]=(0,l.useState)(""),[d,c]=(0,l.useState)([]),[u,m]=(0,l.useState)(!1),[x,f]=(0,l.useState)(null),[p,g]=(0,l.useState)(!1),j=(0,l.useRef)(null),v=e.setQueryToProcess,y=e.onConversationIdChange,N=e.isMobileWidth?"w-full":"w-4/6";if((0,l.useEffect)(()=>{if(d.length>0){let s=d.map(e=>encodeURIComponent(e));e.setImages(s)}},[d,e.setImages]),(0,l.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&&(m(!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,l.useEffect)(()=>{t&&(m(!0),v(t))},[t,v]),(0,l.useEffect)(()=>{s&&(null==y||y(s))},[s,y]),(0,l.useEffect)(()=>{e.streamedMessages&&e.streamedMessages.length>0&&e.streamedMessages[e.streamedMessages.length-1].completed?(m(!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:i().chatBodyFull,children:(0,a.jsx)(o.Z,{conversationId:s,setTitle:e.setTitle,setAgent:f,pendingMessage:u?t:"",incomingMessages:e.streamedMessages,setIncomingMessages:e.setStreamedMessages,customClassName:N,setIsChatSideBarOpen:e.setIsChatSideBarOpen,onRetryMessage:e.onRetryMessage})}),(0,a.jsx)("div",{className:"".concat(i().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(N," mr-auto ml-auto mt-auto"),children:(0,a.jsx)(h.a,{agentColor:null==x?void 0:x.color,isLoggedIn:e.isLoggedIn,sendMessage:e=>n(e),sendImage:e=>c(s=>[...s,e]),sendDisabled:e.isParentProcessing||!1,chatOptionsData:e.chatOptionsData,conversationId:s,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,ref:j,isResearchModeEnabled:p,setTriggeredAbort:e.setTriggeredAbort})})]}),(0,a.jsx)(en,{conversationId:s,isActive:e.isActive,isOpen:e.isChatSideBarOpen,onOpenChange:e.setIsChatSideBarOpen,isMobileWidth:e.isMobileWidth})]})}function er(){let e="Khoj AI - Chat",[s,t]=(0,l.useState)(null),[n,o]=(0,l.useState)(!0),[r,h]=(0,l.useState)(e),[N,b]=(0,l.useState)(null),[w,_]=(0,l.useState)([]),[S,C]=(0,l.useState)(""),[O,k]=(0,l.useState)(!1),[I,M]=(0,l.useState)(void 0),[E,T]=(0,l.useState)([]),[z,B]=(0,l.useState)(null),[R,L]=(0,l.useState)(!1),[F,A]=(0,l.useState)(!1),{locationData:P,locationDataError:Z,locationDataLoading:J}=(0,u.k6)()||{locationData:{timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}},{data:W,error:D,isLoading:K}=(0,m.GW)(),U=(0,u.IC)(),[V,G]=(0,l.useState)(!1);async function H(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="",i=[],l={},o={};for(;;){let e;let{done:r,value:d}=await s.read();if(r){C(""),k(!1),T([]),N&&(0,c.tQ)(N,h);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:i,onlineContext:l,codeContext:o}=(0,c.VK)(s,e,i,l,o)),_([...w])}}}}async function Q(){if(localStorage.removeItem("message"),!S||!N){k(!1);return}let e={q:S,conversation_id:N,stream:!0,interrupt:F,...P&&{city:P.city,region:P.region,country:P.country,country_code:P.countryCode,timezone:P.timezone},...E.length>0&&{images:E},...I&&{files:I}};A(!1);let 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 H(s)}catch(i){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=i.message,n=i.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(""),k(!1)}}return(0,l.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,l.useEffect)(()=>{R&&(null==z||z.abort(),function(){let e=w.find(e=>!e.completed);e&&(e.completed=!0,_([...w]),k(!1))}(),A(!0),L(!1))},[R]),(0,l.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]),k(!0),B(new AbortController)}},[S]),(0,l.useEffect)(()=>{O&&!J&&Q()},[O,J]),n?(0,a.jsx)(d.Z,{}):(0,a.jsxs)(f.Hn,{children:[(0,a.jsx)(p.S,{conversationId:N||""}),(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"}),N&&(0,a.jsx)("div",{className:"".concat(i().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:U?(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:N,setTitle:h,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:()=>G(!V),children:(0,a.jsx)(y.T,{className:"w-6 h-6"})})})]}),(0,a.jsxs)("div",{className:"".concat(i().main," ").concat(i().chatLayout),children:[(0,a.jsx)("title",{children:"".concat(e).concat(r&&r!==e?": ".concat(r):"")}),(0,a.jsx)("div",{className:i().chatBox,children:(0,a.jsx)("div",{className:i().chatBoxBody,children:(0,a.jsx)(l.Suspense,{fallback:(0,a.jsx)(d.Z,{}),children:(0,a.jsx)(eo,{isLoggedIn:!!W,streamedMessages:w,setStreamedMessages:_,chatOptionsData:s,setTitle:h,setQueryToProcess:C,setUploadedFiles:M,isMobileWidth:U,onConversationIdChange:e=>{b(e)},setImages:T,setTriggeredAbort:L,isChatSideBarOpen:V,setIsChatSideBarOpen:G,isActive:null==W?void 0:W.is_active,isParentProcessing:O,onRetryMessage:(e,s)=>{if(!e){console.warn("No query provided for retry");return}s&&(_(e=>e.filter(e=>e.turnId!==s)),fetch("/api/chat/conversation/message",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversation_id:N,turn_id:s})}).catch(e=>{console.error("Failed to delete message for retry:",e)})),C(e)}})})})})]})]})]})}},26815:function(e,s,t){"use strict";t.d(s,{_:function(){return d}});var a=t(57437),n=t(2265),i=t(6394),l=t(90535),o=t(94508);let r=(0,l.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)(i.f,{ref:s,className:(0,o.cn)(r(),t),...n})});d.displayName=i.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 h},ki:function(){return u}});var a=t(57437),n=t(2265),i=t(56873),l=t(40875),o=t(22135),r=t(30401),d=t(94508);let c=i.fC;i.ZA;let u=i.B4,h=n.forwardRef((e,s)=>{let{className:t,children:n,...o}=e;return(0,a.jsxs)(i.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)(i.JO,{asChild:!0,children:(0,a.jsx)(l.Z,{className:"h-4 w-4 opacity-50"})})]})});h.displayName=i.xz.displayName;let m=n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,a.jsx)(i.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"})})});m.displayName=i.u_.displayName;let x=n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,a.jsx)(i.$G,{ref:s,className:(0,d.cn)("flex cursor-default items-center justify-center py-1",t),...n,children:(0,a.jsx)(l.Z,{className:"h-4 w-4"})})});x.displayName=i.$G.displayName;let f=n.forwardRef((e,s)=>{let{className:t,children:n,position:l="popper",...o}=e;return(0,a.jsx)(i.h_,{children:(0,a.jsxs)(i.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"===l&&"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:l,...o,children:[(0,a.jsx)(m,{}),(0,a.jsx)(i.l_,{className:(0,d.cn)("p-1","popper"===l&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),(0,a.jsx)(x,{})]})})});f.displayName=i.VY.displayName,n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,a.jsx)(i.__,{ref:s,className:(0,d.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...n})}).displayName=i.__.displayName;let p=n.forwardRef((e,s)=>{let{className:t,children:n,...l}=e;return(0,a.jsxs)(i.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),...l,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(i.wU,{children:(0,a.jsx)(r.Z,{className:"h-4 w-4"})})}),(0,a.jsx)(i.eT,{children:n})]})});p.displayName=i.ck.displayName,n.forwardRef((e,s)=>{let{className:t,...n}=e;return(0,a.jsx)(i.Z0,{ref:s,className:(0,d.cn)("-mx-1 my-1 h-px bg-muted",t),...n})}).displayName=i.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,[4842,5638,3954,1919,9259,7200,8667,4363,4447,4357,7211,9334,2327,5477,7127,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([[3111],{91955:function(e,t,s){Promise.resolve().then(s.bind(s,41694))},41694:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return j}});var a=s(57437),o=s(22515),n=s.n(o),i=s(2265),r=s(27127),l=s(14308);s(2446);var c=s(7436),d=s(56937),h=s(5477),u=s(60729),m=s(34124),g=s(6512),x=s(37104),p=s(62869),f=s(19841);function _(e){let{slug:t,className:s}=e,o=async()=>{try{(await fetch("/api/chat/share?public_conversation_slug=".concat(t),{method:"DELETE"})).redirected?window.location.reload():console.error("Failed to unshare conversation")}catch(e){console.error("Error unsharing conversation:",e)}};return(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsx)(p.z,{className:"p-0 text-sm h-auto text-rose-500 hover:text-rose-600",variant:"ghost",title:"Unshare conversation",onClick:o,children:(0,a.jsx)(f.r,{className:"".concat(s)})})})}function v(e){let[t,s]=(0,i.useState)(""),[o,l]=(0,i.useState)([]),[c,d]=(0,i.useState)(!1),[u,m]=(0,i.useState)(null),g=(0,i.useRef)(null),x=e.setQueryToProcess,p=e.streamedMessages,f=e.isMobileWidth?"w-full":"w-4/6";return((0,i.useEffect)(()=>{if(o.length>0){let t=o.map(e=>encodeURIComponent(e));e.setImages(t)}},[o,e.setImages]),(0,i.useEffect)(()=>{t&&(d(!0),x(t))},[t,x]),(0,i.useEffect)(()=>{p&&p.length>0&&p[p.length-1].completed?d(!1):s("")},[p]),e.publicConversationSlug||e.conversationId)?(0,a.jsx)("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:n().chatBodyFull,children:(0,a.jsx)(r.Z,{publicConversationSlug:e.publicConversationSlug,conversationId:e.conversationId||"",setAgent:m,setTitle:e.setTitle,setIsOwner:e.setIsOwner,pendingMessage:c?t:"",incomingMessages:e.streamedMessages,customClassName:f})}),(0,a.jsx)("div",{className:"".concat(n().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(f," mr-auto ml-auto mt-auto"),children:(0,a.jsx)(h.a,{isLoggedIn:e.isLoggedIn,sendMessage:e=>s(e),sendImage:e=>l(t=>[...t,e]),sendDisabled:c,chatOptionsData:e.chatOptionsData,conversationId:e.conversationId,agentColor:null==u?void 0:u.color,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,setTriggeredAbort:()=>{},ref:g})})]})}):(0,a.jsx)("div",{className:n().suggestions,children:"Whoops, nothing to see here!"})}function j(){let[e,t]=(0,i.useState)(null),[s,o]=(0,i.useState)(!0),[r,h]=(0,i.useState)("Khoj AI - Chat"),[p,f]=(0,i.useState)(void 0),[j,w]=(0,i.useState)([]),[N,I]=(0,i.useState)(""),[S,C]=(0,i.useState)(null),[b,y]=(0,i.useState)(void 0),[B,O]=(0,i.useState)([]),[k,E]=(0,i.useState)(!1),{data:T,error:M,isLoading:W}=(0,d.GW)(),F=(0,c.IC)();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,c.EK)(),y(window.location.pathname.split("/").pop()||"")},[]),(0,i.useEffect)(()=>{S&&localStorage.setItem("uploadedFiles",JSON.stringify(S))},[S]),(0,i.useEffect)(()=>{if(N&&!p){fetch("/api/chat/share/fork?public_conversation_slug=".concat(b),{method:"POST",headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{f(e.conversation_id),localStorage.setItem("message",N),B.length>0&&localStorage.setItem("images",JSON.stringify(B)),window.location.href="/chat?conversationId=".concat(e.conversation_id)}).catch(e=>{console.error(e)});return}},[N,p,b]),s)?(0,a.jsx)(l.Z,{}):b?(0,a.jsxs)(u.Hn,{children:[(0,a.jsx)(m.S,{conversationId:p||""}),(0,a.jsxs)(u.kV,{children:[(0,a.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,a.jsx)(u.vP,{className:"-ml-1"}),(0,a.jsx)(g.Z,{orientation:"vertical",className:"mr-2 h-4"}),b&&(0,a.jsx)("div",{className:"".concat(n().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:F?(0,a.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,a.jsx)(x.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}),k&&T&&(0,a.jsx)(_,{slug:b,className:"h-4 w-4 mt-1"})]})})]}),(0,a.jsxs)("div",{className:"".concat(n().main," ").concat(n().chatLayout),children:[(0,a.jsx)("title",{children:r}),(0,a.jsx)("div",{className:n().chatBox,children:(0,a.jsx)("div",{className:n().chatBoxBody,children:(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(l.Z,{}),children:(0,a.jsx)(v,{conversationId:p,streamedMessages:j,setQueryToProcess:I,isLoggedIn:!!T,publicConversationSlug:b,chatOptionsData:e,setTitle:h,setUploadedFiles:C,isMobileWidth:F,setImages:O,setIsOwner:E})})})})]})]})]}):(0,a.jsx)("div",{className:n().suggestions,children:"Whoops, nothing to see here!"})}},22515:function(e){e.exports={main:"sharedChat_main__7Nayy",suggestions:"sharedChat_suggestions__V8kr_",inputBox:"sharedChat_inputBox__wRW5A",chatBodyFull:"sharedChat_chatBodyFull__O1MOv",chatBody:"sharedChat_chatBody__OnHDL",chatLayout:"sharedChat_chatLayout__gutlc",chatBox:"sharedChat_chatBox__PmAPg",titleBar:"sharedChat_titleBar__vOHp_",chatBoxBody:"sharedChat_chatBoxBody__ef2Nl",agentIndicator:"sharedChat_agentIndicator__ORCl4",chatTitleWrapper:"sharedChat_chatTitleWrapper__rVdYj"}}},function(e){e.O(0,[9346,4842,5638,3954,1919,9259,7200,8667,4363,4357,5138,2327,5477,7127,2971,2117,1744],function(){return e(e.s=91955)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3111],{91955:function(e,t,s){Promise.resolve().then(s.bind(s,41694))},41694:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return j}});var a=s(57437),o=s(22515),n=s.n(o),i=s(2265),r=s(27127),l=s(14308);s(2446);var c=s(7436),d=s(56937),h=s(5477),u=s(60729),m=s(34124),g=s(6512),x=s(37104),p=s(62869),f=s(19841);function _(e){let{slug:t,className:s}=e,o=async()=>{try{(await fetch("/api/chat/share?public_conversation_slug=".concat(t),{method:"DELETE"})).redirected?window.location.reload():console.error("Failed to unshare conversation")}catch(e){console.error("Error unsharing conversation:",e)}};return(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsx)(p.z,{className:"p-0 text-sm h-auto text-rose-500 hover:text-rose-600",variant:"ghost",title:"Unshare conversation",onClick:o,children:(0,a.jsx)(f.r,{className:"".concat(s)})})})}function v(e){let[t,s]=(0,i.useState)(""),[o,l]=(0,i.useState)([]),[c,d]=(0,i.useState)(!1),[u,m]=(0,i.useState)(null),g=(0,i.useRef)(null),x=e.setQueryToProcess,p=e.streamedMessages,f=e.isMobileWidth?"w-full":"w-4/6";return((0,i.useEffect)(()=>{if(o.length>0){let t=o.map(e=>encodeURIComponent(e));e.setImages(t)}},[o,e.setImages]),(0,i.useEffect)(()=>{t&&(d(!0),x(t))},[t,x]),(0,i.useEffect)(()=>{p&&p.length>0&&p[p.length-1].completed?d(!1):s("")},[p]),e.publicConversationSlug||e.conversationId)?(0,a.jsx)("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:n().chatBodyFull,children:(0,a.jsx)(r.Z,{publicConversationSlug:e.publicConversationSlug,conversationId:e.conversationId||"",setAgent:m,setTitle:e.setTitle,setIsOwner:e.setIsOwner,pendingMessage:c?t:"",incomingMessages:e.streamedMessages,customClassName:f})}),(0,a.jsx)("div",{className:"".concat(n().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(f," mr-auto ml-auto mt-auto"),children:(0,a.jsx)(h.a,{isLoggedIn:e.isLoggedIn,sendMessage:e=>s(e),sendImage:e=>l(t=>[...t,e]),sendDisabled:c,chatOptionsData:e.chatOptionsData,conversationId:e.conversationId,agentColor:null==u?void 0:u.color,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,setTriggeredAbort:()=>{},ref:g})})]})}):(0,a.jsx)("div",{className:n().suggestions,children:"Whoops, nothing to see here!"})}function j(){let[e,t]=(0,i.useState)(null),[s,o]=(0,i.useState)(!0),[r,h]=(0,i.useState)("Khoj AI - Chat"),[p,f]=(0,i.useState)(void 0),[j,w]=(0,i.useState)([]),[N,I]=(0,i.useState)(""),[S,C]=(0,i.useState)(null),[b,y]=(0,i.useState)(void 0),[B,O]=(0,i.useState)([]),[k,E]=(0,i.useState)(!1),{data:T,error:M,isLoading:W}=(0,d.GW)(),F=(0,c.IC)();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,c.EK)(),y(window.location.pathname.split("/").pop()||"")},[]),(0,i.useEffect)(()=>{S&&localStorage.setItem("uploadedFiles",JSON.stringify(S))},[S]),(0,i.useEffect)(()=>{if(N&&!p){fetch("/api/chat/share/fork?public_conversation_slug=".concat(b),{method:"POST",headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{f(e.conversation_id),localStorage.setItem("message",N),B.length>0&&localStorage.setItem("images",JSON.stringify(B)),window.location.href="/chat?conversationId=".concat(e.conversation_id)}).catch(e=>{console.error(e)});return}},[N,p,b]),s)?(0,a.jsx)(l.Z,{}):b?(0,a.jsxs)(u.Hn,{children:[(0,a.jsx)(m.S,{conversationId:p||""}),(0,a.jsxs)(u.kV,{children:[(0,a.jsxs)("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[(0,a.jsx)(u.vP,{className:"-ml-1"}),(0,a.jsx)(g.Z,{orientation:"vertical",className:"mr-2 h-4"}),b&&(0,a.jsx)("div",{className:"".concat(n().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:F?(0,a.jsx)("a",{className:"p-0 no-underline",href:"/",children:(0,a.jsx)(x.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}),k&&T&&(0,a.jsx)(_,{slug:b,className:"h-4 w-4 mt-1"})]})})]}),(0,a.jsxs)("div",{className:"".concat(n().main," ").concat(n().chatLayout),children:[(0,a.jsx)("title",{children:r}),(0,a.jsx)("div",{className:n().chatBox,children:(0,a.jsx)("div",{className:n().chatBoxBody,children:(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(l.Z,{}),children:(0,a.jsx)(v,{conversationId:p,streamedMessages:j,setQueryToProcess:I,isLoggedIn:!!T,publicConversationSlug:b,chatOptionsData:e,setTitle:h,setUploadedFiles:C,isMobileWidth:F,setImages:O,setIsOwner:E})})})})]})]})]}):(0,a.jsx)("div",{className:n().suggestions,children:"Whoops, nothing to see here!"})}},22515:function(e){e.exports={main:"sharedChat_main__7Nayy",suggestions:"sharedChat_suggestions__V8kr_",inputBox:"sharedChat_inputBox__wRW5A",chatBodyFull:"sharedChat_chatBodyFull__O1MOv",chatBody:"sharedChat_chatBody__OnHDL",chatLayout:"sharedChat_chatLayout__gutlc",chatBox:"sharedChat_chatBox__PmAPg",titleBar:"sharedChat_titleBar__vOHp_",chatBoxBody:"sharedChat_chatBoxBody__ef2Nl",agentIndicator:"sharedChat_agentIndicator__ORCl4",chatTitleWrapper:"sharedChat_chatTitleWrapper__rVdYj"}}},function(e){e.O(0,[9346,4842,5638,3954,1919,9259,7200,8667,4363,4357,7211,2327,5477,7127,2971,2117,1744],function(){return e(e.s=91955)}),_N_E=e.O()}]);
@@ -1 +1 @@
1
- !function(){"use strict";var e,t,n,r,o,a,c,f,u,i={},d={};function b(e){var t=d[e];if(void 0!==t)return t.exports;var n=d[e]={exports:{}},r=!0;try{i[e].call(n.exports,n,n.exports,b),r=!1}finally{r&&delete d[e]}return n.exports}b.m=i,e=[],b.O=function(t,n,r,o){if(n){o=o||0;for(var a=e.length;a>0&&e[a-1][2]>o;a--)e[a]=e[a-1];e[a]=[n,r,o];return}for(var c=1/0,a=0;a<e.length;a++){for(var n=e[a][0],r=e[a][1],o=e[a][2],f=!0,u=0;u<n.length;u++)c>=o&&Object.keys(b.O).every(function(e){return b.O[e](n[u])})?n.splice(u--,1):(f=!1,o<c&&(c=o));if(f){e.splice(a--,1);var i=r();void 0!==i&&(t=i)}}return t},b.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return b.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},b.t=function(e,r){if(1&r&&(e=this(e)),8&r||"object"==typeof e&&e&&(4&r&&e.__esModule||16&r&&"function"==typeof e.then))return e;var o=Object.create(null);b.r(o);var a={};t=t||[null,n({}),n([]),n(n)];for(var c=2&r&&e;"object"==typeof c&&!~t.indexOf(c);c=n(c))Object.getOwnPropertyNames(c).forEach(function(t){a[t]=function(){return e[t]}});return a.default=function(){return e},b.d(o,a),o},b.d=function(e,t){for(var n in t)b.o(t,n)&&!b.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},b.f={},b.e=function(e){return Promise.all(Object.keys(b.f).reduce(function(t,n){return b.f[n](e,t),t},[]))},b.u=function(e){return 4609===e?"static/chunks/4609-33aa487dff03a9fd.js":"static/chunks/"+(({1264:"90542734",6555:"964ecbae",7293:"94ca1967"})[e]||e)+"."+({58:"f4bd8a3c9d88f5fe",133:"392ae90c3b2a67f2",479:"a7e0c9cfc376a695",1243:"ea2826fb35adb15a",1264:"9e6e44b1b45b30fe",1592:"b069bdb7aaddd2eb",2069:"f060659791c0c484",2170:"45431769330fa5b7",3237:"c4754f02f1a388cb",3305:"1fc7297ba154ee95",3332:"6313db5217bb1b67",3451:"421db0b49fdbd881",3460:"39c2b9b6a3898384",4299:"2aaa569416cfc208",4327:"238d15c09a039b8b",4415:"e0c0da5eedae4dd7",4610:"a1e7f40a759ed2aa",4650:"41f041da0ad365ad",4872:"5422e8324272ab40",5061:"79a660faed0e16a9",5279:"85d537880b8041ae",5402:"b9460f1b16b57e92",5555:"f7cf9795d675de51",5978:"ddc72cd73130aadc",6434:"7afea9648e238ad5",6555:"d5be7c49c320d695",7140:"4be689873f6a2d1f",7293:"1b3402358e0e1255",7836:"86884157d53d23a1",7890:"f681eb1d1f83bea2",7953:"f6fc335a23efb959",8254:"3145a4fbdcfdca46",8400:"c95e4e79bcd79a56",8673:"be44c4d9e4f1d084",8698:"a088118fef40d302",9022:"33974a513a281fd2",9433:"b1b5f5d050c43e3c",9822:"34f293973c4e9b04"})[e]+".js"},b.miniCssF=function(e){},b.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),b.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r={},o="_N_E:",b.l=function(e,t,n,a){if(r[e]){r[e].push(t);return}if(void 0!==n)for(var c,f,u=document.getElementsByTagName("script"),i=0;i<u.length;i++){var d=u[i];if(d.getAttribute("src")==e||d.getAttribute("data-webpack")==o+n){c=d;break}}c||(f=!0,(c=document.createElement("script")).charset="utf-8",c.timeout=120,b.nc&&c.setAttribute("nonce",b.nc),c.setAttribute("data-webpack",o+n),c.src=b.tu(e)),r[e]=[t];var l=function(t,n){c.onerror=c.onload=null,clearTimeout(s);var o=r[e];if(delete r[e],c.parentNode&&c.parentNode.removeChild(c),o&&o.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:c}),12e4);c.onerror=l.bind(null,c.onerror),c.onload=l.bind(null,c.onload),f&&document.head.appendChild(c)},b.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},b.tt=function(){return void 0===a&&(a={createScriptURL:function(e){return e}},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(a=trustedTypes.createPolicy("nextjs#bundler",a))),a},b.tu=function(e){return b.tt().createScriptURL(e)},b.p="/_next/",c={2272:0,3254:0,3587:0,6250:0,4842:0,5638:0,2026:0,6008:0,9346:0},b.f.j=function(e,t){var n=b.o(c,e)?c[e]:void 0;if(0!==n){if(n)t.push(n[2]);else if(/^(2026|2272|3254|3587|4842|5638|6008|6250|9346)$/.test(e))c[e]=0;else{var r=new Promise(function(t,r){n=c[e]=[t,r]});t.push(n[2]=r);var o=b.p+b.u(e),a=Error();b.l(o,function(t){if(b.o(c,e)&&(0!==(n=c[e])&&(c[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;a.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",a.name="ChunkLoadError",a.type=r,a.request=o,n[1](a)}},"chunk-"+e,e)}}},b.O.j=function(e){return 0===c[e]},f=function(e,t){var n,r,o=t[0],a=t[1],f=t[2],u=0;if(o.some(function(e){return 0!==c[e]})){for(n in a)b.o(a,n)&&(b.m[n]=a[n]);if(f)var i=f(b)}for(e&&e(t);u<o.length;u++)r=o[u],b.o(c,r)&&c[r]&&c[r][0](),c[r]=0;return b.O(i)},(u=self.webpackChunk_N_E=self.webpackChunk_N_E||[]).forEach(f.bind(null,0)),u.push=f.bind(null,u.push.bind(u)),b.nc=void 0}();
1
+ !function(){"use strict";var e,t,n,r,o,c,a,f,u,i={},d={};function b(e){var t=d[e];if(void 0!==t)return t.exports;var n=d[e]={exports:{}},r=!0;try{i[e].call(n.exports,n,n.exports,b),r=!1}finally{r&&delete d[e]}return n.exports}b.m=i,e=[],b.O=function(t,n,r,o){if(n){o=o||0;for(var c=e.length;c>0&&e[c-1][2]>o;c--)e[c]=e[c-1];e[c]=[n,r,o];return}for(var a=1/0,c=0;c<e.length;c++){for(var n=e[c][0],r=e[c][1],o=e[c][2],f=!0,u=0;u<n.length;u++)a>=o&&Object.keys(b.O).every(function(e){return b.O[e](n[u])})?n.splice(u--,1):(f=!1,o<a&&(a=o));if(f){e.splice(c--,1);var i=r();void 0!==i&&(t=i)}}return t},b.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return b.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},b.t=function(e,r){if(1&r&&(e=this(e)),8&r||"object"==typeof e&&e&&(4&r&&e.__esModule||16&r&&"function"==typeof e.then))return e;var o=Object.create(null);b.r(o);var c={};t=t||[null,n({}),n([]),n(n)];for(var a=2&r&&e;"object"==typeof a&&!~t.indexOf(a);a=n(a))Object.getOwnPropertyNames(a).forEach(function(t){c[t]=function(){return e[t]}});return c.default=function(){return e},b.d(o,c),o},b.d=function(e,t){for(var n in t)b.o(t,n)&&!b.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},b.f={},b.e=function(e){return Promise.all(Object.keys(b.f).reduce(function(t,n){return b.f[n](e,t),t},[]))},b.u=function(e){return 4609===e?"static/chunks/4609-33aa487dff03a9fd.js":"static/chunks/"+(({1264:"90542734",6555:"964ecbae",7293:"94ca1967"})[e]||e)+"."+({58:"f4bd8a3c9d88f5fe",133:"392ae90c3b2a67f2",479:"a7e0c9cfc376a695",1243:"ea2826fb35adb15a",1264:"9e6e44b1b45b30fe",1592:"b069bdb7aaddd2eb",2069:"f060659791c0c484",2170:"45431769330fa5b7",3237:"c4754f02f1a388cb",3305:"1fc7297ba154ee95",3332:"6313db5217bb1b67",3451:"421db0b49fdbd881",3460:"39c2b9b6a3898384",4299:"2aaa569416cfc208",4327:"238d15c09a039b8b",4415:"e0c0da5eedae4dd7",4610:"a1e7f40a759ed2aa",4650:"41f041da0ad365ad",4872:"5422e8324272ab40",5061:"79a660faed0e16a9",5279:"85d537880b8041ae",5402:"b9460f1b16b57e92",5555:"f7cf9795d675de51",5978:"ddc72cd73130aadc",6434:"7afea9648e238ad5",6555:"d5be7c49c320d695",7140:"4be689873f6a2d1f",7293:"1b3402358e0e1255",7836:"86884157d53d23a1",7890:"f681eb1d1f83bea2",7953:"f6fc335a23efb959",8254:"3145a4fbdcfdca46",8400:"c95e4e79bcd79a56",8673:"be44c4d9e4f1d084",8698:"a088118fef40d302",9022:"33974a513a281fd2",9433:"b1b5f5d050c43e3c",9822:"34f293973c4e9b04"})[e]+".js"},b.miniCssF=function(e){},b.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),b.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r={},o="_N_E:",b.l=function(e,t,n,c){if(r[e]){r[e].push(t);return}if(void 0!==n)for(var a,f,u=document.getElementsByTagName("script"),i=0;i<u.length;i++){var d=u[i];if(d.getAttribute("src")==e||d.getAttribute("data-webpack")==o+n){a=d;break}}a||(f=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,b.nc&&a.setAttribute("nonce",b.nc),a.setAttribute("data-webpack",o+n),a.src=b.tu(e)),r[e]=[t];var l=function(t,n){a.onerror=a.onload=null,clearTimeout(s);var o=r[e];if(delete r[e],a.parentNode&&a.parentNode.removeChild(a),o&&o.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=l.bind(null,a.onerror),a.onload=l.bind(null,a.onload),f&&document.head.appendChild(a)},b.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},b.tt=function(){return void 0===c&&(c={createScriptURL:function(e){return e}},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(c=trustedTypes.createPolicy("nextjs#bundler",c))),c},b.tu=function(e){return b.tt().createScriptURL(e)},b.p="/_next/",a={2272:0,3254:0,3587:0,6250:0,4842:0,5638:0,9346:0,6008:0,2026:0},b.f.j=function(e,t){var n=b.o(a,e)?a[e]:void 0;if(0!==n){if(n)t.push(n[2]);else if(/^(2026|2272|3254|3587|4842|5638|6008|6250|9346)$/.test(e))a[e]=0;else{var r=new Promise(function(t,r){n=a[e]=[t,r]});t.push(n[2]=r);var o=b.p+b.u(e),c=Error();b.l(o,function(t){if(b.o(a,e)&&(0!==(n=a[e])&&(a[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;c.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",c.name="ChunkLoadError",c.type=r,c.request=o,n[1](c)}},"chunk-"+e,e)}}},b.O.j=function(e){return 0===a[e]},f=function(e,t){var n,r,o=t[0],c=t[1],f=t[2],u=0;if(o.some(function(e){return 0!==a[e]})){for(n in c)b.o(c,n)&&(b.m[n]=c[n]);if(f)var i=f(b)}for(e&&e(t);u<o.length;u++)r=o[u],b.o(a,r)&&a[r]&&a[r][0](),a[r]=0;return b.O(i)},(u=self.webpackChunk_N_E=self.webpackChunk_N_E||[]).forEach(f.bind(null,0)),u.push=f.bind(null,u.push.bind(u)),b.nc=void 0}();
@@ -1 +1 @@
1
- div.agents_titleBar__FzYbY{padding:16px 0;text-align:left}.agents_agentPersonality__o0Ysz p{white-space:inherit;overflow:hidden;height:77px;line-height:1.5}div.agents_agentPersonality__o0Ysz{text-align:left;grid-column:span 3;overflow:hidden}div.agents_pageLayout__gR3S3{max-width:60vw;margin:auto auto 2rem}button.agents_infoButton__NqI7E{border:none;background-color:transparent!important;text-align:left;font-family:inherit;font-size:medium}div.agents_agentList__XVx4A{display:grid;gap:20px;padding-top:30px;margin-right:auto;grid-auto-flow:row;grid-template-columns:1fr 1fr;margin-left:auto}@media only screen and (max-width:768px){div.agents_agentList__XVx4A{width:100%;padding:0;margin-right:auto;margin-left:auto;grid-template-columns:1fr}div.agents_pageLayout__gR3S3{max-width:90vw}}.loginPrompt_gsiMaterialButton__8QVFH{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;-webkit-appearance:none;background-image:none;border-radius:20px;box-sizing:border-box;color:#1f1f1f;cursor:pointer;font-family:Roboto,arial,sans-serif;font-size:14px;height:40px;letter-spacing:.25px;outline:none;overflow:hidden;padding:0;position:relative;text-align:center;transition:background-color .218s,border-color .218s,box-shadow .218s;vertical-align:middle;white-space:nowrap;width:40px;max-width:400px;min-width:-moz-min-content;min-width:min-content}.loginPrompt_gsiMaterialButton__8QVFH .loginPrompt_gsiMaterialButtonIcon__6TSC5{height:100%;min-width:20px;width:100%;margin:0;padding:9px}.loginPrompt_gsiMaterialButton__8QVFH .loginPrompt_gsiMaterialButtonContentWrapper__9tahB{align-items:center;display:flex;flex-direction:row;flex-wrap:nowrap;height:100%;justify-content:space-between;position:relative;width:100%}.loginPrompt_gsiMaterialButton__8QVFH .loginPrompt_gsiMaterialButtonContents__3_YcB{flex-grow:1;font-family:Roboto,arial,sans-serif;font-weight:500;overflow:hidden;text-overflow:ellipsis;vertical-align:top}.loginPrompt_gsiMaterialButton__8QVFH .loginPrompt_gsiMaterialButtonState__CDGQm{transition:opacity .218s;bottom:0;left:0;opacity:0;position:absolute;right:0;top:0}.loginPrompt_gsiMaterialButton__8QVFH:disabled{cursor:default;background-color:#ffffff61;border-color:#1f1f1f1f}.loginPrompt_gsiMaterialButton__8QVFH:disabled .loginPrompt_gsiMaterialButtonContents__3_YcB,.loginPrompt_gsiMaterialButton__8QVFH:disabled .loginPrompt_gsiMaterialButtonIcon__6TSC5{opacity:38%}.loginPrompt_gsiMaterialButton__8QVFH:not(:disabled):active .loginPrompt_gsiMaterialButton-State__mAfCZ,.loginPrompt_gsiMaterialButton__8QVFH:not(:disabled):focus .loginPrompt_gsiMaterialButtonState__CDGQm{background-color:#303030;opacity:12%}.loginPrompt_gsiMaterialButton__8QVFH:not(:disabled):hover{box-shadow:0 1px 2px 0 rgba(60,64,67,.3),0 1px 3px 1px rgba(60,64,67,.15)}.loginPrompt_gsiMaterialButton__8QVFH:not(:disabled):hover .loginPrompt_gsiMaterialButtonState__CDGQm{background-color:#303030;opacity:8%}div.sidePanel_session__EeNjH{padding:.5rem;margin-bottom:.25rem;border-radius:.5rem;cursor:pointer;max-width:14rem;font-size:medium;display:grid;grid-template-columns:minmax(auto,400px) 1fr;gap:0}div.sidePanel_compressed__CUgIn{grid-template-columns:minmax(12rem,100%) 1fr 1fr}div.sidePanel_sessionHover__cf_VO,div.sidePanel_session__EeNjH:hover{background-color:hsla(var(--popover))}div.sidePanel_session__EeNjH:hover{color:hsla(var(--popover-foreground))}div.sidePanel_session__EeNjH a{text-decoration:none}button.sidePanel_button__NzdN_{border:none;outline:none;background-color:transparent;cursor:pointer;color:var(--main-text-color);width:24px}button.sidePanel_showMoreButton__nDt4Z{border-radius:.5rem;padding:8px}div.sidePanel_panel__9offQ{display:flex;flex-direction:column;padding:1rem;overflow-y:auto;max-width:auto;transition:background-color .5s}div.sidePanel_expanded__aHnYV{gap:1rem;background-color:hsla(var(--muted));height:100%}div.sidePanel_collapsed__ewO3e{display:grid;grid-template-columns:1fr;height:-moz-fit-content;height:fit-content;padding:1rem 0 0 1rem}p.sidePanel_session__EeNjH{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;text-align:left;font-size:small}p.sidePanel_compressed__CUgIn{width:11rem}p.sidePanel_expanded__aHnYV{max-width:20rem}div.sidePanel_header__NCT_v{display:grid;grid-template-columns:1fr auto}div.sidePanel_profile__pfAJU{display:grid;grid-template-columns:auto 1fr;gap:1rem;align-items:center;margin-top:auto}div.sidePanel_panelWrapper__cDMvb{display:grid;grid-template-rows:1fr auto auto;height:100%}div.sidePanel_modalSessionsList___u3aa{position:fixed;top:0;left:0;width:100%;height:100%;background-color:hsla(var(--frosted-background-color));z-index:1;display:flex;justify-content:center;align-items:center;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}div.sidePanel_modalSessionsList___u3aa div.sidePanel_content__z60YO{max-width:80%;max-height:80%;background-color:hsla(var(--frosted-background-color));overflow:auto;padding:20px;border-radius:10px}div.sidePanel_modalSessionsList___u3aa div.sidePanel_session__EeNjH{max-width:100%;text-overflow:ellipsis}@media screen and (max-width:768px){div.sidePanel_panel__9offQ{padding:.25rem;width:100%}div.sidePanel_expanded__aHnYV{z-index:1}div.sidePanel_singleReference__vmXZr{padding:4px}div.sidePanel_panelWrapper__cDMvb{width:100%;padding:0 1rem}div.sidePanel_session__EeNjH.sidePanel_compressed__CUgIn{max-width:100%;display:grid;grid-template-columns:70vw auto;justify-content:space-between}div.sidePanel_session__EeNjH{max-width:100%;grid-template-columns:minmax(auto,70vw) 1fr}}div.automations_automationsLayout__Atoh_{display:grid;grid-template-columns:1fr 1fr;gap:1rem}div.automations_automationCard__BKidA{display:grid;grid-template-rows:auto 1fr auto}div.automations_pageLayout__OaoYA{max-width:60vw;margin:auto auto 2rem}@media screen and (max-width:768px){div.automations_automationsLayout__Atoh_{grid-template-columns:1fr}div.automations_pageLayout__OaoYA{max-width:90vw}}.trainOfThoughtVideoPlayer_videoPlayer__Dz3mA{border:1px solid hsl(var(--border));border-radius:8px;background-color:hsl(var(--background));margin:16px 0;overflow:hidden}.trainOfThoughtVideoPlayer_screen__dvEVh{position:relative;background-color:hsl(var(--muted));min-height:300px;display:flex;align-items:center;justify-content:center}.trainOfThoughtVideoPlayer_screenImage__3SgOQ{max-width:100%;max-height:400px;-o-object-fit:contain;object-fit:contain;border-radius:4px}.trainOfThoughtVideoPlayer_textOverlay__BGbhO{position:absolute;bottom:0;left:0;right:0;background:linear-gradient(transparent,rgba(0,0,0,.8));padding:20px 16px 12px;color:#fff}.trainOfThoughtVideoPlayer_thoughtText__zn_vT{font-size:14px;line-height:1.4;max-height:100px;overflow-y:auto}.trainOfThoughtVideoPlayer_controls__HDkO_{padding:12px 16px;background-color:hsl(var(--card));border-top:1px solid hsl(var(--border))}.trainOfThoughtVideoPlayer_timeline__hSpWu{position:relative;margin-bottom:12px}.trainOfThoughtVideoPlayer_timelineSlider__GQ8dx{width:100%;height:4px;background-color:hsl(var(--muted));border-radius:2px;outline:none;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none}.trainOfThoughtVideoPlayer_timelineSlider__GQ8dx::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:16px;height:16px;border-radius:50%;background-color:hsl(var(--primary));cursor:pointer;border:2px solid #fff;box-shadow:0 2px 4px rgba(0,0,0,.2)}.trainOfThoughtVideoPlayer_timelineSlider__GQ8dx::-moz-range-thumb{width:16px;height:16px;border-radius:50%;background-color:hsl(var(--primary));cursor:pointer;border:2px solid #fff;box-shadow:0 2px 4px rgba(0,0,0,.2)}.trainOfThoughtVideoPlayer_frameMarkers__5y3He{position:absolute;top:-2px;left:0;right:0;height:8px;display:flex;justify-content:space-between;pointer-events:none}.trainOfThoughtVideoPlayer_frameMarker__DBO9Y{width:6px;height:8px;border-radius:1px;cursor:pointer;pointer-events:auto;transition:all .2s ease}.trainOfThoughtVideoPlayer_frameMarker__DBO9Y.trainOfThoughtVideoPlayer_hasImage__GFGAk{background-color:hsl(var(--primary))}.trainOfThoughtVideoPlayer_frameMarker__DBO9Y.trainOfThoughtVideoPlayer_textOnly__okufk{background-color:hsl(var(--muted-foreground))}.trainOfThoughtVideoPlayer_frameMarker__DBO9Y.trainOfThoughtVideoPlayer_active__zp6u9{background-color:hsl(var(--accent))!important;transform:scaleY(1.5)}.trainOfThoughtVideoPlayer_frameMarker__DBO9Y:hover{transform:scaleY(1.2)}.trainOfThoughtVideoPlayer_controlButtons__rqfIH{display:flex;align-items:center;gap:8px;margin-bottom:8px}.trainOfThoughtVideoPlayer_controlButton___RdE_{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:1px solid hsl(var(--border));border-radius:4px;background-color:hsl(var(--background));color:hsl(var(--foreground));cursor:pointer;transition:all .2s ease}.trainOfThoughtVideoPlayer_controlButton___RdE_:hover:not(:disabled){background-color:hsl(var(--muted))}.trainOfThoughtVideoPlayer_controlButton___RdE_:disabled{opacity:.5;cursor:not-allowed}.trainOfThoughtVideoPlayer_controlButton___RdE_.trainOfThoughtVideoPlayer_active__zp6u9{background-color:hsl(var(--primary));color:hsl(var(--primary-foreground))}.trainOfThoughtVideoPlayer_frameInfo__u5nwA{display:flex;justify-content:center;font-size:12px;color:hsl(var(--muted-foreground))}@media (prefers-color-scheme:dark){.trainOfThoughtVideoPlayer_textOverlay__BGbhO{background:linear-gradient(transparent,rgba(0,0,0,.9))}}div.chatInputArea_actualInputArea__Ha6cN{display:grid;grid-template-columns:auto 1fr auto auto}.agentCard_agentPersonality__MmRlN p{white-space:inherit;overflow:hidden;height:77px;line-height:1.5}div.agentCard_agentPersonality__MmRlN{text-align:left;grid-column:span 3;overflow:hidden}button.agentCard_infoButton__heh_w{border:none;background-color:transparent!important;text-align:left;font-family:inherit;font-size:medium}
1
+ div.agents_titleBar__FzYbY{padding:16px 0;text-align:left}.agents_agentPersonality__o0Ysz p{white-space:inherit;overflow:hidden;height:77px;line-height:1.5}div.agents_agentPersonality__o0Ysz{text-align:left;grid-column:span 3;overflow:hidden}div.agents_pageLayout__gR3S3{max-width:60vw;margin:auto auto 2rem}button.agents_infoButton__NqI7E{border:none;background-color:transparent!important;text-align:left;font-family:inherit;font-size:medium}div.agents_agentList__XVx4A{display:grid;gap:20px;padding-top:30px;margin-right:auto;grid-auto-flow:row;grid-template-columns:1fr 1fr;margin-left:auto}@media only screen and (max-width:768px){div.agents_agentList__XVx4A{width:100%;padding:0;margin-right:auto;margin-left:auto;grid-template-columns:1fr}div.agents_pageLayout__gR3S3{max-width:90vw}}div.sidePanel_session__EeNjH{padding:.5rem;margin-bottom:.25rem;border-radius:.5rem;cursor:pointer;max-width:14rem;font-size:medium;display:grid;grid-template-columns:minmax(auto,400px) 1fr;gap:0}div.sidePanel_compressed__CUgIn{grid-template-columns:minmax(12rem,100%) 1fr 1fr}div.sidePanel_sessionHover__cf_VO,div.sidePanel_session__EeNjH:hover{background-color:hsla(var(--popover))}div.sidePanel_session__EeNjH:hover{color:hsla(var(--popover-foreground))}div.sidePanel_session__EeNjH a{text-decoration:none}button.sidePanel_button__NzdN_{border:none;outline:none;background-color:transparent;cursor:pointer;color:var(--main-text-color);width:24px}button.sidePanel_showMoreButton__nDt4Z{border-radius:.5rem;padding:8px}div.sidePanel_panel__9offQ{display:flex;flex-direction:column;padding:1rem;overflow-y:auto;max-width:auto;transition:background-color .5s}div.sidePanel_expanded__aHnYV{gap:1rem;background-color:hsla(var(--muted));height:100%}div.sidePanel_collapsed__ewO3e{display:grid;grid-template-columns:1fr;height:-moz-fit-content;height:fit-content;padding:1rem 0 0 1rem}p.sidePanel_session__EeNjH{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;text-align:left;font-size:small}p.sidePanel_compressed__CUgIn{width:11rem}p.sidePanel_expanded__aHnYV{max-width:20rem}div.sidePanel_header__NCT_v{display:grid;grid-template-columns:1fr auto}div.sidePanel_profile__pfAJU{display:grid;grid-template-columns:auto 1fr;gap:1rem;align-items:center;margin-top:auto}div.sidePanel_panelWrapper__cDMvb{display:grid;grid-template-rows:1fr auto auto;height:100%}div.sidePanel_modalSessionsList___u3aa{position:fixed;top:0;left:0;width:100%;height:100%;background-color:hsla(var(--frosted-background-color));z-index:1;display:flex;justify-content:center;align-items:center;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}div.sidePanel_modalSessionsList___u3aa div.sidePanel_content__z60YO{max-width:80%;max-height:80%;background-color:hsla(var(--frosted-background-color));overflow:auto;padding:20px;border-radius:10px}div.sidePanel_modalSessionsList___u3aa div.sidePanel_session__EeNjH{max-width:100%;text-overflow:ellipsis}@media screen and (max-width:768px){div.sidePanel_panel__9offQ{padding:.25rem;width:100%}div.sidePanel_expanded__aHnYV{z-index:1}div.sidePanel_singleReference__vmXZr{padding:4px}div.sidePanel_panelWrapper__cDMvb{width:100%;padding:0 1rem}div.sidePanel_session__EeNjH.sidePanel_compressed__CUgIn{max-width:100%;display:grid;grid-template-columns:70vw auto;justify-content:space-between}div.sidePanel_session__EeNjH{max-width:100%;grid-template-columns:minmax(auto,70vw) 1fr}}.loginPrompt_gsiMaterialButton__8QVFH{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;-webkit-appearance:none;background-image:none;border-radius:20px;box-sizing:border-box;color:#1f1f1f;cursor:pointer;font-family:Roboto,arial,sans-serif;font-size:14px;height:40px;letter-spacing:.25px;outline:none;overflow:hidden;padding:0;position:relative;text-align:center;transition:background-color .218s,border-color .218s,box-shadow .218s;vertical-align:middle;white-space:nowrap;width:40px;max-width:400px;min-width:-moz-min-content;min-width:min-content}.loginPrompt_gsiMaterialButton__8QVFH .loginPrompt_gsiMaterialButtonIcon__6TSC5{height:100%;min-width:20px;width:100%;margin:0;padding:9px}.loginPrompt_gsiMaterialButton__8QVFH .loginPrompt_gsiMaterialButtonContentWrapper__9tahB{align-items:center;display:flex;flex-direction:row;flex-wrap:nowrap;height:100%;justify-content:space-between;position:relative;width:100%}.loginPrompt_gsiMaterialButton__8QVFH .loginPrompt_gsiMaterialButtonContents__3_YcB{flex-grow:1;font-family:Roboto,arial,sans-serif;font-weight:500;overflow:hidden;text-overflow:ellipsis;vertical-align:top}.loginPrompt_gsiMaterialButton__8QVFH .loginPrompt_gsiMaterialButtonState__CDGQm{transition:opacity .218s;bottom:0;left:0;opacity:0;position:absolute;right:0;top:0}.loginPrompt_gsiMaterialButton__8QVFH:disabled{cursor:default;background-color:#ffffff61;border-color:#1f1f1f1f}.loginPrompt_gsiMaterialButton__8QVFH:disabled .loginPrompt_gsiMaterialButtonContents__3_YcB,.loginPrompt_gsiMaterialButton__8QVFH:disabled .loginPrompt_gsiMaterialButtonIcon__6TSC5{opacity:38%}.loginPrompt_gsiMaterialButton__8QVFH:not(:disabled):active .loginPrompt_gsiMaterialButton-State__mAfCZ,.loginPrompt_gsiMaterialButton__8QVFH:not(:disabled):focus .loginPrompt_gsiMaterialButtonState__CDGQm{background-color:#303030;opacity:12%}.loginPrompt_gsiMaterialButton__8QVFH:not(:disabled):hover{box-shadow:0 1px 2px 0 rgba(60,64,67,.3),0 1px 3px 1px rgba(60,64,67,.15)}.loginPrompt_gsiMaterialButton__8QVFH:not(:disabled):hover .loginPrompt_gsiMaterialButtonState__CDGQm{background-color:#303030;opacity:8%}div.automations_automationsLayout__Atoh_{display:grid;grid-template-columns:1fr 1fr;gap:1rem}div.automations_automationCard__BKidA{display:grid;grid-template-rows:auto 1fr auto}div.automations_pageLayout__OaoYA{max-width:60vw;margin:auto auto 2rem}@media screen and (max-width:768px){div.automations_automationsLayout__Atoh_{grid-template-columns:1fr}div.automations_pageLayout__OaoYA{max-width:90vw}}.trainOfThoughtVideoPlayer_videoPlayer__Dz3mA{border:1px solid hsl(var(--border));border-radius:8px;background-color:hsl(var(--background));margin:16px 0;overflow:hidden}.trainOfThoughtVideoPlayer_screen__dvEVh{position:relative;background-color:hsl(var(--muted));min-height:300px;display:flex;align-items:center;justify-content:center}.trainOfThoughtVideoPlayer_screenImage__3SgOQ{max-width:100%;max-height:400px;-o-object-fit:contain;object-fit:contain;border-radius:4px}.trainOfThoughtVideoPlayer_textOverlay__BGbhO{position:absolute;bottom:0;left:0;right:0;background:linear-gradient(transparent,rgba(0,0,0,.8));padding:20px 16px 12px;color:#fff}.trainOfThoughtVideoPlayer_thoughtText__zn_vT{font-size:14px;line-height:1.4;max-height:100px;overflow-y:auto}.trainOfThoughtVideoPlayer_controls__HDkO_{padding:12px 16px;background-color:hsl(var(--card));border-top:1px solid hsl(var(--border))}.trainOfThoughtVideoPlayer_timeline__hSpWu{position:relative;margin-bottom:12px}.trainOfThoughtVideoPlayer_timelineSlider__GQ8dx{width:100%;height:4px;background-color:hsl(var(--muted));border-radius:2px;outline:none;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none}.trainOfThoughtVideoPlayer_timelineSlider__GQ8dx::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:16px;height:16px;border-radius:50%;background-color:hsl(var(--primary));cursor:pointer;border:2px solid #fff;box-shadow:0 2px 4px rgba(0,0,0,.2)}.trainOfThoughtVideoPlayer_timelineSlider__GQ8dx::-moz-range-thumb{width:16px;height:16px;border-radius:50%;background-color:hsl(var(--primary));cursor:pointer;border:2px solid #fff;box-shadow:0 2px 4px rgba(0,0,0,.2)}.trainOfThoughtVideoPlayer_frameMarkers__5y3He{position:absolute;top:-2px;left:0;right:0;height:8px;display:flex;justify-content:space-between;pointer-events:none}.trainOfThoughtVideoPlayer_frameMarker__DBO9Y{width:6px;height:8px;border-radius:1px;cursor:pointer;pointer-events:auto;transition:all .2s ease}.trainOfThoughtVideoPlayer_frameMarker__DBO9Y.trainOfThoughtVideoPlayer_hasImage__GFGAk{background-color:hsl(var(--primary))}.trainOfThoughtVideoPlayer_frameMarker__DBO9Y.trainOfThoughtVideoPlayer_textOnly__okufk{background-color:hsl(var(--muted-foreground))}.trainOfThoughtVideoPlayer_frameMarker__DBO9Y.trainOfThoughtVideoPlayer_active__zp6u9{background-color:hsl(var(--accent))!important;transform:scaleY(1.5)}.trainOfThoughtVideoPlayer_frameMarker__DBO9Y:hover{transform:scaleY(1.2)}.trainOfThoughtVideoPlayer_controlButtons__rqfIH{display:flex;align-items:center;gap:8px;margin-bottom:8px}.trainOfThoughtVideoPlayer_controlButton___RdE_{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:1px solid hsl(var(--border));border-radius:4px;background-color:hsl(var(--background));color:hsl(var(--foreground));cursor:pointer;transition:all .2s ease}.trainOfThoughtVideoPlayer_controlButton___RdE_:hover:not(:disabled){background-color:hsl(var(--muted))}.trainOfThoughtVideoPlayer_controlButton___RdE_:disabled{opacity:.5;cursor:not-allowed}.trainOfThoughtVideoPlayer_controlButton___RdE_.trainOfThoughtVideoPlayer_active__zp6u9{background-color:hsl(var(--primary));color:hsl(var(--primary-foreground))}.trainOfThoughtVideoPlayer_frameInfo__u5nwA{display:flex;justify-content:center;font-size:12px;color:hsl(var(--muted-foreground))}@media (prefers-color-scheme:dark){.trainOfThoughtVideoPlayer_textOverlay__BGbhO{background:linear-gradient(transparent,rgba(0,0,0,.9))}}div.chatInputArea_actualInputArea__Ha6cN{display:grid;grid-template-columns:auto 1fr auto auto}.agentCard_agentPersonality__MmRlN p{white-space:inherit;overflow:hidden;height:77px;line-height:1.5}div.agentCard_agentPersonality__MmRlN{text-align:left;grid-column:span 3;overflow:hidden}button.agentCard_infoButton__heh_w{border:none;background-color:transparent!important;text-align:left;font-family:inherit;font-size:medium}