zevairouter 1.0.145 → 1.0.146

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 (321) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/cli/app/.next-cli-build/BUILD_ID +1 -1
  3. package/cli/app/.next-cli-build/app-path-routes-manifest.json +4 -4
  4. package/cli/app/.next-cli-build/build-manifest.json +2 -2
  5. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/automation/page_client-reference-manifest.js +1 -1
  6. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
  7. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
  8. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
  9. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  10. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
  11. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/context/page_client-reference-manifest.js +1 -1
  12. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  13. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  14. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  15. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
  16. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
  17. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
  18. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  19. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page_client-reference-manifest.js +1 -1
  20. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
  21. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  22. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  23. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
  24. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  25. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
  26. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
  27. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  28. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/terminal/page_client-reference-manifest.js +1 -1
  29. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
  30. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
  31. package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  32. package/cli/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
  33. package/cli/app/.next-cli-build/server/app/_global-error.html +1 -1
  34. package/cli/app/.next-cli-build/server/app/_global-error.rsc +1 -1
  35. package/cli/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
  36. package/cli/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  37. package/cli/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  38. package/cli/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
  39. package/cli/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
  40. package/cli/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  41. package/cli/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
  42. package/cli/app/.next-cli-build/server/app/_not-found.html +1 -1
  43. package/cli/app/.next-cli-build/server/app/_not-found.rsc +4 -4
  44. package/cli/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +4 -4
  45. package/cli/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
  46. package/cli/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +4 -4
  47. package/cli/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  48. package/cli/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  49. package/cli/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  50. package/cli/app/.next-cli-build/server/app/api/models/route.js +1 -1
  51. package/cli/app/.next-cli-build/server/app/api/providers/route.js +1 -1
  52. package/cli/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
  53. package/cli/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
  54. package/cli/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
  55. package/cli/app/.next-cli-build/server/app/api/version/route.js +1 -1
  56. package/cli/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
  57. package/cli/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
  58. package/cli/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
  59. package/cli/app/.next-cli-build/server/app/callback.html +1 -1
  60. package/cli/app/.next-cli-build/server/app/callback.rsc +4 -4
  61. package/cli/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +4 -4
  62. package/cli/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
  63. package/cli/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +4 -4
  64. package/cli/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +2 -2
  65. package/cli/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
  66. package/cli/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
  67. package/cli/app/.next-cli-build/server/app/dashboard/automation.html +1 -1
  68. package/cli/app/.next-cli-build/server/app/dashboard/automation.rsc +6 -6
  69. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard/automation/__PAGE__.segment.rsc +2 -2
  70. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard/automation.segment.rsc +1 -1
  71. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  72. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  73. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_full.segment.rsc +6 -6
  74. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_head.segment.rsc +1 -1
  75. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_index.segment.rsc +4 -4
  76. package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_tree.segment.rsc +2 -2
  77. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
  78. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +6 -6
  79. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
  80. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
  81. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  82. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  83. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +6 -6
  84. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
  85. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_index.segment.rsc +4 -4
  86. package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -2
  87. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
  88. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +6 -6
  89. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
  90. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
  91. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  92. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  93. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +6 -6
  94. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
  95. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_index.segment.rsc +4 -4
  96. package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
  97. package/cli/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
  98. package/cli/app/.next-cli-build/server/app/dashboard/combos.rsc +6 -6
  99. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
  100. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
  101. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  102. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  103. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +6 -6
  104. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
  105. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_index.segment.rsc +4 -4
  106. package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
  107. package/cli/app/.next-cli-build/server/app/dashboard/context.html +1 -1
  108. package/cli/app/.next-cli-build/server/app/dashboard/context.rsc +6 -6
  109. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard/context/__PAGE__.segment.rsc +2 -2
  110. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard/context.segment.rsc +1 -1
  111. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  112. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  113. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_full.segment.rsc +6 -6
  114. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_head.segment.rsc +1 -1
  115. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_index.segment.rsc +4 -4
  116. package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_tree.segment.rsc +2 -2
  117. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
  118. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.rsc +6 -6
  119. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
  120. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
  121. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  122. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  123. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +6 -6
  124. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
  125. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_index.segment.rsc +4 -4
  126. package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
  127. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
  128. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +6 -6
  129. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
  130. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
  131. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
  132. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  133. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  134. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +6 -6
  135. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
  136. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +4 -4
  137. package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -2
  138. package/cli/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
  139. package/cli/app/.next-cli-build/server/app/dashboard/mitm.rsc +6 -6
  140. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
  141. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
  142. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  143. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  144. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +6 -6
  145. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
  146. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_index.segment.rsc +4 -4
  147. package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
  148. package/cli/app/.next-cli-build/server/app/dashboard/playground.html +1 -1
  149. package/cli/app/.next-cli-build/server/app/dashboard/playground.rsc +6 -6
  150. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard/playground/__PAGE__.segment.rsc +2 -2
  151. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard/playground.segment.rsc +1 -1
  152. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  153. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  154. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_full.segment.rsc +6 -6
  155. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_head.segment.rsc +1 -1
  156. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_index.segment.rsc +4 -4
  157. package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_tree.segment.rsc +2 -2
  158. package/cli/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
  159. package/cli/app/.next-cli-build/server/app/dashboard/profile.rsc +6 -6
  160. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
  161. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
  162. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  163. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  164. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +6 -6
  165. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
  166. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_index.segment.rsc +4 -4
  167. package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
  168. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
  169. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.rsc +6 -6
  170. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
  171. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
  172. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  173. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  174. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  175. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +6 -6
  176. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
  177. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_index.segment.rsc +4 -4
  178. package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
  179. package/cli/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
  180. package/cli/app/.next-cli-build/server/app/dashboard/providers.rsc +6 -6
  181. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
  182. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
  183. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  184. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  185. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +6 -6
  186. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
  187. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_index.segment.rsc +4 -4
  188. package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
  189. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
  190. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +6 -6
  191. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
  192. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
  193. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  194. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  195. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +6 -6
  196. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
  197. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +4 -4
  198. package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
  199. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
  200. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +6 -6
  201. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +2 -2
  202. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe.segment.rsc +1 -1
  203. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  204. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  205. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +6 -6
  206. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_head.segment.rsc +1 -1
  207. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_index.segment.rsc +4 -4
  208. package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +2 -2
  209. package/cli/app/.next-cli-build/server/app/dashboard/quota.html +2 -2
  210. package/cli/app/.next-cli-build/server/app/dashboard/quota.rsc +7 -7
  211. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
  212. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
  213. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  214. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  215. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +7 -7
  216. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
  217. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_index.segment.rsc +4 -4
  218. package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
  219. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  220. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
  221. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +4 -4
  222. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +4 -4
  223. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
  224. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +4 -4
  225. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
  226. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
  227. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
  228. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
  229. package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
  230. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
  231. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.rsc +6 -6
  232. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +2 -2
  233. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver.segment.rsc +1 -1
  234. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  235. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  236. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +6 -6
  237. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_head.segment.rsc +1 -1
  238. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_index.segment.rsc +4 -4
  239. package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +2 -2
  240. package/cli/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
  241. package/cli/app/.next-cli-build/server/app/dashboard/translator.rsc +6 -6
  242. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
  243. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
  244. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  245. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  246. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +6 -6
  247. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
  248. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_index.segment.rsc +4 -4
  249. package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
  250. package/cli/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
  251. package/cli/app/.next-cli-build/server/app/dashboard/usage.rsc +6 -6
  252. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
  253. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
  254. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  255. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  256. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +6 -6
  257. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
  258. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_index.segment.rsc +4 -4
  259. package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
  260. package/cli/app/.next-cli-build/server/app/dashboard.html +1 -1
  261. package/cli/app/.next-cli-build/server/app/dashboard.rsc +6 -6
  262. package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
  263. package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
  264. package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
  265. package/cli/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +6 -6
  266. package/cli/app/.next-cli-build/server/app/dashboard.segments/_head.segment.rsc +1 -1
  267. package/cli/app/.next-cli-build/server/app/dashboard.segments/_index.segment.rsc +4 -4
  268. package/cli/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +2 -2
  269. package/cli/app/.next-cli-build/server/app/index.html +1 -1
  270. package/cli/app/.next-cli-build/server/app/index.rsc +4 -4
  271. package/cli/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  272. package/cli/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +4 -4
  273. package/cli/app/.next-cli-build/server/app/index.segments/_head.segment.rsc +1 -1
  274. package/cli/app/.next-cli-build/server/app/index.segments/_index.segment.rsc +4 -4
  275. package/cli/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -2
  276. package/cli/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
  277. package/cli/app/.next-cli-build/server/app/landing.html +1 -1
  278. package/cli/app/.next-cli-build/server/app/landing.rsc +5 -5
  279. package/cli/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +5 -5
  280. package/cli/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
  281. package/cli/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +4 -4
  282. package/cli/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +2 -2
  283. package/cli/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +2 -2
  284. package/cli/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
  285. package/cli/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
  286. package/cli/app/.next-cli-build/server/app/login.html +1 -1
  287. package/cli/app/.next-cli-build/server/app/login.rsc +5 -5
  288. package/cli/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +5 -5
  289. package/cli/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
  290. package/cli/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +4 -4
  291. package/cli/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +2 -2
  292. package/cli/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  293. package/cli/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
  294. package/cli/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
  295. package/cli/app/.next-cli-build/server/app-paths-manifest.json +4 -4
  296. package/cli/app/.next-cli-build/server/chunks/3155.js +1 -1
  297. package/cli/app/.next-cli-build/server/chunks/412.js +1 -1
  298. package/cli/app/.next-cli-build/server/chunks/4746.js +1 -1
  299. package/cli/app/.next-cli-build/server/chunks/5307.js +1 -1
  300. package/cli/app/.next-cli-build/server/chunks/8306.js +1 -1
  301. package/cli/app/.next-cli-build/server/chunks/9621.js +1 -1
  302. package/cli/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
  303. package/cli/app/.next-cli-build/server/pages/404.html +1 -1
  304. package/cli/app/.next-cli-build/server/pages/500.html +1 -1
  305. package/cli/app/.next-cli-build/static/chunks/5497-7f6609cd427c6525.js +7 -0
  306. package/cli/app/.next-cli-build/static/chunks/{620-b21eb963d0189283.js → 620-cc65df39cb93df1c.js} +1 -1
  307. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-847b19cd29966941.js +1 -0
  308. package/cli/app/.next-cli-build/static/css/1472cd17dfd55a13.css +1 -0
  309. package/cli/app/CHANGELOG.md +7 -0
  310. package/cli/app/package.json +1 -1
  311. package/cli/package.json +1 -1
  312. package/package.json +1 -1
  313. package/src/app/(dashboard)/dashboard/providers/page.js +71 -145
  314. package/src/app/(dashboard)/dashboard/usage/components/OverviewCards.js +11 -17
  315. package/src/app/(dashboard)/dashboard/usage/components/ProviderTopology.js +22 -22
  316. package/src/shared/components/UsageStats.js +3 -3
  317. package/cli/app/.next-cli-build/static/chunks/5497-276ef7bcaaa911b7.js +0 -7
  318. package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/page-2cedde97aaf3c729.js +0 -1
  319. package/cli/app/.next-cli-build/static/css/b912482d9fc0b2ed.css +0 -1
  320. /package/cli/app/.next-cli-build/static/{x2eyEbk18Mgl67fqRmEFx → DeFI037NxtdV4EpLD2ihz}/_buildManifest.js +0 -0
  321. /package/cli/app/.next-cli-build/static/{x2eyEbk18Mgl67fqRmEFx → DeFI037NxtdV4EpLD2ihz}/_ssgManifest.js +0 -0
@@ -4,4 +4,4 @@
4
4
  `,children:[s.includes(a.name)&&(0,d.jsx)("span",{className:"material-symbols-outlined leading-none",style:{fontSize:"10px"},children:"check"}),a.name]},a.id)})})]}),Object.entries(I).map(([a,b])=>(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 sticky top-0 bg-surface py-0.5",children:[(0,d.jsx)(i.A,{src:`/providers/${a}.png`,alt:b.name,size:14,fallbackText:(b.name||a).slice(0,2).toUpperCase(),fallbackColor:b.color}),(0,d.jsx)("span",{className:"text-xs font-medium text-primary",children:b.name}),(0,d.jsxs)("span",{className:"text-[10px] text-text-muted",children:["(",b.models.length,")"]})]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:b.models.map(a=>{let b=g===a.value,c=a.isPlaceholder;return(0,d.jsx)("button",{onClick:()=>J(a),title:c?"Select to pre-fill, then edit model ID in the input":void 0,className:`
5
5
  px-2 py-1 rounded-xl text-xs font-medium transition-all border hover:cursor-pointer
6
6
  ${c?"border-dashed border-border text-text-muted hover:border-primary/50 hover:text-primary bg-surface italic":b?"bg-primary text-white border-primary":s.includes(a.value)?"bg-primary border-primary text-white hover:bg-primary-hover":"bg-surface border-border text-text-main hover:border-primary/50 hover:bg-primary/5"}
7
- `,children:(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[s.includes(a.value)&&!c&&(0,d.jsx)("span",{className:"material-symbols-outlined leading-none",style:{fontSize:"10px"},children:"check"}),c?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[11px]",children:"edit"}),a.name]}):a.isCustom?(0,d.jsxs)(d.Fragment,{children:[a.name,(0,d.jsx)("span",{className:"text-[9px] opacity-60 font-normal",children:"custom"})]}):a.name]})},a.value)})})]},a)),0===Object.keys(I).length&&0===H.length&&(0,d.jsxs)("div",{className:"text-center py-4 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-2xl mb-1 block",children:"search_off"}),(0,d.jsx)("p",{className:"text-xs",children:"No models found"})]})]})]})}n.propTypes={isOpen:g().bool.isRequired,onClose:g().func.isRequired,onSelect:g().func.isRequired,onDeselect:g().func,selectedModel:g().string,activeProviders:g().arrayOf(g().shape({provider:g().string.isRequired})),title:g().string,modelAliases:g().object,kindFilter:g().string,addedModelValues:g().arrayOf(g().string),closeOnSelect:g().bool}},83552:(a,b,c)=>{c.d(b,{default:()=>g});var d=c(48249),e=c(67484),f=c(71404);function g({label:a,type:b="text",placeholder:c,value:h,onChange:i,error:j,hint:k,icon:l,disabled:m=!1,required:n=!1,className:o,inputClassName:p,...q}){let r=(0,e.useId)(),s=q.id||r,t=`${s}-error`,u=`${s}-hint`,v=[q["aria-describedby"],j&&t,k&&u].filter(Boolean).join(" ")||void 0;return(0,d.jsxs)("div",{className:(0,f.cn)("flex flex-col gap-1.5",o),children:[a&&(0,d.jsxs)("label",{htmlFor:s,className:"text-sm font-medium text-text-main",children:[a,n&&(0,d.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,d.jsxs)("div",{className:"relative",children:[l&&(0,d.jsx)("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-text-muted",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:l})}),(0,d.jsx)("input",{id:s,type:b,placeholder:c,value:h,onChange:i,disabled:m,required:n,"aria-invalid":!!j||void 0,"aria-describedby":v,className:(0,f.cn)("w-full py-2.5 px-3 text-sm text-text-main bg-surface-2 rounded-[10px]","border border-transparent placeholder-text-muted/70","focus:outline-none focus:ring-2 focus:ring-brand-500/30 focus:border-brand-500/40","transition-all duration-150 ease-out disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",l&&"pl-10",j&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",p),...q})]}),j&&(0,d.jsxs)("p",{id:t,role:"alert",className:"text-xs text-red-500 flex items-center gap-1",children:[(0,d.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[14px]",children:"error"}),j]}),k&&!j&&(0,d.jsx)("p",{id:u,className:"text-xs text-text-muted",children:k})]})}},85158:(a,b,c)=>{c.d(b,{default:()=>g});var d=c(48249),e=c(71404),f=c(99070);function g({currentPage:a,pageSize:b,totalItems:c,onPageChange:h,onPageSizeChange:i,className:j}){let k=Math.ceil(c/b),l=c>0?(a-1)*b+1:0,m=Math.min(a*b,c),n=(()=>{let b=[],c=Math.max(1,a-2),d=Math.min(k,c+5-1);d-c+1<5&&(c=Math.max(1,d-5+1));for(let a=c;a<=d;a++)b.push(a);return b})();return(0,d.jsxs)("div",{className:(0,e.cn)("flex flex-col sm:flex-row items-center justify-between gap-4 py-4 px-2",j),children:[c>0&&(0,d.jsxs)("div",{className:"text-sm text-text-muted",children:["Showing ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:l})," to"," ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:m})," of"," ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:c})," results"]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-2 sm:gap-4",children:[i&&(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-sm text-text-muted",children:"Rows:"}),(0,d.jsx)("select",{value:b,onChange:a=>i(Number(a.target.value)),className:(0,e.cn)("h-9 rounded-lg border border-black/10 dark:border-white/10 bg-surface","text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20","cursor-pointer"),style:{colorScheme:"auto"},children:[10,20,50].map(a=>(0,d.jsx)("option",{value:a,children:a},a))})]}),k>1&&(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)(f.default,{variant:"outline",size:"sm",onClick:()=>h(a-1),disabled:1===a,className:"w-9 px-0",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_left"})}),n[0]>1&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.default,{variant:"ghost",size:"sm",onClick:()=>h(1),className:"w-9 px-0 hidden sm:inline-flex",children:"1"}),n[0]>2&&(0,d.jsx)("span",{className:"text-text-muted px-1 hidden sm:inline",children:"..."})]}),n.map(b=>(0,d.jsx)(f.default,{variant:a===b?"primary":"ghost",size:"sm",onClick:()=>h(b),className:(0,e.cn)("w-9 px-0",a===b?"inline-flex":"hidden sm:inline-flex"),children:b},b)),n[n.length-1]<k&&(0,d.jsxs)(d.Fragment,{children:[n[n.length-1]<k-1&&(0,d.jsx)("span",{className:"text-text-muted px-1 hidden sm:inline",children:"..."}),(0,d.jsx)(f.default,{variant:"ghost",size:"sm",onClick:()=>h(k),className:"w-9 px-0 hidden sm:inline-flex",children:k})]}),(0,d.jsx)(f.default,{variant:"outline",size:"sm",onClick:()=>h(a+1),disabled:a===k,className:"w-9 px-0",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_right"})})]})]})]})}},85306:(a,b,c)=>{c.d(b,{default:()=>j});var d=c(48249),e=c(67484),f=c(19099),g=c(41371),h=c(42196),i=c(32456);function j({children:a}){let[b,c]=(0,e.useState)(!1),k=(0,f.usePathname)(),l=(0,g.i)(a=>a.notifications),m=(0,g.i)(a=>a.removeNotification),n="/dashboard/playground"===k||"/dashboard/basic-chat"===k,o="/dashboard/terminal"===k,p=n||o;return(0,d.jsxs)("div",{className:"flex h-screen w-full overflow-hidden bg-bg",children:[(0,d.jsx)("a",{href:"#main-content",className:"sr-only focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-[100] focus:rounded-lg focus:bg-surface focus:px-4 focus:py-2 focus:text-text-main focus:shadow-lg",children:"Skip to main content"}),(0,d.jsx)("div",{className:"fixed top-4 right-4 z-[80] flex w-[min(92vw,380px)] flex-col gap-2",children:l.map(a=>{var b;let c="success"===(b=a.type)?{wrapper:"border-green-500/30 bg-green-500/10 text-green-600 dark:text-green-400",icon:"check_circle"}:"error"===b?{wrapper:"border-red-500/30 bg-red-500/10 text-red-600 dark:text-red-400",icon:"error"}:"warning"===b?{wrapper:"border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400",icon:"warning"}:{wrapper:"border-blue-500/30 bg-blue-500/10 text-blue-600 dark:text-blue-400",icon:"info"};return(0,d.jsx)("div",{className:`rounded-lg border px-3 py-2 shadow-lg backdrop-blur-sm ${c.wrapper}`,children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] leading-5",children:c.icon}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[a.title?(0,d.jsx)("p",{className:"text-xs font-semibold mb-0.5",children:a.title}):null,(0,d.jsx)("p",{className:"text-xs whitespace-pre-wrap break-words",children:a.message})]}),a.dismissible?(0,d.jsx)("button",{type:"button",onClick:()=>m(a.id),className:"text-current/70 hover:text-current","aria-label":"Dismiss notification",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})}):null]})},a.id)})}),b&&(0,d.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20 lg:hidden",onClick:()=>c(!1)}),(0,d.jsx)("div",{className:"hidden lg:flex",children:(0,d.jsx)(h.default,{})}),(0,d.jsx)("div",{className:`fixed inset-y-0 left-0 z-50 transform lg:hidden transition-transform duration-300 ease-in-out ${b?"translate-x-0":"-translate-x-full"}`,children:(0,d.jsx)(h.default,{onClose:()=>c(!1)})}),(0,d.jsxs)("main",{id:"main-content",tabIndex:-1,className:"flex flex-col flex-1 h-full min-w-0 relative transition-colors duration-300 isolate",children:[(0,d.jsx)("div",{className:"landing-grid absolute inset-0 pointer-events-none -z-10","aria-hidden":"true"}),p?(0,d.jsxs)("div",{className:"lg:hidden shrink-0 flex min-h-12 items-center gap-2 px-2 py-1 border-b border-border-subtle bg-surface/60",children:[(0,d.jsx)("button",{type:"button",onClick:()=>c(!0),className:"flex size-11 shrink-0 items-center justify-center rounded-lg text-text-main hover:bg-surface-2","aria-label":"Open dashboard navigation",children:(0,d.jsx)("span",{className:"material-symbols-outlined",children:"menu"})}),(0,d.jsx)("span",{className:"text-sm font-semibold",children:o?"Terminal":"Playground"})]}):(0,d.jsx)(i.default,{onMenuClick:()=>c(!0)},k),(0,d.jsx)("div",{className:`flex-1 overflow-y-auto custom-scrollbar ${p?"":"px-3 py-4 sm:px-6 sm:py-7 lg:px-10 lg:py-8"} ${p?"flex flex-col overflow-hidden":""}`,children:(0,d.jsx)("div",{className:`${p?"flex-1 w-full h-full flex flex-col min-h-0":"w-full min-w-0 max-w-6xl mx-auto"}`,children:a})})]})]})}},86209:(a,b,c)=>{c.d(b,{default:()=>n});var d=c(48249),e=c(67484),f=c(81220),g=c(49885),h=c.n(g),i=c(50412);function j(a){return["completed","cancelled","failed"].includes(a)}function k(a){return a?a.replaceAll("_"," "):"waiting"}function l(a){if(!a)return"--:--:--";try{return new Date(a).toLocaleTimeString("id-ID",{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return a}}function m({status:a}){let b={queued:"bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-200",running:"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300",success:"bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300",failed:"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300",failed_invalid_credentials:"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300",failed_exchange:"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300",failed_timeout:"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300",needs_manual:"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",cancelled:"bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-200"};return(0,d.jsx)("span",{className:`rounded-full px-2 py-1 text-[11px] font-medium ${b[a]||b.queued}`,children:a.replaceAll("_"," ")})}function n({isOpen:a,onMethodSelect:b,onImportSuccess:c,onClose:g,initialJobId:h,initialSelectedMethod:o,initialImportMode:p,initialFlowKey:q,onBulkJobChange:r}){let[s,t]=(0,e.useState)(null),[u,v]=(0,e.useState)(""),[w,x]=(0,e.useState)("us-east-1"),[y,z]=(0,e.useState)(""),[A,B]=(0,e.useState)("single-token"),[C,D]=(0,e.useState)(""),[E,F]=(0,e.useState)(String(4)),[G,H]=(0,e.useState)(null),[I,J]=(0,e.useState)(null),[K,L]=(0,e.useState)(null),[M,N]=(0,e.useState)(null),[O,P]=(0,e.useState)(!1),[Q,R]=(0,e.useState)(!1),[S,T]=(0,e.useState)(!1),U=(0,e.useRef)(new Set),V=(0,e.useRef)(0),W=a&&h||null,X=s||(W?"import":null),Y="import"===X&&W&&!s?"bulk-account":A,Z="bulk-account"===Y&&I&&!j(I.status),$="bulk-account"===Y&&I&&j(I.status),_=(0,e.useMemo)(()=>I?.summary?[["Total",I.summary.total],["Queued",I.summary.queued],["Running",I.summary.running],["Success",I.summary.success],["Failed",I.summary.failed],["Manual",I.summary.needs_manual]]:[],[I]),aa=(0,e.useMemo)(()=>Array.isArray(I?.activity)?[...I.activity].reverse():[],[I]),ab=(0,e.useMemo)(()=>(function(a=[]){let b=new Map;return a.forEach(a=>{let c=a.status||"queued";b.has(c)||b.set(c,[]),b.get(c).push(a)}),["running","queued","needs_manual","success","failed","failed_invalid_credentials","failed_exchange","failed_timeout","cancelled"].filter(a=>b.has(a)).map(a=>({status:a,accounts:b.get(a)}))})(I?.accounts||[]),[I]),ac=(0,e.useMemo)(()=>I?.accounts?.length?I.accounts.find(a=>"running"===a.status)||I.accounts.find(a=>"needs_manual"===a.status)||I.accounts.find(a=>"success"===a.status)||I.accounts[0]:null,[I]),ad=a=>{t(a),L(null)},ae=()=>{z(""),D(""),H(null),F(String(4)),L(null),N(null),T(!1),J(null),V.current=0,r?.(null)},af=()=>{Z?g?.():(t(null),B("single-token"),ae())},ag=async()=>{if(!y.trim())return void L("Please enter a refresh token");P(!0),L(null);try{let a=await fetch("/api/oauth/kiro/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"token",refreshToken:y.trim()})}),b=await a.json();if(!a.ok)throw Error(b.error||"Import failed");c?.()}catch(a){L(a.message)}finally{P(!1)}},ah=async a=>{let b=await fetch("/api/oauth/kiro/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"token",refreshTokens:a})}),d=await b.json();if(!b.ok)throw Error(d.error||"Bulk import failed");H({success:d.imported||0,failed:d.failed||0}),c?.()},ai=async a=>{let b=await fetch("/api/oauth/kiro/bulk-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accounts:a,concurrency:Number.parseInt(E,10)||4})}),c=await b.json();if(!b.ok){let a=Array.isArray(c.invalidLines)&&c.invalidLines.length>0?` Invalid lines: ${c.invalidLines.join(", ")}`:"";throw Error((c.error||"Bulk account import failed")+a)}J(c.job||null),N(null),c.job?.jobId&&U.current.delete(c.job.jobId),H(null)},aj=async()=>{let a=C.split("\n").map(a=>a.trim()).filter(Boolean);if(!a.length)return void L("bulk-account"===Y?"Please enter at least one gmail|password line":"Please enter at least one refresh token line");P(!0),L(null),H(null);try{"bulk-account"===Y?await ai(a):await ah(a)}catch(a){L(a.message)}finally{P(!1)}},ak=async()=>{if(I?.jobId)try{let a=await fetch(`/api/oauth/kiro/bulk-import/${I.jobId}/cancel`,{method:"POST"}),b=await a.json();if(!a.ok)throw Error(b.error||"Failed to cancel job");b.job&&J(b.job)}catch(a){L(a.message)}},al=()=>{ae(),c?.()},am=async a=>{if(I?.jobId&&a)try{let b=await fetch(`/api/oauth/kiro/bulk-import/${I.jobId}/manual/${a}`,{method:"POST"}),c=await b.json();if(!b.ok)throw Error(c.error||"Failed to open manual session");c.job&&J(c.job)}catch(a){L(a.message)}},an=a=>{b("social",{provider:a})};return(0,d.jsx)(i.aF,{isOpen:a,title:"Connect Kiro",onClose:g,size:"full",className:"max-w-[min(96vw,1540px)]",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[!X&&(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)("p",{className:"mb-4 text-sm text-text-muted",children:"Choose your authentication method:"}),(0,d.jsx)("button",{onClick:()=>b("builder-id"),className:"w-full rounded-lg border border-border p-4 text-left transition-colors hover:bg-sidebar",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined mt-0.5 text-primary",children:"shield"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"mb-1 font-semibold",children:"AWS Builder ID"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Recommended for most users. Free AWS account required."})]})]})}),(0,d.jsx)("button",{onClick:()=>ad("idc"),className:"w-full rounded-lg border border-border p-4 text-left transition-colors hover:bg-sidebar",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined mt-0.5 text-primary",children:"business"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"mb-1 font-semibold",children:"AWS IAM Identity Center"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"For enterprise users with custom AWS IAM Identity Center."})]})]})}),(0,d.jsx)("button",{onClick:()=>ad("social-google"),className:"hidden w-full rounded-lg border border-border p-4 text-left transition-colors hover:bg-sidebar",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined mt-0.5 text-primary",children:"account_circle"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"mb-1 font-semibold",children:"Google Account"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your Google account (manual callback)."})]})]})}),(0,d.jsx)("button",{onClick:()=>ad("social-github"),className:"hidden w-full rounded-lg border border-border p-4 text-left transition-colors hover:bg-sidebar",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined mt-0.5 text-primary",children:"code"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"mb-1 font-semibold",children:"GitHub Account"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your GitHub account (manual callback)."})]})]})}),(0,d.jsx)("button",{onClick:()=>ad("import"),className:"w-full rounded-lg border border-border p-4 text-left transition-colors hover:bg-sidebar",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined mt-0.5 text-primary",children:"file_upload"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"mb-1 font-semibold",children:"Bulk Option"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Import a single token, bulk tokens, or bulk Google accounts."})]})]})})]}),"idc"===X&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"mb-2 block text-sm font-medium",children:["IDC Start URL ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)(i.pd,{value:u,onChange:a=>v(a.target.value),placeholder:"https://your-org.awsapps.com/start",className:"font-mono text-sm"}),(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Your organization's AWS IAM Identity Center URL"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"mb-2 block text-sm font-medium",children:"AWS Region"}),(0,d.jsx)(i.pd,{value:w,onChange:a=>x(a.target.value),placeholder:"us-east-1",className:"font-mono text-sm"}),(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"AWS region for your Identity Center (default: us-east-1)"})]}),K&&(0,d.jsx)("p",{className:"text-sm text-red-600",children:K}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:()=>{u.trim()?b("idc",{startUrl:u.trim(),region:w}):L("Please enter your IDC start URL")},fullWidth:!0,children:"Continue"}),(0,d.jsx)(i.$n,{onClick:af,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-google"===X&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-4 dark:border-amber-800 dark:bg-amber-900/20",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,d.jsxs)("div",{className:"flex-1 text-sm",children:[(0,d.jsx)("p",{className:"mb-1 font-medium text-amber-900 dark:text-amber-100",children:"Manual Callback Required"}),(0,d.jsx)("p",{className:"text-amber-800 dark:text-amber-200",children:"After login, you'll need to copy the callback URL from your browser and paste it back here."})]})]})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:()=>an("google"),fullWidth:!0,children:"Continue with Google"}),(0,d.jsx)(i.$n,{onClick:af,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-github"===X&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-4 dark:border-amber-800 dark:bg-amber-900/20",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,d.jsxs)("div",{className:"flex-1 text-sm",children:[(0,d.jsx)("p",{className:"mb-1 font-medium text-amber-900 dark:text-amber-100",children:"Manual Callback Required"}),(0,d.jsx)("p",{className:"text-amber-800 dark:text-amber-200",children:"After login, you'll need to copy the callback URL from your browser and paste it back here."})]})]})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:()=>an("github"),fullWidth:!0,children:"Continue with GitHub"}),(0,d.jsx)(i.$n,{onClick:af,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"import"===X&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsx)(i.$n,{size:"sm",variant:"single-token"===Y?"primary":"ghost",onClick:()=>{B("single-token"),H(null),L(null)},disabled:Z,children:"Single Token"}),(0,d.jsx)(i.$n,{size:"sm",variant:"bulk-token"===Y?"primary":"ghost",onClick:()=>{B("bulk-token"),H(null),L(null)},disabled:Z,children:"Bulk Token"}),(0,d.jsx)(i.$n,{size:"sm",variant:"bulk-account"===Y?"primary":"ghost",onClick:()=>{B("bulk-account"),H(null),L(null)},children:"Bulk Account"})]}),"single-token"===Y&&(0,d.jsxs)(d.Fragment,{children:[Q&&(0,d.jsxs)("div",{className:"py-6 text-center",children:[(0,d.jsx)("div",{className:"mx-auto mb-4 flex size-16 items-center justify-center rounded-full bg-primary/10",children:(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-3xl text-primary",children:"progress_activity"})}),(0,d.jsx)("h3",{className:"mb-2 text-lg font-semibold",children:"Auto-detecting token..."}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from AWS SSO cache"})]}),!Q&&(0,d.jsxs)(d.Fragment,{children:[S&&(0,d.jsx)("div",{className:"rounded-lg border border-green-200 bg-green-50 p-3 dark:border-green-800 dark:bg-green-900/20",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,d.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Token auto-detected from Kiro IDE successfully!"})]})}),!S&&!K&&(0,d.jsx)("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-800 dark:bg-blue-900/20",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Kiro IDE not detected. Please paste your refresh token manually."})]})}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"mb-2 block text-sm font-medium",children:["Refresh Token ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)(i.pd,{value:y,onChange:a=>z(a.target.value),placeholder:"Token will be auto-filled...",className:"font-mono text-sm"})]}),K&&(0,d.jsx)("div",{className:"rounded-lg border border-red-200 bg-red-50 p-3 dark:border-red-800 dark:bg-red-900/20",children:(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:K})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:ag,fullWidth:!0,disabled:O||!y.trim(),children:O?"Importing...":"Import Token"}),(0,d.jsx)(i.$n,{onClick:af,variant:"ghost",fullWidth:!0,children:"Back"})]})]})]}),"bulk-token"===Y&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-800 dark:bg-blue-900/20",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Bulk token import accepts one refresh token per line."})]})}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"mb-2 block text-sm font-medium",children:["Bulk Refresh Tokens ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)("textarea",{value:C,onChange:a=>D(a.target.value),placeholder:"aorAAAAAG...\naorAAAAAG...",className:"min-h-[160px] w-full resize-y rounded-lg border border-border bg-background px-3 py-2 font-mono text-sm focus:outline-none focus:ring-1 focus:ring-primary"}),(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"One refresh token per line."})]}),G&&(0,d.jsx)("div",{className:`text-sm font-medium ${G.failed>0?"text-yellow-600 dark:text-yellow-400":"text-green-600 dark:text-green-400"}`,children:`Success: ${G.success} imported${G.failed>0?`, ${G.failed} failed`:""}`}),K&&(0,d.jsx)("div",{className:"rounded-lg border border-red-200 bg-red-50 p-3 dark:border-red-800 dark:bg-red-900/20",children:(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:K})}),M&&(0,d.jsx)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-3 dark:border-amber-800 dark:bg-amber-900/20",children:(0,d.jsx)("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:M})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:aj,fullWidth:!0,disabled:O||!C.trim(),children:O?"Importing...":"Import Tokens"}),(0,d.jsx)(i.$n,{onClick:af,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"bulk-account"===Y&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-800 dark:bg-blue-900/20",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Bulk account import runs Playwright in the background, keeps passwords in memory only, and only needs manual action when Google or Kiro blocks a worker. Recommended worker count for a 24 GB machine: 4."})]})}),!I&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"mb-2 block text-sm font-medium",children:["Bulk Accounts ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)("textarea",{value:C,onChange:a=>D(a.target.value),placeholder:"gmail1@example.com|password1\ngmail2@example.com|password2",className:"min-h-[180px] w-full resize-y rounded-lg border border-border bg-background px-3 py-2 font-mono text-sm focus:outline-none focus:ring-1 focus:ring-primary"}),(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"One account per line in the format gmail|password."})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"mb-2 block text-sm font-medium",children:"Concurrent Workers"}),(0,d.jsx)(i.pd,{type:"number",min:"1",max:"8",value:E,onChange:a=>F(a.target.value),placeholder:"4"}),(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Default 4. Allowed range: 1 to 8 workers."})]})]}),I&&(0,d.jsxs)("div",{className:"space-y-4 rounded-xl border border-border p-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"font-semibold",children:"Bulk Import Job"}),(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Job ID: ",(0,d.jsx)("span",{className:"font-mono",children:I.jobId})]}),(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Status: ",(0,d.jsx)("span",{className:"font-medium",children:I.status})," | Workers: ",I.concurrency]}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Browser workers run in the background. Close this modal if needed and reopen it later from the provider page with Resume Bulk Progress."})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[Z&&(0,d.jsx)(i.$n,{size:"sm",variant:"secondary",onClick:ak,children:"Cancel Job"}),$&&(0,d.jsx)(i.$n,{size:"sm",onClick:al,children:"Done & Refresh"})]})]}),(0,d.jsx)("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:_.map(([a,b])=>(0,d.jsxs)("div",{className:"rounded-lg bg-sidebar px-3 py-2",children:[(0,d.jsx)("p",{className:"text-[11px] uppercase tracking-wide text-text-muted",children:a}),(0,d.jsx)("p",{className:"text-lg font-semibold",children:b})]},a))}),I.error&&(0,d.jsx)("div",{className:"rounded-lg border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:border-red-800 dark:bg-red-900/20 dark:text-red-300",children:I.error}),I.summary?.needs_manual>0&&(0,d.jsx)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-3 text-sm text-amber-800 dark:border-amber-800 dark:bg-amber-900/20 dark:text-amber-200",children:"Some accounts need manual assist. Open the blocked worker session below, finish the Google or Kiro prompts, and the job will continue updating automatically."}),(0,d.jsxs)("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,7fr)_minmax(320px,3fr)]",children:[(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{className:"overflow-hidden rounded-xl border border-border bg-sidebar",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2 border-b border-border px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-semibold",children:"Live Browser Preview"}),(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:[I.preview?.email||ac?.email||"Waiting for worker",I.preview?.workerId?` | Worker ${I.preview.workerId}`:""]})]}),(0,d.jsxs)("div",{className:"text-right text-xs text-text-muted",children:[(0,d.jsx)("p",{children:k(I.preview?.step||ac?.currentStep)}),(0,d.jsxs)("p",{children:["Updated ",l(I.preview?.updatedAt||ac?.updatedAt)]})]})]}),(0,d.jsx)("div",{className:"relative bg-black/90",children:I.preview?.imageData?(0,d.jsx)(f.default,{src:I.preview.imageData,alt:`Live worker preview for ${I.preview.email||"Kiro import"}`,width:1440,height:900,unoptimized:!0,className:"h-[420px] w-full object-contain"}):(0,d.jsxs)("div",{className:"flex h-[420px] flex-col items-center justify-center gap-3 px-6 text-center text-slate-200",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-5xl text-primary/80",children:"browser_updated"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-base font-medium",children:"Preview will appear when a worker opens Google or Kiro"}),(0,d.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"The import keeps running in the background even if the screenshot is not available yet."})]})]})})]}),(0,d.jsx)("div",{className:"space-y-4",children:ab.map(a=>{var b;let c;return(0,d.jsxs)("div",{className:`rounded-xl border p-4 ${(b=a.status,(c={queued:"border-slate-200 bg-slate-50/80 dark:border-slate-800 dark:bg-slate-900/20",running:"border-blue-200 bg-blue-50/80 dark:border-blue-900/50 dark:bg-blue-950/20",success:"border-green-200 bg-green-50/80 dark:border-green-900/50 dark:bg-green-950/20",failed:"border-red-200 bg-red-50/80 dark:border-red-900/50 dark:bg-red-950/20",failed_invalid_credentials:"border-red-200 bg-red-50/80 dark:border-red-900/50 dark:bg-red-950/20",failed_exchange:"border-red-200 bg-red-50/80 dark:border-red-900/50 dark:bg-red-950/20",failed_timeout:"border-red-200 bg-red-50/80 dark:border-red-900/50 dark:bg-red-950/20",needs_manual:"border-amber-200 bg-amber-50/80 dark:border-amber-900/50 dark:bg-amber-950/20",cancelled:"border-slate-200 bg-slate-50/80 dark:border-slate-800 dark:bg-slate-900/20"})[b]||c.queued)}`,children:[(0,d.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(m,{status:a.status}),(0,d.jsx)("p",{className:"text-sm font-semibold capitalize",children:k(a.status)})]}),(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:[a.accounts.length," account",a.accounts.length>1?"s":""]})]}),(0,d.jsx)("div",{className:"grid gap-3 xl:grid-cols-2",children:a.accounts.map(a=>(0,d.jsxs)("div",{className:"rounded-xl border border-border bg-background/80 p-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-sm font-semibold",children:a.email}),(0,d.jsxs)("p",{className:"text-[11px] text-text-muted",children:["Line ",a.line,a.workerId?` | Worker ${a.workerId}`:""," | ",l(a.updatedAt)]})]}),(0,d.jsx)(m,{status:a.status})]}),(0,d.jsxs)("div",{className:"mt-3 rounded-lg border border-border/70 bg-sidebar/70 px-3 py-2",children:[(0,d.jsx)("p",{className:"text-[11px] uppercase tracking-wide text-text-muted",children:"Current Step"}),(0,d.jsx)("p",{className:"mt-1 text-sm font-medium capitalize",children:k(a.currentStep)})]}),a.logs?.length>0&&(0,d.jsx)("div",{className:"mt-3 space-y-2",children:a.logs.slice(-3).reverse().map(a=>(0,d.jsxs)("div",{className:"rounded-lg bg-sidebar/60 px-3 py-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsx)("p",{className:"text-xs font-medium capitalize",children:k(a.step)}),(0,d.jsx)("span",{className:"text-[11px] text-text-muted",children:l(a.at)})]}),(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:a.message})]},a.id))}),a.error&&(0,d.jsx)("p",{className:"mt-3 text-xs text-red-500",children:a.error}),a.manualSessionAvailable&&a.workerId?(0,d.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,d.jsx)(i.$n,{size:"sm",variant:a.manualSessionOpened?"secondary":"primary",onClick:()=>am(a.workerId),children:a.manualSessionOpened?"Re-open Manual Session":"Open Manual Session"}),(0,d.jsx)("p",{className:"text-[11px] text-text-muted",children:"Open only if this worker is blocked by CAPTCHA, 2FA, or recovery prompts."})]}):null]},`${a.email}-${a.line}`))})]},a.status)})})]}),(0,d.jsxs)("div",{className:"rounded-xl border border-border bg-sidebar/70",children:[(0,d.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,d.jsx)("p",{className:"text-sm font-semibold",children:"Live Activity Log"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Every worker step is recorded here in near real time."})]}),(0,d.jsxs)("div",{className:"max-h-[720px] space-y-3 overflow-y-auto p-4",children:[0===aa.length&&(0,d.jsx)("div",{className:"rounded-lg bg-background/70 px-3 py-4 text-sm text-text-muted",children:"Waiting for the first worker event..."}),aa.map(a=>(0,d.jsxs)("div",{className:"rounded-lg border border-border/70 bg-background/80 px-3 py-3",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-sm font-semibold",children:a.email}),(0,d.jsxs)("p",{className:"text-[11px] text-text-muted",children:[a.workerId?`Worker ${a.workerId}`:"Waiting"," | ",k(a.step)]})]}),(0,d.jsx)("span",{className:"shrink-0 text-[11px] text-text-muted",children:l(a.at)})]}),(0,d.jsx)("p",{className:"mt-2 text-xs text-text-muted",children:a.message})]},a.id))]})]})]})]}),K&&(0,d.jsx)("div",{className:"rounded-lg border border-red-200 bg-red-50 p-3 dark:border-red-800 dark:bg-red-900/20",children:(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:K})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[!I&&(0,d.jsx)(i.$n,{onClick:aj,fullWidth:!0,disabled:O||!C.trim(),children:O?"Starting...":"Start Bulk Import"}),I&&!$&&(0,d.jsx)(i.$n,{onClick:ak,fullWidth:!0,variant:"secondary",disabled:!Z,children:Z?"Cancel Running Job":"Job Stopped"}),$&&(0,d.jsx)(i.$n,{onClick:al,fullWidth:!0,children:"Done & Refresh Connections"}),(0,d.jsx)(i.$n,{onClick:af,variant:"ghost",fullWidth:!0,children:I?"Back":"Cancel"})]})]})]})]})})}m.propTypes={status:h().string.isRequired},n.propTypes={isOpen:h().bool.isRequired,onMethodSelect:h().func.isRequired,onImportSuccess:h().func,initialJobId:h().string,initialSelectedMethod:h().string,initialImportMode:h().string,initialFlowKey:h().oneOfType([h().string,h().number]),onBulkJobChange:h().func,onClose:h().func.isRequired}},87226:(a,b,c)=>{c.d(b,{default:()=>W});var d=c(48249),e=c(67484),f=c(19099),g=c(96919),h=c(75171),i=c(17660),j=c(49885),k=c.n(j);let l=a=>new Intl.NumberFormat().format(a||0);function m({stats:a}){let b,c=a.totalCachedTokens||0,e=a.totalPromptTokens>0?Math.min(100,c/a.totalPromptTokens*100):0,f=[{label:"Requests",value:l(a.totalRequests),icon:"send",valueClass:"text-text-main",iconClass:"bg-primary/10 text-primary ring-primary/15",accentClass:"from-primary via-primary/70 to-transparent",detail:"All routed calls"},{label:"Input Tokens",value:l(a.totalPromptTokens),icon:"input",valueClass:"text-primary",iconClass:"bg-primary/10 text-primary ring-primary/15",accentClass:"from-primary via-primary/70 to-transparent",detail:"Prompt and context"},{label:"Cached Tokens",value:l(c),icon:"database",valueClass:"text-info",iconClass:"bg-info/10 text-info ring-info/15",accentClass:"from-info via-info/70 to-transparent",detail:c>0?`${e.toFixed(1)}% of input \xb7 cache rate`:"No cache hits yet"},{label:"Output Tokens",value:l(a.totalCompletionTokens),icon:"output",valueClass:"text-success",iconClass:"bg-success/10 text-success ring-success/15",accentClass:"from-success via-success/70 to-transparent",detail:"Generated responses"},{label:"Est. Cost",value:`~${(b=a.totalCost,`$${(b||0).toFixed(2)}`)}`,icon:"payments",valueClass:"text-warning",iconClass:"bg-warning/10 text-warning ring-warning/15",accentClass:"from-warning via-warning/70 to-transparent",detail:"Estimated, not billing",className:"col-span-2 sm:col-span-1"}];return(0,d.jsx)("div",{className:"grid min-w-0 grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-5",children:f.map(a=>(0,d.jsxs)(i.default,{padding:"none",className:`group relative flex min-h-[118px] min-w-0 flex-col overflow-hidden p-3.5 transition-[border-color,box-shadow,transform] duration-200 hover:border-primary/20 sm:min-h-[130px] sm:p-4 ${a.className||""}`,children:[(0,d.jsx)("span",{className:`absolute inset-x-0 top-0 h-0.5 bg-linear-to-r ${a.accentClass}`,"aria-hidden":"true"}),(0,d.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,d.jsx)("span",{className:"pt-0.5 text-[11px] font-bold uppercase tracking-[0.09em] text-text-muted",children:a.label}),(0,d.jsx)("span",{className:`material-symbols-outlined flex size-7 shrink-0 items-center justify-center rounded-lg text-[16px] ring-1 transition-transform duration-300 group-hover:scale-105 ${a.iconClass}`,children:a.icon})]}),(0,d.jsx)("span",{className:`mt-1.5 truncate text-[22px] font-bold tracking-[-0.02em] sm:text-2xl xl:text-[25px] ${a.valueClass}`,children:a.value}),(0,d.jsx)("span",{className:"mt-auto min-h-[30px] text-[11px] leading-[1.35] text-text-muted",children:a.detail})]},a.label))})}m.propTypes={stats:k().object.isRequired};let n=a=>new Intl.NumberFormat().format(a||0),o=a=>`$${(a||0).toFixed(2)}`;function p(a){if(!a)return"Never";let b=Math.floor((Date.now()-new Date(a))/6e4);return b<1?"Just now":b<60?`${b}m ago`:b<1440?`${Math.floor(b/60)}h ago`:new Date(a).toLocaleDateString()}function q({field:a,currentSort:b,currentOrder:c}){return b!==a?(0,d.jsx)("span",{className:"ml-1 opacity-20",children:"↕"}):(0,d.jsx)("span",{className:"ml-1",children:"asc"===c?"↑":"↓"})}function r({item:a,viewMode:b,isSummary:c=!1}){if("tokens"===b){let b=a.cachedTokens;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:c&&void 0===a.promptTokens?"—":n(a.promptTokens)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-info",children:null==b?"—":n(b)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:c&&void 0===a.completionTokens?"—":n(a.completionTokens)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right font-medium",children:n(a.totalTokens)})]})}return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:c&&void 0===a.inputCost?"—":o(a.inputCost)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:c&&void 0===a.outputCost?"—":o(a.outputCost)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right font-medium text-warning",children:o(a.totalCost||a.cost)})]})}function s({title:a,columns:b,groupedData:c,tableType:f,sortBy:g,sortOrder:h,onToggleSort:j,viewMode:k,storageKey:l,renderDetailCells:m,renderSummaryCells:n,emptyMessage:o}){let[p,t]=(0,e.useState)(new Set),u=(0,e.useCallback)(a=>{t(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),v=(0,e.useMemo)(()=>"tokens"===k?[{field:"promptTokens",label:"Input Tokens"},{field:"cachedTokens",label:"Cached"},{field:"completionTokens",label:"Output Tokens"},{field:"totalTokens",label:"Total Tokens"}]:[{field:"promptTokens",label:"Input Cost"},{field:"completionTokens",label:"Output Cost"},{field:"cost",label:"Total Cost"}],[k]),w=b.length+v.length;return(0,d.jsxs)(i.default,{className:"overflow-hidden",children:[(0,d.jsx)("div",{className:"p-4 border-b border-border bg-bg-subtle/50",children:(0,d.jsx)("h3",{className:"font-semibold",children:a})}),(0,d.jsx)("div",{className:"overflow-x-auto",children:(0,d.jsxs)("table",{className:"w-full text-sm text-left",children:[(0,d.jsx)("thead",{className:"bg-bg-subtle/30 text-text-muted uppercase text-xs",children:(0,d.jsxs)("tr",{children:[b.map(a=>(0,d.jsxs)("th",{className:`px-6 py-3 cursor-pointer hover:bg-bg-subtle/50 ${"right"===a.align?"text-right":""}`,onClick:()=>j(f,a.field),children:[a.label," ",(0,d.jsx)(q,{field:a.field,currentSort:g,currentOrder:h})]},a.field)),v.map(a=>(0,d.jsxs)("th",{className:"px-6 py-3 text-right cursor-pointer hover:bg-bg-subtle/50",onClick:()=>j(f,a.field),children:[a.label," ",(0,d.jsx)(q,{field:a.field,currentSort:g,currentOrder:h})]},a.field))]})}),(0,d.jsxs)("tbody",{className:"divide-y divide-border",children:[c.map(a=>(0,d.jsxs)(e.Fragment,{children:[(0,d.jsxs)("tr",{className:"group-summary cursor-pointer hover:bg-bg-subtle/50 transition-colors",onClick:()=>u(a.groupKey),children:[(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`material-symbols-outlined text-[18px] text-text-muted transition-transform ${p.has(a.groupKey)?"rotate-90":""}`,children:"chevron_right"}),(0,d.jsx)("span",{className:`font-medium transition-colors ${a.summary.pending>0?"text-primary":""}`,children:a.groupKey})]})}),n(a),(0,d.jsx)(r,{item:a.summary,viewMode:k,isSummary:!0})]}),p.has(a.groupKey)&&a.items.map(a=>(0,d.jsxs)("tr",{className:"group-detail hover:bg-bg-subtle/20 transition-colors",children:[m(a),(0,d.jsx)(r,{item:a,viewMode:k})]},`detail-${a.key}`))]},a.groupKey)),0===c.length&&(0,d.jsx)("tr",{children:(0,d.jsx)("td",{colSpan:w,className:"px-6 py-8 text-center text-text-muted",children:o})})]})]})})]})}q.propTypes={field:k().string.isRequired,currentSort:k().string.isRequired,currentOrder:k().string.isRequired},r.propTypes={item:k().object.isRequired,viewMode:k().string.isRequired,isSummary:k().bool},s.propTypes={title:k().string.isRequired,columns:k().arrayOf(k().shape({field:k().string.isRequired,label:k().string.isRequired,align:k().string})).isRequired,groupedData:k().array.isRequired,tableType:k().string.isRequired,sortBy:k().string.isRequired,sortOrder:k().string.isRequired,onToggleSort:k().func.isRequired,viewMode:k().string.isRequired,storageKey:k().string.isRequired,renderDetailCells:k().func.isRequired,renderSummaryCells:k().func.isRequired,emptyMessage:k().string.isRequired};var t=c(96103),u=c(22805);c(71763);let v={padding:.2,duration:200};function w({data:a}){let{label:b,color:c,imageUrl:f,textIcon:g,active:h}=a,[i,j]=(0,e.useState)(!1);return(0,d.jsxs)("div",{className:"flex items-center gap-2.5 px-4 py-2.5 rounded-lg border-2 transition-all duration-300 bg-bg",style:{borderColor:h?c:"var(--color-border)",boxShadow:h?`0 0 16px ${c}40`:"none",minWidth:"150px"},children:[(0,d.jsx)(t.h7,{type:"target",position:u.yX.Top,id:"top",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(t.h7,{type:"target",position:u.yX.Bottom,id:"bottom",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(t.h7,{type:"target",position:u.yX.Left,id:"left",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(t.h7,{type:"target",position:u.yX.Right,id:"right",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)("div",{className:"w-8 h-8 rounded-md flex items-center justify-center shrink-0",style:{backgroundColor:`${c}15`},children:i?(0,d.jsx)("span",{className:"text-sm font-bold",style:{color:c},children:g}):(0,d.jsx)("img",{src:f,alt:b,className:"w-6 h-6 rounded-sm object-contain",onError:()=>j(!0)})}),(0,d.jsx)("span",{className:"text-base font-medium truncate",style:{color:h?c:"var(--color-text)"},children:b}),h&&(0,d.jsxs)("span",{className:"relative flex h-2 w-2 shrink-0",children:[(0,d.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full opacity-75",style:{backgroundColor:c}}),(0,d.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2",style:{backgroundColor:c}})]})]})}function x({data:a}){return(0,d.jsxs)("div",{className:"flex items-center justify-center px-5 py-3 rounded-xl border-2 border-primary bg-primary/5 shadow-md min-w-[130px]",children:[(0,d.jsx)(t.h7,{type:"source",position:u.yX.Top,id:"top",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(t.h7,{type:"source",position:u.yX.Bottom,id:"bottom",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(t.h7,{type:"source",position:u.yX.Left,id:"left",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(t.h7,{type:"source",position:u.yX.Right,id:"right",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)("img",{src:"/favicon.svg",alt:"ZevaiRouter",className:"w-6 h-6 mr-2"}),(0,d.jsx)("span",{className:"text-sm font-bold text-primary",children:"ZevaiRouter"}),a.activeCount>0&&(0,d.jsx)("span",{className:"ml-2 px-1.5 py-0.5 rounded-full bg-primary text-white text-xs font-bold",children:a.activeCount})]})}w.propTypes={data:k().object.isRequired},x.propTypes={data:k().object.isRequired};let y={provider:w,router:x};function z({providers:a=[],activeRequests:b=[],lastProvider:c="",errorProvider:f=""}){let h=(0,e.useMemo)(()=>b.map(a=>a.provider?.toLowerCase()).filter(Boolean).sort().join(","),[b]),i=c?.toLowerCase()||"",j=f?.toLowerCase()||"",k=(0,e.useMemo)(()=>new Set(h?h.split(","):[]),[h]),l=(0,e.useMemo)(()=>new Set(i?[i]:[]),[i]),m=(0,e.useMemo)(()=>new Set(j?[j]:[]),[j]),n=(0,e.useRef)({}),[o,p]=(0,e.useState)(0),q=(0,e.useMemo)(()=>{let a=Date.now(),b=new Set;for(let c of k){let d=n.current[c];(!d||a-d<6e4)&&b.add(c)}return b},[k,o]),{nodes:r,edges:s}=(0,e.useMemo)(()=>(function(a,b,c,d){let e=a.length,f=Math.max(320,204*e/(2*Math.PI)),h=Math.max(200,.55*f);if(0===e)return{nodes:[{id:"router",type:"router",position:{x:0,y:0},data:{activeCount:0},draggable:!1}],edges:[]};let i=[],j=[];return i.push({id:"router",type:"router",position:{x:-60,y:-22},data:{activeCount:b.size},draggable:!1}),a.forEach((a,k)=>{var l,m;let n,o,p=(l=a.provider,g.Q2[l]||{color:"#6b7280",name:l}),q=b.has(a.provider?.toLowerCase()),r=!q&&c.has(a.provider?.toLowerCase()),s=!q&&d.has(a.provider?.toLowerCase()),t=`provider-${a.provider}`,u={label:(p.name!==a.provider?p.name:null)||a.name||a.provider,color:p.color||"#6b7280",imageUrl:(m=a.provider,`/providers/${m}.png`),textIcon:p.textIcon||(a.provider||"?").slice(0,2).toUpperCase(),active:q},v=-Math.PI/2+2*Math.PI*k/e,w=f*Math.cos(v),x=h*Math.sin(v);Math.abs(v+Math.PI/2)<Math.PI/4||Math.abs(v-3*Math.PI/2)<Math.PI/4?(n="top",o="bottom"):Math.abs(v-Math.PI/2)<Math.PI/4?(n="bottom",o="top"):w>0?(n="right",o="left"):(n="left",o="right"),i.push({id:t,type:"provider",position:{x:w-90,y:x-15},data:u,draggable:!1}),j.push({id:`e-${t}`,source:"router",sourceHandle:n,target:t,targetHandle:o,animated:q,style:(p.color,s?{stroke:"#ef4444",strokeWidth:2.5,opacity:.9}:q?{stroke:"#22c55e",strokeWidth:2.5,opacity:.9}:r?{stroke:"#f59e0b",strokeWidth:2,opacity:.7}:{stroke:"var(--color-border)",strokeWidth:1,opacity:.3})})}),{nodes:i,edges:j}})(a,q,l,m),[a,q,l,m]),u=(0,e.useMemo)(()=>a.map(a=>a.provider).sort().join(","),[a]),w=(0,e.useRef)(null),x=(0,e.useRef)(null),A=(0,e.useCallback)(a=>{w.current=a,setTimeout(()=>a.fitView(v),50)},[]);return(0,d.jsxs)("div",{ref:x,className:"flex h-[360px] w-full min-w-0 flex-col overflow-hidden rounded-[14px] border border-border-subtle bg-surface/94 shadow-[0_14px_34px_-26px_rgba(15,23,42,0.28)] sm:h-[480px]",children:[(0,d.jsxs)("div",{className:"flex shrink-0 items-center justify-between border-b border-border-subtle bg-surface/75 px-4 py-3.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[17px] text-primary",children:"route"}),(0,d.jsx)("span",{className:"text-xs font-bold uppercase tracking-[0.08em] text-text-muted",children:"Routing Map"})]}),(0,d.jsxs)("span",{className:"rounded-full bg-primary/[0.08] px-2 py-1 text-[10px] font-semibold text-primary ring-1 ring-primary/15",children:[a.length," ",1===a.length?"provider":"providers"]})]}),(0,d.jsx)("div",{className:"min-h-0 flex-1 bg-bg/35",children:0===a.length?(0,d.jsx)("div",{className:"flex h-full items-center justify-center text-sm text-text-muted",children:"No providers connected"}):(0,d.jsx)(t.Gc,{nodes:r,edges:s,nodeTypes:y,fitView:!0,fitViewOptions:v,minZoom:.1,maxZoom:2,onInit:A,proOptions:{hideAttribution:!0},panOnDrag:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,preventScrolling:!1,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,children:(0,d.jsx)(t.H2,{showInteractive:!1,className:"react-flow-controls-custom"})},u)})]})}z.propTypes={providers:k().arrayOf(k().shape({id:k().string,provider:k().string,name:k().string})),activeRequests:k().arrayOf(k().shape({provider:k().string,model:k().string,account:k().string})),lastProvider:k().string,errorProvider:k().string};var A=c(48679),B=c(70452),C=c(28946),D=c(22393),E=c(54206),F=c(57570),G=c(44780);let H=a=>a>=1e6?`${(a/1e6).toFixed(1)}M`:a>=1e3?`${(a/1e3).toFixed(1)}K`:String(a||0),I=a=>`$${(a||0).toFixed(4)}`,J={today:"Today","24h":"Last 24 hours","7d":"Last 7 days","30d":"Last 30 days","60d":"Last 60 days"};function K({period:a="7d"}){let[b,c]=(0,e.useState)([]),[f,g]=(0,e.useState)(!0),[h,j]=(0,e.useState)("tokens");(0,e.useCallback)(async()=>{g(!0);try{let b=await fetch(`/api/usage/chart?period=${a}`);if(b.ok){let a=await b.json();c(a)}}catch(a){console.error("Failed to fetch chart data:",a)}finally{g(!1)}},[a]);let k=b.some(a=>a.tokens>0||a.cost>0);return(0,d.jsxs)(i.default,{className:"flex min-w-0 flex-col gap-5 p-4 sm:p-5",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Usage trend"}),(0,d.jsxs)("p",{className:"mt-0.5 text-[11px] text-text-muted",children:[J[a]||a," \xb7 routed traffic over time"]})]}),(0,d.jsxs)("div",{className:"grid w-full grid-cols-2 items-center gap-1 rounded-lg border border-border bg-bg-subtle p-1 sm:w-auto",children:[(0,d.jsx)("button",{onClick:()=>j("tokens"),className:`rounded-md px-3 py-1 text-sm font-medium transition-colors ${"tokens"===h?"bg-primary text-white shadow-sm":"text-text-muted hover:bg-bg-hover hover:text-text"}`,children:"Tokens"}),(0,d.jsx)("button",{onClick:()=>j("cost"),className:`rounded-md px-3 py-1 text-sm font-medium transition-colors ${"cost"===h?"bg-primary text-white shadow-sm":"text-text-muted hover:bg-bg-hover hover:text-text"}`,children:"Cost"})]})]}),f?(0,d.jsx)("div",{className:"h-48 flex items-center justify-center text-text-muted text-sm",children:"Loading..."}):k?(0,d.jsx)(A.u,{width:"100%",height:220,children:(0,d.jsxs)(B.Q,{data:b,margin:{top:4,right:8,left:0,bottom:0},children:[(0,d.jsxs)("defs",{children:[(0,d.jsxs)("linearGradient",{id:"gradTokens",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,d.jsx)("stop",{offset:"5%",stopColor:"#6366f1",stopOpacity:.25}),(0,d.jsx)("stop",{offset:"95%",stopColor:"#6366f1",stopOpacity:0})]}),(0,d.jsxs)("linearGradient",{id:"gradCost",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,d.jsx)("stop",{offset:"5%",stopColor:"#f59e0b",stopOpacity:.25}),(0,d.jsx)("stop",{offset:"95%",stopColor:"#f59e0b",stopOpacity:0})]})]}),(0,d.jsx)(C.d,{strokeDasharray:"3 3",strokeOpacity:.1}),(0,d.jsx)(D.W,{dataKey:"label",tick:{fontSize:10,fill:"currentColor",fillOpacity:.5},tickLine:!1,axisLine:!1,interval:"preserveStartEnd"}),(0,d.jsx)(E.h,{tick:{fontSize:10,fill:"currentColor",fillOpacity:.5},tickLine:!1,axisLine:!1,tickFormatter:"tokens"===h?H:I,width:50}),(0,d.jsx)(F.m,{contentStyle:{backgroundColor:"var(--color-bg)",border:"1px solid var(--color-border)",borderRadius:"8px",fontSize:"12px"},formatter:(a,b)=>"tokens"===b?[H(a),"Tokens"]:[I(a),"Cost"]}),"tokens"===h?(0,d.jsx)(G.Gk,{type:"monotone",dataKey:"tokens",stroke:"#6366f1",strokeWidth:2,fill:"url(#gradTokens)",dot:!1,activeDot:{r:4}}):(0,d.jsx)(G.Gk,{type:"monotone",dataKey:"cost",stroke:"#f59e0b",strokeWidth:2,fill:"url(#gradCost)",dot:!1,activeDot:{r:4}})]})}):(0,d.jsx)("div",{className:"h-48 flex items-center justify-center text-text-muted text-sm",children:"No data for this period"})]})}function L({timestamp:a}){let b,[,c]=(0,e.useState)(0);return(0,d.jsx)("time",{dateTime:a,title:new Date(a).toLocaleString(),children:(b=Math.max(0,Math.floor((Date.now()-new Date(a))/1e3)))<60?`${b}s ago`:b<3600?`${Math.floor(b/60)}m ago`:b<86400?`${Math.floor(b/3600)}h ago`:`${Math.floor(b/86400)}d ago`})}K.propTypes={period:k().string};let M={live:{label:"Live",title:"Usage stream connected",className:"bg-success/10 text-success",dotClassName:"bg-success animate-pulse"},reconnecting:{label:"Reconnecting",title:"Usage stream disconnected; reconnecting automatically",className:"bg-warning/10 text-warning",dotClassName:"bg-warning animate-pulse"},connecting:{label:"Connecting",title:"Connecting to the live usage stream",className:"bg-primary/10 text-primary",dotClassName:"bg-primary animate-pulse"}};function N({requests:a=[],streamStatus:b="connecting"}){let c=M[b]||M.connecting;return(0,d.jsxs)(i.default,{className:"flex min-w-0 flex-col overflow-hidden",padding:"none",style:{height:480},children:[(0,d.jsxs)("div",{className:"flex shrink-0 items-center justify-between border-b border-border-subtle bg-surface/75 px-4 py-3.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[17px] text-primary",children:"monitor_heart"}),(0,d.jsx)("span",{className:"text-xs font-bold uppercase tracking-[0.08em] text-text-muted",children:"Recent Requests"})]}),(0,d.jsxs)("span",{className:`inline-flex items-center gap-1.5 rounded-full px-2 py-1 text-[10px] font-semibold ${c.className}`,title:c.title,children:[(0,d.jsx)("span",{"aria-hidden":"true",className:`size-1.5 rounded-full ${c.dotClassName}`}),c.label]})]}),a.length?(0,d.jsx)("div",{className:"flex-1 overflow-y-auto px-4 pb-3",children:(0,d.jsxs)("table",{className:"w-full min-w-[300px] border-collapse text-xs",children:[(0,d.jsx)("thead",{className:"sticky top-0 z-10 bg-surface/95 backdrop-blur-sm",children:(0,d.jsxs)("tr",{className:"border-b border-border",children:[(0,d.jsx)("th",{className:"w-2 py-1.5 text-left font-semibold text-text-muted",children:(0,d.jsx)("span",{className:"sr-only",children:"Status"})}),(0,d.jsx)("th",{className:"py-1.5 text-left font-semibold text-text-muted",children:"Model"}),(0,d.jsx)("th",{className:"py-1.5 text-right font-semibold text-text-muted whitespace-nowrap",children:"In / Out"}),(0,d.jsx)("th",{className:"py-1.5 text-right font-semibold text-text-muted",children:"When"})]})}),(0,d.jsx)("tbody",{className:"divide-y divide-border/50",children:a.map((a,b)=>{let c=function(a){if(!a)return!0;let b=String(a).trim().toLowerCase();return"ok"===b||"success"===b||"succeeded"===b||/^2\d\d(?:\s|$)/.test(b)}(a.status),e=c?"Succeeded":"Failed",f=g.Q2[a.provider]?.name||g.IS[a.provider]?.name||a.provider||"Unknown provider";return(0,d.jsxs)("tr",{className:"transition-colors hover:bg-bg-subtle",children:[(0,d.jsx)("td",{className:"py-1.5",title:e,children:(0,d.jsx)("span",{role:"img","aria-label":e,className:`block size-1.5 rounded-full ${c?"bg-success":"bg-error"}`})}),(0,d.jsxs)("td",{className:"min-w-0 py-1.5 pr-2",children:[(0,d.jsx)("div",{className:"max-w-[132px] truncate font-mono",title:a.model,children:a.model}),(0,d.jsx)("div",{className:"mt-0.5 max-w-[132px] truncate text-[9px] font-semibold uppercase tracking-[0.08em] text-text-subtle",title:f,children:f})]}),(0,d.jsxs)("td",{className:"py-1.5 text-right font-mono tabular-nums whitespace-nowrap",children:[(0,d.jsxs)("span",{className:"text-primary",children:[n(a.promptTokens),"↑"]})," ",(0,d.jsxs)("span",{className:"text-success",children:[n(a.completionTokens),"↓"]})]}),(0,d.jsx)("td",{className:"py-1.5 text-right text-text-muted whitespace-nowrap",children:(0,d.jsx)(L,{timestamp:a.timestamp})})]},`${a.timestamp}-${a.model}-${a.provider}-${a.promptTokens}-${a.completionTokens}-${b}`)})})]})}):(0,d.jsx)("div",{className:"flex-1 flex items-center justify-center text-text-muted text-sm",children:"No requests yet."})]})}function O(a,b={},c,d){return Object.entries(a||{}).map(([a,c])=>{let d=(c.promptTokens||0)+(c.completionTokens||0),e=c.cost||0,f=d>0?(c.promptTokens||0)*(e/d):0,g=d>0?(c.completionTokens||0)*(e/d):0;return{...c,key:a,totalTokens:d,totalCost:e,inputCost:f,outputCost:g,pending:b[a]||0}}).sort((a,b)=>{let e=a[c],f=b[c];return("string"==typeof e&&(e=e.toLowerCase()),"string"==typeof f&&(f=f.toLowerCase()),e<f)?"asc"===d?-1:1:e>f?"asc"===d?1:-1:0})}function P(a,b){if(!Array.isArray(a))return[];let c={};return a.forEach(a=>{let d=function(a,b){switch(b){case"rawModel":return a.rawModel||"Unknown Model";case"accountName":return a.accountName||`Account ${a.connectionId?.slice(0,8)}...`||"Unknown Account";case"keyName":return a.keyName||"Unknown Key";case"endpoint":return a.endpoint||"Unknown Endpoint";default:return a[b]||"Unknown"}}(a,b);c[d]||(c[d]={groupKey:d,summary:{requests:0,promptTokens:0,completionTokens:0,cachedTokens:0,totalTokens:0,cost:0,inputCost:0,outputCost:0,lastUsed:null,pending:0},items:[]});let e=c[d].summary;e.requests+=a.requests||0,e.promptTokens+=a.promptTokens||0,e.completionTokens+=a.completionTokens||0,e.cachedTokens+=a.cachedTokens||0,e.totalTokens+=a.totalTokens||0,e.cost+=a.cost||0,e.inputCost+=a.inputCost||0,e.outputCost+=a.outputCost||0,e.pending+=a.pending||0,a.lastUsed&&(!e.lastUsed||new Date(a.lastUsed)>new Date(e.lastUsed))&&(e.lastUsed=a.lastUsed),c[d].items.push(a)}),Object.values(c)}let Q=[{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],R=[{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"accountName",label:"Account"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],S=[{field:"keyName",label:"API Key Name"},{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],T=[{field:"endpoint",label:"Endpoint"},{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],U=[{value:"model",label:"Usage by Model"},{value:"account",label:"Usage by Account"},{value:"apiKey",label:"Usage by API Key"},{value:"endpoint",label:"Usage by Endpoint"}],V=[{value:"today",label:"Today"},{value:"24h",label:"24h"},{value:"7d",label:"7D"},{value:"30d",label:"30D"},{value:"60d",label:"60D"}];function W({period:a,setPeriod:b,hidePeriodSelector:c=!1}={}){let g=(0,f.useRouter)(),i=(0,f.useSearchParams)(),j=i.get("sortBy")||"rawModel",k=i.get("sortOrder")||"asc",[l,o]=(0,e.useState)(null),[q,r]=(0,e.useState)(!0),[t,u]=(0,e.useState)(!1),[v,w]=(0,e.useState)("model"),[x,y]=(0,e.useState)("costs"),[A,B]=(0,e.useState)([]),[C,D]=(0,e.useState)("connecting"),[E,F]=(0,e.useState)("today");(0,e.useRef)(!0);let G=a??E,H=b??F,I=(0,e.useCallback)((a,b)=>{let c=new URLSearchParams(i.toString());c.get("sortBy")===b?c.set("sortOrder","asc"===c.get("sortOrder")?"desc":"asc"):(c.set("sortBy",b),c.set("sortOrder","asc")),g.replace(`?${c.toString()}`,{scroll:!1})},[i,g]),J=(0,e.useMemo)(()=>{if(!l)return null;switch(v){case"model":{let a=l.pending?.byModel||{};return{columns:Q,groupedData:P(O(l.byModel,a,j,k),"rawModel"),storageKey:"usage-stats:expanded-models",emptyMessage:"No usage recorded yet.",renderSummaryCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.summary.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.summary.lastUsed)})]}),renderDetailCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${a.pending>0?"text-primary":""}`,children:a.rawModel}),(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsx)(h.default,{variant:a.pending>0?"primary":"neutral",size:"sm",children:a.provider})}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.lastUsed)})]})}}case"account":{let a={};return l?.pending?.byAccount&&Object.entries(l.byAccount||{}).forEach(([b,c])=>{let d=l.pending.byAccount[c.connectionId];if(d){let e=c.provider?`${c.rawModel} (${c.provider})`:c.rawModel;a[b]=d[e]||0}}),{columns:R,groupedData:P(O(l.byAccount,a,j,k),"accountName"),storageKey:"usage-stats:expanded-accounts",emptyMessage:"No account-specific usage recorded yet.",renderSummaryCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.summary.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.summary.lastUsed)})]}),renderDetailCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${a.pending>0?"text-primary":""}`,children:a.accountName||`Account ${a.connectionId?.slice(0,8)}...`}),(0,d.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${a.pending>0?"text-primary":""}`,children:a.rawModel}),(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsx)(h.default,{variant:a.pending>0?"primary":"neutral",size:"sm",children:a.provider})}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.lastUsed)})]})}}case"apiKey":return{columns:S,groupedData:P(O(l.byApiKey,{},j,k),"keyName"),storageKey:"usage-stats:expanded-apikeys",emptyMessage:"No API key usage recorded yet.",renderSummaryCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.summary.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.summary.lastUsed)})]}),renderDetailCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 font-medium",children:a.keyName}),(0,d.jsx)("td",{className:"px-6 py-3",children:a.rawModel}),(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsx)(h.default,{variant:"neutral",size:"sm",children:a.provider})}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.lastUsed)})]})};default:return{columns:T,groupedData:P(O(l.byEndpoint,{},j,k),"endpoint"),storageKey:"usage-stats:expanded-endpoints",emptyMessage:"No endpoint usage recorded yet.",renderSummaryCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.summary.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.summary.lastUsed)})]}),renderDetailCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 font-medium font-mono text-sm",children:a.endpoint}),(0,d.jsx)("td",{className:"px-6 py-3",children:a.rawModel}),(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsx)(h.default,{variant:"neutral",size:"sm",children:a.provider})}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.lastUsed)})]})}}},[l,v,j,k]);if(!l&&!q)return(0,d.jsx)("div",{className:"text-text-muted",children:"Failed to load usage statistics."});let L=(0,d.jsx)("div",{className:"flex items-center justify-center py-12 text-text-muted",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[32px] animate-spin",children:"progress_activity"})});return(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 lg:gap-7",children:[!c&&(0,d.jsxs)("div",{className:"flex w-full items-center gap-2 sm:w-auto sm:self-end",children:[(0,d.jsx)("div",{className:"grid flex-1 grid-cols-5 items-center gap-1 rounded-lg border border-border bg-bg-subtle p-1 sm:flex sm:flex-none",children:V.map(a=>(0,d.jsx)("button",{onClick:()=>H(a.value),disabled:t,className:`rounded-md px-3 py-1 text-sm font-medium transition-colors ${G===a.value?"bg-primary text-white shadow-sm":"text-text-muted hover:bg-bg-hover hover:text-text"}`,children:a.label},a.value))}),t&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted animate-spin",children:"progress_activity"})]}),q?L:(0,d.jsx)(m,{stats:l}),q?L:(0,d.jsxs)("div",{className:"grid min-w-0 grid-cols-1 items-stretch gap-4 lg:grid-cols-[minmax(0,3fr)_minmax(340px,2fr)]",children:[(0,d.jsx)(z,{providers:A,activeRequests:l.activeRequests||[],lastProvider:l.recentRequests?.[0]?.provider||"",errorProvider:l.errorProvider||""}),(0,d.jsx)(N,{requests:l.recentRequests||[],streamStatus:C})]}),q?L:(0,d.jsx)(K,{period:G}),(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsx)("select",{value:v,onChange:a=>w(a.target.value),className:"w-full rounded-lg border border-border bg-surface px-3 py-1.5 text-sm font-medium text-text-main focus:outline-none focus:ring-2 focus:ring-primary/50 sm:w-auto",style:{colorScheme:"auto"},children:U.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value))}),(0,d.jsxs)("div",{className:"grid grid-cols-2 items-center gap-1 rounded-lg border border-border bg-bg-subtle p-1 sm:flex",children:[(0,d.jsx)("button",{onClick:()=>y("costs"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"costs"===x?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Costs"}),(0,d.jsx)("button",{onClick:()=>y("tokens"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"tokens"===x?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Tokens"})]})]}),q?L:J&&(0,d.jsx)(s,{title:"",columns:J.columns,groupedData:J.groupedData,tableType:v,sortBy:j,sortOrder:k,onToggleSort:I,viewMode:x,storageKey:J.storageKey,renderSummaryCells:J.renderSummaryCells,renderDetailCells:J.renderDetailCells,emptyMessage:J.emptyMessage})]})]})}},91099:(a,b,c)=>{c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({options:a=[],value:b,onChange:c,size:g="md",className:h,...i}){let j={sm:"h-9 text-xs sm:h-7",md:"h-10 text-sm sm:h-9",lg:"h-11 text-base"};return(0,d.jsx)("div",{role:"group",...i,className:(0,e.cn)("inline-flex items-center p-1 rounded-[10px] overflow-x-auto","bg-surface-2",h),children:a.map(a=>(0,d.jsxs)("button",{type:"button","aria-pressed":b===a.value,onClick:()=>c(a.value),className:(0,e.cn)("shrink-0 px-4 rounded-[8px] font-medium transition-all",j[g],b===a.value?"bg-surface text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[a.icon&&(0,d.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[16px] mr-1.5",children:a.icon}),a.label]},a.value))})}},91809:(a,b,c)=>{c.d(b,{default:()=>g});var d=c(48249),e=c(67484),f=c(17660);function g(){let[a,b]=(0,e.useState)([]),[c,g]=(0,e.useState)(!0),[h,i]=(0,e.useState)(!0);return(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("h2",{className:"text-xl font-semibold",children:"Request Logs"}),(0,d.jsx)("div",{className:"flex items-center gap-2",children:(0,d.jsxs)("label",{className:"text-sm font-medium text-text-muted flex items-center gap-2 cursor-pointer",children:[(0,d.jsx)("span",{children:"Auto Refresh (3s)"}),(0,d.jsx)("div",{onClick:()=>i(!h),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors focus:outline-none ${h?"bg-primary":"bg-bg-subtle border border-border"}`,children:(0,d.jsx)("span",{className:`inline-block h-3 w-3 transform rounded-full bg-white transition-transform ${h?"translate-x-5":"translate-x-1"}`})})]})})]}),(0,d.jsx)(f.default,{className:"overflow-hidden bg-black/5 dark:bg-black/20",children:(0,d.jsx)("div",{className:"p-0 overflow-x-auto max-h-[600px] overflow-y-auto font-mono text-xs",children:c&&0===a.length?(0,d.jsx)("div",{className:"p-8 text-center text-text-muted",children:"Loading logs..."}):0===a.length?(0,d.jsx)("div",{className:"p-8 text-center text-text-muted",children:"No logs recorded yet."}):(0,d.jsxs)("table",{className:"w-full text-left border-collapse whitespace-nowrap",children:[(0,d.jsx)("thead",{className:"sticky top-0 bg-bg-subtle border-b border-border z-10",children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"DateTime"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Model"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Provider"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Account"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"In"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Out"}),(0,d.jsx)("th",{className:"px-3 py-2",children:"Status"})]})}),(0,d.jsx)("tbody",{className:"divide-y divide-border/50",children:a.map((a,b)=>{let c=a.split(" | ");if(c.length<7)return null;let e=c[6],f=e.includes("PENDING"),g=e.includes("FAILED"),h=e.includes("OK");return(0,d.jsxs)("tr",{className:`hover:bg-primary/5 transition-colors ${f?"bg-primary/5":""}`,children:[(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-text-muted",children:c[0]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border font-medium",children:c[1]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border",children:(0,d.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-bg-subtle border border-border text-[10px] uppercase font-bold",children:c[2]})}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border truncate max-w-[150px]",title:c[3],children:c[3]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-primary",children:c[4]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-success",children:c[5]}),(0,d.jsx)("td",{className:`px-3 py-1.5 font-bold ${h?"text-success":g?"text-error":"text-primary animate-pulse"}`,children:e})]},b)})})]})})}),(0,d.jsx)("div",{className:"text-[10px] text-text-muted italic",children:"Logs are loaded from the request history database."})]})}},95145:(a,b,c)=>{c.d(b,{ConfirmModal:()=>j,default:()=>i});var d=c(48249),e=c(67484),f=c(71404),g=c(99070),h=c(32971);function i({isOpen:a,onClose:b,title:c,children:g,footer:j,size:k="md",closeOnOverlay:l=!0,showTrafficLights:m=!0,className:n}){let o=(0,e.useId)(),p=(0,e.useRef)(null);return((0,e.useRef)(null),(0,e.useRef)(b).current=b,a)?(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-[2px] fade-in",onClick:l?b:void 0}),(0,d.jsxs)("div",{ref:p,role:"dialog","aria-modal":"true","aria-labelledby":c?o:void 0,"aria-label":c?void 0:"Dialog",tabIndex:-1,className:(0,f.cn)("relative w-full max-h-[calc(100dvh-2rem)] overflow-hidden bg-surface","border border-border-subtle","rounded-[14px] shadow-[var(--shadow-elev)]","fade-in",{sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl",full:"max-w-4xl"}[k],n),children:[(c||m)&&(0,d.jsxs)("div",{className:"flex items-center justify-between p-2 border-b border-border-subtle",children:[(0,d.jsxs)("div",{className:"flex items-center",children:[m&&(0,d.jsxs)("div",{className:"hidden md:flex items-center gap-2 mr-4 ml-2",children:[(0,d.jsx)(h.default,{text:"Close",position:"top",color:"#FF5F56",children:(0,d.jsx)("button",{onClick:b,"aria-label":"Close",title:"Close",className:"w-4 h-4 rounded-full bg-[#FF5F56] hover:brightness-90 transition-all cursor-pointer flex items-center justify-center group/dot",children:(0,d.jsx)("span",{className:"text-[9px] font-bold text-white opacity-0 group-hover/dot:opacity-100 transition-opacity leading-none",children:"✕"})})}),(0,d.jsx)("div",{className:"w-4 h-4 rounded-full bg-[#3a3a3a]/20 dark:bg-white/15 cursor-not-allowed"}),(0,d.jsx)("div",{className:"w-4 h-4 rounded-full bg-[#3a3a3a]/20 dark:bg-white/15 cursor-not-allowed"})]}),c&&(0,d.jsx)("h2",{id:o,className:"text-lg font-semibold text-text-main",children:c})]}),(0,d.jsx)("button",{onClick:b,"aria-label":"Close",className:"md:hidden p-1.5 rounded-[10px] text-text-muted hover:bg-surface-2 hover:text-text-main transition-colors",children:(0,d.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,d.jsx)("div",{className:"p-6 max-h-[calc(85vh-100px)] overflow-y-auto custom-scrollbar",children:g}),j&&(0,d.jsx)("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-border-subtle",children:j})]})]}):null}function j({isOpen:a,onClose:b,onConfirm:c,title:e="Confirm",message:f,confirmText:h="Confirm",cancelText:k="Cancel",variant:l="danger",loading:m=!1}){return(0,d.jsx)(i,{isOpen:a,onClose:b,title:e,size:"sm",footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g.default,{variant:"ghost",onClick:b,disabled:m,children:k}),(0,d.jsx)(g.default,{variant:l,onClick:c,loading:m,children:h})]}),children:(0,d.jsx)("p",{className:"text-text-muted",children:f})})}},95514:(a,b,c)=>{c.d(b,{default:()=>g});var d=c(48249),e=c(67484),f=c(71404);function g({checked:a=!1,onChange:b,label:c,description:h,disabled:i=!1,size:j="md",className:k,busy:l=!1,...m}){let n=(0,e.useId)(),o=(0,e.useId)(),p={sm:{track:"w-8 h-4",thumb:"size-3",translate:"translate-x-4"},md:{track:"w-11 h-6",thumb:"size-5",translate:"translate-x-5"},lg:{track:"w-14 h-7",thumb:"size-6",translate:"translate-x-7"}},q=()=>{i||l||!b||b(!a)};return(0,d.jsxs)("div",{className:(0,f.cn)("flex items-center gap-3",i&&"opacity-50 cursor-not-allowed",k),children:[(0,d.jsx)("button",{type:"button",role:"switch","aria-checked":a,"aria-busy":l||void 0,"aria-labelledby":c?n:void 0,"aria-describedby":h?o:void 0,"aria-label":c?void 0:m["aria-label"],disabled:i||l,onClick:q,...m,className:(0,f.cn)("relative inline-flex shrink-0 cursor-pointer rounded-full","transition-colors duration-200 ease-in-out","focus:outline-none focus:ring-2 focus:ring-brand-500/30",a?"bg-brand-500":"bg-surface-3",p[j].track,i&&"cursor-not-allowed"),children:(0,d.jsx)("span",{className:(0,f.cn)("pointer-events-none inline-block rounded-full bg-white shadow-sm","transform transition duration-200 ease-in-out",a?p[j].translate:"translate-x-0.5",p[j].thumb,"mt-0.5")})}),(c||h)&&(0,d.jsxs)("div",{className:"flex flex-col",children:[c&&(0,d.jsx)("label",{id:n,onClick:q,className:"text-sm font-medium text-text-main cursor-pointer",children:c}),h&&(0,d.jsx)("span",{id:o,className:"text-xs text-text-muted",children:h})]})]})}},99070:(a,b,c)=>{c.d(b,{default:()=>h});var d=c(48249),e=c(71404);let f={primary:"bg-brand-500 hover:bg-brand-600 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted",secondary:"bg-surface-2 hover:bg-surface-3 text-text-main border border-border disabled:opacity-50",outline:"border border-border text-text-main hover:bg-surface-2 hover:border-brand-500/40",ghost:"text-text-muted hover:bg-surface-2 hover:text-text-main",danger:"bg-red-500 hover:bg-red-600 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted",success:"bg-green-600 hover:bg-green-700 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted"},g={sm:"h-10 px-3 text-xs rounded-[8px] sm:h-7",md:"h-11 px-4 text-sm rounded-[10px] sm:h-9",lg:"h-12 px-6 text-sm rounded-[10px] sm:h-11"};function h({children:a,variant:b="primary",size:c="md",icon:i,iconRight:j,disabled:k=!1,loading:l=!1,fullWidth:m=!1,className:n,...o}){return(0,d.jsxs)("button",{className:(0,e.cn)("inline-flex items-center justify-center gap-2 font-semibold transition-all duration-150 ease-out cursor-pointer","active:scale-[0.97] disabled:opacity-50 disabled:cursor-not-allowed disabled:active:scale-100",f[b],g[c],m&&"w-full",n),disabled:k||l,"aria-busy":l||void 0,...o,children:[l?(0,d.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}):i?(0,d.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[18px]",children:i}):null,a,j&&!l&&(0,d.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[18px]",children:j})]})}}};
7
+ `,children:(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[s.includes(a.value)&&!c&&(0,d.jsx)("span",{className:"material-symbols-outlined leading-none",style:{fontSize:"10px"},children:"check"}),c?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[11px]",children:"edit"}),a.name]}):a.isCustom?(0,d.jsxs)(d.Fragment,{children:[a.name,(0,d.jsx)("span",{className:"text-[9px] opacity-60 font-normal",children:"custom"})]}):a.name]})},a.value)})})]},a)),0===Object.keys(I).length&&0===H.length&&(0,d.jsxs)("div",{className:"text-center py-4 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-2xl mb-1 block",children:"search_off"}),(0,d.jsx)("p",{className:"text-xs",children:"No models found"})]})]})]})}n.propTypes={isOpen:g().bool.isRequired,onClose:g().func.isRequired,onSelect:g().func.isRequired,onDeselect:g().func,selectedModel:g().string,activeProviders:g().arrayOf(g().shape({provider:g().string.isRequired})),title:g().string,modelAliases:g().object,kindFilter:g().string,addedModelValues:g().arrayOf(g().string),closeOnSelect:g().bool}},83552:(a,b,c)=>{c.d(b,{default:()=>g});var d=c(48249),e=c(67484),f=c(71404);function g({label:a,type:b="text",placeholder:c,value:h,onChange:i,error:j,hint:k,icon:l,disabled:m=!1,required:n=!1,className:o,inputClassName:p,...q}){let r=(0,e.useId)(),s=q.id||r,t=`${s}-error`,u=`${s}-hint`,v=[q["aria-describedby"],j&&t,k&&u].filter(Boolean).join(" ")||void 0;return(0,d.jsxs)("div",{className:(0,f.cn)("flex flex-col gap-1.5",o),children:[a&&(0,d.jsxs)("label",{htmlFor:s,className:"text-sm font-medium text-text-main",children:[a,n&&(0,d.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,d.jsxs)("div",{className:"relative",children:[l&&(0,d.jsx)("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-text-muted",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:l})}),(0,d.jsx)("input",{id:s,type:b,placeholder:c,value:h,onChange:i,disabled:m,required:n,"aria-invalid":!!j||void 0,"aria-describedby":v,className:(0,f.cn)("w-full py-2.5 px-3 text-sm text-text-main bg-surface-2 rounded-[10px]","border border-transparent placeholder-text-muted/70","focus:outline-none focus:ring-2 focus:ring-brand-500/30 focus:border-brand-500/40","transition-all duration-150 ease-out disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",l&&"pl-10",j&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",p),...q})]}),j&&(0,d.jsxs)("p",{id:t,role:"alert",className:"text-xs text-red-500 flex items-center gap-1",children:[(0,d.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[14px]",children:"error"}),j]}),k&&!j&&(0,d.jsx)("p",{id:u,className:"text-xs text-text-muted",children:k})]})}},85158:(a,b,c)=>{c.d(b,{default:()=>g});var d=c(48249),e=c(71404),f=c(99070);function g({currentPage:a,pageSize:b,totalItems:c,onPageChange:h,onPageSizeChange:i,className:j}){let k=Math.ceil(c/b),l=c>0?(a-1)*b+1:0,m=Math.min(a*b,c),n=(()=>{let b=[],c=Math.max(1,a-2),d=Math.min(k,c+5-1);d-c+1<5&&(c=Math.max(1,d-5+1));for(let a=c;a<=d;a++)b.push(a);return b})();return(0,d.jsxs)("div",{className:(0,e.cn)("flex flex-col sm:flex-row items-center justify-between gap-4 py-4 px-2",j),children:[c>0&&(0,d.jsxs)("div",{className:"text-sm text-text-muted",children:["Showing ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:l})," to"," ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:m})," of"," ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:c})," results"]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-2 sm:gap-4",children:[i&&(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-sm text-text-muted",children:"Rows:"}),(0,d.jsx)("select",{value:b,onChange:a=>i(Number(a.target.value)),className:(0,e.cn)("h-9 rounded-lg border border-black/10 dark:border-white/10 bg-surface","text-sm text-text-main focus:outline-none focus:ring-2 focus:ring-primary/20","cursor-pointer"),style:{colorScheme:"auto"},children:[10,20,50].map(a=>(0,d.jsx)("option",{value:a,children:a},a))})]}),k>1&&(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)(f.default,{variant:"outline",size:"sm",onClick:()=>h(a-1),disabled:1===a,className:"w-9 px-0",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_left"})}),n[0]>1&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.default,{variant:"ghost",size:"sm",onClick:()=>h(1),className:"w-9 px-0 hidden sm:inline-flex",children:"1"}),n[0]>2&&(0,d.jsx)("span",{className:"text-text-muted px-1 hidden sm:inline",children:"..."})]}),n.map(b=>(0,d.jsx)(f.default,{variant:a===b?"primary":"ghost",size:"sm",onClick:()=>h(b),className:(0,e.cn)("w-9 px-0",a===b?"inline-flex":"hidden sm:inline-flex"),children:b},b)),n[n.length-1]<k&&(0,d.jsxs)(d.Fragment,{children:[n[n.length-1]<k-1&&(0,d.jsx)("span",{className:"text-text-muted px-1 hidden sm:inline",children:"..."}),(0,d.jsx)(f.default,{variant:"ghost",size:"sm",onClick:()=>h(k),className:"w-9 px-0 hidden sm:inline-flex",children:k})]}),(0,d.jsx)(f.default,{variant:"outline",size:"sm",onClick:()=>h(a+1),disabled:a===k,className:"w-9 px-0",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_right"})})]})]})]})}},85306:(a,b,c)=>{c.d(b,{default:()=>j});var d=c(48249),e=c(67484),f=c(19099),g=c(41371),h=c(42196),i=c(32456);function j({children:a}){let[b,c]=(0,e.useState)(!1),k=(0,f.usePathname)(),l=(0,g.i)(a=>a.notifications),m=(0,g.i)(a=>a.removeNotification),n="/dashboard/playground"===k||"/dashboard/basic-chat"===k,o="/dashboard/terminal"===k,p=n||o;return(0,d.jsxs)("div",{className:"flex h-screen w-full overflow-hidden bg-bg",children:[(0,d.jsx)("a",{href:"#main-content",className:"sr-only focus:not-sr-only focus:fixed focus:top-4 focus:left-4 focus:z-[100] focus:rounded-lg focus:bg-surface focus:px-4 focus:py-2 focus:text-text-main focus:shadow-lg",children:"Skip to main content"}),(0,d.jsx)("div",{className:"fixed top-4 right-4 z-[80] flex w-[min(92vw,380px)] flex-col gap-2",children:l.map(a=>{var b;let c="success"===(b=a.type)?{wrapper:"border-green-500/30 bg-green-500/10 text-green-600 dark:text-green-400",icon:"check_circle"}:"error"===b?{wrapper:"border-red-500/30 bg-red-500/10 text-red-600 dark:text-red-400",icon:"error"}:"warning"===b?{wrapper:"border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400",icon:"warning"}:{wrapper:"border-blue-500/30 bg-blue-500/10 text-blue-600 dark:text-blue-400",icon:"info"};return(0,d.jsx)("div",{className:`rounded-lg border px-3 py-2 shadow-lg backdrop-blur-sm ${c.wrapper}`,children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] leading-5",children:c.icon}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[a.title?(0,d.jsx)("p",{className:"text-xs font-semibold mb-0.5",children:a.title}):null,(0,d.jsx)("p",{className:"text-xs whitespace-pre-wrap break-words",children:a.message})]}),a.dismissible?(0,d.jsx)("button",{type:"button",onClick:()=>m(a.id),className:"text-current/70 hover:text-current","aria-label":"Dismiss notification",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})}):null]})},a.id)})}),b&&(0,d.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20 lg:hidden",onClick:()=>c(!1)}),(0,d.jsx)("div",{className:"hidden lg:flex",children:(0,d.jsx)(h.default,{})}),(0,d.jsx)("div",{className:`fixed inset-y-0 left-0 z-50 transform lg:hidden transition-transform duration-300 ease-in-out ${b?"translate-x-0":"-translate-x-full"}`,children:(0,d.jsx)(h.default,{onClose:()=>c(!1)})}),(0,d.jsxs)("main",{id:"main-content",tabIndex:-1,className:"flex flex-col flex-1 h-full min-w-0 relative transition-colors duration-300 isolate",children:[(0,d.jsx)("div",{className:"landing-grid absolute inset-0 pointer-events-none -z-10","aria-hidden":"true"}),p?(0,d.jsxs)("div",{className:"lg:hidden shrink-0 flex min-h-12 items-center gap-2 px-2 py-1 border-b border-border-subtle bg-surface/60",children:[(0,d.jsx)("button",{type:"button",onClick:()=>c(!0),className:"flex size-11 shrink-0 items-center justify-center rounded-lg text-text-main hover:bg-surface-2","aria-label":"Open dashboard navigation",children:(0,d.jsx)("span",{className:"material-symbols-outlined",children:"menu"})}),(0,d.jsx)("span",{className:"text-sm font-semibold",children:o?"Terminal":"Playground"})]}):(0,d.jsx)(i.default,{onMenuClick:()=>c(!0)},k),(0,d.jsx)("div",{className:`flex-1 overflow-y-auto custom-scrollbar ${p?"":"px-3 py-4 sm:px-6 sm:py-7 lg:px-10 lg:py-8"} ${p?"flex flex-col overflow-hidden":""}`,children:(0,d.jsx)("div",{className:`${p?"flex-1 w-full h-full flex flex-col min-h-0":"w-full min-w-0 max-w-6xl mx-auto"}`,children:a})})]})]})}},86209:(a,b,c)=>{c.d(b,{default:()=>n});var d=c(48249),e=c(67484),f=c(81220),g=c(49885),h=c.n(g),i=c(50412);function j(a){return["completed","cancelled","failed"].includes(a)}function k(a){return a?a.replaceAll("_"," "):"waiting"}function l(a){if(!a)return"--:--:--";try{return new Date(a).toLocaleTimeString("id-ID",{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return a}}function m({status:a}){let b={queued:"bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-200",running:"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300",success:"bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300",failed:"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300",failed_invalid_credentials:"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300",failed_exchange:"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300",failed_timeout:"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300",needs_manual:"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",cancelled:"bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-200"};return(0,d.jsx)("span",{className:`rounded-full px-2 py-1 text-[11px] font-medium ${b[a]||b.queued}`,children:a.replaceAll("_"," ")})}function n({isOpen:a,onMethodSelect:b,onImportSuccess:c,onClose:g,initialJobId:h,initialSelectedMethod:o,initialImportMode:p,initialFlowKey:q,onBulkJobChange:r}){let[s,t]=(0,e.useState)(null),[u,v]=(0,e.useState)(""),[w,x]=(0,e.useState)("us-east-1"),[y,z]=(0,e.useState)(""),[A,B]=(0,e.useState)("single-token"),[C,D]=(0,e.useState)(""),[E,F]=(0,e.useState)(String(4)),[G,H]=(0,e.useState)(null),[I,J]=(0,e.useState)(null),[K,L]=(0,e.useState)(null),[M,N]=(0,e.useState)(null),[O,P]=(0,e.useState)(!1),[Q,R]=(0,e.useState)(!1),[S,T]=(0,e.useState)(!1),U=(0,e.useRef)(new Set),V=(0,e.useRef)(0),W=a&&h||null,X=s||(W?"import":null),Y="import"===X&&W&&!s?"bulk-account":A,Z="bulk-account"===Y&&I&&!j(I.status),$="bulk-account"===Y&&I&&j(I.status),_=(0,e.useMemo)(()=>I?.summary?[["Total",I.summary.total],["Queued",I.summary.queued],["Running",I.summary.running],["Success",I.summary.success],["Failed",I.summary.failed],["Manual",I.summary.needs_manual]]:[],[I]),aa=(0,e.useMemo)(()=>Array.isArray(I?.activity)?[...I.activity].reverse():[],[I]),ab=(0,e.useMemo)(()=>(function(a=[]){let b=new Map;return a.forEach(a=>{let c=a.status||"queued";b.has(c)||b.set(c,[]),b.get(c).push(a)}),["running","queued","needs_manual","success","failed","failed_invalid_credentials","failed_exchange","failed_timeout","cancelled"].filter(a=>b.has(a)).map(a=>({status:a,accounts:b.get(a)}))})(I?.accounts||[]),[I]),ac=(0,e.useMemo)(()=>I?.accounts?.length?I.accounts.find(a=>"running"===a.status)||I.accounts.find(a=>"needs_manual"===a.status)||I.accounts.find(a=>"success"===a.status)||I.accounts[0]:null,[I]),ad=a=>{t(a),L(null)},ae=()=>{z(""),D(""),H(null),F(String(4)),L(null),N(null),T(!1),J(null),V.current=0,r?.(null)},af=()=>{Z?g?.():(t(null),B("single-token"),ae())},ag=async()=>{if(!y.trim())return void L("Please enter a refresh token");P(!0),L(null);try{let a=await fetch("/api/oauth/kiro/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"token",refreshToken:y.trim()})}),b=await a.json();if(!a.ok)throw Error(b.error||"Import failed");c?.()}catch(a){L(a.message)}finally{P(!1)}},ah=async a=>{let b=await fetch("/api/oauth/kiro/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:"token",refreshTokens:a})}),d=await b.json();if(!b.ok)throw Error(d.error||"Bulk import failed");H({success:d.imported||0,failed:d.failed||0}),c?.()},ai=async a=>{let b=await fetch("/api/oauth/kiro/bulk-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accounts:a,concurrency:Number.parseInt(E,10)||4})}),c=await b.json();if(!b.ok){let a=Array.isArray(c.invalidLines)&&c.invalidLines.length>0?` Invalid lines: ${c.invalidLines.join(", ")}`:"";throw Error((c.error||"Bulk account import failed")+a)}J(c.job||null),N(null),c.job?.jobId&&U.current.delete(c.job.jobId),H(null)},aj=async()=>{let a=C.split("\n").map(a=>a.trim()).filter(Boolean);if(!a.length)return void L("bulk-account"===Y?"Please enter at least one gmail|password line":"Please enter at least one refresh token line");P(!0),L(null),H(null);try{"bulk-account"===Y?await ai(a):await ah(a)}catch(a){L(a.message)}finally{P(!1)}},ak=async()=>{if(I?.jobId)try{let a=await fetch(`/api/oauth/kiro/bulk-import/${I.jobId}/cancel`,{method:"POST"}),b=await a.json();if(!a.ok)throw Error(b.error||"Failed to cancel job");b.job&&J(b.job)}catch(a){L(a.message)}},al=()=>{ae(),c?.()},am=async a=>{if(I?.jobId&&a)try{let b=await fetch(`/api/oauth/kiro/bulk-import/${I.jobId}/manual/${a}`,{method:"POST"}),c=await b.json();if(!b.ok)throw Error(c.error||"Failed to open manual session");c.job&&J(c.job)}catch(a){L(a.message)}},an=a=>{b("social",{provider:a})};return(0,d.jsx)(i.aF,{isOpen:a,title:"Connect Kiro",onClose:g,size:"full",className:"max-w-[min(96vw,1540px)]",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[!X&&(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)("p",{className:"mb-4 text-sm text-text-muted",children:"Choose your authentication method:"}),(0,d.jsx)("button",{onClick:()=>b("builder-id"),className:"w-full rounded-lg border border-border p-4 text-left transition-colors hover:bg-sidebar",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined mt-0.5 text-primary",children:"shield"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"mb-1 font-semibold",children:"AWS Builder ID"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Recommended for most users. Free AWS account required."})]})]})}),(0,d.jsx)("button",{onClick:()=>ad("idc"),className:"w-full rounded-lg border border-border p-4 text-left transition-colors hover:bg-sidebar",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined mt-0.5 text-primary",children:"business"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"mb-1 font-semibold",children:"AWS IAM Identity Center"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"For enterprise users with custom AWS IAM Identity Center."})]})]})}),(0,d.jsx)("button",{onClick:()=>ad("social-google"),className:"hidden w-full rounded-lg border border-border p-4 text-left transition-colors hover:bg-sidebar",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined mt-0.5 text-primary",children:"account_circle"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"mb-1 font-semibold",children:"Google Account"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your Google account (manual callback)."})]})]})}),(0,d.jsx)("button",{onClick:()=>ad("social-github"),className:"hidden w-full rounded-lg border border-border p-4 text-left transition-colors hover:bg-sidebar",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined mt-0.5 text-primary",children:"code"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"mb-1 font-semibold",children:"GitHub Account"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your GitHub account (manual callback)."})]})]})}),(0,d.jsx)("button",{onClick:()=>ad("import"),className:"w-full rounded-lg border border-border p-4 text-left transition-colors hover:bg-sidebar",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)("span",{className:"material-symbols-outlined mt-0.5 text-primary",children:"file_upload"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"mb-1 font-semibold",children:"Bulk Option"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Import a single token, bulk tokens, or bulk Google accounts."})]})]})})]}),"idc"===X&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"mb-2 block text-sm font-medium",children:["IDC Start URL ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)(i.pd,{value:u,onChange:a=>v(a.target.value),placeholder:"https://your-org.awsapps.com/start",className:"font-mono text-sm"}),(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Your organization's AWS IAM Identity Center URL"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"mb-2 block text-sm font-medium",children:"AWS Region"}),(0,d.jsx)(i.pd,{value:w,onChange:a=>x(a.target.value),placeholder:"us-east-1",className:"font-mono text-sm"}),(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"AWS region for your Identity Center (default: us-east-1)"})]}),K&&(0,d.jsx)("p",{className:"text-sm text-red-600",children:K}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:()=>{u.trim()?b("idc",{startUrl:u.trim(),region:w}):L("Please enter your IDC start URL")},fullWidth:!0,children:"Continue"}),(0,d.jsx)(i.$n,{onClick:af,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-google"===X&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-4 dark:border-amber-800 dark:bg-amber-900/20",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,d.jsxs)("div",{className:"flex-1 text-sm",children:[(0,d.jsx)("p",{className:"mb-1 font-medium text-amber-900 dark:text-amber-100",children:"Manual Callback Required"}),(0,d.jsx)("p",{className:"text-amber-800 dark:text-amber-200",children:"After login, you'll need to copy the callback URL from your browser and paste it back here."})]})]})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:()=>an("google"),fullWidth:!0,children:"Continue with Google"}),(0,d.jsx)(i.$n,{onClick:af,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-github"===X&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-4 dark:border-amber-800 dark:bg-amber-900/20",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,d.jsxs)("div",{className:"flex-1 text-sm",children:[(0,d.jsx)("p",{className:"mb-1 font-medium text-amber-900 dark:text-amber-100",children:"Manual Callback Required"}),(0,d.jsx)("p",{className:"text-amber-800 dark:text-amber-200",children:"After login, you'll need to copy the callback URL from your browser and paste it back here."})]})]})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:()=>an("github"),fullWidth:!0,children:"Continue with GitHub"}),(0,d.jsx)(i.$n,{onClick:af,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"import"===X&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,d.jsx)(i.$n,{size:"sm",variant:"single-token"===Y?"primary":"ghost",onClick:()=>{B("single-token"),H(null),L(null)},disabled:Z,children:"Single Token"}),(0,d.jsx)(i.$n,{size:"sm",variant:"bulk-token"===Y?"primary":"ghost",onClick:()=>{B("bulk-token"),H(null),L(null)},disabled:Z,children:"Bulk Token"}),(0,d.jsx)(i.$n,{size:"sm",variant:"bulk-account"===Y?"primary":"ghost",onClick:()=>{B("bulk-account"),H(null),L(null)},children:"Bulk Account"})]}),"single-token"===Y&&(0,d.jsxs)(d.Fragment,{children:[Q&&(0,d.jsxs)("div",{className:"py-6 text-center",children:[(0,d.jsx)("div",{className:"mx-auto mb-4 flex size-16 items-center justify-center rounded-full bg-primary/10",children:(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-3xl text-primary",children:"progress_activity"})}),(0,d.jsx)("h3",{className:"mb-2 text-lg font-semibold",children:"Auto-detecting token..."}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from AWS SSO cache"})]}),!Q&&(0,d.jsxs)(d.Fragment,{children:[S&&(0,d.jsx)("div",{className:"rounded-lg border border-green-200 bg-green-50 p-3 dark:border-green-800 dark:bg-green-900/20",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,d.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Token auto-detected from Kiro IDE successfully!"})]})}),!S&&!K&&(0,d.jsx)("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-800 dark:bg-blue-900/20",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Kiro IDE not detected. Please paste your refresh token manually."})]})}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"mb-2 block text-sm font-medium",children:["Refresh Token ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)(i.pd,{value:y,onChange:a=>z(a.target.value),placeholder:"Token will be auto-filled...",className:"font-mono text-sm"})]}),K&&(0,d.jsx)("div",{className:"rounded-lg border border-red-200 bg-red-50 p-3 dark:border-red-800 dark:bg-red-900/20",children:(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:K})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:ag,fullWidth:!0,disabled:O||!y.trim(),children:O?"Importing...":"Import Token"}),(0,d.jsx)(i.$n,{onClick:af,variant:"ghost",fullWidth:!0,children:"Back"})]})]})]}),"bulk-token"===Y&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-800 dark:bg-blue-900/20",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Bulk token import accepts one refresh token per line."})]})}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"mb-2 block text-sm font-medium",children:["Bulk Refresh Tokens ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)("textarea",{value:C,onChange:a=>D(a.target.value),placeholder:"aorAAAAAG...\naorAAAAAG...",className:"min-h-[160px] w-full resize-y rounded-lg border border-border bg-background px-3 py-2 font-mono text-sm focus:outline-none focus:ring-1 focus:ring-primary"}),(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"One refresh token per line."})]}),G&&(0,d.jsx)("div",{className:`text-sm font-medium ${G.failed>0?"text-yellow-600 dark:text-yellow-400":"text-green-600 dark:text-green-400"}`,children:`Success: ${G.success} imported${G.failed>0?`, ${G.failed} failed`:""}`}),K&&(0,d.jsx)("div",{className:"rounded-lg border border-red-200 bg-red-50 p-3 dark:border-red-800 dark:bg-red-900/20",children:(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:K})}),M&&(0,d.jsx)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-3 dark:border-amber-800 dark:bg-amber-900/20",children:(0,d.jsx)("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:M})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:aj,fullWidth:!0,disabled:O||!C.trim(),children:O?"Importing...":"Import Tokens"}),(0,d.jsx)(i.$n,{onClick:af,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"bulk-account"===Y&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-800 dark:bg-blue-900/20",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Bulk account import runs Playwright in the background, keeps passwords in memory only, and only needs manual action when Google or Kiro blocks a worker. Recommended worker count for a 24 GB machine: 4."})]})}),!I&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"mb-2 block text-sm font-medium",children:["Bulk Accounts ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)("textarea",{value:C,onChange:a=>D(a.target.value),placeholder:"gmail1@example.com|password1\ngmail2@example.com|password2",className:"min-h-[180px] w-full resize-y rounded-lg border border-border bg-background px-3 py-2 font-mono text-sm focus:outline-none focus:ring-1 focus:ring-primary"}),(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"One account per line in the format gmail|password."})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"mb-2 block text-sm font-medium",children:"Concurrent Workers"}),(0,d.jsx)(i.pd,{type:"number",min:"1",max:"8",value:E,onChange:a=>F(a.target.value),placeholder:"4"}),(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:"Default 4. Allowed range: 1 to 8 workers."})]})]}),I&&(0,d.jsxs)("div",{className:"space-y-4 rounded-xl border border-border p-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{className:"font-semibold",children:"Bulk Import Job"}),(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Job ID: ",(0,d.jsx)("span",{className:"font-mono",children:I.jobId})]}),(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Status: ",(0,d.jsx)("span",{className:"font-medium",children:I.status})," | Workers: ",I.concurrency]}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Browser workers run in the background. Close this modal if needed and reopen it later from the provider page with Resume Bulk Progress."})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[Z&&(0,d.jsx)(i.$n,{size:"sm",variant:"secondary",onClick:ak,children:"Cancel Job"}),$&&(0,d.jsx)(i.$n,{size:"sm",onClick:al,children:"Done & Refresh"})]})]}),(0,d.jsx)("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:_.map(([a,b])=>(0,d.jsxs)("div",{className:"rounded-lg bg-sidebar px-3 py-2",children:[(0,d.jsx)("p",{className:"text-[11px] uppercase tracking-wide text-text-muted",children:a}),(0,d.jsx)("p",{className:"text-lg font-semibold",children:b})]},a))}),I.error&&(0,d.jsx)("div",{className:"rounded-lg border border-red-200 bg-red-50 p-3 text-sm text-red-700 dark:border-red-800 dark:bg-red-900/20 dark:text-red-300",children:I.error}),I.summary?.needs_manual>0&&(0,d.jsx)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-3 text-sm text-amber-800 dark:border-amber-800 dark:bg-amber-900/20 dark:text-amber-200",children:"Some accounts need manual assist. Open the blocked worker session below, finish the Google or Kiro prompts, and the job will continue updating automatically."}),(0,d.jsxs)("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,7fr)_minmax(320px,3fr)]",children:[(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{className:"overflow-hidden rounded-xl border border-border bg-sidebar",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2 border-b border-border px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-semibold",children:"Live Browser Preview"}),(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:[I.preview?.email||ac?.email||"Waiting for worker",I.preview?.workerId?` | Worker ${I.preview.workerId}`:""]})]}),(0,d.jsxs)("div",{className:"text-right text-xs text-text-muted",children:[(0,d.jsx)("p",{children:k(I.preview?.step||ac?.currentStep)}),(0,d.jsxs)("p",{children:["Updated ",l(I.preview?.updatedAt||ac?.updatedAt)]})]})]}),(0,d.jsx)("div",{className:"relative bg-black/90",children:I.preview?.imageData?(0,d.jsx)(f.default,{src:I.preview.imageData,alt:`Live worker preview for ${I.preview.email||"Kiro import"}`,width:1440,height:900,unoptimized:!0,className:"h-[420px] w-full object-contain"}):(0,d.jsxs)("div",{className:"flex h-[420px] flex-col items-center justify-center gap-3 px-6 text-center text-slate-200",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-5xl text-primary/80",children:"browser_updated"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-base font-medium",children:"Preview will appear when a worker opens Google or Kiro"}),(0,d.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"The import keeps running in the background even if the screenshot is not available yet."})]})]})})]}),(0,d.jsx)("div",{className:"space-y-4",children:ab.map(a=>{var b;let c;return(0,d.jsxs)("div",{className:`rounded-xl border p-4 ${(b=a.status,(c={queued:"border-slate-200 bg-slate-50/80 dark:border-slate-800 dark:bg-slate-900/20",running:"border-blue-200 bg-blue-50/80 dark:border-blue-900/50 dark:bg-blue-950/20",success:"border-green-200 bg-green-50/80 dark:border-green-900/50 dark:bg-green-950/20",failed:"border-red-200 bg-red-50/80 dark:border-red-900/50 dark:bg-red-950/20",failed_invalid_credentials:"border-red-200 bg-red-50/80 dark:border-red-900/50 dark:bg-red-950/20",failed_exchange:"border-red-200 bg-red-50/80 dark:border-red-900/50 dark:bg-red-950/20",failed_timeout:"border-red-200 bg-red-50/80 dark:border-red-900/50 dark:bg-red-950/20",needs_manual:"border-amber-200 bg-amber-50/80 dark:border-amber-900/50 dark:bg-amber-950/20",cancelled:"border-slate-200 bg-slate-50/80 dark:border-slate-800 dark:bg-slate-900/20"})[b]||c.queued)}`,children:[(0,d.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(m,{status:a.status}),(0,d.jsx)("p",{className:"text-sm font-semibold capitalize",children:k(a.status)})]}),(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:[a.accounts.length," account",a.accounts.length>1?"s":""]})]}),(0,d.jsx)("div",{className:"grid gap-3 xl:grid-cols-2",children:a.accounts.map(a=>(0,d.jsxs)("div",{className:"rounded-xl border border-border bg-background/80 p-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-sm font-semibold",children:a.email}),(0,d.jsxs)("p",{className:"text-[11px] text-text-muted",children:["Line ",a.line,a.workerId?` | Worker ${a.workerId}`:""," | ",l(a.updatedAt)]})]}),(0,d.jsx)(m,{status:a.status})]}),(0,d.jsxs)("div",{className:"mt-3 rounded-lg border border-border/70 bg-sidebar/70 px-3 py-2",children:[(0,d.jsx)("p",{className:"text-[11px] uppercase tracking-wide text-text-muted",children:"Current Step"}),(0,d.jsx)("p",{className:"mt-1 text-sm font-medium capitalize",children:k(a.currentStep)})]}),a.logs?.length>0&&(0,d.jsx)("div",{className:"mt-3 space-y-2",children:a.logs.slice(-3).reverse().map(a=>(0,d.jsxs)("div",{className:"rounded-lg bg-sidebar/60 px-3 py-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,d.jsx)("p",{className:"text-xs font-medium capitalize",children:k(a.step)}),(0,d.jsx)("span",{className:"text-[11px] text-text-muted",children:l(a.at)})]}),(0,d.jsx)("p",{className:"mt-1 text-xs text-text-muted",children:a.message})]},a.id))}),a.error&&(0,d.jsx)("p",{className:"mt-3 text-xs text-red-500",children:a.error}),a.manualSessionAvailable&&a.workerId?(0,d.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,d.jsx)(i.$n,{size:"sm",variant:a.manualSessionOpened?"secondary":"primary",onClick:()=>am(a.workerId),children:a.manualSessionOpened?"Re-open Manual Session":"Open Manual Session"}),(0,d.jsx)("p",{className:"text-[11px] text-text-muted",children:"Open only if this worker is blocked by CAPTCHA, 2FA, or recovery prompts."})]}):null]},`${a.email}-${a.line}`))})]},a.status)})})]}),(0,d.jsxs)("div",{className:"rounded-xl border border-border bg-sidebar/70",children:[(0,d.jsxs)("div",{className:"border-b border-border px-4 py-3",children:[(0,d.jsx)("p",{className:"text-sm font-semibold",children:"Live Activity Log"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Every worker step is recorded here in near real time."})]}),(0,d.jsxs)("div",{className:"max-h-[720px] space-y-3 overflow-y-auto p-4",children:[0===aa.length&&(0,d.jsx)("div",{className:"rounded-lg bg-background/70 px-3 py-4 text-sm text-text-muted",children:"Waiting for the first worker event..."}),aa.map(a=>(0,d.jsxs)("div",{className:"rounded-lg border border-border/70 bg-background/80 px-3 py-3",children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-sm font-semibold",children:a.email}),(0,d.jsxs)("p",{className:"text-[11px] text-text-muted",children:[a.workerId?`Worker ${a.workerId}`:"Waiting"," | ",k(a.step)]})]}),(0,d.jsx)("span",{className:"shrink-0 text-[11px] text-text-muted",children:l(a.at)})]}),(0,d.jsx)("p",{className:"mt-2 text-xs text-text-muted",children:a.message})]},a.id))]})]})]})]}),K&&(0,d.jsx)("div",{className:"rounded-lg border border-red-200 bg-red-50 p-3 dark:border-red-800 dark:bg-red-900/20",children:(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:K})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[!I&&(0,d.jsx)(i.$n,{onClick:aj,fullWidth:!0,disabled:O||!C.trim(),children:O?"Starting...":"Start Bulk Import"}),I&&!$&&(0,d.jsx)(i.$n,{onClick:ak,fullWidth:!0,variant:"secondary",disabled:!Z,children:Z?"Cancel Running Job":"Job Stopped"}),$&&(0,d.jsx)(i.$n,{onClick:al,fullWidth:!0,children:"Done & Refresh Connections"}),(0,d.jsx)(i.$n,{onClick:af,variant:"ghost",fullWidth:!0,children:I?"Back":"Cancel"})]})]})]})]})})}m.propTypes={status:h().string.isRequired},n.propTypes={isOpen:h().bool.isRequired,onMethodSelect:h().func.isRequired,onImportSuccess:h().func,initialJobId:h().string,initialSelectedMethod:h().string,initialImportMode:h().string,initialFlowKey:h().oneOfType([h().string,h().number]),onBulkJobChange:h().func,onClose:h().func.isRequired}},87226:(a,b,c)=>{c.d(b,{default:()=>W});var d=c(48249),e=c(67484),f=c(19099),g=c(96919),h=c(75171),i=c(17660),j=c(49885),k=c.n(j);let l=a=>new Intl.NumberFormat().format(a||0);function m({stats:a}){let b,c=a.totalCachedTokens||0,e=a.totalPromptTokens>0?Math.min(100,c/a.totalPromptTokens*100):0,f=[{label:"Requests",value:l(a.totalRequests),icon:"send",valueClass:"text-text-main",iconClass:"bg-primary/[0.08] text-primary",detail:"All routed calls"},{label:"Input Tokens",value:l(a.totalPromptTokens),icon:"input",valueClass:"text-primary",iconClass:"bg-primary/[0.08] text-primary",detail:"Prompt and context"},{label:"Cached Tokens",value:l(c),icon:"database",valueClass:"text-info",iconClass:"bg-info/[0.08] text-info",detail:c>0?`${e.toFixed(1)}% cache rate`:"No cache hits yet"},{label:"Output Tokens",value:l(a.totalCompletionTokens),icon:"output",valueClass:"text-success",iconClass:"bg-success/[0.08] text-success",detail:"Generated responses"},{label:"Est. Cost",value:`~${(b=a.totalCost,`$${(b||0).toFixed(2)}`)}`,icon:"payments",valueClass:"text-warning",iconClass:"bg-warning/[0.08] text-warning",detail:"Estimated, not billing",className:"col-span-2 sm:col-span-1"}];return(0,d.jsx)("div",{className:"grid min-w-0 grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-5",children:f.map(a=>(0,d.jsxs)(i.default,{padding:"none",className:`relative flex min-h-[104px] min-w-0 flex-col overflow-hidden p-3.5 sm:min-h-[112px] sm:p-4 ${a.className||""}`,children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,d.jsx)("span",{className:"pt-0.5 text-xs font-semibold text-text-muted",children:a.label}),(0,d.jsx)("span",{className:`material-symbols-outlined flex size-7 shrink-0 items-center justify-center rounded-md text-[16px] ${a.iconClass}`,children:a.icon})]}),(0,d.jsx)("span",{className:`mt-1 truncate text-[22px] font-semibold tracking-[-0.02em] sm:text-2xl ${a.valueClass}`,children:a.value}),(0,d.jsx)("span",{className:"mt-auto text-[11px] leading-[1.3] text-text-muted",children:a.detail})]},a.label))})}m.propTypes={stats:k().object.isRequired};let n=a=>new Intl.NumberFormat().format(a||0),o=a=>`$${(a||0).toFixed(2)}`;function p(a){if(!a)return"Never";let b=Math.floor((Date.now()-new Date(a))/6e4);return b<1?"Just now":b<60?`${b}m ago`:b<1440?`${Math.floor(b/60)}h ago`:new Date(a).toLocaleDateString()}function q({field:a,currentSort:b,currentOrder:c}){return b!==a?(0,d.jsx)("span",{className:"ml-1 opacity-20",children:"↕"}):(0,d.jsx)("span",{className:"ml-1",children:"asc"===c?"↑":"↓"})}function r({item:a,viewMode:b,isSummary:c=!1}){if("tokens"===b){let b=a.cachedTokens;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:c&&void 0===a.promptTokens?"—":n(a.promptTokens)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-info",children:null==b?"—":n(b)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:c&&void 0===a.completionTokens?"—":n(a.completionTokens)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right font-medium",children:n(a.totalTokens)})]})}return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:c&&void 0===a.inputCost?"—":o(a.inputCost)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:c&&void 0===a.outputCost?"—":o(a.outputCost)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right font-medium text-warning",children:o(a.totalCost||a.cost)})]})}function s({title:a,columns:b,groupedData:c,tableType:f,sortBy:g,sortOrder:h,onToggleSort:j,viewMode:k,storageKey:l,renderDetailCells:m,renderSummaryCells:n,emptyMessage:o}){let[p,t]=(0,e.useState)(new Set),u=(0,e.useCallback)(a=>{t(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),v=(0,e.useMemo)(()=>"tokens"===k?[{field:"promptTokens",label:"Input Tokens"},{field:"cachedTokens",label:"Cached"},{field:"completionTokens",label:"Output Tokens"},{field:"totalTokens",label:"Total Tokens"}]:[{field:"promptTokens",label:"Input Cost"},{field:"completionTokens",label:"Output Cost"},{field:"cost",label:"Total Cost"}],[k]),w=b.length+v.length;return(0,d.jsxs)(i.default,{className:"overflow-hidden",children:[(0,d.jsx)("div",{className:"p-4 border-b border-border bg-bg-subtle/50",children:(0,d.jsx)("h3",{className:"font-semibold",children:a})}),(0,d.jsx)("div",{className:"overflow-x-auto",children:(0,d.jsxs)("table",{className:"w-full text-sm text-left",children:[(0,d.jsx)("thead",{className:"bg-bg-subtle/30 text-text-muted uppercase text-xs",children:(0,d.jsxs)("tr",{children:[b.map(a=>(0,d.jsxs)("th",{className:`px-6 py-3 cursor-pointer hover:bg-bg-subtle/50 ${"right"===a.align?"text-right":""}`,onClick:()=>j(f,a.field),children:[a.label," ",(0,d.jsx)(q,{field:a.field,currentSort:g,currentOrder:h})]},a.field)),v.map(a=>(0,d.jsxs)("th",{className:"px-6 py-3 text-right cursor-pointer hover:bg-bg-subtle/50",onClick:()=>j(f,a.field),children:[a.label," ",(0,d.jsx)(q,{field:a.field,currentSort:g,currentOrder:h})]},a.field))]})}),(0,d.jsxs)("tbody",{className:"divide-y divide-border",children:[c.map(a=>(0,d.jsxs)(e.Fragment,{children:[(0,d.jsxs)("tr",{className:"group-summary cursor-pointer hover:bg-bg-subtle/50 transition-colors",onClick:()=>u(a.groupKey),children:[(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:`material-symbols-outlined text-[18px] text-text-muted transition-transform ${p.has(a.groupKey)?"rotate-90":""}`,children:"chevron_right"}),(0,d.jsx)("span",{className:`font-medium transition-colors ${a.summary.pending>0?"text-primary":""}`,children:a.groupKey})]})}),n(a),(0,d.jsx)(r,{item:a.summary,viewMode:k,isSummary:!0})]}),p.has(a.groupKey)&&a.items.map(a=>(0,d.jsxs)("tr",{className:"group-detail hover:bg-bg-subtle/20 transition-colors",children:[m(a),(0,d.jsx)(r,{item:a,viewMode:k})]},`detail-${a.key}`))]},a.groupKey)),0===c.length&&(0,d.jsx)("tr",{children:(0,d.jsx)("td",{colSpan:w,className:"px-6 py-8 text-center text-text-muted",children:o})})]})]})})]})}q.propTypes={field:k().string.isRequired,currentSort:k().string.isRequired,currentOrder:k().string.isRequired},r.propTypes={item:k().object.isRequired,viewMode:k().string.isRequired,isSummary:k().bool},s.propTypes={title:k().string.isRequired,columns:k().arrayOf(k().shape({field:k().string.isRequired,label:k().string.isRequired,align:k().string})).isRequired,groupedData:k().array.isRequired,tableType:k().string.isRequired,sortBy:k().string.isRequired,sortOrder:k().string.isRequired,onToggleSort:k().func.isRequired,viewMode:k().string.isRequired,storageKey:k().string.isRequired,renderDetailCells:k().func.isRequired,renderSummaryCells:k().func.isRequired,emptyMessage:k().string.isRequired};var t=c(96103),u=c(22805);c(71763);let v={padding:.14,duration:200};function w({data:a}){let{label:b,color:c,imageUrl:f,textIcon:g,active:h}=a,[i,j]=(0,e.useState)(!1);return(0,d.jsxs)("div",{className:"flex items-center gap-2 rounded-lg border bg-surface px-3 py-2 transition-all duration-300",style:{borderColor:h?c:"var(--color-border)",boxShadow:h?`0 0 12px ${c}30`:"none",minWidth:"140px"},children:[(0,d.jsx)(t.h7,{type:"target",position:u.yX.Top,id:"top",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(t.h7,{type:"target",position:u.yX.Bottom,id:"bottom",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(t.h7,{type:"target",position:u.yX.Left,id:"left",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(t.h7,{type:"target",position:u.yX.Right,id:"right",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)("div",{className:"flex size-7 shrink-0 items-center justify-center rounded-md",style:{backgroundColor:`${c}15`},children:i?(0,d.jsx)("span",{className:"text-xs font-bold",style:{color:c},children:g}):(0,d.jsx)("img",{src:f,alt:b,className:"size-5 rounded-sm object-contain",onError:()=>j(!0)})}),(0,d.jsx)("span",{className:"truncate text-sm font-medium",style:{color:h?c:"var(--color-text)"},children:b}),h&&(0,d.jsxs)("span",{className:"relative flex h-2 w-2 shrink-0",children:[(0,d.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full opacity-75",style:{backgroundColor:c}}),(0,d.jsx)("span",{className:"relative inline-flex rounded-full h-2 w-2",style:{backgroundColor:c}})]})]})}function x({data:a}){return(0,d.jsxs)("div",{className:"flex min-w-[118px] items-center justify-center rounded-lg border border-primary bg-primary/[0.06] px-4 py-2.5 shadow-sm",children:[(0,d.jsx)(t.h7,{type:"source",position:u.yX.Top,id:"top",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(t.h7,{type:"source",position:u.yX.Bottom,id:"bottom",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(t.h7,{type:"source",position:u.yX.Left,id:"left",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)(t.h7,{type:"source",position:u.yX.Right,id:"right",className:"!bg-transparent !border-0 !w-0 !h-0"}),(0,d.jsx)("img",{src:"/favicon.svg",alt:"ZevaiRouter",className:"mr-2 size-5"}),(0,d.jsx)("span",{className:"text-xs font-semibold text-primary",children:"ZevaiRouter"}),a.activeCount>0&&(0,d.jsx)("span",{className:"ml-2 rounded-full bg-primary px-1.5 py-0.5 text-[10px] font-semibold text-white",children:a.activeCount})]})}w.propTypes={data:k().object.isRequired},x.propTypes={data:k().object.isRequired};let y={provider:w,router:x};function z({providers:a=[],activeRequests:b=[],lastProvider:c="",errorProvider:f=""}){let h=(0,e.useMemo)(()=>b.map(a=>a.provider?.toLowerCase()).filter(Boolean).sort().join(","),[b]),i=c?.toLowerCase()||"",j=f?.toLowerCase()||"",k=(0,e.useMemo)(()=>new Set(h?h.split(","):[]),[h]),l=(0,e.useMemo)(()=>new Set(i?[i]:[]),[i]),m=(0,e.useMemo)(()=>new Set(j?[j]:[]),[j]),n=(0,e.useRef)({}),[o,p]=(0,e.useState)(0),q=(0,e.useMemo)(()=>{let a=Date.now(),b=new Set;for(let c of k){let d=n.current[c];(!d||a-d<6e4)&&b.add(c)}return b},[k,o]),{nodes:r,edges:s}=(0,e.useMemo)(()=>(function(a,b,c,d){let e=a.length,f=Math.max(270,180*e/(2*Math.PI)),h=Math.max(150,.52*f);if(0===e)return{nodes:[{id:"router",type:"router",position:{x:0,y:0},data:{activeCount:0},draggable:!1}],edges:[]};let i=[],j=[];return i.push({id:"router",type:"router",position:{x:-59,y:-20},data:{activeCount:b.size},draggable:!1}),a.forEach((a,k)=>{var l,m;let n,o,p=(l=a.provider,g.Q2[l]||{color:"#6b7280",name:l}),q=b.has(a.provider?.toLowerCase()),r=!q&&c.has(a.provider?.toLowerCase()),s=!q&&d.has(a.provider?.toLowerCase()),t=`provider-${a.provider}`,u={label:(p.name!==a.provider?p.name:null)||a.name||a.provider,color:p.color||"#6b7280",imageUrl:(m=a.provider,`/providers/${m}.png`),textIcon:p.textIcon||(a.provider||"?").slice(0,2).toUpperCase(),active:q},v=-Math.PI/2+2*Math.PI*k/e,w=f*Math.cos(v),x=h*Math.sin(v);Math.abs(v+Math.PI/2)<Math.PI/4||Math.abs(v-3*Math.PI/2)<Math.PI/4?(n="top",o="bottom"):Math.abs(v-Math.PI/2)<Math.PI/4?(n="bottom",o="top"):w>0?(n="right",o="left"):(n="left",o="right"),i.push({id:t,type:"provider",position:{x:w-80,y:x-22},data:u,draggable:!1}),j.push({id:`e-${t}`,source:"router",sourceHandle:n,target:t,targetHandle:o,animated:q,style:(p.color,s?{stroke:"#ef4444",strokeWidth:2.5,opacity:.9}:q?{stroke:"#22c55e",strokeWidth:2.5,opacity:.9}:r?{stroke:"#f59e0b",strokeWidth:2,opacity:.7}:{stroke:"var(--color-border)",strokeWidth:1,opacity:.3})})}),{nodes:i,edges:j}})(a,q,l,m),[a,q,l,m]),u=(0,e.useMemo)(()=>a.map(a=>a.provider).sort().join(","),[a]),w=(0,e.useRef)(null),x=(0,e.useRef)(null),A=(0,e.useCallback)(a=>{w.current=a,setTimeout(()=>a.fitView(v),50)},[]);return(0,d.jsxs)("div",{ref:x,className:"flex h-[340px] w-full min-w-0 flex-col overflow-hidden rounded-[14px] border border-border-subtle bg-surface/94 shadow-[0_14px_34px_-26px_rgba(15,23,42,0.28)] sm:h-[440px]",children:[(0,d.jsxs)("div",{className:"flex shrink-0 items-center justify-between border-b border-border-subtle bg-surface/75 px-4 py-3.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[17px] text-primary",children:"route"}),(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main",children:"Routing map"})]}),(0,d.jsxs)("span",{className:"text-[11px] font-medium text-text-muted",children:[a.length," ",1===a.length?"provider":"providers"]})]}),(0,d.jsx)("div",{className:"min-h-0 flex-1 bg-bg/35",children:0===a.length?(0,d.jsx)("div",{className:"flex h-full items-center justify-center text-sm text-text-muted",children:"No providers connected"}):(0,d.jsx)(t.Gc,{nodes:r,edges:s,nodeTypes:y,fitView:!0,fitViewOptions:v,minZoom:.1,maxZoom:2,onInit:A,proOptions:{hideAttribution:!0},panOnDrag:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,preventScrolling:!1,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,children:(0,d.jsx)(t.H2,{showInteractive:!1,className:"react-flow-controls-custom"})},u)})]})}z.propTypes={providers:k().arrayOf(k().shape({id:k().string,provider:k().string,name:k().string})),activeRequests:k().arrayOf(k().shape({provider:k().string,model:k().string,account:k().string})),lastProvider:k().string,errorProvider:k().string};var A=c(48679),B=c(70452),C=c(28946),D=c(22393),E=c(54206),F=c(57570),G=c(44780);let H=a=>a>=1e6?`${(a/1e6).toFixed(1)}M`:a>=1e3?`${(a/1e3).toFixed(1)}K`:String(a||0),I=a=>`$${(a||0).toFixed(4)}`,J={today:"Today","24h":"Last 24 hours","7d":"Last 7 days","30d":"Last 30 days","60d":"Last 60 days"};function K({period:a="7d"}){let[b,c]=(0,e.useState)([]),[f,g]=(0,e.useState)(!0),[h,j]=(0,e.useState)("tokens");(0,e.useCallback)(async()=>{g(!0);try{let b=await fetch(`/api/usage/chart?period=${a}`);if(b.ok){let a=await b.json();c(a)}}catch(a){console.error("Failed to fetch chart data:",a)}finally{g(!1)}},[a]);let k=b.some(a=>a.tokens>0||a.cost>0);return(0,d.jsxs)(i.default,{className:"flex min-w-0 flex-col gap-5 p-4 sm:p-5",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Usage trend"}),(0,d.jsxs)("p",{className:"mt-0.5 text-[11px] text-text-muted",children:[J[a]||a," \xb7 routed traffic over time"]})]}),(0,d.jsxs)("div",{className:"grid w-full grid-cols-2 items-center gap-1 rounded-lg border border-border bg-bg-subtle p-1 sm:w-auto",children:[(0,d.jsx)("button",{onClick:()=>j("tokens"),className:`rounded-md px-3 py-1 text-sm font-medium transition-colors ${"tokens"===h?"bg-primary text-white shadow-sm":"text-text-muted hover:bg-bg-hover hover:text-text"}`,children:"Tokens"}),(0,d.jsx)("button",{onClick:()=>j("cost"),className:`rounded-md px-3 py-1 text-sm font-medium transition-colors ${"cost"===h?"bg-primary text-white shadow-sm":"text-text-muted hover:bg-bg-hover hover:text-text"}`,children:"Cost"})]})]}),f?(0,d.jsx)("div",{className:"h-48 flex items-center justify-center text-text-muted text-sm",children:"Loading..."}):k?(0,d.jsx)(A.u,{width:"100%",height:220,children:(0,d.jsxs)(B.Q,{data:b,margin:{top:4,right:8,left:0,bottom:0},children:[(0,d.jsxs)("defs",{children:[(0,d.jsxs)("linearGradient",{id:"gradTokens",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,d.jsx)("stop",{offset:"5%",stopColor:"#6366f1",stopOpacity:.25}),(0,d.jsx)("stop",{offset:"95%",stopColor:"#6366f1",stopOpacity:0})]}),(0,d.jsxs)("linearGradient",{id:"gradCost",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,d.jsx)("stop",{offset:"5%",stopColor:"#f59e0b",stopOpacity:.25}),(0,d.jsx)("stop",{offset:"95%",stopColor:"#f59e0b",stopOpacity:0})]})]}),(0,d.jsx)(C.d,{strokeDasharray:"3 3",strokeOpacity:.1}),(0,d.jsx)(D.W,{dataKey:"label",tick:{fontSize:10,fill:"currentColor",fillOpacity:.5},tickLine:!1,axisLine:!1,interval:"preserveStartEnd"}),(0,d.jsx)(E.h,{tick:{fontSize:10,fill:"currentColor",fillOpacity:.5},tickLine:!1,axisLine:!1,tickFormatter:"tokens"===h?H:I,width:50}),(0,d.jsx)(F.m,{contentStyle:{backgroundColor:"var(--color-bg)",border:"1px solid var(--color-border)",borderRadius:"8px",fontSize:"12px"},formatter:(a,b)=>"tokens"===b?[H(a),"Tokens"]:[I(a),"Cost"]}),"tokens"===h?(0,d.jsx)(G.Gk,{type:"monotone",dataKey:"tokens",stroke:"#6366f1",strokeWidth:2,fill:"url(#gradTokens)",dot:!1,activeDot:{r:4}}):(0,d.jsx)(G.Gk,{type:"monotone",dataKey:"cost",stroke:"#f59e0b",strokeWidth:2,fill:"url(#gradCost)",dot:!1,activeDot:{r:4}})]})}):(0,d.jsx)("div",{className:"h-48 flex items-center justify-center text-text-muted text-sm",children:"No data for this period"})]})}function L({timestamp:a}){let b,[,c]=(0,e.useState)(0);return(0,d.jsx)("time",{dateTime:a,title:new Date(a).toLocaleString(),children:(b=Math.max(0,Math.floor((Date.now()-new Date(a))/1e3)))<60?`${b}s ago`:b<3600?`${Math.floor(b/60)}m ago`:b<86400?`${Math.floor(b/3600)}h ago`:`${Math.floor(b/86400)}d ago`})}K.propTypes={period:k().string};let M={live:{label:"Live",title:"Usage stream connected",className:"bg-success/10 text-success",dotClassName:"bg-success animate-pulse"},reconnecting:{label:"Reconnecting",title:"Usage stream disconnected; reconnecting automatically",className:"bg-warning/10 text-warning",dotClassName:"bg-warning animate-pulse"},connecting:{label:"Connecting",title:"Connecting to the live usage stream",className:"bg-primary/10 text-primary",dotClassName:"bg-primary animate-pulse"}};function N({requests:a=[],streamStatus:b="connecting"}){let c=M[b]||M.connecting;return(0,d.jsxs)(i.default,{className:"flex h-[420px] min-w-0 flex-col overflow-hidden sm:h-[440px]",padding:"none",children:[(0,d.jsxs)("div",{className:"flex shrink-0 items-center justify-between border-b border-border-subtle bg-surface/75 px-4 py-3.5",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[17px] text-primary",children:"monitor_heart"}),(0,d.jsx)("span",{className:"text-xs font-semibold text-text-main",children:"Recent requests"})]}),(0,d.jsxs)("span",{className:`inline-flex items-center gap-1.5 rounded-full px-2 py-1 text-[10px] font-semibold ${c.className}`,title:c.title,children:[(0,d.jsx)("span",{"aria-hidden":"true",className:`size-1.5 rounded-full ${c.dotClassName}`}),c.label]})]}),a.length?(0,d.jsx)("div",{className:"flex-1 overflow-y-auto px-4 pb-3",children:(0,d.jsxs)("table",{className:"w-full min-w-[300px] border-collapse text-xs",children:[(0,d.jsx)("thead",{className:"sticky top-0 z-10 bg-surface/95 backdrop-blur-sm",children:(0,d.jsxs)("tr",{className:"border-b border-border",children:[(0,d.jsx)("th",{className:"w-2 py-1.5 text-left font-semibold text-text-muted",children:(0,d.jsx)("span",{className:"sr-only",children:"Status"})}),(0,d.jsx)("th",{className:"py-1.5 text-left font-semibold text-text-muted",children:"Model"}),(0,d.jsx)("th",{className:"py-1.5 text-right font-semibold text-text-muted whitespace-nowrap",children:"In / Out"}),(0,d.jsx)("th",{className:"py-1.5 text-right font-semibold text-text-muted",children:"When"})]})}),(0,d.jsx)("tbody",{className:"divide-y divide-border/50",children:a.map((a,b)=>{let c=function(a){if(!a)return!0;let b=String(a).trim().toLowerCase();return"ok"===b||"success"===b||"succeeded"===b||/^2\d\d(?:\s|$)/.test(b)}(a.status),e=c?"Succeeded":"Failed",f=g.Q2[a.provider]?.name||g.IS[a.provider]?.name||a.provider||"Unknown provider";return(0,d.jsxs)("tr",{className:"transition-colors hover:bg-bg-subtle",children:[(0,d.jsx)("td",{className:"py-1.5",title:e,children:(0,d.jsx)("span",{role:"img","aria-label":e,className:`block size-1.5 rounded-full ${c?"bg-success":"bg-error"}`})}),(0,d.jsxs)("td",{className:"min-w-0 py-1.5 pr-2",children:[(0,d.jsx)("div",{className:"max-w-[132px] truncate font-mono",title:a.model,children:a.model}),(0,d.jsx)("div",{className:"mt-0.5 max-w-[132px] truncate text-[10px] font-medium text-text-subtle",title:f,children:f})]}),(0,d.jsxs)("td",{className:"py-1.5 text-right font-mono tabular-nums whitespace-nowrap",children:[(0,d.jsxs)("span",{className:"text-primary",children:[n(a.promptTokens),"↑"]})," ",(0,d.jsxs)("span",{className:"text-success",children:[n(a.completionTokens),"↓"]})]}),(0,d.jsx)("td",{className:"py-1.5 text-right text-text-muted whitespace-nowrap",children:(0,d.jsx)(L,{timestamp:a.timestamp})})]},`${a.timestamp}-${a.model}-${a.provider}-${a.promptTokens}-${a.completionTokens}-${b}`)})})]})}):(0,d.jsx)("div",{className:"flex-1 flex items-center justify-center text-text-muted text-sm",children:"No requests yet."})]})}function O(a,b={},c,d){return Object.entries(a||{}).map(([a,c])=>{let d=(c.promptTokens||0)+(c.completionTokens||0),e=c.cost||0,f=d>0?(c.promptTokens||0)*(e/d):0,g=d>0?(c.completionTokens||0)*(e/d):0;return{...c,key:a,totalTokens:d,totalCost:e,inputCost:f,outputCost:g,pending:b[a]||0}}).sort((a,b)=>{let e=a[c],f=b[c];return("string"==typeof e&&(e=e.toLowerCase()),"string"==typeof f&&(f=f.toLowerCase()),e<f)?"asc"===d?-1:1:e>f?"asc"===d?1:-1:0})}function P(a,b){if(!Array.isArray(a))return[];let c={};return a.forEach(a=>{let d=function(a,b){switch(b){case"rawModel":return a.rawModel||"Unknown Model";case"accountName":return a.accountName||`Account ${a.connectionId?.slice(0,8)}...`||"Unknown Account";case"keyName":return a.keyName||"Unknown Key";case"endpoint":return a.endpoint||"Unknown Endpoint";default:return a[b]||"Unknown"}}(a,b);c[d]||(c[d]={groupKey:d,summary:{requests:0,promptTokens:0,completionTokens:0,cachedTokens:0,totalTokens:0,cost:0,inputCost:0,outputCost:0,lastUsed:null,pending:0},items:[]});let e=c[d].summary;e.requests+=a.requests||0,e.promptTokens+=a.promptTokens||0,e.completionTokens+=a.completionTokens||0,e.cachedTokens+=a.cachedTokens||0,e.totalTokens+=a.totalTokens||0,e.cost+=a.cost||0,e.inputCost+=a.inputCost||0,e.outputCost+=a.outputCost||0,e.pending+=a.pending||0,a.lastUsed&&(!e.lastUsed||new Date(a.lastUsed)>new Date(e.lastUsed))&&(e.lastUsed=a.lastUsed),c[d].items.push(a)}),Object.values(c)}let Q=[{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],R=[{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"accountName",label:"Account"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],S=[{field:"keyName",label:"API Key Name"},{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],T=[{field:"endpoint",label:"Endpoint"},{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],U=[{value:"model",label:"Usage by Model"},{value:"account",label:"Usage by Account"},{value:"apiKey",label:"Usage by API Key"},{value:"endpoint",label:"Usage by Endpoint"}],V=[{value:"today",label:"Today"},{value:"24h",label:"24h"},{value:"7d",label:"7D"},{value:"30d",label:"30D"},{value:"60d",label:"60D"}];function W({period:a,setPeriod:b,hidePeriodSelector:c=!1}={}){let g=(0,f.useRouter)(),i=(0,f.useSearchParams)(),j=i.get("sortBy")||"rawModel",k=i.get("sortOrder")||"asc",[l,o]=(0,e.useState)(null),[q,r]=(0,e.useState)(!0),[t,u]=(0,e.useState)(!1),[v,w]=(0,e.useState)("model"),[x,y]=(0,e.useState)("costs"),[A,B]=(0,e.useState)([]),[C,D]=(0,e.useState)("connecting"),[E,F]=(0,e.useState)("today");(0,e.useRef)(!0);let G=a??E,H=b??F,I=(0,e.useCallback)((a,b)=>{let c=new URLSearchParams(i.toString());c.get("sortBy")===b?c.set("sortOrder","asc"===c.get("sortOrder")?"desc":"asc"):(c.set("sortBy",b),c.set("sortOrder","asc")),g.replace(`?${c.toString()}`,{scroll:!1})},[i,g]),J=(0,e.useMemo)(()=>{if(!l)return null;switch(v){case"model":{let a=l.pending?.byModel||{};return{columns:Q,groupedData:P(O(l.byModel,a,j,k),"rawModel"),storageKey:"usage-stats:expanded-models",emptyMessage:"No usage recorded yet.",renderSummaryCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.summary.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.summary.lastUsed)})]}),renderDetailCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${a.pending>0?"text-primary":""}`,children:a.rawModel}),(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsx)(h.default,{variant:a.pending>0?"primary":"neutral",size:"sm",children:a.provider})}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.lastUsed)})]})}}case"account":{let a={};return l?.pending?.byAccount&&Object.entries(l.byAccount||{}).forEach(([b,c])=>{let d=l.pending.byAccount[c.connectionId];if(d){let e=c.provider?`${c.rawModel} (${c.provider})`:c.rawModel;a[b]=d[e]||0}}),{columns:R,groupedData:P(O(l.byAccount,a,j,k),"accountName"),storageKey:"usage-stats:expanded-accounts",emptyMessage:"No account-specific usage recorded yet.",renderSummaryCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.summary.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.summary.lastUsed)})]}),renderDetailCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${a.pending>0?"text-primary":""}`,children:a.accountName||`Account ${a.connectionId?.slice(0,8)}...`}),(0,d.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${a.pending>0?"text-primary":""}`,children:a.rawModel}),(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsx)(h.default,{variant:a.pending>0?"primary":"neutral",size:"sm",children:a.provider})}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.lastUsed)})]})}}case"apiKey":return{columns:S,groupedData:P(O(l.byApiKey,{},j,k),"keyName"),storageKey:"usage-stats:expanded-apikeys",emptyMessage:"No API key usage recorded yet.",renderSummaryCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.summary.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.summary.lastUsed)})]}),renderDetailCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 font-medium",children:a.keyName}),(0,d.jsx)("td",{className:"px-6 py-3",children:a.rawModel}),(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsx)(h.default,{variant:"neutral",size:"sm",children:a.provider})}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.lastUsed)})]})};default:return{columns:T,groupedData:P(O(l.byEndpoint,{},j,k),"endpoint"),storageKey:"usage-stats:expanded-endpoints",emptyMessage:"No endpoint usage recorded yet.",renderSummaryCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.summary.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.summary.lastUsed)})]}),renderDetailCells:a=>(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{className:"px-6 py-3 font-medium font-mono text-sm",children:a.endpoint}),(0,d.jsx)("td",{className:"px-6 py-3",children:a.rawModel}),(0,d.jsx)("td",{className:"px-6 py-3",children:(0,d.jsx)(h.default,{variant:"neutral",size:"sm",children:a.provider})}),(0,d.jsx)("td",{className:"px-6 py-3 text-right",children:n(a.requests)}),(0,d.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:p(a.lastUsed)})]})}}},[l,v,j,k]);if(!l&&!q)return(0,d.jsx)("div",{className:"text-text-muted",children:"Failed to load usage statistics."});let L=(0,d.jsx)("div",{className:"flex items-center justify-center py-12 text-text-muted",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[32px] animate-spin",children:"progress_activity"})});return(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 lg:gap-7",children:[!c&&(0,d.jsxs)("div",{className:"flex w-full items-center gap-2 sm:w-auto sm:self-end",children:[(0,d.jsx)("div",{className:"grid flex-1 grid-cols-5 items-center gap-1 rounded-lg border border-border bg-bg-subtle p-1 sm:flex sm:flex-none",children:V.map(a=>(0,d.jsx)("button",{onClick:()=>H(a.value),disabled:t,className:`rounded-md px-3 py-1 text-sm font-medium transition-colors ${G===a.value?"bg-primary text-white shadow-sm":"text-text-muted hover:bg-bg-hover hover:text-text"}`,children:a.label},a.value))}),t&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted animate-spin",children:"progress_activity"})]}),q?L:(0,d.jsx)(m,{stats:l}),q?L:(0,d.jsxs)("div",{className:"grid min-w-0 grid-cols-1 items-stretch gap-4 lg:grid-cols-[minmax(0,3fr)_minmax(340px,2fr)]",children:[(0,d.jsx)(z,{providers:A,activeRequests:l.activeRequests||[],lastProvider:l.recentRequests?.[0]?.provider||"",errorProvider:l.errorProvider||""}),(0,d.jsx)(N,{requests:l.recentRequests||[],streamStatus:C})]}),q?L:(0,d.jsx)(K,{period:G}),(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsx)("select",{value:v,onChange:a=>w(a.target.value),className:"w-full rounded-lg border border-border bg-surface px-3 py-1.5 text-sm font-medium text-text-main focus:outline-none focus:ring-2 focus:ring-primary/50 sm:w-auto",style:{colorScheme:"auto"},children:U.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value))}),(0,d.jsxs)("div",{className:"grid grid-cols-2 items-center gap-1 rounded-lg border border-border bg-bg-subtle p-1 sm:flex",children:[(0,d.jsx)("button",{onClick:()=>y("costs"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"costs"===x?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Costs"}),(0,d.jsx)("button",{onClick:()=>y("tokens"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"tokens"===x?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Tokens"})]})]}),q?L:J&&(0,d.jsx)(s,{title:"",columns:J.columns,groupedData:J.groupedData,tableType:v,sortBy:j,sortOrder:k,onToggleSort:I,viewMode:x,storageKey:J.storageKey,renderSummaryCells:J.renderSummaryCells,renderDetailCells:J.renderDetailCells,emptyMessage:J.emptyMessage})]})]})}},91099:(a,b,c)=>{c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({options:a=[],value:b,onChange:c,size:g="md",className:h,...i}){let j={sm:"h-9 text-xs sm:h-7",md:"h-10 text-sm sm:h-9",lg:"h-11 text-base"};return(0,d.jsx)("div",{role:"group",...i,className:(0,e.cn)("inline-flex items-center p-1 rounded-[10px] overflow-x-auto","bg-surface-2",h),children:a.map(a=>(0,d.jsxs)("button",{type:"button","aria-pressed":b===a.value,onClick:()=>c(a.value),className:(0,e.cn)("shrink-0 px-4 rounded-[8px] font-medium transition-all",j[g],b===a.value?"bg-surface text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[a.icon&&(0,d.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[16px] mr-1.5",children:a.icon}),a.label]},a.value))})}},91809:(a,b,c)=>{c.d(b,{default:()=>g});var d=c(48249),e=c(67484),f=c(17660);function g(){let[a,b]=(0,e.useState)([]),[c,g]=(0,e.useState)(!0),[h,i]=(0,e.useState)(!0);return(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("h2",{className:"text-xl font-semibold",children:"Request Logs"}),(0,d.jsx)("div",{className:"flex items-center gap-2",children:(0,d.jsxs)("label",{className:"text-sm font-medium text-text-muted flex items-center gap-2 cursor-pointer",children:[(0,d.jsx)("span",{children:"Auto Refresh (3s)"}),(0,d.jsx)("div",{onClick:()=>i(!h),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors focus:outline-none ${h?"bg-primary":"bg-bg-subtle border border-border"}`,children:(0,d.jsx)("span",{className:`inline-block h-3 w-3 transform rounded-full bg-white transition-transform ${h?"translate-x-5":"translate-x-1"}`})})]})})]}),(0,d.jsx)(f.default,{className:"overflow-hidden bg-black/5 dark:bg-black/20",children:(0,d.jsx)("div",{className:"p-0 overflow-x-auto max-h-[600px] overflow-y-auto font-mono text-xs",children:c&&0===a.length?(0,d.jsx)("div",{className:"p-8 text-center text-text-muted",children:"Loading logs..."}):0===a.length?(0,d.jsx)("div",{className:"p-8 text-center text-text-muted",children:"No logs recorded yet."}):(0,d.jsxs)("table",{className:"w-full text-left border-collapse whitespace-nowrap",children:[(0,d.jsx)("thead",{className:"sticky top-0 bg-bg-subtle border-b border-border z-10",children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"DateTime"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Model"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Provider"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Account"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"In"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Out"}),(0,d.jsx)("th",{className:"px-3 py-2",children:"Status"})]})}),(0,d.jsx)("tbody",{className:"divide-y divide-border/50",children:a.map((a,b)=>{let c=a.split(" | ");if(c.length<7)return null;let e=c[6],f=e.includes("PENDING"),g=e.includes("FAILED"),h=e.includes("OK");return(0,d.jsxs)("tr",{className:`hover:bg-primary/5 transition-colors ${f?"bg-primary/5":""}`,children:[(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-text-muted",children:c[0]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border font-medium",children:c[1]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border",children:(0,d.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-bg-subtle border border-border text-[10px] uppercase font-bold",children:c[2]})}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border truncate max-w-[150px]",title:c[3],children:c[3]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-primary",children:c[4]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-success",children:c[5]}),(0,d.jsx)("td",{className:`px-3 py-1.5 font-bold ${h?"text-success":g?"text-error":"text-primary animate-pulse"}`,children:e})]},b)})})]})})}),(0,d.jsx)("div",{className:"text-[10px] text-text-muted italic",children:"Logs are loaded from the request history database."})]})}},95145:(a,b,c)=>{c.d(b,{ConfirmModal:()=>j,default:()=>i});var d=c(48249),e=c(67484),f=c(71404),g=c(99070),h=c(32971);function i({isOpen:a,onClose:b,title:c,children:g,footer:j,size:k="md",closeOnOverlay:l=!0,showTrafficLights:m=!0,className:n}){let o=(0,e.useId)(),p=(0,e.useRef)(null);return((0,e.useRef)(null),(0,e.useRef)(b).current=b,a)?(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-[2px] fade-in",onClick:l?b:void 0}),(0,d.jsxs)("div",{ref:p,role:"dialog","aria-modal":"true","aria-labelledby":c?o:void 0,"aria-label":c?void 0:"Dialog",tabIndex:-1,className:(0,f.cn)("relative w-full max-h-[calc(100dvh-2rem)] overflow-hidden bg-surface","border border-border-subtle","rounded-[14px] shadow-[var(--shadow-elev)]","fade-in",{sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl",full:"max-w-4xl"}[k],n),children:[(c||m)&&(0,d.jsxs)("div",{className:"flex items-center justify-between p-2 border-b border-border-subtle",children:[(0,d.jsxs)("div",{className:"flex items-center",children:[m&&(0,d.jsxs)("div",{className:"hidden md:flex items-center gap-2 mr-4 ml-2",children:[(0,d.jsx)(h.default,{text:"Close",position:"top",color:"#FF5F56",children:(0,d.jsx)("button",{onClick:b,"aria-label":"Close",title:"Close",className:"w-4 h-4 rounded-full bg-[#FF5F56] hover:brightness-90 transition-all cursor-pointer flex items-center justify-center group/dot",children:(0,d.jsx)("span",{className:"text-[9px] font-bold text-white opacity-0 group-hover/dot:opacity-100 transition-opacity leading-none",children:"✕"})})}),(0,d.jsx)("div",{className:"w-4 h-4 rounded-full bg-[#3a3a3a]/20 dark:bg-white/15 cursor-not-allowed"}),(0,d.jsx)("div",{className:"w-4 h-4 rounded-full bg-[#3a3a3a]/20 dark:bg-white/15 cursor-not-allowed"})]}),c&&(0,d.jsx)("h2",{id:o,className:"text-lg font-semibold text-text-main",children:c})]}),(0,d.jsx)("button",{onClick:b,"aria-label":"Close",className:"md:hidden p-1.5 rounded-[10px] text-text-muted hover:bg-surface-2 hover:text-text-main transition-colors",children:(0,d.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,d.jsx)("div",{className:"p-6 max-h-[calc(85vh-100px)] overflow-y-auto custom-scrollbar",children:g}),j&&(0,d.jsx)("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-border-subtle",children:j})]})]}):null}function j({isOpen:a,onClose:b,onConfirm:c,title:e="Confirm",message:f,confirmText:h="Confirm",cancelText:k="Cancel",variant:l="danger",loading:m=!1}){return(0,d.jsx)(i,{isOpen:a,onClose:b,title:e,size:"sm",footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g.default,{variant:"ghost",onClick:b,disabled:m,children:k}),(0,d.jsx)(g.default,{variant:l,onClick:c,loading:m,children:h})]}),children:(0,d.jsx)("p",{className:"text-text-muted",children:f})})}},95514:(a,b,c)=>{c.d(b,{default:()=>g});var d=c(48249),e=c(67484),f=c(71404);function g({checked:a=!1,onChange:b,label:c,description:h,disabled:i=!1,size:j="md",className:k,busy:l=!1,...m}){let n=(0,e.useId)(),o=(0,e.useId)(),p={sm:{track:"w-8 h-4",thumb:"size-3",translate:"translate-x-4"},md:{track:"w-11 h-6",thumb:"size-5",translate:"translate-x-5"},lg:{track:"w-14 h-7",thumb:"size-6",translate:"translate-x-7"}},q=()=>{i||l||!b||b(!a)};return(0,d.jsxs)("div",{className:(0,f.cn)("flex items-center gap-3",i&&"opacity-50 cursor-not-allowed",k),children:[(0,d.jsx)("button",{type:"button",role:"switch","aria-checked":a,"aria-busy":l||void 0,"aria-labelledby":c?n:void 0,"aria-describedby":h?o:void 0,"aria-label":c?void 0:m["aria-label"],disabled:i||l,onClick:q,...m,className:(0,f.cn)("relative inline-flex shrink-0 cursor-pointer rounded-full","transition-colors duration-200 ease-in-out","focus:outline-none focus:ring-2 focus:ring-brand-500/30",a?"bg-brand-500":"bg-surface-3",p[j].track,i&&"cursor-not-allowed"),children:(0,d.jsx)("span",{className:(0,f.cn)("pointer-events-none inline-block rounded-full bg-white shadow-sm","transform transition duration-200 ease-in-out",a?p[j].translate:"translate-x-0.5",p[j].thumb,"mt-0.5")})}),(c||h)&&(0,d.jsxs)("div",{className:"flex flex-col",children:[c&&(0,d.jsx)("label",{id:n,onClick:q,className:"text-sm font-medium text-text-main cursor-pointer",children:c}),h&&(0,d.jsx)("span",{id:o,className:"text-xs text-text-muted",children:h})]})]})}},99070:(a,b,c)=>{c.d(b,{default:()=>h});var d=c(48249),e=c(71404);let f={primary:"bg-brand-500 hover:bg-brand-600 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted",secondary:"bg-surface-2 hover:bg-surface-3 text-text-main border border-border disabled:opacity-50",outline:"border border-border text-text-main hover:bg-surface-2 hover:border-brand-500/40",ghost:"text-text-muted hover:bg-surface-2 hover:text-text-main",danger:"bg-red-500 hover:bg-red-600 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted",success:"bg-green-600 hover:bg-green-700 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted"},g={sm:"h-10 px-3 text-xs rounded-[8px] sm:h-7",md:"h-11 px-4 text-sm rounded-[10px] sm:h-9",lg:"h-12 px-6 text-sm rounded-[10px] sm:h-11"};function h({children:a,variant:b="primary",size:c="md",icon:i,iconRight:j,disabled:k=!1,loading:l=!1,fullWidth:m=!1,className:n,...o}){return(0,d.jsxs)("button",{className:(0,e.cn)("inline-flex items-center justify-center gap-2 font-semibold transition-all duration-150 ease-out cursor-pointer","active:scale-[0.97] disabled:opacity-50 disabled:cursor-not-allowed disabled:active:scale-100",f[b],g[c],m&&"w-full",n),disabled:k||l,"aria-busy":l||void 0,...o,children:[l?(0,d.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}):i?(0,d.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[18px]",children:i}):null,a,j&&!l&&(0,d.jsx)("span",{"aria-hidden":"true",className:"material-symbols-outlined text-[18px]",children:j})]})}}};