totem-llm 0.2.0 → 0.3.0

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 (90) hide show
  1. package/README.md +12 -0
  2. package/package.json +1 -1
  3. package/server/models/systemSettings.js +1 -1
  4. package/server/models/workspace.js +2 -2
  5. package/server/public/assets/{404-b5c6b0dc.js → 404-56d107aa.js} +1 -1
  6. package/server/public/assets/RunDetailPage-da6aa377.js +1 -0
  7. package/server/public/assets/RunHistoryPage-2fcb4325.js +1 -0
  8. package/server/public/assets/{Trans-ca8f9cfe.js → Trans-820f1dad.js} +1 -1
  9. package/server/public/assets/{cron-1f15870f.js → cron-307d3fc6.js} +1 -1
  10. package/server/public/assets/{files-e19b0187.js → files-676613ed.js} +1 -1
  11. package/server/public/assets/index-01932fa1.js +1 -0
  12. package/server/public/assets/{index-a6e642d7.js → index-0bf4fb6b.js} +1 -1
  13. package/server/public/assets/index-166e238c.js +1 -0
  14. package/server/public/assets/{index-f86e167c.js → index-1c653bbf.js} +2 -2
  15. package/server/public/assets/index-1fe43260.js +1 -0
  16. package/server/public/assets/index-27cc497c.js +1 -0
  17. package/server/public/assets/{index-9cc77cb6.js → index-2aac91d0.js} +3 -3
  18. package/server/public/assets/index-2d84e5fe.js +1 -0
  19. package/server/public/assets/index-33ded078.js +1 -0
  20. package/server/public/assets/{index-2f526c2a.js → index-3cb59d82.js} +1 -1
  21. package/server/public/assets/{index-92d3b7bc.js → index-4277cf52.js} +1 -1
  22. package/server/public/assets/index-44ab5f11.js +1 -0
  23. package/server/public/assets/index-4750915e.js +1 -0
  24. package/server/public/assets/{index-ab72b353.js → index-574ed823.js} +2 -2
  25. package/server/public/assets/{index-3a2c5fd7.js → index-631fc042.js} +1 -1
  26. package/server/public/assets/index-65184421.js +1 -0
  27. package/server/public/assets/index-6679334a.js +1 -0
  28. package/server/public/assets/{index-6cdecde9.js → index-6bd7928a.js} +9 -9
  29. package/server/public/assets/index-6d56c896.js +18 -0
  30. package/server/public/assets/{index-925792fe.js → index-72544df5.js} +1 -1
  31. package/server/public/assets/index-80edec8f.js +1 -0
  32. package/server/public/assets/index-83825216.js +1 -0
  33. package/server/public/assets/index-841db586.js +1 -0
  34. package/server/public/assets/index-882e468e.js +1 -0
  35. package/server/public/assets/{index-ab35fb74.js → index-8c2371f5.js} +1 -1
  36. package/server/public/assets/{index-8eb228e2.js → index-9ab52cfb.js} +3 -3
  37. package/server/public/assets/{index-ad8e77d2.js → index-a2978aa0.js} +2 -2
  38. package/server/public/assets/index-a29a8c19.js +3 -0
  39. package/server/public/assets/{index-62fee0f9.js → index-ae4f557d.js} +2 -2
  40. package/server/public/assets/{index-8132c765.js → index-b49f94f1.js} +1 -1
  41. package/server/public/assets/{index-52850dde.js → index-c453ccc8.js} +1 -1
  42. package/server/public/assets/index-cd6bc090.js +1 -0
  43. package/server/public/assets/{index-c391a2fa.js → index-d1d3d69a.js} +1 -1
  44. package/server/public/assets/index-d29fdeda.js +1 -0
  45. package/server/public/assets/index-d54b0575.js +1 -0
  46. package/server/public/assets/index-dcc00e8c.js +3 -0
  47. package/server/public/assets/index-e58bf860.js +1 -0
  48. package/server/public/assets/index-ec3efa1e.js +1 -0
  49. package/server/public/assets/index-ed9034ac.js +1 -0
  50. package/server/public/assets/{index-92574f3a.js → index-efee6d1f.js} +1 -1
  51. package/server/public/assets/index-f9305828.js +1 -0
  52. package/server/public/assets/index-fce187ac.js +1 -0
  53. package/server/public/assets/{main-8ad4162f.js → main-0b9e408b.js} +1 -1
  54. package/server/public/assets/{mcpServers-a175e8cf.js → mcpServers-1686e782.js} +1 -1
  55. package/server/public/assets/{moment-8a59df1b.js → moment-75486807.js} +1 -1
  56. package/server/public/assets/{purify-fbc9e8e2.js → purify-eb750cf4.js} +1 -1
  57. package/server/public/assets/{react-beautiful-dnd.esm-45ea8487.js → react-beautiful-dnd.esm-bb85eef1.js} +1 -1
  58. package/server/public/assets/{truncate-352eb33b.js → truncate-06273256.js} +1 -1
  59. package/server/public/index.js +27 -27
  60. package/server/utils/AiProviders/ollama/index.js +2 -0
  61. package/server/utils/chats/agents.js +7 -1
  62. package/server/utils/telegramBot/utils/verification.js +1 -1
  63. package/totem.features.cjs +5 -108
  64. package/server/public/assets/RunDetailPage-74b1e63a.js +0 -1
  65. package/server/public/assets/RunHistoryPage-9609436a.js +0 -1
  66. package/server/public/assets/index-25b2660c.js +0 -1
  67. package/server/public/assets/index-2a7c0b04.js +0 -1
  68. package/server/public/assets/index-35b0a39b.js +0 -3
  69. package/server/public/assets/index-3643e990.js +0 -1
  70. package/server/public/assets/index-39899779.js +0 -1
  71. package/server/public/assets/index-51f23c79.js +0 -1
  72. package/server/public/assets/index-56bb11a0.js +0 -1
  73. package/server/public/assets/index-65801ac6.js +0 -1
  74. package/server/public/assets/index-6710499a.js +0 -1
  75. package/server/public/assets/index-73aba4c6.js +0 -3
  76. package/server/public/assets/index-837868b3.js +0 -1
  77. package/server/public/assets/index-86e8a6b4.js +0 -1
  78. package/server/public/assets/index-8e43159f.js +0 -1
  79. package/server/public/assets/index-994c849a.js +0 -1
  80. package/server/public/assets/index-9f71774b.js +0 -1
  81. package/server/public/assets/index-9f7dabd6.js +0 -1
  82. package/server/public/assets/index-a0e2be61.js +0 -1
  83. package/server/public/assets/index-ac4d4b42.js +0 -1
  84. package/server/public/assets/index-c9b59c35.js +0 -1
  85. package/server/public/assets/index-dad0fb8d.js +0 -18
  86. package/server/public/assets/index-dd210692.js +0 -1
  87. package/server/public/assets/index-e28b0ead.js +0 -1
  88. package/server/public/assets/index-e6c540e1.js +0 -1
  89. package/server/public/assets/index-f984ef26.js +0 -1
  90. package/server/public/assets/index-fb26b60a.js +0 -1
@@ -1,5 +1,5 @@
1
- import{R as l,r as c,g as V,u as C,j as e,k as M,V as k,X as A,Y as E,Z as O,q as S,O as U,M as L,c as w,aV as D,$ as P,i as T,C as _,a as q,S as z,aD as I}from"../index.js";import{A as f}from"./admin-04b020fe.js";const $=new Map([["bold",l.createElement(l.Fragment,null,l.createElement("path",{d:"M256,136a12,12,0,0,1-12,12h-8v8a12,12,0,0,1-24,0v-8h-8a12,12,0,0,1,0-24h8v-8a12,12,0,0,1,24,0v8h8A12,12,0,0,1,256,136Zm-54.81,56.28a12,12,0,1,1-18.38,15.44C169.12,191.42,145,172,108,172c-28.89,0-55.46,12.68-74.81,35.72a12,12,0,0,1-18.38-15.44A124.08,124.08,0,0,1,63.5,156.53a72,72,0,1,1,89,0A124,124,0,0,1,201.19,192.28ZM108,148a48,48,0,1,0-48-48A48.05,48.05,0,0,0,108,148Z"}))],["duotone",l.createElement(l.Fragment,null,l.createElement("path",{d:"M168,100a60,60,0,1,1-60-60A60,60,0,0,1,168,100Z",opacity:"0.2"}),l.createElement("path",{d:"M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z"}))],["fill",l.createElement(l.Fragment,null,l.createElement("path",{d:"M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136ZM144,157.68a68,68,0,1,0-71.9,0c-20.65,6.76-39.23,19.39-54.17,37.17A8,8,0,0,0,24,208H192a8,8,0,0,0,6.13-13.15C183.18,177.07,164.6,164.44,144,157.68Z"}))],["light",l.createElement(l.Fragment,null,l.createElement("path",{d:"M254,136a6,6,0,0,1-6,6H230v18a6,6,0,0,1-12,0V142H200a6,6,0,0,1,0-12h18V112a6,6,0,0,1,12,0v18h18A6,6,0,0,1,254,136Zm-57.41,60.14a6,6,0,1,1-9.18,7.72C166.9,179.45,138.69,166,108,166s-58.89,13.45-79.41,37.86a6,6,0,0,1-9.18-7.72C35.14,177.41,55,164.48,77,158.25a66,66,0,1,1,62,0C161,164.48,180.86,177.41,196.59,196.14ZM108,154a54,54,0,1,0-54-54A54.06,54.06,0,0,0,108,154Z"}))],["regular",l.createElement(l.Fragment,null,l.createElement("path",{d:"M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z"}))],["thin",l.createElement(l.Fragment,null,l.createElement("path",{d:"M252,136a4,4,0,0,1-4,4H228v20a4,4,0,0,1-8,0V140H200a4,4,0,0,1,0-8h20V112a4,4,0,0,1,8,0v20h20A4,4,0,0,1,252,136Zm-56.94,61.43a4,4,0,0,1-6.12,5.14C168,177.7,139.3,164,108,164s-60,13.7-80.94,38.57a4,4,0,1,1-6.12-5.14c16.71-19.9,38.13-33.13,61.89-38.59a64,64,0,1,1,50.34,0C156.93,164.3,178.35,177.53,195.06,197.43ZM108,156a56,56,0,1,0-56-56A56.06,56.06,0,0,0,108,156Z"}))]]);var B=Object.defineProperty,G=Object.defineProperties,X=Object.getOwnPropertyDescriptors,y=Object.getOwnPropertySymbols,J=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable,N=(s,t,a)=>t in s?B(s,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):s[t]=a,Y=(s,t)=>{for(var a in t||(t={}))J.call(t,a)&&N(s,a,t[a]);if(y)for(var a of y(t))W.call(t,a)&&N(s,a,t[a]);return s},K=(s,t)=>G(s,X(t));const R=c.forwardRef((s,t)=>l.createElement(V,K(Y({ref:t},s),{weights:$})));R.displayName="UserPlus";function Q({currentUser:s,user:t,closeModal:a}){const[d,r]=c.useState(t.role),[n,m]=c.useState(null),[h,b]=c.useState({enabled:t.dailyMessageLimit!==null,limit:t.dailyMessageLimit||10}),{t:x}=C(),u=async o=>{m(null),o.preventDefault();const i={},p=new FormData(o.target);for(var[v,g]of p.entries())!g||g===null||(i[v]=g);h.enabled?i.dailyMessageLimit=h.limit:i.dailyMessageLimit=null;const{success:j,error:H}=await f.updateUser(t.id,i);j&&(s&&s.id===t.id&&(s.username=i.username,s.bio=i.bio,s.role=i.role,localStorage.setItem(O,JSON.stringify(s))),window.location.reload()),m(H)};return e.jsx("div",{className:"fixed inset-0 z-50 overflow-auto bg-black bg-opacity-50 flex items-center justify-center",children:e.jsxs("div",{className:"relative w-full max-w-2xl bg-theme-bg-secondary rounded-lg shadow border-2 border-theme-modal-border",children:[e.jsxs("div",{className:"relative p-6 border-b rounded-t border-theme-modal-border",children:[e.jsx("div",{className:"w-full flex gap-x-2 items-center",children:e.jsxs("h3",{className:"text-xl font-semibold text-white overflow-hidden overflow-ellipsis whitespace-nowrap",children:["Edit ",t.username]})}),e.jsx("button",{onClick:a,type:"button",className:"absolute top-4 right-4 transition-all duration-300 bg-transparent rounded-lg text-sm p-1 inline-flex items-center hover:bg-theme-modal-border hover:border-theme-modal-border hover:border-opacity-50 border-transparent border",children:e.jsx(M,{size:24,weight:"bold",className:"text-white"})})]}),e.jsx("div",{className:"p-6",children:e.jsxs("form",{onSubmit:u,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"username",className:"block mb-2 text-sm font-medium text-white",children:"Username"}),e.jsx("input",{name:"username",type:"text",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"User's username",defaultValue:t.username,minLength:k,maxLength:A,pattern:E,required:!0,autoComplete:"off"}),e.jsx("p",{className:"mt-2 text-xs text-white/60",children:x("common.username_requirements")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block mb-2 text-sm font-medium text-white",children:"New Password"}),e.jsx("input",{name:"password",type:"text",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:`${t.username}'s new password`,autoComplete:"off",minLength:8}),e.jsx("p",{className:"mt-2 text-xs text-white/60",children:"Password must be at least 8 characters long"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"bio",className:"block mb-2 text-sm font-medium text-white",children:"Bio"}),e.jsx("textarea",{name:"bio",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"User's bio",defaultValue:t.bio,autoComplete:"off",rows:3})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"role",className:"block mb-2 text-sm font-medium text-white",children:"Role"}),e.jsxs("select",{name:"role",required:!0,defaultValue:t.role,onChange:o=>r(o.target.value),className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",children:[e.jsx("option",{value:"default",children:"Default"}),e.jsx("option",{value:"manager",children:"Manager"}),(s==null?void 0:s.role)==="admin"&&e.jsx("option",{value:"admin",children:"Administrator"})]}),e.jsx(F,{role:d})]}),e.jsx(Z,{role:d,enabled:h.enabled,limit:h.limit,updateState:b}),n&&e.jsxs("p",{className:"text-red-400 text-sm",children:["Error: ",n]})]}),e.jsxs("div",{className:"flex justify-between items-center mt-6 pt-6 border-t border-theme-modal-border",children:[e.jsx("button",{onClick:a,type:"button",className:"transition-all duration-300 text-white hover:bg-zinc-700 px-4 py-2 rounded-lg text-sm",children:"Cancel"}),e.jsx("button",{type:"submit",className:"transition-all duration-300 bg-white text-black hover:opacity-60 px-4 py-2 rounded-lg text-sm",children:"Update user"})]})]})})]})})}const ee={admin:["admin","manager","default"],manager:["manager","default"],default:[]};function te({currUser:s,user:t}){const a=c.useRef(null),d=ee[(s==null?void 0:s.role)||"default"].includes(t.role),[r,n]=c.useState(t.suspended===1),{isOpen:m,openModal:h,closeModal:b}=S(),x=async()=>{if(!window.confirm(`Are you sure you want to suspend ${t.username}?
1
+ import{R as l,r as c,g as U,u as C,j as e,k as M,Y as k,Z as A,_ as E,$ as V,q as S,Q as O,M as L,c as w,aX as D,a1 as P,i as T,C as _,a as q,S as z,aF as I}from"../index.js";import{A as f}from"./admin-04b020fe.js";const $=new Map([["bold",l.createElement(l.Fragment,null,l.createElement("path",{d:"M256,136a12,12,0,0,1-12,12h-8v8a12,12,0,0,1-24,0v-8h-8a12,12,0,0,1,0-24h8v-8a12,12,0,0,1,24,0v8h8A12,12,0,0,1,256,136Zm-54.81,56.28a12,12,0,1,1-18.38,15.44C169.12,191.42,145,172,108,172c-28.89,0-55.46,12.68-74.81,35.72a12,12,0,0,1-18.38-15.44A124.08,124.08,0,0,1,63.5,156.53a72,72,0,1,1,89,0A124,124,0,0,1,201.19,192.28ZM108,148a48,48,0,1,0-48-48A48.05,48.05,0,0,0,108,148Z"}))],["duotone",l.createElement(l.Fragment,null,l.createElement("path",{d:"M168,100a60,60,0,1,1-60-60A60,60,0,0,1,168,100Z",opacity:"0.2"}),l.createElement("path",{d:"M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z"}))],["fill",l.createElement(l.Fragment,null,l.createElement("path",{d:"M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136ZM144,157.68a68,68,0,1,0-71.9,0c-20.65,6.76-39.23,19.39-54.17,37.17A8,8,0,0,0,24,208H192a8,8,0,0,0,6.13-13.15C183.18,177.07,164.6,164.44,144,157.68Z"}))],["light",l.createElement(l.Fragment,null,l.createElement("path",{d:"M254,136a6,6,0,0,1-6,6H230v18a6,6,0,0,1-12,0V142H200a6,6,0,0,1,0-12h18V112a6,6,0,0,1,12,0v18h18A6,6,0,0,1,254,136Zm-57.41,60.14a6,6,0,1,1-9.18,7.72C166.9,179.45,138.69,166,108,166s-58.89,13.45-79.41,37.86a6,6,0,0,1-9.18-7.72C35.14,177.41,55,164.48,77,158.25a66,66,0,1,1,62,0C161,164.48,180.86,177.41,196.59,196.14ZM108,154a54,54,0,1,0-54-54A54.06,54.06,0,0,0,108,154Z"}))],["regular",l.createElement(l.Fragment,null,l.createElement("path",{d:"M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z"}))],["thin",l.createElement(l.Fragment,null,l.createElement("path",{d:"M252,136a4,4,0,0,1-4,4H228v20a4,4,0,0,1-8,0V140H200a4,4,0,0,1,0-8h20V112a4,4,0,0,1,8,0v20h20A4,4,0,0,1,252,136Zm-56.94,61.43a4,4,0,0,1-6.12,5.14C168,177.7,139.3,164,108,164s-60,13.7-80.94,38.57a4,4,0,1,1-6.12-5.14c16.71-19.9,38.13-33.13,61.89-38.59a64,64,0,1,1,50.34,0C156.93,164.3,178.35,177.53,195.06,197.43ZM108,156a56,56,0,1,0-56-56A56.06,56.06,0,0,0,108,156Z"}))]]);var B=Object.defineProperty,G=Object.defineProperties,X=Object.getOwnPropertyDescriptors,y=Object.getOwnPropertySymbols,J=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,N=(s,t,a)=>t in s?B(s,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):s[t]=a,W=(s,t)=>{for(var a in t||(t={}))J.call(t,a)&&N(s,a,t[a]);if(y)for(var a of y(t))Q.call(t,a)&&N(s,a,t[a]);return s},Y=(s,t)=>G(s,X(t));const F=c.forwardRef((s,t)=>l.createElement(U,Y(W({ref:t},s),{weights:$})));F.displayName="UserPlus";function K({currentUser:s,user:t,closeModal:a}){const[d,r]=c.useState(t.role),[n,m]=c.useState(null),[h,b]=c.useState({enabled:t.dailyMessageLimit!==null,limit:t.dailyMessageLimit||10}),{t:x}=C(),u=async o=>{m(null),o.preventDefault();const i={},p=new FormData(o.target);for(var[v,g]of p.entries())!g||g===null||(i[v]=g);h.enabled?i.dailyMessageLimit=h.limit:i.dailyMessageLimit=null;const{success:j,error:H}=await f.updateUser(t.id,i);j&&(s&&s.id===t.id&&(s.username=i.username,s.bio=i.bio,s.role=i.role,localStorage.setItem(V,JSON.stringify(s))),window.location.reload()),m(H)};return e.jsx("div",{className:"fixed inset-0 z-50 overflow-auto bg-black bg-opacity-50 flex items-center justify-center",children:e.jsxs("div",{className:"relative w-full max-w-2xl bg-theme-bg-secondary rounded-lg shadow border-2 border-theme-modal-border",children:[e.jsxs("div",{className:"relative p-6 border-b rounded-t border-theme-modal-border",children:[e.jsx("div",{className:"w-full flex gap-x-2 items-center",children:e.jsxs("h3",{className:"text-xl font-semibold text-white overflow-hidden overflow-ellipsis whitespace-nowrap",children:["Edit ",t.username]})}),e.jsx("button",{onClick:a,type:"button",className:"absolute top-4 right-4 transition-all duration-300 bg-transparent rounded-lg text-sm p-1 inline-flex items-center hover:bg-theme-modal-border hover:border-theme-modal-border hover:border-opacity-50 border-transparent border",children:e.jsx(M,{size:24,weight:"bold",className:"text-white"})})]}),e.jsx("div",{className:"p-6",children:e.jsxs("form",{onSubmit:u,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"username",className:"block mb-2 text-sm font-medium text-white",children:"Username"}),e.jsx("input",{name:"username",type:"text",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"User's username",defaultValue:t.username,minLength:k,maxLength:A,pattern:E,required:!0,autoComplete:"off"}),e.jsx("p",{className:"mt-2 text-xs text-white/60",children:x("common.username_requirements")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block mb-2 text-sm font-medium text-white",children:"New Password"}),e.jsx("input",{name:"password",type:"text",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:`${t.username}'s new password`,autoComplete:"off",minLength:8}),e.jsx("p",{className:"mt-2 text-xs text-white/60",children:"Password must be at least 8 characters long"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"bio",className:"block mb-2 text-sm font-medium text-white",children:"Bio"}),e.jsx("textarea",{name:"bio",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"User's bio",defaultValue:t.bio,autoComplete:"off",rows:3})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"role",className:"block mb-2 text-sm font-medium text-white",children:"Role"}),e.jsxs("select",{name:"role",required:!0,defaultValue:t.role,onChange:o=>r(o.target.value),className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",children:[e.jsx("option",{value:"default",children:"Default"}),e.jsx("option",{value:"manager",children:"Manager"}),(s==null?void 0:s.role)==="admin"&&e.jsx("option",{value:"admin",children:"Administrator"})]}),e.jsx(R,{role:d})]}),e.jsx(Z,{role:d,enabled:h.enabled,limit:h.limit,updateState:b}),n&&e.jsxs("p",{className:"text-red-400 text-sm",children:["Error: ",n]})]}),e.jsxs("div",{className:"flex justify-between items-center mt-6 pt-6 border-t border-theme-modal-border",children:[e.jsx("button",{onClick:a,type:"button",className:"transition-all duration-300 text-white hover:bg-zinc-700 px-4 py-2 rounded-lg text-sm",children:"Cancel"}),e.jsx("button",{type:"submit",className:"transition-all duration-300 bg-white text-black hover:opacity-60 px-4 py-2 rounded-lg text-sm",children:"Update user"})]})]})})]})})}const ee={admin:["admin","manager","default"],manager:["manager","default"],default:[]};function te({currUser:s,user:t}){const a=c.useRef(null),d=ee[(s==null?void 0:s.role)||"default"].includes(t.role),[r,n]=c.useState(t.suspended===1),{isOpen:m,openModal:h,closeModal:b}=S(),x=async()=>{if(!window.confirm(`Are you sure you want to suspend ${t.username}?
2
2
  After you do this they will be logged out and unable to log back into this instance of AnythingLLM until unsuspended by an admin.`))return!1;const{success:o,error:i}=await f.updateUser(t.id,{suspended:r?0:1});o||w(i,"error",{clear:!0}),o&&(w(`User ${r?"is no longer suspended":"has been suspended"}.`,"success",{clear:!0}),n(!r))},u=async()=>{var p;if(!window.confirm(`Are you sure you want to delete ${t.username}?
3
3
  After you do this they will be logged out and unable to use this instance of AnythingLLM.
4
4
 
5
- This action is irreversible.`))return!1;const{success:o,error:i}=await f.deleteUser(t.id);o||w(i,"error",{clear:!0}),o&&((p=a==null?void 0:a.current)==null||p.remove(),w("User deleted from system.","success",{clear:!0}))};return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{ref:a,className:"bg-transparent text-white text-opacity-80 text-xs font-medium border-b border-white/10 h-10",children:[e.jsx("th",{scope:"row",className:"px-6 whitespace-nowrap",children:t.username}),e.jsx("td",{className:"px-6",children:U(t.role)}),e.jsx("td",{className:"px-6",children:t.createdAt}),e.jsxs("td",{className:"px-6 flex items-center gap-x-6 h-full mt-2",children:[d&&e.jsx("button",{onClick:h,className:"text-xs font-medium text-white/80 light:text-black/80 rounded-lg hover:text-white hover:light:text-gray-500 px-2 py-1 hover:bg-white hover:bg-opacity-10",children:"Edit"}),(s==null?void 0:s.id)!==t.id&&d&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:x,className:"text-xs font-medium text-white/80 light:text-black/80 hover:light:text-orange-500 hover:text-orange-300 rounded-lg px-2 py-1 hover:bg-white hover:light:bg-orange-50 hover:bg-opacity-10",children:r?"Unsuspend":"Suspend"}),e.jsx("button",{onClick:u,className:"text-xs font-medium text-white/80 light:text-black/80 hover:light:text-red-500 hover:text-red-300 rounded-lg px-2 py-1 hover:bg-white hover:light:bg-red-50 hover:bg-opacity-10",children:"Delete"})]})]})]}),e.jsx(L,{isOpen:m,children:e.jsx(Q,{currentUser:s,user:t,closeModal:b})})]})}function se({closeModal:s}){const[t,a]=c.useState(null),[d,r]=c.useState("default"),[n,m]=c.useState({enabled:!1,limit:10}),{t:h}=C(),b=async u=>{a(null),u.preventDefault();const o={},i=new FormData(u.target);for(var[p,v]of i.entries())o[p]=v;o.dailyMessageLimit=n.enabled?n.limit:null;const{user:g,error:j}=await f.newUser(o);g&&window.location.reload(),a(j)},x=D();return e.jsx("div",{className:"fixed inset-0 z-50 overflow-auto bg-black bg-opacity-50 flex items-center justify-center",children:e.jsxs("div",{className:"relative w-full max-w-2xl bg-theme-bg-secondary rounded-lg shadow border-2 border-theme-modal-border",children:[e.jsxs("div",{className:"relative p-6 border-b rounded-t border-theme-modal-border",children:[e.jsx("div",{className:"w-full flex gap-x-2 items-center",children:e.jsx("h3",{className:"text-xl font-semibold text-white overflow-hidden overflow-ellipsis whitespace-nowrap",children:"Add user to instance"})}),e.jsx("button",{onClick:s,type:"button",className:"absolute top-4 right-4 transition-all duration-300 bg-transparent rounded-lg text-sm p-1 inline-flex items-center hover:bg-theme-modal-border hover:border-theme-modal-border hover:border-opacity-50 border-transparent border",children:e.jsx(M,{size:24,weight:"bold",className:"text-white"})})]}),e.jsx("div",{className:"p-6",children:e.jsxs("form",{onSubmit:b,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"username",className:"block mb-2 text-sm font-medium text-white",children:"Username"}),e.jsx("input",{name:"username",type:"text",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"User's username",minLength:k,maxLength:A,pattern:E,required:!0,autoComplete:"off"}),e.jsx("p",{className:"mt-2 text-xs text-white/60",children:h("common.username_requirements")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block mb-2 text-sm font-medium text-white",children:"Password"}),e.jsx("input",{name:"password",type:"text",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"User's initial password",required:!0,autoComplete:"off",minLength:8}),e.jsx("p",{className:"mt-2 text-xs text-white/60",children:"Password must be at least 8 characters long"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"bio",className:"block mb-2 text-sm font-medium text-white",children:"Bio"}),e.jsx("textarea",{name:"bio",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"User's bio",autoComplete:"off",rows:3})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"role",className:"block mb-2 text-sm font-medium text-white",children:"Role"}),e.jsxs("select",{name:"role",required:!0,defaultValue:"default",onChange:u=>r(u.target.value),className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",children:[e.jsx("option",{value:"default",children:"Default"}),e.jsx("option",{value:"manager",children:"Manager"}),(x==null?void 0:x.role)==="admin"&&e.jsx("option",{value:"admin",children:"Administrator"})]}),e.jsx(F,{role:d})]}),e.jsx(Z,{role:d,enabled:n.enabled,limit:n.limit,updateState:m}),t&&e.jsxs("p",{className:"text-red-400 text-sm",children:["Error: ",t]}),e.jsx("p",{className:"text-white text-xs md:text-sm",children:"After creating a user they will need to login with their initial login to get access."})]}),e.jsxs("div",{className:"flex justify-between items-center mt-6 pt-6 border-t border-theme-modal-border",children:[e.jsx("button",{onClick:s,type:"button",className:"transition-all duration-300 text-white hover:bg-zinc-700 px-4 py-2 rounded-lg text-sm",children:"Cancel"}),e.jsx("button",{type:"submit",className:"transition-all duration-300 bg-white text-black hover:opacity-60 px-4 py-2 rounded-lg text-sm",children:"Add user"})]})]})})]})})}function oe(){const{isOpen:s,openModal:t,closeModal:a}=S();return e.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex",children:[e.jsx(P,{}),e.jsxs("div",{style:{height:T?"100%":"calc(100% - 32px)"},className:"relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-theme-bg-secondary w-full h-full overflow-y-scroll p-4 md:p-0",children:[e.jsxs("div",{className:"flex flex-col w-full px-1 md:pl-6 md:pr-[50px] md:py-6 py-16",children:[e.jsxs("div",{className:"w-full flex flex-col gap-y-1 pb-6 border-white/10 border-b-2",children:[e.jsx("div",{className:"items-center flex gap-x-4",children:e.jsx("p",{className:"text-lg leading-6 font-bold text-theme-text-primary",children:"Users"})}),e.jsx("p",{className:"text-xs leading-[18px] font-base text-theme-text-secondary",children:"These are all the accounts which have an account on this instance. Removing an account will instantly remove their access to this instance."})]}),e.jsx("div",{className:"w-full justify-end flex",children:e.jsxs(_,{onClick:t,className:"mt-3 mr-0 mb-4 md:-mb-6 z-10",children:[e.jsx(R,{className:"h-4 w-4",weight:"bold"})," Add user"]})}),e.jsx("div",{className:"overflow-x-auto",children:e.jsx(ae,{})})]}),e.jsx(L,{isOpen:s,children:e.jsx(se,{closeModal:a})})]})]})}function ae(){const{user:s}=q(),[t,a]=c.useState(!0),[d,r]=c.useState([]);return c.useEffect(()=>{async function n(){const m=await f.users();r(m),a(!1)}n()},[]),t?e.jsx(z,{height:"80vh",width:"100%",highlightColor:"var(--theme-bg-primary)",baseColor:"var(--theme-bg-secondary)",count:1,className:"w-full p-4 rounded-b-2xl rounded-tr-2xl rounded-tl-sm mt-8",containerClassName:"flex w-full"}):e.jsxs("table",{className:"w-full text-xs text-left rounded-lg min-w-[640px] border-spacing-0",children:[e.jsx("thead",{className:"text-theme-text-secondary text-xs leading-[18px] font-bold uppercase border-white/10 border-b",children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"px-6 py-3 rounded-tl-lg",children:"Username"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Role"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Date Added"}),e.jsx("th",{scope:"col",className:"px-6 py-3 rounded-tr-lg",children:" "})]})}),e.jsx("tbody",{children:d.map(n=>e.jsx(te,{currUser:s,user:n},n.id))})]})}const le={default:["Can only send chats with workspaces they are added to by admin or managers.","Cannot modify any settings at all."],manager:["Can view, create, and delete any workspaces and modify workspace-specific settings.","Can create, update and invite new users to the instance.","Cannot modify LLM, vectorDB, embedding, or other connections."],admin:["Highest user level privilege.","Can see and do everything across the system."]};function F({role:s}){return e.jsxs("div",{className:"flex flex-col gap-y-1 py-1 pb-4",children:[e.jsx("p",{className:"text-sm font-medium text-theme-text-primary",children:"Permissions"}),e.jsx("ul",{className:"flex flex-col gap-y-1 list-disc px-4",children:le[s??"default"].map((t,a)=>e.jsx("li",{className:"text-xs text-theme-text-secondary",children:t},a))})]})}function Z({enabled:s,limit:t,updateState:a,role:d}){return d==="admin"?null:e.jsxs("div",{className:"mt-4 mb-8",children:[e.jsx(I,{size:"md",variant:"horizontal",label:"Limit messages per day",description:"Restrict this user to a number of successful queries or chats within a 24 hour window.",enabled:s,onChange:r=>{a(n=>({...n,enabled:r}))}}),s&&e.jsxs("div",{className:"mt-4",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-4",children:"Message limit per day"}),e.jsx("div",{className:"relative mt-2",children:e.jsx("input",{type:"number",onScroll:r=>r.target.blur(),onChange:r=>{var n;a({enabled:!0,limit:Number(((n=r==null?void 0:r.target)==null?void 0:n.value)||0)})},value:t,min:1,className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5"})})]})]})}export{Z as MessageLimitInput,F as RoleHintDisplay,oe as default};
5
+ This action is irreversible.`))return!1;const{success:o,error:i}=await f.deleteUser(t.id);o||w(i,"error",{clear:!0}),o&&((p=a==null?void 0:a.current)==null||p.remove(),w("User deleted from system.","success",{clear:!0}))};return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{ref:a,className:"bg-transparent text-white text-opacity-80 text-xs font-medium border-b border-white/10 h-10",children:[e.jsx("th",{scope:"row",className:"px-6 whitespace-nowrap",children:t.username}),e.jsx("td",{className:"px-6",children:O(t.role)}),e.jsx("td",{className:"px-6",children:t.createdAt}),e.jsxs("td",{className:"px-6 flex items-center gap-x-6 h-full mt-2",children:[d&&e.jsx("button",{onClick:h,className:"text-xs font-medium text-white/80 light:text-black/80 rounded-lg hover:text-white hover:light:text-gray-500 px-2 py-1 hover:bg-white hover:bg-opacity-10",children:"Edit"}),(s==null?void 0:s.id)!==t.id&&d&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:x,className:"text-xs font-medium text-white/80 light:text-black/80 hover:light:text-orange-500 hover:text-orange-300 rounded-lg px-2 py-1 hover:bg-white hover:light:bg-orange-50 hover:bg-opacity-10",children:r?"Unsuspend":"Suspend"}),e.jsx("button",{onClick:u,className:"text-xs font-medium text-white/80 light:text-black/80 hover:light:text-red-500 hover:text-red-300 rounded-lg px-2 py-1 hover:bg-white hover:light:bg-red-50 hover:bg-opacity-10",children:"Delete"})]})]})]}),e.jsx(L,{isOpen:m,children:e.jsx(K,{currentUser:s,user:t,closeModal:b})})]})}function se({closeModal:s}){const[t,a]=c.useState(null),[d,r]=c.useState("default"),[n,m]=c.useState({enabled:!1,limit:10}),{t:h}=C(),b=async u=>{a(null),u.preventDefault();const o={},i=new FormData(u.target);for(var[p,v]of i.entries())o[p]=v;o.dailyMessageLimit=n.enabled?n.limit:null;const{user:g,error:j}=await f.newUser(o);g&&window.location.reload(),a(j)},x=D();return e.jsx("div",{className:"fixed inset-0 z-50 overflow-auto bg-black bg-opacity-50 flex items-center justify-center",children:e.jsxs("div",{className:"relative w-full max-w-2xl bg-theme-bg-secondary rounded-lg shadow border-2 border-theme-modal-border",children:[e.jsxs("div",{className:"relative p-6 border-b rounded-t border-theme-modal-border",children:[e.jsx("div",{className:"w-full flex gap-x-2 items-center",children:e.jsx("h3",{className:"text-xl font-semibold text-white overflow-hidden overflow-ellipsis whitespace-nowrap",children:"Add user to instance"})}),e.jsx("button",{onClick:s,type:"button",className:"absolute top-4 right-4 transition-all duration-300 bg-transparent rounded-lg text-sm p-1 inline-flex items-center hover:bg-theme-modal-border hover:border-theme-modal-border hover:border-opacity-50 border-transparent border",children:e.jsx(M,{size:24,weight:"bold",className:"text-white"})})]}),e.jsx("div",{className:"p-6",children:e.jsxs("form",{onSubmit:b,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"username",className:"block mb-2 text-sm font-medium text-white",children:"Username"}),e.jsx("input",{name:"username",type:"text",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"User's username",minLength:k,maxLength:A,pattern:E,required:!0,autoComplete:"off"}),e.jsx("p",{className:"mt-2 text-xs text-white/60",children:h("common.username_requirements")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block mb-2 text-sm font-medium text-white",children:"Password"}),e.jsx("input",{name:"password",type:"text",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"User's initial password",required:!0,autoComplete:"off",minLength:8}),e.jsx("p",{className:"mt-2 text-xs text-white/60",children:"Password must be at least 8 characters long"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"bio",className:"block mb-2 text-sm font-medium text-white",children:"Bio"}),e.jsx("textarea",{name:"bio",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"User's bio",autoComplete:"off",rows:3})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"role",className:"block mb-2 text-sm font-medium text-white",children:"Role"}),e.jsxs("select",{name:"role",required:!0,defaultValue:"default",onChange:u=>r(u.target.value),className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",children:[e.jsx("option",{value:"default",children:"Default"}),e.jsx("option",{value:"manager",children:"Manager"}),(x==null?void 0:x.role)==="admin"&&e.jsx("option",{value:"admin",children:"Administrator"})]}),e.jsx(R,{role:d})]}),e.jsx(Z,{role:d,enabled:n.enabled,limit:n.limit,updateState:m}),t&&e.jsxs("p",{className:"text-red-400 text-sm",children:["Error: ",t]}),e.jsx("p",{className:"text-white text-xs md:text-sm",children:"After creating a user they will need to login with their initial login to get access."})]}),e.jsxs("div",{className:"flex justify-between items-center mt-6 pt-6 border-t border-theme-modal-border",children:[e.jsx("button",{onClick:s,type:"button",className:"transition-all duration-300 text-white hover:bg-zinc-700 px-4 py-2 rounded-lg text-sm",children:"Cancel"}),e.jsx("button",{type:"submit",className:"transition-all duration-300 bg-white text-black hover:opacity-60 px-4 py-2 rounded-lg text-sm",children:"Add user"})]})]})})]})})}function oe(){const{isOpen:s,openModal:t,closeModal:a}=S();return e.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex",children:[e.jsx(P,{}),e.jsxs("div",{style:{height:T?"100%":"calc(100% - 32px)"},className:"relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-theme-bg-secondary w-full h-full overflow-y-scroll p-4 md:p-0",children:[e.jsxs("div",{className:"flex flex-col w-full px-1 md:pl-6 md:pr-[50px] md:py-6 py-16",children:[e.jsxs("div",{className:"w-full flex flex-col gap-y-1 pb-6 border-white/10 border-b-2",children:[e.jsx("div",{className:"items-center flex gap-x-4",children:e.jsx("p",{className:"text-lg leading-6 font-bold text-theme-text-primary",children:"Users"})}),e.jsx("p",{className:"text-xs leading-[18px] font-base text-theme-text-secondary",children:"These are all the accounts which have an account on this instance. Removing an account will instantly remove their access to this instance."})]}),e.jsx("div",{className:"w-full justify-end flex",children:e.jsxs(_,{onClick:t,className:"mt-3 mr-0 mb-4 md:-mb-6 z-10",children:[e.jsx(F,{className:"h-4 w-4",weight:"bold"})," Add user"]})}),e.jsx("div",{className:"overflow-x-auto",children:e.jsx(ae,{})})]}),e.jsx(L,{isOpen:s,children:e.jsx(se,{closeModal:a})})]})]})}function ae(){const{user:s}=q(),[t,a]=c.useState(!0),[d,r]=c.useState([]);return c.useEffect(()=>{async function n(){const m=await f.users();r(m),a(!1)}n()},[]),t?e.jsx(z,{height:"80vh",width:"100%",highlightColor:"var(--theme-bg-primary)",baseColor:"var(--theme-bg-secondary)",count:1,className:"w-full p-4 rounded-b-2xl rounded-tr-2xl rounded-tl-sm mt-8",containerClassName:"flex w-full"}):e.jsxs("table",{className:"w-full text-xs text-left rounded-lg min-w-[640px] border-spacing-0",children:[e.jsx("thead",{className:"text-theme-text-secondary text-xs leading-[18px] font-bold uppercase border-white/10 border-b",children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"px-6 py-3 rounded-tl-lg",children:"Username"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Role"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Date Added"}),e.jsx("th",{scope:"col",className:"px-6 py-3 rounded-tr-lg",children:" "})]})}),e.jsx("tbody",{children:d.map(n=>e.jsx(te,{currUser:s,user:n},n.id))})]})}const le={default:["Can only send chats with workspaces they are added to by admin or managers.","Cannot modify any settings at all."],manager:["Can view, create, and delete any workspaces and modify workspace-specific settings.","Can create, update and invite new users to the instance.","Cannot modify LLM, vectorDB, embedding, or other connections."],admin:["Highest user level privilege.","Can see and do everything across the system."]};function R({role:s}){return e.jsxs("div",{className:"flex flex-col gap-y-1 py-1 pb-4",children:[e.jsx("p",{className:"text-sm font-medium text-theme-text-primary",children:"Permissions"}),e.jsx("ul",{className:"flex flex-col gap-y-1 list-disc px-4",children:le[s??"default"].map((t,a)=>e.jsx("li",{className:"text-xs text-theme-text-secondary",children:t},a))})]})}function Z({enabled:s,limit:t,updateState:a,role:d}){return d==="admin"?null:e.jsxs("div",{className:"mt-4 mb-8",children:[e.jsx(I,{size:"md",variant:"horizontal",label:"Limit messages per day",description:"Restrict this user to a number of successful queries or chats within a 24 hour window.",enabled:s,onChange:r=>{a(n=>({...n,enabled:r}))}}),s&&e.jsxs("div",{className:"mt-4",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-4",children:"Message limit per day"}),e.jsx("div",{className:"relative mt-2",children:e.jsx("input",{type:"number",onScroll:r=>r.target.blur(),onChange:r=>{var n;a({enabled:!0,limit:Number(((n=r==null?void 0:r.target)==null?void 0:n.value)||0)})},value:t,min:1,className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5"})})]})]})}export{Z as MessageLimitInput,R as RoleHintDisplay,oe as default};
@@ -0,0 +1,3 @@
1
+ import{r as c,j as e,p,C as h,c as d,W as I,ae as w,a4 as v,aJ as S,aE as C,s as A,v as L,aL as T,a1 as F,i as N}from"../index.js";import{C as f}from"./communityHub-aba61686.js";import{r as H}from"./files-676613ed.js";import{p as P}from"./purify-eb750cf4.js";import{s as E}from"./index-9ab52cfb.js";import{A as b}from"./agentFlows-e4124dd3.js";/* empty css */import"./Check-7e83fb0d.js";import"./Copy-d323e545.js";import"./index-6bd7928a.js";import"./truncate-06273256.js";import"./XCircle-edfe554c.js";import"./moment-75486807.js";import"./File-b92df2f3.js";import"./Eye-9f033dc0.js";import"./index-4fb4d421.js";import"./react-beautiful-dnd.esm-bb85eef1.js";import"./mcpServers-1686e782.js";import"./admin-04b020fe.js";import"./Database-f1a76329.js";import"./Trans-820f1dad.js";import"./Brain-24e386d5.js";import"./Browser-1820fad0.js";import"./index-dcc00e8c.js";import"./index-3cb59d82.js";import"./WarningCircle-27467274.js";import"./index-8ba96f42.js";import"./Hammer-05b5ccc7.js";function U({settings:t,setSettings:l,setStep:s}){const[n,a]=c.useState(t.itemId),i=()=>{if(!n)return d("Please enter an item ID","error");l(r=>({...r,itemId:n})),s(x.itemId.next())};return e.jsx("div",{className:"flex-[2] flex flex-col gap-y-[18px] mt-10",children:e.jsx("div",{className:"bg-theme-bg-secondary rounded-xl flex-1 p-6",children:e.jsxs("div",{className:"w-full flex flex-col gap-y-2 max-w-[700px]",children:[e.jsx("h2",{className:"text-base text-theme-text-primary font-semibold",children:"Import an item from the community hub"}),e.jsxs("div",{className:"flex flex-col gap-y-[25px] text-theme-text-secondary text-sm",children:[e.jsx("p",{children:"The community hub is a place where you can find, share, and import agent-skills, system prompts, slash commands, and more!"}),e.jsx("p",{children:"These items are created by the AnythingLLM team and community, and are a great way to get started with AnythingLLM as well as extend AnythingLLM in a way that is customized to your needs."}),e.jsxs("p",{children:["There are both ",e.jsx("b",{children:"private"})," and ",e.jsx("b",{children:"public"})," items in the community hub. Private items are only visible to you, while public items are visible to everyone."]}),e.jsxs("p",{className:"p-4 bg-yellow-800/30 light:bg-orange-100 light:text-orange-500 light:border-orange-500 rounded-lg border border-yellow-500 text-yellow-500",children:["If you are pulling in a private item, make sure it is"," ",e.jsx("b",{children:"shared with a team"})," you belong to, and you have added a"," ",e.jsx("a",{href:p.communityHub.authentication(),className:"underline text-yellow-100 light:text-orange-500 font-semibold",children:"Connection Key."})]})]}),e.jsx("div",{className:"flex flex-col gap-y-2 mt-4",children:e.jsx("div",{className:"w-full flex flex-col gap-y-4",children:e.jsxs("div",{className:"flex flex-col w-full",children:[e.jsx("label",{className:"text-theme-text-primary text-sm font-semibold block mb-3",children:"Community Hub Item Import ID"}),e.jsx("input",{type:"text",value:n,onChange:r=>a(r.target.value),placeholder:"allm-community-id:agent-skill:1234567890",className:"border-none bg-theme-settings-input-bg text-theme-text-primary placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5"})]})})}),e.jsx(h,{className:"text-dark-text w-full mt-[18px] h-[34px] hover:bg-accent",onClick:i,children:"Continue with import →"})]})})})}function z({item:t,setStep:l}){const[s,n]=c.useState(null),[a,i]=c.useState([]);c.useEffect(()=>{async function o(){const m=await I.all();i(m),n(m[0].slug)}o()},[]);async function r(){d("Applying system prompt to workspace...","info");const{error:o}=await f.applyItem(t.importId,{workspaceSlug:s});if(o)return d(`Failed to apply system prompt. ${o}`,"error",{clear:!0});d("System prompt applied to workspace.","success",{clear:!0}),l(x.completed.key)}return e.jsxs("div",{className:"flex flex-col mt-4 gap-y-4",children:[e.jsxs("div",{className:"flex flex-col gap-y-1",children:[e.jsxs("h2",{className:"text-base text-theme-text-primary font-semibold",children:['Review System Prompt "',t.name,'"']}),t.creatorUsername&&e.jsxs("p",{className:"text-white/60 light:text-theme-text-secondary text-xs font-mono",children:["Created by"," ",e.jsxs("a",{href:p.communityHub.profile(t.creatorUsername),target:"_blank",className:"hover:text-blue-500 hover:underline",rel:"noreferrer",children:["@",t.creatorUsername]})]})]}),e.jsxs("div",{className:"flex flex-col gap-y-[25px] text-white/80 light:text-theme-text-secondary text-sm",children:[e.jsx("p",{children:"System prompts are used to guide the behavior of the AI agents and can be applied to any existing workspace."}),e.jsxs("div",{className:"flex flex-col gap-y-2",children:[e.jsx("p",{className:"text-white/60 light:text-theme-text-secondary font-semibold",children:"Provided system prompt:"}),e.jsx("div",{className:"w-full text-theme-text-primary text-md flex flex-col max-h-[calc(300px)] overflow-y-auto",children:e.jsx("p",{className:"text-white/60 light:text-theme-text-secondary font-mono bg-zinc-900 light:bg-slate-200 px-2 py-1 rounded-md text-sm whitespace-pre-line",children:t.prompt})})]}),e.jsxs("div",{className:"flex flex-col w-60",children:[e.jsx("label",{className:"text-theme-text-primary text-sm font-semibold block mb-3",children:"Apply to Workspace"}),e.jsx("select",{name:"destinationWorkspaceSlug",required:!0,onChange:o=>n(o.target.value),className:"border-none bg-theme-settings-input-bg border-gray-500 text-white text-sm rounded-lg block w-full p-2.5",children:e.jsx("optgroup",{label:"Available workspaces",children:a.map(o=>e.jsx("option",{value:o.slug,children:o.name},o.id))})})]})]}),s&&e.jsx(h,{className:"text-dark-text w-full mt-[18px] h-[34px] hover:bg-accent",onClick:r,children:"Apply system prompt to workspace"})]})}function M({item:t,setStep:l}){async function s(){try{const{error:n}=await f.applyItem(t.importId);if(n)throw new Error(n);d(`Slash command ${t.command} imported successfully!`,"success"),l(x.completed.key)}catch(n){console.error(n),d(`Failed to import slash command. ${n.message}`,"error")}}return e.jsxs("div",{className:"flex flex-col mt-4 gap-y-4",children:[e.jsxs("div",{className:"flex flex-col gap-y-1",children:[e.jsxs("h2",{className:"text-base text-theme-text-primary font-semibold",children:['Review Slash Command "',t.name,'"']}),t.creatorUsername&&e.jsxs("p",{className:"text-white/60 text-xs font-mono",children:["Created by"," ",e.jsxs("a",{href:p.communityHub.profile(t.creatorUsername),target:"_blank",className:"hover:text-blue-500 hover:underline",rel:"noreferrer",children:["@",t.creatorUsername]})]})]}),e.jsxs("div",{className:"flex flex-col gap-y-[25px] text-white/80 light:text-theme-text-secondary text-sm",children:[e.jsxs("p",{children:["Slash commands are used to prefill information into a prompt while chatting with a AnythingLLM workspace.",e.jsx("br",{}),e.jsx("br",{}),"The slash command will be available during chatting by simply invoking it with"," ",e.jsx("code",{className:"font-mono bg-zinc-900 light:bg-slate-200 px-1 py-0.5 rounded-md text-sm",children:t.command})," ","like you would any other command."]}),e.jsxs("div",{className:"flex flex-col gap-y-2 mt-2",children:[e.jsx("div",{className:"w-full text-theme-text-primary text-md gap-x-2 flex items-center",children:e.jsx("p",{className:"text-white/60 light:text-theme-text-secondary w-fit font-mono bg-zinc-900 light:bg-slate-200 px-2 py-1 rounded-md text-sm whitespace-pre-line",children:t.command})}),e.jsx("div",{className:"w-full text-theme-text-primary text-md flex flex-col gap-y-2",children:e.jsx("p",{className:"text-white/60 light:text-theme-text-secondary font-mono bg-zinc-900 light:bg-slate-200 p-4 rounded-md text-sm whitespace-pre-line max-h-[calc(200px)] overflow-y-auto",children:t.prompt})})]})]}),e.jsx(h,{className:"text-dark-text w-full mt-[18px] h-[34px] hover:bg-accent",onClick:s,children:"Import slash command"})]})}function $({item:t,setSettings:l,setStep:s}){return e.jsxs("div",{className:"flex flex-col mt-4 gap-y-4",children:[e.jsxs("div",{className:"w-full flex items-center gap-x-2",children:[e.jsx(w,{size:24,className:"text-red-500"}),e.jsx("h2",{className:"text-base text-red-500 font-semibold",children:"Unsupported item"})]}),e.jsxs("div",{className:"flex flex-col gap-y-[25px] text-white/80 text-sm",children:[e.jsx("p",{children:"We found an item in the community hub, but we don't know what it is or it is not yet supported for import into AnythingLLM."}),e.jsxs("p",{children:["The item ID is: ",e.jsx("b",{children:t.id}),e.jsx("br",{}),"The item type is: ",e.jsx("b",{children:t.itemType})]}),e.jsx("p",{children:"Please contact support via email if you need help importing this item."})]}),e.jsx(h,{className:"text-dark-text w-full mt-[18px] h-[34px] hover:bg-accent",onClick:()=>{l({itemId:null,item:null}),s(x.itemId.key)},children:"Try another item"})]})}function D({item:t,settings:l,setStep:s}){const[n,a]=c.useState(!1);async function i(){try{a(!0);const{error:r}=await f.importBundleItem(l.itemId);if(r)throw new Error(r);d("Agent skill imported successfully!","success"),s(x.completed.key)}catch(r){console.error(r),d(`Failed to import agent skill. ${r.message}`,"error")}finally{a(!1)}}return c.useEffect(()=>{E()},[]),e.jsxs("div",{className:"flex flex-col mt-4 gap-y-4",children:[e.jsx("div",{className:"border border-white/10 light:border-orange-500/20 my-2 flex flex-col md:flex-row md:items-center gap-x-2 text-theme-text-primary light:text-orange-600 mb-4 bg-orange-800/30 light:bg-orange-500/10 rounded-lg px-4 py-2",children:e.jsxs("div",{className:"flex flex-col gap-y-2",children:[e.jsxs("div",{className:"gap-x-2 flex items-center",children:[e.jsx(w,{size:25}),e.jsxs("h1",{className:"text-lg font-semibold",children:[" ","Only import agent skills you trust"," "]})]}),e.jsx("p",{className:"text-sm",children:"Agent skills can execute code on your AnythingLLM instance, so only import agent skills from sources you trust. You should also review the code before importing. If you are unsure about what a skill does - don't import it!"})]})}),e.jsxs("div",{className:"flex flex-col gap-y-1",children:[e.jsxs("h2",{className:"text-base text-theme-text-primary font-semibold",children:['Review Agent Skill "',t.name,'"']}),t.creatorUsername&&e.jsxs("p",{className:"text-white/60 light:text-theme-text-secondary text-xs font-mono",children:["Created by"," ",e.jsxs("a",{href:p.communityHub.profile(t.creatorUsername),target:"_blank",className:"hover:text-blue-500 hover:underline",rel:"noreferrer",children:["@",t.creatorUsername]})]}),e.jsxs("div",{className:"flex gap-x-1",children:[t.verified?e.jsx("p",{className:"text-green-500 text-xs font-mono",children:"Verified code"}):e.jsx("p",{className:"text-red-500 text-xs font-mono",children:"This skill is not verified."}),e.jsx("a",{href:"https://docs.anythingllm.com/community-hub/faq#verification",target:"_blank",className:"text-xs font-mono text-blue-500 hover:underline",rel:"noreferrer",children:"Learn more →"})]})]}),e.jsx("div",{className:"flex flex-col gap-y-[25px] text-white/80 light:text-theme-text-secondary text-sm",children:e.jsxs("p",{children:["Agent skills unlock new capabilities for your AnythingLLM workspace via"," ",e.jsx("code",{className:"font-mono bg-zinc-900 light:bg-slate-200 px-1 py-0.5 rounded-md text-sm",children:"@agent"})," ","skills that can do specific tasks when invoked."]})}),e.jsx(W,{item:t}),e.jsxs(h,{disabled:n,className:"text-dark-text w-full mt-[18px] h-[34px] hover:bg-accent",onClick:i,children:[n?e.jsx(v,{size:16,className:"animate-spin"}):null,n?"Importing...":"Import agent skill"]})]})}function W({item:t}){const l=t.manifest.files||[],[s,n]=c.useState(0),[a,i]=c.useState(l[s]);function r(){s>0&&n(s-1)}function o(){s<l.length-1&&n(s+1)}function m(u){switch(u.name.split(".").pop()){case"js":return"javascript";case"json":return"json";case"md":return"markdown";default:return"text"}}return c.useEffect(()=>{l.length>0&&i((l==null?void 0:l[s])||l[0])},[s]),a?e.jsx("div",{className:"flex flex-col gap-y-2",children:e.jsxs("div",{className:"flex flex-col gap-y-2",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("button",{type:"button",className:`border-none bg-black/70 light:bg-slate-200 rounded-md p-1 text-white/60 light:text-theme-text-secondary text-xs font-mono ${s===0?"opacity-50 cursor-not-allowed":""}`,onClick:r,children:e.jsx(S,{size:16})}),e.jsxs("p",{className:"text-white/60 light:text-theme-text-secondary text-xs font-mono",children:[a.name," (",s+1," of ",l.length," files)"]}),e.jsx("button",{type:"button",className:`border-none bg-black/70 light:bg-slate-200 rounded-md p-1 text-white/60 light:text-theme-text-secondary text-xs font-mono ${s===l.length-1?"opacity-50 cursor-not-allowed":""}`,onClick:o,children:e.jsx(C,{size:16})})]}),e.jsx("span",{className:"whitespace-pre-line flex flex-col gap-y-1 text-sm leading-[20px] max-h-[500px] overflow-y-auto hljs text-theme-text-primary",dangerouslySetInnerHTML:{__html:P.sanitize(H(`\`\`\`${m(a)}
2
+ ${m(a)==="markdown"?a.content.replace(/```/g,"~~~"):a.content}
3
+ \`\`\``))}})]})}):null}function R({item:t,setStep:l}){const s=A(t.flow,{steps:[]}),[n,a]=c.useState(!1);async function i(){try{a(!0);const{success:r,error:o,flow:m}=await b.saveFlow(t.name,s);if(!r)throw new Error(o);m!=null&&m.uuid&&await b.toggleFlow(m.uuid,!0),d("Agent flow imported successfully!","success"),l(x.completed.key)}catch(r){console.error(r),d(`Failed to import agent flow. ${r.message}`,"error")}finally{a(!1)}}return e.jsxs("div",{className:"flex flex-col mt-4 gap-y-4",children:[e.jsxs("div",{className:"flex flex-col gap-y-1",children:[e.jsxs("h2",{className:"text-base text-theme-text-primary font-semibold",children:['Import Agent Flow "',t.name,'"']}),t.creatorUsername&&e.jsxs("p",{className:"text-white/60 light:text-theme-text-secondary text-xs font-mono",children:["Created by"," ",e.jsxs("a",{href:p.communityHub.profile(t.creatorUsername),target:"_blank",className:"hover:text-blue-500 hover:underline",rel:"noreferrer",children:["@",t.creatorUsername]})]})]}),e.jsxs("div",{className:"flex flex-col gap-y-[25px] text-white/80 light:text-theme-text-secondary text-sm",children:[e.jsx("p",{children:"Agent flows allow you to create reusable sequences of actions that can be triggered by your agent."}),e.jsxs("div",{className:"flex flex-col gap-y-2",children:[e.jsx("p",{className:"font-semibold",children:"Flow Details:"}),e.jsxs("p",{children:["Description: ",t.description]}),e.jsxs("p",{className:"font-semibold",children:["Steps (",s.steps.length,"):"]}),e.jsx("ul",{className:"list-disc pl-6",children:s.steps.map((r,o)=>e.jsx("li",{children:r.type},o))})]})]}),e.jsxs(h,{disabled:n,className:"text-dark-text w-full mt-[18px] h-[34px] hover:bg-accent",onClick:i,children:[n?e.jsx(v,{size:16,className:"animate-spin"}):null,n?"Importing...":"Import agent flow"]})]})}const j={"agent-skill":D,"system-prompt":z,"slash-command":M,"agent-flow":R,unknown:$};function _({importId:t,updateSettings:l}){const[s,n]=c.useState(null),[a,i]=c.useState(!1),[r,o]=c.useState(null);return c.useEffect(()=>{async function m(){if(!t)return;i(!0),await new Promise(g=>setTimeout(g,2e3));const{error:u,item:y}=await f.getItemFromImportId(t);u&&o(u),n(y),l(g=>({...g,item:y})),i(!1)}m()},[t]),{item:s,loading:a,error:r}}function O({settings:t,setSettings:l,setStep:s}){const{item:n,loading:a,error:i}=_({importId:t.itemId,updateSettings:l}),r=j[n==null?void 0:n.itemType]||j.unknown;return e.jsx("div",{className:"flex-[2] flex flex-col gap-y-[18px] mt-10",children:e.jsx("div",{className:"bg-theme-bg-secondary rounded-xl flex-1 p-6",children:e.jsxs("div",{className:"w-full flex flex-col gap-y-2 max-w-[700px]",children:[e.jsx("h2",{className:"text-base text-theme-text-primary font-semibold",children:"Review item"}),a&&e.jsx("div",{className:"flex h-[200px] w-full rounded-lg animate-pulse",children:e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("p",{className:"text-sm text-theme-text-secondary",children:"Pulling item details from community hub..."})})}),!a&&i&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-y-2 mt-8",children:[e.jsx("p",{className:"text-red-500",children:"An error occurred while fetching the item. Please try again later."}),e.jsx("p",{className:"text-red-500/80 text-sm font-mono",children:i})]}),e.jsx(h,{className:"text-dark-text w-full mt-[18px] h-[34px] hover:bg-accent",onClick:()=>{l({itemId:null,item:null}),s(x.itemId.key)},children:"Try another item"})]}),!a&&!i&&n&&e.jsx(r,{item:n,settings:t,setSettings:l,setStep:s})]})})})}function q({settings:t,setSettings:l,setStep:s}){return e.jsx("div",{className:"flex-[2] flex flex-col gap-y-[18px] mt-10",children:e.jsx("div",{className:"bg-theme-bg-secondary rounded-xl flex-1 p-6",children:e.jsxs("div",{className:"w-full flex flex-col gap-y-2 max-w-[700px]",children:[e.jsx("h2",{className:"text-base text-theme-text-primary font-semibold",children:"Community Hub Item Imported"}),e.jsxs("div",{className:"flex flex-col gap-y-[25px] text-theme-text-secondary text-sm",children:[e.jsxs("p",{children:['The "',t.item.name,'" ',t.item.itemType," has been imported successfully! It is now available in your AnythingLLM instance."]}),t.item.itemType==="agent-flow"&&e.jsxs(L,{to:p.settings.agentSkills(),className:"text-theme-text-primary hover:text-blue-500 hover:underline",children:['View "',t.item.name,'" in Agent Skills']}),e.jsxs("p",{children:["Any changes you make to this ",t.item.itemType," will not be reflected in the community hub. You can now modify as needed."]})]}),e.jsx(h,{className:"text-dark-text w-full mt-[18px] h-[34px] hover:bg-accent",onClick:()=>{l({item:null,itemId:null}),s(x.itemId.key)},children:"Import another item"})]})})})}const k={itemId:{key:"itemId",name:"1. Paste in Item ID",next:()=>"validation",component:({settings:t,setSettings:l,setStep:s})=>e.jsx(U,{settings:t,setSettings:l,setStep:s})},validation:{key:"validation",name:"2. Review item",next:()=>"completed",component:({settings:t,setSettings:l,setStep:s})=>e.jsx(O,{settings:t,setSettings:l,setStep:s})},completed:{key:"completed",name:"3. Completed",component:({settings:t,setSettings:l,setStep:s})=>e.jsx(q,{settings:t,setSettings:l,setStep:s})}};function B({setStep:t,children:l}){const s=T(),[n,a]=c.useState({itemId:null,item:null});return c.useEffect(()=>{function i(){s.get("id")&&(a({itemId:s.get("id")}),t(k.itemId.next()))}i()},[]),e.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex",children:[e.jsx(F,{}),e.jsx("div",{style:{height:N?"100%":"calc(100% - 32px)"},className:"relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] w-full h-full overflow-y-scroll p-4 md:p-0",children:l(n,a,t)})]})}const x=k;function J({setStep:t,currentStep:l}){const s=Object.keys(x).indexOf(l);return e.jsx("div",{className:`bg-white/5 light:bg-white text-theme-text-primary rounded-xl py-1 px-4 shadow-lg ${N?"w-full":"min-w-[360px] w-fit"}`,children:Object.entries(x).map(([n,a],i)=>{const r=l===n,o=i===Object.keys(x).length-1,m=s===Object.keys(x).length-1||i<s;return e.jsxs("div",{className:["py-3 flex items-center justify-between transition-all duration-300",r?"rounded-t-xl":"",o?"":"border-b border-white/10 light:border-[#026AA2]/10"].join(" "),children:[m||r?e.jsx("button",{onClick:()=>t(n),className:"border-none hover:underline text-sm font-medium text-theme-text-primary",children:a.name}):e.jsx("div",{className:"text-sm text-theme-text-secondary font-medium",children:a.name}),e.jsx("div",{className:"flex items-center gap-x-2",children:m?e.jsx("div",{className:"w-[14px] h-[14px] rounded-full border border-[#32D583] flex items-center justify-center",children:e.jsx("div",{className:"w-[5.6px] h-[5.6px] rounded-full bg-[#6CE9A6]"})}):e.jsx("div",{className:`w-[14px] h-[14px] rounded-full border border-theme-text-primary ${r?"animate-pulse":"opacity-50"}`})})]},n)})})}function we(){const[t,l]=c.useState("itemId"),s=x.hasOwnProperty(t)?x[t]:x.itemId;return e.jsx(B,{setStep:l,children:(n,a,i)=>e.jsxs("div",{className:"flex flex-col w-full px-1 md:px-6 2xl:pr-[86px] md:py-6 py-16",children:[e.jsxs("div",{className:"w-full flex flex-col gap-y-1 pb-6 border-white light:border-theme-sidebar-border border-b-2 border-opacity-10",children:[e.jsx("div",{className:"items-center",children:e.jsx("p",{className:"text-lg leading-6 font-bold text-theme-text-primary",children:"Import a Community Item"})}),e.jsx("p",{className:"text-xs leading-[18px] font-base text-theme-text-secondary",children:"Import items from the AnythingLLM Community Hub to enhance your instance with community-created prompts, skills, and commands."})]}),e.jsxs("div",{className:"flex-1 flex flex-col 2xl:flex-row h-full",children:[e.jsx("div",{className:"flex flex-col gap-y-[18px] mt-10 w-full 2xl:w-[360px] 2xl:flex-shrink-0",children:e.jsx(J,{setStep:i,currentStep:t})}),e.jsx("div",{className:"flex-1 min-w-0 overflow-y-auto pb-[200px] 2xl:h-screen no-scroll",children:e.jsx("div",{className:"2xl:ml-8",children:s.component({settings:n,setSettings:a,setStep:i})})})]})]})})}export{we as default};
@@ -1,4 +1,4 @@
1
- import{A as b,m as f,r,j as e,aU as k,c as w,aY as N,k as C,aZ as v,q as E,$ as K,i as S,C as I,S as P,M,a5 as j}from"../index.js";import{C as B}from"./PlusCircle-31c6a8d8.js";import{w as T}from"./Check-7e83fb0d.js";import{C as $}from"./Copy-d323e545.js";import{w as L}from"./Plug-7d951c7d.js";const R={getAll:async()=>await fetch(`${b}/browser-extension/api-keys`,{method:"GET",headers:f()}).then(t=>t.json()).catch(t=>(console.error(t),{success:!1,error:t.message,apiKeys:[]})),generateKey:async()=>await fetch(`${b}/browser-extension/api-keys/new`,{method:"POST",headers:f()}).then(t=>t.json()).catch(t=>(console.error(t),{success:!1,error:t.message})),revoke:async t=>await fetch(`${b}/browser-extension/api-keys/${t}`,{method:"DELETE",headers:f()}).then(o=>o.json()).catch(o=>(console.error(o),{success:!1,error:o.message}))},g=R;function O({apiKey:t,removeApiKey:o,connectionString:a,isMultiUser:n}){const d=r.useRef(null),[x,c]=r.useState(!1),l=async()=>{if(!window.confirm(`Are you sure you want to revoke this browser extension API key?
1
+ import{A as b,m as f,r,j as e,aW as k,c as w,a_ as N,k as C,a$ as v,q as E,a1 as K,i as S,C as I,S as P,M,a7 as j}from"../index.js";import{C as B}from"./PlusCircle-31c6a8d8.js";import{w as T}from"./Check-7e83fb0d.js";import{C as $}from"./Copy-d323e545.js";import{w as L}from"./Plug-7d951c7d.js";const R={getAll:async()=>await fetch(`${b}/browser-extension/api-keys`,{method:"GET",headers:f()}).then(t=>t.json()).catch(t=>(console.error(t),{success:!1,error:t.message,apiKeys:[]})),generateKey:async()=>await fetch(`${b}/browser-extension/api-keys/new`,{method:"POST",headers:f()}).then(t=>t.json()).catch(t=>(console.error(t),{success:!1,error:t.message})),revoke:async t=>await fetch(`${b}/browser-extension/api-keys/${t}`,{method:"DELETE",headers:f()}).then(o=>o.json()).catch(o=>(console.error(o),{success:!1,error:o.message}))},g=R;function _({apiKey:t,removeApiKey:o,connectionString:a,isMultiUser:n}){const d=r.useRef(null),[x,c]=r.useState(!1),l=async()=>{if(!window.confirm(`Are you sure you want to revoke this browser extension API key?
2
2
  After you do this it will no longer be useable.
3
3
 
4
- This action is irreversible.`))return!1;(await g.revoke(t.id)).success?(o(t.id),w("Browser Extension API Key permanently revoked","info",{clear:!0})):w("Failed to revoke API Key","error",{clear:!0})},m=()=>{navigator.clipboard.writeText(a),w("Connection string copied to clipboard","success",{clear:!0}),c(!0),setTimeout(()=>c(!1),2e3)},i=()=>{window.postMessage({type:N,apiKey:a},"*"),w("Attempting to connect to browser extension...","info",{clear:!0})};return e.jsxs("tr",{ref:d,className:"bg-transparent text-white text-opacity-80 text-xs font-medium border-b border-white/10 h-10",children:[e.jsx("td",{scope:"row",className:"px-6 py-2 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("span",{className:"mr-2 font-mono",children:a}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:m,"data-tooltip-id":"copy-connection-text","data-tooltip-content":"Copy connection string",className:"border-none text-theme-text-primary hover:text-theme-text-secondary transition-colors duration-200 p-1 rounded",children:x?e.jsx(T,{className:"h-4 w-4 text-green-500"}):e.jsx($,{className:"h-4 w-4"})}),e.jsx("button",{onClick:i,"data-tooltip-id":"auto-connection","data-tooltip-content":"Automatically connect to extension",className:"border-none text-theme-text-primary hover:text-theme-text-secondary transition-colors duration-200 p-1 rounded",children:e.jsx(L,{className:"h-4 w-4"})})]})]})}),n&&e.jsx("td",{className:"px-6 py-2",children:t.user?t.user.username:"N/A"}),e.jsx("td",{className:"px-6 py-2",children:new Date(t.createdAt).toLocaleString()}),e.jsx("td",{className:"px-6 py-2",children:e.jsx("button",{onClick:l,className:"text-xs font-medium text-white/80 light:text-black/80 hover:light:text-red-500 hover:text-red-300 rounded-lg px-2 py-1 hover:bg-white hover:light:bg-red-50 hover:bg-opacity-10",children:e.jsx(k,{className:"h-4 w-4"})})})]})}function U({closeModal:t,onSuccess:o,isMultiUser:a}){const[n,d]=r.useState(null),[x,c]=r.useState(null),[l,m]=r.useState(!1),i=async h=>{c(null),h.preventDefault();const{apiKey:y,error:s}=await g.generateKey();if(y){const p=`${v()}|${y}`;d(p),o(),window.postMessage({type:N,apiKey:p},"*")}c(s)},u=()=>{if(!n)return!1;window.navigator.clipboard.writeText(n),m(!0)};return r.useEffect(()=>{function h(){if(!l)return!1;setTimeout(()=>{m(!1)},3e3)}h()},[l]),e.jsx("div",{className:"fixed inset-0 z-50 overflow-auto bg-black bg-opacity-50 flex items-center justify-center",children:e.jsxs("div",{className:"relative w-full max-w-2xl bg-theme-bg-secondary rounded-lg shadow border-2 border-theme-modal-border",children:[e.jsxs("div",{className:"relative p-6 border-b rounded-t border-theme-modal-border",children:[e.jsx("div",{className:"w-full flex gap-x-2 items-center",children:e.jsx("h3",{className:"text-xl font-semibold text-white overflow-hidden overflow-ellipsis whitespace-nowrap",children:"New Browser Extension API Key"})}),e.jsx("button",{onClick:t,type:"button",className:"absolute top-4 right-4 transition-all duration-300 bg-transparent rounded-lg text-sm p-1 inline-flex items-center hover:bg-theme-modal-border hover:border-theme-modal-border hover:border-opacity-50 border-transparent border",children:e.jsx(C,{size:24,weight:"bold",className:"text-white"})})]}),e.jsx("div",{className:"px-7 py-6",children:e.jsxs("form",{onSubmit:i,children:[e.jsxs("div",{className:"space-y-6 max-h-[60vh] overflow-y-auto pr-2",children:[x&&e.jsxs("p",{className:"text-red-400 text-sm",children:["Error: ",x]}),n&&e.jsx("input",{type:"text",defaultValue:n,disabled:!0,className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg block w-full p-2.5"}),a&&e.jsx("p",{className:"text-yellow-300 light:text-orange-500 text-xs md:text-sm font-semibold",children:"Warning: You are in multi-user mode, this API key will allow access to all workspaces associated with your account. Please share it cautiously."}),e.jsx("p",{className:"text-white text-opacity-60 text-xs md:text-sm",children:'After clicking "Create API Key", AnythingLLM will attempt to connect to your browser extension automatically.'}),e.jsx("p",{className:"text-white text-opacity-60 text-xs md:text-sm",children:'If you see "Connected to AnythingLLM" in the extension, the connection was successful. If not, please copy the connection string and paste it into the extension manually.'})]}),e.jsx("div",{className:"flex justify-between items-center mt-6 pt-6 border-t border-theme-modal-border",children:n?e.jsx("button",{onClick:u,type:"button",disabled:l,className:"w-full transition-all duration-300 bg-white text-black hover:opacity-60 px-4 py-2 rounded-lg text-sm cursor-pointer",children:l?"API Key Copied!":"Copy API Key"}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:t,type:"button",className:"transition-all duration-300 text-white hover:bg-zinc-700 px-4 py-2 rounded-lg text-sm",children:"Cancel"}),e.jsx("button",{type:"submit",className:"transition-all duration-300 bg-white text-black hover:opacity-60 px-4 py-2 rounded-lg text-sm",children:"Create API Key"})]})})]})})]})})}function G(){const[t,o]=r.useState(!0),[a,n]=r.useState([]),[d,x]=r.useState(null),{isOpen:c,openModal:l,closeModal:m}=E(),[i,u]=r.useState(!1);r.useEffect(()=>{h()},[]);const h=async()=>{const s=await g.getAll();s.success?(n(s.apiKeys),u(s.apiKeys.some(p=>p.user!==null))):x(s.error||"Failed to fetch API keys"),o(!1)},y=s=>{n(p=>p.filter(A=>A.id!==s))};return e.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex",children:[e.jsx(K,{}),e.jsx("div",{style:{height:S?"100%":"calc(100% - 32px)"},className:"relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-theme-bg-secondary w-full h-full overflow-y-scroll p-4 md:p-0",children:e.jsxs("div",{className:"flex flex-col w-full px-1 md:pl-6 md:pr-[50px] md:py-6 py-16",children:[e.jsxs("div",{className:"w-full flex flex-col gap-y-1 pb-6 border-white/10 border-b-2",children:[e.jsx("div",{className:"items-center flex gap-x-4",children:e.jsx("p",{className:"text-lg leading-6 font-bold text-theme-text-primary",children:"Browser Extension API Keys"})}),e.jsx("p",{className:"text-xs leading-[18px] font-base text-theme-text-secondary mt-2",children:"Manage API keys for browser extensions connecting to your AnythingLLM instance."})]}),e.jsx("div",{className:"w-full justify-end flex",children:e.jsxs(I,{onClick:l,className:"mt-3 mr-0 mb-4 md:-mb-14 z-10",children:[e.jsx(B,{className:"h-4 w-4",weight:"bold"}),"Generate New API Key"]})}),e.jsx("div",{className:"overflow-x-auto mt-6",children:t?e.jsx(P,{height:"80vh",width:"100%",highlightColor:"var(--theme-bg-primary)",baseColor:"var(--theme-bg-secondary)",count:1,className:"w-full p-4 rounded-b-2xl rounded-tr-2xl rounded-tl-sm",containerClassName:"flex w-full"}):d?e.jsxs("div",{className:"text-red-500 mt-6",children:["Error: ",d]}):e.jsxs("table",{className:"w-full text-xs text-left rounded-lg min-w-[640px] border-spacing-0 md:mt-6 mt-0",children:[e.jsx("thead",{className:"text-theme-text-secondary text-xs leading-[18px] font-bold uppercase border-white/10 border-b",children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"px-6 py-2 rounded-tl-lg",children:"Extension Connection String"}),i&&e.jsx("th",{scope:"col",className:"px-6 py-2",children:"Created By"}),e.jsx("th",{scope:"col",className:"px-6 py-2",children:"Created At"}),e.jsx("th",{scope:"col",className:"px-6 py-2 rounded-tr-lg",children:"Actions"})]})}),e.jsx("tbody",{children:a.length===0?e.jsx("tr",{className:"bg-transparent text-theme-text-secondary text-sm font-medium",children:e.jsx("td",{colSpan:i?"4":"3",className:"px-6 py-4 text-center",children:"No API keys found"})}):a.map(s=>e.jsx(O,{apiKey:s,removeApiKey:y,connectionString:`${v()}|${s.key}`,isMultiUser:i},s.id))})]})})]})}),e.jsx(M,{isOpen:c,children:e.jsx(U,{closeModal:m,onSuccess:h,isMultiUser:i})}),e.jsx(j,{id:"auto-connection",place:"bottom",delayShow:300,className:"allm-tooltip !allm-text-xs"}),e.jsx(j,{id:"copy-connection-text",place:"bottom",delayShow:300,className:"allm-tooltip !allm-text-xs"})]})}export{G as default};
4
+ This action is irreversible.`))return!1;(await g.revoke(t.id)).success?(o(t.id),w("Browser Extension API Key permanently revoked","info",{clear:!0})):w("Failed to revoke API Key","error",{clear:!0})},m=()=>{navigator.clipboard.writeText(a),w("Connection string copied to clipboard","success",{clear:!0}),c(!0),setTimeout(()=>c(!1),2e3)},i=()=>{window.postMessage({type:N,apiKey:a},"*"),w("Attempting to connect to browser extension...","info",{clear:!0})};return e.jsxs("tr",{ref:d,className:"bg-transparent text-white text-opacity-80 text-xs font-medium border-b border-white/10 h-10",children:[e.jsx("td",{scope:"row",className:"px-6 py-2 whitespace-nowrap",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("span",{className:"mr-2 font-mono",children:a}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("button",{onClick:m,"data-tooltip-id":"copy-connection-text","data-tooltip-content":"Copy connection string",className:"border-none text-theme-text-primary hover:text-theme-text-secondary transition-colors duration-200 p-1 rounded",children:x?e.jsx(T,{className:"h-4 w-4 text-green-500"}):e.jsx($,{className:"h-4 w-4"})}),e.jsx("button",{onClick:i,"data-tooltip-id":"auto-connection","data-tooltip-content":"Automatically connect to extension",className:"border-none text-theme-text-primary hover:text-theme-text-secondary transition-colors duration-200 p-1 rounded",children:e.jsx(L,{className:"h-4 w-4"})})]})]})}),n&&e.jsx("td",{className:"px-6 py-2",children:t.user?t.user.username:"N/A"}),e.jsx("td",{className:"px-6 py-2",children:new Date(t.createdAt).toLocaleString()}),e.jsx("td",{className:"px-6 py-2",children:e.jsx("button",{onClick:l,className:"text-xs font-medium text-white/80 light:text-black/80 hover:light:text-red-500 hover:text-red-300 rounded-lg px-2 py-1 hover:bg-white hover:light:bg-red-50 hover:bg-opacity-10",children:e.jsx(k,{className:"h-4 w-4"})})})]})}function O({closeModal:t,onSuccess:o,isMultiUser:a}){const[n,d]=r.useState(null),[x,c]=r.useState(null),[l,m]=r.useState(!1),i=async h=>{c(null),h.preventDefault();const{apiKey:y,error:s}=await g.generateKey();if(y){const p=`${v()}|${y}`;d(p),o(),window.postMessage({type:N,apiKey:p},"*")}c(s)},u=()=>{if(!n)return!1;window.navigator.clipboard.writeText(n),m(!0)};return r.useEffect(()=>{function h(){if(!l)return!1;setTimeout(()=>{m(!1)},3e3)}h()},[l]),e.jsx("div",{className:"fixed inset-0 z-50 overflow-auto bg-black bg-opacity-50 flex items-center justify-center",children:e.jsxs("div",{className:"relative w-full max-w-2xl bg-theme-bg-secondary rounded-lg shadow border-2 border-theme-modal-border",children:[e.jsxs("div",{className:"relative p-6 border-b rounded-t border-theme-modal-border",children:[e.jsx("div",{className:"w-full flex gap-x-2 items-center",children:e.jsx("h3",{className:"text-xl font-semibold text-white overflow-hidden overflow-ellipsis whitespace-nowrap",children:"New Browser Extension API Key"})}),e.jsx("button",{onClick:t,type:"button",className:"absolute top-4 right-4 transition-all duration-300 bg-transparent rounded-lg text-sm p-1 inline-flex items-center hover:bg-theme-modal-border hover:border-theme-modal-border hover:border-opacity-50 border-transparent border",children:e.jsx(C,{size:24,weight:"bold",className:"text-white"})})]}),e.jsx("div",{className:"px-7 py-6",children:e.jsxs("form",{onSubmit:i,children:[e.jsxs("div",{className:"space-y-6 max-h-[60vh] overflow-y-auto pr-2",children:[x&&e.jsxs("p",{className:"text-red-400 text-sm",children:["Error: ",x]}),n&&e.jsx("input",{type:"text",defaultValue:n,disabled:!0,className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg block w-full p-2.5"}),a&&e.jsx("p",{className:"text-yellow-300 light:text-orange-500 text-xs md:text-sm font-semibold",children:"Warning: You are in multi-user mode, this API key will allow access to all workspaces associated with your account. Please share it cautiously."}),e.jsx("p",{className:"text-white text-opacity-60 text-xs md:text-sm",children:'After clicking "Create API Key", AnythingLLM will attempt to connect to your browser extension automatically.'}),e.jsx("p",{className:"text-white text-opacity-60 text-xs md:text-sm",children:'If you see "Connected to AnythingLLM" in the extension, the connection was successful. If not, please copy the connection string and paste it into the extension manually.'})]}),e.jsx("div",{className:"flex justify-between items-center mt-6 pt-6 border-t border-theme-modal-border",children:n?e.jsx("button",{onClick:u,type:"button",disabled:l,className:"w-full transition-all duration-300 bg-white text-black hover:opacity-60 px-4 py-2 rounded-lg text-sm cursor-pointer",children:l?"API Key Copied!":"Copy API Key"}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:t,type:"button",className:"transition-all duration-300 text-white hover:bg-zinc-700 px-4 py-2 rounded-lg text-sm",children:"Cancel"}),e.jsx("button",{type:"submit",className:"transition-all duration-300 bg-white text-black hover:opacity-60 px-4 py-2 rounded-lg text-sm",children:"Create API Key"})]})})]})})]})})}function G(){const[t,o]=r.useState(!0),[a,n]=r.useState([]),[d,x]=r.useState(null),{isOpen:c,openModal:l,closeModal:m}=E(),[i,u]=r.useState(!1);r.useEffect(()=>{h()},[]);const h=async()=>{const s=await g.getAll();s.success?(n(s.apiKeys),u(s.apiKeys.some(p=>p.user!==null))):x(s.error||"Failed to fetch API keys"),o(!1)},y=s=>{n(p=>p.filter(A=>A.id!==s))};return e.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex",children:[e.jsx(K,{}),e.jsx("div",{style:{height:S?"100%":"calc(100% - 32px)"},className:"relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-theme-bg-secondary w-full h-full overflow-y-scroll p-4 md:p-0",children:e.jsxs("div",{className:"flex flex-col w-full px-1 md:pl-6 md:pr-[50px] md:py-6 py-16",children:[e.jsxs("div",{className:"w-full flex flex-col gap-y-1 pb-6 border-white/10 border-b-2",children:[e.jsx("div",{className:"items-center flex gap-x-4",children:e.jsx("p",{className:"text-lg leading-6 font-bold text-theme-text-primary",children:"Browser Extension API Keys"})}),e.jsx("p",{className:"text-xs leading-[18px] font-base text-theme-text-secondary mt-2",children:"Manage API keys for browser extensions connecting to your AnythingLLM instance."})]}),e.jsx("div",{className:"w-full justify-end flex",children:e.jsxs(I,{onClick:l,className:"mt-3 mr-0 mb-4 md:-mb-14 z-10",children:[e.jsx(B,{className:"h-4 w-4",weight:"bold"}),"Generate New API Key"]})}),e.jsx("div",{className:"overflow-x-auto mt-6",children:t?e.jsx(P,{height:"80vh",width:"100%",highlightColor:"var(--theme-bg-primary)",baseColor:"var(--theme-bg-secondary)",count:1,className:"w-full p-4 rounded-b-2xl rounded-tr-2xl rounded-tl-sm",containerClassName:"flex w-full"}):d?e.jsxs("div",{className:"text-red-500 mt-6",children:["Error: ",d]}):e.jsxs("table",{className:"w-full text-xs text-left rounded-lg min-w-[640px] border-spacing-0 md:mt-6 mt-0",children:[e.jsx("thead",{className:"text-theme-text-secondary text-xs leading-[18px] font-bold uppercase border-white/10 border-b",children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"px-6 py-2 rounded-tl-lg",children:"Extension Connection String"}),i&&e.jsx("th",{scope:"col",className:"px-6 py-2",children:"Created By"}),e.jsx("th",{scope:"col",className:"px-6 py-2",children:"Created At"}),e.jsx("th",{scope:"col",className:"px-6 py-2 rounded-tr-lg",children:"Actions"})]})}),e.jsx("tbody",{children:a.length===0?e.jsx("tr",{className:"bg-transparent text-theme-text-secondary text-sm font-medium",children:e.jsx("td",{colSpan:i?"4":"3",className:"px-6 py-4 text-center",children:"No API keys found"})}):a.map(s=>e.jsx(_,{apiKey:s,removeApiKey:y,connectionString:`${v()}|${s.key}`,isMultiUser:i},s.id))})]})})]})}),e.jsx(M,{isOpen:c,children:e.jsx(O,{closeModal:m,onSuccess:h,isMultiUser:i})}),e.jsx(j,{id:"auto-connection",place:"bottom",delayShow:300,className:"allm-tooltip !allm-text-xs"}),e.jsx(j,{id:"copy-connection-text",place:"bottom",delayShow:300,className:"allm-tooltip !allm-text-xs"})]})}export{G as default};
@@ -1 +1 @@
1
- import{R as r,r as c,g as j,j as e,v as i,p as l,a5 as v,b7 as y,s as N,S as o}from"../index.js";import{C as H}from"./communityHub-aba61686.js";import{w}from"./Eye-9f033dc0.js";import{t as g}from"./truncate-352eb33b.js";const V=new Map([["bold",r.createElement(r.Fragment,null,r.createElement("path",{d:"M208,76H180V56A52,52,0,0,0,76,56V76H48A20,20,0,0,0,28,96V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V96A20,20,0,0,0,208,76ZM100,56a28,28,0,0,1,56,0V76H100ZM204,204H52V100H204Z"}))],["duotone",r.createElement(r.Fragment,null,r.createElement("path",{d:"M216,96V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V96a8,8,0,0,1,8-8H208A8,8,0,0,1,216,96Z",opacity:"0.2"}),r.createElement("path",{d:"M208,80H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96ZM208,208H48V96H208V208Z"}))],["fill",r.createElement(r.Fragment,null,r.createElement("path",{d:"M208,80H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96Z"}))],["light",r.createElement(r.Fragment,null,r.createElement("path",{d:"M208,82H174V56a46,46,0,0,0-92,0V82H48A14,14,0,0,0,34,96V208a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V96A14,14,0,0,0,208,82ZM94,56a34,34,0,0,1,68,0V82H94ZM210,208a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V96a2,2,0,0,1,2-2H208a2,2,0,0,1,2,2Z"}))],["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M208,80H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96ZM208,208H48V96H208V208Z"}))],["thin",r.createElement(r.Fragment,null,r.createElement("path",{d:"M208,84H172V56a44,44,0,0,0-88,0V84H48A12,12,0,0,0,36,96V208a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V96A12,12,0,0,0,208,84ZM92,56a36,36,0,0,1,72,0V84H92ZM212,208a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V96a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Z"}))]]);var C=Object.defineProperty,I=Object.defineProperties,k=Object.getOwnPropertyDescriptors,h=Object.getOwnPropertySymbols,M=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable,p=(t,s,a)=>s in t?C(t,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[s]=a,S=(t,s)=>{for(var a in s||(s={}))M.call(s,a)&&p(t,a,s[a]);if(h)for(var a of h(s))E.call(s,a)&&p(t,a,s[a]);return t},A=(t,s)=>I(t,k(s));const b=c.forwardRef((t,s)=>r.createElement(j,A(S({ref:s},t),{weights:V})));b.displayName="LockSimple";function F({item:t}){return e.jsxs("div",{className:"bg-zinc-800 light:bg-slate-100 rounded-lg p-3 hover:bg-zinc-700 light:hover:bg-slate-200 transition-all duration-200",children:[e.jsx("p",{className:"text-white text-sm font-medium",children:t.name}),e.jsx("p",{className:"text-white/60 text-xs mt-1",children:t.description}),e.jsx("div",{className:"flex justify-end mt-2",children:e.jsx(i,{className:"text-primary-button hover:text-primary-button/80 text-xs",to:l.communityHub.importItem(t.importId),children:"Import →"})})]},t.id)}function m({visibility:t="public"}){const s=t==="private"?b:w;return e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-tooltip-id":"visibility-icon","data-tooltip-content":`This item is ${t==="private"?"private":"public"}`,children:e.jsx(s,{className:"w-4 h-4 text-white/60"})}),e.jsx(v,{id:"visibility-icon",place:"top",delayShow:300,className:"allm-tooltip !allm-text-xs"})]})}function P({item:t}){return e.jsx(e.Fragment,{children:e.jsxs(i,{to:l.communityHub.importItem(t.importId),className:"bg-black/70 light:bg-slate-100 rounded-lg p-3 hover:bg-black/60 light:hover:bg-slate-200 transition-all duration-200 cursor-pointer group border border-transparent hover:border-slate-400",children:[e.jsxs("div",{className:"flex gap-x-2 items-center",children:[e.jsx("p",{className:"text-white text-sm font-medium",children:t.name}),e.jsx(m,{visibility:t.visibility})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("p",{className:"text-white/60 text-xs mt-1",children:t.description}),e.jsx("label",{className:"text-white/60 text-xs font-semibold mt-4",children:"Prompt"}),e.jsx("p",{className:"text-white/60 text-xs bg-zinc-900 light:bg-slate-200 px-2 py-1 rounded-md font-mono border border-slate-800 light:border-slate-300",children:g(t.prompt,90)})]}),e.jsx("div",{className:"flex justify-end mt-2",children:e.jsx(i,{to:l.communityHub.importItem(t.importId),className:"text-primary-button hover:text-primary-button/80 text-sm font-medium px-3 py-1.5 rounded-md bg-black/30 light:bg-slate-200 group-hover:bg-black/50 light:group-hover:bg-slate-300 transition-all",children:"Import →"})})]},t.id)})}function Z({item:t}){return e.jsx(e.Fragment,{children:e.jsxs(i,{to:l.communityHub.importItem(t.importId),className:"bg-black/70 light:bg-slate-100 rounded-lg p-3 hover:bg-black/60 light:hover:bg-slate-200 transition-all duration-200 cursor-pointer group border border-transparent hover:border-slate-400",children:[e.jsxs("div",{className:"flex gap-x-2 items-center",children:[e.jsx("p",{className:"text-white text-sm font-medium",children:t.name}),e.jsx(m,{visibility:t.visibility})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("p",{className:"text-white/60 text-xs mt-1",children:t.description}),e.jsx("label",{className:"text-white/60 text-xs font-semibold mt-4",children:"Command"}),e.jsx("p",{className:"text-white/60 text-xs bg-zinc-900 light:bg-slate-200 px-2 py-1 rounded-md font-mono border border-slate-800 light:border-slate-300",children:t.command}),e.jsx("label",{className:"text-white/60 text-xs font-semibold mt-4",children:"Prompt"}),e.jsx("p",{className:"text-white/60 text-xs bg-zinc-900 light:bg-slate-200 px-2 py-1 rounded-md font-mono border border-slate-800 light:border-slate-300",children:g(t.prompt,90)})]}),e.jsx("div",{className:"flex justify-end mt-2",children:e.jsx(i,{to:l.communityHub.importItem(t.importId),className:"text-primary-button hover:text-primary-button/80 text-sm font-medium px-3 py-1.5 rounded-md bg-black/30 light:bg-slate-200 group-hover:bg-black/50 light:group-hover:bg-slate-300 transition-all",children:"Import →"})})]},t.id)})}function O({item:t}){var s,a;return e.jsx(e.Fragment,{children:e.jsxs(i,{to:l.communityHub.importItem(t.importId),className:"bg-black/70 light:bg-slate-100 rounded-lg p-3 hover:bg-black/60 light:hover:bg-slate-200 transition-all duration-200 cursor-pointer group border border-transparent hover:border-slate-400",children:[e.jsxs("div",{className:"flex gap-x-2 items-center",children:[e.jsx("p",{className:"text-white text-sm font-medium",children:t.name}),e.jsx(m,{visibility:t.visibility})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("p",{className:"text-white/60 text-xs mt-1",children:t.description}),e.jsxs("p",{className:"font-mono text-xs mt-1 text-white/60",children:[t.verified?e.jsx("span",{className:"text-green-500",children:"Verified"}):e.jsx("span",{className:"text-red-500",children:"Unverified"})," ","Skill"]}),e.jsxs("p",{className:"font-mono text-xs mt-1 text-white/60",children:[((s=t.manifest.files)==null?void 0:s.length)||0," ",y("file",((a=t.manifest.files)==null?void 0:a.length)||0)," found"]})]}),e.jsx("div",{className:"flex justify-end mt-2",children:e.jsx(i,{to:l.communityHub.importItem(t.importId),className:"text-primary-button hover:text-primary-button/80 text-sm font-medium px-3 py-1.5 rounded-md bg-black/30 light:bg-slate-200 group-hover:bg-black/50 light:group-hover:bg-slate-300 transition-all",children:"Import →"})})]},t.id)})}function L({item:t}){const s=N(t.flow,{steps:[]});return e.jsxs(i,{to:l.communityHub.importItem(t.importId),className:"bg-black/70 light:bg-slate-100 rounded-lg p-3 hover:bg-black/60 light:hover:bg-slate-200 transition-all duration-200 cursor-pointer group border border-transparent hover:border-slate-400 flex flex-col h-full",children:[e.jsxs("div",{className:"flex gap-x-2 items-center",children:[e.jsx("p",{className:"text-white text-sm font-medium",children:t.name}),e.jsx(m,{visibility:t.visibility})]}),e.jsxs("div",{className:"flex flex-col gap-2 flex-1",children:[e.jsx("p",{className:"text-white/60 text-xs mt-1",children:t.description}),e.jsxs("label",{className:"text-white/60 text-xs font-semibold mt-4",children:["Steps (",s.steps.length,"):"]}),e.jsx("p",{className:"text-white/60 text-xs bg-zinc-900 light:bg-slate-200 px-2 py-1 rounded-md font-mono border border-slate-800 light:border-slate-300",children:e.jsx("ul",{className:"list-disc pl-4",children:s.steps.map((a,n)=>e.jsx("li",{children:a.type},n))})})]}),e.jsx("div",{className:"flex justify-end mt-2",children:e.jsx(i,{to:l.communityHub.importItem(t.importId),className:"text-primary-button hover:text-primary-button/80 text-sm font-medium px-3 py-1.5 rounded-md bg-black/30 light:bg-slate-200 group-hover:bg-black/50 light:group-hover:bg-slate-300 transition-all",children:"Import →"})})]})}function z({type:t,item:s}){switch(t){case"systemPrompts":return e.jsx(P,{item:s});case"slashCommands":return e.jsx(Z,{item:s});case"agentSkills":return e.jsx(O,{item:s});case"agentFlows":return e.jsx(L,{item:s});default:return e.jsx(F,{item:s})}}function R(t){switch(t){case"agentSkills":case"agentSkill":return"Agent Skills";case"systemPrompt":case"systemPrompts":return"System Prompts";case"slashCommand":case"slashCommands":return"Slash Commands";case"agentFlows":case"agentFlow":return"Agent Flows"}}function T(t){switch(t){case"agentSkill":case"agentSkills":return"agent-skills";case"systemPrompt":case"systemPrompts":return"system-prompts";case"slashCommand":case"slashCommands":return"slash-commands";case"agentFlow":case"agentFlows":return"agent-flows"}}const u={agentSkills:{items:[],hasMore:!1,totalCount:0},systemPrompts:{items:[],hasMore:!1,totalCount:0},slashCommands:{items:[],hasMore:!1,totalCount:0}};function D(){const[t,s]=c.useState(!0),[a,n]=c.useState(u);return c.useEffect(()=>{(async()=>{s(!0);try{const{success:x,result:f}=await H.fetchExploreItems();x&&n(f||u)}catch(x){console.error("Error fetching data:",x)}finally{s(!1)}})()},[]),{loading:t,exploreItems:a}}function q(){const{loading:t,exploreItems:s}=D();return e.jsxs("div",{className:"w-full flex flex-col gap-y-1 pb-6 pt-6",children:[e.jsxs("div",{className:"flex flex-col gap-y-2 mb-4",children:[e.jsx("p",{className:"text-base font-semibold text-theme-text-primary",children:"Recently Added on AnythingLLM Community Hub"}),e.jsx("p",{className:"text-xs text-theme-text-secondary",children:"Explore the latest additions to the AnythingLLM Community Hub"})]}),e.jsx(_,{loading:t,exploreItems:s})]})}function _({loading:t,exploreItems:s}){return t?e.jsx(U,{}):e.jsx("div",{className:"flex flex-col gap-4",children:Object.keys(s).map(a=>{const n=T(a);return s[a].items.length===0?null:e.jsxs("div",{className:"rounded-lg w-full",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("h3",{className:"text-theme-text-primary capitalize font-medium mb-3",children:R(a)}),s[a].hasMore&&e.jsx("a",{href:l.communityHub.viewMoreOfType(n),target:"_blank",rel:"noopener noreferrer",className:"text-primary-button hover:text-primary-button/80 text-sm",children:"Explore More →"})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-2",children:s[a].items.map(d=>e.jsx(z,{type:a,item:d},d.id))})]},a)})})}function U(){return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"rounded-lg w-full",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx(o,{height:"40px",width:"300px",highlightColor:"var(--theme-settings-input-active)",baseColor:"var(--theme-settings-input-bg)",count:1})}),e.jsx(o,{height:"200px",width:"300px",highlightColor:"var(--theme-settings-input-active)",baseColor:"var(--theme-settings-input-bg)",count:4,className:"rounded-lg",containerClassName:"flex flex-wrap gap-2 mt-1"})]}),e.jsxs("div",{className:"rounded-lg w-full",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx(o,{height:"40px",width:"300px",highlightColor:"var(--theme-settings-input-active)",baseColor:"var(--theme-settings-input-bg)",count:1})}),e.jsx(o,{height:"200px",width:"300px",highlightColor:"var(--theme-settings-input-active)",baseColor:"var(--theme-settings-input-bg)",count:4,className:"rounded-lg",containerClassName:"flex flex-wrap gap-2 mt-1"})]})]})}export{q as H,U as a,z as b,R as r};
1
+ import{R as r,r as c,g as j,j as e,v as i,p as l,a7 as v,b9 as y,s as N,S as o}from"../index.js";import{C as H}from"./communityHub-aba61686.js";import{w}from"./Eye-9f033dc0.js";import{t as g}from"./truncate-06273256.js";const V=new Map([["bold",r.createElement(r.Fragment,null,r.createElement("path",{d:"M208,76H180V56A52,52,0,0,0,76,56V76H48A20,20,0,0,0,28,96V208a20,20,0,0,0,20,20H208a20,20,0,0,0,20-20V96A20,20,0,0,0,208,76ZM100,56a28,28,0,0,1,56,0V76H100ZM204,204H52V100H204Z"}))],["duotone",r.createElement(r.Fragment,null,r.createElement("path",{d:"M216,96V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V96a8,8,0,0,1,8-8H208A8,8,0,0,1,216,96Z",opacity:"0.2"}),r.createElement("path",{d:"M208,80H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96ZM208,208H48V96H208V208Z"}))],["fill",r.createElement(r.Fragment,null,r.createElement("path",{d:"M208,80H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96Z"}))],["light",r.createElement(r.Fragment,null,r.createElement("path",{d:"M208,82H174V56a46,46,0,0,0-92,0V82H48A14,14,0,0,0,34,96V208a14,14,0,0,0,14,14H208a14,14,0,0,0,14-14V96A14,14,0,0,0,208,82ZM94,56a34,34,0,0,1,68,0V82H94ZM210,208a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V96a2,2,0,0,1,2-2H208a2,2,0,0,1,2,2Z"}))],["regular",r.createElement(r.Fragment,null,r.createElement("path",{d:"M208,80H176V56a48,48,0,0,0-96,0V80H48A16,16,0,0,0,32,96V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V96A16,16,0,0,0,208,80ZM96,56a32,32,0,0,1,64,0V80H96ZM208,208H48V96H208V208Z"}))],["thin",r.createElement(r.Fragment,null,r.createElement("path",{d:"M208,84H172V56a44,44,0,0,0-88,0V84H48A12,12,0,0,0,36,96V208a12,12,0,0,0,12,12H208a12,12,0,0,0,12-12V96A12,12,0,0,0,208,84ZM92,56a36,36,0,0,1,72,0V84H92ZM212,208a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V96a4,4,0,0,1,4-4H208a4,4,0,0,1,4,4Z"}))]]);var C=Object.defineProperty,I=Object.defineProperties,k=Object.getOwnPropertyDescriptors,h=Object.getOwnPropertySymbols,M=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable,p=(t,s,a)=>s in t?C(t,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[s]=a,S=(t,s)=>{for(var a in s||(s={}))M.call(s,a)&&p(t,a,s[a]);if(h)for(var a of h(s))E.call(s,a)&&p(t,a,s[a]);return t},A=(t,s)=>I(t,k(s));const b=c.forwardRef((t,s)=>r.createElement(j,A(S({ref:s},t),{weights:V})));b.displayName="LockSimple";function F({item:t}){return e.jsxs("div",{className:"bg-zinc-800 light:bg-slate-100 rounded-lg p-3 hover:bg-zinc-700 light:hover:bg-slate-200 transition-all duration-200",children:[e.jsx("p",{className:"text-white text-sm font-medium",children:t.name}),e.jsx("p",{className:"text-white/60 text-xs mt-1",children:t.description}),e.jsx("div",{className:"flex justify-end mt-2",children:e.jsx(i,{className:"text-primary-button hover:text-primary-button/80 text-xs",to:l.communityHub.importItem(t.importId),children:"Import →"})})]},t.id)}function m({visibility:t="public"}){const s=t==="private"?b:w;return e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-tooltip-id":"visibility-icon","data-tooltip-content":`This item is ${t==="private"?"private":"public"}`,children:e.jsx(s,{className:"w-4 h-4 text-white/60"})}),e.jsx(v,{id:"visibility-icon",place:"top",delayShow:300,className:"allm-tooltip !allm-text-xs"})]})}function P({item:t}){return e.jsx(e.Fragment,{children:e.jsxs(i,{to:l.communityHub.importItem(t.importId),className:"bg-black/70 light:bg-slate-100 rounded-lg p-3 hover:bg-black/60 light:hover:bg-slate-200 transition-all duration-200 cursor-pointer group border border-transparent hover:border-slate-400",children:[e.jsxs("div",{className:"flex gap-x-2 items-center",children:[e.jsx("p",{className:"text-white text-sm font-medium",children:t.name}),e.jsx(m,{visibility:t.visibility})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("p",{className:"text-white/60 text-xs mt-1",children:t.description}),e.jsx("label",{className:"text-white/60 text-xs font-semibold mt-4",children:"Prompt"}),e.jsx("p",{className:"text-white/60 text-xs bg-zinc-900 light:bg-slate-200 px-2 py-1 rounded-md font-mono border border-slate-800 light:border-slate-300",children:g(t.prompt,90)})]}),e.jsx("div",{className:"flex justify-end mt-2",children:e.jsx(i,{to:l.communityHub.importItem(t.importId),className:"text-primary-button hover:text-primary-button/80 text-sm font-medium px-3 py-1.5 rounded-md bg-black/30 light:bg-slate-200 group-hover:bg-black/50 light:group-hover:bg-slate-300 transition-all",children:"Import →"})})]},t.id)})}function Z({item:t}){return e.jsx(e.Fragment,{children:e.jsxs(i,{to:l.communityHub.importItem(t.importId),className:"bg-black/70 light:bg-slate-100 rounded-lg p-3 hover:bg-black/60 light:hover:bg-slate-200 transition-all duration-200 cursor-pointer group border border-transparent hover:border-slate-400",children:[e.jsxs("div",{className:"flex gap-x-2 items-center",children:[e.jsx("p",{className:"text-white text-sm font-medium",children:t.name}),e.jsx(m,{visibility:t.visibility})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("p",{className:"text-white/60 text-xs mt-1",children:t.description}),e.jsx("label",{className:"text-white/60 text-xs font-semibold mt-4",children:"Command"}),e.jsx("p",{className:"text-white/60 text-xs bg-zinc-900 light:bg-slate-200 px-2 py-1 rounded-md font-mono border border-slate-800 light:border-slate-300",children:t.command}),e.jsx("label",{className:"text-white/60 text-xs font-semibold mt-4",children:"Prompt"}),e.jsx("p",{className:"text-white/60 text-xs bg-zinc-900 light:bg-slate-200 px-2 py-1 rounded-md font-mono border border-slate-800 light:border-slate-300",children:g(t.prompt,90)})]}),e.jsx("div",{className:"flex justify-end mt-2",children:e.jsx(i,{to:l.communityHub.importItem(t.importId),className:"text-primary-button hover:text-primary-button/80 text-sm font-medium px-3 py-1.5 rounded-md bg-black/30 light:bg-slate-200 group-hover:bg-black/50 light:group-hover:bg-slate-300 transition-all",children:"Import →"})})]},t.id)})}function O({item:t}){var s,a;return e.jsx(e.Fragment,{children:e.jsxs(i,{to:l.communityHub.importItem(t.importId),className:"bg-black/70 light:bg-slate-100 rounded-lg p-3 hover:bg-black/60 light:hover:bg-slate-200 transition-all duration-200 cursor-pointer group border border-transparent hover:border-slate-400",children:[e.jsxs("div",{className:"flex gap-x-2 items-center",children:[e.jsx("p",{className:"text-white text-sm font-medium",children:t.name}),e.jsx(m,{visibility:t.visibility})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("p",{className:"text-white/60 text-xs mt-1",children:t.description}),e.jsxs("p",{className:"font-mono text-xs mt-1 text-white/60",children:[t.verified?e.jsx("span",{className:"text-green-500",children:"Verified"}):e.jsx("span",{className:"text-red-500",children:"Unverified"})," ","Skill"]}),e.jsxs("p",{className:"font-mono text-xs mt-1 text-white/60",children:[((s=t.manifest.files)==null?void 0:s.length)||0," ",y("file",((a=t.manifest.files)==null?void 0:a.length)||0)," found"]})]}),e.jsx("div",{className:"flex justify-end mt-2",children:e.jsx(i,{to:l.communityHub.importItem(t.importId),className:"text-primary-button hover:text-primary-button/80 text-sm font-medium px-3 py-1.5 rounded-md bg-black/30 light:bg-slate-200 group-hover:bg-black/50 light:group-hover:bg-slate-300 transition-all",children:"Import →"})})]},t.id)})}function L({item:t}){const s=N(t.flow,{steps:[]});return e.jsxs(i,{to:l.communityHub.importItem(t.importId),className:"bg-black/70 light:bg-slate-100 rounded-lg p-3 hover:bg-black/60 light:hover:bg-slate-200 transition-all duration-200 cursor-pointer group border border-transparent hover:border-slate-400 flex flex-col h-full",children:[e.jsxs("div",{className:"flex gap-x-2 items-center",children:[e.jsx("p",{className:"text-white text-sm font-medium",children:t.name}),e.jsx(m,{visibility:t.visibility})]}),e.jsxs("div",{className:"flex flex-col gap-2 flex-1",children:[e.jsx("p",{className:"text-white/60 text-xs mt-1",children:t.description}),e.jsxs("label",{className:"text-white/60 text-xs font-semibold mt-4",children:["Steps (",s.steps.length,"):"]}),e.jsx("p",{className:"text-white/60 text-xs bg-zinc-900 light:bg-slate-200 px-2 py-1 rounded-md font-mono border border-slate-800 light:border-slate-300",children:e.jsx("ul",{className:"list-disc pl-4",children:s.steps.map((a,n)=>e.jsx("li",{children:a.type},n))})})]}),e.jsx("div",{className:"flex justify-end mt-2",children:e.jsx(i,{to:l.communityHub.importItem(t.importId),className:"text-primary-button hover:text-primary-button/80 text-sm font-medium px-3 py-1.5 rounded-md bg-black/30 light:bg-slate-200 group-hover:bg-black/50 light:group-hover:bg-slate-300 transition-all",children:"Import →"})})]})}function z({type:t,item:s}){switch(t){case"systemPrompts":return e.jsx(P,{item:s});case"slashCommands":return e.jsx(Z,{item:s});case"agentSkills":return e.jsx(O,{item:s});case"agentFlows":return e.jsx(L,{item:s});default:return e.jsx(F,{item:s})}}function R(t){switch(t){case"agentSkills":case"agentSkill":return"Agent Skills";case"systemPrompt":case"systemPrompts":return"System Prompts";case"slashCommand":case"slashCommands":return"Slash Commands";case"agentFlows":case"agentFlow":return"Agent Flows"}}function T(t){switch(t){case"agentSkill":case"agentSkills":return"agent-skills";case"systemPrompt":case"systemPrompts":return"system-prompts";case"slashCommand":case"slashCommands":return"slash-commands";case"agentFlow":case"agentFlows":return"agent-flows"}}const u={agentSkills:{items:[],hasMore:!1,totalCount:0},systemPrompts:{items:[],hasMore:!1,totalCount:0},slashCommands:{items:[],hasMore:!1,totalCount:0}};function D(){const[t,s]=c.useState(!0),[a,n]=c.useState(u);return c.useEffect(()=>{(async()=>{s(!0);try{const{success:x,result:f}=await H.fetchExploreItems();x&&n(f||u)}catch(x){console.error("Error fetching data:",x)}finally{s(!1)}})()},[]),{loading:t,exploreItems:a}}function q(){const{loading:t,exploreItems:s}=D();return e.jsxs("div",{className:"w-full flex flex-col gap-y-1 pb-6 pt-6",children:[e.jsxs("div",{className:"flex flex-col gap-y-2 mb-4",children:[e.jsx("p",{className:"text-base font-semibold text-theme-text-primary",children:"Recently Added on AnythingLLM Community Hub"}),e.jsx("p",{className:"text-xs text-theme-text-secondary",children:"Explore the latest additions to the AnythingLLM Community Hub"})]}),e.jsx(_,{loading:t,exploreItems:s})]})}function _({loading:t,exploreItems:s}){return t?e.jsx(U,{}):e.jsx("div",{className:"flex flex-col gap-4",children:Object.keys(s).map(a=>{const n=T(a);return s[a].items.length===0?null:e.jsxs("div",{className:"rounded-lg w-full",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("h3",{className:"text-theme-text-primary capitalize font-medium mb-3",children:R(a)}),s[a].hasMore&&e.jsx("a",{href:l.communityHub.viewMoreOfType(n),target:"_blank",rel:"noopener noreferrer",className:"text-primary-button hover:text-primary-button/80 text-sm",children:"Explore More →"})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-2",children:s[a].items.map(d=>e.jsx(z,{type:a,item:d},d.id))})]},a)})})}function U(){return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"rounded-lg w-full",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx(o,{height:"40px",width:"300px",highlightColor:"var(--theme-settings-input-active)",baseColor:"var(--theme-settings-input-bg)",count:1})}),e.jsx(o,{height:"200px",width:"300px",highlightColor:"var(--theme-settings-input-active)",baseColor:"var(--theme-settings-input-bg)",count:4,className:"rounded-lg",containerClassName:"flex flex-wrap gap-2 mt-1"})]}),e.jsxs("div",{className:"rounded-lg w-full",children:[e.jsx("div",{className:"flex justify-between items-center",children:e.jsx(o,{height:"40px",width:"300px",highlightColor:"var(--theme-settings-input-active)",baseColor:"var(--theme-settings-input-bg)",count:1})}),e.jsx(o,{height:"200px",width:"300px",highlightColor:"var(--theme-settings-input-active)",baseColor:"var(--theme-settings-input-bg)",count:4,className:"rounded-lg",containerClassName:"flex flex-wrap gap-2 mt-1"})]})]})}export{q as H,U as a,z as b,R as r};
@@ -1 +1 @@
1
- import{d as c,j as s,e as d,f as g,i as f,l as S,r as a,W as i,L as x}from"../index.js";import{W as h}from"./index-8eb228e2.js";import{a as w}from"./index-6cdecde9.js";import"./files-e19b0187.js";import"./purify-fbc9e8e2.js";/* empty css */import"./Check-7e83fb0d.js";import"./Copy-d323e545.js";import"./truncate-352eb33b.js";import"./mcpServers-a175e8cf.js";import"./admin-04b020fe.js";import"./Database-f1a76329.js";import"./File-b92df2f3.js";import"./XCircle-edfe554c.js";import"./Trans-ca8f9cfe.js";import"./Brain-24e386d5.js";import"./Browser-1820fad0.js";import"./index-73aba4c6.js";import"./agentFlows-e4124dd3.js";import"./index-2f526c2a.js";import"./communityHub-aba61686.js";import"./WarningCircle-27467274.js";import"./index-8ba96f42.js";import"./Hammer-05b5ccc7.js";import"./react-beautiful-dnd.esm-45ea8487.js";import"./moment-8a59df1b.js";import"./Eye-9f033dc0.js";import"./index-4fb4d421.js";function Q(){const{loading:t,requiresAuth:r,mode:e}=c();return t?s.jsx(d,{}):r!==!1?s.jsx(s.Fragment,{children:r!==null&&s.jsx(g,{mode:e})}):s.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-zinc-950 light:bg-slate-50 flex",children:[!f&&s.jsx(w,{}),s.jsx(j,{})]})}function j(){const{slug:t}=S(),[r,e]=a.useState(null),[n,m]=a.useState(null);return a.useEffect(()=>{async function p(){if(!t)return;const o=await i.bySlug(t);if(!o){e(null),m(t);return}const[l,{showAgentCommand:u}]=await Promise.all([i.getSuggestedMessages(t),i.agentCommandAvailable(t)]);e({...o,suggestedMessages:l,showAgentCommand:u}),m(t),localStorage.setItem(x,JSON.stringify({slug:o.slug,name:o.name}))}p()},[t]),s.jsx(h,{loading:n!==t,workspace:r})}export{Q as default};
1
+ import{d as c,j as s,e as d,f as g,i as f,l as S,r as a,W as i,L as x}from"../index.js";import{W as h}from"./index-9ab52cfb.js";import{a as w}from"./index-6bd7928a.js";import"./files-676613ed.js";import"./purify-eb750cf4.js";/* empty css */import"./Check-7e83fb0d.js";import"./Copy-d323e545.js";import"./truncate-06273256.js";import"./mcpServers-1686e782.js";import"./admin-04b020fe.js";import"./Database-f1a76329.js";import"./File-b92df2f3.js";import"./XCircle-edfe554c.js";import"./Trans-820f1dad.js";import"./Brain-24e386d5.js";import"./Browser-1820fad0.js";import"./index-dcc00e8c.js";import"./agentFlows-e4124dd3.js";import"./index-3cb59d82.js";import"./communityHub-aba61686.js";import"./WarningCircle-27467274.js";import"./index-8ba96f42.js";import"./Hammer-05b5ccc7.js";import"./react-beautiful-dnd.esm-bb85eef1.js";import"./moment-75486807.js";import"./Eye-9f033dc0.js";import"./index-4fb4d421.js";function Q(){const{loading:t,requiresAuth:r,mode:e}=c();return t?s.jsx(d,{}):r!==!1?s.jsx(s.Fragment,{children:r!==null&&s.jsx(g,{mode:e})}):s.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-zinc-950 light:bg-slate-50 flex",children:[!f&&s.jsx(w,{}),s.jsx(j,{})]})}function j(){const{slug:t}=S(),[r,e]=a.useState(null),[n,m]=a.useState(null);return a.useEffect(()=>{async function p(){if(!t)return;const o=await i.bySlug(t);if(!o){e(null),m(t);return}const[l,{showAgentCommand:u}]=await Promise.all([i.getSuggestedMessages(t),i.agentCommandAvailable(t)]);e({...o,suggestedMessages:l,showAgentCommand:u}),m(t),localStorage.setItem(x,JSON.stringify({slug:o.slug,name:o.name}))}p()},[t]),s.jsx(h,{loading:n!==t,workspace:r})}export{Q as default};
@@ -0,0 +1 @@
1
+ import{R as a,r as h,g as F,m as B,A as X,u as E,j as e,K as ne,ab as re,aE as ie,p as Z,ae as V,k as I,s as oe,c as A,b as ce,aY as de,q as ue,M as he,a1 as me,i as pe,a7 as xe}from"../index.js";import{S as P,u as be}from"./usePolling-417bb099.js";import{C as ge}from"./WarningCircle-27467274.js";import{p as fe,b as we,h as Q}from"./cron-307d3fc6.js";import{w as ve}from"./Check-7e83fb0d.js";import"./moment-75486807.js";const ye=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M225.29,165.93C216.61,151,212,129.57,212,104a84,84,0,0,0-168,0c0,25.58-4.59,47-13.27,61.93A20.08,20.08,0,0,0,30.66,186,19.77,19.77,0,0,0,48,196H84.18a44,44,0,0,0,87.64,0H208a19.77,19.77,0,0,0,17.31-10A20.08,20.08,0,0,0,225.29,165.93ZM128,212a20,20,0,0,1-19.6-16h39.2A20,20,0,0,1,128,212ZM54.66,172C63.51,154,68,131.14,68,104a60,60,0,0,1,120,0c0,27.13,4.48,50,13.33,68Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M208,192H48a8,8,0,0,1-6.88-12C47.71,168.6,56,139.81,56,104a72,72,0,0,1,144,0c0,35.82,8.3,64.6,14.9,76A8,8,0,0,1,208,192Z",opacity:"0.2"}),a.createElement("path",{d:"M221.8,175.94C216.25,166.38,208,139.33,208,104a80,80,0,1,0-160,0c0,35.34-8.26,62.38-13.81,71.94A16,16,0,0,0,48,200H88.81a40,40,0,0,0,78.38,0H208a16,16,0,0,0,13.8-24.06ZM128,216a24,24,0,0,1-22.62-16h45.24A24,24,0,0,1,128,216ZM48,184c7.7-13.24,16-43.92,16-80a64,64,0,1,1,128,0c0,36.05,8.28,66.73,16,80Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M221.8,175.94C216.25,166.38,208,139.33,208,104a80,80,0,1,0-160,0c0,35.34-8.26,62.38-13.81,71.94A16,16,0,0,0,48,200H88.81a40,40,0,0,0,78.38,0H208a16,16,0,0,0,13.8-24.06ZM128,216a24,24,0,0,1-22.62-16h45.24A24,24,0,0,1,128,216Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M220.07,176.94C214.41,167.2,206,139.73,206,104a78,78,0,1,0-156,0c0,35.74-8.42,63.2-14.08,72.94A14,14,0,0,0,48,198H90.48a38,38,0,0,0,75,0H208a14,14,0,0,0,12.06-21.06ZM128,218a26,26,0,0,1-25.29-20h50.58A26,26,0,0,1,128,218Zm81.71-33a1.9,1.9,0,0,1-1.7,1H48a1.9,1.9,0,0,1-1.7-1,2,2,0,0,1,0-2C53.87,170,62,139.69,62,104a66,66,0,1,1,132,0c0,35.68,8.14,65.95,15.71,79A2,2,0,0,1,209.71,185Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M221.8,175.94C216.25,166.38,208,139.33,208,104a80,80,0,1,0-160,0c0,35.34-8.26,62.38-13.81,71.94A16,16,0,0,0,48,200H88.81a40,40,0,0,0,78.38,0H208a16,16,0,0,0,13.8-24.06ZM128,216a24,24,0,0,1-22.62-16h45.24A24,24,0,0,1,128,216ZM48,184c7.7-13.24,16-43.92,16-80a64,64,0,1,1,128,0c0,36.05,8.28,66.73,16,80Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M218.35,178C212.58,168,204,140.13,204,104a76,76,0,1,0-152,0c0,36.13-8.59,64-14.36,73.95A12,12,0,0,0,48,196H92.23a36,36,0,0,0,71.54,0H208A12,12,0,0,0,218.35,178ZM128,220a28,28,0,0,1-27.71-24h55.42A28,28,0,0,1,128,220Zm83.45-34a3.91,3.91,0,0,1-3.44,2H48a3.91,3.91,0,0,1-3.44-2,4,4,0,0,1,0-4C52,169.17,60,139.32,60,104a68,68,0,1,1,136,0c0,35.31,8,65.17,15.44,78A4,4,0,0,1,211.45,186Z"}))]]);var je=Object.defineProperty,Ne=Object.defineProperties,Je=Object.getOwnPropertyDescriptors,_=Object.getOwnPropertySymbols,ke=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable,D=(t,s,l)=>s in t?je(t,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[s]=l,Se=(t,s)=>{for(var l in s||(s={}))ke.call(s,l)&&D(t,l,s[l]);if(_)for(var l of _(s))Ee.call(s,l)&&D(t,l,s[l]);return t},ze=(t,s)=>Ne(t,Je(s));const ee=h.forwardRef((t,s)=>a.createElement(F,ze(Se({ref:s},t),{weights:ye})));ee.displayName="Bell";const Ce=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H40a12,12,0,0,1,0-24H216A12,12,0,0,1,228,128Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),a.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H72a8,8,0,0,1,0-16H184a8,8,0,0,1,0,16Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H40a6,6,0,0,1,0-12H216A6,6,0,0,1,222,128Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H40a4,4,0,0,1,0-8H216A4,4,0,0,1,220,128Z"}))]]);var Me=Object.defineProperty,Ae=Object.defineProperties,Pe=Object.getOwnPropertyDescriptors,T=Object.getOwnPropertySymbols,Oe=Object.prototype.hasOwnProperty,$e=Object.prototype.propertyIsEnumerable,W=(t,s,l)=>s in t?Me(t,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[s]=l,Le=(t,s)=>{for(var l in s||(s={}))Oe.call(s,l)&&W(t,l,s[l]);if(T)for(var l of T(s))$e.call(s,l)&&W(t,l,s[l]);return t},Re=(t,s)=>Ae(t,Pe(s));const te=h.forwardRef((t,s)=>a.createElement(F,Re(Le({ref:s},t),{weights:Ce})));te.displayName="Minus";const He=new Map([["bold",a.createElement(a.Fragment,null,a.createElement("path",{d:"M234.49,111.07,90.41,22.94A20,20,0,0,0,60,39.87V216.13a20,20,0,0,0,30.41,16.93l144.08-88.13a19.82,19.82,0,0,0,0-33.86ZM84,208.85V47.15L216.16,128Z"}))],["duotone",a.createElement(a.Fragment,null,a.createElement("path",{d:"M228.23,134.69,84.15,222.81A8,8,0,0,1,72,216.12V39.88a8,8,0,0,1,12.15-6.69l144.08,88.12A7.82,7.82,0,0,1,228.23,134.69Z",opacity:"0.2"}),a.createElement("path",{d:"M232.4,114.49,88.32,26.35a16,16,0,0,0-16.2-.3A15.86,15.86,0,0,0,64,39.87V216.13A15.94,15.94,0,0,0,80,232a16.07,16.07,0,0,0,8.36-2.35L232.4,141.51a15.81,15.81,0,0,0,0-27ZM80,215.94V40l143.83,88Z"}))],["fill",a.createElement(a.Fragment,null,a.createElement("path",{d:"M240,128a15.74,15.74,0,0,1-7.6,13.51L88.32,229.65a16,16,0,0,1-16.2.3A15.86,15.86,0,0,1,64,216.13V39.87a15.86,15.86,0,0,1,8.12-13.82,16,16,0,0,1,16.2.3L232.4,114.49A15.74,15.74,0,0,1,240,128Z"}))],["light",a.createElement(a.Fragment,null,a.createElement("path",{d:"M231.36,116.19,87.28,28.06a14,14,0,0,0-14.18-.27A13.69,13.69,0,0,0,66,39.87V216.13a13.69,13.69,0,0,0,7.1,12.08,14,14,0,0,0,14.18-.27l144.08-88.13a13.82,13.82,0,0,0,0-23.62Zm-6.26,13.38L81,217.7a2,2,0,0,1-2.06,0,1.78,1.78,0,0,1-1-1.61V39.87a1.78,1.78,0,0,1,1-1.61A2.06,2.06,0,0,1,80,38a2,2,0,0,1,1,.31L225.1,126.43a1.82,1.82,0,0,1,0,3.14Z"}))],["regular",a.createElement(a.Fragment,null,a.createElement("path",{d:"M232.4,114.49,88.32,26.35a16,16,0,0,0-16.2-.3A15.86,15.86,0,0,0,64,39.87V216.13A15.94,15.94,0,0,0,80,232a16.07,16.07,0,0,0,8.36-2.35L232.4,141.51a15.81,15.81,0,0,0,0-27ZM80,215.94V40l143.83,88Z"}))],["thin",a.createElement(a.Fragment,null,a.createElement("path",{d:"M230.32,117.9,86.24,29.79a11.91,11.91,0,0,0-12.17-.23A11.71,11.71,0,0,0,68,39.89V216.11a11.71,11.71,0,0,0,6.07,10.33,11.91,11.91,0,0,0,12.17-.23L230.32,138.1a11.82,11.82,0,0,0,0-20.2Zm-4.18,13.37L82.06,219.39a4,4,0,0,1-4.07.07,3.77,3.77,0,0,1-2-3.35V39.89a3.77,3.77,0,0,1,2-3.35,4,4,0,0,1,4.07.07l144.08,88.12a3.8,3.8,0,0,1,0,6.54Z"}))]]);var Ze=Object.defineProperty,qe=Object.defineProperties,Fe=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertySymbols,Ie=Object.prototype.hasOwnProperty,Be=Object.prototype.propertyIsEnumerable,K=(t,s,l)=>s in t?Ze(t,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[s]=l,Ve=(t,s)=>{for(var l in s||(s={}))Ie.call(s,l)&&K(t,l,s[l]);if(U)for(var l of U(s))Be.call(s,l)&&K(t,l,s[l]);return t},_e=(t,s)=>qe(t,Fe(s));const se=h.forwardRef((t,s)=>a.createElement(F,_e(Ve({ref:s},t),{weights:He})));se.displayName="Play";const De=`${X}/web-push/pubkey`,Te=`${X}/web-push/subscribe`,We="1.0.0";function z(t,...s){typeof t=="object"&&(t=JSON.stringify(t,null,2)),console.log(`[useWebPushNotifications] ${t}`,...s)}async function le(t=!0){try{if(!("serviceWorker"in navigator)||!("PushManager"in window)){z("Push notifications not supported");return}if(t){if(await Notification.requestPermission()!=="granted"){z("Notification permission not granted");return}}else if(Notification.permission!=="granted"){z("Notification permission not granted");return}const s=await fetch(De,{headers:B()}).then(d=>d.json()).then(({publicKey:d})=>{if(!d)throw new Error("No public key found or generated");return d}).catch(()=>null);if(!s)return z("No public key found or generated");const l=await navigator.serviceWorker.register(`/service-workers/push-notifications.js?v=${We}`);l.addEventListener("updatefound",()=>{const d=l.installing;z("Service worker update found"),d.addEventListener("statechange",()=>{d.state==="installed"&&navigator.serviceWorker.controller&&(z("New service worker installed, ready to activate"),confirm("A new version is available. Reload to update?")&&window.location.reload())})}),navigator.serviceWorker.addEventListener("controllerchange",()=>{z("Service worker controller changed")}),l.installing?await new Promise(d=>{l.installing.addEventListener("statechange",()=>{var i;((i=l.installing)==null?void 0:i.state)==="activated"&&d()})}):l.waiting&&await new Promise(d=>{l.waiting.addEventListener("statechange",()=>{var i;((i=l.waiting)==null?void 0:i.state)==="activated"&&d()})});const r=await l.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Ke(s)});await fetch(Te,{method:"POST",body:JSON.stringify(r),headers:B()})}catch(s){z("Error subscribing to push notifications",s)}}function Ue(t=!0){h.useEffect(()=>{le(t)},[])}function Ke(t){const s="=".repeat((4-t.length%4)%4),l=(t+s).replace(/\-/g,"+").replace(/_/g,"/"),r=atob(l);return new Uint8Array([...r].map(d=>d.charCodeAt(0)))}function Ye({form:t,errors:s,onChange:l}){const{t:r}=E();return e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-baseline gap-1.5 mb-2 text-sm font-medium text-theme-text-primary",children:[e.jsxs("span",{children:[r("scheduledJobs.modal.nameLabel")," ",e.jsx("span",{className:"text-red-400",children:"*"})]}),s.name&&e.jsx("span",{className:"text-red-400 italic font-normal",children:r("scheduledJobs.modal.required","Required")})]}),e.jsx("input",{type:"text",name:"name",value:t.name,onChange:l,placeholder:r("scheduledJobs.modal.namePlaceholder"),className:`bg-theme-settings-input-bg text-theme-text-primary placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5 border ${s.name?"border-red-300":"border-transparent"}`})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-baseline gap-1.5 mb-2 text-sm font-medium text-theme-text-primary",children:[e.jsxs("span",{children:[r("scheduledJobs.modal.promptLabel")," ",e.jsx("span",{className:"text-red-400",children:"*"})]}),s.prompt&&e.jsx("span",{className:"text-red-400 italic font-normal",children:r("scheduledJobs.modal.required","Required")})]}),e.jsx("textarea",{name:"prompt",value:t.prompt,onChange:l,placeholder:r("scheduledJobs.modal.promptPlaceholder"),rows:4,className:`bg-theme-settings-input-bg text-theme-text-primary placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5 resize-y border ${s.prompt?"border-red-300":"border-transparent"}`})]})]})}const Ge=[1,2,5,10,15,20,30],Xe=Array.from({length:60},(t,s)=>s),Qe=Array.from({length:31},(t,s)=>s+1),q=t=>String(t).padStart(2,"0"),L="border-none bg-theme-settings-input-bg text-theme-text-primary text-sm rounded-lg focus:outline-primary-button outline-none p-2.5",C="text-sm text-theme-text-secondary";function et({value:t,onChange:s}){const{t:l}=E(),r=[{value:0,label:l("scheduledJobs.builder.weekdays.sun")},{value:1,label:l("scheduledJobs.builder.weekdays.mon")},{value:2,label:l("scheduledJobs.builder.weekdays.tue")},{value:3,label:l("scheduledJobs.builder.weekdays.wed")},{value:4,label:l("scheduledJobs.builder.weekdays.thu")},{value:5,label:l("scheduledJobs.builder.weekdays.fri")},{value:6,label:l("scheduledJobs.builder.weekdays.sat")}],d=fe(t),[i,u]=h.useState(d.state),[w,v]=h.useState(d.wasFallback),N=o=>{const b={...i,...o};u(b),w&&v(!1);const x=we(b);x!==t&&s(x)};return e.jsxs("div",{className:"flex gap-3 p-3 bg-theme-settings-input-bg/40 rounded-lg",children:[w&&e.jsx("p",{className:"text-xs text-yellow-400",children:l("scheduledJobs.builder.fallbackWarning")}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:C,children:l("scheduledJobs.builder.run")}),e.jsxs("select",{value:i.frequency,onChange:o=>N({frequency:o.target.value}),className:L,children:[e.jsx("option",{value:"minute",children:l("scheduledJobs.builder.frequency.minute")}),e.jsx("option",{value:"hour",children:l("scheduledJobs.builder.frequency.hour")}),e.jsx("option",{value:"day",children:l("scheduledJobs.builder.frequency.day")}),e.jsx("option",{value:"week",children:l("scheduledJobs.builder.frequency.week")}),e.jsx("option",{value:"month",children:l("scheduledJobs.builder.frequency.month")})]})]}),i.frequency==="minute"&&e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:C,children:l("scheduledJobs.builder.every")}),e.jsx("select",{value:i.minuteInterval,onChange:o=>N({minuteInterval:parseInt(o.target.value,10)}),className:L,children:Ge.map(o=>e.jsx("option",{value:o,children:o===1?l("scheduledJobs.builder.minuteOne"):l("scheduledJobs.builder.minuteOther",{count:o})},o))})]}),i.frequency==="hour"&&e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:C,children:l("scheduledJobs.builder.atMinute")}),e.jsx("select",{value:i.hourMinuteOffset,onChange:o=>N({hourMinuteOffset:parseInt(o.target.value,10)}),className:L,children:Xe.map(o=>e.jsx("option",{value:o,children:q(o)},o))}),e.jsx("span",{className:C,children:l("scheduledJobs.builder.pastEveryHour")})]}),(i.frequency==="day"||i.frequency==="week"||i.frequency==="month")&&e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:C,children:l("scheduledJobs.builder.at")}),e.jsx("input",{type:"time",value:`${q(i.hour)}:${q(i.minute)}`,onChange:o=>{const[b,x]=o.target.value.split(":");N({hour:parseInt(b,10)||0,minute:parseInt(x,10)||0})},className:`${L} [color-scheme:dark] light:[color-scheme:light]`})]}),i.frequency==="week"&&e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:C,children:l("scheduledJobs.builder.on")}),e.jsx("div",{className:"flex gap-1 flex-wrap",children:r.map(o=>{const b=i.weekdays.includes(o.value);return e.jsx("button",{type:"button",onClick:()=>{const x=b?i.weekdays.filter(J=>J!==o.value):[...i.weekdays,o.value];N({weekdays:x.length?x:[o.value]})},className:`border-none px-3 py-1 text-xs rounded-full transition-colors ${b?"bg-zinc-50 text-zinc-950 light:bg-zinc-950 light:text-white":"bg-white/5 text-theme-text-secondary hover:bg-white/10 hover:text-theme-text-primary light:bg-slate-200 light:hover:bg-slate-300"}`,children:o.label},o.value)})})]}),i.frequency==="month"&&e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:C,children:l("scheduledJobs.builder.onDay")}),e.jsx("select",{value:i.dayOfMonth,onChange:o=>N({dayOfMonth:parseInt(o.target.value,10)}),className:L,children:Qe.map(o=>e.jsx("option",{value:o,children:o},o))}),e.jsx("span",{className:C,children:l("scheduledJobs.builder.ofEveryMonth")})]})]})}function tt({schedule:t,scheduleMode:s,error:l,onScheduleChange:r,onModeChange:d}){const{t:i,i18n:u}=E(),w=v=>{r(v.target.value)};return e.jsxs("div",{children:[e.jsxs("label",{className:"flex items-baseline gap-1.5 mb-2 text-sm font-medium text-theme-text-primary",children:[e.jsxs("span",{children:[i("scheduledJobs.modal.scheduleLabel")," ",e.jsx("span",{className:"text-red-400",children:"*"})]}),l&&e.jsx("span",{className:"text-red-400 italic font-normal",children:i("scheduledJobs.modal.required","Required")})]}),e.jsx("div",{className:"flex gap-1 mb-2 p-1 bg-theme-settings-input-bg rounded-lg w-fit",children:[{value:"builder",label:i("scheduledJobs.modal.modeBuilder")},{value:"custom",label:i("scheduledJobs.modal.modeCustom")}].map(v=>e.jsx("button",{type:"button",onClick:()=>d(v.value),className:`border-none px-3 py-1 text-xs rounded-md transition-colors ${s===v.value?"bg-zinc-50 text-zinc-950 light:bg-zinc-950 light:text-white":"text-theme-text-secondary hover:text-theme-text-primary"}`,children:v.label},v.value))}),s==="builder"&&e.jsx("div",{className:`rounded-lg border ${l?"border-red-300":"border-transparent"}`,children:e.jsx(et,{value:t,onChange:r})}),s==="custom"&&e.jsx("input",{type:"text",name:"schedule",value:t,onChange:w,placeholder:i("scheduledJobs.modal.cronPlaceholder"),className:`bg-theme-settings-input-bg text-theme-text-primary placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button outline-none block w-full p-2.5 border ${l?"border-red-300":"border-transparent"}`}),e.jsxs("p",{className:"text-xs text-theme-text-secondary mt-2",children:[i("scheduledJobs.modal.currentSchedule")," ",e.jsx("code",{className:"text-theme-text-primary",children:t}),t&&e.jsxs("span",{className:"ml-2",children:["— ",Q(t,u.language)]})]})]})}function st(t){const s=new Map;for(const l of t)for(const r of l.items||[])s.set(r.id,r);return s}function Y({state:t,disabled:s=!1}){const l=t==="checked"||t==="indeterminate";return e.jsxs("span",{"aria-hidden":"true",className:`flex items-center justify-center size-4 rounded border shrink-0 transition-colors ${s?"bg-zinc-700 border-zinc-600 opacity-50":l?"bg-sky-500 border-sky-700 light:bg-sky-600 light:border-sky-800":"bg-zinc-800 border-zinc-600 light:bg-white light:border-zinc-600"}`,children:[t==="checked"&&e.jsx(ve,{size:12,weight:"bold",className:"text-white light:text-white"}),t==="indeterminate"&&e.jsx(te,{size:12,weight:"bold",className:"text-white light:text-white"})]})}function lt({availableTools:t,selectedTools:s,onChange:l}){const{t:r}=E(),[d,i]=h.useState(""),[u,w]=h.useState(!1),[v,N]=h.useState("bottom"),[o,b]=h.useState({}),x=h.useRef(null);h.useEffect(()=>{if(!u)return;const n=g=>{var f;(f=x.current)!=null&&f.contains(g.target)||w(!1)},c=g=>{g.key==="Escape"&&w(!1)};return document.addEventListener("mousedown",n),document.addEventListener("keydown",c),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("keydown",c)}},[u]),h.useEffect(()=>{if(!u)return;const n=320,c=()=>{var R;const g=(R=x.current)==null?void 0:R.getBoundingClientRect();if(!g)return;const f=window.innerHeight-g.bottom,p=g.top;N(f<n&&p>f?"top":"bottom")};return c(),window.addEventListener("resize",c),window.addEventListener("scroll",c,!0),()=>{window.removeEventListener("resize",c),window.removeEventListener("scroll",c,!0)}},[u]);const J=h.useMemo(()=>st(t),[t]),S=h.useMemo(()=>{const n=d.trim().toLowerCase();return n?t.map(c=>{if(c.name.toLowerCase().includes(n))return c;const g=(c.items||[]).filter(f=>{var p;return f.name.toLowerCase().includes(n)||((p=f.description)==null?void 0:p.toLowerCase().includes(n))});return g.length?{...c,items:g}:null}).filter(Boolean):t},[t,d]),M=n=>d.trim()||o[n],y=n=>{b(c=>({...c,[n]:!c[n]}))},k=n=>{const c=(n.items||[]).map(f=>f.id),g=c.filter(f=>s.includes(f)).length;return g===0?"unchecked":g===c.length?"checked":"indeterminate"},O=(n,c)=>{c.stopPropagation();const g=(n.items||[]).map(f=>f.id);k(n)==="checked"?l(s.filter(f=>!g.includes(f))):l([...new Set([...s,...g])])},$=n=>{l(s.includes(n)?s.filter(c=>c!==n):[...s,n])},j=n=>l(s.filter(c=>c!==n)),m=n=>{var c;return((c=J.get(n))==null?void 0:c.name)||n};return e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-zinc-50 light:text-slate-700",children:r("scheduledJobs.modal.toolsLabel","Tools (Optional)")}),e.jsx("p",{className:"text-xs text-zinc-400 light:text-slate-600 mt-1 mb-3",children:r("scheduledJobs.modal.toolsDescription","Select which agent tools this job can use. If none are selected, the job runs without any tools.")}),e.jsxs("div",{className:"relative",ref:x,children:[e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"text",value:d,onChange:n=>i(n.target.value),onFocus:()=>w(!0),onClick:()=>w(!0),placeholder:r("scheduledJobs.modal.toolsSearch","Search tools"),className:"border border-transparent light:border-slate-300 bg-zinc-800 light:bg-white text-zinc-300 light:text-slate-700 placeholder:text-zinc-400 light:placeholder:text-slate-500 text-sm rounded-lg focus:outline-sky-500 outline-none block w-full px-3.5 py-2.5 pr-9"}),e.jsx(ne,{size:16,className:"absolute right-3 top-1/2 -translate-y-1/2 text-zinc-400 light:text-slate-500 pointer-events-none"})]}),u&&e.jsx("div",{className:`absolute left-0 right-0 z-20 max-h-80 overflow-y-auto p-1.5 bg-zinc-800 light:bg-white rounded-lg flex flex-col shadow-[0px_4px_12px_0px_rgba(0,0,0,0.35)] border border-zinc-700 light:border-slate-300 ${v==="top"?"bottom-full mb-1":"top-full mt-1"}`,children:S.length===0?e.jsx("p",{className:"text-xs text-zinc-400 light:text-slate-500 px-2 py-3 text-center",children:r("scheduledJobs.modal.toolsNoResults","No tools match")}):S.map(n=>{const c=M(n.category),g=k(n),f=(n.items||[]).filter(p=>s.includes(p.id)).length;return e.jsxs("div",{className:"mb-0.5",children:[e.jsxs("button",{type:"button",onClick:()=>y(n.category),className:"border-none flex items-center gap-2 w-full px-2 py-1.5 rounded-md text-sm font-medium text-zinc-50 light:text-slate-700 bg-zinc-700/50 light:bg-slate-100 hover:bg-zinc-700 light:hover:bg-slate-200 transition-colors",children:[c?e.jsx(re,{size:12,weight:"bold"}):e.jsx(ie,{size:12,weight:"bold"}),e.jsxs("span",{className:"flex-1 text-left truncate flex items-center gap-1.5",children:[n.name,n.requiresSetup&&e.jsxs("a",{href:Z.settings.agentSkills(),onClick:p=>p.stopPropagation(),className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-500/20 text-amber-400 light:bg-amber-100 light:text-amber-700 hover:bg-amber-500/30 light:hover:bg-amber-200 transition-colors",title:r("scheduledJobs.modal.needsSetup","This skill requires configuration before use"),children:[e.jsx(V,{size:10,weight:"fill"}),r("scheduledJobs.modal.needsSetupLabel","Needs Setup")]})]}),e.jsxs("span",{className:"text-xs text-zinc-400 light:text-slate-500 mr-1",children:[f,"/",(n.items||[]).length]}),e.jsx("span",{onClick:p=>!n.requiresSetup&&O(n,p),className:n.requiresSetup?"cursor-not-allowed":"cursor-pointer",children:e.jsx(Y,{state:g,disabled:n.requiresSetup})})]}),c&&e.jsx("div",{className:"ml-2 border-l border-zinc-700 light:border-slate-200 pl-2 mt-0.5",children:(n.items||[]).map(p=>{const R=s.includes(p.id),H=p.requiresSetup||n.requiresSetup;return e.jsxs("button",{type:"button",onClick:()=>!H&&$(p.id),disabled:H,title:p.description||void 0,className:`border-none flex items-center gap-2 w-full px-2 py-1.5 rounded-md text-sm text-zinc-300 light:text-slate-600 transition-colors ${H?"opacity-60 cursor-not-allowed":"hover:bg-zinc-700/60 light:hover:bg-slate-100"}`,children:[e.jsxs("div",{className:"flex-1 text-left",children:[e.jsxs("span",{className:"flex items-center gap-1.5 truncate",children:[p.name,p.requiresSetup&&!n.requiresSetup&&e.jsxs("a",{href:Z.settings.agentSkills(),onClick:ae=>ae.stopPropagation(),className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-500/20 text-amber-400 light:bg-amber-100 light:text-amber-700 hover:bg-amber-500/30 light:hover:bg-amber-200 transition-colors",title:r("scheduledJobs.modal.needsSetup","This skill requires configuration before use"),children:[e.jsx(V,{size:10,weight:"fill"}),r("scheduledJobs.modal.needsSetupLabel","Needs Setup")]})]}),p.description&&e.jsx("span",{className:"block text-xs text-zinc-500 light:text-slate-400 truncate",children:p.description})]}),e.jsx(Y,{state:R?"checked":"unchecked",disabled:H})]},p.id)})})]},n.category)})})]}),s.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:s.map(n=>e.jsxs("div",{className:"bg-zinc-800 light:bg-slate-200 flex gap-1.5 h-[26px] items-center justify-center px-3.5 py-0.5 rounded-full text-sm text-zinc-300 light:text-slate-700",children:[e.jsx("span",{className:"whitespace-nowrap",children:m(n)}),e.jsx("button",{type:"button",onClick:()=>j(n),"aria-label":`Remove ${m(n)}`,className:"border-none text-zinc-400 light:text-slate-500 hover:text-zinc-50 light:hover:text-slate-900 transition-colors",children:e.jsx(I,{size:12,weight:"bold"})})]},n))})]})}function at({isEditing:t,saving:s,onClose:l}){const{t:r}=E();return e.jsxs("div",{className:"flex items-center justify-between pt-4",children:[e.jsx("button",{type:"button",onClick:l,className:"border-none h-[34px] px-3.5 text-sm font-medium text-zinc-50 light:text-slate-900 border border-zinc-700 light:border-slate-600 rounded-lg hover:bg-zinc-800 light:hover:bg-slate-100 transition-colors",children:r("scheduledJobs.modal.cancel")}),e.jsx("button",{type:"submit",disabled:s,className:"border-none h-[34px] px-3.5 text-sm font-medium text-zinc-950 light:text-white bg-zinc-50 light:bg-slate-900 hover:bg-zinc-200 light:hover:bg-slate-800 rounded-lg transition-colors disabled:opacity-50",children:r(s?"scheduledJobs.modal.saving":t?"scheduledJobs.modal.updateJob":"scheduledJobs.modal.createJob")})]})}function nt(t){return{name:(t==null?void 0:t.name)||"",prompt:(t==null?void 0:t.prompt)||"",schedule:(t==null?void 0:t.schedule)||"0 9 * * *",scheduleMode:"builder",selectedTools:t!=null&&t.tools?oe(t.tools,[]):[]}}function rt({job:t=null,onClose:s,onSaved:l}){const{t:r}=E(),d=!!t,[i,u]=h.useState(nt(t)),[w,v]=h.useState([]),[N,o]=h.useState(!1),[b,x]=h.useState({name:!1,prompt:!1,schedule:!1}),J=()=>Object.values(b).some(Boolean),S=j=>{x(m=>m[j]?{...m,[j]:!1}:m)};h.useEffect(()=>{P.availableTools().then(({tools:j})=>{v(j||[])})},[]);const M=j=>{const{name:m,value:n}=j.target;u(c=>({...c,[m]:n})),S(m)},y=j=>{u(m=>({...m,schedule:j})),S("schedule")},k=j=>{u(m=>({...m,scheduleMode:j}))},O=j=>{u(m=>({...m,selectedTools:j}))},$=async j=>{j.preventDefault();const m={name:!i.name.trim(),prompt:!i.prompt.trim(),schedule:!i.schedule.trim()};if(m.name||m.prompt||m.schedule){x(m);return}o(!0);const n={name:i.name.trim(),prompt:i.prompt.trim(),schedule:i.schedule.trim(),tools:i.selectedTools},c=d?await P.update(t.id,n):await P.create(n);if(o(!1),c.error){A(c.error,"error");return}A(r(d?"scheduledJobs.modal.jobUpdated":"scheduledJobs.modal.jobCreated"),"success"),l()};return e.jsx("div",{className:"relative w-full max-w-2xl max-h-full",children:e.jsxs("div",{className:"relative bg-theme-bg-secondary rounded-lg shadow border border-theme-modal-border",children:[e.jsxs("div",{className:"flex flex-col gap-1 p-4 border-b rounded-t border-theme-modal-border",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx("h3",{className:"text-xl font-semibold text-theme-text-primary",children:r(d?"scheduledJobs.modal.titleEdit":"scheduledJobs.modal.titleNew")}),e.jsx("button",{onClick:s,type:"button",className:"border-none transition-all duration-300 text-gray-400 bg-transparent hover:border-white/60 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center",children:e.jsx(I,{className:"text-gray-300 text-lg"})})]}),J()&&e.jsxs("div",{className:"flex gap-1 items-center",children:[e.jsx(ge,{size:16,className:"text-red-400 shrink-0"}),e.jsx("p",{className:"text-sm text-red-400",children:r("scheduledJobs.modal.requiredFieldsBanner","Please fill out all required fields in order to create job.")})]})]}),e.jsxs("form",{onSubmit:$,className:"p-6 space-y-6",children:[e.jsx(Ye,{form:i,errors:b,onChange:M}),e.jsx(tt,{schedule:i.schedule,scheduleMode:i.scheduleMode,error:b.schedule,onScheduleChange:y,onModeChange:k}),w.length>0&&e.jsx(lt,{availableTools:w,selectedTools:i.selectedTools,onChange:O}),e.jsx(at,{isEditing:d,saving:N,onClose:s})]})]})})}function it({job:t,onTrigger:s,onToggle:l,onEdit:r,onDelete:d}){var b,x;const i=ce(),{t:u,i18n:w}=E(),v=((b=t.latestRun)==null?void 0:b.status)==="running"||((x=t.latestRun)==null?void 0:x.status)==="queued",N=t.latestRun?u(`scheduledJobs.status.${t.latestRun.status}`,t.latestRun.status):u("scheduledJobs.row.neverRun"),o=J=>S=>{S.stopPropagation(),J()};return e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>i(Z.settings.scheduledJobRuns(t.id)),onKeyDown:J=>{(J.key==="Enter"||J.key===" ")&&(J.preventDefault(),i(Z.settings.scheduledJobRuns(t.id)))},className:"flex items-center justify-between px-4 h-14 hover:bg-white/5 light:hover:bg-slate-200 transition-colors cursor-pointer",title:u("scheduledJobs.row.viewRuns"),children:[e.jsx("span",{className:"w-[150px] text-sm font-medium text-white light:text-slate-950 truncate",children:t.name}),e.jsx("span",{className:"w-[180px] text-sm text-zinc-400 light:text-slate-600 truncate",children:Q(t.schedule,w.language)}),e.jsx("span",{className:"w-[120px] text-sm text-zinc-400 light:text-slate-600 truncate",children:N}),e.jsx("span",{className:"w-[180px] text-sm text-zinc-400 light:text-slate-600 truncate",children:t.lastRunAt?new Date(t.lastRunAt).toLocaleString():"—"}),e.jsx("span",{className:"w-[180px] text-sm text-zinc-400 light:text-slate-600 truncate",children:t.enabled&&t.nextRunAt?new Date(t.nextRunAt).toLocaleString():"—"}),e.jsxs("div",{className:"w-[140px] flex items-center justify-end gap-1",children:[e.jsx("button",{type:"button",onClick:o(()=>d(t.id)),className:"border-none p-2 rounded-full text-zinc-400 light:text-slate-950 hover:text-red-400 light:hover:text-red-600 hover:bg-white/10 light:hover:bg-slate-300/50 transition-colors",title:u("scheduledJobs.row.delete"),children:e.jsx(I,{className:"h-4 w-4 shrink-0"})}),e.jsx("button",{type:"button",onClick:o(()=>r(t)),className:"border-none p-2 rounded-full text-zinc-400 light:text-slate-950 hover:text-white light:hover:text-slate-700 hover:bg-white/10 light:hover:bg-slate-300/50 transition-colors",title:u("scheduledJobs.row.edit"),children:e.jsx(de,{className:"h-4 w-4 shrink-0"})}),e.jsx("button",{type:"button",onClick:o(()=>s(t.id)),disabled:v,className:"border-none p-2 rounded-full text-zinc-400 light:text-slate-950 hover:text-white light:hover:text-slate-700 hover:bg-white/10 light:hover:bg-slate-300/50 transition-colors disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent",title:u("scheduledJobs.row.runNow"),children:e.jsx(se,{className:"h-4 w-4 shrink-0"})}),e.jsx("button",{type:"button",role:"switch","aria-checked":t.enabled,onClick:o(()=>l(t.id)),title:t.enabled?u("scheduledJobs.row.disable"):u("scheduledJobs.row.enable"),className:`border-none relative h-[15px] w-7 rounded-full p-0.5 transition-colors ${t.enabled?"bg-green-400":"bg-zinc-600 light:bg-slate-300"}`,children:e.jsx("span",{className:`block h-3 w-3 rounded-full bg-white shadow transition-transform ${t.enabled?"translate-x-[13px]":"translate-x-0"}`})})]})]})}function xt(){const{t}=E();Ue(!1);const{isOpen:s,openModal:l,closeModal:r}=ue(),[d,i]=h.useState(!0),[u,w]=h.useState([]),[v,N]=h.useState(null),o=async()=>{const{jobs:y}=await P.list();w(y||[]),i(!1)};h.useEffect(()=>{o()},[]),be(o,5e3);const b=async y=>{window.confirm(t("scheduledJobs.confirmDelete"))&&(await P.delete(y),A(t("scheduledJobs.toast.deleted"),"success",{clear:!0}),o())},x=async y=>{const k=await P.toggle(y);k!=null&&k.error&&A(k.error,"error",{clear:!0}),o()},J=async y=>{const{success:k,skipped:O,error:$}=await P.trigger(y);k?O?A(t("scheduledJobs.toast.triggerSkipped","A run is already in progress for this job"),"info",{clear:!0}):A(t("scheduledJobs.toast.triggered"),"success",{clear:!0}):A($||t("scheduledJobs.toast.triggerFailed"),"error",{clear:!0}),o()},S=y=>{N(y),l()},M=()=>{N(null),l()};return d?e.jsx(G,{showNewJobButton:!1,handleCreate:M,children:e.jsx("div",{className:"w-full flex items-center justify-center text-zinc-400 light:text-slate-600 text-sm pt-8",children:t("scheduledJobs.loading")})}):e.jsxs(G,{showNewJobButton:u.length!==0,handleCreate:M,children:[e.jsxs("div",{className:"pt-8",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 pb-[18px] text-xs font-semibold uppercase tracking-[1.4px] text-zinc-400 light:text-slate-600",children:[e.jsx("span",{className:"w-[150px]",children:t("scheduledJobs.table.name")}),e.jsx("span",{className:"w-[180px]",children:t("scheduledJobs.table.schedule")}),e.jsx("span",{className:"w-[120px]",children:t("scheduledJobs.table.status")}),e.jsx("span",{className:"w-[180px]",children:t("scheduledJobs.table.lastRun")}),e.jsx("span",{className:"w-[180px]",children:t("scheduledJobs.table.nextRun")}),e.jsx("span",{className:"w-[140px] text-right",children:t("scheduledJobs.table.actions")})]}),e.jsx("div",{className:"h-px w-full bg-white/10 light:bg-slate-300"}),u.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-8 py-24 text-center",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("p",{className:"text-base font-semibold text-zinc-50 light:text-slate-950",children:t("scheduledJobs.emptyTitle")}),e.jsx("p",{className:"text-sm font-medium text-zinc-400 light:text-slate-600",children:t("scheduledJobs.emptySubtitle")})]}),e.jsx("button",{type:"button",onClick:M,className:"border-none h-9 px-5 rounded-lg bg-zinc-50 text-zinc-950 light:bg-slate-900 light:text-white text-sm font-medium hover:bg-zinc-200 light:hover:bg-slate-800 transition-colors",children:t("scheduledJobs.newJob")})]}):e.jsx("div",{className:"flex flex-col divide-y divide-white/5 light:divide-slate-300",children:u.map(y=>e.jsx(it,{job:y,onTrigger:J,onToggle:x,onEdit:S,onDelete:b},y.id))})]}),e.jsx(he,{isOpen:s,children:e.jsx(rt,{job:v,onClose:r,onSaved:()=>{r(),o()}})})]})}function G({showNewJobButton:t=!1,handleCreate:s=()=>{},children:l}){const{t:r}=E();return e.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex",children:[e.jsx(me,{}),e.jsx("div",{style:{height:pe?"100%":"calc(100% - 32px)"},className:"relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-theme-bg-secondary w-full h-full overflow-y-scroll p-4 md:p-0",children:e.jsxs("div",{className:"flex flex-col w-full px-1 md:pl-6 md:pr-[50px] md:py-6 py-16",children:[e.jsxs("div",{className:"w-full flex items-end justify-between gap-x-4 pb-6 border-white/10 light:border-slate-300 border-b-2",children:[e.jsxs("div",{className:"flex flex-col gap-y-2",children:[e.jsx("p",{className:"text-lg leading-7 font-semibold text-zinc-50 light:text-slate-950",children:r("scheduledJobs.title")}),e.jsx("p",{className:"text-xs leading-4 text-zinc-400 light:text-slate-600 max-w-[700px]",children:r("scheduledJobs.description")})]}),e.jsxs("div",{className:"flex items-center gap-x-2 shrink-0",children:[e.jsx(ot,{}),t&&e.jsx("button",{type:"button",onClick:s,className:"border-none h-9 px-5 rounded-lg bg-zinc-50 text-zinc-950 light:bg-slate-900 light:text-white text-sm font-medium hover:bg-zinc-200 light:hover:bg-slate-800 transition-colors",children:r("scheduledJobs.newJob")})]})]}),l]})})]})}function ot(){const{t}=E(),[s,l]=h.useState(typeof Notification<"u"?Notification.permission:"denied");if(!("serviceWorker"in navigator)||!("PushManager"in window)||s==="granted")return null;const r=async()=>{await le(),l(Notification.permission)};return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:r,"data-tooltip-id":"notification-bell-tooltip","data-tooltip-content":t("scheduledJobs.enableNotifications","Enable browser notifications for job results"),className:"flex items-center justify-center w-9 h-9 rounded-lg hover:bg-white/10 light:hover:bg-slate-200 transition-colors",children:e.jsx(ee,{size:20,className:"text-orange-400"})}),e.jsx(xe,{id:"notification-bell-tooltip",place:"bottom",className:"tooltip !text-xs"})]})}export{xt as default};
@@ -1 +1 @@
1
- import{u as P,a as k,r as d,j as t,i as w,W as f,b as I,p as E,s as _,L,c as C,P as F,d as U,e as R,f as z}from"../index.js";import{S as A,a as H}from"./index-6cdecde9.js";import{P as M,D as O,a as D,b as N,C as B,c as G,W as J,d as Q,e as V,Q as q,S as K,f as X,M as Y,g as T}from"./index-73aba4c6.js";import"./truncate-352eb33b.js";import"./XCircle-edfe554c.js";import"./moment-8a59df1b.js";import"./File-b92df2f3.js";import"./Eye-9f033dc0.js";import"./index-4fb4d421.js";import"./react-beautiful-dnd.esm-45ea8487.js";import"./mcpServers-a175e8cf.js";import"./admin-04b020fe.js";import"./Database-f1a76329.js";import"./Copy-d323e545.js";import"./Trans-ca8f9cfe.js";import"./Brain-24e386d5.js";import"./Browser-1820fad0.js";import"./agentFlows-e4124dd3.js";import"./index-2f526c2a.js";import"./communityHub-aba61686.js";import"./WarningCircle-27467274.js";async function Z(){const s=_(localStorage.getItem(L));if(s!=null&&s.slug){const n=await f.bySlug(s.slug);if(n)return n}const r=await f.all();return r.length>0?r[0]:null}async function S(s="My Workspace"){const{workspace:r,message:n}=await f.new({name:s});return r||(C(n||"Failed to create workspace","error"),null)}function $(){const{t:s}=P(),{user:r}=k(),[n,h]=d.useState(null),[c,u]=d.useState(null),[v,p]=d.useState(!0),[b,x]=d.useState(!1),g=d.useRef([]);d.useEffect(()=>{async function o(){const e=await Z();if(e){const[i,{showAgentCommand:a}]=await Promise.all([f.getSuggestedMessages(e.slug),f.agentCommandAvailable(e.slug)]);h({...e,suggestedMessages:i,showAgentCommand:a})}p(!1)}o()},[]),d.useEffect(()=>{if(n&&c&&g.current.length>0){const o=g.current;g.current=[],window.dispatchEvent(new CustomEvent(M,{detail:{files:o}}))}},[n,c]),d.useEffect(()=>{if(c)return;async function o(e){var m;const i=(m=e.detail)==null?void 0:m.files;if(!(i!=null&&i.length))return;g.current=i;let a=n;if(!a){if(a=await S(s("new-workspace.placeholder")),!a)return;h(a)}const{thread:l}=await f.threads.new(a.slug);l&&u(l.slug)}return window.addEventListener(M,o),()=>window.removeEventListener(M,o)},[n,c]);async function y(o){x(!1),g.current=o;const e=await S(s("new-workspace.placeholder"));if(!e)return;h(e);const{thread:i}=await f.threads.new(e.slug);i&&u(i.slug)}async function j(o){x(!1),g.current=o;const{thread:e}=await f.threads.new(n.slug);e&&u(e.slug)}return v?t.jsx("div",{style:{height:w?"100%":"calc(100% - 32px)"},className:"transition-all duration-500 relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-zinc-900 light:bg-white w-full h-full overflow-hidden"}):!n&&(r==null?void 0:r.role)==="default"?t.jsx(ee,{}):n&&c?t.jsx(O,{workspace:n,threadSlug:c,children:t.jsx(W,{workspace:n,setWorkspace:h,threadSlug:c,setThreadSlug:u})}):t.jsx(D.Provider,{value:{files:[],ready:!0,dragging:b,setDragging:x,onDrop:n?j:y,parseAttachments:()=>[]},children:t.jsx(W,{workspace:n,setWorkspace:h,threadSlug:null,setThreadSlug:u})})}function W({workspace:s,setWorkspace:r,threadSlug:n,setThreadSlug:h}){const{t:c}=P(),u=I(),[v,p]=d.useState(!1),{files:b,parseAttachments:x}=d.useContext(D);d.useEffect(()=>{window.dispatchEvent(new CustomEvent(N,{detail:{messageContent:"",writeMode:"replace"}}))},[]);async function g(e,i=[]){if(!(!e||v)){p(!0);try{let a=s,l=n;if(!a){if(a=await S(c("new-workspace.placeholder")),!a){p(!1);return}r(a)}if(!l){const{thread:m}=await f.threads.new(a.slug);l=m==null?void 0:m.slug,m&&h(m.slug)}sessionStorage.setItem(F,JSON.stringify({message:e,attachments:i})),u(l?E.workspace.thread(a.slug,l):E.workspace.chat(a.slug))}catch(a){console.error("Error submitting message:",a),C("Failed to send message","error"),p(!1)}}}async function y(e){var a,l;e.preventDefault();const i=((l=(a=document.getElementById(T))==null?void 0:a.value)==null?void 0:l.trim())||"";await g(i,x())}function j({text:e="",autoSubmit:i=!1,writeMode:a="replace"}){var l;if(i){if(a==="append"&&(e=(((l=document.getElementById(T))==null?void 0:l.value)??"")+e),!e.trim())return;g(e.trim());return}window.dispatchEvent(new CustomEvent(N,{detail:{messageContent:e,writeMode:a}}))}async function o(){let e=s;if(!e){if(e=await S(c("new-workspace.placeholder")),!e)return;r(e)}u(E.workspace.settings.generalAppearance(e.slug))}return t.jsx(B,{children:t.jsxs("div",{style:{height:w?"100%":"calc(100% - 32px)"},className:"relative flex md:ml-[2px] md:mr-[16px] md:my-[16px] w-full h-full z-[2]",children:[t.jsx(G,{}),t.jsxs("div",{className:"flex-1 min-w-0 transition-all duration-500 relative md:rounded-[16px] bg-zinc-900 light:bg-white w-full h-full overflow-hidden border-none light:border-solid light:border light:border-theme-modal-border",children:[w&&t.jsx(A,{}),t.jsx(J,{workspaceSlug:s==null?void 0:s.slug}),t.jsx(Q,{children:t.jsxs("div",{className:"flex flex-col h-full w-full items-center justify-center",children:[t.jsxs("div",{className:"flex flex-col items-center w-full max-w-[750px]",children:[t.jsx("h1",{className:"text-white text-xl md:text-2xl mb-11 text-center",children:c("main-page.greeting")}),t.jsx(V,{workspace:s,submit:y,isStreaming:v,sendCommand:j,attachments:b,centered:!0,workspaceSlug:s==null?void 0:s.slug,threadSlug:n}),t.jsx(q,{hasAvailableWorkspace:!!s,onCreateAgent:()=>u(E.settings.agentSkills()),onEditWorkspace:o,onUploadDocument:()=>{var e;return(e=document.getElementById("dnd-chat-file-uploader"))==null?void 0:e.click()}})]}),t.jsx(K,{suggestedMessages:s==null?void 0:s.suggestedMessages,sendCommand:j})]})}),t.jsx(X,{})]}),t.jsx(Y,{workspace:s})]})})}function ee(){const{t:s}=P();return t.jsx("div",{style:{height:w?"100%":"calc(100% - 32px)"},className:"transition-all duration-500 relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-zinc-900 light:bg-white w-full h-full overflow-hidden",children:t.jsx("div",{className:"flex flex-col h-full w-full items-center justify-center",children:t.jsx("p",{className:"text-white/60 text-sm text-center whitespace-pre-line",children:s("home.notAssigned")})})})}function Se(){const{loading:s,requiresAuth:r,mode:n}=U();return s?t.jsx(R,{}):r!==!1?t.jsx(t.Fragment,{children:r!==null&&t.jsx(z,{mode:n})}):t.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-zinc-950 light:bg-slate-50 flex",children:[w?t.jsx(A,{}):t.jsx(H,{}),t.jsx($,{})]})}export{Se as default};
1
+ import{u as P,a as k,r as d,j as t,i as w,W as f,b as I,p as E,s as _,L,c as C,P as F,d as U,e as R,f as z}from"../index.js";import{S as A,a as H}from"./index-6bd7928a.js";import{P as M,D as O,a as D,b as N,C as B,c as G,W as J,d as Q,e as V,Q as q,S as K,f as X,M as Y,g as T}from"./index-dcc00e8c.js";import"./truncate-06273256.js";import"./XCircle-edfe554c.js";import"./moment-75486807.js";import"./File-b92df2f3.js";import"./Eye-9f033dc0.js";import"./index-4fb4d421.js";import"./react-beautiful-dnd.esm-bb85eef1.js";import"./mcpServers-1686e782.js";import"./admin-04b020fe.js";import"./Database-f1a76329.js";import"./Copy-d323e545.js";import"./Trans-820f1dad.js";import"./Brain-24e386d5.js";import"./Browser-1820fad0.js";import"./agentFlows-e4124dd3.js";import"./index-3cb59d82.js";import"./communityHub-aba61686.js";import"./WarningCircle-27467274.js";async function Z(){const s=_(localStorage.getItem(L));if(s!=null&&s.slug){const n=await f.bySlug(s.slug);if(n)return n}const r=await f.all();return r.length>0?r[0]:null}async function S(s="My Workspace"){const{workspace:r,message:n}=await f.new({name:s});return r||(C(n||"Failed to create workspace","error"),null)}function $(){const{t:s}=P(),{user:r}=k(),[n,h]=d.useState(null),[c,u]=d.useState(null),[v,p]=d.useState(!0),[b,x]=d.useState(!1),g=d.useRef([]);d.useEffect(()=>{async function o(){const e=await Z();if(e){const[i,{showAgentCommand:a}]=await Promise.all([f.getSuggestedMessages(e.slug),f.agentCommandAvailable(e.slug)]);h({...e,suggestedMessages:i,showAgentCommand:a})}p(!1)}o()},[]),d.useEffect(()=>{if(n&&c&&g.current.length>0){const o=g.current;g.current=[],window.dispatchEvent(new CustomEvent(M,{detail:{files:o}}))}},[n,c]),d.useEffect(()=>{if(c)return;async function o(e){var m;const i=(m=e.detail)==null?void 0:m.files;if(!(i!=null&&i.length))return;g.current=i;let a=n;if(!a){if(a=await S(s("new-workspace.placeholder")),!a)return;h(a)}const{thread:l}=await f.threads.new(a.slug);l&&u(l.slug)}return window.addEventListener(M,o),()=>window.removeEventListener(M,o)},[n,c]);async function y(o){x(!1),g.current=o;const e=await S(s("new-workspace.placeholder"));if(!e)return;h(e);const{thread:i}=await f.threads.new(e.slug);i&&u(i.slug)}async function j(o){x(!1),g.current=o;const{thread:e}=await f.threads.new(n.slug);e&&u(e.slug)}return v?t.jsx("div",{style:{height:w?"100%":"calc(100% - 32px)"},className:"transition-all duration-500 relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-zinc-900 light:bg-white w-full h-full overflow-hidden"}):!n&&(r==null?void 0:r.role)==="default"?t.jsx(ee,{}):n&&c?t.jsx(O,{workspace:n,threadSlug:c,children:t.jsx(W,{workspace:n,setWorkspace:h,threadSlug:c,setThreadSlug:u})}):t.jsx(D.Provider,{value:{files:[],ready:!0,dragging:b,setDragging:x,onDrop:n?j:y,parseAttachments:()=>[]},children:t.jsx(W,{workspace:n,setWorkspace:h,threadSlug:null,setThreadSlug:u})})}function W({workspace:s,setWorkspace:r,threadSlug:n,setThreadSlug:h}){const{t:c}=P(),u=I(),[v,p]=d.useState(!1),{files:b,parseAttachments:x}=d.useContext(D);d.useEffect(()=>{window.dispatchEvent(new CustomEvent(N,{detail:{messageContent:"",writeMode:"replace"}}))},[]);async function g(e,i=[]){if(!(!e||v)){p(!0);try{let a=s,l=n;if(!a){if(a=await S(c("new-workspace.placeholder")),!a){p(!1);return}r(a)}if(!l){const{thread:m}=await f.threads.new(a.slug);l=m==null?void 0:m.slug,m&&h(m.slug)}sessionStorage.setItem(F,JSON.stringify({message:e,attachments:i})),u(l?E.workspace.thread(a.slug,l):E.workspace.chat(a.slug))}catch(a){console.error("Error submitting message:",a),C("Failed to send message","error"),p(!1)}}}async function y(e){var a,l;e.preventDefault();const i=((l=(a=document.getElementById(T))==null?void 0:a.value)==null?void 0:l.trim())||"";await g(i,x())}function j({text:e="",autoSubmit:i=!1,writeMode:a="replace"}){var l;if(i){if(a==="append"&&(e=(((l=document.getElementById(T))==null?void 0:l.value)??"")+e),!e.trim())return;g(e.trim());return}window.dispatchEvent(new CustomEvent(N,{detail:{messageContent:e,writeMode:a}}))}async function o(){let e=s;if(!e){if(e=await S(c("new-workspace.placeholder")),!e)return;r(e)}u(E.workspace.settings.generalAppearance(e.slug))}return t.jsx(B,{children:t.jsxs("div",{style:{height:w?"100%":"calc(100% - 32px)"},className:"relative flex md:ml-[2px] md:mr-[16px] md:my-[16px] w-full h-full z-[2]",children:[t.jsx(G,{}),t.jsxs("div",{className:"flex-1 min-w-0 transition-all duration-500 relative md:rounded-[16px] bg-zinc-900 light:bg-white w-full h-full overflow-hidden border-none light:border-solid light:border light:border-theme-modal-border",children:[w&&t.jsx(A,{}),t.jsx(J,{workspaceSlug:s==null?void 0:s.slug}),t.jsx(Q,{children:t.jsxs("div",{className:"flex flex-col h-full w-full items-center justify-center",children:[t.jsxs("div",{className:"flex flex-col items-center w-full max-w-[750px]",children:[t.jsx("h1",{className:"text-white text-xl md:text-2xl mb-11 text-center",children:c("main-page.greeting")}),t.jsx(V,{workspace:s,submit:y,isStreaming:v,sendCommand:j,attachments:b,centered:!0,workspaceSlug:s==null?void 0:s.slug,threadSlug:n}),t.jsx(q,{hasAvailableWorkspace:!!s,onCreateAgent:()=>u(E.settings.agentSkills()),onEditWorkspace:o,onUploadDocument:()=>{var e;return(e=document.getElementById("dnd-chat-file-uploader"))==null?void 0:e.click()}})]}),t.jsx(K,{suggestedMessages:s==null?void 0:s.suggestedMessages,sendCommand:j})]})}),t.jsx(X,{})]}),t.jsx(Y,{workspace:s})]})})}function ee(){const{t:s}=P();return t.jsx("div",{style:{height:w?"100%":"calc(100% - 32px)"},className:"transition-all duration-500 relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-zinc-900 light:bg-white w-full h-full overflow-hidden",children:t.jsx("div",{className:"flex flex-col h-full w-full items-center justify-center",children:t.jsx("p",{className:"text-white/60 text-sm text-center whitespace-pre-line",children:s("home.notAssigned")})})})}function Se(){const{loading:s,requiresAuth:r,mode:n}=U();return s?t.jsx(R,{}):r!==!1?t.jsx(t.Fragment,{children:r!==null&&t.jsx(z,{mode:n})}):t.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-zinc-950 light:bg-slate-50 flex",children:[w?t.jsx(A,{}):t.jsx(H,{}),t.jsx($,{})]})}export{Se as default};