trouteai 1.0.7 → 1.0.8

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 (718) hide show
  1. package/.build/next/BUILD_ID +1 -1
  2. package/.build/next/build-manifest.json +3 -3
  3. package/.build/next/fallback-build-manifest.json +3 -3
  4. package/.build/next/server/app/(dashboard)/dashboard/activity/page_client-reference-manifest.js +1 -1
  5. package/.build/next/server/app/(dashboard)/dashboard/analytics/combo-health/page_client-reference-manifest.js +1 -1
  6. package/.build/next/server/app/(dashboard)/dashboard/analytics/page_client-reference-manifest.js +1 -1
  7. package/.build/next/server/app/(dashboard)/dashboard/analytics/utilization/page_client-reference-manifest.js +1 -1
  8. package/.build/next/server/app/(dashboard)/dashboard/api-manager/page_client-reference-manifest.js +1 -1
  9. package/.build/next/server/app/(dashboard)/dashboard/audit/page_client-reference-manifest.js +1 -1
  10. package/.build/next/server/app/(dashboard)/dashboard/auto-combo/page_client-reference-manifest.js +1 -1
  11. package/.build/next/server/app/(dashboard)/dashboard/cache/page_client-reference-manifest.js +1 -1
  12. package/.build/next/server/app/(dashboard)/dashboard/combos/[id]/page_client-reference-manifest.js +1 -1
  13. package/.build/next/server/app/(dashboard)/dashboard/combos/live/page_client-reference-manifest.js +1 -1
  14. package/.build/next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
  15. package/.build/next/server/app/(dashboard)/dashboard/combos/playground/page_client-reference-manifest.js +1 -1
  16. package/.build/next/server/app/(dashboard)/dashboard/costs/budget/page_client-reference-manifest.js +1 -1
  17. package/.build/next/server/app/(dashboard)/dashboard/costs/page_client-reference-manifest.js +1 -1
  18. package/.build/next/server/app/(dashboard)/dashboard/costs/pricing/page_client-reference-manifest.js +1 -1
  19. package/.build/next/server/app/(dashboard)/dashboard/costs/quota-share/page_client-reference-manifest.js +1 -1
  20. package/.build/next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
  21. package/.build/next/server/app/(dashboard)/dashboard/health/page_client-reference-manifest.js +1 -1
  22. package/.build/next/server/app/(dashboard)/dashboard/limits/page_client-reference-manifest.js +1 -1
  23. package/.build/next/server/app/(dashboard)/dashboard/logs/activity/page_client-reference-manifest.js +1 -1
  24. package/.build/next/server/app/(dashboard)/dashboard/logs/console/page_client-reference-manifest.js +1 -1
  25. package/.build/next/server/app/(dashboard)/dashboard/logs/page_client-reference-manifest.js +1 -1
  26. package/.build/next/server/app/(dashboard)/dashboard/logs/proxy/page_client-reference-manifest.js +1 -1
  27. package/.build/next/server/app/(dashboard)/dashboard/logs/timeline/page_client-reference-manifest.js +1 -1
  28. package/.build/next/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
  29. package/.build/next/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
  30. package/.build/next/server/app/(dashboard)/dashboard/media-providers/page_client-reference-manifest.js +1 -1
  31. package/.build/next/server/app/(dashboard)/dashboard/onboarding/page_client-reference-manifest.js +1 -1
  32. package/.build/next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
  33. package/.build/next/server/app/(dashboard)/dashboard/playground/page_client-reference-manifest.js +1 -1
  34. package/.build/next/server/app/(dashboard)/dashboard/provider-stats/page_client-reference-manifest.js +1 -1
  35. package/.build/next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
  36. package/.build/next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
  37. package/.build/next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
  38. package/.build/next/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
  39. package/.build/next/server/app/(dashboard)/dashboard/runtime/page_client-reference-manifest.js +1 -1
  40. package/.build/next/server/app/(dashboard)/dashboard/settings/advanced/page_client-reference-manifest.js +1 -1
  41. package/.build/next/server/app/(dashboard)/dashboard/settings/ai/page_client-reference-manifest.js +1 -1
  42. package/.build/next/server/app/(dashboard)/dashboard/settings/appearance/page_client-reference-manifest.js +1 -1
  43. package/.build/next/server/app/(dashboard)/dashboard/settings/cache/page_client-reference-manifest.js +1 -1
  44. package/.build/next/server/app/(dashboard)/dashboard/settings/feature-flags/page_client-reference-manifest.js +1 -1
  45. package/.build/next/server/app/(dashboard)/dashboard/settings/general/page_client-reference-manifest.js +1 -1
  46. package/.build/next/server/app/(dashboard)/dashboard/settings/page_client-reference-manifest.js +1 -1
  47. package/.build/next/server/app/(dashboard)/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
  48. package/.build/next/server/app/(dashboard)/dashboard/settings/resilience/page_client-reference-manifest.js +1 -1
  49. package/.build/next/server/app/(dashboard)/dashboard/settings/routing/page_client-reference-manifest.js +1 -1
  50. package/.build/next/server/app/(dashboard)/dashboard/settings/security/page_client-reference-manifest.js +1 -1
  51. package/.build/next/server/app/(dashboard)/dashboard/settings/sidebar/page_client-reference-manifest.js +1 -1
  52. package/.build/next/server/app/(dashboard)/dashboard/system/page_client-reference-manifest.js +1 -1
  53. package/.build/next/server/app/(dashboard)/dashboard/system/proxy/page_client-reference-manifest.js +1 -1
  54. package/.build/next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
  55. package/.build/next/server/app/(dashboard)/home/page_client-reference-manifest.js +1 -1
  56. package/.build/next/server/app/400/page_client-reference-manifest.js +1 -1
  57. package/.build/next/server/app/401/page_client-reference-manifest.js +1 -1
  58. package/.build/next/server/app/403/page_client-reference-manifest.js +1 -1
  59. package/.build/next/server/app/408/page_client-reference-manifest.js +1 -1
  60. package/.build/next/server/app/429/page_client-reference-manifest.js +1 -1
  61. package/.build/next/server/app/500/page_client-reference-manifest.js +1 -1
  62. package/.build/next/server/app/502/page_client-reference-manifest.js +1 -1
  63. package/.build/next/server/app/503/page_client-reference-manifest.js +1 -1
  64. package/.build/next/server/app/_global-error.html +1 -1
  65. package/.build/next/server/app/_global-error.rsc +1 -1
  66. package/.build/next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  67. package/.build/next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  68. package/.build/next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  69. package/.build/next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  70. package/.build/next/server/app/api/combos/test/route.js +156 -156
  71. package/.build/next/server/app/api/compression/compare/verify/route.js +2 -2
  72. package/.build/next/server/app/api/models/test/route.js +143 -143
  73. package/.build/next/server/app/api/models/test-all/route.js +143 -143
  74. package/.build/next/server/app/api/usage/[connectionId]/route.js +2 -2
  75. package/.build/next/server/app/api/usage/codex-reset-credit/route.js +2 -2
  76. package/.build/next/server/app/api/usage/provider-limits/route.js +2 -2
  77. package/.build/next/server/app/api/v1/antigravity/route.js +125 -125
  78. package/.build/next/server/app/api/v1/api/chat/route.js +127 -127
  79. package/.build/next/server/app/api/v1/chat/completions/route.js +133 -133
  80. package/.build/next/server/app/api/v1/completions/route.js +131 -131
  81. package/.build/next/server/app/api/v1/messages/count_tokens/route.js +2 -2
  82. package/.build/next/server/app/api/v1/messages/route.js +129 -129
  83. package/.build/next/server/app/api/v1/providers/[provider]/chat/completions/route.js +124 -124
  84. package/.build/next/server/app/api/v1/responses/[...path]/route.js +125 -125
  85. package/.build/next/server/app/api/v1/responses/route.js +133 -133
  86. package/.build/next/server/app/api/v1/videos/generations/route.js +2 -2
  87. package/.build/next/server/app/api/v1/vscode/[token]/api/chat/route.js +131 -131
  88. package/.build/next/server/app/api/v1/vscode/[token]/chat/completions/route.js +132 -132
  89. package/.build/next/server/app/api/v1/vscode/[token]/responses/route.js +131 -131
  90. package/.build/next/server/app/api/v1/vscode/[token]/v1/chat/completions/route.js +132 -132
  91. package/.build/next/server/app/api/v1/vscode/raw/[token]/api/chat/route.js +131 -131
  92. package/.build/next/server/app/api/v1/vscode/raw/[token]/chat/completions/route.js +132 -132
  93. package/.build/next/server/app/api/v1/vscode/raw/[token]/responses/route.js +131 -131
  94. package/.build/next/server/app/api/v1/vscode/raw/[token]/v1/chat/completions/route.js +132 -132
  95. package/.build/next/server/app/api/v1beta/models/[...path]/route.js +128 -128
  96. package/.build/next/server/app/auth/callback/page_client-reference-manifest.js +1 -1
  97. package/.build/next/server/app/callback/page_client-reference-manifest.js +1 -1
  98. package/.build/next/server/app/connect/codex/[token]/page_client-reference-manifest.js +1 -1
  99. package/.build/next/server/app/forbidden/page_client-reference-manifest.js +1 -1
  100. package/.build/next/server/app/forgot-password/page_client-reference-manifest.js +1 -1
  101. package/.build/next/server/app/login/page_client-reference-manifest.js +1 -1
  102. package/.build/next/server/app/maintenance/page_client-reference-manifest.js +1 -1
  103. package/.build/next/server/app/offline/page_client-reference-manifest.js +1 -1
  104. package/.build/next/server/app/page_client-reference-manifest.js +1 -1
  105. package/.build/next/server/chunks/{1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_0071t6-gy8206.js → 1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_0cdytbweqx6b7.js} +1 -1
  106. package/.build/next/server/chunks/{1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_03uipan87s4vs.js → 1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_0dv1_6icxx4nr.js} +1 -1
  107. package/.build/next/server/chunks/{1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_04qcux733c716.js → 1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_0feukx8b--i7y.js} +1 -1
  108. package/.build/next/server/chunks/{1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_04y--asln23t-.js → 1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_0foh2lmr9t9jf.js} +1 -1
  109. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_0ieu8lrtllaog.js +3 -0
  110. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_0jow9no35q-gl.js +3 -0
  111. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_0k39__s-5wenx.js +3 -0
  112. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_0lu36e9zlm6y2.js +3 -0
  113. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_0q3hd0z__qhm1.js +3 -0
  114. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_0svnbjltkehm0.js +3 -0
  115. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_0tp3k6-k_smkk.js +3 -0
  116. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_0tw8hx-r12mrw.js +3 -0
  117. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_0vdgv0qv9t25q.js +3 -0
  118. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_13pu0wi09xd-q.js +3 -0
  119. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_16gcrutnx6jpm.js +3 -0
  120. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_170l4-im9-rts.js +3 -0
  121. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_18ujd4t8o0iap.js +3 -0
  122. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_1kuob30li3zz4.js +3 -0
  123. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_1oghu697pywz1.js +3 -0
  124. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_1oz1ky4cqo5la.js +3 -0
  125. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_1t1tpwfjdroz-.js +3 -0
  126. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_1twzsl5g2kx-m.js +3 -0
  127. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_1u4l5hhlfmkq7.js +3 -0
  128. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_1wgek1bfzkudf.js +3 -0
  129. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_1yazcd_f60euz.js +3 -0
  130. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_1zg9eixcilibu.js +3 -0
  131. package/.build/next/server/chunks/{[root-of-the-server]__0y-c0o33nm9k7._.js → [root-of-the-server]__013qtg6e7nrnt._.js} +2 -2
  132. package/.build/next/server/chunks/{[root-of-the-server]__0s1n86lqib-r8._.js → [root-of-the-server]__01cuuk82yhow-._.js} +2 -2
  133. package/.build/next/server/chunks/[root-of-the-server]__03j1rri4jmffc._.js +1 -1
  134. package/.build/next/server/chunks/{[root-of-the-server]__053e56_stref0._.js → [root-of-the-server]__04-wq1d8ad7-c._.js} +2 -2
  135. package/.build/next/server/chunks/{[root-of-the-server]__09e_jeovzn41x._.js → [root-of-the-server]__04ex4wx450p98._.js} +2 -2
  136. package/.build/next/server/chunks/{[root-of-the-server]__0sh-ax_s9lxgs._.js → [root-of-the-server]__054pm2e42ihgb._.js} +2 -2
  137. package/.build/next/server/chunks/[root-of-the-server]__06a582l--8gfi._.js +1 -1
  138. package/.build/next/server/chunks/{[root-of-the-server]__14qrr7cz7ih12._.js → [root-of-the-server]__08mchwc4bo740._.js} +2 -2
  139. package/.build/next/server/chunks/{[root-of-the-server]__0cdyf9uauo7s-._.js → [root-of-the-server]__0_potadi-xpgt._.js} +2 -2
  140. package/.build/next/server/chunks/{[root-of-the-server]__0b6xbrajo6q7j._.js → [root-of-the-server]__0au1tn-inyd_g._.js} +2 -2
  141. package/.build/next/server/chunks/{[root-of-the-server]__0dnxb-t5a29qw._.js → [root-of-the-server]__0bi89tb8hq7gp._.js} +2 -2
  142. package/.build/next/server/chunks/[root-of-the-server]__0bjb6df6ao16p._.js +3 -0
  143. package/.build/next/server/chunks/{[root-of-the-server]__0bqjf5vfej0y0._.js → [root-of-the-server]__0bn0fnmy3cyov._.js} +2 -2
  144. package/.build/next/server/chunks/[root-of-the-server]__0c8uunduj0rcb._.js +3 -0
  145. package/.build/next/server/chunks/{[root-of-the-server]__0cyc8ns5c-hak._.js → [root-of-the-server]__0cfm4y8lfzabg._.js} +2 -2
  146. package/.build/next/server/chunks/[root-of-the-server]__0h2tv7welidf2._.js +1 -1
  147. package/.build/next/server/chunks/[root-of-the-server]__0h6jczejtzur4._.js +3 -0
  148. package/.build/next/server/chunks/[root-of-the-server]__0jboht3yosva1._.js +1 -1
  149. package/.build/next/server/chunks/[root-of-the-server]__0kmh0llofhi-t._.js +3 -0
  150. package/.build/next/server/chunks/{[root-of-the-server]__19fndg4-8fl2p._.js → [root-of-the-server]__0oe87-hbfx_wt._.js} +2 -2
  151. package/.build/next/server/chunks/[root-of-the-server]__0pkk8q-mwrlhb._.js +3 -0
  152. package/.build/next/server/chunks/[root-of-the-server]__0pr6ndvl99m80._.js +3 -0
  153. package/.build/next/server/chunks/[root-of-the-server]__0q4kt78fse6u1._.js +1 -1
  154. package/.build/next/server/chunks/{[root-of-the-server]__0puajugwbae33._.js → [root-of-the-server]__0qwx0hffq93lu._.js} +2 -2
  155. package/.build/next/server/chunks/{[root-of-the-server]__03wxkz1ocd2m9._.js → [root-of-the-server]__0qzppsy_m_vb2._.js} +2 -2
  156. package/.build/next/server/chunks/[root-of-the-server]__0tadcednrqwvh._.js +3 -0
  157. package/.build/next/server/chunks/[root-of-the-server]__0tmd8acngsii3._.js +3 -0
  158. package/.build/next/server/chunks/{[root-of-the-server]__0urs4jrktsqji._.js → [root-of-the-server]__0vrh-4tf0ft8-._.js} +2 -2
  159. package/.build/next/server/chunks/[root-of-the-server]__0w0-w78j-o7zx._.js +3 -0
  160. package/.build/next/server/chunks/[root-of-the-server]__0yhdbb9w6oy0w._.js +3 -0
  161. package/.build/next/server/chunks/[root-of-the-server]__0yovqcjs0srde._.js +3 -0
  162. package/.build/next/server/chunks/{[root-of-the-server]__155hah7mtxxeu._.js → [root-of-the-server]__0yrk_78ixd453._.js} +2 -2
  163. package/.build/next/server/chunks/{[root-of-the-server]__0e_cgryo2zwu7._.js → [root-of-the-server]__0z24jgzvrqjf-._.js} +2 -2
  164. package/.build/next/server/chunks/[root-of-the-server]__1-elrzh0r1gn1._.js +3 -0
  165. package/.build/next/server/chunks/[root-of-the-server]__13g59axrgpk8f._.js +3 -0
  166. package/.build/next/server/chunks/{[root-of-the-server]__0fqufbrh_mxe6._.js → [root-of-the-server]__14htch0up35mq._.js} +2 -2
  167. package/.build/next/server/chunks/[root-of-the-server]__16__ky70mzpki._.js +1 -1
  168. package/.build/next/server/chunks/[root-of-the-server]__175s6rzt1gxf5._.js +3 -0
  169. package/.build/next/server/chunks/[root-of-the-server]__183u7xm7s7a0k._.js +3 -0
  170. package/.build/next/server/chunks/{[root-of-the-server]__1b7gfspxmfn7w._.js → [root-of-the-server]__1_bm64-b9rvps._.js} +2 -2
  171. package/.build/next/server/chunks/{[root-of-the-server]__0_89zuvif-ac0._.js → [root-of-the-server]__1_u2c9t8ghphk._.js} +2 -2
  172. package/.build/next/server/chunks/[root-of-the-server]__1asmrtinwnms1._.js +3 -0
  173. package/.build/next/server/chunks/[root-of-the-server]__1cs67f0gx1m2b._.js +1 -1
  174. package/.build/next/server/chunks/{[root-of-the-server]__0cya_vem8spaz._.js → [root-of-the-server]__1di-si5n-wa-0._.js} +1 -1
  175. package/.build/next/server/chunks/[root-of-the-server]__1eqvp0su82wa0._.js +1 -1
  176. package/.build/next/server/chunks/[root-of-the-server]__1f5u7fc6i-lh2._.js +3 -0
  177. package/.build/next/server/chunks/[root-of-the-server]__1gvcl_1847dlk._.js +1 -1
  178. package/.build/next/server/chunks/[root-of-the-server]__1gvwvri5-zmqs._.js +3 -0
  179. package/.build/next/server/chunks/[root-of-the-server]__1mfz-ys8z6-vj._.js +3 -0
  180. package/.build/next/server/chunks/[root-of-the-server]__1trre9oa-f-0-._.js +3 -0
  181. package/.build/next/server/chunks/[root-of-the-server]__1vwllhi2yaj22._.js +3 -0
  182. package/.build/next/server/chunks/[root-of-the-server]__1waj1qbbu8d0o._.js +3 -0
  183. package/.build/next/server/chunks/[root-of-the-server]__1x9t7o--7d3xv._.js +3 -0
  184. package/.build/next/server/chunks/[root-of-the-server]__1xi0yu215obtp._.js +3 -0
  185. package/.build/next/server/chunks/[root-of-the-server]__1xrpvccwm0tui._.js +3 -0
  186. package/.build/next/server/chunks/[root-of-the-server]__1xxb_la5pyyty._.js +1 -1
  187. package/.build/next/server/chunks/[root-of-the-server]__1yyq83bab1_34._.js +3 -0
  188. package/.build/next/server/chunks/[root-of-the-server]__1zvn7n_eg3bv6._.js +3 -0
  189. package/.build/next/server/chunks/_0-whad0_ydcsy._.js +1 -1
  190. package/.build/next/server/chunks/{_05uyjdaba145h._.js → _01jw2l_g1m495._.js} +1 -1
  191. package/.build/next/server/chunks/_02r_3f8xhg8a_._.js +16 -0
  192. package/.build/next/server/chunks/{_0-7-wo2rhe742._.js → _03qfav-eclfsv._.js} +1 -1
  193. package/.build/next/server/chunks/{_045qaiya-q9mx._.js → _06tafvn_2upb9._.js} +1 -1
  194. package/.build/next/server/chunks/{_0bnzv1p-iih9y._.js → _070swycte4f2y._.js} +1 -1
  195. package/.build/next/server/chunks/{_0ozkcut9ays1g._.js → _08crm5ua26ded._.js} +1 -1
  196. package/.build/next/server/chunks/{_0cnrejialoejq._.js → _09pw38n0fvjve._.js} +133 -118
  197. package/.build/next/server/chunks/_0_owpim-84v6c._.js +1 -1
  198. package/.build/next/server/chunks/_0bjni2b0bk48x._.js +7 -0
  199. package/.build/next/server/chunks/_0cthudnt9nl4t._.js +3 -0
  200. package/.build/next/server/chunks/_0dtaqfgy6-5ws._.js +3 -0
  201. package/.build/next/server/chunks/{_1gwyqrv4jj-h0._.js → _0dx0f1oye7vfm._.js} +1 -1
  202. package/.build/next/server/chunks/_0gqrj_t8bk-8t._.js +1 -1
  203. package/.build/next/server/chunks/_0heuo1apizyqe._.js +1 -1
  204. package/.build/next/server/chunks/{_0hmkgx75fn7mt._.js → _0jbl3xtidh76w._.js} +1 -1
  205. package/.build/next/server/chunks/_0jzperkk-1ag9._.js +1 -1
  206. package/.build/next/server/chunks/_0nntu-lmwlb6z._.js +1 -1
  207. package/.build/next/server/chunks/_0ntfaxua3a497._.js +3 -0
  208. package/.build/next/server/chunks/{_1mf3kg0sol0_p._.js → _0pqtuwqkanzsg._.js} +133 -118
  209. package/.build/next/server/chunks/{_0syxc2wl5qdnf._.js → _0q0iu436_75a8._.js} +1 -1
  210. package/.build/next/server/chunks/_0qa8wnj0oms8q._.js +3 -0
  211. package/.build/next/server/chunks/{_0i0eoe3j0-x0v._.js → _0r-1igk81_7eg._.js} +1 -1
  212. package/.build/next/server/chunks/{_0iclxqeesd_hr._.js → _0rffd_e2te-9v._.js} +1 -1
  213. package/.build/next/server/chunks/{_0fr8xxna2d5zn._.js → _0rtwo7u0mrb9r._.js} +1 -1
  214. package/.build/next/server/chunks/_0srkl-vgqcos7._.js +1 -1
  215. package/.build/next/server/chunks/_0tjk31-3k5hyf._.js +1 -1
  216. package/.build/next/server/chunks/_0tu5ehvbm4nc0._.js +3 -0
  217. package/.build/next/server/chunks/_0u8bko69-zd_z._.js +3 -0
  218. package/.build/next/server/chunks/_0v2kg-vv66amt._.js +3 -0
  219. package/.build/next/server/chunks/_0xujjs2b429r3._.js +3 -0
  220. package/.build/next/server/chunks/_0zvrsdbnkncnv._.js +3 -0
  221. package/.build/next/server/chunks/{_15efjsoc2b-sk._.js → _0zzir4fs7j_1p._.js} +2 -2
  222. package/.build/next/server/chunks/_10bcih89e-jn4._.js +3 -0
  223. package/.build/next/server/chunks/_10fwjeqnb57r-._.js +3 -0
  224. package/.build/next/server/chunks/_12_v3uivh86bs._.js +3 -0
  225. package/.build/next/server/chunks/_12ra9yaf_1dyr._.js +650 -0
  226. package/.build/next/server/chunks/_12rywigtphiop._.js +1 -1
  227. package/.build/next/server/chunks/_14cqpo0o-pr27._.js +3 -0
  228. package/.build/next/server/chunks/_14lqp4-f8wqgn._.js +3 -0
  229. package/.build/next/server/chunks/_159dadvt3pm1n._.js +3 -0
  230. package/.build/next/server/chunks/_1644hhqg6d_ln._.js +1 -1
  231. package/.build/next/server/chunks/{_1avfc3einmg1h._.js → _16_wwhbnnhkuh._.js} +1 -1
  232. package/.build/next/server/chunks/_16an60huh6tbs._.js +9 -9
  233. package/.build/next/server/chunks/_16i__1nx0epf7._.js +3 -0
  234. package/.build/next/server/chunks/_178o182dc7ex1._.js +3 -0
  235. package/.build/next/server/chunks/_188c9_xzcpc31._.js +1 -1
  236. package/.build/next/server/chunks/_19fzj3u7s0yz1._.js +3 -0
  237. package/.build/next/server/chunks/_19sfk-pzknkyv._.js +3 -0
  238. package/.build/next/server/chunks/_1_r1zgsvs713w._.js +3 -0
  239. package/.build/next/server/chunks/_1b6zyz_ay2ym5._.js +3 -0
  240. package/.build/next/server/chunks/_1btzlsw6io52c._.js +3 -0
  241. package/.build/next/server/chunks/{_0b_i4b8q0n1wz._.js → _1ft8yf-b3j8b8._.js} +147 -132
  242. package/.build/next/server/chunks/_1i00v3yjot-q_._.js +3 -0
  243. package/.build/next/server/chunks/{_0j524iax5w-bz._.js → _1kwnwtivfzp5u._.js} +1 -1
  244. package/.build/next/server/chunks/_1n9cbjvt_d82t._.js +1 -1
  245. package/.build/next/server/chunks/{_1wos-_82xr837._.js → _1q0_qh1mlc-1m._.js} +147 -132
  246. package/.build/next/server/chunks/{_0u-x3uzfboviu._.js → _1qmyzv3q9s7el._.js} +1 -1
  247. package/.build/next/server/chunks/_1qqqu7qtmx3if._.js +3 -0
  248. package/.build/next/server/chunks/_1r-xz7njt1agb._.js +62 -0
  249. package/.build/next/server/chunks/_1r3w1g8gzsrx3._.js +3 -0
  250. package/.build/next/server/chunks/{_1zcs33t-he7xd._.js → _1t7-qccr20ews._.js} +10 -10
  251. package/.build/next/server/chunks/_1uj3ppmpkxnlt._.js +3 -0
  252. package/.build/next/server/chunks/_1vgt3hw061lvz._.js +3 -0
  253. package/.build/next/server/chunks/_1xsk0mm2-hw63._.js +3 -0
  254. package/.build/next/server/chunks/_1yia8a_9rs285._.js +3 -0
  255. package/.build/next/server/chunks/_1yq_qtnhzgne_._.js +3 -0
  256. package/.build/next/server/chunks/_1z1_7oxdwqiqe._.js +3 -0
  257. package/.build/next/server/chunks/{_0zea7hovhgt2_._.js → _1zk9j5avh9do1._.js} +2 -2
  258. package/.build/next/server/chunks/_1zmyssg1ql6gl._.js +3 -3
  259. package/.build/next/server/chunks/_1zzqi2vrqln8r._.js +3 -0
  260. package/.build/next/server/chunks/_20wczne8lusnr._.js +1 -1
  261. package/.build/next/server/chunks/{node_modules_0_a57i8xt9icf._.js → node_modules_00j-j70vb5l89._.js} +1 -1
  262. package/.build/next/server/chunks/{node_modules_0-_w__4n53410._.js → node_modules_00rveaxr6xn-1._.js} +1 -1
  263. package/.build/next/server/chunks/{node_modules_06km3ub1t353p._.js → node_modules_0318sxb9xejre._.js} +1 -1
  264. package/.build/next/server/chunks/{node_modules_070w8pzva2-b5._.js → node_modules_03eegbwr1ykhv._.js} +1 -1
  265. package/.build/next/server/chunks/node_modules_04kmq4fi-fcs3._.js +3 -0
  266. package/.build/next/server/chunks/node_modules_0clpxklowdv39._.js +3 -0
  267. package/.build/next/server/chunks/node_modules_0ixloym14amfv._.js +3 -0
  268. package/.build/next/server/chunks/node_modules_0jcobbm12qhmj._.js +3 -0
  269. package/.build/next/server/chunks/node_modules_0lav-ieym04zb._.js +3 -0
  270. package/.build/next/server/chunks/node_modules_0meaikpo6sp-0._.js +3 -0
  271. package/.build/next/server/chunks/node_modules_0qjpghqow25tc._.js +3 -0
  272. package/.build/next/server/chunks/node_modules_0t3d23hihdgmu._.js +3 -0
  273. package/.build/next/server/chunks/node_modules_0trsqf3qottck._.js +3 -0
  274. package/.build/next/server/chunks/node_modules_0voxtqt-anw9e._.js +3 -0
  275. package/.build/next/server/chunks/node_modules_0vrbvfb6201w6._.js +3 -0
  276. package/.build/next/server/chunks/node_modules_1-kv_qmpt4341._.js +3 -0
  277. package/.build/next/server/chunks/node_modules_10rbyfmbpi425._.js +3 -0
  278. package/.build/next/server/chunks/node_modules_135e3rn3qtd-6._.js +3 -0
  279. package/.build/next/server/chunks/node_modules_17pyrt2it4bgr._.js +3 -0
  280. package/.build/next/server/chunks/node_modules_1ir4um6mro95r._.js +3 -0
  281. package/.build/next/server/chunks/node_modules_1j_0ubaizcezn._.js +3 -0
  282. package/.build/next/server/chunks/node_modules_1n05kwizfpjo6._.js +3 -0
  283. package/.build/next/server/chunks/node_modules_1n47vn0307_u5._.js +3 -0
  284. package/.build/next/server/chunks/node_modules_1srzy9xr2ioyr._.js +3 -0
  285. package/.build/next/server/chunks/node_modules_1tqglxa-ymtqw._.js +3 -0
  286. package/.build/next/server/chunks/node_modules_1z6rpfu7winx2._.js +3 -0
  287. package/.build/next/server/chunks/{node_modules_@aws-sdk_032-tpe7346hb._.js → node_modules_@aws-sdk_03kfydhiseqdg._.js} +2 -2
  288. package/.build/next/server/chunks/{node_modules_@aws-sdk_04o_8bax4fbo4._.js → node_modules_@aws-sdk_0_s99dpim75pu._.js} +2 -2
  289. package/.build/next/server/chunks/{node_modules_@aws-sdk_0_at_8j5m5taa._.js → node_modules_@aws-sdk_0bv_r2pcdu10h._.js} +2 -2
  290. package/.build/next/server/chunks/{node_modules_@aws-sdk_0cpedsd2e8nj9._.js → node_modules_@aws-sdk_0f5qnmpxmag01._.js} +2 -2
  291. package/.build/next/server/chunks/node_modules_@aws-sdk_0nlcm-f5ytb4h._.js +3 -0
  292. package/.build/next/server/chunks/node_modules_@aws-sdk_0obp77rs96mvi._.js +3 -0
  293. package/.build/next/server/chunks/node_modules_@aws-sdk_0oylq1k5y_3ce._.js +3 -0
  294. package/.build/next/server/chunks/node_modules_@aws-sdk_0qf0zztgs682s._.js +3 -0
  295. package/.build/next/server/chunks/node_modules_@aws-sdk_0rgyt30cubjzf._.js +3 -0
  296. package/.build/next/server/chunks/node_modules_@aws-sdk_0vi2hngy9pnuy._.js +3 -0
  297. package/.build/next/server/chunks/node_modules_@aws-sdk_0x510i9ngxcyf._.js +3 -0
  298. package/.build/next/server/chunks/node_modules_@aws-sdk_0y-e4gqf903o3._.js +3 -0
  299. package/.build/next/server/chunks/node_modules_@aws-sdk_0yhl9bvr9ueqh._.js +3 -0
  300. package/.build/next/server/chunks/node_modules_@aws-sdk_0yqxb4ienz6kj._.js +3 -0
  301. package/.build/next/server/chunks/node_modules_@aws-sdk_0yttguxby4mdi._.js +3 -0
  302. package/.build/next/server/chunks/node_modules_@aws-sdk_10101hyu_zjk4._.js +3 -0
  303. package/.build/next/server/chunks/node_modules_@aws-sdk_123n4jie1tq6a._.js +3 -0
  304. package/.build/next/server/chunks/node_modules_@aws-sdk_15qb522ckeehe._.js +3 -0
  305. package/.build/next/server/chunks/node_modules_@aws-sdk_1_n1vj3j0xfms._.js +3 -0
  306. package/.build/next/server/chunks/node_modules_@aws-sdk_1ix0scvbr4xd9._.js +3 -0
  307. package/.build/next/server/chunks/node_modules_@aws-sdk_1lza3gi_jvmio._.js +3 -0
  308. package/.build/next/server/chunks/node_modules_@aws-sdk_1mdahx12zwp_1._.js +3 -0
  309. package/.build/next/server/chunks/node_modules_@aws-sdk_1nk8tt26yrxh-._.js +3 -0
  310. package/.build/next/server/chunks/node_modules_@aws-sdk_1ot6491i27kfo._.js +3 -0
  311. package/.build/next/server/chunks/node_modules_@aws-sdk_1vcgyijr8-gln._.js +3 -0
  312. package/.build/next/server/chunks/node_modules_@aws-sdk_204anorh-zvk-._.js +3 -0
  313. package/.build/next/server/chunks/{node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_0-2dpkdybmydz.js → node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_01m33xoynofsl.js} +1 -1
  314. package/.build/next/server/chunks/{node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_00c1icqvrqz-s.js → node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_06adt_ianv_md.js} +1 -1
  315. package/.build/next/server/chunks/{node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_039_xf84osnel.js → node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_07njywm0sbeyv.js} +1 -1
  316. package/.build/next/server/chunks/{node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_03hjwb47vuwm9.js → node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_080lter3o8zcp.js} +1 -1
  317. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_09_cxlxlqf67s.js +3 -0
  318. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_09ov7ntve-mx7.js +3 -0
  319. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_0kbpnxnu2ejlc.js +3 -0
  320. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_0ki8jbo6k_atz.js +3 -0
  321. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_0npewtp_nops5.js +3 -0
  322. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_0q715b8wgpb1u.js +3 -0
  323. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_0yy3fcwj_b5be.js +3 -0
  324. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_1-4ppt5kmz50x.js +3 -0
  325. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_1-ky0eo80twjx.js +3 -0
  326. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_11u9jygsvvu5c.js +3 -0
  327. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_12s0w02i5mlzh.js +3 -0
  328. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_12sb57-_mdan4.js +3 -0
  329. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_13be-a641383i.js +3 -0
  330. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_14nxcn9iwq7oj.js +3 -0
  331. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_15sqaub981ncp.js +3 -0
  332. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_16mb7bvgqd72p.js +3 -0
  333. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_1a96ybufo8-_d.js +3 -0
  334. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_1epmqjkncfa-t.js +3 -0
  335. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_1ymjdx7brv1u5.js +3 -0
  336. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_1zmx4t1zp2plx.js +3 -0
  337. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_1ztb14nbvq-v8.js +3 -0
  338. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_20swopgb7gs5p.js +3 -0
  339. package/.build/next/server/chunks/{node_modules_ioredis_built_index_1-s3egdocnznd.js → node_modules_ioredis_built_index_0bym26c4shwf9.js} +1 -1
  340. package/.build/next/server/chunks/{node_modules_ioredis_built_index_14ex7cglfl3pz.js → node_modules_ioredis_built_index_0olys7xgnfo0i.js} +1 -1
  341. package/.build/next/server/chunks/{node_modules_ioredis_built_index_1a9ll1mwrmtob.js → node_modules_ioredis_built_index_14ct1dd055dku.js} +1 -1
  342. package/.build/next/server/chunks/{node_modules_ioredis_built_index_1w1hzk4_-8xu5.js → node_modules_ioredis_built_index_1ik97n_251xek.js} +1 -1
  343. package/.build/next/server/chunks/node_modules_ioredis_built_index_1vv514_mvh8ve.js +3 -0
  344. package/.build/next/server/chunks/open-sse_02t7zn7htyw-9._.js +1 -1
  345. package/.build/next/server/chunks/open-sse_03ipq-9xg4l9m._.js +1 -1
  346. package/.build/next/server/chunks/open-sse_0h0zluguzhqef._.js +16 -3
  347. package/.build/next/server/chunks/open-sse_0s84hi7h9418d._.js +16 -3
  348. package/.build/next/server/chunks/open-sse_1b6ivsct5ejh3._.js +1 -1
  349. package/.build/next/server/chunks/open-sse_1r2up99lm4jtz._.js +1 -1
  350. package/.build/next/server/chunks/open-sse_1tgbautgb4f7f._.js +16 -3
  351. package/.build/next/server/chunks/{open-sse_services_02bmh-sbso22m._.js → open-sse_services_00hw3r8y1gfsk._.js} +1 -1
  352. package/.build/next/server/chunks/open-sse_services_03wu42_5vmj9o._.js +2 -2
  353. package/.build/next/server/chunks/open-sse_services_0ct5y5fs-6yum._.js +2 -2
  354. package/.build/next/server/chunks/{open-sse_services_04dvqigm0hy_b._.js → open-sse_services_0faya5lemfn3z._.js} +1 -1
  355. package/.build/next/server/chunks/{open-sse_services_0884oo1_foqx1._.js → open-sse_services_0fqgcvavo8wg0._.js} +1 -1
  356. package/.build/next/server/chunks/{open-sse_services_0cjgk3rys3phs._.js → open-sse_services_0gp_perj2ozc7._.js} +1 -1
  357. package/.build/next/server/chunks/open-sse_services_0luw8b50a275y._.js +3 -0
  358. package/.build/next/server/chunks/open-sse_services_0lz8kz3o3n32w._.js +3 -0
  359. package/.build/next/server/chunks/open-sse_services_0o2xbv4-s_hgc._.js +2 -2
  360. package/.build/next/server/chunks/open-sse_services_0uzit9opfex07._.js +3 -0
  361. package/.build/next/server/chunks/open-sse_services_10-13kqpampl8._.js +3 -0
  362. package/.build/next/server/chunks/open-sse_services_11px-eu6wpco1._.js +3 -0
  363. package/.build/next/server/chunks/open-sse_services_12xf6ogfm7fk6._.js +3 -0
  364. package/.build/next/server/chunks/open-sse_services_13aor5_u0vw67._.js +3 -0
  365. package/.build/next/server/chunks/open-sse_services_17to5z2yz9tp5._.js +3 -0
  366. package/.build/next/server/chunks/open-sse_services_1_z10i8xets76._.js +2 -2
  367. package/.build/next/server/chunks/open-sse_services_1aofhb43cunjk._.js +3 -0
  368. package/.build/next/server/chunks/open-sse_services_1bmzbrj-w51an._.js +3 -0
  369. package/.build/next/server/chunks/open-sse_services_1cfnib8brx231._.js +3 -0
  370. package/.build/next/server/chunks/open-sse_services_1m558021-9l1o._.js +3 -0
  371. package/.build/next/server/chunks/open-sse_services_1mixpyyaadj44._.js +2 -2
  372. package/.build/next/server/chunks/open-sse_services_1pb9vai4pzp46._.js +3 -0
  373. package/.build/next/server/chunks/open-sse_services_1u1h_rm99qyq_._.js +3 -0
  374. package/.build/next/server/chunks/open-sse_services_1v47txy532v7j._.js +3 -0
  375. package/.build/next/server/chunks/open-sse_services_1zn2whnlx96gx._.js +3 -0
  376. package/.build/next/server/chunks/open-sse_services_20qr88u5g_bzt._.js +3 -0
  377. package/.build/next/server/chunks/open-sse_services_kiroRegion_ts_1plr7t56zivs5._.js +1 -1
  378. package/.build/next/server/chunks/open-sse_utils_requestLogger_ts_0bd_-kg8s0mnb._.js +1 -1
  379. package/.build/next/server/chunks/open-sse_utils_requestLogger_ts_0o1bn8tbcrdys._.js +1 -1
  380. package/.build/next/server/chunks/{src_0gff8n1288m1s._.js → src_06dmt2gh7c2r5._.js} +1 -1
  381. package/.build/next/server/chunks/src_072_u91zja_z6._.js +1 -1
  382. package/.build/next/server/chunks/{src_0ogv5rsf3ovzt._.js → src_0iivcw6e2y8b-._.js} +1 -1
  383. package/.build/next/server/chunks/src_0jsr5vm5qt_kk._.js +1 -1
  384. package/.build/next/server/chunks/{src_1gr5o5rdqanpt._.js → src_0l9p-6g-6c00r._.js} +1 -1
  385. package/.build/next/server/chunks/src_1m93lsr72gv4e._.js +1 -1
  386. package/.build/next/server/chunks/src_1p24y5m9owsdz._.js +1 -1
  387. package/.build/next/server/chunks/{src_1w9wqtyffs4jp._.js → src_20-a3old2hlv7._.js} +1 -1
  388. package/.build/next/server/chunks/{src_lib_0t6aj24w2w4um._.js → src_lib_05upj47v7jd8d._.js} +1 -1
  389. package/.build/next/server/chunks/{src_lib_18c9gtbeeedlu._.js → src_lib_0g6dvcltrlrt1._.js} +1 -1
  390. package/.build/next/server/chunks/{src_lib_plugins_manager_ts_03te14cdfjqt1._.js → src_lib_plugins_manager_ts_06-b_e2ssdrqp._.js} +2 -2
  391. package/.build/next/server/chunks/{src_lib_plugins_manager_ts_082ank_n7lv72._.js → src_lib_plugins_manager_ts_07a371xptxn0i._.js} +2 -2
  392. package/.build/next/server/chunks/{src_lib_plugins_manager_ts_08h-7dzhghsw_._.js → src_lib_plugins_manager_ts_07iwfiw5lpzv6._.js} +2 -2
  393. package/.build/next/server/chunks/{src_lib_plugins_manager_ts_08obzclzfmgdo._.js → src_lib_plugins_manager_ts_094zfas129qox._.js} +2 -2
  394. package/.build/next/server/chunks/src_lib_plugins_manager_ts_09x05wttn6gky._.js +3 -0
  395. package/.build/next/server/chunks/src_lib_plugins_manager_ts_0eicpmorbgq_0._.js +3 -0
  396. package/.build/next/server/chunks/src_lib_plugins_manager_ts_0j45w1t53tqiq._.js +3 -0
  397. package/.build/next/server/chunks/src_lib_plugins_manager_ts_0jtsoy2o58_fe._.js +3 -0
  398. package/.build/next/server/chunks/src_lib_plugins_manager_ts_0k2l6fz_allhv._.js +3 -0
  399. package/.build/next/server/chunks/src_lib_plugins_manager_ts_0m4u5d2zpf0jx._.js +3 -0
  400. package/.build/next/server/chunks/src_lib_plugins_manager_ts_0r69m_ija5052._.js +3 -0
  401. package/.build/next/server/chunks/src_lib_plugins_manager_ts_0rd7v66pzywb8._.js +3 -0
  402. package/.build/next/server/chunks/src_lib_plugins_manager_ts_0u9_z3h42wsrr._.js +3 -0
  403. package/.build/next/server/chunks/src_lib_plugins_manager_ts_12ucso7gp_9we._.js +3 -0
  404. package/.build/next/server/chunks/src_lib_plugins_manager_ts_16wp__3_qev5x._.js +3 -0
  405. package/.build/next/server/chunks/src_lib_plugins_manager_ts_1d_p6ksvmoo3y._.js +3 -0
  406. package/.build/next/server/chunks/src_lib_plugins_manager_ts_1l-e0sne7qzzx._.js +3 -0
  407. package/.build/next/server/chunks/src_lib_plugins_manager_ts_1lf_y4ssq-plx._.js +3 -0
  408. package/.build/next/server/chunks/src_lib_plugins_manager_ts_1qlgxrqwigi2t._.js +3 -0
  409. package/.build/next/server/chunks/src_lib_plugins_manager_ts_1u2eu34-upcvy._.js +3 -0
  410. package/.build/next/server/chunks/src_lib_plugins_manager_ts_218376dd7xrc4._.js +3 -0
  411. package/.build/next/server/chunks/{src_lib_quota_0gw-asus4493x._.js → src_lib_quota_05418fyg4agnh._.js} +1 -1
  412. package/.build/next/server/chunks/{src_lib_quota_0mglshbqfhgw7._.js → src_lib_quota_05bcp_6tt7jbr._.js} +1 -1
  413. package/.build/next/server/chunks/{src_lib_quota_0zwicsy-gs0ct._.js → src_lib_quota_0nybt-asgnvf4._.js} +1 -1
  414. package/.build/next/server/chunks/{src_lib_quota_1o_jx24-m_fom._.js → src_lib_quota_0vqp3tcjqt1dw._.js} +1 -1
  415. package/.build/next/server/chunks/src_lib_quota_19hosofplhjh1._.js +3 -0
  416. package/.build/next/server/chunks/{src_lib_quota_quotaKey_ts_0e9929u5mgny4._.js → src_lib_quota_quotaKey_ts_00sufley9tfda._.js} +1 -1
  417. package/.build/next/server/chunks/{src_lib_quota_quotaKey_ts_06gq2e2g0ozlr._.js → src_lib_quota_quotaKey_ts_05unnu3n41ko_._.js} +1 -1
  418. package/.build/next/server/chunks/{src_lib_quota_quotaKey_ts_07_2e5snrn1ck._.js → src_lib_quota_quotaKey_ts_0_9lralwqmbb2._.js} +1 -1
  419. package/.build/next/server/chunks/{src_lib_quota_quotaKey_ts_0e3c15o4yzmvf._.js → src_lib_quota_quotaKey_ts_0anxeaf_zkp8o._.js} +1 -1
  420. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_0ffo874n5oku6._.js +3 -0
  421. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_0jafzf3ifgkuv._.js +3 -0
  422. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_0llm3vdjpfanc._.js +3 -0
  423. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_0o6z11z1bom_m._.js +3 -0
  424. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_0txirnznm274h._.js +3 -0
  425. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_0xuq_g-h5m3c1._.js +3 -0
  426. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_10_ltppb3vez-._.js +3 -0
  427. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_151pluvj7g-vc._.js +3 -0
  428. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_1ceheb324j-3o._.js +3 -0
  429. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_1es9tfkkri56i._.js +3 -0
  430. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_1g0ppe_dhr5q1._.js +3 -0
  431. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_1lyayo5r_xxjv._.js +3 -0
  432. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_1mc353kr74tft._.js +3 -0
  433. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_1q-_0jqsbdlh5._.js +3 -0
  434. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_1qd-81-a26uej._.js +3 -0
  435. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_1qg73wxhhll-s._.js +3 -0
  436. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_1t-h7vqoh9u3s._.js +3 -0
  437. package/.build/next/server/chunks/src_shared_constants_1vndx1xsi1o3x._.js +1 -1
  438. package/.build/next/server/chunks/{src_shared_services_03_eh-49sw70b._.js → src_shared_services_057p4bz8pl04k._.js} +1 -1
  439. package/.build/next/server/chunks/{src_shared_services_04hl1xzqthbh1._.js → src_shared_services_080e2ej5vl6ay._.js} +1 -1
  440. package/.build/next/server/chunks/{src_shared_services_0fjvc-g7uuyno._.js → src_shared_services_0eedv-3vaf69y._.js} +1 -1
  441. package/.build/next/server/chunks/{src_shared_services_0kg6hc95fd11s._.js → src_shared_services_0erucmxdso94e._.js} +1 -1
  442. package/.build/next/server/chunks/{src_shared_services_04z41n7bdg09x._.js → src_shared_services_0lt7_o14ml7sz._.js} +1 -1
  443. package/.build/next/server/chunks/{src_shared_services_06s-_f77zvc_v._.js → src_shared_services_0mv_oizuaavj6._.js} +1 -1
  444. package/.build/next/server/chunks/src_shared_services_0pbe9rzf7waje._.js +3 -0
  445. package/.build/next/server/chunks/src_shared_services_0yf7zz4c9vtx-._.js +3 -0
  446. package/.build/next/server/chunks/src_shared_services_0zulbbb3ttk64._.js +3 -0
  447. package/.build/next/server/chunks/src_shared_services_1-1kghymkipsb._.js +3 -0
  448. package/.build/next/server/chunks/{src_shared_services_13msbx-c1194y._.js → src_shared_services_106s8shtblhd5._.js} +1 -1
  449. package/.build/next/server/chunks/src_shared_services_11l3nwnjgyxm-._.js +3 -0
  450. package/.build/next/server/chunks/src_shared_services_12t1-ga9w38dz._.js +3 -0
  451. package/.build/next/server/chunks/src_shared_services_14w2j2iqdj9eb._.js +3 -0
  452. package/.build/next/server/chunks/src_shared_services_176ndx2kuwev7._.js +3 -0
  453. package/.build/next/server/chunks/{src_shared_services_1jmf68l2lf9nz._.js → src_shared_services_1e0qskhl18qx6._.js} +1 -1
  454. package/.build/next/server/chunks/src_shared_services_1egld-y_7xfyo._.js +3 -0
  455. package/.build/next/server/chunks/src_shared_services_1fhzl753fxvsf._.js +3 -0
  456. package/.build/next/server/chunks/src_shared_services_1rjiu-sbe0cc_._.js +3 -0
  457. package/.build/next/server/chunks/src_shared_services_1w8ezwxiuwg4-._.js +3 -0
  458. package/.build/next/server/chunks/src_shared_services_1y_ma3zvgiio6._.js +3 -0
  459. package/.build/next/server/chunks/src_shared_services_1ypadc9tai46y._.js +3 -0
  460. package/.build/next/server/chunks/{src_shared_services_modelSyncScheduler_ts_0jprbetg42idf._.js → src_shared_services_modelSyncScheduler_ts_091bx-fd70d-_._.js} +1 -1
  461. package/.build/next/server/chunks/{src_shared_services_modelSyncScheduler_ts_1w5s8oci38o86._.js → src_shared_services_modelSyncScheduler_ts_0x1-b0_nhg8oa._.js} +1 -1
  462. package/.build/next/server/chunks/{src_shared_services_modelSyncScheduler_ts_1admvvz7wu5mb._.js → src_shared_services_modelSyncScheduler_ts_1xd6j5kaxzekj._.js} +1 -1
  463. package/.build/next/server/chunks/{src_shared_services_modelSyncScheduler_ts_1nid3ygpp832c._.js → src_shared_services_modelSyncScheduler_ts_1zp-x3g0jwv9s._.js} +1 -1
  464. package/.build/next/server/chunks/ssr/_0rb4h6lptmehu._.js +1 -1
  465. package/.build/next/server/chunks/ssr/_1ucg-1lxpwd_3._.js +2 -2
  466. package/.build/next/server/chunks/ssr/_1wo8wxqh1dk5a._.js +2 -2
  467. package/.build/next/server/middleware-build-manifest.js +3 -3
  468. package/.build/next/server/pages/500.html +1 -1
  469. package/.build/next/static/chunks/{0v_saoyx2w57z.js → 273ss8mst5n0x.js} +1 -1
  470. package/.build/next/static/chunks/{0wxtns-mya-et.css → 36imcs53bs6ue.css} +1 -1
  471. package/.build/next/static/chunks/{2yhtmu668hmia.js → 41ia4t5lkoy-u.js} +1 -1
  472. package/open-sse/config/claudeTokens.ts +108 -0
  473. package/open-sse/executors/base.ts +17 -0
  474. package/open-sse/executors/kiro.ts +415 -66
  475. package/open-sse/handlers/chatCore/nonStreamingResponseParse.ts +14 -0
  476. package/open-sse/handlers/chatCore.ts +23 -3
  477. package/open-sse/handlers/responseTranslator.ts +19 -1
  478. package/open-sse/handlers/sseParser.ts +17 -0
  479. package/open-sse/services/combo/targetExhaustion.ts +16 -1
  480. package/open-sse/services/combo.ts +2 -0
  481. package/open-sse/services/kiroRegion.ts +20 -0
  482. package/open-sse/services/usage/kimi.ts +64 -5
  483. package/open-sse/services/webSearchResultText.ts +100 -0
  484. package/open-sse/translator/request/claude-to-openai.ts +189 -3
  485. package/open-sse/translator/request/openai-to-kiro.ts +119 -10
  486. package/open-sse/translator/response/kiro-to-openai.ts +16 -0
  487. package/open-sse/translator/response/openai-to-claude.ts +62 -3
  488. package/open-sse/utils/contextOverflowError.ts +63 -0
  489. package/open-sse/utils/pdfText.ts +1252 -0
  490. package/open-sse/utils/requestLogger.ts +4 -1
  491. package/open-sse/utils/stream.ts +19 -6
  492. package/open-sse/utils/streamHelpers.ts +3 -1
  493. package/package.json +1 -1
  494. package/src/app/api/v1/messages/count_tokens/route.ts +64 -6
  495. package/src/domain/quotaCache.ts +4 -2
  496. package/src/shared/components/CommandPalette.tsx +2 -2
  497. package/src/shared/components/Sidebar.tsx +3 -3
  498. package/src/sse/handlers/chat.ts +30 -0
  499. package/src/sse/handlers/webSearchEmulation.ts +1181 -0
  500. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_0agn1t27_-87q.js +0 -3
  501. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_0bdbaz8ncan3j.js +0 -3
  502. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_0ic-xl80j3ahf.js +0 -3
  503. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_0j-gka-h5--g7.js +0 -3
  504. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_0jikxjpd83y3m.js +0 -3
  505. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_0pcsfxk7rl_qj.js +0 -3
  506. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_0rour4wnl6mch.js +0 -3
  507. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_1-vgf7hsozo4d.js +0 -3
  508. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_1-wk-99yzo_ij.js +0 -3
  509. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_11j-oo1fko_w9.js +0 -3
  510. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_163fonx9p1t53.js +0 -3
  511. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_1_scz53f35ozv.js +0 -3
  512. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_1b-oarr-rdyrt.js +0 -3
  513. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_1b31tiezn9knj.js +0 -3
  514. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_1bc7yeb23me7o.js +0 -3
  515. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_1cy8wnhh8esbt.js +0 -3
  516. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_1hcyk-boxbura.js +0 -3
  517. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_1hjr8tkngjpn2.js +0 -3
  518. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_1i9ijw0wkft95.js +0 -3
  519. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_1o4j3aexo9biu.js +0 -3
  520. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_1pvenj5ob2aem.js +0 -3
  521. package/.build/next/server/chunks/1q96_modules_@aws-sdk_nested-clients_dist-es_submodules_signin_index_2024waa5dd1lu.js +0 -3
  522. package/.build/next/server/chunks/[root-of-the-server]__0hsw8ehbw3i2o._.js +0 -3
  523. package/.build/next/server/chunks/[root-of-the-server]__0jojq4ni9peyl._.js +0 -3
  524. package/.build/next/server/chunks/[root-of-the-server]__0k_9tln3gjdsg._.js +0 -3
  525. package/.build/next/server/chunks/[root-of-the-server]__0yjugdbzmjz__._.js +0 -3
  526. package/.build/next/server/chunks/[root-of-the-server]__0yku0wexi8ghl._.js +0 -3
  527. package/.build/next/server/chunks/[root-of-the-server]__0yt9iwxll_l6u._.js +0 -3
  528. package/.build/next/server/chunks/[root-of-the-server]__0zgbbqlctz_ss._.js +0 -3
  529. package/.build/next/server/chunks/[root-of-the-server]__1-1xnobnihmvu._.js +0 -3
  530. package/.build/next/server/chunks/[root-of-the-server]__10y_wajcozqre._.js +0 -3
  531. package/.build/next/server/chunks/[root-of-the-server]__12ww6_t3hg59j._.js +0 -3
  532. package/.build/next/server/chunks/[root-of-the-server]__172v_j4xarr6o._.js +0 -3
  533. package/.build/next/server/chunks/[root-of-the-server]__176x6fzvqwsiv._.js +0 -3
  534. package/.build/next/server/chunks/[root-of-the-server]__17ud9_3_ssk8k._.js +0 -3
  535. package/.build/next/server/chunks/[root-of-the-server]__19ocgqujae39l._.js +0 -3
  536. package/.build/next/server/chunks/[root-of-the-server]__1cwkjoabvk0op._.js +0 -3
  537. package/.build/next/server/chunks/[root-of-the-server]__1idr_msgwldj7._.js +0 -3
  538. package/.build/next/server/chunks/[root-of-the-server]__1jb65mvmckdjg._.js +0 -3
  539. package/.build/next/server/chunks/[root-of-the-server]__1ks8m6fd5ayhs._.js +0 -3
  540. package/.build/next/server/chunks/[root-of-the-server]__1m7e1c6uyafq0._.js +0 -3
  541. package/.build/next/server/chunks/[root-of-the-server]__1my791be0ej2f._.js +0 -3
  542. package/.build/next/server/chunks/[root-of-the-server]__1ohivgmoa4y7_._.js +0 -3
  543. package/.build/next/server/chunks/[root-of-the-server]__1pwuqglvqb8ae._.js +0 -3
  544. package/.build/next/server/chunks/[root-of-the-server]__1q9d4sa50girl._.js +0 -3
  545. package/.build/next/server/chunks/[root-of-the-server]__1qqnlb8mlv5qn._.js +0 -3
  546. package/.build/next/server/chunks/[root-of-the-server]__1sbq18_dr5ht1._.js +0 -3
  547. package/.build/next/server/chunks/[root-of-the-server]__1wcvw0tlzacfj._.js +0 -3
  548. package/.build/next/server/chunks/[root-of-the-server]__20gdw36eknl9h._.js +0 -3
  549. package/.build/next/server/chunks/_0mqzrek7ffz5c._.js +0 -3
  550. package/.build/next/server/chunks/_0re9_1xpmi1in._.js +0 -3
  551. package/.build/next/server/chunks/_0v223bkfoc35x._.js +0 -3
  552. package/.build/next/server/chunks/_0w7y9fwzdv184._.js +0 -3
  553. package/.build/next/server/chunks/_1--z-c5w3yh_b._.js +0 -3
  554. package/.build/next/server/chunks/_11dfub0-g5hqx._.js +0 -3
  555. package/.build/next/server/chunks/_13xv49s2emgbh._.js +0 -12
  556. package/.build/next/server/chunks/_142m98dl-v5qx._.js +0 -3
  557. package/.build/next/server/chunks/_16fb5lg934z_y._.js +0 -3
  558. package/.build/next/server/chunks/_16ldvpp3ltmg_._.js +0 -3
  559. package/.build/next/server/chunks/_18nswcjdn-o_d._.js +0 -3
  560. package/.build/next/server/chunks/_19d_r4e56lw6c._.js +0 -3
  561. package/.build/next/server/chunks/_19lsyjj_cdcma._.js +0 -3
  562. package/.build/next/server/chunks/_1_a8xtb4eim3-._.js +0 -3
  563. package/.build/next/server/chunks/_1c99m13xvj0dv._.js +0 -3
  564. package/.build/next/server/chunks/_1do5vraekw7a_._.js +0 -3
  565. package/.build/next/server/chunks/_1e-2ziz7vbvj9._.js +0 -3
  566. package/.build/next/server/chunks/_1foat8d-cw4p_._.js +0 -3
  567. package/.build/next/server/chunks/_1lg1a1-ip82th._.js +0 -3
  568. package/.build/next/server/chunks/_1lyng1xt6yaki._.js +0 -3
  569. package/.build/next/server/chunks/_1nprpllrhv5ur._.js +0 -3
  570. package/.build/next/server/chunks/_1nxn6ans9h-yd._.js +0 -3
  571. package/.build/next/server/chunks/_1ohylflm1s935._.js +0 -3
  572. package/.build/next/server/chunks/_1omvf1ucof_yl._.js +0 -3
  573. package/.build/next/server/chunks/_1p60mk1s2dj0m._.js +0 -3
  574. package/.build/next/server/chunks/_1p628qecv5bcu._.js +0 -3
  575. package/.build/next/server/chunks/_1t0wesdzmxm--._.js +0 -3
  576. package/.build/next/server/chunks/_1tryysi-zw-uk._.js +0 -3
  577. package/.build/next/server/chunks/_1u2fevomxng1z._.js +0 -3
  578. package/.build/next/server/chunks/_1u9svjs_bx9zp._.js +0 -3
  579. package/.build/next/server/chunks/_1ukh92xt_h9ls._.js +0 -3
  580. package/.build/next/server/chunks/_1v87bx9e8bvly._.js +0 -3
  581. package/.build/next/server/chunks/_1vf7irr1wo9p-._.js +0 -3
  582. package/.build/next/server/chunks/_1wkk7z3fobxbo._.js +0 -3
  583. package/.build/next/server/chunks/node_modules_0_x6ms_t9skng._.js +0 -3
  584. package/.build/next/server/chunks/node_modules_0gohbx9aorh0u._.js +0 -3
  585. package/.build/next/server/chunks/node_modules_0kv7lp09lm4-8._.js +0 -3
  586. package/.build/next/server/chunks/node_modules_0l3c--_iz3xqs._.js +0 -3
  587. package/.build/next/server/chunks/node_modules_0p85cgv7zv71m._.js +0 -3
  588. package/.build/next/server/chunks/node_modules_0taa189fdyrvj._.js +0 -3
  589. package/.build/next/server/chunks/node_modules_0u4h-ppwf7yix._.js +0 -3
  590. package/.build/next/server/chunks/node_modules_0xbbdz3qows09._.js +0 -3
  591. package/.build/next/server/chunks/node_modules_0z17bntb8cv10._.js +0 -3
  592. package/.build/next/server/chunks/node_modules_12n0xi55k1732._.js +0 -3
  593. package/.build/next/server/chunks/node_modules_12w64fw3z-bcd._.js +0 -3
  594. package/.build/next/server/chunks/node_modules_17q-udh619fx5._.js +0 -3
  595. package/.build/next/server/chunks/node_modules_19z_pj5419z4n._.js +0 -3
  596. package/.build/next/server/chunks/node_modules_1kx78kk7zgs6_._.js +0 -3
  597. package/.build/next/server/chunks/node_modules_1l6a6ml6v2i_k._.js +0 -3
  598. package/.build/next/server/chunks/node_modules_1lkgfl4ettcxp._.js +0 -3
  599. package/.build/next/server/chunks/node_modules_1t9hizql924bp._.js +0 -3
  600. package/.build/next/server/chunks/node_modules_1tdhc46ytvj0n._.js +0 -3
  601. package/.build/next/server/chunks/node_modules_1uk_qp0gbho8r._.js +0 -3
  602. package/.build/next/server/chunks/node_modules_1w0h0i7jkq9fa._.js +0 -3
  603. package/.build/next/server/chunks/node_modules_1xtwpfq69aty8._.js +0 -3
  604. package/.build/next/server/chunks/node_modules_1zlh23qg1uq5s._.js +0 -3
  605. package/.build/next/server/chunks/node_modules_@aws-sdk_0fukg5x40kwub._.js +0 -3
  606. package/.build/next/server/chunks/node_modules_@aws-sdk_0g1gza5ppvhr8._.js +0 -3
  607. package/.build/next/server/chunks/node_modules_@aws-sdk_0h_fcdlqd8s5n._.js +0 -3
  608. package/.build/next/server/chunks/node_modules_@aws-sdk_0jpc8oc6b6i93._.js +0 -3
  609. package/.build/next/server/chunks/node_modules_@aws-sdk_0r_t1m5o9vn66._.js +0 -3
  610. package/.build/next/server/chunks/node_modules_@aws-sdk_0rr7gmwwe5-dh._.js +0 -3
  611. package/.build/next/server/chunks/node_modules_@aws-sdk_0v_xskgrff6wd._.js +0 -3
  612. package/.build/next/server/chunks/node_modules_@aws-sdk_0zuuhl2wpxt8p._.js +0 -3
  613. package/.build/next/server/chunks/node_modules_@aws-sdk_11ckwzfy422am._.js +0 -3
  614. package/.build/next/server/chunks/node_modules_@aws-sdk_11d97npmgf-3r._.js +0 -3
  615. package/.build/next/server/chunks/node_modules_@aws-sdk_12_vv1aumcw9-._.js +0 -3
  616. package/.build/next/server/chunks/node_modules_@aws-sdk_18d7kh8fes7vc._.js +0 -3
  617. package/.build/next/server/chunks/node_modules_@aws-sdk_1d2_q1k2wkf5s._.js +0 -3
  618. package/.build/next/server/chunks/node_modules_@aws-sdk_1glhxo4bsedyk._.js +0 -3
  619. package/.build/next/server/chunks/node_modules_@aws-sdk_1jk-2_ih5r8hp._.js +0 -3
  620. package/.build/next/server/chunks/node_modules_@aws-sdk_1mq27hyj74pss._.js +0 -3
  621. package/.build/next/server/chunks/node_modules_@aws-sdk_1n6-p7yy8md7l._.js +0 -3
  622. package/.build/next/server/chunks/node_modules_@aws-sdk_1os1eoc8tim1y._.js +0 -3
  623. package/.build/next/server/chunks/node_modules_@aws-sdk_1req4zcx_0cnx._.js +0 -3
  624. package/.build/next/server/chunks/node_modules_@aws-sdk_1wwzw_mr_0uhv._.js +0 -3
  625. package/.build/next/server/chunks/node_modules_@aws-sdk_1xyy_nekye31j._.js +0 -3
  626. package/.build/next/server/chunks/node_modules_@aws-sdk_20myne_q7f2m8._.js +0 -3
  627. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_04gwvpkl1nug0.js +0 -3
  628. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_0630cbcbg0avk.js +0 -3
  629. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_092bd6v9u3x5d.js +0 -3
  630. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_0a--3zhc3833c.js +0 -3
  631. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_0cig_ru63jzhj.js +0 -3
  632. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_0e_80iimfmh81.js +0 -3
  633. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_0hmbodnfjrup6.js +0 -3
  634. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_0pbaee_84omvg.js +0 -3
  635. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_0xwupvdbu9jfl.js +0 -3
  636. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_0yd50kn037tj7.js +0 -3
  637. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_1167_x8-auv93.js +0 -3
  638. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_126xpn2yg3grm.js +0 -3
  639. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_16ku3dxvhzhkk.js +0 -3
  640. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_19bzdp_-n6sq0.js +0 -3
  641. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_1dqajoz1ygnbf.js +0 -3
  642. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_1o4k7zmx1j2bu.js +0 -3
  643. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_1oavue5eviexc.js +0 -3
  644. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_1rqp1l_ptnubg.js +0 -3
  645. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_1rw3-4dmewdr4.js +0 -3
  646. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_1tyx-v56ebpk_.js +0 -3
  647. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_1wn_1b_n7nq-2.js +0 -3
  648. package/.build/next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_20yftlrkp9ara.js +0 -3
  649. package/.build/next/server/chunks/node_modules_ioredis_built_index_1yvlsm3ny3pj9.js +0 -3
  650. package/.build/next/server/chunks/open-sse_services_0cukrrcbxl1gr._.js +0 -3
  651. package/.build/next/server/chunks/open-sse_services_0ef13xoz5w433._.js +0 -3
  652. package/.build/next/server/chunks/open-sse_services_0hdeb5rg-7ctc._.js +0 -3
  653. package/.build/next/server/chunks/open-sse_services_0jjlzdp9t8t3p._.js +0 -3
  654. package/.build/next/server/chunks/open-sse_services_0jyo433yl_s3-._.js +0 -3
  655. package/.build/next/server/chunks/open-sse_services_0k5f57mkiskrt._.js +0 -3
  656. package/.build/next/server/chunks/open-sse_services_0w0o42y4k_0xp._.js +0 -3
  657. package/.build/next/server/chunks/open-sse_services_0x51vcvrd1uy1._.js +0 -3
  658. package/.build/next/server/chunks/open-sse_services_0yenufzwhjgz0._.js +0 -3
  659. package/.build/next/server/chunks/open-sse_services_138omazpx4xu1._.js +0 -3
  660. package/.build/next/server/chunks/open-sse_services_162a5-wghb28k._.js +0 -3
  661. package/.build/next/server/chunks/open-sse_services_1blmj_n8yoazn._.js +0 -3
  662. package/.build/next/server/chunks/open-sse_services_1c2_vovh6b_pe._.js +0 -3
  663. package/.build/next/server/chunks/open-sse_services_1fgkobij47qea._.js +0 -3
  664. package/.build/next/server/chunks/open-sse_services_1iuacwne-axoo._.js +0 -3
  665. package/.build/next/server/chunks/open-sse_services_1ktbqi-1t65pn._.js +0 -3
  666. package/.build/next/server/chunks/open-sse_services_1mdjfnli_1im9._.js +0 -3
  667. package/.build/next/server/chunks/src_lib_plugins_manager_ts_0_8jhcn7g0hyd._.js +0 -3
  668. package/.build/next/server/chunks/src_lib_plugins_manager_ts_0b48oh-otx_ol._.js +0 -3
  669. package/.build/next/server/chunks/src_lib_plugins_manager_ts_0fnwm57tvxp50._.js +0 -3
  670. package/.build/next/server/chunks/src_lib_plugins_manager_ts_0qdw6u_-fb9qe._.js +0 -3
  671. package/.build/next/server/chunks/src_lib_plugins_manager_ts_0u63lwdqoezav._.js +0 -3
  672. package/.build/next/server/chunks/src_lib_plugins_manager_ts_0uw_jlq70rwri._.js +0 -3
  673. package/.build/next/server/chunks/src_lib_plugins_manager_ts_0yxhkyvrf6-x_._.js +0 -3
  674. package/.build/next/server/chunks/src_lib_plugins_manager_ts_1-91nmo9cckkg._.js +0 -3
  675. package/.build/next/server/chunks/src_lib_plugins_manager_ts_11dshqgaqa7k2._.js +0 -3
  676. package/.build/next/server/chunks/src_lib_plugins_manager_ts_12z3np4ktvyaw._.js +0 -3
  677. package/.build/next/server/chunks/src_lib_plugins_manager_ts_1548t2uj3kl8c._.js +0 -3
  678. package/.build/next/server/chunks/src_lib_plugins_manager_ts_198mvq_7kkncw._.js +0 -3
  679. package/.build/next/server/chunks/src_lib_plugins_manager_ts_1cax0u9i8n09r._.js +0 -3
  680. package/.build/next/server/chunks/src_lib_plugins_manager_ts_1dw31gw8gv5b4._.js +0 -3
  681. package/.build/next/server/chunks/src_lib_plugins_manager_ts_1j3eh7kbz5s33._.js +0 -3
  682. package/.build/next/server/chunks/src_lib_plugins_manager_ts_1jgvga752m2_v._.js +0 -3
  683. package/.build/next/server/chunks/src_lib_plugins_manager_ts_1umjhh6i4065t._.js +0 -3
  684. package/.build/next/server/chunks/src_lib_quota_1vpqly464si1q._.js +0 -3
  685. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_0eqloedth3662._.js +0 -3
  686. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_0gsym2up09qbd._.js +0 -3
  687. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_0lqr7nuv40xhn._.js +0 -3
  688. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_0qo8767hpoa2_._.js +0 -3
  689. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_0r56lkpo6ejtl._.js +0 -3
  690. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_0u2q7i-ffa3-0._.js +0 -3
  691. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_0y54fg642lkx_._.js +0 -3
  692. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_144c1_26o_xs_._.js +0 -3
  693. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_1a5p04dslzkkr._.js +0 -3
  694. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_1fqs-9wvkwg8u._.js +0 -3
  695. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_1g_t5orpm0h2k._.js +0 -3
  696. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_1kydk56tgu8ni._.js +0 -3
  697. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_1mpll1mny1n6b._.js +0 -3
  698. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_1sd-o-ncs0v_b._.js +0 -3
  699. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_1u5q9l5wugo13._.js +0 -3
  700. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_1vebln5zz0jh1._.js +0 -3
  701. package/.build/next/server/chunks/src_lib_quota_quotaKey_ts_1xazcu5ici-w1._.js +0 -3
  702. package/.build/next/server/chunks/src_shared_services_083ix1a7l974z._.js +0 -3
  703. package/.build/next/server/chunks/src_shared_services_093xyaxwtg-ji._.js +0 -3
  704. package/.build/next/server/chunks/src_shared_services_0i9oken9kxj9j._.js +0 -3
  705. package/.build/next/server/chunks/src_shared_services_0r-8-60-r4v_r._.js +0 -3
  706. package/.build/next/server/chunks/src_shared_services_0r7xmlmt1k9hy._.js +0 -3
  707. package/.build/next/server/chunks/src_shared_services_0rg59_7jmlgm-._.js +0 -3
  708. package/.build/next/server/chunks/src_shared_services_126q0wbgkzp5l._.js +0 -3
  709. package/.build/next/server/chunks/src_shared_services_12se2mvwbr2q0._.js +0 -3
  710. package/.build/next/server/chunks/src_shared_services_1fwlbkehafca_._.js +0 -3
  711. package/.build/next/server/chunks/src_shared_services_1m3xkf85ae5xt._.js +0 -3
  712. package/.build/next/server/chunks/src_shared_services_1obo27zju04g-._.js +0 -3
  713. package/.build/next/server/chunks/src_shared_services_1rnq7eju312ri._.js +0 -3
  714. package/.build/next/server/chunks/src_shared_services_1vt2-qejrwg77._.js +0 -3
  715. package/.build/next/server/chunks/src_shared_services_1z51753rm-kau._.js +0 -3
  716. /package/.build/next/static/{i-vPbUKTIijARm707KH3L → ScDemTJTEZMscCIzRWSqu}/_buildManifest.js +0 -0
  717. /package/.build/next/static/{i-vPbUKTIijARm707KH3L → ScDemTJTEZMscCIzRWSqu}/_clientMiddlewareManifest.js +0 -0
  718. /package/.build/next/static/{i-vPbUKTIijARm707KH3L → ScDemTJTEZMscCIzRWSqu}/_ssgManifest.js +0 -0
@@ -7,4 +7,4 @@
7
7
  from { opacity: 1; transform: translateY(0); }
8
8
  to { opacity: 0; transform: translateY(-4px); }
9
9
  }
10
- `}),(0,t.jsx)("div",{"aria-live":"polite","aria-atomic":"false",style:{position:"fixed",top:"16px",insetInlineEnd:"16px",zIndex:9999,display:"flex",flexDirection:"column",gap:"8px",pointerEvents:"none"},children:e.map(e=>(0,t.jsx)("div",{style:{pointerEvents:"auto"},children:(0,t.jsx)(d,{notification:e,onDismiss:s})},e.id))})]})}],816062)},964039,e=>{"use strict";var t=e.i(843476),s=e.i(271645),r=e.i(948148),a=e.i(703166),i=e.i(342923),n=e.i(80173),l=e.i(556938);function o({deviceData:e,verificationUrl:s,secondsRemaining:a,polling:n}){let c,d,u=(0,r.f)("oauthModal"),{copied:m,copy:x}=(0,l.f)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"text-center py-4",children:[(0,t.jsx)("p",{className:"text-sm text-text-muted mb-4",children:u("deviceCodeVisitUrl")}),(0,t.jsxs)("div",{className:"bg-sidebar p-4 rounded-lg mb-4",children:[(0,t.jsx)("p",{className:"text-xs text-text-muted mb-1",children:u("deviceCodeVerificationUrl")}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("a",{href:s,target:"_blank",rel:"noreferrer",className:"flex-1 text-sm break-all text-primary hover:underline",children:s}),(0,t.jsx)(i.default,{size:"sm",variant:"ghost",icon:"verify_url"===m?"check":"content_copy",onClick:()=>x(s,"verify_url")})]})]}),(0,t.jsxs)("div",{className:"bg-primary/10 p-4 rounded-lg",children:[(0,t.jsx)("p",{className:"text-xs text-text-muted mb-1",children:u("deviceCodeYourCode")}),(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,t.jsx)("p",{className:"text-2xl font-mono font-bold text-primary",children:e.user_code}),(0,t.jsx)(i.default,{size:"sm",variant:"ghost",icon:"user_code"===m?"check":"content_copy",onClick:()=>x(e.user_code,"user_code")})]}),null!==a&&(0,t.jsxs)("div",{className:"mt-3 flex items-center justify-center gap-1 text-xs text-text-muted","aria-label":u("deviceCodeWaiting"),children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-sm",children:"schedule"}),(0,t.jsx)("span",{children:(d=Math.floor((c=Math.max(0,Math.floor(a)))/60),`${d}:${String(c%60).padStart(2,"0")}`)})]})]})]}),n&&(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2 text-sm text-text-muted",children:[(0,t.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),u("deviceCodeWaiting")]})]})}function c({providerName:e,hint:s,onClose:a}){let o=(0,r.f)("oauthModal"),{copied:d,copy:u}=(0,l.f)(),m=[{key:"cmd",body:o("loopbackMismatchStep1"),value:s.tunnelCommand,copyId:"tunnel_cmd",note:o("loopbackMismatchStep1Note",{userPlaceholder:"<user>"})},{key:"url",body:o("loopbackMismatchStep2"),value:s.localDashboardUrl,copyId:"local_url",note:null},{key:"retry",body:o("loopbackMismatchStep3",{providerName:e}),value:null,copyId:null,note:null}];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("div",{className:"size-10 shrink-0 rounded-full bg-amber-500/15 flex items-center justify-center",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-xl text-amber-500",children:"lan"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-base font-semibold",children:o("loopbackMismatchTitle")}),(0,t.jsxs)("p",{className:"text-xs text-text-muted mt-0.5 font-mono",children:[s.dashboardHost,":",s.dashboardPort]})]})]}),(0,t.jsxs)("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/10 p-3",children:[(0,t.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wide text-amber-500 mb-1",children:o("loopbackMismatchWhatHappened")}),(0,t.jsx)("p",{className:"text-sm text-text-muted",children:o.rich("loopbackMismatchExplanation",{providerName:e,redirectUri:s.redirectUri,code:e=>(0,t.jsx)("code",{className:"font-mono text-xs",children:e})})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium mb-2",children:o("loopbackMismatchHowToFix")}),(0,t.jsx)("ol",{className:"space-y-3",children:m.map((e,s)=>(0,t.jsxs)("li",{className:"flex gap-3",children:[(0,t.jsx)("span",{className:"size-5 shrink-0 mt-0.5 rounded-full bg-primary/15 text-primary text-xs font-semibold flex items-center justify-center",children:s+1}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("p",{className:"text-sm",children:e.body}),e.value&&(0,t.jsxs)("div",{className:"flex gap-2 mt-1.5",children:[(0,t.jsx)(n.default,{value:e.value,readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,t.jsx)(i.default,{variant:"secondary",icon:d===e.copyId?"check":"content_copy",onClick:()=>u(e.value,e.copyId),children:o("copy")})]}),e.note&&(0,t.jsx)("p",{className:"text-xs text-text-muted mt-1",children:e.note})]})]},e.key))})]}),(0,t.jsx)("p",{className:"text-xs text-text-muted",children:o("loopbackMismatchAlternative")})]}),(0,t.jsx)("div",{className:"flex gap-2",children:(0,t.jsx)(i.default,{onClick:a,variant:"secondary",fullWidth:!0,children:o("cancel")})})]})}function d({hint:e}){let s=(0,r.f)("oauthModal"),{copied:a,copy:o}=(0,l.f)(),c=(e,s)=>(0,t.jsxs)("div",{className:"flex gap-2 mt-1.5",children:[(0,t.jsx)(n.default,{value:e,readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,t.jsx)(i.default,{size:"sm",variant:"secondary",icon:a===s?"check":"content_copy",onClick:()=>o(e,s)})]});return(0,t.jsxs)("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 space-y-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{className:"text-sm font-semibold text-amber-500",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-sm align-middle mr-1",children:"warning"}),s("googleLoopbackTitle")]}),(0,t.jsx)("p",{className:"text-xs text-text-muted mt-1",children:s.rich("googleLoopbackWhatHappens",{redirectUri:e.redirectUri,code:e=>(0,t.jsx)("code",{className:"font-mono",children:e})})})]}),e.helperCommand&&(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-xs font-medium",children:s("googleLoopbackRecommended")}),c(e.helperCommand,"google_helper"),(0,t.jsx)("p",{className:"text-xs text-text-muted mt-1",children:s("googleLoopbackHelperNote")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-xs font-medium",children:s("googleLoopbackTunnelLabel")}),c(e.tunnelCommand,"google_tunnel"),(0,t.jsx)("p",{className:"text-xs text-text-muted mt-1",children:s("googleLoopbackTunnelNote",{userPlaceholder:"<user>",localUrl:e.localDashboardUrl})})]}),(0,t.jsx)("p",{className:"text-xs text-text-muted",children:s("googleLoopbackHeadlessAlt")})]})}function u({isGoogleOAuth:e,isTrueLocalhost:s,googleHint:a}){let i=(0,r.f)("oauthModal");return s?null:e&&a?(0,t.jsx)(d,{hint:a}):(0,t.jsxs)("div",{className:"rounded-lg border border-blue-500/30 bg-blue-500/10 p-3 text-xs text-blue-200",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-sm align-middle mr-1",children:"info"}),i("remoteAccessInfo")]})}function m({provider:e,isGoogleOAuth:s,isTrueLocalhost:a,googleHint:o,authUrl:c,callbackUrl:d,placeholderUrl:x,canSubmit:p,onCallbackUrlChange:h,onSubmit:f,onClose:b}){let g=(0,r.f)("oauthModal"),{copied:y,copy:v}=(0,l.f)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(u,{isGoogleOAuth:s,isTrueLocalhost:a,googleHint:o}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium mb-2",children:g("step1OpenUrl")}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(n.default,{value:c,readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,t.jsx)(i.default,{variant:"secondary",icon:"auth_url"===y?"check":"content_copy",onClick:()=>v(c,"auth_url"),children:g("copy")})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium mb-2",children:g("step2PasteCallback")}),(0,t.jsx)("p",{className:"text-xs text-text-muted mb-2",children:g.rich("step2Hint",{code:e=>(0,t.jsx)("code",{className:"font-mono",children:e})})}),(0,t.jsx)(n.default,{value:d,onChange:e=>h(e.target.value),placeholder:"claude"===e||"cline"===e?"code#state or /callback?code=...":x,className:"font-mono text-xs"})]})]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(i.default,{onClick:f,fullWidth:!0,disabled:!p,children:g("connect")}),(0,t.jsx)(i.default,{onClick:b,variant:"ghost",fullWidth:!0,children:g("cancel")})]})]})}async function x(e){let t=await e.text();if(!t)return null;try{return JSON.parse(t)}catch{return t}}function p(e,t,s="Request failed"){if(e&&"object"==typeof e){let t=e.error;if("string"==typeof t&&t.trim())return t;if(t&&"object"==typeof t){let e=t.message;return"string"==typeof e&&e.trim()?e:JSON.stringify(t)}let s=e.message??e.detail;if("string"==typeof s&&s.trim())return s}return"string"==typeof e&&e.trim()?e.length>300?`${e.slice(0,300)}…`:e:null!=t?`${s} (HTTP ${t})`:s}var h=e.i(467034);function f(e){return"string"==typeof e&&e.trim().startsWith("trouteai-cred-v1.")}async function b(e,t,s,r,a){let i=await fetch(`/api/oauth/${e}/paste-credentials`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({blob:t.trim(),connectionId:s?.id})}),n=await x(i);if(!i.ok)throw Error(p(n,i.status,"Failed to import credentials"));r("success"),a?.()}function g(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:null}function y(e){return"string"==typeof e&&e.trim()?e.trim():void 0}function v({gheUrl:e,setGheUrl:s,error:r,setError:a,startOAuthFlow:l}){return(0,t.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,t.jsxs)("p",{className:"text-sm text-text-muted",children:["Enter the base URL of your GitHub Enterprise instance (e.g."," ",(0,t.jsx)("code",{className:"font-mono",children:"https://ghe.yourcompany.com"}),")."]}),(0,t.jsx)(n.default,{value:e,onChange:e=>s(e.target.value),placeholder:"https://ghe.yourcompany.com",label:"GitHub Enterprise URL",type:"url"}),(0,t.jsx)(i.default,{onClick:()=>{e.trim()?l():a("GitHub Enterprise URL is required")},fullWidth:!0,disabled:!e.trim(),children:"Connect"}),r&&(0,t.jsx)("p",{className:"text-sm text-red-500",children:r})]})}let j=/https?:\/\/[^\s"'<>)]+/g;function N({text:e}){return(0,t.jsx)(t.Fragment,{children:(function(e){let t;if(!e)return[];let s=[],r=0;for(j.lastIndex=0;null!==(t=j.exec(e));){t.index>r&&s.push({text:e.slice(r,t.index)});let a=t[0],i="";for(;a.length>0&&/[.,;:!?]$/.test(a);)i=a.slice(-1)+i,a=a.slice(0,-1);let n=function(e){let t;try{t=new URL(e).protocol}catch{return}return"http:"===t||"https:"===t?e:void 0}(a);s.push(n?{text:a,href:n}:{text:a}),i&&s.push({text:i}),r=t.index+t[0].length}return r<e.length&&s.push({text:e.slice(r)}),s})(e||"").map((e,r)=>e.href?(0,t.jsx)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"underline break-all",children:e.text},r):(0,t.jsx)(s.Fragment,{children:e.text},r))})}var k=e.i(282225);function w({onContinue:e,onClose:s}){return(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"rounded-md border border-border bg-muted/40 px-3 py-3 text-left",children:[(0,t.jsx)("p",{className:"text-sm font-medium mb-2",children:"GitLab Duo OAuth setup"}),(0,t.jsx)("p",{className:"text-sm text-text-muted leading-relaxed",children:(0,t.jsx)(N,{text:k.f})})]}),(0,t.jsx)("p",{className:"text-xs text-text-muted",children:"After the application is registered and the env vars are set on this TRouteAI instance, click Continue to start the OAuth login."}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(i.default,{onClick:e,fullWidth:!0,children:"Continue"}),(0,t.jsx)(i.default,{onClick:s,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}function S({error:e,errorTitle:s,tryAgainLabel:r,cancelLabel:a,returnToGitlabDuoSetup:n,onReturnToGitlabDuoSetup:l,onTryAgain:o,onClose:c}){return(0,t.jsxs)("div",{className:"text-center py-6",children:[(0,t.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),(0,t.jsx)("h3",{className:"text-lg font-semibold mb-2",children:s}),(0,t.jsx)("p",{className:"text-sm text-red-600 mb-4",children:(0,t.jsx)(N,{text:e})}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(i.default,{onClick:()=>{n?l():o()},variant:"secondary",fullWidth:!0,children:r}),(0,t.jsx)(i.default,{onClick:c,variant:"ghost",fullWidth:!0,children:a})]})]})}function C({waitingLabel:e,completeAuthLabel:s,popupClosedHint:r,popupBlockedLabel:a,onManualInput:n}){return(0,t.jsxs)("div",{className:"text-center py-6",children:[(0,t.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,t.jsx)("h3",{className:"text-lg font-semibold mb-2",children:e}),(0,t.jsx)("p",{className:"text-sm text-text-muted mb-2",children:s}),(0,t.jsx)("p",{className:"text-xs text-text-muted mb-4 opacity-70",children:r}),(0,t.jsx)(i.default,{variant:"ghost",onClick:n,children:a})]})}function T(e){return e.port?e.port:"https:"===e.protocol?"443":"80"}function I(e,t){let s=[...new Set(e)];return`ssh ${s.map(e=>`-L ${e}:127.0.0.1:${e}`).join(" ")} <user>@${t}`}let M={codex:"http://localhost:1455/auth/callback","xai-oauth":"http://127.0.0.1:56121/callback","grok-cli":"http://127.0.0.1:56122/callback"},_={codex:1455,"xai-oauth":56121,"grok-cli":56122},E=new Set(["antigravity","agy"]),K=new Set(["codex","xai-oauth","grok-cli"]),A=new Set(["github","kiro","amazon-q","kimi-coding","kilocode","codebuddy-cn","ghe-copilot","grok-cli"]),D=new Set(["windsurf","devin-cli","grok-cli"]),L=new Set(["windsurf","devin-cli"]);async function $(e,t,s,r){let a=await fetch("/api/oauth/codex/import-token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accessToken:e,name:t})}),i=await x(a);if(!a.ok)throw Error(p(i,a.status,"Failed to import access token"));s("success"),r?.()}function P(e,t){return Math.max(1,Number(e)||t)}async function O(e,t){try{let s=await fetch(`/api/oauth/${e}/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),r=await x(s);if(r.success)return{status:"success"};if("slow_down"===r.error)return{status:"slow_down"};if(r.error&&!r.pending)return{status:"error",message:String(r.errorDescription||r.error)};return{status:"pending"}}catch(e){return{status:"error",message:e instanceof Error?e.message:"Authorization failed"}}}e.s(["f",0,function({isOpen:e,provider:l,providerInfo:d,onSuccess:u,onClose:j,idcConfig:N,reauthConnection:k}){let R,z=(0,r.f)("oauthModal"),[F,U]=(0,s.useState)("waiting"),[q,W]=(0,s.useState)(null),[J,B]=(0,s.useState)(""),[H,G]=(0,s.useState)(null),[V,Y]=(0,s.useState)(!1),[X,Q]=(0,s.useState)(null),[Z,ee]=(0,s.useState)(""),[et,es]=(0,s.useState)(!1),[er,ea]=(0,s.useState)(null),[ei,en]=(0,s.useState)(null),[el,eo]=(0,s.useState)(L.has(l)),[ec,ed]=(0,s.useState)(""),[eu,em]=(0,s.useState)(!1),[ex,ep]=(0,s.useState)(!1),[eh,ef]=(0,s.useState)(null),eb=D.has(l),eg=L.has(l),ey=(0,s.useRef)(null),ev=(0,s.useRef)(0),ej=X?.verification_uri_complete||X?.verification_uri||"",{isLocalhost:eN,isTrueLocalhost:ek,placeholderUrl:ew,loopbackLocation:eS}=(0,s.useMemo)(()=>{let e=window.location.hostname;return{isLocalhost:"localhost"===e||"127.0.0.1"===e||e.startsWith("192.168.")||e.startsWith("10.")||/^172\.(1[6-9]|2\d|3[01])\./.test(e),isTrueLocalhost:"localhost"===e||"127.0.0.1"===e,placeholderUrl:`${window.location.origin}/callback?code=...`,loopbackLocation:{hostname:e,port:window.location.port,protocol:window.location.protocol}}},[]),eC=(0,s.useRef)(!1),eT=(0,s.useRef)(!1),eI=(0,s.useCallback)(()=>{ev.current+=1,es(!1),ea(null),en(null)},[]),eM=(0,s.useCallback)(async(e,t)=>{if(q)try{if(!q.redirectUri||!q.codeVerifier)throw Error("OAuth session is incomplete (missing redirect URI or code verifier). Restart the connection and try again.");let s="string"==typeof t&&t.length>0?t:void 0,r=await fetch(`/api/oauth/${l}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,redirectUri:q.redirectUri,connectionId:k?.id,codeVerifier:q.codeVerifier,...s?{state:s}:{}})}),a=await x(r);if(!r.ok){let e="object"==typeof a.error&&null!==a.error?a.error:null,t=e?e.message||JSON.stringify(e):a.error||"Exchange failed",s=Array.isArray(e?.details)?e.details.map(e=>e?.message?e.field?`${e.field}: ${e.message}`:e.message:null).filter(Boolean).join("; "):"";throw Error(s?`${t} (${s})`:t)}U("success"),u?.()}catch(e){e.message?.toLowerCase().includes("redirect_uri_mismatch")&&E.has(l)?G("redirect_uri_mismatch: The default Google OAuth credentials only work on localhost. For remote use, configure your own OAuth credentials via environment variables: ANTIGRAVITY_OAUTH_CLIENT_ID and ANTIGRAVITY_OAUTH_CLIENT_SECRET. See the README section 'OAuth on a Remote Server'."):G(e.message),U("error")}},[q,l,u,k]),e_=(0,s.useCallback)(async()=>{let e=ec.trim();if(e&&l){em(!0),G(null);try{let t=e;if("grok-cli"===l){let s=function(e){let t=e.trim();if(!t)return{ok:!1,error:"Paste the full contents of ~/.grok/auth.json"};if(t.startsWith("{"))try{let e=JSON.parse(t);if(!e||"object"!=typeof e||Array.isArray(e))return{ok:!1,error:"auth.json must be a JSON object from ~/.grok/auth.json"};let s=!1,r=!1;for(let t of Object.values(e))if(t&&"object"==typeof t&&("string"==typeof t.key&&t.key.startsWith("eyJ")&&(s=!0,"string"==typeof t.refresh_token&&t.refresh_token.length>0)||"string"==typeof t.access_token&&t.access_token.startsWith("eyJ")&&(s=!0,"string"==typeof t.refresh_token&&t.refresh_token.length>0))){r=!0;break}if(!s)return{ok:!1,error:'Could not find a Grok Build JWT ("key") in the pasted auth.json. Run `grok login` and paste the full file.'};if(!r)return{ok:!1,error:"auth.json is missing refresh_token. Re-run `grok login` and paste the full ~/.grok/auth.json so the connection can auto-refresh (#7610)."};return{ok:!0,token:e}}catch{return{ok:!1,error:"Could not parse auth.json. Paste the full JSON from ~/.grok/auth.json."}}return t.startsWith("eyJ")?{ok:!1,error:'Do not paste only the JWT "key" field. Paste the full ~/.grok/auth.json object so refresh_token is included (#7610).'}:{ok:!1,error:"Paste the full contents of ~/.grok/auth.json (JSON object)."}}(e);if(!1===s.ok)return void G(s.error);t=s.token}let s=await fetch(`/api/oauth/${l}/import-token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t,connectionId:k?.id})}),r=await x(s);if(!s.ok){let e=p(r,s.status,"Save failed");throw Error(e)}U("success"),u?.()}catch(e){G(e.message)}finally{em(!1)}}},[ec,l,u,k]),eE=(0,s.useCallback)(async(e,t,s,r,a)=>{let i=++ev.current,n=P(s,5),o=P(r,60*n),c=Date.now()+1e3*o,d=n;for(es(!0),ea(c);Date.now()<c&&(await new Promise(e=>setTimeout(e,1e3*d)),!(i!==ev.current||Date.now()>=c));){let s=await O(l,{deviceCode:e,connectionId:k?.id,codeVerifier:t,extraData:a});if(i!==ev.current)return;if("success"===s.status){U("success"),es(!1),ea(null),u?.();return}if("slow_down"===s.status){d=Math.min(d+5,30);continue}if("error"===s.status){G(s.message),U("error"),es(!1),ea(null);return}}i===ev.current&&(G("Authorization timeout"),U("error"),es(!1),ea(null))},[l,u,k]),eK=(0,s.useCallback)(async e=>{if(l)try{let t;G(null);let s="grok-cli"===l&&(e?.grokBrowser??ex);if(A.has(l)&&!s){if(eI(),Y(!0),Q(null),U("waiting"),"ghe-copilot"===l&&!Z.trim())return void U("ghe-config");let e=new URL(`/api/oauth/${l}/device-code`,window.location.origin);("kiro"===l||"amazon-q"===l)&&N&&"object"==typeof N&&("string"==typeof N.startUrl&&N.startUrl.trim()&&e.searchParams.set("startUrl",N.startUrl.trim()),"string"==typeof N.region&&N.region.trim()&&e.searchParams.set("region",N.region.trim())),"ghe-copilot"===l&&Z.trim()&&e.searchParams.set("gheUrl",Z.trim());let t=await fetch(e.toString()),s=await x(t);if(!t.ok){let e=p(s,t.status,"Request failed");throw Error(e)}Q(s);let r=s.verification_uri_complete||s.verification_uri;"string"==typeof r&&r&&window.open(r,"oauth_verify");let a="kiro"===l||"amazon-q"===l?{_clientId:s._clientId,_clientSecret:s._clientSecret,_region:s._region}:"ghe-copilot"===l&&Z.trim()?{gheUrl:Z.trim()}:null;eE(s.device_code,s.codeVerifier,s.interval||5,s.expires_in,a);return}let r=!1;if(("claude"===l||"cline"===l||"zed-hosted"===l)&&(r=!0),K.has(l)){if(ek)try{let e=await fetch(`/api/oauth/${l}/start-callback-server`),t=await x(e);if(!e.ok)throw Error(p(t,e.status,"Failed to start callback server"));W({...t,redirectUri:t.redirectUri}),U("waiting"),ey.current=window.open(t.authUrl,"oauth_auth"),ey.current||U("input"),es(!0);for(let e=0;e<150;e++){await new Promise(e=>setTimeout(e,2e3));let e=await fetch(`/api/oauth/${l}/poll-callback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({connectionId:k?.id})}),t=await x(e);if(t.success){U("success"),es(!1),u?.();return}if(t.error&&!t.pending)throw Error(t.errorDescription||t.error)}throw es(!1),Error("Authorization timeout")}catch(e){console.warn(`${l} callback server failed, falling back to manual flow`,e),es(!1),r=!0}else if(eN){let e,t,s;ef((e=T(eS),t=_[l]??null,s=[e],null!=t&&String(t)!==e&&s.push(String(t)),{provider:l,redirectUri:M[l]??"a fixed localhost callback URL",callbackPort:t,dashboardPort:e,dashboardHost:eS.hostname,tunnelCommand:I(s,eS.hostname),localDashboardUrl:`http://localhost:${e}`})),U("loopback-mismatch");return}}if("codex"===l||"openai"===l)t="http://localhost:1455/auth/callback";else if("xai-oauth"===l||"grok-cli"===l){let e="xai-oauth"===l?56121:56122;t=`http://127.0.0.1:${e}/callback`}else if("windsurf"===l||"devin-cli"===l){let e=window.location.port||"20017";t=`http://localhost:${e}/auth/callback`}else if(E.has(l)){let e=window.location.port||"20017";t=`http://127.0.0.1:${e}/callback`}else if(eN){let e=window.location.port||("https:"===window.location.protocol?"443":"80");t=`http://localhost:${e}/callback`}else{let e=window.location.origin;t=`${e}/callback`}let a=await fetch(`/api/oauth/${l}/authorize?redirect_uri=${encodeURIComponent(t)}`),i=await x(a);if(!a.ok){let e=p(i,a.status,"Authorization failed");throw Error(e)}if(!i.authUrl)throw Error(i.error||"Browser OAuth is unavailable for this provider in the current environment. Use the supported auth method instead.");W({...i,redirectUri:i.redirectUri||t}),!ek||r?(U("input"),window.open(i.authUrl,"oauth_auth")):(U("waiting"),ey.current=window.open(i.authUrl,"oauth_popup","width=600,height=700"),ey.current||U("input"))}catch(e){G(e.message),U("error")}},[l,eN,ek,eS,eE,u,k,N,Z,eI,ex]);(0,s.useEffect)(()=>{if(!er)return void en(null);let e=()=>{en(Math.max(0,Math.ceil((er-Date.now())/1e3)))};e();let t=window.setInterval(e,1e3);return()=>window.clearInterval(t)},[er]),(0,s.useEffect)(()=>{eI(),eT.current=!1,ep(!1)},[l,eI]),(0,s.useEffect)(()=>{e||(eI(),eT.current=!1)},[e,eI]),(0,s.useEffect)(()=>()=>{ev.current+=1},[]),(0,s.useEffect)(()=>{if(!e||!l||eT.current)return;eT.current=!0;let t=L.has(l),s="gitlab-duo"===l;(eo(t),ep(!1),W(null),B(""),G(null),Y(!1),Q(null),es(!1),s)?U("gitlab-duo-setup"):t||eK()},[e,l,eK]),(0,s.useEffect)(()=>{let e;if(!q)return;eC.current=!1;let t=async e=>{if(eC.current)return;let{code:t,state:s,error:r,errorDescription:a}=e;if(q?.state&&s&&s!==q.state){eC.current=!0,G("OAuth state mismatch. Restart the connection and try again."),U("error");return}if(r){eC.current=!0,G(a||r),U("error");return}t&&(eC.current=!0,await eM(t,s))},s=e=>{let s=window.location.port,r=!1,a=!1;try{let t=new URL(e.origin);a=(r=/^(localhost|127\.0\.0\.1|\[::1\]|::1)$/i.test(t.hostname))&&t.port===s}catch{}let i=e.data?.data,n=!!q?.state&&i?.state===q.state,o=E.has(l)&&r&&n;(e.origin===window.location.origin||a||o)&&e.data?.type==="oauth_callback"&&t(i)};window.addEventListener("message",s);try{(e=new BroadcastChannel("oauth_callback")).onmessage=e=>t(e.data)}catch(e){console.log("BroadcastChannel not supported")}let r=e=>{if("oauth_callback"===e.key&&e.newValue)try{let s=JSON.parse(e.newValue);t(s),localStorage.removeItem("oauth_callback")}catch(e){console.log("Failed to parse localStorage data")}};window.addEventListener("storage",r);try{let e=localStorage.getItem("oauth_callback");if(e){let s=JSON.parse(e);s.timestamp&&Date.now()-s.timestamp<3e4&&(t(s),localStorage.removeItem("oauth_callback"))}}catch{}return()=>{window.removeEventListener("message",s),window.removeEventListener("storage",r),e&&e.close()}},[q,eM,l]),(0,s.useEffect)(()=>{if("waiting"!==F||V||!ey.current)return;let e=setInterval(()=>{if(eC.current)return void clearInterval(e);try{ey.current?.closed&&(clearInterval(e),"waiting"===F&&U("input"))}catch{}},1e3),t=setTimeout(()=>{eC.current||"waiting"!==F||(clearInterval(e),U("input"))},3e5);return()=>{clearInterval(e),clearTimeout(t)}},[F,V]);let eA=async()=>{try{if(G(null),f(J))return void await b(l,J,k,U,u);if("codex"===l&&/^eyJ/.test(J.trim()))return void await $(J.trim(),void 0,U,u);if("codex"===l&&function(e){let t="string"==typeof e?e.trim():"";if(!t.startsWith("{"))return!1;try{return null!==g(JSON.parse(t))}catch{return!1}}(J)){let e=function(e){let t=g(e);if(!t)return{ok:!1,error:"Pasted session data is not a JSON object"};let s=function(e){let t=y(e.accessToken)||y(e.access_token)||y(e.sessionToken)||y(e.session_token);if(t)return t;let s=g(e.tokens);if(s)return y(s.access_token)||y(s.accessToken)}(t);if(!s)return{ok:!1,error:"Could not find an access token field in the pasted session JSON (expected accessToken, access_token, sessionToken, or tokens.access_token)"};if(3!==s.split(".").length)return{ok:!1,error:"The access token field does not look like a valid JWT"};if(function(e,t){let s,r,a=y(e.expires);if(a){let e=Date.parse(a);if(Number.isFinite(e)&&e<=Date.now())return!0}let i=null!==(r=(s=function(e){try{if(!e||"string"!=typeof e)return null;let t=e.split(".");if(3!==t.length)return null;let s=t[1].replace(/-/g,"+").replace(/_/g,"/"),r=(4-s.length%4)%4,a=s+"=".repeat(r);return JSON.parse(h.Buffer.from(a,"base64").toString("utf8"))}catch{return null}}(t))&&"number"==typeof s.exp?s.exp:null)&&Number.isFinite(r)?r:null;return null!==i&&1e3*i<=Date.now()}(t,s))return{ok:!1,error:"Session is expired — sign in to chatgpt.com again and re-copy the session JSON"};let r=g(t.user);return{ok:!0,session:{accessToken:s,email:r&&y(r.email)||void 0}}}(JSON.parse(J.trim()));if(!1===e.ok)return void G(e.error);await $(e.session.accessToken,e.session.email,U,u);return}if(!q)throw Error("OAuth session not initialized. Restart the connection flow and try again.");let e=J.trim(),t=null,s=q?.state||null,r=null,a=null;try{let i=new URL(e);t=i.searchParams.get("code"),s=i.searchParams.get("state")||i.hash.replace(/^#/,"")||s,r=i.searchParams.get("error"),a=i.searchParams.get("error_description")}catch{let[r,a]=e.split("#",2);t=r||null,s=a||s}if(r)throw Error(a||r);if(!t)throw Error("No authorization code found. Paste the callback URL or the Authentication Code.");await eM(t,s)}catch(e){G(e.message),U("error")}},eD=(0,s.useCallback)(()=>{eI(),j()},[eI,j]),eL=(0,s.useCallback)(()=>{eI(),eo(!0)},[eI]),e$=(0,s.useCallback)(()=>{eo(!1),"grok-cli"===l&&ep(!0),eK("grok-cli"===l?{grokBrowser:!0}:void 0)},[eK,l]),eP=(0,s.useCallback)(()=>{eo(!1),ep(!1),eK({grokBrowser:!1})},[eK]);return l&&d?(0,t.jsx)(a.default,{isOpen:e,title:z("title",{providerName:d.name}),onClose:eD,size:"lg",children:(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[eb&&!eg&&"success"!==F&&(0,t.jsxs)("div",{className:"flex gap-2 border-b border-border pb-3",children:["grok-cli"===l&&(0,t.jsx)("button",{className:`text-sm px-3 py-1 rounded-t ${!el&&!ex?"font-semibold border-b-2 border-primary text-primary":"text-text-muted"}`,onClick:eP,children:"Device Code"}),(0,t.jsx)("button",{className:`text-sm px-3 py-1 rounded-t ${!el&&("grok-cli"!==l||ex)?"font-semibold border-b-2 border-primary text-primary":"text-text-muted"}`,onClick:e$,children:"Browser Login"}),(0,t.jsx)("button",{className:`text-sm px-3 py-1 rounded-t ${el?"font-semibold border-b-2 border-primary text-primary":"text-text-muted"}`,onClick:eL,children:"grok-cli"===l?"Import auth.json":"Paste API Key"})]}),eb&&el&&"success"!==F&&(0,t.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,t.jsx)("p",{className:"text-sm text-text-muted",children:"windsurf"===l?'In the Windsurf / VS Code IDE, run the "Windsurf: Provide Auth Token" command from the command palette (or click the Jupyter "Get Windsurf Authentication Token" button), then copy the shown token and paste it below. Opening windsurf.com/show-auth-token directly only shows a "Redirecting" page — the IDE must initiate the flow.':"grok-cli"===l?'Paste the FULL contents of ~/.grok/auth.json (not just the JWT "key" field). A bare JWT has no refresh_token, so the connection dies after expiry (#7610). Prefer the dedicated Import auth.json modal when available.':'Provide your WINDSURF_API_KEY (obtained via `devin auth login`, or via the Windsurf IDE "Windsurf: Provide Auth Token" command).'}),"grok-cli"===l?(0,t.jsx)("textarea",{className:"w-full h-32 p-3 text-sm font-mono bg-input border border-border rounded-md resize-none focus:outline-none focus:ring-2 focus:ring-primary",value:ec,onChange:e=>ed(e.target.value),placeholder:'{"https://auth.x.ai::clientId": {"key": "eyJ...", "refresh_token": "..."}}',"aria-label":"Grok Build auth.json"}):(0,t.jsx)(n.default,{value:ec,onChange:e=>ed(e.target.value),placeholder:"ws-...",type:"password",label:"API Key / Token"}),H&&(0,t.jsx)("p",{className:"text-sm text-red-500",children:H}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(i.default,{onClick:e_,fullWidth:!0,disabled:!ec.trim()||eu,children:eu?"Saving…":"Save Connection"}),(0,t.jsx)(i.default,{onClick:eD,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),(!eb||!el)&&(0,t.jsxs)(t.Fragment,{children:["ghe-copilot"===l&&"ghe-config"===F&&(0,t.jsx)(v,{gheUrl:Z,setGheUrl:ee,error:H,setError:G,startOAuthFlow:eK}),"gitlab-duo"===l&&"gitlab-duo-setup"===F&&(0,t.jsx)(w,{onContinue:()=>void eK(),onClose:eD}),"waiting"===F&&!V&&(0,t.jsx)(C,{waitingLabel:z("waiting"),completeAuthLabel:z("completeAuthInPopup"),popupClosedHint:z("popupClosedHint"),popupBlockedLabel:z("popupBlocked"),onManualInput:()=>U("input")}),"waiting"===F&&V&&X&&(0,t.jsx)(o,{deviceData:X,verificationUrl:ej,secondsRemaining:ei,polling:et}),"input"===F&&!V&&(0,t.jsx)(m,{provider:l,isGoogleOAuth:E.has(l),isTrueLocalhost:ek,googleHint:E.has(l)?(R=T(eS),{provider:l,redirectUri:`http://127.0.0.1:${R}/callback`,dashboardHost:eS.hostname,dashboardPort:R,tunnelCommand:I([R],eS.hostname),localDashboardUrl:`http://localhost:${R}`,helperCommand:null}):null,authUrl:"string"==typeof q?.authUrl?q.authUrl:"",callbackUrl:J,placeholderUrl:ew,canSubmit:!!(J&&(q||f(J))),onCallbackUrlChange:B,onSubmit:eA,onClose:eD})]}),"success"===F&&(0,t.jsxs)("div",{className:"text-center py-6",children:[(0,t.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,t.jsx)("h3",{className:"text-lg font-semibold mb-2",children:z("success")}),(0,t.jsx)("p",{className:"text-sm text-text-muted mb-4",children:z("successMessage",{providerName:d.name})}),(0,t.jsx)(i.default,{onClick:eD,fullWidth:!0,children:z("done")})]}),"loopback-mismatch"===F&&eh&&!el&&(0,t.jsx)(c,{providerName:d.name,hint:eh,onClose:eD}),"error"===F&&!el&&(0,t.jsx)(S,{error:H,errorTitle:z("error"),tryAgainLabel:z("tryAgain"),cancelLabel:z("cancel"),returnToGitlabDuoSetup:"gitlab-duo"===l,onReturnToGitlabDuoSetup:()=>{G(null),U("gitlab-duo-setup")},onTryAgain:()=>void eK(),onClose:eD})]})}):null}],964039)},110626,e=>{"use strict";e.i(843476),e.i(156132),e.s([])},16190,474078,11477,339971,961430,148943,e=>{"use strict";e.s(["default",()=>p],16190);var t=e.i(843476),s=e.i(593976),r=e.i(271645),a=e.i(948148);e.i(565650);var i=e.i(342923);e.s(["f",()=>i.default],474078);var i=i,n=e.i(393718);e.s(["f",()=>n.default],11477);var n=n,l=e.i(80173);e.s(["f",()=>l.default],339971);var l=l,o=e.i(907714);e.s(["f",()=>o.default],961430);var o=o,c=e.i(635055);e.s(["f",()=>c.default],148943);var c=c;let d=["none","low","medium","high","xhigh"],u=["max","ultra"];function m(e){return{name:"",description:"",scope:e?"apiKey":"global",apiKeyId:e||"",comboId:"",connectionId:"",modelPattern:"",sourceEffort:"any",requestTags:"",tagMatchMode:"any",effortMode:"inherit",targetEffort:"medium",targetKind:"keep",targetModel:"",targetComboId:"",budgetAction:"preserve",budgetTokens:"",priority:"0",enabled:!0}}function x(e,t){let s=e.trim().toLowerCase().replace(/^(?:codex|cx)\//,"");return"ultra"===t?/^gpt-5\.6-(?:sol|terra)(?:-|$)/.test(s):/^gpt-5\.6-(?:sol|terra|luna)(?:-|$)/.test(s)}function p({apiKeyId:e}){let h=(0,a.f)("reasoningRouting"),[f,b]=(0,r.useState)([]),[g,y]=(0,r.useState)([]),[v,j]=(0,r.useState)([]),[N,k]=(0,r.useState)([]),[w,S]=(0,r.useState)(()=>m(e)),[C,T]=(0,r.useState)(null),[I,M]=(0,r.useState)(!1),[_,E]=(0,r.useState)(""),[K,A]=(0,r.useState)("all"),[D,L]=(0,r.useState)("all"),[$,P]=(0,r.useState)(""),[O,R]=(0,r.useState)({model:"",effort:"missing",requestTags:"",transport:"http"}),[z,F]=(0,r.useState)(null),U=(0,r.useCallback)(async()=>{let e=await Promise.all([fetch("/api/settings/reasoning-routing-rules"),fetch("/api/combos"),fetch("/api/keys"),fetch("/api/providers")]);if(e.some(e=>!e.ok))throw Error(h("loadError"));let[t,s,r,a]=await Promise.all(e.map(e=>e.json()));b(Array.isArray(t.rules)?t.rules:[]),y(Array.isArray(s.combos)?s.combos:[]),j(Array.isArray(r.keys)?r.keys:[]),k(Array.isArray(a.connections)?a.connections:[])},[h]);(0,r.useEffect)(()=>{U().catch(()=>E(h("loadError")))},[U,h]);let q=(0,r.useMemo)(()=>{let t=$.trim().toLowerCase();return f.filter(s=>(!e||"apiKey"===s.scope&&s.apiKeyId===e)&&(!!e||"all"===K||s.scope===K)&&("enabled"!==D||!!s.enabled)&&("disabled"!==D||!s.enabled)&&(!t||[s.name,s.description,s.modelPattern,...s.requestTags].filter(Boolean).some(e=>String(e).toLowerCase().includes(t))))},[e,f,K,$,D]),W="model"===w.targetKind?w.targetModel:w.modelPattern,J=(0,r.useMemo)(()=>{let e=[...d];for(let t of u)(x(W,t)||w.targetEffort===t)&&e.push(t);return e.map(e=>({value:e,label:e}))},[w.targetEffort,W]),B=(0,r.useMemo)(()=>"inherit"!==w.effortMode&&u.includes(w.targetEffort)?"combo"===w.targetKind?h("extendedComboWarning"):W.trim()?x(W,w.targetEffort)?"":h("extendedUnsupportedWarning"):h("extendedUnknownWarning"):"",[w.effortMode,w.targetEffort,w.targetKind,h,W]),H=()=>{T(null),S(m(e))},G=async()=>{M(!0),E("");try{let e,t=await fetch(C?`/api/settings/reasoning-routing-rules/${encodeURIComponent(C)}`:"/api/settings/reasoning-routing-rules",{method:C?"PATCH":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify((e="connection"===w.scope?"keep":w.targetKind,{...w,apiKeyId:"apiKey"===w.scope&&w.apiKeyId||null,comboId:"combo"===w.scope&&w.comboId||null,connectionId:"connection"===w.scope&&w.connectionId||null,modelPattern:("model"===w.scope||"apiKey"===w.scope)&&w.modelPattern||null,requestTags:w.requestTags.split(",").map(e=>e.trim()).filter(Boolean),targetEffort:"inherit"===w.effortMode?null:w.targetEffort,targetKind:e,targetModel:"model"===e&&w.targetModel||null,targetComboId:"combo"===e&&w.targetComboId||null,budgetTokens:"set"===w.budgetAction?Number(w.budgetTokens):null,priority:Number(w.priority)}))});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error?.message||e?.error||h("saveError"))}await U(),H(),E(h("saved"))}catch(e){E(e instanceof Error?e.message:h("saveError"))}finally{M(!1)}},V=async e=>{await (0,s.u)({message:h("deleteConfirm")})&&((await fetch(`/api/settings/reasoning-routing-rules/${encodeURIComponent(e)}`,{method:"DELETE"})).ok?await U():E(h("deleteError")))},Y=async e=>{(await fetch(`/api/settings/reasoning-routing-rules/${encodeURIComponent(e.id)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:!e.enabled})})).ok?await U():E(h("saveError"))},X=async()=>{F(null);let t=await fetch("/api/settings/reasoning-routing-rules/simulate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...O,apiKeyId:e||w.apiKeyId||null,requestTags:O.requestTags.split(",").map(e=>e.trim()).filter(Boolean)})});F(await t.json())},Q=["global","apiKey","combo","model","connection"].map(e=>({value:e,label:h(`scope.${e}`)}));return(0,t.jsx)(n.default,{title:e?h("apiKeyTitle"):h("title"),subtitle:h("subtitle"),icon:"route",children:(0,t.jsxs)("div",{className:"space-y-5",children:[(0,t.jsxs)("div",{className:"grid gap-3 md:grid-cols-3",children:[(0,t.jsx)(l.default,{label:h("filterSearch"),value:$,onChange:e=>P(e.target.value)}),!e&&(0,t.jsx)(o.default,{label:h("filterScope"),value:K,onChange:e=>A(e.target.value),options:[{value:"all",label:h("all")},...Q]}),(0,t.jsx)(o.default,{label:h("filterStatus"),value:D,onChange:e=>L(e.target.value),options:[{value:"all",label:h("all")},{value:"enabled",label:h("enabled")},{value:"disabled",label:h("disabled")}]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[0===q.length&&(0,t.jsx)("p",{className:"text-sm text-text-muted",children:h("empty")}),q.map(s=>(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3 rounded-lg border border-border p-3",children:[(0,t.jsx)(c.default,{checked:s.enabled,onChange:()=>Y(s),size:"sm",ariaLabel:h("toggleAria",{name:s.name})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:"font-medium text-text-main",children:s.name}),(0,t.jsxs)("p",{className:"text-xs text-text-muted",children:[h(`scope.${s.scope}`)," · ",s.modelPattern||h("allModels")," ·"," ",s.sourceEffort," →"," ","keep"===s.targetKind?h("keepModel"):s.targetModel||s.targetComboId," ","· ",h(`mode.${s.effortMode}`),s.targetEffort?` ${s.targetEffort}`:""," ·"," ",h("priorityShort",{value:s.priority})]})]}),(0,t.jsx)(i.default,{size:"sm",variant:"ghost",icon:"edit",onClick:()=>{T(s.id),S({...m(e),...s,apiKeyId:s.apiKeyId||"",comboId:s.comboId||"",connectionId:s.connectionId||"",modelPattern:s.modelPattern||"",targetEffort:s.targetEffort||"medium",targetModel:s.targetModel||"",targetComboId:s.targetComboId||"",requestTags:s.requestTags.join(", "),budgetTokens:s.budgetTokens?String(s.budgetTokens):"",priority:String(s.priority)})},children:h("edit")}),(0,t.jsx)(i.default,{size:"sm",variant:"danger",icon:"delete",onClick:()=>V(s.id),children:h("delete")})]},s.id))]}),(0,t.jsxs)("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-4",children:[(0,t.jsx)(l.default,{label:h("name"),value:w.name,onChange:e=>S({...w,name:e.target.value}),required:!0}),(0,t.jsx)(l.default,{label:h("description"),value:w.description,onChange:e=>S({...w,description:e.target.value})}),!e&&(0,t.jsx)(o.default,{label:h("scopeLabel"),value:w.scope,onChange:e=>S({...w,scope:e.target.value,targetKind:"connection"===e.target.value?"keep":w.targetKind}),options:Q}),"apiKey"===w.scope&&!e&&(0,t.jsx)(o.default,{label:h("apiKey"),value:w.apiKeyId,onChange:e=>S({...w,apiKeyId:e.target.value}),options:v.map(e=>({value:e.id,label:e.name}))}),"combo"===w.scope&&(0,t.jsx)(o.default,{label:h("sourceCombo"),value:w.comboId,onChange:e=>S({...w,comboId:e.target.value}),options:g.map(e=>({value:e.id,label:e.name}))}),"connection"===w.scope&&(0,t.jsx)(o.default,{label:h("connection"),value:w.connectionId,onChange:e=>S({...w,connectionId:e.target.value}),options:N.map(e=>({value:e.id,label:e.displayName||e.name||`${e.provider} \xb7 ${e.id.slice(0,8)}`}))}),("model"===w.scope||"apiKey"===w.scope)&&(0,t.jsx)(l.default,{label:h("sourceModel"),value:w.modelPattern,onChange:e=>S({...w,modelPattern:e.target.value}),placeholder:"apiKey"===w.scope?h("sourceModelOptional"):h("sourceModelExample")}),(0,t.jsx)(o.default,{label:h("sourceEffort"),value:w.sourceEffort,onChange:e=>S({...w,sourceEffort:e.target.value}),options:[{value:"any",label:h("any")},{value:"missing",label:h("missing")},...[...d,...u].map(e=>({value:e,label:e}))]}),(0,t.jsx)(l.default,{label:h("requestTags"),value:w.requestTags,onChange:e=>S({...w,requestTags:e.target.value}),placeholder:h("requestTagsExample")}),(0,t.jsx)(o.default,{label:h("tagMode"),value:w.tagMatchMode,onChange:e=>S({...w,tagMatchMode:e.target.value}),options:[{value:"any",label:h("any")},{value:"all",label:h("all")}]}),(0,t.jsx)(o.default,{label:h("effortMode"),value:w.effortMode,onChange:e=>S({...w,effortMode:e.target.value}),options:["inherit","default","force"].map(e=>({value:e,label:h(`mode.${e}`)}))}),"inherit"!==w.effortMode&&(0,t.jsx)(o.default,{label:h("targetEffort"),value:w.targetEffort,onChange:e=>S({...w,targetEffort:e.target.value}),options:J}),(0,t.jsx)(o.default,{label:h("routingTarget"),value:"connection"===w.scope?"keep":w.targetKind,disabled:"connection"===w.scope,onChange:e=>S({...w,targetKind:e.target.value}),options:[{value:"keep",label:h("keepModel")},{value:"model",label:h("otherModel")},{value:"combo",label:h("combo")}]}),"model"===w.targetKind&&"connection"!==w.scope&&(0,t.jsx)(l.default,{label:h("targetModel"),value:w.targetModel,onChange:e=>S({...w,targetModel:e.target.value})}),"combo"===w.targetKind&&"connection"!==w.scope&&(0,t.jsx)(o.default,{label:h("targetCombo"),value:w.targetComboId,onChange:e=>S({...w,targetComboId:e.target.value}),options:g.map(e=>({value:e.id,label:e.name}))}),(0,t.jsx)(o.default,{label:h("budgetAction"),value:w.budgetAction,onChange:e=>S({...w,budgetAction:e.target.value}),options:["preserve","remove","set"].map(e=>({value:e,label:h(`budget.${e}`)}))}),"set"===w.budgetAction&&(0,t.jsx)(l.default,{label:h("budgetTokens"),type:"number",min:"1",value:w.budgetTokens,onChange:e=>S({...w,budgetTokens:e.target.value})}),(0,t.jsx)(l.default,{label:h("priority"),type:"number",value:w.priority,onChange:e=>S({...w,priority:e.target.value})})]}),B&&(0,t.jsx)("p",{className:"text-sm text-amber-600 dark:text-amber-400",children:B}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(i.default,{onClick:G,loading:I,children:C?h("saveChanges"):h("add")}),C&&(0,t.jsx)(i.default,{variant:"ghost",onClick:H,children:h("cancel")})]}),_&&(0,t.jsx)("p",{className:"text-sm text-text-muted",children:_}),(0,t.jsxs)("div",{className:"border-t border-border pt-5",children:[(0,t.jsx)("h4",{className:"mb-3 font-medium text-text-main",children:h("simulateTitle")}),(0,t.jsxs)("div",{className:"grid gap-3 md:grid-cols-4",children:[(0,t.jsx)(l.default,{label:h("model"),value:O.model,onChange:e=>R({...O,model:e.target.value})}),(0,t.jsx)(o.default,{label:h("effort"),value:O.effort,onChange:e=>R({...O,effort:e.target.value}),options:[{value:"missing",label:h("missing")},{value:"signal",label:h("signalOnly")},...[...d,...u].map(e=>({value:e,label:e}))]}),(0,t.jsx)(l.default,{label:h("requestTags"),value:O.requestTags,onChange:e=>R({...O,requestTags:e.target.value})}),(0,t.jsx)(o.default,{label:h("transport"),value:O.transport,onChange:e=>R({...O,transport:e.target.value}),options:[{value:"http",label:"HTTP"},{value:"codex-ws",label:"Codex WebSocket"}]})]}),(0,t.jsx)(i.default,{className:"mt-3",variant:"secondary",onClick:X,children:h("simulate")}),z&&(0,t.jsx)("pre",{className:"mt-3 max-h-64 overflow-auto rounded-lg bg-black/5 p-3 text-xs text-text-main dark:bg-white/5",children:JSON.stringify(z,null,2)})]})]})})}},953789,209991,e=>{"use strict";var t=e.i(843476),s=e.i(271645),r=e.i(618566),a=e.i(948148),i=e.i(393718),n=e.i(563201),l=e.i(629342),o=e.i(1203),c=e.i(950914),d=e.i(484124),u=e.i(243009),m=e.i(624982),x=e.i(768834),p=e.i(579473);let h=(0,x.f)()((0,p.f)(e=>({emailsVisible:!1,setEmailsVisible:t=>e({emailsVisible:t})}),{name:"trouteai-email-privacy"}));e.s(["f",0,h],209991);let f="loggerRefreshIntervalSec";function b(){return void 0===globalThis.window?null:window.localStorage}function g(e){return Number.isFinite(e)?Math.min(300,Math.max(1,Math.round(e))):10}var y=e.i(475394);let v="h-8 max-w-[220px] cursor-pointer truncate rounded-control border border-border bg-surface px-3 text-sm text-text-main focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/20";function j(e){return(e?.tokens?.in||0)+(e?.tokens?.out||0)}function N(e){let t=e?.tokens?.out||0,s=e?.duration||0;return t<=0||s<=0?0:t/(s/1e3)}let k=(0,s.forwardRef)((e,x)=>{let{initialSelectedId:p}=e,k=(0,a.f)("requestLogger"),w=(0,a.f)("common"),{emailsVisible:S}=h(),C=(0,s.useMemo)(()=>[{key:"all",label:k("statusFilters.all"),icon:""},{key:"error",label:k("statusFilters.error"),icon:"error"},{key:"ok",label:k("statusFilters.success"),icon:"check_circle"},{key:"combo",label:k("statusFilters.combo"),icon:"hub"}],[k]),T=(0,s.useMemo)(()=>[{key:"status",label:k("columns.status")},{key:"cacheSource",label:k("columns.cacheSource")},{key:"model",label:k("columns.model")},{key:"requestedModel",label:k("columns.requested")},{key:"provider",label:k("columns.provider")},{key:"protocol",label:k("columns.protocol")},{key:"account",label:k("columns.account")},{key:"apiKey",label:k("columns.apiKey")},{key:"combo",label:k("columns.combo")},{key:"tokens",label:k("columns.tokens")},{key:"tps",label:k("columns.tps")},{key:"duration",label:k("columns.duration")},{key:"time",label:k("columns.time")}],[k]),[I,M]=(0,s.useState)([]),[_,E]=(0,s.useState)(!0),[K,A]=(0,s.useState)(!0),[D,L]=(0,s.useState)(""),[$,P]=(0,s.useState)("all"),[O,R]=(0,s.useState)(""),[z,F]=(0,s.useState)(""),[U,q]=(0,s.useState)(""),[W,J]=(0,s.useState)(""),[B,H]=(0,s.useState)("newest"),[G,V]=(0,s.useState)(null),[Y,X]=(0,s.useState)(""),[Q,Z]=(0,s.useState)(null),[ee,et]=(0,s.useState)(!1),[es,er]=(0,s.useState)(!1),[ea,ei]=(0,s.useState)(!1),en={status:{desc:"status_desc",asc:"status_asc"},model:{desc:"model_desc",asc:"model_asc"},tokens:{desc:"tokens_desc",asc:"tokens_asc"},tps:{desc:"tps_desc",asc:"tps_asc"},duration:{desc:"duration_desc",asc:"duration_asc"},time:{desc:"newest",asc:"oldest"}},el=(0,s.useCallback)(e=>{let t=en[e];t&&H(e=>e===t.desc?t.asc:t.desc)},[]),eo=(0,s.useCallback)(e=>{let t=en[e];return t?B===t.desc?" ↓":B===t.asc?" ↑":"":""},[B]),[ec,ed]=(0,s.useState)(null),[eu,em]=(0,s.useState)(!1),[ex,ep]=(0,s.useState)(!1),[eh,ef]=(0,s.useState)(50),[eb,eg]=(0,s.useState)(!1),[ey,ev]=(0,s.useState)(10),ej=(0,s.useRef)(null),eN=(0,s.useRef)(10),ek=(0,s.useRef)(""),ew=(0,s.useRef)(!1),eS=(0,s.useRef)(""),eC=(0,s.useRef)(null),eT=(0,s.useRef)(null),eI=(0,s.useRef)(!1),[eM,e_]=(0,s.useState)([]),eE=(0,s.useRef)(!0),[eK,eA]=(0,s.useState)(()=>{let e=Object.fromEntries(T.map(e=>[e.key,!0]));if(void 0===globalThis.window)return e;try{let t=localStorage.getItem("loggerVisibleColumns");return t?{...e,...JSON.parse(t)}:e}catch{return e}}),eD=(0,s.useCallback)(e=>{eA(t=>{let s={...t,[e]:!t[e]};try{localStorage.setItem("loggerVisibleColumns",JSON.stringify(s))}catch{}return s})},[]);(0,s.useEffect)(()=>{let e=function(e=b()){if(!e)return 10;try{let t=e.getItem(f);if(!t)return 10;return g(Number.parseInt(t,10))}catch{return 10}}();eN.current=e,ev(e)},[]),(0,s.useEffect)(()=>{eN.current=ey},[ey]);let eL=(0,s.useCallback)(e=>{let t=eN.current,s=g("function"==typeof e?e(t):e);eN.current=s,function(e,t=b()){if(t)try{t.setItem(f,String(g(e)))}catch{return!1}}(s),ev(s)},[]),e$=(0,s.useCallback)(async(e=!1)=>{e&&E(!0);try{let e=new URLSearchParams;D&&e.set("search",D),"error"===$&&e.set("status","error"),"ok"===$&&e.set("status","ok"),"combo"===$&&e.set("combo","1"),O&&e.set("model",O),U&&e.set("provider",U),z&&e.set("account",z),W&&e.set("apiKey",W),Y&&e.set("correlationId",Y),e.set("limit",String(eh));let t=await fetch(`/api/usage/call-logs?${e}`);if(t.ok){let e=await t.json();eg(Array.isArray(e)&&e.length>=eh);let s=(Array.isArray(e)?e:[]).map(e=>e.id+":"+e.status+":"+e.duration+":"+(e.tokens?.out||0)).join("|");s!==eS.current&&(eS.current=s,M(e))}}catch(e){console.error("Failed to fetch call logs:",e)}finally{e&&E(!1)}},[D,$,O,z,U,W,Y,eh]);(0,s.useEffect)(()=>{let e=!ew.current;ew.current=!0,e$(e)},[e$]),(0,s.useEffect)(()=>{fetch("/api/provider-nodes").then(e=>e.ok?e.json():{nodes:[]}).then(e=>e_(e.nodes||[])).catch(()=>{})},[]),(0,s.useEffect)(()=>{fetch("/api/logs/detail?limit=1").then(async e=>e.ok?await e.json():null).then(e=>{e&&em(!0===e.enabled)}).catch(()=>{})},[]),(0,s.useEffect)(()=>{let e=()=>{let e="visible"===document.visibilityState;eE.current=e,e&&!G&&K&&eh<=50&&e$(!1)},t=()=>{eE.current=!0,!G&&K&&eh<=50&&e$(!1)};return document.addEventListener("visibilitychange",e),window.addEventListener("focus",t),()=>{document.removeEventListener("visibilitychange",e),window.removeEventListener("focus",t)}},[K,eh,e$,G]),(0,s.useEffect)(()=>(ej.current&&clearInterval(ej.current),!G&&K&&eh<=50&&(ej.current=setInterval(()=>{(eE.current||"visible"===document.visibilityState)&&e$(!1)},1e3*ey)),()=>{ej.current&&clearInterval(ej.current)}),[K,e$,eh,ey,G]),(0,s.useEffect)(()=>{ef(50),eI.current=!1},[D,$,O,z,U,W,Y]);let eP=(0,s.useCallback)(()=>{ef(e=>e+50)},[]);(0,s.useEffect)(()=>{let e=eC.current;if(!e)return;let t=()=>{e.scrollTop>0&&(eI.current=!0)};return e.addEventListener("scroll",t,{passive:!0}),()=>e.removeEventListener("scroll",t)},[]),(0,s.useEffect)(()=>{let e=eT.current,t=eC.current;if(!e||!eb)return;let s=new IntersectionObserver(e=>{var t;(t={isIntersecting:!!e[0]?.isIntersecting,hasMore:eb,loading:_,hasScrolled:eI.current}).isIntersecting&&t.hasMore&&!t.loading&&t.hasScrolled&&eP()},{root:t,rootMargin:"200px"});return s.observe(e),()=>s.disconnect()},[eb,_,eP]);let eO=(0,s.useMemo)(()=>{let e=I;return"error"===$?e=e.filter(e=>e.status>=400):"ok"===$?e=e.filter(e=>e.status>=200&&e.status<300):"combo"===$&&(e=e.filter(e=>e.comboName)),e},[I,$]),eR=(0,s.useMemo)(()=>{if(!ee)return eO;let e=new Map,t=[];for(let s of eO){let r=s.correlationId;if(!r){t.push(s);continue}let a=e.get(r);(!a||new Date(s.timestamp).getTime()>new Date(a.timestamp).getTime())&&e.set(r,s)}return[...t,...e.values()]},[eO,ee]),ez=(0,s.useMemo)(()=>{let e=[...eR];return e.sort((e,t)=>{switch(B){case"oldest":return new Date(e.timestamp).getTime()-new Date(t.timestamp).getTime();case"tokens_desc":return j(t)-j(e);case"tokens_asc":return j(e)-j(t);case"duration_desc":return(t.duration||0)-(e.duration||0);case"duration_asc":return(e.duration||0)-(t.duration||0);case"tps_desc":return N(t)-N(e);case"tps_asc":return N(e)-N(t);case"status_desc":return(t.status||0)-(e.status||0);case"status_asc":return(e.status||0)-(t.status||0);case"model_asc":return(e.model||"").localeCompare(t.model||"");case"model_desc":return(t.model||"").localeCompare(e.model||"");default:return new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime()}}),e},[eR,B]),eF=(0,s.useMemo)(()=>{let e=new Map;for(let t of ez){let s=t.correlationId;s&&(e.has(s)||e.set(s,[]),e.get(s).push(t))}return ez.map(t=>{let s=t.correlationId;if(!s)return{...t,isRetry:!1,groupSize:1,groupStatus:null};let r=e.get(s);if(!r||r.length<=1)return{...t,isRetry:!1,groupSize:1,groupStatus:null};let a=r[0].id===t.id,i=r.some(e=>e.status>=400||e.active),n=r.some(e=>e.status>=200&&e.status<300);return{...t,isRetry:!a,groupSize:r.length,groupStatus:i&&n?"healed":i?"failed":null}})},[ez]),eU=(0,r.useRouter)(),eq=async e=>{if(!e?.id){try{eW()}catch{}return}let t=`${e.id}:${Date.now()}:${Math.random()}`;ek.current=t,V(e);try{let t=new URL(globalThis.location.href);t.searchParams.set("id",e.id),eU.replace(t.pathname+t.search)}catch(e){}er(!0),ed(null);try{let s=await fetch(`/api/logs/${e.id}`,{cache:"no-store"});if(s.ok){let e=await s.json();if(ek.current!==t)return;let r=e?.pipelinePayloads&&Object.keys(e.pipelinePayloads||{}).length>0;ed(t=>({...t,...e,pipelinePayloads:r?e.pipelinePayloads:t?.pipelinePayloads})),e&&"object"==typeof e&&V(t=>({...t,...e,active:!0===e.active}))}else{if(ek.current!==t)return;if(404===s.status){if(e.pendingLookup||e.active){V(t=>({...t,id:e.id,status:0,method:t?.method,path:t?.path||""})),ed({detailState:"pending"});return}try{console.warn("Log not found:",e.id)}catch{}try{eW()}catch{}return}try{let e=await s.text().catch(()=>null);if(ek.current!==t)return;ed({error:`Failed to fetch log (status ${s.status})`,body:e})}catch{}}}catch(e){console.error("Failed to fetch log detail:",e)}finally{ek.current===t&&er(!1)}},eW=()=>{ek.current="",V(null),ed(null);try{let e=new URL(globalThis.location.href);e.searchParams.delete("id"),eU.replace(e.pathname+e.search)}catch(e){}},eJ=(0,s.useMemo)(()=>ez,[ez]);(0,s.useImperativeHandle)(x,()=>({openDetail:eq,getSortedLogs:()=>eJ}),[eq,eJ]);let eB=(0,s.useRef)(!1);(0,s.useEffect)(()=>{p&&!eB.current&&(eB.current=!0,eq({id:p,pendingLookup:!0}).then(e=>e).catch(e=>{console.error("Failed to open initial log id:",e)}))},[p]),(0,s.useEffect)(()=>{let e=G?.active===!0;if(!G?.id||!e)return;let t=!1,s=0,r=setInterval(async()=>{if("visible"===document.visibilityState)try{let a=await fetch(`/api/logs/${G.id}`,{cache:"no-store"});if(t)return;if(404===a.status){if(e)return;clearInterval(r);return}if(a.ok){let e=await a.json(),t=!0===e.active;ed(t=>({...t,...e,pipelinePayloads:e?.pipelinePayloads||t?.pipelinePayloads})),V(s=>({...s,...e,active:t})),!t&&++s>=3&&clearInterval(r)}}catch{}},1e3);return()=>{t=!0,clearInterval(r)}},[G?.id,ec?.detailState,G?.active,e$]),(0,s.useEffect)(()=>{let e=G?.correlationId;if(!G?.id||!e)return;let t=!1,s=setInterval(async()=>{if("visible"===document.visibilityState)try{let s=await fetch(`/api/usage/call-logs?correlationId=${encodeURIComponent(e)}`,{cache:"no-store"});if(t||!s.ok)return;let r=await s.json();if(!Array.isArray(r)||0===r.length)return;M(e=>{new Set(r.map(e=>e.id));let t=!1,s=e.map(e=>{let s=r.find(t=>t.id===e.id);return s?(t=!0,{...e,...s}):e});for(let e of r)s.some(t=>t.id===e.id)||(s.push(e),t=!0);return t?s:e})}catch{}},3e3);return()=>{t=!0,clearInterval(s)}},[G?.id,G?.correlationId]);let eH=(0,s.useMemo)(()=>G?eJ.findIndex(e=>e.id===G.id):-1,[G,eJ]),eG=(0,s.useCallback)(()=>{let e=eH>0?eJ[eH-1]:null;e?.id?eq(e).then(e=>e).catch(e=>{console.error("Failed to open previous log id:",e)}):eW()},[eH,eJ]),eV=(0,s.useCallback)(()=>{let e=eH>=0&&eH<eJ.length-1?eJ[eH+1]:null;e?.id?eq(e).then(e=>e).catch(e=>{console.error("Failed to open previous log id:",e)}):eW()},[eH,eJ]),eY=async()=>{ep(!0);try{let e=!eu;if(!(await fetch("/api/logs/detail",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:e})})).ok)throw Error(k("updatePipelineFailed"));em(e)}catch(e){console.error("Failed to toggle pipeline logging:",e)}finally{ep(!1)}},eX=(0,s.useMemo)(()=>[...new Set(I.map(e=>e.account).filter(e=>e&&"-"!==e))],[I]),eQ=(0,s.useMemo)(()=>[...new Set(I.flatMap(e=>[e.model,e.requestedModel]).filter(Boolean))].sort(),[I]),eZ=(0,s.useMemo)(()=>[...new Set(I.map(e=>e.provider).filter(e=>e&&"-"!==e))].sort(),[I]),e0=(0,s.useMemo)(()=>[...new Set(I.map(e=>e.apiKeyId||e.apiKeyName).filter(Boolean))].sort(),[I]),{totalCount:e1,okCount:e2,errorCount:e4,comboCount:e3,apiKeyCount:e5,runningCount:e6}=(0,s.useMemo)(()=>({totalCount:eO.length,okCount:eO.filter(e=>e.status>=200&&e.status<300).length,errorCount:eO.filter(e=>e.status>=400).length,comboCount:I.filter(e=>e.comboName).length,apiKeyCount:e0.length,runningCount:eO.filter(e=>!0===e.active).length}),[eO,I,e0]),e8=[U,O,z,W,Y,ee,"newest"!==B].filter(Boolean).length;return(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("button",{onClick:()=>A(!K),className:`inline-flex h-8 items-center gap-2 rounded-control border px-3 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 ${K?"border-error/30 bg-error/10 text-error":"border-border bg-surface text-text-muted hover:bg-surface-2 hover:text-text-main"}`,children:[(0,t.jsx)("span",{className:`size-2 rounded-full ${K?"bg-error animate-pulse":"bg-text-muted"}`,"aria-hidden":"true"}),K?k("recording"):k("paused")]}),(0,t.jsxs)("div",{className:"relative min-w-[200px] flex-1",children:[(0,t.jsx)("span",{className:"material-symbols-outlined pointer-events-none absolute start-2.5 top-1/2 -translate-y-1/2 text-[18px] text-text-muted","aria-hidden":"true",children:"search"}),(0,t.jsx)("input",{type:"text",placeholder:k("searchPlaceholder"),value:D,onChange:e=>L(e.target.value),className:"h-8 w-full rounded-control border border-border bg-surface ps-9 pe-3 text-sm text-text-main placeholder:text-text-muted focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),(0,t.jsx)("div",{className:"inline-flex items-center gap-0.5 rounded-control border border-border bg-surface-2 p-0.5",children:C.map(e=>(0,t.jsxs)("button",{onClick:()=>P($===e.key?"all":e.key),className:`inline-flex h-7 items-center gap-1.5 whitespace-nowrap rounded-md border px-2.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 ${$===e.key?"border-border bg-surface text-text-main shadow-none":"border-transparent text-text-muted hover:text-text-main"}`,children:[e.icon&&(0,t.jsx)("span",{className:`material-symbols-outlined text-[14px] ${$===e.key&&"error"===e.key?"text-error":$===e.key&&"ok"===e.key?"text-success":""}`,"aria-hidden":"true",children:e.icon}),e.label]},e.key))}),(0,t.jsxs)("button",{type:"button",onClick:()=>ei(e=>!e),"aria-expanded":ea,className:`inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-control border px-3 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 ${ea||e8>0?"border-primary/30 bg-primary/10 text-primary-text":"border-border bg-surface text-text-main hover:bg-surface-2"}`,children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"tune"}),w("filters"),e8>0&&(0,t.jsx)("span",{className:"inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-primary px-1 text-[10px] font-semibold tabular-nums text-on-primary",children:e8})]}),(0,t.jsx)(n.default,{columns:T,visible:eK,onToggle:eD}),(0,t.jsx)("button",{onClick:()=>e$(!1),className:"inline-flex size-8 items-center justify-center rounded-control border border-border bg-surface text-text-muted transition-colors hover:bg-surface-2 hover:text-text-main focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",title:k("refresh"),"aria-label":k("refresh"),children:(0,t.jsx)("span",{className:"material-symbols-outlined text-[18px]","aria-hidden":"true",children:"refresh"})})]}),ea&&(0,t.jsx)("div",{className:"flex flex-col gap-3 rounded-card border border-border bg-surface p-3",children:(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("select",{value:U,onChange:e=>q(e.target.value),className:v,children:[(0,t.jsx)("option",{value:"",children:k("allProviders")}),eZ.map(e=>{let s=(0,m.f)(e,eM),r=d.N[e];return(0,t.jsx)("option",{value:e,children:s||r?.label||e.toUpperCase()},e)})]}),(0,t.jsxs)("select",{value:O,onChange:e=>R(e.target.value),className:v,children:[(0,t.jsx)("option",{value:"",children:k("allModels")}),eQ.map(e=>(0,t.jsx)("option",{value:e,children:e},e))]}),(0,t.jsxs)("select",{value:z,onChange:e=>F(e.target.value),className:v,children:[(0,t.jsx)("option",{value:"",children:k("allAccounts")}),eX.map(e=>(0,t.jsx)("option",{value:e,children:S?e:`${(0,u.a)(e,!1)} \xb7 #${(0,u.N)(e)}`},e))]}),(0,t.jsxs)("select",{value:W,onChange:e=>J(e.target.value),className:v,children:[(0,t.jsx)("option",{value:"",children:k("allApiKeys")}),e0.map(e=>{let s=I.find(t=>(t.apiKeyId||t.apiKeyName)===e),r=(0,u.J)(s?.apiKeyName,s?.apiKeyId);return(0,t.jsx)("option",{value:e,children:r},e)})]}),(0,t.jsxs)("div",{className:"relative min-w-[180px]",children:[(0,t.jsx)("span",{className:"material-symbols-outlined pointer-events-none absolute start-2.5 top-1/2 -translate-y-1/2 text-[16px] text-text-muted","aria-hidden":"true",children:"tag"}),(0,t.jsx)("input",{type:"text",placeholder:"Correlation ID",value:Y,onChange:e=>X(e.target.value),className:"h-8 w-full rounded-control border border-border bg-surface ps-8 pe-3 font-mono text-sm text-text-main placeholder:text-text-muted focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),(0,t.jsxs)("button",{onClick:()=>et(e=>!e),className:`inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-control border px-3 text-sm font-medium transition-colors ${ee?"border-primary/30 bg-primary/10 text-primary-text":"border-border bg-surface text-text-muted hover:bg-surface-2 hover:text-text-main"}`,title:ee?k("showAllRows"):k("showLatestPerCorrelation"),children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:ee?"unfold_less":"unfold_more"}),ee?k("grouped"):k("allRows")]}),(0,t.jsxs)("select",{value:B,onChange:e=>H(e.target.value),className:v,title:k("sortLogs"),children:[(0,t.jsx)("option",{value:"newest",children:k("sortNewest")}),(0,t.jsx)("option",{value:"oldest",children:k("sortOldest")}),(0,t.jsx)("option",{value:"tokens_desc",children:k("sortTokensDesc")}),(0,t.jsx)("option",{value:"tokens_asc",children:k("sortTokensAsc")}),(0,t.jsx)("option",{value:"duration_desc",children:k("sortDurationDesc")}),(0,t.jsx)("option",{value:"duration_asc",children:k("sortDurationAsc")}),(0,t.jsx)("option",{value:"status_desc",children:k("sortStatusDesc")}),(0,t.jsx)("option",{value:"status_asc",children:k("sortStatusAsc")}),(0,t.jsx)("option",{value:"model_asc",children:k("sortModelAsc")}),(0,t.jsx)("option",{value:"model_desc",children:k("sortModelDesc")})]}),(0,t.jsxs)("div",{className:"inline-flex h-8 items-center gap-0.5 rounded-control border border-border bg-surface px-1",title:k("refreshIntervalSeconds"),children:[(0,t.jsx)("span",{className:"material-symbols-outlined px-1 text-[16px] text-text-muted","aria-hidden":"true",children:"timer"}),(0,t.jsx)("button",{onClick:()=>eL(e=>e-1),className:"flex size-6 items-center justify-center rounded-md text-sm font-medium text-text-muted transition-colors hover:bg-surface-2 hover:text-text-main",title:k("decreaseInterval"),"aria-label":k("decreaseInterval"),children:"−"}),(0,t.jsx)("input",{type:"number",min:1,max:300,value:ey,onChange:e=>{let t=Number.parseInt(e.target.value,10);Number.isNaN(t)||eL(t)},className:"w-10 bg-transparent text-center text-xs tabular-nums text-text-main focus:outline-none [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",title:k("refreshIntervalSeconds"),"aria-label":k("refreshIntervalSeconds")}),(0,t.jsx)("button",{onClick:()=>eL(e=>e+1),className:"flex size-6 items-center justify-center rounded-md text-sm font-medium text-text-muted transition-colors hover:bg-surface-2 hover:text-text-main",title:k("increaseInterval"),"aria-label":k("increaseInterval"),children:"+"}),(0,t.jsx)("span",{className:"pe-1 text-xs text-text-muted",children:"s"})]}),(0,t.jsxs)("button",{onClick:eY,disabled:ex,className:`inline-flex h-8 items-center gap-2 whitespace-nowrap rounded-control border px-3 text-sm font-medium transition-colors disabled:opacity-60 ${eu?"border-warning/30 bg-warning/10 text-warning":"border-border bg-surface text-text-muted hover:bg-surface-2 hover:text-text-main"}`,title:k("capturePipeline"),children:[(0,t.jsx)("span",{className:`size-2 rounded-full ${eu?"bg-warning":"bg-text-muted"}`,"aria-hidden":"true"}),ex?k("updatingPipelineLogs"):eu?k("pipelineLogsOn"):k("pipelineLogsOff")]})]})}),eZ.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-1.5",children:eZ.map(e=>{let s=(0,m.f)(e,eM)||d.N[e]?.label||e.toUpperCase(),r=U===e;return(0,t.jsx)("button",{onClick:()=>q(r?"":e),className:`inline-flex h-7 max-w-[220px] items-center truncate rounded-full border px-3 text-xs font-medium transition-colors ${r?"border-primary/30 bg-primary/10 text-primary-text":"border-border bg-surface text-text-muted hover:bg-surface-2 hover:text-text-main"}`,title:s,children:s},e)})}),!ea&&eu&&(0,t.jsxs)("div",{className:"-mt-2 flex items-center gap-2 text-xs text-warning",children:[(0,t.jsx)("span",{className:"size-1.5 rounded-full bg-warning","aria-hidden":"true"}),k("pipelineLogsOn")]}),(0,t.jsxs)("div",{className:"-mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-text-muted tabular-nums",children:[(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"font-medium text-text-main",children:e1})," ",k("total")]}),e6>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{"aria-hidden":"true",children:"·"}),(0,t.jsxs)("span",{className:"text-warning",children:[e6," running"]})]}),(0,t.jsx)("span",{"aria-hidden":"true",children:"·"}),(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"font-medium text-text-main",children:e2})," ",k("ok")]}),e4>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{"aria-hidden":"true",children:"·"}),(0,t.jsxs)("span",{className:"text-error",children:[(0,t.jsx)("span",{className:"font-medium",children:e4})," ",k("err")]})]}),e3>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{"aria-hidden":"true",children:"·"}),(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"font-medium text-text-main",children:e3})," ",k("combo")]})]}),e5>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{"aria-hidden":"true",children:"·"}),(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"font-medium text-text-main",children:e5})," ",k("keys")]})]}),(0,t.jsx)("span",{"aria-hidden":"true",children:"·"}),(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"font-medium text-text-main",children:ez.length})," ",k("shown")]})]}),(0,t.jsx)(i.default,{padding:"none",className:"min-h-[460px] resize-y overflow-auto bg-surface",children:(0,t.jsxs)("div",{ref:eC,className:"p-0 overflow-x-auto overflow-y-auto h-full min-h-[460px]",children:[_&&0===I.length?(0,t.jsx)("div",{className:"p-8 text-center text-text-muted",children:k("loadingLogs")}):0===I.length?(0,t.jsx)(l.default,{icon:"receipt_long",title:k("noLogs")}):0===ez.length?(0,t.jsx)(l.default,{icon:"filter_alt_off",title:k("noMatchingLogs")}):(0,t.jsxs)("table",{className:y.g,children:[(0,t.jsx)("thead",{className:y.U,style:y.Q,children:(0,t.jsxs)("tr",{className:y.M,style:y.Q,children:[eK.status&&(0,t.jsxs)("th",{className:`${y.j} cursor-pointer select-none`,onClick:()=>el("status"),children:[k("columns.status"),eo("status")]}),eK.cacheSource&&(0,t.jsx)("th",{className:y.j,children:k("columns.cacheSource")}),eK.model&&(0,t.jsx)("th",{className:y.j,children:k("columns.model")}),eK.requestedModel&&(0,t.jsx)("th",{className:y.j,children:k("columns.requested")}),eK.provider&&(0,t.jsx)("th",{className:y.j,children:k("columns.provider")}),eK.protocol&&(0,t.jsx)("th",{className:y.j,children:k("columns.protocol")}),eK.account&&(0,t.jsx)("th",{className:y.j,children:k("columns.account")}),eK.apiKey&&(0,t.jsx)("th",{className:y.j,children:k("columns.apiKey")}),eK.combo&&(0,t.jsx)("th",{className:y.j,children:k("columns.combo")}),eK.tokens&&(0,t.jsxs)("th",{className:`${y.F} cursor-pointer select-none`,onClick:()=>el("tokens"),children:[k("columns.tokens"),eo("tokens")]}),eK.tps&&(0,t.jsxs)("th",{className:`${y.F} cursor-pointer select-none`,onClick:()=>el("tps"),children:[k("columns.tps"),eo("tps")]}),eK.duration&&(0,t.jsxs)("th",{className:`${y.F} cursor-pointer select-none`,onClick:()=>el("duration"),children:[k("columns.duration"),eo("duration")]}),eK.time&&(0,t.jsxs)("th",{className:`${y.F} cursor-pointer select-none`,onClick:()=>el("time"),children:[k("columns.time"),eo("time")]})]})}),(0,t.jsx)("tbody",{className:"divide-y divide-border/30",children:eF.map(e=>{let s,r,a=!0===e.active,i=a?null:e.sourceFormat||e.provider,n=i?(0,d.g)(i,e.provider):null,l=(0,m.f)(e.provider,eM),o=e.providerDisplay||l||d.N[e.provider]?.label||(e.provider||"-").toUpperCase(),c=!a&&e.status>=400,x=(0,y.a)(e.cacheSource),p=x?.key==="semantic",h=(0,u.a)(e.account,S);return(0,t.jsxs)("tr",{onClick:()=>eq(e),"data-cid":e.correlationId||void 0,onMouseEnter:()=>e.correlationId&&Z(e.correlationId),onMouseLeave:()=>Z(null),className:`cursor-pointer transition-colors ${c?"bg-error/5 hover:bg-error/15":"hover:bg-primary/10"} ${e.isRetry?"border-l-2 border-l-amber-500/50":""} ${Q&&e.correlationId===Q?"bg-primary/10 ring-1 ring-primary/20":""}`,style:e.isRetry?{backgroundColor:Q&&e.correlationId===Q?void 0:"rgba(245,158,11,0.03)"}:void 0,children:[eK.status&&(0,t.jsx)("td",{className:"px-3 py-2",children:a?(0,t.jsx)("span",{className:"inline-flex items-center justify-center w-7 h-7 rounded-full bg-warning/15 border border-warning/25",title:"In progress",children:(0,t.jsx)("span",{className:"inline-block h-3 w-3 rounded-full border-2 border-warning border-t-transparent animate-spin"})}):(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)("span",{className:`inline-block min-w-[36px] rounded-control border px-2 py-0.5 text-center text-[11px] font-medium tabular-nums ${(0,y.X)(e.status)}`,children:e.status||"..."}),"healed"===e.groupStatus&&!e.isRetry&&e.status>=400&&(0,t.jsx)("span",{className:"text-success text-[11px]",title:"Recovered by retry",children:"✓"}),e.isRetry&&(0,t.jsx)("button",{className:"inline-flex items-center text-warning hover:text-warning text-[11px] ml-0.5",title:k("goToParentRequest"),"aria-label":k("goToParentRequest"),onClick:t=>{t.stopPropagation();let s=eF.find(t=>t.correlationId===e.correlationId&&!t.isRetry);s&&eq(s)},children:"↳"})]})}),eK.cacheSource&&(0,t.jsx)("td",{className:"px-3 py-2",children:a?(0,t.jsx)("span",{className:"text-text-muted text-[10px]",children:"—"}):(0,t.jsx)("span",{className:`inline-block px-2 py-0.5 rounded-control text-[11px] font-medium ${x?.className||""}`,title:p?k("semanticCacheHit"):k("upstreamResponse"),children:p?k("semantic"):k("upstream")})}),eK.model&&(0,t.jsxs)("td",{className:"px-3 py-2 font-medium text-text-main font-mono text-[11px]",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("span",{children:e.model}),"healed"===e.groupStatus&&!e.isRetry&&(0,t.jsx)("span",{className:"inline-flex items-center gap-0.5 px-1 py-0 rounded text-[11px] font-medium bg-success/15 text-success border border-success/25",title:`Failed, recovered after ${e.groupSize-1} retry`,children:"healed"}),"failed"===e.groupStatus&&!e.isRetry&&(0,t.jsx)("span",{className:"inline-flex items-center gap-0.5 px-1 py-0 rounded text-[11px] font-medium bg-error/15 text-error border border-error/25",title:`All ${e.groupSize} attempts failed`,children:"failed"}),e.modelPinned&&(0,t.jsx)("span",{className:"inline-flex items-center gap-0.5 px-1 py-0 rounded text-[11px] font-medium bg-primary/15 text-primary-text border border-primary/25",title:"Model selected via context-cache session pinning",children:"pinned"})]}),e.correlationId&&!e.isRetry&&e.groupSize>1&&(0,t.jsxs)("div",{className:"text-[10px] text-text-muted font-normal truncate max-w-[120px]",title:e.correlationId,children:[e.correlationId.slice(0,12),"… · ",e.groupSize," attempts"]}),e.correlationId&&!e.isRetry&&e.groupSize<=1&&(0,t.jsxs)("div",{className:"text-[10px] text-text-muted font-normal truncate max-w-[120px]",title:e.correlationId,children:[e.correlationId.slice(0,12),"…"]}),e.correlationId&&e.isRetry&&(0,t.jsxs)("div",{className:"text-[10px] text-warning font-normal truncate max-w-[120px]",title:e.correlationId,children:[e.correlationId.slice(0,12),"…"]})]}),eK.requestedModel&&(0,t.jsx)("td",{className:"px-3 py-2 font-mono text-[11px]",children:e.requestedModel?(0,t.jsx)("span",{className:e.requestedModel!==e.model?"text-warning":"text-text-muted",title:e.requestedModel!==e.model?k("requestedRoutedTitle",{requested:e.requestedModel,routed:e.model}):e.requestedModel,children:e.requestedModel}):(0,t.jsx)("span",{className:"text-text-muted text-[10px]",children:"—"})}),eK.provider&&(0,t.jsx)("td",{className:"px-3 py-2",children:(0,t.jsx)("span",{className:"inline-block max-w-[160px] truncate rounded-control border border-border bg-surface-2 px-2 py-0.5 text-[11px] font-medium text-text-main",title:o,children:o})}),eK.protocol&&(0,t.jsx)("td",{className:"px-3 py-2",children:a?(0,t.jsx)("span",{className:"text-text-muted text-[10px]",children:"—"}):(0,t.jsx)("span",{className:"inline-block rounded-control border border-border bg-surface-2 px-2 py-0.5 text-[11px] font-medium text-text-muted",children:n?.label||"—"})}),eK.account&&(0,t.jsx)("td",{className:"px-3 py-2 text-text-muted truncate max-w-[120px]",title:h,children:h}),eK.apiKey&&(0,t.jsx)("td",{className:"px-3 py-2 text-text-muted truncate max-w-[140px]",title:e.apiKeyName||e.apiKeyId||k("noApiKey"),children:a?(0,t.jsx)("span",{className:"text-text-muted text-[10px]",children:"—"}):(0,u.J)(e.apiKeyName,e.apiKeyId)}),eK.combo&&(0,t.jsx)("td",{className:"px-3 py-2",children:a?(0,t.jsx)("span",{className:"text-text-muted text-[10px]",children:"—"}):e.comboName?(0,t.jsx)("span",{className:"inline-block max-w-[160px] truncate rounded-full border border-primary/30 bg-primary/10 px-2 py-0.5 text-[11px] font-medium text-primary-text",title:e.comboName,children:e.comboName}):(0,t.jsx)("span",{className:"text-text-muted text-[10px]",children:"—"})}),eK.tokens&&(0,t.jsx)("td",{className:"px-3 py-2 text-right whitespace-nowrap",children:a?(0,t.jsx)("span",{className:"text-text-muted text-[10px]",children:"—"}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-text-muted",children:"TI:"})," ",(0,t.jsx)("span",{className:"text-text-main",children:e.tokens?.in?.toLocaleString()||0}),(0,t.jsx)("span",{className:"mx-1 text-border",children:"|"}),(0,t.jsx)("span",{className:"text-text-muted",children:"TO:"})," ",(0,t.jsx)("span",{className:"text-text-main",children:e.tokens?.out?.toLocaleString()||0}),e.tokens?.compressed!=null&&e.tokens.compressed>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"mx-1 text-border",children:"|"}),(0,t.jsxs)("span",{className:"text-text-muted font-medium",title:`${e.tokens.compressed.toLocaleString()} tokens compressed`,children:["↓",e.tokens.compressed.toLocaleString()]})]})]})}),eK.tps&&(0,t.jsx)("td",{className:"px-3 py-2 text-right whitespace-nowrap font-mono",children:a?(0,t.jsx)("span",{className:"text-text-muted text-[10px]",children:"—"}):(r=(s=N(e))<=0?"text-text-muted":"text-text-main",(0,t.jsx)("span",{className:r,title:`${s.toFixed(2)} tokens/sec`,children:s<=0?"—":s>=100?Math.round(s).toLocaleString():s.toFixed(1)}))}),eK.duration&&(0,t.jsx)("td",{className:"px-3 py-2 text-right text-text-main tabular-nums",children:(0,u.M)(e.duration)}),eK.time&&(0,t.jsx)("td",{className:"px-3 py-2 text-right text-text-muted",children:(0,u.P)(e.timestamp)})]},e.id)})})]}),eb&&ez.length>0&&(0,t.jsx)("div",{ref:eT,className:"flex justify-center py-3 border-t border-border/30",children:(0,t.jsx)("button",{type:"button",onClick:eP,className:"h-7 rounded-control border border-border bg-surface px-3 text-xs font-medium text-text-main transition-colors hover:bg-surface-2",children:_?k("loadingMore"):k("loadMore")})})]})}),(0,t.jsx)("div",{className:"text-xs text-text-muted",children:k("callLogsInfo",{dataDir:"{DATA_DIR}/call_logs/",retentionDays:"CALL_LOG_RETENTION_DAYS",maxEntries:"CALL_LOG_MAX_ENTRIES"})}),G&&(0,t.jsx)(o.f,{log:G,detail:ec,loading:es,debugEnabled:!!G.active||eu,emailsVisible:S,onClose:eW,onCopy:c.f,onPrevious:eG,onNext:eV,relatedLogs:G.correlationId?eF.filter(e=>e.correlationId===G.correlationId):[],onSelectRelated:e=>{eW(),eq(e)}})]})});k.displayName="RequestLoggerV2",e.s(["default",0,k],953789)},323060,e=>{"use strict";var t=e.i(843476),s=e.i(156132);e.s(["default",0,function({options:e=[],value:r,onChange:a,size:i="md",className:n,"aria-label":l}){let o={sm:"h-6 px-2.5 text-xs",md:"h-7 px-3 text-sm",lg:"h-9 px-4 text-sm"};return(0,t.jsx)("div",{role:"tablist","aria-label":l,className:(0,s.f)("inline-flex items-center gap-0.5 p-0.5 rounded-control","bg-surface-2 border border-border",n),children:e.map(e=>(0,t.jsxs)("button",{role:"tab","aria-selected":r===e.value,tabIndex:r===e.value?0:-1,onClick:()=>a(e.value),className:(0,s.f)("rounded-md font-medium whitespace-nowrap transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",o[i],r===e.value?"bg-surface text-text-main shadow-soft dark:bg-white/10":"text-text-muted hover:text-text-main",e.icon&&"flex items-center"),children:[e.icon&&(0,t.jsx)("span",{className:"material-symbols-outlined text-[16px] me-1.5","aria-hidden":"true",children:e.icon}),e.label]},e.value))})}])},907714,e=>{"use strict";var t=e.i(843476),s=e.i(271645),r=e.i(948148),a=e.i(156132);e.s(["default",0,function({label:e,options:i=[],value:n,onChange:l,placeholder:o,error:c,hint:d,disabled:u=!1,required:m=!1,className:x,selectClassName:p,id:h,children:f,...b}){let g=(0,r.f)("common"),y=(0,s.useId)(),v=h||y,j=c?`${v}-error`:void 0,N=d&&!c?`${v}-hint`:void 0,k=[j,N].filter(Boolean).join(" ")||void 0;return(0,t.jsxs)("div",{className:(0,a.f)("flex flex-col gap-1.5",x),children:[e&&(0,t.jsxs)("label",{htmlFor:v,className:"text-xs font-medium text-text-muted",children:[e,m&&(0,t.jsx)("span",{className:"text-error ml-1","aria-hidden":"true",children:"*"})]}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsxs)("select",{id:v,value:n,onChange:l,disabled:u,required:m,"aria-required":m||void 0,"aria-invalid":!!c||void 0,"aria-describedby":k,className:(0,a.f)("w-full h-9 px-3 pe-9 text-sm text-text-main","bg-surface border border-border rounded-control appearance-none cursor-pointer","focus:border-primary focus:ring-2 focus:ring-primary/20 focus:outline-none","transition-colors disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",c?"border-error focus:border-error focus:ring-error/20":"",p),...b,children:[!f&&(o??g("selectOption"))&&(0,t.jsx)("option",{value:"",disabled:!0,className:"bg-surface text-text-muted",children:o??g("selectOption")}),!f&&i.map(e=>(0,t.jsx)("option",{value:e.value,className:"bg-surface text-text-main",children:e.label},e.value)),f]}),(0,t.jsx)("div",{className:"absolute inset-y-0 end-0 flex items-center pe-2.5 pointer-events-none text-text-muted","aria-hidden":"true",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"expand_more"})})]}),c&&(0,t.jsxs)("p",{id:j,className:"text-xs text-error flex items-center gap-1",role:"alert",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[14px]","aria-hidden":"true",children:"error"}),c]}),d&&!c&&(0,t.jsx)("p",{id:N,className:"text-xs text-text-muted",children:d})]})}])},647829,402038,799012,e=>{"use strict";var t=e.i(247167),s=e.i(843476),r=e.i(271645),a=e.i(522016),i=e.i(618566),n=e.i(156132),l=e.i(723790);let o=null;function c({className:e}){let[t,a]=(0,r.useState)(null);return((0,r.useEffect)(()=>{let e=!0;return(o??=fetch("/api/settings/require-login").then(e=>e.ok?e.json():null).then(e=>{let t=e?.brandCredit;return t&&"string"==typeof t.text&&t.text?{text:t.text,url:"string"==typeof t.url?t.url:""}:null}).catch(()=>null)).then(t=>{e&&a(t)}),()=>{e=!1}},[]),t)?(0,s.jsx)("p",{className:(0,n.f)("break-words text-[11px] leading-snug text-text-muted",e),children:t.url?(0,s.jsx)("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"rounded-sm transition-colors hover:text-text-main focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",children:t.text}):t.text}):null}e.s(["f",0,c],402038);var d=e.i(342923),u=e.i(80173),m=e.i(703166),x=e.i(948148);let p=["compression-context","tools","integrations","logs","audit","system","batch"],h="hiddenSidebarGroupLabels";function f(e){if(!Array.isArray(e))return[];let t=new Set;for(let s of e)"string"==typeof s&&p.includes(s)&&t.add(s);return p.filter(e=>t.has(e))}e.s(["T",0,h,"C",0,p,"x",0,f],799012);var b=e.i(241937),g=e.i(513859);t.default.env.NEXT_PUBLIC_TROUTEAI_E2E_MODE;let y="setup",v="sidebar-expanded-sections",j="sidebar-pinned-sections";function N(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}e.s(["default",0,function({onClose:e,collapsed:t=!1,onToggleCollapse:o}){let p=(0,i.usePathname)(),k=(0,x.f)("sidebar"),w=(0,x.f)("common"),S=(0,r.useRef)(null),[C,T]=(0,r.useState)(!1),[I,M]=(0,r.useState)(!1),[_,E]=(0,r.useState)(!1),[K,A]=(0,r.useState)(!1),[D,L]=(0,r.useState)([]),[$,P]=(0,r.useState)(!1),[O,R]=(0,r.useState)(!1),[z,F]=(0,r.useState)([]),[U,q]=(0,r.useState)([]),[W,J]=(0,r.useState)({}),[B,H]=(0,r.useState)(null),[G,V]=(0,r.useState)(null),[Y,X]=(0,r.useState)(new Set([y])),[Q,Z]=(0,r.useState)(new Set),[ee,et]=(0,r.useState)(!1),es=(0,r.useRef)(!1),[er,ea]=(0,r.useState)(null),[ei,en]=(0,r.useState)("");(0,r.useEffect)(()=>{let e=function(e,t){try{let t=localStorage.getItem(e);if(t){let e=JSON.parse(t);if(Array.isArray(e))return e}}catch{}return t}(v,[y]),t=(()=>{try{return localStorage.getItem(j)}catch{return null}})(),s=new Set(null!==t?JSON.parse(t):g.f.filter(e=>e.defaultPinned).map(e=>e.id)),r=new Set([...e,...s]);es.current=0===e.length,X(r),Z(s),et(!0)},[]),(0,r.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{A(e?.debugMode===!0),L((0,b.D)(e?.[b.P])),F(f(e?.[h])),H(e?.instanceName||null),V(e?.customLogoBase64||e?.customLogoUrl||null),Array.isArray(e?.[b._])&&q(e[b._]),e?.[b.R]&&"object"==typeof e[b.R]&&J(e[b.R])}).catch(()=>{}).finally(()=>P(!0));let e=e=>{let t=e.detail||{};"debugMode"in t&&A(!0===t.debugMode),b.P in t&&L((0,b.D)(t[b.P])),h in t&&F(f(t[h])),b._ in t&&Array.isArray(t[b._])&&q(t[b._]),b.R in t&&t[b.R]&&"object"==typeof t[b.R]&&J(t[b.R]),"instanceName"in t&&H(t.instanceName||null),"customLogoBase64"in t?V(t.customLogoBase64||null):"customLogoUrl"in t&&V(t.customLogoUrl||null)};return window.addEventListener(b.z,e),()=>window.removeEventListener(b.z,e)},[]);let el=(e,t)=>"function"==typeof k.has&&k.has(e)?k(e):t,eo=(e,t)=>{if(t.has(e.id))return null;let s=e.subtitleKey?el(e.subtitleKey,e.subtitleFallback??""):e.subtitleFallback;return{...e,label:el(e.i18nKey,e.labelFallback??e.id),subtitle:s||void 0}},ec=new Set(D),ed=new Set(z),eu=(0,b.K)(g.f.filter(e=>"debug"!==e.visibility||K),U).map(e=>{let t=(0,b.S)(e.children,W[e.id]??[]).map(e=>{if("type"in e&&"group"===e.type){let t=e.items.map(e=>eo(e,ec)).filter(Boolean);return 0===t.length?null:1===t.length?t[0]:{...e,title:el(e.titleKey,e.titleFallback),separatorHidden:ed.has(e.id),items:t}}return eo(e,ec)}).filter(Boolean);return{...e,title:el(e.titleKey,e.titleFallback),children:t}}).filter(e=>e.children.flatMap(e=>"group"===e.type?e.items:[e]).length>0),em=eu.flatMap(e=>e.children.flatMap(e=>"group"===e.type?e.items:[e])),ex=em.length<=12,ep=function(e,t){let s=null;for(let r of t)if(!r.external&&function(e,t,s=!1){return!!e&&(s?e===t:e===t||e.startsWith(`${t}/`))}(e,r.href,!0===r.exact)){if(!s||r.href.length>s.href.length){s=r;continue}r.href.length===s.href.length&&r.exact&&!s.exact&&(s=r)}return s?.href||null}(p,em),eh=ei.trim().length>0,ef=eh?function(e,t){let s=t.trim().toLowerCase();if(!s)return[...e];let r=e=>e.label.toLowerCase().includes(s),a=[];for(let t of e){let e=[];for(let s of t.children)if("object"==typeof s&&null!==s&&"type"in s&&"group"===s.type){let t=s.items.filter(r);t.length>0&&e.push({...s,items:t})}else r(s)&&e.push(s);e.length>0&&a.push({...t,children:e})}return a}(eu,ei):eu;(0,r.useEffect)(()=>{if(!t&&ee){if(es.current){es.current=!1;return}for(let e of eu)if(e.children.flatMap(e=>"group"===e.type?e.items:[e]).some(e=>!e.external&&e.href===ep)){X(t=>{let s=new Set([...Q,e.id]);return[...s].every(e=>t.has(e))&&s.size===t.size?t:(N(v,[...s]),s)});break}}},[ep,t,Q,ee]);let eb=(0,r.useCallback)(e=>{X(t=>{let s=function(e,t,s){if(e.has(s)){let t=new Set(e);return t.delete(s),t}return new Set([...t,s])}(t,Q,e);return N(v,[...s]),s})},[Q]),eg=(0,r.useCallback)(e=>{Z(t=>{let s=new Set(t);return s.has(e)?s.delete(e):(s.add(e),X(t=>{if(t.has(e))return t;let s=new Set(t);return s.add(e),N(v,[...s]),s})),N(j,[...s]),s})},[]),ey=async()=>{M(!0);try{await fetch("/api/restart",{method:"POST"})}catch(e){}M(!1),T(!1),E(!0),setTimeout(()=>globalThis.location.reload(),3e3)},ev=0===D.length,ej=ev?el("simpleMenu","Simple menu"):el("showAllMenus","Show all menus"),eN=ev?el("simpleMenuHint","Show only the main pages"):el("showAllMenusHint","Show every page in the menu"),ek=async()=>{let e=ev?"minimal":"all",t={[b.P]:(0,b.I)(e),[b.C]:e};R(!0);try{let e=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});e.ok?window.dispatchEvent(new CustomEvent(b.z,{detail:t})):console.error("Failed to switch the sidebar menu:",e.statusText)}catch(e){console.error("Error switching the sidebar menu:",e)}finally{R(!1)}},ew=(0,r.useCallback)((e,s,r)=>{if(!t)return;let a=e.currentTarget.getBoundingClientRect(),i=S.current?.getBoundingClientRect();ea({id:s,label:r,x:(i?.right??64)+8,y:a.top+a.height/2})},[t]),eS=(0,r.useCallback)(()=>ea(null),[]),eC=r=>{let i=!r.external&&ep===r.href,l=(0,n.f)("group relative flex min-h-8 items-center gap-2.5 rounded-md text-sm transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",t?"mx-auto size-9 justify-center":"px-2 py-1",i?"bg-surface-2 font-medium text-text-main":"text-text-muted hover:bg-surface-2 hover:text-text-main"),o=(0,n.f)("material-symbols-outlined shrink-0 text-[18px] transition-colors",i?"fill-1 text-primary-text":"text-text-muted group-hover:text-text-main"),c=(0,s.jsxs)(s.Fragment,{children:[i&&(0,s.jsx)("span",{"aria-hidden":"true",className:(0,n.f)("absolute start-0 top-1/2 w-0.5 -translate-y-1/2 rounded-full bg-primary",t?"h-5":"h-4")}),(0,s.jsx)("span",{className:o,"aria-hidden":"true",children:r.icon}),!t&&(0,s.jsx)("span",{className:"truncate",title:r.subtitle||r.label,children:r.label})]}),d={onMouseEnter:e=>ew(e,r.id,r.label),onMouseLeave:eS};return r.external?(0,s.jsx)("a",{href:r.href,target:"_blank",rel:"noopener noreferrer",onClick:e,className:l,...d,children:c},r.href):(0,s.jsx)(a.default,{href:r.href,prefetch:!1,onClick:e,className:l,...d,children:c},r.href)};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("aside",{ref:S,className:(0,n.f)("flex h-full min-h-0 flex-col border-e border-border bg-sidebar transition-[width] duration-200 ease-out",t?"w-14":"w-[232px]"),children:[(0,s.jsx)("a",{href:"#main-content",className:"sr-only focus:not-sr-only focus:absolute focus:z-50 focus:m-2 focus:rounded-control focus:bg-primary focus:p-3 focus:text-sm focus:text-on-primary",children:k("skipToContent")}),(0,s.jsxs)("div",{className:(0,n.f)("flex h-12 shrink-0 items-center gap-2 border-b border-border",t?"flex-col justify-center px-2 h-auto py-2":"px-3"),children:[(0,s.jsxs)(a.default,{href:"/home",prefetch:!1,className:(0,n.f)("flex min-w-0 items-center rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",t?"justify-center":"flex-1 gap-2"),children:[(0,s.jsx)("div",{className:"flex size-7 shrink-0 items-center justify-center rounded-md bg-primary text-on-primary",children:G?(0,s.jsx)("img",{src:G,alt:B||l.x.name,className:"size-4 object-contain"}):(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]","aria-hidden":"true",children:"alt_route"})}),!t&&(0,s.jsxs)("div",{className:"flex min-w-0 flex-col leading-tight",children:[(0,s.jsx)("h1",{className:"truncate text-sm font-semibold tracking-tight text-text-main",title:B||l.x.name,children:B||l.x.name}),(0,s.jsx)("span",{className:"truncate text-[11px] text-text-muted",children:l.x.description})]})]}),o&&(0,s.jsx)("button",{type:"button",onClick:o,title:t?k("expandSidebar"):k("collapseSidebar"),"aria-expanded":!t,"aria-label":t?k("expandSidebar"):k("collapseSidebar"),className:"flex size-7 shrink-0 items-center justify-center rounded-md text-text-muted transition-colors hover:bg-surface-2 hover:text-text-main focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]","aria-hidden":"true",children:t?"left_panel_open":"left_panel_close"})})]}),!t&&(0,s.jsx)("div",{className:"px-3 pb-2 pt-3",children:(0,s.jsx)(u.default,{type:"search",value:ei,onChange:e=>en(e.target.value),placeholder:w("search"),"aria-label":w("search"),icon:"search",className:"gap-0",inputClassName:"py-1.5 text-xs"})}),(0,s.jsxs)("nav",{"aria-label":k("mainNavigation"),className:(0,n.f)("min-h-0 flex-1 overflow-y-auto pb-3 custom-scrollbar",t?"space-y-0.5 px-2 pt-2":"px-3 pt-1"),children:[$&&eh&&0===ef.length&&(0,s.jsx)("p",{className:"px-2 py-3 text-xs text-text-muted",children:w("noResults")}),($?ef:[]).map((e,r)=>{let a=e.id,i=eh||ex||Y.has(a),l=Q.has(a),o=0===r,c=e.children.flatMap(e=>"group"===e.type?e.items:[e]);return t?(0,s.jsxs)("div",{children:[!o&&(0,s.jsx)("div",{className:"mx-1 my-2 border-t border-border"}),c.map(eC)]},e.id):!1===e.showTitle?(0,s.jsx)("div",{className:(0,n.f)("space-y-0.5",!o&&"mt-4"),children:c.map(eC)},e.id):(0,s.jsxs)("div",{className:o?"space-y-0.5":"mt-4",children:[ex?(0,s.jsx)("div",{className:"truncate px-2 pb-1 text-[11px] font-medium uppercase tracking-wider text-text-muted/70",children:e.title}):(0,s.jsxs)("div",{className:"group/header flex cursor-pointer items-center gap-0.5 rounded-md px-2 py-1 transition-colors hover:bg-surface-2",onClick:()=>eb(a),role:"button","aria-expanded":i,children:[(0,s.jsx)("span",{className:"flex-1 truncate text-[11px] font-medium uppercase tracking-wider text-text-muted/70 transition-colors group-hover/header:text-text-muted",children:e.title}),(0,s.jsx)("button",{onClick:e=>{e.stopPropagation(),eg(a)},title:l?k("unpinSection"):k("pinSectionOpen"),className:(0,n.f)("shrink-0 rounded p-0.5 transition-opacity",l?"text-primary-text opacity-100":"text-text-muted/60 opacity-0 hover:text-text-main group-hover/header:opacity-100"),children:(0,s.jsx)("span",{className:"material-symbols-outlined",style:{fontSize:"12px",...l?{fontVariationSettings:"'FILL' 1"}:{}},children:"push_pin"})}),(0,s.jsx)("span",{className:(0,n.f)("material-symbols-outlined shrink-0 text-[16px] text-text-muted/60 transition-transform duration-200 group-hover/header:text-text-muted",i&&"rotate-180"),children:"expand_more"})]}),i&&(0,s.jsx)("div",{className:"mt-0.5 space-y-0.5",children:e.children.map(e=>{if("group"===e.type){if(0===e.items.length)return null;let t=!0===e.separatorHidden;return(0,s.jsxs)("div",{className:t?"mt-0.5":"mt-3",children:[!t&&(0,s.jsx)("div",{className:"mb-0.5 flex items-center gap-2 px-2 py-0.5",children:(0,s.jsx)("span",{className:"truncate text-[11px] font-medium text-text-muted/70",children:e.title})}),e.items.map(eC)]},e.id)}return eC(e)})})]},e.id)})]}),(0,s.jsxs)("div",{className:"flex shrink-0 flex-col gap-0.5 border-t border-border p-2",children:[(0,s.jsxs)("button",{type:"button",onClick:ek,disabled:!$||O,"aria-busy":O,title:t?ej:eN,"aria-label":t?ej:void 0,className:(0,n.f)("flex min-h-8 items-center gap-2 rounded-md text-xs font-medium transition-colors disabled:opacity-50","text-text-muted hover:bg-surface-2 hover:text-text-main","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",t?"mx-auto size-9 justify-center":"w-full px-2",!$&&"invisible"),children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]","aria-hidden":"true",children:ev?"unfold_less":"unfold_more"}),!t&&(0,s.jsx)("span",{className:"truncate",children:ej})]}),(0,s.jsxs)("div",{className:t?"flex flex-col gap-1":"flex items-center gap-2",children:[!t&&(0,s.jsxs)("span",{className:"flex-1 truncate px-2 text-[11px] tabular-nums text-text-muted",children:[l.x.name," v",l.x.version]}),(0,s.jsxs)("button",{type:"button",onClick:()=>T(!0),title:k("restart"),"aria-label":k("restart"),className:(0,n.f)("flex min-h-8 items-center justify-center gap-1.5 rounded-md text-xs font-medium transition-colors","text-text-muted hover:bg-surface-2 hover:text-text-main","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",t?"mx-auto size-9":"px-2"),children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]","aria-hidden":"true",children:"restart_alt"}),!t&&(0,s.jsx)("span",{children:k("restart")})]})]}),!t&&(0,s.jsx)(c,{className:"px-2"})]})]}),t&&er&&(0,s.jsx)("div",{className:"fixed z-[200] pointer-events-none flex items-center",style:{left:er.x,top:er.y,transform:"translateY(-50%)"},children:(0,s.jsx)("div",{className:"whitespace-nowrap rounded-md border border-border bg-surface px-2 py-1 text-xs font-medium text-text-main shadow-elevated",children:er.label})}),(0,s.jsx)(m.ConfirmModal,{isOpen:C,onClose:()=>T(!1),onConfirm:ey,title:k("restart"),message:k("restartConfirm"),confirmText:k("restart"),cancelText:w("cancel"),variant:"warning",loading:I}),_&&(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm",children:(0,s.jsxs)("div",{className:"text-center p-8",children:[(0,s.jsx)("div",{className:"mx-auto mb-4 flex size-14 items-center justify-center rounded-full bg-error/15 text-error",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[28px]","aria-hidden":"true",children:"power_off"})}),(0,s.jsx)("h2",{className:"text-xl font-semibold text-white mb-2",children:k("serverDisconnected")}),(0,s.jsx)("p",{className:"mb-6 text-sm text-zinc-400",children:k("serverDisconnectedMsg")}),(0,s.jsx)(d.default,{variant:"secondary",onClick:()=>globalThis.location.reload(),children:k("reloadPage")})]})})]})}],647829)},905204,e=>{"use strict";e.i(843476),e.i(156132),e.s([])},897844,e=>{"use strict";var t=e.i(843476),s=e.i(948148),r=e.i(287531),a=e.i(156132);e.s(["default",0,function({className:e,variant:i="default"}){let{toggleTheme:n,isDark:l}=(0,r.f)(),o=(0,s.f)("header")(l?"switchToLightMode":"switchToDarkMode"),c={default:(0,a.f)("flex size-8 items-center justify-center rounded-md","text-text-muted hover:bg-surface-2 hover:text-text-main","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30","transition-colors"),card:(0,a.f)("flex size-8 items-center justify-center rounded-md","border border-border bg-surface","text-text-muted hover:bg-surface-2 hover:text-text-main","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30","transition-colors")};return(0,t.jsx)("button",{type:"button",onClick:n,className:(0,a.f)(c[i],e),"aria-label":o,title:o,children:(0,t.jsx)("span",{className:"material-symbols-outlined text-[18px]","aria-hidden":"true",children:l?"light_mode":"dark_mode"})})}])},635055,e=>{"use strict";var t=e.i(843476),s=e.i(156132);e.s(["default",0,function({checked:e=!1,onChange:r,label:a,description:i,disabled:n=!1,size:l="md",className:o,title:c,ariaLabel:d}){let u={xs:{track:"w-6 h-3",thumb:"size-[8px]",translate:"translate-x-3.5"},sm:{track:"w-8 h-4",thumb:"size-3",translate:"translate-x-4"},md:{track:"w-9 h-5",thumb:"size-4",translate:"translate-x-4"},lg:{track:"w-11 h-6",thumb:"size-5",translate:"translate-x-5"}};return(0,t.jsxs)("div",{className:(0,s.f)("flex items-center gap-3",n&&"opacity-50 cursor-not-allowed",o),children:[(0,t.jsx)("button",{type:"button",role:"switch","aria-checked":e,"aria-label":d||a||i||c||"Toggle",title:c,disabled:n,onClick:()=>{!n&&r&&r(!e)},className:(0,s.f)("relative inline-flex shrink-0 cursor-pointer rounded-full","transition-colors duration-200 ease-in-out","border","focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",e?"border-primary bg-primary":"border-border bg-surface-2 dark:bg-white/10",u[l].track,n&&"cursor-not-allowed"),children:(0,t.jsx)("span",{"aria-hidden":"true",className:(0,s.f)("pointer-events-none inline-block rounded-full bg-white shadow-[0_1px_2px_rgba(0,0,0,0.2)]","transform transition duration-200 ease-in-out",e?u[l].translate:"translate-x-0.5",u[l].thumb,"mt-0.5")})}),(a||i)&&(0,t.jsxs)("div",{className:"flex flex-col min-w-0",children:[a&&(0,t.jsx)("span",{className:"text-sm font-medium text-text-main",children:a}),i&&(0,t.jsx)("span",{className:"text-xs text-text-muted",children:i})]})]})}])},268226,e=>{"use strict";var t=e.i(843476),s=e.i(271645),r=e.i(703166),a=e.i(342923),i=e.i(80173);e.s(["default",0,function({isOpen:e,onSuccess:n,onClose:l,reauthConnection:o}){let[c,d]=(0,s.useState)(""),[u,m]=(0,s.useState)(""),[x,p]=(0,s.useState)(""),[h,f]=(0,s.useState)(""),[b,g]=(0,s.useState)("marscode-us"),[y,v]=(0,s.useState)("marscode"),[j,N]=(0,s.useState)("US-East"),[k,w]=(0,s.useState)(null),[S,C]=(0,s.useState)(!1),[T,I]=(0,s.useState)(!1),M=(0,s.useRef)(null),_=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(!e)return;let t=e=>{let t=e.data;if(!t||"trae-oauth-callback"!==t.type)return;let s=window.location,r="127.0.0.1"===s.hostname?"localhost":"localhost"===s.hostname?"127.0.0.1":null,a=new Set([s.origin]);r&&a.add(`${s.protocol}//${r}${s.port?`:${s.port}`:""}`),!a.has(e.origin)||_.current&&t.loginTraceId===_.current&&(I(!1),t.success?(n?.(),l()):w(t.error||"Authorization failed"))};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)},[e,n,l]);let E=async()=>{if(!c.trim())return void w("Access token is required.");C(!0),w(null);try{let e={accessToken:c.trim()};u.trim()&&(e.webId=u.trim()),x.trim()&&(e.bizUserId=x.trim()),h.trim()&&(e.userUniqueId=h.trim()),b.trim()&&(e.scope=b.trim()),y.trim()&&(e.tenant=y.trim()),j.trim()&&(e.region=j.trim());let t=await fetch("/api/oauth/trae/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();if(!t.ok)throw Error("string"==typeof s.error?s.error:s.error?.message||"Import failed");n?.(),l()}catch(e){w(e instanceof Error?e.message:String(e))}finally{C(!1)}};return(0,t.jsx)(r.default,{isOpen:e,title:"Connect Trae SOLO",onClose:l,children:(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"bg-emerald-50 dark:bg-emerald-900/20 p-4 rounded-lg border border-emerald-200 dark:border-emerald-800",children:[(0,t.jsxs)("p",{className:"text-sm text-emerald-900 dark:text-emerald-200 mb-2",children:["Authorize via ",(0,t.jsx)("span",{className:"font-mono",children:"trae.ai"})," in a popup. The popup will close itself once the token has been imported."]}),(0,t.jsxs)("p",{className:"text-xs text-emerald-800 dark:text-emerald-300 mb-3",children:[(0,t.jsx)("strong",{children:"Important:"})," you must be logged in to"," ",(0,t.jsx)("span",{className:"font-mono",children:"trae.ai"})," in ",(0,t.jsx)("em",{children:"this"}),' browser first. The authorize page only confirms an existing session — it cannot sign you in. If you see "Login Failed", click "Open solo.trae.ai", sign in, then return here.']}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(a.default,{onClick:()=>{var e;let t,s,r,a,i;w(null),I(!0);let n=(t=globalThis.crypto||globalThis.crypto,t?.randomUUID?t.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}));_.current=n;let l=window.location.port||("https:"===window.location.protocol?"443":"80"),o=(e=`http://127.0.0.1:${l}/authorize`,s=new Uint8Array(32),(globalThis.crypto||globalThis.crypto).getRandomValues(s),r=Array.from(s,e=>e.toString(16).padStart(2,"0")).join(""),i=new URLSearchParams({login_version:"1",auth_from:"solo",login_channel:"native_ide",plugin_version:"2.3.24254",auth_type:"local",client_id:"en1oxy7wnw8j9n",redirect:"0",login_trace_id:n,auth_callback_url:e,machine_id:r,device_id:a=function(){let e="";for(;e.length<19;)e+=Math.floor(1e10*Math.random()).toString();return e.slice(0,19)}(),x_device_id:a,x_machine_id:r,x_device_brand:"Mac14,7",x_device_type:"mac",x_os_version:"macOS 26.4.1",x_env:"",x_app_version:"0.1.7",x_app_type:"stable",hide_saas_login:"true"}),`https://www.trae.ai/authorization?${i.toString()}`),c=window.open(o,"trae-oauth","width=520,height=720");if(!c){I(!1),w("Popup blocked — allow popups for this site, or paste the token manually below.");return}M.current=c;let d=setInterval(()=>{c.closed&&(clearInterval(d),I(e=>(e&&w("Authorization window was closed before completing."),!1)))},700)},disabled:T,fullWidth:!0,children:T?"Waiting for trae.ai…":"Authorize with Browser"}),(0,t.jsx)(a.default,{onClick:()=>window.open("https://solo.trae.ai/","_blank","noopener,noreferrer"),variant:"ghost",fullWidth:!0,children:"Open solo.trae.ai"})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3 text-xs text-text-muted",children:[(0,t.jsx)("span",{className:"flex-1 border-t border-border"}),"or paste a token manually",(0,t.jsx)("span",{className:"flex-1 border-t border-border"})]}),(0,t.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,t.jsxs)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["Sign in to ",(0,t.jsx)("span",{className:"font-mono",children:"solo.trae.ai"}),", open DevTools → Network, send any chat message, and copy the JWT from the"," ",(0,t.jsx)("span",{className:"font-mono",children:"Authorization: Cloud-IDE-JWT <token>"})," request header. JWT lifetime is ~14 days. Optional identity fields come from"," ",(0,t.jsx)("span",{className:"font-mono",children:"common_params"})," in the same request body."]})}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Access Token (Cloud-IDE-JWT) ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("textarea",{value:c,onChange:e=>d(e.target.value),placeholder:"eyJhbGciOiJSUzI1NiIs...",rows:3,className:"w-full px-3 py-2 text-sm font-mono border border-border rounded-lg bg-background focus:outline-none focus:border-primary resize-none"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-sm font-medium mb-1",children:["Web ID ",(0,t.jsx)("span",{className:"text-text-muted text-xs",children:"optional"})]}),(0,t.jsx)(i.default,{value:u,onChange:e=>m(e.target.value),placeholder:"76428...",className:"font-mono text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-sm font-medium mb-1",children:["Biz User ID ",(0,t.jsx)("span",{className:"text-text-muted text-xs",children:"optional"})]}),(0,t.jsx)(i.default,{value:x,onChange:e=>p(e.target.value),placeholder:"76428...",className:"font-mono text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-sm font-medium mb-1",children:["User Unique ID ",(0,t.jsx)("span",{className:"text-text-muted text-xs",children:"optional"})]}),(0,t.jsx)(i.default,{value:h,onChange:e=>f(e.target.value),placeholder:"76428...",className:"font-mono text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium mb-1",children:"Scope"}),(0,t.jsx)(i.default,{value:b,onChange:e=>g(e.target.value),className:"text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium mb-1",children:"Tenant"}),(0,t.jsx)(i.default,{value:y,onChange:e=>v(e.target.value),className:"text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium mb-1",children:"Region"}),(0,t.jsx)(i.default,{value:j,onChange:e=>N(e.target.value),className:"text-sm"})]})]}),k&&(0,t.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,t.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:k})}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(a.default,{onClick:E,fullWidth:!0,disabled:S||!c.trim(),children:S?"Importing…":"Import Token"}),(0,t.jsx)(a.default,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}])},566770,801646,e=>{"use strict";var t=e.i(843476),s=e.i(271645),r=e.i(861745),a=e.i(948148),i=e.i(393718),n=e.i(454149),l=e.i(243009);async function o(e,t){try{let t=await e.json(),s=t?.error;if("string"==typeof s&&s.trim())return s.trim();if(s&&"object"==typeof s){let e=s.message;if("string"==typeof e&&e.trim())return e.trim()}}catch{}return t}var c=e.i(523629);let d={priority:"serviceTierFast",flex:"serviceTierFlex",standard:"serviceTierStandard"},u={priority:"Fast",flex:"Flex",standard:"Standard"};function m(e){let t="string"==typeof e?e.trim().toLowerCase():"";return"priority"===t||"fast"===t?"priority":"flex"===t?"flex":"standard"}function x(e,t,s){return"function"==typeof e.has&&e.has(t)?e(t):s}function p(e,t,s){let r=m(t),a="string"==typeof s?s.trim():"",i=a&&m(a)!==r?a:u[r];return x(e,d[r],i)}e.s(["q",0,p,"j",0,x],801646);let h=new Set(["model"]),f=[{field:"model",labelKey:"chartModel",align:"left"},{field:"requests",labelKey:"chartRequests",align:"right"},{field:"promptTokens",labelKey:"chartInput",align:"right"},{field:"completionTokens",labelKey:"chartOutput",align:"right"},{field:"totalTokens",labelKey:"chartTotal",align:"right"},{field:"cost",labelKey:"chartCost",align:"right"}];function b({active:e,sortOrder:s}){return e?(0,t.jsx)("span",{className:"material-symbols-outlined text-[12px] text-primary-text",children:"asc"===s?"expand_less":"expand_more"}):(0,t.jsx)("span",{className:"material-symbols-outlined text-[12px] opacity-0 group-hover:opacity-30",children:"unfold_more"})}function g({byModel:e,summary:r}){let n=(0,a.f)("analytics"),[o,d]=(0,s.useState)({by:"totalTokens",order:"desc"}),u=(0,s.useCallback)(e=>{d(t=>{var s,r;let a=(s=t.by,r=t.order,s===e?{sortBy:e,sortOrder:"asc"===r?"desc":"asc"}:{sortBy:e,sortOrder:"desc"});return{by:a.sortBy,order:a.sortOrder}})},[]),m=(0,s.useMemo)(()=>{let t;return t=Number(r?.totalTokens??0),(e||[]).map(e=>{if(void 0!==e.pct&&null!==e.pct&&""!==e.pct)return{...e};let s=Number(e.totalTokens??0),r=t>0?(s/t*100).toFixed(1):"0";return{...e,pct:r}})},[e,r?.totalTokens]),x=(0,s.useMemo)(()=>{var e,t;let s;return e=o.by,t=o.order,(s=[...m||[]]).sort((s,r)=>{let a=s[e],i=r[e];if(h.has(e)||"string"==typeof a||"string"==typeof i){let e=String(a??""),s=String(i??""),r=e.localeCompare(s,void 0,{sensitivity:"base",numeric:!0});return"asc"===t?r:-r}let n=Number(a??0),l=Number(i??0),o=Number.isFinite(n)?n:0,c=Number.isFinite(l)?l:0;return"asc"===t?o-c:c-o}),s},[m,o.by,o.order]);return(0,t.jsxs)(i.default,{className:"overflow-hidden",children:[(0,t.jsx)("div",{className:"p-4 border-b border-border",children:(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:n("chartModelBreakdown")})}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full text-sm",children:[(0,t.jsx)("thead",{className:"text-xs font-medium text-text-muted bg-surface-2/60",children:(0,t.jsxs)("tr",{children:[f.map(e=>(0,t.jsx)("th",{className:`px-4 py-2.5 ${"right"===e.align?"text-right":"text-left"}`,children:(0,t.jsxs)("button",{type:"button",className:`inline-flex items-center gap-1 cursor-pointer group hover:text-text-main ${"right"===e.align?"justify-end w-full":"justify-start"}`,onClick:()=>u(e.field),children:[(0,t.jsx)("span",{children:n(e.labelKey)}),(0,t.jsx)(b,{active:o.by===e.field,sortOrder:o.order})]})},e.field)),(0,t.jsx)("th",{className:"px-4 py-2.5 text-right w-36",children:n("chartShare")})]})}),(0,t.jsx)("tbody",{className:"divide-y divide-border",children:x.map((e,s)=>(0,t.jsxs)("tr",{className:"hover:bg-surface-2/60 transition-colors",children:[(0,t.jsx)("td",{className:"px-4 py-2.5",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:(0,c.T)(s)}}),(0,t.jsx)("span",{className:"font-medium",children:e.model})]})}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums text-text-muted",children:(0,l.I)(e.requests)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums text-text-main",children:(0,l.i)(e.promptTokens)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums text-text-main",children:(0,l.i)(e.completionTokens)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums font-semibold text-text-main",children:(0,l.i)(e.totalTokens)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums text-text-main",children:(0,l.r)(e.cost)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,t.jsx)("div",{className:"w-16 h-1.5 rounded-full bg-surface-2 overflow-hidden",children:(0,t.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${e.pct??0}%`,backgroundColor:(0,c.T)(s)}})}),(0,t.jsxs)("span",{className:"text-xs font-mono text-text-muted w-10 text-right",children:[e.pct??0,"%"]})]})})]},String(e.model??s)))})]})})]})}function y(e,t){try{return new Intl.DateTimeFormat(e,t)}catch{return new Intl.DateTimeFormat(void 0,t)}}function v({active:e,sortOrder:s}){return e?(0,t.jsx)("span",{className:"material-symbols-outlined text-[12px] text-primary-text",children:"asc"===s?"expand_less":"expand_more"}):(0,t.jsx)("span",{className:"material-symbols-outlined text-[12px] opacity-0 group-hover:opacity-30",children:"unfold_more"})}let j=new Set(["text-success","text-warning","text-error","text-primary-text","text-text-main","text-text-muted"]);function N(e){return e&&j.has(e)?e:"text-text-main"}function k({icon:e,label:s,value:r,subValue:a,color:n="text-text-main"}){return(0,t.jsxs)(i.default,{padding:"sm",className:"flex flex-col min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-xs font-medium text-text-muted min-w-0",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[18px] shrink-0","aria-hidden":"true",children:e}),(0,t.jsx)("span",{className:"truncate",title:"string"==typeof s?s:void 0,children:s})]}),(0,t.jsx)("span",{className:`mt-1 text-2xl font-semibold tracking-tight tabular-nums truncate ${N(n)}`,title:String(r),children:r}),a&&(0,t.jsx)("span",{className:"mt-0.5 text-xs text-text-muted truncate",children:a})]})}function w({sections:e}){return(0,t.jsx)(i.default,{className:"px-5 py-4",children:(0,t.jsx)("div",{className:"flex flex-col gap-3",children:e.map((e,s)=>(0,t.jsxs)("div",{children:[s>0&&(0,t.jsx)("div",{className:"border-t border-border mb-3"}),(0,t.jsx)("div",{className:"text-sm font-semibold text-text-main mb-2",children:e.title}),(0,t.jsx)("div",{className:e.wideValues?"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 gap-x-5 gap-y-2":"grid grid-cols-2 md:grid-cols-4 gap-x-5 gap-y-2",children:e.items.map((s,r)=>(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 min-w-0 py-0.5",children:[(0,t.jsxs)("div",{className:`flex items-center gap-1.5 ${e.wideValues?"shrink-0":"min-w-0"}`,children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted shrink-0","aria-hidden":"true",children:s.icon}),(0,t.jsx)("span",{className:`text-xs font-medium text-text-muted ${e.wideValues?"whitespace-nowrap":"truncate"}`,title:s.label,children:s.label})]}),(0,t.jsx)("span",{className:`text-sm font-semibold tabular-nums text-right ${e.wideValues?"truncate min-w-0":"shrink-0"} ${N(s.color)}`,title:String(s.value),children:s.value})]},r))})]},s))})})}function S({activityMap:e}){let n=(0,a.f)("analytics"),o=(0,r.X)(),c=(0,s.useRef)(null),d=(0,s.useMemo)(()=>y(o,{month:"short"}),[o]),u=(0,s.useMemo)(()=>y(o,{weekday:"short"}),[o]),m=(0,s.useMemo)(()=>{let t=new Date,s=[],r=0;for(let a=364;a>=0;a--){let i=new Date(t);i.setDate(i.getDate()-a);let n=`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}-${String(i.getDate()).padStart(2,"0")}`,l=e?.[n]||0;l>r&&(r=l),s.push({date:n,value:l,dayOfWeek:i.getDay()})}return{days:s,maxVal:r}},[e]),x=(0,s.useMemo)(()=>{let e=[],t=[],s=m.days[0]?.dayOfWeek||0;for(let e=0;e<s;e++)t.push(null);for(let s of m.days)t.push(s),7===t.length&&(e.push(t),t=[]);return t.length>0&&e.push(t),e},[m]);(0,s.useEffect)(()=>{c.current&&(c.current.scrollLeft=c.current.scrollWidth)},[x]);let p=(0,s.useMemo)(()=>{let e=[],t=-1;return x.forEach((s,r)=>{let a=s.find(e=>null!==e);if(a){let s=new Date(a.date).getMonth();s!==t&&(e.push({weekIdx:r,label:d.format(new Date(2024,s,1))}),t=s)}}),e},[d,x]),h=(0,s.useMemo)(()=>[1,3,5].map(e=>u.format(new Date(2024,0,7+e))),[u]);return(0,t.jsxs)(i.default,{className:"p-4 h-full min-w-0 overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:n("overview")}),(0,t.jsx)("span",{className:"text-xs text-text-muted",children:n("activitySummary",{active:Object.keys(e||{}).length,tokens:(0,l.i)(Object.values(e||{}).reduce((e,t)=>e+t,0)),days:365})})]}),(0,t.jsx)("div",{ref:c,className:"overflow-x-auto",children:(0,t.jsxs)("div",{className:"w-max",children:[(0,t.jsx)("div",{className:"flex gap-[3px] mb-1 ml-6",style:{fontSize:"10px"},children:p.map((e,s)=>(0,t.jsx)("span",{className:"text-text-muted",style:{position:"relative",left:`${13*e.weekIdx}px`,marginLeft:0===s?0:"-20px"},children:e.label},s))}),(0,t.jsxs)("div",{className:"flex gap-[3px]",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-[3px] shrink-0 text-[10px] text-text-muted pr-1 sticky left-0 z-10 bg-surface",children:[(0,t.jsx)("span",{className:"h-[10px]"}),(0,t.jsx)("span",{className:"h-[10px] leading-[10px]",children:h[0]}),(0,t.jsx)("span",{className:"h-[10px]"}),(0,t.jsx)("span",{className:"h-[10px] leading-[10px]",children:h[1]}),(0,t.jsx)("span",{className:"h-[10px]"}),(0,t.jsx)("span",{className:"h-[10px] leading-[10px]",children:h[2]}),(0,t.jsx)("span",{className:"h-[10px]"})]}),x.map((e,s)=>(0,t.jsx)("div",{className:"flex flex-col gap-[3px]",children:e.map((e,s)=>(0,t.jsx)("div",{title:e?n("activityCellTitle",{date:e.date,tokens:(0,l.I)(e.value)}):"",className:`w-[10px] h-[10px] rounded-[2px] ${e?function(e){if(!e||0===e)return"bg-surface-2";let t=Math.min(e/(m.maxVal||1),1);return t<.25?"bg-primary/20":t<.5?"bg-primary/40":t<.75?"bg-primary/60":"bg-primary/90"}(e.value):"bg-transparent"}`},s))},s))]})]})}),(0,t.jsxs)("div",{className:"flex items-center gap-1 mt-2 ml-6 text-[10px] text-text-muted",children:[(0,t.jsx)("span",{children:n("activityLess")}),(0,t.jsx)("div",{className:"w-[10px] h-[10px] rounded-[2px] bg-surface-2"}),(0,t.jsx)("div",{className:"w-[10px] h-[10px] rounded-[2px] bg-primary/20"}),(0,t.jsx)("div",{className:"w-[10px] h-[10px] rounded-[2px] bg-primary/40"}),(0,t.jsx)("div",{className:"w-[10px] h-[10px] rounded-[2px] bg-primary/60"}),(0,t.jsx)("div",{className:"w-[10px] h-[10px] rounded-[2px] bg-primary/90"}),(0,t.jsx)("span",{children:n("activityMore")})]})]})}function C({byApiKey:e}){let r=(0,a.f)("analytics"),[n,o]=(0,s.useState)(""),[c,d]=(0,s.useState)("totalTokens"),[u,m]=(0,s.useState)("desc"),x=(0,s.useMemo)(()=>e||[],[e]),p=(0,s.useMemo)(()=>{let e=n.trim().toLowerCase();return e?x.filter(t=>(t.apiKeyName||"").toLowerCase().includes(e)||(t.apiKeyId||"").toLowerCase().includes(e)):x},[x,n]),h=(0,s.useMemo)(()=>{let e=[...p];return e.sort((e,t)=>{let s=e[c]??0,r=t[c]??0;return"string"==typeof s?"asc"===u?s.localeCompare(r):r.localeCompare(s):"asc"===u?s-r:r-s}),e},[p,c,u]),f=(0,s.useCallback)(e=>{c===e?m(e=>"asc"===e?"desc":"asc"):(d(e),m("desc"))},[c]);return x.length>0?(0,t.jsxs)(i.default,{className:"overflow-hidden",children:[(0,t.jsxs)("div",{className:"p-4 border-b border-border flex items-center justify-between gap-3",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:r("chartApiKeyBreakdown")}),(0,t.jsx)("input",{type:"text",value:n,onChange:e=>o(e.target.value),placeholder:r("filterSearchKeys"),className:"w-full max-w-[220px] h-8 px-3 rounded-control bg-surface border border-border text-xs text-text-main placeholder:text-text-muted focus:outline-none focus:border-primary"})]}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full text-sm",children:[(0,t.jsx)("thead",{className:"text-xs font-medium text-text-muted bg-surface-2/60",children:(0,t.jsxs)("tr",{children:[(0,t.jsxs)("th",{className:"px-4 py-2.5 text-left cursor-pointer group",onClick:()=>f("apiKeyName"),children:[r("chartApiKey")," ",(0,t.jsx)(v,{active:"apiKeyName"===c,sortOrder:u})]}),(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:()=>f("requests"),children:[r("chartRequests")," ",(0,t.jsx)(v,{active:"requests"===c,sortOrder:u})]}),(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:()=>f("promptTokens"),children:[r("chartInput")," ",(0,t.jsx)(v,{active:"promptTokens"===c,sortOrder:u})]}),(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:()=>f("completionTokens"),children:[r("chartOutput")," ",(0,t.jsx)(v,{active:"completionTokens"===c,sortOrder:u})]}),(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:()=>f("totalTokens"),children:[r("chartTotal")," ",(0,t.jsx)(v,{active:"totalTokens"===c,sortOrder:u})]}),(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:()=>f("cost"),children:[r("chartCost")," ",(0,t.jsx)(v,{active:"cost"===c,sortOrder:u})]})]})}),(0,t.jsxs)("tbody",{className:"divide-y divide-border",children:[h.map((e,s)=>(0,t.jsxs)("tr",{className:"hover:bg-surface-2/60 transition-colors",children:[(0,t.jsx)("td",{className:"px-4 py-2.5",children:(0,t.jsx)("span",{className:"font-medium",title:e.apiKeyName||e.apiKeyId||"unknown",children:(0,l.J)(e.apiKeyName,e.apiKeyId)})}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums text-text-muted",children:(0,l.I)(e.requests)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums text-text-main",children:(0,l.i)(e.promptTokens)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums text-text-main",children:(0,l.i)(e.completionTokens)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums font-semibold text-text-main",children:(0,l.i)(e.totalTokens)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums text-text-main",children:(0,l.r)(e.cost)})]},`${e.apiKeyId||e.apiKeyName||"key"}-${s}`)),0===h.length&&(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:6,className:"px-4 py-8 text-center text-text-muted",children:r("filterNoKeysMatch")})})]})]})})]}):(0,t.jsxs)(i.default,{className:"p-4 flex-1",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main mb-3",children:r("chartApiKeyBreakdown")}),(0,t.jsx)("div",{className:"text-center text-text-muted text-sm py-8",children:r("chartNoData")})]})}function T({activityMap:e}){let n=(0,a.f)("analytics"),o=(0,r.X)(),c=(0,s.useMemo)(()=>y(o,{weekday:"long"}),[o]),d=(0,s.useMemo)(()=>y(o,{month:"short",day:"numeric"}),[o]),u=(0,s.useMemo)(()=>{if(!e)return null;let t=new Date,s=null,r=0;for(let a=0;a<7;a++){let i=new Date(t);i.setDate(i.getDate()-a);let n=`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}-${String(i.getDate()).padStart(2,"0")}`,l=e[n]||0;l>r&&(r=l,s=n)}if(!s||0===r)return null;let a=new Date(s+"T12:00:00");return{weekday:c.format(a),label:d.format(a),tokens:r}},[e,d,c]);return(0,t.jsxs)(i.default,{className:"p-4 flex flex-col justify-center",style:{flex:1,minHeight:0},children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main mb-2",children:n("mostActiveDay")}),u?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-xl font-semibold tracking-tight text-text-main capitalize",style:{lineHeight:1.2},children:u.weekday}),(0,t.jsx)("span",{className:"text-xs mt-1",style:{color:"var(--color-text-muted)"},children:n("datedTokenCount",{date:u.label,tokens:(0,l.i)(u.tokens)})})]}):(0,t.jsx)("span",{className:"text-xs",style:{color:"var(--color-text-muted)"},children:n("noDataLast7Days")})]})}function I({activityMap:e}){let n=(0,a.f)("analytics"),o=(0,r.X)(),c=(0,s.useMemo)(()=>y(o,{weekday:"short"}),[o]),d=(0,s.useMemo)(()=>y(o,{month:"short",day:"numeric"}),[o]),u=(0,s.useMemo)(()=>{if(!e)return[];let t=new Date,s=[],r=0;for(let a=6;a>=0;a--){let i=new Date(t);i.setDate(i.getDate()-a);let n=`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}-${String(i.getDate()).padStart(2,"0")}`,l=e[n]||0;l>r&&(r=l),s.push({key:n,val:l,label:c.format(i),dateLabel:d.format(i)})}return s.map(e=>({...e,intensity:r>0?e.val/r:0}))},[e,d,c]);return(0,t.jsxs)(i.default,{className:"p-4 flex flex-col justify-center",style:{flex:1,minHeight:0},children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main mb-3",children:n("chartWeekly")}),(0,t.jsx)("div",{style:{display:"flex",alignItems:"flex-end",gap:6,justifyContent:"center"},children:u.map((e,s)=>(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:4},children:[(0,t.jsx)("div",{title:n("activityCellTitle",{date:e.dateLabel,tokens:(0,l.I)(e.val)}),style:{width:36,height:36,borderRadius:6,...function(e){if(0===e)return{background:"var(--color-surface-2)"};let t=Math.round((.15+.75*e)*100);return{background:`color-mix(in srgb, var(--color-primary) ${t}%, transparent)`}}(e.intensity),transition:"all 0.2s",cursor:"default"}}),(0,t.jsx)("span",{style:{fontSize:9,fontWeight:500,color:"var(--color-text-muted)"},children:e.label})]},e.key))})]})}function M({byServiceTier:e,summary:r}){let n=(0,a.f)("costs"),o=(0,a.f)("analytics"),c=(0,s.useMemo)(()=>e||[],[e]),d=Number(r?.totalRequests||0),u=Number(r?.totalCost||0);return c.length?(0,t.jsxs)(i.default,{className:"overflow-hidden",children:[(0,t.jsxs)("div",{className:"p-4 border-b border-border flex items-center justify-between gap-3",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:x(n,"serviceTierBreakdownTitle","Service Tier")}),(0,t.jsx)("span",{className:"text-xs text-text-muted",children:x(n,"serviceTierBreakdownSubtitle","Fast / Flex / Standard split")})]}),(0,t.jsx)("div",{className:"divide-y divide-border",children:c.map(e=>{var s,r,a;let i="flex"===e.serviceTier,c=p(n,e.serviceTier,e.label),m=d>0?(Number(e.requests||0)/d*100).toFixed(1):"0",h=u>0?(Number(e.cost||0)/u*100).toFixed(1):"0",f=Number(e.usageSavingsTokens||0),b=Number(e.savings||0),g=i&&f>0?` \xb7 ${(0,l.i)(f)} ${x(n,"serviceTierUsageSaved","usage saved")}`:"",y=i&&b>0?`${(0,l.r)(b)} ${x(n,"serviceTierCostSaved","saved")}`:`${h}% ${x(n,"serviceTierCostShareSuffix","of cost")}`;return(0,t.jsxs)("div",{className:"p-4 flex flex-col gap-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:`material-symbols-outlined text-[18px] ${"priority"===(s=e.serviceTier)?"text-primary-text":"flex"===s?"text-success":"text-text-muted"}`,children:"priority"===(r=e.serviceTier)?"bolt":"flex"===r?"savings":"speed"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-sm font-semibold text-text-main",children:c}),(0,t.jsxs)("div",{className:"text-xs text-text-muted",children:[o("requestTokenSummary",{requests:(0,l.I)(e.requests),tokens:(0,l.i)(e.totalTokens)}),g]})]})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:`font-mono tabular-nums text-sm font-semibold ${"flex"===e.serviceTier?"text-success":"text-text-main"}`,children:(0,l.r)(e.cost)}),(0,t.jsx)("div",{className:"text-xs text-text-muted",children:y})]})]}),(0,t.jsx)("div",{className:"h-1.5 rounded-full bg-surface-2 overflow-hidden",children:(0,t.jsx)("div",{className:`h-full rounded-full ${"priority"===(a=e.serviceTier)?"bg-primary":"flex"===a?"bg-success":"bg-text-muted/50"}`,style:{width:`${m}%`}})})]},e.serviceTier)})})]}):null}function _({byProvider:e}){let r=(0,a.f)("analytics"),[n,o]=(0,s.useState)("totalTokens"),[d,u]=(0,s.useState)("desc"),m=(0,s.useMemo)(()=>e||[],[e]),x=(0,s.useMemo)(()=>m.reduce((e,t)=>e+t.totalTokens,0),[m]),p=(0,s.useCallback)(e=>{n===e?u(e=>"asc"===e?"desc":"asc"):(o(e),u("desc"))},[n]),h=(0,s.useMemo)(()=>{let e=[...m];return e.sort((e,t)=>{let s=e[n]??0,r=t[n]??0;return"string"==typeof s?"asc"===d?s.localeCompare(r):r.localeCompare(s):"asc"===d?s-r:r-s}),e},[m,n,d]);return m.length?(0,t.jsxs)(i.default,{className:"overflow-hidden",children:[(0,t.jsx)("div",{className:"p-4 border-b border-border",children:(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:r("chartProviderBreakdown")})}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full text-sm",children:[(0,t.jsx)("thead",{className:"text-xs font-medium text-text-muted bg-surface-2/60",children:(0,t.jsxs)("tr",{children:[(0,t.jsxs)("th",{className:"px-4 py-2.5 text-left cursor-pointer group",onClick:()=>p("provider"),children:[r("chartProvider")," ",(0,t.jsx)(v,{active:"provider"===n,sortOrder:d})]}),(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:()=>p("requests"),children:[r("chartRequests")," ",(0,t.jsx)(v,{active:"requests"===n,sortOrder:d})]}),(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:()=>p("promptTokens"),children:[r("chartInput")," ",(0,t.jsx)(v,{active:"promptTokens"===n,sortOrder:d})]}),(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:()=>p("completionTokens"),children:[r("chartOutput")," ",(0,t.jsx)(v,{active:"completionTokens"===n,sortOrder:d})]}),(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:()=>p("totalTokens"),children:[r("chartTotal")," ",(0,t.jsx)(v,{active:"totalTokens"===n,sortOrder:d})]}),(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:()=>p("cost"),children:[r("chartCost")," ",(0,t.jsx)(v,{active:"cost"===n,sortOrder:d})]}),(0,t.jsx)("th",{className:"px-4 py-2.5 text-right w-36",children:r("chartShare")})]})}),(0,t.jsx)("tbody",{className:"divide-y divide-border",children:h.map((e,s)=>{let r=x>0?(e.totalTokens/x*100).toFixed(1):"0";return(0,t.jsxs)("tr",{className:"hover:bg-surface-2/60 transition-colors",children:[(0,t.jsx)("td",{className:"px-4 py-2.5",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:c.N[s%c.N.length]}}),(0,t.jsx)("span",{className:"font-medium capitalize",children:e.provider})]})}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums text-text-muted",children:(0,l.I)(e.requests)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums text-text-main",children:(0,l.i)(e.promptTokens)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums text-text-main",children:(0,l.i)(e.completionTokens)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums font-semibold text-text-main",children:(0,l.i)(e.totalTokens)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums text-text-main",children:(0,l.r)(e.cost)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,t.jsx)("div",{className:"w-16 h-1.5 rounded-full bg-surface-2 overflow-hidden",children:(0,t.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${r}%`,backgroundColor:c.N[s%c.N.length]}})}),(0,t.jsxs)("span",{className:"text-xs font-mono text-text-muted w-10 text-right",children:[r,"%"]})]})})]},`${e.provider}-${s}`)})})]})})]}):(0,t.jsxs)(i.default,{className:"p-4",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main mb-3",children:r("chartProviderBreakdown")}),(0,t.jsx)("div",{className:"text-center text-text-muted text-sm py-8",children:r("chartNoData")})]})}let E=null,K=null;function A(){let[t,r]=(0,s.useState)(E);return(0,s.useEffect)(()=>{if(t)return;let s=!1;return(E?Promise.resolve(E):(!K&&(K=e.A(416494).then(e=>(E=e,e)).catch(e=>{throw K=null,e})),K)).then(e=>{s||r(e)}).catch(()=>{s||r(null)}),()=>{s=!0}},[t]),t}function D({className:e="p-4 flex-1"}){return(0,t.jsx)(i.default,{className:e,children:(0,t.jsx)("div",{className:"py-8","aria-hidden":"true"})})}function L({active:e,payload:s,label:r,formatter:a}){return e&&s?.length?(0,t.jsxs)("div",{className:"rounded-control border border-border bg-surface px-3 py-2 text-xs shadow-soft",children:[r&&(0,t.jsx)("div",{className:"font-semibold text-text-main mb-1",children:r}),s.map((e,s)=>(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-text-muted",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:e.color}}),(0,t.jsxs)("span",{children:[e.name,":"]}),(0,t.jsx)("span",{className:"font-mono tabular-nums font-medium text-text-main",children:a?a(e.value):e.value})]},s))]}):null}function $({pieData:e,title:s,formatter:r,valueClassName:a="text-text-muted",labelClassName:n="",getLegendKey:l,getLegendTitle:o}){let c=A();if(!c)return(0,t.jsx)(D,{});let{Cell:d,PieChart:u,Pie:m,Tooltip:x,ResponsiveContainer:p}=c;return(0,t.jsxs)(i.default,{className:"p-4 flex-1",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main mb-3",children:s}),(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)(p,{width:120,height:120,children:(0,t.jsxs)(u,{children:[(0,t.jsx)(m,{data:e,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",innerRadius:28,outerRadius:55,paddingAngle:1,animationDuration:600,children:e.map((e,s)=>(0,t.jsx)(d,{fill:e.fill,stroke:"none"},s))}),(0,t.jsx)(x,{content:(0,t.jsx)(L,{formatter:r})})]})}),(0,t.jsx)("div",{className:"flex flex-col gap-1 min-w-0 flex-1",children:e.map((e,s)=>(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 text-xs",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:e.fill}}),(0,t.jsx)("span",{className:`truncate text-text-main ${n}`.trim(),title:o?.(e),children:e.name})]}),(0,t.jsx)("span",{className:`font-mono tabular-nums font-medium shrink-0 ${a}`,children:r(e.value)})]},l?l(e,s):s))})]})]})}function P({byAccount:e}){let r=(0,a.f)("analytics"),n=(0,s.useMemo)(()=>e||[],[e]),o=n.length>0,d=(0,s.useMemo)(()=>n.slice(0,8).map((e,t)=>({name:e.account,value:e.totalTokens,fill:(0,c.T)(t)})),[n]);return o?(0,t.jsx)($,{pieData:d,title:r("chartByAccount"),formatter:l.i}):(0,t.jsxs)(i.default,{className:"p-4 flex-1",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main mb-3",children:r("chartByAccount")}),(0,t.jsx)("div",{className:"text-center text-text-muted text-sm py-8",children:r("chartNoData")})]})}function O({byApiKey:e}){let r=(0,a.f)("analytics"),n=(0,s.useMemo)(()=>e||[],[e]),o=n.length>0,d=(0,s.useMemo)(()=>n.slice(0,8).map((e,t)=>({name:(0,l.J)(e.apiKeyName,e.apiKeyId),fullName:e.apiKeyName||e.apiKeyId||r("unknownApiKey"),value:e.totalTokens,fill:(0,c.T)(t)})),[n,r]);return o?(0,t.jsx)($,{pieData:d,title:r("chartByApiKey"),formatter:l.i,getLegendKey:(e,t)=>`${e.fullName}-${t}`,getLegendTitle:e=>e.fullName}):(0,t.jsxs)(i.default,{className:"p-4 flex-1",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main mb-3",children:r("chartByApiKey")}),(0,t.jsx)("div",{className:"text-center text-text-muted text-sm py-8",children:r("chartNoData")})]})}function R({byProvider:e}){let r=(0,a.f)("analytics"),n=(0,s.useMemo)(()=>e||[],[e]),o=n.length>0&&n.some(e=>e.cost>0),d=(0,s.useMemo)(()=>n.filter(e=>e.cost>0).sort((e,t)=>t.cost-e.cost).slice(0,8).map((e,t)=>({name:e.provider,value:e.cost,fill:c.N[t%c.N.length]})),[n]);return o?(0,t.jsx)($,{pieData:d,title:r("chartCostByProvider"),formatter:l.r,valueClassName:"text-text-main",labelClassName:"capitalize"}):(0,t.jsxs)(i.default,{className:"p-4 flex-1",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main mb-3",children:r("chartCostByProvider")}),(0,t.jsx)("div",{className:"text-center text-text-muted text-sm py-8",children:r("chartNoCostData")})]})}function z({dailyTrend:e}){let r=(0,a.f)("analytics"),n=(0,s.useMemo)(()=>(e||[]).map(e=>({date:e.date.slice(5),[r("chartInput")]:e.promptTokens,[r("chartOutput")]:e.completionTokens,[r("chartCost")]:e.cost||0})),[e,r]),l=(0,s.useMemo)(()=>n.some(e=>e[r("chartCost")]>0),[n,r]);return n.length?(0,t.jsx)(F,{chartData:n,hasCost:l}):(0,t.jsxs)(i.default,{className:"p-4",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main mb-3",children:r("chartModelUsageOverTime")}),(0,t.jsx)("div",{className:"text-center text-text-muted text-sm py-8",children:r("chartNoData")})]})}function F({chartData:e,hasCost:s}){let r=(0,a.f)("analytics"),n=A();if(!n)return(0,t.jsx)(D,{});let{ComposedChart:l,Bar:o,Line:c,XAxis:d,YAxis:u,Tooltip:m,ResponsiveContainer:x}=n;return(0,t.jsxs)(i.default,{className:"p-4 flex-1",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main mb-3",children:r("chartModelUsageOverTime")}),(0,t.jsx)(x,{width:"100%",height:140,children:(0,t.jsxs)(l,{data:e,margin:{top:0,right:40*!!s,left:0,bottom:0},children:[(0,t.jsx)(d,{dataKey:"date",tick:{fontSize:9,fill:"var(--color-text-muted)"},axisLine:!1,tickLine:!1,interval:Math.max(Math.floor(e.length/6),0)}),s&&(0,t.jsx)(u,{yAxisId:"cost",orientation:"right",tick:{fontSize:8,fill:"var(--color-text-muted)"},axisLine:!1,tickLine:!1,tickFormatter:e=>`$${e.toFixed(2)}`,width:36}),(0,t.jsx)(m,{content:(0,t.jsx)(U,{}),cursor:{fill:"var(--color-surface-2)"}}),(0,t.jsx)(o,{dataKey:r("chartInput"),stackId:"a",fill:"var(--color-primary)",opacity:.7,radius:[0,0,0,0],animationDuration:600}),(0,t.jsx)(o,{dataKey:r("chartOutput"),stackId:"a",fill:"var(--color-text-muted)",opacity:.7,radius:[3,3,0,0],animationDuration:600}),s&&(0,t.jsx)(c,{yAxisId:"cost",type:"monotone",dataKey:r("chartCost"),stroke:"var(--color-text-main)",strokeWidth:2,dot:!1,animationDuration:600})]})}),(0,t.jsxs)("div",{className:"flex items-center gap-4 mt-2 text-[10px] text-text-muted",children:[(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-primary/70"})," ",r("chartInput")]}),(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-text-muted/70"})," ",r("chartOutput")]}),s&&(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-text-main"})," ",r("chartCost")," ($)"]})]})]})}function U({active:e,payload:s,label:r}){let i=(0,a.f)("analytics");return e&&s?.length?(0,t.jsxs)("div",{className:"rounded-control border border-border bg-surface px-3 py-2 text-xs shadow-soft",children:[r&&(0,t.jsx)("div",{className:"font-semibold text-text-main mb-1",children:r}),s.map((e,s)=>(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-text-muted",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:e.color}}),(0,t.jsxs)("span",{children:[e.name,":"]}),(0,t.jsx)("span",{className:"font-mono tabular-nums font-medium text-text-main",children:e.name===i("chartCost")?(0,l.r)(e.value):(0,l.i)(e.value)})]},s))]}):null}function q({dailyByModel:e,modelNames:r}){let n=(0,a.f)("analytics"),l=(0,s.useMemo)(()=>e||[],[e]),o=(0,s.useMemo)(()=>r||[],[r]),c=(0,s.useMemo)(()=>l.map(e=>{let t={...e};if(e.date){let s=e.date.split("-");t.dateLabel=`${s[1]}/${s[2]}`}return t}),[l]);return l.length&&o.length?(0,t.jsx)(W,{chartData:c,models:o}):(0,t.jsxs)(i.default,{className:"p-4",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main mb-3",children:n("chartModelUsageOverTime")}),(0,t.jsx)("div",{className:"text-center text-text-muted text-sm py-8",children:n("chartNoData")})]})}function W({chartData:e,models:s}){let r=(0,a.f)("analytics"),n=A();if(!n)return(0,t.jsx)(D,{className:"p-4"});let{AreaChart:o,Area:d,XAxis:u,YAxis:m,Tooltip:x,ResponsiveContainer:p}=n;return(0,t.jsxs)(i.default,{className:"p-4",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main mb-3",children:r("chartModelUsageOverTime")}),(0,t.jsx)(p,{width:"100%",height:240,children:(0,t.jsxs)(o,{data:e,margin:{top:4,right:4,left:0,bottom:0},children:[(0,t.jsx)(u,{dataKey:"dateLabel",tick:{fontSize:10,fill:"var(--color-text-muted)"},axisLine:!1,tickLine:!1,interval:"preserveStartEnd"}),(0,t.jsx)(m,{tick:{fontSize:10,fill:"var(--color-text-muted)"},tickFormatter:e=>(0,l.i)(e),axisLine:!1,tickLine:!1,width:50}),(0,t.jsx)(x,{content:(0,t.jsx)(L,{formatter:l.i})}),s.map((e,s)=>(0,t.jsx)(d,{type:"monotone",dataKey:e,stackId:"1",stroke:(0,c.T)(s),fill:(0,c.T)(s),fillOpacity:.4,strokeWidth:1.5,animationDuration:600},e))]})}),(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 mt-2 text-[10px] text-text-muted",children:s.map((e,s)=>(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:(0,c.T)(s)}}),e]},e))})]})}function J(e){return!e||e.length<=8?e||"unknown":`${e.slice(0,6)}…${e.slice(-4)}`}function B({available:e,selected:r,onChange:i}){let n=(0,a.f)("analytics"),[l,o]=(0,s.useState)(!1),[c,d]=(0,s.useState)(""),u=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(l)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e);function e(e){u.current&&!u.current.contains(e.target)&&o(!1)}},[l]),(0,s.useEffect)(()=>{if(l)return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e);function e(e){"Escape"===e.key&&o(!1)}},[l]);let m=(0,s.useMemo)(()=>{let t=c.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||e.id.toLowerCase().includes(t)):e},[e,c]),x=0===r.length,p=(0,s.useCallback)(e=>{r.includes(e)?i(r.filter(t=>t!==e)):i([...r,e])},[r,i]),h=(0,s.useCallback)(()=>{i([])},[i]),f=(0,s.useMemo)(()=>{if(x)return n("filterAllKeys");if(1===r.length){let t=e.find(e=>e.id===r[0]);return t?J(t.name):n("filterOneKey")}return n("filterMultipleKeys",{count:r.length})},[x,r,e,n]);return 0===e.length?null:(0,t.jsxs)("div",{className:"relative",ref:u,children:[(0,t.jsxs)("button",{type:"button",onClick:()=>o(e=>!e),className:`flex items-center gap-1.5 rounded-control border px-3 py-1.5 text-xs font-medium transition-colors ${x?"border-border bg-surface text-text-muted hover:text-text-main":"border-primary/30 bg-primary/10 text-primary-text"}`,children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"vpn_key"}),f,(0,t.jsx)("span",{className:`material-symbols-outlined text-[14px] transition-transform ${l?"rotate-180":""}`,children:"expand_more"})]}),l&&(0,t.jsxs)("div",{className:"absolute left-0 top-full z-50 mt-1.5 w-[260px] rounded-card border border-border bg-surface shadow-xl",style:{backdropFilter:"blur(16px)"},children:[e.length>5&&(0,t.jsx)("div",{className:"border-b border-border/30 p-2",children:(0,t.jsx)("input",{type:"text",value:c,onChange:e=>d(e.target.value),placeholder:n("filterSearchKeys"),className:"w-full rounded-control border border-border bg-surface px-2.5 py-1.5 text-xs text-text-main placeholder:text-text-muted focus:outline-none focus:border-primary",autoFocus:!0})}),(0,t.jsxs)("div",{className:"max-h-[280px] overflow-y-auto p-1.5",children:[(0,t.jsxs)("button",{type:"button",onClick:h,className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left text-xs transition-colors ${x?"bg-primary/10 text-primary-text font-semibold":"text-text-muted hover:bg-surface-2 hover:text-text-main"}`,children:[(0,t.jsx)("span",{className:`flex h-4 w-4 shrink-0 items-center justify-center rounded border text-[10px] ${x?"border-primary bg-primary text-on-primary":"border-border/60 bg-transparent"}`,children:x&&(0,t.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"check"})}),n("filterAllKeys"),(0,t.jsx)("span",{className:"ml-auto text-[10px] text-text-muted font-normal",children:e.length})]}),(0,t.jsx)("div",{className:"my-1 h-px bg-border/20"}),m.map(e=>{let s=r.includes(e.id);return(0,t.jsxs)("button",{type:"button",onClick:()=>p(e.id),className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left text-xs transition-colors ${s?"bg-primary/[0.06] text-text-main":"text-text-muted hover:bg-surface-2 hover:text-text-main"}`,title:e.name||e.id,children:[(0,t.jsx)("span",{className:`flex h-4 w-4 shrink-0 items-center justify-center rounded border text-[10px] ${s?"border-primary bg-primary text-on-primary":"border-border/60 bg-transparent"}`,children:s&&(0,t.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"check"})}),(0,t.jsx)("span",{className:"truncate",children:J(e.name||e.id)})]},e.id)}),0===m.length&&(0,t.jsx)("p",{className:"px-2.5 py-3 text-center text-[11px] text-text-muted",children:n("filterNoKeysMatch")})]})]})]})}function H(e){if(!e)return"";let t=new Date(e);if(isNaN(t.getTime()))return"";let s=e=>String(e).padStart(2,"0");return`${t.getFullYear()}-${s(t.getMonth()+1)}-${s(t.getDate())}T${s(t.getHours())}:${s(t.getMinutes())}`}function G(e){return e?new Date(e).toISOString():""}function V({start:e,end:r,onApply:i,onClose:n}){let l=(0,a.f)("analytics"),[o,c]=(0,s.useState)(H(e)||""),[d,u]=(0,s.useState)(H(r)||""),m=(0,s.useRef)(null);(0,s.useEffect)(()=>{function e(e){m.current&&!m.current.contains(e.target)&&n()}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[n]),(0,s.useEffect)(()=>{function e(e){"Escape"===e.key&&n()}return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[n]);let x=(0,s.useCallback)(()=>{o&&d&&i(G(o),G(d))},[o,d,i]),p=(0,s.useCallback)(e=>{let{start:t,end:s}=function(e){let t=new Date,s=H(t.toISOString()),r=new Date(t);switch(e){case"today":r.setHours(0,0,0,0);break;case"yesterday":{r.setDate(r.getDate()-1),r.setHours(0,0,0,0);let e=new Date(r);return e.setHours(23,59,59,999),{start:H(r.toISOString()),end:H(e.toISOString())}}case"thisWeek":r.setDate(r.getDate()-r.getDay()),r.setHours(0,0,0,0);break;case"thisMonth":r.setDate(1),r.setHours(0,0,0,0);break;case"last3d":r.setDate(r.getDate()-3);break;case"last14d":r.setDate(r.getDate()-14);break;default:r.setDate(r.getDate()-7)}return{start:H(r.toISOString()),end:s}}(e);c(t),u(s)},[]),h=o&&d&&new Date(o)<=new Date(d),f=[{key:"today",label:l("rangeToday")},{key:"yesterday",label:l("rangeYesterday")},{key:"last3d",label:l("rangeLast3Days")},{key:"thisWeek",label:l("rangeThisWeek")},{key:"last14d",label:l("rangeLast14Days")},{key:"thisMonth",label:l("rangeThisMonth")}];return(0,t.jsxs)("div",{ref:m,className:"absolute right-0 top-full z-50 mt-2 w-[340px] rounded-card border border-border bg-surface p-4 shadow-xl",children:[(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("p",{className:"text-xs font-medium text-text-muted mb-1.5",children:l("rangeQuickSelect")}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:f.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>p(e.key),className:"rounded-md border border-border bg-surface-2 px-2.5 py-1 text-xs font-medium text-text-muted transition-colors hover:bg-primary/10 hover:text-primary-text hover:border-primary/30",children:e.label},e.key))})]}),(0,t.jsx)("div",{className:"h-px bg-border mb-3"}),(0,t.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-text-muted mb-1 block",children:l("rangeStart")}),(0,t.jsx)("input",{type:"datetime-local",value:o,onChange:e=>c(e.target.value),className:"w-full rounded-control border border-border bg-surface px-3 py-2 text-sm text-text-main focus:outline-none focus:border-primary"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-text-muted mb-1 block",children:l("rangeEnd")}),(0,t.jsx)("input",{type:"datetime-local",value:d,onChange:e=>u(e.target.value),className:"w-full rounded-control border border-border bg-surface px-3 py-2 text-sm text-text-main focus:outline-none focus:border-primary"})]})]}),o&&d&&!h&&(0,t.jsx)("p",{className:"mt-1.5 text-[11px] text-error",children:l("rangeErrorInvalid")}),(0,t.jsxs)("div",{className:"mt-3 flex items-center justify-end gap-2",children:[(0,t.jsx)("button",{type:"button",onClick:n,className:"rounded-lg px-3 py-1.5 text-xs font-medium text-text-muted hover:text-text-main transition-colors",children:l("rangeCancel")}),(0,t.jsx)("button",{type:"button",disabled:!h,onClick:x,className:"rounded-control bg-primary px-4 py-1.5 text-xs font-semibold text-on-primary transition-colors hover:bg-primary-hover disabled:opacity-40 disabled:cursor-not-allowed",children:l("rangeApply")})]})]})}function Y({title:e,dateLabel:s,value:r,onChange:a}){return(0,t.jsxs)("div",{className:"p-4 border-b border-border flex items-center justify-between flex-wrap gap-2",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:e}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("input",{type:"date",value:r,onChange:e=>a(e.target.value),"aria-label":s,className:"px-2 py-1 rounded-md text-xs bg-black/[0.03] dark:bg-white/[0.03] border border-black/5 dark:border-white/5"}),r&&(0,t.jsx)("button",{onClick:()=>a(""),className:"text-xs text-text-muted hover:text-text-main",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]})}function X({rows:e,sortBy:s,sortOrder:r,onToggleSort:a,dateLabel:i,providerLabel:n,requestsLabel:o,totalLabel:d}){return(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full text-sm",children:[(0,t.jsx)("thead",{className:"text-xs font-medium text-text-muted bg-surface-2/60",children:(0,t.jsxs)("tr",{children:[(0,t.jsxs)("th",{className:"px-4 py-2.5 text-left cursor-pointer group",onClick:()=>a("date"),children:[i," ",(0,t.jsx)(v,{active:"date"===s,sortOrder:r})]}),(0,t.jsxs)("th",{className:"px-4 py-2.5 text-left cursor-pointer group",onClick:()=>a("provider"),children:[n," ",(0,t.jsx)(v,{active:"provider"===s,sortOrder:r})]}),(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:()=>a("requests"),children:[o," ",(0,t.jsx)(v,{active:"requests"===s,sortOrder:r})]}),(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:()=>a("totalTokens"),children:[d," ",(0,t.jsx)(v,{active:"totalTokens"===s,sortOrder:r})]})]})}),(0,t.jsx)("tbody",{className:"divide-y divide-border",children:e.map((e,s)=>(0,t.jsxs)("tr",{className:"hover:bg-surface-2/60 transition-colors",children:[(0,t.jsx)("td",{className:"px-4 py-2.5 font-mono tabular-nums text-text-muted",children:e.date}),(0,t.jsx)("td",{className:"px-4 py-2.5",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:c.N[s%c.N.length]}}),(0,t.jsx)("span",{className:"font-medium capitalize",children:e.provider})]})}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums font-semibold text-text-main",children:(0,l.I)(e.requests)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums text-text-muted",children:(0,l.i)(e.totalTokens)})]},`${e.date}::${e.provider}`))})]})})}function Q({range:e}){let r=(0,a.f)("analytics"),n=(0,a.f)("common"),[l,c]=(0,s.useState)(""),[d,u]=(0,s.useState)("date"),[m,x]=(0,s.useState)("desc"),{rows:p,loading:h,error:f}=function(e,t){let r=(0,a.f)("common"),[i,n]=(0,s.useState)([]),[l,c]=(0,s.useState)(!0),[d,u]=(0,s.useState)(null),m=(0,s.useCallback)(async()=>{try{c(!0);let s=new URLSearchParams;t?s.set("date",t):s.set("range",e);let a=await fetch(`/api/usage/requests-by-provider-date?${s.toString()}`);if(!a.ok)throw Error(await o(a,r("error")));let i=await a.json();n(Array.isArray(i.rows)?i.rows:[]),u(null)}catch(e){u(e.message)}finally{c(!1)}},[e,t,r]);return(0,s.useEffect)(()=>{m()},[m]),{rows:i,loading:l,error:d}}(e,l),b=(0,s.useCallback)(e=>{d===e?x(e=>"asc"===e?"desc":"asc"):(u(e),x("desc"))},[d]),g=(0,s.useMemo)(()=>{let e;return(e=[...p]).sort((e,t)=>{let s=e[d],r=t[d];return"string"==typeof s&&"string"==typeof r?"asc"===m?s.localeCompare(r):r.localeCompare(s):"asc"===m?Number(s)-Number(r):Number(r)-Number(s)}),e},[p,d,m]);return(0,t.jsxs)(i.default,{className:"overflow-hidden",children:[(0,t.jsx)(Y,{title:r("chartRequestsByProviderDate"),dateLabel:r("chartDate"),value:l,onChange:c}),h&&0===p.length?(0,t.jsx)("div",{className:"text-center text-text-muted text-sm py-8",children:n("loading")}):f?(0,t.jsxs)("div",{className:"text-center text-error text-sm py-8",children:[n("errorShort"),": ",f]}):0===g.length?(0,t.jsx)("div",{className:"text-center text-text-muted text-sm py-8",children:r("chartNoData")}):(0,t.jsx)(X,{rows:g,sortBy:d,sortOrder:m,onToggleSort:b,dateLabel:r("chartDate"),providerLabel:r("chartProvider"),requestsLabel:r("chartRequests"),totalLabel:r("chartTotal")})]})}e.s(["default",0,function(){let e=(0,r.X)(),c=(0,a.f)("analytics"),d=(0,a.f)("common"),[u,m]=(0,s.useState)("30d"),[x,p]=(0,s.useState)(null),[h,f]=(0,s.useState)(!0),[b,y]=(0,s.useState)(null),[v,j]=(0,s.useState)(""),[N,E]=(0,s.useState)(""),[K,A]=(0,s.useState)(!1),D=(0,s.useRef)(null),[L,$]=(0,s.useState)([]),[F,U]=(0,s.useState)([]),W=(0,s.useCallback)(async()=>{try{f(!0);let e=new URLSearchParams;e.set("range",u),"custom"===u&&v&&N&&(e.set("startDate",v),e.set("endDate",N)),L.length>0&&e.set("apiKeyIds",L.join(","));let t=await fetch(`/api/usage/analytics?${e.toString()}`);if(!t.ok)throw Error(await o(t,d("error")));let s=await t.json();if(p(s),y(null),0===L.length&&s.byApiKey?.length>0){let e=new Set,t=[];for(let r of s.byApiKey){let s=r.apiKeyId||r.apiKeyName||d("unknownProvider"),a=r.apiKeyName||r.apiKeyId||d("unknownProvider");e.has(s)||(e.add(s),t.push({id:s,name:a}))}U(t)}}catch(e){y(e.message)}finally{f(!1)}},[u,v,N,L,d]);(0,s.useEffect)(()=>{let e=window.setTimeout(()=>void W(),0);return()=>window.clearTimeout(e)},[W]);let J=(0,s.useCallback)(e=>{"custom"===e?A(!0):(m(e),A(!1))},[]),H=(0,s.useCallback)((e,t)=>{j(e),E(t),m("custom"),A(!1)},[]),G=(0,s.useMemo)(()=>{if("custom"!==u||!v||!N)return null;let t=t=>new Date(t).toLocaleDateString(e,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});return`${t(v)} — ${t(N)}`},[u,v,N,e]),Y=[{value:"1d",label:c("period1D")},{value:"7d",label:c("period7D")},{value:"30d",label:c("period30D")},{value:"90d",label:c("period90D")},{value:"ytd",label:c("periodYTD")},{value:"all",label:c("periodAll")}],X=(0,s.useMemo)(()=>{let e=x?.byModel||[];return e.length>0?e[0].model:"—"},[x]),Z=(0,s.useMemo)(()=>{let e=x?.byProvider||[];return e.length>0?e[0].provider:"—"},[x]),ee=(0,s.useMemo)(()=>{let t=x?.weeklyPattern||[];if(!t.length)return"—";let s=t.reduce((e,t)=>e.avgTokens>t.avgTokens?e:t,t[0]);if(s.avgTokens<=0)return"—";let r=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].indexOf(s.day);return r<0?s.day:new Intl.DateTimeFormat(e,{weekday:"short"}).format(new Date(2024,0,7+r))},[x,e]),et=(0,s.useMemo)(()=>(x?.byProvider||[]).length,[x]),es=(0,s.useMemo)(()=>{let e=x?.byProvider||[];if(e.length<=1)return 0;let t=0;for(let s of e)t+=s.totalRequests||s.apiCalls||0;if(0===t)return 0;let s=0;for(let r of e){let e=(r.totalRequests||r.apiCalls||0)/t;e>0&&(s-=e*Math.log2(e))}let r=Math.log2(e.length);return r>0?s/r*100:0},[x]);if(h&&!x)return(0,t.jsx)(n.CardSkeleton,{});if(b)return(0,t.jsxs)(i.default,{className:"p-6 text-center text-red-500",children:[d("errorShort"),": ",b]});let er=x?.summary||{},ea=er.totalRequests>0?Math.round(er.totalTokens/er.totalRequests):0,ei=er.totalRequests>0?er.totalCost/er.totalRequests:0,en=er.completionTokens>0?(er.promptTokens/er.completionTokens).toFixed(1):"—";return(0,t.jsxs)("div",{className:"flex flex-col gap-5 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[(0,t.jsxs)("h2",{className:"text-xl font-semibold flex items-center gap-2",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-primary text-[22px]",children:"analytics"}),c("usageAnalyticsTitle")]}),(0,t.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,t.jsx)(B,{available:F,selected:L,onChange:$}),(0,t.jsxs)("div",{className:"relative flex items-center gap-1 rounded-control border border-border bg-surface-2 p-1",ref:D,children:[Y.map(e=>(0,t.jsx)("button",{onClick:()=>J(e.value),"aria-pressed":u===e.value,className:`h-7 px-3 rounded-md text-xs font-medium transition-colors ${u===e.value?"border border-border bg-surface text-text-main":"border border-transparent text-text-muted hover:text-text-main"}`,children:e.label},e.value)),(0,t.jsxs)("button",{onClick:()=>J("custom"),"aria-pressed":"custom"===u,className:`h-7 px-3 rounded-md text-xs font-medium transition-colors flex items-center gap-1 ${"custom"===u?"border border-border bg-surface text-text-main":"border border-transparent text-text-muted hover:text-text-main"}`,children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"date_range"}),G||c("customRange"),"custom"===u&&G&&(0,t.jsx)("span",{role:"button",onClick:e=>{e.stopPropagation(),m("30d"),j(""),E("")},className:"ml-0.5 opacity-70 hover:opacity-100",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-[11px]",children:"close"})})]}),K&&(0,t.jsx)(V,{start:v,end:N,onApply:H,onClose:()=>A(!1)})]})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[(0,t.jsx)(k,{icon:"generating_tokens",label:c("totalTokens"),value:(0,l.i)(er.totalTokens),subValue:`${(0,l.I)(er.totalRequests)} ${c("chartRequests")}`}),(0,t.jsx)(k,{icon:"input",label:c("inputTokens"),value:(0,l.i)(er.promptTokens),color:"text-primary"}),(0,t.jsx)(k,{icon:"output",label:c("outputTokens"),value:(0,l.i)(er.completionTokens),color:"text-emerald-500"}),(0,t.jsx)(k,{icon:"payments",label:c("estCost"),value:(0,l.r)(er.totalCost),color:"text-amber-500"})]}),(0,t.jsx)(w,{sections:[{title:c("infraTitle"),items:[{icon:"group",label:c("infraAccounts"),value:er.uniqueAccounts||0},{icon:"dns",label:c("infraProviders"),value:et,color:"text-indigo-500"},{icon:"vpn_key",label:c("infraApiKeys"),value:er.uniqueApiKeys||0},{icon:"model_training",label:c("infraModels"),value:er.uniqueModels||0}]},{title:c("perfTitle"),items:[{icon:"speed",label:c("perfAvgTokens"),value:(0,l.i)(ea),color:"text-cyan-500"},{icon:"request_quote",label:c("perfCostReq"),value:(0,l.r)(ei),color:"text-orange-500"},{icon:"compare_arrows",label:c("perfIoRatio"),value:`${en}x`,color:"text-violet-500"},{icon:"bolt",label:c("perfFastReq"),value:(0,l.i)(er.fastRequests||0),color:"text-sky-500"}]},{title:c("highlightsTitle"),wideValues:!0,items:[{icon:"star",label:c("highlightsTopModel"),value:X,color:"text-pink-500"},{icon:"cloud",label:c("highlightsTopProvider"),value:Z,color:"text-teal-500"},{icon:"today",label:c("highlightsBusiestDay"),value:ee,color:"text-rose-500"},{icon:"network_node",label:c("highlightsDiversity"),value:`${es.toFixed(1)}%`,color:"text-sky-500"},{icon:"swap_horiz",label:c("highlightsFallbackRate"),value:`${Number(er.fallbackRatePct||0).toFixed(1)}%`,color:"text-amber-500"}]}]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-[2fr_1fr] gap-4 items-stretch",children:[(0,t.jsx)(S,{activityMap:x?.activityMap}),(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsx)(T,{activityMap:x?.activityMap}),(0,t.jsx)(I,{activityMap:x?.activityMap})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsx)(z,{dailyTrend:x?.dailyTrend}),(0,t.jsx)(R,{byProvider:x?.byProvider})]}),(0,t.jsx)(M,{byServiceTier:x?.byServiceTier,summary:er}),(0,t.jsx)(q,{dailyByModel:x?.dailyByModel,modelNames:x?.modelNames}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsx)(P,{byAccount:x?.byAccount}),(0,t.jsx)(O,{byApiKey:x?.byApiKey})]}),(0,t.jsx)(_,{byProvider:x?.byProvider}),(0,t.jsx)(Q,{range:u}),(0,t.jsx)(C,{byApiKey:x?.byApiKey}),(0,t.jsx)(g,{byModel:x?.byModel,summary:er})]})}],566770)},548036,e=>{"use strict";e.i(843476),e.i(948148),e.i(271645),e.i(618566),e.i(393718),e.i(969353),e.i(454149),e.i(243009),e.s([])},565650,e=>{"use strict";e.s([],565650),e.i(342923),e.i(80173),e.i(907714),e.i(542055),e.i(905204),e.i(393718),e.i(51130),e.i(703166),e.i(454149),e.i(822124),e.i(969353),e.i(635055),e.i(897844),e.i(450222),e.i(647829),e.i(6998),e.i(964039),e.i(279743),e.i(629476),e.i(16190),e.i(193464),e.i(548036),e.i(566770),e.i(953789),e.i(471348),e.i(8839),e.i(227404),e.i(621745),e.i(567955),e.i(17517),e.i(419947),e.i(268226),e.i(323060),e.i(642440),e.i(629342),e.i(816062),e.i(690777),e.i(563201),e.i(115243),e.i(915139),e.i(524578),e.i(515272),e.i(840387),e.i(110626),e.i(247854),e.i(165149),e.i(359505)},359505,e=>{"use strict";e.i(843476),e.i(897844),e.s([])},165149,e=>{"use strict";var t=e.i(247167),s=e.i(843476),r=e.i(271645),a=e.i(647829),i=e.i(6998),n=e.i(816062),l=e.i(642440),o=e.i(948148);function c(){let[e,t]=(0,r.useState)(!1),[a,i]=(0,r.useState)(""),n=(0,r.useRef)(0),l=(0,r.useRef)(!1),c=(0,o.f)("common");return((0,r.useEffect)(()=>{let e=async()=>{let e=new AbortController,s=setTimeout(()=>e.abort("Health check timeout"),8e3);try{(await fetch("/api/health/ping",{signal:e.signal,cache:"no-store"})).ok?(n.current=0,l.current=!1,t(!1),i("")):(n.current+=1,n.current>=2&&!l.current&&(t(!0),i(c("maintenanceServerIssues"))))}catch{n.current+=1,n.current>=2&&!l.current&&(t(!0),i(c("maintenanceServerUnreachable")))}finally{clearTimeout(s)}};e();let s=setInterval(e,1e4);return()=>clearInterval(s)},[c]),e)?(0,s.jsxs)("div",{role:"status",className:"flex items-center justify-between gap-3 border-b border-warning/20 bg-warning/10 px-4 py-2 sm:px-6",children:[(0,s.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined shrink-0 text-[18px] text-warning","aria-hidden":"true",children:"warning"}),(0,s.jsx)("span",{className:"text-sm text-text-main",children:a})]}),(0,s.jsx)("button",{type:"button",onClick:()=>{l.current=!0,t(!1)},className:"flex size-7 shrink-0 items-center justify-center rounded-md text-text-muted transition-colors hover:bg-warning/10 hover:text-text-main focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30","aria-label":c("close"),children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"close"})})]}):null}var d=e.i(618566),u=e.i(241937),m=e.i(513859);function x({isOpen:e,onClose:t}){return e?(0,s.jsx)(p,{onClose:t}):null}function p({onClose:e}){let t=(0,d.useRouter)(),a=(0,o.f)("sidebar"),i=(0,r.useRef)(null),n=(0,r.useRef)(null),[l,c]=(0,r.useState)(""),[x,h]=(0,r.useState)(0),[f,b]=(0,r.useState)(new Set);(0,r.useEffect)(()=>{let e=new AbortController;return fetch("/api/settings",{signal:e.signal}).then(e=>e.json()).then(e=>{b(new Set((0,u.D)(e?.[u.P])))}).catch(()=>{}),()=>e.abort()},[]),(0,r.useEffect)(()=>{let e=setTimeout(()=>i.current?.focus(),30);return()=>clearTimeout(e)},[]);let g=(0,r.useCallback)((e,t)=>{try{return a(e)}catch{return t}},[a]),y=(0,r.useMemo)(()=>m.f.flatMap(e=>{let t=g(e.titleKey,e.titleFallback);return e.children.flatMap(s=>{if("type"in s&&"group"===s.type){let r=g(s.titleKey,s.titleFallback);return s.items.filter(e=>!f.has(e.id)).map(a=>({id:a.id,href:a.href,icon:a.icon,label:g(a.i18nKey,a.id),subtitle:a.subtitleKey?g(a.subtitleKey,""):void 0,external:a.external??!1,sectionId:e.id,sectionLabel:t,subgroupId:s.id,subgroupLabel:r}))}return f.has(s.id)?[]:[{id:s.id,href:s.href,icon:s.icon,label:g(s.i18nKey,s.id),subtitle:s.subtitleKey?g(s.subtitleKey,""):void 0,external:s.external??!1,sectionId:e.id,sectionLabel:t}]})}),[f,g]),v=(0,r.useMemo)(()=>{let e=l.trim().toLowerCase();return e?y.filter(t=>t.label.toLowerCase().includes(e)||t.subtitle?.toLowerCase().includes(e)||t.sectionLabel.toLowerCase().includes(e)||t.subgroupLabel?.toLowerCase().includes(e)):y},[y,l]),j=(0,r.useMemo)(()=>{let e=[],t=new Map;return v.forEach((s,r)=>{let a=t.get(s.sectionId);a||(a={sectionId:s.sectionId,sectionLabel:s.sectionLabel,subgroups:[]},t.set(s.sectionId,a),e.push(a));let i=s.subgroupId??null,n=a.subgroups.find(e=>e.subgroupId===i);n||(n={subgroupId:i,subgroupLabel:s.subgroupLabel??null,items:[]},a.subgroups.push(n)),n.items.push({item:s,flatIndex:r})}),e},[v]),N=(0,r.useCallback)((s,r)=>{e(),r?window.open(s,"_blank","noopener,noreferrer"):t.push(s)},[e,t]);return(0,r.useEffect)(()=>{let t=t=>{if("Escape"===t.key)return void e();if("ArrowDown"===t.key)t.preventDefault(),h(e=>(e+1)%Math.max(1,v.length));else if("ArrowUp"===t.key)t.preventDefault(),h(e=>(e-1+Math.max(1,v.length))%Math.max(1,v.length));else if("Enter"===t.key){t.preventDefault();let e=v[x];e&&N(e.href,e.external)}};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[v,x,e,N]),(0,r.useEffect)(()=>{let e=n.current;if(!e)return;let t=e.querySelector(`[data-flat-index="${x}"]`);t?.scrollIntoView({block:"nearest"})},[x]),(0,s.jsxs)("div",{className:"fixed inset-0 z-[60] flex items-start justify-center px-4 pt-[12vh]",children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-black/40",onClick:e,"aria-hidden":"true"}),(0,s.jsxs)("div",{className:"relative w-full max-w-2xl overflow-hidden rounded-card border border-border bg-surface shadow-elevated",role:"dialog","aria-modal":"true","aria-label":"Command palette",children:[(0,s.jsxs)("div",{className:"flex h-12 items-center gap-2.5 border-b border-border px-4",children:[(0,s.jsx)("span",{className:"material-symbols-outlined shrink-0 text-[18px] text-text-muted","aria-hidden":"true",children:"search"}),(0,s.jsx)("input",{ref:i,type:"text",className:"min-w-0 flex-1 bg-transparent text-sm text-text-main outline-none placeholder:text-text-muted",placeholder:"Search pages, settings, tools...",value:l,onChange:e=>{c(e.target.value),h(0)},autoComplete:"off",spellCheck:!1}),l&&(0,s.jsx)("button",{type:"button",className:"flex size-6 items-center justify-center rounded-md text-text-muted transition-colors hover:bg-surface-2 hover:text-text-main",onClick:()=>{c(""),h(0)},tabIndex:-1,"aria-label":"Clear search",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"close"})}),(0,s.jsx)("kbd",{className:"hidden h-5 shrink-0 items-center rounded border border-border bg-surface-2 px-1.5 font-sans text-[10px] font-medium text-text-muted sm:inline-flex",children:"Esc"})]}),j.length>0?(0,s.jsx)("ul",{ref:n,className:"custom-scrollbar max-h-[60vh] overflow-y-auto p-1.5",role:"listbox",children:j.map(e=>(0,s.jsxs)("li",{role:"presentation",children:[(0,s.jsx)("div",{className:"sticky top-0 z-10 bg-surface px-2.5 pb-1 pt-2 text-[11px] font-medium uppercase tracking-wider text-text-muted/70",children:e.sectionLabel}),(0,s.jsx)("ul",{role:"group","aria-label":e.sectionLabel,children:e.subgroups.map(t=>(0,s.jsxs)("li",{role:"presentation",children:[t.subgroupLabel&&(0,s.jsx)("div",{className:"px-2.5 pb-1 pt-2 text-[11px] font-medium text-text-muted/70",children:t.subgroupLabel}),(0,s.jsx)("ul",{role:t.subgroupLabel?"group":"presentation","aria-label":t.subgroupLabel??void 0,children:t.items.map(({item:e,flatIndex:r})=>(0,s.jsx)("li",{role:"option","aria-selected":r===x,"data-flat-index":r,children:(0,s.jsxs)("button",{type:"button",className:`flex min-h-9 w-full items-center gap-2.5 rounded-md ${t.subgroupLabel?"ps-6 pe-2.5":"px-2.5"} py-1.5 text-start transition-colors ${r===x?"bg-surface-2 text-text-main":"text-text-main hover:bg-surface-2"}`,onClick:()=>N(e.href,e.external),onMouseEnter:()=>h(r),children:[(0,s.jsx)("span",{className:`material-symbols-outlined text-[18px] shrink-0 ${r===x?"text-primary-text":"text-text-muted"}`,"aria-hidden":"true",children:e.icon}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"truncate text-sm",children:e.label}),e.subtitle&&(0,s.jsx)("p",{className:"truncate text-xs text-text-muted",children:e.subtitle})]}),e.external&&(0,s.jsx)("span",{className:"material-symbols-outlined shrink-0 text-[14px] text-text-muted","aria-hidden":"true",children:"open_in_new"})]})},e.id))})]},`${e.sectionId}::${t.subgroupId??"_root"}`))})]},e.sectionId))}):(0,s.jsx)("div",{className:"py-10 text-center text-sm text-text-muted",children:"No results"}),(0,s.jsxs)("div",{className:"flex items-center gap-4 border-t border-border px-4 py-2 text-[11px] text-text-muted",children:[(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[(0,s.jsx)("kbd",{className:"inline-flex h-5 items-center rounded border border-border bg-surface-2 px-1.5 font-sans text-[10px] font-medium",children:"↑↓"}),"navigate"]}),(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[(0,s.jsx)("kbd",{className:"inline-flex h-5 items-center rounded border border-border bg-surface-2 px-1.5 font-sans text-[10px] font-medium",children:"↵"}),"open"]}),(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[(0,s.jsx)("kbd",{className:"inline-flex h-5 items-center rounded border border-border bg-surface-2 px-1.5 font-sans text-[10px] font-medium",children:"Esc"}),"close"]})]})]})]})}function h(){let e=(0,d.usePathname)(),t=(0,d.useSearchParams)(),[a,i]=(0,r.useState)(!1),[n,l]=(0,r.useState)(0),o=(0,r.useRef)(`${e}?${t?.toString()??""}`),c=(0,r.useRef)(null),u=(0,r.useRef)(null),m=(0,r.useRef)(null);return((0,r.useEffect)(()=>{let e=e=>{if(e.defaultPrevented||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||0!==e.button)return;let t=e.target?.closest?.("a");if(!t||t.target&&""!==t.target&&"_self"!==t.target||t.hasAttribute("download"))return;let s=t.getAttribute("href");if(!(!s||s.startsWith("#"))&&!(s.startsWith("mailto:")||s.startsWith("tel:"))){try{let e=new URL(t.href,window.location.href);if(e.origin!==window.location.origin)return;let s=`${window.location.pathname}?${window.location.search}`,r=`${e.pathname}?${e.search}`;if(s===r)return}catch{return}queueMicrotask(()=>{i(!0),l(8)})}};return document.addEventListener("click",e,!0),()=>document.removeEventListener("click",e,!0)},[]),(0,r.useEffect)(()=>{if(a)return c.current=setInterval(()=>{l(e=>e>=88?e:Math.min(88,e+Math.min(12,Math.max(1,.18*(88-e)))))},150),()=>{c.current&&(clearInterval(c.current),c.current=null)}},[a]),(0,r.useEffect)(()=>{let s=`${e}?${t?.toString()??""}`;if(s!==o.current)return o.current=s,u.current&&clearTimeout(u.current),m.current&&clearTimeout(m.current),u.current=setTimeout(()=>{l(100),m.current=setTimeout(()=>{i(!1),l(0)},320)},220),()=>{u.current&&clearTimeout(u.current),m.current&&clearTimeout(m.current)}},[e,t]),a||0!==n)?(0,s.jsx)("div",{className:"pointer-events-none fixed inset-x-0 top-0 z-[9999] h-0.5","aria-hidden":"true",children:(0,s.jsx)("div",{className:"h-full origin-left bg-primary transition-[width,opacity] duration-200 ease-out",style:{width:`${n}%`,opacity:n>=100?0:1}})}):null}var f=e.i(593976);let b="x-trouteai-csrf",g=["/api/auth/login","/api/auth/logout","/api/auth/status","/api/auth/oidc/","/api/v1/","/api/codex/connect/","/api/usage/om-usage"],y=null,v=null,j=null,N=0,k=["/chat/completions","/responses","/models","/codex"],w=["/a2a"];function S(e=Date.now()){return y&&y.expiresAtMs-e>3e4?y.token:null}async function C(e){try{let t=await fetch("/api/auth/csrf",{cache:"no-store",credentials:"same-origin"});if(!t.ok)return null;let s=await t.json().catch(()=>null);if("string"!=typeof s?.token||"string"!=typeof s.expiresAt)return y=null,null;let r=Date.parse(s.expiresAt);if(!Number.isFinite(r)||r<=e)return y=null,null;return(y={token:s.token,expiresAtMs:r}).token}catch{return null}}async function T(){let e=S();return e||(v||(v=C(Date.now()).finally(()=>{v=null})),v)}function I(e){return"u">typeof Request&&e instanceof Request?e:null}var M=e.i(554364);let _="sidebar-collapsed",E="1"===t.default.env.NEXT_PUBLIC_TROUTEAI_E2E_MODE;e.s(["default",0,function({children:e}){let[t,o]=(0,r.useState)(!1),[d,u]=(0,r.useState)(!1),[m,p]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{try{"true"===localStorage.getItem(_)&&setTimeout(()=>p(!0),0)}catch{}},[]),(0,r.useInsertionEffect)(()=>{let e=(0,M.f)(),t=function(){if("function"!=typeof globalThis.fetch)return()=>{};0===N&&(j=globalThis.fetch,globalThis.fetch=async(e,t)=>{if(!j||!function(e,t){var s,r,a;let i,n;if(!["POST","PUT","PATCH","DELETE"].includes((t?.method?t.method:I(e)?.method??"GET").toUpperCase()))return!1;let l=(n=I(e))?n.url:e instanceof URL?e.href:"string"==typeof e?e:null;if(!l)return!1;try{i=new URL(l,window.location.href)}catch{return!1}return i.origin===window.location.origin&&(s=i,!!w.some(e=>s.pathname===e||s.pathname.startsWith(e+"/"))||s.pathname.startsWith("/api/")&&"/api/auth/csrf"!==s.pathname&&(r=s.pathname,!g.some(e=>r.startsWith(e)))&&!("/api/v1"===(a=s.pathname)||a.startsWith("/api/v1/")||"/api/v1beta"===a||a.startsWith("/api/v1beta/")||"/v1"===a||a.startsWith("/v1/")||"/v1beta"===a||a.startsWith("/v1beta/")||"/v1/v1"===a||a.startsWith("/v1/v1/")||k.some(e=>a===e||a.startsWith(e+"/"))))}(e,t))return j?j(e,t):fetch(e,t);let s=new Headers(t?.headers??I(e)?.headers);if(s.has(b))return j(e,t);let r=S()??await T();return r?(s.set(b,r),j(e,{...t,headers:s})):j(e,t)}),N++;let e=!0;return()=>{e&&(e=!1,0===(N=Math.max(0,N-1))&&j&&(globalThis.fetch=j,j=null))}}();return T(),()=>{t(),e()}},[]),(0,r.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"k"===e.key&&(e.preventDefault(),u(e=>!e))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[]),(0,s.jsxs)("div",{className:"flex h-dvh min-h-0 w-full overflow-hidden bg-bg",children:[(0,s.jsx)(r.Suspense,{fallback:null,children:(0,s.jsx)(h,{})}),t&&(0,s.jsx)("div",{className:"fixed inset-0 z-40 bg-black/40 lg:hidden",onClick:()=>o(!1)}),(0,s.jsx)("div",{className:"dashboard-sidebar-desktop",children:(0,s.jsx)(a.default,{collapsed:m,onToggleCollapse:()=>{let e=!m;p(e),localStorage.setItem(_,String(e))}})}),(0,s.jsx)("div",{id:"mobile-sidebar",className:`fixed inset-y-0 start-0 z-50 h-dvh transform overflow-y-auto shadow-elevated transition-transform duration-200 ease-out lg:hidden ${t?"translate-x-0":"-translate-x-full"}`,children:(0,s.jsx)(a.default,{onClose:()=>o(!1)})}),(0,s.jsxs)("main",{id:"main-content",className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,s.jsx)(i.default,{onMenuClick:()=>o(!0),menuOpen:t,onOpenCommandPalette:()=>u(!0)}),!E&&(0,s.jsx)(c,{}),(0,s.jsx)("div",{className:"custom-scrollbar min-h-0 flex-1 overflow-y-auto overflow-x-hidden p-4 sm:p-6",children:(0,s.jsxs)("div",{className:"mx-auto flex h-full min-h-0 w-full max-w-[3840px] flex-col",children:[(0,s.jsx)(l.default,{}),(0,s.jsx)("div",{className:"flex-1 min-h-0",children:e})]})})]}),(0,s.jsx)(n.default,{}),(0,s.jsx)(f.q,{}),(0,s.jsx)(x,{isOpen:d,onClose:()=>u(!1)})]})}],165149)},241937,974440,513859,e=>{"use strict";let t=["home","endpoints","api-manager","providers","combos","combos-live","quota","costs-quota-share","analytics","analytics-combo-health","analytics-utilization","cache","provider-stats","activity","logs","logs-proxy","logs-console","logs-timeline","health","runtime","costs","costs-pricing","costs-budget","audit","playground","settings-general","settings-appearance","settings-ai","settings-routing","settings-resilience","settings-advanced","settings-security","settings-feature-flags","settings-cache","settings-sidebar"];e.s(["f",0,t],974440);let s=new Set(["home","providers","combos","api-manager","endpoints","quota","analytics","logs","settings-general","settings-security","settings-appearance"]),r=new Set(["home","endpoints","api-manager","providers","combos","quota","analytics","analytics-combo-health","costs","cache","logs","health","runtime","playground","settings-general","settings-routing","settings-resilience","settings-sidebar"]),a=new Set(["home","endpoints","api-manager","providers","combos","quota","analytics","analytics-combo-health","analytics-utilization","costs","costs-pricing","costs-budget","costs-quota-share","cache","logs","activity","health","runtime","audit","settings-general","settings-routing","settings-resilience","settings-security","settings-feature-flags","settings-sidebar"]);function i(e){return t.filter(t=>!e.has(t))}let n=[{id:"all",icon:"select_all",hiddenItems:[]},{id:"minimal",icon:"minimize",hiddenItems:i(s)},{id:"developer",icon:"code",hiddenItems:i(r)},{id:"admin",icon:"admin_panel_settings",hiddenItems:i(a)}];e.s(["g",0,"minimal","P",0,"hiddenSidebarItems","R",0,"sidebarItemOrder","O",0,n,"C",0,"sidebarActivePreset","_",0,"sidebarSectionOrder","z",0,"trouteai:settings-updated","S",0,function(e,t){if(0===t.length)return[...e];let s=e=>("type"in e&&e.type,e.id),r=new Set(e.map(s)),a=t.filter(e=>r.has(e)),i=new Map(a.map((e,t)=>[e,t]));return[...e].sort((t,r)=>{let n=s(t),l=s(r);return(i.get(n)??a.length+e.indexOf(t))-(i.get(l)??a.length+e.indexOf(r))})},"K",0,function(e,t){if(0===t.length)return[...e];let s=new Set(e.map(e=>e.id)),r=t.filter(e=>s.has(e)),a=new Map(r.map((e,t)=>[e,t]));return[...e].sort((t,s)=>(a.get(t.id)??r.length+e.indexOf(t))-(a.get(s.id)??r.length+e.indexOf(s)))},"X",0,function(e){return e.children.flatMap(e=>"type"in e&&"group"===e.type?e.items:[e])},"I",0,function(e){return[...n.find(t=>t.id===e)?.hiddenItems??[]]},"D",0,function(e){if(!Array.isArray(e))return[];let s=new Set;for(let r of e)"string"==typeof r&&t.includes(r)&&s.add(r);return t.filter(e=>s.has(e))}],241937);let l=[{id:"home",titleKey:"home",titleFallback:"Home",children:[{id:"home",href:"/home",i18nKey:"home",subtitleKey:"homeSubtitle",icon:"home",exact:!0}],showTitle:!1},{id:"setup",titleKey:"setupSection",titleFallback:"Setup",children:[{id:"providers",href:"/dashboard/providers",i18nKey:"providers",subtitleKey:"providersSubtitle",icon:"dns"},{id:"combos",href:"/dashboard/combos",i18nKey:"combos",subtitleKey:"combosSubtitle",icon:"layers"},{id:"api-manager",href:"/dashboard/api-manager",i18nKey:"apiManager",subtitleKey:"apiManagerSubtitle",icon:"vpn_key"},{id:"endpoints",href:"/dashboard/endpoint",i18nKey:"endpoints",subtitleKey:"endpointsSubtitle",icon:"api"}],defaultPinned:!0},{id:"router",titleKey:"routerSection",titleFallback:"Routing",children:[{id:"combos-live",href:"/dashboard/combos/live",i18nKey:"combosLive",labelFallback:"Combo Studio",subtitleKey:"combosLiveSubtitle",subtitleFallback:"Live routing cascade",icon:"account_tree"},{id:"quota",href:"/dashboard/quota",i18nKey:"providerQuota",subtitleKey:"providerQuotaSubtitle",icon:"tune"},{id:"costs-quota-share",href:"/dashboard/costs/quota-share",i18nKey:"costsQuotaShare",subtitleKey:"costsQuotaShareSubtitle",icon:"pie_chart"},{id:"proxy",href:"/dashboard/system/proxy",i18nKey:"proxy",subtitleKey:"proxySubtitle",icon:"lan"}]},{id:"analytics",titleKey:"analyticsSection",titleFallback:"Analytics",children:[{id:"analytics",href:"/dashboard/analytics",i18nKey:"usage",subtitleKey:"usageSubtitle",icon:"analytics"},{id:"analytics-combo-health",href:"/dashboard/analytics/combo-health",i18nKey:"analyticsComboHealth",subtitleKey:"analyticsComboHealthSubtitle",icon:"monitor_heart"},{id:"analytics-utilization",href:"/dashboard/analytics/utilization",i18nKey:"analyticsUtilization",subtitleKey:"analyticsUtilizationSubtitle",icon:"bar_chart"},{id:"cache",href:"/dashboard/cache",i18nKey:"cache",subtitleKey:"cacheSubtitle",icon:"cached"},{id:"provider-stats",href:"/dashboard/provider-stats",i18nKey:"providerStats",subtitleKey:"providerStatsSubtitle",icon:"speed"}]},{id:"costs",titleKey:"costsSection",titleFallback:"Costs",children:[{id:"costs",href:"/dashboard/costs",i18nKey:"costsOverview",subtitleKey:"costsOverviewSubtitle",icon:"account_balance_wallet"},{id:"costs-pricing",href:"/dashboard/costs/pricing",i18nKey:"costsPricing",subtitleKey:"costsPricingSubtitle",icon:"price_change"},{id:"costs-budget",href:"/dashboard/costs/budget",i18nKey:"costsBudget",subtitleKey:"costsBudgetSubtitle",icon:"savings"}]},{id:"monitoring",titleKey:"monitoringSection",titleFallback:"Monitoring",children:[{id:"activity",href:"/dashboard/activity",i18nKey:"activity",subtitleKey:"activitySubtitle",icon:"timeline"},{type:"group",id:"logs",titleKey:"logsGroup",titleFallback:"Logs",items:[{id:"logs",href:"/dashboard/logs",i18nKey:"logs",subtitleKey:"logsSubtitle",icon:"description"},{id:"logs-proxy",href:"/dashboard/logs/proxy",i18nKey:"logsProxy",subtitleKey:"logsProxySubtitle",icon:"lan"},{id:"logs-console",href:"/dashboard/logs/console",i18nKey:"consoleLogs",subtitleKey:"consoleLogsSubtitle",icon:"terminal"},{id:"logs-timeline",href:"/dashboard/logs/timeline",i18nKey:"logsTimeline",subtitleKey:"logsTimelineSubtitle",icon:"view_timeline"}]},{type:"group",id:"audit",titleKey:"auditGroup",titleFallback:"Audit",items:[{id:"audit",href:"/dashboard/audit",i18nKey:"auditLog",subtitleKey:"auditLogSubtitle",icon:"policy"}]},{type:"group",id:"system",titleKey:"systemGroup",titleFallback:"System",items:[{id:"health",href:"/dashboard/health",i18nKey:"health",subtitleKey:"healthSubtitle",icon:"health_and_safety"},{id:"runtime",href:"/dashboard/runtime",i18nKey:"runtime",subtitleKey:"runtimeSubtitle",icon:"bolt"}]}]},{id:"devtools",titleKey:"devtoolsSection",titleFallback:"Dev Tools",children:[{id:"playground",href:"/dashboard/playground",i18nKey:"playground",subtitleKey:"playgroundSubtitle",icon:"science"}],visibility:"debug"},{id:"configuration",titleKey:"configurationSection",titleFallback:"Configuration",children:[{id:"settings-general",href:"/dashboard/settings/general",i18nKey:"settingsGeneral",subtitleKey:"settingsGeneralSubtitle",icon:"tune"},{id:"settings-appearance",href:"/dashboard/settings/appearance",i18nKey:"settingsAppearance",subtitleKey:"settingsAppearanceSubtitle",icon:"palette"},{id:"settings-ai",href:"/dashboard/settings/ai",i18nKey:"settingsAi",subtitleKey:"settingsAiSubtitle",icon:"auto_awesome"},{id:"settings-routing",href:"/dashboard/settings/routing",i18nKey:"globalRouting",subtitleKey:"globalRoutingSubtitle",icon:"route"},{id:"settings-resilience",href:"/dashboard/settings/resilience",i18nKey:"settingsResilience",subtitleKey:"settingsResilienceSubtitle",icon:"health_and_safety"},{id:"settings-advanced",href:"/dashboard/settings/advanced",i18nKey:"settingsAdvanced",subtitleKey:"settingsAdvancedSubtitle",icon:"engineering"},{id:"settings-security",href:"/dashboard/settings/security",i18nKey:"settingsSecurity",subtitleKey:"settingsSecuritySubtitle",icon:"shield"},{id:"settings-feature-flags",href:"/dashboard/settings/feature-flags",i18nKey:"settingsFeatureFlags",subtitleKey:"settingsFeatureFlagsSubtitle",icon:"flag"},{id:"settings-cache",href:"/dashboard/settings/cache",i18nKey:"settingsCache",subtitleKey:"settingsCacheSubtitle",icon:"memory"},{id:"settings-sidebar",href:"/dashboard/settings/sidebar",i18nKey:"settingsSidebar",subtitleKey:"settingsSidebarSubtitle",icon:"view_sidebar"}]}];e.s(["f",0,l],513859)}]);
10
+ `}),(0,t.jsx)("div",{"aria-live":"polite","aria-atomic":"false",style:{position:"fixed",top:"16px",insetInlineEnd:"16px",zIndex:9999,display:"flex",flexDirection:"column",gap:"8px",pointerEvents:"none"},children:e.map(e=>(0,t.jsx)("div",{style:{pointerEvents:"auto"},children:(0,t.jsx)(d,{notification:e,onDismiss:s})},e.id))})]})}],816062)},964039,e=>{"use strict";var t=e.i(843476),s=e.i(271645),r=e.i(948148),a=e.i(703166),i=e.i(342923),n=e.i(80173),l=e.i(556938);function o({deviceData:e,verificationUrl:s,secondsRemaining:a,polling:n}){let c,d,u=(0,r.f)("oauthModal"),{copied:m,copy:x}=(0,l.f)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"text-center py-4",children:[(0,t.jsx)("p",{className:"text-sm text-text-muted mb-4",children:u("deviceCodeVisitUrl")}),(0,t.jsxs)("div",{className:"bg-sidebar p-4 rounded-lg mb-4",children:[(0,t.jsx)("p",{className:"text-xs text-text-muted mb-1",children:u("deviceCodeVerificationUrl")}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("a",{href:s,target:"_blank",rel:"noreferrer",className:"flex-1 text-sm break-all text-primary hover:underline",children:s}),(0,t.jsx)(i.default,{size:"sm",variant:"ghost",icon:"verify_url"===m?"check":"content_copy",onClick:()=>x(s,"verify_url")})]})]}),(0,t.jsxs)("div",{className:"bg-primary/10 p-4 rounded-lg",children:[(0,t.jsx)("p",{className:"text-xs text-text-muted mb-1",children:u("deviceCodeYourCode")}),(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,t.jsx)("p",{className:"text-2xl font-mono font-bold text-primary",children:e.user_code}),(0,t.jsx)(i.default,{size:"sm",variant:"ghost",icon:"user_code"===m?"check":"content_copy",onClick:()=>x(e.user_code,"user_code")})]}),null!==a&&(0,t.jsxs)("div",{className:"mt-3 flex items-center justify-center gap-1 text-xs text-text-muted","aria-label":u("deviceCodeWaiting"),children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-sm",children:"schedule"}),(0,t.jsx)("span",{children:(d=Math.floor((c=Math.max(0,Math.floor(a)))/60),`${d}:${String(c%60).padStart(2,"0")}`)})]})]})]}),n&&(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2 text-sm text-text-muted",children:[(0,t.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),u("deviceCodeWaiting")]})]})}function c({providerName:e,hint:s,onClose:a}){let o=(0,r.f)("oauthModal"),{copied:d,copy:u}=(0,l.f)(),m=[{key:"cmd",body:o("loopbackMismatchStep1"),value:s.tunnelCommand,copyId:"tunnel_cmd",note:o("loopbackMismatchStep1Note",{userPlaceholder:"<user>"})},{key:"url",body:o("loopbackMismatchStep2"),value:s.localDashboardUrl,copyId:"local_url",note:null},{key:"retry",body:o("loopbackMismatchStep3",{providerName:e}),value:null,copyId:null,note:null}];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)("div",{className:"size-10 shrink-0 rounded-full bg-amber-500/15 flex items-center justify-center",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-xl text-amber-500",children:"lan"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-base font-semibold",children:o("loopbackMismatchTitle")}),(0,t.jsxs)("p",{className:"text-xs text-text-muted mt-0.5 font-mono",children:[s.dashboardHost,":",s.dashboardPort]})]})]}),(0,t.jsxs)("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/10 p-3",children:[(0,t.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wide text-amber-500 mb-1",children:o("loopbackMismatchWhatHappened")}),(0,t.jsx)("p",{className:"text-sm text-text-muted",children:o.rich("loopbackMismatchExplanation",{providerName:e,redirectUri:s.redirectUri,code:e=>(0,t.jsx)("code",{className:"font-mono text-xs",children:e})})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium mb-2",children:o("loopbackMismatchHowToFix")}),(0,t.jsx)("ol",{className:"space-y-3",children:m.map((e,s)=>(0,t.jsxs)("li",{className:"flex gap-3",children:[(0,t.jsx)("span",{className:"size-5 shrink-0 mt-0.5 rounded-full bg-primary/15 text-primary text-xs font-semibold flex items-center justify-center",children:s+1}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("p",{className:"text-sm",children:e.body}),e.value&&(0,t.jsxs)("div",{className:"flex gap-2 mt-1.5",children:[(0,t.jsx)(n.default,{value:e.value,readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,t.jsx)(i.default,{variant:"secondary",icon:d===e.copyId?"check":"content_copy",onClick:()=>u(e.value,e.copyId),children:o("copy")})]}),e.note&&(0,t.jsx)("p",{className:"text-xs text-text-muted mt-1",children:e.note})]})]},e.key))})]}),(0,t.jsx)("p",{className:"text-xs text-text-muted",children:o("loopbackMismatchAlternative")})]}),(0,t.jsx)("div",{className:"flex gap-2",children:(0,t.jsx)(i.default,{onClick:a,variant:"secondary",fullWidth:!0,children:o("cancel")})})]})}function d({hint:e}){let s=(0,r.f)("oauthModal"),{copied:a,copy:o}=(0,l.f)(),c=(e,s)=>(0,t.jsxs)("div",{className:"flex gap-2 mt-1.5",children:[(0,t.jsx)(n.default,{value:e,readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,t.jsx)(i.default,{size:"sm",variant:"secondary",icon:a===s?"check":"content_copy",onClick:()=>o(e,s)})]});return(0,t.jsxs)("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/10 p-3 space-y-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{className:"text-sm font-semibold text-amber-500",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-sm align-middle mr-1",children:"warning"}),s("googleLoopbackTitle")]}),(0,t.jsx)("p",{className:"text-xs text-text-muted mt-1",children:s.rich("googleLoopbackWhatHappens",{redirectUri:e.redirectUri,code:e=>(0,t.jsx)("code",{className:"font-mono",children:e})})})]}),e.helperCommand&&(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-xs font-medium",children:s("googleLoopbackRecommended")}),c(e.helperCommand,"google_helper"),(0,t.jsx)("p",{className:"text-xs text-text-muted mt-1",children:s("googleLoopbackHelperNote")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-xs font-medium",children:s("googleLoopbackTunnelLabel")}),c(e.tunnelCommand,"google_tunnel"),(0,t.jsx)("p",{className:"text-xs text-text-muted mt-1",children:s("googleLoopbackTunnelNote",{userPlaceholder:"<user>",localUrl:e.localDashboardUrl})})]}),(0,t.jsx)("p",{className:"text-xs text-text-muted",children:s("googleLoopbackHeadlessAlt")})]})}function u({isGoogleOAuth:e,isTrueLocalhost:s,googleHint:a}){let i=(0,r.f)("oauthModal");return s?null:e&&a?(0,t.jsx)(d,{hint:a}):(0,t.jsxs)("div",{className:"rounded-lg border border-blue-500/30 bg-blue-500/10 p-3 text-xs text-blue-200",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-sm align-middle mr-1",children:"info"}),i("remoteAccessInfo")]})}function m({provider:e,isGoogleOAuth:s,isTrueLocalhost:a,googleHint:o,authUrl:c,callbackUrl:d,placeholderUrl:x,canSubmit:p,onCallbackUrlChange:h,onSubmit:f,onClose:b}){let g=(0,r.f)("oauthModal"),{copied:y,copy:v}=(0,l.f)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(u,{isGoogleOAuth:s,isTrueLocalhost:a,googleHint:o}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium mb-2",children:g("step1OpenUrl")}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(n.default,{value:c,readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,t.jsx)(i.default,{variant:"secondary",icon:"auth_url"===y?"check":"content_copy",onClick:()=>v(c,"auth_url"),children:g("copy")})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium mb-2",children:g("step2PasteCallback")}),(0,t.jsx)("p",{className:"text-xs text-text-muted mb-2",children:g.rich("step2Hint",{code:e=>(0,t.jsx)("code",{className:"font-mono",children:e})})}),(0,t.jsx)(n.default,{value:d,onChange:e=>h(e.target.value),placeholder:"claude"===e||"cline"===e?"code#state or /callback?code=...":x,className:"font-mono text-xs"})]})]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(i.default,{onClick:f,fullWidth:!0,disabled:!p,children:g("connect")}),(0,t.jsx)(i.default,{onClick:b,variant:"ghost",fullWidth:!0,children:g("cancel")})]})]})}async function x(e){let t=await e.text();if(!t)return null;try{return JSON.parse(t)}catch{return t}}function p(e,t,s="Request failed"){if(e&&"object"==typeof e){let t=e.error;if("string"==typeof t&&t.trim())return t;if(t&&"object"==typeof t){let e=t.message;return"string"==typeof e&&e.trim()?e:JSON.stringify(t)}let s=e.message??e.detail;if("string"==typeof s&&s.trim())return s}return"string"==typeof e&&e.trim()?e.length>300?`${e.slice(0,300)}…`:e:null!=t?`${s} (HTTP ${t})`:s}var h=e.i(467034);function f(e){return"string"==typeof e&&e.trim().startsWith("trouteai-cred-v1.")}async function b(e,t,s,r,a){let i=await fetch(`/api/oauth/${e}/paste-credentials`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({blob:t.trim(),connectionId:s?.id})}),n=await x(i);if(!i.ok)throw Error(p(n,i.status,"Failed to import credentials"));r("success"),a?.()}function g(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:null}function y(e){return"string"==typeof e&&e.trim()?e.trim():void 0}function v({gheUrl:e,setGheUrl:s,error:r,setError:a,startOAuthFlow:l}){return(0,t.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,t.jsxs)("p",{className:"text-sm text-text-muted",children:["Enter the base URL of your GitHub Enterprise instance (e.g."," ",(0,t.jsx)("code",{className:"font-mono",children:"https://ghe.yourcompany.com"}),")."]}),(0,t.jsx)(n.default,{value:e,onChange:e=>s(e.target.value),placeholder:"https://ghe.yourcompany.com",label:"GitHub Enterprise URL",type:"url"}),(0,t.jsx)(i.default,{onClick:()=>{e.trim()?l():a("GitHub Enterprise URL is required")},fullWidth:!0,disabled:!e.trim(),children:"Connect"}),r&&(0,t.jsx)("p",{className:"text-sm text-red-500",children:r})]})}let j=/https?:\/\/[^\s"'<>)]+/g;function N({text:e}){return(0,t.jsx)(t.Fragment,{children:(function(e){let t;if(!e)return[];let s=[],r=0;for(j.lastIndex=0;null!==(t=j.exec(e));){t.index>r&&s.push({text:e.slice(r,t.index)});let a=t[0],i="";for(;a.length>0&&/[.,;:!?]$/.test(a);)i=a.slice(-1)+i,a=a.slice(0,-1);let n=function(e){let t;try{t=new URL(e).protocol}catch{return}return"http:"===t||"https:"===t?e:void 0}(a);s.push(n?{text:a,href:n}:{text:a}),i&&s.push({text:i}),r=t.index+t[0].length}return r<e.length&&s.push({text:e.slice(r)}),s})(e||"").map((e,r)=>e.href?(0,t.jsx)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"underline break-all",children:e.text},r):(0,t.jsx)(s.Fragment,{children:e.text},r))})}var k=e.i(282225);function w({onContinue:e,onClose:s}){return(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"rounded-md border border-border bg-muted/40 px-3 py-3 text-left",children:[(0,t.jsx)("p",{className:"text-sm font-medium mb-2",children:"GitLab Duo OAuth setup"}),(0,t.jsx)("p",{className:"text-sm text-text-muted leading-relaxed",children:(0,t.jsx)(N,{text:k.f})})]}),(0,t.jsx)("p",{className:"text-xs text-text-muted",children:"After the application is registered and the env vars are set on this TRouteAI instance, click Continue to start the OAuth login."}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(i.default,{onClick:e,fullWidth:!0,children:"Continue"}),(0,t.jsx)(i.default,{onClick:s,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}function S({error:e,errorTitle:s,tryAgainLabel:r,cancelLabel:a,returnToGitlabDuoSetup:n,onReturnToGitlabDuoSetup:l,onTryAgain:o,onClose:c}){return(0,t.jsxs)("div",{className:"text-center py-6",children:[(0,t.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),(0,t.jsx)("h3",{className:"text-lg font-semibold mb-2",children:s}),(0,t.jsx)("p",{className:"text-sm text-red-600 mb-4",children:(0,t.jsx)(N,{text:e})}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(i.default,{onClick:()=>{n?l():o()},variant:"secondary",fullWidth:!0,children:r}),(0,t.jsx)(i.default,{onClick:c,variant:"ghost",fullWidth:!0,children:a})]})]})}function C({waitingLabel:e,completeAuthLabel:s,popupClosedHint:r,popupBlockedLabel:a,onManualInput:n}){return(0,t.jsxs)("div",{className:"text-center py-6",children:[(0,t.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,t.jsx)("h3",{className:"text-lg font-semibold mb-2",children:e}),(0,t.jsx)("p",{className:"text-sm text-text-muted mb-2",children:s}),(0,t.jsx)("p",{className:"text-xs text-text-muted mb-4 opacity-70",children:r}),(0,t.jsx)(i.default,{variant:"ghost",onClick:n,children:a})]})}function T(e){return e.port?e.port:"https:"===e.protocol?"443":"80"}function I(e,t){let s=[...new Set(e)];return`ssh ${s.map(e=>`-L ${e}:127.0.0.1:${e}`).join(" ")} <user>@${t}`}let M={codex:"http://localhost:1455/auth/callback","xai-oauth":"http://127.0.0.1:56121/callback","grok-cli":"http://127.0.0.1:56122/callback"},_={codex:1455,"xai-oauth":56121,"grok-cli":56122},E=new Set(["antigravity","agy"]),K=new Set(["codex","xai-oauth","grok-cli"]),A=new Set(["github","kiro","amazon-q","kimi-coding","kilocode","codebuddy-cn","ghe-copilot","grok-cli"]),D=new Set(["windsurf","devin-cli","grok-cli"]),L=new Set(["windsurf","devin-cli"]);async function $(e,t,s,r){let a=await fetch("/api/oauth/codex/import-token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accessToken:e,name:t})}),i=await x(a);if(!a.ok)throw Error(p(i,a.status,"Failed to import access token"));s("success"),r?.()}function P(e,t){return Math.max(1,Number(e)||t)}async function O(e,t){try{let s=await fetch(`/api/oauth/${e}/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),r=await x(s);if(r.success)return{status:"success"};if("slow_down"===r.error)return{status:"slow_down"};if(r.error&&!r.pending)return{status:"error",message:String(r.errorDescription||r.error)};return{status:"pending"}}catch(e){return{status:"error",message:e instanceof Error?e.message:"Authorization failed"}}}e.s(["f",0,function({isOpen:e,provider:l,providerInfo:d,onSuccess:u,onClose:j,idcConfig:N,reauthConnection:k}){let R,z=(0,r.f)("oauthModal"),[F,U]=(0,s.useState)("waiting"),[q,W]=(0,s.useState)(null),[J,B]=(0,s.useState)(""),[H,G]=(0,s.useState)(null),[V,Y]=(0,s.useState)(!1),[X,Q]=(0,s.useState)(null),[Z,ee]=(0,s.useState)(""),[et,es]=(0,s.useState)(!1),[er,ea]=(0,s.useState)(null),[ei,en]=(0,s.useState)(null),[el,eo]=(0,s.useState)(L.has(l)),[ec,ed]=(0,s.useState)(""),[eu,em]=(0,s.useState)(!1),[ex,ep]=(0,s.useState)(!1),[eh,ef]=(0,s.useState)(null),eb=D.has(l),eg=L.has(l),ey=(0,s.useRef)(null),ev=(0,s.useRef)(0),ej=X?.verification_uri_complete||X?.verification_uri||"",{isLocalhost:eN,isTrueLocalhost:ek,placeholderUrl:ew,loopbackLocation:eS}=(0,s.useMemo)(()=>{let e=window.location.hostname;return{isLocalhost:"localhost"===e||"127.0.0.1"===e||e.startsWith("192.168.")||e.startsWith("10.")||/^172\.(1[6-9]|2\d|3[01])\./.test(e),isTrueLocalhost:"localhost"===e||"127.0.0.1"===e,placeholderUrl:`${window.location.origin}/callback?code=...`,loopbackLocation:{hostname:e,port:window.location.port,protocol:window.location.protocol}}},[]),eC=(0,s.useRef)(!1),eT=(0,s.useRef)(!1),eI=(0,s.useCallback)(()=>{ev.current+=1,es(!1),ea(null),en(null)},[]),eM=(0,s.useCallback)(async(e,t)=>{if(q)try{if(!q.redirectUri||!q.codeVerifier)throw Error("OAuth session is incomplete (missing redirect URI or code verifier). Restart the connection and try again.");let s="string"==typeof t&&t.length>0?t:void 0,r=await fetch(`/api/oauth/${l}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:e,redirectUri:q.redirectUri,connectionId:k?.id,codeVerifier:q.codeVerifier,...s?{state:s}:{}})}),a=await x(r);if(!r.ok){let e="object"==typeof a.error&&null!==a.error?a.error:null,t=e?e.message||JSON.stringify(e):a.error||"Exchange failed",s=Array.isArray(e?.details)?e.details.map(e=>e?.message?e.field?`${e.field}: ${e.message}`:e.message:null).filter(Boolean).join("; "):"";throw Error(s?`${t} (${s})`:t)}U("success"),u?.()}catch(e){e.message?.toLowerCase().includes("redirect_uri_mismatch")&&E.has(l)?G("redirect_uri_mismatch: The default Google OAuth credentials only work on localhost. For remote use, configure your own OAuth credentials via environment variables: ANTIGRAVITY_OAUTH_CLIENT_ID and ANTIGRAVITY_OAUTH_CLIENT_SECRET. See the README section 'OAuth on a Remote Server'."):G(e.message),U("error")}},[q,l,u,k]),e_=(0,s.useCallback)(async()=>{let e=ec.trim();if(e&&l){em(!0),G(null);try{let t=e;if("grok-cli"===l){let s=function(e){let t=e.trim();if(!t)return{ok:!1,error:"Paste the full contents of ~/.grok/auth.json"};if(t.startsWith("{"))try{let e=JSON.parse(t);if(!e||"object"!=typeof e||Array.isArray(e))return{ok:!1,error:"auth.json must be a JSON object from ~/.grok/auth.json"};let s=!1,r=!1;for(let t of Object.values(e))if(t&&"object"==typeof t&&("string"==typeof t.key&&t.key.startsWith("eyJ")&&(s=!0,"string"==typeof t.refresh_token&&t.refresh_token.length>0)||"string"==typeof t.access_token&&t.access_token.startsWith("eyJ")&&(s=!0,"string"==typeof t.refresh_token&&t.refresh_token.length>0))){r=!0;break}if(!s)return{ok:!1,error:'Could not find a Grok Build JWT ("key") in the pasted auth.json. Run `grok login` and paste the full file.'};if(!r)return{ok:!1,error:"auth.json is missing refresh_token. Re-run `grok login` and paste the full ~/.grok/auth.json so the connection can auto-refresh (#7610)."};return{ok:!0,token:e}}catch{return{ok:!1,error:"Could not parse auth.json. Paste the full JSON from ~/.grok/auth.json."}}return t.startsWith("eyJ")?{ok:!1,error:'Do not paste only the JWT "key" field. Paste the full ~/.grok/auth.json object so refresh_token is included (#7610).'}:{ok:!1,error:"Paste the full contents of ~/.grok/auth.json (JSON object)."}}(e);if(!1===s.ok)return void G(s.error);t=s.token}let s=await fetch(`/api/oauth/${l}/import-token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t,connectionId:k?.id})}),r=await x(s);if(!s.ok){let e=p(r,s.status,"Save failed");throw Error(e)}U("success"),u?.()}catch(e){G(e.message)}finally{em(!1)}}},[ec,l,u,k]),eE=(0,s.useCallback)(async(e,t,s,r,a)=>{let i=++ev.current,n=P(s,5),o=P(r,60*n),c=Date.now()+1e3*o,d=n;for(es(!0),ea(c);Date.now()<c&&(await new Promise(e=>setTimeout(e,1e3*d)),!(i!==ev.current||Date.now()>=c));){let s=await O(l,{deviceCode:e,connectionId:k?.id,codeVerifier:t,extraData:a});if(i!==ev.current)return;if("success"===s.status){U("success"),es(!1),ea(null),u?.();return}if("slow_down"===s.status){d=Math.min(d+5,30);continue}if("error"===s.status){G(s.message),U("error"),es(!1),ea(null);return}}i===ev.current&&(G("Authorization timeout"),U("error"),es(!1),ea(null))},[l,u,k]),eK=(0,s.useCallback)(async e=>{if(l)try{let t;G(null);let s="grok-cli"===l&&(e?.grokBrowser??ex);if(A.has(l)&&!s){if(eI(),Y(!0),Q(null),U("waiting"),"ghe-copilot"===l&&!Z.trim())return void U("ghe-config");let e=new URL(`/api/oauth/${l}/device-code`,window.location.origin);("kiro"===l||"amazon-q"===l)&&N&&"object"==typeof N&&("string"==typeof N.startUrl&&N.startUrl.trim()&&e.searchParams.set("startUrl",N.startUrl.trim()),"string"==typeof N.region&&N.region.trim()&&e.searchParams.set("region",N.region.trim())),"ghe-copilot"===l&&Z.trim()&&e.searchParams.set("gheUrl",Z.trim());let t=await fetch(e.toString()),s=await x(t);if(!t.ok){let e=p(s,t.status,"Request failed");throw Error(e)}Q(s);let r=s.verification_uri_complete||s.verification_uri;"string"==typeof r&&r&&window.open(r,"oauth_verify");let a="kiro"===l||"amazon-q"===l?{_clientId:s._clientId,_clientSecret:s._clientSecret,_region:s._region}:"ghe-copilot"===l&&Z.trim()?{gheUrl:Z.trim()}:null;eE(s.device_code,s.codeVerifier,s.interval||5,s.expires_in,a);return}let r=!1;if(("claude"===l||"cline"===l||"zed-hosted"===l)&&(r=!0),K.has(l)){if(ek)try{let e=await fetch(`/api/oauth/${l}/start-callback-server`),t=await x(e);if(!e.ok)throw Error(p(t,e.status,"Failed to start callback server"));W({...t,redirectUri:t.redirectUri}),U("waiting"),ey.current=window.open(t.authUrl,"oauth_auth"),ey.current||U("input"),es(!0);for(let e=0;e<150;e++){await new Promise(e=>setTimeout(e,2e3));let e=await fetch(`/api/oauth/${l}/poll-callback`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({connectionId:k?.id})}),t=await x(e);if(t.success){U("success"),es(!1),u?.();return}if(t.error&&!t.pending)throw Error(t.errorDescription||t.error)}throw es(!1),Error("Authorization timeout")}catch(e){console.warn(`${l} callback server failed, falling back to manual flow`,e),es(!1),r=!0}else if(eN){let e,t,s;ef((e=T(eS),t=_[l]??null,s=[e],null!=t&&String(t)!==e&&s.push(String(t)),{provider:l,redirectUri:M[l]??"a fixed localhost callback URL",callbackPort:t,dashboardPort:e,dashboardHost:eS.hostname,tunnelCommand:I(s,eS.hostname),localDashboardUrl:`http://localhost:${e}`})),U("loopback-mismatch");return}}if("codex"===l||"openai"===l)t="http://localhost:1455/auth/callback";else if("xai-oauth"===l||"grok-cli"===l){let e="xai-oauth"===l?56121:56122;t=`http://127.0.0.1:${e}/callback`}else if("windsurf"===l||"devin-cli"===l){let e=window.location.port||"20017";t=`http://localhost:${e}/auth/callback`}else if(E.has(l)){let e=window.location.port||"20017";t=`http://127.0.0.1:${e}/callback`}else if(eN){let e=window.location.port||("https:"===window.location.protocol?"443":"80");t=`http://localhost:${e}/callback`}else{let e=window.location.origin;t=`${e}/callback`}let a=await fetch(`/api/oauth/${l}/authorize?redirect_uri=${encodeURIComponent(t)}`),i=await x(a);if(!a.ok){let e=p(i,a.status,"Authorization failed");throw Error(e)}if(!i.authUrl)throw Error(i.error||"Browser OAuth is unavailable for this provider in the current environment. Use the supported auth method instead.");W({...i,redirectUri:i.redirectUri||t}),!ek||r?(U("input"),window.open(i.authUrl,"oauth_auth")):(U("waiting"),ey.current=window.open(i.authUrl,"oauth_popup","width=600,height=700"),ey.current||U("input"))}catch(e){G(e.message),U("error")}},[l,eN,ek,eS,eE,u,k,N,Z,eI,ex]);(0,s.useEffect)(()=>{if(!er)return void en(null);let e=()=>{en(Math.max(0,Math.ceil((er-Date.now())/1e3)))};e();let t=window.setInterval(e,1e3);return()=>window.clearInterval(t)},[er]),(0,s.useEffect)(()=>{eI(),eT.current=!1,ep(!1)},[l,eI]),(0,s.useEffect)(()=>{e||(eI(),eT.current=!1)},[e,eI]),(0,s.useEffect)(()=>()=>{ev.current+=1},[]),(0,s.useEffect)(()=>{if(!e||!l||eT.current)return;eT.current=!0;let t=L.has(l),s="gitlab-duo"===l;(eo(t),ep(!1),W(null),B(""),G(null),Y(!1),Q(null),es(!1),s)?U("gitlab-duo-setup"):t||eK()},[e,l,eK]),(0,s.useEffect)(()=>{let e;if(!q)return;eC.current=!1;let t=async e=>{if(eC.current)return;let{code:t,state:s,error:r,errorDescription:a}=e;if(q?.state&&s&&s!==q.state){eC.current=!0,G("OAuth state mismatch. Restart the connection and try again."),U("error");return}if(r){eC.current=!0,G(a||r),U("error");return}t&&(eC.current=!0,await eM(t,s))},s=e=>{let s=window.location.port,r=!1,a=!1;try{let t=new URL(e.origin);a=(r=/^(localhost|127\.0\.0\.1|\[::1\]|::1)$/i.test(t.hostname))&&t.port===s}catch{}let i=e.data?.data,n=!!q?.state&&i?.state===q.state,o=E.has(l)&&r&&n;(e.origin===window.location.origin||a||o)&&e.data?.type==="oauth_callback"&&t(i)};window.addEventListener("message",s);try{(e=new BroadcastChannel("oauth_callback")).onmessage=e=>t(e.data)}catch(e){console.log("BroadcastChannel not supported")}let r=e=>{if("oauth_callback"===e.key&&e.newValue)try{let s=JSON.parse(e.newValue);t(s),localStorage.removeItem("oauth_callback")}catch(e){console.log("Failed to parse localStorage data")}};window.addEventListener("storage",r);try{let e=localStorage.getItem("oauth_callback");if(e){let s=JSON.parse(e);s.timestamp&&Date.now()-s.timestamp<3e4&&(t(s),localStorage.removeItem("oauth_callback"))}}catch{}return()=>{window.removeEventListener("message",s),window.removeEventListener("storage",r),e&&e.close()}},[q,eM,l]),(0,s.useEffect)(()=>{if("waiting"!==F||V||!ey.current)return;let e=setInterval(()=>{if(eC.current)return void clearInterval(e);try{ey.current?.closed&&(clearInterval(e),"waiting"===F&&U("input"))}catch{}},1e3),t=setTimeout(()=>{eC.current||"waiting"!==F||(clearInterval(e),U("input"))},3e5);return()=>{clearInterval(e),clearTimeout(t)}},[F,V]);let eA=async()=>{try{if(G(null),f(J))return void await b(l,J,k,U,u);if("codex"===l&&/^eyJ/.test(J.trim()))return void await $(J.trim(),void 0,U,u);if("codex"===l&&function(e){let t="string"==typeof e?e.trim():"";if(!t.startsWith("{"))return!1;try{return null!==g(JSON.parse(t))}catch{return!1}}(J)){let e=function(e){let t=g(e);if(!t)return{ok:!1,error:"Pasted session data is not a JSON object"};let s=function(e){let t=y(e.accessToken)||y(e.access_token)||y(e.sessionToken)||y(e.session_token);if(t)return t;let s=g(e.tokens);if(s)return y(s.access_token)||y(s.accessToken)}(t);if(!s)return{ok:!1,error:"Could not find an access token field in the pasted session JSON (expected accessToken, access_token, sessionToken, or tokens.access_token)"};if(3!==s.split(".").length)return{ok:!1,error:"The access token field does not look like a valid JWT"};if(function(e,t){let s,r,a=y(e.expires);if(a){let e=Date.parse(a);if(Number.isFinite(e)&&e<=Date.now())return!0}let i=null!==(r=(s=function(e){try{if(!e||"string"!=typeof e)return null;let t=e.split(".");if(3!==t.length)return null;let s=t[1].replace(/-/g,"+").replace(/_/g,"/"),r=(4-s.length%4)%4,a=s+"=".repeat(r);return JSON.parse(h.Buffer.from(a,"base64").toString("utf8"))}catch{return null}}(t))&&"number"==typeof s.exp?s.exp:null)&&Number.isFinite(r)?r:null;return null!==i&&1e3*i<=Date.now()}(t,s))return{ok:!1,error:"Session is expired — sign in to chatgpt.com again and re-copy the session JSON"};let r=g(t.user);return{ok:!0,session:{accessToken:s,email:r&&y(r.email)||void 0}}}(JSON.parse(J.trim()));if(!1===e.ok)return void G(e.error);await $(e.session.accessToken,e.session.email,U,u);return}if(!q)throw Error("OAuth session not initialized. Restart the connection flow and try again.");let e=J.trim(),t=null,s=q?.state||null,r=null,a=null;try{let i=new URL(e);t=i.searchParams.get("code"),s=i.searchParams.get("state")||i.hash.replace(/^#/,"")||s,r=i.searchParams.get("error"),a=i.searchParams.get("error_description")}catch{let[r,a]=e.split("#",2);t=r||null,s=a||s}if(r)throw Error(a||r);if(!t)throw Error("No authorization code found. Paste the callback URL or the Authentication Code.");await eM(t,s)}catch(e){G(e.message),U("error")}},eD=(0,s.useCallback)(()=>{eI(),j()},[eI,j]),eL=(0,s.useCallback)(()=>{eI(),eo(!0)},[eI]),e$=(0,s.useCallback)(()=>{eo(!1),"grok-cli"===l&&ep(!0),eK("grok-cli"===l?{grokBrowser:!0}:void 0)},[eK,l]),eP=(0,s.useCallback)(()=>{eo(!1),ep(!1),eK({grokBrowser:!1})},[eK]);return l&&d?(0,t.jsx)(a.default,{isOpen:e,title:z("title",{providerName:d.name}),onClose:eD,size:"lg",children:(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[eb&&!eg&&"success"!==F&&(0,t.jsxs)("div",{className:"flex gap-2 border-b border-border pb-3",children:["grok-cli"===l&&(0,t.jsx)("button",{className:`text-sm px-3 py-1 rounded-t ${!el&&!ex?"font-semibold border-b-2 border-primary text-primary":"text-text-muted"}`,onClick:eP,children:"Device Code"}),(0,t.jsx)("button",{className:`text-sm px-3 py-1 rounded-t ${!el&&("grok-cli"!==l||ex)?"font-semibold border-b-2 border-primary text-primary":"text-text-muted"}`,onClick:e$,children:"Browser Login"}),(0,t.jsx)("button",{className:`text-sm px-3 py-1 rounded-t ${el?"font-semibold border-b-2 border-primary text-primary":"text-text-muted"}`,onClick:eL,children:"grok-cli"===l?"Import auth.json":"Paste API Key"})]}),eb&&el&&"success"!==F&&(0,t.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,t.jsx)("p",{className:"text-sm text-text-muted",children:"windsurf"===l?'In the Windsurf / VS Code IDE, run the "Windsurf: Provide Auth Token" command from the command palette (or click the Jupyter "Get Windsurf Authentication Token" button), then copy the shown token and paste it below. Opening windsurf.com/show-auth-token directly only shows a "Redirecting" page — the IDE must initiate the flow.':"grok-cli"===l?'Paste the FULL contents of ~/.grok/auth.json (not just the JWT "key" field). A bare JWT has no refresh_token, so the connection dies after expiry (#7610). Prefer the dedicated Import auth.json modal when available.':'Provide your WINDSURF_API_KEY (obtained via `devin auth login`, or via the Windsurf IDE "Windsurf: Provide Auth Token" command).'}),"grok-cli"===l?(0,t.jsx)("textarea",{className:"w-full h-32 p-3 text-sm font-mono bg-input border border-border rounded-md resize-none focus:outline-none focus:ring-2 focus:ring-primary",value:ec,onChange:e=>ed(e.target.value),placeholder:'{"https://auth.x.ai::clientId": {"key": "eyJ...", "refresh_token": "..."}}',"aria-label":"Grok Build auth.json"}):(0,t.jsx)(n.default,{value:ec,onChange:e=>ed(e.target.value),placeholder:"ws-...",type:"password",label:"API Key / Token"}),H&&(0,t.jsx)("p",{className:"text-sm text-red-500",children:H}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(i.default,{onClick:e_,fullWidth:!0,disabled:!ec.trim()||eu,children:eu?"Saving…":"Save Connection"}),(0,t.jsx)(i.default,{onClick:eD,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),(!eb||!el)&&(0,t.jsxs)(t.Fragment,{children:["ghe-copilot"===l&&"ghe-config"===F&&(0,t.jsx)(v,{gheUrl:Z,setGheUrl:ee,error:H,setError:G,startOAuthFlow:eK}),"gitlab-duo"===l&&"gitlab-duo-setup"===F&&(0,t.jsx)(w,{onContinue:()=>void eK(),onClose:eD}),"waiting"===F&&!V&&(0,t.jsx)(C,{waitingLabel:z("waiting"),completeAuthLabel:z("completeAuthInPopup"),popupClosedHint:z("popupClosedHint"),popupBlockedLabel:z("popupBlocked"),onManualInput:()=>U("input")}),"waiting"===F&&V&&X&&(0,t.jsx)(o,{deviceData:X,verificationUrl:ej,secondsRemaining:ei,polling:et}),"input"===F&&!V&&(0,t.jsx)(m,{provider:l,isGoogleOAuth:E.has(l),isTrueLocalhost:ek,googleHint:E.has(l)?(R=T(eS),{provider:l,redirectUri:`http://127.0.0.1:${R}/callback`,dashboardHost:eS.hostname,dashboardPort:R,tunnelCommand:I([R],eS.hostname),localDashboardUrl:`http://localhost:${R}`,helperCommand:null}):null,authUrl:"string"==typeof q?.authUrl?q.authUrl:"",callbackUrl:J,placeholderUrl:ew,canSubmit:!!(J&&(q||f(J))),onCallbackUrlChange:B,onSubmit:eA,onClose:eD})]}),"success"===F&&(0,t.jsxs)("div",{className:"text-center py-6",children:[(0,t.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,t.jsx)("h3",{className:"text-lg font-semibold mb-2",children:z("success")}),(0,t.jsx)("p",{className:"text-sm text-text-muted mb-4",children:z("successMessage",{providerName:d.name})}),(0,t.jsx)(i.default,{onClick:eD,fullWidth:!0,children:z("done")})]}),"loopback-mismatch"===F&&eh&&!el&&(0,t.jsx)(c,{providerName:d.name,hint:eh,onClose:eD}),"error"===F&&!el&&(0,t.jsx)(S,{error:H,errorTitle:z("error"),tryAgainLabel:z("tryAgain"),cancelLabel:z("cancel"),returnToGitlabDuoSetup:"gitlab-duo"===l,onReturnToGitlabDuoSetup:()=>{G(null),U("gitlab-duo-setup")},onTryAgain:()=>void eK(),onClose:eD})]})}):null}],964039)},110626,e=>{"use strict";e.i(843476),e.i(156132),e.s([])},16190,474078,11477,339971,961430,148943,e=>{"use strict";e.s(["default",()=>p],16190);var t=e.i(843476),s=e.i(593976),r=e.i(271645),a=e.i(948148);e.i(565650);var i=e.i(342923);e.s(["f",()=>i.default],474078);var i=i,n=e.i(393718);e.s(["f",()=>n.default],11477);var n=n,l=e.i(80173);e.s(["f",()=>l.default],339971);var l=l,o=e.i(907714);e.s(["f",()=>o.default],961430);var o=o,c=e.i(635055);e.s(["f",()=>c.default],148943);var c=c;let d=["none","low","medium","high","xhigh"],u=["max","ultra"];function m(e){return{name:"",description:"",scope:e?"apiKey":"global",apiKeyId:e||"",comboId:"",connectionId:"",modelPattern:"",sourceEffort:"any",requestTags:"",tagMatchMode:"any",effortMode:"inherit",targetEffort:"medium",targetKind:"keep",targetModel:"",targetComboId:"",budgetAction:"preserve",budgetTokens:"",priority:"0",enabled:!0}}function x(e,t){let s=e.trim().toLowerCase().replace(/^(?:codex|cx)\//,"");return"ultra"===t?/^gpt-5\.6-(?:sol|terra)(?:-|$)/.test(s):/^gpt-5\.6-(?:sol|terra|luna)(?:-|$)/.test(s)}function p({apiKeyId:e}){let h=(0,a.f)("reasoningRouting"),[f,b]=(0,r.useState)([]),[g,y]=(0,r.useState)([]),[v,j]=(0,r.useState)([]),[N,k]=(0,r.useState)([]),[w,S]=(0,r.useState)(()=>m(e)),[C,T]=(0,r.useState)(null),[I,M]=(0,r.useState)(!1),[_,E]=(0,r.useState)(""),[K,A]=(0,r.useState)("all"),[D,L]=(0,r.useState)("all"),[$,P]=(0,r.useState)(""),[O,R]=(0,r.useState)({model:"",effort:"missing",requestTags:"",transport:"http"}),[z,F]=(0,r.useState)(null),U=(0,r.useCallback)(async()=>{let e=await Promise.all([fetch("/api/settings/reasoning-routing-rules"),fetch("/api/combos"),fetch("/api/keys"),fetch("/api/providers")]);if(e.some(e=>!e.ok))throw Error(h("loadError"));let[t,s,r,a]=await Promise.all(e.map(e=>e.json()));b(Array.isArray(t.rules)?t.rules:[]),y(Array.isArray(s.combos)?s.combos:[]),j(Array.isArray(r.keys)?r.keys:[]),k(Array.isArray(a.connections)?a.connections:[])},[h]);(0,r.useEffect)(()=>{U().catch(()=>E(h("loadError")))},[U,h]);let q=(0,r.useMemo)(()=>{let t=$.trim().toLowerCase();return f.filter(s=>(!e||"apiKey"===s.scope&&s.apiKeyId===e)&&(!!e||"all"===K||s.scope===K)&&("enabled"!==D||!!s.enabled)&&("disabled"!==D||!s.enabled)&&(!t||[s.name,s.description,s.modelPattern,...s.requestTags].filter(Boolean).some(e=>String(e).toLowerCase().includes(t))))},[e,f,K,$,D]),W="model"===w.targetKind?w.targetModel:w.modelPattern,J=(0,r.useMemo)(()=>{let e=[...d];for(let t of u)(x(W,t)||w.targetEffort===t)&&e.push(t);return e.map(e=>({value:e,label:e}))},[w.targetEffort,W]),B=(0,r.useMemo)(()=>"inherit"!==w.effortMode&&u.includes(w.targetEffort)?"combo"===w.targetKind?h("extendedComboWarning"):W.trim()?x(W,w.targetEffort)?"":h("extendedUnsupportedWarning"):h("extendedUnknownWarning"):"",[w.effortMode,w.targetEffort,w.targetKind,h,W]),H=()=>{T(null),S(m(e))},G=async()=>{M(!0),E("");try{let e,t=await fetch(C?`/api/settings/reasoning-routing-rules/${encodeURIComponent(C)}`:"/api/settings/reasoning-routing-rules",{method:C?"PATCH":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify((e="connection"===w.scope?"keep":w.targetKind,{...w,apiKeyId:"apiKey"===w.scope&&w.apiKeyId||null,comboId:"combo"===w.scope&&w.comboId||null,connectionId:"connection"===w.scope&&w.connectionId||null,modelPattern:("model"===w.scope||"apiKey"===w.scope)&&w.modelPattern||null,requestTags:w.requestTags.split(",").map(e=>e.trim()).filter(Boolean),targetEffort:"inherit"===w.effortMode?null:w.targetEffort,targetKind:e,targetModel:"model"===e&&w.targetModel||null,targetComboId:"combo"===e&&w.targetComboId||null,budgetTokens:"set"===w.budgetAction?Number(w.budgetTokens):null,priority:Number(w.priority)}))});if(!t.ok){let e=await t.json().catch(()=>null);throw Error(e?.error?.message||e?.error||h("saveError"))}await U(),H(),E(h("saved"))}catch(e){E(e instanceof Error?e.message:h("saveError"))}finally{M(!1)}},V=async e=>{await (0,s.u)({message:h("deleteConfirm")})&&((await fetch(`/api/settings/reasoning-routing-rules/${encodeURIComponent(e)}`,{method:"DELETE"})).ok?await U():E(h("deleteError")))},Y=async e=>{(await fetch(`/api/settings/reasoning-routing-rules/${encodeURIComponent(e.id)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:!e.enabled})})).ok?await U():E(h("saveError"))},X=async()=>{F(null);let t=await fetch("/api/settings/reasoning-routing-rules/simulate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...O,apiKeyId:e||w.apiKeyId||null,requestTags:O.requestTags.split(",").map(e=>e.trim()).filter(Boolean)})});F(await t.json())},Q=["global","apiKey","combo","model","connection"].map(e=>({value:e,label:h(`scope.${e}`)}));return(0,t.jsx)(n.default,{title:e?h("apiKeyTitle"):h("title"),subtitle:h("subtitle"),icon:"route",children:(0,t.jsxs)("div",{className:"space-y-5",children:[(0,t.jsxs)("div",{className:"grid gap-3 md:grid-cols-3",children:[(0,t.jsx)(l.default,{label:h("filterSearch"),value:$,onChange:e=>P(e.target.value)}),!e&&(0,t.jsx)(o.default,{label:h("filterScope"),value:K,onChange:e=>A(e.target.value),options:[{value:"all",label:h("all")},...Q]}),(0,t.jsx)(o.default,{label:h("filterStatus"),value:D,onChange:e=>L(e.target.value),options:[{value:"all",label:h("all")},{value:"enabled",label:h("enabled")},{value:"disabled",label:h("disabled")}]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[0===q.length&&(0,t.jsx)("p",{className:"text-sm text-text-muted",children:h("empty")}),q.map(s=>(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3 rounded-lg border border-border p-3",children:[(0,t.jsx)(c.default,{checked:s.enabled,onChange:()=>Y(s),size:"sm",ariaLabel:h("toggleAria",{name:s.name})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:"font-medium text-text-main",children:s.name}),(0,t.jsxs)("p",{className:"text-xs text-text-muted",children:[h(`scope.${s.scope}`)," · ",s.modelPattern||h("allModels")," ·"," ",s.sourceEffort," →"," ","keep"===s.targetKind?h("keepModel"):s.targetModel||s.targetComboId," ","· ",h(`mode.${s.effortMode}`),s.targetEffort?` ${s.targetEffort}`:""," ·"," ",h("priorityShort",{value:s.priority})]})]}),(0,t.jsx)(i.default,{size:"sm",variant:"ghost",icon:"edit",onClick:()=>{T(s.id),S({...m(e),...s,apiKeyId:s.apiKeyId||"",comboId:s.comboId||"",connectionId:s.connectionId||"",modelPattern:s.modelPattern||"",targetEffort:s.targetEffort||"medium",targetModel:s.targetModel||"",targetComboId:s.targetComboId||"",requestTags:s.requestTags.join(", "),budgetTokens:s.budgetTokens?String(s.budgetTokens):"",priority:String(s.priority)})},children:h("edit")}),(0,t.jsx)(i.default,{size:"sm",variant:"danger",icon:"delete",onClick:()=>V(s.id),children:h("delete")})]},s.id))]}),(0,t.jsxs)("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-4",children:[(0,t.jsx)(l.default,{label:h("name"),value:w.name,onChange:e=>S({...w,name:e.target.value}),required:!0}),(0,t.jsx)(l.default,{label:h("description"),value:w.description,onChange:e=>S({...w,description:e.target.value})}),!e&&(0,t.jsx)(o.default,{label:h("scopeLabel"),value:w.scope,onChange:e=>S({...w,scope:e.target.value,targetKind:"connection"===e.target.value?"keep":w.targetKind}),options:Q}),"apiKey"===w.scope&&!e&&(0,t.jsx)(o.default,{label:h("apiKey"),value:w.apiKeyId,onChange:e=>S({...w,apiKeyId:e.target.value}),options:v.map(e=>({value:e.id,label:e.name}))}),"combo"===w.scope&&(0,t.jsx)(o.default,{label:h("sourceCombo"),value:w.comboId,onChange:e=>S({...w,comboId:e.target.value}),options:g.map(e=>({value:e.id,label:e.name}))}),"connection"===w.scope&&(0,t.jsx)(o.default,{label:h("connection"),value:w.connectionId,onChange:e=>S({...w,connectionId:e.target.value}),options:N.map(e=>({value:e.id,label:e.displayName||e.name||`${e.provider} \xb7 ${e.id.slice(0,8)}`}))}),("model"===w.scope||"apiKey"===w.scope)&&(0,t.jsx)(l.default,{label:h("sourceModel"),value:w.modelPattern,onChange:e=>S({...w,modelPattern:e.target.value}),placeholder:"apiKey"===w.scope?h("sourceModelOptional"):h("sourceModelExample")}),(0,t.jsx)(o.default,{label:h("sourceEffort"),value:w.sourceEffort,onChange:e=>S({...w,sourceEffort:e.target.value}),options:[{value:"any",label:h("any")},{value:"missing",label:h("missing")},...[...d,...u].map(e=>({value:e,label:e}))]}),(0,t.jsx)(l.default,{label:h("requestTags"),value:w.requestTags,onChange:e=>S({...w,requestTags:e.target.value}),placeholder:h("requestTagsExample")}),(0,t.jsx)(o.default,{label:h("tagMode"),value:w.tagMatchMode,onChange:e=>S({...w,tagMatchMode:e.target.value}),options:[{value:"any",label:h("any")},{value:"all",label:h("all")}]}),(0,t.jsx)(o.default,{label:h("effortMode"),value:w.effortMode,onChange:e=>S({...w,effortMode:e.target.value}),options:["inherit","default","force"].map(e=>({value:e,label:h(`mode.${e}`)}))}),"inherit"!==w.effortMode&&(0,t.jsx)(o.default,{label:h("targetEffort"),value:w.targetEffort,onChange:e=>S({...w,targetEffort:e.target.value}),options:J}),(0,t.jsx)(o.default,{label:h("routingTarget"),value:"connection"===w.scope?"keep":w.targetKind,disabled:"connection"===w.scope,onChange:e=>S({...w,targetKind:e.target.value}),options:[{value:"keep",label:h("keepModel")},{value:"model",label:h("otherModel")},{value:"combo",label:h("combo")}]}),"model"===w.targetKind&&"connection"!==w.scope&&(0,t.jsx)(l.default,{label:h("targetModel"),value:w.targetModel,onChange:e=>S({...w,targetModel:e.target.value})}),"combo"===w.targetKind&&"connection"!==w.scope&&(0,t.jsx)(o.default,{label:h("targetCombo"),value:w.targetComboId,onChange:e=>S({...w,targetComboId:e.target.value}),options:g.map(e=>({value:e.id,label:e.name}))}),(0,t.jsx)(o.default,{label:h("budgetAction"),value:w.budgetAction,onChange:e=>S({...w,budgetAction:e.target.value}),options:["preserve","remove","set"].map(e=>({value:e,label:h(`budget.${e}`)}))}),"set"===w.budgetAction&&(0,t.jsx)(l.default,{label:h("budgetTokens"),type:"number",min:"1",value:w.budgetTokens,onChange:e=>S({...w,budgetTokens:e.target.value})}),(0,t.jsx)(l.default,{label:h("priority"),type:"number",value:w.priority,onChange:e=>S({...w,priority:e.target.value})})]}),B&&(0,t.jsx)("p",{className:"text-sm text-amber-600 dark:text-amber-400",children:B}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(i.default,{onClick:G,loading:I,children:C?h("saveChanges"):h("add")}),C&&(0,t.jsx)(i.default,{variant:"ghost",onClick:H,children:h("cancel")})]}),_&&(0,t.jsx)("p",{className:"text-sm text-text-muted",children:_}),(0,t.jsxs)("div",{className:"border-t border-border pt-5",children:[(0,t.jsx)("h4",{className:"mb-3 font-medium text-text-main",children:h("simulateTitle")}),(0,t.jsxs)("div",{className:"grid gap-3 md:grid-cols-4",children:[(0,t.jsx)(l.default,{label:h("model"),value:O.model,onChange:e=>R({...O,model:e.target.value})}),(0,t.jsx)(o.default,{label:h("effort"),value:O.effort,onChange:e=>R({...O,effort:e.target.value}),options:[{value:"missing",label:h("missing")},{value:"signal",label:h("signalOnly")},...[...d,...u].map(e=>({value:e,label:e}))]}),(0,t.jsx)(l.default,{label:h("requestTags"),value:O.requestTags,onChange:e=>R({...O,requestTags:e.target.value})}),(0,t.jsx)(o.default,{label:h("transport"),value:O.transport,onChange:e=>R({...O,transport:e.target.value}),options:[{value:"http",label:"HTTP"},{value:"codex-ws",label:"Codex WebSocket"}]})]}),(0,t.jsx)(i.default,{className:"mt-3",variant:"secondary",onClick:X,children:h("simulate")}),z&&(0,t.jsx)("pre",{className:"mt-3 max-h-64 overflow-auto rounded-lg bg-black/5 p-3 text-xs text-text-main dark:bg-white/5",children:JSON.stringify(z,null,2)})]})]})})}},953789,209991,e=>{"use strict";var t=e.i(843476),s=e.i(271645),r=e.i(618566),a=e.i(948148),i=e.i(393718),n=e.i(563201),l=e.i(629342),o=e.i(1203),c=e.i(950914),d=e.i(484124),u=e.i(243009),m=e.i(624982),x=e.i(768834),p=e.i(579473);let h=(0,x.f)()((0,p.f)(e=>({emailsVisible:!1,setEmailsVisible:t=>e({emailsVisible:t})}),{name:"trouteai-email-privacy"}));e.s(["f",0,h],209991);let f="loggerRefreshIntervalSec";function b(){return void 0===globalThis.window?null:window.localStorage}function g(e){return Number.isFinite(e)?Math.min(300,Math.max(1,Math.round(e))):10}var y=e.i(475394);let v="h-8 max-w-[220px] cursor-pointer truncate rounded-control border border-border bg-surface px-3 text-sm text-text-main focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/20";function j(e){return(e?.tokens?.in||0)+(e?.tokens?.out||0)}function N(e){let t=e?.tokens?.out||0,s=e?.duration||0;return t<=0||s<=0?0:t/(s/1e3)}let k=(0,s.forwardRef)((e,x)=>{let{initialSelectedId:p}=e,k=(0,a.f)("requestLogger"),w=(0,a.f)("common"),{emailsVisible:S}=h(),C=(0,s.useMemo)(()=>[{key:"all",label:k("statusFilters.all"),icon:""},{key:"error",label:k("statusFilters.error"),icon:"error"},{key:"ok",label:k("statusFilters.success"),icon:"check_circle"},{key:"combo",label:k("statusFilters.combo"),icon:"hub"}],[k]),T=(0,s.useMemo)(()=>[{key:"status",label:k("columns.status")},{key:"cacheSource",label:k("columns.cacheSource")},{key:"model",label:k("columns.model")},{key:"requestedModel",label:k("columns.requested")},{key:"provider",label:k("columns.provider")},{key:"protocol",label:k("columns.protocol")},{key:"account",label:k("columns.account")},{key:"apiKey",label:k("columns.apiKey")},{key:"combo",label:k("columns.combo")},{key:"tokens",label:k("columns.tokens")},{key:"tps",label:k("columns.tps")},{key:"duration",label:k("columns.duration")},{key:"time",label:k("columns.time")}],[k]),[I,M]=(0,s.useState)([]),[_,E]=(0,s.useState)(!0),[K,A]=(0,s.useState)(!0),[D,L]=(0,s.useState)(""),[$,P]=(0,s.useState)("all"),[O,R]=(0,s.useState)(""),[z,F]=(0,s.useState)(""),[U,q]=(0,s.useState)(""),[W,J]=(0,s.useState)(""),[B,H]=(0,s.useState)("newest"),[G,V]=(0,s.useState)(null),[Y,X]=(0,s.useState)(""),[Q,Z]=(0,s.useState)(null),[ee,et]=(0,s.useState)(!1),[es,er]=(0,s.useState)(!1),[ea,ei]=(0,s.useState)(!1),en={status:{desc:"status_desc",asc:"status_asc"},model:{desc:"model_desc",asc:"model_asc"},tokens:{desc:"tokens_desc",asc:"tokens_asc"},tps:{desc:"tps_desc",asc:"tps_asc"},duration:{desc:"duration_desc",asc:"duration_asc"},time:{desc:"newest",asc:"oldest"}},el=(0,s.useCallback)(e=>{let t=en[e];t&&H(e=>e===t.desc?t.asc:t.desc)},[]),eo=(0,s.useCallback)(e=>{let t=en[e];return t?B===t.desc?" ↓":B===t.asc?" ↑":"":""},[B]),[ec,ed]=(0,s.useState)(null),[eu,em]=(0,s.useState)(!1),[ex,ep]=(0,s.useState)(!1),[eh,ef]=(0,s.useState)(50),[eb,eg]=(0,s.useState)(!1),[ey,ev]=(0,s.useState)(10),ej=(0,s.useRef)(null),eN=(0,s.useRef)(10),ek=(0,s.useRef)(""),ew=(0,s.useRef)(!1),eS=(0,s.useRef)(""),eC=(0,s.useRef)(null),eT=(0,s.useRef)(null),eI=(0,s.useRef)(!1),[eM,e_]=(0,s.useState)([]),eE=(0,s.useRef)(!0),[eK,eA]=(0,s.useState)(()=>{let e=Object.fromEntries(T.map(e=>[e.key,!0]));if(void 0===globalThis.window)return e;try{let t=localStorage.getItem("loggerVisibleColumns");return t?{...e,...JSON.parse(t)}:e}catch{return e}}),eD=(0,s.useCallback)(e=>{eA(t=>{let s={...t,[e]:!t[e]};try{localStorage.setItem("loggerVisibleColumns",JSON.stringify(s))}catch{}return s})},[]);(0,s.useEffect)(()=>{let e=function(e=b()){if(!e)return 10;try{let t=e.getItem(f);if(!t)return 10;return g(Number.parseInt(t,10))}catch{return 10}}();eN.current=e,ev(e)},[]),(0,s.useEffect)(()=>{eN.current=ey},[ey]);let eL=(0,s.useCallback)(e=>{let t=eN.current,s=g("function"==typeof e?e(t):e);eN.current=s,function(e,t=b()){if(t)try{t.setItem(f,String(g(e)))}catch{return!1}}(s),ev(s)},[]),e$=(0,s.useCallback)(async(e=!1)=>{e&&E(!0);try{let e=new URLSearchParams;D&&e.set("search",D),"error"===$&&e.set("status","error"),"ok"===$&&e.set("status","ok"),"combo"===$&&e.set("combo","1"),O&&e.set("model",O),U&&e.set("provider",U),z&&e.set("account",z),W&&e.set("apiKey",W),Y&&e.set("correlationId",Y),e.set("limit",String(eh));let t=await fetch(`/api/usage/call-logs?${e}`);if(t.ok){let e=await t.json();eg(Array.isArray(e)&&e.length>=eh);let s=(Array.isArray(e)?e:[]).map(e=>e.id+":"+e.status+":"+e.duration+":"+(e.tokens?.out||0)).join("|");s!==eS.current&&(eS.current=s,M(e))}}catch(e){console.error("Failed to fetch call logs:",e)}finally{e&&E(!1)}},[D,$,O,z,U,W,Y,eh]);(0,s.useEffect)(()=>{let e=!ew.current;ew.current=!0,e$(e)},[e$]),(0,s.useEffect)(()=>{fetch("/api/provider-nodes").then(e=>e.ok?e.json():{nodes:[]}).then(e=>e_(e.nodes||[])).catch(()=>{})},[]),(0,s.useEffect)(()=>{fetch("/api/logs/detail?limit=1").then(async e=>e.ok?await e.json():null).then(e=>{e&&em(!0===e.enabled)}).catch(()=>{})},[]),(0,s.useEffect)(()=>{let e=()=>{let e="visible"===document.visibilityState;eE.current=e,e&&!G&&K&&eh<=50&&e$(!1)},t=()=>{eE.current=!0,!G&&K&&eh<=50&&e$(!1)};return document.addEventListener("visibilitychange",e),window.addEventListener("focus",t),()=>{document.removeEventListener("visibilitychange",e),window.removeEventListener("focus",t)}},[K,eh,e$,G]),(0,s.useEffect)(()=>(ej.current&&clearInterval(ej.current),!G&&K&&eh<=50&&(ej.current=setInterval(()=>{(eE.current||"visible"===document.visibilityState)&&e$(!1)},1e3*ey)),()=>{ej.current&&clearInterval(ej.current)}),[K,e$,eh,ey,G]),(0,s.useEffect)(()=>{ef(50),eI.current=!1},[D,$,O,z,U,W,Y]);let eP=(0,s.useCallback)(()=>{ef(e=>e+50)},[]);(0,s.useEffect)(()=>{let e=eC.current;if(!e)return;let t=()=>{e.scrollTop>0&&(eI.current=!0)};return e.addEventListener("scroll",t,{passive:!0}),()=>e.removeEventListener("scroll",t)},[]),(0,s.useEffect)(()=>{let e=eT.current,t=eC.current;if(!e||!eb)return;let s=new IntersectionObserver(e=>{var t;(t={isIntersecting:!!e[0]?.isIntersecting,hasMore:eb,loading:_,hasScrolled:eI.current}).isIntersecting&&t.hasMore&&!t.loading&&t.hasScrolled&&eP()},{root:t,rootMargin:"200px"});return s.observe(e),()=>s.disconnect()},[eb,_,eP]);let eO=(0,s.useMemo)(()=>{let e=I;return"error"===$?e=e.filter(e=>e.status>=400):"ok"===$?e=e.filter(e=>e.status>=200&&e.status<300):"combo"===$&&(e=e.filter(e=>e.comboName)),e},[I,$]),eR=(0,s.useMemo)(()=>{if(!ee)return eO;let e=new Map,t=[];for(let s of eO){let r=s.correlationId;if(!r){t.push(s);continue}let a=e.get(r);(!a||new Date(s.timestamp).getTime()>new Date(a.timestamp).getTime())&&e.set(r,s)}return[...t,...e.values()]},[eO,ee]),ez=(0,s.useMemo)(()=>{let e=[...eR];return e.sort((e,t)=>{switch(B){case"oldest":return new Date(e.timestamp).getTime()-new Date(t.timestamp).getTime();case"tokens_desc":return j(t)-j(e);case"tokens_asc":return j(e)-j(t);case"duration_desc":return(t.duration||0)-(e.duration||0);case"duration_asc":return(e.duration||0)-(t.duration||0);case"tps_desc":return N(t)-N(e);case"tps_asc":return N(e)-N(t);case"status_desc":return(t.status||0)-(e.status||0);case"status_asc":return(e.status||0)-(t.status||0);case"model_asc":return(e.model||"").localeCompare(t.model||"");case"model_desc":return(t.model||"").localeCompare(e.model||"");default:return new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime()}}),e},[eR,B]),eF=(0,s.useMemo)(()=>{let e=new Map;for(let t of ez){let s=t.correlationId;s&&(e.has(s)||e.set(s,[]),e.get(s).push(t))}return ez.map(t=>{let s=t.correlationId;if(!s)return{...t,isRetry:!1,groupSize:1,groupStatus:null};let r=e.get(s);if(!r||r.length<=1)return{...t,isRetry:!1,groupSize:1,groupStatus:null};let a=r[0].id===t.id,i=r.some(e=>e.status>=400||e.active),n=r.some(e=>e.status>=200&&e.status<300);return{...t,isRetry:!a,groupSize:r.length,groupStatus:i&&n?"healed":i?"failed":null}})},[ez]),eU=(0,r.useRouter)(),eq=async e=>{if(!e?.id){try{eW()}catch{}return}let t=`${e.id}:${Date.now()}:${Math.random()}`;ek.current=t,V(e);try{let t=new URL(globalThis.location.href);t.searchParams.set("id",e.id),eU.replace(t.pathname+t.search)}catch(e){}er(!0),ed(null);try{let s=await fetch(`/api/logs/${e.id}`,{cache:"no-store"});if(s.ok){let e=await s.json();if(ek.current!==t)return;let r=e?.pipelinePayloads&&Object.keys(e.pipelinePayloads||{}).length>0;ed(t=>({...t,...e,pipelinePayloads:r?e.pipelinePayloads:t?.pipelinePayloads})),e&&"object"==typeof e&&V(t=>({...t,...e,active:!0===e.active}))}else{if(ek.current!==t)return;if(404===s.status){if(e.pendingLookup||e.active){V(t=>({...t,id:e.id,status:0,method:t?.method,path:t?.path||""})),ed({detailState:"pending"});return}try{console.warn("Log not found:",e.id)}catch{}try{eW()}catch{}return}try{let e=await s.text().catch(()=>null);if(ek.current!==t)return;ed({error:`Failed to fetch log (status ${s.status})`,body:e})}catch{}}}catch(e){console.error("Failed to fetch log detail:",e)}finally{ek.current===t&&er(!1)}},eW=()=>{ek.current="",V(null),ed(null);try{let e=new URL(globalThis.location.href);e.searchParams.delete("id"),eU.replace(e.pathname+e.search)}catch(e){}},eJ=(0,s.useMemo)(()=>ez,[ez]);(0,s.useImperativeHandle)(x,()=>({openDetail:eq,getSortedLogs:()=>eJ}),[eq,eJ]);let eB=(0,s.useRef)(!1);(0,s.useEffect)(()=>{p&&!eB.current&&(eB.current=!0,eq({id:p,pendingLookup:!0}).then(e=>e).catch(e=>{console.error("Failed to open initial log id:",e)}))},[p]),(0,s.useEffect)(()=>{let e=G?.active===!0;if(!G?.id||!e)return;let t=!1,s=0,r=setInterval(async()=>{if("visible"===document.visibilityState)try{let a=await fetch(`/api/logs/${G.id}`,{cache:"no-store"});if(t)return;if(404===a.status){if(e)return;clearInterval(r);return}if(a.ok){let e=await a.json(),t=!0===e.active;ed(t=>({...t,...e,pipelinePayloads:e?.pipelinePayloads||t?.pipelinePayloads})),V(s=>({...s,...e,active:t})),!t&&++s>=3&&clearInterval(r)}}catch{}},1e3);return()=>{t=!0,clearInterval(r)}},[G?.id,ec?.detailState,G?.active,e$]),(0,s.useEffect)(()=>{let e=G?.correlationId;if(!G?.id||!e)return;let t=!1,s=setInterval(async()=>{if("visible"===document.visibilityState)try{let s=await fetch(`/api/usage/call-logs?correlationId=${encodeURIComponent(e)}`,{cache:"no-store"});if(t||!s.ok)return;let r=await s.json();if(!Array.isArray(r)||0===r.length)return;M(e=>{new Set(r.map(e=>e.id));let t=!1,s=e.map(e=>{let s=r.find(t=>t.id===e.id);return s?(t=!0,{...e,...s}):e});for(let e of r)s.some(t=>t.id===e.id)||(s.push(e),t=!0);return t?s:e})}catch{}},3e3);return()=>{t=!0,clearInterval(s)}},[G?.id,G?.correlationId]);let eH=(0,s.useMemo)(()=>G?eJ.findIndex(e=>e.id===G.id):-1,[G,eJ]),eG=(0,s.useCallback)(()=>{let e=eH>0?eJ[eH-1]:null;e?.id?eq(e).then(e=>e).catch(e=>{console.error("Failed to open previous log id:",e)}):eW()},[eH,eJ]),eV=(0,s.useCallback)(()=>{let e=eH>=0&&eH<eJ.length-1?eJ[eH+1]:null;e?.id?eq(e).then(e=>e).catch(e=>{console.error("Failed to open previous log id:",e)}):eW()},[eH,eJ]),eY=async()=>{ep(!0);try{let e=!eu;if(!(await fetch("/api/logs/detail",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:e})})).ok)throw Error(k("updatePipelineFailed"));em(e)}catch(e){console.error("Failed to toggle pipeline logging:",e)}finally{ep(!1)}},eX=(0,s.useMemo)(()=>[...new Set(I.map(e=>e.account).filter(e=>e&&"-"!==e))],[I]),eQ=(0,s.useMemo)(()=>[...new Set(I.flatMap(e=>[e.model,e.requestedModel]).filter(Boolean))].sort(),[I]),eZ=(0,s.useMemo)(()=>[...new Set(I.map(e=>e.provider).filter(e=>e&&"-"!==e))].sort(),[I]),e0=(0,s.useMemo)(()=>[...new Set(I.map(e=>e.apiKeyId||e.apiKeyName).filter(Boolean))].sort(),[I]),{totalCount:e1,okCount:e2,errorCount:e4,comboCount:e3,apiKeyCount:e5,runningCount:e6}=(0,s.useMemo)(()=>({totalCount:eO.length,okCount:eO.filter(e=>e.status>=200&&e.status<300).length,errorCount:eO.filter(e=>e.status>=400).length,comboCount:I.filter(e=>e.comboName).length,apiKeyCount:e0.length,runningCount:eO.filter(e=>!0===e.active).length}),[eO,I,e0]),e8=[U,O,z,W,Y,ee,"newest"!==B].filter(Boolean).length;return(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("button",{onClick:()=>A(!K),className:`inline-flex h-8 items-center gap-2 rounded-control border px-3 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 ${K?"border-error/30 bg-error/10 text-error":"border-border bg-surface text-text-muted hover:bg-surface-2 hover:text-text-main"}`,children:[(0,t.jsx)("span",{className:`size-2 rounded-full ${K?"bg-error animate-pulse":"bg-text-muted"}`,"aria-hidden":"true"}),K?k("recording"):k("paused")]}),(0,t.jsxs)("div",{className:"relative min-w-[200px] flex-1",children:[(0,t.jsx)("span",{className:"material-symbols-outlined pointer-events-none absolute start-2.5 top-1/2 -translate-y-1/2 text-[18px] text-text-muted","aria-hidden":"true",children:"search"}),(0,t.jsx)("input",{type:"text",placeholder:k("searchPlaceholder"),value:D,onChange:e=>L(e.target.value),className:"h-8 w-full rounded-control border border-border bg-surface ps-9 pe-3 text-sm text-text-main placeholder:text-text-muted focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),(0,t.jsx)("div",{className:"inline-flex items-center gap-0.5 rounded-control border border-border bg-surface-2 p-0.5",children:C.map(e=>(0,t.jsxs)("button",{onClick:()=>P($===e.key?"all":e.key),className:`inline-flex h-7 items-center gap-1.5 whitespace-nowrap rounded-md border px-2.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 ${$===e.key?"border-border bg-surface text-text-main shadow-none":"border-transparent text-text-muted hover:text-text-main"}`,children:[e.icon&&(0,t.jsx)("span",{className:`material-symbols-outlined text-[14px] ${$===e.key&&"error"===e.key?"text-error":$===e.key&&"ok"===e.key?"text-success":""}`,"aria-hidden":"true",children:e.icon}),e.label]},e.key))}),(0,t.jsxs)("button",{type:"button",onClick:()=>ei(e=>!e),"aria-expanded":ea,className:`inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-control border px-3 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 ${ea||e8>0?"border-primary/30 bg-primary/10 text-primary-text":"border-border bg-surface text-text-main hover:bg-surface-2"}`,children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"tune"}),w("filters"),e8>0&&(0,t.jsx)("span",{className:"inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-full bg-primary px-1 text-[10px] font-semibold tabular-nums text-on-primary",children:e8})]}),(0,t.jsx)(n.default,{columns:T,visible:eK,onToggle:eD}),(0,t.jsx)("button",{onClick:()=>e$(!1),className:"inline-flex size-8 items-center justify-center rounded-control border border-border bg-surface text-text-muted transition-colors hover:bg-surface-2 hover:text-text-main focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",title:k("refresh"),"aria-label":k("refresh"),children:(0,t.jsx)("span",{className:"material-symbols-outlined text-[18px]","aria-hidden":"true",children:"refresh"})})]}),ea&&(0,t.jsx)("div",{className:"flex flex-col gap-3 rounded-card border border-border bg-surface p-3",children:(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("select",{value:U,onChange:e=>q(e.target.value),className:v,children:[(0,t.jsx)("option",{value:"",children:k("allProviders")}),eZ.map(e=>{let s=(0,m.f)(e,eM),r=d.N[e];return(0,t.jsx)("option",{value:e,children:s||r?.label||e.toUpperCase()},e)})]}),(0,t.jsxs)("select",{value:O,onChange:e=>R(e.target.value),className:v,children:[(0,t.jsx)("option",{value:"",children:k("allModels")}),eQ.map(e=>(0,t.jsx)("option",{value:e,children:e},e))]}),(0,t.jsxs)("select",{value:z,onChange:e=>F(e.target.value),className:v,children:[(0,t.jsx)("option",{value:"",children:k("allAccounts")}),eX.map(e=>(0,t.jsx)("option",{value:e,children:S?e:`${(0,u.a)(e,!1)} \xb7 #${(0,u.N)(e)}`},e))]}),(0,t.jsxs)("select",{value:W,onChange:e=>J(e.target.value),className:v,children:[(0,t.jsx)("option",{value:"",children:k("allApiKeys")}),e0.map(e=>{let s=I.find(t=>(t.apiKeyId||t.apiKeyName)===e),r=(0,u.J)(s?.apiKeyName,s?.apiKeyId);return(0,t.jsx)("option",{value:e,children:r},e)})]}),(0,t.jsxs)("div",{className:"relative min-w-[180px]",children:[(0,t.jsx)("span",{className:"material-symbols-outlined pointer-events-none absolute start-2.5 top-1/2 -translate-y-1/2 text-[16px] text-text-muted","aria-hidden":"true",children:"tag"}),(0,t.jsx)("input",{type:"text",placeholder:"Correlation ID",value:Y,onChange:e=>X(e.target.value),className:"h-8 w-full rounded-control border border-border bg-surface ps-8 pe-3 font-mono text-sm text-text-main placeholder:text-text-muted focus:border-primary focus:outline-none focus:ring-2 focus:ring-primary/20"})]}),(0,t.jsxs)("button",{onClick:()=>et(e=>!e),className:`inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-control border px-3 text-sm font-medium transition-colors ${ee?"border-primary/30 bg-primary/10 text-primary-text":"border-border bg-surface text-text-muted hover:bg-surface-2 hover:text-text-main"}`,title:ee?k("showAllRows"):k("showLatestPerCorrelation"),children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:ee?"unfold_less":"unfold_more"}),ee?k("grouped"):k("allRows")]}),(0,t.jsxs)("select",{value:B,onChange:e=>H(e.target.value),className:v,title:k("sortLogs"),children:[(0,t.jsx)("option",{value:"newest",children:k("sortNewest")}),(0,t.jsx)("option",{value:"oldest",children:k("sortOldest")}),(0,t.jsx)("option",{value:"tokens_desc",children:k("sortTokensDesc")}),(0,t.jsx)("option",{value:"tokens_asc",children:k("sortTokensAsc")}),(0,t.jsx)("option",{value:"duration_desc",children:k("sortDurationDesc")}),(0,t.jsx)("option",{value:"duration_asc",children:k("sortDurationAsc")}),(0,t.jsx)("option",{value:"status_desc",children:k("sortStatusDesc")}),(0,t.jsx)("option",{value:"status_asc",children:k("sortStatusAsc")}),(0,t.jsx)("option",{value:"model_asc",children:k("sortModelAsc")}),(0,t.jsx)("option",{value:"model_desc",children:k("sortModelDesc")})]}),(0,t.jsxs)("div",{className:"inline-flex h-8 items-center gap-0.5 rounded-control border border-border bg-surface px-1",title:k("refreshIntervalSeconds"),children:[(0,t.jsx)("span",{className:"material-symbols-outlined px-1 text-[16px] text-text-muted","aria-hidden":"true",children:"timer"}),(0,t.jsx)("button",{onClick:()=>eL(e=>e-1),className:"flex size-6 items-center justify-center rounded-md text-sm font-medium text-text-muted transition-colors hover:bg-surface-2 hover:text-text-main",title:k("decreaseInterval"),"aria-label":k("decreaseInterval"),children:"−"}),(0,t.jsx)("input",{type:"number",min:1,max:300,value:ey,onChange:e=>{let t=Number.parseInt(e.target.value,10);Number.isNaN(t)||eL(t)},className:"w-10 bg-transparent text-center text-xs tabular-nums text-text-main focus:outline-none [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",title:k("refreshIntervalSeconds"),"aria-label":k("refreshIntervalSeconds")}),(0,t.jsx)("button",{onClick:()=>eL(e=>e+1),className:"flex size-6 items-center justify-center rounded-md text-sm font-medium text-text-muted transition-colors hover:bg-surface-2 hover:text-text-main",title:k("increaseInterval"),"aria-label":k("increaseInterval"),children:"+"}),(0,t.jsx)("span",{className:"pe-1 text-xs text-text-muted",children:"s"})]}),(0,t.jsxs)("button",{onClick:eY,disabled:ex,className:`inline-flex h-8 items-center gap-2 whitespace-nowrap rounded-control border px-3 text-sm font-medium transition-colors disabled:opacity-60 ${eu?"border-warning/30 bg-warning/10 text-warning":"border-border bg-surface text-text-muted hover:bg-surface-2 hover:text-text-main"}`,title:k("capturePipeline"),children:[(0,t.jsx)("span",{className:`size-2 rounded-full ${eu?"bg-warning":"bg-text-muted"}`,"aria-hidden":"true"}),ex?k("updatingPipelineLogs"):eu?k("pipelineLogsOn"):k("pipelineLogsOff")]})]})}),eZ.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-1.5",children:eZ.map(e=>{let s=(0,m.f)(e,eM)||d.N[e]?.label||e.toUpperCase(),r=U===e;return(0,t.jsx)("button",{onClick:()=>q(r?"":e),className:`inline-flex h-7 max-w-[220px] items-center truncate rounded-full border px-3 text-xs font-medium transition-colors ${r?"border-primary/30 bg-primary/10 text-primary-text":"border-border bg-surface text-text-muted hover:bg-surface-2 hover:text-text-main"}`,title:s,children:s},e)})}),!ea&&eu&&(0,t.jsxs)("div",{className:"-mt-2 flex items-center gap-2 text-xs text-warning",children:[(0,t.jsx)("span",{className:"size-1.5 rounded-full bg-warning","aria-hidden":"true"}),k("pipelineLogsOn")]}),(0,t.jsxs)("div",{className:"-mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-text-muted tabular-nums",children:[(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"font-medium text-text-main",children:e1})," ",k("total")]}),e6>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{"aria-hidden":"true",children:"·"}),(0,t.jsxs)("span",{className:"text-warning",children:[e6," running"]})]}),(0,t.jsx)("span",{"aria-hidden":"true",children:"·"}),(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"font-medium text-text-main",children:e2})," ",k("ok")]}),e4>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{"aria-hidden":"true",children:"·"}),(0,t.jsxs)("span",{className:"text-error",children:[(0,t.jsx)("span",{className:"font-medium",children:e4})," ",k("err")]})]}),e3>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{"aria-hidden":"true",children:"·"}),(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"font-medium text-text-main",children:e3})," ",k("combo")]})]}),e5>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{"aria-hidden":"true",children:"·"}),(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"font-medium text-text-main",children:e5})," ",k("keys")]})]}),(0,t.jsx)("span",{"aria-hidden":"true",children:"·"}),(0,t.jsxs)("span",{children:[(0,t.jsx)("span",{className:"font-medium text-text-main",children:ez.length})," ",k("shown")]})]}),(0,t.jsx)(i.default,{padding:"none",className:"min-h-[460px] resize-y overflow-auto bg-surface",children:(0,t.jsxs)("div",{ref:eC,className:"p-0 overflow-x-auto overflow-y-auto h-full min-h-[460px]",children:[_&&0===I.length?(0,t.jsx)("div",{className:"p-8 text-center text-text-muted",children:k("loadingLogs")}):0===I.length?(0,t.jsx)(l.default,{icon:"receipt_long",title:k("noLogs")}):0===ez.length?(0,t.jsx)(l.default,{icon:"filter_alt_off",title:k("noMatchingLogs")}):(0,t.jsxs)("table",{className:y.g,children:[(0,t.jsx)("thead",{className:y.U,style:y.Q,children:(0,t.jsxs)("tr",{className:y.M,style:y.Q,children:[eK.status&&(0,t.jsxs)("th",{className:`${y.j} cursor-pointer select-none`,onClick:()=>el("status"),children:[k("columns.status"),eo("status")]}),eK.cacheSource&&(0,t.jsx)("th",{className:y.j,children:k("columns.cacheSource")}),eK.model&&(0,t.jsx)("th",{className:y.j,children:k("columns.model")}),eK.requestedModel&&(0,t.jsx)("th",{className:y.j,children:k("columns.requested")}),eK.provider&&(0,t.jsx)("th",{className:y.j,children:k("columns.provider")}),eK.protocol&&(0,t.jsx)("th",{className:y.j,children:k("columns.protocol")}),eK.account&&(0,t.jsx)("th",{className:y.j,children:k("columns.account")}),eK.apiKey&&(0,t.jsx)("th",{className:y.j,children:k("columns.apiKey")}),eK.combo&&(0,t.jsx)("th",{className:y.j,children:k("columns.combo")}),eK.tokens&&(0,t.jsxs)("th",{className:`${y.F} cursor-pointer select-none`,onClick:()=>el("tokens"),children:[k("columns.tokens"),eo("tokens")]}),eK.tps&&(0,t.jsxs)("th",{className:`${y.F} cursor-pointer select-none`,onClick:()=>el("tps"),children:[k("columns.tps"),eo("tps")]}),eK.duration&&(0,t.jsxs)("th",{className:`${y.F} cursor-pointer select-none`,onClick:()=>el("duration"),children:[k("columns.duration"),eo("duration")]}),eK.time&&(0,t.jsxs)("th",{className:`${y.F} cursor-pointer select-none`,onClick:()=>el("time"),children:[k("columns.time"),eo("time")]})]})}),(0,t.jsx)("tbody",{className:"divide-y divide-border/30",children:eF.map(e=>{let s,r,a=!0===e.active,i=a?null:e.sourceFormat||e.provider,n=i?(0,d.g)(i,e.provider):null,l=(0,m.f)(e.provider,eM),o=e.providerDisplay||l||d.N[e.provider]?.label||(e.provider||"-").toUpperCase(),c=!a&&e.status>=400,x=(0,y.a)(e.cacheSource),p=x?.key==="semantic",h=(0,u.a)(e.account,S);return(0,t.jsxs)("tr",{onClick:()=>eq(e),"data-cid":e.correlationId||void 0,onMouseEnter:()=>e.correlationId&&Z(e.correlationId),onMouseLeave:()=>Z(null),className:`cursor-pointer transition-colors ${c?"bg-error/5 hover:bg-error/15":"hover:bg-primary/10"} ${e.isRetry?"border-l-2 border-l-amber-500/50":""} ${Q&&e.correlationId===Q?"bg-primary/10 ring-1 ring-primary/20":""}`,style:e.isRetry?{backgroundColor:Q&&e.correlationId===Q?void 0:"rgba(245,158,11,0.03)"}:void 0,children:[eK.status&&(0,t.jsx)("td",{className:"px-3 py-2",children:a?(0,t.jsx)("span",{className:"inline-flex items-center justify-center w-7 h-7 rounded-full bg-warning/15 border border-warning/25",title:"In progress",children:(0,t.jsx)("span",{className:"inline-block h-3 w-3 rounded-full border-2 border-warning border-t-transparent animate-spin"})}):(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)("span",{className:`inline-block min-w-[36px] rounded-control border px-2 py-0.5 text-center text-[11px] font-medium tabular-nums ${(0,y.X)(e.status)}`,children:e.status||"..."}),"healed"===e.groupStatus&&!e.isRetry&&e.status>=400&&(0,t.jsx)("span",{className:"text-success text-[11px]",title:"Recovered by retry",children:"✓"}),e.isRetry&&(0,t.jsx)("button",{className:"inline-flex items-center text-warning hover:text-warning text-[11px] ml-0.5",title:k("goToParentRequest"),"aria-label":k("goToParentRequest"),onClick:t=>{t.stopPropagation();let s=eF.find(t=>t.correlationId===e.correlationId&&!t.isRetry);s&&eq(s)},children:"↳"})]})}),eK.cacheSource&&(0,t.jsx)("td",{className:"px-3 py-2",children:a?(0,t.jsx)("span",{className:"text-text-muted text-[10px]",children:"—"}):(0,t.jsx)("span",{className:`inline-block px-2 py-0.5 rounded-control text-[11px] font-medium ${x?.className||""}`,title:p?k("semanticCacheHit"):k("upstreamResponse"),children:p?k("semantic"):k("upstream")})}),eK.model&&(0,t.jsxs)("td",{className:"px-3 py-2 font-medium text-text-main font-mono text-[11px]",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("span",{children:e.model}),"healed"===e.groupStatus&&!e.isRetry&&(0,t.jsx)("span",{className:"inline-flex items-center gap-0.5 px-1 py-0 rounded text-[11px] font-medium bg-success/15 text-success border border-success/25",title:`Failed, recovered after ${e.groupSize-1} retry`,children:"healed"}),"failed"===e.groupStatus&&!e.isRetry&&(0,t.jsx)("span",{className:"inline-flex items-center gap-0.5 px-1 py-0 rounded text-[11px] font-medium bg-error/15 text-error border border-error/25",title:`All ${e.groupSize} attempts failed`,children:"failed"}),e.modelPinned&&(0,t.jsx)("span",{className:"inline-flex items-center gap-0.5 px-1 py-0 rounded text-[11px] font-medium bg-primary/15 text-primary-text border border-primary/25",title:"Model selected via context-cache session pinning",children:"pinned"})]}),e.correlationId&&!e.isRetry&&e.groupSize>1&&(0,t.jsxs)("div",{className:"text-[10px] text-text-muted font-normal truncate max-w-[120px]",title:e.correlationId,children:[e.correlationId.slice(0,12),"… · ",e.groupSize," attempts"]}),e.correlationId&&!e.isRetry&&e.groupSize<=1&&(0,t.jsxs)("div",{className:"text-[10px] text-text-muted font-normal truncate max-w-[120px]",title:e.correlationId,children:[e.correlationId.slice(0,12),"…"]}),e.correlationId&&e.isRetry&&(0,t.jsxs)("div",{className:"text-[10px] text-warning font-normal truncate max-w-[120px]",title:e.correlationId,children:[e.correlationId.slice(0,12),"…"]})]}),eK.requestedModel&&(0,t.jsx)("td",{className:"px-3 py-2 font-mono text-[11px]",children:e.requestedModel?(0,t.jsx)("span",{className:e.requestedModel!==e.model?"text-warning":"text-text-muted",title:e.requestedModel!==e.model?k("requestedRoutedTitle",{requested:e.requestedModel,routed:e.model}):e.requestedModel,children:e.requestedModel}):(0,t.jsx)("span",{className:"text-text-muted text-[10px]",children:"—"})}),eK.provider&&(0,t.jsx)("td",{className:"px-3 py-2",children:(0,t.jsx)("span",{className:"inline-block max-w-[160px] truncate rounded-control border border-border bg-surface-2 px-2 py-0.5 text-[11px] font-medium text-text-main",title:o,children:o})}),eK.protocol&&(0,t.jsx)("td",{className:"px-3 py-2",children:a?(0,t.jsx)("span",{className:"text-text-muted text-[10px]",children:"—"}):(0,t.jsx)("span",{className:"inline-block rounded-control border border-border bg-surface-2 px-2 py-0.5 text-[11px] font-medium text-text-muted",children:n?.label||"—"})}),eK.account&&(0,t.jsx)("td",{className:"px-3 py-2 text-text-muted truncate max-w-[120px]",title:h,children:h}),eK.apiKey&&(0,t.jsx)("td",{className:"px-3 py-2 text-text-muted truncate max-w-[140px]",title:e.apiKeyName||e.apiKeyId||k("noApiKey"),children:a?(0,t.jsx)("span",{className:"text-text-muted text-[10px]",children:"—"}):(0,u.J)(e.apiKeyName,e.apiKeyId)}),eK.combo&&(0,t.jsx)("td",{className:"px-3 py-2",children:a?(0,t.jsx)("span",{className:"text-text-muted text-[10px]",children:"—"}):e.comboName?(0,t.jsx)("span",{className:"inline-block max-w-[160px] truncate rounded-full border border-primary/30 bg-primary/10 px-2 py-0.5 text-[11px] font-medium text-primary-text",title:e.comboName,children:e.comboName}):(0,t.jsx)("span",{className:"text-text-muted text-[10px]",children:"—"})}),eK.tokens&&(0,t.jsx)("td",{className:"px-3 py-2 text-right whitespace-nowrap",children:a?(0,t.jsx)("span",{className:"text-text-muted text-[10px]",children:"—"}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-text-muted",children:"TI:"})," ",(0,t.jsx)("span",{className:"text-text-main",children:e.tokens?.in?.toLocaleString()||0}),(0,t.jsx)("span",{className:"mx-1 text-border",children:"|"}),(0,t.jsx)("span",{className:"text-text-muted",children:"TO:"})," ",(0,t.jsx)("span",{className:"text-text-main",children:e.tokens?.out?.toLocaleString()||0}),e.tokens?.compressed!=null&&e.tokens.compressed>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"mx-1 text-border",children:"|"}),(0,t.jsxs)("span",{className:"text-text-muted font-medium",title:`${e.tokens.compressed.toLocaleString()} tokens compressed`,children:["↓",e.tokens.compressed.toLocaleString()]})]})]})}),eK.tps&&(0,t.jsx)("td",{className:"px-3 py-2 text-right whitespace-nowrap font-mono",children:a?(0,t.jsx)("span",{className:"text-text-muted text-[10px]",children:"—"}):(r=(s=N(e))<=0?"text-text-muted":"text-text-main",(0,t.jsx)("span",{className:r,title:`${s.toFixed(2)} tokens/sec`,children:s<=0?"—":s>=100?Math.round(s).toLocaleString():s.toFixed(1)}))}),eK.duration&&(0,t.jsx)("td",{className:"px-3 py-2 text-right text-text-main tabular-nums",children:(0,u.M)(e.duration)}),eK.time&&(0,t.jsx)("td",{className:"px-3 py-2 text-right text-text-muted",children:(0,u.P)(e.timestamp)})]},e.id)})})]}),eb&&ez.length>0&&(0,t.jsx)("div",{ref:eT,className:"flex justify-center py-3 border-t border-border/30",children:(0,t.jsx)("button",{type:"button",onClick:eP,className:"h-7 rounded-control border border-border bg-surface px-3 text-xs font-medium text-text-main transition-colors hover:bg-surface-2",children:_?k("loadingMore"):k("loadMore")})})]})}),(0,t.jsx)("div",{className:"text-xs text-text-muted",children:k("callLogsInfo",{dataDir:"{DATA_DIR}/call_logs/",retentionDays:"CALL_LOG_RETENTION_DAYS",maxEntries:"CALL_LOG_MAX_ENTRIES"})}),G&&(0,t.jsx)(o.f,{log:G,detail:ec,loading:es,debugEnabled:!!G.active||eu,emailsVisible:S,onClose:eW,onCopy:c.f,onPrevious:eG,onNext:eV,relatedLogs:G.correlationId?eF.filter(e=>e.correlationId===G.correlationId):[],onSelectRelated:e=>{eW(),eq(e)}})]})});k.displayName="RequestLoggerV2",e.s(["default",0,k],953789)},323060,e=>{"use strict";var t=e.i(843476),s=e.i(156132);e.s(["default",0,function({options:e=[],value:r,onChange:a,size:i="md",className:n,"aria-label":l}){let o={sm:"h-6 px-2.5 text-xs",md:"h-7 px-3 text-sm",lg:"h-9 px-4 text-sm"};return(0,t.jsx)("div",{role:"tablist","aria-label":l,className:(0,s.f)("inline-flex items-center gap-0.5 p-0.5 rounded-control","bg-surface-2 border border-border",n),children:e.map(e=>(0,t.jsxs)("button",{role:"tab","aria-selected":r===e.value,tabIndex:r===e.value?0:-1,onClick:()=>a(e.value),className:(0,s.f)("rounded-md font-medium whitespace-nowrap transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",o[i],r===e.value?"bg-surface text-text-main shadow-soft dark:bg-white/10":"text-text-muted hover:text-text-main",e.icon&&"flex items-center"),children:[e.icon&&(0,t.jsx)("span",{className:"material-symbols-outlined text-[16px] me-1.5","aria-hidden":"true",children:e.icon}),e.label]},e.value))})}])},907714,e=>{"use strict";var t=e.i(843476),s=e.i(271645),r=e.i(948148),a=e.i(156132);e.s(["default",0,function({label:e,options:i=[],value:n,onChange:l,placeholder:o,error:c,hint:d,disabled:u=!1,required:m=!1,className:x,selectClassName:p,id:h,children:f,...b}){let g=(0,r.f)("common"),y=(0,s.useId)(),v=h||y,j=c?`${v}-error`:void 0,N=d&&!c?`${v}-hint`:void 0,k=[j,N].filter(Boolean).join(" ")||void 0;return(0,t.jsxs)("div",{className:(0,a.f)("flex flex-col gap-1.5",x),children:[e&&(0,t.jsxs)("label",{htmlFor:v,className:"text-xs font-medium text-text-muted",children:[e,m&&(0,t.jsx)("span",{className:"text-error ml-1","aria-hidden":"true",children:"*"})]}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsxs)("select",{id:v,value:n,onChange:l,disabled:u,required:m,"aria-required":m||void 0,"aria-invalid":!!c||void 0,"aria-describedby":k,className:(0,a.f)("w-full h-9 px-3 pe-9 text-sm text-text-main","bg-surface border border-border rounded-control appearance-none cursor-pointer","focus:border-primary focus:ring-2 focus:ring-primary/20 focus:outline-none","transition-colors disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",c?"border-error focus:border-error focus:ring-error/20":"",p),...b,children:[!f&&(o??g("selectOption"))&&(0,t.jsx)("option",{value:"",disabled:!0,className:"bg-surface text-text-muted",children:o??g("selectOption")}),!f&&i.map(e=>(0,t.jsx)("option",{value:e.value,className:"bg-surface text-text-main",children:e.label},e.value)),f]}),(0,t.jsx)("div",{className:"absolute inset-y-0 end-0 flex items-center pe-2.5 pointer-events-none text-text-muted","aria-hidden":"true",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"expand_more"})})]}),c&&(0,t.jsxs)("p",{id:j,className:"text-xs text-error flex items-center gap-1",role:"alert",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[14px]","aria-hidden":"true",children:"error"}),c]}),d&&!c&&(0,t.jsx)("p",{id:N,className:"text-xs text-text-muted",children:d})]})}])},647829,402038,799012,e=>{"use strict";var t=e.i(247167),s=e.i(843476),r=e.i(271645),a=e.i(522016),i=e.i(618566),n=e.i(156132),l=e.i(723790);let o=null;function c({className:e}){let[t,a]=(0,r.useState)(null);return((0,r.useEffect)(()=>{let e=!0;return(o??=fetch("/api/settings/require-login").then(e=>e.ok?e.json():null).then(e=>{let t=e?.brandCredit;return t&&"string"==typeof t.text&&t.text?{text:t.text,url:"string"==typeof t.url?t.url:""}:null}).catch(()=>null)).then(t=>{e&&a(t)}),()=>{e=!1}},[]),t)?(0,s.jsx)("p",{className:(0,n.f)("break-words text-[11px] leading-snug text-text-muted",e),children:t.url?(0,s.jsx)("a",{href:t.url,target:"_blank",rel:"noopener noreferrer",className:"rounded-sm transition-colors hover:text-text-main focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",children:t.text}):t.text}):null}e.s(["f",0,c],402038);var d=e.i(342923),u=e.i(80173),m=e.i(703166),x=e.i(948148);let p=["compression-context","tools","integrations","logs","audit","system","batch"],h="hiddenSidebarGroupLabels";function f(e){if(!Array.isArray(e))return[];let t=new Set;for(let s of e)"string"==typeof s&&p.includes(s)&&t.add(s);return p.filter(e=>t.has(e))}e.s(["T",0,h,"C",0,p,"x",0,f],799012);var b=e.i(241937),g=e.i(513859);t.default.env.NEXT_PUBLIC_TROUTEAI_E2E_MODE;let y="setup",v="sidebar-expanded-sections",j="sidebar-pinned-sections";function N(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}e.s(["default",0,function({onClose:e,collapsed:t=!1,onToggleCollapse:o}){let p=(0,i.usePathname)(),k=(0,x.f)("sidebar"),w=(0,x.f)("common"),S=(0,r.useRef)(null),[C,T]=(0,r.useState)(!1),[I,M]=(0,r.useState)(!1),[_,E]=(0,r.useState)(!1),[K,A]=(0,r.useState)(!1),[D,L]=(0,r.useState)([]),[$,P]=(0,r.useState)(!1),[O,R]=(0,r.useState)(!1),[z,F]=(0,r.useState)([]),[U,q]=(0,r.useState)([]),[W,J]=(0,r.useState)({}),[B,H]=(0,r.useState)(null),[G,V]=(0,r.useState)(null),[Y,X]=(0,r.useState)(new Set([y])),[Q,Z]=(0,r.useState)(new Set),[ee,et]=(0,r.useState)(!1),es=(0,r.useRef)(!1),[er,ea]=(0,r.useState)(null),[ei,en]=(0,r.useState)("");(0,r.useEffect)(()=>{let e=function(e,t){try{let t=localStorage.getItem(e);if(t){let e=JSON.parse(t);if(Array.isArray(e))return e}}catch{}return t}(v,[y]),t=(()=>{try{return localStorage.getItem(j)}catch{return null}})(),s=new Set(null!==t?JSON.parse(t):g.f.filter(e=>e.defaultPinned).map(e=>e.id)),r=new Set([...e,...s]);es.current=0===e.length,X(r),Z(s),et(!0)},[]),(0,r.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{A(e?.debugMode===!0),L((0,b.D)(e?.[b.P])),F(f(e?.[h])),H(e?.instanceName||null),V(e?.customLogoBase64||e?.customLogoUrl||null),Array.isArray(e?.[b._])&&q(e[b._]),e?.[b.R]&&"object"==typeof e[b.R]&&J(e[b.R])}).catch(()=>{}).finally(()=>P(!0));let e=e=>{let t=e.detail||{};"debugMode"in t&&A(!0===t.debugMode),b.P in t&&L((0,b.D)(t[b.P])),h in t&&F(f(t[h])),b._ in t&&Array.isArray(t[b._])&&q(t[b._]),b.R in t&&t[b.R]&&"object"==typeof t[b.R]&&J(t[b.R]),"instanceName"in t&&H(t.instanceName||null),"customLogoBase64"in t?V(t.customLogoBase64||null):"customLogoUrl"in t&&V(t.customLogoUrl||null)};return window.addEventListener(b.z,e),()=>window.removeEventListener(b.z,e)},[]);let el=(e,t)=>"function"==typeof k.has&&k.has(e)?k(e):t,eo=(e,t)=>{if(t.has(e.id))return null;let s=e.subtitleKey?el(e.subtitleKey,e.subtitleFallback??""):e.subtitleFallback;return{...e,label:el(e.i18nKey,e.labelFallback??e.id),subtitle:s||void 0}},ec=new Set(D),ed=new Set(z),eu=(0,b.K)(g.f.filter(e=>"debug"!==e.visibility||K),U).map(e=>{let t=(0,b.S)(e.children,W[e.id]??[]).map(e=>{if("type"in e&&"group"===e.type){let t=e.items.map(e=>eo(e,ec)).filter(Boolean);return 0===t.length?null:1===t.length?t[0]:{...e,title:el(e.titleKey,e.titleFallback),separatorHidden:ed.has(e.id),items:t}}return eo(e,ec)}).filter(Boolean);return{...e,title:el(e.titleKey,e.titleFallback),children:t}}).filter(e=>e.children.flatMap(e=>"group"===e.type?e.items:[e]).length>0),em=eu.flatMap(e=>e.children.flatMap(e=>"group"===e.type?e.items:[e])),ex=em.length<=12,ep=function(e,t){let s=null;for(let r of t)if(!r.external&&function(e,t,s=!1){return!!e&&(s?e===t:e===t||e.startsWith(`${t}/`))}(e,r.href,!0===r.exact)){if(!s||r.href.length>s.href.length){s=r;continue}r.href.length===s.href.length&&r.exact&&!s.exact&&(s=r)}return s?.href||null}(p,em),eh=ei.trim().length>0,ef=eh?function(e,t){let s=t.trim().toLowerCase();if(!s)return[...e];let r=e=>e.label.toLowerCase().includes(s),a=[];for(let t of e){let e=[];for(let s of t.children)if("object"==typeof s&&null!==s&&"type"in s&&"group"===s.type){let t=s.items.filter(r);t.length>0&&e.push({...s,items:t})}else r(s)&&e.push(s);e.length>0&&a.push({...t,children:e})}return a}(eu,ei):eu;(0,r.useEffect)(()=>{if(!t&&ee){if(es.current){es.current=!1;return}for(let e of eu)if(e.children.flatMap(e=>"group"===e.type?e.items:[e]).some(e=>!e.external&&e.href===ep)){X(t=>{let s=new Set([...Q,e.id]);return[...s].every(e=>t.has(e))&&s.size===t.size?t:(N(v,[...s]),s)});break}}},[ep,t,Q,ee]);let eb=(0,r.useCallback)(e=>{X(t=>{let s=function(e,t,s){if(e.has(s)){let t=new Set(e);return t.delete(s),t}return new Set([...t,s])}(t,Q,e);return N(v,[...s]),s})},[Q]),eg=(0,r.useCallback)(e=>{Z(t=>{let s=new Set(t);return s.has(e)?s.delete(e):(s.add(e),X(t=>{if(t.has(e))return t;let s=new Set(t);return s.add(e),N(v,[...s]),s})),N(j,[...s]),s})},[]),ey=async()=>{M(!0);try{await fetch("/api/restart",{method:"POST"})}catch(e){}M(!1),T(!1),E(!0),setTimeout(()=>globalThis.location.reload(),3e3)},ev=0===D.length,ej=ev?el("simpleMenu","Simple menu"):el("showAllMenus","Show all menus"),eN=ev?el("simpleMenuHint","Show only the main pages"):el("showAllMenusHint","Show every page in the menu"),ek=async()=>{let e=ev?"minimal":"all",t={[b.P]:(0,b.I)(e),[b.C]:e};R(!0);try{let e=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});e.ok?window.dispatchEvent(new CustomEvent(b.z,{detail:t})):console.error("Failed to switch the sidebar menu:",e.statusText)}catch(e){console.error("Error switching the sidebar menu:",e)}finally{R(!1)}},ew=(0,r.useCallback)((e,s,r)=>{if(!t)return;let a=e.currentTarget.getBoundingClientRect(),i=S.current?.getBoundingClientRect();ea({id:s,label:r,x:(i?.right??64)+8,y:a.top+a.height/2})},[t]),eS=(0,r.useCallback)(()=>ea(null),[]),eC=r=>{let i=!r.external&&ep===r.href,l=(0,n.f)("group relative flex min-h-8 items-center gap-2.5 rounded-md text-sm transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",t?"mx-auto size-9 justify-center":"px-2 py-1",i?"bg-surface-2 font-medium text-text-main":"text-text-muted hover:bg-surface-2 hover:text-text-main"),o=(0,n.f)("material-symbols-outlined shrink-0 text-[18px] transition-colors",i?"fill-1 text-primary-text":"text-text-muted group-hover:text-text-main"),c=(0,s.jsxs)(s.Fragment,{children:[i&&(0,s.jsx)("span",{"aria-hidden":"true",className:(0,n.f)("absolute start-0 top-1/2 w-0.5 -translate-y-1/2 rounded-full bg-primary",t?"h-5":"h-4")}),(0,s.jsx)("span",{className:o,"aria-hidden":"true",children:r.icon}),!t&&(0,s.jsx)("span",{className:"truncate",title:r.subtitle||r.label,children:r.label})]}),d={onMouseEnter:e=>ew(e,r.id,r.label),onMouseLeave:eS};return r.external?(0,s.jsx)("a",{href:r.href,target:"_blank",rel:"noopener noreferrer",onClick:e,className:l,...d,children:c},r.href):(0,s.jsx)(a.default,{href:r.href,prefetch:!1,onClick:e,className:l,...d,children:c},r.href)};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("aside",{ref:S,className:(0,n.f)("flex h-full min-h-0 flex-col border-e border-border bg-sidebar transition-[width] duration-200 ease-out",t?"w-14":"w-[232px]"),children:[(0,s.jsx)("a",{href:"#main-content",className:"sr-only focus:not-sr-only focus:absolute focus:z-50 focus:m-2 focus:rounded-control focus:bg-primary focus:p-3 focus:text-sm focus:text-on-primary",children:k("skipToContent")}),(0,s.jsxs)("div",{className:(0,n.f)("flex h-12 shrink-0 items-center gap-2 border-b border-border",t?"flex-col justify-center px-2 h-auto py-2":"px-3"),children:[(0,s.jsxs)(a.default,{href:"/home",prefetch:!1,className:(0,n.f)("flex min-w-0 items-center rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",t?"justify-center":"flex-1 gap-2"),children:[(0,s.jsx)("div",{className:"flex size-7 shrink-0 items-center justify-center rounded-md bg-primary text-on-primary",children:G?(0,s.jsx)("img",{src:G,alt:B||l.x.name,className:"size-4 object-contain"}):(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]","aria-hidden":"true",children:"alt_route"})}),!t&&(0,s.jsxs)("div",{className:"flex min-w-0 flex-col leading-tight",children:[(0,s.jsx)("h1",{className:"truncate text-sm font-semibold tracking-tight text-text-main",title:B||l.x.name,children:B||l.x.name}),(0,s.jsx)("span",{className:"truncate text-[11px] text-text-muted",children:l.x.description})]})]}),o&&(0,s.jsx)("button",{type:"button",onClick:o,title:t?k("expandSidebar"):k("collapseSidebar"),"aria-expanded":!t,"aria-label":t?k("expandSidebar"):k("collapseSidebar"),className:"flex size-7 shrink-0 items-center justify-center rounded-md text-text-muted transition-colors hover:bg-surface-2 hover:text-text-main focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]","aria-hidden":"true",children:t?"left_panel_open":"left_panel_close"})})]}),!t&&(0,s.jsx)("div",{className:"px-3 pb-2 pt-3",children:(0,s.jsx)(u.default,{type:"search",value:ei,onChange:e=>en(e.target.value),placeholder:w("search"),"aria-label":w("search"),icon:"search",className:"gap-0",inputClassName:"py-1.5 text-xs"})}),(0,s.jsxs)("nav",{"aria-label":k("mainNavigation"),className:(0,n.f)("min-h-0 flex-1 overflow-y-auto pb-3 custom-scrollbar",t?"space-y-0.5 px-2 pt-2":"px-3 pt-1"),children:[$&&eh&&0===ef.length&&(0,s.jsx)("p",{className:"px-2 py-3 text-xs text-text-muted",children:w("noResults")}),($?ef:[]).map((e,r)=>{let a=e.id,i=eh||ex||Y.has(a),l=Q.has(a),o=0===r,c=e.children.flatMap(e=>"group"===e.type?e.items:[e]);return t?(0,s.jsxs)("div",{children:[!o&&(0,s.jsx)("div",{className:"mx-1 my-2 border-t border-border"}),c.map(eC)]},e.id):!1===e.showTitle?(0,s.jsx)("div",{className:(0,n.f)("space-y-0.5",!o&&"mt-4"),children:c.map(eC)},e.id):(0,s.jsxs)("div",{className:o?"space-y-0.5":"mt-4",children:[ex?(0,s.jsx)("div",{className:"truncate px-2 pb-1 text-[11px] font-medium uppercase tracking-wider text-text-muted",children:e.title}):(0,s.jsxs)("div",{className:"group/header flex cursor-pointer items-center gap-0.5 rounded-md px-2 py-1 transition-colors hover:bg-surface-2",onClick:()=>eb(a),role:"button","aria-expanded":i,children:[(0,s.jsx)("span",{className:"flex-1 truncate text-[11px] font-medium uppercase tracking-wider text-text-muted transition-colors group-hover/header:text-text-main",children:e.title}),(0,s.jsx)("button",{onClick:e=>{e.stopPropagation(),eg(a)},title:l?k("unpinSection"):k("pinSectionOpen"),className:(0,n.f)("shrink-0 rounded p-0.5 transition-opacity",l?"text-primary-text opacity-100":"text-text-muted/60 opacity-0 hover:text-text-main group-hover/header:opacity-100"),children:(0,s.jsx)("span",{className:"material-symbols-outlined",style:{fontSize:"12px",...l?{fontVariationSettings:"'FILL' 1"}:{}},children:"push_pin"})}),(0,s.jsx)("span",{className:(0,n.f)("material-symbols-outlined shrink-0 text-[16px] text-text-muted/60 transition-transform duration-200 group-hover/header:text-text-muted",i&&"rotate-180"),children:"expand_more"})]}),i&&(0,s.jsx)("div",{className:"mt-0.5 space-y-0.5",children:e.children.map(e=>{if("group"===e.type){if(0===e.items.length)return null;let t=!0===e.separatorHidden;return(0,s.jsxs)("div",{className:t?"mt-0.5":"mt-3",children:[!t&&(0,s.jsx)("div",{className:"mb-0.5 flex items-center gap-2 px-2 py-0.5",children:(0,s.jsx)("span",{className:"truncate text-[11px] font-medium text-text-muted",children:e.title})}),e.items.map(eC)]},e.id)}return eC(e)})})]},e.id)})]}),(0,s.jsxs)("div",{className:"flex shrink-0 flex-col gap-0.5 border-t border-border p-2",children:[(0,s.jsxs)("button",{type:"button",onClick:ek,disabled:!$||O,"aria-busy":O,title:t?ej:eN,"aria-label":t?ej:void 0,className:(0,n.f)("flex min-h-8 items-center gap-2 rounded-md text-xs font-medium transition-colors disabled:opacity-50","text-text-muted hover:bg-surface-2 hover:text-text-main","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",t?"mx-auto size-9 justify-center":"w-full px-2",!$&&"invisible"),children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]","aria-hidden":"true",children:ev?"unfold_less":"unfold_more"}),!t&&(0,s.jsx)("span",{className:"truncate",children:ej})]}),(0,s.jsxs)("div",{className:t?"flex flex-col gap-1":"flex items-center gap-2",children:[!t&&(0,s.jsxs)("span",{className:"flex-1 truncate px-2 text-[11px] tabular-nums text-text-muted",children:[l.x.name," v",l.x.version]}),(0,s.jsxs)("button",{type:"button",onClick:()=>T(!0),title:k("restart"),"aria-label":k("restart"),className:(0,n.f)("flex min-h-8 items-center justify-center gap-1.5 rounded-md text-xs font-medium transition-colors","text-text-muted hover:bg-surface-2 hover:text-text-main","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",t?"mx-auto size-9":"px-2"),children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]","aria-hidden":"true",children:"restart_alt"}),!t&&(0,s.jsx)("span",{children:k("restart")})]})]}),!t&&(0,s.jsx)(c,{className:"px-2"})]})]}),t&&er&&(0,s.jsx)("div",{className:"fixed z-[200] pointer-events-none flex items-center",style:{left:er.x,top:er.y,transform:"translateY(-50%)"},children:(0,s.jsx)("div",{className:"whitespace-nowrap rounded-md border border-border bg-surface px-2 py-1 text-xs font-medium text-text-main shadow-elevated",children:er.label})}),(0,s.jsx)(m.ConfirmModal,{isOpen:C,onClose:()=>T(!1),onConfirm:ey,title:k("restart"),message:k("restartConfirm"),confirmText:k("restart"),cancelText:w("cancel"),variant:"warning",loading:I}),_&&(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm",children:(0,s.jsxs)("div",{className:"text-center p-8",children:[(0,s.jsx)("div",{className:"mx-auto mb-4 flex size-14 items-center justify-center rounded-full bg-error/15 text-error",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[28px]","aria-hidden":"true",children:"power_off"})}),(0,s.jsx)("h2",{className:"text-xl font-semibold text-white mb-2",children:k("serverDisconnected")}),(0,s.jsx)("p",{className:"mb-6 text-sm text-zinc-400",children:k("serverDisconnectedMsg")}),(0,s.jsx)(d.default,{variant:"secondary",onClick:()=>globalThis.location.reload(),children:k("reloadPage")})]})})]})}],647829)},905204,e=>{"use strict";e.i(843476),e.i(156132),e.s([])},897844,e=>{"use strict";var t=e.i(843476),s=e.i(948148),r=e.i(287531),a=e.i(156132);e.s(["default",0,function({className:e,variant:i="default"}){let{toggleTheme:n,isDark:l}=(0,r.f)(),o=(0,s.f)("header")(l?"switchToLightMode":"switchToDarkMode"),c={default:(0,a.f)("flex size-8 items-center justify-center rounded-md","text-text-muted hover:bg-surface-2 hover:text-text-main","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30","transition-colors"),card:(0,a.f)("flex size-8 items-center justify-center rounded-md","border border-border bg-surface","text-text-muted hover:bg-surface-2 hover:text-text-main","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30","transition-colors")};return(0,t.jsx)("button",{type:"button",onClick:n,className:(0,a.f)(c[i],e),"aria-label":o,title:o,children:(0,t.jsx)("span",{className:"material-symbols-outlined text-[18px]","aria-hidden":"true",children:l?"light_mode":"dark_mode"})})}])},635055,e=>{"use strict";var t=e.i(843476),s=e.i(156132);e.s(["default",0,function({checked:e=!1,onChange:r,label:a,description:i,disabled:n=!1,size:l="md",className:o,title:c,ariaLabel:d}){let u={xs:{track:"w-6 h-3",thumb:"size-[8px]",translate:"translate-x-3.5"},sm:{track:"w-8 h-4",thumb:"size-3",translate:"translate-x-4"},md:{track:"w-9 h-5",thumb:"size-4",translate:"translate-x-4"},lg:{track:"w-11 h-6",thumb:"size-5",translate:"translate-x-5"}};return(0,t.jsxs)("div",{className:(0,s.f)("flex items-center gap-3",n&&"opacity-50 cursor-not-allowed",o),children:[(0,t.jsx)("button",{type:"button",role:"switch","aria-checked":e,"aria-label":d||a||i||c||"Toggle",title:c,disabled:n,onClick:()=>{!n&&r&&r(!e)},className:(0,s.f)("relative inline-flex shrink-0 cursor-pointer rounded-full","transition-colors duration-200 ease-in-out","border","focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/30",e?"border-primary bg-primary":"border-border bg-surface-2 dark:bg-white/10",u[l].track,n&&"cursor-not-allowed"),children:(0,t.jsx)("span",{"aria-hidden":"true",className:(0,s.f)("pointer-events-none inline-block rounded-full bg-white shadow-[0_1px_2px_rgba(0,0,0,0.2)]","transform transition duration-200 ease-in-out",e?u[l].translate:"translate-x-0.5",u[l].thumb,"mt-0.5")})}),(a||i)&&(0,t.jsxs)("div",{className:"flex flex-col min-w-0",children:[a&&(0,t.jsx)("span",{className:"text-sm font-medium text-text-main",children:a}),i&&(0,t.jsx)("span",{className:"text-xs text-text-muted",children:i})]})]})}])},268226,e=>{"use strict";var t=e.i(843476),s=e.i(271645),r=e.i(703166),a=e.i(342923),i=e.i(80173);e.s(["default",0,function({isOpen:e,onSuccess:n,onClose:l,reauthConnection:o}){let[c,d]=(0,s.useState)(""),[u,m]=(0,s.useState)(""),[x,p]=(0,s.useState)(""),[h,f]=(0,s.useState)(""),[b,g]=(0,s.useState)("marscode-us"),[y,v]=(0,s.useState)("marscode"),[j,N]=(0,s.useState)("US-East"),[k,w]=(0,s.useState)(null),[S,C]=(0,s.useState)(!1),[T,I]=(0,s.useState)(!1),M=(0,s.useRef)(null),_=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(!e)return;let t=e=>{let t=e.data;if(!t||"trae-oauth-callback"!==t.type)return;let s=window.location,r="127.0.0.1"===s.hostname?"localhost":"localhost"===s.hostname?"127.0.0.1":null,a=new Set([s.origin]);r&&a.add(`${s.protocol}//${r}${s.port?`:${s.port}`:""}`),!a.has(e.origin)||_.current&&t.loginTraceId===_.current&&(I(!1),t.success?(n?.(),l()):w(t.error||"Authorization failed"))};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)},[e,n,l]);let E=async()=>{if(!c.trim())return void w("Access token is required.");C(!0),w(null);try{let e={accessToken:c.trim()};u.trim()&&(e.webId=u.trim()),x.trim()&&(e.bizUserId=x.trim()),h.trim()&&(e.userUniqueId=h.trim()),b.trim()&&(e.scope=b.trim()),y.trim()&&(e.tenant=y.trim()),j.trim()&&(e.region=j.trim());let t=await fetch("/api/oauth/trae/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();if(!t.ok)throw Error("string"==typeof s.error?s.error:s.error?.message||"Import failed");n?.(),l()}catch(e){w(e instanceof Error?e.message:String(e))}finally{C(!1)}};return(0,t.jsx)(r.default,{isOpen:e,title:"Connect Trae SOLO",onClose:l,children:(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"bg-emerald-50 dark:bg-emerald-900/20 p-4 rounded-lg border border-emerald-200 dark:border-emerald-800",children:[(0,t.jsxs)("p",{className:"text-sm text-emerald-900 dark:text-emerald-200 mb-2",children:["Authorize via ",(0,t.jsx)("span",{className:"font-mono",children:"trae.ai"})," in a popup. The popup will close itself once the token has been imported."]}),(0,t.jsxs)("p",{className:"text-xs text-emerald-800 dark:text-emerald-300 mb-3",children:[(0,t.jsx)("strong",{children:"Important:"})," you must be logged in to"," ",(0,t.jsx)("span",{className:"font-mono",children:"trae.ai"})," in ",(0,t.jsx)("em",{children:"this"}),' browser first. The authorize page only confirms an existing session — it cannot sign you in. If you see "Login Failed", click "Open solo.trae.ai", sign in, then return here.']}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(a.default,{onClick:()=>{var e;let t,s,r,a,i;w(null),I(!0);let n=(t=globalThis.crypto||globalThis.crypto,t?.randomUUID?t.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}));_.current=n;let l=window.location.port||("https:"===window.location.protocol?"443":"80"),o=(e=`http://127.0.0.1:${l}/authorize`,s=new Uint8Array(32),(globalThis.crypto||globalThis.crypto).getRandomValues(s),r=Array.from(s,e=>e.toString(16).padStart(2,"0")).join(""),i=new URLSearchParams({login_version:"1",auth_from:"solo",login_channel:"native_ide",plugin_version:"2.3.24254",auth_type:"local",client_id:"en1oxy7wnw8j9n",redirect:"0",login_trace_id:n,auth_callback_url:e,machine_id:r,device_id:a=function(){let e="";for(;e.length<19;)e+=Math.floor(1e10*Math.random()).toString();return e.slice(0,19)}(),x_device_id:a,x_machine_id:r,x_device_brand:"Mac14,7",x_device_type:"mac",x_os_version:"macOS 26.4.1",x_env:"",x_app_version:"0.1.7",x_app_type:"stable",hide_saas_login:"true"}),`https://www.trae.ai/authorization?${i.toString()}`),c=window.open(o,"trae-oauth","width=520,height=720");if(!c){I(!1),w("Popup blocked — allow popups for this site, or paste the token manually below.");return}M.current=c;let d=setInterval(()=>{c.closed&&(clearInterval(d),I(e=>(e&&w("Authorization window was closed before completing."),!1)))},700)},disabled:T,fullWidth:!0,children:T?"Waiting for trae.ai…":"Authorize with Browser"}),(0,t.jsx)(a.default,{onClick:()=>window.open("https://solo.trae.ai/","_blank","noopener,noreferrer"),variant:"ghost",fullWidth:!0,children:"Open solo.trae.ai"})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3 text-xs text-text-muted",children:[(0,t.jsx)("span",{className:"flex-1 border-t border-border"}),"or paste a token manually",(0,t.jsx)("span",{className:"flex-1 border-t border-border"})]}),(0,t.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,t.jsxs)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["Sign in to ",(0,t.jsx)("span",{className:"font-mono",children:"solo.trae.ai"}),", open DevTools → Network, send any chat message, and copy the JWT from the"," ",(0,t.jsx)("span",{className:"font-mono",children:"Authorization: Cloud-IDE-JWT <token>"})," request header. JWT lifetime is ~14 days. Optional identity fields come from"," ",(0,t.jsx)("span",{className:"font-mono",children:"common_params"})," in the same request body."]})}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Access Token (Cloud-IDE-JWT) ",(0,t.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,t.jsx)("textarea",{value:c,onChange:e=>d(e.target.value),placeholder:"eyJhbGciOiJSUzI1NiIs...",rows:3,className:"w-full px-3 py-2 text-sm font-mono border border-border rounded-lg bg-background focus:outline-none focus:border-primary resize-none"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-sm font-medium mb-1",children:["Web ID ",(0,t.jsx)("span",{className:"text-text-muted text-xs",children:"optional"})]}),(0,t.jsx)(i.default,{value:u,onChange:e=>m(e.target.value),placeholder:"76428...",className:"font-mono text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-sm font-medium mb-1",children:["Biz User ID ",(0,t.jsx)("span",{className:"text-text-muted text-xs",children:"optional"})]}),(0,t.jsx)(i.default,{value:x,onChange:e=>p(e.target.value),placeholder:"76428...",className:"font-mono text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{className:"block text-sm font-medium mb-1",children:["User Unique ID ",(0,t.jsx)("span",{className:"text-text-muted text-xs",children:"optional"})]}),(0,t.jsx)(i.default,{value:h,onChange:e=>f(e.target.value),placeholder:"76428...",className:"font-mono text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium mb-1",children:"Scope"}),(0,t.jsx)(i.default,{value:b,onChange:e=>g(e.target.value),className:"text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium mb-1",children:"Tenant"}),(0,t.jsx)(i.default,{value:y,onChange:e=>v(e.target.value),className:"text-sm"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium mb-1",children:"Region"}),(0,t.jsx)(i.default,{value:j,onChange:e=>N(e.target.value),className:"text-sm"})]})]}),k&&(0,t.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,t.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:k})}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(a.default,{onClick:E,fullWidth:!0,disabled:S||!c.trim(),children:S?"Importing…":"Import Token"}),(0,t.jsx)(a.default,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}])},566770,801646,e=>{"use strict";var t=e.i(843476),s=e.i(271645),r=e.i(861745),a=e.i(948148),i=e.i(393718),n=e.i(454149),l=e.i(243009);async function o(e,t){try{let t=await e.json(),s=t?.error;if("string"==typeof s&&s.trim())return s.trim();if(s&&"object"==typeof s){let e=s.message;if("string"==typeof e&&e.trim())return e.trim()}}catch{}return t}var c=e.i(523629);let d={priority:"serviceTierFast",flex:"serviceTierFlex",standard:"serviceTierStandard"},u={priority:"Fast",flex:"Flex",standard:"Standard"};function m(e){let t="string"==typeof e?e.trim().toLowerCase():"";return"priority"===t||"fast"===t?"priority":"flex"===t?"flex":"standard"}function x(e,t,s){return"function"==typeof e.has&&e.has(t)?e(t):s}function p(e,t,s){let r=m(t),a="string"==typeof s?s.trim():"",i=a&&m(a)!==r?a:u[r];return x(e,d[r],i)}e.s(["q",0,p,"j",0,x],801646);let h=new Set(["model"]),f=[{field:"model",labelKey:"chartModel",align:"left"},{field:"requests",labelKey:"chartRequests",align:"right"},{field:"promptTokens",labelKey:"chartInput",align:"right"},{field:"completionTokens",labelKey:"chartOutput",align:"right"},{field:"totalTokens",labelKey:"chartTotal",align:"right"},{field:"cost",labelKey:"chartCost",align:"right"}];function b({active:e,sortOrder:s}){return e?(0,t.jsx)("span",{className:"material-symbols-outlined text-[12px] text-primary-text",children:"asc"===s?"expand_less":"expand_more"}):(0,t.jsx)("span",{className:"material-symbols-outlined text-[12px] opacity-0 group-hover:opacity-30",children:"unfold_more"})}function g({byModel:e,summary:r}){let n=(0,a.f)("analytics"),[o,d]=(0,s.useState)({by:"totalTokens",order:"desc"}),u=(0,s.useCallback)(e=>{d(t=>{var s,r;let a=(s=t.by,r=t.order,s===e?{sortBy:e,sortOrder:"asc"===r?"desc":"asc"}:{sortBy:e,sortOrder:"desc"});return{by:a.sortBy,order:a.sortOrder}})},[]),m=(0,s.useMemo)(()=>{let t;return t=Number(r?.totalTokens??0),(e||[]).map(e=>{if(void 0!==e.pct&&null!==e.pct&&""!==e.pct)return{...e};let s=Number(e.totalTokens??0),r=t>0?(s/t*100).toFixed(1):"0";return{...e,pct:r}})},[e,r?.totalTokens]),x=(0,s.useMemo)(()=>{var e,t;let s;return e=o.by,t=o.order,(s=[...m||[]]).sort((s,r)=>{let a=s[e],i=r[e];if(h.has(e)||"string"==typeof a||"string"==typeof i){let e=String(a??""),s=String(i??""),r=e.localeCompare(s,void 0,{sensitivity:"base",numeric:!0});return"asc"===t?r:-r}let n=Number(a??0),l=Number(i??0),o=Number.isFinite(n)?n:0,c=Number.isFinite(l)?l:0;return"asc"===t?o-c:c-o}),s},[m,o.by,o.order]);return(0,t.jsxs)(i.default,{className:"overflow-hidden",children:[(0,t.jsx)("div",{className:"p-4 border-b border-border",children:(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:n("chartModelBreakdown")})}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full text-sm",children:[(0,t.jsx)("thead",{className:"text-xs font-medium text-text-muted bg-surface-2/60",children:(0,t.jsxs)("tr",{children:[f.map(e=>(0,t.jsx)("th",{className:`px-4 py-2.5 ${"right"===e.align?"text-right":"text-left"}`,children:(0,t.jsxs)("button",{type:"button",className:`inline-flex items-center gap-1 cursor-pointer group hover:text-text-main ${"right"===e.align?"justify-end w-full":"justify-start"}`,onClick:()=>u(e.field),children:[(0,t.jsx)("span",{children:n(e.labelKey)}),(0,t.jsx)(b,{active:o.by===e.field,sortOrder:o.order})]})},e.field)),(0,t.jsx)("th",{className:"px-4 py-2.5 text-right w-36",children:n("chartShare")})]})}),(0,t.jsx)("tbody",{className:"divide-y divide-border",children:x.map((e,s)=>(0,t.jsxs)("tr",{className:"hover:bg-surface-2/60 transition-colors",children:[(0,t.jsx)("td",{className:"px-4 py-2.5",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:(0,c.T)(s)}}),(0,t.jsx)("span",{className:"font-medium",children:e.model})]})}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums text-text-muted",children:(0,l.I)(e.requests)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums text-text-main",children:(0,l.i)(e.promptTokens)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums text-text-main",children:(0,l.i)(e.completionTokens)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums font-semibold text-text-main",children:(0,l.i)(e.totalTokens)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums text-text-main",children:(0,l.r)(e.cost)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,t.jsx)("div",{className:"w-16 h-1.5 rounded-full bg-surface-2 overflow-hidden",children:(0,t.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${e.pct??0}%`,backgroundColor:(0,c.T)(s)}})}),(0,t.jsxs)("span",{className:"text-xs font-mono text-text-muted w-10 text-right",children:[e.pct??0,"%"]})]})})]},String(e.model??s)))})]})})]})}function y(e,t){try{return new Intl.DateTimeFormat(e,t)}catch{return new Intl.DateTimeFormat(void 0,t)}}function v({active:e,sortOrder:s}){return e?(0,t.jsx)("span",{className:"material-symbols-outlined text-[12px] text-primary-text",children:"asc"===s?"expand_less":"expand_more"}):(0,t.jsx)("span",{className:"material-symbols-outlined text-[12px] opacity-0 group-hover:opacity-30",children:"unfold_more"})}let j=new Set(["text-success","text-warning","text-error","text-primary-text","text-text-main","text-text-muted"]);function N(e){return e&&j.has(e)?e:"text-text-main"}function k({icon:e,label:s,value:r,subValue:a,color:n="text-text-main"}){return(0,t.jsxs)(i.default,{padding:"sm",className:"flex flex-col min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-xs font-medium text-text-muted min-w-0",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[18px] shrink-0","aria-hidden":"true",children:e}),(0,t.jsx)("span",{className:"truncate",title:"string"==typeof s?s:void 0,children:s})]}),(0,t.jsx)("span",{className:`mt-1 text-2xl font-semibold tracking-tight tabular-nums truncate ${N(n)}`,title:String(r),children:r}),a&&(0,t.jsx)("span",{className:"mt-0.5 text-xs text-text-muted truncate",children:a})]})}function w({sections:e}){return(0,t.jsx)(i.default,{className:"px-5 py-4",children:(0,t.jsx)("div",{className:"flex flex-col gap-3",children:e.map((e,s)=>(0,t.jsxs)("div",{children:[s>0&&(0,t.jsx)("div",{className:"border-t border-border mb-3"}),(0,t.jsx)("div",{className:"text-sm font-semibold text-text-main mb-2",children:e.title}),(0,t.jsx)("div",{className:e.wideValues?"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 gap-x-5 gap-y-2":"grid grid-cols-2 md:grid-cols-4 gap-x-5 gap-y-2",children:e.items.map((s,r)=>(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 min-w-0 py-0.5",children:[(0,t.jsxs)("div",{className:`flex items-center gap-1.5 ${e.wideValues?"shrink-0":"min-w-0"}`,children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted shrink-0","aria-hidden":"true",children:s.icon}),(0,t.jsx)("span",{className:`text-xs font-medium text-text-muted ${e.wideValues?"whitespace-nowrap":"truncate"}`,title:s.label,children:s.label})]}),(0,t.jsx)("span",{className:`text-sm font-semibold tabular-nums text-right ${e.wideValues?"truncate min-w-0":"shrink-0"} ${N(s.color)}`,title:String(s.value),children:s.value})]},r))})]},s))})})}function S({activityMap:e}){let n=(0,a.f)("analytics"),o=(0,r.X)(),c=(0,s.useRef)(null),d=(0,s.useMemo)(()=>y(o,{month:"short"}),[o]),u=(0,s.useMemo)(()=>y(o,{weekday:"short"}),[o]),m=(0,s.useMemo)(()=>{let t=new Date,s=[],r=0;for(let a=364;a>=0;a--){let i=new Date(t);i.setDate(i.getDate()-a);let n=`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}-${String(i.getDate()).padStart(2,"0")}`,l=e?.[n]||0;l>r&&(r=l),s.push({date:n,value:l,dayOfWeek:i.getDay()})}return{days:s,maxVal:r}},[e]),x=(0,s.useMemo)(()=>{let e=[],t=[],s=m.days[0]?.dayOfWeek||0;for(let e=0;e<s;e++)t.push(null);for(let s of m.days)t.push(s),7===t.length&&(e.push(t),t=[]);return t.length>0&&e.push(t),e},[m]);(0,s.useEffect)(()=>{c.current&&(c.current.scrollLeft=c.current.scrollWidth)},[x]);let p=(0,s.useMemo)(()=>{let e=[],t=-1;return x.forEach((s,r)=>{let a=s.find(e=>null!==e);if(a){let s=new Date(a.date).getMonth();s!==t&&(e.push({weekIdx:r,label:d.format(new Date(2024,s,1))}),t=s)}}),e},[d,x]),h=(0,s.useMemo)(()=>[1,3,5].map(e=>u.format(new Date(2024,0,7+e))),[u]);return(0,t.jsxs)(i.default,{className:"p-4 h-full min-w-0 overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:n("overview")}),(0,t.jsx)("span",{className:"text-xs text-text-muted",children:n("activitySummary",{active:Object.keys(e||{}).length,tokens:(0,l.i)(Object.values(e||{}).reduce((e,t)=>e+t,0)),days:365})})]}),(0,t.jsx)("div",{ref:c,className:"overflow-x-auto",children:(0,t.jsxs)("div",{className:"w-max",children:[(0,t.jsx)("div",{className:"flex gap-[3px] mb-1 ml-6",style:{fontSize:"10px"},children:p.map((e,s)=>(0,t.jsx)("span",{className:"text-text-muted",style:{position:"relative",left:`${13*e.weekIdx}px`,marginLeft:0===s?0:"-20px"},children:e.label},s))}),(0,t.jsxs)("div",{className:"flex gap-[3px]",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-[3px] shrink-0 text-[10px] text-text-muted pr-1 sticky left-0 z-10 bg-surface",children:[(0,t.jsx)("span",{className:"h-[10px]"}),(0,t.jsx)("span",{className:"h-[10px] leading-[10px]",children:h[0]}),(0,t.jsx)("span",{className:"h-[10px]"}),(0,t.jsx)("span",{className:"h-[10px] leading-[10px]",children:h[1]}),(0,t.jsx)("span",{className:"h-[10px]"}),(0,t.jsx)("span",{className:"h-[10px] leading-[10px]",children:h[2]}),(0,t.jsx)("span",{className:"h-[10px]"})]}),x.map((e,s)=>(0,t.jsx)("div",{className:"flex flex-col gap-[3px]",children:e.map((e,s)=>(0,t.jsx)("div",{title:e?n("activityCellTitle",{date:e.date,tokens:(0,l.I)(e.value)}):"",className:`w-[10px] h-[10px] rounded-[2px] ${e?function(e){if(!e||0===e)return"bg-surface-2";let t=Math.min(e/(m.maxVal||1),1);return t<.25?"bg-primary/20":t<.5?"bg-primary/40":t<.75?"bg-primary/60":"bg-primary/90"}(e.value):"bg-transparent"}`},s))},s))]})]})}),(0,t.jsxs)("div",{className:"flex items-center gap-1 mt-2 ml-6 text-[10px] text-text-muted",children:[(0,t.jsx)("span",{children:n("activityLess")}),(0,t.jsx)("div",{className:"w-[10px] h-[10px] rounded-[2px] bg-surface-2"}),(0,t.jsx)("div",{className:"w-[10px] h-[10px] rounded-[2px] bg-primary/20"}),(0,t.jsx)("div",{className:"w-[10px] h-[10px] rounded-[2px] bg-primary/40"}),(0,t.jsx)("div",{className:"w-[10px] h-[10px] rounded-[2px] bg-primary/60"}),(0,t.jsx)("div",{className:"w-[10px] h-[10px] rounded-[2px] bg-primary/90"}),(0,t.jsx)("span",{children:n("activityMore")})]})]})}function C({byApiKey:e}){let r=(0,a.f)("analytics"),[n,o]=(0,s.useState)(""),[c,d]=(0,s.useState)("totalTokens"),[u,m]=(0,s.useState)("desc"),x=(0,s.useMemo)(()=>e||[],[e]),p=(0,s.useMemo)(()=>{let e=n.trim().toLowerCase();return e?x.filter(t=>(t.apiKeyName||"").toLowerCase().includes(e)||(t.apiKeyId||"").toLowerCase().includes(e)):x},[x,n]),h=(0,s.useMemo)(()=>{let e=[...p];return e.sort((e,t)=>{let s=e[c]??0,r=t[c]??0;return"string"==typeof s?"asc"===u?s.localeCompare(r):r.localeCompare(s):"asc"===u?s-r:r-s}),e},[p,c,u]),f=(0,s.useCallback)(e=>{c===e?m(e=>"asc"===e?"desc":"asc"):(d(e),m("desc"))},[c]);return x.length>0?(0,t.jsxs)(i.default,{className:"overflow-hidden",children:[(0,t.jsxs)("div",{className:"p-4 border-b border-border flex items-center justify-between gap-3",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:r("chartApiKeyBreakdown")}),(0,t.jsx)("input",{type:"text",value:n,onChange:e=>o(e.target.value),placeholder:r("filterSearchKeys"),className:"w-full max-w-[220px] h-8 px-3 rounded-control bg-surface border border-border text-xs text-text-main placeholder:text-text-muted focus:outline-none focus:border-primary"})]}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full text-sm",children:[(0,t.jsx)("thead",{className:"text-xs font-medium text-text-muted bg-surface-2/60",children:(0,t.jsxs)("tr",{children:[(0,t.jsxs)("th",{className:"px-4 py-2.5 text-left cursor-pointer group",onClick:()=>f("apiKeyName"),children:[r("chartApiKey")," ",(0,t.jsx)(v,{active:"apiKeyName"===c,sortOrder:u})]}),(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:()=>f("requests"),children:[r("chartRequests")," ",(0,t.jsx)(v,{active:"requests"===c,sortOrder:u})]}),(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:()=>f("promptTokens"),children:[r("chartInput")," ",(0,t.jsx)(v,{active:"promptTokens"===c,sortOrder:u})]}),(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:()=>f("completionTokens"),children:[r("chartOutput")," ",(0,t.jsx)(v,{active:"completionTokens"===c,sortOrder:u})]}),(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:()=>f("totalTokens"),children:[r("chartTotal")," ",(0,t.jsx)(v,{active:"totalTokens"===c,sortOrder:u})]}),(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:()=>f("cost"),children:[r("chartCost")," ",(0,t.jsx)(v,{active:"cost"===c,sortOrder:u})]})]})}),(0,t.jsxs)("tbody",{className:"divide-y divide-border",children:[h.map((e,s)=>(0,t.jsxs)("tr",{className:"hover:bg-surface-2/60 transition-colors",children:[(0,t.jsx)("td",{className:"px-4 py-2.5",children:(0,t.jsx)("span",{className:"font-medium",title:e.apiKeyName||e.apiKeyId||"unknown",children:(0,l.J)(e.apiKeyName,e.apiKeyId)})}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums text-text-muted",children:(0,l.I)(e.requests)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums text-text-main",children:(0,l.i)(e.promptTokens)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums text-text-main",children:(0,l.i)(e.completionTokens)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums font-semibold text-text-main",children:(0,l.i)(e.totalTokens)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums text-text-main",children:(0,l.r)(e.cost)})]},`${e.apiKeyId||e.apiKeyName||"key"}-${s}`)),0===h.length&&(0,t.jsx)("tr",{children:(0,t.jsx)("td",{colSpan:6,className:"px-4 py-8 text-center text-text-muted",children:r("filterNoKeysMatch")})})]})]})})]}):(0,t.jsxs)(i.default,{className:"p-4 flex-1",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main mb-3",children:r("chartApiKeyBreakdown")}),(0,t.jsx)("div",{className:"text-center text-text-muted text-sm py-8",children:r("chartNoData")})]})}function T({activityMap:e}){let n=(0,a.f)("analytics"),o=(0,r.X)(),c=(0,s.useMemo)(()=>y(o,{weekday:"long"}),[o]),d=(0,s.useMemo)(()=>y(o,{month:"short",day:"numeric"}),[o]),u=(0,s.useMemo)(()=>{if(!e)return null;let t=new Date,s=null,r=0;for(let a=0;a<7;a++){let i=new Date(t);i.setDate(i.getDate()-a);let n=`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}-${String(i.getDate()).padStart(2,"0")}`,l=e[n]||0;l>r&&(r=l,s=n)}if(!s||0===r)return null;let a=new Date(s+"T12:00:00");return{weekday:c.format(a),label:d.format(a),tokens:r}},[e,d,c]);return(0,t.jsxs)(i.default,{className:"p-4 flex flex-col justify-center",style:{flex:1,minHeight:0},children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main mb-2",children:n("mostActiveDay")}),u?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-xl font-semibold tracking-tight text-text-main capitalize",style:{lineHeight:1.2},children:u.weekday}),(0,t.jsx)("span",{className:"text-xs mt-1",style:{color:"var(--color-text-muted)"},children:n("datedTokenCount",{date:u.label,tokens:(0,l.i)(u.tokens)})})]}):(0,t.jsx)("span",{className:"text-xs",style:{color:"var(--color-text-muted)"},children:n("noDataLast7Days")})]})}function I({activityMap:e}){let n=(0,a.f)("analytics"),o=(0,r.X)(),c=(0,s.useMemo)(()=>y(o,{weekday:"short"}),[o]),d=(0,s.useMemo)(()=>y(o,{month:"short",day:"numeric"}),[o]),u=(0,s.useMemo)(()=>{if(!e)return[];let t=new Date,s=[],r=0;for(let a=6;a>=0;a--){let i=new Date(t);i.setDate(i.getDate()-a);let n=`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}-${String(i.getDate()).padStart(2,"0")}`,l=e[n]||0;l>r&&(r=l),s.push({key:n,val:l,label:c.format(i),dateLabel:d.format(i)})}return s.map(e=>({...e,intensity:r>0?e.val/r:0}))},[e,d,c]);return(0,t.jsxs)(i.default,{className:"p-4 flex flex-col justify-center",style:{flex:1,minHeight:0},children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main mb-3",children:n("chartWeekly")}),(0,t.jsx)("div",{style:{display:"flex",alignItems:"flex-end",gap:6,justifyContent:"center"},children:u.map((e,s)=>(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:4},children:[(0,t.jsx)("div",{title:n("activityCellTitle",{date:e.dateLabel,tokens:(0,l.I)(e.val)}),style:{width:36,height:36,borderRadius:6,...function(e){if(0===e)return{background:"var(--color-surface-2)"};let t=Math.round((.15+.75*e)*100);return{background:`color-mix(in srgb, var(--color-primary) ${t}%, transparent)`}}(e.intensity),transition:"all 0.2s",cursor:"default"}}),(0,t.jsx)("span",{style:{fontSize:9,fontWeight:500,color:"var(--color-text-muted)"},children:e.label})]},e.key))})]})}function M({byServiceTier:e,summary:r}){let n=(0,a.f)("costs"),o=(0,a.f)("analytics"),c=(0,s.useMemo)(()=>e||[],[e]),d=Number(r?.totalRequests||0),u=Number(r?.totalCost||0);return c.length?(0,t.jsxs)(i.default,{className:"overflow-hidden",children:[(0,t.jsxs)("div",{className:"p-4 border-b border-border flex items-center justify-between gap-3",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:x(n,"serviceTierBreakdownTitle","Service Tier")}),(0,t.jsx)("span",{className:"text-xs text-text-muted",children:x(n,"serviceTierBreakdownSubtitle","Fast / Flex / Standard split")})]}),(0,t.jsx)("div",{className:"divide-y divide-border",children:c.map(e=>{var s,r,a;let i="flex"===e.serviceTier,c=p(n,e.serviceTier,e.label),m=d>0?(Number(e.requests||0)/d*100).toFixed(1):"0",h=u>0?(Number(e.cost||0)/u*100).toFixed(1):"0",f=Number(e.usageSavingsTokens||0),b=Number(e.savings||0),g=i&&f>0?` \xb7 ${(0,l.i)(f)} ${x(n,"serviceTierUsageSaved","usage saved")}`:"",y=i&&b>0?`${(0,l.r)(b)} ${x(n,"serviceTierCostSaved","saved")}`:`${h}% ${x(n,"serviceTierCostShareSuffix","of cost")}`;return(0,t.jsxs)("div",{className:"p-4 flex flex-col gap-3",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:`material-symbols-outlined text-[18px] ${"priority"===(s=e.serviceTier)?"text-primary-text":"flex"===s?"text-success":"text-text-muted"}`,children:"priority"===(r=e.serviceTier)?"bolt":"flex"===r?"savings":"speed"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-sm font-semibold text-text-main",children:c}),(0,t.jsxs)("div",{className:"text-xs text-text-muted",children:[o("requestTokenSummary",{requests:(0,l.I)(e.requests),tokens:(0,l.i)(e.totalTokens)}),g]})]})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:`font-mono tabular-nums text-sm font-semibold ${"flex"===e.serviceTier?"text-success":"text-text-main"}`,children:(0,l.r)(e.cost)}),(0,t.jsx)("div",{className:"text-xs text-text-muted",children:y})]})]}),(0,t.jsx)("div",{className:"h-1.5 rounded-full bg-surface-2 overflow-hidden",children:(0,t.jsx)("div",{className:`h-full rounded-full ${"priority"===(a=e.serviceTier)?"bg-primary":"flex"===a?"bg-success":"bg-text-muted/50"}`,style:{width:`${m}%`}})})]},e.serviceTier)})})]}):null}function _({byProvider:e}){let r=(0,a.f)("analytics"),[n,o]=(0,s.useState)("totalTokens"),[d,u]=(0,s.useState)("desc"),m=(0,s.useMemo)(()=>e||[],[e]),x=(0,s.useMemo)(()=>m.reduce((e,t)=>e+t.totalTokens,0),[m]),p=(0,s.useCallback)(e=>{n===e?u(e=>"asc"===e?"desc":"asc"):(o(e),u("desc"))},[n]),h=(0,s.useMemo)(()=>{let e=[...m];return e.sort((e,t)=>{let s=e[n]??0,r=t[n]??0;return"string"==typeof s?"asc"===d?s.localeCompare(r):r.localeCompare(s):"asc"===d?s-r:r-s}),e},[m,n,d]);return m.length?(0,t.jsxs)(i.default,{className:"overflow-hidden",children:[(0,t.jsx)("div",{className:"p-4 border-b border-border",children:(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:r("chartProviderBreakdown")})}),(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full text-sm",children:[(0,t.jsx)("thead",{className:"text-xs font-medium text-text-muted bg-surface-2/60",children:(0,t.jsxs)("tr",{children:[(0,t.jsxs)("th",{className:"px-4 py-2.5 text-left cursor-pointer group",onClick:()=>p("provider"),children:[r("chartProvider")," ",(0,t.jsx)(v,{active:"provider"===n,sortOrder:d})]}),(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:()=>p("requests"),children:[r("chartRequests")," ",(0,t.jsx)(v,{active:"requests"===n,sortOrder:d})]}),(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:()=>p("promptTokens"),children:[r("chartInput")," ",(0,t.jsx)(v,{active:"promptTokens"===n,sortOrder:d})]}),(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:()=>p("completionTokens"),children:[r("chartOutput")," ",(0,t.jsx)(v,{active:"completionTokens"===n,sortOrder:d})]}),(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:()=>p("totalTokens"),children:[r("chartTotal")," ",(0,t.jsx)(v,{active:"totalTokens"===n,sortOrder:d})]}),(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:()=>p("cost"),children:[r("chartCost")," ",(0,t.jsx)(v,{active:"cost"===n,sortOrder:d})]}),(0,t.jsx)("th",{className:"px-4 py-2.5 text-right w-36",children:r("chartShare")})]})}),(0,t.jsx)("tbody",{className:"divide-y divide-border",children:h.map((e,s)=>{let r=x>0?(e.totalTokens/x*100).toFixed(1):"0";return(0,t.jsxs)("tr",{className:"hover:bg-surface-2/60 transition-colors",children:[(0,t.jsx)("td",{className:"px-4 py-2.5",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:c.N[s%c.N.length]}}),(0,t.jsx)("span",{className:"font-medium capitalize",children:e.provider})]})}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums text-text-muted",children:(0,l.I)(e.requests)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums text-text-main",children:(0,l.i)(e.promptTokens)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums text-text-main",children:(0,l.i)(e.completionTokens)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums font-semibold text-text-main",children:(0,l.i)(e.totalTokens)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums text-text-main",children:(0,l.r)(e.cost)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,t.jsx)("div",{className:"w-16 h-1.5 rounded-full bg-surface-2 overflow-hidden",children:(0,t.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${r}%`,backgroundColor:c.N[s%c.N.length]}})}),(0,t.jsxs)("span",{className:"text-xs font-mono text-text-muted w-10 text-right",children:[r,"%"]})]})})]},`${e.provider}-${s}`)})})]})})]}):(0,t.jsxs)(i.default,{className:"p-4",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main mb-3",children:r("chartProviderBreakdown")}),(0,t.jsx)("div",{className:"text-center text-text-muted text-sm py-8",children:r("chartNoData")})]})}let E=null,K=null;function A(){let[t,r]=(0,s.useState)(E);return(0,s.useEffect)(()=>{if(t)return;let s=!1;return(E?Promise.resolve(E):(!K&&(K=e.A(416494).then(e=>(E=e,e)).catch(e=>{throw K=null,e})),K)).then(e=>{s||r(e)}).catch(()=>{s||r(null)}),()=>{s=!0}},[t]),t}function D({className:e="p-4 flex-1"}){return(0,t.jsx)(i.default,{className:e,children:(0,t.jsx)("div",{className:"py-8","aria-hidden":"true"})})}function L({active:e,payload:s,label:r,formatter:a}){return e&&s?.length?(0,t.jsxs)("div",{className:"rounded-control border border-border bg-surface px-3 py-2 text-xs shadow-soft",children:[r&&(0,t.jsx)("div",{className:"font-semibold text-text-main mb-1",children:r}),s.map((e,s)=>(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-text-muted",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:e.color}}),(0,t.jsxs)("span",{children:[e.name,":"]}),(0,t.jsx)("span",{className:"font-mono tabular-nums font-medium text-text-main",children:a?a(e.value):e.value})]},s))]}):null}function $({pieData:e,title:s,formatter:r,valueClassName:a="text-text-muted",labelClassName:n="",getLegendKey:l,getLegendTitle:o}){let c=A();if(!c)return(0,t.jsx)(D,{});let{Cell:d,PieChart:u,Pie:m,Tooltip:x,ResponsiveContainer:p}=c;return(0,t.jsxs)(i.default,{className:"p-4 flex-1",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main mb-3",children:s}),(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)(p,{width:120,height:120,children:(0,t.jsxs)(u,{children:[(0,t.jsx)(m,{data:e,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",innerRadius:28,outerRadius:55,paddingAngle:1,animationDuration:600,children:e.map((e,s)=>(0,t.jsx)(d,{fill:e.fill,stroke:"none"},s))}),(0,t.jsx)(x,{content:(0,t.jsx)(L,{formatter:r})})]})}),(0,t.jsx)("div",{className:"flex flex-col gap-1 min-w-0 flex-1",children:e.map((e,s)=>(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 text-xs",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 min-w-0",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:e.fill}}),(0,t.jsx)("span",{className:`truncate text-text-main ${n}`.trim(),title:o?.(e),children:e.name})]}),(0,t.jsx)("span",{className:`font-mono tabular-nums font-medium shrink-0 ${a}`,children:r(e.value)})]},l?l(e,s):s))})]})]})}function P({byAccount:e}){let r=(0,a.f)("analytics"),n=(0,s.useMemo)(()=>e||[],[e]),o=n.length>0,d=(0,s.useMemo)(()=>n.slice(0,8).map((e,t)=>({name:e.account,value:e.totalTokens,fill:(0,c.T)(t)})),[n]);return o?(0,t.jsx)($,{pieData:d,title:r("chartByAccount"),formatter:l.i}):(0,t.jsxs)(i.default,{className:"p-4 flex-1",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main mb-3",children:r("chartByAccount")}),(0,t.jsx)("div",{className:"text-center text-text-muted text-sm py-8",children:r("chartNoData")})]})}function O({byApiKey:e}){let r=(0,a.f)("analytics"),n=(0,s.useMemo)(()=>e||[],[e]),o=n.length>0,d=(0,s.useMemo)(()=>n.slice(0,8).map((e,t)=>({name:(0,l.J)(e.apiKeyName,e.apiKeyId),fullName:e.apiKeyName||e.apiKeyId||r("unknownApiKey"),value:e.totalTokens,fill:(0,c.T)(t)})),[n,r]);return o?(0,t.jsx)($,{pieData:d,title:r("chartByApiKey"),formatter:l.i,getLegendKey:(e,t)=>`${e.fullName}-${t}`,getLegendTitle:e=>e.fullName}):(0,t.jsxs)(i.default,{className:"p-4 flex-1",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main mb-3",children:r("chartByApiKey")}),(0,t.jsx)("div",{className:"text-center text-text-muted text-sm py-8",children:r("chartNoData")})]})}function R({byProvider:e}){let r=(0,a.f)("analytics"),n=(0,s.useMemo)(()=>e||[],[e]),o=n.length>0&&n.some(e=>e.cost>0),d=(0,s.useMemo)(()=>n.filter(e=>e.cost>0).sort((e,t)=>t.cost-e.cost).slice(0,8).map((e,t)=>({name:e.provider,value:e.cost,fill:c.N[t%c.N.length]})),[n]);return o?(0,t.jsx)($,{pieData:d,title:r("chartCostByProvider"),formatter:l.r,valueClassName:"text-text-main",labelClassName:"capitalize"}):(0,t.jsxs)(i.default,{className:"p-4 flex-1",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main mb-3",children:r("chartCostByProvider")}),(0,t.jsx)("div",{className:"text-center text-text-muted text-sm py-8",children:r("chartNoCostData")})]})}function z({dailyTrend:e}){let r=(0,a.f)("analytics"),n=(0,s.useMemo)(()=>(e||[]).map(e=>({date:e.date.slice(5),[r("chartInput")]:e.promptTokens,[r("chartOutput")]:e.completionTokens,[r("chartCost")]:e.cost||0})),[e,r]),l=(0,s.useMemo)(()=>n.some(e=>e[r("chartCost")]>0),[n,r]);return n.length?(0,t.jsx)(F,{chartData:n,hasCost:l}):(0,t.jsxs)(i.default,{className:"p-4",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main mb-3",children:r("chartModelUsageOverTime")}),(0,t.jsx)("div",{className:"text-center text-text-muted text-sm py-8",children:r("chartNoData")})]})}function F({chartData:e,hasCost:s}){let r=(0,a.f)("analytics"),n=A();if(!n)return(0,t.jsx)(D,{});let{ComposedChart:l,Bar:o,Line:c,XAxis:d,YAxis:u,Tooltip:m,ResponsiveContainer:x}=n;return(0,t.jsxs)(i.default,{className:"p-4 flex-1",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main mb-3",children:r("chartModelUsageOverTime")}),(0,t.jsx)(x,{width:"100%",height:140,children:(0,t.jsxs)(l,{data:e,margin:{top:0,right:40*!!s,left:0,bottom:0},children:[(0,t.jsx)(d,{dataKey:"date",tick:{fontSize:9,fill:"var(--color-text-muted)"},axisLine:!1,tickLine:!1,interval:Math.max(Math.floor(e.length/6),0)}),s&&(0,t.jsx)(u,{yAxisId:"cost",orientation:"right",tick:{fontSize:8,fill:"var(--color-text-muted)"},axisLine:!1,tickLine:!1,tickFormatter:e=>`$${e.toFixed(2)}`,width:36}),(0,t.jsx)(m,{content:(0,t.jsx)(U,{}),cursor:{fill:"var(--color-surface-2)"}}),(0,t.jsx)(o,{dataKey:r("chartInput"),stackId:"a",fill:"var(--color-primary)",opacity:.7,radius:[0,0,0,0],animationDuration:600}),(0,t.jsx)(o,{dataKey:r("chartOutput"),stackId:"a",fill:"var(--color-text-muted)",opacity:.7,radius:[3,3,0,0],animationDuration:600}),s&&(0,t.jsx)(c,{yAxisId:"cost",type:"monotone",dataKey:r("chartCost"),stroke:"var(--color-text-main)",strokeWidth:2,dot:!1,animationDuration:600})]})}),(0,t.jsxs)("div",{className:"flex items-center gap-4 mt-2 text-[10px] text-text-muted",children:[(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-primary/70"})," ",r("chartInput")]}),(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-text-muted/70"})," ",r("chartOutput")]}),s&&(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full bg-text-main"})," ",r("chartCost")," ($)"]})]})]})}function U({active:e,payload:s,label:r}){let i=(0,a.f)("analytics");return e&&s?.length?(0,t.jsxs)("div",{className:"rounded-control border border-border bg-surface px-3 py-2 text-xs shadow-soft",children:[r&&(0,t.jsx)("div",{className:"font-semibold text-text-main mb-1",children:r}),s.map((e,s)=>(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-text-muted",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:e.color}}),(0,t.jsxs)("span",{children:[e.name,":"]}),(0,t.jsx)("span",{className:"font-mono tabular-nums font-medium text-text-main",children:e.name===i("chartCost")?(0,l.r)(e.value):(0,l.i)(e.value)})]},s))]}):null}function q({dailyByModel:e,modelNames:r}){let n=(0,a.f)("analytics"),l=(0,s.useMemo)(()=>e||[],[e]),o=(0,s.useMemo)(()=>r||[],[r]),c=(0,s.useMemo)(()=>l.map(e=>{let t={...e};if(e.date){let s=e.date.split("-");t.dateLabel=`${s[1]}/${s[2]}`}return t}),[l]);return l.length&&o.length?(0,t.jsx)(W,{chartData:c,models:o}):(0,t.jsxs)(i.default,{className:"p-4",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main mb-3",children:n("chartModelUsageOverTime")}),(0,t.jsx)("div",{className:"text-center text-text-muted text-sm py-8",children:n("chartNoData")})]})}function W({chartData:e,models:s}){let r=(0,a.f)("analytics"),n=A();if(!n)return(0,t.jsx)(D,{className:"p-4"});let{AreaChart:o,Area:d,XAxis:u,YAxis:m,Tooltip:x,ResponsiveContainer:p}=n;return(0,t.jsxs)(i.default,{className:"p-4",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main mb-3",children:r("chartModelUsageOverTime")}),(0,t.jsx)(p,{width:"100%",height:240,children:(0,t.jsxs)(o,{data:e,margin:{top:4,right:4,left:0,bottom:0},children:[(0,t.jsx)(u,{dataKey:"dateLabel",tick:{fontSize:10,fill:"var(--color-text-muted)"},axisLine:!1,tickLine:!1,interval:"preserveStartEnd"}),(0,t.jsx)(m,{tick:{fontSize:10,fill:"var(--color-text-muted)"},tickFormatter:e=>(0,l.i)(e),axisLine:!1,tickLine:!1,width:50}),(0,t.jsx)(x,{content:(0,t.jsx)(L,{formatter:l.i})}),s.map((e,s)=>(0,t.jsx)(d,{type:"monotone",dataKey:e,stackId:"1",stroke:(0,c.T)(s),fill:(0,c.T)(s),fillOpacity:.4,strokeWidth:1.5,animationDuration:600},e))]})}),(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 mt-2 text-[10px] text-text-muted",children:s.map((e,s)=>(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:(0,c.T)(s)}}),e]},e))})]})}function J(e){return!e||e.length<=8?e||"unknown":`${e.slice(0,6)}…${e.slice(-4)}`}function B({available:e,selected:r,onChange:i}){let n=(0,a.f)("analytics"),[l,o]=(0,s.useState)(!1),[c,d]=(0,s.useState)(""),u=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(l)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e);function e(e){u.current&&!u.current.contains(e.target)&&o(!1)}},[l]),(0,s.useEffect)(()=>{if(l)return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e);function e(e){"Escape"===e.key&&o(!1)}},[l]);let m=(0,s.useMemo)(()=>{let t=c.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||e.id.toLowerCase().includes(t)):e},[e,c]),x=0===r.length,p=(0,s.useCallback)(e=>{r.includes(e)?i(r.filter(t=>t!==e)):i([...r,e])},[r,i]),h=(0,s.useCallback)(()=>{i([])},[i]),f=(0,s.useMemo)(()=>{if(x)return n("filterAllKeys");if(1===r.length){let t=e.find(e=>e.id===r[0]);return t?J(t.name):n("filterOneKey")}return n("filterMultipleKeys",{count:r.length})},[x,r,e,n]);return 0===e.length?null:(0,t.jsxs)("div",{className:"relative",ref:u,children:[(0,t.jsxs)("button",{type:"button",onClick:()=>o(e=>!e),className:`flex items-center gap-1.5 rounded-control border px-3 py-1.5 text-xs font-medium transition-colors ${x?"border-border bg-surface text-text-muted hover:text-text-main":"border-primary/30 bg-primary/10 text-primary-text"}`,children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"vpn_key"}),f,(0,t.jsx)("span",{className:`material-symbols-outlined text-[14px] transition-transform ${l?"rotate-180":""}`,children:"expand_more"})]}),l&&(0,t.jsxs)("div",{className:"absolute left-0 top-full z-50 mt-1.5 w-[260px] rounded-card border border-border bg-surface shadow-xl",style:{backdropFilter:"blur(16px)"},children:[e.length>5&&(0,t.jsx)("div",{className:"border-b border-border/30 p-2",children:(0,t.jsx)("input",{type:"text",value:c,onChange:e=>d(e.target.value),placeholder:n("filterSearchKeys"),className:"w-full rounded-control border border-border bg-surface px-2.5 py-1.5 text-xs text-text-main placeholder:text-text-muted focus:outline-none focus:border-primary",autoFocus:!0})}),(0,t.jsxs)("div",{className:"max-h-[280px] overflow-y-auto p-1.5",children:[(0,t.jsxs)("button",{type:"button",onClick:h,className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left text-xs transition-colors ${x?"bg-primary/10 text-primary-text font-semibold":"text-text-muted hover:bg-surface-2 hover:text-text-main"}`,children:[(0,t.jsx)("span",{className:`flex h-4 w-4 shrink-0 items-center justify-center rounded border text-[10px] ${x?"border-primary bg-primary text-on-primary":"border-border/60 bg-transparent"}`,children:x&&(0,t.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"check"})}),n("filterAllKeys"),(0,t.jsx)("span",{className:"ml-auto text-[10px] text-text-muted font-normal",children:e.length})]}),(0,t.jsx)("div",{className:"my-1 h-px bg-border/20"}),m.map(e=>{let s=r.includes(e.id);return(0,t.jsxs)("button",{type:"button",onClick:()=>p(e.id),className:`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left text-xs transition-colors ${s?"bg-primary/[0.06] text-text-main":"text-text-muted hover:bg-surface-2 hover:text-text-main"}`,title:e.name||e.id,children:[(0,t.jsx)("span",{className:`flex h-4 w-4 shrink-0 items-center justify-center rounded border text-[10px] ${s?"border-primary bg-primary text-on-primary":"border-border/60 bg-transparent"}`,children:s&&(0,t.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"check"})}),(0,t.jsx)("span",{className:"truncate",children:J(e.name||e.id)})]},e.id)}),0===m.length&&(0,t.jsx)("p",{className:"px-2.5 py-3 text-center text-[11px] text-text-muted",children:n("filterNoKeysMatch")})]})]})]})}function H(e){if(!e)return"";let t=new Date(e);if(isNaN(t.getTime()))return"";let s=e=>String(e).padStart(2,"0");return`${t.getFullYear()}-${s(t.getMonth()+1)}-${s(t.getDate())}T${s(t.getHours())}:${s(t.getMinutes())}`}function G(e){return e?new Date(e).toISOString():""}function V({start:e,end:r,onApply:i,onClose:n}){let l=(0,a.f)("analytics"),[o,c]=(0,s.useState)(H(e)||""),[d,u]=(0,s.useState)(H(r)||""),m=(0,s.useRef)(null);(0,s.useEffect)(()=>{function e(e){m.current&&!m.current.contains(e.target)&&n()}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[n]),(0,s.useEffect)(()=>{function e(e){"Escape"===e.key&&n()}return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[n]);let x=(0,s.useCallback)(()=>{o&&d&&i(G(o),G(d))},[o,d,i]),p=(0,s.useCallback)(e=>{let{start:t,end:s}=function(e){let t=new Date,s=H(t.toISOString()),r=new Date(t);switch(e){case"today":r.setHours(0,0,0,0);break;case"yesterday":{r.setDate(r.getDate()-1),r.setHours(0,0,0,0);let e=new Date(r);return e.setHours(23,59,59,999),{start:H(r.toISOString()),end:H(e.toISOString())}}case"thisWeek":r.setDate(r.getDate()-r.getDay()),r.setHours(0,0,0,0);break;case"thisMonth":r.setDate(1),r.setHours(0,0,0,0);break;case"last3d":r.setDate(r.getDate()-3);break;case"last14d":r.setDate(r.getDate()-14);break;default:r.setDate(r.getDate()-7)}return{start:H(r.toISOString()),end:s}}(e);c(t),u(s)},[]),h=o&&d&&new Date(o)<=new Date(d),f=[{key:"today",label:l("rangeToday")},{key:"yesterday",label:l("rangeYesterday")},{key:"last3d",label:l("rangeLast3Days")},{key:"thisWeek",label:l("rangeThisWeek")},{key:"last14d",label:l("rangeLast14Days")},{key:"thisMonth",label:l("rangeThisMonth")}];return(0,t.jsxs)("div",{ref:m,className:"absolute right-0 top-full z-50 mt-2 w-[340px] rounded-card border border-border bg-surface p-4 shadow-xl",children:[(0,t.jsxs)("div",{className:"mb-3",children:[(0,t.jsx)("p",{className:"text-xs font-medium text-text-muted mb-1.5",children:l("rangeQuickSelect")}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1",children:f.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>p(e.key),className:"rounded-md border border-border bg-surface-2 px-2.5 py-1 text-xs font-medium text-text-muted transition-colors hover:bg-primary/10 hover:text-primary-text hover:border-primary/30",children:e.label},e.key))})]}),(0,t.jsx)("div",{className:"h-px bg-border mb-3"}),(0,t.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-text-muted mb-1 block",children:l("rangeStart")}),(0,t.jsx)("input",{type:"datetime-local",value:o,onChange:e=>c(e.target.value),className:"w-full rounded-control border border-border bg-surface px-3 py-2 text-sm text-text-main focus:outline-none focus:border-primary"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-text-muted mb-1 block",children:l("rangeEnd")}),(0,t.jsx)("input",{type:"datetime-local",value:d,onChange:e=>u(e.target.value),className:"w-full rounded-control border border-border bg-surface px-3 py-2 text-sm text-text-main focus:outline-none focus:border-primary"})]})]}),o&&d&&!h&&(0,t.jsx)("p",{className:"mt-1.5 text-[11px] text-error",children:l("rangeErrorInvalid")}),(0,t.jsxs)("div",{className:"mt-3 flex items-center justify-end gap-2",children:[(0,t.jsx)("button",{type:"button",onClick:n,className:"rounded-lg px-3 py-1.5 text-xs font-medium text-text-muted hover:text-text-main transition-colors",children:l("rangeCancel")}),(0,t.jsx)("button",{type:"button",disabled:!h,onClick:x,className:"rounded-control bg-primary px-4 py-1.5 text-xs font-semibold text-on-primary transition-colors hover:bg-primary-hover disabled:opacity-40 disabled:cursor-not-allowed",children:l("rangeApply")})]})]})}function Y({title:e,dateLabel:s,value:r,onChange:a}){return(0,t.jsxs)("div",{className:"p-4 border-b border-border flex items-center justify-between flex-wrap gap-2",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-text-main",children:e}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("input",{type:"date",value:r,onChange:e=>a(e.target.value),"aria-label":s,className:"px-2 py-1 rounded-md text-xs bg-black/[0.03] dark:bg-white/[0.03] border border-black/5 dark:border-white/5"}),r&&(0,t.jsx)("button",{onClick:()=>a(""),className:"text-xs text-text-muted hover:text-text-main",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]})}function X({rows:e,sortBy:s,sortOrder:r,onToggleSort:a,dateLabel:i,providerLabel:n,requestsLabel:o,totalLabel:d}){return(0,t.jsx)("div",{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full text-sm",children:[(0,t.jsx)("thead",{className:"text-xs font-medium text-text-muted bg-surface-2/60",children:(0,t.jsxs)("tr",{children:[(0,t.jsxs)("th",{className:"px-4 py-2.5 text-left cursor-pointer group",onClick:()=>a("date"),children:[i," ",(0,t.jsx)(v,{active:"date"===s,sortOrder:r})]}),(0,t.jsxs)("th",{className:"px-4 py-2.5 text-left cursor-pointer group",onClick:()=>a("provider"),children:[n," ",(0,t.jsx)(v,{active:"provider"===s,sortOrder:r})]}),(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:()=>a("requests"),children:[o," ",(0,t.jsx)(v,{active:"requests"===s,sortOrder:r})]}),(0,t.jsxs)("th",{className:"px-4 py-2.5 text-right cursor-pointer group",onClick:()=>a("totalTokens"),children:[d," ",(0,t.jsx)(v,{active:"totalTokens"===s,sortOrder:r})]})]})}),(0,t.jsx)("tbody",{className:"divide-y divide-border",children:e.map((e,s)=>(0,t.jsxs)("tr",{className:"hover:bg-surface-2/60 transition-colors",children:[(0,t.jsx)("td",{className:"px-4 py-2.5 font-mono tabular-nums text-text-muted",children:e.date}),(0,t.jsx)("td",{className:"px-4 py-2.5",children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:c.N[s%c.N.length]}}),(0,t.jsx)("span",{className:"font-medium capitalize",children:e.provider})]})}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums font-semibold text-text-main",children:(0,l.I)(e.requests)}),(0,t.jsx)("td",{className:"px-4 py-2.5 text-right font-mono tabular-nums text-text-muted",children:(0,l.i)(e.totalTokens)})]},`${e.date}::${e.provider}`))})]})})}function Q({range:e}){let r=(0,a.f)("analytics"),n=(0,a.f)("common"),[l,c]=(0,s.useState)(""),[d,u]=(0,s.useState)("date"),[m,x]=(0,s.useState)("desc"),{rows:p,loading:h,error:f}=function(e,t){let r=(0,a.f)("common"),[i,n]=(0,s.useState)([]),[l,c]=(0,s.useState)(!0),[d,u]=(0,s.useState)(null),m=(0,s.useCallback)(async()=>{try{c(!0);let s=new URLSearchParams;t?s.set("date",t):s.set("range",e);let a=await fetch(`/api/usage/requests-by-provider-date?${s.toString()}`);if(!a.ok)throw Error(await o(a,r("error")));let i=await a.json();n(Array.isArray(i.rows)?i.rows:[]),u(null)}catch(e){u(e.message)}finally{c(!1)}},[e,t,r]);return(0,s.useEffect)(()=>{m()},[m]),{rows:i,loading:l,error:d}}(e,l),b=(0,s.useCallback)(e=>{d===e?x(e=>"asc"===e?"desc":"asc"):(u(e),x("desc"))},[d]),g=(0,s.useMemo)(()=>{let e;return(e=[...p]).sort((e,t)=>{let s=e[d],r=t[d];return"string"==typeof s&&"string"==typeof r?"asc"===m?s.localeCompare(r):r.localeCompare(s):"asc"===m?Number(s)-Number(r):Number(r)-Number(s)}),e},[p,d,m]);return(0,t.jsxs)(i.default,{className:"overflow-hidden",children:[(0,t.jsx)(Y,{title:r("chartRequestsByProviderDate"),dateLabel:r("chartDate"),value:l,onChange:c}),h&&0===p.length?(0,t.jsx)("div",{className:"text-center text-text-muted text-sm py-8",children:n("loading")}):f?(0,t.jsxs)("div",{className:"text-center text-error text-sm py-8",children:[n("errorShort"),": ",f]}):0===g.length?(0,t.jsx)("div",{className:"text-center text-text-muted text-sm py-8",children:r("chartNoData")}):(0,t.jsx)(X,{rows:g,sortBy:d,sortOrder:m,onToggleSort:b,dateLabel:r("chartDate"),providerLabel:r("chartProvider"),requestsLabel:r("chartRequests"),totalLabel:r("chartTotal")})]})}e.s(["default",0,function(){let e=(0,r.X)(),c=(0,a.f)("analytics"),d=(0,a.f)("common"),[u,m]=(0,s.useState)("30d"),[x,p]=(0,s.useState)(null),[h,f]=(0,s.useState)(!0),[b,y]=(0,s.useState)(null),[v,j]=(0,s.useState)(""),[N,E]=(0,s.useState)(""),[K,A]=(0,s.useState)(!1),D=(0,s.useRef)(null),[L,$]=(0,s.useState)([]),[F,U]=(0,s.useState)([]),W=(0,s.useCallback)(async()=>{try{f(!0);let e=new URLSearchParams;e.set("range",u),"custom"===u&&v&&N&&(e.set("startDate",v),e.set("endDate",N)),L.length>0&&e.set("apiKeyIds",L.join(","));let t=await fetch(`/api/usage/analytics?${e.toString()}`);if(!t.ok)throw Error(await o(t,d("error")));let s=await t.json();if(p(s),y(null),0===L.length&&s.byApiKey?.length>0){let e=new Set,t=[];for(let r of s.byApiKey){let s=r.apiKeyId||r.apiKeyName||d("unknownProvider"),a=r.apiKeyName||r.apiKeyId||d("unknownProvider");e.has(s)||(e.add(s),t.push({id:s,name:a}))}U(t)}}catch(e){y(e.message)}finally{f(!1)}},[u,v,N,L,d]);(0,s.useEffect)(()=>{let e=window.setTimeout(()=>void W(),0);return()=>window.clearTimeout(e)},[W]);let J=(0,s.useCallback)(e=>{"custom"===e?A(!0):(m(e),A(!1))},[]),H=(0,s.useCallback)((e,t)=>{j(e),E(t),m("custom"),A(!1)},[]),G=(0,s.useMemo)(()=>{if("custom"!==u||!v||!N)return null;let t=t=>new Date(t).toLocaleDateString(e,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});return`${t(v)} — ${t(N)}`},[u,v,N,e]),Y=[{value:"1d",label:c("period1D")},{value:"7d",label:c("period7D")},{value:"30d",label:c("period30D")},{value:"90d",label:c("period90D")},{value:"ytd",label:c("periodYTD")},{value:"all",label:c("periodAll")}],X=(0,s.useMemo)(()=>{let e=x?.byModel||[];return e.length>0?e[0].model:"—"},[x]),Z=(0,s.useMemo)(()=>{let e=x?.byProvider||[];return e.length>0?e[0].provider:"—"},[x]),ee=(0,s.useMemo)(()=>{let t=x?.weeklyPattern||[];if(!t.length)return"—";let s=t.reduce((e,t)=>e.avgTokens>t.avgTokens?e:t,t[0]);if(s.avgTokens<=0)return"—";let r=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].indexOf(s.day);return r<0?s.day:new Intl.DateTimeFormat(e,{weekday:"short"}).format(new Date(2024,0,7+r))},[x,e]),et=(0,s.useMemo)(()=>(x?.byProvider||[]).length,[x]),es=(0,s.useMemo)(()=>{let e=x?.byProvider||[];if(e.length<=1)return 0;let t=0;for(let s of e)t+=s.totalRequests||s.apiCalls||0;if(0===t)return 0;let s=0;for(let r of e){let e=(r.totalRequests||r.apiCalls||0)/t;e>0&&(s-=e*Math.log2(e))}let r=Math.log2(e.length);return r>0?s/r*100:0},[x]);if(h&&!x)return(0,t.jsx)(n.CardSkeleton,{});if(b)return(0,t.jsxs)(i.default,{className:"p-6 text-center text-red-500",children:[d("errorShort"),": ",b]});let er=x?.summary||{},ea=er.totalRequests>0?Math.round(er.totalTokens/er.totalRequests):0,ei=er.totalRequests>0?er.totalCost/er.totalRequests:0,en=er.completionTokens>0?(er.promptTokens/er.completionTokens).toFixed(1):"—";return(0,t.jsxs)("div",{className:"flex flex-col gap-5 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[(0,t.jsxs)("h2",{className:"text-xl font-semibold flex items-center gap-2",children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-primary text-[22px]",children:"analytics"}),c("usageAnalyticsTitle")]}),(0,t.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,t.jsx)(B,{available:F,selected:L,onChange:$}),(0,t.jsxs)("div",{className:"relative flex items-center gap-1 rounded-control border border-border bg-surface-2 p-1",ref:D,children:[Y.map(e=>(0,t.jsx)("button",{onClick:()=>J(e.value),"aria-pressed":u===e.value,className:`h-7 px-3 rounded-md text-xs font-medium transition-colors ${u===e.value?"border border-border bg-surface text-text-main":"border border-transparent text-text-muted hover:text-text-main"}`,children:e.label},e.value)),(0,t.jsxs)("button",{onClick:()=>J("custom"),"aria-pressed":"custom"===u,className:`h-7 px-3 rounded-md text-xs font-medium transition-colors flex items-center gap-1 ${"custom"===u?"border border-border bg-surface text-text-main":"border border-transparent text-text-muted hover:text-text-main"}`,children:[(0,t.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"date_range"}),G||c("customRange"),"custom"===u&&G&&(0,t.jsx)("span",{role:"button",onClick:e=>{e.stopPropagation(),m("30d"),j(""),E("")},className:"ml-0.5 opacity-70 hover:opacity-100",children:(0,t.jsx)("span",{className:"material-symbols-outlined text-[11px]",children:"close"})})]}),K&&(0,t.jsx)(V,{start:v,end:N,onApply:H,onClose:()=>A(!1)})]})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[(0,t.jsx)(k,{icon:"generating_tokens",label:c("totalTokens"),value:(0,l.i)(er.totalTokens),subValue:`${(0,l.I)(er.totalRequests)} ${c("chartRequests")}`}),(0,t.jsx)(k,{icon:"input",label:c("inputTokens"),value:(0,l.i)(er.promptTokens),color:"text-primary"}),(0,t.jsx)(k,{icon:"output",label:c("outputTokens"),value:(0,l.i)(er.completionTokens),color:"text-emerald-500"}),(0,t.jsx)(k,{icon:"payments",label:c("estCost"),value:(0,l.r)(er.totalCost),color:"text-amber-500"})]}),(0,t.jsx)(w,{sections:[{title:c("infraTitle"),items:[{icon:"group",label:c("infraAccounts"),value:er.uniqueAccounts||0},{icon:"dns",label:c("infraProviders"),value:et,color:"text-indigo-500"},{icon:"vpn_key",label:c("infraApiKeys"),value:er.uniqueApiKeys||0},{icon:"model_training",label:c("infraModels"),value:er.uniqueModels||0}]},{title:c("perfTitle"),items:[{icon:"speed",label:c("perfAvgTokens"),value:(0,l.i)(ea),color:"text-cyan-500"},{icon:"request_quote",label:c("perfCostReq"),value:(0,l.r)(ei),color:"text-orange-500"},{icon:"compare_arrows",label:c("perfIoRatio"),value:`${en}x`,color:"text-violet-500"},{icon:"bolt",label:c("perfFastReq"),value:(0,l.i)(er.fastRequests||0),color:"text-sky-500"}]},{title:c("highlightsTitle"),wideValues:!0,items:[{icon:"star",label:c("highlightsTopModel"),value:X,color:"text-pink-500"},{icon:"cloud",label:c("highlightsTopProvider"),value:Z,color:"text-teal-500"},{icon:"today",label:c("highlightsBusiestDay"),value:ee,color:"text-rose-500"},{icon:"network_node",label:c("highlightsDiversity"),value:`${es.toFixed(1)}%`,color:"text-sky-500"},{icon:"swap_horiz",label:c("highlightsFallbackRate"),value:`${Number(er.fallbackRatePct||0).toFixed(1)}%`,color:"text-amber-500"}]}]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-[2fr_1fr] gap-4 items-stretch",children:[(0,t.jsx)(S,{activityMap:x?.activityMap}),(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsx)(T,{activityMap:x?.activityMap}),(0,t.jsx)(I,{activityMap:x?.activityMap})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsx)(z,{dailyTrend:x?.dailyTrend}),(0,t.jsx)(R,{byProvider:x?.byProvider})]}),(0,t.jsx)(M,{byServiceTier:x?.byServiceTier,summary:er}),(0,t.jsx)(q,{dailyByModel:x?.dailyByModel,modelNames:x?.modelNames}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsx)(P,{byAccount:x?.byAccount}),(0,t.jsx)(O,{byApiKey:x?.byApiKey})]}),(0,t.jsx)(_,{byProvider:x?.byProvider}),(0,t.jsx)(Q,{range:u}),(0,t.jsx)(C,{byApiKey:x?.byApiKey}),(0,t.jsx)(g,{byModel:x?.byModel,summary:er})]})}],566770)},548036,e=>{"use strict";e.i(843476),e.i(948148),e.i(271645),e.i(618566),e.i(393718),e.i(969353),e.i(454149),e.i(243009),e.s([])},565650,e=>{"use strict";e.s([],565650),e.i(342923),e.i(80173),e.i(907714),e.i(542055),e.i(905204),e.i(393718),e.i(51130),e.i(703166),e.i(454149),e.i(822124),e.i(969353),e.i(635055),e.i(897844),e.i(450222),e.i(647829),e.i(6998),e.i(964039),e.i(279743),e.i(629476),e.i(16190),e.i(193464),e.i(548036),e.i(566770),e.i(953789),e.i(471348),e.i(8839),e.i(227404),e.i(621745),e.i(567955),e.i(17517),e.i(419947),e.i(268226),e.i(323060),e.i(642440),e.i(629342),e.i(816062),e.i(690777),e.i(563201),e.i(115243),e.i(915139),e.i(524578),e.i(515272),e.i(840387),e.i(110626),e.i(247854),e.i(165149),e.i(359505)},359505,e=>{"use strict";e.i(843476),e.i(897844),e.s([])},165149,e=>{"use strict";var t=e.i(247167),s=e.i(843476),r=e.i(271645),a=e.i(647829),i=e.i(6998),n=e.i(816062),l=e.i(642440),o=e.i(948148);function c(){let[e,t]=(0,r.useState)(!1),[a,i]=(0,r.useState)(""),n=(0,r.useRef)(0),l=(0,r.useRef)(!1),c=(0,o.f)("common");return((0,r.useEffect)(()=>{let e=async()=>{let e=new AbortController,s=setTimeout(()=>e.abort("Health check timeout"),8e3);try{(await fetch("/api/health/ping",{signal:e.signal,cache:"no-store"})).ok?(n.current=0,l.current=!1,t(!1),i("")):(n.current+=1,n.current>=2&&!l.current&&(t(!0),i(c("maintenanceServerIssues"))))}catch{n.current+=1,n.current>=2&&!l.current&&(t(!0),i(c("maintenanceServerUnreachable")))}finally{clearTimeout(s)}};e();let s=setInterval(e,1e4);return()=>clearInterval(s)},[c]),e)?(0,s.jsxs)("div",{role:"status",className:"flex items-center justify-between gap-3 border-b border-warning/20 bg-warning/10 px-4 py-2 sm:px-6",children:[(0,s.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined shrink-0 text-[18px] text-warning","aria-hidden":"true",children:"warning"}),(0,s.jsx)("span",{className:"text-sm text-text-main",children:a})]}),(0,s.jsx)("button",{type:"button",onClick:()=>{l.current=!0,t(!1)},className:"flex size-7 shrink-0 items-center justify-center rounded-md text-text-muted transition-colors hover:bg-warning/10 hover:text-text-main focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30","aria-label":c("close"),children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"close"})})]}):null}var d=e.i(618566),u=e.i(241937),m=e.i(513859);function x({isOpen:e,onClose:t}){return e?(0,s.jsx)(p,{onClose:t}):null}function p({onClose:e}){let t=(0,d.useRouter)(),a=(0,o.f)("sidebar"),i=(0,r.useRef)(null),n=(0,r.useRef)(null),[l,c]=(0,r.useState)(""),[x,h]=(0,r.useState)(0),[f,b]=(0,r.useState)(new Set);(0,r.useEffect)(()=>{let e=new AbortController;return fetch("/api/settings",{signal:e.signal}).then(e=>e.json()).then(e=>{b(new Set((0,u.D)(e?.[u.P])))}).catch(()=>{}),()=>e.abort()},[]),(0,r.useEffect)(()=>{let e=setTimeout(()=>i.current?.focus(),30);return()=>clearTimeout(e)},[]);let g=(0,r.useCallback)((e,t)=>{try{return a(e)}catch{return t}},[a]),y=(0,r.useMemo)(()=>m.f.flatMap(e=>{let t=g(e.titleKey,e.titleFallback);return e.children.flatMap(s=>{if("type"in s&&"group"===s.type){let r=g(s.titleKey,s.titleFallback);return s.items.filter(e=>!f.has(e.id)).map(a=>({id:a.id,href:a.href,icon:a.icon,label:g(a.i18nKey,a.id),subtitle:a.subtitleKey?g(a.subtitleKey,""):void 0,external:a.external??!1,sectionId:e.id,sectionLabel:t,subgroupId:s.id,subgroupLabel:r}))}return f.has(s.id)?[]:[{id:s.id,href:s.href,icon:s.icon,label:g(s.i18nKey,s.id),subtitle:s.subtitleKey?g(s.subtitleKey,""):void 0,external:s.external??!1,sectionId:e.id,sectionLabel:t}]})}),[f,g]),v=(0,r.useMemo)(()=>{let e=l.trim().toLowerCase();return e?y.filter(t=>t.label.toLowerCase().includes(e)||t.subtitle?.toLowerCase().includes(e)||t.sectionLabel.toLowerCase().includes(e)||t.subgroupLabel?.toLowerCase().includes(e)):y},[y,l]),j=(0,r.useMemo)(()=>{let e=[],t=new Map;return v.forEach((s,r)=>{let a=t.get(s.sectionId);a||(a={sectionId:s.sectionId,sectionLabel:s.sectionLabel,subgroups:[]},t.set(s.sectionId,a),e.push(a));let i=s.subgroupId??null,n=a.subgroups.find(e=>e.subgroupId===i);n||(n={subgroupId:i,subgroupLabel:s.subgroupLabel??null,items:[]},a.subgroups.push(n)),n.items.push({item:s,flatIndex:r})}),e},[v]),N=(0,r.useCallback)((s,r)=>{e(),r?window.open(s,"_blank","noopener,noreferrer"):t.push(s)},[e,t]);return(0,r.useEffect)(()=>{let t=t=>{if("Escape"===t.key)return void e();if("ArrowDown"===t.key)t.preventDefault(),h(e=>(e+1)%Math.max(1,v.length));else if("ArrowUp"===t.key)t.preventDefault(),h(e=>(e-1+Math.max(1,v.length))%Math.max(1,v.length));else if("Enter"===t.key){t.preventDefault();let e=v[x];e&&N(e.href,e.external)}};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[v,x,e,N]),(0,r.useEffect)(()=>{let e=n.current;if(!e)return;let t=e.querySelector(`[data-flat-index="${x}"]`);t?.scrollIntoView({block:"nearest"})},[x]),(0,s.jsxs)("div",{className:"fixed inset-0 z-[60] flex items-start justify-center px-4 pt-[12vh]",children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-black/40",onClick:e,"aria-hidden":"true"}),(0,s.jsxs)("div",{className:"relative w-full max-w-2xl overflow-hidden rounded-card border border-border bg-surface shadow-elevated",role:"dialog","aria-modal":"true","aria-label":"Command palette",children:[(0,s.jsxs)("div",{className:"flex h-12 items-center gap-2.5 border-b border-border px-4",children:[(0,s.jsx)("span",{className:"material-symbols-outlined shrink-0 text-[18px] text-text-muted","aria-hidden":"true",children:"search"}),(0,s.jsx)("input",{ref:i,type:"text",className:"min-w-0 flex-1 bg-transparent text-sm text-text-main outline-none placeholder:text-text-muted",placeholder:"Search pages, settings, tools...",value:l,onChange:e=>{c(e.target.value),h(0)},autoComplete:"off",spellCheck:!1}),l&&(0,s.jsx)("button",{type:"button",className:"flex size-6 items-center justify-center rounded-md text-text-muted transition-colors hover:bg-surface-2 hover:text-text-main",onClick:()=>{c(""),h(0)},tabIndex:-1,"aria-label":"Clear search",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]","aria-hidden":"true",children:"close"})}),(0,s.jsx)("kbd",{className:"hidden h-5 shrink-0 items-center rounded border border-border bg-surface-2 px-1.5 font-sans text-[10px] font-medium text-text-muted sm:inline-flex",children:"Esc"})]}),j.length>0?(0,s.jsx)("ul",{ref:n,className:"custom-scrollbar max-h-[60vh] overflow-y-auto p-1.5",role:"listbox",children:j.map(e=>(0,s.jsxs)("li",{role:"presentation",children:[(0,s.jsx)("div",{className:"sticky top-0 z-10 bg-surface px-2.5 pb-1 pt-2 text-[11px] font-medium uppercase tracking-wider text-text-muted",children:e.sectionLabel}),(0,s.jsx)("ul",{role:"group","aria-label":e.sectionLabel,children:e.subgroups.map(t=>(0,s.jsxs)("li",{role:"presentation",children:[t.subgroupLabel&&(0,s.jsx)("div",{className:"px-2.5 pb-1 pt-2 text-[11px] font-medium text-text-muted",children:t.subgroupLabel}),(0,s.jsx)("ul",{role:t.subgroupLabel?"group":"presentation","aria-label":t.subgroupLabel??void 0,children:t.items.map(({item:e,flatIndex:r})=>(0,s.jsx)("li",{role:"option","aria-selected":r===x,"data-flat-index":r,children:(0,s.jsxs)("button",{type:"button",className:`flex min-h-9 w-full items-center gap-2.5 rounded-md ${t.subgroupLabel?"ps-6 pe-2.5":"px-2.5"} py-1.5 text-start transition-colors ${r===x?"bg-surface-2 text-text-main":"text-text-main hover:bg-surface-2"}`,onClick:()=>N(e.href,e.external),onMouseEnter:()=>h(r),children:[(0,s.jsx)("span",{className:`material-symbols-outlined text-[18px] shrink-0 ${r===x?"text-primary-text":"text-text-muted"}`,"aria-hidden":"true",children:e.icon}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"truncate text-sm",children:e.label}),e.subtitle&&(0,s.jsx)("p",{className:"truncate text-xs text-text-muted",children:e.subtitle})]}),e.external&&(0,s.jsx)("span",{className:"material-symbols-outlined shrink-0 text-[14px] text-text-muted","aria-hidden":"true",children:"open_in_new"})]})},e.id))})]},`${e.sectionId}::${t.subgroupId??"_root"}`))})]},e.sectionId))}):(0,s.jsx)("div",{className:"py-10 text-center text-sm text-text-muted",children:"No results"}),(0,s.jsxs)("div",{className:"flex items-center gap-4 border-t border-border px-4 py-2 text-[11px] text-text-muted",children:[(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[(0,s.jsx)("kbd",{className:"inline-flex h-5 items-center rounded border border-border bg-surface-2 px-1.5 font-sans text-[10px] font-medium",children:"↑↓"}),"navigate"]}),(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[(0,s.jsx)("kbd",{className:"inline-flex h-5 items-center rounded border border-border bg-surface-2 px-1.5 font-sans text-[10px] font-medium",children:"↵"}),"open"]}),(0,s.jsxs)("span",{className:"flex items-center gap-1",children:[(0,s.jsx)("kbd",{className:"inline-flex h-5 items-center rounded border border-border bg-surface-2 px-1.5 font-sans text-[10px] font-medium",children:"Esc"}),"close"]})]})]})]})}function h(){let e=(0,d.usePathname)(),t=(0,d.useSearchParams)(),[a,i]=(0,r.useState)(!1),[n,l]=(0,r.useState)(0),o=(0,r.useRef)(`${e}?${t?.toString()??""}`),c=(0,r.useRef)(null),u=(0,r.useRef)(null),m=(0,r.useRef)(null);return((0,r.useEffect)(()=>{let e=e=>{if(e.defaultPrevented||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||0!==e.button)return;let t=e.target?.closest?.("a");if(!t||t.target&&""!==t.target&&"_self"!==t.target||t.hasAttribute("download"))return;let s=t.getAttribute("href");if(!(!s||s.startsWith("#"))&&!(s.startsWith("mailto:")||s.startsWith("tel:"))){try{let e=new URL(t.href,window.location.href);if(e.origin!==window.location.origin)return;let s=`${window.location.pathname}?${window.location.search}`,r=`${e.pathname}?${e.search}`;if(s===r)return}catch{return}queueMicrotask(()=>{i(!0),l(8)})}};return document.addEventListener("click",e,!0),()=>document.removeEventListener("click",e,!0)},[]),(0,r.useEffect)(()=>{if(a)return c.current=setInterval(()=>{l(e=>e>=88?e:Math.min(88,e+Math.min(12,Math.max(1,.18*(88-e)))))},150),()=>{c.current&&(clearInterval(c.current),c.current=null)}},[a]),(0,r.useEffect)(()=>{let s=`${e}?${t?.toString()??""}`;if(s!==o.current)return o.current=s,u.current&&clearTimeout(u.current),m.current&&clearTimeout(m.current),u.current=setTimeout(()=>{l(100),m.current=setTimeout(()=>{i(!1),l(0)},320)},220),()=>{u.current&&clearTimeout(u.current),m.current&&clearTimeout(m.current)}},[e,t]),a||0!==n)?(0,s.jsx)("div",{className:"pointer-events-none fixed inset-x-0 top-0 z-[9999] h-0.5","aria-hidden":"true",children:(0,s.jsx)("div",{className:"h-full origin-left bg-primary transition-[width,opacity] duration-200 ease-out",style:{width:`${n}%`,opacity:n>=100?0:1}})}):null}var f=e.i(593976);let b="x-trouteai-csrf",g=["/api/auth/login","/api/auth/logout","/api/auth/status","/api/auth/oidc/","/api/v1/","/api/codex/connect/","/api/usage/om-usage"],y=null,v=null,j=null,N=0,k=["/chat/completions","/responses","/models","/codex"],w=["/a2a"];function S(e=Date.now()){return y&&y.expiresAtMs-e>3e4?y.token:null}async function C(e){try{let t=await fetch("/api/auth/csrf",{cache:"no-store",credentials:"same-origin"});if(!t.ok)return null;let s=await t.json().catch(()=>null);if("string"!=typeof s?.token||"string"!=typeof s.expiresAt)return y=null,null;let r=Date.parse(s.expiresAt);if(!Number.isFinite(r)||r<=e)return y=null,null;return(y={token:s.token,expiresAtMs:r}).token}catch{return null}}async function T(){let e=S();return e||(v||(v=C(Date.now()).finally(()=>{v=null})),v)}function I(e){return"u">typeof Request&&e instanceof Request?e:null}var M=e.i(554364);let _="sidebar-collapsed",E="1"===t.default.env.NEXT_PUBLIC_TROUTEAI_E2E_MODE;e.s(["default",0,function({children:e}){let[t,o]=(0,r.useState)(!1),[d,u]=(0,r.useState)(!1),[m,p]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{try{"true"===localStorage.getItem(_)&&setTimeout(()=>p(!0),0)}catch{}},[]),(0,r.useInsertionEffect)(()=>{let e=(0,M.f)(),t=function(){if("function"!=typeof globalThis.fetch)return()=>{};0===N&&(j=globalThis.fetch,globalThis.fetch=async(e,t)=>{if(!j||!function(e,t){var s,r,a;let i,n;if(!["POST","PUT","PATCH","DELETE"].includes((t?.method?t.method:I(e)?.method??"GET").toUpperCase()))return!1;let l=(n=I(e))?n.url:e instanceof URL?e.href:"string"==typeof e?e:null;if(!l)return!1;try{i=new URL(l,window.location.href)}catch{return!1}return i.origin===window.location.origin&&(s=i,!!w.some(e=>s.pathname===e||s.pathname.startsWith(e+"/"))||s.pathname.startsWith("/api/")&&"/api/auth/csrf"!==s.pathname&&(r=s.pathname,!g.some(e=>r.startsWith(e)))&&!("/api/v1"===(a=s.pathname)||a.startsWith("/api/v1/")||"/api/v1beta"===a||a.startsWith("/api/v1beta/")||"/v1"===a||a.startsWith("/v1/")||"/v1beta"===a||a.startsWith("/v1beta/")||"/v1/v1"===a||a.startsWith("/v1/v1/")||k.some(e=>a===e||a.startsWith(e+"/"))))}(e,t))return j?j(e,t):fetch(e,t);let s=new Headers(t?.headers??I(e)?.headers);if(s.has(b))return j(e,t);let r=S()??await T();return r?(s.set(b,r),j(e,{...t,headers:s})):j(e,t)}),N++;let e=!0;return()=>{e&&(e=!1,0===(N=Math.max(0,N-1))&&j&&(globalThis.fetch=j,j=null))}}();return T(),()=>{t(),e()}},[]),(0,r.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"k"===e.key&&(e.preventDefault(),u(e=>!e))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[]),(0,s.jsxs)("div",{className:"flex h-dvh min-h-0 w-full overflow-hidden bg-bg",children:[(0,s.jsx)(r.Suspense,{fallback:null,children:(0,s.jsx)(h,{})}),t&&(0,s.jsx)("div",{className:"fixed inset-0 z-40 bg-black/40 lg:hidden",onClick:()=>o(!1)}),(0,s.jsx)("div",{className:"dashboard-sidebar-desktop",children:(0,s.jsx)(a.default,{collapsed:m,onToggleCollapse:()=>{let e=!m;p(e),localStorage.setItem(_,String(e))}})}),(0,s.jsx)("div",{id:"mobile-sidebar",className:`fixed inset-y-0 start-0 z-50 h-dvh transform overflow-y-auto shadow-elevated transition-transform duration-200 ease-out lg:hidden ${t?"translate-x-0":"-translate-x-full"}`,children:(0,s.jsx)(a.default,{onClose:()=>o(!1)})}),(0,s.jsxs)("main",{id:"main-content",className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,s.jsx)(i.default,{onMenuClick:()=>o(!0),menuOpen:t,onOpenCommandPalette:()=>u(!0)}),!E&&(0,s.jsx)(c,{}),(0,s.jsx)("div",{className:"custom-scrollbar min-h-0 flex-1 overflow-y-auto overflow-x-hidden p-4 sm:p-6",children:(0,s.jsxs)("div",{className:"mx-auto flex h-full min-h-0 w-full max-w-[3840px] flex-col",children:[(0,s.jsx)(l.default,{}),(0,s.jsx)("div",{className:"flex-1 min-h-0",children:e})]})})]}),(0,s.jsx)(n.default,{}),(0,s.jsx)(f.q,{}),(0,s.jsx)(x,{isOpen:d,onClose:()=>u(!1)})]})}],165149)},241937,974440,513859,e=>{"use strict";let t=["home","endpoints","api-manager","providers","combos","combos-live","quota","costs-quota-share","analytics","analytics-combo-health","analytics-utilization","cache","provider-stats","activity","logs","logs-proxy","logs-console","logs-timeline","health","runtime","costs","costs-pricing","costs-budget","audit","playground","settings-general","settings-appearance","settings-ai","settings-routing","settings-resilience","settings-advanced","settings-security","settings-feature-flags","settings-cache","settings-sidebar"];e.s(["f",0,t],974440);let s=new Set(["home","providers","combos","api-manager","endpoints","quota","analytics","logs","settings-general","settings-security","settings-appearance"]),r=new Set(["home","endpoints","api-manager","providers","combos","quota","analytics","analytics-combo-health","costs","cache","logs","health","runtime","playground","settings-general","settings-routing","settings-resilience","settings-sidebar"]),a=new Set(["home","endpoints","api-manager","providers","combos","quota","analytics","analytics-combo-health","analytics-utilization","costs","costs-pricing","costs-budget","costs-quota-share","cache","logs","activity","health","runtime","audit","settings-general","settings-routing","settings-resilience","settings-security","settings-feature-flags","settings-sidebar"]);function i(e){return t.filter(t=>!e.has(t))}let n=[{id:"all",icon:"select_all",hiddenItems:[]},{id:"minimal",icon:"minimize",hiddenItems:i(s)},{id:"developer",icon:"code",hiddenItems:i(r)},{id:"admin",icon:"admin_panel_settings",hiddenItems:i(a)}];e.s(["g",0,"minimal","P",0,"hiddenSidebarItems","R",0,"sidebarItemOrder","O",0,n,"C",0,"sidebarActivePreset","_",0,"sidebarSectionOrder","z",0,"trouteai:settings-updated","S",0,function(e,t){if(0===t.length)return[...e];let s=e=>("type"in e&&e.type,e.id),r=new Set(e.map(s)),a=t.filter(e=>r.has(e)),i=new Map(a.map((e,t)=>[e,t]));return[...e].sort((t,r)=>{let n=s(t),l=s(r);return(i.get(n)??a.length+e.indexOf(t))-(i.get(l)??a.length+e.indexOf(r))})},"K",0,function(e,t){if(0===t.length)return[...e];let s=new Set(e.map(e=>e.id)),r=t.filter(e=>s.has(e)),a=new Map(r.map((e,t)=>[e,t]));return[...e].sort((t,s)=>(a.get(t.id)??r.length+e.indexOf(t))-(a.get(s.id)??r.length+e.indexOf(s)))},"X",0,function(e){return e.children.flatMap(e=>"type"in e&&"group"===e.type?e.items:[e])},"I",0,function(e){return[...n.find(t=>t.id===e)?.hiddenItems??[]]},"D",0,function(e){if(!Array.isArray(e))return[];let s=new Set;for(let r of e)"string"==typeof r&&t.includes(r)&&s.add(r);return t.filter(e=>s.has(e))}],241937);let l=[{id:"home",titleKey:"home",titleFallback:"Home",children:[{id:"home",href:"/home",i18nKey:"home",subtitleKey:"homeSubtitle",icon:"home",exact:!0}],showTitle:!1},{id:"setup",titleKey:"setupSection",titleFallback:"Setup",children:[{id:"providers",href:"/dashboard/providers",i18nKey:"providers",subtitleKey:"providersSubtitle",icon:"dns"},{id:"combos",href:"/dashboard/combos",i18nKey:"combos",subtitleKey:"combosSubtitle",icon:"layers"},{id:"api-manager",href:"/dashboard/api-manager",i18nKey:"apiManager",subtitleKey:"apiManagerSubtitle",icon:"vpn_key"},{id:"endpoints",href:"/dashboard/endpoint",i18nKey:"endpoints",subtitleKey:"endpointsSubtitle",icon:"api"}],defaultPinned:!0},{id:"router",titleKey:"routerSection",titleFallback:"Routing",children:[{id:"combos-live",href:"/dashboard/combos/live",i18nKey:"combosLive",labelFallback:"Combo Studio",subtitleKey:"combosLiveSubtitle",subtitleFallback:"Live routing cascade",icon:"account_tree"},{id:"quota",href:"/dashboard/quota",i18nKey:"providerQuota",subtitleKey:"providerQuotaSubtitle",icon:"tune"},{id:"costs-quota-share",href:"/dashboard/costs/quota-share",i18nKey:"costsQuotaShare",subtitleKey:"costsQuotaShareSubtitle",icon:"pie_chart"},{id:"proxy",href:"/dashboard/system/proxy",i18nKey:"proxy",subtitleKey:"proxySubtitle",icon:"lan"}]},{id:"analytics",titleKey:"analyticsSection",titleFallback:"Analytics",children:[{id:"analytics",href:"/dashboard/analytics",i18nKey:"usage",subtitleKey:"usageSubtitle",icon:"analytics"},{id:"analytics-combo-health",href:"/dashboard/analytics/combo-health",i18nKey:"analyticsComboHealth",subtitleKey:"analyticsComboHealthSubtitle",icon:"monitor_heart"},{id:"analytics-utilization",href:"/dashboard/analytics/utilization",i18nKey:"analyticsUtilization",subtitleKey:"analyticsUtilizationSubtitle",icon:"bar_chart"},{id:"cache",href:"/dashboard/cache",i18nKey:"cache",subtitleKey:"cacheSubtitle",icon:"cached"},{id:"provider-stats",href:"/dashboard/provider-stats",i18nKey:"providerStats",subtitleKey:"providerStatsSubtitle",icon:"speed"}]},{id:"costs",titleKey:"costsSection",titleFallback:"Costs",children:[{id:"costs",href:"/dashboard/costs",i18nKey:"costsOverview",subtitleKey:"costsOverviewSubtitle",icon:"account_balance_wallet"},{id:"costs-pricing",href:"/dashboard/costs/pricing",i18nKey:"costsPricing",subtitleKey:"costsPricingSubtitle",icon:"price_change"},{id:"costs-budget",href:"/dashboard/costs/budget",i18nKey:"costsBudget",subtitleKey:"costsBudgetSubtitle",icon:"savings"}]},{id:"monitoring",titleKey:"monitoringSection",titleFallback:"Monitoring",children:[{id:"activity",href:"/dashboard/activity",i18nKey:"activity",subtitleKey:"activitySubtitle",icon:"timeline"},{type:"group",id:"logs",titleKey:"logsGroup",titleFallback:"Logs",items:[{id:"logs",href:"/dashboard/logs",i18nKey:"logs",subtitleKey:"logsSubtitle",icon:"description"},{id:"logs-proxy",href:"/dashboard/logs/proxy",i18nKey:"logsProxy",subtitleKey:"logsProxySubtitle",icon:"lan"},{id:"logs-console",href:"/dashboard/logs/console",i18nKey:"consoleLogs",subtitleKey:"consoleLogsSubtitle",icon:"terminal"},{id:"logs-timeline",href:"/dashboard/logs/timeline",i18nKey:"logsTimeline",subtitleKey:"logsTimelineSubtitle",icon:"view_timeline"}]},{type:"group",id:"audit",titleKey:"auditGroup",titleFallback:"Audit",items:[{id:"audit",href:"/dashboard/audit",i18nKey:"auditLog",subtitleKey:"auditLogSubtitle",icon:"policy"}]},{type:"group",id:"system",titleKey:"systemGroup",titleFallback:"System",items:[{id:"health",href:"/dashboard/health",i18nKey:"health",subtitleKey:"healthSubtitle",icon:"health_and_safety"},{id:"runtime",href:"/dashboard/runtime",i18nKey:"runtime",subtitleKey:"runtimeSubtitle",icon:"bolt"}]}]},{id:"devtools",titleKey:"devtoolsSection",titleFallback:"Dev Tools",children:[{id:"playground",href:"/dashboard/playground",i18nKey:"playground",subtitleKey:"playgroundSubtitle",icon:"science"}],visibility:"debug"},{id:"configuration",titleKey:"configurationSection",titleFallback:"Configuration",children:[{id:"settings-general",href:"/dashboard/settings/general",i18nKey:"settingsGeneral",subtitleKey:"settingsGeneralSubtitle",icon:"tune"},{id:"settings-appearance",href:"/dashboard/settings/appearance",i18nKey:"settingsAppearance",subtitleKey:"settingsAppearanceSubtitle",icon:"palette"},{id:"settings-ai",href:"/dashboard/settings/ai",i18nKey:"settingsAi",subtitleKey:"settingsAiSubtitle",icon:"auto_awesome"},{id:"settings-routing",href:"/dashboard/settings/routing",i18nKey:"globalRouting",subtitleKey:"globalRoutingSubtitle",icon:"route"},{id:"settings-resilience",href:"/dashboard/settings/resilience",i18nKey:"settingsResilience",subtitleKey:"settingsResilienceSubtitle",icon:"health_and_safety"},{id:"settings-advanced",href:"/dashboard/settings/advanced",i18nKey:"settingsAdvanced",subtitleKey:"settingsAdvancedSubtitle",icon:"engineering"},{id:"settings-security",href:"/dashboard/settings/security",i18nKey:"settingsSecurity",subtitleKey:"settingsSecuritySubtitle",icon:"shield"},{id:"settings-feature-flags",href:"/dashboard/settings/feature-flags",i18nKey:"settingsFeatureFlags",subtitleKey:"settingsFeatureFlagsSubtitle",icon:"flag"},{id:"settings-cache",href:"/dashboard/settings/cache",i18nKey:"settingsCache",subtitleKey:"settingsCacheSubtitle",icon:"memory"},{id:"settings-sidebar",href:"/dashboard/settings/sidebar",i18nKey:"settingsSidebar",subtitleKey:"settingsSidebarSubtitle",icon:"view_sidebar"}]}];e.s(["f",0,l],513859)}]);