khoj 1.29.0__py3-none-any.whl → 1.29.1__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 (37) hide show
  1. khoj/database/migrations/0074_alter_conversation_title.py +17 -0
  2. khoj/database/models/__init__.py +1 -1
  3. khoj/interface/compiled/404/index.html +1 -1
  4. khoj/interface/compiled/_next/static/chunks/app/agents/{page-4353b1a532795ad1.js → page-ee4f0da14df15091.js} +1 -1
  5. khoj/interface/compiled/_next/static/chunks/app/automations/{page-c9f13c865e739607.js → page-da59a2b9ec07da16.js} +1 -1
  6. khoj/interface/compiled/_next/static/chunks/app/chat/{page-45720e1ed71e3ef5.js → page-90d3621e1e3f0cb2.js} +1 -1
  7. khoj/interface/compiled/_next/static/chunks/app/{page-ecb8e1c192aa8834.js → page-b4f76bc1b35170c4.js} +1 -1
  8. khoj/interface/compiled/_next/static/chunks/app/search/{page-8e28deacb61f75aa.js → page-4f44549ba3807021.js} +1 -1
  9. khoj/interface/compiled/_next/static/chunks/app/settings/{page-610d33158b233b34.js → page-5591490850437232.js} +1 -1
  10. khoj/interface/compiled/_next/static/chunks/app/share/chat/{page-30376aa7e9cfa342.js → page-178afe8ed85593c4.js} +1 -1
  11. khoj/interface/compiled/_next/static/chunks/{webpack-6e43825796b7dfa6.js → webpack-0769777912137ea3.js} +1 -1
  12. khoj/interface/compiled/_next/static/css/4cae6c0e5c72fb2d.css +1 -0
  13. khoj/interface/compiled/_next/static/css/9d45de78fba367c1.css +1 -0
  14. khoj/interface/compiled/agents/index.html +1 -1
  15. khoj/interface/compiled/agents/index.txt +2 -2
  16. khoj/interface/compiled/automations/index.html +1 -1
  17. khoj/interface/compiled/automations/index.txt +2 -2
  18. khoj/interface/compiled/chat/index.html +1 -1
  19. khoj/interface/compiled/chat/index.txt +2 -2
  20. khoj/interface/compiled/index.html +1 -1
  21. khoj/interface/compiled/index.txt +2 -2
  22. khoj/interface/compiled/search/index.html +1 -1
  23. khoj/interface/compiled/search/index.txt +2 -2
  24. khoj/interface/compiled/settings/index.html +1 -1
  25. khoj/interface/compiled/settings/index.txt +2 -2
  26. khoj/interface/compiled/share/chat/index.html +1 -1
  27. khoj/interface/compiled/share/chat/index.txt +2 -2
  28. khoj/routers/api_content.py +12 -2
  29. {khoj-1.29.0.dist-info → khoj-1.29.1.dist-info}/METADATA +2 -1
  30. {khoj-1.29.0.dist-info → khoj-1.29.1.dist-info}/RECORD +35 -34
  31. {khoj-1.29.0.dist-info → khoj-1.29.1.dist-info}/WHEEL +1 -1
  32. khoj/interface/compiled/_next/static/css/2d097a35da6bfe8d.css +0 -1
  33. khoj/interface/compiled/_next/static/css/592ca99f5122e75a.css +0 -1
  34. /khoj/interface/compiled/_next/static/{bM0HVaqXqBW3iL4kXivLq → n5-LsQwOfQsEHB9mAc6q0}/_buildManifest.js +0 -0
  35. /khoj/interface/compiled/_next/static/{bM0HVaqXqBW3iL4kXivLq → n5-LsQwOfQsEHB9mAc6q0}/_ssgManifest.js +0 -0
  36. {khoj-1.29.0.dist-info → khoj-1.29.1.dist-info}/entry_points.txt +0 -0
  37. {khoj-1.29.0.dist-info → khoj-1.29.1.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,17 @@
1
+ # Generated by Django 5.0.9 on 2024-11-12 09:50
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+ dependencies = [
8
+ ("database", "0073_delete_usersearchmodelconfig"),
9
+ ]
10
+
11
+ operations = [
12
+ migrations.AlterField(
13
+ model_name="conversation",
14
+ name="title",
15
+ field=models.CharField(blank=True, default=None, max_length=500, null=True),
16
+ ),
17
+ ]
@@ -463,7 +463,7 @@ class Conversation(BaseModel):
463
463
  slug = models.CharField(max_length=200, default=None, null=True, blank=True)
464
464
 
465
465
  # The title field is explicitly set by the user.
466
- title = models.CharField(max_length=200, default=None, null=True, blank=True)
466
+ title = models.CharField(max_length=500, default=None, null=True, blank=True)
467
467
  agent = models.ForeignKey(Agent, on_delete=models.SET_NULL, default=None, null=True, blank=True)
468
468
  file_filters = models.JSONField(default=list)
469
469
  id = models.UUIDField(default=uuid.uuid4, editable=False, unique=True, primary_key=True, db_index=True)
@@ -1 +1 @@
1
- <!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" href="/_next/static/media/5455839c73f146e7-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="stylesheet" href="/_next/static/css/0e9d53dcd7f11342.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/ed437164d77aa600.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-6e43825796b7dfa6.js"/><script src="/_next/static/chunks/fd9d1056-2b978342deb60015.js" async=""></script><script src="/_next/static/chunks/7023-a5bf5744d19b3bd3.js" async=""></script><script src="/_next/static/chunks/main-app-6d6ee3495efe03d4.js" async=""></script><meta name="robots" content="noindex"/><meta http-equiv="Content-Security-Policy" content="default-src &#x27;self&#x27; https://assets.khoj.dev; media-src * blob:; script-src &#x27;self&#x27; https://assets.khoj.dev &#x27;unsafe-inline&#x27; &#x27;unsafe-eval&#x27;; connect-src &#x27;self&#x27; blob: https://ipapi.co/json ws://localhost:42110; style-src &#x27;self&#x27; https://assets.khoj.dev &#x27;unsafe-inline&#x27; https://fonts.googleapis.com; img-src &#x27;self&#x27; data: blob: https://*.khoj.dev https://*.googleusercontent.com https://*.google.com/ https://*.gstatic.com; font-src &#x27;self&#x27; https://assets.khoj.dev https://fonts.gstatic.com; child-src &#x27;none&#x27;; object-src &#x27;none&#x27;;"/><title>404: This page could not be found.</title><title>Khoj AI - Home</title><meta name="description" content="Your Second Brain."/><link rel="manifest" href="/static/khoj.webmanifest" crossorigin="use-credentials"/><meta property="og:title" content="Khoj AI"/><meta property="og:description" content="Your Second Brain."/><meta property="og:url" content="https://app.khoj.dev/"/><meta property="og:site_name" content="Khoj AI"/><meta property="og:image" content="https://assets.khoj.dev/khoj_lantern_256x256.png"/><meta property="og:image:width" content="256"/><meta property="og:image:height" content="256"/><meta property="og:image" content="https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:type" content="website"/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:title" content="Khoj AI"/><meta name="twitter:description" content="Your Second Brain."/><meta name="twitter:image" content="https://assets.khoj.dev/khoj_lantern_256x256.png"/><meta name="twitter:image:width" content="256"/><meta name="twitter:image:height" content="256"/><meta name="twitter:image" content="https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png"/><meta name="twitter:image:width" content="1200"/><meta name="twitter:image:height" content="630"/><link rel="icon" href="/static/assets/icons/khoj_lantern.ico"/><link rel="apple-touch-icon" href="/static/assets/icons/khoj_lantern_256x256.png"/><meta name="next-size-adjust"/><script src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js" noModule=""></script></head><body class="__className_af6c42"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><script src="/_next/static/chunks/webpack-6e43825796b7dfa6.js" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0]);self.__next_f.push([2,null])</script><script>self.__next_f.push([1,"1:HL[\"/_next/static/media/5455839c73f146e7-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n2:HL[\"/_next/static/css/0e9d53dcd7f11342.css\",\"style\"]\n3:HL[\"/_next/static/css/ed437164d77aa600.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"4:I[95751,[],\"\"]\n6:I[39275,[],\"\"]\n7:I[61343,[],\"\"]\nd:I[76130,[],\"\"]\n8:{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"}\n9:{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"}\na:{\"display\":\"inline-block\"}\nb:{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0}\ne:[]\n"])</script><script>self.__next_f.push([1,"0:[\"$\",\"$L4\",null,{\"buildId\":\"bM0HVaqXqBW3iL4kXivLq\",\"assetPrefix\":\"\",\"urlParts\":[\"\",\"_not-found\",\"\"],\"initialTree\":[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],\"initialSeedData\":[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{},[[\"$L5\",[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],null],null],null]},[null,[\"$\",\"$L6\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"/_not-found\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L7\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\"}]],null]},[[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/0e9d53dcd7f11342.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/ed437164d77aa600.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[[\"$\",\"meta\",null,{\"httpEquiv\":\"Content-Security-Policy\",\"content\":\"default-src 'self' https://assets.khoj.dev; media-src * blob:; script-src 'self' https://assets.khoj.dev 'unsafe-inline' 'unsafe-eval'; connect-src 'self' blob: https://ipapi.co/json ws://localhost:42110; style-src 'self' https://assets.khoj.dev 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob: https://*.khoj.dev https://*.googleusercontent.com https://*.google.com/ https://*.gstatic.com; font-src 'self' https://assets.khoj.dev https://fonts.gstatic.com; child-src 'none'; object-src 'none';\"}],[\"$\",\"body\",null,{\"className\":\"__className_af6c42\",\"children\":[\"$\",\"$L6\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L7\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$8\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$9\",\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":\"$a\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$b\",\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[]}]}]]}]],null],null],\"couldBeIntercepted\":false,\"initialHead\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],\"$Lc\"],\"globalErrorComponent\":\"$d\",\"missingSlots\":\"$We\"}]\n"])</script><script>self.__next_f.push([1,"c:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"2\",{\"children\":\"Khoj AI - Home\"}],[\"$\",\"meta\",\"3\",{\"name\":\"description\",\"content\":\"Your Second Brain.\"}],[\"$\",\"link\",\"4\",{\"rel\":\"manifest\",\"href\":\"/static/khoj.webmanifest\",\"crossOrigin\":\"use-credentials\"}],[\"$\",\"meta\",\"5\",{\"property\":\"og:title\",\"content\":\"Khoj AI\"}],[\"$\",\"meta\",\"6\",{\"property\":\"og:description\",\"content\":\"Your Second Brain.\"}],[\"$\",\"meta\",\"7\",{\"property\":\"og:url\",\"content\":\"https://app.khoj.dev/\"}],[\"$\",\"meta\",\"8\",{\"property\":\"og:site_name\",\"content\":\"Khoj AI\"}],[\"$\",\"meta\",\"9\",{\"property\":\"og:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_256x256.png\"}],[\"$\",\"meta\",\"10\",{\"property\":\"og:image:width\",\"content\":\"256\"}],[\"$\",\"meta\",\"11\",{\"property\":\"og:image:height\",\"content\":\"256\"}],[\"$\",\"meta\",\"12\",{\"property\":\"og:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png\"}],[\"$\",\"meta\",\"13\",{\"property\":\"og:image:width\",\"content\":\"1200\"}],[\"$\",\"meta\",\"14\",{\"property\":\"og:image:height\",\"content\":\"630\"}],[\"$\",\"meta\",\"15\",{\"property\":\"og:type\",\"content\":\"website\"}],[\"$\",\"meta\",\"16\",{\"name\":\"twitter:card\",\"content\":\"summary_large_image\"}],[\"$\",\"meta\",\"17\",{\"name\":\"twitter:title\",\"content\":\"Khoj AI\"}],[\"$\",\"meta\",\"18\",{\"name\":\"twitter:description\",\"content\":\"Your Second Brain.\"}],[\"$\",\"meta\",\"19\",{\"name\":\"twitter:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_256x256.png\"}],[\"$\",\"meta\",\"20\",{\"name\":\"twitter:image:width\",\"content\":\"256\"}],[\"$\",\"meta\",\"21\",{\"name\":\"twitter:image:height\",\"content\":\"256\"}],[\"$\",\"meta\",\"22\",{\"name\":\"twitter:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png\"}],[\"$\",\"meta\",\"23\",{\"name\":\"twitter:image:width\",\"content\":\"1200\"}],[\"$\",\"meta\",\"24\",{\"name\":\"twitter:image:height\",\"content\":\"630\"}],[\"$\",\"link\",\"25\",{\"rel\":\"icon\",\"href\":\"/static/assets/icons/khoj_lantern.ico\"}],[\"$\",\"link\",\"26\",{\"rel\":\"apple-touch-icon\",\"href\":\"/static/assets/icons/khoj_lantern_256x256.png\"}],[\"$\",\"meta\",\"27\",{\"name\":\"next-size-adjust\"}]]\n"])</script><script>self.__next_f.push([1,"5:null\n"])</script></body></html>
1
+ <!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" href="/_next/static/media/5455839c73f146e7-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="stylesheet" href="/_next/static/css/0e9d53dcd7f11342.css" data-precedence="next"/><link rel="stylesheet" href="/_next/static/css/ed437164d77aa600.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-0769777912137ea3.js"/><script src="/_next/static/chunks/fd9d1056-2b978342deb60015.js" async=""></script><script src="/_next/static/chunks/7023-a5bf5744d19b3bd3.js" async=""></script><script src="/_next/static/chunks/main-app-6d6ee3495efe03d4.js" async=""></script><meta name="robots" content="noindex"/><meta http-equiv="Content-Security-Policy" content="default-src &#x27;self&#x27; https://assets.khoj.dev; media-src * blob:; script-src &#x27;self&#x27; https://assets.khoj.dev &#x27;unsafe-inline&#x27; &#x27;unsafe-eval&#x27;; connect-src &#x27;self&#x27; blob: https://ipapi.co/json ws://localhost:42110; style-src &#x27;self&#x27; https://assets.khoj.dev &#x27;unsafe-inline&#x27; https://fonts.googleapis.com; img-src &#x27;self&#x27; data: blob: https://*.khoj.dev https://*.googleusercontent.com https://*.google.com/ https://*.gstatic.com; font-src &#x27;self&#x27; https://assets.khoj.dev https://fonts.gstatic.com; child-src &#x27;none&#x27;; object-src &#x27;none&#x27;;"/><title>404: This page could not be found.</title><title>Khoj AI - Home</title><meta name="description" content="Your Second Brain."/><link rel="manifest" href="/static/khoj.webmanifest" crossorigin="use-credentials"/><meta property="og:title" content="Khoj AI"/><meta property="og:description" content="Your Second Brain."/><meta property="og:url" content="https://app.khoj.dev/"/><meta property="og:site_name" content="Khoj AI"/><meta property="og:image" content="https://assets.khoj.dev/khoj_lantern_256x256.png"/><meta property="og:image:width" content="256"/><meta property="og:image:height" content="256"/><meta property="og:image" content="https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:type" content="website"/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:title" content="Khoj AI"/><meta name="twitter:description" content="Your Second Brain."/><meta name="twitter:image" content="https://assets.khoj.dev/khoj_lantern_256x256.png"/><meta name="twitter:image:width" content="256"/><meta name="twitter:image:height" content="256"/><meta name="twitter:image" content="https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png"/><meta name="twitter:image:width" content="1200"/><meta name="twitter:image:height" content="630"/><link rel="icon" href="/static/assets/icons/khoj_lantern.ico"/><link rel="apple-touch-icon" href="/static/assets/icons/khoj_lantern_256x256.png"/><meta name="next-size-adjust"/><script src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js" noModule=""></script></head><body class="__className_af6c42"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><script src="/_next/static/chunks/webpack-0769777912137ea3.js" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0]);self.__next_f.push([2,null])</script><script>self.__next_f.push([1,"1:HL[\"/_next/static/media/5455839c73f146e7-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n2:HL[\"/_next/static/css/0e9d53dcd7f11342.css\",\"style\"]\n3:HL[\"/_next/static/css/ed437164d77aa600.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"4:I[95751,[],\"\"]\n6:I[39275,[],\"\"]\n7:I[61343,[],\"\"]\nd:I[76130,[],\"\"]\n8:{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"}\n9:{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"}\na:{\"display\":\"inline-block\"}\nb:{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0}\ne:[]\n"])</script><script>self.__next_f.push([1,"0:[\"$\",\"$L4\",null,{\"buildId\":\"n5-LsQwOfQsEHB9mAc6q0\",\"assetPrefix\":\"\",\"urlParts\":[\"\",\"_not-found\",\"\"],\"initialTree\":[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],\"initialSeedData\":[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{},[[\"$L5\",[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],null],null],null]},[null,[\"$\",\"$L6\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"/_not-found\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L7\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\"}]],null]},[[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/0e9d53dcd7f11342.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}],[\"$\",\"link\",\"1\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/ed437164d77aa600.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[[\"$\",\"meta\",null,{\"httpEquiv\":\"Content-Security-Policy\",\"content\":\"default-src 'self' https://assets.khoj.dev; media-src * blob:; script-src 'self' https://assets.khoj.dev 'unsafe-inline' 'unsafe-eval'; connect-src 'self' blob: https://ipapi.co/json ws://localhost:42110; style-src 'self' https://assets.khoj.dev 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: blob: https://*.khoj.dev https://*.googleusercontent.com https://*.google.com/ https://*.gstatic.com; font-src 'self' https://assets.khoj.dev https://fonts.gstatic.com; child-src 'none'; object-src 'none';\"}],[\"$\",\"body\",null,{\"className\":\"__className_af6c42\",\"children\":[\"$\",\"$L6\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L7\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$8\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$9\",\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":\"$a\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$b\",\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[]}]}]]}]],null],null],\"couldBeIntercepted\":false,\"initialHead\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],\"$Lc\"],\"globalErrorComponent\":\"$d\",\"missingSlots\":\"$We\"}]\n"])</script><script>self.__next_f.push([1,"c:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"2\",{\"children\":\"Khoj AI - Home\"}],[\"$\",\"meta\",\"3\",{\"name\":\"description\",\"content\":\"Your Second Brain.\"}],[\"$\",\"link\",\"4\",{\"rel\":\"manifest\",\"href\":\"/static/khoj.webmanifest\",\"crossOrigin\":\"use-credentials\"}],[\"$\",\"meta\",\"5\",{\"property\":\"og:title\",\"content\":\"Khoj AI\"}],[\"$\",\"meta\",\"6\",{\"property\":\"og:description\",\"content\":\"Your Second Brain.\"}],[\"$\",\"meta\",\"7\",{\"property\":\"og:url\",\"content\":\"https://app.khoj.dev/\"}],[\"$\",\"meta\",\"8\",{\"property\":\"og:site_name\",\"content\":\"Khoj AI\"}],[\"$\",\"meta\",\"9\",{\"property\":\"og:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_256x256.png\"}],[\"$\",\"meta\",\"10\",{\"property\":\"og:image:width\",\"content\":\"256\"}],[\"$\",\"meta\",\"11\",{\"property\":\"og:image:height\",\"content\":\"256\"}],[\"$\",\"meta\",\"12\",{\"property\":\"og:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png\"}],[\"$\",\"meta\",\"13\",{\"property\":\"og:image:width\",\"content\":\"1200\"}],[\"$\",\"meta\",\"14\",{\"property\":\"og:image:height\",\"content\":\"630\"}],[\"$\",\"meta\",\"15\",{\"property\":\"og:type\",\"content\":\"website\"}],[\"$\",\"meta\",\"16\",{\"name\":\"twitter:card\",\"content\":\"summary_large_image\"}],[\"$\",\"meta\",\"17\",{\"name\":\"twitter:title\",\"content\":\"Khoj AI\"}],[\"$\",\"meta\",\"18\",{\"name\":\"twitter:description\",\"content\":\"Your Second Brain.\"}],[\"$\",\"meta\",\"19\",{\"name\":\"twitter:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_256x256.png\"}],[\"$\",\"meta\",\"20\",{\"name\":\"twitter:image:width\",\"content\":\"256\"}],[\"$\",\"meta\",\"21\",{\"name\":\"twitter:image:height\",\"content\":\"256\"}],[\"$\",\"meta\",\"22\",{\"name\":\"twitter:image\",\"content\":\"https://assets.khoj.dev/khoj_lantern_logomarktype_1200x630.png\"}],[\"$\",\"meta\",\"23\",{\"name\":\"twitter:image:width\",\"content\":\"1200\"}],[\"$\",\"meta\",\"24\",{\"name\":\"twitter:image:height\",\"content\":\"630\"}],[\"$\",\"link\",\"25\",{\"rel\":\"icon\",\"href\":\"/static/assets/icons/khoj_lantern.ico\"}],[\"$\",\"link\",\"26\",{\"rel\":\"apple-touch-icon\",\"href\":\"/static/assets/icons/khoj_lantern_256x256.png\"}],[\"$\",\"meta\",\"27\",{\"name\":\"next-size-adjust\"}]]\n"])</script><script>self.__next_f.push([1,"5:null\n"])</script></body></html>
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9718],{1813:function(e,t,n){Promise.resolve().then(n.bind(n,89915))},89915:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return O}});var a=n(57437),l=n(15283),o=n.n(l),s=n(29039),i=n(2265),r=n(79306),d=n(35418),c=n(64945),u=n(90837),p=n(66820),m=n(58485),f=n(48861),h=n(47412),g=n(69591),x=n(81970),v=n(39343),j=n(31014);let b=()=>window.fetch("/api/agents").then(e=>e.json()).catch(e=>console.log(e)),_=e=>fetch(e).then(e=>e.json());function y(e){let[t,n]=(0,i.useState)(!1),[l,o]=(0,i.useState)(null),[s,r]=(0,i.useState)(!0),c=(0,v.cI)({resolver:(0,j.F)(x.bc),defaultValues:{name:e.data.name,persona:e.data.persona,color:e.data.color,icon:e.data.icon,privacy_level:e.data.privacy_level,chat_model:e.selectedChatModelOption,files:[]}});return(0,i.useEffect)(()=>{c.reset({name:e.data.name,persona:e.data.persona,color:e.data.color,icon:e.data.icon,privacy_level:e.data.privacy_level,chat_model:e.selectedChatModelOption,files:[]})},[e.selectedChatModelOption,e.data]),(0,a.jsxs)(u.Vq,{open:t,onOpenChange:n,children:[(0,a.jsx)(u.hg,{children:(0,a.jsxs)("div",{className:"flex items-center text-md gap-2",children:[(0,a.jsx)(d.v,{}),"Create Agent"]})}),(0,a.jsxs)(u.cZ,{className:"lg:max-w-screen-lg overflow-y-scroll max-h-screen",children:[(0,a.jsx)(u.fK,{children:"Create Agent"}),!e.userProfile&&s&&(0,a.jsx)(p.Z,{loginRedirectMessage:"Sign in to start chatting with a specialized agent",onOpenChange:r}),(0,a.jsx)(x.ks,{form:c,onSubmit:t=>{fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(t=>{200===t.status?(c.reset(),n(!1),o(null),e.setAgentChangeTriggered(!0)):t.json().then(e=>{console.error(e),e.error&&o(e.error)})}).catch(e=>{console.error("Error:",e),o(e)})},create:!0,errors:l,filesOptions:e.filesOptions,modelOptions:e.modelOptions,inputToolOptions:e.inputToolOptions,outputModeOptions:e.outputModeOptions,isSubscribed:e.isSubscribed})]})]})}function O(){let{data:e,error:t,mutate:n}=(0,s.ZP)("agents",b,{revalidateOnFocus:!1}),l=(0,r.GW)(),{userConfig:d}=(0,r.h2)(!0),[u,v]=(0,i.useState)(!1),j=(0,g.IC)(),[O,w]=(0,i.useState)([]),[N,L]=(0,i.useState)([]),[M,C]=(0,i.useState)(null),{data:E,error:S}=(0,s.ZP)(d?"/api/content/computer":null,_),{data:Z,error:P}=(0,s.ZP)("/api/agents/options",_),[A,T]=(0,i.useState)(!1);if((0,i.useEffect)(()=>{A&&(n(),T(!1))},[A]),(0,i.useEffect)(()=>{if(e){w(e.filter(e=>e.creator===(null==l?void 0:l.username)));let t=e.filter(e=>"private"!==e.privacy_level&&e.creator!==(null==l?void 0:l.username));L(t);{let n=new URLSearchParams(window.location.search).get("agent");if(n){C(n);let a=e.find(e=>e.slug===n);a||(a=t.find(e=>e.slug===n)),a||fetch("/api/agents/".concat(n)).then(e=>{if(404===e.status)throw Error("Agent not found");return e.json()}).then(e=>{"protected"===e.privacy_level&&L(t=>[...t,e])})}}}},[e,l]),t)return(0,a.jsxs)("main",{className:o().main,children:[(0,a.jsx)("div",{className:"".concat(o().titleBar," text-5xl"),children:"Agents"}),(0,a.jsx)("div",{className:o().agentList,children:"Error loading agents"})]});if(!e)return(0,a.jsx)("main",{className:o().main,children:(0,a.jsxs)("div",{className:o().agentList,children:[(0,a.jsx)(m.l,{})," booting up your agents"]})});let R=(null==d?void 0:d.chat_model_options)||[],k=(null==d?void 0:d.selected_chat_model_config)||0,z=(0,r.T8)(d),F=R.find(e=>e.id===k);return(0,a.jsx)("main",{className:"w-full mx-auto",children:(0,a.jsxs)("div",{className:"grid w-full mx-auto",children:[(0,a.jsx)("div",{className:"".concat(o().sidePanel," top-0"),children:(0,a.jsx)(f.ZP,{conversationId:null,uploadedFiles:[],isMobileWidth:j})}),(0,a.jsxs)("div",{className:"".concat(o().pageLayout," w-full"),children:[(0,a.jsxs)("div",{className:"pt-6 md:pt-8 flex justify-between",children:[(0,a.jsx)("h1",{className:"text-3xl flex items-center",children:"Agents"}),(0,a.jsx)("div",{className:"ml-auto float-right border p-2 pt-3 rounded-xl font-bold hover:bg-stone-100 dark:hover:bg-neutral-900",children:(0,a.jsx)(y,{data:{slug:"",name:"",persona:"",color:"",icon:"",privacy_level:"private",managed_by_admin:!1,chat_model:"",input_tools:[],output_modes:[]},userProfile:l,isMobileWidth:j,filesOptions:E||[],modelOptions:(null==d?void 0:d.chat_model_options)||[],selectedChatModelOption:(null==F?void 0:F.name)||"",isSubscribed:z,setAgentChangeTriggered:T,inputToolOptions:(null==Z?void 0:Z.input_tools)||{},outputModeOptions:(null==Z?void 0:Z.output_modes)||{}})})]}),u&&(0,a.jsx)(p.Z,{loginRedirectMessage:"Sign in to start chatting with a specialized agent",onOpenChange:v}),(0,a.jsx)(h.bZ,{className:"bg-secondary border-none my-4",children:(0,a.jsxs)(h.X,{children:[(0,a.jsx)(c.B,{weight:"fill",className:"h-4 w-4 text-purple-400 inline"}),(0,a.jsx)("span",{className:"font-bold",children:"How it works"})," Use any of these specialized personas to tune your conversation to your needs."]})}),(0,a.jsx)("div",{className:"pt-6 md:pt-8",children:(0,a.jsx)("div",{className:"".concat(o().agentList),children:O.map(e=>(0,a.jsx)(x.EY,{data:e,userProfile:l,isMobileWidth:j,filesOptions:null!=E?E:[],selectedChatModelOption:(null==F?void 0:F.name)||"",isSubscribed:z,setAgentChangeTriggered:T,modelOptions:(null==d?void 0:d.chat_model_options)||[],editCard:!0,agentSlug:M||"",inputToolOptions:(null==Z?void 0:Z.input_tools)||{},outputModeOptions:(null==Z?void 0:Z.output_modes)||{}},e.slug))})}),(0,a.jsxs)("div",{className:"pt-6 md:pt-8",children:[(0,a.jsx)("h2",{className:"text-2xl",children:"Explore"}),(0,a.jsx)("div",{className:"".concat(o().agentList),children:N.map(e=>(0,a.jsx)(x.EY,{data:e,userProfile:l,isMobileWidth:j,editCard:!1,filesOptions:null!=E?E:[],selectedChatModelOption:(null==F?void 0:F.name)||"",isSubscribed:z,setAgentChangeTriggered:T,modelOptions:(null==d?void 0:d.chat_model_options)||[],agentSlug:M||"",inputToolOptions:(null==Z?void 0:Z.input_tools)||{},outputModeOptions:(null==Z?void 0:Z.output_modes)||{}},e.slug))})]})]})]})})}},66820:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var a=n(57437),l=n(6780),o=n(87138);function s(e){return(0,a.jsx)(l.aR,{open:!0,onOpenChange:e.onOpenChange,children:(0,a.jsxs)(l._T,{children:[(0,a.jsx)(l.fY,{children:(0,a.jsx)(l.f$,{children:"Sign in to Khoj to continue"})}),(0,a.jsxs)(l.yT,{children:[e.loginRedirectMessage,". By logging in, you agree to our"," ",(0,a.jsx)(o.default,{href:"https://khoj.dev/terms-of-service",children:"Terms of Service."})]}),(0,a.jsxs)(l.xo,{children:[(0,a.jsx)(l.le,{children:"Dismiss"}),(0,a.jsx)(l.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>{window.location.href="/login?next=".concat(encodeURIComponent(window.location.pathname))},children:(0,a.jsxs)(o.default,{href:"/login?next=".concat(encodeURIComponent(window.location.pathname)),children:[" ","Login"]})})]})]})})}},70571:function(e,t,n){"use strict";n.d(t,{E:function(){return i}});var a=n(57437),l=n(2265),o=n(52431),s=n(37440);let i=l.forwardRef((e,t)=>{let{className:n,value:l,indicatorColor:i,...r}=e;return(0,a.jsx)(o.fC,{ref:t,className:(0,s.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",n),...r,children:(0,a.jsx)(o.z$,{className:"h-full w-full flex-1 bg-primary transition-all ".concat(i),style:{transform:"translateX(-".concat(100-(l||0),"%)")}})})});i.displayName=o.fC.displayName},93146:function(e,t,n){"use strict";n.d(t,{g:function(){return s}});var a=n(57437),l=n(2265),o=n(37440);let s=l.forwardRef((e,t)=>{let{className:n,...l}=e;return(0,a.jsx)("textarea",{className:(0,o.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",n),ref:t,...l})});s.displayName="Textarea"},19666:function(e,t,n){"use strict";n.d(t,{_v:function(){return c},aJ:function(){return d},pn:function(){return i},u:function(){return r}});var a=n(57437),l=n(2265),o=n(27071),s=n(37440);let i=o.zt,r=o.fC,d=o.xz,c=l.forwardRef((e,t)=>{let{className:n,sideOffset:l=4,...i}=e;return(0,a.jsx)(o.VY,{ref:t,sideOffset:l,className:(0,s.cn)("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",n),...i})});c.displayName=o.VY.displayName},15283:function(e){e.exports={titleBar:"agents_titleBar__FzYbY",agentPersonality:"agents_agentPersonality__o0Ysz",pageLayout:"agents_pageLayout__gR3S3",sidePanel:"agents_sidePanel__wGVGc",infoButton:"agents_infoButton__NqI7E",agentList:"agents_agentList__XVx4A"}},64945:function(e,t,n){"use strict";n.d(t,{B:function(){return h}});var a=n(2265),l=n(52195);let o=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M219.71,117.38a12,12,0,0,0-7.25-8.52L161.28,88.39l10.59-70.61a12,12,0,0,0-20.64-10l-112,120a12,12,0,0,0,4.31,19.33l51.18,20.47L84.13,238.22a12,12,0,0,0,20.64,10l112-120A12,12,0,0,0,219.71,117.38ZM113.6,203.55l6.27-41.77a12,12,0,0,0-7.41-12.92L68.74,131.37,142.4,52.45l-6.27,41.77a12,12,0,0,0,7.41,12.92l43.72,17.49Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M96,240l16-80L48,136,160,16,144,96l64,24Z",opacity:"0.2"}),a.createElement("path",{d:"M215.79,118.17a8,8,0,0,0-5-5.66L153.18,90.9l14.66-73.33a8,8,0,0,0-13.69-7l-112,120a8,8,0,0,0,3,13l57.63,21.61L88.16,238.43a8,8,0,0,0,13.69,7l112-120A8,8,0,0,0,215.79,118.17ZM109.37,214l10.47-52.38a8,8,0,0,0-5-9.06L62,132.71l84.62-90.66L136.16,94.43a8,8,0,0,0,5,9.06l52.8,19.8Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M213.85,125.46l-112,120a8,8,0,0,1-13.69-7l14.66-73.33L45.19,143.49a8,8,0,0,1-3-13l112-120a8,8,0,0,1,13.69,7L153.18,90.9l57.63,21.61a8,8,0,0,1,3,12.95Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M213.84,118.63a6,6,0,0,0-3.73-4.25L150.88,92.17l15-75a6,6,0,0,0-10.27-5.27l-112,120a6,6,0,0,0,2.28,9.71l59.23,22.21-15,75a6,6,0,0,0,3.14,6.52A6.07,6.07,0,0,0,96,246a6,6,0,0,0,4.39-1.91l112-120A6,6,0,0,0,213.84,118.63ZM106,220.46l11.85-59.28a6,6,0,0,0-3.77-6.8l-55.6-20.85,91.46-98L138.12,94.82a6,6,0,0,0,3.77,6.8l55.6,20.85Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M215.79,118.17a8,8,0,0,0-5-5.66L153.18,90.9l14.66-73.33a8,8,0,0,0-13.69-7l-112,120a8,8,0,0,0,3,13l57.63,21.61L88.16,238.43a8,8,0,0,0,13.69,7l112-120A8,8,0,0,0,215.79,118.17ZM109.37,214l10.47-52.38a8,8,0,0,0-5-9.06L62,132.71l84.62-90.66L136.16,94.43a8,8,0,0,0,5,9.06l52.8,19.8Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M211.89,119.09a4,4,0,0,0-2.49-2.84l-60.81-22.8,15.33-76.67a4,4,0,0,0-6.84-3.51l-112,120a4,4,0,0,0-1,3.64,4,4,0,0,0,2.49,2.84l60.81,22.8L92.08,239.22a4,4,0,0,0,6.84,3.51l112-120A4,4,0,0,0,211.89,119.09ZM102.68,227l13.24-66.2a4,4,0,0,0-2.52-4.53L55,134.36,153.32,29l-13.24,66.2a4,4,0,0,0,2.52,4.53L201,121.64Z"}))]]);var s=Object.defineProperty,i=Object.defineProperties,r=Object.getOwnPropertyDescriptors,d=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable,p=(e,t,n)=>t in e?s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,m=(e,t)=>{for(var n in t||(t={}))c.call(t,n)&&p(e,n,t[n]);if(d)for(var n of d(t))u.call(t,n)&&p(e,n,t[n]);return e},f=(e,t)=>i(e,r(t));let h=(0,a.forwardRef)((e,t)=>a.createElement(l.Z,f(m({ref:t},e),{weights:o})));h.displayName="Lightning"}},function(e){e.O(0,[9460,9448,9001,3062,3124,3803,5512,4602,1603,9417,1970,2971,7023,1744],function(){return e(e.s=1813)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9718],{1813:function(e,t,n){Promise.resolve().then(n.bind(n,89915))},89915:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return O}});var a=n(57437),l=n(15283),o=n.n(l),s=n(29039),i=n(2265),r=n(79306),d=n(35418),c=n(64945),u=n(90837),p=n(66820),m=n(58485),f=n(48861),h=n(47412),g=n(69591),x=n(81970),v=n(39343),j=n(31014);let b=()=>window.fetch("/api/agents").then(e=>e.json()).catch(e=>console.log(e)),_=e=>fetch(e).then(e=>e.json());function y(e){let[t,n]=(0,i.useState)(!1),[l,o]=(0,i.useState)(null),[s,r]=(0,i.useState)(!0),c=(0,v.cI)({resolver:(0,j.F)(x.bc),defaultValues:{name:e.data.name,persona:e.data.persona,color:e.data.color,icon:e.data.icon,privacy_level:e.data.privacy_level,chat_model:e.selectedChatModelOption,files:[]}});return(0,i.useEffect)(()=>{c.reset({name:e.data.name,persona:e.data.persona,color:e.data.color,icon:e.data.icon,privacy_level:e.data.privacy_level,chat_model:e.selectedChatModelOption,files:[]})},[e.selectedChatModelOption,e.data]),(0,a.jsxs)(u.Vq,{open:t,onOpenChange:n,children:[(0,a.jsx)(u.hg,{children:(0,a.jsxs)("div",{className:"flex items-center text-md gap-2",children:[(0,a.jsx)(d.v,{}),"Create Agent"]})}),(0,a.jsxs)(u.cZ,{className:"lg:max-w-screen-lg overflow-y-scroll max-h-screen",children:[(0,a.jsx)(u.fK,{children:"Create Agent"}),!e.userProfile&&s&&(0,a.jsx)(p.Z,{loginRedirectMessage:"Sign in to start chatting with a specialized agent",onOpenChange:r}),(0,a.jsx)(x.ks,{form:c,onSubmit:t=>{fetch("/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).then(t=>{200===t.status?(c.reset(),n(!1),o(null),e.setAgentChangeTriggered(!0)):t.json().then(e=>{console.error(e),e.error&&o(e.error)})}).catch(e=>{console.error("Error:",e),o(e)})},create:!0,errors:l,filesOptions:e.filesOptions,modelOptions:e.modelOptions,inputToolOptions:e.inputToolOptions,outputModeOptions:e.outputModeOptions,isSubscribed:e.isSubscribed})]})]})}function O(){let{data:e,error:t,mutate:n}=(0,s.ZP)("agents",b,{revalidateOnFocus:!1}),l=(0,r.GW)(),{userConfig:d}=(0,r.h2)(!0),[u,v]=(0,i.useState)(!1),j=(0,g.IC)(),[O,w]=(0,i.useState)([]),[N,L]=(0,i.useState)([]),[M,C]=(0,i.useState)(null),{data:E,error:S}=(0,s.ZP)(d?"/api/content/computer":null,_),{data:Z,error:P}=(0,s.ZP)("/api/agents/options",_),[A,T]=(0,i.useState)(!1);if((0,i.useEffect)(()=>{A&&(n(),T(!1))},[A]),(0,i.useEffect)(()=>{if(e){w(e.filter(e=>e.creator===(null==l?void 0:l.username)));let t=e.filter(e=>"private"!==e.privacy_level&&e.creator!==(null==l?void 0:l.username));L(t);{let n=new URLSearchParams(window.location.search).get("agent");if(n){C(n);let a=e.find(e=>e.slug===n);a||(a=t.find(e=>e.slug===n)),a||fetch("/api/agents/".concat(n)).then(e=>{if(404===e.status)throw Error("Agent not found");return e.json()}).then(e=>{"protected"===e.privacy_level&&L(t=>[...t,e])})}}}},[e,l]),t)return(0,a.jsxs)("main",{className:o().main,children:[(0,a.jsx)("div",{className:"".concat(o().titleBar," text-5xl"),children:"Agents"}),(0,a.jsx)("div",{className:o().agentList,children:"Error loading agents"})]});if(!e)return(0,a.jsx)("main",{className:o().main,children:(0,a.jsxs)("div",{className:o().agentList,children:[(0,a.jsx)(m.l,{})," booting up your agents"]})});let R=(null==d?void 0:d.chat_model_options)||[],k=(null==d?void 0:d.selected_chat_model_config)||0,z=(0,r.T8)(d),F=R.find(e=>e.id===k);return(0,a.jsx)("main",{className:"w-full mx-auto",children:(0,a.jsxs)("div",{className:"grid w-full mx-auto",children:[(0,a.jsx)("div",{className:"".concat(o().sidePanel," top-0"),children:(0,a.jsx)(f.ZP,{conversationId:null,uploadedFiles:[],isMobileWidth:j})}),(0,a.jsxs)("div",{className:"".concat(o().pageLayout," w-full"),children:[(0,a.jsxs)("div",{className:"pt-6 md:pt-8 flex justify-between",children:[(0,a.jsx)("h1",{className:"text-3xl flex items-center",children:"Agents"}),(0,a.jsx)("div",{className:"ml-auto float-right border p-2 pt-3 rounded-xl font-bold hover:bg-stone-100 dark:hover:bg-neutral-900",children:(0,a.jsx)(y,{data:{slug:"",name:"",persona:"",color:"",icon:"",privacy_level:"private",managed_by_admin:!1,chat_model:"",input_tools:[],output_modes:[]},userProfile:l,isMobileWidth:j,filesOptions:E||[],modelOptions:(null==d?void 0:d.chat_model_options)||[],selectedChatModelOption:(null==F?void 0:F.name)||"",isSubscribed:z,setAgentChangeTriggered:T,inputToolOptions:(null==Z?void 0:Z.input_tools)||{},outputModeOptions:(null==Z?void 0:Z.output_modes)||{}})})]}),u&&(0,a.jsx)(p.Z,{loginRedirectMessage:"Sign in to start chatting with a specialized agent",onOpenChange:v}),(0,a.jsx)(h.bZ,{className:"bg-secondary border-none my-4",children:(0,a.jsxs)(h.X,{children:[(0,a.jsx)(c.B,{weight:"fill",className:"h-4 w-4 text-purple-400 inline"}),(0,a.jsx)("span",{className:"font-bold",children:"How it works"})," Use any of these specialized personas to tune your conversation to your needs."]})}),(0,a.jsx)("div",{className:"pt-6 md:pt-8",children:(0,a.jsx)("div",{className:"".concat(o().agentList),children:O.map(e=>(0,a.jsx)(x.EY,{data:e,userProfile:l,isMobileWidth:j,filesOptions:null!=E?E:[],selectedChatModelOption:(null==F?void 0:F.name)||"",isSubscribed:z,setAgentChangeTriggered:T,modelOptions:(null==d?void 0:d.chat_model_options)||[],editCard:!0,agentSlug:M||"",inputToolOptions:(null==Z?void 0:Z.input_tools)||{},outputModeOptions:(null==Z?void 0:Z.output_modes)||{}},e.slug))})}),(0,a.jsxs)("div",{className:"pt-6 md:pt-8",children:[(0,a.jsx)("h2",{className:"text-2xl",children:"Explore"}),(0,a.jsx)("div",{className:"".concat(o().agentList),children:N.map(e=>(0,a.jsx)(x.EY,{data:e,userProfile:l,isMobileWidth:j,editCard:!1,filesOptions:null!=E?E:[],selectedChatModelOption:(null==F?void 0:F.name)||"",isSubscribed:z,setAgentChangeTriggered:T,modelOptions:(null==d?void 0:d.chat_model_options)||[],agentSlug:M||"",inputToolOptions:(null==Z?void 0:Z.input_tools)||{},outputModeOptions:(null==Z?void 0:Z.output_modes)||{}},e.slug))})]})]})]})})}},66820:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var a=n(57437),l=n(6780),o=n(87138);function s(e){return(0,a.jsx)(l.aR,{open:!0,onOpenChange:e.onOpenChange,children:(0,a.jsxs)(l._T,{children:[(0,a.jsx)(l.fY,{children:(0,a.jsx)(l.f$,{children:"Sign in to Khoj to continue"})}),(0,a.jsxs)(l.yT,{children:[e.loginRedirectMessage,". By logging in, you agree to our"," ",(0,a.jsx)(o.default,{href:"https://khoj.dev/terms-of-service",children:"Terms of Service."})]}),(0,a.jsxs)(l.xo,{children:[(0,a.jsx)(l.le,{children:"Dismiss"}),(0,a.jsx)(l.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>{window.location.href="/login?next=".concat(encodeURIComponent(window.location.pathname))},children:(0,a.jsxs)(o.default,{href:"/login?next=".concat(encodeURIComponent(window.location.pathname)),children:[" ","Login"]})})]})]})})}},70571:function(e,t,n){"use strict";n.d(t,{E:function(){return i}});var a=n(57437),l=n(2265),o=n(52431),s=n(37440);let i=l.forwardRef((e,t)=>{let{className:n,value:l,indicatorColor:i,...r}=e;return(0,a.jsx)(o.fC,{ref:t,className:(0,s.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",n),...r,children:(0,a.jsx)(o.z$,{className:"h-full w-full flex-1 bg-primary transition-all ".concat(i),style:{transform:"translateX(-".concat(100-(l||0),"%)")}})})});i.displayName=o.fC.displayName},93146:function(e,t,n){"use strict";n.d(t,{g:function(){return s}});var a=n(57437),l=n(2265),o=n(37440);let s=l.forwardRef((e,t)=>{let{className:n,...l}=e;return(0,a.jsx)("textarea",{className:(0,o.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",n),ref:t,...l})});s.displayName="Textarea"},19666:function(e,t,n){"use strict";n.d(t,{_v:function(){return c},aJ:function(){return d},pn:function(){return i},u:function(){return r}});var a=n(57437),l=n(2265),o=n(27071),s=n(37440);let i=o.zt,r=o.fC,d=o.xz,c=l.forwardRef((e,t)=>{let{className:n,sideOffset:l=4,...i}=e;return(0,a.jsx)(o.VY,{ref:t,sideOffset:l,className:(0,s.cn)("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",n),...i})});c.displayName=o.VY.displayName},15283:function(e){e.exports={titleBar:"agents_titleBar__FzYbY",agentPersonality:"agents_agentPersonality__o0Ysz",pageLayout:"agents_pageLayout__gR3S3",sidePanel:"agents_sidePanel__wGVGc",infoButton:"agents_infoButton__NqI7E",agentList:"agents_agentList__XVx4A"}},64945:function(e,t,n){"use strict";n.d(t,{B:function(){return h}});var a=n(2265),l=n(52195);let o=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M219.71,117.38a12,12,0,0,0-7.25-8.52L161.28,88.39l10.59-70.61a12,12,0,0,0-20.64-10l-112,120a12,12,0,0,0,4.31,19.33l51.18,20.47L84.13,238.22a12,12,0,0,0,20.64,10l112-120A12,12,0,0,0,219.71,117.38ZM113.6,203.55l6.27-41.77a12,12,0,0,0-7.41-12.92L68.74,131.37,142.4,52.45l-6.27,41.77a12,12,0,0,0,7.41,12.92l43.72,17.49Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M96,240l16-80L48,136,160,16,144,96l64,24Z",opacity:"0.2"}),a.createElement("path",{d:"M215.79,118.17a8,8,0,0,0-5-5.66L153.18,90.9l14.66-73.33a8,8,0,0,0-13.69-7l-112,120a8,8,0,0,0,3,13l57.63,21.61L88.16,238.43a8,8,0,0,0,13.69,7l112-120A8,8,0,0,0,215.79,118.17ZM109.37,214l10.47-52.38a8,8,0,0,0-5-9.06L62,132.71l84.62-90.66L136.16,94.43a8,8,0,0,0,5,9.06l52.8,19.8Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M213.85,125.46l-112,120a8,8,0,0,1-13.69-7l14.66-73.33L45.19,143.49a8,8,0,0,1-3-13l112-120a8,8,0,0,1,13.69,7L153.18,90.9l57.63,21.61a8,8,0,0,1,3,12.95Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M213.84,118.63a6,6,0,0,0-3.73-4.25L150.88,92.17l15-75a6,6,0,0,0-10.27-5.27l-112,120a6,6,0,0,0,2.28,9.71l59.23,22.21-15,75a6,6,0,0,0,3.14,6.52A6.07,6.07,0,0,0,96,246a6,6,0,0,0,4.39-1.91l112-120A6,6,0,0,0,213.84,118.63ZM106,220.46l11.85-59.28a6,6,0,0,0-3.77-6.8l-55.6-20.85,91.46-98L138.12,94.82a6,6,0,0,0,3.77,6.8l55.6,20.85Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M215.79,118.17a8,8,0,0,0-5-5.66L153.18,90.9l14.66-73.33a8,8,0,0,0-13.69-7l-112,120a8,8,0,0,0,3,13l57.63,21.61L88.16,238.43a8,8,0,0,0,13.69,7l112-120A8,8,0,0,0,215.79,118.17ZM109.37,214l10.47-52.38a8,8,0,0,0-5-9.06L62,132.71l84.62-90.66L136.16,94.43a8,8,0,0,0,5,9.06l52.8,19.8Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M211.89,119.09a4,4,0,0,0-2.49-2.84l-60.81-22.8,15.33-76.67a4,4,0,0,0-6.84-3.51l-112,120a4,4,0,0,0-1,3.64,4,4,0,0,0,2.49,2.84l60.81,22.8L92.08,239.22a4,4,0,0,0,6.84,3.51l112-120A4,4,0,0,0,211.89,119.09ZM102.68,227l13.24-66.2a4,4,0,0,0-2.52-4.53L55,134.36,153.32,29l-13.24,66.2a4,4,0,0,0,2.52,4.53L201,121.64Z"}))]]);var s=Object.defineProperty,i=Object.defineProperties,r=Object.getOwnPropertyDescriptors,d=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable,p=(e,t,n)=>t in e?s(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,m=(e,t)=>{for(var n in t||(t={}))c.call(t,n)&&p(e,n,t[n]);if(d)for(var n of d(t))u.call(t,n)&&p(e,n,t[n]);return e},f=(e,t)=>i(e,r(t));let h=(0,a.forwardRef)((e,t)=>a.createElement(l.Z,f(m({ref:t},e),{weights:o})));h.displayName="Lightning"}},function(e){e.O(0,[9848,9001,3062,3124,3803,5512,4602,1603,9417,1970,2971,7023,1744],function(){return e(e.s=1813)}),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4371],{2743:function(e,t,a){Promise.resolve().then(a.bind(a,19648))},19648:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return ex}});var n=a(57437),s=a(29039),r=a(58485),o=a(36013),i=a(50495),l=a(46294),c=a(18760),d=a.n(c),u=a(31014),m=a(39343),h=a(59772),x=a(2265),f=a(32653),p=a(83102),g=a(90837),j=a(13304),y=a(93146),w=a(69591),v=a(23611),N=a.n(v),b=a(18642),D=a(16463),C=a(19573),k=a(20319),S=a(22049),_=a(55362),I=a(13537),A=a(76082),M=a(52674),R=a(23751),T=a(83522),z=a(8837),P=a(21819),L=a(35418),O=a(64945),W=a(79306),q=a(66820),E=a(35657),U=a(50151),F=a(47412),B=a(48861),V=a(7951);let G=()=>window.fetch("/api/automations").then(e=>e.json()).catch(e=>console.log(e));function Z(e){let t=e.split(" "),a=t[2],n=t[4];return"*"===a&&"*"===n?"Day":"*"!==n?"Week":"*"!==a?"Month":"Day"}function J(e){let t=e.split(" ");if("*"===t[3]&&"*"!==t[4])return Number(t[4])}function Q(e){let t=e.split(" "),a=t[1],n=t[0],s=Number(a)>=12?"PM":"AM",r=Number(a)>12?Number(a)-12:a;"00"===r&&(r="12");let o=n;return 10>Number(o)&&"00"!==o&&(o="0".concat(o)),"".concat(r,":").concat(o," ").concat(s)}function X(e){return String(e.split(" ")[2])}function Y(e){return d().toString(e)}let $=["Day","Week","Month"],H=Array.from({length:31},(e,t)=>String(t+1)),K=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ee=[],et=["AM","PM"];for(var ea=0;ea<et.length;ea++)for(var en=0;en<12;en++)for(var es=0;es<60;es+=15){let e=String(es).padStart(2,"0"),t=0===en?12:en;ee.push("".concat(t,":").concat(e," ").concat(et[ea]))}let er=Date.now(),eo=[{subject:"Weekly Newsletter",query_to_run:"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:er,scheduling_request:""},{subject:"Daily Bedtime Story",query_to_run:"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:er+1,scheduling_request:""},{subject:"Front Page of Hacker News",query_to_run:"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:er+2,scheduling_request:""},{subject:"Market Summary",query_to_run:"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:er+3,scheduling_request:""},{subject:"Market Crash Notification",query_to_run:"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:er+5,scheduling_request:""},{subject:"Round-up of research papers about AI in healthcare",query_to_run:"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:er+4,scheduling_request:""}];function ei(e){let t=encodeURIComponent(e.subject),a=encodeURIComponent(e.query_to_run),n=encodeURIComponent(e.crontime);return"".concat(window.location.origin,"/automations?subject=").concat(t,"&query=").concat(a,"&crontime=").concat(n)}function el(e){let[t,a]=(0,x.useState)(!1),[s,r]=(0,x.useState)(null),[l,c]=(0,x.useState)(!1),[d,u]=(0,x.useState)(""),{toast:m}=(0,E.pm)(),h=e.automation,[f,p]=(0,x.useState)(""),[g,j]=(0,x.useState)("");return((0,x.useEffect)(()=>{let e=s||h;p(Q(e.crontime));let t=Z(e.crontime);if("Day"===t)j("Daily");else if("Week"===t){let t=J(e.crontime);void 0===t?j("Weekly"):j("".concat(K[t]))}else if("Month"===t){let t=X(e.crontime);j("Monthly on the ".concat(t))}},[s,h]),(0,x.useEffect)(()=>{let e="Automation: ".concat((null==s?void 0:s.subject)||h.subject);d&&(m({title:e,description:d,action:(0,n.jsx)(U.gD,{altText:"Dismiss",children:"Ok"})}),u(""))},[d,s,h,m]),l)?null:(0,n.jsxs)(o.Zb,{className:"bg-secondary h-full shadow-sm rounded-lg bg-gradient-to-b from-background to-slate-50 dark:to-gray-950 border ".concat(N().automationCard),children:[(0,n.jsx)(o.Ol,{children:(0,n.jsxs)(o.ll,{className:"line-clamp-2 leading-normal flex justify-between",children:[(null==s?void 0:s.subject)||h.subject,(0,n.jsxs)(C.J2,{children:[(0,n.jsx)(C.xo,{asChild:!0,children:(0,n.jsx)(i.z,{className:"bg-background",variant:"ghost",children:(0,n.jsx)(k.F,{className:"h-4 w-4"})})}),(0,n.jsxs)(C.yk,{className:"w-auto grid gap-2 text-left bg-secondary",children:[!e.suggestedCard&&e.locationData&&(0,n.jsx)(eh,{isMobileWidth:e.isMobileWidth,callToAction:"Edit",createNew:!1,setIsCreating:a,setShowLoginPrompt:e.setShowLoginPrompt,setNewAutomationData:r,authenticatedData:e.authenticatedData,isCreating:t,automation:s||h,ipLocationData:e.locationData}),(0,n.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:ei(h),onShare:()=>{navigator.clipboard.writeText(ei(h))}}),!e.suggestedCard&&(0,n.jsxs)(i.z,{variant:"outline",className:"justify-start",onClick:()=>{!function(e,t){fetch("/api/trigger/automation?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.")})}(h.id.toString(),u)},children:[(0,n.jsx)(S.s,{className:"h-4 w-4 mr-2"}),"Run Now"]}),(0,n.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)})}(h.id.toString(),c)},children:[(0,n.jsx)(_.r,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})}),(0,n.jsx)(o.aY,{className:"text-secondary-foreground break-all",children:(null==s?void 0:s.query_to_run)||h.query_to_run}),(0,n.jsxs)(o.eW,{className:"flex flex-col items-start md:flex-row md:justify-between md:items-center gap-2",children:[(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsxs)("div",{className:"flex items-center bg-blue-50 rounded-lg p-1.5 border-blue-200 border dark:bg-blue-800 dark:border-blue-500",children:[(0,n.jsx)(I.T,{className:"h-4 w-4 mr-2 text-blue-700 dark:text-blue-300"}),(0,n.jsx)("div",{className:"text-s text-blue-700 dark:text-blue-300",children:f})]}),(0,n.jsxs)("div",{className:"flex items-center bg-purple-50 rounded-lg p-1.5 border-purple-200 border dark:bg-purple-800 dark:border-purple-500",children:[(0,n.jsx)(A.u,{className:"h-4 w-4 mr-2 text-purple-700 dark:text-purple-300"}),(0,n.jsx)("div",{className:"text-s text-purple-700 dark:text-purple-300",children:g})]})]}),e.suggestedCard&&e.setNewAutomationData&&(0,n.jsx)(eh,{isMobileWidth:e.isMobileWidth,callToAction:"Add",createNew:!0,setIsCreating:a,setShowLoginPrompt:e.setShowLoginPrompt,setNewAutomationData:e.setNewAutomationData,authenticatedData:e.authenticatedData,isCreating:t,automation:h,ipLocationData:e.locationData})]})]})}function ec(e){let t=(0,D.useSearchParams)(),[a,s]=(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),query_to_run:decodeURIComponent(o),scheduling_request:"",schedule:Y(decodeURIComponent(i)),crontime:decodeURIComponent(i),next:""};return a?(0,n.jsx)(eh,{isMobileWidth:e.isMobileWidth,callToAction:"Shared",createNew:!0,setIsCreating:s,setShowLoginPrompt:e.setShowLoginPrompt,setNewAutomationData:e.setNewAutomationData,authenticatedData:e.authenticatedData,isCreating:a,automation:l,ipLocationData:e.locationData}):null}let ed=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"}),queryToRun:h.z.string({required_error:"Query to Run is required"})});function eu(e){let t=e.automation,a=(0,m.cI)({resolver:(0,u.F)(ed),defaultValues:{subject:null==t?void 0:t.subject,everyBlah:(null==t?void 0:t.crontime)?Z(t.crontime):"Day",dayOfWeek:(null==t?void 0:t.crontime)?J(t.crontime):void 0,timeRecurrence:(null==t?void 0:t.crontime)?Q(t.crontime):"12:00 PM",dayOfMonth:(null==t?void 0:t.crontime)?X(t.crontime):"1",queryToRun:null==t?void 0:t.query_to_run}});return(0,n.jsx)(em,{authenticatedData:e.authenticatedData,locationData:e.locationData||null,form:a,onSubmit:a=>{let n=function(e,t,a,n){let s="",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":s="".concat(r," ").concat(l," * * *");break;case"Week":s="".concat(r," ").concat(l," * * ").concat(void 0!==a?7===a?0:a:"*");break;case"Month":s="".concat(r," ").concat(l," ").concat(n," * *")}return s}(a.everyBlah,a.timeRecurrence,a.dayOfWeek,a.dayOfMonth),s="/api/automation?";s+="q=".concat(encodeURIComponent(a.queryToRun)),(null==t?void 0:t.id)&&!e.createNew&&(s+="&automation_id=".concat(encodeURIComponent(t.id))),a.subject&&(s+="&subject=".concat(encodeURIComponent(a.subject))),s+="&crontime=".concat(encodeURIComponent(n)),e.locationData&&e.locationData.city&&(s+="&city=".concat(encodeURIComponent(e.locationData.city))),e.locationData&&e.locationData.region&&(s+="&region=".concat(encodeURIComponent(e.locationData.region))),e.locationData&&e.locationData.country&&(s+="&country=".concat(encodeURIComponent(e.locationData.country))),e.locationData&&e.locationData.timezone&&(s+="&timezone=".concat(encodeURIComponent(e.locationData.timezone))),fetch(s,{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:Y(t.crontime),crontime:t.crontime,next:t.next})})},create:e.createNew,isLoggedIn:e.isLoggedIn,setShowLoginPrompt:e.setShowLoginPrompt})}function em(e){var t,a;let[s,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,n.jsx)(f.l0,{...e.form,children:(0,n.jsxs)("form",{onSubmit:e.form.handleSubmit(t=>{e.onSubmit(t),r(!0)}),className:"space-y-6",children:[(0,n.jsx)(f.xJ,{className:"space-y-1",children:(0,n.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,n.jsxs)("div",{className:"flex flex-wrap gap-2 items-center justify-start",children:[a?(0,n.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm",children:[(0,n.jsx)(T.w,{className:"h-4 w-4 mr-2 inline text-orange-500 shadow-sm"}),a.email]}):null,t&&(0,n.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm",children:[(0,n.jsx)(z.x,{className:"h-4 w-4 mr-2 inline text-purple-500"}),t?"".concat(t.city,", ").concat(t.country):"Unknown"]}),t&&(0,n.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm",children:[(0,n.jsx)(P.S,{className:"h-4 w-4 mr-2 inline text-green-500"}),t?"".concat(t.timezone):"Unknown"]})]}))]})}),!e.create&&(0,n.jsx)(f.Wi,{control:e.form.control,name:"subject",render:e=>{var t;let{field:a}=e;return(0,n.jsxs)(f.xJ,{className:"space-y-1",children:[(0,n.jsx)(f.lX,{children:"Subject"}),(0,n.jsx)(f.pf,{children:"This is the subject of the email you will receive."}),(0,n.jsx)(f.NI,{children:(0,n.jsx)(p.I,{placeholder:"Digest of Healthcare AI trends",...a})}),(0,n.jsx)(f.zG,{}),o.subject&&(0,n.jsx)(f.zG,{children:null===(t=o.subject)||void 0===t?void 0:t.message})]})}}),(0,n.jsx)(f.Wi,{control:e.form.control,name:"everyBlah",render:e=>{var t;let{field:a}=e;return(0,n.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,n.jsx)(f.lX,{children:"Frequency"}),(0,n.jsx)(f.pf,{children:"How often should this automation run?"}),(0,n.jsxs)(l.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,n.jsx)(f.NI,{children:(0,n.jsxs)(l.i4,{className:"w-[200px]",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(M.W,{className:"h-4 w-4 mr-2 inline"}),"Every"]}),(0,n.jsx)(l.ki,{placeholder:""})]})}),(0,n.jsx)(l.Bw,{children:$.map(e=>(0,n.jsx)(l.Ql,{value:e,children:e},e))})]}),(0,n.jsx)(f.zG,{}),o.subject&&(0,n.jsx)(f.zG,{children:null===(t=o.everyBlah)||void 0===t?void 0:t.message})]})}}),"Week"===e.form.watch("everyBlah")&&(0,n.jsx)(f.Wi,{control:e.form.control,name:"dayOfWeek",render:e=>{var t;let{field:a}=e;return(0,n.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,n.jsx)(f.pf,{children:"Every week, on which day should this automation run?"}),(0,n.jsxs)(l.Ph,{onValueChange:e=>a.onChange(Number(e)),defaultValue:String(a.value),children:[(0,n.jsx)(f.NI,{children:(0,n.jsxs)(l.i4,{className:"w-[200px]",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(R.n,{className:"h-4 w-4 mr-2 inline"}),"On"]}),(0,n.jsx)(l.ki,{placeholder:""})]})}),(0,n.jsx)(l.Bw,{children:K.map((e,t)=>(0,n.jsx)(l.Ql,{value:String(t),children:e},e))})]}),(0,n.jsx)(f.zG,{}),o.subject&&(0,n.jsx)(f.zG,{children:null===(t=o.dayOfWeek)||void 0===t?void 0:t.message})]})}}),"Month"===e.form.watch("everyBlah")&&(0,n.jsx)(f.Wi,{control:e.form.control,name:"dayOfMonth",render:e=>{var t;let{field:a}=e;return(0,n.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,n.jsx)(f.pf,{children:"Every month, on which day should the automation run?"}),(0,n.jsxs)(l.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,n.jsx)(f.NI,{children:(0,n.jsxs)(l.i4,{className:"w-[200px]",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(R.n,{className:"h-4 w-4 mr-2 inline"}),"On the"]}),(0,n.jsx)(l.ki,{placeholder:""})]})}),(0,n.jsx)(l.Bw,{children:H.map(e=>(0,n.jsx)(l.Ql,{value:e,children:e},e))})]}),(0,n.jsx)(f.zG,{}),o.subject&&(0,n.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,n.jsx)(f.Wi,{control:e.form.control,name:"timeRecurrence",render:e=>{var t;let{field:a}=e;return(0,n.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,n.jsx)(f.lX,{children:"Time"}),(0,n.jsx)(f.pf,{children:"On the days this automation runs, at what time should it run?"}),(0,n.jsxs)(l.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,n.jsx)(f.NI,{children:(0,n.jsxs)(l.i4,{className:"w-[200px]",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(A.u,{className:"h-4 w-4 mr-2 inline"}),"At"]}),(0,n.jsx)(l.ki,{placeholder:""})]})}),(0,n.jsx)(l.Bw,{children:ee.map(e=>(0,n.jsx)(l.Ql,{value:e,children:e},e))})]}),(0,n.jsx)(f.zG,{}),o.subject&&(0,n.jsx)(f.zG,{children:null===(t=o.timeRecurrence)||void 0===t?void 0:t.message})]})}}),(0,n.jsx)(f.Wi,{control:e.form.control,name:"queryToRun",render:t=>{var a;let{field:s}=t;return(0,n.jsxs)(f.xJ,{className:"space-y-1",children:[(0,n.jsx)(f.lX,{children:"Instructions"}),(0,n.jsx)(f.pf,{children:"What do you want Khoj to do?"}),e.create&&(0,n.jsx)("div",{children:c.map(e=>{var t;return t=s.onChange,(0,n.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,n.jsx)(f.NI,{children:(0,n.jsx)(y.g,{placeholder:"Create a summary of the latest news about AI in healthcare.",value:s.value,onChange:s.onChange})}),(0,n.jsx)(f.zG,{}),o.subject&&(0,n.jsx)(f.zG,{children:null===(a=o.queryToRun)||void 0===a?void 0:a.message})]})}}),(0,n.jsx)("fieldset",{disabled:s,children:e.isLoggedIn?s?(0,n.jsx)(i.z,{type:"submit",disabled:!0,children:"Saving..."}):(0,n.jsx)(i.z,{type:"submit",children:"Save"}):(0,n.jsx)(i.z,{onClick:t=>{t.preventDefault(),e.setShowLoginPrompt(!0)},variant:"default",children:"Login to Save"})})]})})}function eh(e){return e.isMobileWidth?(0,n.jsxs)(V.dy,{open:e.isCreating,onOpenChange:t=>{e.setIsCreating(t)},children:[(0,n.jsx)(V.Qz,{asChild:!0,children:(0,n.jsxs)(i.z,{className:"shadow-sm justify-start",variant:"outline",children:[(0,n.jsx)(L.v,{className:"h-4 w-4 mr-2"}),e.callToAction]})}),(0,n.jsxs)(V.sc,{className:"p-2",children:[(0,n.jsx)(V.iI,{children:"Automation"}),(0,n.jsx)(eu,{createNew:e.createNew,automation:e.automation,setIsEditing:e.setIsCreating,isLoggedIn:!!e.authenticatedData,authenticatedData:e.authenticatedData,setShowLoginPrompt:e.setShowLoginPrompt,setUpdatedAutomationData:e.setNewAutomationData,locationData:e.ipLocationData})]})]}):(0,n.jsxs)(g.Vq,{open:e.isCreating,onOpenChange:t=>{e.setIsCreating(t)},children:[(0,n.jsx)(g.hg,{asChild:!0,children:(0,n.jsxs)(i.z,{className:"shadow-sm justify-start",variant:"outline",children:[(0,n.jsx)(L.v,{className:"h-4 w-4 mr-2"}),e.callToAction]})}),(0,n.jsxs)(g.cZ,{className:"max-h-[98vh] overflow-y-auto",children:[(0,n.jsx)(j.$N,{children:"Automation"}),(0,n.jsx)(eu,{automation:e.automation,createNew:e.createNew,setIsEditing:e.setIsCreating,isLoggedIn:!!e.authenticatedData,authenticatedData:e.authenticatedData,setShowLoginPrompt:e.setShowLoginPrompt,setUpdatedAutomationData:e.setNewAutomationData,locationData:e.ipLocationData})]})]})}function ex(){let e=(0,W.GW)(),{data:t,error:a,isLoading:o}=(0,s.ZP)(e?"automations":null,G,{revalidateOnFocus:!1}),[l,c]=(0,x.useState)(!1),[d,u]=(0,x.useState)(null),[m,h]=(0,x.useState)([]),[f,p]=(0,x.useState)([]),[g,j]=(0,x.useState)(!1),y=(0,w.IC)(),v=(0,w.k6)();return((0,x.useEffect)(()=>{d&&(h([...m,d]),u(null))},[d,m]),(0,x.useEffect)(()=>{let e=t?t.concat(m):m;e&&p(eo.filter(t=>void 0===e.find(e=>t.subject===e.subject)))},[t,m]),a)?(0,n.jsx)(r.l,{message:"Oops, something went wrong. Please refresh the page."}):(0,n.jsx)("main",{className:"w-full mx-auto",children:(0,n.jsxs)("div",{className:"grid w-full mx-auto",children:[(0,n.jsx)("div",{className:"".concat(N().sidePanel," top-0"),children:(0,n.jsx)(B.ZP,{conversationId:null,uploadedFiles:[],isMobileWidth:y})}),(0,n.jsxs)("div",{className:"".concat(N().pageLayout," w-full"),children:[(0,n.jsxs)("div",{className:"pt-6 md:pt-8 grid gap-1 md:flex md:justify-between",children:[(0,n.jsx)("h1",{className:"text-3xl flex items-center",children:"Automations"}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 items-center justify-start",children:[e?(0,n.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm",children:[(0,n.jsx)(T.w,{className:"h-4 w-4 mr-2 inline text-orange-500 shadow-sm"}),e.email]}):null,v&&(0,n.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm",children:[(0,n.jsx)(z.x,{className:"h-4 w-4 mr-2 inline text-purple-500"}),v?"".concat(v.city,", ").concat(v.country):"Unknown"]}),v&&(0,n.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm",children:[(0,n.jsx)(P.S,{className:"h-4 w-4 mr-2 inline text-green-500"}),v?"".concat(v.timezone):"Unknown"]})]})]}),g&&(0,n.jsx)(q.Z,{loginRedirectMessage:"Create an account to make your own automation",onOpenChange:j}),(0,n.jsx)(F.bZ,{className:"bg-secondary border-none my-4",children:(0,n.jsxs)(F.X,{children:[(0,n.jsx)(O.B,{weight:"fill",className:"h-4 w-4 text-purple-400 inline"}),(0,n.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,n.jsxs)("div",{className:"flex justify-between items-center py-4",children:[(0,n.jsx)("h3",{className:"text-xl",children:"Your Creations"}),e?(0,n.jsx)(eh,{isMobileWidth:y,callToAction:"Create Automation",createNew:!0,setIsCreating:c,setShowLoginPrompt:j,setNewAutomationData:u,authenticatedData:e,isCreating:l,ipLocationData:v}):(0,n.jsxs)(i.z,{className:"shadow-sm",onClick:()=>j(!0),variant:"outline",children:[(0,n.jsx)(L.v,{className:"h-4 w-4 mr-2"}),"Create Automation"]})]}),(0,n.jsx)(x.Suspense,{children:(0,n.jsx)(ec,{isMobileWidth:y,authenticatedData:e,locationData:v,isLoggedIn:!!e,setShowLoginPrompt:j,setNewAutomationData:u})}),(!t||0===t.length)&&0==m.length&&!o&&(0,n.jsxs)("div",{className:"px-4",children:["So empty! Create your own automation to get started.",(0,n.jsx)("div",{className:"mt-4",children:e?(0,n.jsx)(eh,{isMobileWidth:y,callToAction:"Design Automation",createNew:!0,setIsCreating:c,setShowLoginPrompt:j,setNewAutomationData:u,authenticatedData:e,isCreating:l,ipLocationData:v}):(0,n.jsx)(i.z,{onClick:()=>j(!0),variant:"default",children:"Design"})})]}),o&&(0,n.jsx)(r.l,{message:"booting up your automations"}),(0,n.jsxs)("div",{className:"".concat(N().automationsLayout),children:[t&&t.map(t=>(0,n.jsx)(el,{isMobileWidth:y,authenticatedData:e,automation:t,locationData:v,isLoggedIn:!!e,setShowLoginPrompt:j},t.id)),m.map(t=>(0,n.jsx)(el,{isMobileWidth:y,authenticatedData:e,automation:t,locationData:v,isLoggedIn:!!e,setShowLoginPrompt:j},t.id))]}),(0,n.jsx)("h3",{className:"text-xl py-4",children:"Try these out"}),(0,n.jsx)("div",{className:"".concat(N().automationsLayout),children:f.map(t=>(0,n.jsx)(el,{isMobileWidth:y,setNewAutomationData:u,authenticatedData:e,automation:t,locationData:v,isLoggedIn:!!e,setShowLoginPrompt:j,suggestedCard:!0},t.id))})]})]})})}},66820:function(e,t,a){"use strict";a.d(t,{Z:function(){return o}});var n=a(57437),s=a(6780),r=a(87138);function o(e){return(0,n.jsx)(s.aR,{open:!0,onOpenChange:e.onOpenChange,children:(0,n.jsxs)(s._T,{children:[(0,n.jsx)(s.fY,{children:(0,n.jsx)(s.f$,{children:"Sign in to Khoj to continue"})}),(0,n.jsxs)(s.yT,{children:[e.loginRedirectMessage,". By logging in, you agree to our"," ",(0,n.jsx)(r.default,{href:"https://khoj.dev/terms-of-service",children:"Terms of Service."})]}),(0,n.jsxs)(s.xo,{children:[(0,n.jsx)(s.le,{children:"Dismiss"}),(0,n.jsx)(s.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>{window.location.href="/login?next=".concat(encodeURIComponent(window.location.pathname))},children:(0,n.jsxs)(r.default,{href:"/login?next=".concat(encodeURIComponent(window.location.pathname)),children:[" ","Login"]})})]})]})})}},18642:function(e,t,a){"use strict";a.d(t,{Z:function(){return c}});var n=a(57437),s=a(90837),r=a(50495),o=a(83102),i=a(67135),l=a(34797);function c(e){var t;return(0,n.jsxs)(s.Vq,{children:[(0,n.jsx)(s.hg,{asChild:!0,onClick:e.onShare,children:(0,n.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,n.jsx)(l.m,{className:"w-4 h-4 mr-2"}),e.buttonTitle]})}),(0,n.jsxs)(s.cZ,{children:[(0,n.jsxs)(s.fK,{children:[(0,n.jsx)(s.$N,{children:e.title}),(0,n.jsx)(s.Be,{children:e.description})]}),(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsxs)("div",{className:"grid flex-1 gap-2",children:[(0,n.jsx)(i._,{htmlFor:"link",className:"sr-only",children:"Link"}),(0,n.jsx)(o.I,{id:"link",defaultValue:e.url,readOnly:!0})]}),(0,n.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,n.jsx)("span",{children:"Copy"})})]})]})]})}},47412:function(e,t,a){"use strict";a.d(t,{X:function(){return c},bZ:function(){return l}});var n=a(57437),s=a(2265),r=a(12218),o=a(37440);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=s.forwardRef((e,t)=>{let{className:a,variant:s,...r}=e;return(0,n.jsx)("div",{ref:t,role:"alert",className:(0,o.cn)(i({variant:s}),a),...r})});l.displayName="Alert",s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)("h5",{ref:t,className:(0,o.cn)("mb-1 font-medium leading-none tracking-tight",a),...s})}).displayName="AlertTitle";let c=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)("div",{ref:t,className:(0,o.cn)("text-sm [&_p]:leading-relaxed",a),...s})});c.displayName="AlertDescription"},32653: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 n=a(57437),s=a(2265),r=a(71538),o=a(39343),i=a(37440),l=a(67135);let c=o.RV,d=s.createContext({}),u=e=>{let{...t}=e;return(0,n.jsx)(d.Provider,{value:{name:t.name},children:(0,n.jsx)(o.Qr,{...t})})},m=()=>{let e=s.useContext(d),t=s.useContext(h),{getFieldState:a,formState:n}=(0,o.Gc)(),r=a(e.name,n);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=s.createContext({}),x=s.forwardRef((e,t)=>{let{className:a,...r}=e,o=s.useId();return(0,n.jsx)(h.Provider,{value:{id:o},children:(0,n.jsx)("div",{ref:t,className:(0,i.cn)("space-y-2",a),...r})})});x.displayName="FormItem";let f=s.forwardRef((e,t)=>{let{className:a,...s}=e,{error:r,formItemId:o}=m();return(0,n.jsx)(l._,{ref:t,className:(0,i.cn)(r&&"text-destructive",a),htmlFor:o,...s})});f.displayName="FormLabel";let p=s.forwardRef((e,t)=>{let{...a}=e,{error:s,formItemId:o,formDescriptionId:i,formMessageId:l}=m();return(0,n.jsx)(r.g7,{ref:t,id:o,"aria-describedby":s?"".concat(i," ").concat(l):"".concat(i),"aria-invalid":!!s,...a})});p.displayName="FormControl";let g=s.forwardRef((e,t)=>{let{className:a,...s}=e,{formDescriptionId:r}=m();return(0,n.jsx)("p",{ref:t,id:r,className:(0,i.cn)("text-sm text-muted-foreground",a),...s})});g.displayName="FormDescription";let j=s.forwardRef((e,t)=>{let{className:a,children:s,...r}=e,{error:o,formMessageId:l}=m(),c=o?String(null==o?void 0:o.message):s;return c?(0,n.jsx)("p",{ref:t,id:l,className:(0,i.cn)("text-sm font-medium text-destructive",a),...r,children:c}):null});j.displayName="FormMessage"},67135:function(e,t,a){"use strict";a.d(t,{_:function(){return c}});var n=a(57437),s=a(2265),r=a(38364),o=a(12218),i=a(37440);let l=(0,o.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.f,{ref:t,className:(0,i.cn)(l(),a),...s})});c.displayName=r.f.displayName},46294: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 n=a(57437),s=a(2265),r=a(77539),o=a(42421),i=a(14392),l=a(22468),c=a(37440);let d=r.fC;r.ZA;let u=r.B4,m=s.forwardRef((e,t)=>{let{className:a,children:s,...i}=e;return(0,n.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:[s,(0,n.jsx)(r.JO,{asChild:!0,children:(0,n.jsx)(o.Z,{className:"h-4 w-4 opacity-50"})})]})});m.displayName=r.xz.displayName;let h=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.u_,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",a),...s,children:(0,n.jsx)(i.Z,{className:"h-4 w-4"})})});h.displayName=r.u_.displayName;let x=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.$G,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",a),...s,children:(0,n.jsx)(o.Z,{className:"h-4 w-4"})})});x.displayName=r.$G.displayName;let f=s.forwardRef((e,t)=>{let{className:a,children:s,position:o="popper",...i}=e;return(0,n.jsx)(r.h_,{children:(0,n.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,n.jsx)(h,{}),(0,n.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:s}),(0,n.jsx)(x,{})]})})});f.displayName=r.VY.displayName,s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.__,{ref:t,className:(0,c.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",a),...s})}).displayName=r.__.displayName;let p=s.forwardRef((e,t)=>{let{className:a,children:s,...o}=e;return(0,n.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,n.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,n.jsx)(r.wU,{children:(0,n.jsx)(l.Z,{className:"h-4 w-4"})})}),(0,n.jsx)(r.eT,{children:s})]})});p.displayName=r.ck.displayName,s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.Z0,{ref:t,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",a),...s})}).displayName=r.Z0.displayName},93146:function(e,t,a){"use strict";a.d(t,{g:function(){return o}});var n=a(57437),s=a(2265),r=a(37440);let o=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.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,...s})});o.displayName="Textarea"},50151: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 n=a(57437),s=a(2265),r=a(44504),o=a(12218),i=a(74697),l=a(37440);let c=r.zt,d=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.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),...s})});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=s.forwardRef((e,t)=>{let{className:a,variant:s,...o}=e;return(0,n.jsx)(r.fC,{ref:t,className:(0,l.cn)(u({variant:s}),a),...o})});m.displayName=r.fC.displayName;let h=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.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),...s})});h.displayName=r.aU.displayName;let x=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.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":"",...s,children:(0,n.jsx)(i.Z,{className:"h-4 w-4"})})});x.displayName=r.x8.displayName;let f=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.Dx,{ref:t,className:(0,l.cn)("text-sm font-semibold",a),...s})});f.displayName=r.Dx.displayName;let p=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.dk,{ref:t,className:(0,l.cn)("text-sm opacity-90",a),...s})});p.displayName=r.dk.displayName},35657:function(e,t,a){"use strict";a.d(t,{pm:function(){return m}});var n=a(2265);let s=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=(s=(s+1)%Number.MAX_SAFE_INTEGER).toString(),n=()=>d({type:"DISMISS_TOAST",toastId:a});return d({type:"ADD_TOAST",toast:{...t,id:a,open:!0,onOpenChange:e=>{e||n()}}}),{id:a,dismiss:n,update:e=>d({type:"UPDATE_TOAST",toast:{...e,id:a}})}}function m(){let[e,t]=n.useState(c);return n.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})}}},23611:function(e){e.exports={automationsLayout:"automations_automationsLayout__Atoh_",automationCard:"automations_automationCard__BKidA",pageLayout:"automations_pageLayout__OaoYA",sidePanel:"automations_sidePanel__MPciO"}}},function(e){e.O(0,[9448,9001,3062,5512,4504,1279,1603,2971,7023,1744],function(){return e(e.s=2743)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4371],{2743:function(e,t,a){Promise.resolve().then(a.bind(a,19648))},19648:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return ex}});var n=a(57437),s=a(29039),r=a(58485),o=a(36013),i=a(50495),l=a(46294),c=a(18760),d=a.n(c),u=a(31014),m=a(39343),h=a(59772),x=a(2265),f=a(32653),p=a(83102),g=a(90837),j=a(13304),y=a(93146),w=a(69591),v=a(23611),N=a.n(v),b=a(18642),D=a(16463),C=a(19573),k=a(20319),S=a(22049),_=a(55362),I=a(13537),A=a(76082),M=a(52674),R=a(23751),T=a(83522),z=a(8837),P=a(21819),L=a(35418),O=a(64945),W=a(79306),q=a(66820),E=a(35657),U=a(50151),F=a(47412),B=a(48861),V=a(7951);let G=()=>window.fetch("/api/automations").then(e=>e.json()).catch(e=>console.log(e));function Z(e){let t=e.split(" "),a=t[2],n=t[4];return"*"===a&&"*"===n?"Day":"*"!==n?"Week":"*"!==a?"Month":"Day"}function J(e){let t=e.split(" ");if("*"===t[3]&&"*"!==t[4])return Number(t[4])}function Q(e){let t=e.split(" "),a=t[1],n=t[0],s=Number(a)>=12?"PM":"AM",r=Number(a)>12?Number(a)-12:a;"00"===r&&(r="12");let o=n;return 10>Number(o)&&"00"!==o&&(o="0".concat(o)),"".concat(r,":").concat(o," ").concat(s)}function X(e){return String(e.split(" ")[2])}function Y(e){return d().toString(e)}let $=["Day","Week","Month"],H=Array.from({length:31},(e,t)=>String(t+1)),K=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ee=[],et=["AM","PM"];for(var ea=0;ea<et.length;ea++)for(var en=0;en<12;en++)for(var es=0;es<60;es+=15){let e=String(es).padStart(2,"0"),t=0===en?12:en;ee.push("".concat(t,":").concat(e," ").concat(et[ea]))}let er=Date.now(),eo=[{subject:"Weekly Newsletter",query_to_run:"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:er,scheduling_request:""},{subject:"Daily Bedtime Story",query_to_run:"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:er+1,scheduling_request:""},{subject:"Front Page of Hacker News",query_to_run:"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:er+2,scheduling_request:""},{subject:"Market Summary",query_to_run:"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:er+3,scheduling_request:""},{subject:"Market Crash Notification",query_to_run:"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:er+5,scheduling_request:""},{subject:"Round-up of research papers about AI in healthcare",query_to_run:"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:er+4,scheduling_request:""}];function ei(e){let t=encodeURIComponent(e.subject),a=encodeURIComponent(e.query_to_run),n=encodeURIComponent(e.crontime);return"".concat(window.location.origin,"/automations?subject=").concat(t,"&query=").concat(a,"&crontime=").concat(n)}function el(e){let[t,a]=(0,x.useState)(!1),[s,r]=(0,x.useState)(null),[l,c]=(0,x.useState)(!1),[d,u]=(0,x.useState)(""),{toast:m}=(0,E.pm)(),h=e.automation,[f,p]=(0,x.useState)(""),[g,j]=(0,x.useState)("");return((0,x.useEffect)(()=>{let e=s||h;p(Q(e.crontime));let t=Z(e.crontime);if("Day"===t)j("Daily");else if("Week"===t){let t=J(e.crontime);void 0===t?j("Weekly"):j("".concat(K[t]))}else if("Month"===t){let t=X(e.crontime);j("Monthly on the ".concat(t))}},[s,h]),(0,x.useEffect)(()=>{let e="Automation: ".concat((null==s?void 0:s.subject)||h.subject);d&&(m({title:e,description:d,action:(0,n.jsx)(U.gD,{altText:"Dismiss",children:"Ok"})}),u(""))},[d,s,h,m]),l)?null:(0,n.jsxs)(o.Zb,{className:"bg-secondary h-full shadow-sm rounded-lg bg-gradient-to-b from-background to-slate-50 dark:to-gray-950 border ".concat(N().automationCard),children:[(0,n.jsx)(o.Ol,{children:(0,n.jsxs)(o.ll,{className:"line-clamp-2 leading-normal flex justify-between",children:[(null==s?void 0:s.subject)||h.subject,(0,n.jsxs)(C.J2,{children:[(0,n.jsx)(C.xo,{asChild:!0,children:(0,n.jsx)(i.z,{className:"bg-background",variant:"ghost",children:(0,n.jsx)(k.F,{className:"h-4 w-4"})})}),(0,n.jsxs)(C.yk,{className:"w-auto grid gap-2 text-left bg-secondary",children:[!e.suggestedCard&&e.locationData&&(0,n.jsx)(eh,{isMobileWidth:e.isMobileWidth,callToAction:"Edit",createNew:!1,setIsCreating:a,setShowLoginPrompt:e.setShowLoginPrompt,setNewAutomationData:r,authenticatedData:e.authenticatedData,isCreating:t,automation:s||h,ipLocationData:e.locationData}),(0,n.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:ei(h),onShare:()=>{navigator.clipboard.writeText(ei(h))}}),!e.suggestedCard&&(0,n.jsxs)(i.z,{variant:"outline",className:"justify-start",onClick:()=>{!function(e,t){fetch("/api/trigger/automation?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.")})}(h.id.toString(),u)},children:[(0,n.jsx)(S.s,{className:"h-4 w-4 mr-2"}),"Run Now"]}),(0,n.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)})}(h.id.toString(),c)},children:[(0,n.jsx)(_.r,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})}),(0,n.jsx)(o.aY,{className:"text-secondary-foreground break-all",children:(null==s?void 0:s.query_to_run)||h.query_to_run}),(0,n.jsxs)(o.eW,{className:"flex flex-col items-start md:flex-row md:justify-between md:items-center gap-2",children:[(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsxs)("div",{className:"flex items-center bg-blue-50 rounded-lg p-1.5 border-blue-200 border dark:bg-blue-800 dark:border-blue-500",children:[(0,n.jsx)(I.T,{className:"h-4 w-4 mr-2 text-blue-700 dark:text-blue-300"}),(0,n.jsx)("div",{className:"text-s text-blue-700 dark:text-blue-300",children:f})]}),(0,n.jsxs)("div",{className:"flex items-center bg-purple-50 rounded-lg p-1.5 border-purple-200 border dark:bg-purple-800 dark:border-purple-500",children:[(0,n.jsx)(A.u,{className:"h-4 w-4 mr-2 text-purple-700 dark:text-purple-300"}),(0,n.jsx)("div",{className:"text-s text-purple-700 dark:text-purple-300",children:g})]})]}),e.suggestedCard&&e.setNewAutomationData&&(0,n.jsx)(eh,{isMobileWidth:e.isMobileWidth,callToAction:"Add",createNew:!0,setIsCreating:a,setShowLoginPrompt:e.setShowLoginPrompt,setNewAutomationData:e.setNewAutomationData,authenticatedData:e.authenticatedData,isCreating:t,automation:h,ipLocationData:e.locationData})]})]})}function ec(e){let t=(0,D.useSearchParams)(),[a,s]=(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),query_to_run:decodeURIComponent(o),scheduling_request:"",schedule:Y(decodeURIComponent(i)),crontime:decodeURIComponent(i),next:""};return a?(0,n.jsx)(eh,{isMobileWidth:e.isMobileWidth,callToAction:"Shared",createNew:!0,setIsCreating:s,setShowLoginPrompt:e.setShowLoginPrompt,setNewAutomationData:e.setNewAutomationData,authenticatedData:e.authenticatedData,isCreating:a,automation:l,ipLocationData:e.locationData}):null}let ed=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"}),queryToRun:h.z.string({required_error:"Query to Run is required"})});function eu(e){let t=e.automation,a=(0,m.cI)({resolver:(0,u.F)(ed),defaultValues:{subject:null==t?void 0:t.subject,everyBlah:(null==t?void 0:t.crontime)?Z(t.crontime):"Day",dayOfWeek:(null==t?void 0:t.crontime)?J(t.crontime):void 0,timeRecurrence:(null==t?void 0:t.crontime)?Q(t.crontime):"12:00 PM",dayOfMonth:(null==t?void 0:t.crontime)?X(t.crontime):"1",queryToRun:null==t?void 0:t.query_to_run}});return(0,n.jsx)(em,{authenticatedData:e.authenticatedData,locationData:e.locationData||null,form:a,onSubmit:a=>{let n=function(e,t,a,n){let s="",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":s="".concat(r," ").concat(l," * * *");break;case"Week":s="".concat(r," ").concat(l," * * ").concat(void 0!==a?7===a?0:a:"*");break;case"Month":s="".concat(r," ").concat(l," ").concat(n," * *")}return s}(a.everyBlah,a.timeRecurrence,a.dayOfWeek,a.dayOfMonth),s="/api/automation?";s+="q=".concat(encodeURIComponent(a.queryToRun)),(null==t?void 0:t.id)&&!e.createNew&&(s+="&automation_id=".concat(encodeURIComponent(t.id))),a.subject&&(s+="&subject=".concat(encodeURIComponent(a.subject))),s+="&crontime=".concat(encodeURIComponent(n)),e.locationData&&e.locationData.city&&(s+="&city=".concat(encodeURIComponent(e.locationData.city))),e.locationData&&e.locationData.region&&(s+="&region=".concat(encodeURIComponent(e.locationData.region))),e.locationData&&e.locationData.country&&(s+="&country=".concat(encodeURIComponent(e.locationData.country))),e.locationData&&e.locationData.timezone&&(s+="&timezone=".concat(encodeURIComponent(e.locationData.timezone))),fetch(s,{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:Y(t.crontime),crontime:t.crontime,next:t.next})})},create:e.createNew,isLoggedIn:e.isLoggedIn,setShowLoginPrompt:e.setShowLoginPrompt})}function em(e){var t,a;let[s,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,n.jsx)(f.l0,{...e.form,children:(0,n.jsxs)("form",{onSubmit:e.form.handleSubmit(t=>{e.onSubmit(t),r(!0)}),className:"space-y-6",children:[(0,n.jsx)(f.xJ,{className:"space-y-1",children:(0,n.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,n.jsxs)("div",{className:"flex flex-wrap gap-2 items-center justify-start",children:[a?(0,n.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm",children:[(0,n.jsx)(T.w,{className:"h-4 w-4 mr-2 inline text-orange-500 shadow-sm"}),a.email]}):null,t&&(0,n.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm",children:[(0,n.jsx)(z.x,{className:"h-4 w-4 mr-2 inline text-purple-500"}),t?"".concat(t.city,", ").concat(t.country):"Unknown"]}),t&&(0,n.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm",children:[(0,n.jsx)(P.S,{className:"h-4 w-4 mr-2 inline text-green-500"}),t?"".concat(t.timezone):"Unknown"]})]}))]})}),!e.create&&(0,n.jsx)(f.Wi,{control:e.form.control,name:"subject",render:e=>{var t;let{field:a}=e;return(0,n.jsxs)(f.xJ,{className:"space-y-1",children:[(0,n.jsx)(f.lX,{children:"Subject"}),(0,n.jsx)(f.pf,{children:"This is the subject of the email you will receive."}),(0,n.jsx)(f.NI,{children:(0,n.jsx)(p.I,{placeholder:"Digest of Healthcare AI trends",...a})}),(0,n.jsx)(f.zG,{}),o.subject&&(0,n.jsx)(f.zG,{children:null===(t=o.subject)||void 0===t?void 0:t.message})]})}}),(0,n.jsx)(f.Wi,{control:e.form.control,name:"everyBlah",render:e=>{var t;let{field:a}=e;return(0,n.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,n.jsx)(f.lX,{children:"Frequency"}),(0,n.jsx)(f.pf,{children:"How often should this automation run?"}),(0,n.jsxs)(l.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,n.jsx)(f.NI,{children:(0,n.jsxs)(l.i4,{className:"w-[200px]",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(M.W,{className:"h-4 w-4 mr-2 inline"}),"Every"]}),(0,n.jsx)(l.ki,{placeholder:""})]})}),(0,n.jsx)(l.Bw,{children:$.map(e=>(0,n.jsx)(l.Ql,{value:e,children:e},e))})]}),(0,n.jsx)(f.zG,{}),o.subject&&(0,n.jsx)(f.zG,{children:null===(t=o.everyBlah)||void 0===t?void 0:t.message})]})}}),"Week"===e.form.watch("everyBlah")&&(0,n.jsx)(f.Wi,{control:e.form.control,name:"dayOfWeek",render:e=>{var t;let{field:a}=e;return(0,n.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,n.jsx)(f.pf,{children:"Every week, on which day should this automation run?"}),(0,n.jsxs)(l.Ph,{onValueChange:e=>a.onChange(Number(e)),defaultValue:String(a.value),children:[(0,n.jsx)(f.NI,{children:(0,n.jsxs)(l.i4,{className:"w-[200px]",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(R.n,{className:"h-4 w-4 mr-2 inline"}),"On"]}),(0,n.jsx)(l.ki,{placeholder:""})]})}),(0,n.jsx)(l.Bw,{children:K.map((e,t)=>(0,n.jsx)(l.Ql,{value:String(t),children:e},e))})]}),(0,n.jsx)(f.zG,{}),o.subject&&(0,n.jsx)(f.zG,{children:null===(t=o.dayOfWeek)||void 0===t?void 0:t.message})]})}}),"Month"===e.form.watch("everyBlah")&&(0,n.jsx)(f.Wi,{control:e.form.control,name:"dayOfMonth",render:e=>{var t;let{field:a}=e;return(0,n.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,n.jsx)(f.pf,{children:"Every month, on which day should the automation run?"}),(0,n.jsxs)(l.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,n.jsx)(f.NI,{children:(0,n.jsxs)(l.i4,{className:"w-[200px]",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(R.n,{className:"h-4 w-4 mr-2 inline"}),"On the"]}),(0,n.jsx)(l.ki,{placeholder:""})]})}),(0,n.jsx)(l.Bw,{children:H.map(e=>(0,n.jsx)(l.Ql,{value:e,children:e},e))})]}),(0,n.jsx)(f.zG,{}),o.subject&&(0,n.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,n.jsx)(f.Wi,{control:e.form.control,name:"timeRecurrence",render:e=>{var t;let{field:a}=e;return(0,n.jsxs)(f.xJ,{className:"w-full space-y-1",children:[(0,n.jsx)(f.lX,{children:"Time"}),(0,n.jsx)(f.pf,{children:"On the days this automation runs, at what time should it run?"}),(0,n.jsxs)(l.Ph,{onValueChange:a.onChange,defaultValue:a.value,children:[(0,n.jsx)(f.NI,{children:(0,n.jsxs)(l.i4,{className:"w-[200px]",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(A.u,{className:"h-4 w-4 mr-2 inline"}),"At"]}),(0,n.jsx)(l.ki,{placeholder:""})]})}),(0,n.jsx)(l.Bw,{children:ee.map(e=>(0,n.jsx)(l.Ql,{value:e,children:e},e))})]}),(0,n.jsx)(f.zG,{}),o.subject&&(0,n.jsx)(f.zG,{children:null===(t=o.timeRecurrence)||void 0===t?void 0:t.message})]})}}),(0,n.jsx)(f.Wi,{control:e.form.control,name:"queryToRun",render:t=>{var a;let{field:s}=t;return(0,n.jsxs)(f.xJ,{className:"space-y-1",children:[(0,n.jsx)(f.lX,{children:"Instructions"}),(0,n.jsx)(f.pf,{children:"What do you want Khoj to do?"}),e.create&&(0,n.jsx)("div",{children:c.map(e=>{var t;return t=s.onChange,(0,n.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,n.jsx)(f.NI,{children:(0,n.jsx)(y.g,{placeholder:"Create a summary of the latest news about AI in healthcare.",value:s.value,onChange:s.onChange})}),(0,n.jsx)(f.zG,{}),o.subject&&(0,n.jsx)(f.zG,{children:null===(a=o.queryToRun)||void 0===a?void 0:a.message})]})}}),(0,n.jsx)("fieldset",{disabled:s,children:e.isLoggedIn?s?(0,n.jsx)(i.z,{type:"submit",disabled:!0,children:"Saving..."}):(0,n.jsx)(i.z,{type:"submit",children:"Save"}):(0,n.jsx)(i.z,{onClick:t=>{t.preventDefault(),e.setShowLoginPrompt(!0)},variant:"default",children:"Login to Save"})})]})})}function eh(e){return e.isMobileWidth?(0,n.jsxs)(V.dy,{open:e.isCreating,onOpenChange:t=>{e.setIsCreating(t)},children:[(0,n.jsx)(V.Qz,{asChild:!0,children:(0,n.jsxs)(i.z,{className:"shadow-sm justify-start",variant:"outline",children:[(0,n.jsx)(L.v,{className:"h-4 w-4 mr-2"}),e.callToAction]})}),(0,n.jsxs)(V.sc,{className:"p-2",children:[(0,n.jsx)(V.iI,{children:"Automation"}),(0,n.jsx)(eu,{createNew:e.createNew,automation:e.automation,setIsEditing:e.setIsCreating,isLoggedIn:!!e.authenticatedData,authenticatedData:e.authenticatedData,setShowLoginPrompt:e.setShowLoginPrompt,setUpdatedAutomationData:e.setNewAutomationData,locationData:e.ipLocationData})]})]}):(0,n.jsxs)(g.Vq,{open:e.isCreating,onOpenChange:t=>{e.setIsCreating(t)},children:[(0,n.jsx)(g.hg,{asChild:!0,children:(0,n.jsxs)(i.z,{className:"shadow-sm justify-start",variant:"outline",children:[(0,n.jsx)(L.v,{className:"h-4 w-4 mr-2"}),e.callToAction]})}),(0,n.jsxs)(g.cZ,{className:"max-h-[98vh] overflow-y-auto",children:[(0,n.jsx)(j.$N,{children:"Automation"}),(0,n.jsx)(eu,{automation:e.automation,createNew:e.createNew,setIsEditing:e.setIsCreating,isLoggedIn:!!e.authenticatedData,authenticatedData:e.authenticatedData,setShowLoginPrompt:e.setShowLoginPrompt,setUpdatedAutomationData:e.setNewAutomationData,locationData:e.ipLocationData})]})]})}function ex(){let e=(0,W.GW)(),{data:t,error:a,isLoading:o}=(0,s.ZP)(e?"automations":null,G,{revalidateOnFocus:!1}),[l,c]=(0,x.useState)(!1),[d,u]=(0,x.useState)(null),[m,h]=(0,x.useState)([]),[f,p]=(0,x.useState)([]),[g,j]=(0,x.useState)(!1),y=(0,w.IC)(),v=(0,w.k6)();return((0,x.useEffect)(()=>{d&&(h([...m,d]),u(null))},[d,m]),(0,x.useEffect)(()=>{let e=t?t.concat(m):m;e&&p(eo.filter(t=>void 0===e.find(e=>t.subject===e.subject)))},[t,m]),a)?(0,n.jsx)(r.l,{message:"Oops, something went wrong. Please refresh the page."}):(0,n.jsx)("main",{className:"w-full mx-auto",children:(0,n.jsxs)("div",{className:"grid w-full mx-auto",children:[(0,n.jsx)("div",{className:"".concat(N().sidePanel," top-0"),children:(0,n.jsx)(B.ZP,{conversationId:null,uploadedFiles:[],isMobileWidth:y})}),(0,n.jsxs)("div",{className:"".concat(N().pageLayout," w-full"),children:[(0,n.jsxs)("div",{className:"pt-6 md:pt-8 grid gap-1 md:flex md:justify-between",children:[(0,n.jsx)("h1",{className:"text-3xl flex items-center",children:"Automations"}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 items-center justify-start",children:[e?(0,n.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm",children:[(0,n.jsx)(T.w,{className:"h-4 w-4 mr-2 inline text-orange-500 shadow-sm"}),e.email]}):null,v&&(0,n.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm",children:[(0,n.jsx)(z.x,{className:"h-4 w-4 mr-2 inline text-purple-500"}),v?"".concat(v.city,", ").concat(v.country):"Unknown"]}),v&&(0,n.jsxs)("span",{className:"rounded-lg text-sm border-secondary border p-1 flex items-center shadow-sm",children:[(0,n.jsx)(P.S,{className:"h-4 w-4 mr-2 inline text-green-500"}),v?"".concat(v.timezone):"Unknown"]})]})]}),g&&(0,n.jsx)(q.Z,{loginRedirectMessage:"Create an account to make your own automation",onOpenChange:j}),(0,n.jsx)(F.bZ,{className:"bg-secondary border-none my-4",children:(0,n.jsxs)(F.X,{children:[(0,n.jsx)(O.B,{weight:"fill",className:"h-4 w-4 text-purple-400 inline"}),(0,n.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,n.jsxs)("div",{className:"flex justify-between items-center py-4",children:[(0,n.jsx)("h3",{className:"text-xl",children:"Your Creations"}),e?(0,n.jsx)(eh,{isMobileWidth:y,callToAction:"Create Automation",createNew:!0,setIsCreating:c,setShowLoginPrompt:j,setNewAutomationData:u,authenticatedData:e,isCreating:l,ipLocationData:v}):(0,n.jsxs)(i.z,{className:"shadow-sm",onClick:()=>j(!0),variant:"outline",children:[(0,n.jsx)(L.v,{className:"h-4 w-4 mr-2"}),"Create Automation"]})]}),(0,n.jsx)(x.Suspense,{children:(0,n.jsx)(ec,{isMobileWidth:y,authenticatedData:e,locationData:v,isLoggedIn:!!e,setShowLoginPrompt:j,setNewAutomationData:u})}),(!t||0===t.length)&&0==m.length&&!o&&(0,n.jsxs)("div",{className:"px-4",children:["So empty! Create your own automation to get started.",(0,n.jsx)("div",{className:"mt-4",children:e?(0,n.jsx)(eh,{isMobileWidth:y,callToAction:"Design Automation",createNew:!0,setIsCreating:c,setShowLoginPrompt:j,setNewAutomationData:u,authenticatedData:e,isCreating:l,ipLocationData:v}):(0,n.jsx)(i.z,{onClick:()=>j(!0),variant:"default",children:"Design"})})]}),o&&(0,n.jsx)(r.l,{message:"booting up your automations"}),(0,n.jsxs)("div",{className:"".concat(N().automationsLayout),children:[t&&t.map(t=>(0,n.jsx)(el,{isMobileWidth:y,authenticatedData:e,automation:t,locationData:v,isLoggedIn:!!e,setShowLoginPrompt:j},t.id)),m.map(t=>(0,n.jsx)(el,{isMobileWidth:y,authenticatedData:e,automation:t,locationData:v,isLoggedIn:!!e,setShowLoginPrompt:j},t.id))]}),(0,n.jsx)("h3",{className:"text-xl py-4",children:"Try these out"}),(0,n.jsx)("div",{className:"".concat(N().automationsLayout),children:f.map(t=>(0,n.jsx)(el,{isMobileWidth:y,setNewAutomationData:u,authenticatedData:e,automation:t,locationData:v,isLoggedIn:!!e,setShowLoginPrompt:j,suggestedCard:!0},t.id))})]})]})})}},66820:function(e,t,a){"use strict";a.d(t,{Z:function(){return o}});var n=a(57437),s=a(6780),r=a(87138);function o(e){return(0,n.jsx)(s.aR,{open:!0,onOpenChange:e.onOpenChange,children:(0,n.jsxs)(s._T,{children:[(0,n.jsx)(s.fY,{children:(0,n.jsx)(s.f$,{children:"Sign in to Khoj to continue"})}),(0,n.jsxs)(s.yT,{children:[e.loginRedirectMessage,". By logging in, you agree to our"," ",(0,n.jsx)(r.default,{href:"https://khoj.dev/terms-of-service",children:"Terms of Service."})]}),(0,n.jsxs)(s.xo,{children:[(0,n.jsx)(s.le,{children:"Dismiss"}),(0,n.jsx)(s.OL,{className:"bg-slate-400 hover:bg-slate-500",onClick:()=>{window.location.href="/login?next=".concat(encodeURIComponent(window.location.pathname))},children:(0,n.jsxs)(r.default,{href:"/login?next=".concat(encodeURIComponent(window.location.pathname)),children:[" ","Login"]})})]})]})})}},18642:function(e,t,a){"use strict";a.d(t,{Z:function(){return c}});var n=a(57437),s=a(90837),r=a(50495),o=a(83102),i=a(67135),l=a(34797);function c(e){var t;return(0,n.jsxs)(s.Vq,{children:[(0,n.jsx)(s.hg,{asChild:!0,onClick:e.onShare,children:(0,n.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,n.jsx)(l.m,{className:"w-4 h-4 mr-2"}),e.buttonTitle]})}),(0,n.jsxs)(s.cZ,{children:[(0,n.jsxs)(s.fK,{children:[(0,n.jsx)(s.$N,{children:e.title}),(0,n.jsx)(s.Be,{children:e.description})]}),(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsxs)("div",{className:"grid flex-1 gap-2",children:[(0,n.jsx)(i._,{htmlFor:"link",className:"sr-only",children:"Link"}),(0,n.jsx)(o.I,{id:"link",defaultValue:e.url,readOnly:!0})]}),(0,n.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,n.jsx)("span",{children:"Copy"})})]})]})]})}},47412:function(e,t,a){"use strict";a.d(t,{X:function(){return c},bZ:function(){return l}});var n=a(57437),s=a(2265),r=a(12218),o=a(37440);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=s.forwardRef((e,t)=>{let{className:a,variant:s,...r}=e;return(0,n.jsx)("div",{ref:t,role:"alert",className:(0,o.cn)(i({variant:s}),a),...r})});l.displayName="Alert",s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)("h5",{ref:t,className:(0,o.cn)("mb-1 font-medium leading-none tracking-tight",a),...s})}).displayName="AlertTitle";let c=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)("div",{ref:t,className:(0,o.cn)("text-sm [&_p]:leading-relaxed",a),...s})});c.displayName="AlertDescription"},32653: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 n=a(57437),s=a(2265),r=a(71538),o=a(39343),i=a(37440),l=a(67135);let c=o.RV,d=s.createContext({}),u=e=>{let{...t}=e;return(0,n.jsx)(d.Provider,{value:{name:t.name},children:(0,n.jsx)(o.Qr,{...t})})},m=()=>{let e=s.useContext(d),t=s.useContext(h),{getFieldState:a,formState:n}=(0,o.Gc)(),r=a(e.name,n);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=s.createContext({}),x=s.forwardRef((e,t)=>{let{className:a,...r}=e,o=s.useId();return(0,n.jsx)(h.Provider,{value:{id:o},children:(0,n.jsx)("div",{ref:t,className:(0,i.cn)("space-y-2",a),...r})})});x.displayName="FormItem";let f=s.forwardRef((e,t)=>{let{className:a,...s}=e,{error:r,formItemId:o}=m();return(0,n.jsx)(l._,{ref:t,className:(0,i.cn)(r&&"text-destructive",a),htmlFor:o,...s})});f.displayName="FormLabel";let p=s.forwardRef((e,t)=>{let{...a}=e,{error:s,formItemId:o,formDescriptionId:i,formMessageId:l}=m();return(0,n.jsx)(r.g7,{ref:t,id:o,"aria-describedby":s?"".concat(i," ").concat(l):"".concat(i),"aria-invalid":!!s,...a})});p.displayName="FormControl";let g=s.forwardRef((e,t)=>{let{className:a,...s}=e,{formDescriptionId:r}=m();return(0,n.jsx)("p",{ref:t,id:r,className:(0,i.cn)("text-sm text-muted-foreground",a),...s})});g.displayName="FormDescription";let j=s.forwardRef((e,t)=>{let{className:a,children:s,...r}=e,{error:o,formMessageId:l}=m(),c=o?String(null==o?void 0:o.message):s;return c?(0,n.jsx)("p",{ref:t,id:l,className:(0,i.cn)("text-sm font-medium text-destructive",a),...r,children:c}):null});j.displayName="FormMessage"},67135:function(e,t,a){"use strict";a.d(t,{_:function(){return c}});var n=a(57437),s=a(2265),r=a(38364),o=a(12218),i=a(37440);let l=(0,o.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.f,{ref:t,className:(0,i.cn)(l(),a),...s})});c.displayName=r.f.displayName},46294: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 n=a(57437),s=a(2265),r=a(77539),o=a(42421),i=a(14392),l=a(22468),c=a(37440);let d=r.fC;r.ZA;let u=r.B4,m=s.forwardRef((e,t)=>{let{className:a,children:s,...i}=e;return(0,n.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:[s,(0,n.jsx)(r.JO,{asChild:!0,children:(0,n.jsx)(o.Z,{className:"h-4 w-4 opacity-50"})})]})});m.displayName=r.xz.displayName;let h=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.u_,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",a),...s,children:(0,n.jsx)(i.Z,{className:"h-4 w-4"})})});h.displayName=r.u_.displayName;let x=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.$G,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",a),...s,children:(0,n.jsx)(o.Z,{className:"h-4 w-4"})})});x.displayName=r.$G.displayName;let f=s.forwardRef((e,t)=>{let{className:a,children:s,position:o="popper",...i}=e;return(0,n.jsx)(r.h_,{children:(0,n.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,n.jsx)(h,{}),(0,n.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:s}),(0,n.jsx)(x,{})]})})});f.displayName=r.VY.displayName,s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.__,{ref:t,className:(0,c.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",a),...s})}).displayName=r.__.displayName;let p=s.forwardRef((e,t)=>{let{className:a,children:s,...o}=e;return(0,n.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,n.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,n.jsx)(r.wU,{children:(0,n.jsx)(l.Z,{className:"h-4 w-4"})})}),(0,n.jsx)(r.eT,{children:s})]})});p.displayName=r.ck.displayName,s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.Z0,{ref:t,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",a),...s})}).displayName=r.Z0.displayName},93146:function(e,t,a){"use strict";a.d(t,{g:function(){return o}});var n=a(57437),s=a(2265),r=a(37440);let o=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.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,...s})});o.displayName="Textarea"},50151: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 n=a(57437),s=a(2265),r=a(44504),o=a(12218),i=a(74697),l=a(37440);let c=r.zt,d=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.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),...s})});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=s.forwardRef((e,t)=>{let{className:a,variant:s,...o}=e;return(0,n.jsx)(r.fC,{ref:t,className:(0,l.cn)(u({variant:s}),a),...o})});m.displayName=r.fC.displayName;let h=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.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),...s})});h.displayName=r.aU.displayName;let x=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.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":"",...s,children:(0,n.jsx)(i.Z,{className:"h-4 w-4"})})});x.displayName=r.x8.displayName;let f=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.Dx,{ref:t,className:(0,l.cn)("text-sm font-semibold",a),...s})});f.displayName=r.Dx.displayName;let p=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,n.jsx)(r.dk,{ref:t,className:(0,l.cn)("text-sm opacity-90",a),...s})});p.displayName=r.dk.displayName},35657:function(e,t,a){"use strict";a.d(t,{pm:function(){return m}});var n=a(2265);let s=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=(s=(s+1)%Number.MAX_SAFE_INTEGER).toString(),n=()=>d({type:"DISMISS_TOAST",toastId:a});return d({type:"ADD_TOAST",toast:{...t,id:a,open:!0,onOpenChange:e=>{e||n()}}}),{id:a,dismiss:n,update:e=>d({type:"UPDATE_TOAST",toast:{...e,id:a}})}}function m(){let[e,t]=n.useState(c);return n.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})}}},23611:function(e){e.exports={automationsLayout:"automations_automationsLayout__Atoh_",automationCard:"automations_automationCard__BKidA",pageLayout:"automations_pageLayout__OaoYA",sidePanel:"automations_sidePanel__MPciO"}}},function(e){e.O(0,[2734,9848,9001,3062,5512,4504,1279,1603,2971,7023,1744],function(){return e(e.s=2743)}),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1929],{39929:function(e,t,s){Promise.resolve().then(s.bind(s,38874))},38874:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return p}});var a=s(57437),o=s(65104),n=s.n(o),i=s(2265),r=s(48861),c=s(55538),l=s(16463),d=s(58485),u=s(9557);s(7395);var h=s(69591),m=s(38423),g=s(79306);function f(e){let t=(0,l.useSearchParams)().get("conversationId"),[s,o]=(0,i.useState)(""),[r,d]=(0,i.useState)([]),[u,h]=(0,i.useState)(!1),[g,f]=(0,i.useState)(null),[p,_]=(0,i.useState)(!1),x=(0,i.useRef)(null),y=e.setQueryToProcess,w=e.onConversationIdChange,S=e.isMobileWidth?"w-full":"w-4/6";if((0,i.useEffect)(()=>{if(r.length>0){let t=r.map(e=>encodeURIComponent(e));e.setImages(t)}},[r,e.setImages]),(0,i.useEffect)(()=>{let t=localStorage.getItem("images");if(t){let s=JSON.parse(t);d(s);let a=s.map(e=>encodeURIComponent(e));e.setImages(a),localStorage.removeItem("images")}let s=localStorage.getItem("message");s&&(h(!0),y(s),s.trim().startsWith("/research")&&_(!0));let a=localStorage.getItem("uploadedFiles");if(a){let t=a?JSON.parse(a):[],s=[];for(let e of t)s.push({name:e.name,file_type:e.file_type,content:e.content,size:e.size});localStorage.removeItem("uploadedFiles"),e.setUploadedFiles(s)}},[y,e.setImages,t]),(0,i.useEffect)(()=>{s&&(h(!0),y(s))},[s,y]),(0,i.useEffect)(()=>{t&&(null==w||w(t))},[t,w]),(0,i.useEffect)(()=>{e.streamedMessages&&e.streamedMessages.length>0&&e.streamedMessages[e.streamedMessages.length-1].completed?(h(!1),d([]),e.setUploadedFiles(void 0)):o("")},[e.streamedMessages]),!t){window.location.href="/";return}return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:n().chatBodyFull,children:(0,a.jsx)(c.Z,{conversationId:t,setTitle:e.setTitle,setAgent:f,pendingMessage:u?s:"",incomingMessages:e.streamedMessages,setIncomingMessages:e.setStreamedMessages,customClassName:S})}),(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-t-2xl rounded-b-none md:rounded-xl h-fit ").concat(S," mr-auto ml-auto"),children:(0,a.jsx)(m.a,{agentColor:null==g?void 0:g.color,isLoggedIn:e.isLoggedIn,sendMessage:e=>o(e),sendImage:e=>d(t=>[...t,e]),sendDisabled:u,chatOptionsData:e.chatOptionsData,conversationId:t,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,ref:x,isResearchModeEnabled:p})})]})}function p(){let e="Khoj AI - Chat",[t,s]=(0,i.useState)(null),[o,c]=(0,i.useState)(!0),[l,m]=(0,i.useState)(e),[p,_]=(0,i.useState)(null),[x,y]=(0,i.useState)([]),[w,S]=(0,i.useState)(""),[I,v]=(0,i.useState)(!1),[b,j]=(0,i.useState)(void 0),[B,C]=(0,i.useState)([]),M=(0,h.k6)()||{timezone:Intl.DateTimeFormat().resolvedOptions().timeZone},E=(0,g.GW)(),F=(0,h.IC)();async function T(e){if(!e.ok)throw Error(e.statusText);if(!e.body)throw Error("Response body is null");let t=e.body.getReader(),s=new TextDecoder,a="␃\uD83D\uDD1A␗",o="",n=[],i={},r={};for(;;){let e;let{done:c,value:l}=await t.read();if(c){S(""),v(!1),C([]),p&&(0,u.tQ)(p,m);break}for(o+=s.decode(l,{stream:!0});-1!==(e=o.indexOf(a));){let t=o.slice(0,e);if(o=o.slice(e+a.length),t){let e=x.find(e=>!e.completed);if(!e){console.error("No current message found");return}({context:n,onlineContext:i,codeContext:r}=(0,u.VK)(t,e,n,i,r)),y([...x])}}}}async function k(){if(localStorage.removeItem("message"),!w||!p)return;let e={q:w,conversation_id:p,stream:!0,...M&&{city:M.city,region:M.region,country:M.country,country_code:M.countryCode,timezone:M.timezone},...B.length>0&&{images:B},...b&&{files:b}},t=await fetch("/api/chat?client=web",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});try{await T(t)}catch(o){let e=await t.json();console.error(e);let s=x.find(e=>!e.completed);if(!s)return;let a=o.message;a.includes("Error in input stream")?s.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?":429===t.status?"detail"in e?s.rawResponse="".concat(e.detail):s.rawResponse="I'm a bit overwhelmed at the moment. Could you try again in a bit or dislike this message if the issue persists?":s.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?"),s.completed=!0,y([...x]),S(""),v(!1)}}return((0,i.useEffect)(()=>{fetch("/api/chat/options").then(e=>e.json()).then(e=>{c(!1),e&&s(e)}).catch(e=>{console.error(e)}),(0,h.EK)()},[]),(0,i.useEffect)(()=>{if(w){let e={rawResponse:"",trainOfThought:[],context:[],onlineContext:{},codeContext:{},completed:!1,timestamp:new Date().toISOString(),rawQuery:w||"",images:B,queryFiles:b};y(t=>[...t,e]),v(!0)}},[w]),(0,i.useEffect)(()=>{I&&k()},[I]),o)?(0,a.jsx)(d.Z,{}):(0,a.jsxs)("div",{className:"".concat(n().main," ").concat(n().chatLayout),children:[(0,a.jsx)("title",{children:"".concat(e).concat(l&&l!==e?": ".concat(l):"")}),(0,a.jsx)("div",{children:(0,a.jsx)(r.ZP,{conversationId:p,uploadedFiles:[],isMobileWidth:F})}),(0,a.jsx)("div",{className:n().chatBox,children:(0,a.jsxs)("div",{className:n().chatBoxBody,children:[!F&&p&&(0,a.jsxs)("div",{className:"".concat(n().chatTitleWrapper," text-nowrap text-ellipsis overflow-hidden max-w-screen-md grid items-top font-bold mr-8 pt-6 col-auto h-fit"),children:[l&&(0,a.jsx)("h2",{className:"text-lg text-ellipsis whitespace-nowrap overflow-x-hidden",children:l}),(0,a.jsx)(r.En,{conversationId:p,setTitle:m,sizing:"md"})]}),(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(d.Z,{}),children:(0,a.jsx)(f,{isLoggedIn:null!==E,streamedMessages:x,setStreamedMessages:y,chatOptionsData:t,setTitle:m,setQueryToProcess:S,setUploadedFiles:j,isMobileWidth:F,onConversationIdChange:e=>{_(e)},setImages:C})})]})})]})}},16463:function(e,t,s){"use strict";var a=s(71169);s.o(a,"useRouter")&&s.d(t,{useRouter:function(){return a.useRouter}}),s.o(a,"useSearchParams")&&s.d(t,{useSearchParams:function(){return a.useSearchParams}})},65104: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,[7812,9448,4836,3954,9001,3062,3124,3803,2261,5961,1603,9417,8423,5538,2971,7023,1744],function(){return e(e.s=39929)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1929],{39929:function(e,t,s){Promise.resolve().then(s.bind(s,38874))},38874:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return p}});var a=s(57437),o=s(65104),n=s.n(o),i=s(2265),r=s(48861),c=s(55538),l=s(16463),d=s(58485),u=s(9557);s(7395);var h=s(69591),m=s(38423),g=s(79306);function f(e){let t=(0,l.useSearchParams)().get("conversationId"),[s,o]=(0,i.useState)(""),[r,d]=(0,i.useState)([]),[u,h]=(0,i.useState)(!1),[g,f]=(0,i.useState)(null),[p,_]=(0,i.useState)(!1),x=(0,i.useRef)(null),y=e.setQueryToProcess,w=e.onConversationIdChange,S=e.isMobileWidth?"w-full":"w-4/6";if((0,i.useEffect)(()=>{if(r.length>0){let t=r.map(e=>encodeURIComponent(e));e.setImages(t)}},[r,e.setImages]),(0,i.useEffect)(()=>{let t=localStorage.getItem("images");if(t){let s=JSON.parse(t);d(s);let a=s.map(e=>encodeURIComponent(e));e.setImages(a),localStorage.removeItem("images")}let s=localStorage.getItem("message");s&&(h(!0),y(s),s.trim().startsWith("/research")&&_(!0));let a=localStorage.getItem("uploadedFiles");if(a){let t=a?JSON.parse(a):[],s=[];for(let e of t)s.push({name:e.name,file_type:e.file_type,content:e.content,size:e.size});localStorage.removeItem("uploadedFiles"),e.setUploadedFiles(s)}},[y,e.setImages,t]),(0,i.useEffect)(()=>{s&&(h(!0),y(s))},[s,y]),(0,i.useEffect)(()=>{t&&(null==w||w(t))},[t,w]),(0,i.useEffect)(()=>{e.streamedMessages&&e.streamedMessages.length>0&&e.streamedMessages[e.streamedMessages.length-1].completed?(h(!1),d([]),e.setUploadedFiles(void 0)):o("")},[e.streamedMessages]),!t){window.location.href="/";return}return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:n().chatBodyFull,children:(0,a.jsx)(c.Z,{conversationId:t,setTitle:e.setTitle,setAgent:f,pendingMessage:u?s:"",incomingMessages:e.streamedMessages,setIncomingMessages:e.setStreamedMessages,customClassName:S})}),(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-t-2xl rounded-b-none md:rounded-xl h-fit ").concat(S," mr-auto ml-auto"),children:(0,a.jsx)(m.a,{agentColor:null==g?void 0:g.color,isLoggedIn:e.isLoggedIn,sendMessage:e=>o(e),sendImage:e=>d(t=>[...t,e]),sendDisabled:u,chatOptionsData:e.chatOptionsData,conversationId:t,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,ref:x,isResearchModeEnabled:p})})]})}function p(){let e="Khoj AI - Chat",[t,s]=(0,i.useState)(null),[o,c]=(0,i.useState)(!0),[l,m]=(0,i.useState)(e),[p,_]=(0,i.useState)(null),[x,y]=(0,i.useState)([]),[w,S]=(0,i.useState)(""),[I,v]=(0,i.useState)(!1),[b,j]=(0,i.useState)(void 0),[B,C]=(0,i.useState)([]),M=(0,h.k6)()||{timezone:Intl.DateTimeFormat().resolvedOptions().timeZone},E=(0,g.GW)(),F=(0,h.IC)();async function T(e){if(!e.ok)throw Error(e.statusText);if(!e.body)throw Error("Response body is null");let t=e.body.getReader(),s=new TextDecoder,a="␃\uD83D\uDD1A␗",o="",n=[],i={},r={};for(;;){let e;let{done:c,value:l}=await t.read();if(c){S(""),v(!1),C([]),p&&(0,u.tQ)(p,m);break}for(o+=s.decode(l,{stream:!0});-1!==(e=o.indexOf(a));){let t=o.slice(0,e);if(o=o.slice(e+a.length),t){let e=x.find(e=>!e.completed);if(!e){console.error("No current message found");return}({context:n,onlineContext:i,codeContext:r}=(0,u.VK)(t,e,n,i,r)),y([...x])}}}}async function k(){if(localStorage.removeItem("message"),!w||!p)return;let e={q:w,conversation_id:p,stream:!0,...M&&{city:M.city,region:M.region,country:M.country,country_code:M.countryCode,timezone:M.timezone},...B.length>0&&{images:B},...b&&{files:b}},t=await fetch("/api/chat?client=web",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});try{await T(t)}catch(o){let e=await t.json();console.error(e);let s=x.find(e=>!e.completed);if(!s)return;let a=o.message;a.includes("Error in input stream")?s.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?":429===t.status?"detail"in e?s.rawResponse="".concat(e.detail):s.rawResponse="I'm a bit overwhelmed at the moment. Could you try again in a bit or dislike this message if the issue persists?":s.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?"),s.completed=!0,y([...x]),S(""),v(!1)}}return((0,i.useEffect)(()=>{fetch("/api/chat/options").then(e=>e.json()).then(e=>{c(!1),e&&s(e)}).catch(e=>{console.error(e)}),(0,h.EK)()},[]),(0,i.useEffect)(()=>{if(w){let e={rawResponse:"",trainOfThought:[],context:[],onlineContext:{},codeContext:{},completed:!1,timestamp:new Date().toISOString(),rawQuery:w||"",images:B,queryFiles:b};y(t=>[...t,e]),v(!0)}},[w]),(0,i.useEffect)(()=>{I&&k()},[I]),o)?(0,a.jsx)(d.Z,{}):(0,a.jsxs)("div",{className:"".concat(n().main," ").concat(n().chatLayout),children:[(0,a.jsx)("title",{children:"".concat(e).concat(l&&l!==e?": ".concat(l):"")}),(0,a.jsx)("div",{children:(0,a.jsx)(r.ZP,{conversationId:p,uploadedFiles:[],isMobileWidth:F})}),(0,a.jsx)("div",{className:n().chatBox,children:(0,a.jsxs)("div",{className:n().chatBoxBody,children:[!F&&p&&(0,a.jsxs)("div",{className:"".concat(n().chatTitleWrapper," text-nowrap text-ellipsis overflow-hidden max-w-screen-md grid items-top font-bold mr-8 pt-6 col-auto h-fit"),children:[l&&(0,a.jsx)("h2",{className:"text-lg text-ellipsis whitespace-nowrap overflow-x-hidden",children:l}),(0,a.jsx)(r.En,{conversationId:p,setTitle:m,sizing:"md"})]}),(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(d.Z,{}),children:(0,a.jsx)(f,{isLoggedIn:null!==E,streamedMessages:x,setStreamedMessages:y,chatOptionsData:t,setTitle:m,setQueryToProcess:S,setUploadedFiles:j,isMobileWidth:F,onConversationIdChange:e=>{_(e)},setImages:C})})]})})]})}},16463:function(e,t,s){"use strict";var a=s(71169);s.o(a,"useRouter")&&s.d(t,{useRouter:function(){return a.useRouter}}),s.o(a,"useSearchParams")&&s.d(t,{useSearchParams:function(){return a.useSearchParams}})},65104: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,[7812,9848,4836,3954,9001,3062,3124,3803,2261,5961,1603,9417,8423,5538,2971,7023,1744],function(){return e(e.s=39929)}),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1931],{1507:function(e,t,n){Promise.resolve().then(n.bind(n,4515))},4515:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return U}});var i,o,a=n(57437);n(58877);var r=n(68518),s=n.n(r);n(7395);var l=n(2265),c=n(29039),d=n(52195);let p=new Map([["bold",l.createElement(l.Fragment,null,l.createElement("path",{d:"M228,128a100,100,0,0,1-98.66,100H128a99.39,99.39,0,0,1-68.62-27.29,12,12,0,0,1,16.48-17.45,76,76,0,1,0-1.57-109c-.13.13-.25.25-.39.37L54.89,92H72a12,12,0,0,1,0,24H24a12,12,0,0,1-12-12V56a12,12,0,0,1,24,0V76.72L57.48,57.06A100,100,0,0,1,228,128Z"}))],["duotone",l.createElement(l.Fragment,null,l.createElement("path",{d:"M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z",opacity:"0.2"}),l.createElement("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"}))],["fill",l.createElement(l.Fragment,null,l.createElement("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L60.63,81.29l17,17A8,8,0,0,1,72,112H24a8,8,0,0,1-8-8V56A8,8,0,0,1,29.66,50.3L49.31,70,60.25,60A96,96,0,0,1,224,128Z"}))],["light",l.createElement(l.Fragment,null,l.createElement("path",{d:"M222,128a94,94,0,0,1-92.74,94H128a93.43,93.43,0,0,1-64.5-25.65,6,6,0,1,1,8.24-8.72A82,82,0,1,0,70,70l-.19.19L39.44,98H72a6,6,0,0,1,0,12H24a6,6,0,0,1-6-6V56a6,6,0,0,1,12,0V90.34L61.63,61.4A94,94,0,0,1,222,128Z"}))],["regular",l.createElement(l.Fragment,null,l.createElement("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"}))],["thin",l.createElement(l.Fragment,null,l.createElement("path",{d:"M220,128a92,92,0,0,1-90.77,92H128a91.47,91.47,0,0,1-63.13-25.1,4,4,0,1,1,5.5-5.82A84,84,0,1,0,68.6,68.57l-.13.12L34.3,100H72a4,4,0,0,1,0,8H24a4,4,0,0,1-4-4V56a4,4,0,0,1,8,0V94.89l35-32A92,92,0,0,1,220,128Z"}))]]);var u=Object.defineProperty,h=Object.defineProperties,g=Object.getOwnPropertyDescriptors,m=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable,k=(e,t,n)=>t in e?u(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=(e,t)=>{for(var n in t||(t={}))f.call(t,n)&&k(e,n,t[n]);if(m)for(var n of m(t))y.call(t,n)&&k(e,n,t[n]);return e},v=(e,t)=>h(e,g(t));let w=(0,l.forwardRef)((e,t)=>l.createElement(d.Z,v(b({ref:t},e),{weights:p})));w.displayName="ArrowCounterClockwise";var x=n(36013),P=n(31806),C=n.n(P),L=n(58575),j=n(89417);(i=o||(o={})).Automation="Automation",i.Paint="Paint",i.Travel="Travel",i.Health="Health",i.Learning="Learning",i.Language="Language",i.PopCulture="Pop Culture",i.Food="Food",i.Interviewing="Interviewing",i.Home="Home",i.Fun="Fun",i.Code="Code",i.Finance="Finance";let A={};A.Automation="blue",A.Paint="indigo",A.Travel="yellow",A.Health="teal",A.Learning="purple",A.Language="blue",A["Pop Culture"]="red",A.Food="yellow",A.Interviewing="orange",A.Home="green",A.Fun="fuchsia",A.Code="purple",A.Finance="green";let S="orange",E=[{type:"Automation",color:A.Automation||S,description:"Send me a summary of HackerNews every morning.",link:"/automations?subject=Summarizing%20Top%20Headlines%20from%20HackerNews&query=Summarize%20the%20top%20headlines%20on%20HackerNews&crontime=00%207%20*%20*%20*"},{type:"Automation",color:A.Automation||S,description:"Compose a bedtime story that a five-year-old might enjoy.",link:"/automations?subject=Daily%20Bedtime%20Story&query=Compose%20a%20bedtime%20story%20that%20a%20five-year-old%20might%20enjoy.%20It%20should%20not%20exceed%20five%20paragraphs.%20Appeal%20to%20the%20imagination%2C%20but%20weave%20in%20learnings.&crontime=0%2021%20*%20*%20*"},{type:"Paint",color:A.Paint||S,description:"Paint a picture of a sunset but it's made of stained glass tiles",link:""},{type:"Travel",color:A.Travel||S,description:"Search for the best attractions in Austria Hungary",link:""},{type:"Health",color:A.Health||S,description:"Generate a weekly meal plan with recipes.",link:"/automations?subject=Weekly Meal Plan&query=Create a weekly meal plan with 7 dinner recipes, including ingredients and brief instructions. Focus on balanced, healthy meals.&crontime=0 18 * * 0"},{type:"Paint",color:A.Paint||S,description:"Paint a futuristic cityscape with flying cars.",link:""},{type:"Travel",color:A.Travel||S,description:"Find the top-rated coffee shops in Seattle.",link:""},{type:"Automation",color:A.Automation||S,description:"Send daily motivational quotes.",link:"/automations?subject=Daily Motivation&query=Provide an inspiring quote for the day along with a brief explanation of its meaning.&crontime=0 7 * * *"},{type:"Paint",color:A.Paint||S,description:"Create an abstract representation of jazz music.",link:""},{type:"Learning",color:A.Learning||S,description:"Research the history of the Eiffel Tower.",link:""},{type:"Automation",color:A.Automation||S,description:"Compile a weekly news summary.",link:"/automations?subject=Weekly News Digest&query=Summarize the top 5 most important news stories of the week across various categories.&crontime=0 18 * * 5"},{type:"Paint",color:A.Paint||S,description:"Paint a portrait of a cat wearing a Victorian-era costume.",link:""},{type:"Travel",color:A.Travel||S,description:"Find beginner-friendly hiking trails near Los Angeles.",link:""},{type:"Automation",color:A.Automation||S,description:"Generate a daily writing prompt.",link:"/automations?subject=Daily Writing Prompt&query=Create an engaging writing prompt suitable for short story or journal writing.&crontime=0 9 * * *"},{type:"Paint",color:A.Paint||S,description:"Create a surrealist landscape inspired by Salvador Dali.",link:""},{type:"Learning",color:A.Learning||S,description:"Research the benefits and drawbacks of electric vehicles.",link:""},{type:"Automation",color:A.Automation||S,description:"Send weekly language learning tips for Spanish.",link:"/automations?subject=Spanish Learning Tips&query=Provide a useful Spanish language learning tip, including vocabulary, grammar, or cultural insight.&crontime=0 19 * * 2"},{type:"Paint",color:A.Paint||S,description:"Paint a scene from a fairy tale in the style of Studio Ghibli.",link:""},{type:"Pop Culture",color:"yellow",description:"Find the best-rated science fiction books of the last decade.",link:""},{type:"Paint",color:A.Paint||S,description:"Paint a still life of exotic fruits in a neon color palette.",link:""},{type:"Travel",color:A.Travel||S,description:"Research the most eco-friendly cities in Europe.",link:""},{type:"Automation",color:A.Automation||S,description:"Send daily reminders for habit tracking.",link:"/automations?subject=Habit Tracker&query=Generate a daily reminder to track habits, including a motivational message.&crontime=0 20 * * *"},{type:"Paint",color:A.Paint||S,description:"Create a digital painting of a cyberpunk street market.",link:""},{type:"Learning",color:A.Learning||S,description:"Summarize the biography of this figure: https://en.wikipedia.org/wiki/Jean_Baptiste_Point_du_Sable",link:""},{type:"Language",color:"blue",description:"Send daily Spanish phrases used in Latin America.",link:"/automations?subject=Daily Latin American Spanish&query=Provide a common Spanish phrase or slang term used in Latin America, its meaning, and an example of usage. Include which countries it's most common in.&crontime=0 8 * * *"},{type:"Paint",color:A.Paint||S,description:"Create a vibrant painting inspired by Frida Kahlo's style.",link:""},{type:"Food",color:A.Food||S,description:"Find the best empanada recipe from Colombia.",link:""},{type:"Automation",color:A.Automation||S,description:"Weekly update on the Brazilian startup ecosystems.",link:"/automations?subject=LatAm Startup News&query=Provide a summary of the most significant developments in Latin American startup ecosystems this week. Include notable funding rounds, expansions, or policy changes.&crontime=0 18 * * 5"},{type:"Paint",color:A.Paint||S,description:"Paint a colorful scene of a traditional Day of the Dead celebration in Mexico.",link:""},{type:"Language",color:A.Language||S,description:"Daily Swahili phrase with English translation.",link:"/automations?subject=Daily Swahili Lesson&query=Provide a common Swahili phrase or proverb, its English translation, and a brief explanation of its cultural significance in East Africa.&crontime=0 7 * * *"},{type:"Paint",color:A.Paint||S,description:"Create a digital painting of the Serengeti during wildebeest migration.",link:""},{type:"Learning",color:A.Learning||S,description:"Research the top M-Pesa alternatives in East Africa.",link:""},{type:"Automation",color:A.Automation||S,description:"Weekly update on East African tech startups and innovations.",link:"/automations?subject=East African Tech News&query=Summarize the most significant developments in East African tech startups and innovations this week. Include notable funding rounds, new product launches, or policy changes affecting the tech ecosystem.&crontime=0 18 * * 5"},{type:"Paint",color:A.Paint||S,description:"Paint a colorful scene inspired by Maasai traditional clothing and jewelry.",link:""},{type:"Automation",color:A.Automation||S,description:"Weekly summary of EU policy changes and their impact.",link:"/automations?subject=EU Policy Update&query=Summarize the most significant EU policy changes or proposals from this week. Explain their potential impact on European citizens and businesses.&crontime=0 17 * * 5"},{type:"Paint",color:A.Paint||S,description:"Paint a digital landscape of the Northern Lights over the Norwegian fjords.",link:""},{type:"Automation",color:A.Automation||S,description:"Daily East Asian proverb with explanation.",link:"/automations?subject=East Asian Wisdom&query=Provide a proverb from an East Asian language (rotating through Chinese, Japanese, Korean, etc.), its English translation, and a brief explanation of its cultural significance and practical application.&crontime=0 7 * * *"},{type:"Paint",color:A.Paint||S,description:"Create a digital painting in the style of traditional Chinese ink wash landscape.",link:""},{type:"Pop Culture",color:"yellow",description:"Research the latest trends in K-pop and its global influence.",link:""},{type:"Automation",color:A.Automation||S,description:"Weekly summary of technological innovations from East Asian tech giants.",link:"/automations?subject=East Asian Tech Update&query=Summarize the most significant technological innovations or product launches from major East Asian tech companies (e.g., Samsung, Sony, Alibaba, Tencent) this week. Explain their potential impact on global markets.&crontime=0 18 * * 5"},{type:"Paint",color:A.Paint||S,description:"Paint a vibrant scene of a Japanese cherry blossom festival.",link:""},{type:"Automation",color:A.Automation||S,description:"Daily South Asian recipe with cultural significance.",link:"/automations?subject=South Asian Culinary Journey&query=Provide a traditional South Asian recipe (rotating through Indian, Pakistani, Bangladeshi, Sri Lankan, etc. cuisines), including ingredients, brief instructions, and its cultural significance or origin story.&crontime=0 10 * * *"},{type:"Pop Culture",color:A["Pop Culture"]||S,description:"Research the impact of Bollywood on global cinema and fashion.",link:""},{type:"Automation",color:A.Automation||S,description:"Weekly update on South Asian startup ecosystems and innovations.",link:"/automations?subject=South Asian Startup Pulse&query=Summarize the most significant developments in South Asian startup ecosystems this week. Include notable funding rounds, innovative solutions to local challenges, and any policy changes affecting the tech landscape in countries like India, Bangladesh, Pakistan, and Sri Lanka.&crontime=0 18 * * 5"},{type:"Interviewing",color:A.Interviewing||S,description:"Create interview prep questions for a consulting job.",link:""},{type:"Interviewing",color:A.Interviewing||S,description:"What information should I include in a CV for a PhD application?",link:""},{type:"Home",color:A.Home||S,description:"Recommend plants that can grow well indoors.",link:""},{type:"Health",color:A.Health||S,description:"Suggest healthy meal prep ideas for a busy work week.",link:""},{type:"Learning",color:A.Learning||S,description:"List effective time management techniques for students.",link:""},{type:"Learning",color:A.Learning||S,description:"Provide tips for improving public speaking skills.",link:""},{type:"Learning",color:A.Learning||S,description:"Recommend books for learning about personal finance.",link:""},{type:"Home",color:A.Home||S,description:"Suggest ways to reduce plastic waste in daily life.",link:""},{type:"Health",color:A.Health||S,description:"Create a beginner's guide to meditation and mindfulness.",link:""},{type:"Health",color:A.Health||S,description:"Give me some tips for improving my sleep quality.",link:""},{type:"Health",color:A.Health||S,description:"What are weight loss strategies supported by clinical studies?",link:""},{type:"Fun",color:A.Fun||S,description:"List creative date ideas for couples on a budget.",link:""},{type:"Code",color:A.Interviewing||S,description:"Provide tips for writing an effective resume.",link:""},{type:"Code",color:A.Code||S,description:"Explain the concept of recursion with a simple coding example.",link:""},{type:"Code",color:A.Code||S,description:"Provide a coding challenge to reverse a string without using built-in functions.",link:""},{type:"Code",color:A.Code||S,description:"Explain the difference between 'let', 'const', and 'var' in JavaScript.",link:""},{type:"Code",color:A.Code||S,description:"Create a coding exercise to implement a basic sorting algorithm (e.g., bubble sort).",link:""},{type:"Code",color:A.Code||S,description:"Explain object-oriented programming principles with a simple class example.",link:""},{type:"Code",color:A.Code||S,description:"Provide a coding challenge to find the longest palindromic substring in a given string.",link:""},{type:"Code",color:A.Code||S,description:"Explain the concept of asynchronous programming with a JavaScript Promise example.",link:""},{type:"Code",color:A.Code||S,description:"Create a coding exercise to implement a basic data structure (e.g., linked list or stack).",link:""},{type:"Code",color:A.Code||S,description:"Explain the time and space complexity of common algorithms (e.g., binary search).",link:""},{type:"Code",color:A.Code||S,description:"Provide a coding challenge to implement a simple REST API using Node.js and Express.",link:""},{type:"Code",color:A.Code||S,description:"Compare popular web frameworks in Rust and Python",link:""},{type:"Travel",color:A.Travel||S,description:"Craft an off-beat itinerary for a weekend in Lagos, Nigeria.",link:""},{type:"Language",color:A.Language||S,description:"Teach me about declensions in Latin.",link:""},{type:"Learning",color:A.Learning||S,description:"Break down the concept of photosynthesis for a middle school student.",link:""},{type:"Learning",color:A.Learning||S,description:"Use the Socratic method to explore the causes of World War I.",link:""},{type:"Learning",color:A.Learning||S,description:"Explain the water cycle using an analogy suitable for elementary students.",link:""},{type:"Learning",color:A.Learning||S,description:"Guide a high school student through solving a quadratic equation step-by-step.",link:""},{type:"Learning",color:A.Learning||S,description:"Create a series of questions to help a student discover the principles of basic economics.",link:""},{type:"Learning",color:A.Learning||S,description:"Develop a hands-on experiment to demonstrate the concept of density to middle schoolers.",link:""},{type:"Learning",color:A.Learning||S,description:"Use guided discovery to help a student understand the structure of DNA.",link:""},{type:"Learning",color:A.Learning||S,description:"Create a personalized learning plan for a student struggling with grammar concepts.",link:""},{type:"Learning",color:A.Learning||S,description:"Design a series of questions to encourage critical thinking about climate change.",link:""},{type:"Learning",color:A.Learning||S,description:"Develop a step-by-step guide for conducting a basic science experiment on plant growth.",link:""},{type:"Health",color:A.Health||S,description:"Provide a detailed explanation about how to manage type 2 diabetes.",link:""},{type:"Health",color:A.Health||S,description:"Explain the effects a stroke might have on the body.",link:""},{type:"Health",color:A.Health||S,description:"Describe the recommended steps for preventing heart disease.",link:""},{type:"Health",color:A.Health||S,description:"Explain the differences between various types of headaches and their treatments.",link:""},{type:"Health",color:A.Health||S,description:"Provide an overview of the most effective stress management techniques.",link:""},{type:"Health",color:A.Health||S,description:"Explain the importance of vaccination and how vaccines work.",link:""},{type:"Health",color:A.Health||S,description:"Describe the symptoms and treatment options for depression.",link:""},{type:"Health",color:A.Health||S,description:"Explain the process of digestion and common digestive disorders.",link:""},{type:"Health",color:A.Health||S,description:"Provide an overview of the different types of cancer screenings and their importance.",link:""},{type:"Health",color:A.Health||S,description:"Explain the effects of sleep deprivation on physical and mental health.",link:""},{type:"Fun",color:A.Fun||S,description:"Create a list of fun activities for a family game night.",link:""},{type:"Finance",color:A.Finance||S,description:"Explain the concept of compound interest and its importance in long-term savings.",link:""},{type:"Finance",color:A.Finance||S,description:"Provide an overview of different types of retirement accounts (e.g., 401(k), IRA, Roth IRA).",link:""},{type:"Finance",color:A.Finance||S,description:"Describe strategies for creating and sticking to a personal budget.",link:""},{type:"Finance",color:A.Finance||S,description:"Explain the basics of stock market investing for beginners.",link:""},{type:"Finance",color:A.Finance||S,description:"Outline the pros and cons of renting vs. buying a home.",link:""},{type:"Finance",color:A.Finance||S,description:"Describe different methods for paying off debt, such as the snowball and avalanche methods.",link:""},{type:"Finance",color:A.Finance||S,description:"Explain the importance of an emergency fund and how to build one.",link:""},{type:"Finance",color:A.Finance||S,description:"Provide an overview of different types of insurance and their importance in financial planning.",link:""},{type:"Finance",color:A.Finance||S,description:"Explain the concept of diversification in investment portfolios.",link:""},{type:"Finance",color:A.Finance||S,description:"Describe strategies for minimizing tax liability legally.",link:""}];function H(e){var t,n;let i=(0,L.Zc)(e.color),o="".concat(C().card," ").concat(i," md:w-full md:h-fit sm:w-full h-fit md:w-[200px] md:h-[180px] cursor-pointer md:p-2"),r="".concat(C().text," dark:text-white"),s=(0,a.jsx)(x.Zb,{className:o,children:(0,a.jsx)("div",{className:"flex w-full",children:(0,a.jsxs)(x.aY,{className:"m-0 p-2 w-full",children:[(t=e.title,n=e.color.toLowerCase(),"Automation"===t?(0,j.TI)("Robot",n,"w-6","h-6"):"Paint"===t?(0,j.TI)("Palette",n,"w-6","h-6"):"Pop Culture"===t?(0,j.TI)("Confetti",n,"w-6","h-6"):"Travel"===t?(0,j.TI)("Jeep",n,"w-6","h-6"):"Learning"===t?(0,j.TI)("Book",n,"w-6","h-6"):"Health"===t?(0,j.TI)("Asclepius",n,"w-6","h-6"):"Fun"===t?(0,j.TI)("Island",n,"w-6","h-6"):"Home"===t?(0,j.TI)("House",n,"w-6","h-6"):"Language"===t?(0,j.TI)("Translate",n,"w-6","h-6"):"Code"===t?(0,j.TI)("Code",n,"w-6","h-6"):"Food"===t?(0,j.TI)("BowlFood",n,"w-6","h-6"):"Interviewing"===t?(0,j.TI)("Lectern",n,"w-6","h-6"):"Finance"===t?(0,j.TI)("Wallet",n,"w-6","h-6"):(0,j.TI)("Lightbulb",n,"w-6","h-6")),(0,a.jsx)(x.SZ,{className:"".concat(r," sm:line-clamp-2 md:line-clamp-4 pt-1 break-words whitespace-pre-wrap max-w-full"),children:e.body})]})})});return e.link?(0,a.jsx)("a",{href:e.link,className:"no-underline",children:s}):s}var I=n(48861),F=n(58485),_=n(38423),N=n(66820),T=n(79306),M=n(9557),D=n(69591),W=n(16463),B=n(94880),O=n(81970),q=n(19573);function R(e){var t,n;let[i,o]=(0,l.useState)(""),[r,d]=(0,l.useState)([]),[p,u]=(0,l.useState)(!1),[h,g]=(0,l.useState)(""),[m,f]=(0,l.useState)([]),[y,k]=(0,l.useState)(null),b=(0,D.Nr)(y,500),[v,P]=(0,l.useState)(!1),[C,A]=(0,l.useState)("khoj"),[S,I]=(0,l.useState)([]),[F,R]=(0,l.useState)([]),U=(0,l.useRef)(null),[Z,z]=(0,l.useState)(!1),V=(0,W.useRouter)(),J=(0,W.useSearchParams)().get("q");(0,l.useEffect)(()=>{J&&o(decodeURIComponent(J))},[J]),(0,l.useEffect)(()=>{b&&P(!0)},[b]);let G=e.onConversationIdChange,{data:K,error:Y}=(0,c.ZP)("agents",()=>window.fetch("/api/agents").then(e=>e.json()).catch(e=>console.log(e)),{revalidateOnFocus:!1}),Q=e=>{V.push("/agents?agent=".concat(e))};function X(){f((function(e){for(let t=e.length-1;t>0;t--){let n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}return e})(E).slice(0,3))}return(0,l.useEffect)(()=>{var t,n;if(e.isLoadingUserConfig)return;let i=new Date,o=i.getDay(),a=i.getHours()>=17||4>i.getHours()?"evening":i.getHours()>=12?"afternoon":"morning",r=(null===(t=e.userConfig)||void 0===t?void 0:t.given_name)?", ".concat(null===(n=e.userConfig)||void 0===n?void 0:n.given_name):"",s=["What would you like to get done".concat(r,"?"),"Hey".concat(r,"! How can I help?"),"Good ".concat(a).concat(r,"! What's on your mind?"),"Ready to breeze through ".concat(["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][o],"?"),"Let's navigate your ".concat(["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][o]," workload")];g(s[Math.floor(Math.random()*s.length)])},[e.isLoadingUserConfig,e.userConfig]),(0,l.useEffect)(()=>{e.chatOptionsData&&X()},[e.chatOptionsData]),(0,l.useEffect)(()=>{let e=(K||[]).filter(e=>null!=e);R(e),A(e.length>1?e[0].slug:"khoj"),I(e.map(e=>(0,j.TI)(e.icon,e.color)))},[K,e.isMobileWidth]),(0,l.useEffect)(()=>{(async()=>{if(i&&!p){u(!0);try{let e=await (0,M.A0)(C||"khoj");null==G||G(e),localStorage.setItem("message",i),r.length>0&&localStorage.setItem("images",JSON.stringify(r)),window.location.href="/chat?conversationId=".concat(e)}catch(e){console.error("Error creating new conversation:",e),u(!1)}o(""),d([])}})(),(i||r.length>0)&&u(!0)},[C,i,p,G]),(0,l.useEffect)(()=>{let e=document.querySelector("[data-radix-scroll-area-viewport]"),t=()=>{k(null),P(!1)};return null==e||e.addEventListener("scroll",t),()=>null==e?void 0:e.removeEventListener("scroll",t)},[]),(0,a.jsxs)("div",{className:"".concat(s().homeGreetings," w-full md:w-auto"),children:[Z&&(0,a.jsx)(N.Z,{onOpenChange:z,loginRedirectMessage:"Login to your second brain"}),(0,a.jsxs)("div",{className:"w-full text-center justify-end content-end",children:[(0,a.jsx)("div",{className:"items-center",children:(0,a.jsx)("h1",{className:"text-2xl md:text-3xl text-center w-fit pb-6 px-4 mx-auto",children:h})}),!e.isMobileWidth&&(0,a.jsxs)(B.x,{className:"w-full max-w-[600px] mx-auto",children:[(0,a.jsx)("div",{className:"flex pb-2 gap-2 items-center justify-center",children:F.map((t,n)=>(0,a.jsxs)(q.J2,{open:v&&b===t.slug,onOpenChange:e=>{e||(k(null),P(!1))},children:[(0,a.jsx)(q.xo,{asChild:!0,children:(0,a.jsx)(x.Zb,{className:"".concat(C===t.slug?(0,L.Iu)(t.color):"border-stone-100 dark:border-neutral-700 text-muted-foreground","\n hover:cursor-pointer rounded-lg px-2 py-2"),onDoubleClick:()=>Q(t.slug),onClick:()=>{var e;A(t.slug),null===(e=U.current)||void 0===e||e.focus(),k(null),P(!1)},onMouseEnter:()=>k(t.slug),onMouseLeave:()=>{k(null),P(!1)},children:(0,a.jsxs)(x.ll,{className:"text-center text-md font-medium flex justify-center items-center whitespace-nowrap",children:[S[n]," ",t.name]})})}),(0,a.jsx)(q.yk,{className:"w-80 p-0 border-none bg-transparent shadow-none",onMouseLeave:()=>{k(null),P(!1)},children:(0,a.jsx)(O.EY,{data:t,userProfile:null,isMobileWidth:e.isMobileWidth||!1,showChatButton:!1,editCard:!1,filesOptions:[],selectedChatModelOption:"",agentSlug:"",isSubscribed:(0,T.T8)(e.userConfig),setAgentChangeTriggered:()=>{},modelOptions:[],inputToolOptions:{},outputModeOptions:{}})})]},"".concat(n,"-").concat(t.slug)))}),(0,a.jsx)(B.B,{orientation:"horizontal"})]})]}),(0,a.jsxs)("div",{className:"mx-auto ".concat(e.isMobileWidth?"w-full":"w-fit max-w-screen-md"),children:[!e.isMobileWidth&&(0,a.jsx)("div",{className:"w-full ".concat(s().inputBox," shadow-lg bg-background align-middle items-center justify-center px-3 py-1 dark:bg-neutral-700 border-stone-100 dark:border-none dark:shadow-none rounded-2xl"),children:(0,a.jsx)(_.a,{isLoggedIn:e.isLoggedIn,sendMessage:e=>o(e),sendImage:e=>d(t=>[...t,e]),sendDisabled:p,chatOptionsData:e.chatOptionsData,conversationId:null,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,agentColor:null===(t=F.find(e=>e.slug===C))||void 0===t?void 0:t.color,ref:U})}),(0,a.jsx)("div",{className:"".concat(s().suggestions," w-full ").concat(e.isMobileWidth?"grid":"flex flex-row"," justify-center items-center"),children:m.map((t,n)=>(0,a.jsx)("div",{onClick:n=>{e.isLoggedIn?function(e,t,n){if(!e){let e="";n=n.charAt(0).toLowerCase()+n.slice(1),e="Online Search"===t?"/online "+n:"Paint"===t?"/image "+n:n;let i=document.getElementById("message");i&&(i.value=e,o(e))}}(t.link,t.type,t.description):(n.preventDefault(),n.stopPropagation(),z(!0))},children:(0,a.jsx)(H,{title:t.type,body:t.description,link:t.link,color:t.color},t.type+Math.random())},"".concat(t.type," ").concat(t.description)))}),(0,a.jsx)("div",{className:"flex items-center justify-center margin-auto",children:(0,a.jsxs)("button",{onClick:function(){X()},className:"m-2 p-1.5 rounded-lg dark:hover:bg-[var(--background-color)] hover:bg-stone-100 border border-stone-100 text-sm text-stone-500 dark:text-stone-300 dark:border-neutral-700",children:["More Ideas ",(0,a.jsx)(w,{className:"h-4 w-4 inline"})]})})]}),e.isMobileWidth&&(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)("div",{className:"".concat(s().inputBox," pt-1 shadow-[0_-20px_25px_-5px_rgba(0,0,0,0.1)] dark:bg-neutral-700 bg-background align-middle items-center justify-center pb-3 mx-1 rounded-t-2xl rounded-b-none"),children:[(0,a.jsxs)(B.x,{className:"w-full max-w-[85vw]",children:[(0,a.jsx)("div",{className:"flex gap-2 items-center justify-left pt-1 pb-2 px-12",children:S.map((e,t)=>(0,a.jsx)(x.Zb,{className:"".concat(C===F[t].slug?(0,L.Iu)(F[t].color):"border-muted text-muted-foreground"," hover:cursor-pointer"),children:(0,a.jsxs)(x.ll,{className:"text-center text-xs font-medium flex justify-center items-center whitespace-nowrap px-1.5 py-1",onDoubleClick:()=>Q(F[t].slug),onClick:()=>{var e;A(F[t].slug),null===(e=U.current)||void 0===e||e.focus()},children:[e," ",F[t].name]})},"".concat(t,"-").concat(F[t].slug)))}),(0,a.jsx)(B.B,{orientation:"horizontal"})]}),(0,a.jsx)(_.a,{isLoggedIn:e.isLoggedIn,sendMessage:e=>o(e),sendImage:e=>d(t=>[...t,e]),sendDisabled:p,chatOptionsData:e.chatOptionsData,conversationId:null,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,agentColor:null===(n=F.find(e=>e.slug===C))||void 0===n?void 0:n.color,ref:U})]})})]})}function U(){let[e,t]=(0,l.useState)(null),[n,i]=(0,l.useState)(!0),[o,r]=(0,l.useState)(null),[c,d]=(0,l.useState)(null),p=(0,D.IC)(),{userConfig:u,isLoadingUserConfig:h}=(0,T.h2)(!0),[g,m]=(0,l.useState)(null),f=(0,T.GW)();return((0,l.useEffect)(()=>{m(u)},[u]),(0,l.useEffect)(()=>{c&&localStorage.setItem("uploadedFiles",JSON.stringify(c))},[c]),(0,l.useEffect)(()=>{fetch("/api/chat/options").then(e=>e.json()).then(e=>{i(!1),e&&t(e)}).catch(e=>{console.error(e)})},[]),n)?(0,a.jsx)(F.Z,{}):(0,a.jsxs)("div",{className:"".concat(s().main," ").concat(s().chatLayout),children:[(0,a.jsx)("title",{children:"Khoj AI - Your Second Brain"}),(0,a.jsx)("div",{className:"".concat(s().sidePanel),children:(0,a.jsx)(I.ZP,{conversationId:o,uploadedFiles:[],isMobileWidth:p})}),(0,a.jsx)("div",{className:"".concat(s().chatBox),children:(0,a.jsx)("div",{className:"".concat(s().chatBoxBody),children:(0,a.jsx)(R,{isLoggedIn:null!==f,chatOptionsData:e,setUploadedFiles:d,isMobileWidth:p,onConversationIdChange:e=>{r(e)},userConfig:g,isLoadingUserConfig:h})})})]})}},16463:function(e,t,n){"use strict";var i=n(71169);n.o(i,"useRouter")&&n.d(t,{useRouter:function(){return i.useRouter}}),n.o(i,"useSearchParams")&&n.d(t,{useSearchParams:function(){return i.useSearchParams}})},58877:function(){},31806:function(e){e.exports={card:"suggestions_card__fbiZo",title:"suggestions_title__vNozc",text:"suggestions_text__J_IfY"}},68518:function(e){e.exports={main:"page_main__nw1Wk",suggestions:"page_suggestions__Y8EqU",inputBox:"page_inputBox__LrcZ4",chatBodyFull:"page_chatBodyFull__Qu2T2",chatBody:"page_chatBody__IirQQ",chatLayout:"page_chatLayout__bJUjP",chatBox:"page_chatBox__gsR6V",titleBar:"page_titleBar__3btUI",chatBoxBody:"page_chatBoxBody__xORKr",homeGreetings:"page_homeGreetings__VjQhh",sidePanel:"page_sidePanel__mxpxa"}}},function(e){e.O(0,[404,4836,9448,9001,3062,3124,3803,5512,2261,4602,1603,9417,8423,1970,2971,7023,1744],function(){return e(e.s=1507)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1931],{1507:function(e,t,n){Promise.resolve().then(n.bind(n,4515))},4515:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return U}});var i,o,a=n(57437);n(58877);var r=n(68518),s=n.n(r);n(7395);var l=n(2265),c=n(29039),d=n(52195);let p=new Map([["bold",l.createElement(l.Fragment,null,l.createElement("path",{d:"M228,128a100,100,0,0,1-98.66,100H128a99.39,99.39,0,0,1-68.62-27.29,12,12,0,0,1,16.48-17.45,76,76,0,1,0-1.57-109c-.13.13-.25.25-.39.37L54.89,92H72a12,12,0,0,1,0,24H24a12,12,0,0,1-12-12V56a12,12,0,0,1,24,0V76.72L57.48,57.06A100,100,0,0,1,228,128Z"}))],["duotone",l.createElement(l.Fragment,null,l.createElement("path",{d:"M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z",opacity:"0.2"}),l.createElement("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"}))],["fill",l.createElement(l.Fragment,null,l.createElement("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L60.63,81.29l17,17A8,8,0,0,1,72,112H24a8,8,0,0,1-8-8V56A8,8,0,0,1,29.66,50.3L49.31,70,60.25,60A96,96,0,0,1,224,128Z"}))],["light",l.createElement(l.Fragment,null,l.createElement("path",{d:"M222,128a94,94,0,0,1-92.74,94H128a93.43,93.43,0,0,1-64.5-25.65,6,6,0,1,1,8.24-8.72A82,82,0,1,0,70,70l-.19.19L39.44,98H72a6,6,0,0,1,0,12H24a6,6,0,0,1-6-6V56a6,6,0,0,1,12,0V90.34L61.63,61.4A94,94,0,0,1,222,128Z"}))],["regular",l.createElement(l.Fragment,null,l.createElement("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"}))],["thin",l.createElement(l.Fragment,null,l.createElement("path",{d:"M220,128a92,92,0,0,1-90.77,92H128a91.47,91.47,0,0,1-63.13-25.1,4,4,0,1,1,5.5-5.82A84,84,0,1,0,68.6,68.57l-.13.12L34.3,100H72a4,4,0,0,1,0,8H24a4,4,0,0,1-4-4V56a4,4,0,0,1,8,0V94.89l35-32A92,92,0,0,1,220,128Z"}))]]);var u=Object.defineProperty,h=Object.defineProperties,g=Object.getOwnPropertyDescriptors,m=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable,k=(e,t,n)=>t in e?u(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=(e,t)=>{for(var n in t||(t={}))f.call(t,n)&&k(e,n,t[n]);if(m)for(var n of m(t))y.call(t,n)&&k(e,n,t[n]);return e},v=(e,t)=>h(e,g(t));let w=(0,l.forwardRef)((e,t)=>l.createElement(d.Z,v(b({ref:t},e),{weights:p})));w.displayName="ArrowCounterClockwise";var x=n(36013),P=n(31806),C=n.n(P),L=n(58575),j=n(89417);(i=o||(o={})).Automation="Automation",i.Paint="Paint",i.Travel="Travel",i.Health="Health",i.Learning="Learning",i.Language="Language",i.PopCulture="Pop Culture",i.Food="Food",i.Interviewing="Interviewing",i.Home="Home",i.Fun="Fun",i.Code="Code",i.Finance="Finance";let A={};A.Automation="blue",A.Paint="indigo",A.Travel="yellow",A.Health="teal",A.Learning="purple",A.Language="blue",A["Pop Culture"]="red",A.Food="yellow",A.Interviewing="orange",A.Home="green",A.Fun="fuchsia",A.Code="purple",A.Finance="green";let S="orange",E=[{type:"Automation",color:A.Automation||S,description:"Send me a summary of HackerNews every morning.",link:"/automations?subject=Summarizing%20Top%20Headlines%20from%20HackerNews&query=Summarize%20the%20top%20headlines%20on%20HackerNews&crontime=00%207%20*%20*%20*"},{type:"Automation",color:A.Automation||S,description:"Compose a bedtime story that a five-year-old might enjoy.",link:"/automations?subject=Daily%20Bedtime%20Story&query=Compose%20a%20bedtime%20story%20that%20a%20five-year-old%20might%20enjoy.%20It%20should%20not%20exceed%20five%20paragraphs.%20Appeal%20to%20the%20imagination%2C%20but%20weave%20in%20learnings.&crontime=0%2021%20*%20*%20*"},{type:"Paint",color:A.Paint||S,description:"Paint a picture of a sunset but it's made of stained glass tiles",link:""},{type:"Travel",color:A.Travel||S,description:"Search for the best attractions in Austria Hungary",link:""},{type:"Health",color:A.Health||S,description:"Generate a weekly meal plan with recipes.",link:"/automations?subject=Weekly Meal Plan&query=Create a weekly meal plan with 7 dinner recipes, including ingredients and brief instructions. Focus on balanced, healthy meals.&crontime=0 18 * * 0"},{type:"Paint",color:A.Paint||S,description:"Paint a futuristic cityscape with flying cars.",link:""},{type:"Travel",color:A.Travel||S,description:"Find the top-rated coffee shops in Seattle.",link:""},{type:"Automation",color:A.Automation||S,description:"Send daily motivational quotes.",link:"/automations?subject=Daily Motivation&query=Provide an inspiring quote for the day along with a brief explanation of its meaning.&crontime=0 7 * * *"},{type:"Paint",color:A.Paint||S,description:"Create an abstract representation of jazz music.",link:""},{type:"Learning",color:A.Learning||S,description:"Research the history of the Eiffel Tower.",link:""},{type:"Automation",color:A.Automation||S,description:"Compile a weekly news summary.",link:"/automations?subject=Weekly News Digest&query=Summarize the top 5 most important news stories of the week across various categories.&crontime=0 18 * * 5"},{type:"Paint",color:A.Paint||S,description:"Paint a portrait of a cat wearing a Victorian-era costume.",link:""},{type:"Travel",color:A.Travel||S,description:"Find beginner-friendly hiking trails near Los Angeles.",link:""},{type:"Automation",color:A.Automation||S,description:"Generate a daily writing prompt.",link:"/automations?subject=Daily Writing Prompt&query=Create an engaging writing prompt suitable for short story or journal writing.&crontime=0 9 * * *"},{type:"Paint",color:A.Paint||S,description:"Create a surrealist landscape inspired by Salvador Dali.",link:""},{type:"Learning",color:A.Learning||S,description:"Research the benefits and drawbacks of electric vehicles.",link:""},{type:"Automation",color:A.Automation||S,description:"Send weekly language learning tips for Spanish.",link:"/automations?subject=Spanish Learning Tips&query=Provide a useful Spanish language learning tip, including vocabulary, grammar, or cultural insight.&crontime=0 19 * * 2"},{type:"Paint",color:A.Paint||S,description:"Paint a scene from a fairy tale in the style of Studio Ghibli.",link:""},{type:"Pop Culture",color:"yellow",description:"Find the best-rated science fiction books of the last decade.",link:""},{type:"Paint",color:A.Paint||S,description:"Paint a still life of exotic fruits in a neon color palette.",link:""},{type:"Travel",color:A.Travel||S,description:"Research the most eco-friendly cities in Europe.",link:""},{type:"Automation",color:A.Automation||S,description:"Send daily reminders for habit tracking.",link:"/automations?subject=Habit Tracker&query=Generate a daily reminder to track habits, including a motivational message.&crontime=0 20 * * *"},{type:"Paint",color:A.Paint||S,description:"Create a digital painting of a cyberpunk street market.",link:""},{type:"Learning",color:A.Learning||S,description:"Summarize the biography of this figure: https://en.wikipedia.org/wiki/Jean_Baptiste_Point_du_Sable",link:""},{type:"Language",color:"blue",description:"Send daily Spanish phrases used in Latin America.",link:"/automations?subject=Daily Latin American Spanish&query=Provide a common Spanish phrase or slang term used in Latin America, its meaning, and an example of usage. Include which countries it's most common in.&crontime=0 8 * * *"},{type:"Paint",color:A.Paint||S,description:"Create a vibrant painting inspired by Frida Kahlo's style.",link:""},{type:"Food",color:A.Food||S,description:"Find the best empanada recipe from Colombia.",link:""},{type:"Automation",color:A.Automation||S,description:"Weekly update on the Brazilian startup ecosystems.",link:"/automations?subject=LatAm Startup News&query=Provide a summary of the most significant developments in Latin American startup ecosystems this week. Include notable funding rounds, expansions, or policy changes.&crontime=0 18 * * 5"},{type:"Paint",color:A.Paint||S,description:"Paint a colorful scene of a traditional Day of the Dead celebration in Mexico.",link:""},{type:"Language",color:A.Language||S,description:"Daily Swahili phrase with English translation.",link:"/automations?subject=Daily Swahili Lesson&query=Provide a common Swahili phrase or proverb, its English translation, and a brief explanation of its cultural significance in East Africa.&crontime=0 7 * * *"},{type:"Paint",color:A.Paint||S,description:"Create a digital painting of the Serengeti during wildebeest migration.",link:""},{type:"Learning",color:A.Learning||S,description:"Research the top M-Pesa alternatives in East Africa.",link:""},{type:"Automation",color:A.Automation||S,description:"Weekly update on East African tech startups and innovations.",link:"/automations?subject=East African Tech News&query=Summarize the most significant developments in East African tech startups and innovations this week. Include notable funding rounds, new product launches, or policy changes affecting the tech ecosystem.&crontime=0 18 * * 5"},{type:"Paint",color:A.Paint||S,description:"Paint a colorful scene inspired by Maasai traditional clothing and jewelry.",link:""},{type:"Automation",color:A.Automation||S,description:"Weekly summary of EU policy changes and their impact.",link:"/automations?subject=EU Policy Update&query=Summarize the most significant EU policy changes or proposals from this week. Explain their potential impact on European citizens and businesses.&crontime=0 17 * * 5"},{type:"Paint",color:A.Paint||S,description:"Paint a digital landscape of the Northern Lights over the Norwegian fjords.",link:""},{type:"Automation",color:A.Automation||S,description:"Daily East Asian proverb with explanation.",link:"/automations?subject=East Asian Wisdom&query=Provide a proverb from an East Asian language (rotating through Chinese, Japanese, Korean, etc.), its English translation, and a brief explanation of its cultural significance and practical application.&crontime=0 7 * * *"},{type:"Paint",color:A.Paint||S,description:"Create a digital painting in the style of traditional Chinese ink wash landscape.",link:""},{type:"Pop Culture",color:"yellow",description:"Research the latest trends in K-pop and its global influence.",link:""},{type:"Automation",color:A.Automation||S,description:"Weekly summary of technological innovations from East Asian tech giants.",link:"/automations?subject=East Asian Tech Update&query=Summarize the most significant technological innovations or product launches from major East Asian tech companies (e.g., Samsung, Sony, Alibaba, Tencent) this week. Explain their potential impact on global markets.&crontime=0 18 * * 5"},{type:"Paint",color:A.Paint||S,description:"Paint a vibrant scene of a Japanese cherry blossom festival.",link:""},{type:"Automation",color:A.Automation||S,description:"Daily South Asian recipe with cultural significance.",link:"/automations?subject=South Asian Culinary Journey&query=Provide a traditional South Asian recipe (rotating through Indian, Pakistani, Bangladeshi, Sri Lankan, etc. cuisines), including ingredients, brief instructions, and its cultural significance or origin story.&crontime=0 10 * * *"},{type:"Pop Culture",color:A["Pop Culture"]||S,description:"Research the impact of Bollywood on global cinema and fashion.",link:""},{type:"Automation",color:A.Automation||S,description:"Weekly update on South Asian startup ecosystems and innovations.",link:"/automations?subject=South Asian Startup Pulse&query=Summarize the most significant developments in South Asian startup ecosystems this week. Include notable funding rounds, innovative solutions to local challenges, and any policy changes affecting the tech landscape in countries like India, Bangladesh, Pakistan, and Sri Lanka.&crontime=0 18 * * 5"},{type:"Interviewing",color:A.Interviewing||S,description:"Create interview prep questions for a consulting job.",link:""},{type:"Interviewing",color:A.Interviewing||S,description:"What information should I include in a CV for a PhD application?",link:""},{type:"Home",color:A.Home||S,description:"Recommend plants that can grow well indoors.",link:""},{type:"Health",color:A.Health||S,description:"Suggest healthy meal prep ideas for a busy work week.",link:""},{type:"Learning",color:A.Learning||S,description:"List effective time management techniques for students.",link:""},{type:"Learning",color:A.Learning||S,description:"Provide tips for improving public speaking skills.",link:""},{type:"Learning",color:A.Learning||S,description:"Recommend books for learning about personal finance.",link:""},{type:"Home",color:A.Home||S,description:"Suggest ways to reduce plastic waste in daily life.",link:""},{type:"Health",color:A.Health||S,description:"Create a beginner's guide to meditation and mindfulness.",link:""},{type:"Health",color:A.Health||S,description:"Give me some tips for improving my sleep quality.",link:""},{type:"Health",color:A.Health||S,description:"What are weight loss strategies supported by clinical studies?",link:""},{type:"Fun",color:A.Fun||S,description:"List creative date ideas for couples on a budget.",link:""},{type:"Code",color:A.Interviewing||S,description:"Provide tips for writing an effective resume.",link:""},{type:"Code",color:A.Code||S,description:"Explain the concept of recursion with a simple coding example.",link:""},{type:"Code",color:A.Code||S,description:"Provide a coding challenge to reverse a string without using built-in functions.",link:""},{type:"Code",color:A.Code||S,description:"Explain the difference between 'let', 'const', and 'var' in JavaScript.",link:""},{type:"Code",color:A.Code||S,description:"Create a coding exercise to implement a basic sorting algorithm (e.g., bubble sort).",link:""},{type:"Code",color:A.Code||S,description:"Explain object-oriented programming principles with a simple class example.",link:""},{type:"Code",color:A.Code||S,description:"Provide a coding challenge to find the longest palindromic substring in a given string.",link:""},{type:"Code",color:A.Code||S,description:"Explain the concept of asynchronous programming with a JavaScript Promise example.",link:""},{type:"Code",color:A.Code||S,description:"Create a coding exercise to implement a basic data structure (e.g., linked list or stack).",link:""},{type:"Code",color:A.Code||S,description:"Explain the time and space complexity of common algorithms (e.g., binary search).",link:""},{type:"Code",color:A.Code||S,description:"Provide a coding challenge to implement a simple REST API using Node.js and Express.",link:""},{type:"Code",color:A.Code||S,description:"Compare popular web frameworks in Rust and Python",link:""},{type:"Travel",color:A.Travel||S,description:"Craft an off-beat itinerary for a weekend in Lagos, Nigeria.",link:""},{type:"Language",color:A.Language||S,description:"Teach me about declensions in Latin.",link:""},{type:"Learning",color:A.Learning||S,description:"Break down the concept of photosynthesis for a middle school student.",link:""},{type:"Learning",color:A.Learning||S,description:"Use the Socratic method to explore the causes of World War I.",link:""},{type:"Learning",color:A.Learning||S,description:"Explain the water cycle using an analogy suitable for elementary students.",link:""},{type:"Learning",color:A.Learning||S,description:"Guide a high school student through solving a quadratic equation step-by-step.",link:""},{type:"Learning",color:A.Learning||S,description:"Create a series of questions to help a student discover the principles of basic economics.",link:""},{type:"Learning",color:A.Learning||S,description:"Develop a hands-on experiment to demonstrate the concept of density to middle schoolers.",link:""},{type:"Learning",color:A.Learning||S,description:"Use guided discovery to help a student understand the structure of DNA.",link:""},{type:"Learning",color:A.Learning||S,description:"Create a personalized learning plan for a student struggling with grammar concepts.",link:""},{type:"Learning",color:A.Learning||S,description:"Design a series of questions to encourage critical thinking about climate change.",link:""},{type:"Learning",color:A.Learning||S,description:"Develop a step-by-step guide for conducting a basic science experiment on plant growth.",link:""},{type:"Health",color:A.Health||S,description:"Provide a detailed explanation about how to manage type 2 diabetes.",link:""},{type:"Health",color:A.Health||S,description:"Explain the effects a stroke might have on the body.",link:""},{type:"Health",color:A.Health||S,description:"Describe the recommended steps for preventing heart disease.",link:""},{type:"Health",color:A.Health||S,description:"Explain the differences between various types of headaches and their treatments.",link:""},{type:"Health",color:A.Health||S,description:"Provide an overview of the most effective stress management techniques.",link:""},{type:"Health",color:A.Health||S,description:"Explain the importance of vaccination and how vaccines work.",link:""},{type:"Health",color:A.Health||S,description:"Describe the symptoms and treatment options for depression.",link:""},{type:"Health",color:A.Health||S,description:"Explain the process of digestion and common digestive disorders.",link:""},{type:"Health",color:A.Health||S,description:"Provide an overview of the different types of cancer screenings and their importance.",link:""},{type:"Health",color:A.Health||S,description:"Explain the effects of sleep deprivation on physical and mental health.",link:""},{type:"Fun",color:A.Fun||S,description:"Create a list of fun activities for a family game night.",link:""},{type:"Finance",color:A.Finance||S,description:"Explain the concept of compound interest and its importance in long-term savings.",link:""},{type:"Finance",color:A.Finance||S,description:"Provide an overview of different types of retirement accounts (e.g., 401(k), IRA, Roth IRA).",link:""},{type:"Finance",color:A.Finance||S,description:"Describe strategies for creating and sticking to a personal budget.",link:""},{type:"Finance",color:A.Finance||S,description:"Explain the basics of stock market investing for beginners.",link:""},{type:"Finance",color:A.Finance||S,description:"Outline the pros and cons of renting vs. buying a home.",link:""},{type:"Finance",color:A.Finance||S,description:"Describe different methods for paying off debt, such as the snowball and avalanche methods.",link:""},{type:"Finance",color:A.Finance||S,description:"Explain the importance of an emergency fund and how to build one.",link:""},{type:"Finance",color:A.Finance||S,description:"Provide an overview of different types of insurance and their importance in financial planning.",link:""},{type:"Finance",color:A.Finance||S,description:"Explain the concept of diversification in investment portfolios.",link:""},{type:"Finance",color:A.Finance||S,description:"Describe strategies for minimizing tax liability legally.",link:""}];function H(e){var t,n;let i=(0,L.Zc)(e.color),o="".concat(C().card," ").concat(i," md:w-full md:h-fit sm:w-full h-fit md:w-[200px] md:h-[180px] cursor-pointer md:p-2"),r="".concat(C().text," dark:text-white"),s=(0,a.jsx)(x.Zb,{className:o,children:(0,a.jsx)("div",{className:"flex w-full",children:(0,a.jsxs)(x.aY,{className:"m-0 p-2 w-full",children:[(t=e.title,n=e.color.toLowerCase(),"Automation"===t?(0,j.TI)("Robot",n,"w-6","h-6"):"Paint"===t?(0,j.TI)("Palette",n,"w-6","h-6"):"Pop Culture"===t?(0,j.TI)("Confetti",n,"w-6","h-6"):"Travel"===t?(0,j.TI)("Jeep",n,"w-6","h-6"):"Learning"===t?(0,j.TI)("Book",n,"w-6","h-6"):"Health"===t?(0,j.TI)("Asclepius",n,"w-6","h-6"):"Fun"===t?(0,j.TI)("Island",n,"w-6","h-6"):"Home"===t?(0,j.TI)("House",n,"w-6","h-6"):"Language"===t?(0,j.TI)("Translate",n,"w-6","h-6"):"Code"===t?(0,j.TI)("Code",n,"w-6","h-6"):"Food"===t?(0,j.TI)("BowlFood",n,"w-6","h-6"):"Interviewing"===t?(0,j.TI)("Lectern",n,"w-6","h-6"):"Finance"===t?(0,j.TI)("Wallet",n,"w-6","h-6"):(0,j.TI)("Lightbulb",n,"w-6","h-6")),(0,a.jsx)(x.SZ,{className:"".concat(r," sm:line-clamp-2 md:line-clamp-4 pt-1 break-words whitespace-pre-wrap max-w-full"),children:e.body})]})})});return e.link?(0,a.jsx)("a",{href:e.link,className:"no-underline",children:s}):s}var I=n(48861),F=n(58485),_=n(38423),N=n(66820),T=n(79306),M=n(9557),D=n(69591),W=n(16463),B=n(94880),O=n(81970),q=n(19573);function R(e){var t,n;let[i,o]=(0,l.useState)(""),[r,d]=(0,l.useState)([]),[p,u]=(0,l.useState)(!1),[h,g]=(0,l.useState)(""),[m,f]=(0,l.useState)([]),[y,k]=(0,l.useState)(null),b=(0,D.Nr)(y,500),[v,P]=(0,l.useState)(!1),[C,A]=(0,l.useState)("khoj"),[S,I]=(0,l.useState)([]),[F,R]=(0,l.useState)([]),U=(0,l.useRef)(null),[Z,z]=(0,l.useState)(!1),V=(0,W.useRouter)(),J=(0,W.useSearchParams)().get("q");(0,l.useEffect)(()=>{J&&o(decodeURIComponent(J))},[J]),(0,l.useEffect)(()=>{b&&P(!0)},[b]);let G=e.onConversationIdChange,{data:K,error:Y}=(0,c.ZP)("agents",()=>window.fetch("/api/agents").then(e=>e.json()).catch(e=>console.log(e)),{revalidateOnFocus:!1}),Q=e=>{V.push("/agents?agent=".concat(e))};function X(){f((function(e){for(let t=e.length-1;t>0;t--){let n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}return e})(E).slice(0,3))}return(0,l.useEffect)(()=>{var t,n;if(e.isLoadingUserConfig)return;let i=new Date,o=i.getDay(),a=i.getHours()>=17||4>i.getHours()?"evening":i.getHours()>=12?"afternoon":"morning",r=(null===(t=e.userConfig)||void 0===t?void 0:t.given_name)?", ".concat(null===(n=e.userConfig)||void 0===n?void 0:n.given_name):"",s=["What would you like to get done".concat(r,"?"),"Hey".concat(r,"! How can I help?"),"Good ".concat(a).concat(r,"! What's on your mind?"),"Ready to breeze through ".concat(["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][o],"?"),"Let's navigate your ".concat(["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][o]," workload")];g(s[Math.floor(Math.random()*s.length)])},[e.isLoadingUserConfig,e.userConfig]),(0,l.useEffect)(()=>{e.chatOptionsData&&X()},[e.chatOptionsData]),(0,l.useEffect)(()=>{let e=(K||[]).filter(e=>null!=e);R(e),A(e.length>1?e[0].slug:"khoj"),I(e.map(e=>(0,j.TI)(e.icon,e.color)))},[K,e.isMobileWidth]),(0,l.useEffect)(()=>{(async()=>{if(i&&!p){u(!0);try{let e=await (0,M.A0)(C||"khoj");null==G||G(e),localStorage.setItem("message",i),r.length>0&&localStorage.setItem("images",JSON.stringify(r)),window.location.href="/chat?conversationId=".concat(e)}catch(e){console.error("Error creating new conversation:",e),u(!1)}o(""),d([])}})(),(i||r.length>0)&&u(!0)},[C,i,p,G]),(0,l.useEffect)(()=>{let e=document.querySelector("[data-radix-scroll-area-viewport]"),t=()=>{k(null),P(!1)};return null==e||e.addEventListener("scroll",t),()=>null==e?void 0:e.removeEventListener("scroll",t)},[]),(0,a.jsxs)("div",{className:"".concat(s().homeGreetings," w-full md:w-auto"),children:[Z&&(0,a.jsx)(N.Z,{onOpenChange:z,loginRedirectMessage:"Login to your second brain"}),(0,a.jsxs)("div",{className:"w-full text-center justify-end content-end",children:[(0,a.jsx)("div",{className:"items-center",children:(0,a.jsx)("h1",{className:"text-2xl md:text-3xl text-center w-fit pb-6 px-4 mx-auto",children:h})}),!e.isMobileWidth&&(0,a.jsxs)(B.x,{className:"w-full max-w-[600px] mx-auto",children:[(0,a.jsx)("div",{className:"flex pb-2 gap-2 items-center justify-center",children:F.map((t,n)=>(0,a.jsxs)(q.J2,{open:v&&b===t.slug,onOpenChange:e=>{e||(k(null),P(!1))},children:[(0,a.jsx)(q.xo,{asChild:!0,children:(0,a.jsx)(x.Zb,{className:"".concat(C===t.slug?(0,L.Iu)(t.color):"border-stone-100 dark:border-neutral-700 text-muted-foreground","\n hover:cursor-pointer rounded-lg px-2 py-2"),onDoubleClick:()=>Q(t.slug),onClick:()=>{var e;A(t.slug),null===(e=U.current)||void 0===e||e.focus(),k(null),P(!1)},onMouseEnter:()=>k(t.slug),onMouseLeave:()=>{k(null),P(!1)},children:(0,a.jsxs)(x.ll,{className:"text-center text-md font-medium flex justify-center items-center whitespace-nowrap",children:[S[n]," ",t.name]})})}),(0,a.jsx)(q.yk,{className:"w-80 p-0 border-none bg-transparent shadow-none",onMouseLeave:()=>{k(null),P(!1)},children:(0,a.jsx)(O.EY,{data:t,userProfile:null,isMobileWidth:e.isMobileWidth||!1,showChatButton:!1,editCard:!1,filesOptions:[],selectedChatModelOption:"",agentSlug:"",isSubscribed:(0,T.T8)(e.userConfig),setAgentChangeTriggered:()=>{},modelOptions:[],inputToolOptions:{},outputModeOptions:{}})})]},"".concat(n,"-").concat(t.slug)))}),(0,a.jsx)(B.B,{orientation:"horizontal"})]})]}),(0,a.jsxs)("div",{className:"mx-auto ".concat(e.isMobileWidth?"w-full":"w-fit max-w-screen-md"),children:[!e.isMobileWidth&&(0,a.jsx)("div",{className:"w-full ".concat(s().inputBox," shadow-lg bg-background align-middle items-center justify-center px-3 py-1 dark:bg-neutral-700 border-stone-100 dark:border-none dark:shadow-none rounded-2xl"),children:(0,a.jsx)(_.a,{isLoggedIn:e.isLoggedIn,sendMessage:e=>o(e),sendImage:e=>d(t=>[...t,e]),sendDisabled:p,chatOptionsData:e.chatOptionsData,conversationId:null,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,agentColor:null===(t=F.find(e=>e.slug===C))||void 0===t?void 0:t.color,ref:U})}),(0,a.jsx)("div",{className:"".concat(s().suggestions," w-full ").concat(e.isMobileWidth?"grid":"flex flex-row"," justify-center items-center"),children:m.map((t,n)=>(0,a.jsx)("div",{onClick:n=>{e.isLoggedIn?function(e,t,n){if(!e){let e="";n=n.charAt(0).toLowerCase()+n.slice(1),e="Online Search"===t?"/online "+n:"Paint"===t?"/image "+n:n;let i=document.getElementById("message");i&&(i.value=e,o(e))}}(t.link,t.type,t.description):(n.preventDefault(),n.stopPropagation(),z(!0))},children:(0,a.jsx)(H,{title:t.type,body:t.description,link:t.link,color:t.color},t.type+Math.random())},"".concat(t.type," ").concat(t.description)))}),(0,a.jsx)("div",{className:"flex items-center justify-center margin-auto",children:(0,a.jsxs)("button",{onClick:function(){X()},className:"m-2 p-1.5 rounded-lg dark:hover:bg-[var(--background-color)] hover:bg-stone-100 border border-stone-100 text-sm text-stone-500 dark:text-stone-300 dark:border-neutral-700",children:["More Ideas ",(0,a.jsx)(w,{className:"h-4 w-4 inline"})]})})]}),e.isMobileWidth&&(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)("div",{className:"".concat(s().inputBox," pt-1 shadow-[0_-20px_25px_-5px_rgba(0,0,0,0.1)] dark:bg-neutral-700 bg-background align-middle items-center justify-center pb-3 mx-1 rounded-t-2xl rounded-b-none"),children:[(0,a.jsxs)(B.x,{className:"w-full max-w-[85vw]",children:[(0,a.jsx)("div",{className:"flex gap-2 items-center justify-left pt-1 pb-2 px-12",children:S.map((e,t)=>(0,a.jsx)(x.Zb,{className:"".concat(C===F[t].slug?(0,L.Iu)(F[t].color):"border-muted text-muted-foreground"," hover:cursor-pointer"),children:(0,a.jsxs)(x.ll,{className:"text-center text-xs font-medium flex justify-center items-center whitespace-nowrap px-1.5 py-1",onDoubleClick:()=>Q(F[t].slug),onClick:()=>{var e;A(F[t].slug),null===(e=U.current)||void 0===e||e.focus()},children:[e," ",F[t].name]})},"".concat(t,"-").concat(F[t].slug)))}),(0,a.jsx)(B.B,{orientation:"horizontal"})]}),(0,a.jsx)(_.a,{isLoggedIn:e.isLoggedIn,sendMessage:e=>o(e),sendImage:e=>d(t=>[...t,e]),sendDisabled:p,chatOptionsData:e.chatOptionsData,conversationId:null,isMobileWidth:e.isMobileWidth,setUploadedFiles:e.setUploadedFiles,agentColor:null===(n=F.find(e=>e.slug===C))||void 0===n?void 0:n.color,ref:U})]})})]})}function U(){let[e,t]=(0,l.useState)(null),[n,i]=(0,l.useState)(!0),[o,r]=(0,l.useState)(null),[c,d]=(0,l.useState)(null),p=(0,D.IC)(),{userConfig:u,isLoadingUserConfig:h}=(0,T.h2)(!0),[g,m]=(0,l.useState)(null),f=(0,T.GW)();return((0,l.useEffect)(()=>{m(u)},[u]),(0,l.useEffect)(()=>{c&&localStorage.setItem("uploadedFiles",JSON.stringify(c))},[c]),(0,l.useEffect)(()=>{fetch("/api/chat/options").then(e=>e.json()).then(e=>{i(!1),e&&t(e)}).catch(e=>{console.error(e)})},[]),n)?(0,a.jsx)(F.Z,{}):(0,a.jsxs)("div",{className:"".concat(s().main," ").concat(s().chatLayout),children:[(0,a.jsx)("title",{children:"Khoj AI - Your Second Brain"}),(0,a.jsx)("div",{className:"".concat(s().sidePanel),children:(0,a.jsx)(I.ZP,{conversationId:o,uploadedFiles:[],isMobileWidth:p})}),(0,a.jsx)("div",{className:"".concat(s().chatBox),children:(0,a.jsx)("div",{className:"".concat(s().chatBoxBody),children:(0,a.jsx)(R,{isLoggedIn:null!==f,chatOptionsData:e,setUploadedFiles:d,isMobileWidth:p,onConversationIdChange:e=>{r(e)},userConfig:g,isLoadingUserConfig:h})})})]})}},16463:function(e,t,n){"use strict";var i=n(71169);n.o(i,"useRouter")&&n.d(t,{useRouter:function(){return i.useRouter}}),n.o(i,"useSearchParams")&&n.d(t,{useSearchParams:function(){return i.useSearchParams}})},58877:function(){},31806:function(e){e.exports={card:"suggestions_card__fbiZo",title:"suggestions_title__vNozc",text:"suggestions_text__J_IfY"}},68518:function(e){e.exports={main:"page_main__nw1Wk",suggestions:"page_suggestions__Y8EqU",inputBox:"page_inputBox__LrcZ4",chatBodyFull:"page_chatBodyFull__Qu2T2",chatBody:"page_chatBody__IirQQ",chatLayout:"page_chatLayout__bJUjP",chatBox:"page_chatBox__gsR6V",titleBar:"page_titleBar__3btUI",chatBoxBody:"page_chatBoxBody__xORKr",homeGreetings:"page_homeGreetings__VjQhh",sidePanel:"page_sidePanel__mxpxa"}}},function(e){e.O(0,[404,4836,9848,9001,3062,3124,3803,5512,2261,4602,1603,9417,8423,1970,2971,7023,1744],function(){return e(e.s=1507)}),_N_E=e.O()}]);