hive-am 1.3.0 → 1.5.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 (164) hide show
  1. package/CHANGELOG.md +47 -1
  2. package/README.md +20 -5
  3. package/bin/hive-am.mjs +242 -31
  4. package/bin/run.mjs +135 -0
  5. package/package.json +1 -1
  6. package/server/dist/connections/manager.js +15 -3
  7. package/server/dist/connections/router.js +2 -2
  8. package/server/dist/connections/secrets.js +8 -0
  9. package/server/dist/db/migrations.js +68 -0
  10. package/server/dist/db.js +11 -10
  11. package/server/dist/efforts.js +105 -0
  12. package/server/dist/http/routes/agents.js +4 -3
  13. package/server/dist/http/routes/meta.js +12 -0
  14. package/server/dist/http/routes/notebook.js +10 -2
  15. package/server/dist/http/routes/resources.js +3 -0
  16. package/server/dist/http/routes/types.js +18 -1
  17. package/server/dist/http/validate.js +5 -2
  18. package/server/dist/index.js +4 -1
  19. package/server/dist/instructions.js +10 -2
  20. package/server/dist/objects/agent-db.js +258 -0
  21. package/server/dist/objects/database.js +496 -34
  22. package/server/dist/objects/index.js +20 -14
  23. package/server/dist/objects/runner.js +20 -0
  24. package/server/dist/objects/supervisor.js +2 -2
  25. package/server/dist/providers/kiro.js +7 -1
  26. package/server/dist/providers/opencode-server.js +11 -1
  27. package/server/dist/providers/opencode.js +4 -3
  28. package/server/dist/providers/spawn.js +38 -4
  29. package/server/dist/retention.js +50 -0
  30. package/server/dist/runtime.js +52 -21
  31. package/server/dist/services/agents.js +53 -1
  32. package/server/dist/services/notebook.js +7 -3
  33. package/server/dist/skills/defaults.js +35 -1
  34. package/server/dist/skills/notebook.js +57 -13
  35. package/server/mcp/dispatch.mjs +68 -0
  36. package/web/.next/BUILD_ID +1 -1
  37. package/web/.next/app-build-manifest.json +79 -70
  38. package/web/.next/app-path-routes-manifest.json +9 -8
  39. package/web/.next/build-manifest.json +2 -2
  40. package/web/.next/prerender-manifest.json +71 -47
  41. package/web/.next/routes-manifest.json +6 -0
  42. package/web/.next/server/app/_not-found/page.js +1 -1
  43. package/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  44. package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  45. package/web/.next/server/app/_not-found.html +1 -1
  46. package/web/.next/server/app/_not-found.rsc +3 -3
  47. package/web/.next/server/app/agents/[id]/page.js +4 -4
  48. package/web/.next/server/app/agents/[id]/page.js.nft.json +1 -1
  49. package/web/.next/server/app/agents/[id]/page_client-reference-manifest.js +1 -1
  50. package/web/.next/server/app/agents/page.js +2 -2
  51. package/web/.next/server/app/agents/page.js.nft.json +1 -1
  52. package/web/.next/server/app/agents/page_client-reference-manifest.js +1 -1
  53. package/web/.next/server/app/agents.html +1 -1
  54. package/web/.next/server/app/agents.rsc +4 -4
  55. package/web/.next/server/app/chat/page.js +2 -0
  56. package/web/.next/server/app/chat/page.js.nft.json +1 -0
  57. package/web/.next/server/app/chat/page_client-reference-manifest.js +1 -0
  58. package/web/.next/server/app/chat.html +1 -0
  59. package/web/.next/server/app/chat.meta +15 -0
  60. package/web/.next/server/app/chat.rsc +25 -0
  61. package/web/.next/server/app/connections/page.js +1 -1
  62. package/web/.next/server/app/connections/page.js.nft.json +1 -1
  63. package/web/.next/server/app/connections/page_client-reference-manifest.js +1 -1
  64. package/web/.next/server/app/connections.html +1 -1
  65. package/web/.next/server/app/connections.rsc +4 -4
  66. package/web/.next/server/app/index.html +1 -1
  67. package/web/.next/server/app/index.rsc +4 -4
  68. package/web/.next/server/app/page.js +1 -1
  69. package/web/.next/server/app/page.js.nft.json +1 -1
  70. package/web/.next/server/app/page_client-reference-manifest.js +1 -1
  71. package/web/.next/server/app/relations/page.js +2 -2
  72. package/web/.next/server/app/relations/page.js.nft.json +1 -1
  73. package/web/.next/server/app/relations/page_client-reference-manifest.js +1 -1
  74. package/web/.next/server/app/relations.html +1 -1
  75. package/web/.next/server/app/relations.rsc +4 -4
  76. package/web/.next/server/app/resources/[id]/page.js +2 -2
  77. package/web/.next/server/app/resources/[id]/page.js.nft.json +1 -1
  78. package/web/.next/server/app/resources/[id]/page_client-reference-manifest.js +1 -1
  79. package/web/.next/server/app/resources/page.js +2 -2
  80. package/web/.next/server/app/resources/page.js.nft.json +1 -1
  81. package/web/.next/server/app/resources/page_client-reference-manifest.js +1 -1
  82. package/web/.next/server/app/resources.html +1 -1
  83. package/web/.next/server/app/resources.rsc +4 -4
  84. package/web/.next/server/app/schedules/page.js +1 -1
  85. package/web/.next/server/app/schedules/page.js.nft.json +1 -1
  86. package/web/.next/server/app/schedules/page_client-reference-manifest.js +1 -1
  87. package/web/.next/server/app/schedules.html +1 -1
  88. package/web/.next/server/app/schedules.rsc +4 -4
  89. package/web/.next/server/app/sessions/page.js +2 -2
  90. package/web/.next/server/app/sessions/page.js.nft.json +1 -1
  91. package/web/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  92. package/web/.next/server/app/sessions.html +1 -1
  93. package/web/.next/server/app/sessions.rsc +4 -4
  94. package/web/.next/server/app/skills/page.js +1 -1
  95. package/web/.next/server/app/skills/page.js.nft.json +1 -1
  96. package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  97. package/web/.next/server/app/skills.html +1 -1
  98. package/web/.next/server/app/skills.rsc +4 -4
  99. package/web/.next/server/app/types/page.js +1 -1
  100. package/web/.next/server/app/types/page.js.nft.json +1 -1
  101. package/web/.next/server/app/types/page_client-reference-manifest.js +1 -1
  102. package/web/.next/server/app/types.html +1 -1
  103. package/web/.next/server/app/types.rsc +4 -4
  104. package/web/.next/server/app-paths-manifest.json +9 -8
  105. package/web/.next/server/chunks/143.js +1 -1
  106. package/web/.next/server/chunks/148.js +1 -0
  107. package/web/.next/server/chunks/213.js +6 -0
  108. package/web/.next/server/chunks/274.js +1 -1
  109. package/web/.next/server/chunks/368.js +1 -0
  110. package/web/.next/server/chunks/403.js +1 -0
  111. package/web/.next/server/chunks/{790.js → 435.js} +2 -2
  112. package/web/.next/server/chunks/505.js +1 -6
  113. package/web/.next/server/chunks/612.js +1 -1
  114. package/web/.next/server/pages/404.html +1 -1
  115. package/web/.next/server/pages/500.html +1 -1
  116. package/web/.next/server/server-reference-manifest.json +1 -1
  117. package/web/.next/static/UDA414PFPu9ZROltNmjbX/_buildManifest.js +1 -0
  118. package/web/.next/static/chunks/{316-26da9cc233ba7557.js → 107-77dd87cc2ca4f941.js} +1 -1
  119. package/web/.next/static/chunks/281-30e32d932b8b5a75.js +1 -0
  120. package/web/.next/static/chunks/391-18768499e741112e.js +1 -0
  121. package/web/.next/static/chunks/517-b3b1c9044d2ef23c.js +1 -0
  122. package/web/.next/static/chunks/587-5b511f5f93910180.js +1 -0
  123. package/web/.next/static/chunks/606-14fb5aaa4d0ff22d.js +1 -0
  124. package/web/.next/static/chunks/656-f3cc78328603241a.js +1 -0
  125. package/web/.next/static/chunks/{705-780e48e55b0346bd.js → 705-ce86175dea00e6a9.js} +1 -1
  126. package/web/.next/static/chunks/757-03361e7a97a605a2.js +1 -0
  127. package/web/.next/static/chunks/app/agents/[id]/page-638e12ba3cb813c3.js +1 -0
  128. package/web/.next/static/chunks/app/agents/page-9da499db6d22731f.js +1 -0
  129. package/web/.next/static/chunks/app/chat/page-383bc24e72dab7fa.js +1 -0
  130. package/web/.next/static/chunks/app/connections/{page-eb11cfb1ffeab3ca.js → page-06bd2d7d9495126a.js} +1 -1
  131. package/web/.next/static/chunks/app/layout-fad968a635f9a4b3.js +1 -0
  132. package/web/.next/static/chunks/app/page-0062ebc30322b1ae.js +1 -0
  133. package/web/.next/static/chunks/app/relations/page-02710fe1f8a670a9.js +1 -0
  134. package/web/.next/static/chunks/app/resources/[id]/{page-bf05836f97248ca7.js → page-fc494e85b01e8cb7.js} +1 -1
  135. package/web/.next/static/chunks/app/resources/{page-800f774e5cacf4c9.js → page-61cccd8fdcc2f6c8.js} +1 -1
  136. package/web/.next/static/chunks/app/sessions/page-85638705fdc18174.js +1 -0
  137. package/web/.next/static/chunks/app/types/page-8e25f503bdcd72ad.js +1 -0
  138. package/web/.next/static/css/dfcaa19a8d46e60d.css +1 -0
  139. package/web/.next/trace +30 -29
  140. package/web/.next/types/app/chat/page.ts +84 -0
  141. package/web/.next/types/routes.d.ts +2 -1
  142. package/web/.next/types/validator.ts +9 -0
  143. package/web/.next/server/chunks/306.js +0 -1
  144. package/web/.next/server/chunks/451.js +0 -1
  145. package/web/.next/server/chunks/638.js +0 -1
  146. package/web/.next/server/chunks/802.js +0 -1
  147. package/web/.next/static/aSYzbHk1M5YeS_d3SQKTZ/_buildManifest.js +0 -1
  148. package/web/.next/static/chunks/281-d8a0dcfaa6d064e4.js +0 -1
  149. package/web/.next/static/chunks/291-23f314877fa39054.js +0 -1
  150. package/web/.next/static/chunks/304-681348099f874a30.js +0 -1
  151. package/web/.next/static/chunks/491-28f093772bd460ac.js +0 -1
  152. package/web/.next/static/chunks/517-373a80c8ba432bdc.js +0 -1
  153. package/web/.next/static/chunks/562-7c2e33d838e869bf.js +0 -1
  154. package/web/.next/static/chunks/581-3ad5c4343dad3f50.js +0 -1
  155. package/web/.next/static/chunks/844-519177e6198ca84f.js +0 -1
  156. package/web/.next/static/chunks/app/agents/[id]/page-c005161cec5527d8.js +0 -1
  157. package/web/.next/static/chunks/app/agents/page-9bb8cba69776c719.js +0 -1
  158. package/web/.next/static/chunks/app/layout-49b46c9b5aa512a8.js +0 -1
  159. package/web/.next/static/chunks/app/page-da042d146caeeab6.js +0 -1
  160. package/web/.next/static/chunks/app/relations/page-a44fd515a3b0525e.js +0 -1
  161. package/web/.next/static/chunks/app/sessions/page-a7534ebd90e982d6.js +0 -1
  162. package/web/.next/static/chunks/app/types/page-ebd37e220f77c1f3.js +0 -1
  163. package/web/.next/static/css/d42799b7e6a0e8a2.css +0 -1
  164. /package/web/.next/static/{aSYzbHk1M5YeS_d3SQKTZ → UDA414PFPu9ZROltNmjbX}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[391],{494:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},2432:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]])},3492:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]])},4713:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("Paperclip",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]])},5503:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("MousePointerClick",[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]])},6673:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]])},7991:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).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"}]])},19431:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},20555:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]])},26701:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).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"}]])},29416:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]])},32219:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("FilePen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]])},32335:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("LockOpen",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]])},33691:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("UserPlus",[["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"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]])},34978:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("Container",[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]])},38950:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]])},47405:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},52263:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]])},52687:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]])},55267:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]])},55712:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]])},55838:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]])},62716:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]])},64883:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]])},66477:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]])},66654:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).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"}]])},66826:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]])},70283:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]])},71529:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]])},73784:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]])},73885:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("PlugZap",[["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m18 3-4 4h6l-4 4",key:"16psg9"}]])},77841:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]])},79141:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},79278:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]])},83372:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]])},84616:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]])},87454:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).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"}]])},89075:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).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"}]])},90124:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]])},91833:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]])},92720:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]])},92947:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},97356:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).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"}]])},97541:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("Waypoints",[["circle",{cx:"12",cy:"4.5",r:"2.5",key:"r5ysbb"}],["path",{d:"m10.2 6.3-3.9 3.9",key:"1nzqf6"}],["circle",{cx:"4.5",cy:"12",r:"2.5",key:"jydg6v"}],["path",{d:"M7 12h10",key:"b7w52i"}],["circle",{cx:"19.5",cy:"12",r:"2.5",key:"1piiel"}],["path",{d:"m13.8 17.7 3.9-3.9",key:"1wyg1y"}],["circle",{cx:"12",cy:"19.5",r:"2.5",key:"13o1pw"}]])},98148:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]])},98392:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("ArrowDownToLine",[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]])},98938:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]])},99579:(e,a,t)=>{t.d(a,{A:()=>y});let y=(0,t(74955).A)("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]])}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[517],{1517:(e,n,l)=>{l.d(n,{bC:()=>f,pU:()=>h,tJ:()=>p});var s=l(94799),r=l(34023),t=l(43624),i=l(10804),o=l(5300),a=l(48538),c=l(73506),d=l(3749),m=l(47890),u=l(69654);let p="default-objects",h="default-databases";function f(e){var n,l;let{onClose:f,onCreated:v,presetTypeId:b,presetColonyId:g,presetObjectId:j,manager:x=!1}=e,{t:k}=(0,u.s9)(),{types:y,agents:w,refresh:_,colonies:C,objects:N}=(0,a.q5)(),A=(0,i.dj)(),D=(0,t.useRouter)(),[S,E]=(0,r.useState)(b||x?"form":"type"),[q,z]=(0,r.useState)(()=>{var e;let n={...(0,o.WU)(y.find(e=>e.id===b)),colony_id:null!=g?g:null,object_ids:j?[j]:[]},l=(null==(e=N.find(e=>e.id===j))?void 0:e.kind)==="database"?h:p;return x?{...n,description:k(l===h?"obj.manager.description.db":"obj.manager.description"),permission:"acceptEdits",skill_ids:[...new Set([...n.skill_ids,l])],skill_loads:{...n.skill_loads,[l]:"always"}}:n}),[F,L]=(0,r.useState)(()=>JSON.stringify(q)),M=e=>{z(e),L(JSON.stringify(e)),E("form")},O=(0,r.useRef)(!1),T=JSON.stringify(q)!==F;(0,c.h)(T&&!O.current);let[P,R]=(0,r.useState)(!1),[U,K]=(0,r.useState)(!1),[H,B]=(0,r.useState)(!1),I=(0,o.tf)(q,w,void 0,C),W=async()=>{if(B(!0),!Object.keys(I).length){K(!0);try{let{object_ids:e,...n}=q,l=await d.FH.post("/agents",n);e.length&&await d.FH.put("/agents/".concat(l.id,"/resources"),{object_ids:e}).catch(e=>A(e instanceof Error?e.message:"","err")),await _(["agents","colonies","objects"]),A(k("newAgent.created",{name:l.name})),O.current=!0,null==v||v(l.id),f(),D.push("/agents/".concat(l.id))}catch(e){A(e instanceof Error?e.message:k("newAgent.failed"),"err"),K(!1)}}};return"type"===S?(0,s.jsx)(i._s,{title:k("newAgent.title"),subtitle:k("newAgent.pickType"),onClose:f,children:(0,s.jsxs)("div",{className:"col gap-m",children:[y.map(e=>(0,s.jsxs)("button",{className:"card card-pad row gap-l cx-typecard",onClick:()=>{M({...(0,o.WU)(e),colony_id:null!=g?g:null,object_ids:j?[j]:[]})},children:[(0,s.jsx)(i._h,{color:m.xq[e.provider].color,queen:"orchestrator"===e.role,label:e.name.slice(0,2).toUpperCase()}),(0,s.jsxs)("div",{className:"grow",children:[(0,s.jsx)("b",{className:"cx-pick-title",children:e.name}),(0,s.jsx)("div",{className:"muted small",children:e.description||k("newAgent.typeFallback",{role:k("role.".concat(e.role)),provider:m.xq[e.provider].label})})]}),(0,s.jsx)("span",{className:"chip",children:m.xq[e.provider].short})]},e.id)),(0,s.jsxs)("button",{className:"card card-pad row gap-l cx-typecard blank",onClick:()=>{M({...(0,o.WU)(),colony_id:null!=g?g:null,object_ids:j?[j]:[]})},children:[(0,s.jsx)(i._h,{color:"var(--muted)",label:"+"}),(0,s.jsxs)("div",{className:"grow",children:[(0,s.jsx)("b",{className:"cx-pick-title",children:k("newAgent.blank")}),(0,s.jsx)("div",{className:"muted small",children:k("newAgent.blankHint")})]})]})]})},"type"):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i._s,{title:k("newAgent.title"),subtitle:x?k("obj.manager.subtitle"):q.type_id?k("newAgent.fromType",{name:null!=(l=null==(n=y.find(e=>e.id===q.type_id))?void 0:n.name)?l:""}):k("newAgent.blank"),onClose:()=>{!T||O.current?f():R(!0)},footer:(0,s.jsxs)(s.Fragment,{children:[!b&&!x&&(0,s.jsx)("button",{className:"btn ghost",onClick:()=>E("type"),children:k("common.back")}),(0,s.jsx)("button",{className:"btn primary",disabled:U,onClick:W,children:U?k("newAgent.creating"):k("newAgent.create")})]}),children:(0,s.jsx)(o.SU,{draft:q,onChange:z,errors:H?I:{},focusName:!0})},"form"),P&&(0,s.jsx)(i.TM,{danger:!0,title:k("fa.unsaved.title"),body:k("fa.unsaved.body"),confirmLabel:k("fa.unsaved.discard"),cancelLabel:k("fa.unsaved.keep"),onClose:()=>R(!1),onConfirm:f})]})}},5300:(e,n,l)=>{l.d(n,{SU:()=>j,TN:()=>v,WU:()=>f,tf:()=>g});var s=l(94799),r=l(34023),t=l(12646),i=l(69654),o=l(56072),a=l(10804),c=l(48538),d=l(22214),m=l(47890),u=l(28941),p=l(7708),h=l(52974);let f=e=>{var n,l,s,r,t,i,o,a,c,d;return{name:"",description:null!=(n=null==e?void 0:e.description)?n:"",role:null!=(l=null==e?void 0:e.role)?l:"worker",provider:null!=(s=null==e?void 0:e.provider)?s:"claude",model:null!=(r=null==e?void 0:e.model)?r:"",effort:null!=(t=null==e?void 0:e.effort)?t:"",system_prompt:null!=(i=null==e?void 0:e.system_prompt)?i:"",permission:null!=(o=null==e?void 0:e.permission)?o:"acceptEdits",cwd:"",skill_ids:null!=(a=null==e?void 0:e.skill_ids)?a:[],skill_loads:null!=(c=null==e?void 0:e.skill_loads)?c:{},worker_ids:[],type_id:null!=(d=null==e?void 0:e.id)?d:null,colony_id:null,overrides:[],browser:!1,object_ids:[]}},v=function(e){var n;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return{name:e.name,description:e.description,role:e.role,provider:e.provider,model:e.model,effort:null!=(n=e.effort)?n:"",system_prompt:e.system_prompt,permission:e.permission,cwd:e.cwd,skill_ids:e.skill_ids,skill_loads:e.skill_loads,worker_ids:e.worker_ids,type_id:e.type_id,colony_id:e.colony_id,overrides:e.overrides,browser:e.browser,object_ids:l}},b=(e,n,l)=>!!n&&n.inherit[l]&&!e.overrides.includes(l);function g(e,n,l){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],r={};e.name.trim()?n.some(n=>n.id!==l&&n.name.toLowerCase()===e.name.trim().toLowerCase())&&(r.name=(0,i.Tl)("form.err.nameTaken")):r.name=(0,i.Tl)("form.err.name");let t=s.find(n=>n.id===e.colony_id);return e.cwd.trim()||b(e,t,"cwd")&&(null==t?void 0:t.cwd)||(r.cwd=(0,i.Tl)("form.err.folder")),r}function j(e){var n;let{draft:l,onChange:f,errors:v,selfId:g,showType:j=!0,focusName:k=!1}=e,{t:y}=(0,i.s9)(),{skills:w,providers:_,agents:C,types:N,colonies:A,connections:D,objects:S}=(0,c.q5)(),E=(0,r.useMemo)(()=>S.filter(e=>h.Gn.includes(e.kind)).map(e=>{var n,l,s,r;return{id:e.id,label:e.name,hint:e.manager_id&&e.manager_id!==g?y("form.resources.taken",{name:null!=(s=null==(n=C.find(n=>n.id===e.manager_id))?void 0:n.name)?s:""}):null!=(r=null==(l=A.find(n=>n.id===e.colony_id))?void 0:l.name)?r:y("common.noColony")}}),[S,C,A,g,y]),q=(0,r.useMemo)(()=>D.filter(e=>e.agent_id===g&&e.enabled),[D,g]),z=A.find(e=>e.id===l.colony_id),F=e=>b(l,z,e),L=(e,n)=>f({...l,overrides:n?l.overrides.filter(n=>n!==e):[...new Set([...l.overrides,e])]}),M=(e,n)=>f({...l,[e]:n}),O=(0,r.useMemo)(()=>C.filter(e=>e.id!==g&&"worker"===e.role),[C,g]),T=N.find(e=>e.id===l.type_id);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a.D0,{label:y("form.name"),error:v.name,hint:y("form.name.hint"),children:(0,s.jsx)("input",{className:"input",value:l.name,onChange:e=>M("name",e.target.value),placeholder:y("form.name.placeholder"),"data-autofocus":k?"":void 0})}),(0,s.jsx)(a.D0,{label:y("form.purpose"),hint:y("form.purpose.hint"),children:(0,s.jsx)("input",{className:"input",value:l.description,onChange:e=>M("description",e.target.value),placeholder:y("form.purpose.placeholder")})}),(0,s.jsxs)(a.D0,{label:y("form.role"),children:[(0,s.jsx)(a.$q,{value:l.role,onChange:e=>M("role",e),options:[{id:"worker",label:y("role.worker")},{id:"orchestrator",label:y("role.orchestrator")}]}),(0,s.jsx)("span",{className:"hint",children:"orchestrator"===l.role?y("form.role.orchestratorHint"):y("form.role.workerHint")})]}),j&&T&&(0,s.jsx)("p",{className:"hint m0",children:y("form.basedOn",{name:T.name})}),(0,s.jsx)(a.D0,{label:y("form.colony"),hint:y("form.colony.hint"),children:(0,s.jsxs)("select",{className:"select",value:null!=(n=l.colony_id)?n:"",onChange:e=>f({...l,colony_id:e.target.value||null,overrides:[]}),children:[(0,s.jsx)("option",{value:"",children:y("common.noColony")}),A.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name},e.id))]})}),(0,s.jsx)(a.D0,{label:y("form.provider"),children:(0,s.jsx)(a.YO,{value:l.provider,onChange:e=>f({...l,provider:e,model:"",effort:"",browser:"claude"===e&&l.browser}),providers:_})}),(0,s.jsx)(a.CD,{provider:l.provider,value:l.model,onChange:e=>M("model",e)}),(0,s.jsx)(a.xA,{provider:l.provider,model:l.model,value:l.effort,onChange:e=>M("effort",e)}),"claude"===l.provider&&(0,s.jsx)(p.Tl,{checked:l.browser,onChange:e=>M("browser",e),label:y("form.browser"),hint:y("form.browser.hint")}),z&&z.inherit.permission&&(0,s.jsx)(x,{colony:z,on:F("permission"),onChange:e=>L("permission",e),label:y("inherit.permissions"),value:(0,m.Ck)(z.permission)}),!F("permission")&&(0,s.jsx)(a.en,{value:l.permission,onChange:e=>M("permission",e),locked:q.length?["plan"]:[]}),q.length>0&&(0,s.jsxs)("p",{className:"hint m0",children:[(0,s.jsxs)("b",{children:[y("form.connections"),":"]})," ",y("form.connections.hint",{names:q.map(e=>e.name).join(", ")})]}),z&&z.inherit.cwd&&z.cwd&&(0,s.jsx)(x,{colony:z,on:F("cwd"),onChange:e=>L("cwd",e),label:y("field.folder"),value:(0,m._1)(z.cwd),mono:!0}),!(F("cwd")&&(null==z?void 0:z.cwd))&&(0,s.jsx)(a.dR,{value:l.cwd,onChange:e=>M("cwd",e),error:v.cwd}),z&&z.inherit.prompt&&z.system_prompt.trim()&&(0,s.jsx)(x,{colony:z,on:F("prompt"),onChange:e=>L("prompt",e),label:y("inherit.context"),value:"".concat(z.system_prompt.trim().slice(0,90)).concat(z.system_prompt.trim().length>90?"…":""),note:y("inherit.context.note")}),(0,s.jsx)(a.D0,{label:F("prompt")||(null==z?void 0:z.system_prompt)?y("form.ownPrompt"):y("form.systemPrompt"),hint:y("form.promptHint",{count:l.system_prompt.length,n:(0,o._E)(l.system_prompt.length)}),children:(0,s.jsx)(t.n,{value:l.system_prompt,onChange:e=>M("system_prompt",e),placeholder:y("form.prompt.placeholder"),defaultView:"write",minHeight:220})}),z&&z.inherit.skills&&z.skill_ids.length>0&&(0,s.jsx)(x,{colony:z,on:F("skills"),onChange:e=>L("skills",e),label:y("inherit.skills"),value:z.skill_ids.map(e=>{var n;return null==(n=w.find(n=>n.id===e))?void 0:n.name}).filter(Boolean).join(", "),note:y("inherit.skills.note")}),(0,s.jsx)(a.D0,{label:y("form.skills"),hint:y("form.skills.hint"),children:(0,s.jsx)(a.kV,{skills:w,value:l.skill_ids,loads:l.skill_loads,onChange:(e,n)=>f({...l,skill_ids:e,skill_loads:n})})}),E.length>0&&(0,s.jsx)(a.D0,{label:y("form.resources"),hint:y("form.resources.hint"),children:(0,s.jsx)(u.c,{multi:!0,options:E,value:l.object_ids,onChange:e=>f({...l,object_ids:e}),placeholder:y("form.resources.placeholder"),empty:y("form.resources.empty"),ariaLabel:y("form.resources")})}),"orchestrator"===l.role&&(0,s.jsx)(a.D0,{label:y("form.team"),hint:y("form.team.hint"),children:O.length?(0,s.jsx)(d.C,{items:O.map(e=>({id:e.id,name:e.name,note:e.description||e.provider})),value:l.worker_ids,onChange:e=>M("worker_ids",e)}):(0,s.jsx)("p",{className:"hint",children:y("form.team.empty")})})]})}function x(e){let{colony:n,on:l,onChange:r,label:t,value:o,note:a,mono:c}=e,{t:d}=(0,i.s9)();return(0,s.jsxs)("label",{className:"inherit-row ".concat(l?"on":""),children:[(0,s.jsx)("input",{type:"checkbox",checked:l,onChange:e=>r(e.target.checked)}),(0,s.jsxs)("span",{className:"grow",children:[(0,s.jsxs)("b",{children:[t," ",(0,s.jsx)("span",{className:"muted fw-500",children:d("inherit.from")})," ",(0,s.jsx)("i",{className:"cdot",style:{background:n.color||"var(--honey)"}}),n.name]}),(0,s.jsx)("span",{className:"inh-val ".concat(c?"mono":""),children:o||"—"}),a&&(0,s.jsx)("span",{className:"hint",children:a})]}),(0,s.jsx)("span",{className:"inh-state",children:d(l?"inherit.following":"inherit.own")})]})}},12646:(e,n,l)=>{l.d(n,{n:()=>_});var s=l(94799),r=l(34023),t=l(6458),i=l(53983),o=l(3492),a=l(98148),c=l(99579),d=l(55838),m=l(98938),u=l(52263),p=l(20555),h=l(91833),f=l(55712),v=l(71529),b=l(69654);function g(e,n,l,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:s,t=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"",i=e.slice(n,l)||t;return e.slice(n-s.length,n)===s&&e.slice(l,l+r.length)===r&&n!==l?{value:e.slice(0,n-s.length)+i+e.slice(l+r.length),start:n-s.length,end:l-s.length}:{value:e.slice(0,n)+s+i+r+e.slice(l),start:n+s.length,end:n+s.length+i.length}}function j(e,n,l,s,r){let t=e.lastIndexOf("\n",n-1)+1,i=e.indexOf("\n",l),o=-1===i?e.length:i,a=e.slice(t,o).split("\n"),c=a.every(e=>r.test(e)),d=a.map((e,n)=>c?e.replace(r,""):s(n)+e.replace(r,"")).join("\n");return{value:e.slice(0,t)+d+e.slice(o),start:t,end:t+d.length}}let x=/^\s*[-*+] (\[[ x]\] )?/,k=/^\s*\d+\. /,y=/^#{1,6} /,w=/^> ?/;function _(e){let{value:n,onChange:l,placeholder:_,defaultView:C="split",minHeight:N=340,fill:A=!1}=e,{t:D}=(0,b.s9)(),S=(0,r.useRef)(null),[E,q]=(0,r.useState)(C),z=e=>{let n=S.current;if(!n)return;let s=e(n.value,n.selectionStart,n.selectionEnd);l(s.value),requestAnimationFrame(()=>{n.focus(),n.setSelectionRange(s.start,s.end)})},F=[{id:"h",icon:(0,s.jsx)(o.A,{size:15}),label:D("md.heading"),run:()=>z((e,n,l)=>j(e,n,l,()=>"## ",y))},{id:"b",icon:(0,s.jsx)(a.A,{size:15}),label:D("md.bold"),keys:"B",run:()=>z((e,n,l)=>g(e,n,l,"**","**",D("md.boldPh")))},{id:"i",icon:(0,s.jsx)(c.A,{size:15}),label:D("md.italic"),keys:"I",run:()=>z((e,n,l)=>g(e,n,l,"*","*",D("md.italicPh")))},{id:"c",icon:(0,s.jsx)(d.A,{size:15}),label:D("md.code"),run:()=>z((e,n,l)=>g(e,n,l,"`","`","code"))},{id:"cb",icon:(0,s.jsx)(m.A,{size:15}),label:D("md.codeBlock"),run:()=>z((e,n,l)=>g(e,n,l,"\n```\n","\n```\n","code"))},{id:"ul",icon:(0,s.jsx)(u.A,{size:15}),label:D("md.bullets"),run:()=>z((e,n,l)=>j(e,n,l,()=>"- ",x))},{id:"ol",icon:(0,s.jsx)(p.A,{size:15}),label:D("md.numbered"),run:()=>z((e,n,l)=>j(e,n,l,e=>"".concat(e+1,". "),k))},{id:"q",icon:(0,s.jsx)(h.A,{size:15}),label:D("md.quote"),run:()=>z((e,n,l)=>j(e,n,l,()=>"> ",w))},{id:"l",icon:(0,s.jsx)(f.A,{size:15}),label:D("md.link"),keys:"K",run:()=>z((e,n,l)=>{let s=e.slice(n,l)||D("md.linkPh"),r="[".concat(s,"](https://)");return{value:e.slice(0,n)+r+e.slice(l),start:n+s.length+3,end:n+s.length+11}})},{id:"hr",icon:(0,s.jsx)(v.A,{size:15}),label:D("md.rule"),run:()=>z((e,n,l)=>({value:e.slice(0,n)+"\n\n---\n\n"+e.slice(l),start:n+7,end:n+7}))}],L=n.trim()?n.trim().split(/\s+/).length:0;return(0,s.jsxs)("div",{className:"mde".concat(A?" fill":""),children:[(0,s.jsxs)("div",{className:"mde-bar",role:"toolbar","aria-label":D("md.toolbar"),children:[F.map(e=>(0,s.jsx)("button",{type:"button",className:"mde-btn",title:e.keys?"".concat(e.label," (Ctrl+").concat(e.keys,")"):e.label,"aria-label":e.label,onMouseDown:e=>e.preventDefault(),onClick:e.run,disabled:"preview"===E,children:e.icon},e.id)),(0,s.jsx)("span",{className:"grow"}),(0,s.jsx)("div",{className:"mde-views",role:"group",children:["write","split","preview"].map(e=>(0,s.jsx)("button",{type:"button",className:E===e?"on":"","aria-pressed":E===e,onClick:()=>q(e),children:D("md.view.".concat(e))},e))})]}),(0,s.jsxs)("div",{className:"mde-body v-".concat(E),style:{minHeight:N},children:["preview"!==E&&(0,s.jsx)("textarea",{ref:S,className:"mde-text mono",style:{minHeight:N},value:n,onChange:e=>l(e.target.value),onKeyDown:e=>{let n=e.currentTarget;if(e.ctrlKey||e.metaKey){let n=F.find(n=>n.keys&&n.keys.toLowerCase()===e.key.toLowerCase());if(n){e.preventDefault(),n.run();return}}if("Tab"===e.key){e.preventDefault(),z((n,l,s)=>{if(l===s&&!e.shiftKey)return{value:n.slice(0,l)+" "+n.slice(s),start:l+2,end:l+2};let r=n.lastIndexOf("\n",l-1)+1,t=n.indexOf("\n",s),i=-1===t?n.length:t,o=n.slice(r,i).split("\n").map(n=>e.shiftKey?n.replace(/^ {1,2}/,""):" "+n).join("\n");return{value:n.slice(0,r)+o+n.slice(i),start:r,end:r+o.length}});return}if("Enter"===e.key&&!e.shiftKey&&n.selectionStart===n.selectionEnd){let s=n.value,r=n.selectionStart,t=s.lastIndexOf("\n",r-1)+1,i=s.slice(t,r),o=/^(\s*)([-*+] (?:\[[ x]\] )?|(\d+)\. )(.*)$/.exec(i);if(!o)return;if(e.preventDefault(),!o[4]){l(s.slice(0,t)+s.slice(r)),requestAnimationFrame(()=>n.setSelectionRange(t,t));return}let a=o[3]?"".concat(o[1]).concat(Number(o[3])+1,". "):o[1]+o[2].replace("[x]","[ ]");l(s.slice(0,r)+"\n"+a+s.slice(r)),requestAnimationFrame(()=>{let e=r+1+a.length;n.setSelectionRange(e,e)})}},placeholder:_,spellCheck:!1}),"write"!==E&&(0,s.jsx)("div",{className:"mde-prev md",children:(0,s.jsx)(t.oz,{remarkPlugins:[i.A],children:n||D("skills.previewEmpty")})})]}),(0,s.jsxs)("div",{className:"mde-foot muted",children:[D("md.stats",{words:L,chars:n.length})," \xb7 ",D("md.tips")]})]})}},22214:(e,n,l)=>{l.d(n,{C:()=>t});var s=l(94799),r=l(72705);function t(e){let{items:n,value:l,onChange:t}=e;return(0,s.jsx)("div",{className:"skillpick",children:n.map(e=>{let n=l.includes(e.id);return(0,s.jsxs)("button",{type:"button",className:"skillrow","aria-pressed":n,onClick:()=>t(n?l.filter(n=>n!==e.id):[...l,e.id]),children:[(0,s.jsx)("span",{className:"check",children:n&&(0,s.jsx)(r.A,{size:13,strokeWidth:3})}),(0,s.jsxs)("span",{children:[(0,s.jsx)("b",{className:"fw-600",children:e.name}),(0,s.jsx)("span",{className:"hint hint-block",children:e.note})]})]},e.id)})})}},28941:(e,n,l)=>{l.d(n,{c:()=>a});var s=l(94799),r=l(34023),t=l(70665),i=l(21018),o=l(48539);function a(e){let{options:n,value:l,onChange:a,multi:c=!1,inline:d=!1,placeholder:m,empty:u,ariaLabel:p,autoFocus:h=!1}=e,[f,v]=(0,r.useState)(""),[b,g]=(0,r.useState)(!1),[j,x]=(0,r.useState)(0),k=(0,r.useRef)(null),y=(0,r.useRef)(null);(0,i.s)(b,k,()=>g(!1));let w=l.map(e=>n.find(n=>n.id===e)).filter(e=>!!e),_=(0,r.useMemo)(()=>{let e=f.trim().toLowerCase();return n.filter(n=>{var s;return!l.includes(n.id)&&(!e||"".concat(n.label," ").concat(null!=(s=n.hint)?s:"").toLowerCase().includes(e))}).slice(0,50)},[n,l,f]);(0,r.useEffect)(()=>{x(0)},[f,b]);let C=e=>{var n;a(c?[...l,e.id]:[e.id]),v(""),g(c),c&&(null==(n=y.current)||n.focus())},N=e=>{a(l.filter(n=>n!==e)),requestAnimationFrame(()=>{var e;return null==(e=y.current)?void 0:e.focus()})},A=!c&&w.length>0,D=b&&!A&&(_.length>0||!!u),S=(0,o.B)(D,j,_.length);return(0,s.jsxs)("div",{className:"sg ps ".concat(d?"ps-inline":""),ref:k,children:[(0,s.jsxs)("div",{className:"ps-box input ".concat(b?"open":""),onClick:()=>{if(!A){var e;g(!0),null==(e=y.current)||e.focus()}},children:[w.map(e=>(0,s.jsxs)("span",{className:"chip ps-chip",children:[e.label,(0,s.jsx)("button",{type:"button",onClick:n=>{n.stopPropagation(),N(e.id)},"aria-label":"\xd7 ".concat(e.label),children:(0,s.jsx)(t.A,{size:12})})]},e.id)),!A&&(0,s.jsx)("input",{ref:y,className:"ps-input",value:f,placeholder:w.length?"":m,"aria-label":p,autoComplete:"off",spellCheck:!1,autoFocus:h,...S.input,onFocus:()=>g(!0),onChange:e=>{v(e.target.value),g(!0)},onKeyDown:e=>{"ArrowDown"===e.key?(e.preventDefault(),g(!0),x(e=>Math.min(_.length-1,e+1))):"ArrowUp"===e.key?(e.preventDefault(),x(e=>Math.max(0,e-1))):"Enter"===e.key&&b&&_[j]?(e.preventDefault(),C(_[j])):"Escape"===e.key&&b?(e.stopPropagation(),g(!1)):"Backspace"===e.key&&!f&&w.length&&N(w[w.length-1].id)}})]}),D&&(0,s.jsxs)("ul",{className:"sg-list",...S.listProps,children:[0===_.length&&(0,s.jsx)("li",{className:"sg-empty",children:u}),_.map((e,n)=>(0,s.jsx)("li",{...S.optionProps(n),children:(0,s.jsxs)("button",{type:"button",className:"sg-opt ".concat(n===j?"hi":""),onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>x(n),onClick:()=>C(e),children:[(0,s.jsx)("span",{className:"nm",children:e.label}),e.hint&&(0,s.jsx)("span",{className:"hint",children:e.hint})]})},e.id))]})]})}},52974:(e,n,l)=>{l.d(n,{Gn:()=>d,ID:()=>m,no:()=>c});var s=l(94799),r=l(34023),t=l(69654),i=l(48538),o=l(10804),a=l(28941);let c=["server","docker","cluster"],d=[...c,"database"];function m(e){let{value:n,onChange:l,kind:c}=e,{t:d}=(0,t.s9)(),{agents:m,colonies:u}=(0,i.o0)(),p=(0,r.useMemo)(()=>m.map(e=>{var n,l;return{id:e.id,label:e.name,hint:null!=(l=null==(n=u.find(n=>n.id===e.colony_id))?void 0:n.name)?l:d("common.noColony")}}),[m,u,d]);return(0,s.jsx)(o.D0,{label:d("obj.manager.label"),hint:"database"===c?n?d("obj.manager.hint.set.db"):d("obj.manager.hint.none.db"):n?d("obj.manager.hint.set"):d("obj.manager.hint.none"),children:(0,s.jsx)(a.c,{options:p,value:n?[n]:[],onChange:e=>{var n;return l(null!=(n=e[0])?n:"")},placeholder:d("obj.manager.placeholder"),empty:d("obj.manager.empty"),ariaLabel:d("obj.manager.label")})})}},73506:(e,n,l)=>{l.d(n,{h:()=>r});var s=l(34023);function r(e){(0,s.useEffect)(()=>{if(!e)return;let n=e=>{e.preventDefault(),e.returnValue=""};return window.addEventListener("beforeunload",n),()=>window.removeEventListener("beforeunload",n)},[e])}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[587],{9217:(e,l,t)=>{t.d(l,{Zp:()=>N,Bh:()=>C,Mr:()=>y,QJ:()=>g,qP:()=>k,Te:()=>S});var s=t(94799),a=t(52974),n=t(34023),r=t(89075),o=t(79141),i=t(10804),d=t(3749),c=t(84561),m=t(69654);let h=null;function u(e){let{template:l,values:t,onPick:a,onValue:r}=e,{t:o}=(0,m.s9)(),c=function(){let[e,l]=(0,n.useState)(h);return(0,n.useEffect)(()=>{h||d.FH.get("/object-templates").then(e=>{h=e,l(e)}).catch(()=>l([]))},[]),e}(),u=null==c?void 0:c.find(e=>e.id===l);return c?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"tpls",children:c.map(e=>(0,s.jsxs)("button",{type:"button",className:"tpl","aria-pressed":l===e.id,onClick:()=>a(e),children:[(0,s.jsx)("b",{children:e.name}),(0,s.jsx)("small",{children:e.description})]},e.id))}),u&&u.fields.map(e=>{var l;return(0,s.jsx)(i.D0,{label:e.label,children:(0,s.jsx)("input",{className:"input ".concat("text"===e.kind&&"version"!==e.key?"":"mono"),value:null!=(l=t[e.key])?l:"",onChange:l=>r(e.key,l.target.value),placeholder:e.default,inputMode:"port"===e.kind?"numeric":void 0})},"".concat(u.id,"-").concat(e.key))}),u&&(0,s.jsx)("p",{className:"muted small",style:{margin:0},children:o("tpl.note")})]}):(0,s.jsx)("p",{className:"muted small",style:{margin:0},children:o("git.loading")})}var p=t(48538),b=t(74988),j=t(13460),v=t(29867);let x=e=>void 0===e?"":String(e),g=(e,l,t)=>{var s,a,n,r,o,i,d,c,m,h,u,p,j,v,g,f,k,y,N,w,C,S,D,T,R,q,F,M,P,z,E,O,A,I,_,H,L,K,U,$;let B=(null==e?void 0:e.kind)==="server"?e.config:{},Q=(null==e?void 0:e.kind)==="docker"?e.config:{},V=(null==e?void 0:e.kind)==="http"?e.config:{},Z=(null==e?void 0:e.kind)==="cluster"?e.config:{},W=(null==e?void 0:e.kind)==="database"?e.config:{};return{manager:null!=(d=null==e?void 0:e.manager_id)?d:"",name:null!=(c=null==e?void 0:e.name)?c:"",colony_id:null!=(h=null!=(m=null==e?void 0:e.colony_id)?m:l)?h:"",kind:null!=(p=null!=(u=null==e?void 0:e.kind)?u:t)?p:"server",cwd:null!=(j=B.cwd)?j:"",start:null!=(v=B.start)?v:"",stop:null!=(g=B.stop)?g:"",port:x(B.port),env:(0,b.M6)((null==e?void 0:e.kind)==="server"?B.env:Q.env),restart:null!=(f=B.restart)?f:"no",maxRestarts:x(B.maxRestarts),healthKind:null!=(k=null==(s=B.health)?void 0:s.kind)?k:"",healthTarget:null!=(y=null==(a=B.health)?void 0:a.target)?y:"",healthInterval:x(null==(n=B.health)?void 0:n.intervalSec),healthTimeout:x(null==(r=B.health)?void 0:r.timeoutSec),healthRetries:x(null==(o=B.health)?void 0:o.retries),healthRestart:!!(null==(i=B.health)?void 0:i.restartWhenUnhealthy),stopTimeout:x((null==e?void 0:e.kind)==="server"?B.stopTimeoutSec:Q.stopTimeoutSec),logMax:x((null==e?void 0:e.kind)==="server"?B.logMaxMb:Q.logMaxMb),folder:null!=(N=V.folder)?N:"",defEnv:null!=(w=V.env)?w:"",variables:null!=(C=V.variables)?C:{},members:null!=(S=Z.members)?S:[],template:"",tplValues:{},mode:null!=(D=Q.mode)?D:e?"container":"template",image:null!=(T=Q.image)?T:"",ports:(null!=(R=Q.ports)?R:[]).join("\n"),volumes:(null!=(q=Q.volumes)?q:[]).join("\n"),dockerRestart:null!=(F=Q.restart)?F:"no",command:null!=(M=Q.command)?M:"",file:null!=(P=Q.file)?P:"",project:null!=(z=Q.project)?z:"",services:(null!=(E=Q.services)?E:[]).join(", "),container:null!=(O=Q.container)?O:"",memory:null!=(A=Q.memory)?A:"",cpus:x(Q.cpus),network:null!=(I=Q.network)?I:"",engine:null!=(_=W.engine)?_:"postgresql",dbHost:null!=(H=W.host)?H:"",dbPort:x(W.port),dbUser:null!=(L=W.user)?L:"",dbPassword:"",dbPasswordSet:!!W.passwordSet,dbName:null!=(K=W.database)?K:"",dbFile:null!=(U=W.file)?U:"",dbSsl:!!W.ssl,dbTrust:!!W.trustCert,dbReadOnly:!1!==W.readOnly,dbTimeout:x(W.timeoutSec),dbMaxRows:x(W.maxRows),dbProps:{...null!=($=W.props)?$:{}}}},f=e=>""===e.trim()?void 0:Number(e);function k(e){return"database"===e.kind?y(e):"http"===e.kind?{folder:e.folder.trim(),env:e.defEnv.trim()||void 0,variables:Object.keys(e.variables).length?e.variables:void 0}:"cluster"===e.kind?{members:e.members}:"server"===e.kind?{cwd:e.cwd.trim(),start:e.start.trim(),stop:e.stop.trim()||void 0,port:f(e.port),env:(0,b.y$)(e.env),restart:"no"===e.restart?void 0:e.restart,maxRestarts:f(e.maxRestarts),stopTimeoutSec:f(e.stopTimeout),logMaxMb:f(e.logMax),health:e.healthKind&&e.healthTarget.trim()?{kind:e.healthKind,target:e.healthTarget.trim(),intervalSec:f(e.healthInterval),timeoutSec:f(e.healthTimeout),retries:f(e.healthRetries),restartWhenUnhealthy:e.healthRestart||void 0}:void 0}:"template"===e.mode?{mode:"compose"}:"existing"===e.mode?{mode:"existing",container:e.container.trim(),stopTimeoutSec:f(e.stopTimeout)}:"compose"===e.mode?{mode:"compose",file:e.file.trim(),project:e.project.trim()||void 0,services:e.services.split(",").map(e=>e.trim()).filter(Boolean),stopTimeoutSec:f(e.stopTimeout)}:{mode:"container",image:e.image.trim(),ports:(0,b.Mn)(e.ports),volumes:(0,b.Mn)(e.volumes),env:(0,b.y$)(e.env),restart:e.dockerRestart||"no",command:e.command.trim()||void 0,memory:e.memory.trim()||void 0,cpus:f(e.cpus),network:e.network.trim()||void 0,stopTimeoutSec:f(e.stopTimeout),logMaxMb:f(e.logMax)}}let y=e=>{let l=Object.entries(e.dbProps).filter(l=>{let[t,s]=l;return""!==s.trim()&&(e.dbSsl||!t.startsWith("ssl."))}),t=l.length?Object.fromEntries(l):void 0;return"sqlite"===e.engine?{engine:"sqlite",file:e.dbFile.trim(),props:t,readOnly:e.dbReadOnly,timeoutSec:f(e.dbTimeout),maxRows:f(e.dbMaxRows)}:{engine:e.engine,host:e.dbHost.trim()||void 0,port:f(e.dbPort),user:e.dbUser.trim()||void 0,password:e.dbPassword,database:e.dbName.trim()||void 0,ssl:e.dbSsl||void 0,trustCert:!!e.dbSsl&&!!e.dbTrust||void 0,props:t,readOnly:e.dbReadOnly,timeoutSec:f(e.dbTimeout),maxRows:f(e.dbMaxRows)}},N=e=>{let{title:l,hint:t,wide:a=!1,children:n}=e;return(0,s.jsxs)("section",{className:"of-card ".concat(a?"wide":""),id:"of-".concat(l.toLowerCase().normalize("NFD").replace(/[^a-z0-9]+/g,"-")),"data-title":l,children:[(0,s.jsxs)("header",{children:[(0,s.jsx)("h4",{children:l}),t&&(0,s.jsx)("p",{className:"muted small",children:t})]}),n]})};function w(e){let{file:l,project:t,services:a,onServices:r,onProject:o}=e,{t:c}=(0,m.s9)(),{info:h,err:u,loading:p}=function(e){let[l,t]=(0,n.useState)(null),[s,a]=(0,n.useState)(""),[r,o]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{if(a(""),!/^\/.+\.ya?ml$/i.test(e))return void t(null);let l=!1;o(!0);let s=setTimeout(()=>d.FH.get("/docker/compose-services?file=".concat(encodeURIComponent(e))).then(e=>!l&&t(e)).catch(e=>{l||(t(null),a(e instanceof Error?e.message:""))}).finally(()=>!l&&o(!1)),300);return()=>{l=!0,clearTimeout(s)}},[e]),{info:l,err:s,loading:r}}(l),b=new Set(a.split(",").map(e=>e.trim()).filter(Boolean));return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.D0,{label:c("obj.f.services"),hint:c("dk.services.hint"),children:l?p?(0,s.jsx)("p",{className:"muted small res-m0",children:c("dk.services.loading")}):u?(0,s.jsx)("p",{className:"gx-note err res-m0",children:u}):h&&0===h.services.length?(0,s.jsx)("p",{className:"muted small res-m0",children:c("dk.services.none")}):h?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"chips",children:h.services.map(e=>(0,s.jsx)("button",{type:"button",className:"chip-pick ".concat(b.has(e)?"on":""),"aria-pressed":b.has(e),onClick:()=>(e=>{let l=new Set(b);l.has(e)?l.delete(e):l.add(e),r([...l].join(", "))})(e),children:e},e))}),"file"===h.source&&(0,s.jsx)("p",{className:"muted small res-mt6",children:c("dk.services.file")})]}):null:(0,s.jsx)("p",{className:"muted small res-m0",children:c("dk.services.pickFile")})}),(0,s.jsx)(i.D0,{label:c("obj.f.project"),hint:c("dk.project.hint"),children:(0,s.jsxs)("div",{className:"row gap-s",children:[(0,s.jsx)("input",{className:"input mono",value:t,onChange:e=>o(e.target.value),placeholder:null==h?void 0:h.project}),h&&!t&&(0,s.jsx)("button",{type:"button",className:"btn sm",onClick:()=>o(h.project),children:c("dk.project.use",{name:h.project})})]})})]})}function C(e){var l,t,h;let{d:x,set:g,setD:f,scan:k,showKind:y=!1,error:C,objectId:S}=e,{t:D}=(0,m.s9)(),{colonies:T,objects:R}=(0,p.o0)(),q=function(e){let[l,t]=(0,n.useState)(null),[s,a]=(0,n.useState)(null),[r,o]=(0,n.useState)(""),[i,c]=(0,n.useState)(0);return(0,n.useEffect)(()=>{if(!e)return;let l=!1;return d.FH.get("/docker/containers").then(e=>{var s;l||(t(e.containers),o(e.available?"":null!=(s=e.error)?s:"unavailable"))}).catch(()=>!l&&o("unavailable")),d.FH.get("/docker/images").then(e=>!l&&a(e.images)).catch(()=>void 0),()=>{l=!0}},[e,i]),{containers:l,images:s,error:r,reload:(0,n.useCallback)(()=>c(e=>e+1),[])}}("docker"===x.kind&&("existing"===x.mode||"container"===x.mode)),F=function(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,s.jsx)("input",{className:"input ".concat(l.mono?"mono":""),type:l.type,value:x[e],placeholder:l.placeholder,onChange:l=>g(e,l.target.value)})},M=q.error?(0,s.jsx)("p",{className:"muted small res-mt4",children:D("dk.unavailable",{error:q.error})}):null,P=(0,s.jsx)("button",{type:"button",className:"btn ghost icon sm",onClick:q.reload,"aria-label":D("dk.refresh"),title:D("dk.refresh"),children:(0,s.jsx)(r.A,{size:14})}),z=k?Object.keys(k.fileVars).filter(e=>"$shared"!==e):void 0,E=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.dR,{value:x.folder,onChange:e=>g("folder",e),label:D("obj.f.httpFolder"),hint:D("obj.f.httpFolder.hint")}),(0,s.jsx)(i.D0,{label:D("obj.f.defaultEnv"),hint:D("obj.f.defaultEnv.hint"),children:(0,s.jsx)(c.b,{value:x.defEnv,onChange:e=>g("defEnv",e),mono:!0,placeholder:"dev",options:[...new Set([...null!=(l=null==k?void 0:k.environments)?l:[],...Object.keys(x.variables).filter(e=>"$shared"!==e)])].map(e=>({value:e}))})})]});return(0,s.jsxs)("div",{className:"of",children:[y&&(0,s.jsx)(N,{title:D("obj.kind.pick"),wide:!0,children:(0,s.jsx)("div",{className:"okinds",children:["server","docker","http","database","cluster"].map(e=>{let{icon:l,color:t}=b.Nd[e];return(0,s.jsxs)("button",{type:"button",className:"okind","aria-pressed":x.kind===e,style:{"--c":t},onClick:()=>g("kind",e),children:[(0,s.jsx)(l,{size:20}),(0,s.jsx)("b",{children:D("obj.kind.".concat(e))}),(0,s.jsx)("small",{children:D("obj.kind.".concat(e,".hint"))})]},e)})})}),(0,s.jsxs)(N,{title:D("of.general"),children:[(0,s.jsx)(i.D0,{label:D("obj.f.name"),error:C,children:F("name",{placeholder:"database"===x.kind?(0,v.I5)(x):void 0})}),(0,s.jsx)(i.D0,{label:D("obj.colony"),children:(0,s.jsxs)("select",{className:"select",value:x.colony_id,onChange:e=>f(l=>({...l,colony_id:e.target.value,members:[]})),children:[(0,s.jsx)("option",{value:"",children:D("obj.noColony")}),T.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name},e.id))]})}),a.Gn.includes(x.kind)&&(0,s.jsx)(a.ID,{kind:x.kind,value:x.manager,onChange:e=>g("manager",e)}),"http"===x.kind&&!y&&E]}),"http"===x.kind?(0,s.jsxs)(s.Fragment,{children:[y&&(0,s.jsx)(N,{title:D("of.files"),children:E}),y&&(0,s.jsx)(N,{title:D("of.vars"),wide:!0,children:(0,s.jsx)(j.W,{value:x.variables,onChange:e=>g("variables",e),fileEnvs:z,fileVars:null==k?void 0:k.fileVars,used:null==k?void 0:k.used,fileDefined:null==k?void 0:k.fileDefined,setBy:null==k?void 0:k.setBy})})]}):"database"===x.kind?(0,s.jsx)(v.dN,{d:x,set:g,setD:f,objectId:S,creating:y}):"cluster"===x.kind?(0,s.jsx)(N,{title:D("of.members"),hint:D("obj.f.members.hint"),children:(()=>{let e=R.filter(e=>{var l;return("server"===e.kind||"docker"===e.kind)&&(null!=(l=e.colony_id)?l:"")===x.colony_id});return e.length?(0,s.jsx)("div",{className:"omembers",children:e.map(e=>{let{icon:l,color:t}=b.Nd[e.kind],a=x.members.indexOf(e.id);return(0,s.jsxs)("label",{className:"omember",children:[(0,s.jsx)("input",{type:"checkbox",checked:a>=0,onChange:()=>{let l;return l=e.id,g("members",x.members.includes(l)?x.members.filter(e=>e!==l):[...x.members,l])}}),(0,s.jsx)(l,{size:15,style:{color:t}}),(0,s.jsx)("span",{className:"nm",children:e.name}),a>=0&&(0,s.jsx)("span",{className:"ord",children:a+1})]},e.id)})}):(0,s.jsx)("p",{className:"muted small res-m0",children:D("obj.f.members.none")})})()}):"server"===x.kind?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(N,{title:D("of.run"),children:[(0,s.jsx)(i.dR,{value:x.cwd,onChange:e=>g("cwd",e),label:D("obj.f.folder"),hint:D("obj.f.folder.hint")}),(0,s.jsx)(i.D0,{label:D("obj.f.start"),hint:D("obj.f.start.hint"),children:F("start",{placeholder:"npm run dev",mono:!0})}),(0,s.jsx)(i.D0,{label:D("obj.f.stop"),hint:D("obj.f.stop.hint"),children:F("stop",{mono:!0})}),(0,s.jsx)(i.D0,{label:D("obj.f.port"),hint:D("obj.f.port.hint"),children:F("port",{placeholder:"3000"})})]}),(0,s.jsx)(N,{title:D("of.env"),children:(0,s.jsx)(i.D0,{label:D("obj.f.env"),hint:D("obj.f.env.hint"),children:(0,s.jsx)("textarea",{className:"textarea mono",rows:5,value:x.env,onChange:e=>g("env",e.target.value)})})}),(0,s.jsxs)(N,{title:D("obj.sup.crash"),hint:D("obj.sup.note"),children:[(0,s.jsx)(i.D0,{label:D("obj.sup.restart"),hint:D("obj.sup.restart.hint"),children:(0,s.jsxs)("div",{className:"row gap-s",children:[(0,s.jsxs)("select",{className:"select",value:x.restart,onChange:e=>g("restart",e.target.value),children:[(0,s.jsx)("option",{value:"no",children:D("obj.sup.restart.no")}),(0,s.jsx)("option",{value:"on-failure",children:D("obj.sup.restart.fail")}),(0,s.jsx)("option",{value:"always",children:D("obj.sup.restart.always")})]}),("no"!==x.restart||x.healthRestart)&&(0,s.jsx)("input",{className:"input res-mw130",value:x.maxRestarts,placeholder:D("obj.sup.max"),onChange:e=>g("maxRestarts",e.target.value),title:D("obj.sup.max.hint"),"aria-label":D("obj.sup.max")})]})}),(0,s.jsxs)("details",{className:"fold of-fold",children:[(0,s.jsxs)("summary",{children:[D("obj.sup.more"),(0,s.jsx)(o.A,{size:15,className:"chev","aria-hidden":!0})]}),(0,s.jsxs)("div",{className:"of-grid2",children:[(0,s.jsx)(i.D0,{label:D("obj.sup.stopTimeout"),hint:D("obj.sup.stopTimeout.hint"),children:F("stopTimeout",{placeholder:"8"})}),(0,s.jsx)(i.D0,{label:D("obj.sup.logMax"),hint:D("obj.sup.logMax.hint"),children:F("logMax",{placeholder:"5"})})]})]})]}),(0,s.jsxs)(N,{title:D("obj.sup.health"),hint:D("obj.sup.health.hint"),children:[(0,s.jsx)(i.D0,{label:D("obj.sup.health.how"),children:(0,s.jsxs)("div",{className:"row gap-s",children:[(0,s.jsxs)("select",{className:"select res-mw170",value:x.healthKind,onChange:e=>g("healthKind",e.target.value),children:[(0,s.jsx)("option",{value:"",children:D("obj.sup.health.none")}),(0,s.jsx)("option",{value:"http",children:"HTTP"}),(0,s.jsx)("option",{value:"tcp",children:D("obj.sup.health.tcp")}),(0,s.jsx)("option",{value:"command",children:D("obj.sup.health.command")})]}),x.healthKind&&(0,s.jsx)("input",{className:"input mono grow",value:x.healthTarget,onChange:e=>g("healthTarget",e.target.value),placeholder:"http"===x.healthKind?"http://127.0.0.1:3000/health":"tcp"===x.healthKind?"3000":"curl -fs localhost:3000","aria-label":D("obj.sup.health")})]})}),x.healthKind&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.Tl,{checked:x.healthRestart,onChange:e=>g("healthRestart",e),label:D("obj.sup.healthRestart")}),(0,s.jsx)("p",{className:"hint hint-block",children:(()=>{let e=Number(x.healthInterval)||15,l=Number(x.healthRetries)||3,t=Number(x.maxRestarts)||5;return D(x.healthRestart?"obj.sup.health.sumRestart":"obj.sup.health.sum",{a1:String(e),a2:String(l),a3:String(e*l),a4:String(t)})})()}),(0,s.jsxs)("details",{className:"fold of-fold",children:[(0,s.jsxs)("summary",{children:[D("obj.sup.timing"),(0,s.jsx)(o.A,{size:15,className:"chev","aria-hidden":!0})]}),(0,s.jsxs)("div",{className:"of-grid3",children:[(0,s.jsx)(i.D0,{label:D("obj.sup.interval"),hint:D("obj.sup.interval.hint"),children:F("healthInterval",{placeholder:"15"})}),(0,s.jsx)(i.D0,{label:D("obj.sup.timeout"),hint:D("obj.sup.timeout.hint"),children:F("healthTimeout",{placeholder:"5"})}),(0,s.jsx)(i.D0,{label:D("obj.sup.retries"),hint:D("obj.sup.retries.hint"),children:F("healthRetries",{placeholder:"3"})})]})]})]})]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(N,{title:D("obj.f.mode"),children:(0,s.jsx)(i.$q,{value:x.mode,onChange:e=>g("mode",e),options:[...y?[{id:"template",label:D("obj.mode.template")}]:[],{id:"container",label:D("obj.mode.container")},{id:"compose",label:D("obj.mode.compose")},{id:"existing",label:D("obj.mode.existing")}]})}),"template"===x.mode&&(0,s.jsx)(N,{title:D("obj.mode.template"),hint:D("tpl.hint"),children:(0,s.jsx)(u,{template:x.template,values:x.tplValues,onPick:e=>f(l=>({...l,template:e.id,tplValues:Object.fromEntries(e.fields.map(e=>[e.key,e.default])),name:l.name.trim()?l.name:e.name})),onValue:(e,l)=>f(t=>({...t,tplValues:{...t.tplValues,[e]:l}}))})}),"container"===x.mode&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(N,{title:D("of.image"),children:[(0,s.jsxs)(i.D0,{label:D("obj.f.image"),children:[(0,s.jsxs)("div",{className:"row gap-s",children:[(0,s.jsx)("div",{className:"grow",children:(0,s.jsx)(c.b,{value:x.image,onChange:e=>g("image",e),mono:!0,placeholder:D("dk.pickImage"),ariaLabel:D("obj.f.image"),options:(null!=(t=q.images)?t:[]).map(e=>({value:e.ref,hint:"".concat(e.size).concat(e.created?" \xb7 ".concat(e.created):"")}))})}),P]}),M]}),(0,s.jsx)(i.D0,{label:D("obj.f.ports"),hint:D("obj.f.ports.hint"),children:(0,s.jsx)("textarea",{className:"textarea mono",rows:2,value:x.ports,onChange:e=>g("ports",e.target.value),placeholder:"8080:80"})}),(0,s.jsxs)(i.D0,{label:D("obj.f.volumes"),hint:D("obj.f.volumes.hint"),children:[(0,s.jsx)("textarea",{className:"textarea mono",rows:2,value:x.volumes,onChange:e=>g("volumes",e.target.value)}),(0,s.jsx)(i.yQ,{bare:!0,value:"",buttonLabel:D("obj.f.volumes.add"),onChange:e=>g("volumes","".concat(x.volumes.trimEnd()).concat(x.volumes.trim()?"\n":"").concat(e,":/data"))})]})]}),(0,s.jsxs)(N,{title:D("of.env"),children:[(0,s.jsx)(i.D0,{label:D("obj.f.env"),hint:D("obj.f.env.hint"),children:(0,s.jsx)("textarea",{className:"textarea mono",rows:4,value:x.env,onChange:e=>g("env",e.target.value)})}),(0,s.jsx)(i.D0,{label:D("obj.f.restart"),children:(0,s.jsx)("select",{className:"select",value:x.dockerRestart,onChange:e=>g("dockerRestart",e.target.value),children:["no","always","unless-stopped","on-failure"].map(e=>(0,s.jsx)("option",{value:e,children:e},e))})}),(0,s.jsx)(i.D0,{label:D("obj.f.command"),children:F("command",{mono:!0})})]}),(0,s.jsx)(N,{title:D("of.limits"),hint:D("obj.dk.limits.hint"),children:(0,s.jsxs)("div",{className:"of-grid2",children:[(0,s.jsx)(i.D0,{label:D("obj.dk.memory"),children:F("memory",{placeholder:"512m"})}),(0,s.jsx)(i.D0,{label:D("obj.dk.cpus"),children:F("cpus",{placeholder:"1.5"})}),(0,s.jsx)(i.D0,{label:D("obj.dk.network"),children:F("network",{placeholder:"bridge"})}),(0,s.jsx)(i.D0,{label:D("obj.sup.stopTimeout"),children:F("stopTimeout",{placeholder:"10"})}),(0,s.jsx)(i.D0,{label:D("obj.sup.logMax"),children:F("logMax",{placeholder:"10"})})]})})]}),"compose"===x.mode&&(0,s.jsxs)(N,{title:D("obj.mode.compose"),children:[(0,s.jsx)(i.yQ,{mode:"file",exts:["yml","yaml"],value:x.file,onChange:e=>g("file",e),label:D("obj.f.file"),hint:D("obj.f.file.hint"),placeholder:"/home/you/app/docker-compose.yml"}),(0,s.jsx)(w,{file:x.file,project:x.project,services:x.services,onServices:e=>g("services",e),onProject:e=>g("project",e)}),(0,s.jsx)(i.D0,{label:D("obj.sup.stopTimeout"),hint:D("obj.sup.stopTimeout.hint"),children:F("stopTimeout",{placeholder:"10"})})]}),"existing"===x.mode&&(0,s.jsxs)(N,{title:D("obj.mode.existing"),children:[(0,s.jsxs)(i.D0,{label:D("obj.f.container"),hint:D("obj.f.container.hint"),children:[(0,s.jsxs)("div",{className:"row gap-s",children:[(0,s.jsx)("div",{className:"grow",children:(0,s.jsx)(c.b,{value:x.container,onChange:e=>g("container",e),mono:!0,placeholder:D("dk.pickContainer"),ariaLabel:D("obj.f.container"),options:(null!=(h=q.containers)?h:[]).map(e=>({value:e.name,hint:"".concat(e.image," \xb7 ").concat(e.state).concat(e.managed?" \xb7 ".concat(D("dk.managed")):"")}))})}),P]}),M]}),(0,s.jsx)(i.D0,{label:D("obj.sup.stopTimeout"),hint:D("obj.sup.stopTimeout.hint"),children:F("stopTimeout",{placeholder:"10"})})]})]})]})}function S(e){let[l,t]=(0,n.useState)(e);return{d:l,setD:t,set:(e,l)=>t(t=>({...t,[e]:l}))}}},13460:(e,l,t)=>{t.d(l,{W:()=>b});var s=t(94799),a=t(34023),n=t(92947),r=t(2432),o=t(58960),i=t(7168),d=t(97356),c=t(70665),m=t(37165),h=t(69654),u=t(84561);let p="$shared";function b(e){var l,t,b;let{value:j,onChange:v,fileEnvs:x=[],fileVars:g={},used:f=[],fileDefined:k=[],setBy:y={}}=e,{t:N}=(0,h.s9)(),w=[p,...[...new Set([...Object.keys(j),...x])].filter(e=>e!==p).sort()],[C,S]=(0,a.useState)(()=>{var e;return null!=(e=w.find(e=>{var l;return e!==p&&Object.keys(null!=(l=j[e])?l:{}).length>0}))?e:w[0]}),[D,T]=(0,a.useState)(""),[R,q]=(0,a.useState)({}),F=null!=(l=j[C])?l:{},M=new Set([...C!==p&&null!=(t=g[p])?t:[],...null!=(b=g[C])?b:[]]),P=f.filter(e=>!(e.name in F)).map(e=>({value:e.name,hint:N("vars.used.count",{count:e.count})})),z=(e,l,t)=>{if(void 0!==t&&t!==e&&t in F)return;let s=Object.entries(F).map(s=>{let[a,n]=s;return a===e?[null!=t?t:a,{...n,...l}]:[a,n]});v({...j,[C]:Object.fromEntries(s)})},E=()=>{let e=D.trim();!/^[\w.$-]{1,60}$/.test(e)||e in j||e===p||(v({...j,[e]:{}}),S(e),T(""))};return(0,s.jsxs)("div",{className:"vars",children:[(0,s.jsxs)("div",{className:"row gap-s",children:[(0,s.jsx)("b",{children:N("ow.tab.vars")}),(0,s.jsxs)(m.B,{size:"sm",label:N("common.help"),title:N("vars.how.title"),children:[(0,s.jsx)("p",{children:N("vars.hint")}),(0,s.jsx)("p",{children:N("vars.how.1")}),(0,s.jsx)("p",{children:N("vars.how.2")}),(0,s.jsx)("p",{children:N("vars.note")})]})]}),(0,s.jsxs)("div",{className:"vars-envs",role:"tablist",children:[w.map(e=>(0,s.jsxs)("button",{type:"button",role:"tab","aria-selected":C===e,className:"vars-env ".concat(C===e?"on":""),onClick:()=>S(e),title:e===p?N("vars.all.hint"):void 0,children:[e===p?N("vars.all"):e,x.includes(e)&&(0,s.jsx)("i",{className:"vars-file",title:N("vars.fromFile"),children:"\xb7"})]},e)),(0,s.jsxs)("span",{className:"vars-add",children:[(0,s.jsx)("input",{className:"input",placeholder:N("vars.newEnv"),value:D,onChange:e=>T(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),E())},"aria-label":N("vars.newEnv")}),(0,s.jsx)("button",{type:"button",className:"btn ghost icon sm",onClick:E,disabled:!D.trim(),"aria-label":N("vars.newEnv"),children:(0,s.jsx)(n.A,{size:14})})]})]}),(0,s.jsx)("p",{className:"muted small vars-scope",children:C===p?N("vars.scope.all"):N("vars.scope.env",{env:C})}),(0,s.jsxs)("div",{className:"vars-table",children:[0===Object.keys(F).length&&(0,s.jsx)("p",{className:"muted small",style:{margin:"4px 2px"},children:N("vars.empty")}),Object.entries(F).map((e,l)=>{let[t,a]=e,n="".concat(C,"/").concat(l),c=a.secret&&!R[n];return(0,s.jsxs)("div",{className:"vars-row",children:[(0,s.jsx)(u.b,{value:t,onChange:e=>z(t,{},e.trim()),options:P,mono:!0,placeholder:N("vars.name"),ariaLabel:N("vars.name")}),(0,s.jsx)("input",{className:"input mono",type:c?"password":"text",value:a.value,onChange:e=>z(t,{value:e.target.value}),"aria-label":N("vars.value"),placeholder:a.secret&&a.set&&!a.value?N("vars.saved"):N("vars.value"),autoComplete:"off"}),(0,s.jsx)("button",{type:"button",className:"btn ghost icon sm ".concat(a.secret?"on":""),"aria-pressed":!!a.secret,onClick:()=>z(t,{secret:!a.secret}),"aria-label":N("vars.secret"),title:N("vars.secret.hint"),children:(0,s.jsx)(r.A,{size:14})}),a.secret?(0,s.jsx)("button",{type:"button",className:"btn ghost icon sm",onClick:()=>q(e=>({...e,[n]:!e[n]})),"aria-label":N("vars.show"),title:N("vars.show"),children:R[n]?(0,s.jsx)(o.A,{size:14}):(0,s.jsx)(i.A,{size:14})}):(0,s.jsx)("span",{}),(0,s.jsx)("button",{type:"button",className:"btn ghost icon sm",onClick:()=>(e=>{let l={...F};delete l[e],v({...j,[C]:l})})(t),"aria-label":N("common.delete"),children:(0,s.jsx)(d.A,{size:14})}),M.has(t)&&(0,s.jsx)("span",{className:"vars-note",children:N("vars.overridden")})]},"".concat(C,":").concat(l))})]}),(0,s.jsxs)("div",{className:"row gap-s",children:[(0,s.jsxs)("button",{type:"button",className:"btn sm",onClick:()=>(e=>{let l=null!=e?e:"name",t=1;for(;l in F;)l="".concat(null!=e?e:"name").concat(++t);v({...j,[C]:{...F,[l]:{value:""}}})})(),children:[(0,s.jsx)(n.A,{size:14}),N("vars.add")]}),C!==p&&!x.includes(C)&&(0,s.jsxs)("button",{type:"button",className:"btn ghost sm",onClick:()=>{let e={...j};delete e[C],v(e),S(p)},children:[(0,s.jsx)(c.A,{size:14}),N("vars.delEnv")]})]})]})}},29867:(e,l,t)=>{t.d(l,{dN:()=>M,I5:()=>F});var s=t(94799),a=t(66843),n=t(34023),r=t(59959),o=t(73885),i=t(74955);let d=(0,i.A)("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),c=(0,i.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"}]]);var m=t(66826),h=t(55712),u=t(79141),p=t(3749),b=t(10804),j=t(69654);let v=null;function x(){let[e,l]=(0,n.useState)(null);return(0,n.useEffect)(()=>{let e=!0;return null!=v||(v=p.FH.get("/object-db/props").catch(e=>{throw v=null,e})),v.then(t=>{e&&l(t)}).catch(()=>void 0),()=>{e=!1}},[]),e}var g=t(9217),f=t(70665),k=t(92947);let y=["session","network","ssl","advanced"];function N(e){let{def:l,value:t,onChange:a}=e;return"boolean"===l.type?(0,s.jsxs)("select",{className:"select",value:t,onChange:e=>a(e.target.value),"aria-label":l.name,children:[(0,s.jsx)("option",{value:"true",children:"true"}),(0,s.jsx)("option",{value:"false",children:"false"})]}):"choice"===l.type?(0,s.jsxs)("select",{className:"select",value:t,onChange:e=>a(e.target.value),"aria-label":l.name,children:[!t&&(0,s.jsx)("option",{value:""}),l.choices.map(e=>(0,s.jsx)("option",{value:e,children:e},e))]}):(0,s.jsx)("input",{className:"input mono",type:"number"===l.type?"number":"text",min:l.min,max:l.max,value:t,placeholder:l.placeholder,autoComplete:"off",onChange:e=>a(e.target.value),"aria-label":l.name})}function w(e){let{engine:l,value:t,onChange:a,groups:n=y,exclude:r=[],quiet:o=!1}=e,{t:i,locale:d}=(0,j.s9)(),c=x();if(!c)return(0,s.jsx)("p",{className:"muted small",style:{margin:0},children:i("dp.loading")});let m=c[l].filter(e=>n.includes(e.group)&&!r.includes(e.name)),h=m.filter(e=>e.name in t),u=m.filter(e=>!(e.name in t));return(0,s.jsxs)("div",{className:"dprops",children:[0===h.length&&!o&&(0,s.jsx)("p",{className:"muted small",style:{margin:0},children:i("dp.none")}),h.map(e=>(0,s.jsxs)("div",{className:"dprop",children:[(0,s.jsxs)("div",{className:"dprop-row",children:[(0,s.jsx)("code",{className:"dprop-name",children:e.name}),(0,s.jsx)("div",{className:"dprop-val",children:(0,s.jsx)(N,{def:e,value:t[e.name],onChange:l=>a({...t,[e.name]:l})})}),(0,s.jsx)("button",{type:"button",className:"btn ghost icon sm",onClick:()=>{let{[e.name]:l,...s}=t;a(s)},"aria-label":i("dp.remove",{name:e.name}),title:i("dp.remove",{name:e.name}),children:(0,s.jsx)(f.A,{size:14})})]}),(0,s.jsx)("p",{className:"muted small dprop-desc",children:"es"===d?e.es:e.desc})]},e.name)),u.length>0&&(0,s.jsxs)("div",{className:"dprop-add",children:[(0,s.jsx)(k.A,{size:14,className:"muted"}),(0,s.jsxs)("select",{className:"select",value:"","aria-label":i("dp.add"),onChange:e=>{let l=m.find(l=>l.name===e.target.value);l&&a({...t,[l.name]:"boolean"===l.type?"true":"choice"===l.type?l.choices[0]:""})},children:[(0,s.jsx)("option",{value:"",children:i("dp.add")}),y.filter(e=>u.some(l=>l.group===e)).map(e=>(0,s.jsx)("optgroup",{label:i("dp.group.".concat(e)),children:u.filter(l=>l.group===e).map(e=>(0,s.jsx)("option",{value:e.name,children:e.name},e.name))},e))]})]})]})}let C={postgres:"postgresql",postgresql:"postgresql",mysql:"mysql",mariadb:"mysql",mssql:"mssql",sqlserver:"mssql",sqlite:"sqlite",file:"sqlite"};function S(e){let l,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],s=e.trim(),a=/^(?:jdbc:)?([a-z][a-z0-9+.-]*):/i.exec(s),n=a?C[a[1].toLowerCase()]:void 0;if(!n)return null;let r={engine:n,host:"",port:"",user:"",password:"",database:"",file:"",ssl:!1,trust:!1,props:{}};if("sqlite"===n){let e=s.replace(/^(?:jdbc:)?(?:sqlite|file):(?:\/\/)?/i,"").split("?")[0],l=decodeURIComponent(e.startsWith("/")?e:"/".concat(e));return l.length>1?{...r,file:l}:null}try{l=new URL(s.replace(/^jdbc:/i,"").replace(/^[a-z][a-z0-9+.-]*:/i,"http:"))}catch(e){return null}r.host=l.hostname,r.port=l.port,r.user=decodeURIComponent(l.username),r.password=decodeURIComponent(l.password),r.database=decodeURIComponent(l.pathname.replace(/^\//,""));let o=new Map(t.map(e=>[e.name.toLowerCase(),e]));return l.searchParams.forEach((e,l)=>{let t=l.toLowerCase(),s=e.toLowerCase();if("sslmode"===t||"ssl"===t||"encrypt"===t||"tls"===t)r.ssl=!["disable","disabled","false","no","0","allow","prefer"].includes(s)&&""!==s,r.trust=r.ssl&&["require","required","preferred"].includes(s);else if("trustservercertificate"===t)r.trust="true"===s;else{let l=o.get(t);l&&!l.name.startsWith("ssl.")&&(r.props[l.name]=e)}}),r}let D={mysql:{label:"MySQL / MariaDB",port:3306,color:"#00758f",sample:"mysql://user:password@localhost:3306/app"},postgresql:{label:"PostgreSQL",port:5432,color:"#4a7fb5",sample:"postgresql://user:password@localhost:5432/app?sslmode=require"},sqlite:{label:"SQLite",port:0,color:"#0f80cc",sample:"sqlite:///home/you/app/data.db"},mssql:{label:"SQL Server",port:1433,color:"#cc2927",sample:"mssql://sa:password@localhost:1433/master"}},T=Object.keys(D),R=["ssl.ca","ssl.cert","ssl.key"],q={"ssl.ca":"db.ssl.ca","ssl.cert":"db.ssl.cert","ssl.key":"db.ssl.key"};function F(e){var l;let t="sqlite"===e.engine?null==(l=e.dbFile.split("/").pop())?void 0:l.replace(/\.[^.]+$/,""):e.dbName.trim()||e.dbHost.trim();return t?"".concat(t," \xb7 ").concat(D[e.engine].label.split(" ")[0]):""}function M(e){let{d:l,set:t,setD:i,objectId:v,creating:f=!1}=e,{t:k,locale:y}=(0,j.s9)(),N=x(),[C,F]=(0,n.useState)({state:"idle"}),[M,P]=(0,n.useState)(""),[z,E]=(0,n.useState)(""),O="sqlite"===l.engine,A=function(e){var a;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(0,s.jsx)("input",{className:"input ".concat(n.mono?"mono":""),type:n.type,value:l[e],placeholder:n.placeholder,autoComplete:null!=(a=n.auto)?a:"off",onChange:l=>t(e,l.target.value)})},I=e=>{e!==l.engine&&(i(l=>({...l,engine:e,dbProps:{},dbSsl:!1,dbTrust:!1})),F({state:"idle"}))},_=async()=>{F({state:"busy"});try{let e=await p.FH.post("/object-db/test",{id:v,config:(0,g.Mr)(l)});F({state:"ok",text:"".concat(e.version," \xb7 ").concat(e.ms," ms")})}catch(e){F({state:"err",text:e instanceof Error?e.message:""})}},H=()=>{var e,t;let s=S(M,null==N?void 0:N[null!=(t=null==(e=S(M))?void 0:e.engine)?t:l.engine]);if(!s)return void E(k("db.url.bad"));E(""),F({state:"idle"}),i(e=>({...e,engine:s.engine,dbHost:s.host,dbPort:s.port,dbUser:s.user,dbPassword:s.password,dbName:s.database,dbFile:s.file,dbSsl:s.ssl,dbTrust:s.trust,dbProps:s.props})),P("")},L=(0,s.jsxs)(s.Fragment,{children:[O?(0,s.jsx)(b.yQ,{mode:"file",exts:["db","sqlite","sqlite3","db3"],value:l.dbFile,onChange:e=>t("dbFile",e),label:k("db.file"),hint:k("db.file.hint"),placeholder:"/home/you/app/data.db"}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"of-grid2",children:[(0,s.jsx)(b.D0,{label:k("db.host"),children:A("dbHost",{placeholder:"127.0.0.1",mono:!0})}),(0,s.jsx)(b.D0,{label:k("db.port"),children:A("dbPort",{placeholder:String(D[l.engine].port)})}),(0,s.jsx)(b.D0,{label:k("db.user"),children:A("dbUser",{mono:!0})}),(0,s.jsx)(b.D0,{label:k("db.password"),hint:l.dbPasswordSet&&!l.dbPassword?k("db.password.saved"):void 0,children:(0,s.jsx)(a.y,{value:l.dbPassword,autoComplete:"new-password",placeholder:l.dbPasswordSet?"••••••••":"",onChange:e=>t("dbPassword",e.target.value)})})]}),(0,s.jsx)(b.D0,{label:k("db.database"),hint:k("db.database.hint"),children:A("dbName",{mono:!0})})]}),(0,s.jsxs)("div",{className:"row gap-s wrap db-test",children:[(0,s.jsxs)("button",{type:"button",className:"btn sm",onClick:()=>void _(),disabled:"busy"===C.state||!!O&&!l.dbFile.trim(),children:["busy"===C.state?(0,s.jsx)(r.A,{size:14,className:"spin"}):(0,s.jsx)(o.A,{size:14}),k("db.test")]}),"ok"===C.state&&(0,s.jsxs)("span",{className:"db-ok small",children:[(0,s.jsx)(d,{size:14}),k("db.test.ok")," \xb7 ",C.text]}),"err"===C.state&&(0,s.jsxs)("span",{className:"db-bad small",children:[(0,s.jsx)(c,{size:14}),C.text]})]})]}),K=O?null:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(b.Tl,{checked:l.dbSsl,onChange:e=>t("dbSsl",e),label:k("db.ssl")}),l.dbSsl&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(b.Tl,{checked:l.dbTrust,onChange:e=>t("dbTrust",e),label:k("db.trust"),hint:l.dbTrust?k("db.trust.on"):k("db.trust.off")}),R.filter(e=>null==N?void 0:N[l.engine].some(l=>l.name===e)).map(e=>{var a;let n=N[l.engine].find(l=>l.name===e);return(0,s.jsx)(b.yQ,{mode:"file",exts:["pem","crt","cer","key"],value:null!=(a=l.dbProps[e])?a:"",onChange:s=>t("dbProps",{...l.dbProps,[e]:s}),label:k(q[e]),hint:"es"===y?n.es:n.desc,placeholder:n.placeholder},e)}),(0,s.jsx)(w,{engine:l.engine,value:l.dbProps,onChange:e=>t("dbProps",e),groups:["ssl"],exclude:[...R],quiet:!0})]})]}),U=(0,s.jsx)(w,{engine:l.engine,value:l.dbProps,onChange:e=>t("dbProps",e),groups:["session","network","advanced"]}),$=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(b.Tl,{checked:l.dbReadOnly,onChange:e=>t("dbReadOnly",e),label:k("db.readonly"),hint:l.dbReadOnly?k("db.readonly.on"):k("db.readonly.off")}),(0,s.jsxs)("div",{className:"of-grid2",children:[(0,s.jsx)(b.D0,{label:k("db.timeout"),hint:k("db.timeout.hint"),children:A("dbTimeout",{placeholder:"30"})}),(0,s.jsx)(b.D0,{label:k("db.maxRows"),hint:k("db.maxRows.hint"),children:A("dbMaxRows",{placeholder:"1000"})})]})]}),B=(0,s.jsx)("div",{className:"dbengines",role:"group","aria-label":k("db.engine"),children:T.map(e=>(0,s.jsxs)("button",{type:"button",className:"dbengine","aria-pressed":l.engine===e,style:{"--c":D[e].color},onClick:()=>I(e),children:[(0,s.jsx)(m.A,{size:18}),(0,s.jsx)("b",{children:D[e].label}),(0,s.jsx)("small",{children:"sqlite"===e?k("db.engine.file"):k("db.engine.port",{port:D[e].port})})]},e))});return f?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(g.Zp,{title:k("db.engine"),hint:k("db.engine.hint"),children:B}),(0,s.jsxs)(g.Zp,{title:k("db.conn"),hint:k("db.conn.hint"),children:[(0,s.jsx)(b.D0,{label:k("db.url"),error:z,hint:z?void 0:k("db.url.hint"),children:(0,s.jsxs)("div",{className:"row gap-s",children:[(0,s.jsx)("input",{className:"input mono grow",value:M,placeholder:D[l.engine].sample,autoComplete:"off",spellCheck:!1,onChange:e=>{P(e.target.value),E("")},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),H())}}),(0,s.jsxs)("button",{type:"button",className:"btn sm",disabled:!M.trim(),onClick:H,children:[(0,s.jsx)(h.A,{size:14}),k("db.url.use")]})]})}),L]}),(0,s.jsx)(g.Zp,{title:k("db.safety"),hint:k("db.safety.hint"),children:$}),(0,s.jsxs)("details",{className:"of-adv",children:[(0,s.jsxs)("summary",{children:[(0,s.jsx)(u.A,{size:15}),k("db.advanced"),(0,s.jsx)("span",{className:"muted small",children:k("db.advanced.hint")})]}),!O&&(0,s.jsx)(g.Zp,{title:k("db.sslTitle"),hint:k("db.sslTitle.hint"),children:K}),(0,s.jsx)(g.Zp,{title:k("dp.title"),hint:k("dp.hint"),children:U})]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(g.Zp,{title:k("db.conn"),hint:k("db.conn.hint"),children:[(0,s.jsx)(b.D0,{label:k("db.engine"),children:(0,s.jsx)(b.$q,{value:l.engine,onChange:I,options:T.map(e=>({id:e,label:D[e].label}))})}),L]}),!O&&(0,s.jsx)(g.Zp,{title:k("db.sslTitle"),hint:k("db.sslTitle.hint"),children:K}),(0,s.jsx)(g.Zp,{title:k("dp.title"),hint:k("dp.hint"),children:U}),(0,s.jsx)(g.Zp,{title:k("db.safety"),hint:k("db.safety.hint"),children:$})]})}},37165:(e,l,t)=>{t.d(l,{B:()=>o});var s=t(94799),a=t(34023);let n=(0,t(74955).A)("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var r=t(21018);function o(e){let{label:l,title:t,children:o,size:i="md",align:d="start"}=e,[c,m]=(0,a.useState)(!1),h=(0,a.useRef)(null),u=(0,a.useRef)(null),p=(0,a.useId)();return(0,r.s)(c,h,()=>m(!1),()=>{var e;return null==(e=u.current)?void 0:e.focus()}),(0,s.jsxs)("span",{className:"help ".concat("sm"===i?"sm":""," ").concat("end"===d?"end":""),ref:h,children:[(0,s.jsx)("button",{ref:u,type:"button",className:"help-btn","aria-label":l,title:l,"aria-haspopup":"dialog","aria-expanded":c,"aria-controls":c?p:void 0,onClick:()=>m(e=>!e),children:(0,s.jsx)(n,{size:"sm"===i?15:18})}),c&&(0,s.jsxs)("div",{id:p,role:"dialog","aria-label":t,className:"help-pop",children:[(0,s.jsx)("div",{className:"eyebrow",children:t}),(0,s.jsx)("div",{className:"muted small help-body",children:o})]})]})}},84561:(e,l,t)=>{t.d(l,{b:()=>o});var s=t(94799),a=t(34023),n=t(21018),r=t(10804);function o(e){let{value:l,onChange:t,options:o,placeholder:i,mono:d=!1,ariaLabel:c,onOpen:m,empty:h}=e,[u,p]=(0,a.useState)(!1),[b,j]=(0,a.useState)(0),v=(0,a.useRef)(null);(0,n.s)(u,v,()=>p(!1));let x=(0,a.useMemo)(()=>{let e=l.trim().toLowerCase();return(e?o.filter(l=>{var t,s;return"".concat(l.value," ").concat(null!=(t=l.label)?t:""," ").concat(null!=(s=l.hint)?s:"").toLowerCase().includes(e)}):o).slice(0,60)},[o,l]);(0,a.useEffect)(()=>{j(0)},[l,u]);let g=(0,r.Bp)(u&&(x.length>0||!!h),b,x.length),f=e=>{t(e.value),p(!1)};return(0,s.jsxs)("div",{className:"sg",ref:v,children:[(0,s.jsx)("input",{className:"input ".concat(d?"mono":""),value:l,placeholder:i,"aria-label":c,autoComplete:"off",spellCheck:!1,...g.input,onFocus:()=>{u||(p(!0),null==m||m())},onClick:()=>p(!0),onChange:e=>{t(e.target.value),p(!0)},onKeyDown:e=>{"ArrowDown"===e.key?(e.preventDefault(),p(!0),j(e=>Math.min(x.length-1,e+1))):"ArrowUp"===e.key?(e.preventDefault(),j(e=>Math.max(0,e-1))):"Enter"===e.key&&u&&x[b]?(e.preventDefault(),f(x[b])):"Escape"===e.key&&u&&(e.stopPropagation(),p(!1))}}),u&&(x.length>0||h)&&(0,s.jsxs)("ul",{className:"sg-list",...g.listProps,children:[0===x.length&&(0,s.jsx)("li",{className:"sg-empty",role:"presentation",children:h}),x.map((e,l)=>{var t;return(0,s.jsx)("li",{...g.optionProps(l),children:(0,s.jsxs)("button",{type:"button",tabIndex:-1,className:"sg-opt ".concat(l===b?"hi":""),onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>j(l),onClick:()=>f(e),children:[(0,s.jsx)("span",{className:"nm ".concat(d?"mono":""),children:null!=(t=e.label)?t:e.value}),e.hint&&(0,s.jsx)("span",{className:"hint",children:e.hint})]})},e.value)})]})]})}},95587:(e,l,t)=>{t.d(l,{X:()=>h});var s=t(94799),a=t(34023),n=t(3749),r=t(69654),o=t(48538),i=t(10804),d=t(9217),c=t(52974),m=t(29867);function h(e){let{presetColonyId:l,presetKind:t,onClose:h,onSaved:u}=e,{t:p}=(0,r.s9)(),{refresh:b}=(0,o.o0)(),j=(0,i.dj)(),{d:v,set:x,setD:g}=(0,d.Te)(()=>(0,d.QJ)(void 0,l,t)),[f,k]=(0,a.useState)(""),[y,N]=(0,a.useState)(!1),w=async()=>{let e=v.name.trim()||("database"===v.kind?(0,m.I5)(v):"");if(!e)return void k(p("obj.err.name"));N(!0),k("");try{if("docker"===v.kind&&"template"===v.mode&&!v.template){k(p("tpl.pick")),N(!1);return}let l="docker"===v.kind&&"template"===v.mode?await n.FH.post("/objects/from-template",{name:e,colony_id:v.colony_id||null,template:v.template,values:v.tplValues}):await n.FH.post("/objects",{name:e,colony_id:v.colony_id||null,kind:v.kind,config:(0,d.qP)(v)});v.manager&&c.Gn.includes(v.kind)&&await n.FH.put("/objects/".concat(l.id,"/manager"),{agent_id:v.manager}).catch(e=>j(e instanceof Error?e.message:"","err")),await b(["objects","agents"]),j(p("obj.created")),null==u||u(l.id),h()}catch(e){k(e instanceof Error?e.message:p("edit.saveFailed")),N(!1)}};return(0,s.jsx)(i._s,{title:p("obj.newTitle"),subtitle:p("obj.subtitle"),onClose:h,footer:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{className:"btn ghost",onClick:h,children:p("common.cancel")}),(0,s.jsx)("button",{className:"btn primary",disabled:y,onClick:()=>void w(),children:p("obj.create")})]}),children:(0,s.jsx)(d.Bh,{d:v,set:x,setD:g,showKind:!0,error:f})})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[606],{5372:(e,n,t)=>{t.d(n,{kh:()=>g,rs:()=>j,z6:()=>m});var s=t(94799),a=t(34023),r=t(56742),l=t(48538),i=t(69654),c=t(47890),o=t(72942),d=t(10804),u=t(15426);function m(){let[e,n]=(0,a.useState)(null),t=(0,a.useRef)(void 0),l=(0,a.useRef)(!1);l.current=!!e;let i=(0,a.useCallback)((e,s,a)=>{clearTimeout(t.current);let r=()=>n({id:e,rect:s.getBoundingClientRect()});a||l.current?r():t.current=setTimeout(r,280)},[]),c=(0,a.useCallback)(()=>{clearTimeout(t.current),n(null)},[]);return(0,a.useEffect)(()=>{if(!e)return;let n=e=>{"Escape"===e.key&&c()};return window.addEventListener("keydown",n),window.addEventListener("scroll",c,!0),window.addEventListener("resize",c),()=>{window.removeEventListener("keydown",n),window.removeEventListener("scroll",c,!0),window.removeEventListener("resize",c)}},[e,c]),(0,a.useEffect)(()=>()=>clearTimeout(t.current),[]),{bind:(0,a.useCallback)(e=>({onMouseEnter:n=>i(e,n.currentTarget,!1),onMouseLeave:c,onFocus:n=>{n.currentTarget.matches(":focus-visible")&&i(e,n.currentTarget,!0)},onBlur:c,onClick:c}),[i,c]),node:e&&"undefined"!=typeof document?(0,r.createPortal)((0,s.jsx)(p,{anchor:e}),document.body):null}}function h(e){let{label:n,children:t}=e;return(0,s.jsxs)("div",{className:"ap-row",children:[(0,s.jsx)("dt",{children:n}),(0,s.jsx)("dd",{children:t})]})}function g(e){let{agent:n,hideColony:t=!1}=e,{t:a}=(0,i.s9)(),r=(0,l.Tu)(e=>e.agents),m=(0,l.Tu)(e=>e.colonies).find(e=>e.id===n.colony_id),g=(0,o.E)((0,l.M_)(n.id)),j=n.worker_ids.map(e=>{var n;return null==(n=r.find(n=>n.id===e))?void 0:n.name}).filter(Boolean),p=r.filter(e=>"orchestrator"===e.role&&e.worker_ids.includes(n.id)).map(e=>e.name),f=e=>e.length>4?"".concat(e.slice(0,4).join(", ")," ").concat(a("hover.more",{count:e.length-4})):e.join(", ");return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"ap-head",children:[(0,s.jsx)(d._h,{agent:n}),(0,s.jsxs)("div",{className:"grow",children:[(0,s.jsx)("b",{className:"ap-name",children:n.name}),(0,s.jsxs)("div",{className:"row gap-s wrap mt-s",children:[(0,s.jsx)(d.PW,{role:n.role}),(0,s.jsx)(d.P5,{status:n.status}),(0,s.jsx)(u.IX,{agent:n}),(0,s.jsx)(u.R4,{agent:n})]})]})]}),(0,s.jsx)("p",{className:"ap-desc ".concat(n.description?"":"muted"),children:n.description||a("switcher.noDescription")}),g&&(0,s.jsxs)("div",{className:"ap-now",children:[(0,s.jsx)("i",{className:"dot run"}),g]}),(0,s.jsxs)("dl",{className:"ap-rows",children:[(0,s.jsxs)(h,{label:a("form.provider"),children:[c.xq[n.provider].label,n.model?" \xb7 ".concat(n.model):" \xb7 ".concat(a("model.cliDefault"))]}),(0,s.jsx)(h,{label:a("inherit.permissions"),children:(0,c.Ck)(n.effective.permission)}),(0,s.jsxs)(h,{label:a("colony.folder"),children:[(0,s.jsx)("span",{className:"mono",children:(0,c._1)(n.effective.cwd)}),n.effective.inherited.includes("cwd")&&(0,s.jsxs)("span",{className:"muted",children:[" \xb7 ",a("colony.fromColony")]})]}),!t&&(0,s.jsx)(h,{label:a("form.colony"),children:m?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("i",{className:"cdot",style:{background:m.color||"var(--honey)"}}),m.name]}):(0,s.jsx)("span",{className:"muted",children:a("common.noColony")})}),"orchestrator"===n.role?(0,s.jsx)(h,{label:a("form.team"),children:j.length?f(j):(0,s.jsx)("span",{className:"muted",children:a("colony.noWorkers")})}):(0,s.jsx)(h,{label:a("rel.directedBy"),children:p.length?f(p):(0,s.jsx)("span",{className:"muted",children:a("hover.noOrchestrator")})}),(0,s.jsx)(h,{label:a("colony.session"),children:(0,s.jsx)("span",{className:"mono",children:n.session_id?"".concat(n.session_id.slice(0,12),"…"):a("colony.noSession")})}),(0,s.jsxs)(h,{label:a("agents.col.updated"),children:[(0,c.KN)(n.updated_at),!!n.queued&&n.queued>0&&(0,s.jsxs)("span",{className:"muted",children:[" \xb7 ",a("queue.count",{count:n.queued})]})]})]})]})}function j(e){var n,t,l;let{target:i,width:c=310,pinned:o=!1,onClose:d,children:u,label:m}=e,h=(0,a.useRef)(null),[g,j]=(0,a.useState)(null),p=(0,a.useCallback)(()=>{var e,n;if(!i)return;let t=null!=(n=null==(e=h.current)?void 0:e.offsetHeight)?n:0,s=i instanceof DOMRect?i:i.getBoundingClientRect(),a=s.right+12+c+8<=window.innerWidth?"right":"left",r="right"===a?s.right+12:Math.max(8,s.left-12-c),l=Math.min(Math.max(8,s.top+s.height/2-t/2),Math.max(8,window.innerHeight-t-8));j(e=>e&&e.left===r&&e.top===l&&e.side===a?e:{left:r,top:l,side:a})},[i,c]);return((0,a.useLayoutEffect)(p),(0,a.useEffect)(()=>{if(!o)return;window.addEventListener("scroll",p,!0),window.addEventListener("resize",p);let e="undefined"!=typeof ResizeObserver&&h.current?new ResizeObserver(p):null;e&&h.current&&e.observe(h.current);let n=e=>{var n;let t=e.target;(null==(n=h.current)?void 0:n.contains(t))||t.closest('.cell, [role="dialog"], .modal, .drawer, .scrim, .menu-pop')||null==d||d()};return document.addEventListener("pointerdown",n),()=>{window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p),null==e||e.disconnect(),document.removeEventListener("pointerdown",n)}},[o,p,d]),i&&"undefined"!=typeof document)?(0,r.createPortal)((0,s.jsx)("div",{ref:h,className:"ap-card ".concat(o?"pinned":""," ").concat(null!=(n=null==g?void 0:g.side)?n:"right"),role:o?"complementary":"tooltip","aria-label":m,style:{left:null!=(t=null==g?void 0:g.left)?t:-9999,top:null!=(l=null==g?void 0:g.top)?l:-9999,width:c,visibility:g?"visible":"hidden"},children:u}),document.body):null}function p(e){let{anchor:n}=e,t=(0,l.fJ)(n.id);return t?(0,s.jsx)(j,{target:n.rect,children:(0,s.jsx)(g,{agent:t})}):null}},15426:(e,n,t)=>{t.d(n,{IX:()=>u,R4:()=>m});var s=t(94799),a=t(41463),r=t.n(a),l=t(34023),i=t(494),c=t(48538),o=t(69654);function d(e){let n=(0,c.Tu)(e=>e.agents);return(0,l.useMemo)(()=>({of:e.cloned_from?n.find(n=>n.id===e.cloned_from):void 0,clones:n.filter(n=>n.cloned_from===e.id)}),[n,e.id,e.cloned_from])}function u(e){let{agent:n,link:t=!1,className:a=""}=e,{t:l}=(0,o.s9)(),{of:c}=d(n);if(!c)return null;let u=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.A,{size:11,"aria-hidden":!0}),c.name]}),m=l("agent.cloneOf",{name:c.name});return t?(0,s.jsx)(r(),{className:"chip clone ".concat(a),href:"/agents/".concat(c.id),title:m,onClick:e=>e.stopPropagation(),children:u}):(0,s.jsx)("span",{className:"chip clone ".concat(a),title:m,children:u})}function m(e){let{agent:n}=e,{t}=(0,o.s9)(),{clones:a}=d(n);return a.length?(0,s.jsxs)("span",{className:"chip clone",title:t("agent.clonesList",{names:a.map(e=>e.name).join(", ")}),children:[(0,s.jsx)(i.A,{size:11,"aria-hidden":!0}),t("agent.clones.count",{count:a.length})]}):null}},20422:(e,n,t)=>{t.d(n,{N:()=>i});var s=t(94799),a=t(70283),r=t(42162),l=t(69654);function i(e){let{spec:n,label:t,title:i}=e,{t:c}=(0,l.s9)(),o=(0,r.n)();return(0,s.jsxs)("button",{className:"btn sm",onClick:()=>void o.openTerminal(n),title:i,children:[(0,s.jsx)(a.A,{size:14}),null!=t?t:c("dock.nav")]})}},31606:(e,n,t)=>{t.d(n,{md:()=>M,wl:()=>R});var s=t(94799),a=t(20422),r=t(34023),l=t(41463),i=t.n(l),c=t(66654),o=t(70665),d=t(7991),u=t(66826),m=t(2432),h=t(32335),g=t(59959),j=t(73885),p=t(47405),f=t(83372),b=t(6673),x=t(19431),v=t(33691),y=t(26701),k=t(5372),w=t(3749),N=t(69654),E=t(47890),C=t(10804),_=t(28941),A=t(48538),z=t(42162),S=t(1517),$=t(74988),L=t(75010);let T={mysql:"MySQL / MariaDB",postgresql:"PostgreSQL",sqlite:"SQLite",mssql:"SQL Server"};function M(e){let{status:n,className:t=""}=e;return(0,s.jsx)("i",{className:"odot ".concat($.Wy[n]," ").concat(t),"aria-hidden":!0})}function H(e){var n,t,s,a;if("server"===e.kind)return e.config.start;if("http"===e.kind)return(0,E._1)(e.config.folder);if("database"===e.kind){let t=e.config;return"sqlite"===t.engine?(0,E._1)(null!=(n=t.file)?n:""):"".concat(t.host||"127.0.0.1").concat(t.port?":".concat(t.port):"").concat(t.database?"/".concat(t.database):"")}if("cluster"===e.kind)return"".concat(e.config.members.length);let r=e.config;return"container"===r.mode?null!=(t=r.image)?t:"":"compose"===r.mode?(0,E._1)(null!=(s=r.file)?s:""):null!=(a=r.container)?a:""}function R(e){let{object:n,target:t,onClose:l,onCreateManager:R}=e,{t:q}=(0,N.s9)(),{agents:F,objects:P,colonies:O}=(0,A.o0)(),I=(0,z.n)(),B="server"===n.kind||"docker"===n.kind&&"compose"!==n.config.mode,W=n.manager_id?F.filter(e=>e.id===n.manager_id):F.filter(e=>{var t,s;return e.skill_ids.includes("database"===n.kind?S.pU:S.tJ)&&(null!=(t=e.colony_id)?t:null)===(null!=(s=n.colony_id)?s:null)}),[D,K]=(0,r.useState)(!1),{refresh:J}=(0,A.o0)(),Q=async e=>{try{await w.FH.put("/objects/".concat(n.id,"/manager"),{agent_id:e}),await J(["objects","agents"]),K(!1)}catch(e){U(e instanceof Error?e.message:"","err")}},U=(0,C.dj)(),[X,G]=(0,r.useState)(null),{icon:V,color:Y}=$.Nd[n.kind],Z=n.state.status,ee=async e=>{G(e);try{await w.FH.post("/objects/".concat(n.id,"/action"),{action:e})}catch(n){U("".concat(q("obj.act.failed",{action:q("obj.act.".concat(e))}),": ").concat(n instanceof Error?n.message:""),"err")}finally{G(null)}},en="running"===Z||"starting"===Z,et=async()=>{G("test");try{let e=await w.FH.post("/object-db/test",{id:n.id,config:n.config});U("".concat(q("db.test.ok")," \xb7 ").concat(e.version," \xb7 ").concat(e.ms," ms"))}catch(e){U(e instanceof Error?e.message:"","err")}finally{G(null)}},es="cluster"===n.kind?n.config.members.map(e=>P.find(n=>n.id===e)).filter(e=>!!e):[];return(0,s.jsx)(k.rs,{target:t,pinned:!0,width:380,label:n.name,onClose:l,children:(0,s.jsxs)("div",{className:"col obj-panel res-gap12",children:[(0,s.jsxs)("div",{className:"ap-corner row gap-s",children:[(0,s.jsx)(i(),{className:"btn ghost icon sm",href:"/resources/".concat(n.id,"?tab=config"),"aria-label":q("obj.act.edit"),title:q("obj.act.edit"),children:(0,s.jsx)(c.A,{size:15})}),(0,s.jsx)("button",{className:"btn ghost icon sm",onClick:l,"aria-label":q("common.close"),title:"".concat(q("common.close")," (Esc)"),children:(0,s.jsx)(o.A,{size:16})})]}),(0,s.jsxs)("div",{className:"row gap-l res-pr70",children:[(0,s.jsx)("span",{className:"obj-ico",style:{"--c":Y},children:(0,s.jsx)(V,{size:22})}),(0,s.jsxs)("div",{className:"grow res-minw0",children:[(0,s.jsx)("h2",{className:"res-h2",children:n.name}),(0,s.jsxs)("div",{className:"row gap-s wrap res-mt4",children:[(0,s.jsxs)("span",{className:"ostatus ".concat($.Wy[Z]),children:[(0,s.jsx)(M,{status:Z}),q("obj.status.".concat(Z))]}),(0,s.jsx)("span",{className:"muted small",children:q("obj.kind.".concat(n.kind))})]})]})]}),(n.state.detail||n.state.since)&&(0,s.jsx)("p",{className:"muted small res-m0",children:[(0,$.HS)(q,n.state.detail),n.state.since&&en?q("obj.since",{time:(0,E.KN)(n.state.since)}):"",n.state.pid?q("obj.pid",{pid:n.state.pid}):""].filter(Boolean).join(" \xb7 ")}),(0,s.jsxs)(i(),{className:"btn primary",href:"/resources/".concat(n.id),children:[(0,s.jsx)(d.A,{size:15}),q("obj.open")]}),"cluster"!==n.kind&&(0,s.jsx)("div",{className:"mono small obj-cmd",title:H(n),children:H(n)}),"database"===n.kind&&(0,s.jsxs)("div",{className:"row gap-s wrap",children:[(0,s.jsxs)("span",{className:"db-badge",children:[(0,s.jsx)(u.A,{size:12}),T[n.config.engine]]}),!1!==n.config.readOnly?(0,s.jsxs)("span",{className:"db-badge ro",children:[(0,s.jsx)(m.A,{size:12}),q("db.readonly.badge")]}):(0,s.jsxs)("span",{className:"db-badge rw",children:[(0,s.jsx)(h.A,{size:12}),q("db.write.badge")]}),(0,s.jsxs)("button",{className:"btn sm",disabled:!!X,onClick:()=>void et(),children:["test"===X?(0,s.jsx)(g.A,{size:14,className:"spin"}):(0,s.jsx)(j.A,{size:14}),q("db.test")]})]}),"http"===n.kind||"database"===n.kind?null:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"row gap-s wrap",children:[(0,s.jsxs)("button",{className:"btn primary sm",disabled:!!X||("cluster"===n.kind?"running"===Z:en),onClick:()=>void ee("start"),children:[(0,s.jsx)(p.A,{size:14}),q("cluster"===n.kind?"obj.act.startAll":"obj.act.start")]}),(0,s.jsxs)("button",{className:"btn sm",disabled:!!X||!en&&"error"!==Z&&!("cluster"===n.kind&&es.some(e=>"running"===e.state.status)),onClick:()=>void ee("stop"),children:[(0,s.jsx)(f.A,{size:14}),q("cluster"===n.kind?"obj.act.stopAll":"obj.act.stop")]}),(0,s.jsxs)("button",{className:"btn sm",disabled:!!X,onClick:()=>void ee("restart"),children:[(0,s.jsx)(b.A,{size:14}),q("cluster"===n.kind?"obj.act.restartAll":"obj.act.restart")]})]}),"cluster"===n.kind&&(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"eyebrow res-mb6",children:q("obj.members")}),es.length?(0,s.jsx)("div",{className:"col res-gap4",children:es.map((e,n)=>(0,s.jsxs)("div",{className:"row gap-s small",children:[(0,s.jsx)("span",{className:"ord",children:n+1}),(0,s.jsx)(M,{status:e.state.status}),(0,s.jsx)("b",{className:"grow ellipsis",children:e.name}),(0,s.jsx)("span",{className:"muted",children:q("obj.status.".concat(e.state.status))})]},e.id))}):(0,s.jsx)("p",{className:"muted small res-m0",children:q("obj.members.empty")})]}),(0,s.jsxs)("div",{className:"row gap-s wrap",children:[B&&(0,s.jsx)(a.N,{spec:{objectId:n.id},label:"server"===n.kind?q("dock.here"):q("dock.shell")}),(0,s.jsxs)("button",{className:"btn sm",onClick:()=>I.openLogs(n.id,n.name),children:[(0,s.jsx)(x.A,{size:14}),q("dock.logs")]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"eyebrow res-mb6",children:q("obj.logs")}),(0,s.jsx)(L.I,{id:n.id})]})]}),"http"!==n.kind&&(0,s.jsxs)("div",{className:"obj-managers",children:[(0,s.jsx)("div",{className:"eyebrow res-mb6",children:q("obj.managers")}),W.length?(0,s.jsx)("div",{className:"row gap-s wrap",children:W.map(e=>(0,s.jsxs)("span",{className:"chip ps-chip",children:[(0,s.jsxs)(i(),{href:"/agents/".concat(e.id),title:"plan"===e.permission?q("database"===n.kind?"obj.managers.readonly.db":"obj.managers.readonly"):void 0,children:[e.name,"plan"===e.permission?" \xb7 ".concat(q("obj.managers.ro")):""]}),n.manager_id===e.id&&(0,s.jsx)("button",{type:"button",onClick:()=>void Q(null),"aria-label":q("obj.managers.remove"),title:q("obj.managers.remove"),children:(0,s.jsx)(o.A,{size:12})})]},e.id))}):(0,s.jsx)("p",{className:"muted small res-m0",children:q("obj.managers.none")}),n.manager_id&&(0,s.jsx)("p",{className:"muted small res-mt6",children:q("obj.managers.only")}),(0,s.jsxs)("div",{className:"row gap-s wrap res-mt8",children:[(0,s.jsxs)("button",{className:"btn sm",onClick:R,children:[(0,s.jsx)(v.A,{size:14}),q("obj.managers.create")]}),(0,s.jsxs)("button",{className:"btn sm","aria-pressed":D,onClick:()=>K(e=>!e),children:[(0,s.jsx)(y.A,{size:14}),q("obj.managers.add")]})]}),D&&(0,s.jsx)("div",{className:"res-mt8",children:(0,s.jsx)(_.c,{inline:!0,autoFocus:!0,options:F.filter(e=>e.id!==n.manager_id).map(e=>{var n,t;return{id:e.id,label:e.name,hint:null!=(t=null==(n=O.find(n=>n.id===e.colony_id))?void 0:n.name)?t:q("common.noColony")}}),value:[],onChange:e=>e[0]&&void Q(e[0]),placeholder:q("obj.manager.placeholder"),empty:q("obj.manager.empty"),ariaLabel:q("obj.managers.add")})})]})]})})}},42162:(e,n,t)=>{t.d(n,{$:()=>u,n:()=>c});var s=t(94799),a=t(34023),r=t(3749),l=t(69654);let i=(0,a.createContext)(null),c=()=>{let e=(0,a.useContext)(i);if(!e)throw Error("DockProvider missing");return e},o="hive-am.dock",d=e=>Math.max(140,Math.min(e,Math.round(.8*window.innerHeight)));function u(e){let{children:n}=e,{t}=(0,l.s9)(),[c,u]=(0,a.useState)(!1),[m,h]=(0,a.useState)(320),[g,j]=(0,a.useState)([]),[p,f]=(0,a.useState)(null),[b,x]=(0,a.useState)(!0),[v,y]=(0,a.useState)(""),k=(0,a.useRef)(!1);(0,a.useEffect)(()=>{try{var e;let n=JSON.parse(null!=(e=localStorage.getItem(o))?e:"{}");"number"==typeof n.height&&h(d(n.height)),n.open&&u(!0),"string"==typeof n.active&&f(n.active)}catch(e){}r.FH.get("/terminals").then(e=>{x(e.enabled),j(n=>[...e.terminals.map(e=>({key:"t:".concat(e.id),kind:"term",id:e.id,title:e.title,cwd:e.cwd,ended:e.alive?void 0:e.exitCode})),...n.filter(e=>"logs"===e.kind)]),f(n=>n&&e.terminals.some(e=>"t:".concat(e.id)===n)?n:e.terminals[0]?"t:".concat(e.terminals[0].id):n)}).catch(()=>void 0).finally(()=>{k.current=!0})},[]),(0,a.useEffect)(()=>{if(k.current)try{localStorage.setItem(o,JSON.stringify({open:c,height:m,active:p}))}catch(e){}},[c,m,p]),(0,a.useEffect)(()=>{document.documentElement.style.setProperty("--app-h",c?"calc(100vh - ".concat(m,"px)"):"100vh")},[c,m]);let w=(0,a.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};y("");try{let n=await r.FH.post("/terminals",e),t={key:"t:".concat(n.id),kind:"term",id:n.id,title:n.title,cwd:n.cwd};j(e=>[...e,t]),f(t.key),u(!0)}catch(e){y(e instanceof Error?e.message:t("dock.failed")),u(!0)}},[t]),N=(0,a.useCallback)((e,n)=>{let t="l:".concat(e);j(s=>s.some(e=>e.key===t)?s:[...s,{key:t,kind:"logs",objectId:e,title:n}]),f(t),u(!0)},[]),E=(0,a.useCallback)(e=>{j(n=>{let t=n.find(n=>n.key===e);(null==t?void 0:t.kind)==="term"&&r.FH.del("/terminals/".concat(t.id)).catch(()=>void 0);let s=n.filter(n=>n.key!==e);return f(n=>{var t,a;return n===e?null!=(a=null==(t=s[s.length-1])?void 0:t.key)?a:null:n}),s})},[]),C=(0,a.useCallback)((e,n)=>j(t=>t.map(t=>t.key===e&&"term"===t.kind?{...t,ended:null!=n?n:0}:t)),[]),_=(0,a.useCallback)(()=>{if(c)return void u(!1);u(!0),!g.length&&b&&w()},[c,g.length,b,w]);(0,a.useEffect)(()=>{let e=e=>{!e.ctrlKey||e.altKey||e.metaKey||"`"!==e.key&&"Backquote"!==e.code||(e.preventDefault(),e.stopPropagation(),_())};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[_]);let A=(0,a.useMemo)(()=>({open:c,height:m,tabs:g,active:p,enabled:b,error:v,toggle:_,setOpen:u,setHeight:e=>h(d(e)),setActive:f,openTerminal:w,openLogs:N,closeTab:E,markEnded:C}),[c,m,g,p,b,v,_,w,N,E,C]);return(0,s.jsx)(i.Provider,{value:A,children:n})}},72942:(e,n,t)=>{t.d(n,{E:()=>r});var s=t(68419),a=t(10969);function r(e){if(!e)return null;let n=e.blocks[e.blocks.length-1],t="dispatch"===e.source?(0,s.Tl)("activity.delegated"):"";if(!n)return"".concat(t).concat((0,s.Tl)("activity.starting"));if("tool"===n.type){let e=(0,a.q0)(n),r="".concat(e.label).concat(e.summary?" ".concat(e.summary):"");return"".concat(t).concat(void 0===n.output?(0,s.Tl)("activity.running",{tool:r}):(0,s.Tl)("activity.ran",{tool:r}))}return"".concat(t).concat("thinking"===n.type?(0,s.Tl)("activity.thinking"):(0,s.Tl)("activity.writing"))}},74988:(e,n,t)=>{t.d(n,{HS:()=>j,M6:()=>u,Mn:()=>h,Nd:()=>o,Wy:()=>d,y$:()=>m});var s=t(29416),a=t(34978),r=t(84616),l=t(66826),i=t(73784),c=t(47890);let o={server:{color:"#0f8f9e",icon:s.A},docker:{color:"#2496ed",icon:a.A},http:{color:"#7a4de0",icon:r.A},database:{color:"#d9822b",icon:l.A},cluster:{color:c.Ng,icon:i.A}},d={running:"ok",ready:"ok",starting:"warn",error:"err",stopped:"off",unknown:"off"},u=e=>Object.entries(null!=e?e:{}).map(e=>{let[n,t]=e;return"".concat(n,"=").concat(t)}).join("\n");function m(e){let n={};for(let t of e.split("\n")){let e=t.trim();if(!e||e.startsWith("#"))continue;let s=e.indexOf("=");if(s<=0)throw Error('"'.concat(e,'" is not NAME=value'));n[e.slice(0,s).trim()]=e.slice(s+1)}return n}let h=e=>e.split("\n").map(e=>e.trim()).filter(Boolean),g=[[/^(\d+) requests in (\d+) files$/,"d.requests"],[/^(\d+)\/(\d+) running$/,"d.running"],[/^no members$/,"d.noMembers"],[/^only (\d+)\/(\d+) running · stopped: (.+)$/,"d.onlySome"],[/^(.+) failed · (\d+)\/(\d+) running$/,"d.failed"],[/^waiting for port (\d+)$/,"d.waitPort"],[/^running, but nothing listens on port (\d+)$/,"d.noPort"],[/^exited with code (\d+)$/,"d.exited"],[/^ended by (\w+)$/,"d.signal"],[/^restarted \((\d+)\/(\d+)\)$/,"d.restarted"],[/^was unhealthy: restarting \((\d+)\/(\d+)\)$/,"d.unhealthyRestart"],[/^health check pending$/,"d.healthPending"],[/^restarting$/,"d.restarting"],[/^container not found$/,"d.noContainer"],[/^the compose file is missing$/,"d.noCompose"],[/^(\d+) of (\d+) running$/,"d.running2"],[/^(\d+) services?$/,"d.services"],[/^a service exited with an error$/,"d.serviceFailed"],[/^checking…$/,"d.checking"],[/^unhealthy$/,"d.unhealthy"]];function j(e,n){return n?n.split(" \xb7 ").map(n=>{for(let[t,s]of g){let a=t.exec(n);if(a)return e(s,Object.fromEntries(a.slice(1).map((e,n)=>["a".concat(n+1),e])))}let t=/^(.*)restarting in (\d+) s \((\d+)\/(\d+)\)$/.exec(n);if(t)return e("d.restartIn",{a1:t[2],a2:t[3],a3:t[4]});let s=/^gave up after (\d+) restarts$/.exec(n);if(s)return e("d.gaveUp",{a1:s[1]});let a=/^unhealthy: (.+)$/.exec(n);return a?"".concat(e("d.unhealthy"),": ").concat(a[1]):n}).join(" \xb7 "):""}},75010:(e,n,t)=>{t.d(n,{I:()=>d});var s=t(94799),a=t(34023),r=t(98392),l=t(64883),i=t(3749),c=t(69654);let o=/\u001b\[[0-9;?]*[ -/]*[@-~]/g;function d(e){let{id:n,height:t=220}=e,{t:d}=(0,c.s9)(),[u,m]=(0,a.useState)(null),h=(0,a.useRef)(""),g=(0,a.useRef)(null),j=(0,a.useRef)(!0),[p,f]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{let e=!1,t;m(null),h.current="",j.current=!0,f(!1);let s=async()=>{try{let t=h.current?"after=".concat(encodeURIComponent(h.current)):"tail=300",s=await i.FH.get("/objects/".concat(n,"/logs?").concat(t));if(e)return;h.current=s.cursor||h.current;let a=s.text.replace(o,"");m(e=>{let n=s.reset?"":null!=e?e:"";if(!a)return null!=e?e:"";let t=!n||n.endsWith("\n")||a.startsWith("\n")?n+a:"".concat(n,"\n").concat(a);return t.length>2e5?t.slice(t.length-2e5):t})}catch(e){}e||(t=setTimeout(s,1200))};return s(),()=>{e=!0,clearTimeout(t)}},[n]),(0,a.useEffect)(()=>{let e=g.current;e&&j.current&&(e.scrollTop=e.scrollHeight)},[u]),(0,s.jsxs)("div",{className:"logv",children:[(0,s.jsx)("pre",{ref:g,className:"logv-body mono",style:{height:t},onScroll:()=>{let e=g.current;if(!e)return;let n=e.scrollHeight-e.scrollTop-e.clientHeight<24;j.current=n,f(!n)},tabIndex:0,children:null===u?d("git.loading"):u.trim()?u:d("obj.logs.empty")}),(0,s.jsxs)("div",{className:"logv-tools",children:[p&&(0,s.jsxs)("button",{className:"btn sm",onClick:()=>{let e=g.current;e&&(e.scrollTop=e.scrollHeight,j.current=!0,f(!1))},children:[(0,s.jsx)(r.A,{size:14}),d("obj.logs.bottom")]}),(0,s.jsx)("button",{className:"btn ghost icon sm",onClick:()=>m(""),"aria-label":d("obj.logs.clear"),title:d("obj.logs.clear"),children:(0,s.jsx)(l.A,{size:14})})]})]})}}}]);