@jheavenknows/bluerouter 5.5.23 → 5.5.25

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 (883) hide show
  1. package/app/.next-cli-build/BUILD_ID +1 -1
  2. package/app/.next-cli-build/app-path-routes-manifest.json +17 -17
  3. package/app/.next-cli-build/build-manifest.json +2 -2
  4. package/app/.next-cli-build/server/app/(dashboard)/dashboard/ai-power-index/page.js +1 -1
  5. package/app/.next-cli-build/server/app/(dashboard)/dashboard/ai-power-index/page.js.nft.json +1 -1
  6. package/app/.next-cli-build/server/app/(dashboard)/dashboard/ai-power-index/page_client-reference-manifest.js +1 -1
  7. package/app/.next-cli-build/server/app/(dashboard)/dashboard/analytics/page.js +1 -1
  8. package/app/.next-cli-build/server/app/(dashboard)/dashboard/analytics/page.js.nft.json +1 -1
  9. package/app/.next-cli-build/server/app/(dashboard)/dashboard/analytics/page_client-reference-manifest.js +1 -1
  10. package/app/.next-cli-build/server/app/(dashboard)/dashboard/api-keys/page.js +3 -3
  11. package/app/.next-cli-build/server/app/(dashboard)/dashboard/api-keys/page.js.nft.json +1 -1
  12. package/app/.next-cli-build/server/app/(dashboard)/dashboard/api-keys/page_client-reference-manifest.js +1 -1
  13. package/app/.next-cli-build/server/app/(dashboard)/dashboard/audit-proxy/page.js +1 -1
  14. package/app/.next-cli-build/server/app/(dashboard)/dashboard/audit-proxy/page.js.nft.json +1 -1
  15. package/app/.next-cli-build/server/app/(dashboard)/dashboard/audit-proxy/page_client-reference-manifest.js +1 -1
  16. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
  17. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
  18. package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  19. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
  20. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
  21. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  22. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/model-profiles/page.js +1 -1
  23. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/model-profiles/page.js.nft.json +1 -1
  24. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/model-profiles/page_client-reference-manifest.js +1 -1
  25. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
  26. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
  27. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  28. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cluster/page.js +1 -1
  29. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cluster/page.js.nft.json +1 -1
  30. package/app/.next-cli-build/server/app/(dashboard)/dashboard/cluster/page_client-reference-manifest.js +1 -1
  31. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
  32. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
  33. package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  34. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
  35. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
  36. package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  37. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
  38. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
  39. package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  40. package/app/.next-cli-build/server/app/(dashboard)/dashboard/logs/console/page.js +1 -1
  41. package/app/.next-cli-build/server/app/(dashboard)/dashboard/logs/console/page.js.nft.json +1 -1
  42. package/app/.next-cli-build/server/app/(dashboard)/dashboard/logs/console/page_client-reference-manifest.js +1 -1
  43. package/app/.next-cli-build/server/app/(dashboard)/dashboard/logs/page.js +1 -1
  44. package/app/.next-cli-build/server/app/(dashboard)/dashboard/logs/page.js.nft.json +1 -1
  45. package/app/.next-cli-build/server/app/(dashboard)/dashboard/logs/page_client-reference-manifest.js +1 -1
  46. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +1 -1
  47. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
  48. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  49. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
  50. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
  51. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  52. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
  53. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
  54. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  55. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
  56. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
  57. package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  58. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
  59. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
  60. package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  61. package/app/.next-cli-build/server/app/(dashboard)/dashboard/personal/page.js +1 -1
  62. package/app/.next-cli-build/server/app/(dashboard)/dashboard/personal/page.js.nft.json +1 -1
  63. package/app/.next-cli-build/server/app/(dashboard)/dashboard/personal/page_client-reference-manifest.js +1 -1
  64. package/app/.next-cli-build/server/app/(dashboard)/dashboard/personalcloudcombo/page.js +1 -1
  65. package/app/.next-cli-build/server/app/(dashboard)/dashboard/personalcloudcombo/page.js.nft.json +1 -1
  66. package/app/.next-cli-build/server/app/(dashboard)/dashboard/personalcloudcombo/page_client-reference-manifest.js +1 -1
  67. package/app/.next-cli-build/server/app/(dashboard)/dashboard/personalcloudprovider/page.js +1 -1
  68. package/app/.next-cli-build/server/app/(dashboard)/dashboard/personalcloudprovider/page.js.nft.json +1 -1
  69. package/app/.next-cli-build/server/app/(dashboard)/dashboard/personalcloudprovider/page_client-reference-manifest.js +1 -1
  70. package/app/.next-cli-build/server/app/(dashboard)/dashboard/personalcloudprovidermonitor/page.js +1 -1
  71. package/app/.next-cli-build/server/app/(dashboard)/dashboard/personalcloudprovidermonitor/page.js.nft.json +1 -1
  72. package/app/.next-cli-build/server/app/(dashboard)/dashboard/personalcloudprovidermonitor/page_client-reference-manifest.js +1 -1
  73. package/app/.next-cli-build/server/app/(dashboard)/dashboard/personalquota/page.js +1 -1
  74. package/app/.next-cli-build/server/app/(dashboard)/dashboard/personalquota/page.js.nft.json +1 -1
  75. package/app/.next-cli-build/server/app/(dashboard)/dashboard/personalquota/page_client-reference-manifest.js +1 -1
  76. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
  77. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
  78. package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  79. package/app/.next-cli-build/server/app/(dashboard)/dashboard/prompt-logs/page.js +1 -1
  80. package/app/.next-cli-build/server/app/(dashboard)/dashboard/prompt-logs/page.js.nft.json +1 -1
  81. package/app/.next-cli-build/server/app/(dashboard)/dashboard/prompt-logs/page_client-reference-manifest.js +1 -1
  82. package/app/.next-cli-build/server/app/(dashboard)/dashboard/provider-health/page.js +1 -1
  83. package/app/.next-cli-build/server/app/(dashboard)/dashboard/provider-health/page.js.nft.json +1 -1
  84. package/app/.next-cli-build/server/app/(dashboard)/dashboard/provider-health/page_client-reference-manifest.js +1 -1
  85. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
  86. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
  87. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  88. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/embedding/[id]/page.js +1 -1
  89. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/embedding/[id]/page.js.nft.json +1 -1
  90. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/embedding/[id]/page_client-reference-manifest.js +1 -1
  91. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/embedding/page.js +1 -1
  92. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/embedding/page.js.nft.json +1 -1
  93. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/embedding/page_client-reference-manifest.js +1 -1
  94. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/image/[id]/page.js +1 -1
  95. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/image/[id]/page.js.nft.json +1 -1
  96. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/image/[id]/page_client-reference-manifest.js +1 -1
  97. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/image/page.js +1 -1
  98. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/image/page.js.nft.json +1 -1
  99. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/image/page_client-reference-manifest.js +1 -1
  100. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/image-to-text/[id]/page.js +1 -1
  101. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/image-to-text/[id]/page.js.nft.json +1 -1
  102. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/image-to-text/[id]/page_client-reference-manifest.js +1 -1
  103. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/image-to-text/page.js +1 -1
  104. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/image-to-text/page.js.nft.json +1 -1
  105. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/image-to-text/page_client-reference-manifest.js +1 -1
  106. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
  107. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
  108. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  109. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  110. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
  111. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  112. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/stt/[id]/page.js +1 -1
  113. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/stt/[id]/page.js.nft.json +1 -1
  114. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/stt/[id]/page_client-reference-manifest.js +1 -1
  115. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/stt/page.js +1 -1
  116. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/stt/page.js.nft.json +1 -1
  117. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/stt/page_client-reference-manifest.js +1 -1
  118. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/tts/[id]/page.js +1 -1
  119. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/tts/[id]/page.js.nft.json +1 -1
  120. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/tts/[id]/page_client-reference-manifest.js +1 -1
  121. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/tts/page.js +1 -1
  122. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/tts/page.js.nft.json +1 -1
  123. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/tts/page_client-reference-manifest.js +1 -1
  124. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/web/[kind]/[id]/page.js +1 -1
  125. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/web/[kind]/[id]/page.js.nft.json +1 -1
  126. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/web/[kind]/[id]/page_client-reference-manifest.js +1 -1
  127. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/web/page.js +1 -1
  128. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/web/page.js.nft.json +1 -1
  129. package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/web/page_client-reference-manifest.js +1 -1
  130. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js +1 -1
  131. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
  132. package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  133. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
  134. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
  135. package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  136. package/app/.next-cli-build/server/app/(dashboard)/dashboard/resource-monitor/page.js +1 -1
  137. package/app/.next-cli-build/server/app/(dashboard)/dashboard/resource-monitor/page.js.nft.json +1 -1
  138. package/app/.next-cli-build/server/app/(dashboard)/dashboard/resource-monitor/page_client-reference-manifest.js +1 -1
  139. package/app/.next-cli-build/server/app/(dashboard)/dashboard/settings/pricing/page.js +1 -1
  140. package/app/.next-cli-build/server/app/(dashboard)/dashboard/settings/pricing/page.js.nft.json +1 -1
  141. package/app/.next-cli-build/server/app/(dashboard)/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  142. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
  143. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
  144. package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
  145. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
  146. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
  147. package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  148. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
  149. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
  150. package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  151. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
  152. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
  153. package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  154. package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
  155. package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  156. package/app/.next-cli-build/server/app/_global-error.html +1 -1
  157. package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  158. package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  159. package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  160. package/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  161. package/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
  162. package/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
  163. package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  164. package/app/.next-cli-build/server/app/_not-found/page.js +1 -1
  165. package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
  166. package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  167. package/app/.next-cli-build/server/app/_not-found.html +1 -1
  168. package/app/.next-cli-build/server/app/_not-found.rsc +5 -5
  169. package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +5 -5
  170. package/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
  171. package/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +5 -5
  172. package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  173. package/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  174. package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  175. package/app/.next-cli-build/server/app/api/audit-proxy/ca/route.js.nft.json +1 -1
  176. package/app/.next-cli-build/server/app/api/audit-proxy/me/route.js.nft.json +1 -1
  177. package/app/.next-cli-build/server/app/api/audit-proxy/root-ca/route.js.nft.json +1 -1
  178. package/app/.next-cli-build/server/app/api/audit-proxy/route.js +17 -8
  179. package/app/.next-cli-build/server/app/api/audit-proxy/route.js.nft.json +1 -1
  180. package/app/.next-cli-build/server/app/api/audit-proxy/users/route.js.nft.json +1 -1
  181. package/app/.next-cli-build/server/app/api/auth/ldap/test/route.js.nft.json +1 -1
  182. package/app/.next-cli-build/server/app/api/auth/ldap/users/route.js.nft.json +1 -1
  183. package/app/.next-cli-build/server/app/api/auth/login/route.js +1 -1
  184. package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
  185. package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
  186. package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js +1 -1
  187. package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
  188. package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
  189. package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
  190. package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
  191. package/app/.next-cli-build/server/app/api/auth/view-mode/route.js.nft.json +1 -1
  192. package/app/.next-cli-build/server/app/api/branding/[asset]/route.js.nft.json +1 -1
  193. package/app/.next-cli-build/server/app/api/branding/route.js.nft.json +1 -1
  194. package/app/.next-cli-build/server/app/api/branding/upload/route.js.nft.json +1 -1
  195. package/app/.next-cli-build/server/app/api/cli-model-profiles/cloud-models/route.js +1 -1
  196. package/app/.next-cli-build/server/app/api/cli-model-profiles/cloud-models/route.js.nft.json +1 -1
  197. package/app/.next-cli-build/server/app/api/cli-model-profiles/model-catalog/route.js.nft.json +1 -1
  198. package/app/.next-cli-build/server/app/api/cli-model-profiles/route.js.nft.json +1 -1
  199. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +1 -1
  200. package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
  201. package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
  202. package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
  203. package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
  204. package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
  205. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
  206. package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
  207. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
  208. package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
  209. package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
  210. package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
  211. package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
  212. package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
  213. package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
  214. package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
  215. package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
  216. package/app/.next-cli-build/server/app/api/cli-tools/qwen-settings/route.js.nft.json +1 -1
  217. package/app/.next-cli-build/server/app/api/cluster/config/route.js.nft.json +1 -1
  218. package/app/.next-cli-build/server/app/api/cluster/heartbeat/route.js.nft.json +1 -1
  219. package/app/.next-cli-build/server/app/api/cluster/peers/[id]/command/route.js.nft.json +1 -1
  220. package/app/.next-cli-build/server/app/api/cluster/peers/[id]/route.js.nft.json +1 -1
  221. package/app/.next-cli-build/server/app/api/cluster/peers/route.js.nft.json +1 -1
  222. package/app/.next-cli-build/server/app/api/cluster/snapshot/route.js.nft.json +1 -1
  223. package/app/.next-cli-build/server/app/api/cluster/sync/route.js.nft.json +1 -1
  224. package/app/.next-cli-build/server/app/api/cluster/test/route.js.nft.json +1 -1
  225. package/app/.next-cli-build/server/app/api/codex-catalog/download/route.js.nft.json +1 -1
  226. package/app/.next-cli-build/server/app/api/codex-catalog/route.js.nft.json +1 -1
  227. package/app/.next-cli-build/server/app/api/codex-catalog/upload/route.js.nft.json +1 -1
  228. package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
  229. package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
  230. package/app/.next-cli-build/server/app/api/dashboard/ai-power-index/route.js.nft.json +1 -1
  231. package/app/.next-cli-build/server/app/api/dashboard/analytics/ai-models/route.js +1 -1
  232. package/app/.next-cli-build/server/app/api/dashboard/analytics/ai-models/route.js.nft.json +1 -1
  233. package/app/.next-cli-build/server/app/api/dashboard/analytics/analyze/route.js +1 -1
  234. package/app/.next-cli-build/server/app/api/dashboard/analytics/analyze/route.js.nft.json +1 -1
  235. package/app/.next-cli-build/server/app/api/dashboard/analytics/route.js.nft.json +1 -1
  236. package/app/.next-cli-build/server/app/api/dashboard/combos/route.js.nft.json +1 -1
  237. package/app/.next-cli-build/server/app/api/dashboard/endpoint/route.js.nft.json +1 -1
  238. package/app/.next-cli-build/server/app/api/dashboard/prompt-logs/[id]/route.js.nft.json +1 -1
  239. package/app/.next-cli-build/server/app/api/dashboard/prompt-logs/options/route.js.nft.json +1 -1
  240. package/app/.next-cli-build/server/app/api/dashboard/prompt-logs/route.js.nft.json +1 -1
  241. package/app/.next-cli-build/server/app/api/dashboard/token-saver/route.js.nft.json +1 -1
  242. package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
  243. package/app/.next-cli-build/server/app/api/init/route.js.nft.json +1 -1
  244. package/app/.next-cli-build/server/app/api/keys/[id]/caveman-test/route.js +1 -1
  245. package/app/.next-cli-build/server/app/api/keys/[id]/caveman-test/route.js.nft.json +1 -1
  246. package/app/.next-cli-build/server/app/api/keys/[id]/rotate/route.js.nft.json +1 -1
  247. package/app/.next-cli-build/server/app/api/keys/[id]/route.js +1 -1
  248. package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
  249. package/app/.next-cli-build/server/app/api/keys/route.js +2 -2
  250. package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
  251. package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
  252. package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
  253. package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
  254. package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
  255. package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
  256. package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
  257. package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
  258. package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
  259. package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
  260. package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
  261. package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
  262. package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
  263. package/app/.next-cli-build/server/app/api/models/route.js +1 -1
  264. package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
  265. package/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
  266. package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
  267. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
  268. package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
  269. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
  270. package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
  271. package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
  272. package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
  273. package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
  274. package/app/.next-cli-build/server/app/api/oauth/grok-cli/device-code/route.js +1 -1
  275. package/app/.next-cli-build/server/app/api/oauth/grok-cli/device-code/route.js.nft.json +1 -1
  276. package/app/.next-cli-build/server/app/api/oauth/grok-cli/poll/route.js +1 -1
  277. package/app/.next-cli-build/server/app/api/oauth/grok-cli/poll/route.js.nft.json +1 -1
  278. package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
  279. package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
  280. package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
  281. package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
  282. package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
  283. package/app/.next-cli-build/server/app/api/personal-cloud-combos/[id]/api-key-models/route.js +1 -1
  284. package/app/.next-cli-build/server/app/api/personal-cloud-combos/[id]/api-key-models/route.js.nft.json +1 -1
  285. package/app/.next-cli-build/server/app/api/personal-cloud-combos/[id]/route.js +1 -1
  286. package/app/.next-cli-build/server/app/api/personal-cloud-combos/[id]/route.js.nft.json +1 -1
  287. package/app/.next-cli-build/server/app/api/personal-cloud-combos/route.js +1 -1
  288. package/app/.next-cli-build/server/app/api/personal-cloud-combos/route.js.nft.json +1 -1
  289. package/app/.next-cli-build/server/app/api/personal-cloud-providers/[id]/api-key-models/route.js +1 -1
  290. package/app/.next-cli-build/server/app/api/personal-cloud-providers/[id]/api-key-models/route.js.nft.json +1 -1
  291. package/app/.next-cli-build/server/app/api/personal-cloud-providers/[id]/import-models/route.js +1 -1
  292. package/app/.next-cli-build/server/app/api/personal-cloud-providers/[id]/import-models/route.js.nft.json +1 -1
  293. package/app/.next-cli-build/server/app/api/personal-cloud-providers/[id]/models/[...routeModel]/route.js +1 -1
  294. package/app/.next-cli-build/server/app/api/personal-cloud-providers/[id]/models/[...routeModel]/route.js.nft.json +1 -1
  295. package/app/.next-cli-build/server/app/api/personal-cloud-providers/[id]/move/route.js +1 -1
  296. package/app/.next-cli-build/server/app/api/personal-cloud-providers/[id]/move/route.js.nft.json +1 -1
  297. package/app/.next-cli-build/server/app/api/personal-cloud-providers/[id]/route.js +1 -1
  298. package/app/.next-cli-build/server/app/api/personal-cloud-providers/[id]/route.js.nft.json +1 -1
  299. package/app/.next-cli-build/server/app/api/personal-cloud-providers/[id]/usage/route.js +1 -1
  300. package/app/.next-cli-build/server/app/api/personal-cloud-providers/[id]/usage/route.js.nft.json +1 -1
  301. package/app/.next-cli-build/server/app/api/personal-cloud-providers/client/route.js +1 -1
  302. package/app/.next-cli-build/server/app/api/personal-cloud-providers/client/route.js.nft.json +1 -1
  303. package/app/.next-cli-build/server/app/api/personal-cloud-providers/monitor/route.js +1 -1
  304. package/app/.next-cli-build/server/app/api/personal-cloud-providers/monitor/route.js.nft.json +1 -1
  305. package/app/.next-cli-build/server/app/api/personal-cloud-providers/permissions/route.js +1 -1
  306. package/app/.next-cli-build/server/app/api/personal-cloud-providers/permissions/route.js.nft.json +1 -1
  307. package/app/.next-cli-build/server/app/api/personal-cloud-providers/route.js +1 -1
  308. package/app/.next-cli-build/server/app/api/personal-cloud-providers/route.js.nft.json +1 -1
  309. package/app/.next-cli-build/server/app/api/personal-cloud-providers/routing/route.js +1 -1
  310. package/app/.next-cli-build/server/app/api/personal-cloud-providers/routing/route.js.nft.json +1 -1
  311. package/app/.next-cli-build/server/app/api/personal-cloud-providers/shares/route.js +1 -1
  312. package/app/.next-cli-build/server/app/api/personal-cloud-providers/shares/route.js.nft.json +1 -1
  313. package/app/.next-cli-build/server/app/api/personal-cloud-providers/visibility/route.js +1 -1
  314. package/app/.next-cli-build/server/app/api/personal-cloud-providers/visibility/route.js.nft.json +1 -1
  315. package/app/.next-cli-build/server/app/api/pricing/catalog/route.js.nft.json +1 -1
  316. package/app/.next-cli-build/server/app/api/pricing/recalculate/route.js.nft.json +1 -1
  317. package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
  318. package/app/.next-cli-build/server/app/api/provider-health/route.js +1 -1
  319. package/app/.next-cli-build/server/app/api/provider-health/route.js.nft.json +1 -1
  320. package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
  321. package/app/.next-cli-build/server/app/api/provider-nodes/combo-references/route.js.nft.json +1 -1
  322. package/app/.next-cli-build/server/app/api/provider-nodes/custom-embedding/manage/route.js.nft.json +1 -1
  323. package/app/.next-cli-build/server/app/api/provider-nodes/openai-compatible/manage/route.js.nft.json +1 -1
  324. package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
  325. package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
  326. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
  327. package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
  328. package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
  329. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js +1 -1
  330. package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
  331. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
  332. package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
  333. package/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
  334. package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
  335. package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
  336. package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
  337. package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
  338. package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
  339. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js +1 -1
  340. package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
  341. package/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
  342. package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
  343. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
  344. package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
  345. package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
  346. package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
  347. package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
  348. package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
  349. package/app/.next-cli-build/server/app/api/resource-monitor/[id]/route.js.nft.json +1 -1
  350. package/app/.next-cli-build/server/app/api/resource-monitor/ai-models/route.js +1 -1
  351. package/app/.next-cli-build/server/app/api/resource-monitor/ai-models/route.js.nft.json +1 -1
  352. package/app/.next-cli-build/server/app/api/resource-monitor/analyze/route.js +1 -1
  353. package/app/.next-cli-build/server/app/api/resource-monitor/analyze/route.js.nft.json +1 -1
  354. package/app/.next-cli-build/server/app/api/resource-monitor/history/route.js.nft.json +1 -1
  355. package/app/.next-cli-build/server/app/api/resource-monitor/route.js.nft.json +1 -1
  356. package/app/.next-cli-build/server/app/api/settings/database/export/route.js.nft.json +1 -1
  357. package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
  358. package/app/.next-cli-build/server/app/api/settings/prompt-log-db/route.js +5 -2
  359. package/app/.next-cli-build/server/app/api/settings/prompt-log-db/route.js.nft.json +1 -1
  360. package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
  361. package/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
  362. package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
  363. package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
  364. package/app/.next-cli-build/server/app/api/statusline/route.js.nft.json +1 -1
  365. package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
  366. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  367. package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
  368. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +2 -2
  369. package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
  370. package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
  371. package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
  372. package/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
  373. package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
  374. package/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
  375. package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
  376. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
  377. package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
  378. package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
  379. package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
  380. package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
  381. package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
  382. package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
  383. package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
  384. package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
  385. package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
  386. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js +1 -1
  387. package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
  388. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js +1 -1
  389. package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
  390. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +1 -1
  391. package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
  392. package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
  393. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js +1 -1
  394. package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
  395. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
  396. package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
  397. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js +1 -1
  398. package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
  399. package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
  400. package/app/.next-cli-build/server/app/api/v1/messages/route.js +1 -1
  401. package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
  402. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js +1 -1
  403. package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
  404. package/app/.next-cli-build/server/app/api/v1/models/info/route.js +1 -1
  405. package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
  406. package/app/.next-cli-build/server/app/api/v1/models/route.js +1 -1
  407. package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
  408. package/app/.next-cli-build/server/app/api/v1/rate-limits/route.js +1 -1
  409. package/app/.next-cli-build/server/app/api/v1/rate-limits/route.js.nft.json +1 -1
  410. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js +1 -1
  411. package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
  412. package/app/.next-cli-build/server/app/api/v1/responses/route.js +1 -1
  413. package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
  414. package/app/.next-cli-build/server/app/api/v1/route.js +1 -1
  415. package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
  416. package/app/.next-cli-build/server/app/api/v1/search/route.js +1 -1
  417. package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
  418. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js +1 -1
  419. package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
  420. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js +1 -1
  421. package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
  422. package/app/.next-cli-build/server/app/api/v1beta/models/route.js +1 -1
  423. package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
  424. package/app/.next-cli-build/server/app/api/version/restart/route.js.nft.json +1 -1
  425. package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
  426. package/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
  427. package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
  428. package/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
  429. package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
  430. package/app/.next-cli-build/server/app/callback/page.js +1 -1
  431. package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
  432. package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  433. package/app/.next-cli-build/server/app/callback.html +1 -1
  434. package/app/.next-cli-build/server/app/callback.rsc +5 -5
  435. package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +5 -5
  436. package/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
  437. package/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +5 -5
  438. package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
  439. package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  440. package/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
  441. package/app/.next-cli-build/server/app/dashboard/ai-power-index.html +1 -1
  442. package/app/.next-cli-build/server/app/dashboard/ai-power-index.rsc +6 -6
  443. package/app/.next-cli-build/server/app/dashboard/ai-power-index.segments/!KGRhc2hib2FyZCk/dashboard/ai-power-index/__PAGE__.segment.rsc +1 -1
  444. package/app/.next-cli-build/server/app/dashboard/ai-power-index.segments/!KGRhc2hib2FyZCk/dashboard/ai-power-index.segment.rsc +1 -1
  445. package/app/.next-cli-build/server/app/dashboard/ai-power-index.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  446. package/app/.next-cli-build/server/app/dashboard/ai-power-index.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  447. package/app/.next-cli-build/server/app/dashboard/ai-power-index.segments/_full.segment.rsc +6 -6
  448. package/app/.next-cli-build/server/app/dashboard/ai-power-index.segments/_head.segment.rsc +1 -1
  449. package/app/.next-cli-build/server/app/dashboard/ai-power-index.segments/_index.segment.rsc +5 -5
  450. package/app/.next-cli-build/server/app/dashboard/ai-power-index.segments/_tree.segment.rsc +1 -1
  451. package/app/.next-cli-build/server/app/dashboard/api-keys.html +1 -1
  452. package/app/.next-cli-build/server/app/dashboard/api-keys.rsc +9 -9
  453. package/app/.next-cli-build/server/app/dashboard/api-keys.segments/!KGRhc2hib2FyZCk/dashboard/api-keys/__PAGE__.segment.rsc +4 -4
  454. package/app/.next-cli-build/server/app/dashboard/api-keys.segments/!KGRhc2hib2FyZCk/dashboard/api-keys.segment.rsc +1 -1
  455. package/app/.next-cli-build/server/app/dashboard/api-keys.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  456. package/app/.next-cli-build/server/app/dashboard/api-keys.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  457. package/app/.next-cli-build/server/app/dashboard/api-keys.segments/_full.segment.rsc +9 -9
  458. package/app/.next-cli-build/server/app/dashboard/api-keys.segments/_head.segment.rsc +1 -1
  459. package/app/.next-cli-build/server/app/dashboard/api-keys.segments/_index.segment.rsc +5 -5
  460. package/app/.next-cli-build/server/app/dashboard/api-keys.segments/_tree.segment.rsc +1 -1
  461. package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  462. package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +7 -7
  463. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
  464. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
  465. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  466. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  467. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +7 -7
  468. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
  469. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_index.segment.rsc +5 -5
  470. package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
  471. package/app/.next-cli-build/server/app/dashboard/cli-tools/model-profiles.html +1 -1
  472. package/app/.next-cli-build/server/app/dashboard/cli-tools/model-profiles.rsc +8 -8
  473. package/app/.next-cli-build/server/app/dashboard/cli-tools/model-profiles.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/model-profiles/__PAGE__.segment.rsc +3 -3
  474. package/app/.next-cli-build/server/app/dashboard/cli-tools/model-profiles.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/model-profiles.segment.rsc +1 -1
  475. package/app/.next-cli-build/server/app/dashboard/cli-tools/model-profiles.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
  476. package/app/.next-cli-build/server/app/dashboard/cli-tools/model-profiles.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  477. package/app/.next-cli-build/server/app/dashboard/cli-tools/model-profiles.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  478. package/app/.next-cli-build/server/app/dashboard/cli-tools/model-profiles.segments/_full.segment.rsc +8 -8
  479. package/app/.next-cli-build/server/app/dashboard/cli-tools/model-profiles.segments/_head.segment.rsc +1 -1
  480. package/app/.next-cli-build/server/app/dashboard/cli-tools/model-profiles.segments/_index.segment.rsc +5 -5
  481. package/app/.next-cli-build/server/app/dashboard/cli-tools/model-profiles.segments/_tree.segment.rsc +1 -1
  482. package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  483. package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +7 -7
  484. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  485. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
  486. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  487. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  488. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +7 -7
  489. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
  490. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_index.segment.rsc +5 -5
  491. package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
  492. package/app/.next-cli-build/server/app/dashboard/cluster.html +1 -1
  493. package/app/.next-cli-build/server/app/dashboard/cluster.rsc +6 -6
  494. package/app/.next-cli-build/server/app/dashboard/cluster.segments/!KGRhc2hib2FyZCk/dashboard/cluster/__PAGE__.segment.rsc +1 -1
  495. package/app/.next-cli-build/server/app/dashboard/cluster.segments/!KGRhc2hib2FyZCk/dashboard/cluster.segment.rsc +1 -1
  496. package/app/.next-cli-build/server/app/dashboard/cluster.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  497. package/app/.next-cli-build/server/app/dashboard/cluster.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  498. package/app/.next-cli-build/server/app/dashboard/cluster.segments/_full.segment.rsc +6 -6
  499. package/app/.next-cli-build/server/app/dashboard/cluster.segments/_head.segment.rsc +1 -1
  500. package/app/.next-cli-build/server/app/dashboard/cluster.segments/_index.segment.rsc +5 -5
  501. package/app/.next-cli-build/server/app/dashboard/cluster.segments/_tree.segment.rsc +1 -1
  502. package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  503. package/app/.next-cli-build/server/app/dashboard/combos.rsc +7 -7
  504. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  505. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
  506. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  507. package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  508. package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +7 -7
  509. package/app/.next-cli-build/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
  510. package/app/.next-cli-build/server/app/dashboard/combos.segments/_index.segment.rsc +5 -5
  511. package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
  512. package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  513. package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +7 -7
  514. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
  515. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
  516. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  517. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  518. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +7 -7
  519. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
  520. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_index.segment.rsc +5 -5
  521. package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
  522. package/app/.next-cli-build/server/app/dashboard/logs.html +1 -1
  523. package/app/.next-cli-build/server/app/dashboard/logs.rsc +6 -6
  524. package/app/.next-cli-build/server/app/dashboard/logs.segments/!KGRhc2hib2FyZCk/dashboard/logs/__PAGE__.segment.rsc +1 -1
  525. package/app/.next-cli-build/server/app/dashboard/logs.segments/!KGRhc2hib2FyZCk/dashboard/logs.segment.rsc +1 -1
  526. package/app/.next-cli-build/server/app/dashboard/logs.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  527. package/app/.next-cli-build/server/app/dashboard/logs.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  528. package/app/.next-cli-build/server/app/dashboard/logs.segments/_full.segment.rsc +6 -6
  529. package/app/.next-cli-build/server/app/dashboard/logs.segments/_head.segment.rsc +1 -1
  530. package/app/.next-cli-build/server/app/dashboard/logs.segments/_index.segment.rsc +5 -5
  531. package/app/.next-cli-build/server/app/dashboard/logs.segments/_tree.segment.rsc +1 -1
  532. package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  533. package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +7 -7
  534. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
  535. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
  536. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
  537. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  538. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  539. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +7 -7
  540. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
  541. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +5 -5
  542. package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
  543. package/app/.next-cli-build/server/app/dashboard/personal.html +1 -1
  544. package/app/.next-cli-build/server/app/dashboard/personal.rsc +7 -7
  545. package/app/.next-cli-build/server/app/dashboard/personal.segments/!KGRhc2hib2FyZCk/dashboard/personal/__PAGE__.segment.rsc +2 -2
  546. package/app/.next-cli-build/server/app/dashboard/personal.segments/!KGRhc2hib2FyZCk/dashboard/personal.segment.rsc +1 -1
  547. package/app/.next-cli-build/server/app/dashboard/personal.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  548. package/app/.next-cli-build/server/app/dashboard/personal.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  549. package/app/.next-cli-build/server/app/dashboard/personal.segments/_full.segment.rsc +7 -7
  550. package/app/.next-cli-build/server/app/dashboard/personal.segments/_head.segment.rsc +1 -1
  551. package/app/.next-cli-build/server/app/dashboard/personal.segments/_index.segment.rsc +5 -5
  552. package/app/.next-cli-build/server/app/dashboard/personal.segments/_tree.segment.rsc +1 -1
  553. package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  554. package/app/.next-cli-build/server/app/dashboard/profile.rsc +7 -7
  555. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
  556. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
  557. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  558. package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  559. package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +7 -7
  560. package/app/.next-cli-build/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
  561. package/app/.next-cli-build/server/app/dashboard/profile.segments/_index.segment.rsc +5 -5
  562. package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
  563. package/app/.next-cli-build/server/app/dashboard/prompt-logs.html +1 -1
  564. package/app/.next-cli-build/server/app/dashboard/prompt-logs.rsc +6 -6
  565. package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/!KGRhc2hib2FyZCk/dashboard/prompt-logs/__PAGE__.segment.rsc +1 -1
  566. package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/!KGRhc2hib2FyZCk/dashboard/prompt-logs.segment.rsc +1 -1
  567. package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  568. package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  569. package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/_full.segment.rsc +6 -6
  570. package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/_head.segment.rsc +1 -1
  571. package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/_index.segment.rsc +5 -5
  572. package/app/.next-cli-build/server/app/dashboard/prompt-logs.segments/_tree.segment.rsc +1 -1
  573. package/app/.next-cli-build/server/app/dashboard/provider-health.html +1 -1
  574. package/app/.next-cli-build/server/app/dashboard/provider-health.rsc +6 -6
  575. package/app/.next-cli-build/server/app/dashboard/provider-health.segments/!KGRhc2hib2FyZCk/dashboard/provider-health/__PAGE__.segment.rsc +1 -1
  576. package/app/.next-cli-build/server/app/dashboard/provider-health.segments/!KGRhc2hib2FyZCk/dashboard/provider-health.segment.rsc +1 -1
  577. package/app/.next-cli-build/server/app/dashboard/provider-health.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  578. package/app/.next-cli-build/server/app/dashboard/provider-health.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  579. package/app/.next-cli-build/server/app/dashboard/provider-health.segments/_full.segment.rsc +6 -6
  580. package/app/.next-cli-build/server/app/dashboard/provider-health.segments/_head.segment.rsc +1 -1
  581. package/app/.next-cli-build/server/app/dashboard/provider-health.segments/_index.segment.rsc +5 -5
  582. package/app/.next-cli-build/server/app/dashboard/provider-health.segments/_tree.segment.rsc +1 -1
  583. package/app/.next-cli-build/server/app/dashboard/providers/embedding.html +1 -1
  584. package/app/.next-cli-build/server/app/dashboard/providers/embedding.rsc +7 -7
  585. package/app/.next-cli-build/server/app/dashboard/providers/embedding.segments/!KGRhc2hib2FyZCk/dashboard/providers/embedding/__PAGE__.segment.rsc +2 -2
  586. package/app/.next-cli-build/server/app/dashboard/providers/embedding.segments/!KGRhc2hib2FyZCk/dashboard/providers/embedding.segment.rsc +1 -1
  587. package/app/.next-cli-build/server/app/dashboard/providers/embedding.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  588. package/app/.next-cli-build/server/app/dashboard/providers/embedding.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  589. package/app/.next-cli-build/server/app/dashboard/providers/embedding.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  590. package/app/.next-cli-build/server/app/dashboard/providers/embedding.segments/_full.segment.rsc +7 -7
  591. package/app/.next-cli-build/server/app/dashboard/providers/embedding.segments/_head.segment.rsc +1 -1
  592. package/app/.next-cli-build/server/app/dashboard/providers/embedding.segments/_index.segment.rsc +5 -5
  593. package/app/.next-cli-build/server/app/dashboard/providers/embedding.segments/_tree.segment.rsc +1 -1
  594. package/app/.next-cli-build/server/app/dashboard/providers/image-to-text.html +1 -1
  595. package/app/.next-cli-build/server/app/dashboard/providers/image-to-text.rsc +7 -7
  596. package/app/.next-cli-build/server/app/dashboard/providers/image-to-text.segments/!KGRhc2hib2FyZCk/dashboard/providers/image-to-text/__PAGE__.segment.rsc +2 -2
  597. package/app/.next-cli-build/server/app/dashboard/providers/image-to-text.segments/!KGRhc2hib2FyZCk/dashboard/providers/image-to-text.segment.rsc +1 -1
  598. package/app/.next-cli-build/server/app/dashboard/providers/image-to-text.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  599. package/app/.next-cli-build/server/app/dashboard/providers/image-to-text.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  600. package/app/.next-cli-build/server/app/dashboard/providers/image-to-text.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  601. package/app/.next-cli-build/server/app/dashboard/providers/image-to-text.segments/_full.segment.rsc +7 -7
  602. package/app/.next-cli-build/server/app/dashboard/providers/image-to-text.segments/_head.segment.rsc +1 -1
  603. package/app/.next-cli-build/server/app/dashboard/providers/image-to-text.segments/_index.segment.rsc +5 -5
  604. package/app/.next-cli-build/server/app/dashboard/providers/image-to-text.segments/_tree.segment.rsc +1 -1
  605. package/app/.next-cli-build/server/app/dashboard/providers/image.html +1 -1
  606. package/app/.next-cli-build/server/app/dashboard/providers/image.rsc +7 -7
  607. package/app/.next-cli-build/server/app/dashboard/providers/image.segments/!KGRhc2hib2FyZCk/dashboard/providers/image/__PAGE__.segment.rsc +2 -2
  608. package/app/.next-cli-build/server/app/dashboard/providers/image.segments/!KGRhc2hib2FyZCk/dashboard/providers/image.segment.rsc +1 -1
  609. package/app/.next-cli-build/server/app/dashboard/providers/image.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  610. package/app/.next-cli-build/server/app/dashboard/providers/image.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  611. package/app/.next-cli-build/server/app/dashboard/providers/image.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  612. package/app/.next-cli-build/server/app/dashboard/providers/image.segments/_full.segment.rsc +7 -7
  613. package/app/.next-cli-build/server/app/dashboard/providers/image.segments/_head.segment.rsc +1 -1
  614. package/app/.next-cli-build/server/app/dashboard/providers/image.segments/_index.segment.rsc +5 -5
  615. package/app/.next-cli-build/server/app/dashboard/providers/image.segments/_tree.segment.rsc +1 -1
  616. package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  617. package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +7 -7
  618. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  619. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
  620. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  621. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  622. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  623. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +7 -7
  624. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
  625. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_index.segment.rsc +5 -5
  626. package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
  627. package/app/.next-cli-build/server/app/dashboard/providers/stt.html +1 -1
  628. package/app/.next-cli-build/server/app/dashboard/providers/stt.rsc +7 -7
  629. package/app/.next-cli-build/server/app/dashboard/providers/stt.segments/!KGRhc2hib2FyZCk/dashboard/providers/stt/__PAGE__.segment.rsc +2 -2
  630. package/app/.next-cli-build/server/app/dashboard/providers/stt.segments/!KGRhc2hib2FyZCk/dashboard/providers/stt.segment.rsc +1 -1
  631. package/app/.next-cli-build/server/app/dashboard/providers/stt.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  632. package/app/.next-cli-build/server/app/dashboard/providers/stt.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  633. package/app/.next-cli-build/server/app/dashboard/providers/stt.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  634. package/app/.next-cli-build/server/app/dashboard/providers/stt.segments/_full.segment.rsc +7 -7
  635. package/app/.next-cli-build/server/app/dashboard/providers/stt.segments/_head.segment.rsc +1 -1
  636. package/app/.next-cli-build/server/app/dashboard/providers/stt.segments/_index.segment.rsc +5 -5
  637. package/app/.next-cli-build/server/app/dashboard/providers/stt.segments/_tree.segment.rsc +1 -1
  638. package/app/.next-cli-build/server/app/dashboard/providers/tts.html +1 -1
  639. package/app/.next-cli-build/server/app/dashboard/providers/tts.rsc +7 -7
  640. package/app/.next-cli-build/server/app/dashboard/providers/tts.segments/!KGRhc2hib2FyZCk/dashboard/providers/tts/__PAGE__.segment.rsc +2 -2
  641. package/app/.next-cli-build/server/app/dashboard/providers/tts.segments/!KGRhc2hib2FyZCk/dashboard/providers/tts.segment.rsc +1 -1
  642. package/app/.next-cli-build/server/app/dashboard/providers/tts.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  643. package/app/.next-cli-build/server/app/dashboard/providers/tts.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  644. package/app/.next-cli-build/server/app/dashboard/providers/tts.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  645. package/app/.next-cli-build/server/app/dashboard/providers/tts.segments/_full.segment.rsc +7 -7
  646. package/app/.next-cli-build/server/app/dashboard/providers/tts.segments/_head.segment.rsc +1 -1
  647. package/app/.next-cli-build/server/app/dashboard/providers/tts.segments/_index.segment.rsc +5 -5
  648. package/app/.next-cli-build/server/app/dashboard/providers/tts.segments/_tree.segment.rsc +1 -1
  649. package/app/.next-cli-build/server/app/dashboard/providers/web.html +1 -1
  650. package/app/.next-cli-build/server/app/dashboard/providers/web.rsc +7 -7
  651. package/app/.next-cli-build/server/app/dashboard/providers/web.segments/!KGRhc2hib2FyZCk/dashboard/providers/web/__PAGE__.segment.rsc +2 -2
  652. package/app/.next-cli-build/server/app/dashboard/providers/web.segments/!KGRhc2hib2FyZCk/dashboard/providers/web.segment.rsc +1 -1
  653. package/app/.next-cli-build/server/app/dashboard/providers/web.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  654. package/app/.next-cli-build/server/app/dashboard/providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  655. package/app/.next-cli-build/server/app/dashboard/providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  656. package/app/.next-cli-build/server/app/dashboard/providers/web.segments/_full.segment.rsc +7 -7
  657. package/app/.next-cli-build/server/app/dashboard/providers/web.segments/_head.segment.rsc +1 -1
  658. package/app/.next-cli-build/server/app/dashboard/providers/web.segments/_index.segment.rsc +5 -5
  659. package/app/.next-cli-build/server/app/dashboard/providers/web.segments/_tree.segment.rsc +1 -1
  660. package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  661. package/app/.next-cli-build/server/app/dashboard/providers.rsc +7 -7
  662. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  663. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  664. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  665. package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  666. package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +7 -7
  667. package/app/.next-cli-build/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
  668. package/app/.next-cli-build/server/app/dashboard/providers.segments/_index.segment.rsc +5 -5
  669. package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
  670. package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  671. package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +7 -7
  672. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
  673. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
  674. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  675. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  676. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +7 -7
  677. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
  678. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +5 -5
  679. package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
  680. package/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
  681. package/app/.next-cli-build/server/app/dashboard/quota.rsc +8 -8
  682. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
  683. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
  684. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  685. package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  686. package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +8 -8
  687. package/app/.next-cli-build/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
  688. package/app/.next-cli-build/server/app/dashboard/quota.segments/_index.segment.rsc +5 -5
  689. package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
  690. package/app/.next-cli-build/server/app/dashboard/resource-monitor.html +1 -1
  691. package/app/.next-cli-build/server/app/dashboard/resource-monitor.rsc +6 -6
  692. package/app/.next-cli-build/server/app/dashboard/resource-monitor.segments/!KGRhc2hib2FyZCk/dashboard/resource-monitor/__PAGE__.segment.rsc +1 -1
  693. package/app/.next-cli-build/server/app/dashboard/resource-monitor.segments/!KGRhc2hib2FyZCk/dashboard/resource-monitor.segment.rsc +1 -1
  694. package/app/.next-cli-build/server/app/dashboard/resource-monitor.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  695. package/app/.next-cli-build/server/app/dashboard/resource-monitor.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  696. package/app/.next-cli-build/server/app/dashboard/resource-monitor.segments/_full.segment.rsc +6 -6
  697. package/app/.next-cli-build/server/app/dashboard/resource-monitor.segments/_head.segment.rsc +1 -1
  698. package/app/.next-cli-build/server/app/dashboard/resource-monitor.segments/_index.segment.rsc +5 -5
  699. package/app/.next-cli-build/server/app/dashboard/resource-monitor.segments/_tree.segment.rsc +1 -1
  700. package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  701. package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +6 -6
  702. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  703. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings/pricing.segment.rsc +1 -1
  704. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings.segment.rsc +1 -1
  705. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  706. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  707. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +6 -6
  708. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  709. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +5 -5
  710. package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
  711. package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
  712. package/app/.next-cli-build/server/app/dashboard/skills.rsc +7 -7
  713. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +2 -2
  714. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills.segment.rsc +1 -1
  715. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  716. package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  717. package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +7 -7
  718. package/app/.next-cli-build/server/app/dashboard/skills.segments/_head.segment.rsc +1 -1
  719. package/app/.next-cli-build/server/app/dashboard/skills.segments/_index.segment.rsc +5 -5
  720. package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +1 -1
  721. package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
  722. package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +6 -6
  723. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +1 -1
  724. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver.segment.rsc +1 -1
  725. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  726. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  727. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +6 -6
  728. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_head.segment.rsc +1 -1
  729. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_index.segment.rsc +5 -5
  730. package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
  731. package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  732. package/app/.next-cli-build/server/app/dashboard/translator.rsc +7 -7
  733. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  734. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
  735. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  736. package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  737. package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +7 -7
  738. package/app/.next-cli-build/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
  739. package/app/.next-cli-build/server/app/dashboard/translator.segments/_index.segment.rsc +5 -5
  740. package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
  741. package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  742. package/app/.next-cli-build/server/app/dashboard/usage.rsc +7 -7
  743. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
  744. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
  745. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  746. package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  747. package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +7 -7
  748. package/app/.next-cli-build/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
  749. package/app/.next-cli-build/server/app/dashboard/usage.segments/_index.segment.rsc +5 -5
  750. package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
  751. package/app/.next-cli-build/server/app/dashboard.html +1 -1
  752. package/app/.next-cli-build/server/app/dashboard.rsc +7 -7
  753. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  754. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  755. package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  756. package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +7 -7
  757. package/app/.next-cli-build/server/app/dashboard.segments/_head.segment.rsc +1 -1
  758. package/app/.next-cli-build/server/app/dashboard.segments/_index.segment.rsc +5 -5
  759. package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
  760. package/app/.next-cli-build/server/app/favicon.ico/route.js.nft.json +1 -1
  761. package/app/.next-cli-build/server/app/index.html +1 -1
  762. package/app/.next-cli-build/server/app/index.rsc +5 -5
  763. package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  764. package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +5 -5
  765. package/app/.next-cli-build/server/app/index.segments/_head.segment.rsc +1 -1
  766. package/app/.next-cli-build/server/app/index.segments/_index.segment.rsc +5 -5
  767. package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
  768. package/app/.next-cli-build/server/app/landing/page.js +1 -1
  769. package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
  770. package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  771. package/app/.next-cli-build/server/app/landing.html +1 -1
  772. package/app/.next-cli-build/server/app/landing.rsc +5 -5
  773. package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +5 -5
  774. package/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
  775. package/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +5 -5
  776. package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
  777. package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
  778. package/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
  779. package/app/.next-cli-build/server/app/login/page.js +1 -1
  780. package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
  781. package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  782. package/app/.next-cli-build/server/app/login.html +1 -1
  783. package/app/.next-cli-build/server/app/login.rsc +6 -6
  784. package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +6 -6
  785. package/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
  786. package/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +5 -5
  787. package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
  788. package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  789. package/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
  790. package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  791. package/app/.next-cli-build/server/app/page.js +1 -1
  792. package/app/.next-cli-build/server/app/page.js.nft.json +1 -1
  793. package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  794. package/app/.next-cli-build/server/app-paths-manifest.json +17 -17
  795. package/app/.next-cli-build/server/chunks/1583.js +4 -0
  796. package/app/.next-cli-build/server/chunks/238.js +1 -0
  797. package/app/.next-cli-build/server/chunks/2428.js +1 -1
  798. package/app/.next-cli-build/server/chunks/3042.js +1 -0
  799. package/app/.next-cli-build/server/chunks/3399.js +1 -1
  800. package/app/.next-cli-build/server/chunks/3738.js +1 -1
  801. package/app/.next-cli-build/server/chunks/402.js +6 -4
  802. package/app/.next-cli-build/server/chunks/4746.js +1 -1
  803. package/app/.next-cli-build/server/chunks/4778.js +1 -1
  804. package/app/.next-cli-build/server/chunks/5024.js +1 -0
  805. package/app/.next-cli-build/server/chunks/5210.js +1 -1
  806. package/app/.next-cli-build/server/chunks/6811.js +1 -1
  807. package/app/.next-cli-build/server/chunks/689.js +6 -4
  808. package/app/.next-cli-build/server/chunks/6992.js +2 -2
  809. package/app/.next-cli-build/server/chunks/8255.js +1 -1
  810. package/app/.next-cli-build/server/chunks/8590.js +1 -1
  811. package/app/.next-cli-build/server/chunks/9293.js +1 -0
  812. package/app/.next-cli-build/server/chunks/9489.js +1 -1
  813. package/app/.next-cli-build/server/instrumentation.js +1 -1
  814. package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  815. package/app/.next-cli-build/server/middleware.js +1 -1
  816. package/app/.next-cli-build/server/pages/404.html +1 -1
  817. package/app/.next-cli-build/server/pages/500.html +1 -1
  818. package/app/.next-cli-build/static/chunks/2793-b3a4461f8347c3f1.js +1 -0
  819. package/app/.next-cli-build/static/chunks/{5263-bca625e0dd9b7bf9.js → 5263-b7941fae776c4373.js} +1 -1
  820. package/app/.next-cli-build/static/chunks/{7413-3e5afea5c22f910a.js → 7413-87f4038b5317729f.js} +1 -1
  821. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/api-keys/page-fa6ae9cb4ba87b70.js +24 -0
  822. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/audit-proxy/{page-4f2e8def23f3f005.js → page-8ddbfc576e6c54b4.js} +1 -1
  823. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/basic-chat/{page-3de740618a468209.js → page-3b6fe31430b96954.js} +1 -1
  824. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/[toolId]/{page-f8a6d165b26aaf5a.js → page-678b01b8b35e85fd.js} +1 -1
  825. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/model-profiles/{page-8935236e1f866fca.js → page-3c1dbf4a4cb14dcb.js} +1 -1
  826. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-3b28c09213ab1bea.js → page-0498f663a08738f1.js} +1 -1
  827. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/combos/{page-4d39bc7a667da5a2.js → page-c64166b1525750d0.js} +1 -1
  828. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/console-log/{page-7782a481be255ba6.js → page-b027f589b9f76fa8.js} +1 -1
  829. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/endpoint/{page-e38eb4f9135a5005.js → page-b28c25f5c4b94189.js} +1 -1
  830. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/logs/console/{page-b6895a7c4d70ae65.js → page-7e0fb3db5ded3275.js} +1 -1
  831. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/[id]/{page-74c4a203f2d082ca.js → page-e5b6794cd8a6364f.js} +1 -1
  832. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/[kind]/{page-2066d15d50185051.js → page-f408f6e27a9760bb.js} +1 -1
  833. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/combo/[id]/{page-f89986d814b13c83.js → page-68040f2d7e3f076b.js} +1 -1
  834. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/media-providers/web/{page-6bcc9fa0051952cb.js → page-71731eef239fdab0.js} +1 -1
  835. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/{page-e38eb4f9135a5005.js → page-b28c25f5c4b94189.js} +1 -1
  836. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/personal/{page-9a341b6c7310ad34.js → page-db1a1700eea425f9.js} +1 -1
  837. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/personalcloudprovider/{layout-edda63ea02c3ee78.js → layout-4d30604723c64128.js} +1 -1
  838. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/personalcloudprovider/{page-b93abae5023a85cf.js → page-4c7c9a82cd4c06e4.js} +1 -1
  839. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/personalcloudprovidermonitor/{page-a6dc0b4339a4d9bd.js → page-b729e99653688409.js} +1 -1
  840. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/personalquota/{page-d11481e430225507.js → page-0537a2fa161b82eb.js} +1 -1
  841. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/profile/page-bfe98cb1f3da9ddd.js +1 -0
  842. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/{page-a2d7718a46f23583.js → page-dfb9cb61a2e3114b.js} +1 -1
  843. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/embedding/[id]/{page-400b6d127fc405b4.js → page-182a798f8ca008a1.js} +1 -1
  844. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/embedding/{page-2066d15d50185051.js → page-f408f6e27a9760bb.js} +1 -1
  845. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/image/[id]/{page-400b6d127fc405b4.js → page-182a798f8ca008a1.js} +1 -1
  846. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/{image-to-text/page-2066d15d50185051.js → image/page-f408f6e27a9760bb.js} +1 -1
  847. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/image-to-text/[id]/{page-400b6d127fc405b4.js → page-182a798f8ca008a1.js} +1 -1
  848. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/{image/page-2066d15d50185051.js → image-to-text/page-f408f6e27a9760bb.js} +1 -1
  849. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/new/{page-ef4f4a36e0ae5f8f.js → page-1710ccdfda2a7cbf.js} +1 -1
  850. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/{page-5652d62b22c03565.js → page-f195d485859696b8.js} +1 -1
  851. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/stt/[id]/{page-400b6d127fc405b4.js → page-182a798f8ca008a1.js} +1 -1
  852. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/stt/page-f408f6e27a9760bb.js +1 -0
  853. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/tts/[id]/page-182a798f8ca008a1.js +1 -0
  854. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/tts/page-f408f6e27a9760bb.js +1 -0
  855. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/web/[kind]/[id]/{page-f21e487a475ae11e.js → page-e46c0847d86fc008.js} +1 -1
  856. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/web/{page-6bcc9fa0051952cb.js → page-71731eef239fdab0.js} +1 -1
  857. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/proxy-pools/{page-cfe69843fa6b8bcb.js → page-2043197f3715fe4c.js} +1 -1
  858. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/quota/{page-d9b185af46d82c0a.js → page-3a4844e727cfec8f.js} +1 -1
  859. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/{page-8b9e1c8be804971d.js → page-1b1ae93c3f398083.js} +1 -1
  860. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/translator/{page-c5db4eaeba510642.js → page-bc64c0e184eef9d3.js} +1 -1
  861. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/usage/{page-126235bff3c64952.js → page-b6a76e695fa879b2.js} +1 -1
  862. package/app/.next-cli-build/static/chunks/app/(dashboard)/{layout-259d197fb4549037.js → layout-c33de7f43266076b.js} +1 -1
  863. package/app/.next-cli-build/static/chunks/app/{layout-db21980eededc57c.js → layout-bf4de7a5f9e7315c.js} +1 -1
  864. package/app/.next-cli-build/static/chunks/app/login/{page-62f5a0e3540ad0ee.js → page-071c3519fddc7b20.js} +1 -1
  865. package/app/cli/.build-home/AppData/Roaming/bluerouter/db/data.sqlite-shm +0 -0
  866. package/app/cli/.build-home/AppData/Roaming/bluerouter/db/data.sqlite-wal +0 -0
  867. package/app/package.json +1 -1
  868. package/package.json +1 -1
  869. package/app/.next-cli-build/server/chunks/2507.js +0 -1
  870. package/app/.next-cli-build/server/chunks/2611.js +0 -1
  871. package/app/.next-cli-build/server/chunks/436.js +0 -1
  872. package/app/.next-cli-build/server/chunks/5915.js +0 -1
  873. package/app/.next-cli-build/server/chunks/6064.js +0 -1
  874. package/app/.next-cli-build/server/chunks/8347.js +0 -1
  875. package/app/.next-cli-build/static/chunks/5564-1a19fcc53b3c3799.js +0 -1
  876. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/api-keys/page-369540b70a5900d2.js +0 -24
  877. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/profile/page-aeb3e20ebe5633da.js +0 -1
  878. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/stt/page-2066d15d50185051.js +0 -1
  879. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/tts/[id]/page-400b6d127fc405b4.js +0 -1
  880. package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/tts/page-2066d15d50185051.js +0 -1
  881. /package/app/.next-cli-build/static/{PxXrQn1altmhav3s2vRkE → 8HLcfPZQbiQFkzvYyYlAK}/_buildManifest.js +0 -0
  882. /package/app/.next-cli-build/static/{PxXrQn1altmhav3s2vRkE → 8HLcfPZQbiQFkzvYyYlAK}/_ssgManifest.js +0 -0
  883. /package/app/cli/.build-home/AppData/Roaming/bluerouter/db/backups/{upgrade-5.5.17-to-5.5.18-5.5.18-20260918-093202 → upgrade-5.5.23-to-5.5.25-5.5.25-20260923-082441}/data.sqlite +0 -0
@@ -1,24 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7593],{9385:(e,t,n)=>{"use strict";n.d(t,{Ek:()=>h,FY:()=>f,H1:()=>p,O0:()=>o,Zn:()=>j,cL:()=>g,j5:()=>u,pA:()=>s,u1:()=>b});let s=["coder","fast","thinking"],r=["claude","codex"],l={claude:"claude/",codex:"codex/"},a={coder:{model:"",contextWindow:0},fast:{model:"",contextWindow:0},thinking:{model:"",contextWindow:0}},o={version:2,local:{enabled:!0,providerName:"Local AI",autoCompactPct:75,models:{coder:{model:"programmer",contextWindow:12e4},fast:{model:"programmer-fast",contextWindow:12e4},thinking:{model:"programmer",contextWindow:12e4}}},cloud:{claude:{enabled:!1,providerName:"Claude Code Cloud",models:a},codex:{enabled:!1,providerName:"Codex Cloud",models:a}}};function i(e,t=300){return String(e??"").trim().slice(0,t)}function d(e,t){let n=Number(e);return!Number.isFinite(n)||n<=0?t:Math.floor(n)}function c(e,t=75){let n=Number(e);return Number.isFinite(n)?Math.min(100,Math.max(1,Math.floor(n))):t}function m(e,t,{local:n}){let r=e&&"object"==typeof e&&!Array.isArray(e)?e:{},l=r.models&&"object"==typeof r.models&&!Array.isArray(r.models)?r.models:{},a={};for(let e of s)a[e]=function(e,t,{local:n}){let s=e&&"object"==typeof e&&!Array.isArray(e)?e:{};return{model:i(Object.prototype.hasOwnProperty.call(s,"model")?s.model:t.model),contextWindow:n?d(s.contextWindow,t.contextWindow||12e4):0}}(l[e],t.models[e],{local:n});let o={enabled:Object.prototype.hasOwnProperty.call(r,"enabled")?!0===r.enabled:t.enabled,providerName:i(Object.prototype.hasOwnProperty.call(r,"providerName")?r.providerName:t.providerName,80)||t.providerName,models:a};return n&&(o.autoCompactPct=c(r.autoCompactPct,t.autoCompactPct)),o}function x(e,t){if(!e||"object"!=typeof e||Array.isArray(e)||e.claude||e.codex)return null;let n=e.models&&"object"==typeof e.models&&!Array.isArray(e.models)?e.models:{},r=s.map(e=>i(n?.[e]?.model)).filter(Boolean),a=l[t];return a&&0!==r.length&&r.every(e=>e.startsWith(a))?e:null}function u(e={}){let t=e&&"object"==typeof e&&!Array.isArray(e)?e:{},n=t.cloud&&"object"==typeof t.cloud&&!Array.isArray(t.cloud)?t.cloud:{};return{version:2,local:m(t.local,o.local,{local:!0}),cloud:{claude:m(n.claude||x(n,"claude"),o.cloud.claude,{local:!1}),codex:m(n.codex||x(n,"codex"),o.cloud.codex,{local:!1})}}}function h(e,t){return r.includes(t)&&e?.cloud?.[t]||null}function p(e){return l[e]||""}function g(e,t,n=""){return i(e?.models?.[t]?.model)||n}function b(e,t,n=12e4){return d(e?.models?.[t]?.contextWindow,n)}function f(e){return[...new Set(s.map(t=>g(e,t)).filter(Boolean))]}function j(e){return Math.max(1,Math.floor(b(e,"coder")*c(e?.autoCompactPct)/100))}},56484:(e,t,n)=>{"use strict";n.d(t,{default:()=>R});var s=n(95155),r=n(12115),l=n(35497),a=n(94027),o=n(11059);let i=Object.freeze({enabled:!0,requestsPerMinute:20,maxOutputTokens:0,forceThinkingOff:!0,allowedIpCidrs:[],expiresAt:""});function d(e){return String(e||"").trim().toLowerCase()}function c(e){return Array.isArray(e)?[...new Set(e.map(e=>String(e||"").trim()).filter(Boolean))]:[]}function m(e,t){let n=c(e?.allowedModels),s=n[0]||String(t||"programmer").trim()||"programmer",r=n.find(e=>/fast|small|haiku/i.test(e))||n.find(e=>e!==s)||s;return{codingModel:s,fastModel:r}}let x="model_catalog.json";function u({icon:e,materialIcon:t,image:n,children:r,className:l=""}){return(0,s.jsxs)("span",{className:`inline-flex items-center gap-1.5 ${l}`,children:[n?(0,s.jsx)("img",{src:n,alt:"","aria-hidden":"true",className:"size-4 rounded-sm object-contain"}):t?(0,s.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[17px] leading-none",children:t}):e?(0,s.jsx)("span",{"aria-hidden":"true",className:"text-base leading-none",children:e}):null,(0,s.jsx)("span",{children:r})]})}function h(e,t=0){let n=Number(e);return Number.isFinite(n)?Math.max(0,Math.floor(n)):t}function p(e,t=!0){return null==e||""===e?t:!0===e||"true"===e||1===e||"1"===e}function g(e){return Array.isArray(e)?[...new Set(e.map(e=>String(e||"").trim()).filter(Boolean))]:[]}function b(e){return e&&"object"==typeof e&&!Array.isArray(e)&&Object.keys(e).length>0}function f(e={},t={}){let n={...t},s=e&&"object"==typeof e&&!Array.isArray(e)?e:{};return{enabled:p(s.enabled??n.enabled,!0),requestsPerMinute:h(s.requestsPerMinute??n.requestsPerMinute,0),maxOutputTokens:h(s.maxOutputTokens??s.outputTokensMax??s.maxTokens??s.max_tokens??s.max_completion_tokens??n.maxOutputTokens,0),forceThinkingOff:p(s.forceThinkingOff??n.forceThinkingOff,!0),allowedIpCidrs:g(s.allowedIpCidrs??n.allowedIpCidrs),expiresAt:String(s.expiresAt??n.expiresAt??"").trim()}}function j({models:e,emptyLabel:t="Chưa g\xe1n model"}){let n=c(e);return 0===n.length?(0,s.jsx)("span",{className:"text-xs text-text-muted",children:t}):(0,s.jsxs)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[n.slice(0,8).map(e=>(0,s.jsx)("span",{className:"rounded-full border border-border bg-surface px-2 py-1 font-mono text-xs",children:e},e)),n.length>8?(0,s.jsxs)("span",{className:"rounded-full border border-border bg-surface px-2 py-1 text-xs",children:["+",n.length-8," model kh\xe1c"]}):null]})}function y({limits:e,showThinking:t=!1,showOutputLimit:n=!1}){if(!b(e))return(0,s.jsx)("div",{className:"mt-2 flex flex-wrap gap-2 text-xs text-text-muted",children:(0,s.jsx)("span",{className:"rounded-full border border-border bg-surface px-2 py-1",children:"policy: chưa set, kh\xf4ng giới hạn"})});let r=f(e);return(0,s.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2 text-xs text-text-muted",children:[(0,s.jsxs)("span",{className:"rounded-full border border-border bg-surface px-2 py-1",children:["policy: ",r.enabled?"bật":"tắt"]}),(0,s.jsxs)("span",{className:"rounded-full border border-border bg-surface px-2 py-1",children:[r.requestsPerMinute||"∞"," req/ph\xfat"]}),n?(0,s.jsxs)("span",{className:"rounded-full border border-border bg-surface px-2 py-1",children:[r.maxOutputTokens||"∞"," output tokens"]}):null,t?(0,s.jsxs)("span",{className:"rounded-full border border-border bg-surface px-2 py-1",children:["thinking: ",r.forceThinkingOff?"force off":"client tự quyết"]}):null,r.allowedIpCidrs.length>0?(0,s.jsx)("span",{className:"rounded-full border border-border bg-surface px-2 py-1",children:"IP locked"}):null]})}function v({label:e,value:t,onChange:n,hint:r}){return(0,s.jsxs)("label",{className:"block",children:[(0,s.jsx)("span",{className:"mb-1 block text-xs font-medium text-text-muted",children:e}),(0,s.jsx)("input",{type:"number",min:"0",value:t,onChange:e=>n(h(e.target.value,0)),className:"w-full rounded-xl border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary"}),r?(0,s.jsx)("span",{className:"mt-1 block text-xs text-text-muted",children:r}):null]})}function N({isOpen:e,keyName:t,policy:n,setPolicy:r,onClose:a,onSave:o,onClear:d,saving:c,clearLabel:m="X\xf3a policy / kh\xf4ng limit"}){let x=f(n,i),u=(e,t)=>r(n=>f({...n,[e]:t},i));return(0,s.jsx)(l.aF,{isOpen:e,onClose:a,title:`Policy API key: ${t||"API Key"}`,size:"xl",children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"rounded-xl border border-border bg-surface/60 p-3 text-sm text-text-muted",children:["Key mới tự c\xf3 ",(0,s.jsx)("b",{children:"default policy"}),". Chỉ admin được sửa policy. Request/ph\xfat = 0 nghĩa l\xe0 kh\xf4ng giới hạn tần suất. Max output tokens = 0 nghĩa l\xe0 kh\xf4ng \xe9p giới hạn output."]}),(0,s.jsxs)("label",{className:"flex items-center justify-between gap-3 rounded-xl border border-border p-3 text-sm",children:[(0,s.jsxs)("span",{children:[(0,s.jsx)("b",{children:"Bật policy"}),(0,s.jsx)("br",{}),(0,s.jsx)("span",{className:"text-xs text-text-muted",children:"Tắt mục n\xe0y th\xec policy được lưu nhưng kh\xf4ng \xe1p limit."})]}),(0,s.jsx)("input",{type:"checkbox",checked:x.enabled,onChange:e=>u("enabled",e.target.checked)})]}),(0,s.jsxs)("div",{className:"grid gap-3 md:grid-cols-2",children:[(0,s.jsx)(v,{label:"Request / ph\xfat",value:x.requestsPerMinute,onChange:e=>u("requestsPerMinute",e),hint:"0 = kh\xf4ng giới hạn tần suất. Khuyến nghị user thường: 10–20 req/ph\xfat."}),(0,s.jsx)(v,{label:"Max output tokens",value:x.maxOutputTokens,onChange:e=>u("maxOutputTokens",e),hint:"0 = kh\xf4ng giới hạn. VS Code khuyến nghị 2048–3072; chat d\xe0i 4096–8192."})]}),(0,s.jsxs)("label",{className:"flex items-center justify-between gap-3 rounded-xl border border-border p-3 text-sm",children:[(0,s.jsxs)("span",{children:[(0,s.jsx)("b",{children:"Force Thinking Off"}),(0,s.jsx)("br",{}),(0,s.jsx)("span",{className:"text-xs text-text-muted",children:"Khi bật, gateway \xe9p request c\xf3 chat_template_kwargs.enable_thinking=false theo chuẩn llama.cpp."})]}),(0,s.jsx)("input",{type:"checkbox",checked:x.forceThinkingOff,onChange:e=>u("forceThinkingOff",e.target.checked)})]}),(0,s.jsxs)("label",{className:"block",children:[(0,s.jsx)("span",{className:"mb-1 block text-xs font-medium text-text-muted",children:"IP/CIDR được ph\xe9p"}),(0,s.jsx)("textarea",{value:g(x.allowedIpCidrs).join("\n"),onChange:e=>u("allowedIpCidrs",[...new Set(String(e.target.value||"").split(/[\n,]+/).map(e=>e.trim()).filter(Boolean))]),rows:3,className:"w-full rounded-xl border border-border bg-background px-3 py-2 font-mono text-sm text-text-main outline-none focus:border-primary",placeholder:"10.0.0.0/8\n192.168.0.0/16"}),(0,s.jsx)("span",{className:"mt-1 block text-xs text-text-muted",children:"Để trống = mọi IP. Hỗ trợ IPv4 exact hoặc CIDR."})]}),(0,s.jsxs)("label",{className:"block",children:[(0,s.jsx)("span",{className:"mb-1 block text-xs font-medium text-text-muted",children:"Hết hạn l\xfac"}),(0,s.jsx)("input",{value:x.expiresAt,onChange:e=>u("expiresAt",e.target.value),className:"w-full rounded-xl border border-border bg-background px-3 py-2 font-mono text-sm text-text-main outline-none focus:border-primary",placeholder:"2026-12-31T23:59:59+07:00 hoặc để trống"})]}),(0,s.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:[(0,s.jsx)(l.$n,{variant:"ghost",onClick:a,children:"Hủy"}),d?(0,s.jsx)(l.$n,{variant:"outline",onClick:d,disabled:c,children:m}):null,(0,s.jsx)(l.$n,{onClick:()=>o(x),disabled:c,children:c?"Đang lưu...":"Lưu policy"})]})]})})}function k({open:e,keyName:t,models:n,setModels:a,activeProviders:o,modelAliases:i,onClose:d,onSave:m,saving:x,personalOnly:u,extraModels:h}){let[p,g]=(0,r.useState)(!1),b=c(n),f=e=>{let t=e?.value||e?.name||e;a(e=>c(e).filter(e=>e!==t))};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.aF,{isOpen:e,onClose:d,title:`Model access: ${t||"API Key"}`,size:"xl",children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"Chọn một hoặc nhiều model m\xe0 API key n\xe0y được ph\xe9p sử dụng. Trang n\xe0y kh\xf4ng cho lưu danh s\xe1ch model rỗng."}),(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)("span",{className:"text-sm font-medium",children:"Model được ph\xe9p d\xf9ng"}),(0,s.jsx)(l.$n,{size:"sm",variant:"outline",onClick:()=>g(!0),children:"Th\xeam model"})]}),0===b.length?(0,s.jsx)("div",{className:"rounded-xl border border-dashed border-border p-4 text-sm text-text-muted",children:"Chưa chọn model n\xe0o. H\xe3y th\xeam \xedt nhất một model trước khi lưu."}):(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:b.map(e=>(0,s.jsxs)("button",{type:"button",onClick:()=>f(e),className:"rounded-full border border-primary/30 bg-primary/10 px-2 py-1 font-mono text-xs text-primary transition hover:bg-red-500/10 hover:text-red-600",title:"Bấm để gỡ model n\xe0y",children:[e," \xd7"]},e))}),(0,s.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,s.jsx)(l.$n,{variant:"ghost",onClick:d,children:"Hủy"}),(0,s.jsx)(l.$n,{onClick:m,disabled:x||0===b.length,children:x?"Đang lưu...":"Lưu danh s\xe1ch model"})]})]})}),(0,s.jsx)(l.rq,{isOpen:p,onClose:()=>g(!1),onSelect:e=>{let t=e?.value||e?.name||e;t&&a(e=>c([...e,t]))},onDeselect:f,activeProviders:o,modelAliases:i,title:"Chọn model được ph\xe9p d\xf9ng",addedModelValues:b,closeOnSelect:!1,personalOnly:u,extraModels:h,allKinds:!0})]})}function w({label:e,value:t,hint:n}){return(0,s.jsxs)("div",{className:"rounded-2xl border border-border bg-surface/70 p-4",children:[(0,s.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-text-muted",children:e}),(0,s.jsx)("div",{className:"mt-2 text-2xl font-semibold text-text-main",children:t}),n?(0,s.jsx)("div",{className:"mt-1 text-xs text-text-muted",children:n}):null]})}function C({pagination:e,pageSize:t,onPageChange:n,onPageSizeChange:r,loading:a}){let o=Number(e?.page||1),i=Number(e?.totalPages||1),d=Number(e?.total||0),c=0===d?0:(o-1)*t+1,m=Math.min(d,o*t);return(0,s.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border px-4 py-3 md:flex-row md:items-center md:justify-between",children:[(0,s.jsxs)("div",{className:"text-sm text-text-muted",children:["Hiển thị ",(0,s.jsx)("b",{children:c}),"–",(0,s.jsx)("b",{children:m})," / ",(0,s.jsx)("b",{children:d})," API keys"]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsxs)("select",{value:t,onChange:e=>r(Number(e.target.value)),className:"rounded-xl border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary",disabled:a,children:[(0,s.jsx)("option",{value:25,children:"25 / trang"}),(0,s.jsx)("option",{value:50,children:"50 / trang"}),(0,s.jsx)("option",{value:100,children:"100 / trang"})]}),(0,s.jsx)(l.$n,{variant:"outline",size:"sm",onClick:()=>n(1),disabled:a||o<=1,children:"Đầu"}),(0,s.jsx)(l.$n,{variant:"outline",size:"sm",onClick:()=>n(Math.max(1,o-1)),disabled:a||o<=1,children:"Trước"}),(0,s.jsxs)("span",{className:"rounded-xl border border-border bg-surface px-3 py-2 text-sm",children:["Trang ",o,"/",i]}),(0,s.jsx)(l.$n,{variant:"outline",size:"sm",onClick:()=>n(Math.min(i,o+1)),disabled:a||o>=i,children:"Sau"}),(0,s.jsx)(l.$n,{variant:"outline",size:"sm",onClick:()=>n(i),disabled:a||o>=i,children:"Cuối"})]})]})}function A({image:e,label:t,onClick:n}){return(0,s.jsx)("button",{type:"button",onClick:n,title:t,"aria-label":t,className:"flex h-9 w-9 items-center justify-center rounded-xl border border-border bg-background transition hover:border-primary/50 hover:bg-surface focus:outline-none focus:ring-2 focus:ring-primary/20",children:(0,s.jsx)("img",{src:e,alt:"","aria-hidden":"true",className:"size-5 rounded-sm object-contain"})})}function S({apiKey:e,onClaudeSettings:t,onOpenCodeSettings:n,onCodexSettings:r,onQwenSettings:l}){return(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)(A,{image:"/providers/claude.png",label:"Claude Code Settings",onClick:()=>t(e)}),(0,s.jsx)(A,{image:"/providers/opencode.png",label:"OpenCode Settings",onClick:()=>n(e)}),(0,s.jsx)(A,{image:"/providers/codex.png",label:"Codex Settings",onClick:()=>r(e)}),(0,s.jsx)(A,{image:"/providers/qwen.png",label:"Qwen Code Settings",onClick:()=>l(e)})]})}function P({apiKey:e,globalEnabled:t,globalLevel:n,onClose:a,onSave:o,saving:i,infoOnly:d=!1}){let[c,m]=(0,r.useState)(e?.cavemanMode||"inherit"),[x,u]=(0,r.useState)(e?.cavemanLevel||"lite"),[h,p]=(0,r.useState)(d?"info":"edit"),[g,b]=(0,r.useState)("");if((0,r.useEffect)(()=>{e&&(m(e.cavemanMode||"inherit"),u(e.cavemanLevel||"lite"),p(d?"info":"edit"),b(""))},[e,d]),!e)return null;let f="on"===c||"off"!==c&&t,j="on"===c?x:n,y=String(n||"full").toUpperCase(),v="info"===h,N=()=>{if(!i){if(v&&!d)return void p("edit");a()}},k=async()=>{if(!i){b("");try{let e=await o({cavemanMode:c,cavemanLevel:x});!1===e&&b("Kh\xf4ng lưu được cấu h\xecnh Caveman. Vui l\xf2ng kiểm tra lại v\xe0 thử lần nữa.")}catch(e){b(e?.message||"Kh\xf4ng lưu được cấu h\xecnh Caveman.")}}};return(0,s.jsx)(l.aF,{isOpen:!!e,onClose:N,title:v?"Caveman output compression l\xe0 g\xec?":`Caveman: ${e.name||"API Key"}`,size:v?"xl":"lg",footer:v?(0,s.jsx)(l.$n,{onClick:N,disabled:i,children:d?"Đ\xe3 hiểu":"Quay lại cấu h\xecnh"}):void 0,children:v?(0,s.jsxs)("div",{className:"space-y-5 text-sm text-text-main",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 rounded-xl border border-border bg-surface px-3 py-2",children:[(0,s.jsx)("span",{className:"text-xs text-text-muted",children:"Global Caveman hiện đang:"}),(0,s.jsx)(l.Ex,{variant:t?"success":"default",size:"sm",children:t?"ON":"OFF"}),t?(0,s.jsx)(l.Ex,{variant:"default",size:"sm",children:y}):null,(0,s.jsx)("span",{className:"text-xs text-text-muted",children:'— \xe1p dụng cho API key chọn "Kế thừa Global"'})]}),(0,s.jsxs)("p",{className:"text-text-muted",children:["Caveman ch\xe8n một instruction về phong c\xe1ch trả lời v\xe0o ",(0,s.jsx)("span",{className:"font-semibold text-text-main",children:"provider request"})," ngay trước khi gửi tới model, nhằm giảm lời dẫn, lặp \xfd v\xe0 diễn giải kh\xf4ng cần thiết để output ngắn gọn hơn. T\xednh năng n\xe0y d\xf9ng được cho mọi request qua API key, kh\xf4ng chỉ CLI tool."]}),(0,s.jsxs)("div",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 p-3 text-amber-800 dark:text-amber-200",children:["Caveman kh\xf4ng n\xe9n input hoặc tool output như RTK. Hiệu quả phụ thuộc model v\xe0 nội dung request. D\xf9ng n\xfat ",(0,s.jsx)("b",{children:"Test"})," ngay cuối block Caveman của API key để gọi c\xf9ng prompt khi Caveman OFF v\xe0 ON, sau đ\xf3 so s\xe1nh output token thực tế."]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"mb-2 font-semibold text-text-main",children:"Caveman được \xe1p dụng ở đ\xe2u?"}),(0,s.jsxs)("div",{className:"rounded-xl border border-border bg-surface/60 p-3 font-mono text-xs text-text-muted",children:["Client request → x\xe1c thực / quota → routing → translate provider → RTK → ",(0,s.jsx)("span",{className:"font-semibold text-text-main",children:"Caveman"})," → gửi provider"]}),(0,s.jsxs)("ul",{className:"mt-2 list-disc space-y-1 pl-5 text-text-muted",children:[(0,s.jsx)("li",{children:"Kh\xf4ng thay đổi model, provider, account, combo routing, fallback hoặc retry."}),(0,s.jsx)("li",{children:"Client Request v\xe0 Source Request vẫn giữ nội dung gốc."}),(0,s.jsx)("li",{children:"Provider Request JSON trong log sẽ chứa instruction Caveman v\xec đ\xf3 l\xe0 body thực tế gửi upstream."})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"mb-2 font-semibold text-text-main",children:"C\xe1c mức độ"}),(0,s.jsx)("div",{className:"overflow-x-auto rounded-xl border border-border",children:(0,s.jsxs)("table",{className:"min-w-full text-xs",children:[(0,s.jsx)("thead",{className:"bg-surface/80 text-left uppercase tracking-wide text-text-muted",children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"px-3 py-2 font-medium",children:"Mức"}),(0,s.jsx)("th",{className:"px-3 py-2 font-medium",children:"T\xe1c dụng"}),(0,s.jsx)("th",{className:"px-3 py-2 font-medium",children:"Khuyến nghị"})]})}),(0,s.jsxs)("tbody",{className:"divide-y divide-border text-text-muted",children:[(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{className:"px-3 py-2 font-semibold text-text-main",children:"Lite"}),(0,s.jsx)("td",{className:"px-3 py-2",children:"Bỏ lời dẫn v\xe0 lặp \xfd, vẫn ưu ti\xean giữ giải th\xedch cần thiết."}),(0,s.jsx)("td",{className:"px-3 py-2",children:"Coding CLI, chat kỹ thuật, agent th\xf4ng thường."})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{className:"px-3 py-2 font-semibold text-text-main",children:"Full"}),(0,s.jsx)("td",{className:"px-3 py-2",children:"\xc9p c\xe2u trả lời s\xfac t\xedch hơn, ưu ti\xean lệnh, code v\xe0 kết luận."}),(0,s.jsx)("td",{className:"px-3 py-2",children:"Automation, t\xe1c vụ lặp lại, người d\xf9ng đ\xe3 quen ngữ cảnh."})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{className:"px-3 py-2 font-semibold text-text-main",children:"Ultra"}),(0,s.jsx)("td",{className:"px-3 py-2",children:"Output cực ngắn, giảm mạnh phần giải th\xedch."}),(0,s.jsx)("td",{className:"px-3 py-2",children:"Chỉ d\xf9ng cho workflow kiểm so\xe1t chặt v\xe0 đ\xe3 kiểm thử."})]})]})]})})]}),(0,s.jsxs)("div",{className:"grid gap-4 md:grid-cols-2",children:[(0,s.jsxs)("div",{className:"rounded-xl border border-green-500/30 bg-green-500/10 p-4",children:[(0,s.jsx)("h3",{className:"mb-2 font-semibold text-green-800 dark:text-green-200",children:"N\xean bật"}),(0,s.jsxs)("ul",{className:"list-disc space-y-1 pl-5 text-green-800/90 dark:text-green-200/90",children:[(0,s.jsx)("li",{children:"Claude Code, Codex CLI, OpenCode v\xe0 coding agent."}),(0,s.jsx)("li",{children:"Chat hỗ trợ kỹ thuật cần c\xe2u trả lời đi thẳng v\xe0o thao t\xe1c."}),(0,s.jsx)("li",{children:"Automation hoặc agent gọi model nhiều lần với ngữ cảnh r\xf5 r\xe0ng."}),(0,s.jsx)("li",{children:"API key chuy\xean d\xf9ng cho output ngắn: lệnh, checklist, kết luận, đoạn code."})]})]}),(0,s.jsxs)("div",{className:"rounded-xl border border-red-500/30 bg-red-500/10 p-4",children:[(0,s.jsx)("h3",{className:"mb-2 font-semibold text-red-800 dark:text-red-200",children:"Kh\xf4ng n\xean bật"}),(0,s.jsxs)("ul",{className:"list-disc space-y-1 pl-5 text-red-800/90 dark:text-red-200/90",children:[(0,s.jsx)("li",{children:"Dịch thuật, viết t\xe0i liệu, b\xe1o c\xe1o, proposal hoặc tạo presentation."}),(0,s.jsx)("li",{children:"Nội dung ph\xe1p l\xfd, hợp đồng, bi\xean bản, incident report cần đầy đủ chi tiết."}),(0,s.jsx)("li",{children:"Hướng dẫn đ\xe0o tạo, giải th\xedch chuy\xean s\xe2u, brainstorming hoặc s\xe1ng tạo nội dung."}),(0,s.jsx)("li",{children:"Workflow y\xeau cầu đ\xfang cấu tr\xfac, đủ trường hoặc wording ch\xednh x\xe1c tuyệt đối."})]})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"mb-2 font-semibold text-text-main",children:"Caveman kh\xe1c RTK thế n\xe0o?"}),(0,s.jsx)("div",{className:"overflow-x-auto rounded-xl border border-border",children:(0,s.jsxs)("table",{className:"min-w-full text-xs",children:[(0,s.jsx)("thead",{className:"bg-surface/80 text-left uppercase tracking-wide text-text-muted",children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"px-3 py-2 font-medium",children:"T\xednh năng"}),(0,s.jsx)("th",{className:"px-3 py-2 font-medium",children:"T\xe1c động"})]})}),(0,s.jsxs)("tbody",{className:"divide-y divide-border text-text-muted",children:[(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{className:"px-3 py-2 font-semibold text-text-main",children:"RTK"}),(0,s.jsx)("td",{className:"px-3 py-2",children:"R\xfat gọn tool output trước khi gửi model."})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{className:"px-3 py-2 font-semibold text-text-main",children:"Caveman"}),(0,s.jsx)("td",{className:"px-3 py-2",children:"Điều khiển model trả lời ngắn hơn."})]})]})]})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"mb-2 font-semibold text-text-main",children:"Global vs từng API key"}),(0,s.jsxs)("p",{className:"text-text-muted",children:[(0,s.jsx)("span",{className:"font-semibold text-text-main",children:"Kế thừa Global"})," d\xf9ng đ\xfang trạng th\xe1i v\xe0 level tại ",(0,s.jsx)("span",{className:"font-mono text-text-main",children:"/dashboard/endpoint"}),";",(0,s.jsx)("span",{className:"font-semibold text-text-main",children:" Force ON"})," bật ri\xeang cho key v\xe0 d\xf9ng level đ\xe3 chọn;",(0,s.jsx)("span",{className:"font-semibold text-text-main",children:" Force OFF"})," lu\xf4n tắt cho key. Override của API key lu\xf4n thắng Global theo cả hai chiều."]})]})]}):(0,s.jsxs)("div",{className:"space-y-5",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 rounded-xl border border-border bg-surface p-3 text-sm",children:[(0,s.jsx)("span",{className:"text-text-muted",children:"Global Caveman hiện đang:"}),(0,s.jsx)(l.Ex,{variant:t?"success":"default",size:"sm",children:t?"ON":"OFF"}),t?(0,s.jsx)(l.Ex,{variant:"default",size:"sm",children:y}):null,(0,s.jsx)("span",{className:"text-xs text-text-muted",children:'— \xe1p dụng cho API key chọn "Kế thừa Global"'}),(0,s.jsx)("button",{type:"button",onClick:()=>p("info"),disabled:i,title:"Caveman l\xe0 g\xec? Bấm để xem giải th\xedch","aria-label":"Xem giải th\xedch về Caveman",className:"inline-flex size-5 shrink-0 items-center justify-center rounded-full border border-border text-[11px] font-bold text-text-muted transition-colors hover:border-brand-500 hover:text-brand-600 disabled:cursor-not-allowed disabled:opacity-50",children:"?"})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"block text-sm font-medium",children:"Chế độ override"}),(0,s.jsxs)("select",{value:c,onChange:e=>{m(e.target.value),b("")},disabled:i,className:"w-full rounded-xl border border-border bg-background px-3 py-2 text-sm disabled:cursor-not-allowed disabled:opacity-60",children:[(0,s.jsxs)("option",{value:"inherit",children:["Kế thừa Global (",t?`ON \xb7 ${y}`:"OFF",")"]}),(0,s.jsx)("option",{value:"on",children:"Force ON"}),(0,s.jsx)("option",{value:"off",children:"Force OFF"})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"block text-sm font-medium",children:"Mức n\xe9n"}),"on"===c?(0,s.jsxs)("select",{value:x,onChange:e=>{u(e.target.value),b("")},disabled:i,className:"w-full rounded-xl border border-border bg-background px-3 py-2 text-sm disabled:cursor-not-allowed disabled:opacity-60",children:[(0,s.jsx)("option",{value:"lite",children:"Lite — an to\xe0n cho coding CLI"}),(0,s.jsx)("option",{value:"full",children:"Full — s\xfac t\xedch hơn"}),(0,s.jsx)("option",{value:"ultra",children:"Ultra — cực ngắn"})]}):(0,s.jsx)("div",{className:"rounded-xl border border-border bg-surface/60 px-3 py-2.5 text-sm text-text-muted",children:"inherit"===c?t?(0,s.jsxs)(s.Fragment,{children:["Đang d\xf9ng mức Global: ",(0,s.jsx)("b",{className:"text-text-main",children:y})]}):(0,s.jsxs)(s.Fragment,{children:["Global đang ",(0,s.jsx)("b",{className:"text-text-main",children:"OFF"}),", n\xean kh\xf4ng c\xf3 mức n\xe9n hiệu lực."]}):(0,s.jsx)(s.Fragment,{children:"Force OFF — mức n\xe9n kh\xf4ng được \xe1p dụng."})})]}),(0,s.jsxs)("div",{className:"rounded-xl border border-border p-3 text-sm text-text-muted",children:["Hiệu lực: ",(0,s.jsx)("b",{className:"text-text-main",children:f?`ON \xb7 ${String(j||"lite").toUpperCase()}`:"OFF"})]}),g?(0,s.jsxs)("div",{className:"flex items-start gap-2 rounded-xl border border-red-500/30 bg-red-500/10 p-3 text-sm text-red-700 dark:text-red-300",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[19px]",children:"error"}),(0,s.jsx)("span",{children:g})]}):null,(0,s.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,s.jsx)(l.$n,{variant:"outline",onClick:N,disabled:i,children:"Hủy"}),(0,s.jsx)(l.$n,{onClick:k,disabled:i,children:i?"Đang lưu...":"Lưu"})]})]})})}let O=Object.freeze([{value:"lite",label:"Lite",description:"Giữ giải th\xedch cần thiết"},{value:"full",label:"Full",description:"Ưu ti\xean code v\xe0 kết luận"},{value:"ultra",label:"Ultra",description:"Output cực ngắn"}]),$=`Ph\xe2n t\xedch đoạn code sau, chỉ ra lỗi, nguy\xean nh\xe2n v\xe0 đưa bản sửa ho\xe0n chỉnh. Giữ đầy đủ lệnh v\xe0 code cần thiết:
2
-
3
- function getUserName(user) {
4
- return user.profile.name.trim();
5
- }`;function I(e){if(null==e||""===e)return"—";let t=Number(e);return Number.isFinite(t)?t.toLocaleString("vi-VN"):"—"}function E(e){if(null==e||""===e)return"—";let t=Number(e);if(!Number.isFinite(t))return"—";let n=t>0?"+":"";return`${n}${t.toFixed(1)}%`}function L(e){if(null==e||""===e)return"—";let t=Number(e);if(!Number.isFinite(t))return"—";let n=t>0?"+":"";return`${n}${t.toLocaleString("vi-VN")}`}function T({label:e,value:t,hint:n,tone:r="default"}){return(0,s.jsxs)("div",{className:`rounded-xl border p-3 ${"good"===r?"border-emerald-500/25 bg-emerald-500/10 text-emerald-800 dark:text-emerald-200":"bad"===r?"border-red-500/25 bg-red-500/10 text-red-700 dark:text-red-300":"border-border bg-surface/70 text-text-main"}`,children:[(0,s.jsx)("div",{className:"text-[11px] font-medium uppercase tracking-wide opacity-70",children:e}),(0,s.jsx)("div",{className:"mt-1 text-lg font-semibold",children:t}),n?(0,s.jsx)("div",{className:"mt-1 text-[11px] opacity-70",children:n}):null]})}function _({apiKey:e,fallbackModels:t,onClose:n}){let a=(0,r.useMemo)(()=>{let n=c(e?.allowedModels);return n.length>0?n:c(t)},[e,t]),[o,i]=(0,r.useState)(""),[d,m]=(0,r.useState)($),[x,h]=(0,r.useState)("lite"),[p,g]=(0,r.useState)(!1),[b,f]=(0,r.useState)(""),[j,y]=(0,r.useState)(null);if((0,r.useEffect)(()=>{if(!e)return;let n=c(e.allowedModels),s=c(t);i(n[0]||s[0]||""),h(["lite","full","ultra"].includes(e.cavemanLevel)?e.cavemanLevel:"lite"),m($),g(!1),f(""),y(null)},[e?.id]),!e)return null;let v=!!o&&!!d.trim()&&!p,N=async()=>{if(v){g(!0),f(""),y(null);try{let t=await fetch(`/api/keys/${e.id}/caveman-test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:o,prompt:d.trim(),level:x})}),n=await t.json().catch(()=>({}));if(!t.ok){let e=n?.error?.message||n?.error||n?.message||"Kh\xf4ng chạy được Caveman A/B test";throw Error(e)}y(n)}catch(e){f(e?.message||"Kh\xf4ng chạy được Caveman A/B test")}finally{g(!1)}}},k=j?.baseline||null;return(0,s.jsx)(l.aF,{isOpen:!!e,onClose:()=>!p&&n(),title:"Test Caveman A/B",size:"xl",children:(0,s.jsxs)("div",{className:"space-y-5",children:[(0,s.jsx)("div",{className:"overflow-hidden rounded-2xl border border-indigo-500/25 bg-gradient-to-r from-indigo-500/10 via-primary/5 to-cyan-500/10",children:(0,s.jsxs)("div",{className:"flex flex-col gap-3 p-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,s.jsx)("span",{className:"inline-flex size-11 shrink-0 items-center justify-center rounded-2xl bg-indigo-500/15 text-indigo-700 dark:text-indigo-300",children:(0,s.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[25px]",children:"experiment"})}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("div",{className:"truncate font-semibold text-text-main",children:e.name||"API Key"}),(0,s.jsx)("div",{className:"mt-0.5 text-xs text-text-muted",children:"So s\xe1nh c\xf9ng prompt: Caveman OFF với mức ON đ\xe3 chọn"})]})]}),(0,s.jsxs)("div",{className:"flex shrink-0 items-center gap-2 text-xs",children:[(0,s.jsx)("span",{className:"rounded-full border border-border bg-background/80 px-2.5 py-1",children:"A/B thực tế"}),(0,s.jsxs)("span",{className:"rounded-full border border-amber-500/30 bg-amber-500/10 px-2.5 py-1 text-amber-700 dark:text-amber-300",children:[2," lượt gọi"]})]})]})}),(0,s.jsxs)("label",{className:"block",children:[(0,s.jsx)("span",{className:"mb-1.5 block text-xs font-medium text-text-muted",children:"Model được ph\xe9p d\xf9ng"}),(0,s.jsxs)("select",{value:o,onChange:e=>i(e.target.value),disabled:p||0===a.length,className:"w-full rounded-xl border border-border bg-background px-3 py-2.5 font-mono text-sm text-text-main outline-none transition focus:border-primary disabled:opacity-60",children:[0===a.length?(0,s.jsx)("option",{value:"",children:"Kh\xf4ng c\xf3 model để test"}):null,a.map(e=>(0,s.jsx)("option",{value:e,children:e},e))]})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-3",children:[(0,s.jsx)("span",{className:"text-xs font-medium text-text-muted",children:"Mức Caveman"}),(0,s.jsx)("span",{className:"text-[11px] text-text-muted",children:"Tối đa 2.048 output tokens"})]}),(0,s.jsx)("div",{className:"grid gap-2 sm:grid-cols-3",children:O.map(e=>{let t=x===e.value;return(0,s.jsxs)("button",{type:"button",onClick:()=>h(e.value),disabled:p,className:`rounded-xl border p-3 text-left transition ${t?"border-primary bg-primary/10 ring-1 ring-primary/20":"border-border bg-background hover:border-primary/40 hover:bg-surface"} disabled:cursor-default disabled:opacity-80`,children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)("span",{className:"font-semibold text-text-main",children:e.label}),t?(0,s.jsx)("span",{className:"material-symbols-outlined text-[17px] text-primary",children:"check_circle"}):null]}),(0,s.jsx)("div",{className:"mt-1 text-xs text-text-muted",children:e.description})]},e.value)})})]}),(0,s.jsxs)("label",{className:"block",children:[(0,s.jsxs)("div",{className:"mb-1.5 flex items-center justify-between gap-3",children:[(0,s.jsx)("span",{className:"text-xs font-medium text-text-muted",children:"Prompt test"}),(0,s.jsxs)("span",{className:`text-[11px] ${d.length>12e3?"text-red-600":"text-text-muted"}`,children:[d.length.toLocaleString("vi-VN"),"/12.000 k\xfd tự"]})]}),(0,s.jsx)("textarea",{value:d,onChange:e=>m(e.target.value.slice(0,12e3)),disabled:p,rows:7,className:"w-full resize-y rounded-xl border border-border bg-background px-3 py-3 font-mono text-sm leading-6 text-text-main outline-none transition focus:border-primary disabled:opacity-70",placeholder:"Nhập c\xf9ng một prompt để so s\xe1nh Caveman OFF v\xe0 ON..."})]}),(0,s.jsxs)("div",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 p-3 text-xs leading-5 text-amber-800 dark:text-amber-200",children:[(0,s.jsx)("b",{children:"Lưu \xfd chi ph\xed:"})," ph\xe9p thử gọi provider thật v\xe0 tạo usage/log như request b\xecnh thường. Mỗi lần test d\xf9ng đ\xfang 2 lượt gọi: một baseline OFF v\xe0 một lượt ON ở mức đ\xe3 chọn. Kết quả vẫn c\xf3 thể dao động nhẹ theo model."]}),b?(0,s.jsxs)("div",{className:"flex items-start gap-2 rounded-xl border border-red-500/30 bg-red-500/10 p-3 text-sm text-red-700 dark:text-red-300",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[19px]",children:"error"}),(0,s.jsx)("span",{children:b})]}):null,p?(0,s.jsxs)("div",{className:"rounded-2xl border border-primary/25 bg-primary/5 p-6 text-center",children:[(0,s.jsx)("span",{className:"material-symbols-outlined animate-spin text-3xl text-primary",children:"progress_activity"}),(0,s.jsxs)("div",{className:"mt-2 font-medium text-text-main",children:["Đang chạy ",2," lượt A/B..."]}),(0,s.jsx)("div",{className:"mt-1 text-xs text-text-muted",children:"Giữ modal mở cho tới khi model trả đủ kết quả. Mỗi lượt c\xf3 timeout tối đa 5 ph\xfat."})]}):null,j&&k?(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"font-semibold text-text-main",children:"Kết quả A/B"}),(0,s.jsxs)("p",{className:"text-xs text-text-muted",children:[j.model," \xb7 ",j.callsMade," lượt gọi \xb7 output cap ",I(j.maxOutputTokens)]})]}),(0,s.jsxs)("span",{className:"rounded-full border border-border bg-surface px-3 py-1 text-xs text-text-muted",children:["Baseline OFF: ",I(k.usage?.outputTokens)," output tokens"]})]}),(0,s.jsx)("div",{className:"grid gap-3 lg:grid-cols-1",children:(j.results||[]).map(e=>{if(e.error)return(0,s.jsxs)("div",{className:"rounded-2xl border border-red-500/30 bg-red-500/10 p-4",children:[(0,s.jsx)("div",{className:"font-semibold uppercase text-red-700 dark:text-red-300",children:e.level}),(0,s.jsx)("div",{className:"mt-2 text-sm text-red-700 dark:text-red-300",children:e.error})]},e.level);let t=e.savings?.outputSaved,n=e.savings?.outputSavedPercent,r=k.usage?.outputTokens!==null&&e.usage?.outputTokens!==null,l=Number(t)>0,a=0>Number(t),o=Number.isFinite(Number(n))?Math.max(0,Math.min(100,Number(n))):0;return(0,s.jsxs)("div",{className:"overflow-hidden rounded-2xl border border-border bg-background shadow-sm",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2 border-b border-border bg-surface/60 px-4 py-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"inline-flex size-8 items-center justify-center rounded-xl bg-primary/10 text-primary",children:(0,s.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[19px]",children:"compress"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-semibold uppercase text-text-main",children:e.level}),(0,s.jsxs)("div",{className:"text-[11px] text-text-muted",children:[I(e.latencyMs)," ms"]})]})]}),(0,s.jsx)("span",{className:`rounded-full px-2.5 py-1 text-xs font-semibold ${l?"bg-emerald-500/15 text-emerald-700 dark:text-emerald-300":a?"bg-red-500/15 text-red-700 dark:text-red-300":"bg-surface text-text-muted"}`,children:r?`${L(t)} tokens`:"No usage"})]}),(0,s.jsxs)("div",{className:"space-y-3 p-4",children:[(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,s.jsx)(T,{label:"OFF output",value:I(k.usage?.outputTokens)}),(0,s.jsx)(T,{label:"ON output",value:I(e.usage?.outputTokens),tone:l?"good":a?"bad":"default"}),(0,s.jsx)(T,{label:"Output giảm",value:r?E(n):"—",hint:r?`${L(t)} token`:"Provider kh\xf4ng trả usage",tone:l?"good":a?"bad":"default"}),(0,s.jsx)(T,{label:"Input overhead",value:L(e.savings?.inputOverhead),hint:"instruction Caveman"})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"mb-1 flex justify-between text-[11px] text-text-muted",children:[(0,s.jsx)("span",{children:"Hiệu quả output"}),(0,s.jsx)("span",{children:r?E(n):"—"})]}),(0,s.jsx)("div",{className:"h-2 overflow-hidden rounded-full bg-surface",children:(0,s.jsx)("div",{className:`h-full rounded-full transition-all ${l?"bg-emerald-500":"bg-red-500"}`,style:{width:`${o}%`}})})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between rounded-xl border border-border bg-surface/50 px-3 py-2 text-xs",children:[(0,s.jsx)("span",{className:"text-text-muted",children:"Net total token"}),(0,s.jsxs)("span",{className:`font-semibold ${Number(e.savings?.totalSaved)>0?"text-emerald-700 dark:text-emerald-300":0>Number(e.savings?.totalSaved)?"text-red-600":"text-text-main"}`,children:[L(e.savings?.totalSaved)," (",E(e.savings?.totalSavedPercent),")"]})]})]})]},e.level)})}),(0,s.jsxs)("div",{className:"grid gap-3 lg:grid-cols-2",children:[(0,s.jsxs)("details",{className:"overflow-hidden rounded-xl border border-border bg-background",open:!0,children:[(0,s.jsx)("summary",{className:"cursor-pointer bg-surface/60 px-4 py-3 text-sm font-medium text-text-main",children:"Output baseline \xb7 Caveman OFF"}),(0,s.jsx)("pre",{className:"max-h-80 overflow-auto whitespace-pre-wrap p-4 text-xs leading-5 text-text-muted",children:k.output||"Model kh\xf4ng trả content text."})]}),(j.results||[]).map(e=>(0,s.jsxs)("details",{className:"overflow-hidden rounded-xl border border-border bg-background",open:!0,children:[(0,s.jsxs)("summary",{className:"cursor-pointer bg-surface/60 px-4 py-3 text-sm font-medium text-text-main",children:["Output Caveman \xb7 ",String(e.level||"").toUpperCase()]}),(0,s.jsx)("pre",{className:"max-h-80 overflow-auto whitespace-pre-wrap p-4 text-xs leading-5 text-text-muted",children:e.error||e.output||"Model kh\xf4ng trả content text."})]},`output-${e.level}`))]}),(0,s.jsx)("p",{className:"text-[11px] leading-5 text-text-muted",children:j.note})]}):null,(0,s.jsxs)("div",{className:"flex flex-wrap justify-end gap-2 border-t border-border pt-4",children:[(0,s.jsx)(l.$n,{variant:"ghost",onClick:n,disabled:p,children:"Đ\xf3ng"}),(0,s.jsx)(l.$n,{onClick:N,disabled:!v||d.length>12e3,children:(0,s.jsx)(u,{materialIcon:p?"progress_activity":"experiment",children:p?"Đang test...":"Chạy A/B (2 calls)"})})]})]})})}function M({apiKey:e,owner:t,isAdmin:n,isFullAdmin:l,onRename:a,onRotate:o,onEditModels:i,onEditPolicy:d,onAssignOwner:c,onDelete:m}){let[x,h]=(0,r.useState)(!1),p=(0,r.useRef)(null);(0,r.useEffect)(()=>{if(!x)return;let e=e=>{!p.current||p.current.contains(e.target)||h(!1)},t=e=>{"Escape"===e.key&&h(!1)};return document.addEventListener("pointerdown",e,!0),document.addEventListener("keydown",t),()=>{document.removeEventListener("pointerdown",e,!0),document.removeEventListener("keydown",t)}},[p,x,h]);let g=e=>{h(!1),e()};return(0,s.jsxs)("details",{ref:p,className:"group",open:x,onToggle:e=>h(e.currentTarget.open),children:[(0,s.jsx)("summary",{title:"Thao t\xe1c kh\xe1c",className:"flex h-9 cursor-pointer list-none items-center rounded-xl border border-border bg-background px-3 text-sm font-medium text-text-main transition hover:border-primary/50 hover:bg-surface focus:outline-none focus:ring-2 focus:ring-primary/20 [&::-webkit-details-marker]:hidden",children:(0,s.jsx)("span",{"aria-hidden":"true",className:"text-lg leading-none",children:"⋯"})}),(0,s.jsxs)("div",{className:"ml-auto mt-2 w-48 overflow-hidden rounded-xl border border-border bg-background py-1 text-left shadow-xl shadow-black/10",children:[(0,s.jsx)("button",{type:"button",className:"block w-full px-3 py-2 text-left text-sm text-text-main transition hover:bg-surface",onClick:()=>g(()=>a(e.id,e.name)),children:(0,s.jsx)(u,{icon:"✏️",children:"Đổi t\xean"})}),(0,s.jsx)("button",{type:"button",className:"block w-full px-3 py-2 text-left text-sm text-text-main transition hover:bg-surface",onClick:()=>g(()=>o(e)),children:(0,s.jsx)(u,{materialIcon:"key",children:"Đổi key"})}),l?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"my-1 border-t border-border"}),(0,s.jsx)("button",{type:"button",className:"block w-full px-3 py-2 text-left text-sm text-text-main transition hover:bg-surface",onClick:()=>g(()=>i(e)),children:(0,s.jsx)(u,{icon:"\uD83D\uDCE6",children:"Models"})})]}):null,n?(0,s.jsx)("button",{type:"button",className:"block w-full px-3 py-2 text-left text-sm text-text-main transition hover:bg-surface",onClick:()=>g(()=>d(e)),children:(0,s.jsx)(u,{icon:"\uD83D\uDEE1️",children:"Policy"})}):null,n?(0,s.jsx)("button",{type:"button",className:"block w-full px-3 py-2 text-left text-sm text-text-main transition hover:bg-surface",onClick:()=>g(()=>c(e.id,t)),children:(0,s.jsx)(u,{icon:"\uD83D\uDC64",children:"Owner"})}):null,(0,s.jsx)("div",{className:"my-1 border-t border-border"}),(0,s.jsx)("button",{type:"button",className:"block w-full px-3 py-2 text-left text-sm font-medium text-red-600 transition hover:bg-red-500/10",onClick:()=>g(()=>m(e.id)),children:(0,s.jsx)(u,{icon:"\uD83D\uDDD1️",children:"X\xf3a"})})]})]})}function K({mode:e,effectiveEnabled:t,effectiveLevel:n,globalEnabled:r,onEdit:l,onInfo:a,onTest:o}){let i=String(n||"lite").toUpperCase();return(0,s.jsxs)("div",{className:`inline-flex max-w-full items-center gap-1.5 whitespace-nowrap rounded-xl border px-2 py-1.5 shadow-sm ${t?"border-emerald-500/30 bg-emerald-500/10 text-emerald-800 dark:text-emerald-200":"border-slate-300/80 bg-slate-500/5 text-slate-700 dark:border-slate-600 dark:text-slate-300"}`,title:`Caveman ${t?"ON":"OFF"} \xb7 ${"inherit"===e?"Kế thừa Global":"on"===e?"Force ON":"Force OFF"} \xb7 Global ${r?"ON":"OFF"} \xb7 Mức ${i}`,children:[(0,s.jsx)("span",{className:`inline-flex size-5 shrink-0 items-center justify-center rounded-md ${t?"bg-emerald-500/15 text-emerald-700 dark:text-emerald-300":"bg-slate-500/10 text-slate-600 dark:text-slate-300"}`,children:(0,s.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[15px] leading-none",children:"compress"})}),(0,s.jsx)("button",{type:"button",onClick:a,className:"shrink-0 rounded-md font-semibold underline-offset-2 transition hover:text-primary hover:underline focus:outline-none focus:ring-2 focus:ring-primary/25",title:"Xem hướng dẫn Caveman","aria-label":"Mở hướng dẫn Caveman",children:"Caveman"}),(0,s.jsx)("button",{type:"button",onClick:l,className:`shrink-0 rounded-full border px-2 py-0.5 text-[10px] font-bold tracking-wide transition focus:outline-none focus:ring-2 focus:ring-primary/25 ${t?"border-emerald-500/40 bg-emerald-600 text-white hover:bg-emerald-700":"border-slate-300 bg-white text-slate-600 hover:border-primary/50 hover:text-primary dark:border-slate-600 dark:bg-slate-900/40 dark:text-slate-300"}`,"aria-label":`Mở cấu h\xecnh Caveman, hiện đang ${t?"bật":"tắt"}`,children:t?"ON":"OFF"}),(0,s.jsxs)("span",{className:`inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] font-semibold ${t?"border-emerald-500/25 bg-white/55 text-emerald-800 dark:bg-slate-950/20 dark:text-emerald-200":"border-slate-300/80 bg-white/55 text-slate-500 dark:border-slate-600 dark:bg-slate-950/20 dark:text-slate-400"}`,children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[12px] leading-none",children:"tune"}),i]}),(0,s.jsx)("span",{"aria-hidden":"true",className:"h-5 w-px shrink-0 bg-current opacity-15"}),(0,s.jsxs)("button",{type:"button",onClick:o,className:"inline-flex shrink-0 items-center gap-1 rounded-lg border border-indigo-500/30 bg-indigo-500/10 px-2 py-0.5 text-[10px] font-semibold text-indigo-700 transition hover:border-indigo-500/60 hover:bg-indigo-500/20 focus:outline-none focus:ring-2 focus:ring-indigo-500/25 dark:text-indigo-300",title:"Test A/B Caveman với một mức n\xe9n","aria-label":"Mở Caveman A/B test",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[13px] leading-none",children:"experiment"}),"Test"]})]})}function F({keys:e,copied:t,copy:n,isAdmin:r,isFullAdmin:a,globalCavemanEnabled:o,globalCavemanLevel:i,onToggleActive:d,onApiTest:m,onClaudeSettings:x,onOpenCodeSettings:u,onCodexSettings:h,onQwenSettings:p,onRename:g,onRotate:j,onEditModels:y,onEditPolicy:v,onEditCaveman:N,onShowCavemanInfo:k,onCavemanTest:w,onAssignOwner:C,onDelete:A}){return(0,s.jsx)("div",{className:"overflow-hidden rounded-2xl border border-border",children:(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)("table",{className:"min-w-full divide-y divide-border text-sm",children:[(0,s.jsx)("thead",{className:"bg-surface/80 text-left text-xs uppercase tracking-wide text-text-muted",children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"whitespace-nowrap px-4 py-3 font-medium",children:"T\xean / Key"}),(0,s.jsx)("th",{className:"whitespace-nowrap px-4 py-3 font-medium",children:"Trạng th\xe1i"}),(0,s.jsx)("th",{className:"whitespace-nowrap px-4 py-3 font-medium",children:"Owner"}),(0,s.jsx)("th",{className:"whitespace-nowrap px-4 py-3 font-medium",children:"Model"}),(0,s.jsx)("th",{className:"whitespace-nowrap px-4 py-3 font-medium",children:"Policy"}),(0,s.jsx)("th",{className:"whitespace-nowrap px-4 py-3 font-medium",children:"Ng\xe0y tạo"}),(0,s.jsx)("th",{className:"whitespace-nowrap px-4 py-3 text-right font-medium",children:"Thao t\xe1c"})]})}),(0,s.jsx)("tbody",{className:"divide-y divide-border bg-background",children:e.map(e=>{var P;let O=e.ownerUser||e.createdByUser||"chưa g\xe1n",$=c(e.allowedModels),I=b(e.limits),E=f(e.limits||{}),L=e.cavemanMode||"inherit",T="on"===L||"off"!==L&&o,_="on"===L?e.cavemanLevel||"lite":i;return(0,s.jsxs)("tr",{className:"align-top transition hover:bg-surface/50",children:[(0,s.jsxs)("td",{className:"min-w-[280px] px-4 py-4",children:[(0,s.jsx)("div",{className:"font-medium text-text-main",children:e.name||"API Key"}),(0,s.jsxs)("div",{className:"group/key mt-2 flex max-w-[380px] items-center gap-2 rounded-xl border border-border bg-surface px-3 py-2 font-mono text-xs text-text-main",children:[(0,s.jsx)("span",{className:"min-w-0 flex-1 truncate",children:(P=e.key)?P.length>12?`${P.slice(0,8)}...${P.slice(-4)}`:P:""}),(0,s.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,s.jsx)("button",{type:"button",onClick:()=>n(e.key,e.id),className:"rounded p-0.5 text-text-muted transition hover:bg-sidebar hover:text-primary","aria-label":t===e.id?"Đ\xe3 copy":"Copy API key",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:t===e.id?"check":"content_copy"})}),(0,s.jsx)("span",{className:"pointer-events-none absolute left-1/2 top-5 mt-1 -translate-x-1/2 whitespace-nowrap text-[10px] text-text-muted opacity-0 transition-opacity group-hover/btn:opacity-100",children:t===e.id?"Copied!":"Copy"})]}),(0,s.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,s.jsx)("button",{type:"button",onClick:()=>m(e),className:"rounded p-0.5 text-text-muted transition hover:bg-sidebar hover:text-primary","aria-label":"Test API key bằng curl",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"science"})}),(0,s.jsx)("span",{className:"pointer-events-none absolute left-1/2 top-5 mt-1 -translate-x-1/2 whitespace-nowrap text-[10px] text-text-muted opacity-0 transition-opacity group-hover/btn:opacity-100",children:"Test"})]})]}),e.createdByUser?(0,s.jsxs)("div",{className:"mt-2 text-xs text-text-muted",children:["Tạo bởi: ",e.createdByUser]}):null]}),(0,s.jsx)("td",{className:"whitespace-nowrap px-4 py-4",children:(0,s.jsx)(l.lM,{checked:!!e.isActive,onChange:t=>d(e.id,t)})}),(0,s.jsx)("td",{className:"min-w-[160px] px-4 py-4",children:(0,s.jsx)("div",{className:"break-all text-sm text-text-main",children:O})}),(0,s.jsx)("td",{className:"px-4 py-4 align-top",children:$.length>0?(0,s.jsxs)("div",{className:"flex flex-col items-start gap-1",children:[$.slice(0,3).map(e=>(0,s.jsx)("span",{className:"max-w-full truncate rounded-full border border-border bg-surface px-2 py-1 font-mono text-xs",children:e},e)),$.length>3?(0,s.jsxs)("span",{className:"rounded-full border border-border bg-surface px-2 py-1 text-xs",children:["+",$.length-3]}):null]}):(0,s.jsx)("span",{className:"inline-block rounded-full border border-amber-500/30 bg-amber-500/10 px-2 py-1 text-xs text-amber-700 dark:text-amber-300",children:"Legacy full access"})}),(0,s.jsx)("td",{className:"px-4 py-4 align-top",children:(0,s.jsxs)("div",{className:"flex flex-col items-start gap-1 text-xs",children:[I?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"rounded-full border border-border bg-surface px-2 py-1",children:E.enabled?"bật":"tắt"}),(0,s.jsxs)("span",{className:"rounded-full border border-border bg-surface px-2 py-1",children:[E.requestsPerMinute||"∞","/ph\xfat"]}),r&&E.maxOutputTokens>0?(0,s.jsxs)("span",{className:"rounded-full border border-border bg-surface px-2 py-1",children:[E.maxOutputTokens," out"]}):null,r&&E.forceThinkingOff?(0,s.jsx)("span",{className:"rounded-full border border-border bg-surface px-2 py-1",children:"thinking off"}):null,E.allowedIpCidrs.length>0?(0,s.jsx)("span",{className:"rounded-full border border-border bg-surface px-2 py-1",children:"IP locked"}):null]}):(0,s.jsx)("span",{className:"rounded-full border border-border bg-surface px-2 py-1 text-text-muted",children:"Policy: chưa set"}),(0,s.jsx)(K,{mode:L,effectiveEnabled:T,effectiveLevel:_,globalEnabled:o,onEdit:()=>N(e),onInfo:()=>k(e),onTest:()=>w(e)})]})}),(0,s.jsx)("td",{className:"min-w-[150px] px-4 py-4 text-xs text-text-muted",children:function(e){if(!e)return"kh\xf4ng r\xf5";try{return new Date(e).toLocaleString()}catch{return String(e)}}(e.createdAt)}),(0,s.jsx)("td",{className:"min-w-[200px] px-4 py-4",children:(0,s.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,s.jsx)(M,{apiKey:e,owner:O,isAdmin:r,isFullAdmin:a,onRename:g,onRotate:j,onEditModels:y,onEditPolicy:v,onAssignOwner:C,onDelete:A}),(0,s.jsx)(S,{apiKey:e,onClaudeSettings:x,onOpenCodeSettings:u,onCodexSettings:h,onQwenSettings:p})]})})]},e.id)})})]})})})}function R(){let e,t,n,u,[p,g]=(0,r.useState)([]),[v,A]=(0,r.useState)(!0),[S,O]=(0,r.useState)(""),[$,I]=(0,r.useState)(!1),[E,L]=(0,r.useState)(""),[T,M]=(0,r.useState)(""),[K,R]=(0,r.useState)(""),[U,D]=(0,r.useState)(""),[q,B]=(0,r.useState)(null),[z,W]=(0,r.useState)([]),[H,G]=(0,r.useState)(""),[Y,J]=(0,r.useState)(!1),[V,X]=(0,r.useState)(!1),[Z,Q]=(0,r.useState)([]),[ee,et]=(0,r.useState)([]),[en,es]=(0,r.useState)(!1),[er,el]=(0,r.useState)(i),[ea,eo]=(0,r.useState)(i),[ei,ed]=(0,r.useState)(!1),[ec,em]=(0,r.useState)(!1),[ex,eu]=(0,r.useState)(!1),[eh,ep]=(0,r.useState)([]),[eg,eb]=(0,r.useState)({}),[ef,ej]=(0,r.useState)(!1),[ey,ev]=(0,r.useState)(!1),[eN,ek]=(0,r.useState)(null),[ew,eC]=(0,r.useState)([]),[eA,eS]=(0,r.useState)(!1),[eP,eO]=(0,r.useState)(null),[e$,eI]=(0,r.useState)(i),[eE,eL]=(0,r.useState)(!1),[eT,e_]=(0,r.useState)(null),[eM,eK]=(0,r.useState)(null),[eF,eR]=(0,r.useState)(null),[eU,eD]=(0,r.useState)(!1),[eq,eB]=(0,r.useState)(!1),[ez,eW]=(0,r.useState)("full"),[eH,eG]=(0,r.useState)(5),[eY,eJ]=(0,r.useState)(0),[eV,eX]=(0,r.useState)(0),[eZ,eQ]=(0,r.useState)(5),[e0,e1]=(0,r.useState)(String(5)),[e2,e3]=(0,r.useState)(!1),[e5,e4]=(0,r.useState)({}),[e7,e8]=(0,r.useState)(""),[e6,e9]=(0,r.useState)(""),[te,tt]=(0,r.useState)(!1),[tn,ts]=(0,r.useState)(""),[tr,tl]=(0,r.useState)(null),[ta,to]=(0,r.useState)(null),[ti,td]=(0,r.useState)(null),[tc,tm]=(0,r.useState)(null),[tx,tu]=(0,r.useState)(null),[th,tp]=(0,r.useState)(!1),[tg,tb]=(0,r.useState)({type:"",message:""}),tf=(0,r.useRef)(null),[tj,ty]=(0,r.useState)(null),[tv,tN]=(0,r.useState)(""),[tk,tw]=(0,r.useState)(""),[tC,tA]=(0,r.useState)("all"),[tS,tP]=(0,r.useState)(1),[tO,t$]=(0,r.useState)(25),[tI,tE]=(0,r.useState)({page:1,pageSize:25,total:0,totalAll:0,totalPages:1,status:"all",search:""}),{copied:tL,copy:tT}=(0,o.C)(),{isAdmin:t_,canManageApiKeys:tM,userId:tK}=(0,a.s)(),tF=t_||tM,tR=Number.isFinite(Number(eH))?Number(eH):5,tU=Number.isFinite(Number(eY))?Number(eY):p.length,tD=Number.isFinite(Number(eV))?Number(eV):Number(tI.totalAll||tI.total||0),tq=Number(tI.total||0),tB=!tF&&tU>=tR,tz=tn?`${tn}/v1`:"/v1",tW=tn||"",tH=tn?`${tn}/v1/chat/completions`:"/v1/chat/completions",tG=c(Z)[0]||"",tY=(e=c(tr?.allowedModels)[0],t=String(tG||"").trim(),e||t||"YOUR_MODEL"),tJ=tr?f(tr.limits||{}):i,tV=tJ.maxOutputTokens>0?tJ.maxOutputTokens:0,tX=tr?function({endpoint:e,apiKey:t,model:n,maxOutputTokens:s=0}){let r=String(e||"/v1/chat/completions").replace(/"/g,""),l=String(t||"YOUR_API_KEY").replace(/"/g,""),a=h(s,0),o={model:String(n||"YOUR_MODEL"),messages:[{role:"user",content:"Say hi.\nReply in one short sentence."}],temperature:.2,stream:!1};a>0&&(o.max_tokens=a);let i=JSON.stringify(o).replace(/"/g,'\\"');return`curl.exe -X POST "${r}" ^
6
- -H "Authorization: Bearer ${l}" ^
7
- -H "Content-Type: application/json" ^
8
- -d "${i}"`}({endpoint:tH,apiKey:tr.key,model:tY,maxOutputTokens:tV}):"",tZ=ta?m(ta,tG):{codingModel:"programmer",fastModel:"programmer-fast"},tQ=ta?function({baseUrl:e,apiKey:t,codingModel:n,fastModel:s}){let r=n||"programmer",l=s||r||"programmer-fast";return`{
9
- "env": {
10
- "ANTHROPIC_BASE_URL": "${e||"https://models-gateway.example.com"}",
11
- "ANTHROPIC_AUTH_TOKEN": "${t||"sk-xxxxx"}",
12
- "ANTHROPIC_MODEL": "${r}",
13
- "ANTHROPIC_SMALL_FAST_MODEL": "${l}",
14
- "ANTHROPIC_DEFAULT_OPUS_MODEL": "${r}",
15
- "ANTHROPIC_DEFAULT_SONNET_MODEL": "${r}",
16
- "ANTHROPIC_DEFAULT_HAIKU_MODEL": "${l}"
17
- // Uncomment 2 d\xf2ng dưới khi d\xf9ng local model:
18
- // "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "120000",
19
- // "CLAUDE_AUTOCOMPACT_PCT_OVERRIDE": "75"
20
- },
21
- "theme": "dark",
22
- "hasCompletedOnboarding": true
23
- }`}({baseUrl:tW,apiKey:ta.key,codingModel:tZ.codingModel,fastModel:tZ.fastModel}):"",t0=ta?['# C\xe1ch 1: PowerShell installer\nirm https://claude.ai/install.ps1 | iex\n\n# C\xe1ch 2: CMD installer\ncurl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd\n\n# C\xe1ch 3: npm (cần c\xe0i Node.js trước)\nnpm install -g @anthropic-ai/claude-code\nclaude --version\nmkdir $env:USERPROFILE\\.claude -Force\n$utf8NoBom = New-Object System.Text.UTF8Encoding $false\n[System.IO.File]::WriteAllText("$env:USERPROFILE\\.claude\\settings.json", @\'',tQ,"'@, $utf8NoBom)\ncd D:\\path\\to\\your-project\nclaude"].join("\n"):"",t1=ti?m(ti,tG):{codingModel:"programmer",fastModel:"programmer-fast"},t2=ti?function({baseUrl:e,apiKey:t,codingModel:n,fastModel:s}){let r=n||"programmer",l=s||r||"programmer-fast",a=`bluerouter/${r}`,o=`bluerouter/${l}`,i={[r]:{name:r,limit:{context:12e4,output:3e4},modalities:{input:["text","image"],output:["text"]}}};return l!==r&&(i[l]={name:l,limit:{context:12e4,output:3e4},modalities:{input:["text"],output:["text"]}}),JSON.stringify({$schema:"https://opencode.ai/config.json",provider:{bluerouter:{npm:"@ai-sdk/openai-compatible",name:"BlueRouter",options:{baseURL:e||"https://models-gateway.example.com/v1",apiKey:t||"sk-xxxxx"},models:i}},model:a,small_model:o,compaction:{auto:!0,prune:!0,reserved:3e4},agent:{explorer:{description:"Fast explorer subagent for codebase exploration",mode:"subagent",model:o}}},null,2)}({baseUrl:tz,apiKey:ti.key,codingModel:t1.codingModel,fastModel:t1.fastModel}):"",t3=ti?['npm install -g opencode-ai\nopencode --version\nmkdir $env:APPDATA\\opencode -Force\n$utf8NoBom = New-Object System.Text.UTF8Encoding $false\n[System.IO.File]::WriteAllText("$env:APPDATA\\opencode\\opencode.json", @\'',t2,"'@, $utf8NoBom)\ncd D:\\path\\to\\your-project\nopencode"].join("\n"):"";(0,r.useEffect)(()=>{if(!tc)return;let e=!1;return fetch("/api/codex-catalog").then(e=>e.ok?e.json():null).then(t=>{e||tu(t)}).catch(()=>{e||tu(null)}),()=>{e=!0}},[tc]);let t5=!!tx?.exists,t4=async e=>{if(e){tp(!0),tb({type:"",message:""});try{let t=new FormData;t.append("file",e);let n=await fetch("/api/codex-catalog/upload",{method:"POST",body:t}),s=await n.json().catch(()=>({}));if(!n.ok)throw Error(s.error||"Tải l\xean thất bại");tu(s),tb({type:"success",message:`Đ\xe3 tải l\xean ${s.modelCount} model.`})}catch(e){tb({type:"error",message:e.message||"Tải l\xean thất bại"})}finally{tp(!1)}}},t7=async e=>{let t=e.target.files?.[0];await t4(t),tf.current&&(tf.current.value="")},t8=async()=>{tp(!0),tb({type:"",message:""});try{let e=await fetch("/api/codex-catalog",{method:"DELETE"}),t=await e.json().catch(()=>({}));if(!e.ok)throw Error(t.error||"Xo\xe1 thất bại");tu(t),tb({type:"success",message:"Đ\xe3 xo\xe1 catalog."})}catch(e){tb({type:"error",message:e.message||"Xo\xe1 thất bại"})}finally{tp(!1)}},t6=tc?m(tc,tG):{codingModel:"programmer",fastModel:"programmer-fast"},t9=tc?function({baseUrl:e,codingModel:t,hasCatalog:n}){let s=[`model = "${t||"programmer"}"`,'model_provider = "bluerouter"'];return n&&s.push(`model_catalog_json = '${x}'`),s.push("# Uncomment 3 d\xf2ng dưới khi d\xf9ng local model:","# model_context_window = 120000","# model_auto_compact_token_limit = 90000",'# model_auto_compact_token_limit_scope = "total"',"","[model_providers.bluerouter]",'name = "BlueRouter"',`base_url = "${e||"https://models-gateway.example.com"}"`,'env_key = "OPENAI_API_KEY"','wire_api = "responses"'),s.join("\n")}({baseUrl:tz,codingModel:t6.codingModel,hasCatalog:t5}):"",ne=tc?function({model:e}){return`model = "${e}"`}({model:t6.fastModel||t6.codingModel}):"",nt=tc?["npm install -g @openai/codex","codex --version","mkdir $env:USERPROFILE\\.codex -Force","$utf8NoBom = New-Object System.Text.UTF8Encoding $false",'[System.IO.File]::WriteAllText("$env:USERPROFILE\\.codex\\config.toml", @\'',t9,"'@, $utf8NoBom)","","# Profile fast: chạy bằng codex -p fast",'[System.IO.File]::WriteAllText("$env:USERPROFILE\\.codex\\fast.config.toml", @\'',ne,"'@, $utf8NoBom)",...t5?["",`# Bấm n\xfat "Tải ${x}" ở tr\xean, rồi ch\xe9p file v\xe0o đ\xfang thư mục n\xe0y:`,`# Move-Item -Force "$env:USERPROFILE\\Downloads\\${x}" "$env:USERPROFILE\\.codex\\${x}"`]:[],"",`$env:OPENAI_API_KEY = "${tc.key}"`,`setx OPENAI_API_KEY "${tc.key}"`,"cd D:\\path\\to\\your-project","codex"].join("\n"):"",nn=tj?m(tj,tG):{codingModel:tG||"YOUR_MODEL",fastModel:tG||"YOUR_MODEL"},ns=tj?function({baseUrl:e,apiKey:t,codingModel:n,fastModel:s}){let r=n||"programmer",l=s||r||"programmer-fast",a=e||"https://models-gateway.example.com/v1";return JSON.stringify({env:{OPENAI_API_KEY:t||"sk-xxxxx"},security:{auth:{selectedType:"openai"}},model:{name:r},modelProviders:{openai:[{id:r,name:r,envKey:"OPENAI_API_KEY",baseUrl:a,generationConfig:{timeout:12e4,maxRetries:2,contextWindowSize:12e4,samplingParams:{temperature:.2}}},{id:l,name:l,envKey:"OPENAI_API_KEY",baseUrl:a,generationConfig:{timeout:6e4,maxRetries:2,reasoning:!1,contextWindowSize:12e4,samplingParams:{temperature:.2,max_tokens:4096}}}]}},null,2)}({baseUrl:tz,apiKey:tj.key,codingModel:nn.codingModel,fastModel:nn.fastModel}):"",nr=tj?['npm install -g @qwen-code/qwen-code\nqwen --version\nmkdir $env:USERPROFILE\\.qwen -Force\n$utf8NoBom = New-Object System.Text.UTF8Encoding $false\n[System.IO.File]::WriteAllText("$env:USERPROFILE\\.qwen\\settings.json", @\'',ns,"'@, $utf8NoBom)",`$env:OPENAI_API_KEY = "${tj.key}"`,`$env:OPENAI_BASE_URL = "${tz}"`,`$env:OPENAI_MODEL = "${nn.codingModel}"`,`setx OPENAI_API_KEY "${tj.key}"`,`setx OPENAI_BASE_URL "${tz}"`,`setx OPENAI_MODEL "${nn.codingModel}"`,"cd D:\\path\\to\\your-project\nqwen"].join("\n"):"",nl=(0,r.useMemo)(()=>{let e=new Map;for(let t of z){let n=d(t.username||t.email||t.userPrincipalName||t.sAMAccountName);n&&e.set(n,{id:n,label:`${t.displayName||t.username||n}${t.email?` \xb7 ${t.email}`:""}`})}for(let t of p){let n=d(t.ownerUser||t.createdByUser);n&&!e.has(n)&&e.set(n,{id:n,label:n})}return tK&&!e.has(tK)&&e.set(tK,{id:tK,label:`${tK} (t\xf4i)`}),[...e.values()].sort((e,t)=>e.label.localeCompare(t.label))},[z,p,tK]),na=(n=c(ee),u=c(Z),!(n.length===u.length&&n.every((e,t)=>e===u[t]))),no=V||!E.trim()||0===Z.length||tB,ni=!!tk||"all"!==tC,nd=async()=>{A(!0),O("");try{let e=new URLSearchParams;e.set("page",String(tS)),e.set("pageSize",String(tO)),tk&&e.set("q",tk),"all"!==tC&&e.set("status",tC);let t=await fetch(`/api/keys?${e.toString()}`,{cache:"no-store"}),n=await t.json().catch(()=>({}));if(!t.ok)throw Error(n.error||"Kh\xf4ng tải được danh s\xe1ch API keys");let s=n.keys||[],r=n.pagination||{page:tS,pageSize:tO,total:s.length,totalAll:s.length,totalPages:1,search:tk,status:tC};if(0===s.length&&Number(r.total||0)>0&&tS>1)return void tP(Math.max(1,Number(r.totalPages||1)));let l=c(n.apiKeyDefaultModels||(n.apiKeyDefaultModel?[n.apiKeyDefaultModel]:[]));g(s),tE(r),eX(n.apiKeyTotal??r.totalAll??r.total??s.length);let a=f(n.apiKeyDefaultPolicy||i,i);Q(l),et(l),el(a),eo(a),eG(n.apiKeyLimit??5),eJ(n.apiKeyCount??r.totalAll??s.length),"number"==typeof n.globalApiKeyLimit&&n.globalApiKeyLimit>0&&(eQ(n.globalApiKeyLimit),e1(String(n.globalApiKeyLimit))),n.apiKeyLimitOverrides&&"object"==typeof n.apiKeyLimitOverrides&&e4(n.apiKeyLimitOverrides),eB(!0===n.globalCavemanEnabled),eW(n.globalCavemanLevel||"full")}catch(e){O(e.message||"Kh\xf4ng tải được danh s\xe1ch API keys")}finally{A(!1)}};(0,r.useEffect)(()=>{ts(window.location.origin)},[]),(0,r.useEffect)(()=>{let e=setTimeout(()=>{tP(1),tw(tv.trim())},350);return()=>clearTimeout(e)},[tv]),(0,r.useEffect)(()=>{nd()},[tS,tO,tk,tC]),(0,r.useEffect)(()=>{let e=!1,t=async()=>{try{let t=await fetch("/api/keys?page=1&pageSize=1",{cache:"no-store"}),n=await t.json().catch(()=>({}));if(!t.ok||e)return;eB(!0===n.globalCavemanEnabled),eW(n.globalCavemanLevel||"full")}catch{}},n=()=>t(),s=()=>{"visible"===document.visibilityState&&t()};window.addEventListener("focus",n),document.addEventListener("visibilitychange",s);let r=window.setInterval(t,3e4);return()=>{e=!0,window.removeEventListener("focus",n),document.removeEventListener("visibilitychange",s),window.clearInterval(r)}},[]),(0,r.useEffect)(()=>{!T&&tK&&M(tK)},[tK,T]);let nc=async()=>{if(!ef&&!ey){ev(!0);try{let[e,t,n]=await Promise.allSettled([tF?fetch("/api/providers",{cache:"no-store"}):Promise.resolve(null),fetch("/api/personal-cloud-providers",{cache:"no-store"}),fetch("/api/models/alias",{cache:"no-store"})]),s=[],r=[];if("fulfilled"===e.status&&e.value?.ok){let t=await e.value.json().catch(()=>({}));s.push(...t.connections||[])}if("fulfilled"===t.status&&t.value.ok){let e=await t.value.json().catch(()=>({}));r.push(...e.connections||[])}if(ep(tF?[...s,...r]:r),"fulfilled"===n.status&&n.value.ok){let e=await n.value.json().catch(()=>({}));eb(e.aliases||{})}ej(!0)}catch{}finally{ev(!1)}}},nm=async(e=H)=>{if(tF){J(!0);try{let t=await fetch(`/api/auth/ldap/users?q=${encodeURIComponent(e||"")}`,{cache:"no-store"}),n=await t.json().catch(()=>({}));t.ok&&W(n.users||[])}catch{}finally{J(!1)}}},nx=async()=>{if(tF&&0!==ee.length){es(!0),O("");try{let e=await fetch("/api/keys",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKeyDefaultModels:ee})}),t=await e.json().catch(()=>({}));if(!e.ok)throw Error(t.error||"Kh\xf4ng lưu được default models");let n=c(t.apiKeyDefaultModels||(t.apiKeyDefaultModel?[t.apiKeyDefaultModel]:[])),s=f(t.apiKeyDefaultPolicy||i,i);Q(n),et(n),el(s),eo(s)}catch(e){O(e.message||"Kh\xf4ng lưu được default models")}finally{es(!1)}}},nu=e=>{"number"==typeof e?.globalApiKeyLimit&&e.globalApiKeyLimit>0&&(eQ(e.globalApiKeyLimit),e1(String(e.globalApiKeyLimit))),e?.apiKeyLimitOverrides&&"object"==typeof e.apiKeyLimitOverrides&&e4(e.apiKeyLimitOverrides)},nh=async()=>{if(!tF)return;let e=Number.parseInt(e0,10);if(!Number.isFinite(e)||e<=0)return void O("Giới hạn global phải l\xe0 số nguy\xean dương.");e3(!0),O("");try{let t=await fetch("/api/keys",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({userApiKeyLimit:e})}),n=await t.json().catch(()=>({}));if(!t.ok)throw Error(n.error||"Kh\xf4ng lưu được global API key limit");nu(n)}catch(e){O(e.message||"Kh\xf4ng lưu được global API key limit")}finally{e3(!1)}},np=async e=>{if(!tF)return!1;tt(!0),O("");try{let t=await fetch("/api/keys",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({userApiKeyLimitOverrides:e})}),n=await t.json().catch(()=>({}));if(!t.ok)throw Error(n.error||"Kh\xf4ng lưu được per-user override");return nu(n),!0}catch(e){return O(e.message||"Kh\xf4ng lưu được per-user override"),!1}finally{tt(!1)}},ng=async()=>{let e=d(e7),t=Number.parseInt(e6,10);if(!e)return void O("Nhập username/email cần override.");if(!Number.isFinite(t)||t<=0)return void O("Giới hạn per-user phải l\xe0 số nguy\xean dương.");let n={...e5,[e]:t};await np(n)&&(e8(""),e9(""))},nb=async e=>{let t={...e5};delete t[e],await np(t)},nf=async e=>{if(!tF)return;let t=f(e,i);ed(!0),O("");try{let e=await fetch("/api/keys",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKeyDefaultPolicy:t})}),n=await e.json().catch(()=>({}));if(!e.ok)throw Error(n.error||"Kh\xf4ng lưu được default policy");let s=f(n.apiKeyDefaultPolicy||t,i);el(s),eo(s),em(!1)}catch(e){O(e.message||"Kh\xf4ng lưu được default policy")}finally{ed(!1)}},nj=async()=>{if(E.trim()){if(0===Z.length)return void O("Admin cần cấu h\xecnh default models trước khi tạo API key.");if(tB)return void O(`Mỗi user chỉ được tạo tối đa ${tR} API keys.
24
- C\xf3 thể d\xf9ng n\xfat Đổi key để xoay sang key mới m\xe0 kh\xf4ng cần x\xf3a/tạo lại.`);X(!0),O("");try{let e=tF?d(K||T||tK):void 0,t=await fetch("/api/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:E.trim(),ownerUser:e})}),n=await t.json().catch(()=>({}));if(!t.ok)throw Error(n.error||"Kh\xf4ng tạo được API key");D(n.key),L(""),R(""),I(!1),tP(1),await nd()}catch(e){O(e.message||"Kh\xf4ng tạo được API key")}finally{X(!1)}}},ny=async(e,t)=>{let n=await fetch(`/api/keys/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),s=await n.json().catch(()=>({}));return n.ok?(await nd(),!0):(O(s.error||"Kh\xf4ng cập nhật được API key"),!1)},nv=async()=>{if(!eN)return;let e=c(ew);if(0===e.length)return void O("H\xe3y chọn \xedt nhất một model trước khi lưu quyền truy cập API key.");eS(!0),O("");try{await ny(eN.id,{allowedModels:e})&&(ek(null),eC([]))}finally{eS(!1)}},nN=async e=>{if(eP){eL(!0),O("");try{await ny(eP.id,{limits:f(e)})&&(eO(null),eI(i))}finally{eL(!1)}}},nk=async()=>{if(eP){eL(!0),O("");try{await ny(eP.id,{limits:{}})&&(eO(null),eI(i))}finally{eL(!1)}}},nw=async e=>{if(!eT)return!1;eD(!0),O("");try{let t=await fetch(`/api/keys/${eT.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>({}));if(!t.ok)throw Error(n.error||"Kh\xf4ng lưu được cấu h\xecnh Caveman");return await nd(),e_(null),!0}catch(t){let e=t?.message||"Kh\xf4ng lưu được cấu h\xecnh Caveman";throw O(e),Error(e)}finally{eD(!1)}};return(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-2xl font-semibold text-text-main",children:"Quản l\xfd API Keys"}),(0,s.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:tF?"Bảng quản trị API key c\xf3 t\xecm kiếm, lọc trạng th\xe1i v\xe0 ph\xe2n trang để kh\xf4ng render qu\xe1 nhiều key c\xf9ng l\xfac.":`Bạn c\xf3 thể quản l\xfd API key của t\xe0i khoản m\xecnh. Mỗi user thường sở hữu tối đa ${tR} API keys. D\xf9ng n\xfat Đổi key để xoay sang key mới m\xe0 kh\xf4ng cần x\xf3a/tạo lại.`})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)(l.$n,{variant:"outline",onClick:nd,disabled:v,children:v?"Đang tải...":"Refresh"}),(0,s.jsx)(l.$n,{onClick:()=>{I(!0),!T&&tK&&M(tK)},disabled:tB,children:"Tạo API Key"})]})]}),S?(0,s.jsx)("div",{className:"rounded-xl border border-red-500/30 bg-red-500/10 p-3 text-sm text-red-600 whitespace-pre-line",children:S}):null,(0,s.jsxs)("div",{className:"grid gap-3 md:grid-cols-3",children:[(0,s.jsx)(w,{label:"Tổng API keys",value:tD,hint:tF?"To\xe0n hệ thống":`${tU}/${tR} key của bạn`}),(0,s.jsx)(w,{label:"Đang hiển thị",value:tq,hint:ni?"Theo bộ lọc hiện tại":"Kh\xf4ng filter"}),(0,s.jsx)(w,{label:"Page size",value:tO,hint:"Chỉ tải số d\xf2ng của trang hiện tại"})]}),tF?null:(0,s.jsx)(l.Zp,{children:(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"font-medium",children:"Giới hạn API key theo user"}),(0,s.jsxs)("p",{className:"text-sm text-text-muted",children:["T\xe0i khoản của bạn đang c\xf3 ",tU,"/",tR," API keys. Key bị disabled vẫn được t\xednh v\xe0o giới hạn."]})]}),(0,s.jsx)("span",{className:"rounded-full border border-border bg-surface px-3 py-1 text-sm",children:tB?"Đ\xe3 đạt giới hạn":"C\xf2n c\xf3 thể tạo th\xeam"})]})}),(0,s.jsxs)("div",{className:"grid gap-4 xl:grid-cols-2",children:[(0,s.jsx)(l.Zp,{children:(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"font-medium",children:"Default models cho API key mới"}),(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"API key mới sẽ mặc định được d\xf9ng c\xe1c model n\xe0y. Cần cấu h\xecnh \xedt nhất một default model trước khi tạo API key."})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[Z.length>0?(0,s.jsx)(j,{models:Z,emptyLabel:"Chưa cấu h\xecnh default models"}):(0,s.jsx)("span",{className:"text-sm text-red-600",children:"Chưa cấu h\xecnh default models"}),tF?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.$n,{variant:"outline",size:"sm",onClick:()=>{eu(!0),nc()},children:ee.length>0?`Đ\xe3 chọn ${ee.length} model`:"Chọn default models..."}),(0,s.jsx)(l.$n,{size:"sm",onClick:nx,disabled:!na||en||0===ee.length,children:en?"Đang lưu...":"Lưu"})]}):null]}),tF?(0,s.jsx)("p",{className:"text-xs text-text-muted",children:ey?"Đang tải danh s\xe1ch model...":"Danh s\xe1ch model chỉ tải khi mở bộ chọn để trang load nhanh hơn."}):null]})}),(0,s.jsx)(l.Zp,{children:(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"font-medium",children:"Default policy cho API key mới"}),(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"Policy n\xe0y được tự động g\xe1n cho key mới. Policy ri\xeang từng key vẫn c\xf3 thể override sau khi tạo."})]}),tF?(0,s.jsx)(l.$n,{variant:"outline",size:"sm",onClick:()=>{eo(f(er||i,i)),em(!0)},children:"Chỉnh default policy"}):null]}),(0,s.jsx)(y,{limits:er,showThinking:tF,showOutputLimit:tF})]})})]}),tF?(0,s.jsx)(l.Zp,{children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"font-medium",children:"Giới hạn số API key cho mỗi user"}),(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"Global default \xe1p dụng cho mọi user thường. Per-user override sẽ ghi đ\xe8 global cho user cụ thể (nhập 0 hoặc bấm X\xf3a để bỏ override v\xe0 quay lại global)."})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-end",children:[(0,s.jsxs)("label",{className:"flex-1",children:[(0,s.jsx)("span",{className:"mb-1 block text-xs font-medium text-text-muted",children:"Global default (\xe1p dụng cho user kh\xf4ng c\xf3 override)"}),(0,s.jsx)("input",{type:"number",min:"1",value:e0,onChange:e=>e1(e.target.value),className:"w-full rounded-xl border border-border bg-background px-3 py-2 text-sm outline-none focus:border-primary"})]}),(0,s.jsx)(l.$n,{onClick:nh,disabled:e2||Number.parseInt(e0,10)===eZ,children:e2?"Đang lưu...":"Lưu global"})]}),(0,s.jsxs)("div",{className:"rounded-xl border border-border p-3",children:[(0,s.jsx)("div",{className:"text-sm font-medium",children:"Per-user override"}),(0,s.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Ghi đ\xe8 global cho user cụ thể. Override sẽ \xe1p dụng lu\xf4n cả cho key hiện c\xf3 (chặn tạo key mới nếu vượt)."}),(0,s.jsxs)("div",{className:"mt-3 flex flex-col gap-2 sm:flex-row",children:[(0,s.jsx)("input",{value:e7,onChange:e=>e8(e.target.value),placeholder:"username hoặc email",className:"min-w-0 flex-1 rounded-xl border border-border bg-background px-3 py-2 text-sm outline-none focus:border-primary"}),(0,s.jsx)("input",{type:"number",min:"1",value:e6,onChange:e=>e9(e.target.value),placeholder:"Giới hạn key",className:"w-full rounded-xl border border-border bg-background px-3 py-2 text-sm outline-none focus:border-primary sm:w-40"}),(0,s.jsx)(l.$n,{onClick:ng,disabled:te,children:te?"Đang lưu...":"Th\xeam / Cập nhật"})]}),0===Object.keys(e5).length?(0,s.jsxs)("div",{className:"mt-3 rounded-xl border border-dashed border-border bg-surface p-3 text-xs text-text-muted",children:["Chưa c\xf3 user n\xe0o được override. Global = ",eZ," key."]}):(0,s.jsx)("div",{className:"mt-3 overflow-hidden rounded-xl border border-border",children:(0,s.jsxs)("table",{className:"min-w-full text-sm",children:[(0,s.jsx)("thead",{className:"bg-surface text-xs text-text-muted",children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"px-3 py-2 text-left font-medium",children:"User"}),(0,s.jsx)("th",{className:"px-3 py-2 text-left font-medium",children:"Giới hạn"}),(0,s.jsx)("th",{className:"px-3 py-2 text-right font-medium",children:"H\xe0nh động"})]})}),(0,s.jsx)("tbody",{children:Object.entries(e5).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>(0,s.jsxs)("tr",{className:"border-t border-border",children:[(0,s.jsx)("td",{className:"px-3 py-2 font-mono text-xs",children:e}),(0,s.jsx)("td",{className:"px-3 py-2",children:t}),(0,s.jsx)("td",{className:"px-3 py-2 text-right",children:(0,s.jsx)(l.$n,{size:"sm",variant:"ghost",disabled:te,onClick:()=>nb(e),children:"X\xf3a"})})]},e))})]})})]})]})}):null,(0,s.jsx)(l.Zp,{children:(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"font-medium",children:"Th\xf4ng tin API endpoint"}),(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"D\xf9ng API key b\xean dưới để gọi gateway theo chuẩn OpenAI-compatible. Endpoint lấy theo domain hiện tại của dashboard."})]}),(0,s.jsxs)("div",{className:"grid gap-3 md:grid-cols-2",children:[(0,s.jsxs)("div",{className:"rounded-xl border border-border bg-surface p-3",children:[(0,s.jsx)("div",{className:"text-xs text-text-muted",children:"Base URL"}),(0,s.jsx)("div",{className:"mt-1 break-all font-mono text-sm",children:tz})]}),(0,s.jsxs)("div",{className:"rounded-xl border border-border bg-surface p-3",children:[(0,s.jsx)("div",{className:"text-xs text-text-muted",children:"Chat Completions"}),(0,s.jsx)("div",{className:"mt-1 break-all font-mono text-sm",children:tH})]})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)(l.$n,{variant:"outline",size:"sm",onClick:()=>tT(tz,"api-base-url"),children:"api-base-url"===tL?"Đ\xe3 copy Base URL":"Copy Base URL"}),(0,s.jsx)(l.$n,{variant:"outline",size:"sm",onClick:()=>tT(tH,"api-chat-endpoint"),children:"api-chat-endpoint"===tL?"Đ\xe3 copy Endpoint":"Copy Endpoint"})]})]})}),U?(0,s.jsx)(l.Zp,{children:(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("h3",{className:"font-medium",children:"Đ\xe3 tạo API key"}),(0,s.jsx)("pre",{className:"overflow-auto rounded-xl border border-border bg-surface p-3 text-sm",children:U}),(0,s.jsxs)("div",{className:"text-sm text-text-muted",children:["H\xe3y copy ngay. Key mới mặc định được d\xf9ng default models v\xe0 default policy đang cấu h\xecnh trong Dashboard, trừ khi admin chỉnh quyền model/policy.",(0,s.jsx)(j,{models:Z,emptyLabel:"default models"})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(l.$n,{size:"sm",onClick:()=>tT(U,"created"),children:"created"===tL?"Đ\xe3 copy":"Copy"}),(0,s.jsx)(l.$n,{size:"sm",variant:"ghost",onClick:()=>D(""),children:"Đ\xf3ng"})]})]})}):null,(0,s.jsx)(l.Zp,{children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-3 xl:flex-row xl:items-end xl:justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-lg font-semibold text-text-main",children:"Danh s\xe1ch API keys"}),(0,s.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:"T\xecm theo t\xean key, owner, model, id hoặc một phần API key. Backend chỉ trả về page hiện tại."})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[(0,s.jsx)("input",{value:tv,onChange:e=>tN(e.target.value),placeholder:"T\xecm API key, owner, model...",className:"w-full rounded-xl border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary sm:w-80"}),(0,s.jsxs)("select",{value:tC,onChange:e=>{tA(e.target.value),tP(1)},className:"rounded-xl border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary",children:[(0,s.jsx)("option",{value:"all",children:"Tất cả trạng th\xe1i"}),(0,s.jsx)("option",{value:"active",children:"Chỉ key đang bật"}),(0,s.jsx)("option",{value:"inactive",children:"Chỉ key đ\xe3 tắt"})]}),ni?(0,s.jsx)(l.$n,{variant:"outline",size:"sm",onClick:()=>{tN(""),tw(""),tA("all"),tP(1)},children:"X\xf3a lọc"}):null]})]}),v?(0,s.jsx)("div",{className:"rounded-2xl border border-dashed border-border p-8 text-center text-sm text-text-muted",children:"Đang tải API keys..."}):0===p.length?(0,s.jsx)("div",{className:"rounded-2xl border border-dashed border-border p-8 text-center text-sm text-text-muted",children:ni?"Kh\xf4ng t\xecm thấy API key ph\xf9 hợp bộ lọc.":"Chưa c\xf3 API key n\xe0o."}):(0,s.jsx)(F,{keys:p,copied:tL,copy:tT,isAdmin:tF,isFullAdmin:t_,globalCavemanEnabled:eq,globalCavemanLevel:ez,onToggleActive:(e,t)=>ny(e,{isActive:t}),onApiTest:tl,onClaudeSettings:to,onOpenCodeSettings:td,onCodexSettings:e=>{tb({type:"",message:""}),tm(e)},onQwenSettings:ty,onRename:(e,t)=>{let n=prompt("T\xean API key mới",t||"");n?.trim()&&ny(e,{name:n.trim()})},onRotate:e=>{e?.id&&B({title:"Đổi API key",message:"Hệ thống sẽ tạo chuỗi API key mới cho record n\xe0y v\xe0 giữ nguy\xean t\xean, owner, model, policy. Key cũ sẽ hết hiệu lực ngay sau khi đổi.",onConfirm:async()=>{B(null),O("");let t=await fetch(`/api/keys/${e.id}/rotate`,{method:"POST"}),n=await t.json().catch(()=>({}));if(!t.ok)return void O(n.error||"Kh\xf4ng đổi được API key");let s=n.rotatedKey||n.key?.key||"";s&&D(s),await nd()}})},onEditModels:e=>{t_&&(ek(e),eC(c(e.allowedModels)),nc())},onEditPolicy:e=>{tF&&(eO(e),eI(b(e.limits)?f(e.limits):i))},onEditCaveman:e_,onShowCavemanInfo:eK,onCavemanTest:eR,onAssignOwner:(e,t)=>{if(!tF)return;let n=prompt("G\xe1n owner username/email",t||tK||"");null!==n&&ny(e,{ownerUser:d(n)})},onDelete:e=>{B({title:"X\xf3a API Key",message:"Bạn chắc chắn muốn x\xf3a API key n\xe0y? Thao t\xe1c n\xe0y kh\xf4ng thể ho\xe0n t\xe1c.",onConfirm:async()=>{B(null),(await fetch(`/api/keys/${e}`,{method:"DELETE"})).ok&&await nd()}})}}),(0,s.jsx)(C,{pagination:tI,pageSize:tO,onPageChange:tP,onPageSizeChange:e=>{t$(e),tP(1)},loading:v})]})}),(0,s.jsx)(l.aF,{isOpen:$,onClose:()=>I(!1),title:"Tạo API Key",size:"lg",children:(0,s.jsxs)("div",{className:"space-y-4",children:[0===Z.length?(0,s.jsx)("div",{className:"rounded-xl border border-red-500/30 bg-red-500/10 p-3 text-sm text-red-600",children:"Admin cần cấu h\xecnh default models trước khi tạo API key."}):tB?(0,s.jsxs)("div",{className:"rounded-xl border border-red-500/30 bg-red-500/10 p-3 text-sm text-red-600",children:["Bạn đ\xe3 đạt giới hạn ",tR," API keys. H\xe3y x\xf3a bớt key cũ trước khi tạo key mới."]}):(0,s.jsxs)("div",{className:"text-sm text-text-muted",children:["Key n\xe0y sẽ được tạo với quyền d\xf9ng default models v\xe0 default policy đang cấu h\xecnh trong Dashboard.",(0,s.jsx)(j,{models:Z})]}),(0,s.jsxs)("label",{className:"block",children:[(0,s.jsx)("span",{className:"mb-1 block text-xs font-medium text-text-muted",children:"T\xean API key"}),(0,s.jsx)("input",{value:E,onChange:e=>L(e.target.value),placeholder:"VD: VSCode, LibreChat, team-user",className:"w-full rounded-xl border border-border bg-background px-3 py-2 text-sm outline-none focus:border-primary"})]}),tF?(0,s.jsxs)("div",{className:"space-y-3 rounded-xl border border-border p-3",children:[(0,s.jsx)("div",{className:"text-sm font-medium",children:"Owner user"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("input",{value:H,onChange:e=>G(e.target.value),placeholder:"Nhập từ kh\xf3a rồi bấm Tải",className:"min-w-0 flex-1 rounded-xl border border-border bg-background px-3 py-2 text-sm outline-none focus:border-primary"}),(0,s.jsx)(l.$n,{variant:"outline",onClick:()=>nm(H),disabled:Y,children:Y?"Đang tải":"Tải LDAP"})]}),(0,s.jsxs)("select",{value:T,onChange:e=>M(e.target.value),className:"w-full rounded-xl border border-border bg-background px-3 py-2 text-sm text-text-main outline-none focus:border-primary",children:[(0,s.jsxs)("option",{value:tK||"",children:["G\xe1n cho t\xf4i (",tK||"local",")"]}),nl.map(e=>(0,s.jsx)("option",{value:e.id,children:e.label},e.id))]}),(0,s.jsx)("input",{value:K,onChange:e=>R(e.target.value),placeholder:"username hoặc email, kh\xf4ng bắt buộc",className:"w-full rounded-xl border border-border bg-background px-3 py-2 text-sm outline-none focus:border-primary"}),(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"LDAP kh\xf4ng tự tải khi mở trang để giảm thời gian load. C\xf3 thể nhập owner thủ c\xf4ng hoặc nhập từ kh\xf3a rồi bấm Tải LDAP."})]}):(0,s.jsxs)("p",{className:"rounded-xl border border-border bg-surface p-3 text-sm text-text-muted",children:["Owner: ",tK||"user hiện tại"]}),(0,s.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,s.jsx)(l.$n,{variant:"ghost",onClick:()=>I(!1),children:"Hủy"}),(0,s.jsx)(l.$n,{onClick:nj,disabled:no,children:V?"Đang tạo...":"Tạo"})]})]})}),(0,s.jsx)(l.aF,{isOpen:!!tr,onClose:()=>tl(null),title:"API Test bằng curl Windows",size:"xl",children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"Lệnh dưới đ\xe2y gọi thử endpoint Chat Completions bằng API key đang chọn v\xe0 đ\xe3 nh\xfang sẵn Bearer token."}),(0,s.jsxs)("div",{className:"grid gap-3 md:grid-cols-3",children:[(0,s.jsxs)("div",{className:"rounded-xl border border-border bg-surface p-3",children:[(0,s.jsx)("div",{className:"text-xs text-text-muted",children:"API Key"}),(0,s.jsx)("div",{className:"mt-1 text-sm",children:tr?.name||"API Key"})]}),(0,s.jsxs)("div",{className:"rounded-xl border border-border bg-surface p-3",children:[(0,s.jsx)("div",{className:"text-xs text-text-muted",children:"Endpoint"}),(0,s.jsx)("div",{className:"mt-1 break-all font-mono text-sm",children:tH})]}),(0,s.jsxs)("div",{className:"rounded-xl border border-border bg-surface p-3",children:[(0,s.jsx)("div",{className:"text-xs text-text-muted",children:"Model test"}),(0,s.jsx)("div",{className:"mt-1 break-all font-mono text-sm",children:tY})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mb-1 text-xs font-medium text-text-muted",children:"Lệnh curl cho Windows CMD"}),(0,s.jsx)("pre",{className:"overflow-auto rounded-xl border border-border bg-surface p-3 text-xs",children:tX})]}),(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"D\xe1n lệnh v\xe0o CMD hoặc Windows Terminal để test nhanh. Nếu domain dashboard chạy sau reverse proxy, endpoint sẽ d\xf9ng đ\xfang domain đang mở tr\xean tr\xecnh duyệt."}),(0,s.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,s.jsx)(l.$n,{variant:"ghost",onClick:()=>tl(null),children:"Đ\xf3ng"}),(0,s.jsx)(l.$n,{onClick:()=>tT(tX,`api-test-curl-${tr?.id||"current"}`),children:tL===`api-test-curl-${tr?.id||"current"}`?"Đ\xe3 copy":"Copy lệnh curl"})]})]})}),(0,s.jsx)(l.aF,{isOpen:!!ta,onClose:()=>to(null),title:"Claude Code Settings",size:"xl",children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("p",{className:"text-sm text-text-muted",children:["Copy nội dung JSON dưới đ\xe2y v\xe0o file ",(0,s.jsx)("span",{className:"font-mono",children:"%USERPROFILE%\\.claude\\settings.json"})," để Claude Code gọi qua gateway n\xe0y. Model coding d\xf9ng ",(0,s.jsx)("span",{className:"font-mono",children:tZ.codingModel}),"; model fast d\xf9ng ",(0,s.jsx)("span",{className:"font-mono",children:tZ.fastModel}),"."]}),(0,s.jsxs)("div",{className:"grid gap-3 md:grid-cols-3",children:[(0,s.jsxs)("div",{className:"rounded-xl border border-border bg-surface p-3",children:[(0,s.jsx)("div",{className:"text-xs text-text-muted",children:"API Key"}),(0,s.jsx)("div",{className:"mt-1 text-sm",children:ta?.name||"API Key"})]}),(0,s.jsxs)("div",{className:"rounded-xl border border-border bg-surface p-3",children:[(0,s.jsx)("div",{className:"text-xs text-text-muted",children:"Base URL"}),(0,s.jsx)("div",{className:"mt-1 break-all font-mono text-sm",children:tz})]}),(0,s.jsxs)("div",{className:"rounded-xl border border-border bg-surface p-3",children:[(0,s.jsx)("div",{className:"text-xs text-text-muted",children:"Model"}),(0,s.jsx)("div",{className:"mt-1 break-all font-mono text-sm",children:tZ.codingModel})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mb-1 text-xs font-medium text-text-muted",children:"settings.json"}),(0,s.jsx)("pre",{className:"max-h-[420px] overflow-auto rounded-xl border border-border bg-surface p-3 text-xs",children:tQ})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mb-1 text-xs font-medium text-text-muted",children:"C\xe0i v\xe0 chạy Claude Code CLI tr\xean Windows"}),(0,s.jsx)("pre",{className:"overflow-auto rounded-xl border border-border bg-surface p-3 text-xs",children:t0})]}),(0,s.jsx)("div",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 p-3 text-xs text-amber-700 dark:text-amber-300",children:"Lưu \xfd: 2 d\xf2ng auto-compact/context window đ\xe3 được comment sẵn; chỉ uncomment khi d\xf9ng local model. Nếu c\xe0i bằng npm th\xec m\xe1y cần c\xe0i Node.js trước. Chạy Claude Code trong thư mục project, kh\xf4ng chạy trong C:\\WINDOWS\\system32. Nếu d\xf9ng model fast ri\xeang như programmer-fast th\xec API key n\xe0y cũng phải được ph\xe9p d\xf9ng model đ\xf3 trong cột Model."}),(0,s.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:[(0,s.jsx)(l.$n,{variant:"ghost",onClick:()=>to(null),children:"Đ\xf3ng"}),(0,s.jsx)(l.$n,{variant:"outline",onClick:()=>tT(t0,`claude-code-help-${ta?.id||"current"}`),children:tL===`claude-code-help-${ta?.id||"current"}`?"Đ\xe3 copy hướng dẫn":"Copy hướng dẫn"}),(0,s.jsx)(l.$n,{onClick:()=>tT(tQ,`claude-code-settings-${ta?.id||"current"}`),children:tL===`claude-code-settings-${ta?.id||"current"}`?"Đ\xe3 copy settings":"Copy settings.json"})]})]})}),(0,s.jsx)(l.aF,{isOpen:!!ti,onClose:()=>td(null),title:"OpenCode Settings",size:"xl",children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("p",{className:"text-sm text-text-muted",children:["Copy JSON dưới đ\xe2y v\xe0o file ",(0,s.jsx)("span",{className:"font-mono",children:"%APPDATA%\\opencode\\opencode.json"})," hoặc ",(0,s.jsx)("span",{className:"font-mono",children:"opencode.json"})," trong project. Model ch\xednh d\xf9ng ",(0,s.jsx)("span",{className:"font-mono",children:t1.codingModel}),"; explorer/fast d\xf9ng ",(0,s.jsx)("span",{className:"font-mono",children:t1.fastModel}),"."]}),(0,s.jsxs)("div",{className:"grid gap-3 md:grid-cols-4",children:[(0,s.jsxs)("div",{className:"rounded-xl border border-border bg-surface p-3",children:[(0,s.jsx)("div",{className:"text-xs text-text-muted",children:"API Key"}),(0,s.jsx)("div",{className:"mt-1 text-sm",children:ti?.name||"API Key"})]}),(0,s.jsxs)("div",{className:"rounded-xl border border-border bg-surface p-3",children:[(0,s.jsx)("div",{className:"text-xs text-text-muted",children:"Base URL"}),(0,s.jsx)("div",{className:"mt-1 break-all font-mono text-sm",children:tz})]}),(0,s.jsxs)("div",{className:"rounded-xl border border-border bg-surface p-3",children:[(0,s.jsx)("div",{className:"text-xs text-text-muted",children:"Model ch\xednh"}),(0,s.jsx)("div",{className:"mt-1 break-all font-mono text-sm",children:t1.codingModel})]}),(0,s.jsxs)("div",{className:"rounded-xl border border-border bg-surface p-3",children:[(0,s.jsx)("div",{className:"text-xs text-text-muted",children:"Model fast"}),(0,s.jsx)("div",{className:"mt-1 break-all font-mono text-sm",children:t1.fastModel})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mb-1 text-xs font-medium text-text-muted",children:"opencode.json"}),(0,s.jsx)("pre",{className:"max-h-[420px] overflow-auto rounded-xl border border-border bg-surface p-3 text-xs",children:t2})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mb-1 text-xs font-medium text-text-muted",children:"C\xe0i v\xe0 chạy OpenCode tr\xean Windows PowerShell"}),(0,s.jsx)("pre",{className:"overflow-auto rounded-xl border border-border bg-surface p-3 text-xs",children:t3})]}),(0,s.jsxs)("div",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 p-3 text-xs text-amber-700 dark:text-amber-300",children:["Lưu \xfd: API key n\xe0y cần được ph\xe9p gọi cả ",t1.codingModel," v\xe0 ",t1.fastModel,". Nếu OpenCode đang d\xf9ng đường dẫn config kh\xe1c, c\xf3 thể đặt file opencode.json ngay trong thư mục project."]}),(0,s.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:[(0,s.jsx)(l.$n,{variant:"ghost",onClick:()=>td(null),children:"Đ\xf3ng"}),(0,s.jsx)(l.$n,{variant:"outline",onClick:()=>tT(t3,`opencode-help-${ti?.id||"current"}`),children:tL===`opencode-help-${ti?.id||"current"}`?"Đ\xe3 copy hướng dẫn":"Copy hướng dẫn"}),(0,s.jsx)(l.$n,{onClick:()=>tT(t2,`opencode-settings-${ti?.id||"current"}`),children:tL===`opencode-settings-${ti?.id||"current"}`?"Đ\xe3 copy settings":"Copy opencode.json"})]})]})}),(0,s.jsx)(l.aF,{isOpen:!!tc,onClose:()=>tm(null),title:"Codex Settings",size:"xl",children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("p",{className:"text-sm text-text-muted",children:["Copy TOML dưới đ\xe2y v\xe0o file ",(0,s.jsx)("span",{className:"font-mono",children:"%USERPROFILE%\\.codex\\config.toml"}),". API key được set bằng biến m\xf4i trường ",(0,s.jsx)("span",{className:"font-mono",children:"OPENAI_API_KEY"}),". Model ch\xednh d\xf9ng ",(0,s.jsx)("span",{className:"font-mono",children:t6.codingModel}),"; profile fast d\xf9ng ",(0,s.jsx)("span",{className:"font-mono",children:t6.fastModel}),"."]}),(0,s.jsxs)("div",{className:"grid gap-3 md:grid-cols-3",children:[(0,s.jsxs)("div",{className:"rounded-xl border border-border bg-surface p-3",children:[(0,s.jsx)("div",{className:"text-xs text-text-muted",children:"API Key"}),(0,s.jsx)("div",{className:"mt-1 text-sm",children:tc?.name||"API Key"})]}),(0,s.jsxs)("div",{className:"rounded-xl border border-border bg-surface p-3",children:[(0,s.jsx)("div",{className:"text-xs text-text-muted",children:"Base URL"}),(0,s.jsx)("div",{className:"mt-1 break-all font-mono text-sm",children:tz})]}),(0,s.jsxs)("div",{className:"rounded-xl border border-border bg-surface p-3",children:[(0,s.jsx)("div",{className:"text-xs text-text-muted",children:"Model"}),(0,s.jsx)("div",{className:"mt-1 break-all font-mono text-sm",children:t6.codingModel})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mb-1 text-xs font-medium text-text-muted",children:"%USERPROFILE%\\.codex\\config.toml"}),(0,s.jsx)("pre",{className:"max-h-[420px] overflow-auto rounded-xl border border-border bg-surface p-3 text-xs",children:t9})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"mb-1 text-xs font-medium text-text-muted",children:["%USERPROFILE%\\.codex\\fast.config.toml — chạy bằng ",(0,s.jsx)("span",{className:"font-mono",children:"codex -p fast"})]}),(0,s.jsx)("pre",{className:"overflow-auto rounded-xl border border-border bg-surface p-3 text-xs",children:ne})]}),(0,s.jsxs)("div",{className:"rounded-xl border border-border bg-surface p-3",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,s.jsx)("div",{className:"text-xs font-medium text-text-muted",children:x}),tx?.exists?(0,s.jsxs)("a",{href:"/api/codex-catalog/download",download:x,className:"rounded-lg border border-border px-3 py-1.5 text-xs font-medium hover:bg-surface-2",children:["Tải ",x]}):(0,s.jsx)("span",{className:"text-xs text-text-muted",children:"Admin chưa tải l\xean"})]}),(0,s.jsxs)("p",{className:"mt-2 text-xs text-text-muted",children:["File n\xe0y khai metadata model cho Codex: tắt cảnh b\xe1o ",(0,s.jsx)("span",{className:"font-mono",children:"Model metadata for ... not found"}),", khai đ\xfang context window v\xe0 mức reasoning. Tải về rồi để ",(0,s.jsx)("strong",{children:"chung thư mục với config.toml"})," — tức l\xe0 ",(0,s.jsxs)("span",{className:"font-mono",children:["%USERPROFILE%\\.codex\\",x]}),". Kh\xf4ng đổi t\xean file."]}),tx?.exists&&(0,s.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-[11px] text-text-muted",children:[(0,s.jsxs)("span",{children:[(tx.sizeBytes/1024).toFixed(0)," KB"]}),(0,s.jsx)("span",{children:"\xb7"}),(0,s.jsxs)("span",{children:[tx.modelCount," model"]}),tx.updatedAt&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{children:"\xb7"}),(0,s.jsxs)("span",{children:["cập nhật ",new Date(tx.updatedAt).toLocaleString("vi-VN")]})]})]}),tx?.exists&&tx.slugs?.length>0&&(0,s.jsxs)("div",{className:"mt-2 flex flex-wrap gap-1",children:[tx.slugs.map(e=>(0,s.jsx)("span",{className:"rounded-md border border-border px-1.5 py-0.5 font-mono text-[10px] text-text-muted",children:e},e)),tx.truncatedSlugs&&(0,s.jsx)("span",{className:"text-[10px] text-text-muted",children:"…"})]}),t_&&(0,s.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2 border-t border-border pt-3",children:[(0,s.jsx)("input",{ref:tf,type:"file",accept:"application/json,.json",className:"hidden",onChange:t7}),(0,s.jsx)(l.$n,{variant:"outline",size:"sm",disabled:th,onClick:()=>tf.current?.click(),children:th?"Đang xử l\xfd...":tx?.exists?"Thay file kh\xe1c":"Tải file l\xean"}),tx?.exists&&(0,s.jsx)(l.$n,{variant:"ghost",size:"sm",disabled:th,onClick:t8,children:"Xo\xe1"}),tg.message&&(0,s.jsx)("span",{className:`text-xs ${"error"===tg.type?"text-red-600":"text-emerald-600"}`,children:tg.message}),(0,s.jsxs)("span",{className:"text-[11px] text-text-muted",children:["Sinh bằng ",(0,s.jsx)("span",{className:"font-mono",children:"scripts/gen-codex-model-catalog.mjs"})," tr\xean m\xe1y đ\xe3 c\xe0i Codex."]})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mb-1 text-xs font-medium text-text-muted",children:"C\xe0i v\xe0 chạy Codex tr\xean Windows PowerShell"}),(0,s.jsx)("pre",{className:"overflow-auto rounded-xl border border-border bg-surface p-3 text-xs",children:nt})]}),(0,s.jsxs)("div",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 p-3 text-xs text-amber-700 dark:text-amber-300",children:["Lưu \xfd: c\xe1c d\xf2ng context window v\xe0 auto-compact đ\xe3 được comment sẵn; chỉ uncomment khi d\xf9ng local model. Profile fast nằm ở file ri\xeang ",(0,s.jsx)("span",{className:"font-mono",children:"fast.config.toml"})," (Codex đời mới kh\xf4ng c\xf2n nhận bảng ",(0,s.jsx)("span",{className:"font-mono",children:"[profiles.*]"})," trong config.toml); n\xf3 chỉ ghi đ\xe8 ",(0,s.jsx)("span",{className:"font-mono",children:"model"}),", c\xf2n provider v\xe0 base URL kế thừa từ config.toml. ",tx?.exists?(0,s.jsxs)(s.Fragment,{children:["Nhớ tải ",(0,s.jsx)("span",{className:"font-mono",children:x})," về đặt cạnh config.toml — thiếu file đ\xf3 Codex sẽ b\xe1o lỗi khi khởi động v\xec config.toml đang trỏ tới n\xf3."]}):"Khi admin tải model_catalog.json l\xean, config.toml ở tr\xean sẽ tự c\xf3 th\xeam d\xf2ng model_catalog_json."," Nếu c\xe0i bằng npm th\xec m\xe1y cần c\xe0i Node.js trước. setx chỉ lưu biến m\xf4i trường cho terminal mở sau. Codex d\xf9ng OpenAI-compatible endpoint của BlueRouter."]}),(0,s.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:[(0,s.jsx)(l.$n,{variant:"ghost",onClick:()=>tm(null),children:"Đ\xf3ng"}),(0,s.jsx)(l.$n,{variant:"outline",onClick:()=>tT(nt,`codex-help-${tc?.id||"current"}`),children:tL===`codex-help-${tc?.id||"current"}`?"Đ\xe3 copy hướng dẫn":"Copy hướng dẫn"}),(0,s.jsx)(l.$n,{onClick:()=>tT(t9,`codex-settings-${tc?.id||"current"}`),children:tL===`codex-settings-${tc?.id||"current"}`?"Đ\xe3 copy settings":"Copy config.toml"})]})]})}),(0,s.jsx)(l.aF,{isOpen:!!tj,onClose:()=>ty(null),title:"Qwen Code Settings",size:"xl",children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("p",{className:"text-sm text-text-muted",children:["Copy JSON dưới đ\xe2y v\xe0o file ",(0,s.jsx)("span",{className:"font-mono",children:"%USERPROFILE%\\.qwen\\settings.json"})," để Qwen Code gọi qua OpenAI-compatible endpoint của BlueRouter. Model ch\xednh d\xf9ng ",(0,s.jsx)("span",{className:"font-mono",children:nn.codingModel}),"; model fast d\xf9ng ",(0,s.jsx)("span",{className:"font-mono",children:nn.fastModel}),"."]}),(0,s.jsxs)("div",{className:"grid gap-3 md:grid-cols-3",children:[(0,s.jsxs)("div",{className:"rounded-xl border border-border bg-surface p-3",children:[(0,s.jsx)("div",{className:"text-xs text-text-muted",children:"API Key"}),(0,s.jsx)("div",{className:"mt-1 text-sm",children:tj?.name||"API Key"})]}),(0,s.jsxs)("div",{className:"rounded-xl border border-border bg-surface p-3",children:[(0,s.jsx)("div",{className:"text-xs text-text-muted",children:"Base URL"}),(0,s.jsx)("div",{className:"mt-1 break-all font-mono text-sm",children:tz})]}),(0,s.jsxs)("div",{className:"rounded-xl border border-border bg-surface p-3",children:[(0,s.jsx)("div",{className:"text-xs text-text-muted",children:"Model"}),(0,s.jsx)("div",{className:"mt-1 break-all font-mono text-sm",children:nn.codingModel})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mb-1 text-xs font-medium text-text-muted",children:"settings.json"}),(0,s.jsx)("pre",{className:"max-h-[420px] overflow-auto rounded-xl border border-border bg-surface p-3 text-xs",children:ns})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mb-1 text-xs font-medium text-text-muted",children:"C\xe0i v\xe0 chạy Qwen Code tr\xean Windows PowerShell"}),(0,s.jsx)("pre",{className:"overflow-auto rounded-xl border border-border bg-surface p-3 text-xs",children:nr})]}),(0,s.jsx)("div",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 p-3 text-xs text-amber-700 dark:text-amber-300",children:"Lưu \xfd: hướng dẫn đ\xe3 tự tạo settings.json hợp lệ v\xe0 set biến m\xf4i trường cho phi\xean PowerShell hiện tại. setx chỉ lưu lại cho terminal mở sau. Qwen Code hỗ trợ OpenAI-compatible provider n\xean d\xf9ng tốt với BlueRouter."}),(0,s.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:[(0,s.jsx)(l.$n,{variant:"ghost",onClick:()=>ty(null),children:"Đ\xf3ng"}),(0,s.jsx)(l.$n,{variant:"outline",onClick:()=>tT(nr,`qwen-code-help-${tj?.id||"current"}`),children:tL===`qwen-code-help-${tj?.id||"current"}`?"Đ\xe3 copy hướng dẫn":"Copy hướng dẫn"}),(0,s.jsx)(l.$n,{onClick:()=>tT(ns,`qwen-code-settings-${tj?.id||"current"}`),children:tL===`qwen-code-settings-${tj?.id||"current"}`?"Đ\xe3 copy settings":"Copy settings.json"})]})]})}),(0,s.jsx)(_,{apiKey:eF,fallbackModels:Z,onClose:()=>eR(null)}),(0,s.jsx)(P,{apiKey:eT,globalEnabled:eq,globalLevel:ez,onClose:()=>e_(null),onSave:nw,saving:eU}),(0,s.jsx)(P,{apiKey:eM,globalEnabled:eq,globalLevel:ez,onClose:()=>eK(null),onSave:()=>{},saving:!1,infoOnly:!0}),(0,s.jsx)(k,{open:!!eN,keyName:eN?.name,models:ew,setModels:eC,activeProviders:eh,modelAliases:eg,onClose:()=>{ek(null),eC([])},onSave:nv,saving:eA,personalOnly:!t_,extraModels:Z}),(0,s.jsx)(N,{isOpen:ec,keyName:"Default cho API key mới",policy:ea,setPolicy:eo,onClose:()=>{em(!1),eo(er||i)},onSave:nf,saving:ei}),(0,s.jsx)(N,{isOpen:!!eP,keyName:eP?.name,policy:e$,setPolicy:eI,onClose:()=>{eO(null),eI(i)},onSave:nN,onClear:nk,saving:eE}),(0,s.jsx)(l.rq,{isOpen:ex,onClose:()=>eu(!1),onSelect:e=>{let t=String(e?.value||e?.name||e||"").trim();t&&et(e=>c([...e,t]))},onDeselect:e=>{let t=String(e?.value||e?.name||e||"").trim();t&&et(e=>c(e).filter(e=>e!==t))},activeProviders:eh,modelAliases:eg,title:"Chọn default models cho API key",addedModelValues:ee,closeOnSelect:!1}),q?(0,s.jsx)(l.uo,{isOpen:!!q,onClose:()=>B(null),onConfirm:q.onConfirm,title:q.title,message:q.message,confirmText:"X\xf3a",cancelText:"Hủy",variant:"danger"}):null]})}},61771:(e,t,n)=>{"use strict";n.d(t,{default:()=>i});var s=n(95155),r=n(12115),l=n(35497),a=n(94027);let o="api-keys-bulk-default-models-result";function i(){let[e,t]=(0,r.useState)(!1),[n,i]=(0,r.useState)(!1),[d,c]=(0,r.useState)(""),[m,x]=(0,r.useState)(""),{isAdmin:u}=(0,a.s)();if((0,r.useEffect)(()=>{let e=window.sessionStorage.getItem(o);e&&(window.sessionStorage.removeItem(o),c(e))},[]),!u)return null;let h=async()=>{t(!1),i(!0),c(""),x("");try{let e=await fetch("/api/keys",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({applyDefaultModelsToExistingKeys:!0})}),t=await e.json().catch(()=>({}));if(!e.ok)throw Error(t.error||"Kh\xf4ng th\xeam được default models v\xe0o API key hiện c\xf3");let n=t.apiKeyDefaultModelsApplied||{},s=Number(n.updated||0),r=Number(n.unchanged||0),l=Number(n.legacyFullAccessSkipped||0),a=`Đ\xe3 bổ sung default models cho ${s} API key. ${r} key đ\xe3 c\xf3 đủ model; ${l} key Legacy full access được giữ nguy\xean.`;window.sessionStorage.setItem(o,a),window.location.reload()}catch(e){x(e?.message||"Kh\xf4ng th\xeam được default models v\xe0o API key hiện c\xf3")}finally{i(!1)}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"mb-4 flex flex-col gap-2 rounded-2xl border border-border bg-surface/50 p-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsxs)("div",{className:"min-w-0 text-sm",children:[(0,s.jsx)("div",{className:"font-medium text-text-main",children:"\xc1p Default models cho API key hiện c\xf3"}),(0,s.jsx)("div",{className:"text-xs text-text-muted",children:"Chỉ th\xeam model c\xf2n thiếu; kh\xf4ng x\xf3a model đ\xe3 g\xe1n v\xe0 kh\xf4ng thu hẹp quyền của key Legacy full access."}),d?(0,s.jsx)("div",{className:"mt-1 text-xs text-emerald-700 dark:text-emerald-300",children:d}):null,m?(0,s.jsx)("div",{className:"mt-1 text-xs text-red-600",children:m}):null]}),(0,s.jsx)(l.$n,{size:"sm",variant:"outline",onClick:()=>t(!0),disabled:n,children:n?"Đang th\xeam...":"Th\xeam Default models v\xe0o tất cả API key"})]}),(0,s.jsx)(l.uo,{isOpen:e,onClose:()=>!n&&t(!1),onConfirm:h,title:"Th\xeam Default models v\xe0o tất cả API key?",message:"Hệ thống sẽ th\xeam c\xe1c Default models đ\xe3 lưu v\xe0o mọi API key c\xf3 danh s\xe1ch model giới hạn. Model đ\xe3 g\xe1n sẵn vẫn được giữ nguy\xean. API key Legacy full access sẽ kh\xf4ng bị thay đổi để tr\xe1nh v\xf4 t\xecnh thu hẹp quyền truy cập.",confirmText:"Th\xeam v\xe0o tất cả",cancelText:"Hủy"})]})}},72143:()=>{},84578:(e,t,n)=>{Promise.resolve().then(n.t.bind(n,72143,23)),Promise.resolve().then(n.bind(n,56484)),Promise.resolve().then(n.bind(n,61771)),Promise.resolve().then(n.bind(n,87572))},87572:(e,t,n)=>{"use strict";n.d(t,{default:()=>I});var s=n(95155),r=n(12115),l=n(46442),a=n(98500),o=n.n(a),i=n(35497),d=n(94027),c=n(11059),m=n(9385);let x="https://models-gateway.example.com";function u(e,t=""){return String(e??"").trim()||t}function h(e){let t=String(e??"").trim().replace(/\/+$/,"");return t?/\/v1$/.test(t)?t:`${t}/v1`:t}function p(e){return String(e??"").replace(/`/g,"``").replace(/"/g,'`"')}function g(e){let t=new Map;for(let n of m.pA){let s=(0,m.cL)(e,n);if(!s)continue;let r=t.get(s);r?(r.roles.push(n),r.contextWindow=Math.max(r.contextWindow,(0,m.u1)(e,n))):t.set(s,{model:s,roles:[n],contextWindow:(0,m.u1)(e,n)})}return[...t.values()]}let b={claude:"Claude Code",opencode:"OpenCode",codex:"Codex",qwen:"Qwen Code"},f=new Set(["claude","codex"]);function j(e){let t=String(e||"");return t?t.length<=12?`${t.slice(0,4)}••••`:`${t.slice(0,8)}••••••••${t.slice(-4)}`:""}function y(e,t){return t?String(e||"").split(t).join(j(t)):e}async function v(e,t){if(!e||!t)return null;let n=new URLSearchParams({page:"1",pageSize:"25",q:t}),s=await fetch(`/api/keys?${n.toString()}`,{cache:"no-store"});return s.ok&&((await s.json().catch(()=>({}))).keys||[]).find(t=>t?.key===e)||null}function N({label:e,model:t,detail:n}){return(0,s.jsxs)("div",{className:"min-w-0 rounded-xl border border-border bg-background px-3 py-2.5",children:[(0,s.jsx)("div",{className:"text-[11px] font-medium uppercase tracking-wide text-text-muted",children:e}),(0,s.jsx)("div",{className:"mt-1 truncate font-mono text-xs font-medium text-text-main",title:t||"—",children:t||"—"}),(0,s.jsx)("div",{className:"mt-1 truncate text-[11px] text-text-muted",title:n,children:n})]})}function k({enabled:e,coder:t,apiKey:n,missingModels:r}){return e?t?n?r.length>0?(0,s.jsxs)("div",{className:"min-h-[44px] rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-700 dark:text-amber-300",children:["API key chưa được cấp quyền cho ",(0,s.jsx)("span",{className:"font-mono",children:r.join(", ")}),". Guide kh\xf4ng tự fallback model kh\xe1c."]}):(0,s.jsxs)("div",{className:"flex min-h-[44px] items-center gap-2 rounded-xl border border-emerald-500/20 bg-emerald-500/5 px-3 py-2 text-xs text-text-muted",children:[(0,s.jsx)("span",{className:"size-1.5 shrink-0 rounded-full bg-emerald-500"}),"Config sẵn s\xe0ng để copy v\xe0 \xe1p dụng."]}):(0,s.jsx)("div",{className:"flex min-h-[44px] items-center rounded-xl border border-red-500/30 bg-red-500/10 px-3 py-2 text-xs text-red-600",children:"Kh\xf4ng đọc được API key từ modal hiện tại."}):(0,s.jsx)("div",{className:"flex min-h-[44px] items-center rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-700 dark:text-amber-300",children:"Chưa cấu h\xecnh Coder model cho profile n\xe0y."}):(0,s.jsx)("div",{className:"flex min-h-[44px] items-center rounded-xl border border-dashed border-border px-3 py-2 text-xs text-text-muted",children:"Profile đang tắt. Admin c\xf3 thể bật trong CLI Model Settings."})}function w({tool:e,profile:t}){if("claude"!==e&&"codex"!==e)return null;let n=(0,m.u1)(t,"coder"),r=(0,m.u1)(t,"fast"),l=(0,m.u1)(t,"thinking"),a=Number(t?.autoCompactPct||75),o=(0,m.Zn)(t),i=new Set([n,r,l]).size>1;return(0,s.jsx)("div",{className:"mt-3 overflow-hidden rounded-xl border-2 border-amber-400/60 bg-amber-500/10 shadow-sm dark:border-amber-400/40",children:(0,s.jsxs)("div",{className:"flex gap-3 p-3 sm:p-4",children:[(0,s.jsx)("span",{className:"material-symbols-outlined mt-0.5 shrink-0 text-[22px] text-amber-600 dark:text-amber-300",children:"warning"}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("div",{className:"text-sm font-semibold text-amber-800 dark:text-amber-200",children:"Quan trọng khi đổi model Local"}),"claude"===e?(0,s.jsxs)("p",{className:"mt-1.5 text-xs leading-5 text-amber-900/90 dark:text-amber-100/90",children:["Config b\xean dưới đang đặt ",(0,s.jsxs)("code",{className:"rounded bg-amber-500/10 px-1 font-mono font-semibold",children:["CLAUDE_CODE_AUTO_COMPACT_WINDOW=",n]})," theo ",(0,s.jsx)("strong",{children:"Coder"}),". Nếu bạn đổi model Local đang sử dụng sang Fast, Thinking hoặc model kh\xe1c c\xf3 Max Context kh\xe1c, ",(0,s.jsx)("strong",{children:"kh\xf4ng chỉ đổi t\xean model"})," — h\xe3y sửa ",(0,s.jsx)("code",{className:"rounded bg-amber-500/10 px-1 font-mono",children:"CLAUDE_CODE_AUTO_COMPACT_WINDOW"})," theo đ\xfang Max Context của model đ\xf3 trước khi chạy. ",(0,s.jsx)("code",{className:"rounded bg-amber-500/10 px-1 font-mono",children:"CLAUDE_AUTOCOMPACT_PCT_OVERRIDE"})," hiện l\xe0 ",(0,s.jsxs)("strong",{children:[a,"%"]}),"."]}):(0,s.jsxs)("p",{className:"mt-1.5 text-xs leading-5 text-amber-900/90 dark:text-amber-100/90",children:["Config b\xean dưới đang t\xednh theo ",(0,s.jsx)("strong",{children:"Coder"}),": ",(0,s.jsxs)("code",{className:"rounded bg-amber-500/10 px-1 font-mono font-semibold",children:["model_context_window=",n]})," v\xe0 ",(0,s.jsxs)("code",{className:"rounded bg-amber-500/10 px-1 font-mono font-semibold",children:["model_auto_compact_token_limit=",o]}),". Nếu bạn đổi model Local đang sử dụng, ",(0,s.jsx)("strong",{children:"kh\xf4ng chỉ đổi t\xean model"})," — h\xe3y cập nhật ",(0,s.jsx)("code",{className:"rounded bg-amber-500/10 px-1 font-mono",children:"model_context_window"})," theo Max Context mới v\xe0 t\xednh lại ",(0,s.jsx)("code",{className:"rounded bg-amber-500/10 px-1 font-mono",children:"model_auto_compact_token_limit"})," theo mức ",(0,s.jsxs)("strong",{children:[a,"%"]}),"."]}),i?(0,s.jsxs)("div",{className:"mt-2 flex flex-wrap gap-x-3 gap-y-1 rounded-lg border border-amber-400/30 bg-background/70 px-2.5 py-2 font-mono text-[11px] text-amber-900 dark:text-amber-100",children:[(0,s.jsxs)("span",{children:["Coder: ",n.toLocaleString()]}),(0,s.jsxs)("span",{children:["Fast: ",r.toLocaleString()]}),(0,s.jsxs)("span",{children:["Thinking: ",l.toLocaleString()]})]}):null]})]})})}function C({activeView:e,setActiveView:t,configMeta:n,config:r,applyCommands:l}){let a="config"===e;return(0,s.jsxs)("div",{className:"overflow-hidden rounded-xl border border-border bg-background",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 border-b border-border bg-surface/60 px-3 py-2.5 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsxs)("div",{className:"inline-flex w-fit rounded-lg border border-border bg-background p-1",children:[(0,s.jsx)("button",{type:"button",onClick:()=>t("config"),className:`rounded-md px-3 py-1.5 text-xs font-medium transition ${a?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text-main"}`,children:n.label}),(0,s.jsx)("button",{type:"button",onClick:()=>t("powershell"),className:`rounded-md px-3 py-1.5 text-xs font-medium transition ${!a?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text-main"}`,children:"PowerShell"})]}),(0,s.jsx)("span",{className:"truncate font-mono text-[11px] text-text-muted",children:a?n.path:"Apply config on Windows"})]}),(0,s.jsx)("pre",{className:"h-[340px] overflow-auto p-4 text-[11px] leading-5 text-text-main custom-scrollbar",children:a?r:l})]})}function A({scope:e,profile:t,tool:n,baseUrl:l,apiKey:a,selectedKey:o,copied:d,copy:c}){let[f,j]=(0,r.useState)("config"),v="local"===e,S=t?.enabled===!0,P=(0,m.cL)(t,"coder"),O=(0,m.cL)(t,"fast",P),$=(0,m.cL)(t,"thinking",P),I=function(e){switch(e){case"claude":return{label:"settings.json",path:"%USERPROFILE%\\.claude\\settings.json",command:"claude"};case"opencode":return{label:"opencode.json",path:"%APPDATA%\\opencode\\opencode.json",command:"opencode"};case"codex":return{label:"config.toml",path:"%USERPROFILE%\\.codex\\config.toml",command:"codex"};case"qwen":return{label:"settings.json",path:"%USERPROFILE%\\.qwen\\settings.json",command:"qwen"};default:return{label:"config",path:"",command:""}}}(n),E=S&&!!P&&!!a,L=E?function({tool:e,baseUrl:t,apiKey:n,profile:s,scope:r}){switch(e){case"claude":return function({baseUrl:e,apiKey:t,profile:n,scope:s}){let r=(0,m.cL)(n,"coder","programmer"),l=(0,m.cL)(n,"fast",r),a=(0,m.cL)(n,"thinking",r),o={ANTHROPIC_BASE_URL:String(u(e,x)??"").trim().replace(/\/+$/,"").replace(/\/v1$/,""),ANTHROPIC_AUTH_TOKEN:u(t,"sk-xxxxx"),ANTHROPIC_MODEL:r,ANTHROPIC_SMALL_FAST_MODEL:l,ANTHROPIC_DEFAULT_OPUS_MODEL:a,ANTHROPIC_DEFAULT_SONNET_MODEL:r,ANTHROPIC_DEFAULT_HAIKU_MODEL:l};return"local"===s&&(o.CLAUDE_CODE_AUTO_COMPACT_WINDOW=String((0,m.u1)(n,"coder")),o.CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=String(n.autoCompactPct||75)),JSON.stringify({env:o,theme:"dark",hasCompletedOnboarding:!0},null,2)}({baseUrl:t,apiKey:n,profile:s,scope:r});case"opencode":return function({baseUrl:e,apiKey:t,profile:n,scope:s}){let r=(0,m.cL)(n,"coder","programmer"),l=(0,m.cL)(n,"fast",r),a=(0,m.cL)(n,"thinking",r),o={};for(let e of g(n)){let t={name:e.model};"local"===s&&(t.limit={context:e.contextWindow,output:Math.min(3e4,Math.max(4096,Math.floor(e.contextWindow/4)))}),o[e.model]=t}let i={explorer:{description:"Fast explorer subagent for codebase exploration",mode:"subagent",model:`bluerouter/${l}`}};a&&a!==r&&(i.thinking={description:"Thinking/reasoning subagent",mode:"subagent",model:`bluerouter/${a}`});let d={$schema:"https://opencode.ai/config.json",provider:{bluerouter:{npm:"@ai-sdk/openai-compatible",name:"BlueRouter",options:{baseURL:h(u(e,x)),apiKey:u(t,"sk-xxxxx")},models:o}},model:`bluerouter/${r}`,small_model:`bluerouter/${l}`,agent:i};return"local"===s&&(d.compaction={auto:!0,prune:!0,reserved:Math.max(4096,(0,m.u1)(n,"coder")-(0,m.Zn)(n))}),JSON.stringify(d,null,2)}({baseUrl:t,apiKey:n,profile:s,scope:r});case"codex":return function({baseUrl:e,profile:t,scope:n}){let s=(0,m.cL)(t,"coder","programmer"),r=(0,m.cL)(t,"fast",s),l=(0,m.cL)(t,"thinking",s),a=[`model = "${s}"`,'model_provider = "bluerouter"'];return"local"===n&&a.push(`model_context_window = ${(0,m.u1)(t,"coder")}`,`model_auto_compact_token_limit = ${(0,m.Zn)(t)}`,'model_auto_compact_token_limit_scope = "total"',"model_catalog_json = 'model_catalog.json'"),a.push("","[model_providers.bluerouter]",'name = "BlueRouter"',`base_url = "${h(u(e,x))}"`,'env_key = "OPENAI_API_KEY"','wire_api = "responses"'),r&&a.push("","[profiles.fast]",`model = "${r}"`,'model_provider = "bluerouter"'),l&&l!==r&&a.push("","[profiles.thinking]",`model = "${l}"`,'model_provider = "bluerouter"'),a.join("\n")}({baseUrl:t,profile:s,scope:r});case"qwen":return function({baseUrl:e,apiKey:t,profile:n,scope:s}){let r=(0,m.cL)(n,"coder","programmer"),l=g(n).map(t=>{let n=new Set(t.roles),r=n.has("fast")&&!n.has("coder")&&!n.has("thinking"),l={timeout:r?6e4:12e4,maxRetries:2,samplingParams:{temperature:.2,...r?{max_tokens:4096}:{}}};return r&&(l.reasoning=!1),"local"===s&&(l.contextWindowSize=t.contextWindow),{id:t.model,name:t.model,envKey:"OPENAI_API_KEY",baseUrl:h(u(e,x)),generationConfig:l}});return JSON.stringify({env:{OPENAI_API_KEY:u(t,"sk-xxxxx")},security:{auth:{selectedType:"openai"}},model:{name:r},modelProviders:{openai:l}},null,2)}({baseUrl:t,apiKey:n,profile:s,scope:r});default:return""}}({tool:n,baseUrl:l,apiKey:a,profile:t,scope:e}):"",T=E?function({tool:e,config:t,apiKey:n,baseUrl:s,profile:r}){let l=(0,m.cL)(r,"coder","programmer"),a=p(n),o=p(h(u(s,x))),i=p(l),d="$utf8NoBom = New-Object System.Text.UTF8Encoding $false";switch(e){case"claude":return["mkdir $env:USERPROFILE\\.claude -Force",d,'[System.IO.File]::WriteAllText("$env:USERPROFILE\\.claude\\settings.json", @\'',t,"'@, $utf8NoBom)\ncd D:\\path\\to\\your-project\nclaude"].join("\n");case"opencode":return["mkdir $env:APPDATA\\opencode -Force",d,'[System.IO.File]::WriteAllText("$env:APPDATA\\opencode\\opencode.json", @\'',t,"'@, $utf8NoBom)\ncd D:\\path\\to\\your-project\nopencode"].join("\n");case"codex":return["mkdir $env:USERPROFILE\\.codex -Force",d,'[System.IO.File]::WriteAllText("$env:USERPROFILE\\.codex\\config.toml", @\'',t,"'@, $utf8NoBom)",`$env:OPENAI_API_KEY = "${a}"`,`setx OPENAI_API_KEY "${a}"`,"cd D:\\path\\to\\your-project\ncodex"].join("\n");case"qwen":return["mkdir $env:USERPROFILE\\.qwen -Force",d,'[System.IO.File]::WriteAllText("$env:USERPROFILE\\.qwen\\settings.json", @\'',t,"'@, $utf8NoBom)",`$env:OPENAI_API_KEY = "${a}"`,`$env:OPENAI_BASE_URL = "${o}"`,`$env:OPENAI_MODEL = "${i}"`,`setx OPENAI_API_KEY "${a}"`,`setx OPENAI_BASE_URL "${o}"`,`setx OPENAI_MODEL "${i}"`,"cd D:\\path\\to\\your-project\nqwen"].join("\n");default:return""}}({tool:n,config:L,apiKey:a,baseUrl:l,profile:t}):"",_=Array.isArray(o?.allowedModels)?o.allowedModels:[],M=_.length>0?(0,m.FY)(t).filter(e=>!_.includes(e)):[],K=`${n}-${e}`,F=v?`${t?.autoCompactPct||75}% \xb7 ${(0,m.Zn)(t).toLocaleString()} tokens`:"Managed by cloud provider";return(0,s.jsxs)("section",{className:"flex min-w-0 flex-col rounded-2xl border border-border bg-surface/40 p-4 shadow-sm sm:p-5",children:[(0,s.jsxs)("div",{className:"flex min-h-[72px] items-start justify-between gap-3",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)("span",{className:"rounded-full border border-border bg-background px-2 py-1 text-[10px] font-semibold uppercase tracking-[0.12em] text-text-muted",children:v?"Local":"Cloud"}),(0,s.jsx)("h3",{className:"truncate text-base font-semibold text-text-main",children:t?.providerName||(v?"Local AI":"Cloud AI")})]}),(0,s.jsx)("p",{className:"mt-1.5 text-xs leading-5 text-text-muted",children:v?"Local model, context v\xe0 auto-compact do admin quản l\xfd.":`Cloud mapping ri\xeang cho ${b[n]}; kh\xf4ng d\xf9ng chung model với CLI kh\xe1c.`})]}),(0,s.jsx)("span",{className:`shrink-0 rounded-full px-2.5 py-1 text-[11px] font-medium ${S?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-300":"bg-background text-text-muted"}`,children:S?"Enabled":"Disabled"})]}),(0,s.jsxs)("div",{className:"mt-4 grid gap-2 sm:grid-cols-3",children:[(0,s.jsx)(N,{label:"Coder",model:P,detail:v&&P?`${(0,m.u1)(t,"coder").toLocaleString()} tokens`:"Primary model"}),(0,s.jsx)(N,{label:"Fast",model:O,detail:v&&O?`${(0,m.u1)(t,"fast").toLocaleString()} tokens`:"Fast profile"}),(0,s.jsx)(N,{label:"Thinking",model:$,detail:v&&$?`${(0,m.u1)(t,"thinking").toLocaleString()} tokens`:"Reasoning profile"})]}),(0,s.jsxs)("div",{className:"mt-2 flex min-h-[40px] items-center justify-between gap-3 rounded-xl border border-border bg-background px-3 py-2 text-xs",children:[(0,s.jsx)("span",{className:"text-text-muted",children:v?"Auto compact":"Context policy"}),(0,s.jsx)("span",{className:"truncate text-right font-medium text-text-main",children:F})]}),(0,s.jsx)("div",{className:"mt-3",children:(0,s.jsx)(k,{enabled:S,coder:P,apiKey:a,missingModels:M})}),v&&E&&"claude"===n?(0,s.jsx)(w,{tool:n,profile:t}):null,E?(0,s.jsxs)("div",{className:"mt-4",children:[(0,s.jsx)(C,{activeView:f,setActiveView:j,configMeta:I,config:y(L,a),applyCommands:y(T,a)}),(0,s.jsxs)("div",{className:"mt-3 flex flex-wrap items-center justify-end gap-2",children:[(0,s.jsx)(i.$n,{variant:"outline",size:"sm",onClick:()=>c(T,`${K}-apply`),children:d===`${K}-apply`?"Đ\xe3 copy PowerShell":"Copy PowerShell"}),(0,s.jsx)(i.$n,{size:"sm",onClick:()=>c(L,`${K}-config`),children:d===`${K}-config`?"Đ\xe3 copy config":`Copy ${I.label}`})]})]}):null]})}function S({tool:e,seed:t}){let[n,l]=(0,r.useState)(()=>(0,m.j5)(m.O0)),[a,x]=(0,r.useState)(null),[u,h]=(0,r.useState)(!0),[p,g]=(0,r.useState)(""),{copied:y,copy:N}=(0,c.C)(),{isAdmin:k,canManageApiKeys:w}=(0,d.s)(),C=String(t?.apiKey||""),P=String(t?.baseUrl||""),O=String(t?.keyName||""),$=b[e]||"CLI",I=(0,r.useMemo)(()=>(function(e){switch(e){case"claude":return"# C\xe1ch 1: PowerShell installer\nirm https://claude.ai/install.ps1 | iex\n\n# C\xe1ch 2: CMD installer\ncurl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd\n\n# C\xe1ch 3: npm (cần c\xe0i Node.js trước)\nnpm install -g @anthropic-ai/claude-code\nclaude --version";case"opencode":return"npm install -g opencode-ai\nopencode --version";case"codex":return'# C\xe0i Codex kh\xf4ng cần Node/npm (cần sh, v\xed dụ Git Bash hoặc WSL)\ncurl -fsSL https://chatgpt.com/codex/install.sh | sh\ncodex --version\n\n# Lưu API key vĩnh viễn cho Windows user hiện tại\n[Environment]::SetEnvironmentVariable("OPENAI_API_KEY","sk-xxx","User")';case"qwen":return"npm install -g @qwen-code/qwen-code\nqwen --version";default:return""}})(e).replaceAll("sk-xxx",C),[e,C]),E=f.has(e),L=(0,m.Ek)(n,e);return(0,r.useEffect)(()=>{let e=!1;return h(!0),g(""),Promise.allSettled([fetch("/api/cli-model-profiles",{cache:"no-store"}).then(async e=>{let t=await e.json().catch(()=>({}));if(!e.ok)throw Error(t.error||"Kh\xf4ng tải được CLI model profiles");return(0,m.j5)(t.profiles||{})}),v(C,O)]).then(([t,n])=>{e||("fulfilled"===t.status?l(t.value):g(t.reason?.message||"Kh\xf4ng tải được CLI model profiles; đang d\xf9ng local defaults."),"fulfilled"===n.status&&x(n.value),h(!1))}),()=>{e=!0}},[C,O,e]),(0,s.jsxs)("div",{className:"space-y-4 pb-1",children:[(0,s.jsx)("div",{className:"rounded-2xl border border-border bg-surface/35 p-4 sm:p-5",children:(0,s.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)("span",{className:"rounded-full border border-primary/20 bg-primary/5 px-2.5 py-1 text-[11px] font-semibold text-primary",children:$}),(0,s.jsx)("span",{className:"text-xs text-text-muted",children:"Configuration guide"})]}),(0,s.jsx)("p",{className:"mt-2 max-w-4xl text-sm leading-6 text-text-muted",children:E?`Chọn Local hoặc ${$} Cloud. Hai profile độc lập nhưng d\xf9ng chung API key v\xe0 gateway.`:`${$} chỉ sử dụng Local Model profile; Cloud Provider kh\xf4ng \xe1p dụng cho tool n\xe0y.`}),(0,s.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2 text-xs text-text-muted",children:[(0,s.jsxs)("span",{className:"rounded-lg border border-border bg-background px-2.5 py-1.5",children:["API key ",(0,s.jsx)("span",{className:"ml-1 font-mono text-text-main",children:j(C)||"kh\xf4ng x\xe1c định"})]}),(0,s.jsxs)("span",{className:"max-w-full rounded-lg border border-border bg-background px-2.5 py-1.5",children:["Base URL ",(0,s.jsx)("span",{className:"ml-1 break-all font-mono text-text-main",children:P||"/v1"})]})]})]}),k||w?(0,s.jsxs)(o(),{href:"/dashboard/cli-tools/model-profiles",className:"inline-flex shrink-0 items-center justify-center gap-1.5 rounded-xl border border-border bg-background px-3 py-2 text-sm font-medium text-text-main transition hover:border-primary/50 hover:text-primary",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"tune"}),"CLI Model Settings"]}):null]})}),u?(0,s.jsx)("div",{className:"rounded-xl border border-dashed border-border p-4 text-center text-sm text-text-muted",children:"Đang tải CLI model settings..."}):null,p?(0,s.jsx)("div",{className:"rounded-xl border border-amber-500/30 bg-amber-500/10 p-3 text-xs text-amber-700 dark:text-amber-300",children:p}):null,E?(0,s.jsxs)("div",{className:"grid items-stretch gap-4 xl:grid-cols-2",children:[(0,s.jsx)(A,{scope:"local",profile:n.local,tool:e,baseUrl:P,apiKey:C,selectedKey:a,copied:y,copy:N}),(0,s.jsx)(A,{scope:"cloud",profile:L,tool:e,baseUrl:P,apiKey:C,selectedKey:a,copied:y,copy:N})]}):(0,s.jsx)("div",{className:"mx-auto max-w-4xl",children:(0,s.jsx)(A,{scope:"local",profile:n.local,tool:e,baseUrl:P,apiKey:C,selectedKey:a,copied:y,copy:N})}),(0,s.jsxs)("div",{className:"rounded-2xl border border-border bg-surface/35 p-4 sm:p-5",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"text-sm font-semibold text-text-main",children:["C\xe0i ",$," tr\xean Windows"]}),(0,s.jsx)("p",{className:"mt-1 text-xs leading-5 text-text-muted",children:E?"Lệnh c\xe0i d\xf9ng chung cho Local v\xe0 Cloud. Sau khi c\xe0i, chọn tab PowerShell trong profile muốn \xe1p dụng.":"Sau khi c\xe0i, chọn tab PowerShell trong Local profile ph\xeda tr\xean."})]}),(0,s.jsx)(i.$n,{variant:"outline",size:"sm",onClick:()=>N(I,`${e}-install`),children:y===`${e}-install`?"Đ\xe3 copy lệnh c\xe0i":"Copy lệnh c\xe0i"})]}),(0,s.jsx)("pre",{className:"mt-3 max-h-[150px] overflow-auto rounded-xl border border-border bg-background p-3 text-[11px] leading-5 text-text-main custom-scrollbar",children:I})]}),(0,s.jsx)("div",{className:"rounded-xl border border-blue-500/20 bg-blue-500/5 px-3 py-2.5 text-xs leading-5 text-text-muted",children:"CLI Model Settings chỉ ảnh hưởng config/hướng dẫn sinh trong Dashboard. Kh\xf4ng chỉnh request pipeline, provider routing, combo, load balancing hoặc model routing runtime."})]})}let P="/api/cli-model-profiles/model-catalog";function O(){let[e,t]=(0,r.useState)(null);return(0,r.useEffect)(()=>{let e=!1;return fetch(`${P}?meta=1`,{cache:"no-store"}).then(async n=>{let s=await n.json().catch(()=>({}));!e&&n.ok&&t(s.catalog||null)}).catch(()=>{}),()=>{e=!0}},[]),(0,s.jsxs)("div",{className:"rounded-xl border border-border bg-background p-3",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)("span",{className:"rounded-full border border-border bg-surface px-2 py-1 text-[10px] font-semibold uppercase tracking-wide text-text-muted",children:"Local only"}),(0,s.jsx)("div",{className:"text-sm font-semibold text-text-main",children:"Codex model_catalog.json"})]}),(0,s.jsxs)("p",{className:"mt-1.5 text-xs leading-5 text-text-muted",children:["Local config d\xf9ng ",(0,s.jsx)("code",{className:"rounded bg-surface px-1 font-mono",children:"model_catalog_json = 'model_catalog.json'"}),". Download file v\xe0 đặt cạnh ",(0,s.jsx)("code",{className:"rounded bg-surface px-1 font-mono",children:"%USERPROFILE%\\.codex\\config.toml"}),", sau đ\xf3 restart Codex. Cloud Codex kh\xf4ng d\xf9ng file n\xe0y."]}),e?.available?(0,s.jsxs)("a",{href:P,download:"model_catalog.json",className:"mt-2 inline-flex items-center gap-1.5 rounded-lg border border-border px-2.5 py-1.5 text-xs font-medium text-primary transition hover:border-primary/50",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"download"}),"Download model_catalog.json"]}):(0,s.jsx)("div",{className:"mt-2 text-xs text-amber-700 dark:text-amber-300",children:"Admin chưa upload model_catalog.json."})]})}let $={"Claude Code Settings":"claude","OpenCode Settings":"opencode","Codex Settings":"codex","Qwen Code Settings":"qwen"};function I({children:e}){let t=(0,r.useCallback)(({title:e,children:t})=>{let n=$[String(e||"")];if(!n)return null;let l=function(e){let t=[];!function e(t,n){if(null!=t&&"boolean"!=typeof t){if("string"==typeof t||"number"==typeof t)return void n.push(String(t));if(Array.isArray(t)){for(let s of t)e(s,n);return}(0,r.isValidElement)(t)&&e(t.props?.children,n)}}(e,t);let n=t.join("\n"),s=n.match(/\bsk-[A-Za-z0-9._~-]{8,}\b/)?.[0]||"",l="";for(let e=0;e<t.length-1;e+=1){if("API Key"!==String(t[e]).trim())continue;let n=String(t[e+1]||"").trim();if(n&&!n.startsWith("sk-")){l=n;break}}let a=(n.match(/https?:\/\/[^\s\"'<>]+/g)||[]).map(e=>e.replace(/[),.;]+$/,""));return{apiKey:s,baseUrl:a.find(e=>/\/v1\/?$/i.test(e))||a.find(e=>/\/v1(?:\/|$)/i.test(e))||"",keyName:l}}(t);return{size:"full",className:"!max-w-6xl",footer:null,children:(0,s.jsxs)("div",{className:"space-y-4",children:["codex"===n?(0,s.jsx)(O,{}):null,(0,s.jsx)(S,{tool:n,seed:l},`${n}:${l.apiKey}`)]})}},[]);return(0,s.jsx)(l.j,{resolver:t,children:e})}}},e=>{e.O(0,[646,6373,3862,8500,506,9959,7050,5564,5263,7033,5497,8441,3794,7358],()=>e(e.s=84578)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3471],{6191:(e,a,t)=>{"use strict";t.r(a),t.d(a,{default:()=>j});var s=t(95155),r=t(12115),l=t(44656),o=t(35497);let d={enabled:!1,fileLoggingEnabled:!1,type:"mysql",host:"",port:"",database:"",username:"",password:"",ssl:!1,createDatabase:!1,logClientRequest:!0,logSourceRequest:!0,logTargetRequest:!0,logProviderResponse:!1,logErrors:!0,retentionDays:30,payloadRotationEnabled:!1,payloadRetentionDays:60,payloadRotationScheduleTime:"21:00",payloadRotationMaxRuntimeMinutes:60,payloadRotationIntervalHours:24,payloadRotationBatchSize:500,payloadRotationMaxBatches:20},n=[{value:60,label:"1 hour"},{value:120,label:"2 hours"},{value:180,label:"3 hours"},{value:240,label:"4 hours"},{value:360,label:"6 hours"},{value:480,label:"8 hours"},{value:720,label:"12 hours"},{value:0,label:"Until finished"}];function i({label:e,value:a,onChange:t,type:r="text",placeholder:l="",disabled:o=!1,min:d,max:n,step:c}){return(0,s.jsxs)("label",{className:"flex flex-col gap-1 text-xs",children:[(0,s.jsx)("span",{className:"text-text-muted",children:e}),(0,s.jsx)("input",{type:r,value:a||"",placeholder:l,disabled:o,min:d,max:n,step:c,onChange:e=>t(e.target.value),className:"w-full rounded border border-border bg-surface px-2 py-1.5 text-xs text-text-main focus:outline-none focus:ring-1 focus:ring-primary/50 disabled:opacity-50"})]})}function c({label:e,checked:a,onChange:t,disabled:r=!1}){return(0,s.jsxs)("label",{className:"flex items-center gap-2 text-xs text-text-main",children:[(0,s.jsx)("input",{type:"checkbox",checked:!!a,disabled:r,onChange:e=>t(e.target.checked)}),e]})}function p(){let[e,a]=(0,r.useState)(d),[t,l]=(0,r.useState)(!1),[p,u]=(0,r.useState)(null),[m,x]=(0,r.useState)(null),[h,b]=(0,r.useState)(null),g=e=>a(a=>({...a,...e})),y=async()=>{l(!0),x(null);try{let e=await fetch("/api/settings/prompt-log-db"),t=await e.json();if(!e.ok)throw Error(t.error||"Failed to load config");a({...d,...t.config||{}})}catch(e){x(e.message||"Failed to load config")}finally{l(!1)}};(0,r.useEffect)(()=>{y()},[]);let f=async()=>{l(!0),x(null),u(null);try{let t=await fetch("/api/settings/prompt-log-db",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({config:e})}),s=await t.json();if(!t.ok)throw Error(s.error||"Failed to save config");a({...d,...s.config||{}}),u("Saved")}catch(e){x(e.message||"Failed to save config")}finally{l(!1)}},v=async(a,t={})=>{if(!t.confirm||window.confirm("Delete all prompt_logs rows and their payloads older than the retention cutoff? Both the rows in prompt_logs (previews, model/provider/token metadata) and the referenced payloads will be removed. This cannot be undone.")){l(!0),x(null),u(null),a.includes("payload-rotation")&&b(null);try{let s=await fetch("/api/settings/prompt-log-db",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:a,config:e,confirm:!0===t.confirm})}),r=await s.text(),l={};try{l=r?JSON.parse(r):{}}catch{let e=r.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim().slice(0,200),a=504===s.status?"Manual rotation exceeded the request timeout. Use automatic rotation for long-running cleanup.":`HTTP ${s.status}: ${e||s.statusText||"non-JSON response"}`;throw Error(a)}if(!s.ok)throw Error(l.error||`HTTP ${s.status}`);a.includes("payload-rotation")&&b(l),u(l.message||l.init?.message||"OK")}catch(e){x(e.message||"Action failed")}finally{l(!1)}}},j="postgres"===e.type||"mysql"===e.type;return(0,s.jsx)(o.Zp,{title:"Request Logging",subtitle:"Choose which request stages are logged, and where the prompt log database lives",icon:"receipt_long",children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:(0,s.jsxs)(o.Ex,{variant:e.enabled?"success":"default",children:["Prompt logging: ",e.enabled?"Enabled":"Disabled"]})}),(0,s.jsx)("div",{className:"rounded-lg border border-yellow-500/30 bg-yellow-500/10 p-3 text-xs text-yellow-700 dark:text-yellow-300",children:'Prompt logs may contain source code, selected code, internal URLs, user prompts, and provider responses. Checked stages store the full raw request/response body; prompt/response text columns keep only short previews. Per-combo "hide content" still redacts the body.'}),(0,s.jsx)("div",{className:"grid gap-3 md:grid-cols-2",children:(0,s.jsxs)("label",{className:"flex flex-col gap-1 text-xs",children:[(0,s.jsx)("span",{className:"text-text-muted",children:"Database type"}),(0,s.jsxs)("select",{value:e.type,disabled:t,onChange:a=>{let t=a.target.value;g({type:t,port:"postgres"===t?e.port||"5432":"mysql"===t?e.port||"3306":e.port})},className:"w-full rounded border border-border bg-surface px-2 py-1.5 text-xs text-text-main focus:outline-none focus:ring-1 focus:ring-primary/50",children:[(0,s.jsx)("option",{value:"mysql",children:"MySQL / MariaDB"}),(0,s.jsx)("option",{value:"postgres",children:"PostgreSQL"})]})]})}),j&&(0,s.jsxs)("div",{className:"grid gap-3 md:grid-cols-2",children:[(0,s.jsx)(i,{label:"Host",value:e.host,placeholder:"127.0.0.1",onChange:e=>g({host:e}),disabled:t}),(0,s.jsx)(i,{label:"Port",value:e.port,placeholder:"postgres"===e.type?"5432":"3306",onChange:e=>g({port:e}),disabled:t}),(0,s.jsx)(i,{label:"Database",value:e.database,placeholder:"bluerouter_logs",onChange:e=>g({database:e}),disabled:t}),(0,s.jsx)(i,{label:"Username",value:e.username,placeholder:"bluerouter",onChange:e=>g({username:e}),disabled:t}),(0,s.jsx)(i,{label:"Password",type:"password",value:e.password,placeholder:"Leave as ******** to keep existing password",onChange:e=>g({password:e}),disabled:t}),(0,s.jsxs)("div",{className:"flex flex-col justify-end gap-2",children:[(0,s.jsx)(c,{label:"Use SSL",checked:e.ssl,onChange:e=>g({ssl:e}),disabled:t}),(0,s.jsx)(c,{label:"Create database if missing",checked:e.createDatabase,onChange:e=>g({createDatabase:e}),disabled:t})]})]}),(0,s.jsxs)("div",{className:"grid gap-2 rounded-lg border border-border bg-surface/40 p-3 md:grid-cols-2",children:[(0,s.jsx)(c,{label:"Enable prompt logging",checked:e.enabled,onChange:e=>g({enabled:e}),disabled:t}),(0,s.jsx)(c,{label:"Log client request",checked:e.logClientRequest,onChange:e=>g({logClientRequest:e}),disabled:t}),(0,s.jsx)(c,{label:"Log normalized/source request",checked:e.logSourceRequest,onChange:e=>g({logSourceRequest:e}),disabled:t}),(0,s.jsx)(c,{label:"Log target/provider request",checked:e.logTargetRequest,onChange:e=>g({logTargetRequest:e}),disabled:t}),(0,s.jsx)(c,{label:"Log provider response",checked:e.logProviderResponse,onChange:e=>g({logProviderResponse:e}),disabled:t}),(0,s.jsx)(c,{label:"Log errors",checked:e.logErrors,onChange:e=>g({logErrors:e}),disabled:t})]}),(0,s.jsxs)("div",{className:"rounded-lg border border-border bg-background p-3 text-xs text-text-muted",children:["Full request/response bodies are stored as gzip files under ",(0,s.jsx)("code",{children:"DATA_DIR/prompt-log-payloads/"}),", addressed by content hash; the database keeps only that hash, the size and the short previews. The client, source and target stages of one call share a single file, so enabling more stages costs little extra disk."]}),(0,s.jsxs)("div",{className:"space-y-3 rounded-xl border border-border bg-surface/40 p-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm font-semibold text-text-main",children:"Prompt log rotation"}),(0,s.jsxs)("div",{className:"mt-1 text-xs text-text-muted",children:["Deletes ",(0,s.jsx)("code",{children:"prompt_logs"})," rows AND their referenced payloads older than the retention cutoff. After a full run, only logs from the last N days remain — analytics/metadata for older rows are removed as well."]})]}),(0,s.jsx)(c,{label:"Enable automatic rotation",checked:e.payloadRotationEnabled,onChange:e=>g({payloadRotationEnabled:e}),disabled:t}),(0,s.jsxs)("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-4",children:[(0,s.jsx)(i,{label:"Keep logs for (days)",type:"number",min:1,max:3650,step:1,value:String(e.payloadRetentionDays||60),onChange:e=>g({payloadRetentionDays:Number(e)||60}),disabled:t}),(0,s.jsx)(i,{label:"Daily start time (Vietnam, UTC+7)",type:"time",step:60,value:String(e.payloadRotationScheduleTime||"21:00"),onChange:e=>g({payloadRotationScheduleTime:e||"21:00"}),disabled:t}),(0,s.jsxs)("label",{className:"flex flex-col gap-1 text-xs",children:[(0,s.jsx)("span",{className:"text-text-muted",children:"Maximum automatic run time"}),(0,s.jsx)("select",{value:String(Number(e.payloadRotationMaxRuntimeMinutes??60)),disabled:t,onChange:e=>g({payloadRotationMaxRuntimeMinutes:Number(e.target.value)}),className:"w-full rounded border border-border bg-surface px-2 py-1.5 text-xs text-text-main focus:outline-none focus:ring-1 focus:ring-primary/50 disabled:opacity-50",children:n.map(e=>(0,s.jsx)("option",{value:String(e.value),children:e.label},e.value))})]}),(0,s.jsx)(i,{label:"Prompt-log rows per transaction",type:"number",min:50,max:5e3,step:50,value:String(e.payloadRotationBatchSize||500),onChange:e=>g({payloadRotationBatchSize:Number(e)||500}),disabled:t})]}),(0,s.jsxs)("div",{className:"rounded-lg border border-blue-500/30 bg-blue-500/10 p-3 text-xs text-blue-700 dark:text-blue-300",children:["Automatic rotation runs once per day at the selected Vietnam time. It deletes expired ",(0,s.jsx)("code",{children:"prompt_logs"})," in small transactions and checks the run-time budget between cleanup passes. If the budget is reached, remaining rows continue at the next daily run. Choose ",(0,s.jsx)("strong",{children:"Until finished"})," to keep running until no expired rows remain. On MySQL, orphan ",(0,s.jsx)("code",{children:"prompt_log_payloads"})," rows (and their payload files on disk) are reaped as part of the cleanup."]}),(0,s.jsxs)("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 text-xs text-amber-700 dark:text-amber-300",children:["Deletion is permanent: previews, model/provider/token metadata, and analytics for older rows go away too. The full request/response bodies live as gzip files on disk (not in ",(0,s.jsx)("code",{children:"payload_json"}),"), so reaping them frees disk space immediately. The ",(0,s.jsx)("code",{children:"prompt_logs"}),"/",(0,s.jsx)("code",{children:"prompt_log_payloads"})," tables themselves still keep their allocated space inside InnoDB — ",(0,s.jsx)("code",{children:"OPTIMIZE TABLE"})," is needed to shrink the .ibd files (only during a maintenance window, with enough free disk)."]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)(o.$n,{size:"sm",variant:"secondary",onClick:()=>v("preview-payload-rotation"),loading:t,children:"Preview expired logs"}),(0,s.jsx)(o.$n,{size:"sm",variant:"danger",onClick:()=>v("run-payload-rotation",{confirm:!0}),loading:t,children:"Delete expired logs now"})]}),h&&(0,s.jsxs)("div",{className:"grid gap-2 rounded-lg border border-border bg-background p-3 text-xs md:grid-cols-2 lg:grid-cols-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"text-text-muted",children:"Cutoff:"})," ",(0,s.jsx)("span",{className:"text-text-main",children:h.cutoff?new Date(h.cutoff).toLocaleString():"-"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"text-text-muted",children:void 0===h.promptLogRowsUpdated?"Prompt-log rows past retention:":"Prompt-log rows deleted:"})," ",(0,s.jsx)("span",{className:"text-text-main",children:Number(h.promptLogRowsUpdated??h.promptLogRows??0).toLocaleString()})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"text-text-muted",children:void 0===h.payloadRowsDeleted?"Payload rows to delete:":"Payload rows deleted:"})," ",(0,s.jsx)("span",{className:"text-text-main",children:Number(h.payloadRowsDeleted??h.payloadRowsPastRetention??0).toLocaleString()})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"text-text-muted",children:void 0===h.payloadBytesDeleted?"Estimated payload size:":"Payload size deleted:"})," ",(0,s.jsx)("span",{className:"text-text-main",children:function(e){let a=Number(e||0);if(!Number.isFinite(a)||a<=0)return"0 B";let t=["B","KB","MB","GB","TB"],s=Math.min(t.length-1,Math.floor(Math.log(a)/Math.log(1024))),r=a/1024**s;return`${r.toFixed(r>=10||0===s?1:2)} ${t[s]}`}(h.payloadBytesDeleted??h.payloadBytesPastRetention??h.referencedPayloadBytes)})]}),h.hasMore?(0,s.jsx)("div",{className:"md:col-span-2 lg:col-span-4 text-amber-600",children:"More expired rows remain. Automatic rotation will continue them at the next scheduled run."}):null]}),(0,s.jsx)("div",{className:"text-[11px] text-text-muted",children:"Save to apply the automatic schedule immediately. Preview uses the values currently shown. Manual deletion is a bounded maintenance pass; use automatic rotation for multi-hour cleanup."})]}),j&&(0,s.jsxs)("div",{className:"rounded-lg border border-blue-500/30 bg-blue-500/10 p-3 text-xs text-blue-700 dark:text-blue-300",children:["Prompt logs now support MySQL/MariaDB and PostgreSQL only. MySQL/MariaDB requires ",(0,s.jsx)("code",{children:"mysql2"}),"; PostgreSQL requires ",(0,s.jsx)("code",{children:"pg"}),"."]}),p&&(0,s.jsx)("div",{className:"rounded-lg border border-green-500/30 bg-green-500/10 p-2 text-xs text-green-600",children:p}),m&&(0,s.jsx)("div",{className:"rounded-lg border border-red-500/30 bg-red-500/10 p-2 text-xs text-red-500",children:m}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)(o.$n,{size:"sm",variant:"secondary",onClick:y,loading:t,children:"Reload"}),(0,s.jsx)(o.$n,{size:"sm",variant:"secondary",onClick:()=>v("test"),loading:t,children:"Test connection"}),(0,s.jsx)(o.$n,{size:"sm",variant:"secondary",onClick:()=>v("init"),loading:t,children:"Initialize schema"}),(0,s.jsx)(o.$n,{size:"sm",onClick:f,loading:t,children:"Save"}),(0,s.jsx)(o.$n,{size:"sm",variant:"success",onClick:()=>v("save-and-init"),loading:t,children:"Save & initialize"})]})]})})}let u="(|(sAMAccountName={{username}})(userPrincipalName={{username}})(mail={{username}}))",m="image/svg+xml,image/png,image/webp,image/jpeg,image/gif",x=`${m},image/x-icon,image/vnd.microsoft.icon,.ico`;function h({status:e}){if(!e?.message)return null;let a="error"===e.type?"text-red-600 bg-red-50 border-red-200":"text-green-700 bg-green-50 border-green-200";return(0,s.jsx)("div",{className:`mt-3 rounded-xl border px-4 py-3 text-sm ${a}`,children:e.message})}function b({icon:e,title:a,desc:t,children:r}){return(0,s.jsxs)("section",{className:"rounded-2xl border border-border bg-surface p-6 shadow-sm",children:[(0,s.jsxs)("div",{className:"mb-5 flex items-start gap-3",children:[e&&(0,s.jsx)("span",{className:"material-symbols-outlined text-primary",children:e}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-xl font-bold text-text-main",children:a}),t&&(0,s.jsx)("p",{className:"mt-1 text-sm text-text-muted",children:t})]})]}),r]})}function g({label:e,hint:a,children:t}){return(0,s.jsxs)("label",{className:"block",children:[(0,s.jsx)("span",{className:"mb-1 block text-sm font-semibold text-text-main",children:e}),t,a&&(0,s.jsx)("span",{className:"mt-1 block text-xs text-text-muted",children:a})]})}function y(e){return(0,s.jsx)("input",{...e,className:`w-full rounded-xl border border-border bg-background px-3 py-2 text-sm outline-none focus:border-primary ${e.className||""}`})}function f(e){return(0,s.jsx)("textarea",{...e,className:`w-full rounded-xl border border-border bg-background px-3 py-2 text-sm outline-none focus:border-primary ${e.className||""}`})}function v({title:e,desc:a,checked:t,onChange:r,disabled:l}){return(0,s.jsxs)("div",{className:"flex items-start justify-between gap-4 rounded-xl border border-border bg-background px-4 py-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm font-semibold text-text-main",children:e}),a&&(0,s.jsx)("div",{className:"mt-1 text-xs text-text-muted",children:a})]}),(0,s.jsx)("button",{type:"button",disabled:l,onClick:()=>r(!t),className:`relative mt-0.5 h-6 w-11 rounded-full transition disabled:opacity-50 ${t?"bg-primary":"bg-border"}`,children:(0,s.jsx)("span",{className:`absolute top-0.5 h-5 w-5 rounded-full bg-white transition ${t?"left-5":"left-0.5"}`})})]})}function j(){let[e,a]=(0,r.useState)({}),[t,o]=(0,r.useState)(!0),[d,n]=(0,r.useState)({current:"",new:"",confirm:""}),[i,c]=(0,r.useState)({type:"",message:""}),[j,w]=(0,r.useState)(!1),[N,C]=(0,r.useState)(!1),[D,A]=(0,r.useState)({type:"",message:""}),[S,k]=(0,r.useState)(""),[U,L]=(0,r.useState)(""),P=(0,r.useRef)(null),[R,M]=(0,r.useState)("admin"),[B,E]=(0,r.useState)({type:"",message:""}),[G,I]=(0,r.useState)({ldapEnabled:!1,ldapUrl:"",ldapBindDn:"",ldapBindPassword:"",ldapUserBaseDn:"",ldapUserSearchFilter:u,ldapUserNameAttribute:"sAMAccountName",ldapUserDisplayAttribute:"displayName",ldapUserEmailAttribute:"mail",ldapLoginAllowedGroupDn:"",ldapAdminGroupDn:"",ldapMonitorAdminGroupDn:"",ldapAiGatewaysMonitorsGroupDn:"",ldapNestedGroups:!0,ldapAllowedUsers:[],ldapTlsRejectUnauthorized:!0,ldapConnectTimeoutMs:8e3}),[T,O]=(0,r.useState)({type:"",message:""}),[F,$]=(0,r.useState)(!1),[q,_]=(0,r.useState)(!1),[z,J]=(0,r.useState)(""),[V,H]=(0,r.useState)([]),[K,Q]=(0,r.useState)(!1),[W,Z]=(0,r.useState)({authMode:"password",oidcIssuerUrl:"",oidcClientId:"",oidcScopes:"openid profile email",oidcLoginLabel:"Sign in with OIDC"}),[X,Y]=(0,r.useState)(""),[ee,ea]=(0,r.useState)({type:"",message:""}),[et,es]=(0,r.useState)(!1),[er,el]=(0,r.useState)(!1),[eo,ed]=(0,r.useState)({type:"",message:""}),en=(0,l.useBranding)(),[ei,ec]=(0,r.useState)(""),[ep,eu]=(0,r.useState)(""),[em,ex]=(0,r.useState)(""),[eh,eb]=(0,r.useState)({type:"",message:""}),[eg,ey]=(0,r.useState)(!1),[ef,ev]=(0,r.useState)(!1),[ej,ew]=(0,r.useState)(!1),[eN,eC]=(0,r.useState)(!1),eD=(0,r.useRef)(null),eA=(0,r.useRef)(null),eS=async()=>{o(!0);try{let e=await fetch("/api/settings",{cache:"no-store"}),t=await e.json();a(t),M(t.localLoginUsername||"admin"),I({ldapEnabled:!0===t.ldapEnabled,ldapUrl:t.ldapUrl||"",ldapBindDn:t.ldapBindDn||"",ldapBindPassword:"",ldapUserBaseDn:t.ldapUserBaseDn||t.ldapBaseDn||"",ldapUserSearchFilter:t.ldapUserSearchFilter||u,ldapUserNameAttribute:t.ldapUserNameAttribute||"sAMAccountName",ldapUserDisplayAttribute:t.ldapUserDisplayAttribute||"displayName",ldapUserEmailAttribute:t.ldapUserEmailAttribute||"mail",ldapLoginAllowedGroupDn:t.ldapLoginAllowedGroupDn||"",ldapAdminGroupDn:t.ldapAdminGroupDn||"",ldapMonitorAdminGroupDn:t.ldapMonitorAdminGroupDn||"",ldapAiGatewaysMonitorsGroupDn:t.ldapAiGatewaysMonitorsGroupDn||"",ldapNestedGroups:!1!==t.ldapNestedGroups,ldapAllowedUsers:Array.isArray(t.ldapAllowedUsers)?t.ldapAllowedUsers:[],ldapTlsRejectUnauthorized:!1!==t.ldapTlsRejectUnauthorized,ldapConnectTimeoutMs:t.ldapConnectTimeoutMs||8e3}),Z({authMode:t.authMode||"password",oidcIssuerUrl:t.oidcIssuerUrl||"",oidcClientId:t.oidcClientId||"",oidcScopes:t.oidcScopes||"openid profile email",oidcLoginLabel:t.oidcLoginLabel||"Sign in with OIDC"}),ec(t.siteTitle||""),eu(t.siteShortName||""),ex(t.siteDescription||""),("oidc"===t.authMode||"both"===t.authMode)&&el(!0)}catch(e){console.log("Failed to fetch settings:",e)}finally{o(!1)}};(0,r.useEffect)(()=>{eS()},[]);let ek=async e=>{let t=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json().catch(()=>({}));if(!t.ok)throw Error(s.error||"Failed to save settings");return a(e=>({...e,...s})),s},eU=async t=>{ed({type:"",message:""});let s=!1!==e.sidebarAdvancedToolsVisible;a(e=>({...e,sidebarAdvancedToolsVisible:t}));try{let e=await ek({sidebarAdvancedToolsVisible:t}),s=!1!==e.sidebarAdvancedToolsVisible;a(e=>({...e,sidebarAdvancedToolsVisible:s})),window.dispatchEvent(new CustomEvent("bluerouter:sidebar-advanced-tools",{detail:{visible:s}})),ed({type:"success",message:s?"Advanced tools are visible in the sidebar.":"Advanced tools are hidden from the sidebar."})}catch(e){a(e=>({...e,sidebarAdvancedToolsVisible:s})),window.dispatchEvent(new CustomEvent("bluerouter:sidebar-advanced-tools",{detail:{visible:s}})),ed({type:"error",message:e.message||"Failed to save sidebar setting."})}},eL=async e=>{e.preventDefault(),E({type:"",message:""});try{let e=await ek({localLoginUsername:R});M(e.localLoginUsername||R||"admin"),E({type:"success",message:"Local account name saved."})}catch(e){E({type:"error",message:e.message})}},eP=async e=>{if(e.preventDefault(),d.new!==d.confirm)return void c({type:"error",message:"Passwords do not match"});w(!0),c({type:"",message:""});try{await ek({currentPassword:d.current,newPassword:d.new}),c({type:"success",message:"Password updated successfully"}),n({current:"",new:"",confirm:""})}catch(e){c({type:"error",message:e.message||"Failed to update password"})}finally{w(!1)}},eR=async()=>{C(!0),A({type:"",message:""});try{if(S&&S!==U)throw Error("Backup password confirmation does not match.");if(S&&new TextEncoder().encode(S).length<8)throw Error("Backup password must be at least 8 characters.");let e=await fetch("/api/settings/database/export",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:S})});if(!e.ok){let a=await e.json().catch(()=>({}));throw Error(a.error||"Failed to export full-node backup")}let a=await e.json(),t=a?.backup?.encrypted===!0,s=JSON.stringify(a,null,2*!t),r=new Blob([s],{type:"application/json"}),l=URL.createObjectURL(r),o=document.createElement("a"),d=new Date().toISOString().replace(/[.:]/g,"-");o.href=l,o.download=t?`bluerouter-full-backup-${d}.brbackup.json`:`bluerouter-full-backup-${d}.json`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(l),A({type:"success",message:t?"Encrypted full-node backup downloaded.":"Plaintext full-node backup downloaded."})}catch(e){A({type:"error",message:e.message||"Failed to export full-node backup."})}finally{C(!1)}},eM=async e=>{let a=e.target.files?.[0];if(a){C(!0),A({type:"",message:""});try{let e=await a.text(),t=JSON.parse(e),s=t?.backup?.encrypted===!0;if(s&&!S)throw Error("Enter the backup password before importing this encrypted backup.");let r=await fetch("/api/settings/database",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({payload:t,password:s?S:""})}),l=await r.json().catch(()=>({}));if(!r.ok)throw Error(l.error||"Failed to import backup");await eS();let o=l.resourceMonitorImported?`Restored ${l.resourceMonitorServerCount||0} Resource Monitor server(s) and ${l.resourceMonitorHistoryCount||0} history sample(s).`:"Legacy backup: current Resource Monitor data was kept.",d=l.brandingImported?`Restored ${l.brandingAssetCount||0} branding asset(s).`:"Current logo and favicon were kept.",n=l.auditProxyImported?`Audit Proxy restored; listener is ${l.listenerRunning?"running":"stopped"}.`:"legacy-database"===l.backupKind?`Legacy Audit Proxy policy: ${l.auditProxyReason||"not present"}.`:"Audit Proxy data was not restored.",i=l.rootCAImported?"Root CA certificate/private key restored.":l.rootCAPreserved?"Current Root CA was preserved.":"";A({type:"success",message:`Backup imported successfully. ${o} ${d} ${n} ${i}`})}catch(e){A({type:"error",message:e.message||"Invalid backup file."})}finally{P.current&&(P.current.value=""),C(!1)}}},eB=(e,a)=>I(t=>({...t,[e]:a})),eE=async e=>{e?.preventDefault?.(),$(!0),O({type:"",message:""});try{let e={...G,ldapBaseDn:G.ldapUserBaseDn,ldapAllowedUsers:G.ldapAllowedUsers};e.ldapBindPassword||delete e.ldapBindPassword;let a=await ek(e);I(e=>({...e,ldapBindPassword:"",ldapEnabled:!0===a.ldapEnabled,ldapUserBaseDn:a.ldapUserBaseDn||a.ldapBaseDn||e.ldapUserBaseDn,ldapLoginAllowedGroupDn:a.ldapLoginAllowedGroupDn||"",ldapAdminGroupDn:a.ldapAdminGroupDn||"",ldapMonitorAdminGroupDn:a.ldapMonitorAdminGroupDn||"",ldapAiGatewaysMonitorsGroupDn:a.ldapAiGatewaysMonitorsGroupDn||"",ldapNestedGroups:!1!==a.ldapNestedGroups,ldapAllowedUsers:Array.isArray(a.ldapAllowedUsers)?a.ldapAllowedUsers:e.ldapAllowedUsers})),O({type:"success",message:"LDAP settings saved."})}catch(e){O({type:"error",message:e.message||"Failed to save LDAP settings"})}finally{$(!1)}},eG=async()=>{_(!0),O({type:"",message:""});try{await eE();let e=await fetch("/api/auth/ldap/test",{method:"POST"}),a=await e.json().catch(()=>({}));e.ok&&a.ok?O({type:"success",message:a.message||"LDAP connection OK."}):O({type:"error",message:a.error||"LDAP test failed."})}catch(e){O({type:"error",message:e.message||"LDAP test failed."})}finally{_(!1)}},eI=async()=>{Q(!0),O({type:"",message:""});try{await eE();let e=await fetch(`/api/auth/ldap/users?q=${encodeURIComponent(z)}`,{cache:"no-store"}),a=await e.json().catch(()=>({}));e.ok?(H(a.users||[]),O({type:"success",message:`Loaded ${(a.users||[]).length} LDAP user(s).`})):O({type:"error",message:a.error||"Failed to load LDAP users."})}catch(e){O({type:"error",message:e.message||"Failed to load LDAP users."})}finally{Q(!1)}},eT=e=>{let a=String(e||"").trim();a&&I(e=>{let t=new Set(e.ldapAllowedUsers||[]);return t.has(a)?t.delete(a):t.add(a),{...e,ldapAllowedUsers:[...t]}})},eO=async(a=W.authMode||"password")=>{let t=W.oidcIssuerUrl.trim(),s=W.oidcClientId.trim(),r=W.oidcScopes.trim(),l=W.oidcLoginLabel.trim(),o=X.trim();if("password"!==a&&(!t||!s||!o)&&!e.oidcConfigured)return void ea({type:"error",message:"Issuer URL, client ID, and client secret are required to enable OIDC."});es(!0),ea({type:"",message:""});try{let e={authMode:a,oidcIssuerUrl:t,oidcClientId:s,oidcScopes:r||"openid profile email",oidcLoginLabel:l||"Sign in with OIDC"};o&&(e.oidcClientSecret=o);let d=await ek(e);Z({authMode:d.authMode||a,oidcIssuerUrl:d.oidcIssuerUrl||t,oidcClientId:d.oidcClientId||s,oidcScopes:d.oidcScopes||r||"openid profile email",oidcLoginLabel:d.oidcLoginLabel||l||"Sign in with OIDC"}),Y(""),ea({type:"success",message:"OIDC settings saved."})}catch(e){ea({type:"error",message:e.message||"Failed to save OIDC settings"})}finally{es(!1)}},eF=async(e,a)=>{if(!a)return;if(a.size>1048576)return void eb({type:"error",message:"File exceeds 1 MB limit."});let t="logo"===e?ev:ew;t(!0),eb({type:"",message:""});try{let t=new FormData;t.append("asset",e),t.append("file",a);let s=await fetch("/api/branding/upload",{method:"POST",body:t}),r=await s.json().catch(()=>({}));if(!s.ok)throw Error(r.error||"Upload failed");(0,l.notifyBrandingChanged)(),eb({type:"success",message:`${"logo"===e?"Logo":"Favicon"} uploaded.`})}catch(e){eb({type:"error",message:e.message||"Upload failed."})}finally{t(!1)}},e$=async e=>{let a=e.target.files?.[0];await eF("logo",a),eD.current&&(eD.current.value="")},eq=async e=>{let a=e.target.files?.[0];await eF("favicon",a),eA.current&&(eA.current.value="")},e_=async e=>{e.preventDefault(),ey(!0),eb({type:"",message:""});try{await ek({siteTitle:ei.trim(),siteShortName:ep.trim(),siteDescription:em.trim()}),(0,l.notifyBrandingChanged)(),eb({type:"success",message:"Branding text saved."})}catch(e){eb({type:"error",message:e.message||"Failed to save branding."})}finally{ey(!1)}},ez=async e=>{eb({type:"",message:""});try{let a=await fetch(`/api/branding?asset=${e}`,{method:"DELETE"}),t=await a.json().catch(()=>({}));if(!a.ok)throw Error(t.error||"Failed to remove asset");(0,l.notifyBrandingChanged)(),eb({type:"success",message:`${"logo"===e?"Logo":"Favicon"} removed.`})}catch(e){eb({type:"error",message:e.message||"Failed to remove asset."})}},eJ=async()=>{eC(!0),eb({type:"",message:""});try{let e=await fetch("/api/branding",{method:"DELETE"});if(!e.ok){let a=await e.json().catch(()=>({}));throw Error(a.error||"Failed to reset branding")}await ek({siteTitle:"",siteShortName:"",siteDescription:""}),ec(""),eu(""),ex(""),(0,l.notifyBrandingChanged)(),eb({type:"success",message:"Branding reset to defaults."})}catch(e){eb({type:"error",message:e.message||"Failed to reset branding."})}finally{eC(!1)}};return t?(0,s.jsx)("div",{className:"p-8 text-text-muted",children:"Loading settings..."}):(0,s.jsxs)("div",{className:"mx-auto max-w-6xl space-y-6 p-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-3xl font-bold text-text-main",children:"Settings"}),(0,s.jsx)("p",{className:"mt-1 text-text-muted",children:"Configure dashboard preferences, request logging, database backup, and authentication."})]}),(0,s.jsxs)(b,{icon:"view_sidebar",title:"Sidebar tools",desc:"Show or hide advanced dashboard tools to keep the sidebar clean.",children:[(0,s.jsx)(v,{title:"Show Advanced tools",desc:"When disabled, Media / Web, AI Traffic Gateway, CLI Tools, Proxy Pools, Skills, Console Log and Translator are hidden from the sidebar. Core admin pages remain visible.",checked:!1!==e.sidebarAdvancedToolsVisible,onChange:eU}),(0,s.jsx)(h,{status:eo})]}),(0,s.jsxs)(b,{icon:"palette",title:"Branding",desc:"Customize site title, logo and favicon shown in the dashboard, browser tab and login page. Max 1 MB per file.",children:[(0,s.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2",children:[(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mb-2 text-sm font-semibold text-text-main",children:"Logo"}),(0,s.jsxs)("div",{className:"flex items-center gap-4 rounded-xl border border-border bg-background p-4",children:[(0,s.jsx)("div",{className:"flex h-16 w-16 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-surface",children:en?.logoUrl?(0,s.jsx)("img",{src:en.logoUrl,alt:"Current logo",className:"max-h-full max-w-full object-contain"}):(0,s.jsx)("span",{className:"material-symbols-outlined text-text-muted",children:"hub"})}),(0,s.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,s.jsx)("div",{className:"text-xs text-text-muted",children:"Shown in the dashboard sidebar and login page. SVG, PNG, WebP, JPEG, GIF."}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)("button",{type:"button",disabled:ef,onClick:()=>eD.current?.click(),className:"rounded-xl bg-primary px-3 py-1.5 text-xs font-semibold text-white disabled:opacity-50",children:ef?"Uploading...":en?.logoUrl?"Replace logo":"Upload logo"}),en?.logoUrl?(0,s.jsx)("button",{type:"button",onClick:()=>ez("logo"),className:"rounded-xl border border-border px-3 py-1.5 text-xs font-semibold text-text-main hover:border-red-300 hover:text-red-600",children:"Remove"}):null]})]}),(0,s.jsx)("input",{ref:eD,type:"file",accept:m,className:"hidden",onChange:e$})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mb-2 text-sm font-semibold text-text-main",children:"Favicon"}),(0,s.jsxs)("div",{className:"flex items-center gap-4 rounded-xl border border-border bg-background p-4",children:[(0,s.jsx)("div",{className:"flex h-16 w-16 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-surface",children:en?.faviconUrl?(0,s.jsx)("img",{src:en.faviconUrl,alt:"Current favicon",className:"max-h-10 max-w-10 object-contain"}):(0,s.jsx)("span",{className:"material-symbols-outlined text-text-muted",children:"public"})}),(0,s.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,s.jsx)("div",{className:"text-xs text-text-muted",children:"Shown in the browser tab. ICO, SVG, PNG, WebP, JPEG, GIF."}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)("button",{type:"button",disabled:ej,onClick:()=>eA.current?.click(),className:"rounded-xl bg-primary px-3 py-1.5 text-xs font-semibold text-white disabled:opacity-50",children:ej?"Uploading...":en?.faviconUrl?"Replace favicon":"Upload favicon"}),en?.faviconUrl?(0,s.jsx)("button",{type:"button",onClick:()=>ez("favicon"),className:"rounded-xl border border-border px-3 py-1.5 text-xs font-semibold text-text-main hover:border-red-300 hover:text-red-600",children:"Remove"}):null]})]}),(0,s.jsx)("input",{ref:eA,type:"file",accept:x,className:"hidden",onChange:eq})]})]})]}),(0,s.jsxs)("form",{onSubmit:e_,className:"space-y-3",children:[(0,s.jsx)(g,{label:"Site title",hint:"Shown in browser tab and login page. Leave blank for default.",children:(0,s.jsx)(y,{value:ei,onChange:e=>ec(e.target.value),placeholder:"AI Router Gateway"})}),(0,s.jsx)(g,{label:"Company short name",hint:"Shown in dashboard sidebar and login hero text. Defaults to site title/sidebar default or 'Fujinet' on login.",children:(0,s.jsx)(y,{value:ep,onChange:e=>eu(e.target.value),placeholder:"Fujinet"})}),(0,s.jsx)(g,{label:"Description",hint:"Used for browser metadata.",children:(0,s.jsx)(f,{rows:3,value:em,onChange:e=>ex(e.target.value),placeholder:"AI Infrastructure Management"})}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)("button",{type:"submit",disabled:eg,className:"rounded-xl bg-primary px-4 py-2 text-sm font-semibold text-white disabled:opacity-50",children:eg?"Saving...":"Save branding text"}),(0,s.jsx)("button",{type:"button",disabled:eN,onClick:eJ,className:"rounded-xl border border-border px-4 py-2 text-sm font-semibold text-text-main hover:border-red-300 hover:text-red-600 disabled:opacity-50",children:eN?"Resetting...":"Reset to defaults"})]})]})]}),(0,s.jsx)(h,{status:eh})]}),(0,s.jsx)(b,{icon:"shield",title:"Dashboard Login",desc:"Local account remains available even when LDAP is enabled.",children:(0,s.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2",children:[(0,s.jsxs)("form",{onSubmit:eL,className:"space-y-3",children:[(0,s.jsx)("h3",{className:"font-semibold text-text-main",children:"Local account"}),(0,s.jsx)(g,{label:"Local username",children:(0,s.jsx)(y,{value:R,onChange:e=>M(e.target.value)})}),(0,s.jsx)("button",{className:"rounded-xl bg-primary px-4 py-2 text-sm font-semibold text-white",children:"Save account"}),(0,s.jsx)(h,{status:B})]}),(0,s.jsxs)("form",{onSubmit:eP,className:"space-y-3",children:[(0,s.jsx)("h3",{className:"font-semibold text-text-main",children:"Local password"}),e.hasPassword&&(0,s.jsx)(g,{label:"Current password",children:(0,s.jsx)(y,{type:"password",value:d.current,onChange:e=>n({...d,current:e.target.value}),required:!0})}),(0,s.jsx)(g,{label:"New password",children:(0,s.jsx)(y,{type:"password",value:d.new,onChange:e=>n({...d,new:e.target.value}),required:!0})}),(0,s.jsx)(g,{label:"Confirm password",children:(0,s.jsx)(y,{type:"password",value:d.confirm,onChange:e=>n({...d,confirm:e.target.value}),required:!0})}),(0,s.jsx)("button",{disabled:j,className:"rounded-xl bg-primary px-4 py-2 text-sm font-semibold text-white disabled:opacity-50",children:e.hasPassword?"Update Password":"Set Password"}),(0,s.jsx)(h,{status:i})]})]})}),(0,s.jsx)("div",{id:"request-logging",className:"scroll-mt-6",children:(0,s.jsx)(p,{})}),(0,s.jsxs)(b,{icon:"database",title:"Full Node Backup",desc:"Export or restore the database, Audit Proxy node configuration, Root CA, Resource Monitor data, logo and favicon.",children:[(0,s.jsxs)("div",{className:"mb-4 grid gap-3 md:grid-cols-2",children:[(0,s.jsx)(g,{label:"Backup password (optional)",hint:"Leave blank for plaintext JSON. When set, the entire backup is encrypted with AES-256-GCM and scrypt. Minimum 8 characters.",children:(0,s.jsx)(y,{type:"password",autoComplete:"new-password",value:S,onChange:e=>k(e.target.value),placeholder:"Optional encryption password"})}),(0,s.jsx)(g,{label:"Confirm password (export only)",hint:"Used only to prevent exporting a backup with a mistyped password. Not required when importing.",children:(0,s.jsx)(y,{type:"password",autoComplete:"new-password",value:U,onChange:e=>L(e.target.value),placeholder:"Repeat password before download"})})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,s.jsx)("button",{onClick:eR,disabled:N,className:"rounded-xl bg-primary px-4 py-2 text-sm font-semibold text-white disabled:opacity-50",children:"Download Full Backup"}),(0,s.jsx)("button",{onClick:()=>P.current?.click(),disabled:N,className:"rounded-xl border border-border px-4 py-2 text-sm font-semibold text-text-main hover:border-primary/50 disabled:opacity-50",children:"Import Backup"}),(0,s.jsx)("input",{ref:P,type:"file",accept:"application/json,.brbackup",className:"hidden",onChange:eM})]}),(0,s.jsx)("div",{className:"mt-3 rounded-xl border border-amber-500/30 bg-amber-500/10 px-4 py-3 text-xs leading-5 text-amber-800 dark:text-amber-300",children:"Full backups include API credentials, Audit Proxy bcrypt password hashes and the Root CA private key. Anyone holding the Root CA key can issue certificates trusted by enrolled clients. Use a password whenever the file leaves the secured backup location."}),(0,s.jsx)("p",{className:"mt-3 text-xs text-text-muted",children:"Import validates the complete Root CA pair and Audit Proxy configuration before mutation, applies the restored runtime state immediately, and rolls back database/configuration/CA state if restore fails. Legacy v2 database backups remain supported."}),(0,s.jsx)(h,{status:D})]}),(0,s.jsx)(b,{icon:"corporate_fare",title:"LDAP / Active Directory Login",desc:"Search users from a User Base DN, restrict login by group DN, and grant admin by group DN. The old Selected LDAP users list is kept as a manual admin list.",children:(0,s.jsxs)("form",{onSubmit:eE,className:"space-y-5",children:[(0,s.jsx)("div",{className:"flex flex-wrap gap-3",children:(0,s.jsx)("button",{type:"button",onClick:()=>eB("ldapEnabled",!G.ldapEnabled),className:`rounded-xl px-3 py-2 text-sm font-semibold ${G.ldapEnabled?"bg-primary text-white":"border border-border text-text-muted"}`,children:G.ldapEnabled?"Enabled":"Disabled"})}),(0,s.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,s.jsx)(g,{label:"LDAP URL",children:(0,s.jsx)(y,{value:G.ldapUrl,onChange:e=>eB("ldapUrl",e.target.value),placeholder:"ldap://dc01.company.local:389"})}),(0,s.jsx)(g,{label:"LDAP User Base DN",hint:"OU/container/domain where user objects are searched. Do not use a group DN here.",children:(0,s.jsx)(y,{value:G.ldapUserBaseDn,onChange:e=>eB("ldapUserBaseDn",e.target.value),placeholder:"OU=Users,OU=xxx,DC=xx,DC=vn"})}),(0,s.jsx)(g,{label:"LDAP Bind DN",children:(0,s.jsx)(y,{value:G.ldapBindDn,onChange:e=>eB("ldapBindDn",e.target.value),placeholder:"CN=svc-bluerouter,OU=Service Accounts,DC=company,DC=local"})}),(0,s.jsx)(g,{label:"LDAP Bind Password",children:(0,s.jsx)(y,{type:"password",value:G.ldapBindPassword,onChange:e=>eB("ldapBindPassword",e.target.value),placeholder:e.ldapHasBindPassword?"Saved — leave blank to keep":"Service account password"})}),(0,s.jsx)(g,{label:"LDAP Login Allowed Group DN",hint:"Only members of this group can log in. Leave blank to allow any valid LDAP user.",children:(0,s.jsx)(y,{value:G.ldapLoginAllowedGroupDn,onChange:e=>eB("ldapLoginAllowedGroupDn",e.target.value),placeholder:"CN=Apikeys_Groups,OU=AppGroups,OU=xxx,DC=xx,DC=vn"})}),(0,s.jsx)(g,{label:"LDAP Admin Group DN",hint:"Members of this group get full admin dashboard access.",children:(0,s.jsx)(y,{value:G.ldapAdminGroupDn,onChange:e=>eB("ldapAdminGroupDn",e.target.value),placeholder:"CN=BlueRouter_Admins,OU=AppGroups,OU=xxx,DC=xx,DC=vn"})}),(0,s.jsx)(g,{label:"LDAP Monitor Admin Group DN",hint:"Members can use only Endpoint, API Keys, Usage, Analytics, Quota Tracker and Prompt Logs with admin-like permissions inside those tabs.",children:(0,s.jsx)(y,{value:G.ldapMonitorAdminGroupDn,onChange:e=>eB("ldapMonitorAdminGroupDn",e.target.value),placeholder:"CN=BlueRouter_Monitor_Admins,OU=AppGroups,OU=xxx,DC=xx,DC=vn"})}),(0,s.jsx)(g,{label:"LDAP AI Gateways Monitors Group DN",hint:"Members log in as regular users but the Analytics page aggregates statistics for every API key that has an owner, instead of only their own keys.",children:(0,s.jsx)(y,{value:G.ldapAiGatewaysMonitorsGroupDn,onChange:e=>eB("ldapAiGatewaysMonitorsGroupDn",e.target.value),placeholder:"CN=BlueRouter_AI_Gateways_Monitors,OU=AppGroups,OU=xxx,DC=xx,DC=vn"})})]}),(0,s.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,s.jsx)(g,{label:"User search filter",hint:"Use {{username}} placeholder.",children:(0,s.jsx)(y,{value:G.ldapUserSearchFilter,onChange:e=>eB("ldapUserSearchFilter",e.target.value)})}),(0,s.jsx)(g,{label:"Login group mode",hint:"Nested groups uses AD matching rule 1.2.840.113556.1.4.1941.",children:(0,s.jsx)(v,{title:"Nested group membership",desc:"Recommended for Active Directory nested groups.",checked:G.ldapNestedGroups,onChange:e=>eB("ldapNestedGroups",e)})}),(0,s.jsx)(g,{label:"Username attribute",children:(0,s.jsx)(y,{value:G.ldapUserNameAttribute,onChange:e=>eB("ldapUserNameAttribute",e.target.value)})}),(0,s.jsx)(g,{label:"Display attribute",children:(0,s.jsx)(y,{value:G.ldapUserDisplayAttribute,onChange:e=>eB("ldapUserDisplayAttribute",e.target.value)})}),(0,s.jsx)(g,{label:"Email attribute",children:(0,s.jsx)(y,{value:G.ldapUserEmailAttribute,onChange:e=>eB("ldapUserEmailAttribute",e.target.value)})}),(0,s.jsx)(g,{label:"Connect timeout ms",children:(0,s.jsx)(y,{type:"number",value:G.ldapConnectTimeoutMs,onChange:e=>eB("ldapConnectTimeoutMs",e.target.value)})})]}),(0,s.jsx)(v,{title:"Reject invalid TLS certificates",desc:"Disable only for test/self-signed LDAP TLS.",checked:G.ldapTlsRejectUnauthorized,onChange:e=>eB("ldapTlsRejectUnauthorized",e)}),(0,s.jsxs)("div",{className:"rounded-2xl border border-border bg-background p-4",children:[(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsx)("h3",{className:"font-semibold text-text-main",children:"Manual admin users / LDAP owner list"}),(0,s.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Users loaded here come from Login Allowed Group DN when set. Selected users are also treated as manual admins for backward compatibility."})]}),(0,s.jsxs)("div",{className:"mb-3 flex gap-2",children:[(0,s.jsx)(y,{value:z,onChange:e=>J(e.target.value),placeholder:"Search users..."}),(0,s.jsx)("button",{type:"button",onClick:eI,disabled:K,className:"rounded-xl border border-border px-4 py-2 text-sm font-semibold text-text-main disabled:opacity-50",children:K?"Loading...":"Load users"})]}),V.length>0&&(0,s.jsx)("div",{className:"max-h-72 overflow-auto rounded-xl border border-border",children:V.map(e=>{let a=G.ldapAllowedUsers.includes(e.username);return(0,s.jsxs)("button",{type:"button",onClick:()=>eT(e.username),className:`flex w-full items-center justify-between gap-3 border-b border-border px-3 py-2 text-left text-sm last:border-b-0 ${a?"bg-primary/10":"bg-background hover:bg-surface"}`,children:[(0,s.jsxs)("span",{children:[(0,s.jsx)("span",{className:"font-semibold text-text-main",children:e.displayName||e.username}),(0,s.jsxs)("span",{className:"ml-2 text-text-muted",children:[e.username,e.email?` \xb7 ${e.email}`:""]})]}),(0,s.jsx)("span",{className:"material-symbols-outlined text-primary",children:a?"check_circle":"radio_button_unchecked"})]},e.dn||e.username)})}),(0,s.jsxs)("div",{className:"mt-3",children:[(0,s.jsxs)("div",{className:"mb-2 text-sm font-semibold text-text-main",children:["Selected manual admin users (",G.ldapAllowedUsers.length,")"]}),0===G.ldapAllowedUsers.length?(0,s.jsx)("div",{className:"text-sm text-text-muted",children:"No users selected."}):(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:G.ldapAllowedUsers.map(e=>(0,s.jsxs)("button",{type:"button",onClick:()=>eT(e),className:"rounded-full border border-primary/30 bg-primary/10 px-3 py-1 text-xs text-primary",children:[e," \xd7"]},e))})]})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-3",children:[(0,s.jsx)("button",{type:"button",onClick:eG,disabled:q,className:"rounded-xl border border-border px-4 py-2 text-sm font-semibold text-text-main disabled:opacity-50",children:q?"Testing...":"Save & test LDAP"}),(0,s.jsx)("button",{type:"submit",disabled:F,className:"rounded-xl bg-primary px-4 py-2 text-sm font-semibold text-white disabled:opacity-50",children:F?"Saving...":"Save LDAP settings"})]}),(0,s.jsx)(h,{status:T})]})}),(0,s.jsxs)(b,{icon:"lock_open",title:"OIDC Dashboard Login",desc:"oidc"===e.authMode?"OIDC active":"both"===e.authMode?"Password + OIDC active":"Optional SSO via Authentik/Keycloak/Google",children:[(0,s.jsx)("button",{type:"button",onClick:()=>el(e=>!e),className:"mb-4 rounded-xl border border-border px-4 py-2 text-sm font-semibold text-text-main",children:er?"Hide OIDC settings":"Show OIDC settings"}),er&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)("div",{className:"grid gap-3 md:grid-cols-3",children:[{value:"password",title:"Password/LDAP",desc:"Keep local and LDAP login."},{value:"oidc",title:"OIDC only",desc:"Disable local/LDAP login when configured."},{value:"both",title:"Both",desc:"Allow either OIDC or local/LDAP."}].map(e=>{let a=W.authMode===e.value;return(0,s.jsxs)("button",{type:"button",onClick:()=>Z(a=>({...a,authMode:e.value})),className:`rounded-xl border p-3 text-left ${a?"border-primary bg-primary/10":"border-border bg-background hover:border-primary/40"}`,children:[(0,s.jsx)("div",{className:"font-semibold text-text-main",children:e.title}),(0,s.jsx)("div",{className:"mt-1 text-xs text-text-muted",children:e.desc})]},e.value)})}),(0,s.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,s.jsx)(g,{label:"Issuer URL",children:(0,s.jsx)(y,{value:W.oidcIssuerUrl,onChange:e=>Z({...W,oidcIssuerUrl:e.target.value})})}),(0,s.jsx)(g,{label:"Client ID",children:(0,s.jsx)(y,{value:W.oidcClientId,onChange:e=>Z({...W,oidcClientId:e.target.value})})}),(0,s.jsx)(g,{label:"Client Secret",children:(0,s.jsx)(y,{type:"password",value:X,onChange:e=>Y(e.target.value),placeholder:e.oidcConfigured?"Saved — leave blank to keep":"Client secret"})}),(0,s.jsx)(g,{label:"Scopes",children:(0,s.jsx)(y,{value:W.oidcScopes,onChange:e=>Z({...W,oidcScopes:e.target.value})})}),(0,s.jsx)(g,{label:"Login label",children:(0,s.jsx)(y,{value:W.oidcLoginLabel,onChange:e=>Z({...W,oidcLoginLabel:e.target.value})})})]}),(0,s.jsx)("button",{type:"button",onClick:()=>eO(),disabled:et,className:"rounded-xl bg-primary px-4 py-2 text-sm font-semibold text-white disabled:opacity-50",children:et?"Saving...":"Save OIDC settings"}),(0,s.jsx)(h,{status:ee})]})]})]})}},7973:(e,a,t)=>{Promise.resolve().then(t.bind(t,6191))}},e=>{e.O(0,[6373,3862,8500,506,9959,7050,5564,5263,7033,5497,8441,3794,7358],()=>e(e.s=7973)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[166,1316,2006,6526,6620,8982],{32239:(e,s,t)=>{"use strict";t.d(s,{default:()=>f});var i=t(95155),n=t(73321),o=t(98500),a=t.n(o),r=t(12115),l=t(35497),c=t(57250),d=t(52679);let m=new Set(["image"]),x={image:"image-combo",tts:"tts-combo"};function h(e){let s=Object.entries(e).some(([e,s])=>e.startsWith("modelLock_")&&s&&new Date(s).getTime()>Date.now());return"unavailable"!==e.testStatus||s?e.testStatus:"active"}function p({provider:e,kind:s,connections:t,isCustom:n,onToggle:o}){var r;let m,x=d.Q2[e.id],u=!!x?.noAuth,f=t.filter(s=>s.provider===e.id),j=f.filter(e=>{let s=h(e);return"active"===s||"success"===s}).length,g=f.filter(e=>{let s=h(e);return"error"===s||"expired"===s||"unavailable"===s}).length,b=f.length,v=b>0&&f.every(e=>!1===e.isActive);return(0,i.jsx)(a(),{href:(r=e.id,(m=d.dV[s])?`${m}/${r}`:`/dashboard/media-providers/${s}/${r}`),className:"group",children:(0,i.jsx)(l.Zp,{padding:"xs",className:`h-full hover:bg-black/[0.01] dark:hover:bg-white/[0.01] transition-colors cursor-pointer ${v?"opacity-50":""}`,children:(0,i.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[(0,i.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,i.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",style:{backgroundColor:`${e.color?.length>7?e.color:(e.color??"#888")+"15"}`},children:(0,i.jsx)(c.A,{src:`/providers/${e.id}.png`,alt:e.name,size:30,className:"object-contain rounded-lg max-w-[30px] max-h-[30px]",fallbackText:e.textIcon||e.id.slice(0,2).toUpperCase(),fallbackColor:e.color})}),(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsx)("h3",{className:"font-semibold text-sm",children:e.name}),(0,i.jsxs)("div",{className:"flex items-center gap-2 mt-0.5 flex-wrap",children:[n&&(0,i.jsx)(l.Ex,{variant:"default",size:"sm",children:"Custom"}),n&&("stt"===s||"tts"===s)||u?(0,i.jsx)(l.Ex,{variant:"success",size:"sm",children:"Ready"}):v?(0,i.jsx)(l.Ex,{variant:"default",size:"sm",children:"Disabled"}):0===b?(0,i.jsx)("span",{className:"text-xs text-text-muted",children:"No connections"}):(0,i.jsxs)(i.Fragment,{children:[j>0&&(0,i.jsxs)(l.Ex,{variant:"success",size:"sm",dot:!0,children:[j," Connected"]}),g>0&&(0,i.jsxs)(l.Ex,{variant:"error",size:"sm",dot:!0,children:[g," Error"]}),0===j&&0===g&&(0,i.jsxs)(l.Ex,{variant:"default",size:"sm",children:[b," Added"]})]})]})]})]}),b>0&&(0,i.jsx)("div",{className:"shrink-0 opacity-100 transition-opacity sm:opacity-0 sm:group-hover:opacity-100",onClick:s=>{s.preventDefault(),s.stopPropagation(),o&&o(e.id,v)},children:(0,i.jsx)(l.lM,{size:"sm",checked:!v,onChange:()=>{},title:v?"Enable provider":"Disable provider"})})]})})})}function u({combos:e}){return 0===e.length?null:(0,i.jsx)("div",{className:"flex flex-col gap-2",children:e.map(e=>(0,i.jsx)(a(),{href:`/dashboard/media-providers/combo/${e.id}`,children:(0,i.jsx)(l.Zp,{padding:"xs",className:"hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors cursor-pointer",children:(0,i.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-primary text-[18px]",children:"layers"}),(0,i.jsx)("code",{className:"text-sm font-mono font-medium flex-1 truncate",children:e.name}),(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-1 sm:shrink-0",children:[e.models.slice(0,6).map((e,s)=>{let t="string"==typeof e?e.split("/")[0]:"",n=d.Q2[t];return(0,i.jsx)("div",{title:n?.name||e,className:"size-5 rounded flex items-center justify-center",style:{backgroundColor:`${n?.color??"#888"}15`},children:(0,i.jsx)(c.A,{src:`/providers/${t}.png`,alt:n?.name||t,size:18,className:"object-contain rounded max-w-[18px] max-h-[18px]",fallbackText:n?.textIcon||t.slice(0,2).toUpperCase(),fallbackColor:n?.color})},`${e}-${s}`)}),e.models.length>6&&(0,i.jsxs)("span",{className:"text-[10px] text-text-muted ml-1",children:["+",e.models.length-6]})]}),(0,i.jsx)("span",{className:"text-[11px] text-text-muted shrink-0",children:e.models.length}),(0,i.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[16px]",children:"chevron_right"})]})})},e.id))})}function f({forcedKind:e}){let s=(0,n.useParams)(),t=e||s.kind,o=(0,n.useRouter)(),[a,c]=(0,r.useState)([]),[h,j]=(0,r.useState)([]),[g,b]=(0,r.useState)([]),[v,y]=(0,r.useState)(!1),[C,N]=(0,r.useState)(!1),[k,w]=(0,r.useState)(!1);(0,r.useEffect)(()=>{("webSearch"===t||"webFetch"===t)&&o.replace("/dashboard/media-providers/web")},[t,o]);let S=d.rj.find(e=>e.id===t),$="embedding"===t,E="stt"===t,T="tts"===t,z=m.has(t);if((0,r.useEffect)(()=>{S&&(fetch("/api/providers",{cache:"no-store"}).then(e=>e.json()).then(e=>c(e.connections||[])).catch(()=>{}),($||E||T)&&fetch("/api/provider-nodes",{cache:"no-store"}).then(e=>e.json()).then(e=>j((e.nodes||[]).filter(e=>e.type===(E?"custom-stt":T?"custom-tts":"custom-embedding")))).catch(()=>{}),z&&fetch("/api/combos",{cache:"no-store"}).then(e=>e.json()).then(e=>b(e.combos||[])).catch(()=>{}))},[$,E,T,z,S]),!S)return(0,n.notFound)();let A=(0,d.o5)(t),O=g.filter(e=>e.kind===t),_=h.map(e=>({id:e.id,name:e.name||("custom-stt"===e.type?"Custom STT":"custom-tts"===e.type?"Custom TTS":"Custom Embedding"),color:"custom-stt"===e.type||"custom-tts"===e.type?"#0EA5E9":"#6366F1",textIcon:"custom-stt"===e.type?"CS":"custom-tts"===e.type?"CT":"CE"})),F=[...A,..._],P=async(e,s)=>{let t=a.filter(s=>s.provider===e);c(t=>t.map(t=>t.provider===e?{...t,isActive:s}:t)),await Promise.allSettled(t.map(e=>fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:s})})))},D=async()=>{let e=x[t]||`${t}-combo`,s=e,i=1,n=new Set(g.map(e=>e.name));for(;n.has(s);)s=`${e}-${i++}`;let a=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,models:[],kind:t})});if(a.ok){let e=await a.json();o.push(`/dashboard/media-providers/combo/${e.id}`)}else alert((await a.json()).error||"Failed to create combo")};return(0,i.jsxs)("div",{className:"flex flex-col gap-6",children:[($||E||T||z)&&(0,i.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[z&&(0,i.jsx)(l.$n,{size:"sm",icon:"add",onClick:D,children:"Create Combo"}),$&&(0,i.jsx)(l.$n,{size:"sm",icon:"add",onClick:()=>y(!0),children:"Add Custom Embedding"}),E&&(0,i.jsx)(l.$n,{size:"sm",icon:"add",onClick:()=>N(!0),children:"Add Custom STT"}),T&&(0,i.jsx)(l.$n,{size:"sm",icon:"add",onClick:()=>w(!0),children:"Add Custom TTS"})]}),z&&O.length>0&&(0,i.jsx)(u,{combos:O}),0===F.length?(0,i.jsxs)("div",{className:"text-center py-12 border border-dashed border-border rounded-xl text-text-muted text-sm",children:["No providers support ",(0,i.jsx)("strong",{children:S.label})," yet."]}):(0,i.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:[A.map(e=>(0,i.jsx)(p,{provider:e,kind:t,connections:a,onToggle:P},e.id)),_.map(e=>(0,i.jsx)(p,{provider:e,kind:t,connections:a,isCustom:!0,onToggle:P},e.id))]}),$&&(0,i.jsx)(l.Jz,{isOpen:v,onClose:()=>y(!1),onSaved:e=>{j(s=>[...s,e]),y(!1)}}),E&&(0,i.jsx)(l.F8,{isOpen:C,onClose:()=>N(!1),onCreated:e=>{j(s=>[...s,e]),N(!1)}}),T&&(0,i.jsx)(l.b1,{isOpen:k,onClose:()=>w(!1),onCreated:e=>{j(s=>[...s,e]),w(!1)}})]})}},78521:(e,s,t)=>{Promise.resolve().then(t.bind(t,32239))}},e=>{e.O(0,[6373,3862,8500,506,9959,7050,5564,5263,7033,5497,8441,3794,7358],()=>e(e.s=78521)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3444,4574,4588,5180,5324],{83211:(e,s,_)=>{Promise.resolve().then(_.bind(_,94588))}},e=>{e.O(0,[6373,3862,8500,506,9959,7050,5564,5263,7033,5497,2207,8441,3794,7358],()=>e(e.s=83211)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[166,1316,2006,6526,6620,8982],{32239:(e,s,t)=>{"use strict";t.d(s,{default:()=>f});var i=t(95155),n=t(73321),o=t(98500),a=t.n(o),r=t(12115),l=t(35497),c=t(57250),d=t(52679);let m=new Set(["image"]),x={image:"image-combo",tts:"tts-combo"};function h(e){let s=Object.entries(e).some(([e,s])=>e.startsWith("modelLock_")&&s&&new Date(s).getTime()>Date.now());return"unavailable"!==e.testStatus||s?e.testStatus:"active"}function p({provider:e,kind:s,connections:t,isCustom:n,onToggle:o}){var r;let m,x=d.Q2[e.id],u=!!x?.noAuth,f=t.filter(s=>s.provider===e.id),j=f.filter(e=>{let s=h(e);return"active"===s||"success"===s}).length,g=f.filter(e=>{let s=h(e);return"error"===s||"expired"===s||"unavailable"===s}).length,b=f.length,v=b>0&&f.every(e=>!1===e.isActive);return(0,i.jsx)(a(),{href:(r=e.id,(m=d.dV[s])?`${m}/${r}`:`/dashboard/media-providers/${s}/${r}`),className:"group",children:(0,i.jsx)(l.Zp,{padding:"xs",className:`h-full hover:bg-black/[0.01] dark:hover:bg-white/[0.01] transition-colors cursor-pointer ${v?"opacity-50":""}`,children:(0,i.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-3",children:[(0,i.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,i.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",style:{backgroundColor:`${e.color?.length>7?e.color:(e.color??"#888")+"15"}`},children:(0,i.jsx)(c.A,{src:`/providers/${e.id}.png`,alt:e.name,size:30,className:"object-contain rounded-lg max-w-[30px] max-h-[30px]",fallbackText:e.textIcon||e.id.slice(0,2).toUpperCase(),fallbackColor:e.color})}),(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsx)("h3",{className:"font-semibold text-sm",children:e.name}),(0,i.jsxs)("div",{className:"flex items-center gap-2 mt-0.5 flex-wrap",children:[n&&(0,i.jsx)(l.Ex,{variant:"default",size:"sm",children:"Custom"}),n&&("stt"===s||"tts"===s)||u?(0,i.jsx)(l.Ex,{variant:"success",size:"sm",children:"Ready"}):v?(0,i.jsx)(l.Ex,{variant:"default",size:"sm",children:"Disabled"}):0===b?(0,i.jsx)("span",{className:"text-xs text-text-muted",children:"No connections"}):(0,i.jsxs)(i.Fragment,{children:[j>0&&(0,i.jsxs)(l.Ex,{variant:"success",size:"sm",dot:!0,children:[j," Connected"]}),g>0&&(0,i.jsxs)(l.Ex,{variant:"error",size:"sm",dot:!0,children:[g," Error"]}),0===j&&0===g&&(0,i.jsxs)(l.Ex,{variant:"default",size:"sm",children:[b," Added"]})]})]})]})]}),b>0&&(0,i.jsx)("div",{className:"shrink-0 opacity-100 transition-opacity sm:opacity-0 sm:group-hover:opacity-100",onClick:s=>{s.preventDefault(),s.stopPropagation(),o&&o(e.id,v)},children:(0,i.jsx)(l.lM,{size:"sm",checked:!v,onChange:()=>{},title:v?"Enable provider":"Disable provider"})})]})})})}function u({combos:e}){return 0===e.length?null:(0,i.jsx)("div",{className:"flex flex-col gap-2",children:e.map(e=>(0,i.jsx)(a(),{href:`/dashboard/media-providers/combo/${e.id}`,children:(0,i.jsx)(l.Zp,{padding:"xs",className:"hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors cursor-pointer",children:(0,i.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-primary text-[18px]",children:"layers"}),(0,i.jsx)("code",{className:"text-sm font-mono font-medium flex-1 truncate",children:e.name}),(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-1 sm:shrink-0",children:[e.models.slice(0,6).map((e,s)=>{let t="string"==typeof e?e.split("/")[0]:"",n=d.Q2[t];return(0,i.jsx)("div",{title:n?.name||e,className:"size-5 rounded flex items-center justify-center",style:{backgroundColor:`${n?.color??"#888"}15`},children:(0,i.jsx)(c.A,{src:`/providers/${t}.png`,alt:n?.name||t,size:18,className:"object-contain rounded max-w-[18px] max-h-[18px]",fallbackText:n?.textIcon||t.slice(0,2).toUpperCase(),fallbackColor:n?.color})},`${e}-${s}`)}),e.models.length>6&&(0,i.jsxs)("span",{className:"text-[10px] text-text-muted ml-1",children:["+",e.models.length-6]})]}),(0,i.jsx)("span",{className:"text-[11px] text-text-muted shrink-0",children:e.models.length}),(0,i.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[16px]",children:"chevron_right"})]})})},e.id))})}function f({forcedKind:e}){let s=(0,n.useParams)(),t=e||s.kind,o=(0,n.useRouter)(),[a,c]=(0,r.useState)([]),[h,j]=(0,r.useState)([]),[g,b]=(0,r.useState)([]),[v,y]=(0,r.useState)(!1),[C,N]=(0,r.useState)(!1),[k,w]=(0,r.useState)(!1);(0,r.useEffect)(()=>{("webSearch"===t||"webFetch"===t)&&o.replace("/dashboard/media-providers/web")},[t,o]);let S=d.rj.find(e=>e.id===t),$="embedding"===t,E="stt"===t,T="tts"===t,z=m.has(t);if((0,r.useEffect)(()=>{S&&(fetch("/api/providers",{cache:"no-store"}).then(e=>e.json()).then(e=>c(e.connections||[])).catch(()=>{}),($||E||T)&&fetch("/api/provider-nodes",{cache:"no-store"}).then(e=>e.json()).then(e=>j((e.nodes||[]).filter(e=>e.type===(E?"custom-stt":T?"custom-tts":"custom-embedding")))).catch(()=>{}),z&&fetch("/api/combos",{cache:"no-store"}).then(e=>e.json()).then(e=>b(e.combos||[])).catch(()=>{}))},[$,E,T,z,S]),!S)return(0,n.notFound)();let A=(0,d.o5)(t),O=g.filter(e=>e.kind===t),_=h.map(e=>({id:e.id,name:e.name||("custom-stt"===e.type?"Custom STT":"custom-tts"===e.type?"Custom TTS":"Custom Embedding"),color:"custom-stt"===e.type||"custom-tts"===e.type?"#0EA5E9":"#6366F1",textIcon:"custom-stt"===e.type?"CS":"custom-tts"===e.type?"CT":"CE"})),F=[...A,..._],P=async(e,s)=>{let t=a.filter(s=>s.provider===e);c(t=>t.map(t=>t.provider===e?{...t,isActive:s}:t)),await Promise.allSettled(t.map(e=>fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:s})})))},D=async()=>{let e=x[t]||`${t}-combo`,s=e,i=1,n=new Set(g.map(e=>e.name));for(;n.has(s);)s=`${e}-${i++}`;let a=await fetch("/api/combos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s,models:[],kind:t})});if(a.ok){let e=await a.json();o.push(`/dashboard/media-providers/combo/${e.id}`)}else alert((await a.json()).error||"Failed to create combo")};return(0,i.jsxs)("div",{className:"flex flex-col gap-6",children:[($||E||T||z)&&(0,i.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[z&&(0,i.jsx)(l.$n,{size:"sm",icon:"add",onClick:D,children:"Create Combo"}),$&&(0,i.jsx)(l.$n,{size:"sm",icon:"add",onClick:()=>y(!0),children:"Add Custom Embedding"}),E&&(0,i.jsx)(l.$n,{size:"sm",icon:"add",onClick:()=>N(!0),children:"Add Custom STT"}),T&&(0,i.jsx)(l.$n,{size:"sm",icon:"add",onClick:()=>w(!0),children:"Add Custom TTS"})]}),z&&O.length>0&&(0,i.jsx)(u,{combos:O}),0===F.length?(0,i.jsxs)("div",{className:"text-center py-12 border border-dashed border-border rounded-xl text-text-muted text-sm",children:["No providers support ",(0,i.jsx)("strong",{children:S.label})," yet."]}):(0,i.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:[A.map(e=>(0,i.jsx)(p,{provider:e,kind:t,connections:a,onToggle:P},e.id)),_.map(e=>(0,i.jsx)(p,{provider:e,kind:t,connections:a,isCustom:!0,onToggle:P},e.id))]}),$&&(0,i.jsx)(l.Jz,{isOpen:v,onClose:()=>y(!1),onSaved:e=>{j(s=>[...s,e]),y(!1)}}),E&&(0,i.jsx)(l.F8,{isOpen:C,onClose:()=>N(!1),onCreated:e=>{j(s=>[...s,e]),N(!1)}}),T&&(0,i.jsx)(l.b1,{isOpen:k,onClose:()=>w(!1),onCreated:e=>{j(s=>[...s,e]),w(!1)}})]})}},78521:(e,s,t)=>{Promise.resolve().then(t.bind(t,32239))}},e=>{e.O(0,[6373,3862,8500,506,9959,7050,5564,5263,7033,5497,8441,3794,7358],()=>e(e.s=78521)),_N_E=e.O()}]);