reflex-agent 0.9.1 → 0.10.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 (163) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +93 -93
  3. package/.next/app-path-routes-manifest.json +8 -8
  4. package/.next/build-manifest.json +5 -5
  5. package/.next/prerender-manifest.json +3 -3
  6. package/.next/react-loadable-manifest.json +1 -1
  7. package/.next/server/app/_not-found/page.js +1 -1
  8. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  9. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  10. package/.next/server/app/agents/[agentId]/page.js +2 -3
  11. package/.next/server/app/agents/[agentId]/page.js.nft.json +1 -1
  12. package/.next/server/app/agents/[agentId]/page_client-reference-manifest.js +1 -1
  13. package/.next/server/app/api/agents/[agentId]/respond/route.js +1 -2
  14. package/.next/server/app/api/agents/[agentId]/respond/route.js.nft.json +1 -1
  15. package/.next/server/app/api/agents/[agentId]/respond/route_client-reference-manifest.js +1 -1
  16. package/.next/server/app/api/images/[rootId]/[file]/route_client-reference-manifest.js +1 -1
  17. package/.next/server/app/api/oauth/callback/route.js +2 -2
  18. package/.next/server/app/api/oauth/callback/route_client-reference-manifest.js +1 -1
  19. package/.next/server/app/api/oauth/start/route_client-reference-manifest.js +1 -1
  20. package/.next/server/app/api/roots/[id]/attachments/route_client-reference-manifest.js +1 -1
  21. package/.next/server/app/api/roots/[id]/chat/[topicId]/send/route.js +1 -2
  22. package/.next/server/app/api/roots/[id]/chat/[topicId]/send/route.js.nft.json +1 -1
  23. package/.next/server/app/api/roots/[id]/chat/[topicId]/send/route_client-reference-manifest.js +1 -1
  24. package/.next/server/app/api/roots/[id]/chat/[topicId]/stop/route.js +1 -2
  25. package/.next/server/app/api/roots/[id]/chat/[topicId]/stop/route.js.nft.json +1 -1
  26. package/.next/server/app/api/roots/[id]/chat/[topicId]/stop/route_client-reference-manifest.js +1 -1
  27. package/.next/server/app/api/roots/[id]/chat/[topicId]/stream/route.js +2 -3
  28. package/.next/server/app/api/roots/[id]/chat/[topicId]/stream/route.js.nft.json +1 -1
  29. package/.next/server/app/api/roots/[id]/chat/[topicId]/stream/route_client-reference-manifest.js +1 -1
  30. package/.next/server/app/api/roots/[id]/dashboard/route.js +1 -1
  31. package/.next/server/app/api/roots/[id]/dashboard/route.js.nft.json +1 -1
  32. package/.next/server/app/api/roots/[id]/dashboard/route_client-reference-manifest.js +1 -1
  33. package/.next/server/app/api/roots/[id]/suggestions/route.js +1 -1
  34. package/.next/server/app/api/roots/[id]/suggestions/route.js.nft.json +1 -1
  35. package/.next/server/app/api/roots/[id]/suggestions/route_client-reference-manifest.js +1 -1
  36. package/.next/server/app/api/utilities/[scope]/[id]/bundle.js/route_client-reference-manifest.js +1 -1
  37. package/.next/server/app/api/utilities/[scope]/[id]/host/route.js +1 -2
  38. package/.next/server/app/api/utilities/[scope]/[id]/host/route.js.nft.json +1 -1
  39. package/.next/server/app/api/utilities/[scope]/[id]/host/route_client-reference-manifest.js +1 -1
  40. package/.next/server/app/api/utilities/[scope]/[id]/host-api.mjs/route_client-reference-manifest.js +1 -1
  41. package/.next/server/app/api/utilities/[scope]/[id]/host-ui.mjs/route_client-reference-manifest.js +1 -1
  42. package/.next/server/app/api/utilities/[scope]/[id]/iframe/route_client-reference-manifest.js +1 -1
  43. package/.next/server/app/api/utilities/[scope]/[id]/style.css/route_client-reference-manifest.js +1 -1
  44. package/.next/server/app/audit/page.js +1 -1
  45. package/.next/server/app/audit/page.js.nft.json +1 -1
  46. package/.next/server/app/audit/page_client-reference-manifest.js +1 -1
  47. package/.next/server/app/onboarding/page.js +3 -4
  48. package/.next/server/app/onboarding/page.js.nft.json +1 -1
  49. package/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  50. package/.next/server/app/page.js +2 -3
  51. package/.next/server/app/page.js.nft.json +1 -1
  52. package/.next/server/app/page_client-reference-manifest.js +1 -1
  53. package/.next/server/app/roots/[id]/chat/[topicId]/page.js +2 -3
  54. package/.next/server/app/roots/[id]/chat/[topicId]/page.js.nft.json +1 -1
  55. package/.next/server/app/roots/[id]/chat/[topicId]/page_client-reference-manifest.js +1 -1
  56. package/.next/server/app/roots/[id]/kb/[...slug]/page.js +2 -2
  57. package/.next/server/app/roots/[id]/kb/[...slug]/page.js.nft.json +1 -1
  58. package/.next/server/app/roots/[id]/kb/[...slug]/page_client-reference-manifest.js +1 -1
  59. package/.next/server/app/roots/[id]/page.js +6 -6
  60. package/.next/server/app/roots/[id]/page.js.nft.json +1 -1
  61. package/.next/server/app/roots/[id]/page_client-reference-manifest.js +1 -1
  62. package/.next/server/app/roots/[id]/workflows/[wfId]/page.js +2 -2
  63. package/.next/server/app/roots/[id]/workflows/[wfId]/page.js.nft.json +1 -1
  64. package/.next/server/app/roots/[id]/workflows/[wfId]/page_client-reference-manifest.js +1 -1
  65. package/.next/server/app/roots/[id]/workflows/page.js +2 -2
  66. package/.next/server/app/roots/[id]/workflows/page.js.nft.json +1 -1
  67. package/.next/server/app/roots/[id]/workflows/page_client-reference-manifest.js +1 -1
  68. package/.next/server/app/roots/new/page.js +3 -3
  69. package/.next/server/app/roots/new/page.js.nft.json +1 -1
  70. package/.next/server/app/roots/new/page_client-reference-manifest.js +1 -1
  71. package/.next/server/app/settings/page.js +4 -4
  72. package/.next/server/app/settings/page.js.nft.json +1 -1
  73. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  74. package/.next/server/app/share/[id]/file/page.js +2 -2
  75. package/.next/server/app/share/[id]/file/page.js.nft.json +1 -1
  76. package/.next/server/app/share/[id]/file/page_client-reference-manifest.js +1 -1
  77. package/.next/server/app/share/[id]/page.js +2 -2
  78. package/.next/server/app/share/[id]/page.js.nft.json +1 -1
  79. package/.next/server/app/share/[id]/page_client-reference-manifest.js +1 -1
  80. package/.next/server/app/utilities/[scope]/[id]/page.js +2 -2
  81. package/.next/server/app/utilities/[scope]/[id]/page.js.nft.json +1 -1
  82. package/.next/server/app/utilities/[scope]/[id]/page_client-reference-manifest.js +1 -1
  83. package/.next/server/app/utilities/page.js +2 -2
  84. package/.next/server/app/utilities/page.js.nft.json +1 -1
  85. package/.next/server/app/utilities/page_client-reference-manifest.js +1 -1
  86. package/.next/server/app-paths-manifest.json +8 -8
  87. package/.next/server/chunks/1105.js +1 -1
  88. package/.next/server/chunks/1198.js +1 -0
  89. package/.next/server/chunks/1358.js +1 -1
  90. package/.next/server/chunks/2722.js +1 -0
  91. package/.next/server/chunks/285.js +6 -6
  92. package/.next/server/chunks/3332.js +1 -1
  93. package/.next/server/chunks/4812.js +1 -1
  94. package/.next/server/chunks/4925.js +1 -1
  95. package/.next/server/chunks/5090.js +1 -0
  96. package/.next/server/chunks/{1988.js → 5470.js} +2 -2
  97. package/.next/server/chunks/5934.js +1 -0
  98. package/.next/server/chunks/6216.js +1 -1
  99. package/.next/server/chunks/6622.js +3 -0
  100. package/.next/server/chunks/7229.js +2 -0
  101. package/.next/server/chunks/7358.js +4 -4
  102. package/.next/server/chunks/9098.js +1 -1
  103. package/.next/server/chunks/{6326.js → 9333.js} +2 -2
  104. package/.next/server/chunks/9631.js +2 -2
  105. package/.next/server/chunks/{3749.js → 9809.js} +1 -1
  106. package/.next/server/functions-config-manifest.json +1 -1
  107. package/.next/server/middleware-build-manifest.js +1 -1
  108. package/.next/server/middleware-manifest.json +5 -5
  109. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  110. package/.next/server/pages/500.html +1 -1
  111. package/.next/server/pages/_error.js +3 -3
  112. package/.next/server/pages-manifest.json +1 -1
  113. package/.next/server/server-reference-manifest.js +1 -1
  114. package/.next/server/server-reference-manifest.json +1 -1
  115. package/.next/static/chunks/1166-5f91e07573aba5c2.js +1 -0
  116. package/.next/static/chunks/1316-fbbc7e5231784e28.js +1 -0
  117. package/.next/static/chunks/1520-eeab8b7f39ffea7b.js +1 -0
  118. package/.next/static/chunks/4108.5478f85adbbd1337.js +1 -0
  119. package/.next/static/chunks/5779-5be906c67d9d3c80.js +1 -0
  120. package/.next/static/chunks/6594-fcdf71ca82322736.js +1 -0
  121. package/.next/static/chunks/app/layout-5e299e9b79abfedf.js +1 -0
  122. package/.next/static/chunks/app/onboarding/page-1cde2db95ed14b64.js +1 -0
  123. package/.next/static/chunks/app/page-1ea9bd7d8a2c7e0d.js +1 -0
  124. package/.next/static/chunks/app/roots/[id]/chat/[topicId]/{page-dc406db1caaa8b38.js → page-5e805f15e4b1cdf6.js} +1 -1
  125. package/.next/static/chunks/app/roots/[id]/kb/[...slug]/page-9424547b67be2a76.js +1 -0
  126. package/.next/static/chunks/app/roots/[id]/page-c3140c542b7fc06d.js +1 -0
  127. package/.next/static/chunks/app/roots/[id]/workflows/[wfId]/page-4da7b5a46cbaf70c.js +1 -0
  128. package/.next/static/chunks/app/roots/new/page-ed360b415bf7fe38.js +1 -0
  129. package/.next/static/chunks/app/settings/page-27ef527431277f6b.js +1 -0
  130. package/.next/static/chunks/app/share/[id]/page-70b32c2d1c5819a4.js +1 -0
  131. package/.next/static/chunks/app/utilities/[scope]/[id]/page-3f219cbd957603ef.js +1 -0
  132. package/.next/static/chunks/app/utilities/page-5f8903782a48ebac.js +1 -0
  133. package/.next/static/chunks/{webpack-274d59f6d4391442.js → webpack-ab6092bb760ab431.js} +1 -1
  134. package/.next/trace +89 -89
  135. package/package.json +1 -1
  136. package/.next/server/chunks/1088.js +0 -1
  137. package/.next/server/chunks/192.js +0 -1
  138. package/.next/server/chunks/2143.js +0 -1
  139. package/.next/server/chunks/2356.js +0 -1
  140. package/.next/server/chunks/3775.js +0 -1
  141. package/.next/server/chunks/445.js +0 -3
  142. package/.next/server/chunks/5844.js +0 -1
  143. package/.next/server/chunks/7572.js +0 -2
  144. package/.next/server/chunks/9617.js +0 -1
  145. package/.next/static/chunks/2390-079e9ccc8bd20e63.js +0 -1
  146. package/.next/static/chunks/4108.4e39a8f41278c35d.js +0 -1
  147. package/.next/static/chunks/5822-6d9ec5c9f0cc673f.js +0 -1
  148. package/.next/static/chunks/7703-d9e4d0e072aed92d.js +0 -1
  149. package/.next/static/chunks/8302-4918fb0ed8cc2283.js +0 -1
  150. package/.next/static/chunks/8336-e69c4adb375513c5.js +0 -1
  151. package/.next/static/chunks/app/layout-7e681a7d621e2e09.js +0 -1
  152. package/.next/static/chunks/app/onboarding/page-69bd037838f9e996.js +0 -1
  153. package/.next/static/chunks/app/page-ad10be3dfddf1726.js +0 -1
  154. package/.next/static/chunks/app/roots/[id]/kb/[...slug]/page-b0ef88a66b2f0d1d.js +0 -1
  155. package/.next/static/chunks/app/roots/[id]/page-aa93ae31a8ee3c99.js +0 -1
  156. package/.next/static/chunks/app/roots/[id]/workflows/[wfId]/page-4526b98999cca3ad.js +0 -1
  157. package/.next/static/chunks/app/roots/new/page-03431339c6cd8f24.js +0 -1
  158. package/.next/static/chunks/app/settings/page-a19a41e378e7d8a4.js +0 -1
  159. package/.next/static/chunks/app/share/[id]/page-f9087c14a67b4dcd.js +0 -1
  160. package/.next/static/chunks/app/utilities/[scope]/[id]/page-f57871e8c1ab1f72.js +0 -1
  161. package/.next/static/chunks/app/utilities/page-ca382ce386f0d77c.js +0 -1
  162. /package/.next/static/{Phb9nqftdL6MOVwBc0yAc → l_M5u154jKhXKvK6-kjlW}/_buildManifest.js +0 -0
  163. /package/.next/static/{Phb9nqftdL6MOVwBc0yAc → l_M5u154jKhXKvK6-kjlW}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7703],{8096:(e,t,r)=>{r.d(t,{A:()=>s});let s=(0,r(45804).A)("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]])},13561:(e,t,r)=>{r.d(t,{A:()=>s});let s=(0,r(45804).A)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},39783:(e,t,r)=>{r.d(t,{A:()=>s});let s=(0,r(45804).A)("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]])},67703:(e,t,r)=>{r.d(t,{UtilityIframe:()=>w});var s=r(4624),l=r(99356),a=r(79182),n=r(49411),i=r(39783),o=r(13561),c=r(8096),u=r(3239),d=r(95265),p=r(54400),h=r.n(p),m=r(56221),x=r(7911);let f=(0,x.createServerReference)("40343d697d37c86c998dcf67ae4a162d4be496417f",x.callServer,void 0,x.findSourceMapURL,"getOrCreateUtilityHelperTopicAction"),y=(0,x.createServerReference)("609e4792ff5b14048beb17bbba64374c3dca763b69",x.callServer,void 0,x.findSourceMapURL,"loadHelperTranscriptAction");function v(e){let{scope:t,utilityId:r,utilityName:p,rootId:x,requestSnapshot:v,onClose:w}=e,b=(0,n.c)("app"),[j,k]=(0,l.useState)(null),[N,S]=(0,l.useState)([]),[A,M]=(0,l.useState)(""),[T,E]=(0,l.useState)(null),[R,C]=(0,l.useTransition)(),[H,L]=(0,l.useState)(!1),O=(0,l.useRef)(null),I=(0,l.useRef)(null),P=(0,l.useRef)(""),[q,z]=(0,l.useState)("");(0,l.useEffect)(()=>{if(!x)return void E(b("utilities.helper.projectOnly"));let e=!1;return(async()=>{let t=await f({rootId:x,utilityId:r,utilityName:null!=p?p:r});if(e)return;if(!t.ok)return E(t.error);k(t.topicId);let s=await y(x,t.topicId);!e&&s.ok&&S(s.messages)})(),()=>{e=!0}},[x,r,p]),(0,l.useEffect)(()=>{if(!x||!j)return;let e=new EventSource("/api/roots/".concat(x,"/chat/").concat(j,"/stream?since=").concat(Number.MAX_SAFE_INTEGER));return I.current=e,e.addEventListener("event",e=>{try{let t=JSON.parse(e.data);"assistant-delta"===t.type&&"string"==typeof t.text?(P.current+=t.text,z(P.current),L(!0)):"turn-end"===t.type||"agent-end"===t.type?(P.current="",z(""),L(!1),(async()=>{let e=await y(x,j);e.ok&&S(e.messages)})()):t.type}catch(e){}}),e.onerror=()=>{},()=>{e.close(),I.current=null}},[x,j]),(0,l.useEffect)(()=>{let e=O.current;e&&(e.scrollTop=e.scrollHeight)},[N,q]);let _=()=>{let e=A.trim();e&&x&&j&&(M(""),S(t=>[...t,{role:"user",text:e,ts:new Date().toISOString()}]),C(async()=>{let t;try{t=await Promise.race([v(),new Promise(e=>setTimeout(()=>e(void 0),600))])}catch(e){}let r=void 0!==t?function(e,t){let r;try{r="string"==typeof t?t:JSON.stringify(t,null,2)}catch(e){r=String(t)}return r.length>4e3&&(r=r.slice(0,4e3)+"\n…[truncated]"),["[Mini-app context]",r,"[/context]\n",e].join("\n")}(e,t):e;try{let e=await fetch("/api/roots/".concat(x,"/chat/").concat(j,"/send"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:r})});if(!e.ok){var s;let t=await e.json().catch(()=>({}));m.oR.error(null!=(s=t.error)?s:"HTTP ".concat(e.status))}}catch(e){m.oR.error(String(e))}}))};return(0,s.jsxs)("aside",{className:"flex h-full flex-col border-l bg-card",children:[(0,s.jsxs)("header",{className:"border-b px-3 py-2 flex items-center gap-2",children:[(0,s.jsx)(a.A,{className:"h-3.5 w-3.5 text-violet-600"}),(0,s.jsx)("span",{className:"text-sm font-medium",children:b("utilities.helper.title")}),(0,s.jsx)("span",{className:"text-[10px] text-muted-foreground ml-1",children:b("utilities.helper.hint")}),x&&j&&(0,s.jsx)(h(),{href:"/roots/".concat(x,"/chat/").concat(j),className:"ml-auto p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground",title:b("utilities.helper.openFull"),children:(0,s.jsx)(i.A,{className:"h-3.5 w-3.5"})}),w&&(0,s.jsx)("button",{type:"button",onClick:w,className:"p-1 rounded hover:bg-accent "+(x&&j?"":"ml-auto"),title:b("utilities.helper.hide"),children:(0,s.jsx)(o.A,{className:"h-3.5 w-3.5"})})]}),(0,s.jsxs)("div",{ref:O,className:"flex-1 overflow-y-auto px-3 py-2 space-y-2 text-sm",children:[T&&(0,s.jsx)("p",{className:"text-xs text-red-600",children:T}),!T&&0===N.length&&!q&&(0,s.jsxs)("div",{className:"text-xs text-muted-foreground flex items-start gap-2",children:[(0,s.jsx)(c.A,{className:"h-3 w-3 mt-0.5 text-violet-600 shrink-0"}),(0,s.jsx)("span",{children:b("utilities.helper.welcome")})]}),N.map((e,t)=>(0,s.jsx)(g,{role:e.role,text:e.text},t)),H&&q&&(0,s.jsx)(g,{role:"assistant",text:q,streaming:!0}),R&&!H&&(0,s.jsxs)("div",{className:"mr-6 rounded-md bg-muted/40 px-2 py-1.5 text-xs text-muted-foreground inline-flex items-center gap-2",children:[(0,s.jsx)(u.A,{className:"h-3 w-3 animate-spin"}),b("utilities.helper.thinking")]})]}),(0,s.jsxs)("div",{className:"border-t px-3 py-2 flex items-end gap-1.5",children:[(0,s.jsx)("textarea",{value:A,onChange:e=>M(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),_())},rows:1,placeholder:b("utilities.helper.placeholder"),disabled:R||!!T||!j,className:"flex-1 resize-none rounded border bg-background px-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-violet-400 max-h-24"}),(0,s.jsx)("button",{type:"button",onClick:_,disabled:R||!A.trim()||!!T||!j,className:"inline-flex items-center justify-center rounded bg-violet-600 px-2 py-1 text-white hover:bg-violet-700 disabled:opacity-50",children:R?(0,s.jsx)(u.A,{className:"h-3 w-3 animate-spin"}):(0,s.jsx)(d.A,{className:"h-3 w-3"})})]})]})}function g(e){let{role:t,text:r,streaming:l}=e,a=(0,n.c)("app"),i=r;return("user"===t&&(i=i.replace(/^\s*\[Mini-app context\][\s\S]*?\[\/context\]\s*/,"").trim()),i.trim())?(0,s.jsxs)("div",{className:"user"===t?"ml-6 rounded-md bg-violet-50 dark:bg-violet-950/30 px-2 py-1.5":"mr-6 rounded-md bg-muted/40 px-2 py-1.5 whitespace-pre-wrap",children:[(0,s.jsxs)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-0.5",children:[a("user"===t?"utilities.helper.you":"assistant"===t?"utilities.helper.reflex":"utilities.helper.system"),l&&(0,s.jsx)("span",{className:"ml-1 text-violet-600",children:"●"})]}),i]}):null}function w(e){let{scope:t,id:r,rootId:i,className:o,title:c,agentChat:u,utilityName:d}=e,p=(0,n.c)("app"),h=(0,l.useRef)(null),m=(0,l.useRef)(null),[x,f]=(0,l.useState)(!0),y=i?"?rootId=".concat(encodeURIComponent(i)):"",g="/api/utilities/".concat(t,"/").concat(r,"/iframe").concat(y),w="/api/utilities/".concat(t,"/").concat(r,"/host").concat(y);(0,l.useEffect)(()=>{let e=async e=>{var t,r,s,l,a,n;let i=e.data;if(!i||e.source!==(null==(t=h.current)?void 0:t.contentWindow))return;if("snapshot-payload"===i.type){let e=m.current;e&&(clearTimeout(e.timer),m.current=null,e.resolve(i.snapshot));return}if("host-rpc"!==i.type)return;let o=i.id;try{let e=await fetch(w,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({method:i.method,args:i.args})}),t=await e.json();null==(s=h.current)||null==(r=s.contentWindow)||r.postMessage(t.ok?{type:"host-rpc-result",id:o,ok:!0,result:t.result}:{type:"host-rpc-result",id:o,ok:!1,error:null!=(l=t.error)?l:"HTTP ".concat(e.status)},"*")}catch(e){null==(n=h.current)||null==(a=n.contentWindow)||a.postMessage({type:"host-rpc-result",id:o,ok:!1,error:e instanceof Error?e.message:String(e)},"*")}};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[w]);let b=(0,s.jsx)("iframe",{ref:h,src:g,sandbox:"allow-scripts allow-forms allow-same-origin",className:null!=o?o:"h-full w-full border-0 bg-white",title:null!=c?c:"utility-".concat(r)});return u?(0,s.jsxs)("div",{className:"flex h-full w-full",children:[(0,s.jsxs)("div",{className:"flex-1 min-w-0 relative",children:[b,!x&&(0,s.jsxs)("button",{type:"button",onClick:()=>f(!0),className:"absolute right-3 bottom-3 inline-flex items-center gap-1 rounded-full bg-violet-600 px-3 py-1.5 text-xs text-white shadow-lg hover:bg-violet-700",title:p("utilities.iframe.openHelper"),children:[(0,s.jsx)(a.A,{className:"h-3.5 w-3.5"}),p("utilities.iframe.helper")]})]}),x&&(0,s.jsx)("div",{className:"w-80 shrink-0",children:(0,s.jsx)(v,{scope:t,utilityId:r,...d?{utilityName:d}:{},...i?{rootId:i}:{},requestSnapshot:()=>{var e;let t=null==(e=h.current)?void 0:e.contentWindow;return t?(m.current&&(clearTimeout(m.current.timer),m.current.resolve(void 0),m.current=null),new Promise(e=>{let r=setTimeout(()=>{var t;(null==(t=m.current)?void 0:t.resolve)===e&&(m.current=null,e(void 0))},500);m.current={resolve:e,timer:r};try{t.postMessage({type:"request-snapshot"},"*")}catch(t){clearTimeout(r),m.current=null,e(void 0)}})):Promise.resolve(void 0)},onClose:()=>f(!1)})})]}):b}},79182:(e,t,r)=>{r.d(t,{A:()=>s});let s=(0,r(45804).A)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},95265:(e,t,r)=>{r.d(t,{A:()=>s});let s=(0,r(45804).A)("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]])}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8302],{68682:(e,t,r)=>{function a(e){return"".concat(e.lat,",").concat(e.lng)}function n(e){return"".concat(e.lng,",").concat(e.lat)}r.d(t,{JY:()=>l,yp:()=>s});let s=[{id:"google",label:"Google Maps",description:"Global, navigation + street view. Works everywhere except where the RF blocks it.",brand:"#4285F4",glyph:"G",urlFor:(e,t)=>"https://www.google.com/maps/dir/?api=1&destination=".concat(e,",").concat(t),routeUrlFor:e=>{if(e.length<2)return"";let t=a(e[0]),r=a(e[e.length-1]),n=e.slice(1,-1).map(a).join("|"),s=n?"&waypoints=".concat(encodeURIComponent(n)):"";return"https://www.google.com/maps/dir/?api=1&origin=".concat(t,"&destination=").concat(r).concat(s)}},{id:"yandex",label:"Yandex Maps",description:"CIS region, best RF detail and real-time traffic.",brand:"#FFCC00",glyph:"Y",urlFor:(e,t)=>"https://yandex.ru/maps/?rtext=~".concat(e,",").concat(t,"&rtt=auto"),routeUrlFor:e=>"https://yandex.ru/maps/?rtext=".concat(e.map(a).join("~"),"&rtt=auto")},{id:"2gis",label:"2GIS",description:"CIS region, precise addresses and POI. Uniquely strong on RF cities.",brand:"#1BA049",glyph:"2",urlFor:(e,t)=>"https://2gis.ru/routeSearch/to/".concat(t,",").concat(e),routeUrlFor:e=>{let t=n(e[0]),r=n(e[e.length-1]),a=e.slice(1,-1).map(e=>"/via/".concat(n(e))).join("");return"https://2gis.ru/routeSearch/rsType/car/from/".concat(t).concat(a,"/to/").concat(r)}},{id:"apple",label:"Apple Maps",description:"Opens in the native app on iOS/macOS, otherwise on the website.",brand:"#1d1d1f",glyph:"A",urlFor:(e,t)=>"https://maps.apple.com/?daddr=".concat(e,",").concat(t),routeUrlFor:e=>{let t=a(e[0]),r=e.slice(1).map(e=>"+to:".concat(a(e))).join("");return"https://maps.apple.com/?saddr=".concat(t,"&daddr=").concat(t).concat(r)}},{id:"osm",label:"OpenStreetMap",description:"Open data, no account required. Basic navigation.",brand:"#7EB73F",glyph:"OSM",urlFor:(e,t)=>"https://www.openstreetmap.org/directions?to=".concat(e,",").concat(t),routeUrlFor:e=>{let t=e.map(a).join(";");return"https://www.openstreetmap.org/directions?route=".concat(encodeURIComponent(t))}},{id:"waze",label:"Waze",description:"Car navigation with crowd-sourced traffic and alerts.",brand:"#33CCFF",glyph:"W",urlFor:(e,t)=>"https://waze.com/ul?ll=".concat(e,",").concat(t,"&navigate=yes"),routeUrlFor:e=>{let t=e[e.length-1];return"https://waze.com/ul?ll=".concat(t.lat,",").concat(t.lng,"&navigate=yes")}},{id:"organic",label:"Organic Maps",description:"Offline maps with open data. Opens in the app.",brand:"#006C35",glyph:"OM",urlFor:(e,t)=>"om://map?ll=".concat(e,",").concat(t),routeUrlFor:e=>{let t=e[0],r=e[e.length-1];return"om://route?sll=".concat(t.lat,",").concat(t.lng,"&saddr=&dll=").concat(r.lat,",").concat(r.lng,"&daddr=&type=vehicle")}}],l=["google","yandex","apple","osm"]},75691:(e,t,r)=>{r.d(t,{v:()=>q});var a=r(4624),n=r(49411),s=r(64874),l=r(99356),i=r(87738),o=r(39783),c=r(43153),d=r(13561),u=r(41695),p=r(46972),m=r(84630),x=r(96447),h=r(54207),g=r(84860),f=r(41379),b=r(3239),v=r(85253),y=r(15523),j=r(64681),N=r(54400),w=r.n(N),k=r(49623),W=r(85785),C=r(43863),A=r(57308),S=r(35285),F=r(9598),R=r(56221),T=r(68682);function L(e){let{service:t,size:r=18,className:n}=e;return(0,a.jsx)("span",{className:"inline-flex items-center justify-center rounded-[5px] font-bold leading-none text-white shrink-0 "+(null!=n?n:""),style:{background:t.brand,width:r,height:r,fontSize:Math.max(8,Math.floor(.55*r)),letterSpacing:t.glyph.length>1?"-0.05em":"0"},"aria-hidden":!0,children:t.glyph})}var z=r(7911);let M=(0,z.createServerReference)("0037ccb2cd3d5d262d811ed2350ad5bb5944a1ddc3",z.callServer,void 0,z.findSourceMapURL,"getEnabledMapServicesAction"),U="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css",E="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js";function I(e){let{point:t,services:r,interactive:s,onRemove:l}=e,i=(0,n.c)("roots");return(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[r.slice(0,4).map(e=>(0,a.jsx)("a",{href:e.urlFor(t.lat,t.lng),target:"_blank",rel:"noopener noreferrer",className:"rounded p-0.5 hover:ring-1 hover:ring-offset-1 hover:ring-violet-300",title:i("mapWidget.navigationTitle",{service:e.label}),children:(0,a.jsx)(L,{service:e,size:18})},e.id)),(0,a.jsx)("button",{type:"button",onClick:()=>{navigator.clipboard.writeText("".concat(t.lat,", ").concat(t.lng)).then(()=>R.oR.success(i("mapWidget.coordsCopied"))).catch(()=>R.oR.error(i("mapWidget.clipboardUnavailable")))},className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground",title:i("mapWidget.copyCoords"),children:(0,a.jsx)(F.A,{className:"h-3 w-3"})}),s&&(0,a.jsx)("button",{type:"button",onClick:l,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-destructive",title:i("mapWidget.removePoint"),children:(0,a.jsx)(d.A,{className:"h-3 w-3"})})]})}function O(e){let{service:t,stops:r}=e,s=(0,n.c)("roots"),l=t.routeUrlFor(r),i=e=>{e.preventDefault(),e.stopPropagation(),navigator.clipboard.writeText(l).then(()=>R.oR.success(s("mapWidget.linkCopied",{service:t.label}))).catch(()=>R.oR.error(s("mapWidget.clipboardUnavailable")))};return(0,a.jsxs)("a",{href:l,target:"_blank",rel:"noopener noreferrer",onContextMenu:i,className:"inline-flex items-center gap-1 rounded border px-1.5 py-0.5 text-[11px] hover:bg-accent",title:s("mapWidget.openTitle",{service:t.label}),children:[(0,a.jsx)(L,{service:t,size:16}),(0,a.jsx)("span",{className:"truncate max-w-[80px]",children:t.label}),(0,a.jsx)("button",{type:"button",onClick:i,className:"text-muted-foreground hover:text-foreground",title:s("mapWidget.copyLinkTitle"),children:(0,a.jsx)(F.A,{className:"h-2.5 w-2.5"})})]})}var _=r(8096);let P={markdown:function(e){var t;let{data:r}=e;return(0,a.jsx)("div",{className:"text-sm",children:(0,a.jsx)(s.p,{source:null!=(t=r.body)?t:""})})},"news-list":function(e){var t;let{data:r,readonly:s,onPatch:u}=e,p=(0,n.c)("roots"),m=null!=(t=r.items)?t:[],[x,h]=(0,l.useState)(m),[g,f]=(0,l.useTransition)(),b=(0,l.useRef)("");(0,l.useEffect)(()=>{let e=JSON.stringify(m);e!==b.current&&(b.current=e,h(m))},[r]);let v=e=>{h(e),u&&f(async()=>{try{await u({items:e})}catch(e){}})};return 0===x.length?(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:p("newsListWidget.empty")}):(0,a.jsx)("ul",{className:"space-y-2",children:x.map((e,t)=>(0,a.jsxs)("li",{className:"group/row relative border-l-2 pl-2.5 py-0.5 transition ".concat(e.read?"border-muted-foreground/30 opacity-60":"border-violet-200"),children:[(0,a.jsxs)("div",{className:"flex items-start gap-1.5",children:[(0,a.jsx)(i.A,{className:"h-3 w-3 mt-1 shrink-0 ".concat(e.read?"text-muted-foreground":"text-violet-600")}),(0,a.jsxs)("div",{className:"min-w-0 flex-1 pr-12",children:[e.url?(0,a.jsxs)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-sm font-medium hover:underline inline-flex items-center gap-1",children:[e.title,(0,a.jsx)(o.A,{className:"h-3 w-3 opacity-50"})]}):(0,a.jsx)("span",{className:"text-sm font-medium",children:e.title}),e.summary&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:e.summary}),(e.source||e.date)&&(0,a.jsxs)("div",{className:"text-[10px] text-muted-foreground mt-0.5 flex gap-1.5",children:[e.source&&(0,a.jsx)("span",{children:e.source}),e.source&&e.date&&(0,a.jsx)("span",{children:"\xb7"}),e.date&&(0,a.jsx)("span",{className:"font-mono",children:e.date})]})]})]}),!s&&(0,a.jsxs)("div",{className:"absolute top-0 right-0 flex items-center gap-0.5 opacity-0 group-hover/row:opacity-100 transition-opacity",children:[(0,a.jsx)("button",{type:"button",onClick:()=>{!s&&v(x.map((e,r)=>r===t?{...e,read:!e.read}:e))},disabled:g,"aria-label":e.read?p("newsListWidget.markUnreadAria"):p("newsListWidget.markReadAria"),title:e.read?p("newsListWidget.markUnreadTitle"):p("newsListWidget.markReadTitle"),className:"p-1 rounded hover:bg-emerald-100 dark:hover:bg-emerald-950/40 text-muted-foreground hover:text-emerald-600 disabled:opacity-30",children:(0,a.jsx)(c.A,{className:"h-3 w-3"})}),(0,a.jsx)("button",{type:"button",onClick:()=>{!s&&v(x.filter((e,r)=>r!==t))},disabled:g,"aria-label":p("newsListWidget.dismissAria"),title:p("newsListWidget.dismissTitle"),className:"p-1 rounded hover:bg-destructive/15 text-muted-foreground hover:text-destructive disabled:opacity-30",children:(0,a.jsx)(d.A,{className:"h-3 w-3"})})]})]},t))})},"link-list":function(e){var t;let{data:r,readonly:s,onPatch:i}=e,c=(0,n.c)("roots"),d=null!=(t=r.items)?t:[],[m,x]=(0,l.useState)(d),[h,g]=(0,l.useTransition)(),f=(0,l.useRef)("");return((0,l.useEffect)(()=>{let e=JSON.stringify(d);e!==f.current&&(f.current=e,x(d))},[r]),0===m.length)?(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:c("linkListWidget.empty")}):(0,a.jsx)("ul",{className:"space-y-0.5",children:m.map((e,t)=>(0,a.jsxs)("li",{className:"group/row relative",children:[(0,a.jsxs)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-start gap-1.5 rounded-md px-2 py-1.5 hover:bg-accent/40 transition",children:[(0,a.jsx)(u.A,{className:"h-3 w-3 mt-1 shrink-0 text-sky-600"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"text-sm font-medium hover:underline inline-flex items-center gap-1",children:[e.title,(0,a.jsx)(o.A,{className:"h-3 w-3 opacity-50"})]}),e.hint&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed",children:e.hint}),(0,a.jsx)("div",{className:"text-[10px] text-muted-foreground truncate font-mono mt-0.5",children:e.url})]})]}),!s&&(0,a.jsx)("button",{type:"button",onClick:()=>(e=>{if(!s){var t;x(t=m.filter((t,r)=>r!==e)),i&&g(async()=>{try{await i({items:t})}catch(e){}})}})(t),disabled:h,"aria-label":c("linkListWidget.removeAria"),className:"absolute top-1.5 right-1.5 opacity-0 group-hover/row:opacity-100 transition-opacity p-1 rounded hover:bg-destructive/15 text-muted-foreground hover:text-destructive disabled:opacity-30",children:(0,a.jsx)(p.A,{className:"h-3 w-3"})})]},t))})},kpi:function(e){var t;let{data:r}=e,s=(0,n.c)("roots"),l=null!=(t=r.items)?t:[];if(0===l.length)return(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:s("kpiWidget.empty")});let i=Math.min(l.length,3);return(0,a.jsx)("div",{className:"grid gap-2",style:{gridTemplateColumns:"repeat(".concat(i,", minmax(0,1fr))")},children:l.map((e,t)=>(0,a.jsxs)("div",{className:"rounded-md border bg-card px-3 py-2 flex flex-col gap-0.5",children:[(0,a.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:e.label}),(0,a.jsxs)("div",{className:"flex items-baseline gap-1",children:[(0,a.jsx)("span",{className:"text-lg font-semibold tabular-nums",children:e.value}),"up"===e.delta&&(0,a.jsx)(m.A,{className:"h-3.5 w-3.5 text-emerald-600"}),"down"===e.delta&&(0,a.jsx)(x.A,{className:"h-3.5 w-3.5 text-rose-600"}),"flat"===e.delta&&(0,a.jsx)(h.A,{className:"h-3.5 w-3.5 text-muted-foreground"})]}),e.hint&&(0,a.jsx)("div",{className:"text-[10px] text-muted-foreground leading-snug",children:e.hint})]},t))})},checklist:function(e){var t;let{data:r,readonly:s,onPatch:i}=e,o=(0,n.c)("roots"),d=null!=(t=r.items)?t:[],[u,m]=(0,l.useState)(d),[x,h]=(0,l.useTransition)(),[j,N]=(0,l.useState)(""),w=(0,l.useRef)("");(0,l.useEffect)(()=>{let e=JSON.stringify(d);e!==w.current&&(w.current=e,m(d))},[r]);let k=e=>{m(e),i&&h(async()=>{try{await i({items:e})}catch(e){}})},W=e=>{s||k(u.map((t,r)=>r===e?{...t,done:!t.done}:t))};return 0===u.length&&s?(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:o("checklistWidget.empty")}):(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)("ul",{className:"space-y-0.5",children:u.map((e,t)=>(0,a.jsxs)("li",{className:"group/row flex items-start gap-2 text-sm py-0.5 rounded hover:bg-accent/30 px-1 -mx-1 ".concat(e.done?"text-muted-foreground":""),children:[(0,a.jsx)("button",{type:"button",onClick:()=>W(t),disabled:s||x,"aria-label":e.done?o("checklistWidget.uncheckAria"):o("checklistWidget.checkAria"),className:"shrink-0 mt-0.5 disabled:opacity-50",children:e.done?(0,a.jsx)(c.A,{className:"h-3.5 w-3.5 text-emerald-600"}):(0,a.jsx)(g.A,{className:"h-3.5 w-3.5 text-muted-foreground/60 hover:text-foreground"})}),(0,a.jsx)("span",{className:"flex-1 min-w-0 break-words ".concat(e.done?"line-through":""),onClick:()=>W(t),style:s?{}:{cursor:"pointer"},children:e.text}),!s&&(0,a.jsx)("button",{type:"button",onClick:()=>{!s&&k(u.filter((e,r)=>r!==t))},disabled:x,"aria-label":o("checklistWidget.removeAria"),className:"opacity-0 group-hover/row:opacity-100 transition-opacity shrink-0 p-0.5 text-muted-foreground hover:text-destructive disabled:opacity-30",children:(0,a.jsx)(p.A,{className:"h-3 w-3"})})]},t))}),!s&&(0,a.jsxs)("form",{className:"flex items-center gap-1 pt-1",onSubmit:e=>{e.preventDefault(),(()=>{if(s)return;let e=j.trim();e&&(k([...u,{text:e,done:!1}]),N(""))})()},children:[(0,a.jsx)(f.A,{className:"h-3 w-3 text-muted-foreground shrink-0"}),(0,a.jsx)(y.p,{value:j,onChange:e=>N(e.target.value),placeholder:o("checklistWidget.newItemPlaceholder"),className:"h-7 text-xs flex-1 border-0 shadow-none focus-visible:ring-0 focus-visible:ring-offset-0 px-1",disabled:x}),j.trim()&&(0,a.jsx)(v.$,{type:"submit",size:"sm",variant:"ghost",className:"h-6 text-[10px] px-1.5",disabled:x,children:x?(0,a.jsx)(b.A,{className:"h-3 w-3 animate-spin"}):o("checklistWidget.add")})]})]})},quote:function(e){let{data:t}=e,r=(0,n.c)("roots");return(null==t?void 0:t.text)?(0,a.jsxs)("figure",{className:"relative pl-6",children:[(0,a.jsx)(j.A,{className:"h-5 w-5 absolute left-0 top-0 text-violet-300"}),(0,a.jsx)("blockquote",{className:"text-sm italic leading-relaxed",children:t.text}),t.attribution&&(0,a.jsxs)("figcaption",{className:"text-xs text-muted-foreground mt-1.5",children:["— ",t.attribution]})]}):(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:r("quoteWidget.empty")})},"kb-pinned":function(e){var t;let{rootId:r,data:s,readonly:i,onPatch:o}=e,c=(0,n.c)("roots"),u=null!=(t=s.items)?t:[],[p,m]=(0,l.useState)(u),[x,h]=(0,l.useTransition)(),g=(0,l.useRef)("");return((0,l.useEffect)(()=>{let e=JSON.stringify(u);e!==g.current&&(g.current=e,m(u))},[s]),0===p.length)?(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:c("kbPinnedWidget.empty")}):(0,a.jsx)("ul",{className:"space-y-1",children:p.map((e,t)=>{var n;let s=e.rel.split("/").map(encodeURIComponent).join("/");return(0,a.jsxs)("li",{className:"group/row relative",children:[(0,a.jsxs)(w(),{href:"/roots/".concat(r,"/kb/").concat(s),className:"flex items-start gap-2 rounded-md px-2 py-1.5 hover:bg-accent/40 transition pr-7",children:[(0,a.jsx)(k.A,{className:"h-3 w-3 mt-0.5 shrink-0 text-emerald-700"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"text-sm font-medium truncate",children:null!=(n=e.title)?n:e.rel}),e.snippet&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 leading-relaxed mt-0.5",children:e.snippet}),(0,a.jsx)("div",{className:"text-[10px] text-muted-foreground font-mono mt-0.5 truncate",children:e.rel})]})]}),!i&&(0,a.jsx)("button",{type:"button",onClick:()=>(e=>{if(!i){var t;m(t=p.filter((t,r)=>r!==e)),o&&h(async()=>{try{await o({items:t})}catch(e){}})}})(t),disabled:x,"aria-label":c("kbPinnedWidget.unpinAria"),title:c("kbPinnedWidget.unpinTitle"),className:"absolute top-1.5 right-1.5 opacity-0 group-hover/row:opacity-100 transition-opacity p-1 rounded hover:bg-destructive/15 text-muted-foreground hover:text-destructive disabled:opacity-30",children:(0,a.jsx)(d.A,{className:"h-3 w-3"})})]},t)})})},progress:function(e){var t;let{data:r,readonly:s,onPatch:i}=e,o=(0,n.c)("roots"),c=null!=(t=r.items)?t:[],[d,u]=(0,l.useState)(c),[p,m]=(0,l.useTransition)(),x=(0,l.useRef)("");(0,l.useEffect)(()=>{let e=JSON.stringify(c);e!==x.current&&(x.current=e,u(c))},[r]);let h=(e,t)=>{if(!s){var r;u(r=d.map((r,a)=>a===e?{...r,current:Math.max(0,r.current+t)}:r)),i&&m(async()=>{try{await i({items:r})}catch(e){}})}};return 0===d.length?(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:o("progressWidget.empty")}):(0,a.jsx)("ul",{className:"space-y-2.5",children:d.map((e,t)=>{let r=e.target>0?Math.max(0,Math.min(100,e.current/e.target*100)):0;return(0,a.jsxs)("li",{className:"space-y-1 group/row",children:[(0,a.jsxs)("div",{className:"flex items-baseline justify-between gap-2 text-sm",children:[(0,a.jsx)("span",{className:"truncate flex-1 min-w-0",children:e.label}),!s&&(0,a.jsxs)("div",{className:"flex items-center gap-0.5 opacity-0 group-hover/row:opacity-100 transition-opacity shrink-0",children:[(0,a.jsx)("button",{type:"button",onClick:()=>h(t,-1),disabled:p||e.current<=0,"aria-label":"−1",className:"p-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground disabled:opacity-30",children:(0,a.jsx)(W.A,{className:"h-3 w-3"})}),(0,a.jsx)("button",{type:"button",onClick:()=>h(t,1),disabled:p,"aria-label":"+1",className:"p-0.5 rounded hover:bg-accent text-muted-foreground hover:text-foreground disabled:opacity-30",children:(0,a.jsx)(f.A,{className:"h-3 w-3"})})]}),(0,a.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums shrink-0",children:[e.current," / ",e.target,e.unit?" ".concat(e.unit):""]})]}),(0,a.jsx)("div",{className:"h-1.5 rounded-full bg-muted overflow-hidden",children:(0,a.jsx)("div",{className:"h-full bg-violet-600 transition-all",style:{width:"".concat(r,"%")}})})]},t)})})},image:function(e){var t;let{data:r}=e,s=(0,n.c)("roots");return(null==r?void 0:r.url)?(0,a.jsxs)("figure",{className:"space-y-1",children:[(0,a.jsx)("img",{src:r.url,alt:null!=(t=r.alt)?t:"",className:"rounded-md w-full h-auto border",loading:"lazy"}),r.caption&&(0,a.jsx)("figcaption",{className:"text-xs text-muted-foreground text-center",children:r.caption})]}):(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:s("imageWidget.empty")})},"stat-table":function(e){var t;let{data:r}=e,s=(0,n.c)("roots"),l=null!=(t=r.rows)?t:[];return 0===l.length?(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:s("statTableWidget.empty")}):(0,a.jsx)("div",{className:"overflow-x-auto -mx-1",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[r.columns&&r.columns.length>0&&(0,a.jsx)("thead",{children:(0,a.jsx)("tr",{className:"border-b",children:r.columns.map((e,t)=>(0,a.jsx)("th",{className:"text-left text-[10px] uppercase tracking-wider text-muted-foreground font-medium px-1.5 py-1.5",children:e},t))})}),(0,a.jsx)("tbody",{children:l.map((e,t)=>(0,a.jsx)("tr",{className:"border-b border-dashed last:border-b-0 hover:bg-accent/30",children:e.map((e,t)=>(0,a.jsx)("td",{className:"px-1.5 py-1.5 align-top",children:e},t))},t))})]})})},map:function(e){var t,r,s;let{data:i,readonly:o,onPatch:c}=e,u=(0,n.c)("roots"),m=(0,l.useRef)(null),x=(0,l.useRef)(null),[h,g]=(0,l.useState)(!1),[v,y]=(0,l.useState)(T.JY),[j,N]=(0,l.useState)(""),[w,k]=(0,l.useState)(!1),[W,F]=(0,l.useState)([]),[L,z]=(0,l.useState)(!1),[_,P]=(0,l.useState)([]),q=null!=(r=i.points)?r:[],B=null!=(s=null==(t=i.route)?void 0:t.stops)?s:[],D=L?_:B,J=(0,l.useMemo)(()=>D.map(e=>q[e]).filter(e=>!!e).map(e=>({lat:e.lat,lng:e.lng})),[D,q]),G=(0,l.useMemo)(()=>T.yp.filter(e=>v.includes(e.id)),[v]);(0,l.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await M();!e&&t.ok&&y(t.enabled)}catch(e){}})(),()=>{e=!0}},[]),(0,l.useEffect)(()=>{if(window.L)return void g(!0);if(!document.querySelector('link[href="'.concat(U,'"]'))){let e=document.createElement("link");e.rel="stylesheet",e.href=U,document.head.appendChild(e)}let e=document.querySelector('script[src="'.concat(E,'"]'));if(e){e.addEventListener("load",()=>g(!0)),window.L&&g(!0);return}let t=document.createElement("script");t.src=E,t.async=!0,t.onload=()=>g(!0),t.onerror=()=>R.oR.error(u("mapWidget.leafletLoadFailed")),document.head.appendChild(t)},[]),(0,l.useEffect)(()=>{var e,t,r;if(!h||!m.current)return;let a=window.L;if(!a||(x.current&&(x.current.remove(),x.current=null),0===q.length))return;let n=a.map(m.current,{scrollWheelZoom:!1,zoomControl:!0});x.current=n,a.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',maxZoom:19}).addTo(n);let s=q.map((e,t)=>{let r=D.includes(t),s=function(e,t,r){let a=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),n=t.map(t=>{let r=t.urlFor(e.lat,e.lng);return'<a href="'.concat(a(r),'" target="_blank" rel="noopener noreferrer" ')+'title="'.concat(a(t.label),'" ')+'style="display:inline-flex;align-items:center;gap:4px;margin:2px 4px 2px 0;padding:2px 6px;border-radius:5px;border:1px solid #e5e7eb;text-decoration:none;font-size:11px;color:#111;background:#fff;">'+'<span style="display:inline-block;width:14px;height:14px;border-radius:3px;background:'.concat(t.brand,";")+"color:#fff;font-size:9px;font-weight:700;line-height:14px;text-align:center;"+"letter-spacing:".concat(t.glyph.length>1?"-0.05em":"0",'">').concat(a(t.glyph),"</span>")+"<span>".concat(a(t.label),"</span>")+"</a>"}).join("");return['<div style="font-family:inherit;min-width:200px">','<div style="font-weight:600;font-size:13px;margin-bottom:2px">'.concat(a(e.title),"</div>"),e.description?'<div style="font-size:12px;color:#666;margin-bottom:6px">'.concat(a(e.description),"</div>"):"",'<div style="font-family:monospace;font-size:10px;color:#888;margin-bottom:6px">'.concat(e.lat.toFixed(5),", ").concat(e.lng.toFixed(5),"</div>"),t.length>0?'<div style="font-size:10px;color:#888;text-transform:uppercase;letter-spacing:0.5px;margin-bottom:2px">'.concat(a(r.openIn),"</div>").concat(n):"",'<div style="margin-top:6px"><button type="button" data-reflex-copy="'.concat(e.lat,", ").concat(e.lng,'" style="font-size:11px;padding:2px 8px;border:1px solid #ddd;border-radius:4px;background:#fff;cursor:pointer">\uD83D\uDCCB ').concat(a(r.copyCoords),"</button></div>"),"</div>"].filter(Boolean).join("")}(e,G,{openIn:u("mapWidget.openIn"),copyCoords:u("mapWidget.copyCoords")}),l=a.marker([e.lat,e.lng],{opacity:L&&!r?.55:1}).addTo(n);return l.bindPopup(s,{maxWidth:280}),l.on("click",()=>{L&&P(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])}),l});J.length>=2&&a.polyline(J.map(e=>[e.lat,e.lng]),{color:null!=(t=null==(e=i.route)?void 0:e.color)?t:"#7c3aed",weight:4,opacity:.85,dashArray:L?"6,6":void 0}).addTo(n);let l=e=>{let t=e.target.closest("[data-reflex-copy]");if(t){let r=t.getAttribute("data-reflex-copy");r&&navigator.clipboard.writeText(r).then(()=>R.oR.success(u("mapWidget.copied"))).catch(()=>R.oR.error(u("mapWidget.clipboardUnavailable"))),e.preventDefault()}};if(m.current.addEventListener("click",l),i.center&&"number"==typeof i.zoom)n.setView([i.center.lat,i.center.lng],i.zoom);else if(1===q.length)n.setView([q[0].lat,q[0].lng],null!=(r=i.zoom)?r:12);else{let e=a.featureGroup(s);n.fitBounds(e.getBounds().pad(.2))}return()=>{var e;null==(e=m.current)||e.removeEventListener("click",l),n.remove(),x.current=null}},[h,i,v.join("|"),L,_.join(",")]);let Y=!o&&!!c,K=async()=>{let e=j.trim();if(e){k(!0),F([]);try{let t="".concat("https://nominatim.openstreetmap.org/search","?q=").concat(encodeURIComponent(e),"&format=json&limit=6"),r=await fetch(t,{headers:{Accept:"application/json"}});if(!r.ok)throw Error("status ".concat(r.status));let a=await r.json();F(a),0===a.length&&R.oR.message(u("mapWidget.nothingFound"))}catch(e){R.oR.error(u("mapWidget.searchFailed",{error:e instanceof Error?e.message:String(e)}))}finally{k(!1)}}},V=async e=>{var t;if(!Y)return;let r=Number(e.lat),a=Number(e.lon);if(!Number.isFinite(r)||!Number.isFinite(a))return void R.oR.error(u("mapWidget.invalidCoordinates"));let n=(null==(t=e.display_name.split(",")[0])?void 0:t.trim())||e.display_name.slice(0,60),s={...i,points:[...q,{lat:r,lng:a,title:n,description:e.display_name}]};F([]),N(""),await (null==c?void 0:c(s))},Z=async e=>{var t,r;if(!Y)return;let a=q.filter((t,r)=>r!==e),n=i.route;if(null==(r=i.route)||null==(t=r.stops)?void 0:t.length){let t=i.route.stops.filter(t=>t!==e).map(t=>t>e?t-1:t);n=t.length>=2?{...i.route,stops:t}:void 0}let s={...i,points:a,...n?{route:n}:{route:void 0}};await (null==c?void 0:c(s))},H=async()=>{if(!Y)return;let e={...i,route:void 0};await (null==c?void 0:c(e)),z(!1),P([])},$=async()=>{var e;if(!Y)return;if(_.length<2)return void R.oR.error(u("mapWidget.routeNeedsTwo"));let t={...i,route:{...null!=(e=i.route)?e:{},stops:_}};await (null==c?void 0:c(t)),z(!1)};return 0!==q.length||Y?(0,a.jsxs)("div",{className:"space-y-2",children:[Y&&(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsxs)("div",{className:"relative flex-1",children:[(0,a.jsx)(C.A,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground pointer-events-none"}),(0,a.jsx)("input",{type:"search",value:j,onChange:e=>N(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),K())},placeholder:u("mapWidget.searchPlaceholder"),className:"w-full rounded border bg-background pl-7 pr-2 py-1 text-xs focus:outline-none focus:ring-1 focus:ring-violet-400"})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>void K(),disabled:w||!j.trim(),className:"rounded border px-2 py-1 text-xs hover:bg-accent disabled:opacity-50 inline-flex items-center gap-1",children:[w?(0,a.jsx)(b.A,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(C.A,{className:"h-3 w-3"}),u("mapWidget.search")]}),L?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("button",{type:"button",onClick:()=>void $(),className:"rounded px-2 py-1 text-xs bg-violet-600 text-white hover:bg-violet-700 inline-flex items-center gap-1",title:u("mapWidget.saveRouteTitle"),children:[(0,a.jsx)(A.A,{className:"h-3 w-3"})," ",u("mapWidget.save")]}),(0,a.jsx)("button",{type:"button",onClick:()=>{z(!1),P([])},className:"rounded border px-2 py-1 text-xs hover:bg-accent inline-flex items-center gap-1",title:u("mapWidget.cancelTitle"),children:(0,a.jsx)(d.A,{className:"h-3 w-3"})})]}):(0,a.jsxs)("button",{type:"button",onClick:()=>{P(B),z(!0)},disabled:q.length<2,className:"rounded border px-2 py-1 text-xs hover:bg-accent disabled:opacity-50 inline-flex items-center gap-1",title:u("mapWidget.routeButtonTitle"),children:[(0,a.jsx)(A.A,{className:"h-3 w-3"}),u("mapWidget.route")]})]}),W.length>0&&(0,a.jsx)("ul",{className:"rounded border bg-card divide-y text-xs max-h-44 overflow-y-auto",children:W.map((e,t)=>(0,a.jsx)("li",{children:(0,a.jsxs)("button",{type:"button",onClick:()=>void V(e),className:"w-full text-left flex items-start gap-2 px-2 py-1.5 hover:bg-accent",children:[(0,a.jsx)(f.A,{className:"h-3 w-3 mt-0.5 text-emerald-700 shrink-0"}),(0,a.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,a.jsx)("span",{className:"block font-medium truncate",children:e.display_name.split(",")[0]}),(0,a.jsx)("span",{className:"block text-[10px] text-muted-foreground truncate",children:e.display_name})]})]})},t))}),L&&(0,a.jsx)("div",{className:"rounded border border-violet-200 bg-violet-50 dark:bg-violet-950/30 dark:border-violet-900/50 px-2 py-1.5 text-[11px] text-violet-900 dark:text-violet-200",children:u.rich("mapWidget.routeModeHint",{count:_.length,strong:e=>(0,a.jsx)("strong",{children:e})})})]}),(0,a.jsx)("div",{ref:m,className:"rounded-md border overflow-hidden bg-muted/30",style:{height:280}}),!L&&J.length>=2&&G.length>0&&(0,a.jsx)("div",{className:"rounded border bg-card px-2 py-1.5",children:(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 text-[11px] font-medium",children:[(0,a.jsx)(A.A,{className:"h-3 w-3 text-violet-600"}),u("mapWidget.routeLabel",{count:J.length})]}),G.map(e=>(0,a.jsx)(O,{service:e,stops:J},e.id)),Y&&(0,a.jsxs)("button",{type:"button",onClick:()=>void H(),className:"ml-auto text-[10px] text-muted-foreground hover:text-destructive inline-flex items-center gap-0.5",title:u("mapWidget.deleteRouteTitle"),children:[(0,a.jsx)(p.A,{className:"h-3 w-3"}),u("mapWidget.delete")]})]})}),(0,a.jsx)("ul",{className:"space-y-1",children:q.map((e,t)=>{let r=D.indexOf(t);return(0,a.jsxs)("li",{className:"flex items-start gap-2 rounded-md border bg-card px-2 py-1.5 text-xs "+(L&&r>=0?"ring-1 ring-violet-400 border-violet-300":""),children:[L?(0,a.jsx)("button",{type:"button",onClick:()=>P(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t]),className:"h-5 w-5 mt-0.5 shrink-0 rounded-full border text-[10px] font-mono inline-flex items-center justify-center "+(r>=0?"bg-violet-600 text-white border-violet-600":"bg-card text-muted-foreground"),title:r>=0?u("mapWidget.removeFromRoute"):u("mapWidget.addToRoute"),children:r>=0?r+1:"+"}):(0,a.jsx)(S.A,{className:"h-3 w-3 mt-1 shrink-0 "+(B.includes(t)?"text-violet-600":"text-emerald-700")}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"font-medium truncate",children:e.title}),e.description&&(0,a.jsx)("p",{className:"text-muted-foreground leading-snug mt-0.5 line-clamp-2",children:e.description}),(0,a.jsxs)("div",{className:"text-[10px] text-muted-foreground/80 font-mono mt-0.5",children:[e.lat.toFixed(5),", ",e.lng.toFixed(5)]})]}),(0,a.jsx)(I,{point:e,services:G,interactive:Y,onRemove:()=>void Z(t)})]},t)})})]}):(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:u("mapWidget.noPointsReadonly")})},"utility-card":function(e){let{rootId:t,data:r,readonly:s}=e,l=(0,n.c)("roots"),i="project"===r.utilityScope?"/utilities/project/".concat(r.utilityId,"?rootId=").concat(encodeURIComponent(t)):"/utilities/global/".concat(r.utilityId);return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-[10px] uppercase tracking-wider text-muted-foreground",children:[(0,a.jsx)(_.A,{className:"h-3 w-3 text-violet-600"}),(0,a.jsx)("span",{children:l("utilityCardWidget.miniAppLabel")}),(0,a.jsx)("span",{className:"font-mono normal-case tracking-normal text-muted-foreground/80",children:r.utilityId}),(0,a.jsxs)(w(),{href:i,className:"ml-auto inline-flex items-center gap-0.5 text-[10px] text-violet-700 hover:underline normal-case tracking-normal",title:l("utilityCardWidget.openFullTitle"),children:[l("utilityCardWidget.openLabel"),(0,a.jsx)(o.A,{className:"h-2.5 w-2.5"})]})]}),r.inner.title&&(0,a.jsx)("h4",{className:"text-sm font-medium",children:r.inner.title}),r.inner.description&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground -mt-1",children:r.inner.description}),(0,a.jsx)("div",{children:q(t,r.inner.kind,r.inner.data,{readonly:!0})})]})}};function q(e,t,r,n){var s;let l=P[t];return l?(0,a.jsx)(l,{rootId:e,data:r,readonly:null!=(s=null==n?void 0:n.readonly)&&s,onPatch:null==n?void 0:n.onPatch}):(0,a.jsx)(B,{kind:t})}function B(e){let{kind:t}=e,r=(0,n.c)("roots");return(0,a.jsx)("p",{className:"text-xs text-destructive",children:r.rich("widgetsCommon.unknownKind",{kind:t,code:e=>(0,a.jsx)("code",{className:"font-mono",children:e})})})}},87400:(e,t,r)=>{r.d(t,{t:()=>n});var a=r(7911);let n=(0,a.createServerReference)("60c107b18c203cd38bee8764b29a794f0e2ab24c32",a.callServer,void 0,a.findSourceMapURL,"restoreWidgetAction")}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8336],{15523:(e,r,t)=>{t.d(r,{p:()=>s});var a=t(4624);t(99356);var n=t(13506);function s(e){let{className:r,type:t,...s}=e;return(0,a.jsx)("input",{type:t,"data-slot":"input",className:(0,n.cn)("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30","focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",r),...s})}},28310:(e,r,t)=>{t.d(r,{E:()=>l});var a=t(4624);t(99356);var n=t(60621),s=t(50362),o=t(13506);let i=(0,n.F)("inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function l(e){let{className:r,variant:t="default",asChild:n=!1,...l}=e,c=n?s.bL:"span";return(0,a.jsx)(c,{"data-slot":"badge","data-variant":t,className:(0,o.cn)(i({variant:t}),r),...l})}},64874:(e,r,t)=>{t.d(r,{p:()=>j});var a=t(4624),n=t(99356),s=t(49411),o=t(88365),i=t(72461),l=t(43455),c=t(13561),d=t(60532),u=t(3239),m=t(8096),p=t(94151),x=t(65714),b=t(43153),f=t(95265),h=t(56221),g=t(85253),v=t(15523),w=t(7911);let y=(0,w.createServerReference)("400cee8bc9aabdcab6946c78ffb8fbd71454a7b747",w.callServer,void 0,w.findSourceMapURL,"summarizeYoutubeAction");var k=t(99949);function j(e){let{source:r,onSendToChat:t,autoSummarizeYoutube:s}=e,[c,d]=(0,n.useState)(null);return(0,a.jsxs)("div",{className:"prose prose-neutral dark:prose-invert max-w-none [&_pre]:bg-muted [&_pre]:rounded-md [&_pre]:p-4 [&_pre]:overflow-x-auto [&_pre]:text-sm [&_pre_code]:bg-transparent [&_pre_code]:p-0 [&_pre_code]:text-foreground [&_:not(pre)>code]:bg-muted [&_:not(pre)>code]:px-1.5 [&_:not(pre)>code]:py-0.5 [&_:not(pre)>code]:rounded [&_:not(pre)>code]:text-[0.9em] [&_code]:font-mono [&_table]:text-sm",children:[(0,a.jsx)(o.oz,{remarkPlugins:[i.A],rehypePlugins:[[l.A,{detect:!0,ignoreMissing:!0}]],components:{a:e=>{let{href:r,children:n,...o}=e,i=r?function(e){try{let r=new URL(e),t=r.hostname.replace(/^www\./,"");if("youtu.be"===t){let e=r.pathname.slice(1).split("/")[0];return e&&/^[A-Za-z0-9_-]{6,}$/.test(e)?e:null}if("youtube.com"===t||"m.youtube.com"===t||"youtube-nocookie.com"===t){if("/watch"===r.pathname){let e=r.searchParams.get("v");return e&&/^[A-Za-z0-9_-]{6,}$/.test(e)?e:null}let e=/^\/(shorts|embed|live|v)\/([^/?#]+)/.exec(r.pathname);if(e&&/^[A-Za-z0-9_-]{6,}$/.test(e[2]))return e[2]}}catch(e){}return null}(r):null;return i&&r?(0,a.jsx)(A,{url:r,videoId:i,autoSummarize:null!=s&&s,...t?{onSendToChat:t}:{}}):(0,a.jsx)("a",{href:r,...o,children:n})},img:e=>{let{src:r,alt:t,title:n}=e;return"string"!=typeof r||0===r.length?null:(0,a.jsx)(N,{src:r,alt:"string"==typeof t?t:"",title:"string"==typeof n?n:void 0,onZoom:e=>d(e)})}},children:r}),c&&(0,a.jsx)(_,{src:c.src,alt:c.alt,onClose:()=>d(null)})]})}function N(e){var r;let{src:t,alt:n,title:o,onZoom:i}=e,l=(0,s.c)("roots");return(0,a.jsx)("img",{src:t,alt:n,title:null!=(r=null!=o?o:n)?r:l("markdown.openFullscreen"),onClick:()=>i({src:t,alt:n}),className:"cursor-zoom-in rounded-md border bg-muted/40 transition hover:opacity-90",loading:"lazy"})}function _(e){let{src:r,alt:t,onClose:o}=e,i=(0,s.c)("roots"),l=(0,n.useCallback)(e=>{"Escape"===e.key&&o()},[o]);return(0,n.useEffect)(()=>{document.addEventListener("keydown",l);let e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",l),document.body.style.overflow=e}},[l]),(0,a.jsxs)("div",{className:"fixed inset-0 z-[80] flex items-center justify-center p-6 bg-background/85 backdrop-blur-sm cursor-zoom-out",onClick:o,role:"dialog","aria-label":t||i("markdown.imagePreview"),children:[(0,a.jsx)(g.$,{type:"button",size:"icon",variant:"ghost",className:"absolute top-4 right-4 h-9 w-9 bg-card/80 hover:bg-card",onClick:e=>{e.stopPropagation(),o()},"aria-label":i("markdown.closeAria"),children:(0,a.jsx)(c.A,{className:"h-5 w-5"})}),(0,a.jsx)("img",{src:r,alt:t,className:"max-h-full max-w-full object-contain rounded-lg shadow-2xl",onClick:e=>e.stopPropagation()}),t&&(0,a.jsx)("div",{className:"absolute bottom-6 inset-x-0 mx-auto max-w-3xl px-6 text-center text-sm text-foreground/80 pointer-events-none",children:t})]})}function A(e){let{url:r,videoId:t,onSendToChat:o,autoSummarize:i}=e,l=(0,s.c)("roots"),[w,j]=(0,n.useTransition)(),[N,_]=(0,n.useState)(null),[A,z]=(0,n.useState)(!1),[C,S]=(0,n.useState)(""),[R,$]=(0,n.useState)(!1),E=(0,n.useRef)(!1),L=()=>{_(null),j(async()=>{let e=await y({url:r});if(e.ok){_(e.text),z(!1);return}if(e.needsKey)return void z(!0);h.oR.error(e.error)})};(0,n.useEffect)(()=>{i&&(E.current||(E.current=!0,L()))},[i]);let P=async()=>{if(!C.trim())return void h.oR.error(l("markdown.enterKey"));$(!0);try{let e=await (0,k.A)(C.trim());if(!e.ok)return void h.oR.error(e.error);h.oR.success(l("markdown.geminiKeySaved")),S(""),z(!1),L()}finally{$(!1)}};return(0,a.jsxs)("span",{className:"not-prose my-4 block rounded-lg border bg-card overflow-hidden",children:[(0,a.jsx)("span",{className:"relative block w-full",style:{paddingTop:"56.25%"},children:(0,a.jsx)("iframe",{src:"https://www.youtube-nocookie.com/embed/".concat(t),className:"absolute inset-0 h-full w-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",referrerPolicy:"strict-origin-when-cross-origin",allowFullScreen:!0,title:"YouTube video"})}),(0,a.jsxs)("span",{className:"flex items-center gap-2 p-2 border-t bg-muted/30",children:[(0,a.jsx)(d.A,{className:"h-4 w-4 text-red-600 shrink-0"}),(0,a.jsx)("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:underline truncate flex-1 min-w-0",children:r}),(0,a.jsxs)(g.$,{type:"button",size:"sm",variant:"outline",onClick:L,disabled:w,className:"gap-1 shrink-0 h-7",children:[w?(0,a.jsx)(u.A,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(m.A,{className:"h-3 w-3"}),l("markdown.summarize")]})]}),A&&(0,a.jsxs)("span",{className:"block border-t bg-amber-50/60 p-3 space-y-2",children:[(0,a.jsxs)("span",{className:"flex items-center gap-2 text-xs text-amber-900",children:[(0,a.jsx)(p.A,{className:"h-3.5 w-3.5"}),(0,a.jsx)("span",{className:"font-medium",children:l("markdown.needsGeminiKey")})]}),(0,a.jsx)("span",{className:"block text-[11px] text-amber-900/80",children:l.rich("markdown.geminiKeyHelp",{link:()=>(0,a.jsx)("a",{href:"https://aistudio.google.com/apikey",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"aistudio.google.com/apikey"}),path:()=>(0,a.jsx)("code",{className:"font-mono",children:"~/.reflex/api-keys/gemini.json"}),modelsList:()=>(0,a.jsx)("code",{className:"font-mono",children:"models.list"})})}),(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsx)(v.p,{type:"password",value:C,onChange:e=>S(e.target.value),placeholder:"AIza…",className:"font-mono text-xs h-8 flex-1",disabled:R}),(0,a.jsxs)(g.$,{type:"button",size:"sm",onClick:()=>void P(),disabled:R||!C.trim(),className:"h-8 gap-1",children:[R?(0,a.jsx)(u.A,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(x.A,{className:"h-3 w-3"}),l("markdown.saveAndContinue")]}),(0,a.jsx)(g.$,{type:"button",size:"icon",variant:"ghost",onClick:()=>z(!1),className:"h-8 w-8",children:(0,a.jsx)(c.A,{className:"h-3.5 w-3.5"})})]})]}),N&&(0,a.jsxs)("span",{className:"block border-t p-3 space-y-2",children:[(0,a.jsxs)("span",{className:"flex items-center gap-2 text-[11px] uppercase tracking-wider text-muted-foreground",children:[(0,a.jsx)(b.A,{className:"h-3 w-3 text-emerald-600"}),"Gemini summary",(0,a.jsxs)(g.$,{type:"button",size:"sm",variant:"ghost",onClick:L,className:"ml-auto h-6 text-[10px] gap-1",disabled:w,children:[w?(0,a.jsx)(u.A,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(m.A,{className:"h-3 w-3"}),l("markdown.redo")]}),o&&(0,a.jsxs)(g.$,{type:"button",size:"sm",variant:"outline",onClick:()=>o(N,r),className:"h-6 text-[10px] gap-1",children:[(0,a.jsx)(f.A,{className:"h-3 w-3"}),l("markdown.toChat")]})]}),(0,a.jsx)("span",{className:"block",children:(0,a.jsx)("span",{className:"block text-sm whitespace-pre-wrap leading-relaxed",children:N})})]})]})}},78825:(e,r,t)=>{t.d(r,{J:()=>o});var a=t(4624);t(99356);var n=t(33976),s=t(13506);function o(e){let{className:r,...t}=e;return(0,a.jsx)(n.Root,{"data-slot":"label",className:(0,s.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",r),...t})}},91074:(e,r,t)=>{t.d(r,{Separator:()=>o});var a=t(4624);t(99356);var n=t(44188),s=t(13506);function o(e){let{className:r,orientation:t="horizontal",decorative:o=!0,...i}=e;return(0,a.jsx)(n.b,{"data-slot":"separator",decorative:o,orientation:t,className:(0,s.cn)("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",r),...i})}},99949:(e,r,t)=>{t.d(r,{A:()=>n});var a=t(7911);let n=(0,a.createServerReference)("40c2dbb278e7744fe1df22f6aa0ca5605b41851e55",a.callServer,void 0,a.findSourceMapURL,"saveGeminiKeyAction")}}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177],{13506:(e,t,s)=>{"use strict";s.d(t,{cn:()=>n});var a=s(47989),r=s(55701);function n(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return(0,r.QP)((0,a.$)(t))}},17848:(e,t,s)=>{Promise.resolve().then(s.bind(s,35114)),Promise.resolve().then(s.t.bind(s,60290,23)),Promise.resolve().then(s.bind(s,43450)),Promise.resolve().then(s.bind(s,52713))},35114:(e,t,s)=>{"use strict";s.d(t,{AppSidebar:()=>T});var a=s(4624),r=s(99356),n=s(54400),l=s.n(n),i=s(69285),c=s(56221),o=s(49411),d=s(8096),u=s(72754),x=s(70762),h=s(69709),m=s(69205),p=s(9923),f=s(49623),g=s(3239),b=s(79182),v=s(42146),j=s(46972),N=s(74664),w=s(63514),y=s(80192),k=s(91074),A=s(85253),S=s(7911);let z=(0,S.createServerReference)("409592191b6d1a83dcfa43bb10166ebdab3102e0ec",S.callServer,void 0,S.findSourceMapURL,"loadKbSectionsAction"),C=(0,S.createServerReference)("40a6b3ebfb40d5e1a219cfc2e16ca9567d31539193",S.callServer,void 0,S.findSourceMapURL,"loadTopicsAction"),R=(0,S.createServerReference)("00ddec867808eaf0f08bb13fd6c5e56d54c9c80d61",S.callServer,void 0,S.findSourceMapURL,"listRootsAction"),E=(0,S.createServerReference)("405b5636ac1dd68523fd62b7d16ab7852845ce22d2",S.callServer,void 0,S.findSourceMapURL,"listAgentsAction");var I=s(39624),L=s(53296),_=s(50988),P=s(63622);function T(e){let{initialRoots:t}=e,s=(0,i.usePathname)(),n=(0,o.c)("app"),[c,h]=(0,r.useState)(t),m=(0,r.useCallback)(async()=>{let e=await R();e.ok&&h(e.entries)},[]);return((0,w.S9)(w.Zi.rootsChanged,m),(null==s?void 0:s.startsWith("/share/"))||"/share"===s)?null:(0,a.jsxs)("aside",{className:"w-72 shrink-0 border-r bg-muted/30 flex flex-col",children:[(0,a.jsxs)("div",{className:"px-4 py-4 flex items-center gap-2 border-b",children:[(0,a.jsx)("span",{className:"reflex-gradient inline-flex h-7 w-7 items-center justify-center rounded-lg text-white shadow-sm",children:(0,a.jsx)(d.A,{className:"h-4 w-4"})}),(0,a.jsxs)("div",{className:"leading-tight",children:[(0,a.jsx)(l(),{href:"/",className:"text-sm font-semibold tracking-tight hover:underline",children:"Reflex"}),(0,a.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:"knowledge base"})]})]}),(0,a.jsx)(y.F,{className:"flex-1",children:(0,a.jsxs)("nav",{className:"px-2 pt-3 pb-6",children:[(0,a.jsx)("div",{className:"px-2 mb-1 text-[10px] uppercase tracking-wider text-muted-foreground",children:n("sidebar.spaces")}),0===c.length?(0,a.jsx)("div",{className:"px-2 py-3 text-xs text-muted-foreground",children:n("sidebar.empty")}):(0,a.jsx)("ul",{className:"space-y-0.5",children:c.map(e=>{var t;return(0,a.jsx)($,{root:e,active:null!=(t=null==s?void 0:s.startsWith("/roots/".concat(e.id)))&&t},e.id)})}),(0,a.jsx)("div",{className:"mt-2 px-2",children:(0,a.jsx)(A.$,{asChild:!0,variant:"ghost",size:"sm",className:"h-7 w-full justify-start text-xs",children:(0,a.jsxs)(l(),{href:"/roots/new",children:[(0,a.jsx)(u.A,{className:"mr-1 h-3.5 w-3.5"})," ",n("sidebar.addSpace")]})})})]})}),(0,a.jsx)(k.Separator,{}),(0,a.jsxs)("div",{className:"px-2 py-2 space-y-0.5",children:[(0,a.jsx)(A.$,{asChild:!0,variant:"/utilities"===s||(null==s?void 0:s.startsWith("/utilities/"))?"secondary":"ghost",size:"sm",className:"w-full justify-start",children:(0,a.jsxs)(l(),{href:"/utilities",children:[(0,a.jsx)(I.A,{className:"mr-2 h-4 w-4"})," ",n("sidebar.utilities")]})}),(0,a.jsx)(A.$,{asChild:!0,variant:"/audit"===s?"secondary":"ghost",size:"sm",className:"w-full justify-start",children:(0,a.jsxs)(l(),{href:"/audit",children:[(0,a.jsx)(L.A,{className:"mr-2 h-4 w-4"})," ",n("sidebar.audit")]})}),(0,a.jsx)(A.$,{asChild:!0,variant:"/settings"===s?"secondary":"ghost",size:"sm",className:"w-full justify-start",children:(0,a.jsxs)(l(),{href:"/settings",children:[(0,a.jsx)(x.A,{className:"mr-2 h-4 w-4"})," Settings"]})})]})]})}function $(e){let{root:t,active:s}=e,n=(0,o.c)("app"),[c,d]=(0,r.useState)(s),[u,x]=(0,r.useState)(!1),[v,j]=(0,r.useState)(!1),[N,y]=(0,r.useState)(!1),[k,A]=(0,r.useState)(null),[S,R]=(0,r.useState)(null),[I,L]=(0,r.useState)(null),[P,T]=(0,r.useState)(!1),[$,U]=(0,r.useState)(!1),[Z,W]=(0,r.useState)(!1),O=(0,i.usePathname)();(0,r.useEffect)(()=>{s&&d(!0)},[s]);let V=(0,r.useCallback)(async()=>{T(!0);let e=await z(t.id);T(!1),e.ok?A(e.sections):A([])},[t.id]),K=(0,r.useCallback)(async()=>{U(!0);let e=await C(t.id);U(!1),e.ok?R(e.topics):R([])},[t.id]),Q=(0,r.useCallback)(async()=>{W(!0);let e=await E({rootId:t.id});W(!1),e.ok?L(e.agents):L([])},[t.id]);(0,w.S9)(w.Zi.kbChanged(t.id),()=>{u?V():A(null)}),(0,w.S9)(w.Zi.topicsChanged(t.id),()=>{v?K():R(null),N?Q():L(null)}),(0,r.useEffect)(()=>{if(!N)return;let e=setInterval(()=>{Q()},3e3);return()=>clearInterval(e)},[N,Q]);let q=async()=>{let e=!u;x(e),e&&null===k&&!P&&await V()},G=async()=>{let e=!v;j(e),e&&null===S&&!$&&await K()},H=async()=>{let e=!N;y(e),e&&null===I&&!Z&&await Q()},J=function(e){var t;let s=e.split("/").filter(Boolean);return null!=(t=s[s.length-1])?t:e}(t.path);return(0,a.jsxs)("li",{children:[(0,a.jsxs)("div",{className:"flex items-center group",children:[(0,a.jsx)("button",{type:"button",onClick:()=>d(e=>!e),className:"h-6 w-6 flex items-center justify-center text-muted-foreground hover:text-foreground shrink-0","aria-label":n(c?"sidebar.collapse":"sidebar.expand"),children:c?(0,a.jsx)(h.A,{className:"h-3.5 w-3.5"}):(0,a.jsx)(m.A,{className:"h-3.5 w-3.5"})}),(0,a.jsxs)(l(),{href:"/roots/".concat(t.id),className:"flex-1 min-w-0 flex items-center gap-2 px-2 py-1 rounded-md text-sm hover:bg-accent ".concat(s?"bg-accent":""),children:[(0,a.jsx)(p.A,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:J})]})]}),c&&(0,a.jsxs)("ul",{className:"ml-5 mt-0.5 space-y-0.5 border-l pl-1",children:[(0,a.jsxs)("li",{children:[(0,a.jsxs)("button",{type:"button",onClick:q,className:"w-full flex items-center gap-1 px-2 py-1 rounded-md text-xs text-muted-foreground hover:bg-accent hover:text-foreground",children:[u?(0,a.jsx)(h.A,{className:"h-3 w-3 shrink-0"}):(0,a.jsx)(m.A,{className:"h-3 w-3 shrink-0"}),(0,a.jsx)(f.A,{className:"h-3 w-3 shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:n("sidebar.kb")}),P&&(0,a.jsx)(g.A,{className:"ml-auto h-3 w-3 animate-spin shrink-0"})]}),u&&null!==k&&(0,a.jsx)(F,{rootId:t.id,sections:k,pathname:O})]}),(0,a.jsxs)("li",{children:[(0,a.jsxs)("button",{type:"button",onClick:G,className:"w-full flex items-center gap-1 px-2 py-1 rounded-md text-xs text-muted-foreground hover:bg-accent hover:text-foreground",children:[v?(0,a.jsx)(h.A,{className:"h-3 w-3 shrink-0"}):(0,a.jsx)(m.A,{className:"h-3 w-3 shrink-0"}),(0,a.jsx)(b.A,{className:"h-3 w-3 shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:n("sidebar.topics")}),$&&(0,a.jsx)(g.A,{className:"ml-auto h-3 w-3 animate-spin shrink-0"}),null!==S&&(0,a.jsx)("span",{className:"ml-auto text-[10px] text-muted-foreground",children:S.length})]}),v&&null!==S&&(0,a.jsx)(B,{rootId:t.id,topics:S,pathname:O})]}),(0,a.jsxs)("li",{children:[(0,a.jsxs)("button",{type:"button",onClick:H,className:"w-full flex items-center gap-1 px-2 py-1 rounded-md text-xs text-muted-foreground hover:bg-accent hover:text-foreground",children:[N?(0,a.jsx)(h.A,{className:"h-3 w-3 shrink-0"}):(0,a.jsx)(m.A,{className:"h-3 w-3 shrink-0"}),(0,a.jsx)(_.A,{className:"h-3 w-3 shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:n("sidebar.agents")}),Z&&(0,a.jsx)(g.A,{className:"ml-auto h-3 w-3 animate-spin shrink-0"}),null!==I&&!Z&&(0,a.jsxs)("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[I.filter(e=>D(e.status)).length,"/",I.length]})]}),N&&null!==I&&(0,a.jsx)(M,{agents:I,pathname:O})]})]})]})}function M(e){var t,s;let{agents:r,pathname:n}=e;if(0===r.length)return(0,a.jsx)(U,{});let l=new Map;for(let e of r){let s=e.parentId,a=null!=(t=l.get(s))?t:[];a.push(e),l.set(s,a)}let i=null!=(s=l.get(void 0))?s:[];return(0,a.jsx)("ul",{className:"ml-4 mt-0.5 space-y-0.5 border-l pl-1",children:i.map(e=>(0,a.jsx)(Z,{agent:e,byParent:l,pathname:n,depth:0},e.id))})}function U(){let e=(0,o.c)("app");return(0,a.jsx)("div",{className:"ml-4 px-3 py-1 text-[11px] italic text-muted-foreground",children:e("sidebar.noAgents")})}function Z(e){var t;let{agent:s,byParent:r,pathname:n,depth:i}=e,c=null!=(t=r.get(s.id))?t:[],o="/agents/".concat(s.id),d=n===o;return(0,a.jsxs)("li",{children:[(0,a.jsxs)(l(),{href:o,className:"flex items-center gap-1 px-2 py-1 text-[12px] rounded hover:bg-accent ".concat(d?"bg-accent":""),style:{paddingLeft:8*i+4},children:[D(s.status)?(0,a.jsx)(P.A,{className:"h-3 w-3 text-emerald-600 shrink-0 animate-pulse"}):(0,a.jsx)(_.A,{className:"h-3 w-3 text-muted-foreground shrink-0"}),(0,a.jsx)("span",{className:"truncate flex-1",children:s.label}),(0,a.jsx)("span",{className:"font-mono text-[10px] text-muted-foreground shrink-0",title:"".concat(s.harness," \xb7 ").concat(s.model),children:"claude-code"===s.harness?"claude":"ollama"===s.harness?"ollama":"codex"})]}),c.length>0&&(0,a.jsx)("ul",{className:"space-y-0.5",children:c.map(e=>(0,a.jsx)(Z,{agent:e,byParent:r,pathname:n,depth:i+1},e.id))})]})}function D(e){return"starting"===e||"running"===e}function F(e){let{rootId:t,sections:s,pathname:r}=e;return 0===s.length?(0,a.jsx)(W,{}):(0,a.jsx)("ul",{className:"ml-4 mt-0.5 space-y-0.5 border-l pl-1",children:s.map(e=>e.isDir?(0,a.jsx)(O,{rootId:t,section:e,pathname:r},e.rel):(0,a.jsx)("li",{children:(0,a.jsx)(V,{rootId:t,section:e,pathname:r})},e.rel))})}function W(){let e=(0,o.c)("app");return(0,a.jsx)("div",{className:"px-3 py-1 text-[11px] italic text-muted-foreground",children:e("sidebar.kbEmpty")})}function O(e){let{rootId:t,section:s,pathname:n}=e,[l,i]=(0,r.useState)(!1);return(0,a.jsxs)("li",{children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("button",{type:"button",onClick:()=>i(e=>!e),className:"h-5 w-5 flex items-center justify-center text-muted-foreground hover:text-foreground shrink-0",children:l?(0,a.jsx)(h.A,{className:"h-3 w-3"}):(0,a.jsx)(m.A,{className:"h-3 w-3"})}),(0,a.jsx)(v.A,{className:"h-3 w-3 text-muted-foreground shrink-0 mr-1"}),(0,a.jsx)("span",{className:"text-[12px] flex-1 truncate",children:s.label})]}),l&&s.children&&(0,a.jsx)("ul",{className:"ml-4 space-y-0.5 border-l pl-1",children:s.children.map(e=>(0,a.jsx)("li",{children:(0,a.jsx)(V,{rootId:t,section:e,pathname:n})},e.rel))})]})}function V(e){let{rootId:t,section:s,pathname:r}=e;if(!s.fileRel)return null;let n=s.fileRel.split("/").map(encodeURIComponent).join("/"),i="/roots/".concat(t,"/kb/").concat(n),c=r===i;return(0,a.jsxs)(l(),{href:i,className:"flex items-center gap-1 px-2 py-1 text-[12px] rounded hover:bg-accent ".concat(c?"bg-accent":""),children:[(0,a.jsx)(f.A,{className:"h-3 w-3 text-muted-foreground shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:s.label})]})}function B(e){let{rootId:t,topics:s,pathname:r}=e;return 0===s.length?(0,a.jsx)(K,{}):(0,a.jsx)("ul",{className:"ml-4 mt-0.5 space-y-0.5 border-l pl-1",children:s.map(e=>(0,a.jsx)(Q,{rootId:t,topic:e,pathname:r},e.id))})}function K(){let e=(0,o.c)("app");return(0,a.jsx)("div",{className:"ml-4 px-3 py-1 text-[11px] italic text-muted-foreground",children:e("sidebar.noTopics")})}function Q(e){let{rootId:t,topic:s,pathname:n}=e,d=(0,o.c)("app"),u="/roots/".concat(t,"/chat/").concat(s.id),x=n===u,[h,m]=(0,r.useTransition)(),p=(0,i.useRouter)();return(0,a.jsx)("li",{className:"group/topic",children:(0,a.jsxs)(l(),{href:u,className:"flex items-center gap-1 px-2 py-1 text-[12px] rounded hover:bg-accent ".concat(x?"bg-accent":""),children:[(0,a.jsx)(b.A,{className:"h-3 w-3 text-muted-foreground shrink-0"}),(0,a.jsx)("span",{className:"truncate flex-1 min-w-0",children:s.title}),(0,a.jsx)("button",{type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),confirm(d("sidebar.deleteTopicConfirm",{title:s.title}))&&m(async()=>{let e=await (0,N.L)(t,s.id);if(!e.ok){var a;c.oR.error(null!=(a=e.error)?a:d("sidebar.deleteFailed"));return}c.oR.success(d("sidebar.topicDeleted")),(0,w.$d)(w.Zi.topicsChanged(t)),x&&p.push("/roots/".concat(t))})},disabled:h,"aria-label":d("sidebar.deleteTopic"),title:d("sidebar.deleteTopic"),className:"opacity-0 group-hover/topic:opacity-100 transition-opacity p-0.5 rounded hover:bg-destructive/15 text-muted-foreground hover:text-destructive shrink-0",children:h?(0,a.jsx)(g.A,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(j.A,{className:"h-3 w-3"})})]})})}},43450:(e,t,s)=>{"use strict";s.d(t,{Toaster:()=>u});var a=s(4624),r=s(58726),n=s(42795),l=s(85924),i=s(69259),c=s(3239),o=s(41085),d=s(56221);let u=e=>{let{...t}=e,{theme:s="system"}=(0,o.D)();return(0,a.jsx)(d.l$,{theme:s,className:"toaster group",icons:{success:(0,a.jsx)(r.A,{className:"size-4"}),info:(0,a.jsx)(n.A,{className:"size-4"}),warning:(0,a.jsx)(l.A,{className:"size-4"}),error:(0,a.jsx)(i.A,{className:"size-4"}),loading:(0,a.jsx)(c.A,{className:"size-4 animate-spin"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)"},...t})}},60290:()=>{},63514:(e,t,s)=>{"use strict";s.d(t,{$d:()=>n,S9:()=>l,Zi:()=>r});var a=s(99356);let r={rootsChanged:"reflex:roots-changed",topicsChanged:e=>"reflex:topics-changed:".concat(e),kbChanged:e=>"reflex:kb-changed:".concat(e)};function n(e,t){window.dispatchEvent(new CustomEvent(e,{detail:t}))}function l(e,t){(0,a.useEffect)(()=>{let s=e=>t(e.detail);return window.addEventListener(e,s),()=>window.removeEventListener(e,s)},[e,t])}},74664:(e,t,s)=>{"use strict";s.d(t,{L:()=>r});var a=s(7911);let r=(0,a.createServerReference)("609d8ee75370ce752d807c32f779a1f858b1841607",a.callServer,void 0,a.findSourceMapURL,"deleteTopicAction")},80192:(e,t,s)=>{"use strict";s.d(t,{F:()=>l});var a=s(4624);s(99356);var r=s(14884),n=s(13506);function l(e){let{className:t,children:s,...l}=e;return(0,a.jsxs)(r.Root,{"data-slot":"scroll-area",className:(0,n.cn)("relative",t),...l,children:[(0,a.jsx)(r.Viewport,{"data-slot":"scroll-area-viewport",className:"size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",children:s}),(0,a.jsx)(i,{}),(0,a.jsx)(r.Corner,{})]})}function i(e){let{className:t,orientation:s="vertical",...l}=e;return(0,a.jsx)(r.ScrollAreaScrollbar,{"data-slot":"scroll-area-scrollbar",orientation:s,className:(0,n.cn)("flex touch-none p-px transition-colors select-none","vertical"===s&&"h-full w-2.5 border-l border-l-transparent","horizontal"===s&&"h-2.5 flex-col border-t border-t-transparent",t),...l,children:(0,a.jsx)(r.ScrollAreaThumb,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"})})}},85253:(e,t,s)=>{"use strict";s.d(t,{$:()=>c});var a=s(4624);s(99356);var r=s(60621),n=s(50362),l=s(13506);let i=(0,r.F)("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function c(e){let{className:t,variant:s="default",size:r="default",asChild:c=!1,...o}=e,d=c?n.bL:"button";return(0,a.jsx)(d,{"data-slot":"button","data-variant":s,"data-size":r,className:(0,l.cn)(i({variant:s,size:r,className:t})),...o})}},91074:(e,t,s)=>{"use strict";s.d(t,{Separator:()=>l});var a=s(4624);s(99356);var r=s(44188),n=s(13506);function l(e){let{className:t,orientation:s="horizontal",decorative:l=!0,...i}=e;return(0,a.jsx)(r.b,{"data-slot":"separator",decorative:l,orientation:s,className:(0,n.cn)("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...i})}}},e=>{e.O(0,[497,4400,1217,9411,5097,6445,4933,146,7358],()=>e(e.s=17848)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9566],{8096:(e,s,t)=>{"use strict";t.d(s,{A:()=>l});let l=(0,t(45804).A)("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]])},54207:(e,s,t)=>{"use strict";t.d(s,{A:()=>l});let l=(0,t(45804).A)("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])},58726:(e,s,t)=>{"use strict";t.d(s,{A:()=>l});let l=(0,t(45804).A)("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},69285:(e,s,t)=>{"use strict";var l=t(48849);t.o(l,"usePathname")&&t.d(s,{usePathname:function(){return l.usePathname}}),t.o(l,"useRouter")&&t.d(s,{useRouter:function(){return l.useRouter}})},81641:(e,s,t)=>{Promise.resolve().then(t.bind(t,92577))},85924:(e,s,t)=>{"use strict";t.d(s,{A:()=>l});let l=(0,t(45804).A)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},86790:(e,s,t)=>{"use strict";t.d(s,{A:()=>l});let l=(0,t(45804).A)("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])},92577:(e,s,t)=>{"use strict";t.d(s,{OnboardingWizard:()=>N});var l=t(4624),a=t(99356),i=t(69285),n=t(49411),c=t(8096),d=t(3239),r=t(45804);let o=(0,r.A)("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);var m=t(86790);let x=(0,r.A)("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);var u=t(58726);let p=(0,r.A)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);var h=t(54207),g=t(85924),v=t(56221),b=t(7911);let f=(0,b.createServerReference)("00ccd76fc13cb0ba3d18dc989d9bcfe0f24fd01b3f",b.callServer,void 0,b.findSourceMapURL,"detectEnginesAction"),j=(0,b.createServerReference)("40f39d7afc1e774b93b4107c769658c9c8fb5cfe8c",b.callServer,void 0,b.findSourceMapURL,"runOnboardingAction");function N(e){var s,t,r;let{templates:g,initialLanguage:b,initialName:N}=e,w=(0,n.c)("onboarding"),C=(0,i.useRouter)(),[M,L]=(0,a.useState)(0),[S,R]=(0,a.useState)(N),[z,T]=(0,a.useState)(b||"russian"),[D,E]=(0,a.useState)(""),[_,H]=(0,a.useState)("claude"),[O,P]=(0,a.useState)({loading:!0,claudeAvailable:!1,codexAvailable:!1,ollamaAvailable:!1}),[F,q]=(0,a.useState)(new Set),[V,Z]=(0,a.useTransition)();(0,a.useEffect)(()=>{try{E(Intl.DateTimeFormat().resolvedOptions().timeZone||"")}catch(e){}(async()=>{let e=await f();P({loading:!1,claudeAvailable:e.claudeCli.available,...e.claudeCli.version?{claudeVersion:e.claudeCli.version}:{},codexAvailable:e.codexCli.available,...e.codexCli.version?{codexVersion:e.codexCli.version}:{},ollamaAvailable:e.ollama.available,...void 0!==e.ollama.modelsCount?{ollamaModels:e.ollama.modelsCount}:{}}),!e.claudeCli.available&&(e.codexCli.available?H("codex"):e.ollama.available&&H("ollama"))})()},[]);let U=(0,a.useMemo)(()=>0===M?S.trim().length>0&&z.trim().length>0:1===M?"claude"===_?O.claudeAvailable:"codex"===_?O.codexAvailable:O.ollamaAvailable:2!==M||F.size>0,[M,S,z,_,O,F]),B=[w("stepTitles.0"),w("stepTitles.1"),w("stepTitles.2"),w("stepTitles.3")];return(0,l.jsx)("div",{className:"min-h-screen flex flex-col items-center px-4 py-8",children:(0,l.jsxs)("div",{className:"w-full max-w-2xl space-y-4",children:[(0,l.jsxs)("header",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,l.jsx)(c.A,{className:"h-4 w-4 text-violet-600"}),(0,l.jsx)("span",{className:"font-medium",children:w("header.welcome")}),(0,l.jsx)("span",{className:"ml-auto text-xs",children:w("header.stepCounter",{current:M+1,total:4,title:B[M]})})]}),(0,l.jsx)(y,{current:M}),0===M&&(0,l.jsxs)(k,{children:[(0,l.jsx)("h1",{className:"text-2xl font-semibold",children:w("step0.title")}),(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:w("step0.description")}),(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)("label",{className:"text-xs font-medium",htmlFor:"name",children:w("step0.nameLabel")}),(0,l.jsx)("input",{id:"name",value:S,onChange:e=>R(e.target.value),autoFocus:!0,placeholder:w("step0.namePlaceholder"),className:"w-full rounded border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-violet-400"})]}),(0,l.jsxs)("div",{className:"space-y-2",children:[(0,l.jsx)("label",{className:"text-xs font-medium",htmlFor:"lang",children:w("step0.languageLabel")}),(0,l.jsxs)("select",{id:"lang",value:z,onChange:e=>T(e.target.value),className:"w-full rounded border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-violet-400",children:[(0,l.jsx)("option",{value:"russian",children:w("step0.languageRu")}),(0,l.jsx)("option",{value:"english",children:w("step0.languageEn")}),(0,l.jsx)("option",{value:"espa\xf1ol",children:w("step0.languageEs")}),(0,l.jsx)("option",{value:"deutsch",children:w("step0.languageDe")}),(0,l.jsx)("option",{value:"fran\xe7ais",children:w("step0.languageFr")})]})]}),D&&(0,l.jsxs)("p",{className:"text-[11px] text-muted-foreground",children:[w("step0.timezoneDetected")," ",(0,l.jsx)("code",{className:"font-mono",children:D})]})]}),1===M&&(0,l.jsxs)(k,{children:[(0,l.jsx)("h1",{className:"text-2xl font-semibold",children:w("step1.title")}),(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:w("step1.description")}),O.loading?(0,l.jsxs)("p",{className:"text-sm text-muted-foreground flex items-center gap-2",children:[(0,l.jsx)(d.A,{className:"h-4 w-4 animate-spin"}),w("step1.checking")]}):(0,l.jsxs)("div",{className:"grid gap-2",children:[(0,l.jsx)(A,{selected:"claude"===_,onSelect:()=>H("claude"),icon:(0,l.jsx)(o,{className:"h-5 w-5"}),title:w("step1.claudeTitle"),description:w("step1.claudeDescription"),installLinkLabel:w("step1.installLink"),status:O.claudeAvailable?{ok:!0,hint:null!=(s=O.claudeVersion)?s:w("step1.claudeReady")}:{ok:!1,hint:w("step1.claudeMissing"),link:"https://docs.anthropic.com/claude/docs/claude-code"}}),(0,l.jsx)(A,{selected:"codex"===_,onSelect:()=>H("codex"),icon:(0,l.jsx)(m.A,{className:"h-5 w-5"}),title:w("step1.codexTitle"),description:w("step1.codexDescription"),installLinkLabel:w("step1.installLink"),status:O.codexAvailable?{ok:!0,hint:null!=(t=O.codexVersion)?t:w("step1.codexReady")}:{ok:!1,hint:w("step1.codexMissing"),link:"https://github.com/openai/codex"}}),(0,l.jsx)(A,{selected:"ollama"===_,onSelect:()=>H("ollama"),icon:(0,l.jsx)(x,{className:"h-5 w-5"}),title:w("step1.ollamaTitle"),description:w("step1.ollamaDescription"),installLinkLabel:w("step1.installLink"),status:O.ollamaAvailable?{ok:!0,hint:w("step1.ollamaModels",{count:null!=(r=O.ollamaModels)?r:"?"})}:{ok:!1,hint:w("step1.ollamaMissing"),link:"https://ollama.com/download"}})]})]}),2===M&&(0,l.jsxs)(k,{children:[(0,l.jsx)("h1",{className:"text-2xl font-semibold",children:w("step2.title")}),(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:w("step2.description")}),(0,l.jsx)("ul",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:g.map(e=>{let s=F.has(e.id);return(0,l.jsx)("li",{children:(0,l.jsx)("button",{type:"button",onClick:()=>{let s=new Set(F);s.has(e.id)?s.delete(e.id):s.add(e.id),q(s)},className:"w-full text-left rounded-lg border p-3 transition "+(s?"border-violet-500 bg-violet-50 dark:bg-violet-950/40":"hover:bg-accent"),children:(0,l.jsxs)("div",{className:"flex items-start gap-2",children:[(0,l.jsx)("span",{className:"text-2xl leading-none",children:e.emoji}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsxs)("div",{className:"font-medium flex items-center gap-1",children:[e.label,s&&(0,l.jsx)(u.A,{className:"h-3.5 w-3.5 text-violet-600"})]}),(0,l.jsx)("p",{className:"text-xs text-muted-foreground leading-snug mt-0.5",children:e.description})]})]})})},e.id)})}),(0,l.jsx)("p",{className:"text-[11px] text-muted-foreground",children:w("step2.folderHint")})]}),3===M&&(0,l.jsxs)(k,{children:[(0,l.jsx)("h1",{className:"text-2xl font-semibold",children:w("step3.title")}),(0,l.jsx)("p",{className:"text-sm text-muted-foreground",children:w("step3.description")}),(0,l.jsxs)("ul",{className:"text-sm space-y-1",children:[(0,l.jsxs)("li",{className:"flex items-center gap-2",children:[(0,l.jsx)(u.A,{className:"h-4 w-4 text-emerald-600"}),w("step3.profileLabel")," ",(0,l.jsx)("strong",{children:S})," \xb7 ",z," \xb7 ",D||w("step3.empty")]}),(0,l.jsxs)("li",{className:"flex items-center gap-2",children:[(0,l.jsx)(u.A,{className:"h-4 w-4 text-emerald-600"}),w("step3.engineLabel")," ",(0,l.jsx)("strong",{children:"claude"===_?w("step3.engineClaude"):"codex"===_?w("step3.engineCodex"):w("step3.engineOllama")})]}),(0,l.jsxs)("li",{className:"flex items-center gap-2",children:[(0,l.jsx)(u.A,{className:"h-4 w-4 text-emerald-600"}),w("step3.spacesLabel")," ",[...F].map(e=>{var s;return null==(s=g.find(s=>s.id===e))?void 0:s.label}).filter(Boolean).join(" \xb7 ")||w("step3.empty")]})]}),(0,l.jsx)("p",{className:"text-xs text-muted-foreground",children:w("step3.footer")})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[M>0&&(0,l.jsxs)("button",{type:"button",onClick:()=>L(e=>e-1),className:"inline-flex items-center gap-1 rounded border px-3 py-2 text-sm hover:bg-accent",children:[(0,l.jsx)(p,{className:"h-4 w-4"}),w("nav.back")]}),(0,l.jsx)("div",{className:"ml-auto"}),M<3?(0,l.jsxs)("button",{type:"button",onClick:()=>L(e=>e+1),disabled:!U,className:"inline-flex items-center gap-1 rounded bg-violet-600 px-4 py-2 text-sm font-medium text-white hover:bg-violet-700 disabled:opacity-50",children:[w("nav.next"),(0,l.jsx)(h.A,{className:"h-4 w-4"})]}):(0,l.jsxs)("button",{type:"button",onClick:()=>{Z(async()=>{let e=await j({userName:S.trim(),language:z.trim(),timezone:D.trim(),engine:_,templates:[...F]});if(!e.ok){var s;v.oR.error(null!=(s=e.error)?s:w("errors.generic"));return}v.oR.success(w("success.created",{spaces:e.spacesCreated,widgets:e.widgetsCreated})),C.push("/")})},disabled:V,className:"inline-flex items-center gap-1 rounded bg-emerald-600 px-4 py-2 text-sm font-medium text-white hover:bg-emerald-700 disabled:opacity-50",children:[V?(0,l.jsx)(d.A,{className:"h-4 w-4 animate-spin"}):(0,l.jsx)(c.A,{className:"h-4 w-4"}),w("nav.start")]})]})]})})}function k(e){let{children:s}=e;return(0,l.jsx)("section",{className:"rounded-xl border bg-card p-6 shadow-sm space-y-4",children:s})}function y(e){let{current:s}=e;return(0,l.jsx)("div",{className:"flex items-center gap-1",children:[0,1,2,3].map(e=>(0,l.jsx)("div",{className:"h-1 flex-1 rounded-full "+(e<=s?"bg-violet-600":"bg-muted")},e))})}function A(e){let{selected:s,onSelect:t,icon:a,title:i,description:n,status:c,installLinkLabel:d}=e;return(0,l.jsxs)("button",{type:"button",onClick:t,className:"w-full text-left rounded-lg border p-3 transition flex items-start gap-3 "+(s?"border-violet-500 bg-violet-50 dark:bg-violet-950/40":"hover:bg-accent"),children:[(0,l.jsx)("div",{className:"mt-0.5 text-violet-600",children:a}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsxs)("div",{className:"font-medium flex items-center gap-2",children:[i,s&&(0,l.jsx)(u.A,{className:"h-3.5 w-3.5 text-violet-600"})]}),(0,l.jsx)("p",{className:"text-xs text-muted-foreground leading-snug mt-0.5",children:n}),(0,l.jsxs)("div",{className:"mt-1.5 inline-flex items-center gap-1 text-[11px] "+(c.ok?"text-emerald-700":"text-amber-700"),children:[c.ok?(0,l.jsx)(u.A,{className:"h-3 w-3"}):(0,l.jsx)(g.A,{className:"h-3 w-3"}),(0,l.jsx)("span",{children:c.hint}),c.link&&(0,l.jsx)("a",{href:c.link,target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),className:"underline ml-1",children:d})]})]})]})}}},e=>{e.O(0,[9411,5097,4933,146,7358],()=>e(e.s=81641)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8974],{39607:(e,r,n)=>{"use strict";n.d(r,{g:()=>s});var i=n(7911);let s=(0,i.createServerReference)("78d4d46efadb1cd5b97ebc9bca154661d52ec30210",i.callServer,void 0,i.findSourceMapURL,"startTopicAction")},63392:(e,r,n)=>{Promise.resolve().then(n.bind(n,89061)),Promise.resolve().then(n.bind(n,96253)),Promise.resolve().then(n.bind(n,28050)),Promise.resolve().then(n.bind(n,94904)),Promise.resolve().then(n.bind(n,13270)),Promise.resolve().then(n.bind(n,99730)),Promise.resolve().then(n.bind(n,89146)),Promise.resolve().then(n.bind(n,19078)),Promise.resolve().then(n.bind(n,67854)),Promise.resolve().then(n.bind(n,69050)),Promise.resolve().then(n.bind(n,63739)),Promise.resolve().then(n.bind(n,33976)),Promise.resolve().then(n.bind(n,12537)),Promise.resolve().then(n.bind(n,97485)),Promise.resolve().then(n.bind(n,41923)),Promise.resolve().then(n.bind(n,73868)),Promise.resolve().then(n.bind(n,53511)),Promise.resolve().then(n.bind(n,2018)),Promise.resolve().then(n.bind(n,18487)),Promise.resolve().then(n.bind(n,98346)),Promise.resolve().then(n.bind(n,14884)),Promise.resolve().then(n.bind(n,85314)),Promise.resolve().then(n.bind(n,17280)),Promise.resolve().then(n.bind(n,8855)),Promise.resolve().then(n.bind(n,86631)),Promise.resolve().then(n.bind(n,2604)),Promise.resolve().then(n.bind(n,27237)),Promise.resolve().then(n.bind(n,49455)),Promise.resolve().then(n.bind(n,39211)),Promise.resolve().then(n.bind(n,56360)),Promise.resolve().then(n.t.bind(n,54400,23))},68426:(e,r,n)=>{"use strict";n.d(r,{h:()=>s});var i=n(7911);let s=(0,i.createServerReference)("70dba417ed137a6761e753072dcdd9487c28dd02a0",i.callServer,void 0,i.findSourceMapURL,"generateTopicTitleAction")},89061:(e,r,n)=>{"use strict";n.d(r,{UniversalChatBar:()=>v});var i=n(4624),s=n(99356),t=n(69285),o=n(69709),l=n(95265),d=n(56221),a=n(49411),c=n(39607),m=n(68426),u=n(54589),b=n(63602),h=n(63514);function v(e){var r,n,v;let{spaces:p}=e,x=(0,t.useRouter)(),P=(0,a.c)("app"),[f,g]=(0,s.useState)(null!=(n=null==(r=p[0])?void 0:r.id)?n:""),[w,j]=(0,s.useState)(!1),[,k]=(0,s.useTransition)(),N=(0,s.useRef)(null),S=null!=(v=p.find(e=>e.id===f))?v:p[0];if((0,s.useEffect)(()=>{if(!w)return;let e=e=>{var r;(null==(r=N.current)?void 0:r.contains(e.target))||j(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[w]),!S)return(0,i.jsx)("div",{className:"border-t bg-background",children:(0,i.jsxs)("div",{className:"mx-auto max-w-3xl px-6 py-5 text-center text-xs text-muted-foreground",children:[P("universal.createFirstSpace1")," ",(0,i.jsx)("a",{href:"/onboarding?force=1",className:"underline",children:P("universal.wizardLink")})," ",P("universal.or")," ",(0,i.jsx)("a",{href:"/roots/new",className:"underline",children:P("universal.manualLink")}),"."]})});let L=p.length>1?(0,i.jsxs)("div",{className:"relative",ref:N,children:[(0,i.jsxs)("button",{type:"button",onClick:()=>j(e=>!e),className:"inline-flex items-center gap-1 rounded-full border bg-card/80 px-2 py-0.5 text-[10px] font-medium hover:bg-accent normal-case tracking-normal",title:P("universal.pickSpace"),children:[(0,i.jsx)("span",{className:"text-muted-foreground",children:P("universal.in")}),(0,i.jsx)("span",{children:S.label}),(0,i.jsx)(o.A,{className:"h-3 w-3 text-muted-foreground"})]}),w&&(0,i.jsx)("ul",{className:"absolute bottom-full right-0 mb-1 min-w-[200px] max-h-60 overflow-y-auto rounded-md border bg-popover shadow-lg z-40 py-1",children:p.map(e=>(0,i.jsx)("li",{children:(0,i.jsx)("button",{type:"button",onClick:()=>{g(e.id),j(!1)},className:"block w-full text-left px-3 py-1.5 text-sm hover:bg-accent "+(e.id===S.id?"font-semibold":""),children:e.label})},e.id))})]}):null,y=async e=>await new Promise(r=>{k(async()=>{let n=await (0,c.g)(S.id,e.message,e.attachments);if(!n.ok){d.oR.error(n.error),r(!1);return}(0,h.$d)(h.Zi.topicsChanged(S.id)),e.message.trim()&&(0,m.h)(S.id,n.topicId,e.message).then(e=>{e.ok&&(0,h.$d)(h.Zi.topicsChanged(S.id))}),x.push("/roots/".concat(S.id,"/chat/").concat(n.topicId)),r(!0)})});return(0,i.jsx)(b.E,{label:P("universal.label"),...L?{headerRight:L}:{},children:(0,i.jsx)(u.L,{rootId:S.id,placeholder:P("universal.placeholder"),submitLabel:P("universal.submitLabel"),pendingLabel:P("universal.pendingLabel"),SubmitIcon:l.A,onSubmit:y},S.id)})}}},e=>{e.O(0,[4400,1217,9411,3335,5097,3954,5822,4933,146,7358],()=>e(e.s=63392)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[532],{2046:(e,t,s)=>{Promise.resolve().then(s.bind(s,14594)),Promise.resolve().then(s.bind(s,18016)),Promise.resolve().then(s.bind(s,91827)),Promise.resolve().then(s.bind(s,91074)),Promise.resolve().then(s.bind(s,96253)),Promise.resolve().then(s.bind(s,28050)),Promise.resolve().then(s.bind(s,94904)),Promise.resolve().then(s.bind(s,13270)),Promise.resolve().then(s.bind(s,99730)),Promise.resolve().then(s.bind(s,89146)),Promise.resolve().then(s.bind(s,19078)),Promise.resolve().then(s.bind(s,67854)),Promise.resolve().then(s.bind(s,69050)),Promise.resolve().then(s.bind(s,63739)),Promise.resolve().then(s.bind(s,33976)),Promise.resolve().then(s.bind(s,12537)),Promise.resolve().then(s.bind(s,97485)),Promise.resolve().then(s.bind(s,41923)),Promise.resolve().then(s.bind(s,73868)),Promise.resolve().then(s.bind(s,53511)),Promise.resolve().then(s.bind(s,2018)),Promise.resolve().then(s.bind(s,18487)),Promise.resolve().then(s.bind(s,98346)),Promise.resolve().then(s.bind(s,14884)),Promise.resolve().then(s.bind(s,85314)),Promise.resolve().then(s.bind(s,17280)),Promise.resolve().then(s.bind(s,8855)),Promise.resolve().then(s.bind(s,86631)),Promise.resolve().then(s.bind(s,2604)),Promise.resolve().then(s.bind(s,27237)),Promise.resolve().then(s.bind(s,49455)),Promise.resolve().then(s.bind(s,39211)),Promise.resolve().then(s.bind(s,56360)),Promise.resolve().then(s.t.bind(s,54400,23))},5270:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},16329:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]])},23262:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]])},30441:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]])},39160:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]])},58726:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},59728:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])},72691:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},91827:(e,t,s)=>{"use strict";s.d(t,{RootViewer:()=>F});var r=s(4624),n=s(99356),a=s(69285),i=s(49411),l=s(56221),c=s(80192),o=s(43504),d=s(28310),m=s(64874),x=s(7911);let u=(0,x.createServerReference)("60fd5a15da171e6fee0f46125216ab0daf41b57660",x.callServer,void 0,x.findSourceMapURL,"readKbFileAction");var h=s(8190),p=s(45804);let y=(0,p.A)("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);var v=s(16329);let f=(0,p.A)("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),g=(0,p.A)("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]),b=(0,p.A)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]),j=(0,p.A)("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);var k=s(39783),N=s(58726),w=s(72691),A=s(5270);let P=(0,p.A)("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);var E=s(13506);function C(e){let{kind:t,data:s}=e,n=(null!=t?t:"").toLowerCase();return"task"===n?(0,r.jsx)(L,{data:s}):"meeting"===n?(0,r.jsx)(_,{data:s}):"product"===n?(0,r.jsx)(z,{data:s}):"fact"===n?(0,r.jsx)(B,{data:s}):(0,r.jsx)(M,{data:s})}let S=new Set(["title","version","date","kind"]);function M(e){let{data:t}=e,s=Object.entries(t).filter(e=>{let[t]=e;return!S.has(t)});return 0===s.length?null:(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-1.5",children:s.map(e=>{let[t,s]=e;return(0,r.jsxs)(d.E,{variant:"outline",className:"font-mono text-[10px]",children:[(0,r.jsxs)("span",{className:"text-muted-foreground mr-1",children:[t,":"]}),(0,r.jsx)("span",{className:"truncate max-w-[16rem]",children:function e(t){if(null==t)return"";if("string"==typeof t)return t;if("number"==typeof t||"boolean"==typeof t)return String(t);if(Array.isArray(t))return t.map(t=>e(t)).join(", ");try{return JSON.stringify(t)}catch(e){return String(t)}}(s)})]},t)})})}function L(e){var t;let{data:s}=e,n=(0,i.c)("roots"),a=R(s.status),l=R(s.priority),c=null!=(t=R(s.due))?t:R(s.due_date),o=R(s.assignee),m=U(s.tags);return(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[a&&(0,r.jsxs)(d.E,{className:(0,E.cn)("gap-1 capitalize",function(e){let t=e.toLowerCase();return"done"===t?"bg-emerald-600 text-white":"doing"===t||"in_progress"===t?"bg-blue-600 text-white":"blocked"===t||"cancelled"===t?"bg-destructive text-destructive-foreground":"paused"===t?"bg-amber-600 text-white":"bg-secondary text-secondary-foreground"}(a)),children:[(0,r.jsx)(H,{status:a}),a]}),l&&(0,r.jsxs)(d.E,{variant:"outline",className:(0,E.cn)("gap-1 capitalize",function(e){let t=e.toLowerCase();return"high"===t||"p0"===t||"urgent"===t?"border-destructive text-destructive":"med"===t||"medium"===t||"p1"===t?"border-amber-600 text-amber-700":"border-muted-foreground text-muted-foreground"}(l)),children:[(0,r.jsx)(y,{className:"h-3 w-3"}),l]}),c&&(0,r.jsxs)(d.E,{variant:"secondary",className:"gap-1",children:[(0,r.jsx)(v.A,{className:"h-3 w-3"}),n("entityBadges.dueLabel",{date:c})]}),o&&(0,r.jsxs)(d.E,{variant:"outline",className:"gap-1",children:[(0,r.jsx)(f,{className:"h-3 w-3"}),o]}),null==m?void 0:m.map(e=>(0,r.jsxs)(d.E,{variant:"secondary",className:"gap-1",children:[(0,r.jsx)(g,{className:"h-3 w-3"}),e]},e))]})}function _(e){var t;let{data:s}=e,n=(0,i.c)("roots"),a=U(s.attendees),l=U(s.decisions),c=null!=(t=U(s.action_items))?t:U(s.actionItems);return(0,r.jsxs)("div",{className:"space-y-2",children:[a&&a.length>0&&(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,r.jsx)(b,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.map(e=>(0,r.jsxs)(d.E,{variant:"outline",className:"gap-1",children:[(0,r.jsx)(f,{className:"h-3 w-3"})," ",e]},e))]}),l&&l.length>0&&(0,r.jsx)(I,{title:n("entityBadges.decisionsTitle"),items:l}),c&&c.length>0&&(0,r.jsx)(I,{title:"Action items",items:c})]})}function z(e){var t;let{data:s}=e,n=(0,i.c)("roots"),a=R(s.sku),l=s.price,c=R(s.currency),o=R(s.vendor),m=R(s.url),x=U(s.tags);return(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[null!=l&&""!==l&&(0,r.jsxs)(d.E,{className:"bg-emerald-600 text-white",children:["number"==typeof(t=l)?t.toLocaleString():"string"==typeof t?t:String(t),c?" ".concat(c):""]}),a&&(0,r.jsxs)(d.E,{variant:"outline",className:"gap-1 font-mono",children:[(0,r.jsx)(j,{className:"h-3 w-3"})," ",a]}),o&&(0,r.jsx)(d.E,{variant:"secondary",className:"gap-1",children:o}),m&&(0,r.jsxs)("a",{href:m,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs text-primary underline-offset-2 hover:underline",children:[(0,r.jsx)(k.A,{className:"h-3 w-3"}),n("entityBadges.openLink")]}),null==x?void 0:x.map(e=>(0,r.jsxs)(d.E,{variant:"outline",className:"gap-1",children:[(0,r.jsx)(g,{className:"h-3 w-3"})," ",e]},e))]})}function B(e){let{data:t}=e,s=(0,i.c)("roots"),n=U(t.tags),a=R(t.source);return(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[null==n?void 0:n.map(e=>(0,r.jsxs)(d.E,{variant:"secondary",className:"gap-1",children:[(0,r.jsx)(g,{className:"h-3 w-3"})," ",e]},e)),a&&(0,r.jsxs)(d.E,{variant:"outline",className:"gap-1 max-w-[24rem]",children:[(0,r.jsx)("span",{className:"text-muted-foreground",children:s("entityBadges.sourceLabel")}),(0,r.jsx)("span",{className:"truncate",children:a})]})]})}function I(e){let{title:t,items:s}=e;return(0,r.jsxs)("div",{className:"rounded-md border bg-muted/30 p-2",children:[(0,r.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground mb-1",children:t}),(0,r.jsx)("ul",{className:"space-y-0.5 text-sm",children:s.map((e,t)=>(0,r.jsxs)("li",{className:"leading-snug",children:["• ",e]},t))})]})}function H(e){let{status:t}=e,s=t.toLowerCase();return"done"===s?(0,r.jsx)(N.A,{className:"h-3 w-3"}):"doing"===s||"in_progress"===s?(0,r.jsx)(w.A,{className:"h-3 w-3"}):"blocked"===s||"cancelled"===s?(0,r.jsx)(A.A,{className:"h-3 w-3"}):"paused"===s?(0,r.jsx)(P,{className:"h-3 w-3"}):(0,r.jsx)(y,{className:"h-3 w-3"})}function R(e){return"string"==typeof e&&e.trim()?e:"number"==typeof e?String(e):void 0}function U(e){if(!Array.isArray(e))return;let t=e.map(e=>"string"==typeof e?e:null==e?"":String(e)).filter(e=>e.trim());return t.length>0?t:void 0}var q=s(39607);function F(e){var t,s;let{files:d,rootId:x,rootPath:p,initialFile:y}=e,v=(0,i.c)("roots"),f=(()=>{let e=new Map;for(let t of d)e.set(t.rel,t);return e})(),g=null!=(s=y&&f.has(y)?y:f.has("INDEX.md")?"INDEX.md":null==(t=d[0])?void 0:t.rel)?s:null,[b,j]=(0,n.useState)(g),[k,N]=(0,n.useState)(""),[w,A]=(0,n.useState)(null),[P,E]=(0,n.useTransition)(),C=(0,a.useRouter)();return(0,n.useEffect)(()=>{y&&f.has(y)&&j(y)},[y]),(0,n.useEffect)(()=>{b&&E(async()=>{let e=await u(x,b);if(e.ok)N(e.content),A(e.meta);else{var t;N("# Error\n\n".concat(null!=(t=e.error)?t:"")),A(null)}})},[b,x]),(0,r.jsxs)("div",{className:"flex-1 flex flex-col min-h-0",children:[(0,r.jsx)(c.F,{className:"flex-1 min-h-0",children:(0,r.jsxs)("article",{className:"mx-auto max-w-3xl px-8 py-10",children:[b?P?(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)(o.E,{className:"h-8 w-3/5"}),(0,r.jsx)(o.E,{className:"h-4 w-full"}),(0,r.jsx)(o.E,{className:"h-4 w-11/12"}),(0,r.jsx)(o.E,{className:"h-4 w-4/5"})]}):(0,r.jsxs)(r.Fragment,{children:[w&&(0,r.jsx)(O,{meta:w,filename:b}),(0,r.jsx)(m.p,{source:function(e){if(!e.startsWith("---"))return e;let t=e.indexOf("\n---",3);return t<0?e:e.slice(t+4).replace(/^\r?\n/,"")}(k),onSendToChat:(e,t)=>{(async()=>{let s=v("kb.summaryContext",{url:t,text:e}),r=await (0,q.g)(x,s);if(!r.ok)return l.oR.error(r.error);C.push("/roots/".concat(x,"/chat/").concat(r.topicId))})()}})]}):(0,r.jsx)("p",{className:"text-muted-foreground",children:v("kb.selectFileHint")}),(0,r.jsxs)("div",{className:"mt-10 text-[11px] text-muted-foreground font-mono truncate",children:[p,"/.reflex/"]})]})}),(0,r.jsx)(h.CommandBar,{rootId:x,focusFile:null!=b?b:void 0})]})}function O(e){var t;let{meta:s,filename:n}=e;return s.title||void 0!==s.version||s.date||s.kind?(0,r.jsxs)("header",{className:"mb-6 pb-4 border-b space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-baseline gap-3 flex-wrap",children:[(0,r.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",children:null!=(t=s.title)?t:n}),(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[s.kind&&(0,r.jsx)(d.E,{variant:"default",className:"capitalize",children:s.kind}),void 0!==s.version&&(0,r.jsxs)(d.E,{variant:"outline",children:["v",s.version]}),s.date&&(0,r.jsx)("span",{className:"font-mono",children:s.date})]})]}),(0,r.jsx)(T,{createdBy:s.data.createdBy}),(0,r.jsx)(C,{kind:s.kind,data:s.data}),(0,r.jsx)("div",{className:"text-[11px] text-muted-foreground font-mono",children:n})]}):null}function T(e){let{createdBy:t}=e,s=(0,i.c)("roots");if("string"!=typeof t||!t)return null;let[n,a]=t.split(":",2);if(!n||!a)return null;let[l,c]=a.split("@",2),o="utility"===n?s("kb.createdMiniApp"):"workflow"===n?s("kb.createdWorkflow"):"agent"===n?s("kb.createdAgent"):n,d=(0,r.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full border bg-violet-50 dark:bg-violet-950/30 px-2 py-0.5 text-[10px] text-violet-700 dark:text-violet-300",children:[(0,r.jsx)("span",{className:"text-[9px] uppercase tracking-wider text-muted-foreground",children:s("kb.createdLabel")}),(0,r.jsx)("span",{children:o}),(0,r.jsx)("code",{className:"font-mono",children:l}),c&&(0,r.jsxs)("span",{className:"font-mono text-muted-foreground",children:["v",c]})]});return"utility"===n&&l?(0,r.jsx)("a",{href:"/utilities/project/".concat(encodeURIComponent(l)),className:"inline-block hover:opacity-80",title:s("kb.openMiniApp"),children:d}):d}}},e=>{e.O(0,[4400,1217,9411,3335,5097,3954,8775,5822,8336,2390,4933,146,7358],()=>e(e.s=2046)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8138],{4959:(e,t,s)=>{"use strict";s.d(t,{BT:()=>l,Wu:()=>d,ZB:()=>o,Zp:()=>n,aR:()=>i,wL:()=>c});var a=s(4624);s(99356);var r=s(13506);function n(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card",className:(0,r.cn)("flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm",t),...s})}function i(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-header",className:(0,r.cn)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...s})}function o(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-title",className:(0,r.cn)("leading-none font-semibold",t),...s})}function l(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-description",className:(0,r.cn)("text-sm text-muted-foreground",t),...s})}function d(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-content",className:(0,r.cn)("px-6",t),...s})}function c(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-footer",className:(0,r.cn)("flex items-center px-6 [.border-t]:pt-6",t),...s})}},6896:(e,t,s)=>{"use strict";s.d(t,{g:()=>r});var a=s(7911);let r=(0,a.createServerReference)("40b6e50457c5f3d8ea6f4eeb59bc6a36c9f2a94c38",a.callServer,void 0,a.findSourceMapURL,"installCuratedAction")},7530:(e,t,s)=>{Promise.resolve().then(s.bind(s,14594)),Promise.resolve().then(s.bind(s,97127)),Promise.resolve().then(s.bind(s,18016)),Promise.resolve().then(s.bind(s,8466)),Promise.resolve().then(s.bind(s,8190)),Promise.resolve().then(s.bind(s,54095)),Promise.resolve().then(s.bind(s,86667)),Promise.resolve().then(s.bind(s,91074)),Promise.resolve().then(s.bind(s,96253)),Promise.resolve().then(s.bind(s,28050)),Promise.resolve().then(s.bind(s,94904)),Promise.resolve().then(s.bind(s,13270)),Promise.resolve().then(s.bind(s,99730)),Promise.resolve().then(s.bind(s,89146)),Promise.resolve().then(s.bind(s,19078)),Promise.resolve().then(s.bind(s,67854)),Promise.resolve().then(s.bind(s,69050)),Promise.resolve().then(s.bind(s,63739)),Promise.resolve().then(s.bind(s,33976)),Promise.resolve().then(s.bind(s,12537)),Promise.resolve().then(s.bind(s,97485)),Promise.resolve().then(s.bind(s,41923)),Promise.resolve().then(s.bind(s,73868)),Promise.resolve().then(s.bind(s,53511)),Promise.resolve().then(s.bind(s,2018)),Promise.resolve().then(s.bind(s,18487)),Promise.resolve().then(s.bind(s,98346)),Promise.resolve().then(s.bind(s,14884)),Promise.resolve().then(s.bind(s,85314)),Promise.resolve().then(s.bind(s,17280)),Promise.resolve().then(s.bind(s,8855)),Promise.resolve().then(s.bind(s,86631)),Promise.resolve().then(s.bind(s,2604)),Promise.resolve().then(s.bind(s,27237)),Promise.resolve().then(s.bind(s,49455)),Promise.resolve().then(s.bind(s,39211)),Promise.resolve().then(s.bind(s,56360)),Promise.resolve().then(s.t.bind(s,54400,23))},8466:(e,t,s)=>{"use strict";s.d(t,{AddUtilityButton:()=>A});var a=s(4624),r=s(99356),n=s(54400),i=s.n(n),o=s(69285),l=s(49411),d=s(39624),c=s(36059),m=s(13561),u=s(3239),x=s(39783),h=s(46972),p=s(43153),g=s(57751),f=s(56221),v=s(85253),b=s(70465),j=s(7911);let w=(0,j.createServerReference)("403ae4f4987be8c16b4b4e575a8eeb73e787832c76",j.callServer,void 0,j.findSourceMapURL,"checkUtilityUpdatesAction"),N=(0,j.createServerReference)("403d5ad7aef782546ecac36aed02c5ba008e1c85f5",j.callServer,void 0,j.findSourceMapURL,"applyUtilityUpdateAction");var y=s(6896),k=s(69615),S=s(63514);function A(e){let{rootId:t,installed:s}=e,n=(0,l.c)("roots"),[j,A]=(0,r.useState)(!1),[C,R]=(0,r.useState)([]),[U,T]=(0,r.useState)(!1),[M,D]=(0,r.useState)(null),[I,P]=(0,r.useTransition)(),[E,L]=(0,r.useState)([]),z=(0,r.useRef)(null),W=(0,o.useRouter)(),F=new Set(s.map(e=>e.id)),Z=s.filter(e=>"project"===e.scope),$=new Map(E.map(e=>[e.id,e]));return(0,r.useEffect)(()=>{if(!j)return;let e=e=>{var t;(null==(t=z.current)?void 0:t.contains(e.target))||A(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[j]),(0,r.useEffect)(()=>{!j||C.length>0||U||(T(!0),(async()=>{try{let e=await (0,b.B)();R(e.items)}catch(e){f.oR.error(n("addUtility.loadCatalogFailed"))}finally{T(!1)}})())},[j,C.length,U]),(0,r.useEffect)(()=>{j&&0!==s.length&&(async()=>{let e=await w({rootId:t});e.ok&&L(e.updates)})()},[j,s.length,t]),(0,a.jsxs)("div",{className:"relative",ref:z,children:[(0,a.jsxs)(v.$,{type:"button",variant:"ghost",size:"sm",className:"gap-1",onClick:()=>A(e=>!e),title:n("addUtility.buttonTitle"),children:[(0,a.jsx)(d.A,{className:"h-4 w-4"}),n("addUtility.buttonLabel"),Z.length>0&&(0,a.jsx)("span",{className:"ml-1 text-[10px] rounded-full bg-violet-100 text-violet-700 px-1.5",children:Z.length}),E.length>0&&(0,a.jsxs)("span",{className:"ml-0.5 text-[10px] rounded-full bg-amber-100 text-amber-800 px-1.5 inline-flex items-center gap-0.5",title:n("addUtility.updatesTitle",{count:E.length}),children:[(0,a.jsx)(c.A,{className:"h-2.5 w-2.5"}),E.length]})]}),j&&(0,a.jsxs)("div",{className:"absolute right-0 top-full mt-1 z-30 w-[440px] max-h-[75vh] overflow-y-auto rounded-lg border bg-popover shadow-lg",children:[(0,a.jsxs)("div",{className:"sticky top-0 bg-popover flex items-center gap-2 px-3 py-2 border-b",children:[(0,a.jsx)(d.A,{className:"h-3.5 w-3.5 text-violet-600"}),(0,a.jsx)("span",{className:"text-xs font-medium",children:n("addUtility.popoverTitle")}),(0,a.jsx)("button",{type:"button",onClick:()=>A(!1),className:"ml-auto p-0.5 rounded hover:bg-accent",children:(0,a.jsx)(m.A,{className:"h-3 w-3"})})]}),Z.length>0&&(0,a.jsxs)("section",{className:"p-2 border-b",children:[(0,a.jsx)("div",{className:"px-1 text-[10px] uppercase tracking-wider text-muted-foreground mb-1.5",children:n("addUtility.installedInProject")}),(0,a.jsx)("ul",{className:"space-y-1",children:Z.map(e=>{let s=$.get(e.id);return(0,a.jsxs)("li",{className:"flex items-center gap-1.5 rounded-md border bg-card px-2 py-1.5 text-xs",children:[(0,a.jsxs)("span",{className:"flex-1 min-w-0",children:[(0,a.jsx)("div",{className:"truncate font-medium",children:e.name}),s&&(0,a.jsxs)("div",{className:"text-[10px] text-amber-700 inline-flex items-center gap-0.5",children:[(0,a.jsx)(c.A,{className:"h-2.5 w-2.5"}),s.currentVersion," → ",s.latestVersion]})]}),s&&(0,a.jsxs)("button",{type:"button",onClick:()=>{D(s.id),P(async()=>{let e=await N({...s,rootId:t});if(D(null),!e.ok)return void f.oR.error(e.error);f.oR.success(n("addUtility.applyUpdateSuccess",{name:s.name,from:s.currentVersion,to:e.newVersion})),L(e=>e.filter(e=>e.id!==s.id)),(0,S.$d)(S.Zi.kbChanged(t)),W.refresh()})},disabled:I&&M===e.id,className:"text-[11px] rounded bg-amber-600 px-2 py-1 text-white hover:bg-amber-700 disabled:opacity-50 inline-flex items-center gap-0.5",title:n("addUtility.applyUpdateTitle"),children:[I&&M===e.id?(0,a.jsx)(u.A,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(c.A,{className:"h-3 w-3"}),n("addUtility.updateAction")]}),(0,a.jsx)(i(),{href:"/utilities/".concat(e.scope,"/").concat(e.id,"?rootId=").concat(encodeURIComponent(t)),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground",title:n("addUtility.openAction"),children:(0,a.jsx)(x.A,{className:"h-3 w-3"})}),(0,a.jsx)("button",{type:"button",onClick:()=>{confirm(n("addUtility.removeConfirm",{name:e.name}))&&(D(e.id),P(async()=>{let s=await (0,k.j)(e.scope,e.id,"project"===e.scope?t:void 0);if(D(null),!s.ok){var a;f.oR.error(null!=(a=s.error)?a:n("addUtility.removeFailed"));return}f.oR.success(n("addUtility.removeSuccess",{name:e.name})),(0,S.$d)(S.Zi.kbChanged(t)),W.refresh()}))},disabled:I&&M===e.id,className:"p-1 rounded hover:bg-destructive/15 text-muted-foreground hover:text-destructive disabled:opacity-50",title:n("addUtility.removeAction"),children:I&&M===e.id?(0,a.jsx)(u.A,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(h.A,{className:"h-3 w-3"})})]},e.id)})})]}),(0,a.jsxs)("section",{className:"p-2",children:[(0,a.jsx)("div",{className:"px-1 text-[10px] uppercase tracking-wider text-muted-foreground mb-1.5",children:n("addUtility.catalog")}),U?(0,a.jsxs)("div",{className:"px-2 py-4 text-xs text-muted-foreground flex items-center gap-1.5",children:[(0,a.jsx)(u.A,{className:"h-3 w-3 animate-spin"}),n("addUtility.loading")]}):0===C.length?(0,a.jsx)("p",{className:"px-2 py-4 text-xs text-muted-foreground",children:n("addUtility.catalogEmpty")}):(0,a.jsx)("ul",{className:"space-y-1",children:C.map(e=>{let s=F.has(e.id),r=M===e.id&&I;return(0,a.jsx)("li",{className:"rounded-md border bg-card px-2 py-2",children:(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)("span",{className:"text-xl leading-none",children:e.emoji}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("div",{className:"font-medium text-sm",children:e.name}),(0,a.jsx)("p",{className:"text-[11px] text-muted-foreground leading-snug",children:e.description})]}),s?(0,a.jsxs)("span",{className:"text-[10px] text-emerald-700 inline-flex items-center gap-0.5",children:[(0,a.jsx)(p.A,{className:"h-3 w-3"})," ",n("addUtility.already")]}):(0,a.jsxs)("button",{type:"button",onClick:()=>{D(e.id),P(async()=>{var s;let a=null!=(s=e.suggestedScope)?s:"global",r=await (0,y.g)({github:e.github,scope:a,..."project"===a?{rootId:t}:{}});if(D(null),!r.ok)return void f.oR.error(r.error);f.oR.success(n("addUtility.installSuccess",{name:e.name})),(0,S.$d)(S.Zi.kbChanged(t)),W.refresh()})},disabled:r||I,className:"text-[11px] rounded bg-violet-600 px-2 py-1 text-white hover:bg-violet-700 disabled:opacity-50 inline-flex items-center gap-0.5",children:[r?(0,a.jsx)(u.A,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(g.A,{className:"h-3 w-3"}),n("addUtility.add")]})]})},e.id)})})]})]})]})}},54095:(e,t,s)=>{"use strict";s.d(t,{Dashboard:()=>eC});var a=s(4624),r=s(99356),n=s(49411),i=s(3747),o=s(56221),l=s(85253),d=s(63514),c=s(54400),m=s.n(c),u=s(41234),x=s(3239),h=s(86790),p=s(28310),g=s(4959);function f(e){let{rootId:t,activeGoals:s,runningAgents:r}=e,i=(0,n.c)("roots"),o=s.length+r.length;return(0,a.jsxs)(g.Zp,{children:[(0,a.jsxs)(g.aR,{className:"pb-2 flex flex-row items-center justify-between space-y-0",children:[(0,a.jsxs)(g.ZB,{className:"text-sm flex items-center gap-2",children:[(0,a.jsx)(u.A,{className:"h-4 w-4 text-violet-600"}),i("activeGoals.title")]}),o>0&&(0,a.jsx)(p.E,{variant:"secondary",className:"text-[10px]",children:o})]}),(0,a.jsxs)(g.Wu,{className:"space-y-2",children:[0===o&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:i("activeGoals.empty")}),s.map(e=>(0,a.jsx)(m(),{href:"/roots/".concat(t,"/chat/").concat(e.topicId),className:"block rounded-md border bg-card hover:bg-accent/40 transition px-3 py-2",children:(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)(u.A,{className:"h-3.5 w-3.5 text-violet-600 mt-0.5 shrink-0"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium truncate flex-1 min-w-0",children:e.topicTitle}),e.running&&(0,a.jsx)(x.A,{className:"h-3 w-3 animate-spin text-violet-600 shrink-0"})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:e.goal}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-1 text-[10px] text-muted-foreground",children:[(0,a.jsx)("span",{children:i("activeGoals.iterationLabel",{count:e.goalIterations})}),(0,a.jsx)("span",{children:"\xb7"}),(0,a.jsx)("span",{children:i("activeGoals.updatedLabel",{time:function(e,t){let s=Date.now()-Date.parse(e);if(!Number.isFinite(s)||s<0)return t("activeGoals.justNow");let a=Math.floor(s/6e4);if(a<1)return t("activeGoals.justNow");if(a<60)return t("activeGoals.minutesAgo",{count:a});let r=Math.floor(a/60);return r<24?t("activeGoals.hoursAgo",{count:r}):t("activeGoals.daysAgo",{count:Math.floor(r/24)})}(e.updatedAt,i)})})]})]})]})},e.topicId)),r.map(e=>(0,a.jsx)(m(),{href:"/roots/".concat(t,"/chat/").concat(e.topicId),className:"block rounded-md border bg-card hover:bg-accent/40 transition px-3 py-2",children:(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)(h.A,{className:"h-3.5 w-3.5 text-amber-600 mt-0.5 shrink-0"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium truncate flex-1 min-w-0",children:e.topicTitle}),(0,a.jsx)(x.A,{className:"h-3 w-3 animate-spin text-amber-600 shrink-0"}),(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground",children:i("activeGoals.agentRunning")})]})]})},e.topicId))]})]})}var v=s(85924),b=s(3024),j=s(59145),w=s(31108);function N(e){let{rootId:t,items:s}=e,r=(0,n.c)("roots");return(0,a.jsxs)(g.Zp,{children:[(0,a.jsxs)(g.aR,{className:"pb-2 flex flex-row items-center justify-between space-y-0",children:[(0,a.jsxs)(g.ZB,{className:"text-sm flex items-center gap-2",children:[(0,a.jsx)(v.A,{className:"h-4 w-4 text-amber-600"}),r("pendingApprovals.title")]}),s.length>0&&(0,a.jsx)(p.E,{variant:"secondary",className:"text-[10px]",children:s.length})]}),(0,a.jsxs)(g.Wu,{className:"space-y-2",children:[0===s.length&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:r("pendingApprovals.empty")}),s.map(e=>{var s;return(0,a.jsx)(m(),{href:"/roots/".concat(t,"/chat/").concat(e.topicId),className:"block rounded-md border bg-card hover:bg-accent/40 transition px-3 py-2",children:(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)(y,{kind:e.kind}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium truncate flex-1 min-w-0",children:e.summary}),(0,a.jsx)(p.E,{variant:"outline",className:"text-[10px] shrink-0",children:"permission"===(s=e.kind)?"permission":"question"===s?"question":"mcp-add"})]}),e.details&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:e.details}),(0,a.jsxs)("div",{className:"text-[10px] text-muted-foreground mt-1",children:["topic ",e.topicId.slice(0,12)," \xb7 ",function(e,t){let s=Date.now()-Date.parse(e);if(!Number.isFinite(s)||s<0)return t("pendingApprovals.justNow");let a=Math.floor(s/6e4);if(a<1)return t("pendingApprovals.justNow");if(a<60)return t("pendingApprovals.minutesAgo",{count:a});let r=Math.floor(a/60);return r<24?t("pendingApprovals.hoursAgo",{count:r}):t("pendingApprovals.daysAgo",{count:Math.floor(r/24)})}(e.ts,r)]})]})]})},"".concat(e.kind,":").concat(e.requestId))})]})]})}function y(e){let{kind:t}=e,s="h-3.5 w-3.5 mt-0.5 shrink-0";return"permission"===t?(0,a.jsx)(b.A,{className:"".concat(s," text-rose-600")}):"question"===t?(0,a.jsx)(j.A,{className:"".concat(s," text-sky-600")}):(0,a.jsx)(w.A,{className:"".concat(s," text-emerald-600")})}var k=s(49623),S=s(7911);let A=(0,S.createServerReference)("6033c0b0237a8a85a7ace18ca9a330749623cd3e73",S.callServer,void 0,S.findSourceMapURL,"readKbPreviewAction");function C(e){let{rootId:t,items:s}=e,i=(0,n.c)("roots"),[o,l]=(0,r.useState)({});return(0,r.useEffect)(()=>{let e=!1;return(async()=>{for(let a of s){if(o[a.rel])continue;let s=await A(t,a.rel);if(e)return;s.ok&&l(e=>({...e,[a.rel]:s.preview}))}})(),()=>{e=!0}},[t,s]),(0,a.jsxs)(g.Zp,{children:[(0,a.jsxs)(g.aR,{className:"pb-2 flex flex-row items-center justify-between space-y-0",children:[(0,a.jsxs)(g.ZB,{className:"text-sm flex items-center gap-2",children:[(0,a.jsx)(k.A,{className:"h-4 w-4 text-emerald-700"}),i("recentKb.title")]}),s.length>0&&(0,a.jsx)(p.E,{variant:"secondary",className:"text-[10px]",children:s.length})]}),(0,a.jsxs)(g.Wu,{className:"space-y-2",children:[0===s.length&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:i("recentKb.empty")}),s.map(e=>{var s;return(0,a.jsx)(m(),{href:"/roots/".concat(t,"/kb/").concat(e.rel.split("/").map(encodeURIComponent).join("/")),className:"block rounded-md border bg-card hover:bg-accent/40 transition px-3 py-2",children:(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)(k.A,{className:"h-3.5 w-3.5 mt-0.5 shrink-0 text-emerald-700"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm font-medium truncate flex-1 min-w-0",children:e.title}),e.kind&&(0,a.jsx)(p.E,{variant:"outline",className:"text-[10px] shrink-0",children:e.kind})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:null!=(s=o[e.rel])?s:e.rel}),(0,a.jsxs)("div",{className:"text-[10px] text-muted-foreground mt-1",children:[function(e,t){let s=Date.now()-Date.parse(e);if(!Number.isFinite(s)||s<0)return t("recentKb.justNow");let a=Math.floor(s/6e4);if(a<1)return t("recentKb.justNow");if(a<60)return t("recentKb.minutesAgo",{count:a});let r=Math.floor(a/60);return r<24?t("recentKb.hoursAgo",{count:r}):t("recentKb.daysAgo",{count:Math.floor(r/24)})}(e.modifiedAt,i)," \xb7 ",(0,a.jsx)("span",{className:"font-mono",children:e.rel})]})]})]})},e.rel)})]})]})}var R=s(69285),U=s(95046),T=s(8096),M=s(54207),D=s(95265),I=s(39607);function P(e){let{rootId:t,cache:s}=e,d=(0,n.c)("roots"),[c,m]=(0,r.useState)(s),[u,h]=(0,r.useTransition)(),f=(0,R.useRouter)(),v=c&&Date.now()-Date.parse(c.generatedAt)>864e5;return(0,a.jsxs)(g.Zp,{className:"lg:col-span-2",children:[(0,a.jsxs)(g.aR,{className:"pb-2 flex flex-row items-center justify-between space-y-0",children:[(0,a.jsxs)(g.ZB,{className:"text-sm flex items-center gap-2",children:[(0,a.jsx)(U.A,{className:"h-4 w-4 text-amber-500"}),d("aiSuggestions.title"),v&&(0,a.jsx)(p.E,{variant:"outline",className:"text-[10px]",children:d("aiSuggestions.stale")})]}),(0,a.jsxs)(l.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>{h(async()=>{try{let s=await fetch("/api/roots/".concat(t,"/suggestions"),{method:"POST",cache:"no-store"}),a=await s.json();if(!a.ok){var e;o.oR.error(null!=(e=a.error)?e:d("aiSuggestions.regenerateFailed"));return}a.cache&&m(a.cache)}catch(e){o.oR.error(e instanceof Error?e.message:String(e))}})},disabled:u,className:"gap-1 h-7 text-xs",children:[u?(0,a.jsx)(x.A,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(i.A,{className:"h-3 w-3"}),d("aiSuggestions.recompute")]})]}),(0,a.jsxs)(g.Wu,{className:"space-y-2",children:[!c&&!u&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:d("aiSuggestions.intro")}),c&&0===c.items.length&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:d("aiSuggestions.nothingUrgent")}),(0,a.jsx)("div",{className:"grid gap-2 md:grid-cols-2",children:null==c?void 0:c.items.map((e,s)=>(0,a.jsxs)("div",{className:"rounded-md border bg-card p-3 space-y-1.5",children:[(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)(T.A,{className:"h-3.5 w-3.5 text-amber-500 mt-0.5 shrink-0"}),(0,a.jsx)("p",{className:"text-sm font-medium leading-snug flex-1",children:e.title})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground leading-relaxed",children:e.why}),(0,a.jsx)(E,{rootId:t,item:e,router:f})]},s))}),c&&(0,a.jsx)("p",{className:"text-[10px] text-muted-foreground pt-1",children:d.rich("aiSuggestions.generatedAt",{time:function(e,t){let s=Date.now()-Date.parse(e);if(!Number.isFinite(s)||s<0)return t("aiSuggestions.justNow");let a=Math.floor(s/6e4);if(a<1)return t("aiSuggestions.justNow");if(a<60)return t("aiSuggestions.minutesAgo",{count:a});let r=Math.floor(a/60);return r<24?t("aiSuggestions.hoursAgo",{count:r}):t("aiSuggestions.daysAgo",{count:Math.floor(r/24)})}(c.generatedAt,d),model:c.model,code:e=>(0,a.jsx)("code",{className:"font-mono",children:e})})})]})]})}function E(e){let{rootId:t,item:s,router:i}=e,[c,u]=(0,r.useTransition)(),h=(0,n.c)("roots"),{action:p}=s;if("none"===p.kind)return null;if("open-topic"===p.kind&&p.target)return(0,a.jsx)(l.$,{asChild:!0,size:"sm",variant:"outline",className:"h-7 text-xs gap-1",children:(0,a.jsxs)(m(),{href:"/roots/".concat(t,"/chat/").concat(p.target),children:[(0,a.jsx)(M.A,{className:"h-3 w-3"}),p.label]})});if("open-kb"===p.kind&&p.target){let e=p.target.split("/").map(encodeURIComponent).join("/");return(0,a.jsx)(l.$,{asChild:!0,size:"sm",variant:"outline",className:"h-7 text-xs gap-1",children:(0,a.jsxs)(m(),{href:"/roots/".concat(t,"/kb/").concat(e),children:[(0,a.jsx)(M.A,{className:"h-3 w-3"}),p.label]})})}return"send-message"===p.kind&&p.target?(0,a.jsxs)(l.$,{type:"button",size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:()=>{u(async()=>{try{let s=await (0,I.g)(t,p.target,[],void 0);if(!s.ok){var e;o.oR.error(null!=(e=s.error)?e:h("aiSuggestions.sendFailed"));return}(0,d.$d)(d.Zi.topicsChanged(t)),i.push("/roots/".concat(t,"/chat/").concat(s.topicId))}catch(e){o.oR.error(e instanceof Error?e.message:String(e))}})},disabled:c,children:[c?(0,a.jsx)(x.A,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(D.A,{className:"h-3 w-3"}),p.label]}):null}var L=s(39624),z=s(71789),W=s(53732),F=s(43153),Z=s(13561);let $=(0,S.createServerReference)("40fb748b22f40f8e776c035fc348de72c3bd2c0494",S.callServer,void 0,S.findSourceMapURL,"listSuggestionsAction"),B=(0,S.createServerReference)("40b4f4b13569a61f03764e54af4aa99094938c70c1",S.callServer,void 0,S.findSourceMapURL,"approveSuggestionAction"),O=(0,S.createServerReference)("401fae50a98bedb890e441c39ed81eefb2475df3ac",S.callServer,void 0,S.findSourceMapURL,"rejectSuggestionAction");var K=s(13506);let G={utility:L.A,research:z.A,widget:W.A,goal:u.A,skill:T.A},H={utility:"text-emerald-600",research:"text-violet-600",widget:"text-blue-600",goal:"text-amber-600",skill:"text-pink-600"};function V(e){let{rootId:t}=e,s=(0,R.useRouter)(),[n,d]=(0,r.useState)([]),[c,m]=(0,r.useState)(!0),[u,h]=(0,r.useState)({}),[f,v]=(0,r.useTransition)(),b=(0,r.useCallback)(async()=>{let e=await $(t);m(!1),e.ok&&d(e.items)},[t]);return((0,r.useEffect)(()=>{b()},[b]),(0,r.useEffect)(()=>{let e=window.setInterval(()=>{"visible"===document.visibilityState&&b()},3e4);return()=>window.clearInterval(e)},[b]),c||0===n.length)?null:(0,a.jsxs)(g.Zp,{children:[(0,a.jsxs)(g.aR,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)(g.ZB,{className:"text-lg flex items-center gap-2",children:[(0,a.jsx)(U.A,{className:"h-4 w-4 text-amber-500"}),"Suggestions",(0,a.jsx)(p.E,{variant:"secondary",className:"ml-1",children:n.length})]}),(0,a.jsxs)(l.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>v(()=>b()),disabled:f,className:"h-7 gap-1",children:[(0,a.jsx)(i.A,{className:(0,K.cn)("h-3 w-3",f&&"animate-spin")}),"Refresh"]})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Hypotheses the agent put together from the onboarding chat. Approve to start a topic; dismiss to drop it (and remember you said no)."})]}),(0,a.jsx)(g.Wu,{className:"space-y-2",children:n.map(e=>{var r;let n=null!=(r=G[e.kind])?r:U.A,i=u[e.id];return(0,a.jsxs)("div",{className:"flex items-start gap-3 rounded-md border p-3",children:[(0,a.jsx)(n,{className:(0,K.cn)("h-4 w-4 mt-1 shrink-0",H[e.kind])}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-baseline gap-2 flex-wrap",children:[(0,a.jsx)("span",{className:"font-medium text-sm",children:e.title}),(0,a.jsx)(p.E,{variant:"outline",className:"text-[10px]",children:e.kind})]}),e.description&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-1 leading-snug",children:e.description}),e.prompt&&(0,a.jsx)("code",{className:"block mt-1 text-[10px] font-mono text-muted-foreground/70 truncate",children:e.prompt})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,a.jsxs)(l.$,{type:"button",size:"sm",variant:"default",disabled:!!i,onClick:()=>{h(t=>({...t,[e.id]:"approve"})),(async()=>{let a=await B({rootId:t,suggestionId:e.id});if(h(t=>({...t,[e.id]:null})),!a.ok){var r;o.oR.error(null!=(r=a.error)?r:"Failed to start topic");return}o.oR.success("Started: ".concat(e.title)),d(t=>t.filter(t=>t.id!==e.id)),s.push("/roots/".concat(t,"/chat/").concat(a.topicId))})()},className:"h-8 gap-1",children:["approve"===i?(0,a.jsx)(x.A,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(F.A,{className:"h-3 w-3"}),"Approve"]}),(0,a.jsxs)(l.$,{type:"button",size:"sm",variant:"ghost",disabled:!!i,onClick:()=>{h(t=>({...t,[e.id]:"reject"})),(async()=>{let s=await O({rootId:t,suggestionId:e.id});if(h(t=>({...t,[e.id]:null})),!s.ok){var a;o.oR.error(null!=(a=s.error)?a:"Failed to reject");return}o.oR.success("Dismissed: ".concat(e.title)),d(t=>t.filter(t=>t.id!==e.id))})()},className:"h-8 gap-1 text-muted-foreground hover:text-destructive",children:["reject"===i?(0,a.jsx)(x.A,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(Z.A,{className:"h-3 w-3"}),"Dismiss"]})]})]},e.id)})})]})}var _=s(70285),q=s(93305),J=s(41379);let Y=(0,S.createServerReference)("6087310c6eee8a70b68f8436f36504b730a4f1d29b",S.callServer,void 0,S.findSourceMapURL,"saveWidgetOrderAction"),Q=(0,S.createServerReference)("60c5a8fa4da8b1426502d923b91b70a59b01efbbfe",S.callServer,void 0,S.findSourceMapURL,"hideWidgetAction"),X={sm:2,md:3,wide:6},ee=["sys:active-goals","sys:pending","sys:recent-kb","sys:ai-suggestions"],et=[{id:"sys:active-goals",title:"Active goals & running agents",description:"Topics with an active /goal and a running orchestrator."},{id:"sys:pending",title:"Awaiting response",description:"Unanswered permission / question / mcp-add cards."},{id:"sys:recent-kb",title:"Recent in KB",description:"KB files modified in the last 72 hours."},{id:"sys:ai-suggestions",title:"What's next — Reflex suggestions",description:"Gemini-driven analysis of project state with actions."}],es=(0,S.createServerReference)("70da8ab5b229de10305893d32fd3352b6f148d9a3b",S.callServer,void 0,S.findSourceMapURL,"setWidgetSizeAction"),ea=[{mode:"sm",label:"S",titleKey:"widgetsCommon.sizeSm"},{mode:"md",label:"M",titleKey:"widgetsCommon.sizeMd"},{mode:"wide",label:"W",titleKey:"widgetsCommon.sizeWide"}];function er(e){let{rootId:t,widgetId:s,mode:i,onChanged:l}=e,d=(0,n.c)("roots"),[c,m]=(0,r.useTransition)();return(0,a.jsx)("div",{role:"radiogroup","aria-label":d("widgetsCommon.sizeAria"),className:"inline-flex items-center rounded border bg-background/80 backdrop-blur overflow-hidden text-[10px] leading-none",children:ea.map(e=>{let r=e.mode===i,n="sm"===e.mode?d("widgetsCommon.sizeSm"):"md"===e.mode?d("widgetsCommon.sizeMd"):d("widgetsCommon.sizeWide");return(0,a.jsx)("button",{type:"button",role:"radio","aria-checked":r,"aria-label":n,title:n,onClick:()=>{var a;(a=e.mode)!==i&&m(async()=>{let e=await es(t,s,a);if(!e.ok){var r;o.oR.error(null!=(r=e.error)?r:d("widgetsCommon.sizeFailed"));return}l()})},disabled:c,className:["px-1.5 py-0.5 font-mono transition-colors disabled:opacity-50",r?"bg-violet-600 text-white":"text-muted-foreground hover:bg-accent hover:text-foreground"].join(" "),children:e.label},e.mode)})})}function en(e){let t=X[e];return 2===t?"lg:col-span-2":3===t?"lg:col-span-3":"lg:col-span-6"}var ei=s(73600),eo=s(76974),el=s(72691),ed=s(22841),ec=s(75691);let em=(0,S.createServerReference)("78b64e996de1f8eb3a61df75c11ae161c41b354182",S.callServer,void 0,S.findSourceMapURL,"patchWidgetDataAction"),eu=(0,S.createServerReference)("70d2e483db011170d5982fd10b640850cf523769cf",S.callServer,void 0,S.findSourceMapURL,"setWidgetRefreshAction"),ex=(0,S.createServerReference)("605763c6d6a33e4be0a89dc853093cc95825c8dfb5",S.callServer,void 0,S.findSourceMapURL,"refreshWidgetNowAction");function eh(e){let{rootId:t,widget:s,mode:i,onHide:l,hiding:d,onLayoutChanged:c,dnd:u}=e,x=(0,n.c)("roots"),[h,f]=(0,r.useTransition)(),v=u.dragging===s.id,b=u.dropTarget===s.id&&!v,j=en(i);return(0,a.jsxs)(g.Zp,{draggable:!0,onDragStart:e=>{e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",s.id),u.onDragStart(s.id)},onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="move",u.dropTarget!==s.id&&u.onDragOver(s.id)},onDrop:e=>{e.preventDefault(),u.onDrop(s.id)},onDragEnd:()=>u.onDragEnd(),className:[j,"transition-all",v?"opacity-50":"",b?"ring-2 ring-violet-400 ring-offset-2 ring-offset-background":""].join(" "),children:[(0,a.jsxs)(g.aR,{className:"pb-2 flex flex-row items-start gap-2 space-y-0",children:[(0,a.jsx)(ei.A,{className:"h-3.5 w-3.5 text-muted-foreground/60 cursor-grab active:cursor-grabbing mt-1 shrink-0","aria-label":x("widgetsCommon.dragHandle")}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)(g.ZB,{className:"text-sm flex items-center gap-2 flex-wrap",children:[(0,a.jsx)("span",{className:"truncate",children:s.title}),(0,a.jsx)(p.E,{variant:"outline",className:"text-[10px] font-mono shrink-0",children:s.kind})]}),s.description&&(0,a.jsx)("p",{className:"text-[11px] text-muted-foreground mt-0.5 line-clamp-2",children:s.description})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 -mt-0.5 shrink-0",children:[(0,a.jsx)(er,{rootId:t,widgetId:s.id,mode:i,onChanged:c}),s.sourceTopicId&&(0,a.jsx)(m(),{href:"/roots/".concat(t,"/chat/").concat(s.sourceTopicId),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground","aria-label":x("widgetsCommon.editViaTopicAria"),title:x("widgetsCommon.editViaTopicTitle"),children:(0,a.jsx)(eo.A,{className:"h-3.5 w-3.5"})}),(0,a.jsx)("button",{type:"button",onClick:()=>f(async()=>{await Promise.resolve(),l(s.id)}),disabled:h||d,"aria-label":x("widgetsCommon.hideAria"),title:x("widgetsCommon.hideTitle"),className:"p-1 rounded hover:bg-destructive/15 text-muted-foreground hover:text-destructive",children:(0,a.jsx)(Z.A,{className:"h-3.5 w-3.5"})})]})]}),(0,a.jsxs)(g.Wu,{className:"space-y-3",children:[(0,ec.v)(t,s.kind,s.data,{onPatch:async e=>{let a=await em(t,s.id,e);if(!a.ok){var r,n;throw o.oR.error(null!=(r=a.error)?r:x("widgetsCommon.savePatchFailed")),Error(null!=(n=a.error)?n:x("widgetsCommon.patchFailed"))}}}),(0,a.jsx)(ep,{rootId:t,widget:s})]})]})}function ep(e){var t,s;let{rootId:l,widget:d}=e,c=(0,n.c)("roots"),[m,u]=(0,r.useTransition)(),[x,h]=(0,r.useTransition)(),p=null!=(t=d.refresh)?t:"manual",g=null!=(s=d.lastRefreshAt)?s:d.updatedAt;return d.sourceTopicId?(0,a.jsxs)("div",{className:"flex items-center gap-2 pt-2 border-t text-[11px] text-muted-foreground",children:[(0,a.jsx)(el.A,{className:"h-3 w-3 shrink-0"}),(0,a.jsx)("span",{className:"shrink-0",children:c("widgetsCommon.updatedAt",{time:function(e,t){let s=Date.now()-Date.parse(e);if(!Number.isFinite(s)||s<0)return t("widgetsCommon.justNow");let a=Math.floor(s/6e4);if(a<1)return t("widgetsCommon.justNow");if(a<60)return t("widgetsCommon.minutesAgo",{count:a});let r=Math.floor(a/60);return r<24?t("widgetsCommon.hoursAgo",{count:r}):t("widgetsCommon.daysAgo",{count:Math.floor(r/24)})}(g,c)})}),(0,a.jsxs)("div",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[(0,a.jsxs)(ed.l6,{value:p,onValueChange:e=>{h(async()=>{var t,s;let a=await eu(l,d.id,e);a.ok?o.oR.success("manual"===e?c("widgetsCommon.autoRefreshOff"):c("widgetsCommon.cadenceSet",{cadence:(s=e,c("hourly"===s?"widgetsCommon.cadenceHourly":"daily"===s?"widgetsCommon.cadenceDaily":"weekly"===s?"widgetsCommon.cadenceWeekly":"widgetsCommon.cadenceManual"))})):o.oR.error(null!=(t=a.error)?t:c("widgetsCommon.cadenceFailed"))})},disabled:x,children:[(0,a.jsx)(ed.bq,{className:"h-6 text-[10px] gap-1 px-1.5 w-auto min-w-[110px]",children:(0,a.jsx)(ed.yv,{})}),(0,a.jsxs)(ed.gC,{children:[(0,a.jsx)(ed.eb,{value:"manual",children:c("widgetsCommon.manual")}),(0,a.jsx)(ed.eb,{value:"hourly",children:c("widgetsCommon.hourly")}),(0,a.jsx)(ed.eb,{value:"daily",children:c("widgetsCommon.daily")}),(0,a.jsx)(ed.eb,{value:"weekly",children:c("widgetsCommon.weekly")})]})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>{u(async()=>{var e;let t=await ex(l,d.id);t.ok?o.oR.success(c("widgetsCommon.refreshStarted")):o.oR.error(null!=(e=t.error)?e:c("widgetsCommon.refreshFailed"))})},disabled:m,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 hover:bg-accent text-foreground/80 hover:text-foreground",title:c("widgetsCommon.refreshNowTitle"),children:[(0,a.jsx)(i.A,{className:"h-3 w-3 ".concat(m?"animate-spin":"")}),c("widgetsCommon.refreshLabel")]})]})]}):null}var eg=s(84784),ef=s(41280),ev=s(46972),eb=s(80192),ej=s(87400);let ew=(0,S.createServerReference)("6024e756a0e01430cdd295e4d136547d77079edb96",S.callServer,void 0,S.findSourceMapURL,"deleteWidgetAction");function eN(e){let{rootId:t,open:s,onOpenChange:i,widgets:o,layout:d,onChanged:c}=e,m=(0,n.c)("roots");if((0,r.useEffect)(()=>{if(!s)return;let e=e=>{"Escape"===e.key&&i(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[s,i]),!s)return null;let u=new Set(d.hidden);return(0,a.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",onClick:e=>{e.target===e.currentTarget&&i(!1)},children:[(0,a.jsx)("div",{"aria-hidden":!0,className:"absolute inset-0 bg-background/80 backdrop-blur-sm",onClick:()=>i(!1)}),(0,a.jsxs)("div",{className:"relative bg-card border rounded-lg shadow-xl w-full max-w-2xl max-h-[80vh] flex flex-col",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3 border-b",children:[(0,a.jsx)(q.A,{className:"h-4 w-4 text-violet-600"}),(0,a.jsx)("h2",{className:"text-sm font-medium flex-1",children:m("widgetsCommon.libraryTitle")}),(0,a.jsx)(l.$,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7",onClick:()=>i(!1),children:(0,a.jsx)(Z.A,{className:"h-4 w-4"})})]}),(0,a.jsx)(eb.F,{className:"flex-1 min-h-0",children:(0,a.jsxs)("div",{className:"p-4 space-y-4",children:[(0,a.jsxs)("section",{className:"space-y-2",children:[(0,a.jsx)("h3",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:m("widgetsCommon.systemWidgetsHeading")}),et.map(e=>(0,a.jsx)(ey,{rootId:t,id:e.id,title:e.title,description:e.description,badge:"system",badgeVariant:"default",hidden:u.has(e.id),canDelete:!1,onChanged:c},e.id))]}),(0,a.jsxs)("section",{className:"space-y-2",children:[(0,a.jsx)("h3",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:m("widgetsCommon.userWidgetsHeading",{count:o.length})}),0===o.length&&(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:m("widgetsCommon.noUserWidgets")}),o.map(e=>{var s;return(0,a.jsx)(ey,{rootId:t,id:e.id,title:e.title,description:null!=(s=e.description)?s:"kind: ".concat(e.kind),badge:e.kind,badgeVariant:"outline",hidden:u.has(e.id),canDelete:!0,onChanged:c},e.id)})]})]})})]})]})}function ey(e){let{rootId:t,id:s,title:i,description:d,badge:c,badgeVariant:m,hidden:u,canDelete:x,onChanged:h}=e,g=(0,n.c)("roots"),[f,v]=(0,r.useTransition)();return(0,a.jsxs)("div",{className:"flex items-start gap-3 rounded-md border bg-card px-3 py-2",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,a.jsx)("span",{className:"text-sm font-medium truncate",children:i}),(0,a.jsx)(p.E,{variant:m,className:"text-[10px] font-mono",children:c}),u&&(0,a.jsx)(p.E,{variant:"secondary",className:"text-[10px]",children:g("widgetsCommon.hidden")})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2",children:d})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,a.jsx)(l.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>{v(async()=>{let e=u?await (0,ej.t)(t,s):await Q(t,s);if(!e.ok)return void o.oR.error(e.error);h()})},disabled:f,className:"gap-1 h-7 text-xs",children:u?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eg.A,{className:"h-3 w-3"}),g("widgetsCommon.show")]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ef.A,{className:"h-3 w-3"}),g("widgetsCommon.hide")]})}),x&&(0,a.jsx)(l.$,{type:"button",size:"icon",variant:"ghost",onClick:()=>{confirm(g("widgetsCommon.deleteWidgetConfirm",{title:i}))&&v(async()=>{let e=await ew(t,s);if(!e.ok)return void o.oR.error(e.error);h()})},disabled:f,className:"h-7 w-7 text-muted-foreground hover:text-destructive",title:g("widgetsCommon.deleteForever"),children:(0,a.jsx)(ev.A,{className:"h-3.5 w-3.5"})})]})]})}function ek(e){let{rootId:t,widgets:s,layout:i,systemRenderers:d,snapshot:c,onLayoutChanged:m}=e,u=(0,n.c)("roots"),x=(0,r.useMemo)(()=>{let e=new Map;for(let t of s)e.set(t.id,t);return e},[s]),[h,p]=(0,r.useState)(i.order),[g,f]=(0,r.useState)(i.hidden),[,v]=(0,r.useTransition)(),[b,j]=(0,r.useState)(null),[w,N]=(0,r.useState)(null),[y,k]=(0,r.useState)(!1);eA(i.order,p),eA(i.hidden,f);let S=(0,r.useCallback)(e=>{p(e),v(async()=>{let s=await Y(t,e);s.ok?(p(s.layout.order),f(s.layout.hidden),m()):o.oR.error(s.error)})},[t,m]),A=(0,r.useCallback)(e=>{p(h.filter(t=>t!==e)),f(t=>[...new Set([e,...t])]),v(async()=>{let s=await Q(t,e);if(!s.ok)return void o.oR.error(s.error);p(s.layout.order),f(s.layout.hidden),m()})},[t,h,m]),C={onDragStart:e=>j(e),onDragOver:e=>N(e),onDrop:e=>{if(j(null),N(null),!b||b===e)return;let t=[...h],s=t.indexOf(b),a=t.indexOf(e);s<0||a<0||(t.splice(s,1),t.splice(a,0,b),S(t))},onDragEnd:()=>{j(null),N(null)},dragging:b,dropTarget:w};return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:u("widgetsCommon.projectWidgetsTitle")}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:u("widgetsCommon.projectWidgetsHint")})]}),(0,a.jsxs)(l.$,{type:"button",size:"sm",variant:"outline",onClick:()=>k(!0),className:"gap-1 h-8",children:[(0,a.jsx)(q.A,{className:"h-3.5 w-3.5"}),u("widgetsCommon.library",{count:g.length})]})]}),0===h.length&&(0,a.jsxs)("div",{className:"rounded-md border border-dashed bg-muted/20 p-6 text-center space-y-2",children:[(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:u.rich("widgetsCommon.emptyDashboard",{example:()=>(0,a.jsx)("em",{children:u("widgetsCommon.emptyDashboardExample")})})}),(0,a.jsxs)(l.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>k(!0),className:"gap-1",children:[(0,a.jsx)(J.A,{className:"h-3 w-3"}),u("widgetsCommon.restoreSystem")]})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-6 gap-4",children:h.map(e=>{var s,r;let n=x.get(e),o=null==(s=i.sizes)?void 0:s[e],l=null!=o?o:(null==(r=null==n?void 0:n.size)?void 0:r.mode)?r.mode:(null==r?void 0:r.cols)===1?"sm":(null==r?void 0:r.cols)===2?"md":(null==r?void 0:r.cols)===3?"wide":"md";return ee.includes(e)?(0,a.jsx)(eS,{rootId:t,id:e,node:d[e],onHide:A,dnd:C,mode:l,onLayoutChanged:m},e):n?(0,a.jsx)(eh,{rootId:t,widget:n,mode:l,onHide:A,hiding:!1,dnd:C,onLayoutChanged:m},e):null})}),(0,a.jsx)(eN,{open:y,onOpenChange:k,rootId:t,widgets:s,layout:{order:h,hidden:g},onChanged:()=>{m()}})]})}function eS(e){let{rootId:t,id:s,node:r,onHide:i,dnd:o,mode:l,onLayoutChanged:d}=e,c=(0,n.c)("roots"),m=o.dragging===s,u=o.dropTarget===s&&!m,x=en(l);return(0,a.jsxs)("div",{draggable:!0,onDragStart:e=>{e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",s),o.onDragStart(s)},onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="move",o.dropTarget!==s&&o.onDragOver(s)},onDrop:e=>{e.preventDefault(),o.onDrop(s)},onDragEnd:()=>o.onDragEnd(),className:[x,"relative group/sys transition-all",m?"opacity-50":"",u?"ring-2 ring-violet-400 ring-offset-2 ring-offset-background rounded-lg":""].join(" "),children:[r,(0,a.jsxs)("div",{className:"absolute top-2 right-2 opacity-0 group-hover/sys:opacity-100 transition-opacity flex items-center gap-1 bg-background/85 backdrop-blur rounded p-0.5",children:[(0,a.jsx)(er,{rootId:t,widgetId:s,mode:l,onChanged:d}),(0,a.jsx)("button",{type:"button",onClick:()=>i(s),"aria-label":c("widgetsCommon.hideAria"),title:c("widgetsCommon.hideSystemTitle"),className:"p-1 rounded hover:bg-destructive/15 text-muted-foreground hover:text-destructive",children:"\xd7"})]})]})}function eA(e,t){(0,r.useMemo)(()=>{t(e)},[JSON.stringify(e)])}function eC(e){let{rootId:t,initialSnapshot:s}=e,c=(0,n.c)("roots"),[m,u]=(0,r.useState)(s),[x,h]=(0,r.useTransition)(),p=(0,r.useCallback)(()=>{h(async()=>{try{let s=await fetch("/api/roots/".concat(t,"/dashboard"),{cache:"no-store"}),a=await s.json();if(!a.ok||!a.snapshot){var e;o.oR.error(null!=(e=a.error)?e:c("dashboard.refreshFailed"));return}u(a.snapshot)}catch(e){o.oR.error(e instanceof Error?e.message:String(e))}})},[t,c]);(0,d.S9)(d.Zi.topicsChanged(t),p),(0,d.S9)(d.Zi.kbChanged(t),p),(0,r.useEffect)(()=>{let e=window.setInterval(()=>{"visible"===document.visibilityState&&p()},3e4);return()=>window.clearInterval(e)},[p]);let g={"sys:active-goals":(0,a.jsx)(f,{rootId:t,activeGoals:m.activeGoals,runningAgents:m.runningAgents}),"sys:pending":(0,a.jsx)(N,{rootId:t,items:m.pendingApprovals}),"sys:recent-kb":(0,a.jsx)(C,{rootId:t,items:m.recentKb}),"sys:ai-suggestions":(0,a.jsx)(P,{rootId:t,cache:m.suggestions})};return(0,a.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto",children:(0,a.jsxs)("div",{className:"p-6 space-y-5 max-w-6xl mx-auto",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:c("dashboard.projectOverview")}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:c("dashboard.projectOverviewHint")})]}),(0,a.jsxs)(l.$,{type:"button",size:"sm",variant:"ghost",onClick:p,disabled:x,className:"gap-1 h-8",children:[(0,a.jsx)(i.A,{className:"h-3.5 w-3.5 ".concat(x?"animate-spin":"")}),c("dashboard.refresh")]})]}),(0,a.jsx)(V,{rootId:t}),(0,a.jsx)(ek,{rootId:t,widgets:m.widgets,layout:m.layout,systemRenderers:g,snapshot:m,onLayoutChanged:p}),(0,a.jsx)(_.p,{scope:"project",rootId:t,title:c("dashboard.memoryTitle"),description:c("dashboard.memoryHint")})]})})}},69615:(e,t,s)=>{"use strict";s.d(t,{j:()=>r});var a=s(7911);let r=(0,a.createServerReference)("70143e4221052d144ffe7c7f1fc312c47794683afa",a.callServer,void 0,a.findSourceMapURL,"removeUtilityAction")},70285:(e,t,s)=>{"use strict";s.d(t,{p:()=>v});var a=s(4624),r=s(99356),n=s(56221),i=s(3239),o=s(85924),l=s(65714),d=s(46972),c=s(85253),m=s(4959),u=s(71651),x=s(13506),h=s(7911);let p=(0,h.createServerReference)("40c3d9a29da37c2191f87c9a9fd2b1b643482ea0b3",h.callServer,void 0,h.findSourceMapURL,"loadMemoryAction"),g=(0,h.createServerReference)("40bccd9c92dc1cb071add81109c92d99dab47b50aa",h.callServer,void 0,h.findSourceMapURL,"saveMemoryFileAction"),f=(0,h.createServerReference)("4005a98cb7953d7747ffd74efe0f9f4c7997955423",h.callServer,void 0,h.findSourceMapURL,"wipeMemoryAction");function v(e){let{scope:t,rootId:s,title:n,description:l,allowWipe:d}=e,[c,u]=(0,r.useState)([]),[x,h]=(0,r.useState)(!0),[g,f]=(0,r.useState)(null),v=(0,r.useCallback)(async()=>{h(!0);let e=await p(s?{scope:t,rootId:s}:{scope:t});if(h(!1),!e.ok)return void f(e.error);f(null),u(e.files)},[t,s]);return(0,r.useEffect)(()=>{v()},[v]),(0,a.jsxs)(m.Zp,{children:[(0,a.jsx)(m.aR,{children:(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(m.ZB,{className:"text-lg",children:n}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:l})]}),d&&c.length>0&&(0,a.jsx)(j,{scope:t,rootId:s,onWiped:v})]})}),(0,a.jsx)(m.Wu,{children:x?(0,a.jsxs)("div",{className:"text-sm text-muted-foreground flex items-center gap-2",children:[(0,a.jsx)(i.A,{className:"h-3 w-3 animate-spin"})," Loading…"]}):g?(0,a.jsxs)("p",{className:"text-sm text-destructive flex items-center gap-2",children:[(0,a.jsx)(o.A,{className:"h-3.5 w-3.5"}),g]}):(0,a.jsx)("div",{className:"space-y-4",children:c.map(e=>(0,a.jsx)(b,{snapshot:e,scope:t,rootId:s,onSaved:e=>u(t=>t.map(t=>t.file===e.file?e:t))},e.file))})})]})}function b(e){let{snapshot:t,scope:s,rootId:o,onSaved:d}=e,[m,h]=(0,r.useState)(t.content),[p,f]=(0,r.useTransition)();(0,r.useEffect)(()=>{h(t.content)},[t.content]);let v=m.trim(),b=v?v.split("\n").length:0,j=b>t.cap,w=b>.9*t.cap,N=m!==t.content;return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,a.jsx)("span",{className:"font-mono text-sm font-semibold",children:t.file}),(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:t.description})]}),(0,a.jsxs)("span",{className:(0,x.cn)("text-xs tabular-nums",j?"text-destructive font-medium":w?"text-amber-600":"text-muted-foreground"),children:[b,"/",t.cap]})]}),(0,a.jsx)(u.T,{value:m,onChange:e=>h(e.target.value),rows:Math.min(t.cap+2,Math.max(3,b+1)),placeholder:"Empty",className:"font-mono text-xs"}),(0,a.jsx)("div",{className:"flex items-center justify-end gap-2",children:(0,a.jsxs)(c.$,{type:"button",size:"sm",variant:N?"default":"ghost",disabled:!N||p||j,onClick:()=>{if(j)return void n.oR.error("".concat(t.file," exceeds ").concat(t.cap,"-line cap (").concat(b,"). Trim before saving."));f(async()=>{let e=await g({scope:s,...o?{rootId:o}:{},file:t.file,content:v});if(!e.ok){var a;n.oR.error(null!=(a=e.error)?a:"Save failed");return}n.oR.success("Saved ".concat(t.file)),d({...t,content:v,lines:e.lines})})},children:[p?(0,a.jsx)(i.A,{className:"mr-1 h-3 w-3 animate-spin"}):(0,a.jsx)(l.A,{className:"mr-1 h-3 w-3"}),"Save"]})})]})}function j(e){let{scope:t,rootId:s,onWiped:i}=e,[o,l]=(0,r.useTransition)();return(0,a.jsxs)(c.$,{type:"button",size:"sm",variant:"ghost",disabled:o,onClick:()=>{confirm("Erase ALL memory at this scope? Cannot be undone.")&&l(async()=>{let e=await f(s?{scope:t,rootId:s}:{scope:t});if(!e.ok){var a;n.oR.error(null!=(a=e.error)?a:"Wipe failed");return}n.oR.success("Memory wiped"),await i()})},className:"text-destructive hover:text-destructive",children:[(0,a.jsx)(d.A,{className:"mr-1 h-3 w-3"}),"Wipe all"]})}},70465:(e,t,s)=>{"use strict";s.d(t,{B:()=>r});var a=s(7911);let r=(0,a.createServerReference)("00e69bc3d48703de31dc45f6137a45499d7475e1cd",a.callServer,void 0,a.findSourceMapURL,"listCuratedAction")},86667:(e,t,s)=>{"use strict";s.d(t,{RunInitButton:()=>u});var a=s(4624),r=s(99356),n=s(3239),i=s(67805),o=s(56221),l=s(85253),d=s(7911);let c=(0,d.createServerReference)("706d0022aab1e0fc1a600301a2ed4a098828d4f417",d.callServer,void 0,d.findSourceMapURL,"runInitAction");var m=s(63514);function u(e){let{rootPath:t,rootId:s}=e,[d,u]=(0,r.useTransition)();return(0,a.jsx)(l.$,{onClick:()=>u(async()=>{let e=o.oR.loading("Running agent — this can take a minute or two…"),a=await c(t,s,!1);if(o.oR.dismiss(e),a.ok)o.oR.success("Init complete"),(0,m.$d)(m.Zi.kbChanged(s)),(0,m.$d)(m.Zi.rootsChanged);else{var r;o.oR.error(null!=(r=a.error)?r:"Init failed")}}),disabled:d,children:d?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.A,{className:"mr-2 h-4 w-4 animate-spin"})," Running…"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.A,{className:"mr-2 h-4 w-4"})," Run init"]})})}},97127:(e,t,s)=>{"use strict";s.d(t,{RemoveRootButton:()=>u});var a=s(4624),r=s(99356),n=s(46972),i=s(56221),o=s(69285),l=s(85253),d=s(7911);let c=(0,d.createServerReference)("40e24180a123ecd66aa80cf2a8dbe2dc5069f7bd0b",d.callServer,void 0,d.findSourceMapURL,"removeRootAction");var m=s(63514);function u(e){let{id:t,path:s,redirectHome:d}=e,[u,x]=(0,r.useTransition)(),h=(0,o.useRouter)();return(0,a.jsx)(l.$,{variant:"ghost",size:"sm",disabled:u,title:"Delete Space",onClick:()=>{var e;confirm("Delete this Space?\n\n"+"Path: ".concat(s,"\n\n")+"This wipes the .reflex/ folder (KB, topics, memory, "+'suggestions, audit) and removes mentions of "'.concat(null!=(e=s.split("/").pop())?e:s,'" from global memory.\n\n')+"Your own files in the folder are NOT touched.\n\nThis cannot be undone.")&&x(async()=>{let e=await c(t);if(e.ok)i.oR.success("Space deleted"),(0,m.$d)(m.Zi.rootsChanged),d&&h.push("/");else{var s;i.oR.error(null!=(s=e.error)?s:"Failed to delete")}})},children:(0,a.jsx)(n.A,{className:"h-4 w-4 text-muted-foreground"})})}}},e=>{e.O(0,[4400,1217,9411,3335,5097,3954,8775,8566,5822,8336,8302,2390,4933,146,7358],()=>e(e.s=7530)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6388],{13506:(e,t,s)=>{"use strict";s.d(t,{cn:()=>i});var r=s(47989),a=s(55701);function i(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return(0,a.QP)((0,r.$)(t))}},15523:(e,t,s)=>{"use strict";s.d(t,{p:()=>i});var r=s(4624);s(99356);var a=s(13506);function i(e){let{className:t,type:s,...i}=e;return(0,r.jsx)("input",{type:s,"data-slot":"input",className:(0,a.cn)("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30","focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",t),...i})}},22841:(e,t,s)=>{"use strict";s.d(t,{bq:()=>u,eb:()=>m,gC:()=>p,l6:()=>d,yv:()=>c});var r=s(4624);s(99356);var a=s(69709),i=s(43153),n=s(59728),l=s(85314),o=s(13506);function d(e){let{...t}=e;return(0,r.jsx)(l.Root,{"data-slot":"select",...t})}function c(e){let{...t}=e;return(0,r.jsx)(l.Value,{"data-slot":"select-value",...t})}function u(e){let{className:t,size:s="default",children:i,...n}=e;return(0,r.jsxs)(l.Trigger,{"data-slot":"select-trigger","data-size":s,className:(0,o.cn)("flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",t),...n,children:[i,(0,r.jsx)(l.Icon,{asChild:!0,children:(0,r.jsx)(a.A,{className:"size-4 opacity-50"})})]})}function p(e){let{className:t,children:s,position:a="item-aligned",align:i="center",...n}=e;return(0,r.jsx)(l.Portal,{children:(0,r.jsxs)(l.Content,{"data-slot":"select-content",className:(0,o.cn)("relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95","popper"===a&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:a,align:i,...n,children:[(0,r.jsx)(h,{}),(0,r.jsx)(l.Viewport,{className:(0,o.cn)("p-1","popper"===a&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:s}),(0,r.jsx)(x,{})]})})}function m(e){let{className:t,children:s,...a}=e;return(0,r.jsxs)(l.Item,{"data-slot":"select-item",className:(0,o.cn)("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...a,children:[(0,r.jsx)("span",{"data-slot":"select-item-indicator",className:"absolute right-2 flex size-3.5 items-center justify-center",children:(0,r.jsx)(l.ItemIndicator,{children:(0,r.jsx)(i.A,{className:"size-4"})})}),(0,r.jsx)(l.ItemText,{children:s})]})}function h(e){let{className:t,...s}=e;return(0,r.jsx)(l.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:(0,o.cn)("flex cursor-default items-center justify-center py-1",t),...s,children:(0,r.jsx)(n.A,{className:"size-4"})})}function x(e){let{className:t,...s}=e;return(0,r.jsx)(l.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:(0,o.cn)("flex cursor-default items-center justify-center py-1",t),...s,children:(0,r.jsx)(a.A,{className:"size-4"})})}},28310:(e,t,s)=>{"use strict";s.d(t,{E:()=>o});var r=s(4624);s(99356);var a=s(60621),i=s(50362),n=s(13506);let l=(0,a.F)("inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function o(e){let{className:t,variant:s="default",asChild:a=!1,...o}=e,d=a?i.bL:"span";return(0,r.jsx)(d,{"data-slot":"badge","data-variant":s,className:(0,n.cn)(l({variant:s}),t),...o})}},41379:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},43153:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},46972:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},52515:(e,t,s)=>{Promise.resolve().then(s.bind(s,62712)),Promise.resolve().then(s.bind(s,91074)),Promise.resolve().then(s.bind(s,96253)),Promise.resolve().then(s.bind(s,28050)),Promise.resolve().then(s.bind(s,94904)),Promise.resolve().then(s.bind(s,13270)),Promise.resolve().then(s.bind(s,99730)),Promise.resolve().then(s.bind(s,89146)),Promise.resolve().then(s.bind(s,19078)),Promise.resolve().then(s.bind(s,67854)),Promise.resolve().then(s.bind(s,69050)),Promise.resolve().then(s.bind(s,63739)),Promise.resolve().then(s.bind(s,33976)),Promise.resolve().then(s.bind(s,12537)),Promise.resolve().then(s.bind(s,97485)),Promise.resolve().then(s.bind(s,41923)),Promise.resolve().then(s.bind(s,73868)),Promise.resolve().then(s.bind(s,53511)),Promise.resolve().then(s.bind(s,2018)),Promise.resolve().then(s.bind(s,18487)),Promise.resolve().then(s.bind(s,98346)),Promise.resolve().then(s.bind(s,14884)),Promise.resolve().then(s.bind(s,85314)),Promise.resolve().then(s.bind(s,17280)),Promise.resolve().then(s.bind(s,8855)),Promise.resolve().then(s.bind(s,86631)),Promise.resolve().then(s.bind(s,2604)),Promise.resolve().then(s.bind(s,27237)),Promise.resolve().then(s.bind(s,49455)),Promise.resolve().then(s.bind(s,39211)),Promise.resolve().then(s.bind(s,56360)),Promise.resolve().then(s.t.bind(s,54400,23))},59728:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])},60621:(e,t,s)=>{"use strict";s.d(t,{F:()=>n});var r=s(47989);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,i=r.$,n=(e,t)=>s=>{var r;if((null==t?void 0:t.variants)==null)return i(e,null==s?void 0:s.class,null==s?void 0:s.className);let{variants:n,defaultVariants:l}=t,o=Object.keys(n).map(e=>{let t=null==s?void 0:s[e],r=null==l?void 0:l[e];if(null===t)return null;let i=a(t)||a(r);return n[e][i]}),d=s&&Object.entries(s).reduce((e,t)=>{let[s,r]=t;return void 0===r||(e[s]=r),e},{});return i(e,o,null==t||null==(r=t.compoundVariants)?void 0:r.reduce((e,t)=>{let{class:s,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,s]=e;return Array.isArray(s)?s.includes({...l,...d}[t]):({...l,...d})[t]===s})?[...e,s,r]:e},[]),null==s?void 0:s.class,null==s?void 0:s.className)}},62712:(e,t,s)=>{"use strict";s.d(t,{WorkflowEditor:()=>C});var r=s(4624),a=s(99356),i=s(69285),n=s(49411),l=s(3239),o=s(46972),d=s(67805),c=s(41379),u=s(59728),p=s(69709),m=s(76974),h=s(65714),x=s(54400),v=s.n(x),f=s(56221),g=s(28310),b=s(85253),y=s(15523),w=s(71651),k=s(22841),j=s(7911);let N=(0,j.createServerReference)("60e54ca7f42e564bf44d85d5ab6e8a92ffda845253",j.callServer,void 0,j.findSourceMapURL,"saveWorkflowAction"),P=(0,j.createServerReference)("60768538a8af5cd35a01e255af3343f63f873e5978",j.callServer,void 0,j.findSourceMapURL,"listRunsAction"),z=(0,j.createServerReference)("70cd6c4fb350f67e15aa95ae883a38cf5aa3ce5178",j.callServer,void 0,j.findSourceMapURL,"runWorkflowAction"),A=(0,j.createServerReference)("606e8bd4f1400e7ca35cc6340eb770ec1093da3f50",j.callServer,void 0,j.findSourceMapURL,"deleteWorkflowAction"),S=[{kind:"text-template",label:"Text template",description:"Assembles text from a template with substitutions from previous steps. Use as glue between steps before the next one.",defaultParams:{template:"Hello {{prev}}"},fields:[{key:"template",label:"Template",type:"text",hint:"Substitutions: {{prev}}, {{steps.<id>.output}}, {{input.<field>}}",placeholder:"Summary: {{prev}}"}]},{kind:"http-request",label:"HTTP request",description:"Makes an HTTP request (GET by default). Puts the response body into output as a string or JSON if application/json.",defaultParams:{url:"https://api.example.com/",method:"GET"},fields:[{key:"url",label:"URL",type:"url",placeholder:"https://…"},{key:"method",label:"Method",type:"select",options:["GET","POST","PUT","PATCH","DELETE"]},{key:"headers",label:"Headers (JSON)",type:"json",hint:'Example: {"Authorization":"Bearer …"}'},{key:"body",label:"Body",type:"text",hint:"Leave empty for GET"}]},{kind:"web-fetch",label:"Fetch page",description:"Requests a URL and returns the textual content. Convenient for parsing pages without HTTP-config pain.",defaultParams:{url:"https://example.com"},fields:[{key:"url",label:"URL",type:"url",placeholder:"https://…"}]},{kind:"ask-agent",label:"Ask the agent",description:"Runs a headless orchestrator agent with the given question. Output is the agent's reply (the full assistant text).",defaultParams:{prompt:"Briefly summarize: {{prev}}"},fields:[{key:"prompt",label:"Question for the agent",type:"text",placeholder:"Use {{prev}} to pass the input"}]},{kind:"kb-write",label:"Write to KB",description:"Saves to the knowledge base as a Markdown file with frontmatter (kind, title, body). Use the previous step's output as `body`.",defaultParams:{kind:"note",title:"From workflow {{workflow.label}}",body:"{{prev}}"},fields:[{key:"kind",label:"Kind",type:"string",placeholder:"note"},{key:"title",label:"Title",type:"string",placeholder:"{{workflow.label}}"},{key:"body",label:"Body (Markdown)",type:"text",placeholder:"{{prev}}"}]},{kind:"utility-call",label:"Call a mini-app",description:"Runs a named server action of an installed utility with the given args. Output = the action's result. utility-call lets the workflow use mini-app functions as a library.",defaultParams:{utilityId:"",utilityScope:"global",actionName:"",args:"{}"},fields:[{key:"utilityId",label:"Utility (id)",type:"string",placeholder:"my-utility"},{key:"utilityScope",label:"Scope",type:"select",options:["global","project"]},{key:"actionName",label:"Action",type:"string",placeholder:"name from manifest.serverActions"},{key:"args",label:"Arguments (JSON)",type:"json",hint:"Passed as the first argument to the action. {{prev}} substitutions work inside JSON strings."}]},{kind:"image-generate",label:"Generate an image",description:"Generates an image via Gemini Nano Banana or Codex `$imagegen`. Output: {url, sha, mime, provider} — `url` can be inserted into a kb-write body as `![]({{steps.<id>.output.url}})`.",defaultParams:{prompt:"cute raccoon in a spacesuit, watercolor",provider:"gemini",aspectRatio:"1:1"},fields:[{key:"prompt",label:"Prompt",type:"text",placeholder:"Image description"},{key:"provider",label:"Provider",type:"select",options:["gemini","codex"]},{key:"aspectRatio",label:"Aspect ratio",type:"select",options:["1:1","16:9","9:16","4:3","3:4","21:9"]},{key:"size",label:"Size (opt.)",type:"string",placeholder:"1024x1024"}]},{kind:"image-search",label:"Search images on the web",description:"Searches for ready-made images by query (Unsplash by default, Pexels as fallback). Output: {results: [{url, thumb, attribution}…]}.",defaultParams:{query:"mountains sunrise",provider:"unsplash",count:6},fields:[{key:"query",label:"Query",type:"string",placeholder:"mountains sunrise"},{key:"provider",label:"Provider",type:"select",options:["unsplash","pexels","brave"]},{key:"count",label:"Result count",type:"string",placeholder:"6"}]}];function E(e){var t;return null!=(t=S.find(t=>t.kind===e))?t:null}function C(e){var t;let{rootId:s,initial:u,initialRuns:p}=e,m=(0,n.c)("roots"),h=(0,i.useRouter)(),[x,g]=(0,a.useState)(u),[w,j]=(0,a.useState)(p),[C,M]=(0,a.useState)(null),[O,_]=(0,a.useState)("closed"),[I,L]=(0,a.useTransition)(),[U,$]=(0,a.useTransition)(),H=e=>{g(e),$(async()=>{var t;let r=await N(s,e);r.ok||f.oR.error(null!=(t=r.error)?t:m("workflowEditor.saveFailed"))})},q=async()=>{let e=await P(s,x.id);e.ok&&j(e.runs)},V=(e,t)=>{let s=e+t;if(s<0||s>=x.steps.length)return;let r=[...x.steps],a=r[e],i=r[s];r[e]=i,r[s]=a,H({...x,steps:r,updatedAt:new Date().toISOString()})};return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"rounded-md border bg-card p-4 space-y-3",children:[(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:m("workflowEditor.nameLabel")}),(0,r.jsx)(y.p,{value:x.label,onChange:e=>H({...x,label:e.target.value}),className:"text-sm"})]}),(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:m("workflowEditor.descriptionLabel")}),(0,r.jsx)(y.p,{value:null!=(t=x.description)?t:"",onChange:e=>H({...x,description:e.target.value}),className:"text-sm",placeholder:m("workflowEditor.descriptionPlaceholder")})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsxs)("div",{className:"space-y-1.5",children:[(0,r.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:m("workflowEditor.triggerLabel")}),(0,r.jsxs)(k.l6,{value:x.trigger,onValueChange:e=>H({...x,trigger:e}),children:[(0,r.jsx)(k.bq,{className:"h-8 w-32",children:(0,r.jsx)(k.yv,{})}),(0,r.jsxs)(k.gC,{children:[(0,r.jsx)(k.eb,{value:"manual",children:m("workflowEditor.triggerManual")}),(0,r.jsx)(k.eb,{value:"hourly",children:m("workflowEditor.triggerHourly")}),(0,r.jsx)(k.eb,{value:"daily",children:m("workflowEditor.triggerDaily")}),(0,r.jsx)(k.eb,{value:"weekly",children:m("workflowEditor.triggerWeekly")})]})]})]}),x.sourceTopicId&&(0,r.jsx)(v(),{href:"/roots/".concat(s,"/chat/").concat(x.sourceTopicId),className:"text-xs text-muted-foreground hover:underline self-end pb-2",children:m("workflowEditor.editViaTopic")}),(0,r.jsxs)("div",{className:"ml-auto flex items-center gap-2 self-end pb-1",children:[U&&(0,r.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[(0,r.jsx)(l.A,{className:"h-3 w-3 animate-spin inline mr-1"}),m("workflowEditor.saving")]}),(0,r.jsxs)(b.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>{confirm(m("workflowEditor.deleteConfirm",{label:x.label}))&&$(async()=>{let e=await A(s,x.id);if(!e.ok)return void f.oR.error(e.error);h.push("/roots/".concat(s,"/workflows"))})},disabled:U,className:"text-muted-foreground hover:text-destructive",children:[(0,r.jsx)(o.A,{className:"h-3.5 w-3.5 mr-1"}),m("workflowEditor.delete")]}),(0,r.jsxs)(b.$,{type:"button",size:"sm",onClick:()=>{L(async()=>{let e=await z(s,x.id);if(!e.ok)return void f.oR.error(e.error);"completed"===e.run.status?f.oR.success(m("workflowEditor.completed")):"failed"===e.run.status&&f.oR.error(m("workflowEditor.failedRun")),q()})},disabled:I||0===x.steps.length,className:"gap-1",children:[I?(0,r.jsx)(l.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,r.jsx)(d.A,{className:"h-3.5 w-3.5"}),m("workflowEditor.run")]})]})]})]}),(0,r.jsxs)("section",{className:"space-y-2",children:[(0,r.jsx)("h2",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:m("workflowEditor.stepsHeading",{count:x.steps.length})}),x.steps.map((e,t)=>(0,r.jsx)(R,{step:e,idx:t,total:x.steps.length,editing:C===e.id,onToggleEdit:()=>M(C===e.id?null:e.id),onMoveUp:()=>V(t,-1),onMoveDown:()=>V(t,1),onRemove:()=>(e=>{let t=x.steps.filter((t,s)=>s!==e);H({...x,steps:t,updatedAt:new Date().toISOString()})})(t),onChange:e=>((e,t)=>{let s=x.steps.map((s,r)=>r===e?{...s,...t}:s);H({...x,steps:s,updatedAt:new Date().toISOString()})})(t,e)},e.id)),"open"===O?(0,r.jsxs)("div",{className:"rounded-md border bg-card p-3 space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h3",{className:"text-xs font-medium",children:m("workflowEditor.pickStepKind")}),(0,r.jsx)(b.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>_("closed"),className:"h-6 text-xs",children:m("workflowEditor.cancel")})]}),(0,r.jsx)("div",{className:"grid gap-1.5",children:S.map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>(e=>{let t=E(e);if(!t)return;let s=function(e,t){let s=t.replace(/[^a-z0-9]/gi,"-"),r=1;for(;e.some(e=>e.id==="".concat(s,"-").concat(r));)r+=1;return"".concat(s,"-").concat(r)}(x.steps,e);H({...x,steps:[...x.steps,{id:s,kind:e,label:t.label,params:{...t.defaultParams}}],updatedAt:new Date().toISOString()}),_("closed"),M(s)})(e.kind),className:"text-left rounded-md border px-3 py-2 hover:bg-accent/60 transition",children:[(0,r.jsx)("div",{className:"text-sm font-medium",children:e.label}),(0,r.jsx)("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:e.description})]},e.kind))})]}):(0,r.jsxs)(b.$,{type:"button",variant:"outline",size:"sm",onClick:()=>_("open"),className:"w-full gap-1 border-dashed",children:[(0,r.jsx)(c.A,{className:"h-3.5 w-3.5"}),m("workflowEditor.addStep")]})]}),(0,r.jsx)(T,{runs:w,onRefresh:q})]})}function R(e){let{step:t,idx:s,total:a,editing:i,onToggleEdit:l,onMoveUp:d,onMoveDown:c,onRemove:x,onChange:v}=e,f=(0,n.c)("roots"),j=E(t.kind);return(0,r.jsxs)("div",{className:"rounded-md border bg-card overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 group",children:[(0,r.jsx)("span",{className:"text-[10px] font-mono text-muted-foreground w-6 text-center shrink-0",children:s+1}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,r.jsx)("span",{className:"text-sm font-medium truncate",children:t.label}),(0,r.jsx)(g.E,{variant:"outline",className:"text-[10px] font-mono",children:t.kind})]}),j&&(0,r.jsx)("p",{className:"text-[11px] text-muted-foreground line-clamp-1 mt-0.5",children:j.description})]}),(0,r.jsxs)("div",{className:"flex items-center gap-0.5 shrink-0",children:[(0,r.jsx)(b.$,{type:"button",size:"icon",variant:"ghost",onClick:d,disabled:0===s,className:"h-7 w-7",children:(0,r.jsx)(u.A,{className:"h-3.5 w-3.5"})}),(0,r.jsx)(b.$,{type:"button",size:"icon",variant:"ghost",onClick:c,disabled:s===a-1,className:"h-7 w-7",children:(0,r.jsx)(p.A,{className:"h-3.5 w-3.5"})}),(0,r.jsx)(b.$,{type:"button",size:"icon",variant:"ghost",onClick:l,className:"h-7 w-7",children:(0,r.jsx)(m.A,{className:"h-3.5 w-3.5"})}),(0,r.jsx)(b.$,{type:"button",size:"icon",variant:"ghost",onClick:x,className:"h-7 w-7 text-muted-foreground hover:text-destructive",children:(0,r.jsx)(o.A,{className:"h-3.5 w-3.5"})})]})]}),i&&(0,r.jsxs)("div",{className:"border-t bg-muted/30 px-3 py-3 space-y-2.5",children:[(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("label",{className:"text-[11px] font-medium text-muted-foreground",children:f("workflowEditor.labelField")}),(0,r.jsx)(y.p,{value:t.label,onChange:e=>v({label:e.target.value}),className:"h-8 text-sm"})]}),null==j?void 0:j.fields.map(e=>{var s;let a=null!=(s=t.params[e.key])?s:"";return(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("label",{className:"text-[11px] font-medium text-muted-foreground",children:e.label}),"select"===e.type&&e.options?(0,r.jsxs)(k.l6,{value:String(a||e.options[0]),onValueChange:s=>v({params:{...t.params,[e.key]:s}}),children:[(0,r.jsx)(k.bq,{className:"h-8 text-sm",children:(0,r.jsx)(k.yv,{})}),(0,r.jsx)(k.gC,{children:e.options.map(e=>(0,r.jsx)(k.eb,{value:e,children:e},e))})]}):"text"===e.type||"json"===e.type?(0,r.jsx)(w.T,{value:String(a),onChange:s=>v({params:{...t.params,[e.key]:s.target.value}}),placeholder:e.placeholder,rows:3,className:"text-sm font-mono"}):(0,r.jsx)(y.p,{value:String(a),onChange:s=>v({params:{...t.params,[e.key]:s.target.value}}),placeholder:e.placeholder,className:"h-8 text-sm font-mono"}),e.hint&&(0,r.jsx)("p",{className:"text-[10px] text-muted-foreground",children:e.hint})]},e.key)}),(0,r.jsx)("div",{className:"flex justify-end",children:(0,r.jsxs)(b.$,{type:"button",size:"sm",variant:"ghost",onClick:l,className:"h-7 text-xs gap-1",children:[(0,r.jsx)(h.A,{className:"h-3 w-3"}),f("workflowEditor.done")]})})]})]})}function T(e){let{runs:t,onRefresh:s}=e,i=(0,n.c)("roots"),[o,d]=(0,a.useTransition)();return 0===t.length?(0,r.jsxs)("section",{className:"space-y-2",children:[(0,r.jsx)("h2",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:i("workflowEditor.runHistory")}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:i("workflowEditor.noRuns")})]}):(0,r.jsxs)("section",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wider",children:i("workflowEditor.runHistory")}),(0,r.jsx)(b.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>d(async()=>s()),disabled:o,className:"h-7 text-xs",children:o?(0,r.jsx)(l.A,{className:"h-3 w-3 animate-spin"}):i("workflowEditor.refresh")})]}),(0,r.jsx)("ul",{className:"space-y-1.5",children:t.map(e=>(0,r.jsx)("li",{children:(0,r.jsxs)("details",{className:"rounded-md border bg-card",children:[(0,r.jsxs)("summary",{className:"cursor-pointer list-none flex items-center gap-2 px-3 py-2",children:[(0,r.jsx)(g.E,{variant:"completed"===e.status?"secondary":"failed"===e.status?"destructive":"outline",className:"text-[10px]",children:e.status}),(0,r.jsx)("span",{className:"text-xs font-mono truncate",children:e.id}),(0,r.jsx)("span",{className:"text-[10px] text-muted-foreground ml-auto",children:new Date(e.startedAt).toLocaleString()})]}),(0,r.jsx)("div",{className:"px-3 pb-3 space-y-1.5",children:e.steps.map(e=>(0,r.jsxs)("div",{className:"text-xs rounded border bg-muted/30 px-2 py-1.5",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(g.E,{variant:"completed"===e.status?"secondary":"failed"===e.status?"destructive":"outline",className:"text-[10px]",children:e.status}),(0,r.jsx)("span",{className:"font-mono",children:e.stepId})]}),e.error&&(0,r.jsx)("pre",{className:"mt-1 text-[10px] text-destructive whitespace-pre-wrap",children:e.error}),void 0!==e.output&&(0,r.jsx)("pre",{className:"mt-1 text-[10px] text-muted-foreground whitespace-pre-wrap max-h-32 overflow-y-auto font-mono",children:function(e){try{if("string"==typeof e)return e.length>800?e.slice(0,800)+"…":e;let t=JSON.stringify(e,null,2);return t.length>800?t.slice(0,800)+"…":t}catch(t){return String(e)}}(e.output)})]},e.stepId))})]})},e.id))})]})}},65714:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},67805:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},69285:(e,t,s)=>{"use strict";var r=s(48849);s.o(r,"usePathname")&&s.d(t,{usePathname:function(){return r.usePathname}}),s.o(r,"useRouter")&&s.d(t,{useRouter:function(){return r.useRouter}})},69709:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},71651:(e,t,s)=>{"use strict";s.d(t,{T:()=>i});var r=s(4624);s(99356);var a=s(13506);function i(e){let{className:t,...s}=e;return(0,r.jsx)("textarea",{"data-slot":"textarea",className:(0,a.cn)("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:ring-destructive/40",t),...s})}},76974:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let r=(0,s(45804).A)("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},85253:(e,t,s)=>{"use strict";s.d(t,{$:()=>o});var r=s(4624);s(99356);var a=s(60621),i=s(50362),n=s(13506);let l=(0,a.F)("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function o(e){let{className:t,variant:s="default",size:a="default",asChild:o=!1,...d}=e,c=o?i.bL:"button";return(0,r.jsx)(c,{"data-slot":"button","data-variant":s,"data-size":a,className:(0,n.cn)(l({variant:s,size:a,className:t})),...d})}},91074:(e,t,s)=>{"use strict";s.d(t,{Separator:()=>n});var r=s(4624);s(99356);var a=s(44188),i=s(13506);function n(e){let{className:t,orientation:s="horizontal",decorative:n=!0,...l}=e;return(0,r.jsx)(a.b,{"data-slot":"separator",decorative:n,orientation:s,className:(0,i.cn)("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...l})}}},e=>{e.O(0,[4400,1217,9411,3335,5097,4933,146,7358],()=>e(e.s=52515)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9429],{3747:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(45804).A)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},4959:(e,t,r)=>{"use strict";r.d(t,{BT:()=>l,Wu:()=>d,ZB:()=>o,Zp:()=>n,aR:()=>i,wL:()=>c});var a=r(4624);r(99356);var s=r(13506);function n(e){let{className:t,...r}=e;return(0,a.jsx)("div",{"data-slot":"card",className:(0,s.cn)("flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm",t),...r})}function i(e){let{className:t,...r}=e;return(0,a.jsx)("div",{"data-slot":"card-header",className:(0,s.cn)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...r})}function o(e){let{className:t,...r}=e;return(0,a.jsx)("div",{"data-slot":"card-title",className:(0,s.cn)("leading-none font-semibold",t),...r})}function l(e){let{className:t,...r}=e;return(0,a.jsx)("div",{"data-slot":"card-description",className:(0,s.cn)("text-sm text-muted-foreground",t),...r})}function d(e){let{className:t,...r}=e;return(0,a.jsx)("div",{"data-slot":"card-content",className:(0,s.cn)("px-6",t),...r})}function c(e){let{className:t,...r}=e;return(0,a.jsx)("div",{"data-slot":"card-footer",className:(0,s.cn)("flex items-center px-6 [.border-t]:pt-6",t),...r})}},9923:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(45804).A)("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]])},13506:(e,t,r)=>{"use strict";r.d(t,{cn:()=>n});var a=r(47989),s=r(55701);function n(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,s.QP)((0,a.$)(t))}},13561:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(45804).A)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},15523:(e,t,r)=>{"use strict";r.d(t,{p:()=>n});var a=r(4624);r(99356);var s=r(13506);function n(e){let{className:t,type:r,...n}=e;return(0,a.jsx)("input",{type:r,"data-slot":"input",className:(0,s.cn)("h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30","focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",t),...n})}},32740:(e,t,r)=>{Promise.resolve().then(r.bind(r,42023)),Promise.resolve().then(r.bind(r,96253)),Promise.resolve().then(r.bind(r,28050)),Promise.resolve().then(r.bind(r,94904)),Promise.resolve().then(r.bind(r,13270)),Promise.resolve().then(r.bind(r,99730)),Promise.resolve().then(r.bind(r,89146)),Promise.resolve().then(r.bind(r,19078)),Promise.resolve().then(r.bind(r,67854)),Promise.resolve().then(r.bind(r,69050)),Promise.resolve().then(r.bind(r,63739)),Promise.resolve().then(r.bind(r,33976)),Promise.resolve().then(r.bind(r,12537)),Promise.resolve().then(r.bind(r,97485)),Promise.resolve().then(r.bind(r,41923)),Promise.resolve().then(r.bind(r,73868)),Promise.resolve().then(r.bind(r,53511)),Promise.resolve().then(r.bind(r,2018)),Promise.resolve().then(r.bind(r,18487)),Promise.resolve().then(r.bind(r,98346)),Promise.resolve().then(r.bind(r,14884)),Promise.resolve().then(r.bind(r,85314)),Promise.resolve().then(r.bind(r,17280)),Promise.resolve().then(r.bind(r,8855)),Promise.resolve().then(r.bind(r,86631)),Promise.resolve().then(r.bind(r,2604)),Promise.resolve().then(r.bind(r,27237)),Promise.resolve().then(r.bind(r,49455)),Promise.resolve().then(r.bind(r,39211)),Promise.resolve().then(r.bind(r,56360)),Promise.resolve().then(r.t.bind(r,54400,23))},42023:(e,t,r)=>{"use strict";r.d(t,{DirectoryPicker:()=>C});var a=r(4624),s=r(99356),n=r(69285),i=r(49411);let o=(0,r(45804).A)("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);var l=r(3747),d=r(59728),c=r(42146),u=r(72754),h=r(3239),m=r(13561),p=r(69709),x=r(69205),v=r(9923),f=r(56221),b=r(85253),g=r(4959),j=r(15523),y=r(80192),k=r(91074),w=r(7911);let N=(0,w.createServerReference)("4008dacebd8ed3d13aa636ec4e4a99d649d7e3a7b7",w.callServer,void 0,w.findSourceMapURL,"addRootAction");var P=r(63514);let A=(0,w.createServerReference)("40602c35494a26236ec4a0f2595499139664f70d8e",w.callServer,void 0,w.findSourceMapURL,"browseAction"),S=(0,w.createServerReference)("6078b4e595c5fe9986c43c1bbda6695e36ee3f56cf",w.callServer,void 0,w.findSourceMapURL,"createDirectoryAction");function C(e){let{initialPath:t}=e,r=(0,i.c)("roots"),[p,x]=(0,s.useState)(t),[v,w]=(0,s.useState)(t),[C,R]=(0,s.useState)(null),[D,$]=(0,s.useState)([]),[_,E]=(0,s.useState)(t),[H,T]=(0,s.useState)(!1),[Z,B]=(0,s.useTransition)(),[O,V]=(0,s.useTransition)(),[U,q]=(0,s.useState)(!1),[I,W]=(0,s.useState)(""),[K,Q]=(0,s.useTransition)(),X=(0,n.useRouter)();(0,s.useEffect)(()=>{G(t)},[]);let G=e=>{B(async()=>{let t=await A(e);if(!t.ok){var r;f.oR.error(null!=(r=t.error)?r:"Failed to browse");return}x(t.path),w(t.path),R(t.parent),E(t.path),$(t.entries.filter(e=>e.isDir).map(e=>F(e.name,e.absPath,e.hidden)))})},J=async e=>{let t=function e(t,r){for(let a of t){if(a.absPath===r)return a;if(a.expanded){let t=e(a.children,r);if(t)return t}}return null}(D,e);if(!t)return;if(t.expanded)return void $(t=>L(t,e,e=>({...e,expanded:!1})));if(t.loaded)return void $(t=>L(t,e,e=>({...e,expanded:!0})));$(t=>L(t,e,e=>({...e,loading:!0})));let r=await A(e);if(!r.ok){var a;f.oR.error(null!=(a=r.error)?a:"Failed to browse"),$(t=>L(t,e,e=>({...e,loading:!1})));return}let s=r.entries.filter(e=>e.isDir).map(e=>F(e.name,e.absPath,e.hidden));$(t=>L(t,e,e=>({...e,loading:!1,loaded:!0,expanded:!0,children:s})))},Y=async e=>{if(e===p){let t=await A(e);t.ok&&$(t.entries.filter(e=>e.isDir).map(e=>F(e.name,e.absPath,e.hidden)));return}let t=await A(e);if(!t.ok)return;let r=t.entries.filter(e=>e.isDir).map(e=>F(e.name,e.absPath,e.hidden));$(t=>L(t,e,e=>({...e,children:r,loaded:!0,expanded:!0})))};return(0,a.jsxs)(g.Zp,{children:[(0,a.jsxs)(g.aR,{children:[(0,a.jsxs)(g.ZB,{className:"flex items-center justify-between gap-4",children:[(0,a.jsx)("span",{children:"Browse"}),(0,a.jsxs)(b.$,{variant:"ghost",size:"sm",onClick:()=>G(t),disabled:Z,children:[(0,a.jsx)(o,{className:"mr-1 h-4 w-4"})," Home"]})]}),(0,a.jsxs)("form",{className:"flex gap-2 mt-2",onSubmit:e=>{e.preventDefault(),G(v)},children:[(0,a.jsx)(j.p,{value:v,onChange:e=>w(e.target.value),placeholder:"/absolute/path",className:"font-mono text-xs"}),(0,a.jsx)(b.$,{type:"submit",variant:"secondary",disabled:Z,children:(0,a.jsx)(l.A,{className:"h-4 w-4 ".concat(Z?"animate-spin":"")})})]})]}),(0,a.jsx)(k.Separator,{}),(0,a.jsx)(g.Wu,{className:"px-2 py-2",children:(0,a.jsxs)(y.F,{className:"h-[460px]",children:[(0,a.jsxs)("div",{className:"px-2 py-1 flex items-center gap-2",children:[(0,a.jsxs)(b.$,{variant:"ghost",size:"sm",disabled:!C||Z,onClick:()=>C&&G(C),className:"h-8",children:[(0,a.jsx)(d.A,{className:"mr-1 h-4 w-4"})," Up"]}),(0,a.jsxs)("button",{type:"button",onClick:()=>E(p),className:"flex-1 flex items-center gap-2 px-2 py-1 text-sm rounded-md hover:bg-accent ".concat(_===p?"bg-accent":""),title:p,children:[(0,a.jsx)(c.A,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,a.jsx)("span",{className:"truncate font-mono text-xs",children:"."}),(0,a.jsxs)("span",{className:"text-muted-foreground text-[11px] truncate",children:["(",M(p),")"]})]}),(0,a.jsxs)(b.$,{variant:"ghost",size:"sm",disabled:Z||K,onClick:()=>{q(e=>!e),W("")},className:"h-8",title:r("picker.createFolderTitle",{parent:M(_)}),children:[(0,a.jsx)(u.A,{className:"mr-1 h-4 w-4"})," ",r("picker.createButton")]}),(0,a.jsxs)("label",{className:"flex items-center gap-1 text-xs text-muted-foreground select-none",children:[(0,a.jsx)("input",{type:"checkbox",checked:H,onChange:e=>T(e.target.checked)}),"hidden"]})]}),U&&(0,a.jsxs)("form",{className:"px-2 pb-2 flex items-center gap-2",onSubmit:e=>{e.preventDefault();let t=I.trim();t&&Q(async()=>{let e=await S(_,t);if(!e.ok){var a;f.oR.error(null!=(a=e.error)?a:r("picker.createFolderFailed"));return}f.oR.success(r("picker.folderCreated")),q(!1),W(""),await Y(_),E(e.path)})},children:[(0,a.jsxs)("span",{className:"text-[11px] text-muted-foreground font-mono truncate max-w-[40%]",children:[_,"/"]}),(0,a.jsx)(j.p,{autoFocus:!0,value:I,onChange:e=>W(e.target.value),placeholder:r("picker.newFolderPlaceholder"),className:"h-8 text-sm flex-1",disabled:K,onKeyDown:e=>{"Escape"===e.key&&(e.preventDefault(),q(!1),W(""))}}),(0,a.jsxs)(b.$,{type:"submit",size:"sm",disabled:K||!I.trim(),className:"h-8",children:[K?(0,a.jsx)(h.A,{className:"mr-1 h-3.5 w-3.5 animate-spin"}):(0,a.jsx)(u.A,{className:"mr-1 h-3.5 w-3.5"}),r("picker.createButton")]}),(0,a.jsx)(b.$,{type:"button",size:"sm",variant:"ghost",onClick:()=>{q(!1),W("")},className:"h-8",children:(0,a.jsx)(m.A,{className:"h-3.5 w-3.5"})})]}),(0,a.jsx)(k.Separator,{className:"my-1"}),Z?(0,a.jsxs)("div",{className:"flex items-center justify-center py-10 text-sm text-muted-foreground",children:[(0,a.jsx)(h.A,{className:"mr-2 h-4 w-4 animate-spin"})," Loading…"]}):0===D.length?(0,a.jsx)("div",{className:"px-4 py-10 text-center text-sm text-muted-foreground",children:"No subdirectories."}):(0,a.jsx)(z,{nodes:D,selected:_,onSelect:E,onToggle:J,showHidden:H,depth:0})]})}),(0,a.jsx)(k.Separator,{}),(0,a.jsxs)(g.wL,{className:"flex items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"text-xs text-muted-foreground font-mono truncate",children:["Selected: ",_]}),(0,a.jsx)(b.$,{onClick:()=>{V(async()=>{let e=await N(_);if(!e.ok){var t;f.oR.error(null!=(t=e.error)?t:"Failed to add");return}f.oR.success("Directory added"),(0,P.$d)(P.Zi.rootsChanged),e.onboardingTopicId?X.push("/roots/".concat(e.id,"/chat/").concat(e.onboardingTopicId)):X.push("/roots/".concat(e.id))})},disabled:O||Z,children:O?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(h.A,{className:"mr-2 h-4 w-4 animate-spin"})," Adding…"]}):"Add this directory"})]})]})}function z(e){let{nodes:t,selected:r,onSelect:s,onToggle:n,showHidden:i,depth:o}=e;return(0,a.jsx)("ul",{children:t.filter(e=>i||!e.hidden).map(e=>(0,a.jsxs)("li",{children:[(0,a.jsx)(R,{node:e,depth:o,selected:r,onSelect:s,onToggle:n}),e.expanded&&e.children.length>0&&(0,a.jsx)(z,{nodes:e.children,selected:r,onSelect:s,onToggle:n,showHidden:i,depth:o+1}),e.expanded&&e.loaded&&0===e.children.length&&(0,a.jsx)("div",{className:"text-xs text-muted-foreground italic px-2 py-1",style:{paddingLeft:16*o+44},children:"(empty)"})]},e.absPath))})}function R(e){let{node:t,depth:r,selected:s,onSelect:n,onToggle:i}=e,o=s===t.absPath;return(0,a.jsxs)("div",{className:"group flex items-center gap-1 pr-2 py-1 rounded-md hover:bg-accent/60 ".concat(o?"bg-accent":""),style:{paddingLeft:16*r+4},children:[(0,a.jsx)("button",{type:"button",onClick:()=>i(t.absPath),className:"h-6 w-6 flex items-center justify-center text-muted-foreground hover:text-foreground shrink-0","aria-label":t.expanded?"Collapse":"Expand",children:t.loading?(0,a.jsx)(h.A,{className:"h-3.5 w-3.5 animate-spin"}):t.expanded?(0,a.jsx)(p.A,{className:"h-3.5 w-3.5"}):(0,a.jsx)(x.A,{className:"h-3.5 w-3.5"})}),(0,a.jsxs)("button",{type:"button",onClick:()=>n(t.absPath),onDoubleClick:()=>i(t.absPath),className:"flex-1 min-w-0 flex items-center gap-2 text-left text-sm",children:[t.expanded?(0,a.jsx)(c.A,{className:"h-4 w-4 text-muted-foreground shrink-0"}):(0,a.jsx)(v.A,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,a.jsx)("span",{className:"truncate ".concat(t.hidden?"opacity-60":""),children:t.name})]})]})}function F(e,t,r){return{name:e,absPath:t,hidden:r,loaded:!1,loading:!1,expanded:!1,children:[]}}function L(e,t,r){return e.map(e=>e.absPath===t?r(e):e.children.length>0?{...e,children:L(e.children,t,r)}:e)}function M(e){var t;let r=e.split("/").filter(Boolean);return null!=(t=r[r.length-1])?t:e}},42146:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(45804).A)("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]])},59728:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(45804).A)("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]])},60621:(e,t,r)=>{"use strict";r.d(t,{F:()=>i});var a=r(47989);let s=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,n=a.$,i=(e,t)=>r=>{var a;if((null==t?void 0:t.variants)==null)return n(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:i,defaultVariants:o}=t,l=Object.keys(i).map(e=>{let t=null==r?void 0:r[e],a=null==o?void 0:o[e];if(null===t)return null;let n=s(t)||s(a);return i[e][n]}),d=r&&Object.entries(r).reduce((e,t)=>{let[r,a]=t;return void 0===a||(e[r]=a),e},{});return n(e,l,null==t||null==(a=t.compoundVariants)?void 0:a.reduce((e,t)=>{let{class:r,className:a,...s}=t;return Object.entries(s).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...o,...d}[t]):({...o,...d})[t]===r})?[...e,r,a]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}},63514:(e,t,r)=>{"use strict";r.d(t,{$d:()=>n,S9:()=>i,Zi:()=>s});var a=r(99356);let s={rootsChanged:"reflex:roots-changed",topicsChanged:e=>"reflex:topics-changed:".concat(e),kbChanged:e=>"reflex:kb-changed:".concat(e)};function n(e,t){window.dispatchEvent(new CustomEvent(e,{detail:t}))}function i(e,t){(0,a.useEffect)(()=>{let r=e=>t(e.detail);return window.addEventListener(e,r),()=>window.removeEventListener(e,r)},[e,t])}},69205:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(45804).A)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},69285:(e,t,r)=>{"use strict";var a=r(48849);r.o(a,"usePathname")&&r.d(t,{usePathname:function(){return a.usePathname}}),r.o(a,"useRouter")&&r.d(t,{useRouter:function(){return a.useRouter}})},69709:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(45804).A)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},72754:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});let a=(0,r(45804).A)("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]])},80192:(e,t,r)=>{"use strict";r.d(t,{F:()=>i});var a=r(4624);r(99356);var s=r(14884),n=r(13506);function i(e){let{className:t,children:r,...i}=e;return(0,a.jsxs)(s.Root,{"data-slot":"scroll-area",className:(0,n.cn)("relative",t),...i,children:[(0,a.jsx)(s.Viewport,{"data-slot":"scroll-area-viewport",className:"size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1",children:r}),(0,a.jsx)(o,{}),(0,a.jsx)(s.Corner,{})]})}function o(e){let{className:t,orientation:r="vertical",...i}=e;return(0,a.jsx)(s.ScrollAreaScrollbar,{"data-slot":"scroll-area-scrollbar",orientation:r,className:(0,n.cn)("flex touch-none p-px transition-colors select-none","vertical"===r&&"h-full w-2.5 border-l border-l-transparent","horizontal"===r&&"h-2.5 flex-col border-t border-t-transparent",t),...i,children:(0,a.jsx)(s.ScrollAreaThumb,{"data-slot":"scroll-area-thumb",className:"relative flex-1 rounded-full bg-border"})})}},85253:(e,t,r)=>{"use strict";r.d(t,{$:()=>l});var a=r(4624);r(99356);var s=r(60621),n=r(50362),i=r(13506);let o=(0,s.F)("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function l(e){let{className:t,variant:r="default",size:s="default",asChild:l=!1,...d}=e,c=l?n.bL:"button";return(0,a.jsx)(c,{"data-slot":"button","data-variant":r,"data-size":s,className:(0,i.cn)(o({variant:r,size:s,className:t})),...d})}},91074:(e,t,r)=>{"use strict";r.d(t,{Separator:()=>i});var a=r(4624);r(99356);var s=r(44188),n=r(13506);function i(e){let{className:t,orientation:r="horizontal",decorative:i=!0,...o}=e;return(0,a.jsx)(s.b,{"data-slot":"separator",decorative:i,orientation:r,className:(0,n.cn)("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...o})}}},e=>{e.O(0,[4400,1217,9411,3335,5097,4933,146,7358],()=>e(e.s=32740)),_N_E=e.O()}]);