wrong-notebook 2026.10.25-2 → 2026.10.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (327) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +3 -0
  3. package/.next/build-manifest.json +3 -3
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/routes-manifest.json +18 -0
  6. package/.next/server/app/_global-error/page.js +1 -1
  7. package/.next/server/app/_global-error/page.js.nft.json +1 -1
  8. package/.next/server/app/_global-error.html +1 -1
  9. package/.next/server/app/_global-error.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  14. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/.next/server/app/admin/page.js.nft.json +1 -1
  16. package/.next/server/app/admin/page_client-reference-manifest.js +1 -1
  17. package/.next/server/app/admin/user/[id]/page.js.nft.json +1 -1
  18. package/.next/server/app/admin/user/[id]/page_client-reference-manifest.js +1 -1
  19. package/.next/server/app/api/admin/dashboard/route.js +12 -11
  20. package/.next/server/app/api/admin/dashboard/route.js.nft.json +1 -1
  21. package/.next/server/app/api/admin/migrate-tags/route.js +1 -1
  22. package/.next/server/app/api/admin/migrate-tags/route.js.nft.json +1 -1
  23. package/.next/server/app/api/admin/system-reset/route.js +1 -1
  24. package/.next/server/app/api/admin/system-reset/route.js.nft.json +1 -1
  25. package/.next/server/app/api/admin/users/[id]/detail/route.js +12 -11
  26. package/.next/server/app/api/admin/users/[id]/detail/route.js.nft.json +1 -1
  27. package/.next/server/app/api/admin/users/[id]/route.js +1 -1
  28. package/.next/server/app/api/admin/users/[id]/route.js.nft.json +1 -1
  29. package/.next/server/app/api/admin/users/route.js +1 -1
  30. package/.next/server/app/api/admin/users/route.js.nft.json +1 -1
  31. package/.next/server/app/api/ai/models/route.js +1 -1
  32. package/.next/server/app/api/ai/models/route.js.nft.json +1 -1
  33. package/.next/server/app/api/ai/test/route.js +9 -8
  34. package/.next/server/app/api/ai/test/route.js.nft.json +1 -1
  35. package/.next/server/app/api/analytics/route.js +1 -1
  36. package/.next/server/app/api/analytics/route.js.nft.json +1 -1
  37. package/.next/server/app/api/analyze/route.js +12 -11
  38. package/.next/server/app/api/analyze/route.js.nft.json +1 -1
  39. package/.next/server/app/api/auth/[...nextauth]/route.js +1 -1
  40. package/.next/server/app/api/auth/[...nextauth]/route.js.nft.json +1 -1
  41. package/.next/server/app/api/error-items/[id]/delete/route.js +1 -1
  42. package/.next/server/app/api/error-items/[id]/delete/route.js.nft.json +1 -1
  43. package/.next/server/app/api/error-items/[id]/figure/route.js +13 -12
  44. package/.next/server/app/api/error-items/[id]/figure/route.js.nft.json +1 -1
  45. package/.next/server/app/api/error-items/[id]/fix-latex/route.js +14 -13
  46. package/.next/server/app/api/error-items/[id]/fix-latex/route.js.nft.json +1 -1
  47. package/.next/server/app/api/error-items/[id]/geogebra/route.js +11 -10
  48. package/.next/server/app/api/error-items/[id]/geogebra/route.js.nft.json +1 -1
  49. package/.next/server/app/api/error-items/[id]/image/route.js +1 -1
  50. package/.next/server/app/api/error-items/[id]/image/route.js.nft.json +1 -1
  51. package/.next/server/app/api/error-items/[id]/notes/route.js +1 -1
  52. package/.next/server/app/api/error-items/[id]/notes/route.js.nft.json +1 -1
  53. package/.next/server/app/api/error-items/[id]/practice-records/route.js +1 -1
  54. package/.next/server/app/api/error-items/[id]/practice-records/route.js.nft.json +1 -1
  55. package/.next/server/app/api/error-items/[id]/reanswer/route.js +13 -12
  56. package/.next/server/app/api/error-items/[id]/reanswer/route.js.nft.json +1 -1
  57. package/.next/server/app/api/error-items/[id]/retag/route.js +12 -11
  58. package/.next/server/app/api/error-items/[id]/retag/route.js.nft.json +1 -1
  59. package/.next/server/app/api/error-items/[id]/route.js +1 -1
  60. package/.next/server/app/api/error-items/[id]/route.js.nft.json +1 -1
  61. package/.next/server/app/api/error-items/[id]/svg-animation/route.js +13 -12
  62. package/.next/server/app/api/error-items/[id]/svg-animation/route.js.nft.json +1 -1
  63. package/.next/server/app/api/error-items/batch-delete/route.js +1 -1
  64. package/.next/server/app/api/error-items/batch-delete/route.js.nft.json +1 -1
  65. package/.next/server/app/api/error-items/clear/route.js +1 -1
  66. package/.next/server/app/api/error-items/clear/route.js.nft.json +1 -1
  67. package/.next/server/app/api/error-items/list/route.js +1 -1
  68. package/.next/server/app/api/error-items/list/route.js.nft.json +1 -1
  69. package/.next/server/app/api/error-items/route.js +13 -12
  70. package/.next/server/app/api/error-items/route.js.nft.json +1 -1
  71. package/.next/server/app/api/error-items/short/[shortId]/route.js +1 -1
  72. package/.next/server/app/api/error-items/short/[shortId]/route.js.nft.json +1 -1
  73. package/.next/server/app/api/error-items/similarity/route.js +1 -1
  74. package/.next/server/app/api/error-items/similarity/route.js.nft.json +1 -1
  75. package/.next/server/app/api/exams/[id]/questions/[questionId]/regenerate/route.js +12 -11
  76. package/.next/server/app/api/exams/[id]/questions/[questionId]/regenerate/route.js.nft.json +1 -1
  77. package/.next/server/app/api/exams/[id]/results/route.js +12 -11
  78. package/.next/server/app/api/exams/[id]/results/route.js.nft.json +1 -1
  79. package/.next/server/app/api/exams/[id]/retry/route.js +11 -10
  80. package/.next/server/app/api/exams/[id]/retry/route.js.nft.json +1 -1
  81. package/.next/server/app/api/exams/[id]/route.js +11 -10
  82. package/.next/server/app/api/exams/[id]/route.js.nft.json +1 -1
  83. package/.next/server/app/api/exams/route.js +11 -10
  84. package/.next/server/app/api/exams/route.js.nft.json +1 -1
  85. package/.next/server/app/api/export/route.js +1 -1
  86. package/.next/server/app/api/export/route.js.nft.json +1 -1
  87. package/.next/server/app/api/geogebra-analyze/route.js +12 -11
  88. package/.next/server/app/api/geogebra-analyze/route.js.nft.json +1 -1
  89. package/.next/server/app/api/health/route.js +1 -1
  90. package/.next/server/app/api/health/route.js.nft.json +1 -1
  91. package/.next/server/app/api/import/route.js +11 -10
  92. package/.next/server/app/api/import/route.js.nft.json +1 -1
  93. package/.next/server/app/api/logs/frontend/route.js +1 -1
  94. package/.next/server/app/api/logs/frontend/route.js.nft.json +1 -1
  95. package/.next/server/app/api/minimax-code/checkin/route/app-paths-manifest.json +3 -0
  96. package/.next/server/app/api/minimax-code/checkin/route/build-manifest.json +12 -0
  97. package/.next/server/app/api/minimax-code/checkin/route/server-reference-manifest.json +4 -0
  98. package/.next/server/app/api/minimax-code/checkin/route.js +14 -0
  99. package/.next/server/app/api/minimax-code/checkin/route.js.map +5 -0
  100. package/.next/server/app/api/minimax-code/checkin/route.js.nft.json +1 -0
  101. package/.next/server/app/api/minimax-code/checkin/route_client-reference-manifest.js +3 -0
  102. package/.next/server/app/api/minimax-code/login/route/app-paths-manifest.json +3 -0
  103. package/.next/server/app/api/minimax-code/login/route/build-manifest.json +12 -0
  104. package/.next/server/app/api/minimax-code/login/route/server-reference-manifest.json +4 -0
  105. package/.next/server/app/api/minimax-code/login/route.js +12 -0
  106. package/.next/server/app/api/minimax-code/login/route.js.map +5 -0
  107. package/.next/server/app/api/minimax-code/login/route.js.nft.json +1 -0
  108. package/.next/server/app/api/minimax-code/login/route_client-reference-manifest.js +3 -0
  109. package/.next/server/app/api/minimax-code/route/app-paths-manifest.json +3 -0
  110. package/.next/server/app/api/minimax-code/route/build-manifest.json +12 -0
  111. package/.next/server/app/api/minimax-code/route/server-reference-manifest.json +4 -0
  112. package/.next/server/app/api/minimax-code/route.js +14 -0
  113. package/.next/server/app/api/minimax-code/route.js.map +5 -0
  114. package/.next/server/app/api/minimax-code/route.js.nft.json +1 -0
  115. package/.next/server/app/api/minimax-code/route_client-reference-manifest.js +3 -0
  116. package/.next/server/app/api/notebooks/[id]/retag/route.js +11 -10
  117. package/.next/server/app/api/notebooks/[id]/retag/route.js.nft.json +1 -1
  118. package/.next/server/app/api/notebooks/[id]/route.js +1 -1
  119. package/.next/server/app/api/notebooks/[id]/route.js.nft.json +1 -1
  120. package/.next/server/app/api/notebooks/route.js +1 -1
  121. package/.next/server/app/api/notebooks/route.js.nft.json +1 -1
  122. package/.next/server/app/api/openclaw/batch-upload/route.js +12 -11
  123. package/.next/server/app/api/openclaw/batch-upload/route.js.nft.json +1 -1
  124. package/.next/server/app/api/practice/generate/route.js +11 -10
  125. package/.next/server/app/api/practice/generate/route.js.nft.json +1 -1
  126. package/.next/server/app/api/practice/grade/route.js +11 -10
  127. package/.next/server/app/api/practice/grade/route.js.nft.json +1 -1
  128. package/.next/server/app/api/practice/record/[id]/route.js +13 -12
  129. package/.next/server/app/api/practice/record/[id]/route.js.nft.json +1 -1
  130. package/.next/server/app/api/practice/record/route.js +10 -9
  131. package/.next/server/app/api/practice/record/route.js.nft.json +1 -1
  132. package/.next/server/app/api/reanswer/route.js +11 -10
  133. package/.next/server/app/api/reanswer/route.js.nft.json +1 -1
  134. package/.next/server/app/api/register/route.js +1 -1
  135. package/.next/server/app/api/register/route.js.nft.json +1 -1
  136. package/.next/server/app/api/register/status/route.js +1 -1
  137. package/.next/server/app/api/register/status/route.js.nft.json +1 -1
  138. package/.next/server/app/api/review/due/route.js +1 -1
  139. package/.next/server/app/api/review/due/route.js.nft.json +1 -1
  140. package/.next/server/app/api/settings/route.js +6 -5
  141. package/.next/server/app/api/settings/route.js.nft.json +1 -1
  142. package/.next/server/app/api/stats/practice/clear/route.js +1 -1
  143. package/.next/server/app/api/stats/practice/clear/route.js.nft.json +1 -1
  144. package/.next/server/app/api/stats/practice/route.js +1 -1
  145. package/.next/server/app/api/stats/practice/route.js.nft.json +1 -1
  146. package/.next/server/app/api/tags/route.js +1 -1
  147. package/.next/server/app/api/tags/route.js.nft.json +1 -1
  148. package/.next/server/app/api/tags/stats/route.js +1 -1
  149. package/.next/server/app/api/tags/stats/route.js.nft.json +1 -1
  150. package/.next/server/app/api/tags/suggestions/route.js +1 -1
  151. package/.next/server/app/api/tags/suggestions/route.js.nft.json +1 -1
  152. package/.next/server/app/api/tasks/route.js +1 -1
  153. package/.next/server/app/api/tasks/route.js.nft.json +1 -1
  154. package/.next/server/app/api/user/route.js +1 -1
  155. package/.next/server/app/api/user/route.js.nft.json +1 -1
  156. package/.next/server/app/api/version/route.js +1 -1
  157. package/.next/server/app/api/version/route.js.nft.json +1 -1
  158. package/.next/server/app/error-items/[id]/page.js.nft.json +1 -1
  159. package/.next/server/app/error-items/[id]/page_client-reference-manifest.js +1 -1
  160. package/.next/server/app/exams/[id]/page.js.nft.json +1 -1
  161. package/.next/server/app/exams/[id]/page_client-reference-manifest.js +1 -1
  162. package/.next/server/app/exams/[id]/print/page.js.nft.json +1 -1
  163. package/.next/server/app/exams/[id]/print/page_client-reference-manifest.js +1 -1
  164. package/.next/server/app/exams/page.js.nft.json +1 -1
  165. package/.next/server/app/exams/page_client-reference-manifest.js +1 -1
  166. package/.next/server/app/favicon.ico/route.js +1 -1
  167. package/.next/server/app/favicon.ico/route.js.nft.json +1 -1
  168. package/.next/server/app/login/page.js.nft.json +1 -1
  169. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  170. package/.next/server/app/manifest.webmanifest/route.js +1 -1
  171. package/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  172. package/.next/server/app/notebooks/[id]/add/page.js.nft.json +1 -1
  173. package/.next/server/app/notebooks/[id]/add/page_client-reference-manifest.js +1 -1
  174. package/.next/server/app/notebooks/[id]/page.js.nft.json +1 -1
  175. package/.next/server/app/notebooks/[id]/page_client-reference-manifest.js +1 -1
  176. package/.next/server/app/notebooks/page.js.nft.json +1 -1
  177. package/.next/server/app/notebooks/page_client-reference-manifest.js +1 -1
  178. package/.next/server/app/page.js.nft.json +1 -1
  179. package/.next/server/app/page_client-reference-manifest.js +1 -1
  180. package/.next/server/app/practice/page.js.nft.json +1 -1
  181. package/.next/server/app/practice/page_client-reference-manifest.js +1 -1
  182. package/.next/server/app/print-preview/page.js.nft.json +1 -1
  183. package/.next/server/app/print-preview/page_client-reference-manifest.js +1 -1
  184. package/.next/server/app/register/page.js.nft.json +1 -1
  185. package/.next/server/app/register/page_client-reference-manifest.js +1 -1
  186. package/.next/server/app/review/page.js.nft.json +1 -1
  187. package/.next/server/app/review/page_client-reference-manifest.js +1 -1
  188. package/.next/server/app/stats/page.js.nft.json +1 -1
  189. package/.next/server/app/stats/page_client-reference-manifest.js +1 -1
  190. package/.next/server/app/tags/page.js.nft.json +1 -1
  191. package/.next/server/app/tags/page_client-reference-manifest.js +1 -1
  192. package/.next/server/app-paths-manifest.json +3 -0
  193. package/.next/server/chunks/{[externals]__1yyxisf-dquqj._.js → [externals]__1242krpdwt3fy._.js} +1 -1
  194. package/.next/server/chunks/{[externals]__0pot68n2q47fn._.js → [externals]__1pplcusjo3ok7._.js} +1 -1
  195. package/.next/server/chunks/[externals]__1zw_oy_-csyo1._.js +3 -0
  196. package/.next/server/chunks/{[root-of-the-server]__03_k40ubn0a9g._.js → [root-of-the-server]__0-12_rul4y06m._.js} +1 -1
  197. package/.next/server/chunks/{[root-of-the-server]__1dll9dp1pfrtj._.js → [root-of-the-server]__0-jhvuvprdrmu._.js} +2 -2
  198. package/.next/server/chunks/{[root-of-the-server]__00vnodiir_2d4._.js → [root-of-the-server]__0-lanxvfyc5w7._.js} +1 -1
  199. package/.next/server/chunks/{[root-of-the-server]__0rg4hkgdxbjou._.js → [root-of-the-server]__00rgirsp29kma._.js} +1 -1
  200. package/.next/server/chunks/{[root-of-the-server]__15eu8gun_s7xv._.js → [root-of-the-server]__023qntqk9nbma._.js} +2 -2
  201. package/.next/server/chunks/{[root-of-the-server]__18si67df5ho67._.js → [root-of-the-server]__035mztvplnh0_._.js} +2 -2
  202. package/.next/server/chunks/{[root-of-the-server]__0ry-pq8_6mc_0._.js → [root-of-the-server]__03nsgjsm70ted._.js} +2 -2
  203. package/.next/server/chunks/{[root-of-the-server]__1klj9kp10-bta._.js → [root-of-the-server]__03rln5n_21ad0._.js} +2 -2
  204. package/.next/server/chunks/{[root-of-the-server]__0-d9f8_x-uokl._.js → [root-of-the-server]__05-dvjb11wbvo._.js} +1 -1
  205. package/.next/server/chunks/{[root-of-the-server]__061dm-7_xqjef._.js → [root-of-the-server]__0ayraoa4xz-qt._.js} +2 -2
  206. package/.next/server/chunks/{[root-of-the-server]__04894g43fsy-j._.js → [root-of-the-server]__0b3ss-8ztcftu._.js} +1 -1
  207. package/.next/server/chunks/[root-of-the-server]__0dmllzem7rfag._.js +3 -0
  208. package/.next/server/chunks/[root-of-the-server]__0gx76tnihfcyv._.js +3 -0
  209. package/.next/server/chunks/{[root-of-the-server]__0an5a3hedd42o._.js → [root-of-the-server]__0h7igxq4ub38i._.js} +2 -2
  210. package/.next/server/chunks/{[root-of-the-server]__1i75c6j1-yn3y._.js → [root-of-the-server]__0icc6dvauvb15._.js} +2 -2
  211. package/.next/server/chunks/{[root-of-the-server]__1-g3tlhljmfsp._.js → [root-of-the-server]__0jb_3-yu-o6ms._.js} +2 -2
  212. package/.next/server/chunks/{[root-of-the-server]__1-hc0q3ck7id_._.js → [root-of-the-server]__0jjisfje72sqz._.js} +2 -2
  213. package/.next/server/chunks/[root-of-the-server]__0kskkg4ve55lv._.js +3 -0
  214. package/.next/server/chunks/[root-of-the-server]__0mbd9_76yhyaf._.js +3 -0
  215. package/.next/server/chunks/{[root-of-the-server]__1n8ih5ow23_12._.js → [root-of-the-server]__0my6t3vz24mmo._.js} +2 -2
  216. package/.next/server/chunks/{[root-of-the-server]__1k0zrfx1r08xk._.js → [root-of-the-server]__0nj600_104dqn._.js} +2 -2
  217. package/.next/server/chunks/[root-of-the-server]__0q4s9a9wy51vm._.js +3 -0
  218. package/.next/server/chunks/{[root-of-the-server]__18j9-n7s671bt._.js → [root-of-the-server]__0q_db5a74evdw._.js} +1 -1
  219. package/.next/server/chunks/{[root-of-the-server]__0_qgrtzrjahhc._.js → [root-of-the-server]__0qb8n1h-am-es._.js} +2 -2
  220. package/.next/server/chunks/{[root-of-the-server]__0yd-eoiuoru2o._.js → [root-of-the-server]__0rbh_oqaajxmo._.js} +2 -2
  221. package/.next/server/chunks/{[root-of-the-server]__1k_8n_p3i4my_._.js → [root-of-the-server]__0ssa-hz8b3v1i._.js} +1 -1
  222. package/.next/server/chunks/{[root-of-the-server]__123tftn1fdgwu._.js → [root-of-the-server]__0u2_q8y9hl1u-._.js} +2 -2
  223. package/.next/server/chunks/[root-of-the-server]__0uz7-ix0696nv._.js +3 -0
  224. package/.next/server/chunks/[root-of-the-server]__0v3k8_i3f2v13._.js +3 -0
  225. package/.next/server/chunks/[root-of-the-server]__0vu6_38lbzxar._.js +3 -0
  226. package/.next/server/chunks/[root-of-the-server]__0wcet8-wl-oad._.js +3 -0
  227. package/.next/server/chunks/{[root-of-the-server]__0hjv7gm7tjgzr._.js → [root-of-the-server]__0wmczeyrx2y7f._.js} +1 -1
  228. package/.next/server/chunks/{[root-of-the-server]__1q9wd_k6hcd5m._.js → [root-of-the-server]__0zb48en2m8yk0._.js} +3 -3
  229. package/.next/server/chunks/[root-of-the-server]__0zjg773epx4r_._.js +1 -1
  230. package/.next/server/chunks/{[root-of-the-server]__0p4dqz2jo4o3r._.js → [root-of-the-server]__0zr9l7lnr1i0l._.js} +2 -2
  231. package/.next/server/chunks/{[root-of-the-server]__0k0-mj3lzqicn._.js → [root-of-the-server]__1-302_px1h0qz._.js} +2 -2
  232. package/.next/server/chunks/[root-of-the-server]__1-9hu4j35d9ao._.js +3 -0
  233. package/.next/server/chunks/{[root-of-the-server]__00atddp_h2wsm._.js → [root-of-the-server]__12tt2pf5nuueu._.js} +2 -2
  234. package/.next/server/chunks/[root-of-the-server]__13z5coff9j0sa._.js +3 -0
  235. package/.next/server/chunks/[root-of-the-server]__14n5uude1fj4h._.js +3 -0
  236. package/.next/server/chunks/{[root-of-the-server]__1e_3xwt459gzy._.js → [root-of-the-server]__16c0c0-pt6gz4._.js} +1 -1
  237. package/.next/server/chunks/[root-of-the-server]__17pktht8hd051._.js +3 -0
  238. package/.next/server/chunks/[root-of-the-server]__18lmdddgrhac8._.js +3 -0
  239. package/.next/server/chunks/{[root-of-the-server]__1unmu-s-yg7fk._.js → [root-of-the-server]__199tod2f3vhny._.js} +2 -2
  240. package/.next/server/chunks/[root-of-the-server]__1a1fr6o2wf7qx._.js +3 -0
  241. package/.next/server/chunks/{[root-of-the-server]__0l7y2xk1m7h84._.js → [root-of-the-server]__1ar95f9mysi15._.js} +1 -1
  242. package/.next/server/chunks/[root-of-the-server]__1bep0vcwbtlfu._.js +3 -0
  243. package/.next/server/chunks/[root-of-the-server]__1esyxu40fpnyx._.js +3 -0
  244. package/.next/server/chunks/[root-of-the-server]__1fc23i58z_ao2._.js +1 -1
  245. package/.next/server/chunks/{[root-of-the-server]__15vjk2wddz8hx._.js → [root-of-the-server]__1g2qwf_mnzqly._.js} +2 -2
  246. package/.next/server/chunks/{[root-of-the-server]__20khcxfcwy16p._.js → [root-of-the-server]__1gg8lq2q9gzg2._.js} +3 -3
  247. package/.next/server/chunks/{[root-of-the-server]__1wfua4wupbgjj._.js → [root-of-the-server]__1imiyrtb6t6zp._.js} +2 -2
  248. package/.next/server/chunks/[root-of-the-server]__1iux__qytdtm5._.js +3 -0
  249. package/.next/server/chunks/[root-of-the-server]__1jhz19cuxjpmb._.js +3 -0
  250. package/.next/server/chunks/[root-of-the-server]__1jthkkelxfeb0._.js +3 -0
  251. package/.next/server/chunks/[root-of-the-server]__1k7cmt02s_syx._.js +3 -0
  252. package/.next/server/chunks/[root-of-the-server]__1kvcjw9quzr0w._.js +3 -0
  253. package/.next/server/chunks/[root-of-the-server]__1nsrbw9jntgo8._.js +3 -0
  254. package/.next/server/chunks/[root-of-the-server]__1p08ff3pxle05._.js +3 -0
  255. package/.next/server/chunks/{[root-of-the-server]__1vgkjjilvagrv._.js → [root-of-the-server]__1pulvd2ac2agx._.js} +1 -1
  256. package/.next/server/chunks/[root-of-the-server]__1rfqipe89aq-u._.js +3 -0
  257. package/.next/server/chunks/[root-of-the-server]__1uscfmw0q-en5._.js +3 -0
  258. package/.next/server/chunks/{[root-of-the-server]__15g3fbcq719hq._.js → [root-of-the-server]__1ya630gfyks-f._.js} +2 -2
  259. package/.next/server/chunks/[root-of-the-server]__1yslrvk_y61kt._.js +3 -0
  260. package/.next/server/chunks/[root-of-the-server]__1zyka21s1ahtj._.js +1 -1
  261. package/.next/server/chunks/{[root-of-the-server]__1jvkc3eu49g96._.js → [root-of-the-server]__20i0-g_8_okaf._.js} +2 -2
  262. package/.next/server/chunks/[root-of-the-server]__20sulb1y6n1b8._.js +3 -0
  263. package/.next/server/chunks/_076-jjzrfdsdk._.js +3 -0
  264. package/.next/server/chunks/_0geyrqrvyak26._.js +1 -1
  265. package/.next/server/chunks/_0kkvpy2s_y3-n._.js +1 -1
  266. package/.next/server/chunks/_0lob14xk0ko5z._.js +3 -0
  267. package/.next/server/chunks/_0ne4rbj35w-io._.js +1 -1
  268. package/.next/server/chunks/_0qsjdkq-39qbo._.js +1 -1
  269. package/.next/server/chunks/_13ffmxv8qrwi0._.js +1 -1
  270. package/.next/server/chunks/_1hp9mnz19v199._.js +3 -0
  271. package/.next/server/chunks/_1lrt8e26anbnm._.js +1 -1
  272. package/.next/server/chunks/_1pvqo-qnv-nqm._.js +1 -1
  273. package/.next/server/chunks/_next-internal_server_app_api_minimax-code_checkin_route_actions_0wqvstxphnn7t.js +3 -0
  274. package/.next/server/chunks/_next-internal_server_app_api_minimax-code_login_route_actions_0z7k0201hg8nt.js +3 -0
  275. package/.next/server/chunks/_next-internal_server_app_api_minimax-code_route_actions_0isqzusy30klb.js +3 -0
  276. package/.next/server/chunks/src_03_og0nynnyx2._.js +3 -0
  277. package/.next/server/chunks/src_lib_05svhzm9a162-._.js +1 -1
  278. package/.next/server/chunks/src_lib_logger_ts_1a0ve505bb0y2._.js +3 -0
  279. package/.next/server/chunks/src_lib_minimax-code_auth_ts_0-i5sxuori1um._.js +3 -0
  280. package/.next/server/chunks/src_lib_minimax-code_checkin_ts_1j1mpuxc1vgoz._.js +3 -0
  281. package/.next/server/chunks/ssr/{[root-of-the-server]__070lhtl_a6l81._.js → [root-of-the-server]__1vkia8gjeangv._.js} +1 -1
  282. package/.next/server/chunks/ssr/_00np6xqvkg6u-._.js +1 -1
  283. package/.next/server/chunks/ssr/src_1gayunqs8u2e2._.js +1 -1
  284. package/.next/server/chunks/ssr/src_components_providers_tsx_09kw-mv3nb6xs._.js +10 -10
  285. package/.next/server/instrumentation.js +1 -1
  286. package/.next/server/middleware-build-manifest.js +3 -3
  287. package/.next/server/middleware-manifest.json +5 -5
  288. package/.next/server/pages/500.html +1 -1
  289. package/.next/server/preview-props.json +3 -3
  290. package/.next/server/server-reference-manifest.js +1 -1
  291. package/.next/server/server-reference-manifest.json +1 -1
  292. package/.next/static/chunks/1nimjc5xqpgag.js +191 -0
  293. package/.next/static/chunks/1v_ioerabkr4s.js +1 -0
  294. package/.next/static/chunks/43gsd2ww2f2iy.css +3 -0
  295. package/package.json +1 -1
  296. package/prisma/seed.db +0 -0
  297. package/.next/server/chunks/[root-of-the-server]__076sanerpxzzq._.js +0 -3
  298. package/.next/server/chunks/[root-of-the-server]__08ftj1z8v5lqc._.js +0 -3
  299. package/.next/server/chunks/[root-of-the-server]__09-twlny39tdc._.js +0 -3
  300. package/.next/server/chunks/[root-of-the-server]__09mpwfp41rtdc._.js +0 -3
  301. package/.next/server/chunks/[root-of-the-server]__0dql4kl3n1jq6._.js +0 -3
  302. package/.next/server/chunks/[root-of-the-server]__0fyho53bjgbss._.js +0 -3
  303. package/.next/server/chunks/[root-of-the-server]__0hgoyp7m26_hk._.js +0 -3
  304. package/.next/server/chunks/[root-of-the-server]__0j-pkzf61aot8._.js +0 -3
  305. package/.next/server/chunks/[root-of-the-server]__0swyn0_rzg_pb._.js +0 -3
  306. package/.next/server/chunks/[root-of-the-server]__0tua5u4r1xt_r._.js +0 -3
  307. package/.next/server/chunks/[root-of-the-server]__0vtzo5ex73ywq._.js +0 -3
  308. package/.next/server/chunks/[root-of-the-server]__1-2dj_mbdiqvl._.js +0 -3
  309. package/.next/server/chunks/[root-of-the-server]__1-ti76u3720cd._.js +0 -3
  310. package/.next/server/chunks/[root-of-the-server]__10-um36nto0ht._.js +0 -3
  311. package/.next/server/chunks/[root-of-the-server]__10jwy1-wzrjon._.js +0 -3
  312. package/.next/server/chunks/[root-of-the-server]__12czp5_up_ywb._.js +0 -3
  313. package/.next/server/chunks/[root-of-the-server]__1bqziovn_k5u5._.js +0 -3
  314. package/.next/server/chunks/[root-of-the-server]__1cbj5r83fs2up._.js +0 -3
  315. package/.next/server/chunks/[root-of-the-server]__1d25c4t27ht5c._.js +0 -3
  316. package/.next/server/chunks/[root-of-the-server]__1dxa-5wqgxi3y._.js +0 -3
  317. package/.next/server/chunks/[root-of-the-server]__1i0nyuimhqkda._.js +0 -3
  318. package/.next/server/chunks/[root-of-the-server]__1wpzmu_3tg_74._.js +0 -3
  319. package/.next/server/chunks/[root-of-the-server]__1ztojnklvdebx._.js +0 -3
  320. package/.next/server/chunks/[root-of-the-server]__1zzfvs1z1_tig._.js +0 -3
  321. package/.next/server/chunks/src_0tzpy5j8n_1bx._.js +0 -3
  322. package/.next/static/chunks/00kfvk-buhhsb.js +0 -191
  323. package/.next/static/chunks/0_9gv911-tqmk.css +0 -3
  324. package/.next/static/chunks/2wk_a0jmwmybn.js +0 -1
  325. /package/.next/static/{ZH3ew12HOzoE3JRl8c_8L → 5uNP139l0DCSagwPDMOvD}/_buildManifest.js +0 -0
  326. /package/.next/static/{ZH3ew12HOzoE3JRl8c_8L → 5uNP139l0DCSagwPDMOvD}/_clientMiddlewareManifest.js +0 -0
  327. /package/.next/static/{ZH3ew12HOzoE3JRl8c_8L → 5uNP139l0DCSagwPDMOvD}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
1
- module.exports=[[827572,a=>{let b;var c,d=a.i(907997),e=a.i(423164);let f={className:e.default.className,style:{fontFamily:"'geistSans', 'geistSans Fallback'"}};null!=e.default.variable&&(f.variable=e.default.variable);var g=a.i(706111);let h={className:g.default.className,style:{fontFamily:"'geistMono', 'geistMono Fallback'"}};null!=g.default.variable&&(h.variable=g.default.variable);var i=a.i(547189),j=a.i(522734),k=a.i(814747);let l={trace:10,debug:20,info:30,warn:40,error:50,fatal:60};function m(a,b={}){let c,d=l[a],e=(c=process.env.LOG_LEVEL?.toLowerCase())&&void 0!==l[c]?l[c]:l.info;return(c,f)=>{let g,h;if(d<e)return;let i=new Date;"string"==typeof c?(g={},h=c):(g=c,h=f||"");{let c=JSON.stringify({level:a,time:i.toISOString(),...b,...g,msg:h});switch(a){case"error":case"fatal":console.error(c);break;case"warn":console.warn(c);break;default:console.log(c)}}}}let n=function a(b={}){return b.module,{trace:m("trace",b),debug:m("debug",b),info:m("info",b),warn:m("warn",b),error:m("error",b),fatal:m("fatal",b),child:c=>a({...b,...c}),box:(a,c,d="📋")=>{console.log(JSON.stringify({level:"info",time:new Date().toISOString(),...b,title:a,..."string"==typeof c?{content:c}:c||{},msg:a}))},divider:(a="-")=>{}}}({env:"production"});new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z"));let o="Asia/Shanghai",p={minimax:{name:"MiniMax",baseUrl:"https://api.minimax.cn/v1",model:"MiniMax-M3.1-Flash",envPrefix:"MINIMAX",consoleUrl:"https://platform.minimax.cn"},glm:{name:"智谱 GLM",baseUrl:"https://open.bigmodel.cn/api/paas/v4",model:"glm-5.3-flash",envPrefix:"GLM",consoleUrl:"https://open.bigmodel.cn"},deepseek:{name:"DeepSeek",baseUrl:"https://api.deepseek.com",model:"deepseek-flash",envPrefix:"DEEPSEEK",consoleUrl:"https://platform.deepseek.com"},kimi:{name:"Kimi",baseUrl:"https://api.moonshot.cn/v1",model:"kimi-k3",envPrefix:"KIMI",consoleUrl:"https://platform.kimi.com"}},q=Object.keys(p),r=n.child({module:"config"}),s=k.default.join(process.env.CONFIG_DIR||k.default.join(process.cwd(),"config"),"app-config.json"),t={aiProvider:process.env.AI_PROVIDER||"minimax",allowRegistration:"true"===process.env.ALLOW_REGISTRATION,aiDailyLimit:Number.isInteger(b="number"==typeof(c=process.env.AI_DAILY_LIMIT)?c:Number(c))&&b>0?b:0,timeZone:o,openai:{instances:process.env.OPENAI_API_KEY?[{id:"env-default",name:"Default (ENV)",apiKey:process.env.OPENAI_API_KEY,baseUrl:process.env.OPENAI_BASE_URL||"https://api.openai.com/v1",model:process.env.OPENAI_MODEL||"gpt-6.1-sol"}]:[],activeInstanceId:process.env.OPENAI_API_KEY?"env-default":void 0},gemini:{apiKey:process.env.GOOGLE_API_KEY,baseUrl:process.env.GEMINI_BASE_URL,model:process.env.GEMINI_MODEL||"gemini-2.5-flash"},azure:{apiKey:process.env.AZURE_OPENAI_API_KEY,endpoint:process.env.AZURE_OPENAI_ENDPOINT,deploymentName:process.env.AZURE_OPENAI_DEPLOYMENT,apiVersion:process.env.AZURE_OPENAI_API_VERSION||"2024-02-15-preview",model:process.env.AZURE_OPENAI_MODEL||"gpt-4o"},anthropic:{apiKey:process.env.ANTHROPIC_API_KEY,baseUrl:process.env.ANTHROPIC_BASE_URL,model:process.env.ANTHROPIC_MODEL||"claude-sonnet-5-5"},...Object.fromEntries(q.map(a=>{let b=p[a].envPrefix;return[a,{apiKey:process.env[`${b}_API_KEY`],baseUrl:process.env[`${b}_BASE_URL`],model:process.env[`${b}_MODEL`]}]})),prompts:{analyze:"",similar:""},timeouts:{analyze:18e4}};a.s(["default",0,function({children:a}){return(0,d.jsxs)("html",{lang:"en",suppressHydrationWarning:!0,children:[(0,d.jsx)("head",{children:(0,d.jsx)("title",{children:"AI智能错题本"})}),(0,d.jsx)("body",{className:`${f.variable} ${h.variable} antialiased`,suppressHydrationWarning:!0,children:(0,d.jsx)(i.Providers,{timeZone:function(){let a;try{a=function(){try{return j.default.readFileSync(s,"utf-8")}catch(a){if(a?.code==="ENOENT")return null;throw a}}()}catch(a){return r.error({error:a},"Failed to read config file"),t}if(null!==a)try{var b,c;let d=JSON.parse(a),e=d.openai;if((b=d.openai)&&"object"==typeof b&&"apiKey"in b&&!("instances"in b)){let a;r.info("Detected legacy OpenAI config, migrating to multi-instance format..."),e=function(a){if(!a.apiKey)return{instances:[],activeInstanceId:void 0};let b={id:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{let b=16*Math.random()|0;return("x"===a?b:3&b|8).toString(16)}),name:"Default",apiKey:a.apiKey,baseUrl:a.baseUrl||"https://api.openai.com/v1",model:a.model||"gpt-6.1-sol"};return{instances:[b],activeInstanceId:b.id}}(d.openai),c={...d,openai:e},a=`${s}.${process.pid}.tmp`,j.default.writeFileSync(a,JSON.stringify(c,null,2)),j.default.renameSync(a,s),r.info("Legacy OpenAI config migrated successfully")}return{...t,...d,timeZone:!function(a){if("string"!=typeof a||!a.trim())return!1;try{return new Intl.DateTimeFormat("en",{timeZone:a.trim()}).format(),!0}catch{return!1}}(d.timeZone)?o:d.timeZone.trim(),openai:{instances:e?.instances||t.openai?.instances||[],activeInstanceId:e?.activeInstanceId||t.openai?.activeInstanceId},gemini:{...t.gemini,...d.gemini},azure:{...t.azure,...d.azure},anthropic:{...t.anthropic,...d.anthropic},...Object.fromEntries(q.map(a=>[a,{...t[a],...d[a]}])),prompts:{...t.prompts,...d.prompts},timeouts:{...t.timeouts,...d.timeouts}}}catch(a){r.error({error:a},"Failed to read config file")}return t}().timeZone||o,children:a})})]})},"dynamic",0,"force-dynamic","metadata",0,{description:"基于AI的智能错题管理系统,帮助学生高效整理、分析和复习错题",appleWebApp:{capable:!0,statusBarStyle:"default",title:"智能错题本"},formatDetection:{telephone:!1},icons:{icon:"/icons/icon.png",apple:"/icons/apple-touch-icon.png"}},"viewport",0,{themeColor:"#4f46e5",width:"device-width",initialScale:1,maximumScale:1,userScalable:!1}],827572)},207698,a=>{let b=(0,a.i(211857).registerClientReference)(function(){throw Error("Attempted to call Providers() from the server but Providers is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/components/providers.tsx","Providers");a.s(["Providers",0,b])},547189,a=>{var b=a.i(207698);a.n(b)}],706111,a=>{a.v({className:"ayGZiq_className",variable:"ayGZiq_variable"})},423164,a=>{a.v({className:"ckR-yq_className",variable:"ckR-yq_variable"})},650645,function(a){a.n(a.i(827572))}];
1
+ module.exports=[[827572,a=>{let b;var c,d=a.i(907997),e=a.i(423164);let f={className:e.default.className,style:{fontFamily:"'geistSans', 'geistSans Fallback'"}};null!=e.default.variable&&(f.variable=e.default.variable);var g=a.i(706111);let h={className:g.default.className,style:{fontFamily:"'geistMono', 'geistMono Fallback'"}};null!=g.default.variable&&(h.variable=g.default.variable);var i=a.i(547189),j=a.i(522734),k=a.i(814747);let l={trace:10,debug:20,info:30,warn:40,error:50,fatal:60};function m(a,b={}){let c,d=l[a],e=(c=process.env.LOG_LEVEL?.toLowerCase())&&void 0!==l[c]?l[c]:l.info;return(c,f)=>{let g,h;if(d<e)return;let i=new Date;"string"==typeof c?(g={},h=c):(g=c,h=f||"");{let c=JSON.stringify({level:a,time:i.toISOString(),...b,...g,msg:h});switch(a){case"error":case"fatal":console.error(c);break;case"warn":console.warn(c);break;default:console.log(c)}}}}let n=function a(b={}){return b.module,{trace:m("trace",b),debug:m("debug",b),info:m("info",b),warn:m("warn",b),error:m("error",b),fatal:m("fatal",b),child:c=>a({...b,...c}),box:(a,c,d="📋")=>{console.log(JSON.stringify({level:"info",time:new Date().toISOString(),...b,title:a,..."string"==typeof c?{content:c}:c||{},msg:a}))},divider:(a="-")=>{}}}({env:"production"});new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date("2014-06-25T04:00:00.123Z"));let o="Asia/Shanghai",p={minimax:{name:"MiniMax",baseUrl:"https://api.minimax.cn/v1",model:"MiniMax-M3.1-Flash",envPrefix:"MINIMAX",consoleUrl:"https://platform.minimax.cn"},glm:{name:"智谱 GLM",baseUrl:"https://open.bigmodel.cn/api/paas/v4",model:"glm-5.3-flash",envPrefix:"GLM",consoleUrl:"https://open.bigmodel.cn"},deepseek:{name:"DeepSeek",baseUrl:"https://api.deepseek.com",model:"deepseek-flash",envPrefix:"DEEPSEEK",consoleUrl:"https://platform.deepseek.com"},kimi:{name:"Kimi",baseUrl:"https://api.moonshot.cn/v1",model:"kimi-k3",envPrefix:"KIMI",consoleUrl:"https://platform.kimi.com"}},q=Object.keys(p),r=n.child({module:"config"}),s=k.default.join(process.env.CONFIG_DIR||k.default.join(process.cwd(),"config"),"app-config.json"),t={aiProvider:process.env.AI_PROVIDER||"minimax",allowRegistration:"true"===process.env.ALLOW_REGISTRATION,aiDailyLimit:Number.isInteger(b="number"==typeof(c=process.env.AI_DAILY_LIMIT)?c:Number(c))&&b>0?b:0,timeZone:o,openai:{instances:process.env.OPENAI_API_KEY?[{id:"env-default",name:"Default (ENV)",apiKey:process.env.OPENAI_API_KEY,baseUrl:process.env.OPENAI_BASE_URL||"https://api.openai.com/v1",model:process.env.OPENAI_MODEL||"gpt-6.1-sol"}]:[],activeInstanceId:process.env.OPENAI_API_KEY?"env-default":void 0},gemini:{apiKey:process.env.GOOGLE_API_KEY,baseUrl:process.env.GEMINI_BASE_URL,model:process.env.GEMINI_MODEL||"gemini-2.5-flash"},azure:{apiKey:process.env.AZURE_OPENAI_API_KEY,endpoint:process.env.AZURE_OPENAI_ENDPOINT,deploymentName:process.env.AZURE_OPENAI_DEPLOYMENT,apiVersion:process.env.AZURE_OPENAI_API_VERSION||"2024-02-15-preview",model:process.env.AZURE_OPENAI_MODEL||"gpt-4o"},anthropic:{apiKey:process.env.ANTHROPIC_API_KEY,baseUrl:process.env.ANTHROPIC_BASE_URL,model:process.env.ANTHROPIC_MODEL||"claude-sonnet-5-5"},minimaxCode:{model:process.env.MINIMAX_CODE_MODEL,autoCheckin:"false"!==process.env.MINIMAX_CODE_AUTO_CHECKIN},...Object.fromEntries(q.map(a=>{let b=p[a].envPrefix;return[a,{apiKey:process.env[`${b}_API_KEY`],baseUrl:process.env[`${b}_BASE_URL`],model:process.env[`${b}_MODEL`]}]})),prompts:{analyze:"",similar:""},timeouts:{analyze:18e4}};a.s(["default",0,function({children:a}){return(0,d.jsxs)("html",{lang:"en",suppressHydrationWarning:!0,children:[(0,d.jsx)("head",{children:(0,d.jsx)("title",{children:"AI智能错题本"})}),(0,d.jsx)("body",{className:`${f.variable} ${h.variable} antialiased`,suppressHydrationWarning:!0,children:(0,d.jsx)(i.Providers,{timeZone:function(){let a;try{a=function(){try{return j.default.readFileSync(s,"utf-8")}catch(a){if(a?.code==="ENOENT")return null;throw a}}()}catch(a){return r.error({error:a},"Failed to read config file"),t}if(null!==a)try{var b,c;let d=JSON.parse(a),e=d.openai;if((b=d.openai)&&"object"==typeof b&&"apiKey"in b&&!("instances"in b)){let a;r.info("Detected legacy OpenAI config, migrating to multi-instance format..."),e=function(a){if(!a.apiKey)return{instances:[],activeInstanceId:void 0};let b={id:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{let b=16*Math.random()|0;return("x"===a?b:3&b|8).toString(16)}),name:"Default",apiKey:a.apiKey,baseUrl:a.baseUrl||"https://api.openai.com/v1",model:a.model||"gpt-6.1-sol"};return{instances:[b],activeInstanceId:b.id}}(d.openai),c={...d,openai:e},a=`${s}.${process.pid}.tmp`,j.default.writeFileSync(a,JSON.stringify(c,null,2)),j.default.renameSync(a,s),r.info("Legacy OpenAI config migrated successfully")}return{...t,...d,timeZone:!function(a){if("string"!=typeof a||!a.trim())return!1;try{return new Intl.DateTimeFormat("en",{timeZone:a.trim()}).format(),!0}catch{return!1}}(d.timeZone)?o:d.timeZone.trim(),openai:{instances:e?.instances||t.openai?.instances||[],activeInstanceId:e?.activeInstanceId||t.openai?.activeInstanceId},gemini:{...t.gemini,...d.gemini},azure:{...t.azure,...d.azure},anthropic:{...t.anthropic,...d.anthropic},minimaxCode:{...t.minimaxCode,...d.minimaxCode},...Object.fromEntries(q.map(a=>[a,{...t[a],...d[a]}])),prompts:{...t.prompts,...d.prompts},timeouts:{...t.timeouts,...d.timeouts}}}catch(a){r.error({error:a},"Failed to read config file")}return t}().timeZone||o,children:a})})]})},"dynamic",0,"force-dynamic","metadata",0,{description:"基于AI的智能错题管理系统,帮助学生高效整理、分析和复习错题",appleWebApp:{capable:!0,statusBarStyle:"default",title:"智能错题本"},formatDetection:{telephone:!1},icons:{icon:"/icons/icon.png",apple:"/icons/apple-touch-icon.png"}},"viewport",0,{themeColor:"#4f46e5",width:"device-width",initialScale:1,maximumScale:1,userScalable:!1}],827572)},207698,a=>{let b=(0,a.i(211857).registerClientReference)(function(){throw Error("Attempted to call Providers() from the server but Providers is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/components/providers.tsx","Providers");a.s(["Providers",0,b])},547189,a=>{var b=a.i(207698);a.n(b)}],706111,a=>{a.v({className:"ayGZiq_className",variable:"ayGZiq_variable"})},423164,a=>{a.v({className:"ckR-yq_className",variable:"ckR-yq_variable"})},650645,function(a){a.n(a.i(827572))}];
2
2
 
3
3
  //# sourceMappingURL=src_1gayunqs8u2e2._.js.map
@@ -1,19 +1,19 @@
1
- module.exports=[418175,a=>{"use strict";var b=a.i(187924),c=a.i(550194),d=a.i(875003),e=a.i(529759),f=a.i(16644),g=a.i(238246),h=a.i(50944),i=a.i(839761),j=a.i(953722),k=a.i(327999),l=a.i(104720),m=a.i(170106);let n=(0,m.f)("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]),o=(0,m.f)("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),p=(0,m.f)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]),q=(0,m.f)("tags",[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]]);var r=a.i(572131);let s=(0,m.f)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),t=(0,m.f)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]),u=(0,m.f)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);var v=a.i(149625),w=a.i(596221);let x=(0,m.f)("message-square-text",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]]),y=(0,m.f)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);var z=a.i(546842),A=a.i(699570),B=a.i(814574),C=a.i(875083),D=a.i(986705),E=a.i(786304),F=a.i(507554),G=a.i(470121),H=a.i(750104),I=a.i(225152),J=a.i(3688),K=a.i(30553),L=Object.defineProperty,M=(a,b)=>L(a,"name",{value:b,configurable:!0}),N="Switch",[O,P]=(0,H.f)(N),[Q,R]=O(N);function S(a){let{__scopeSwitch:c,checked:d,children:e,defaultChecked:f,disabled:g,form:h,name:i,onCheckedChange:j,required:k,value:l="on",internal_do_not_use_render:m}=a,[n,o]=(0,I.f)({prop:d,defaultProp:f??!1,onChange:j,caller:N}),[p,q]=r.useState(null),[s,t]=r.useState(null),[u,v]=r.useState(null),w=!p||!!h||!!p.closest("form"),x={checked:n,setChecked:o,disabled:g,control:p,setControl:q,name:i,form:h,value:l,userClick:u,onUserClick:v,required:k,defaultChecked:f,isFormControl:w,bubbleInput:s,setBubbleInput:t};return(0,b.jsx)(Q,{scope:c,...x,children:X(m)?m(x):e})}M(S,"SwitchProvider");var T=r.forwardRef(M(function({__scopeSwitch:a,onClick:c,...d},e){let{control:f,form:g,value:h,disabled:i,checked:j,required:k,setControl:l,setChecked:m,onUserClick:n,isFormControl:o,bubbleInput:p}=R("SwitchTrigger",a),q=(0,G.f)(e,l),s=r.useRef(j);return r.useEffect(()=>{let a=g?f?.ownerDocument.getElementById(g):f?.form;if(a instanceof HTMLFormElement){let b=M(()=>m(s.current),"reset");return a.addEventListener("reset",b),()=>a.removeEventListener("reset",b)}},[f,g,m]),(0,b.jsx)(K.V.button,{type:"button",role:"switch","aria-checked":j,"aria-required":k,"data-state":Y(j),"data-disabled":i?"":void 0,disabled:i,value:h,...d,ref:q,onClick:(0,F.f)(c,a=>{let b=a.isPropagationStopped();n({requestedChecked:!j,hasConsumerStoppedPropagation:b}),m(a=>!a),p&&o&&!b&&a.stopPropagation()})})},"SwitchTrigger")),U=r.forwardRef(M(function(a,c){let{__scopeSwitch:d,name:e,checked:f,defaultChecked:g,required:h,disabled:i,value:j,onCheckedChange:k,form:l,...m}=a;return(0,b.jsx)(S,{__scopeSwitch:d,checked:f,defaultChecked:g,disabled:i,required:h,onCheckedChange:k,name:e,form:l,value:j,internal_do_not_use_render:({isFormControl:a})=>(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(T,{...m,ref:c,__scopeSwitch:d}),a&&(0,b.jsx)(W,{__scopeSwitch:d})]})})},"Switch")),V=r.forwardRef(M(function(a,c){let{__scopeSwitch:d,...e}=a,f=R("SwitchThumb",d);return(0,b.jsx)(K.V.span,{"data-state":Y(f.checked),"data-disabled":f.disabled?"":void 0,...e,ref:c})},"SwitchThumb")),W=r.forwardRef(M(function({__scopeSwitch:a,onClick:c,...d},e){let{control:f,userClick:g,checked:h,defaultChecked:i,required:j,disabled:k,name:l,value:m,form:n,bubbleInput:o,setBubbleInput:p}=R("SwitchBubbleInput",a),q=(0,G.f)(e,p),s=(0,J.f)(f),t=r.useRef(!1),u=r.useRef(h),v=r.useRef(g),w=r.useRef(null);r.useEffect(()=>{if(!o)return;let a=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(!a)return;let b=u.current!==h;u.current=h;let c=null!==g&&g!==v.current;if(v.current=g,c)w.current=b?null:g,b&&a.call(o,h),o.dispatchEvent(new Event("click",{bubbles:!g.hasConsumerStoppedPropagation}));else if(b){let b=w.current;w.current=null;let c=b?.requestedChecked===h;t.current=!0,a.call(o,h),o.dispatchEvent(new Event("click",{bubbles:!(c&&b.hasConsumerStoppedPropagation)})),t.current=!1}},[o,h,g]);let x=r.useRef(h);return(0,b.jsx)(K.V.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??x.current,required:j,disabled:k,name:l,value:m,form:n,...d,tabIndex:-1,ref:q,onClick:(0,F.f)(c,a=>{t.current&&a.stopPropagation()}),style:{...d.style,...s,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function X(a){return"function"==typeof a}function Y(a){return a?"checked":"unchecked"}M(X,"isFunction"),M(Y,"getState");var Z=a.i(368114);let $=r.forwardRef(({className:a,...c},d)=>(0,b.jsx)(U,{className:(0,Z.f)("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",a),...c,ref:d,children:(0,b.jsx)(V,{className:(0,Z.f)("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));$.displayName=U.displayName;var _=a.i(866718),aa=a.i(870430);let ab=r.forwardRef(({className:a,...c},d)=>(0,b.jsx)("div",{className:"relative w-full overflow-auto",children:(0,b.jsx)("table",{ref:d,className:(0,Z.f)("w-full caption-bottom text-sm",a),...c})}));ab.displayName="Table";let ac=r.forwardRef(({className:a,...c},d)=>(0,b.jsx)("thead",{ref:d,className:(0,Z.f)("[&_tr]:border-b",a),...c}));ac.displayName="TableHeader";let ad=r.forwardRef(({className:a,...c},d)=>(0,b.jsx)("tbody",{ref:d,className:(0,Z.f)("[&_tr:last-child]:border-0",a),...c}));ad.displayName="TableBody",(r.forwardRef(({className:a,...c},d)=>(0,b.jsx)("tfoot",{ref:d,className:(0,Z.f)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",a),...c}))).displayName="TableFooter";let ae=r.forwardRef(({className:a,...c},d)=>(0,b.jsx)("tr",{ref:d,className:(0,Z.f)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",a),...c}));ae.displayName="TableRow";let af=r.forwardRef(({className:a,...c},d)=>(0,b.jsx)("th",{ref:d,className:(0,Z.f)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",a),...c}));af.displayName="TableHead";let ag=r.forwardRef(({className:a,...c},d)=>(0,b.jsx)("td",{ref:d,className:(0,Z.f)("p-4 align-middle [&:has([role=checkbox])]:pr-0",a),...c}));ag.displayName="TableCell",(r.forwardRef(({className:a,...c},d)=>(0,b.jsx)("caption",{ref:d,className:(0,Z.f)("mt-4 text-sm text-muted-foreground",a),...c}))).displayName="TableCaption";var ah=a.i(781560);let ai=(0,m.f)("ban",[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var aj=a.i(816201),ak=a.i(291938),al=a.i(710302),am=a.i(630534),an=a.i(960927);function ao(){let{timeZone:a}=(0,e.M)(),{data:f}=(0,d.useSession)(),{t:g}=(0,c.b)(),[h,i]=(0,r.useState)([]),[j,k]=(0,r.useState)(!0),[l,m]=(0,r.useState)(!1),[n,o]=(0,r.useState)(!1),[p,q]=(0,r.useState)("0"),[s,t]=(0,r.useState)(!1),u=(0,r.useCallback)(async()=>{k(!0);try{let a=await ak.f.get("/api/admin/users");i(a)}catch(a){am.f.error("[UserManagement]","Failed to fetch users",{error:a})}finally{k(!1)}},[]),v=(0,r.useCallback)(async()=>{try{let a=await ak.f.get("/api/settings");m(!0===a.allowRegistration),q(String(a.aiDailyLimit??0))}catch(a){am.f.error("[UserManagement]","Failed to fetch config",{error:a})}},[]);(0,r.useEffect)(()=>{u(),v()},[u,v]);let x=async a=>{o(!0);try{await ak.f.post("/api/settings",{allowRegistration:a}),m(a)}catch(a){am.f.error("[UserManagement]","Failed to update registration setting",{error:a}),al.c.error(g.common.error)}finally{o(!1)}},y=Number(p),z=""!==p.trim()&&Number.isInteger(y)&&y>=0,B=async()=>{if(z){t(!0);try{await ak.f.post("/api/settings",{aiDailyLimit:y}),al.c.success(g.admin.aiDailyLimitSaved)}catch(a){am.f.error("[UserManagement]","Failed to update AI daily limit",{error:a}),al.c.error(g.common.error)}finally{t(!1)}}},C=async a=>{let b=a.isActive?g.admin.confirmDisable:g.admin.confirmEnable;if(await (0,al.u)(b))try{await ak.f.patch(`/api/admin/users/${a.id}`,{isActive:!a.isActive}),u()}catch(a){am.f.error("[UserManagement]","Failed to update user status",{error:a}),al.c.error(g.common.error)}},F=async a=>{if(await (0,al.u)(g.admin.confirmDelete,{destructive:!0}))try{await ak.f.delete(`/api/admin/users/${a.id}`),u()}catch(b){am.f.error("[UserManagement]","Failed to delete user",{error:b});let a=(0,an.d)(b)||g.common.error;al.c.error(a)}};return j?(0,b.jsx)("div",{className:"flex justify-center py-8",children:(0,b.jsx)(w.f,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between p-4 border rounded-lg bg-muted/30",children:[(0,b.jsxs)("div",{className:"space-y-0.5",children:[(0,b.jsx)(aa.f,{className:"text-base",children:g.admin?.allowRegistration||"Allow New Registrations"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:g.admin?.allowRegistrationDesc||"When disabled, new users cannot register"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[n&&(0,b.jsx)(w.f,{className:"h-4 w-4 animate-spin"}),(0,b.jsx)($,{checked:l,onCheckedChange:x,disabled:n})]})]}),(0,b.jsxs)("div",{className:"flex flex-col gap-3 p-4 border rounded-lg bg-muted/30 sm:flex-row sm:items-center sm:justify-between",children:[(0,b.jsxs)("div",{className:"space-y-0.5",children:[(0,b.jsx)(aa.f,{htmlFor:"ai-daily-limit",className:"text-base",children:g.admin.aiDailyLimit}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:g.admin.aiDailyLimitDesc})]}),(0,b.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,b.jsx)(_.f,{id:"ai-daily-limit",type:"number",min:0,step:1,inputMode:"numeric",value:p,onChange:a=>q(a.target.value),"aria-invalid":!z,className:"w-24"}),(0,b.jsxs)(A.f,{size:"sm",onClick:B,disabled:s||!z,children:[s&&(0,b.jsx)(w.f,{className:"mr-2 h-4 w-4 animate-spin"}),g.common.save]})]})]}),(0,b.jsx)("div",{className:"sm:hidden space-y-3",children:h.map(c=>(0,b.jsxs)("div",{className:"border rounded-lg p-4 bg-card space-y-3",children:[(0,b.jsxs)("div",{className:"flex justify-between items-start",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"font-medium",children:c.name||"N/A"}),(0,b.jsx)("div",{className:"text-sm text-muted-foreground",children:c.email})]}),(0,b.jsx)(E.f,{variant:"admin"===c.role?"default":"secondary",children:"admin"===c.role?g.admin.admin:g.admin.user})]}),(0,b.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,b.jsxs)("div",{className:"text-muted-foreground",children:[g.admin.errors,": ",c._count.errorItems," | ",g.admin.practiceCount,": ",c._count.practiceRecords," | ",g.admin.aiUsageToday,": ",c.aiUsageToday]}),(0,b.jsx)(E.f,{variant:c.isActive?"default":"destructive",className:"text-xs",children:c.isActive?g.admin.active:g.admin.disabled})]}),(0,b.jsxs)("div",{className:"flex justify-between items-center pt-2 border-t",children:[(0,b.jsx)("div",{className:"text-xs text-muted-foreground",children:(0,D.r)(c.createdAt,"yyyy-MM-dd",a)}),(0,b.jsxs)("div",{className:"flex gap-2",children:[(0,b.jsx)(A.f,{variant:"ghost",size:"sm",onClick:()=>C(c),disabled:c.id===f?.user?.id,children:c.isActive?(0,b.jsx)(ai,{className:"h-4 w-4 text-orange-500"}):(0,b.jsx)(aj.f,{className:"h-4 w-4 text-green-500"})}),(0,b.jsx)(A.f,{variant:"ghost",size:"sm",onClick:()=>F(c),disabled:c.id===f?.user?.id,children:(0,b.jsx)(ah.f,{className:"h-4 w-4 text-destructive"})})]})]})]},c.id))}),(0,b.jsx)("div",{className:"hidden sm:block border rounded-lg overflow-hidden",children:(0,b.jsxs)(ab,{children:[(0,b.jsx)(ac,{children:(0,b.jsxs)(ae,{children:[(0,b.jsx)(af,{children:g.admin.nameEmail}),(0,b.jsx)(af,{children:g.admin.role}),(0,b.jsx)(af,{children:g.admin.stats}),(0,b.jsx)(af,{children:g.admin.createdAt}),(0,b.jsx)(af,{children:g.admin.status}),(0,b.jsx)(af,{className:"text-right",children:g.admin.actions})]})}),(0,b.jsx)(ad,{children:h.map(c=>(0,b.jsxs)(ae,{children:[(0,b.jsxs)(ag,{children:[(0,b.jsx)("div",{className:"font-medium",children:c.name||"N/A"}),(0,b.jsx)("div",{className:"text-sm text-muted-foreground",children:c.email})]}),(0,b.jsx)(ag,{children:(0,b.jsx)(E.f,{variant:"admin"===c.role?"default":"secondary",children:"admin"===c.role?g.admin.admin:g.admin.user})}),(0,b.jsxs)(ag,{children:[(0,b.jsxs)("div",{className:"text-sm",children:[g.admin.errors,": ",c._count.errorItems]}),(0,b.jsxs)("div",{className:"text-sm",children:[g.admin.practiceCount,": ",c._count.practiceRecords]}),(0,b.jsxs)("div",{className:"text-sm",children:[g.admin.aiUsageToday,": ",c.aiUsageToday]})]}),(0,b.jsx)(ag,{children:(0,D.r)(c.createdAt,"yyyy-MM-dd",a)}),(0,b.jsx)(ag,{children:(0,b.jsx)(E.f,{variant:c.isActive?"default":"destructive",children:c.isActive?g.admin.active:g.admin.disabled})}),(0,b.jsxs)(ag,{className:"text-right space-x-2",children:[(0,b.jsx)(A.f,{variant:"ghost",size:"sm",onClick:()=>C(c),disabled:c.id===f?.user?.id,title:c.isActive?g.admin.disable:g.admin.enable,children:c.isActive?(0,b.jsx)(ai,{className:"h-4 w-4 text-orange-500"}):(0,b.jsx)(aj.f,{className:"h-4 w-4 text-green-500"})}),(0,b.jsx)(A.f,{variant:"ghost",size:"sm",onClick:()=>F(c),disabled:c.id===f?.user?.id,title:g.admin.delete,children:(0,b.jsx)(ah.f,{className:"h-4 w-4 text-destructive"})})]})]},c.id))})]})})]})}let ap=(0,m.f)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]),aq=(0,m.f)("github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]),ar=(0,m.f)("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),as=(0,m.f)("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);function at(){return null}let au=()=>()=>void 0;function av(){let{t:a}=(0,c.b)(),d=(0,r.useSyncExternalStore)(au,at,()=>null);return d?d.isStandalone?.()?(0,b.jsx)("p",{className:"text-center text-sm text-muted-foreground",children:a.settings?.about?.androidStandalone||"Running on this device. Data is stored only on this device."}):(0,b.jsxs)("div",{className:"flex flex-col items-center gap-2 text-sm text-muted-foreground",children:[(0,b.jsxs)("span",{className:"break-all",children:[a.settings?.about?.androidServer||"Server",": ",d.getServerUrl()]}),(0,b.jsxs)(A.f,{variant:"outline",className:"gap-2",onClick:()=>d.changeServer(),children:[(0,b.jsx)(as,{className:"h-4 w-4"}),a.settings?.about?.changeServer||"Change server"]})]}):null}let aw="https://github.com/margrop/wrong-notebook";function ax(){let{t:a}=(0,c.b)(),[d,e]=(0,r.useState)("");(0,r.useEffect)(()=>{fetch("/api/version").then(a=>a.json()).then(a=>e(a.version)).catch(()=>{})},[]);let f=[{href:aw,icon:aq,label:a.settings?.about?.github||"GitHub Repository"},{href:`${aw}/releases`,icon:ar,label:a.settings?.about?.releaseNotes||"Release Notes"},{href:`${aw}/issues`,icon:x,label:a.settings?.about?.feedback||"Feedback"}];return(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center space-y-6 py-8 text-center bg-muted/30 rounded-lg border",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("h3",{className:"text-2xl font-bold",children:a.app?.title||"Smart Error Notebook"}),(0,b.jsx)("p",{className:"text-muted-foreground",children:a.settings?.about?.desc||"AI-powered learning assistant"})]}),(0,b.jsxs)("div",{className:"flex items-center space-x-2 text-sm text-muted-foreground border px-4 py-2 rounded-full bg-background",children:[(0,b.jsx)(u,{className:"h-4 w-4"}),(0,b.jsxs)("span",{children:[a.settings?.about?.version||"Version",": v",d||"unknown"]})]}),(0,b.jsx)(av,{}),(0,b.jsx)("div",{className:"flex flex-col sm:flex-row flex-wrap justify-center gap-4 w-full sm:w-auto px-4 sm:px-0",children:f.map(({href:a,icon:c,label:d})=>(0,b.jsx)(A.f,{variant:"outline",asChild:!0,className:"gap-2 w-full sm:w-auto",children:(0,b.jsxs)("a",{href:a,target:"_blank",rel:"noopener noreferrer",children:[(0,b.jsx)(c,{className:"h-4 w-4"}),d,(0,b.jsx)(ap,{className:"h-3 w-3 ml-1 opacity-50"})]})},a))}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mt-8",children:a.settings?.about?.copyright||"© 2026 margrop · Based on wttwins/wrong-notebook · MIT License"})]})}var ay=a.i(177156),az=a.i(141379);function aA({className:a,...d}){let{t:e}=(0,c.b)(),[f,g]=(0,r.useState)(!1);return(0,b.jsxs)("div",{className:"relative",children:[(0,b.jsx)(_.f,{type:f?"text":"password",className:(0,Z.f)("pr-10",a),...d}),(0,b.jsx)(A.f,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>g(!f),"aria-label":f?e.common.hidePassword:e.common.showPassword,tabIndex:-1,children:f?(0,b.jsx)(az.f,{className:"h-4 w-4 text-muted-foreground"}):(0,b.jsx)(ay.f,{className:"h-4 w-4 text-muted-foreground"})})]})}var aB=a.i(580701);let aC={name:"",email:"",educationStage:"",enrollmentYear:"",password:""};function aD(){let{t:a}=(0,c.b)(),[d,e]=(0,r.useState)(aC),[f,g]=(0,r.useState)(""),[h,i]=(0,r.useState)(!0),[j,k]=(0,r.useState)(!1),l=(0,r.useCallback)(async()=>{try{let a=await ak.f.get("/api/user");e({name:a.name||"",email:a.email||"",educationStage:a.educationStage||"",enrollmentYear:a.enrollmentYear||"",password:""})}catch(a){am.f.error("[AccountSettings]","Failed to fetch profile",{error:a})}finally{i(!1)}},[]);(0,r.useEffect)(()=>{l()},[l]);let m=async()=>{if(d.password&&d.password!==f)return void al.c.error(a.settings?.messages?.passwordMismatch||"Passwords do not match");k(!0);try{let b={name:d.name,email:d.email,educationStage:d.educationStage};d.enrollmentYear&&(b.enrollmentYear=parseInt(d.enrollmentYear.toString())),d.password&&(b.password=d.password),await ak.f.patch("/api/user",b),al.c.success(a.settings?.messages?.profileUpdated||"Profile updated"),e(a=>({...a,password:""})),g(""),window.location.reload()}catch(b){am.f.error("[AccountSettings]","Failed to update profile",{error:(0,an.d)(b)??(0,an.Z)(b)}),al.c.error((0,an.d)(b)||a.settings?.messages?.updateFailed||"Update failed")}finally{k(!1)}};return h?(0,b.jsx)("div",{className:"flex justify-center py-8",children:(0,b.jsx)(w.f,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,b.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:a.auth?.name||"Name"}),(0,b.jsx)(_.f,{value:d.name||"",onChange:a=>e({...d,name:a.target.value})})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:a.auth?.email||"Email"}),(0,b.jsx)(_.f,{value:d.email||"",onChange:a=>e({...d,email:a.target.value}),type:"email"})]})]}),(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:a.auth?.educationStage||"Education Stage"}),(0,b.jsxs)(aB.d,{value:d.educationStage||"",onValueChange:a=>e({...d,educationStage:a}),children:[(0,b.jsx)(aB.P,{children:(0,b.jsx)(aB.U,{placeholder:a.auth?.selectStage||"Select Stage"})}),(0,b.jsxs)(aB.r,{children:[(0,b.jsx)(aB.T,{value:"primary",children:a.auth?.primary||"Primary School"}),(0,b.jsx)(aB.T,{value:"junior_high",children:a.auth?.juniorHigh||"Junior High"}),(0,b.jsx)(aB.T,{value:"senior_high",children:a.auth?.seniorHigh||"Senior High"}),(0,b.jsx)(aB.T,{value:"university",children:a.auth?.university||"University"})]})]})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:a.auth?.enrollmentYear||"Enrollment Year"}),(0,b.jsx)(_.f,{type:"number",value:d.enrollmentYear||"",onChange:a=>e({...d,enrollmentYear:a.target.value}),placeholder:"YYYY"})]})]}),(0,b.jsxs)("div",{className:"space-y-3 pt-2 border-t",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:a.settings?.account?.changePassword||"Change Password (Leave empty to keep)"}),(0,b.jsx)(aA,{value:d.password,onChange:a=>e({...d,password:a.target.value}),placeholder:"******",minLength:6})]}),d.password&&(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:a.auth?.confirmPassword||"Confirm Password"}),(0,b.jsx)(aA,{value:f,onChange:a=>g(a.target.value),placeholder:"******",minLength:6})]})]}),(0,b.jsxs)(A.f,{onClick:m,disabled:j,className:"w-full",children:[j&&(0,b.jsx)(w.f,{className:"mr-2 h-4 w-4 animate-spin"}),a.settings?.account?.update||"Update Profile"]})]})}let aE=(0,m.f)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);var aF=a.i(862722);let aG=(0,m.f)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),aH={minimax:{name:"MiniMax",baseUrl:"https://api.minimax.cn/v1",model:"MiniMax-M3.1-Flash",envPrefix:"MINIMAX",consoleUrl:"https://platform.minimax.cn"},glm:{name:"智谱 GLM",baseUrl:"https://open.bigmodel.cn/api/paas/v4",model:"glm-5.3-flash",envPrefix:"GLM",consoleUrl:"https://open.bigmodel.cn"},deepseek:{name:"DeepSeek",baseUrl:"https://api.deepseek.com",model:"deepseek-flash",envPrefix:"DEEPSEEK",consoleUrl:"https://platform.deepseek.com"},kimi:{name:"Kimi",baseUrl:"https://api.moonshot.cn/v1",model:"kimi-k3",envPrefix:"KIMI",consoleUrl:"https://platform.kimi.com"}},aI=Object.keys(aH);function aJ(a){return"string"==typeof a&&Object.prototype.hasOwnProperty.call(aH,a)}function aK({config:a,saving:d,saveButton:e}){let{t:f,language:g}=(0,c.b)(),[h,i]=(0,r.useState)(!1),[j,k]=(0,r.useState)(null),l=a=>f.settings?.ai?.errors?.[a]||a.replace("UNKNOWN:",""),m=async()=>{let b=function(a,b){let c=a.aiProvider;if("openai"===c){let d=a.openai?.instances?.find(b=>b.id===a.openai?.activeInstanceId);return d?.apiKey?{ok:!0,body:{provider:c,apiKey:d.apiKey,baseUrl:d.baseUrl,model:d.model,language:b}}:{ok:!1,error:"API_KEY_REQUIRED"}}if("azure"===c){let d=a.azure;return d?.apiKey&&d.endpoint&&d.deploymentName?{ok:!0,body:{provider:c,apiKey:d.apiKey,endpoint:d.endpoint,deploymentName:d.deploymentName,apiVersion:d.apiVersion,model:d.model,language:b}}:{ok:!1,error:"AZURE_CONFIG_INCOMPLETE"}}if("gemini"===c||"anthropic"===c||aJ(c)){let d=a[c];return d?.apiKey?{ok:!0,body:{provider:c,apiKey:d.apiKey,baseUrl:d.baseUrl,model:d.model,language:b}}:{ok:!1,error:"API_KEY_REQUIRED"}}return{ok:!1,error:"UNSUPPORTED_PROVIDER"}}(a,g);if(!b.ok){if("UNSUPPORTED_PROVIDER"===b.error)return;k({success:!1,textSupport:!1,visionSupport:!1,textError:"AZURE_CONFIG_INCOMPLETE"===b.error?f.settings?.ai?.validationAzureEndpointRequired||"Azure config is incomplete":f.settings?.ai?.validationApiKeyRequired||"API Key is required"});return}i(!0),k(null);try{k(await ak.f.post("/api/ai/test",b.body))}catch(a){am.f.error("[AiConnectionTest]","AI connection test failed",{error:a}),k({success:!1,textSupport:!1,visionSupport:!1,textError:(0,an.Z)(a)})}finally{i(!1)}};return(0,b.jsxs)("div",{className:"space-y-3 pt-3 border-t",children:[(0,b.jsxs)("div",{className:"flex gap-2",children:[(0,b.jsxs)(A.f,{type:"button",variant:"outline",onClick:m,disabled:h||d,className:"flex-1",children:[h?(0,b.jsx)(w.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,b.jsx)(aG,{className:"mr-2 h-4 w-4"}),h?f.settings?.ai?.testing||"Testing...":f.settings?.ai?.testConnection||"Test Connection"]}),e]}),j&&(0,b.jsxs)("div",{className:`p-3 rounded-md text-sm ${j.success?"bg-green-50 border border-green-200":"bg-red-50 border border-red-200"}`,children:[(0,b.jsx)("div",{className:"flex items-center gap-2 font-medium mb-2",children:j.success?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(aE,{className:"h-4 w-4 text-green-600"}),(0,b.jsx)("span",{className:"text-green-700",children:f.settings?.ai?.testSuccess||"Connection Successful"}),j.modelInfo&&(0,b.jsxs)("span",{className:"text-green-600 text-xs",children:["(",j.modelInfo,")"]})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(aF.f,{className:"h-4 w-4 text-red-600"}),(0,b.jsx)("span",{className:"text-red-700",children:f.settings?.ai?.testFailed||"Connection Failed"})]})}),j.success&&(0,b.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsxs)("span",{className:"text-muted-foreground",children:[f.settings?.ai?.textSupport||"Text Generation",":"]}),(0,b.jsxs)("span",{className:"text-green-600",children:["✓ ",f.settings?.ai?.supported||"Supported"]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsxs)("span",{className:"text-muted-foreground",children:[f.settings?.ai?.visionSupport||"Vision/Multimodal",":"]}),j.visionSupport?(0,b.jsxs)("span",{className:"text-green-600",children:["✓ ",f.settings?.ai?.supported||"Supported"]}):(0,b.jsxs)("span",{className:"text-amber-600",children:["✗ ",j.visionError?l(j.visionError):f.settings?.ai?.notSupported||"Not Supported"]})]}),(0,b.jsx)("p",{className:"text-muted-foreground/60 text-[10px] pl-1",children:f.settings?.ai?.testNetworkNote})]}),!j.success&&j.textError&&(0,b.jsx)("p",{className:"text-red-600 text-xs mt-1",children:l(j.textError)})]})]})}var aL=a.i(669520);function aM({provider:a,apiKey:d,baseUrl:e,currentModel:f,onModelChange:g}){let{t:h}=(0,c.b)(),[i,j]=(0,r.useState)([]),[k,l]=(0,r.useState)(!1),[m,n]=(0,r.useState)(null),[o,p]=(0,r.useState)(f||""),[q,s]=(0,r.useState)(!1),[t,u]=(0,r.useState)(f);f!==t&&(u(f),p(f||""));let v=async()=>{if(!d)return void n(h.modelSelector?.enterApiKeyFirst||"Please enter API Key first");l(!0),n(null);try{let b=await ak.f.post("/api/ai/models",{provider:a,apiKey:d,...e&&{baseUrl:e}});if("error"in b&&"string"==typeof b.error){n(b.error),s(!0),j([]);return}j(b.models),0===b.models.length&&(n(h.modelSelector?.noVisionModel||"No vision model found, please enter manually"),s(!0))}catch(b){am.f.error("[ModelSelector]","Failed to fetch models",{error:b});let a=b instanceof Error&&b.message||h.modelSelector?.fetchFailed||"Failed to fetch models";n(a+(h.modelSelector?.enterManually||", please enter manually")),s(!0)}finally{l(!1)}};return(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(aa.f,{className:"flex-1",children:h.modelSelector?.modelName||"Model Name"}),(0,b.jsx)(A.f,{type:"button",variant:"outline",size:"sm",onClick:v,disabled:k||!d,children:k?(0,b.jsx)(w.f,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(aL.f,{className:"h-3 w-3"})})]}),m&&(0,b.jsx)("p",{className:"text-xs text-yellow-600",children:m}),q||0===i.length?(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(_.f,{value:o,onChange:a=>{var b;p(b=a.target.value),g(b)},placeholder:aJ(a)?aH[a].model:"openai"===a?"gpt-6.1-sol":"gemini-1.5-flash"}),i.length>0&&(0,b.jsx)(A.f,{type:"button",variant:"link",size:"sm",className:"h-auto p-0 text-xs",onClick:()=>s(!1),children:h.modelSelector?.selectFromList||"Select from List"})]}):(0,b.jsx)("div",{className:"space-y-2",children:(0,b.jsxs)(aB.d,{value:f,onValueChange:a=>{"_custom"===a?s(!0):(s(!1),p(a),g(a))},children:[(0,b.jsx)(aB.P,{children:(0,b.jsx)(aB.U,{placeholder:h.modelSelector?.selectModel||"Select Model"})}),(0,b.jsxs)(aB.r,{children:[i.map(a=>(0,b.jsxs)(aB.T,{value:a.id,children:[a.name,a.owned_by&&` (${a.owned_by})`]},a.id)),(0,b.jsx)(aB.T,{value:"_custom",children:h.modelSelector?.customInput||"Custom Input..."})]})]})})]})}function aN({value:a,onChange:d}){let{t:e}=(0,c.b)(),f=(b,c)=>d({...a,[b]:c});return(0,b.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:"API Key"}),(0,b.jsx)(aA,{value:a?.apiKey||"",onChange:a=>f("apiKey",a.target.value),placeholder:"sk-ant-..."})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:"Base URL (Optional)"}),(0,b.jsx)(_.f,{value:a?.baseUrl||"",onChange:a=>f("baseUrl",a.target.value),placeholder:"https://api.anthropic.com"}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:e.settings?.ai?.anthropicBaseUrlHint})]}),(0,b.jsx)(aM,{provider:"anthropic",apiKey:a?.apiKey,baseUrl:a?.baseUrl,currentModel:a?.model,onModelChange:a=>f("model",a)})]})}function aO({value:a,onChange:d}){let{t:e}=(0,c.b)(),f=(b,c)=>d({...a,[b]:c}),g=a=>a?.trim()?"":"border-destructive";return(0,b.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsxs)(aa.f,{children:[e.settings?.ai?.azureEndpoint||"Azure Endpoint"," ",(0,b.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,b.jsx)(_.f,{value:a?.endpoint||"",onChange:a=>f("endpoint",a.target.value),placeholder:e.settings?.ai?.azureEndpointPlaceholder||"https://your-resource.openai.azure.com",className:g(a?.endpoint)})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsxs)(aa.f,{children:[e.settings?.ai?.azureDeployment||"Deployment Name"," ",(0,b.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,b.jsx)(_.f,{value:a?.deploymentName||"",onChange:a=>f("deploymentName",a.target.value),placeholder:e.settings?.ai?.azureDeploymentPlaceholder||"gpt-4o-deployment",className:g(a?.deploymentName)})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsxs)(aa.f,{children:["API Key ",(0,b.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,b.jsx)(aA,{value:a?.apiKey||"",onChange:a=>f("apiKey",a.target.value),placeholder:"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",className:g(a?.apiKey)})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:e.settings?.ai?.azureApiVersion||"API Version"}),(0,b.jsx)(_.f,{value:a?.apiVersion||"",onChange:a=>f("apiVersion",a.target.value),placeholder:e.settings?.ai?.azureApiVersionPlaceholder||"2024-02-15-preview"})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:e.settings?.ai?.azureModel||"Model Display Name"}),(0,b.jsx)(_.f,{value:a?.model||"",onChange:a=>f("model",a.target.value),placeholder:"gpt-4o"})]})]})}function aP({value:a,onChange:c}){let d=(b,d)=>c({...a,[b]:d});return(0,b.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:"API Key"}),(0,b.jsx)(aA,{value:a?.apiKey||"",onChange:a=>d("apiKey",a.target.value),placeholder:"AIza..."})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:"Base URL (Optional)"}),(0,b.jsx)(_.f,{value:a?.baseUrl||"",onChange:a=>d("baseUrl",a.target.value),placeholder:"https://generativelanguage.googleapis.com"})]}),(0,b.jsx)(aM,{provider:"gemini",apiKey:a?.apiKey,baseUrl:a?.baseUrl,currentModel:a?.model,onModelChange:a=>d("model",a)})]})}var aQ=a.i(915618);function aR({value:a,onChange:d}){let{t:e}=(0,c.b)(),f=a?.instances||[],g=a?.activeInstanceId,h=f.find(a=>a.id===g),i=(b,c)=>{d({...a,instances:f.map(a=>a.id===g?{...a,[b]:c}:a)})},j=async()=>{if(!g||!await (0,al.u)(e.settings?.ai?.confirmDelete||"Delete this instance?",{destructive:!0}))return;let a=f.filter(a=>a.id!==g);d({instances:a,activeInstanceId:a[0]?.id})};return(0,b.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)(aa.f,{children:e.settings?.ai?.instances||"Instance"}),(0,b.jsxs)(A.f,{type:"button",variant:"outline",size:"sm",onClick:()=>{if(f.length>=10)return;let a={id:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{let b=16*Math.random()|0;return("x"===a?b:3&b|8).toString(16)}),name:`Instance ${f.length+1}`,apiKey:"",baseUrl:"https://api.openai.com/v1",model:"gpt-6.1-sol"};d({instances:[...f,a],activeInstanceId:a.id})},disabled:f.length>=10,className:"h-7 px-2 text-xs",children:[(0,b.jsx)(aQ.f,{className:"h-3 w-3 mr-1"}),e.settings?.ai?.addInstance||"Add"]})]}),f.length>0?(0,b.jsxs)("div",{className:"flex gap-2",children:[(0,b.jsxs)(aB.d,{value:g||"",onValueChange:b=>d({...a,activeInstanceId:b}),children:[(0,b.jsx)(aB.P,{className:"flex-1",children:(0,b.jsx)(aB.U,{placeholder:e.settings?.ai?.selectInstance||"Select Instance"})}),(0,b.jsx)(aB.r,{children:f.map(a=>(0,b.jsx)(aB.T,{value:a.id,children:a.name},a.id))})]}),f.length>1&&(0,b.jsx)(A.f,{type:"button",variant:"outline",size:"icon",onClick:j,className:"h-10 w-10 text-destructive hover:text-destructive",children:(0,b.jsx)(ah.f,{className:"h-4 w-4"})})]}):(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:e.settings?.ai?.noInstances||"No instances configured. Click 'Add' to create one."}),f.length>=10&&(0,b.jsx)("p",{className:"text-xs text-amber-600",children:e.settings?.ai?.maxInstancesReached||"Maximum instances reached (10)"})]}),h&&(0,b.jsxs)("div",{className:"space-y-3 p-3 border rounded-md bg-background",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsxs)(aa.f,{children:[e.settings?.ai?.instanceName||"Instance Name"," ",(0,b.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,b.jsx)(_.f,{value:h.name||"",onChange:a=>i("name",a.target.value),placeholder:"e.g. 智谱 GLM-4V",className:h.name?.trim()?"":"border-destructive"})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsxs)(aa.f,{children:["API Key ",(0,b.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,b.jsx)(aA,{value:h.apiKey||"",onChange:a=>i("apiKey",a.target.value),placeholder:"sk-...",className:h.apiKey?.trim()?"":"border-destructive"})]}),(0,b.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,b.jsxs)(aa.f,{children:["Base URL ",(0,b.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,b.jsx)(_.f,{value:h.baseUrl||"",onChange:a=>i("baseUrl",a.target.value),placeholder:"https://api.openai.com/v1",className:h.baseUrl?.trim()?"":"border-destructive"})]}),(0,b.jsx)(aM,{provider:"openai",apiKey:h.apiKey,baseUrl:h.baseUrl,currentModel:h.model,onModelChange:a=>i("model",a)})]})]})}function aS({provider:a,value:d,onChange:e}){let{t:f}=(0,c.b)(),g=aH[a],h=(a,b)=>e({...d,[a]:b});return(0,b.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:"API Key"}),(0,b.jsx)(aA,{value:d?.apiKey||"",onChange:a=>h("apiKey",a.target.value),placeholder:"sk-..."}),(0,b.jsxs)("p",{className:"text-xs text-muted-foreground",children:[f.settings?.ai?.vendorApiKeyHint||"Get an API key from the console:"," ",(0,b.jsx)("a",{href:g.consoleUrl,target:"_blank",rel:"noopener noreferrer",className:"underline break-all",children:g.consoleUrl})]})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:"Base URL (Optional)"}),(0,b.jsx)(_.f,{value:d?.baseUrl||"",onChange:a=>h("baseUrl",a.target.value),placeholder:g.baseUrl}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:f.settings?.ai?.vendorBaseUrlHint})]}),(0,b.jsx)(aM,{provider:a,apiKey:d?.apiKey,baseUrl:d?.baseUrl,currentModel:d?.model||g.model,onModelChange:a=>h("model",a)})]})}function aT({config:a,setConfig:d,loading:e,saving:f,onSave:g}){let{t:h}=(0,c.b)();return e?(0,b.jsx)("div",{className:"flex justify-center py-4",children:(0,b.jsx)(w.f,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):(0,b.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:h.settings?.tabs?.ai||"AI Provider"}),(0,b.jsxs)(aB.d,{value:a.aiProvider,onValueChange:a=>d(b=>({...b,aiProvider:a})),children:[(0,b.jsx)(aB.P,{children:(0,b.jsx)(aB.U,{})}),(0,b.jsxs)(aB.r,{children:[aI.map(a=>(0,b.jsx)(aB.T,{value:a,children:aH[a].name},a)),(0,b.jsx)(aB.T,{value:"anthropic",children:"Anthropic / Compatible"}),(0,b.jsx)(aB.T,{value:"azure",children:"Azure OpenAI"}),(0,b.jsx)(aB.T,{value:"openai",children:"OpenAI / Compatible"}),(0,b.jsx)(aB.T,{value:"gemini",children:"Google Gemini"})]})]})]}),"openai"===a.aiProvider&&(0,b.jsx)(aR,{value:a.openai,onChange:a=>d(b=>({...b,openai:a}))}),"gemini"===a.aiProvider&&(0,b.jsx)(aP,{value:a.gemini,onChange:a=>d(b=>({...b,gemini:a}))}),"anthropic"===a.aiProvider&&(0,b.jsx)(aN,{value:a.anthropic,onChange:a=>d(b=>({...b,anthropic:a}))}),aJ(a.aiProvider)&&(0,b.jsx)(aS,{provider:a.aiProvider,value:a[a.aiProvider],onChange:a=>d(b=>({...b,[b.aiProvider]:a}))},a.aiProvider),"azure"===a.aiProvider&&(0,b.jsx)(aO,{value:a.azure,onChange:a=>d(b=>({...b,azure:a}))}),(0,b.jsx)(aK,{config:a,saving:f,saveButton:(0,b.jsxs)(A.f,{onClick:g,disabled:f,className:"flex-1",children:[f&&(0,b.jsx)(w.f,{className:"mr-2 h-4 w-4 animate-spin"}),h.settings?.ai?.save||"Save AI Settings"]})})]})}let aU={info:{card:"border-blue-200 bg-blue-50",title:"text-blue-900 font-bold",desc:"text-blue-800 font-medium",button:"bg-blue-100 hover:bg-blue-200 text-blue-900 border-blue-300"},danger:{card:"border-red-200 bg-red-50",title:"text-red-700 font-medium",desc:"text-red-600",button:""},critical:{card:"border-red-600/50 bg-red-100/50",title:"text-red-900 font-bold",desc:"text-red-800 font-medium",button:"bg-red-700 hover:bg-red-800"}};function aV({title:a,description:c,tone:d,busy:e,icon:f,onClick:g}){let h=aU[d];return(0,b.jsxs)("div",{className:`p-4 border rounded-lg ${h.card}`,children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)("span",{className:`text-sm flex items-center gap-2 ${h.title}`,children:a}),(0,b.jsx)(A.f,{variant:"info"===d?"outline":"destructive",size:"sm",onClick:g,disabled:e,className:h.button,children:e?(0,b.jsx)(w.f,{className:"h-4 w-4 animate-spin"}):f})]}),(0,b.jsx)("p",{className:`text-xs mt-2 ${h.desc}`,children:c})]})}function aW({isAdmin:a}){let{t:d}=(0,c.b)(),[e,f]=(0,r.useState)(null),g=async(a,b,c,d)=>{f(a);try{al.c.success(await b()),d&&window.location.reload()}catch(b){am.f.error("[DangerZoneSettings]",`${a} failed`,{error:b}),al.c.error(c)}finally{f(null)}},h=d.settings?.clearSuccess||"Success",i=d.settings?.clearError||"Failed",j=async()=>{await (0,al.u)(d.settings?.migrateTagsConfirm||"This will reset system tags. Confirm?",{destructive:!0})&&await g("migrateTags",async()=>{let a=await ak.f.post("/api/admin/migrate-tags",{});return`${h}: ${a.count||0} tags migrated.`},d.settings?.clearError||"Failed to migrate tags",!1)},k=async()=>{await (0,al.u)(d.settings?.clearDataConfirm||"Are you sure?",{destructive:!0})&&await g("clearPractice",async()=>(await ak.f.delete("/api/stats/practice/clear"),h),i,!0)},l=async()=>{await (0,al.u)(d.settings?.clearErrorDataConfirm||"Are you sure?",{destructive:!0})&&await g("clearErrors",async()=>(await ak.f.delete("/api/error-items/clear"),h),i,!0)},m=async()=>{if(!await (0,al.u)(d.settings?.systemResetConfirm||"WARNING: Deleting ALL data. Undoing is impossible. Are you sure?",{destructive:!0}))return;let a=prompt(d.settings?.systemResetPrompt||"Type 'RESET' to confirm system initialization:","");if("RESET"!==a){null!==a&&al.c.error(d.common?.error||"Confirmation failed");return}await g("systemReset",async()=>(await ak.f.post("/api/admin/system-reset",{}),d.settings?.clearSuccess||"Success - System Reset Complete"),d.settings?.clearError||"Failed to reset system",!0)};return(0,b.jsxs)(b.Fragment,{children:[a&&(0,b.jsx)(aV,{tone:"info",title:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(aL.f,{className:"h-4 w-4"}),d.settings?.migrateTags||"Migrate Tags"]}),description:d.settings?.migrateTagsDesc||"Re-populates standard tags from file",busy:"migrateTags"===e,icon:(0,b.jsx)(aL.f,{className:"h-4 w-4"}),onClick:j}),(0,b.jsx)(aV,{tone:"danger",title:d.settings?.clearData||"Clear Practice Data",description:d.settings?.clearDataDesc||"This will permanently delete all practice history. Irreversible.",busy:"clearPractice"===e,icon:(0,b.jsx)(ah.f,{className:"h-4 w-4"}),onClick:k}),(0,b.jsx)(aV,{tone:"danger",title:d.settings?.clearErrorData||"Clear Error Data",description:d.settings?.clearErrorDataDesc||"This will permanently delete all error items. Irreversible.",busy:"clearErrors"===e,icon:(0,b.jsx)(ah.f,{className:"h-4 w-4"}),onClick:l}),a&&(0,b.jsx)(aV,{tone:"critical",title:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(s,{className:"h-4 w-4"}),d.settings?.systemReset||"System Initialization"]}),description:d.settings?.systemResetDesc||"Resets the system to factory state. Deletes ALL data.",busy:"systemReset"===e,icon:(0,b.jsx)(ah.f,{className:"h-4 w-4"}),onClick:m})]})}var aX=a.i(284505);let aY=(0,m.f)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);async function aZ(a,b){let c=await fetch(a);if(!c.ok)throw Error((await c.json().catch(()=>({}))).message||"Export failed");let d=await c.blob(),e=window.URL.createObjectURL(d),f=document.createElement("a");f.href=e;let g=c.headers.get("Content-Disposition")?.match(/filename="(.+)"/);f.download=g?g[1]:b,document.body.appendChild(f),f.click(),document.body.removeChild(f),window.URL.revokeObjectURL(e)}function a$({isAdmin:a}){let{t:d}=(0,c.b)(),[e,f]=(0,r.useState)(!1),[g,h]=(0,r.useState)(!1),[i,j]=(0,r.useState)(null),k=async a=>{if(!a||await (0,al.u)(d.settings?.exportAllConfirm||"Export all users' data? This may take a while.")){f(!0);try{await aZ(a?"/api/export?all=true":"/api/export",a?"wrong-notebook-export-all.json":"wrong-notebook-export.json"),al.c.success(d.settings?.exportSuccess||"Export successful")}catch(b){am.f.error("[DataBackupSettings]",a?"Export all failed":"Export failed",{error:b}),al.c.error(d.settings?.exportFailed||"Export failed")}finally{f(!1)}}},l=async a=>{if(!i)return;let b=a?d.settings?.importAllConfirm||"Import all users' data? This will restore data for all users from the export file.":d.settings?.importConfirm||"Are you sure you want to import?";if(await (0,al.u)(b)){h(!0);try{let b=JSON.parse(await i.text()),{stats:c}=await ak.f.post(a?"/api/import?all=true":"/api/import",b);al.c.success((d.settings?.importResultDesc||"Imported {subjects} notebooks, {tags} tags, {items} error items, {schedules} review schedules, {records} practice records, {papers} exam papers.").replace("{subjects}",String(c.subjectsCreated)).replace("{tags}",String(c.tagsCreated)).replace("{items}",String(c.errorItemsCreated)).replace("{schedules}",String(c.reviewSchedulesCreated)).replace("{records}",String(c.practiceRecordsCreated)).replace("{papers}",String(c.examPapersCreated??0)).replace("{duplicates}",String(c.duplicateErrorItems??0))),j(null),window.location.reload()}catch(b){am.f.error("[DataBackupSettings]",a?"Import all failed":"Import failed",{error:b}),al.c.error(d.settings?.importFailed||"Import failed")}finally{h(!1)}}},m=(a,c)=>a?(0,b.jsx)(w.f,{className:"mr-2 h-4 w-4 animate-spin"}):c;return(0,b.jsxs)("div",{className:"p-4 border border-blue-200 rounded-lg bg-blue-50",children:[(0,b.jsx)("h4",{className:"text-sm font-bold text-blue-900 mb-3",children:d.settings?.dataManagement||"Data Management"}),(0,b.jsxs)("div",{className:"mb-4",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,b.jsx)("span",{className:"text-sm text-blue-800 font-medium",children:d.settings?.exportData||"Export Data"}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsxs)(A.f,{variant:"outline",size:"sm",onClick:()=>k(!1),disabled:e,className:"bg-blue-100 hover:bg-blue-200 text-blue-900 border-blue-300",children:[m(e,(0,b.jsx)(aX.f,{className:"mr-2 h-4 w-4"})),d.settings?.exportData||"Export"]}),a&&(0,b.jsxs)(A.f,{variant:"outline",size:"sm",onClick:()=>k(!0),disabled:e,className:"bg-orange-100 hover:bg-orange-200 text-orange-900 border-orange-300",children:[m(e,(0,b.jsx)(aX.f,{className:"mr-2 h-4 w-4"})),d.settings?.exportAllData||"Export All"]})]})]}),(0,b.jsx)("p",{className:"text-xs text-blue-700",children:d.settings?.exportDataDesc||"Export all data as JSON file."})]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,b.jsx)("span",{className:"text-sm text-blue-800 font-medium",children:d.settings?.importData||"Import Data"}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("input",{type:"file",accept:".json",onChange:a=>j(a.target.files?.[0]??i),className:"hidden",id:"import-file-input",disabled:g}),(0,b.jsxs)(A.f,{variant:"outline",size:"sm",onClick:()=>document.getElementById("import-file-input")?.click(),disabled:g,className:"bg-blue-100 hover:bg-blue-200 text-blue-900 border-blue-300",children:[m(g,(0,b.jsx)(aY,{className:"mr-2 h-4 w-4"})),i?.name||d.settings?.selectFile||"Select File"]}),i&&(0,b.jsxs)(A.f,{variant:"outline",size:"sm",onClick:()=>l(!1),disabled:g,className:"bg-green-100 hover:bg-green-200 text-green-900 border-green-300",children:[m(g,(0,b.jsx)(aE,{className:"mr-2 h-4 w-4"})),d.settings?.importData||"Import"]}),i&&a&&(0,b.jsxs)(A.f,{variant:"outline",size:"sm",onClick:()=>l(!0),disabled:g,className:"bg-orange-100 hover:bg-orange-200 text-orange-900 border-orange-300",children:[m(g,(0,b.jsx)(aE,{className:"mr-2 h-4 w-4"})),d.settings?.importAllData||"Import All"]})]})]}),(0,b.jsx)("p",{className:"text-xs text-blue-700",children:d.settings?.importDataDesc||"Import data from JSON file. Existing data will be skipped."})]})]})}var a_=a.i(225949);function a0({field:a,label:d,description:e}){let{t:f}=(0,c.b)(),[g,h]=(0,r.useState)(!1),[i,j]=(0,r.useState)(!1),[k,l]=(0,r.useState)(!1),[m,n]=(0,r.useState)(null),o=`preference-${a}`;(0,r.useEffect)(()=>{ak.f.get("/api/user").then(b=>h(!!b[a])).catch(()=>void 0).finally(()=>j(!0))},[a]);let p=async b=>{h(b),l(!0);try{await ak.f.patch("/api/user",{[a]:b}),n(f.importFlow.preferenceSaved)}catch(c){h(!b),n(f.importFlow.preferenceSaveFailed),am.f.error("[Settings]","Failed to save user preference",{field:a,error:c instanceof Error?c.message:String(c)})}finally{l(!1)}};return(0,b.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,b.jsx)(aa.f,{htmlFor:o,children:d}),(0,b.jsx)($,{id:o,checked:g,onCheckedChange:p,disabled:!i||k})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:e}),m&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:m})]})}function a1(){let{t:a}=(0,c.b)();return(0,b.jsx)(a0,{field:"enableGeogebra",label:a.importFlow.enableGeogebra,description:a.importFlow.enableGeogebraDesc})}function a2(){let{t:a}=(0,c.b)();return(0,b.jsx)(a0,{field:"confirmBeforeImport",label:a.importFlow.confirmBeforeImport,description:a.importFlow.confirmBeforeImportDesc})}function a3(){let{t:a}=(0,c.b)();return(0,b.jsx)(a0,{field:"enableSvgAnimation",label:a.importFlow.enableSvgAnimation,description:a.importFlow.enableSvgAnimationDesc})}function a4({value:a,onChange:d,disabled:e}){let{t:f}=(0,c.b)();return(0,b.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,b.jsx)(aa.f,{htmlFor:"app-time-zone",children:f.settings.general.timeZoneLabel}),(0,b.jsx)(_.f,{id:"app-time-zone",value:a,onChange:a=>d(a.target.value),disabled:e,list:"app-time-zones",placeholder:"Asia/Shanghai"}),(0,b.jsx)("datalist",{id:"app-time-zones",children:["Asia/Shanghai","Asia/Hong_Kong","Asia/Tokyo","Asia/Singapore","Europe/London","America/New_York","America/Los_Angeles","UTC"].map(a=>(0,b.jsx)("option",{value:a},a))}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:f.settings.general.timeZoneDesc})]})}function a5({config:a,setConfig:d,isAdmin:f,disabled:g}){let{t:h,language:i,setLanguage:j}=(0,c.b)(),{timeZone:k}=(0,e.M)(),l=a=>d(b=>({...b,timeouts:{...b.timeouts,analyze:1e3*a}}));return(0,b.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:h.settings?.language||"Language"}),(0,b.jsxs)(aB.d,{value:i,onValueChange:a=>j(a),children:[(0,b.jsx)(aB.P,{children:(0,b.jsx)(aB.U,{})}),(0,b.jsxs)(aB.r,{children:[(0,b.jsx)(aB.T,{value:"zh",children:"中文 (Chinese)"}),(0,b.jsx)(aB.T,{value:"en",children:"English"})]})]})]}),(0,b.jsx)(a4,{value:a.timeZone??k,onChange:a=>d(b=>({...b,timeZone:a})),disabled:!f||g}),f&&(0,b.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,b.jsx)(aa.f,{children:h.settings?.general?.timeoutLabel||"AI Analysis Timeout (Seconds)"}),(0,b.jsx)(_.f,{type:"number",value:a.timeouts?.analyze?a.timeouts.analyze/1e3:"",onChange:a=>{let b=""===a.target.value?0:parseInt(a.target.value);l(isNaN(b)?0:b)},onBlur:()=>{let b=(a.timeouts?.analyze||0)/1e3,c=Math.min(600,Math.max(120,b));c!==b&&l(c)},min:120,max:600}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:h.settings?.general?.timeoutDesc||"Increase this value if you experience frequent timeouts during AI analysis."})]}),(0,b.jsx)(a2,{}),(0,b.jsx)(a3,{}),(0,b.jsx)(a1,{}),(0,b.jsx)(a_.f,{})]})}var a6=a.i(429246);let a7={trace:10,debug:20,info:30,warn:40,error:50,fatal:60};function a8(a,b={}){let c,d=a7[a],e=(c=process.env.LOG_LEVEL?.toLowerCase())&&void 0!==a7[c]?a7[c]:a7.info;return(c,f)=>{let g,h;if(d<e)return;let i=new Date;"string"==typeof c?(g={},h=c):(g=c,h=f||"");{let c=JSON.stringify({level:a,time:i.toISOString(),...b,...g,msg:h});switch(a){case"error":case"fatal":console.error(c);break;case"warn":console.warn(c);break;default:console.log(c)}}}}(function a(b={}){return b.module,{trace:a8("trace",b),debug:a8("debug",b),info:a8("info",b),warn:a8("warn",b),error:a8("error",b),fatal:a8("fatal",b),child:c=>a({...b,...c}),box:(a,c,d="📋")=>{console.log(JSON.stringify({level:"info",time:new Date().toISOString(),...b,title:a,..."string"==typeof c?{content:c}:c||{},msg:a}))},divider:(a="-")=>{}}})({env:"production"}).child({module:"ai:prompts"});let a9=`请参考《高思学校竞赛数学导引》(每讲分兴趣篇、拓展篇、超越篇,题目左侧标 1~5 颗星)的星级标准,结合题目所在年级评定难度:
1
+ module.exports=[418175,a=>{"use strict";var b=a.i(187924),c=a.i(550194),d=a.i(875003),e=a.i(529759),f=a.i(16644),g=a.i(238246),h=a.i(50944),i=a.i(839761),j=a.i(953722),k=a.i(327999),l=a.i(104720),m=a.i(170106);let n=(0,m.f)("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]),o=(0,m.f)("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),p=(0,m.f)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]),q=(0,m.f)("tags",[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]]);var r=a.i(572131);let s=(0,m.f)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),t=(0,m.f)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]),u=(0,m.f)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);var v=a.i(149625),w=a.i(596221);let x=(0,m.f)("message-square-text",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]]),y=(0,m.f)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);var z=a.i(546842),A=a.i(699570),B=a.i(814574),C=a.i(875083),D=a.i(986705),E=a.i(786304),F=a.i(507554),G=a.i(470121),H=a.i(750104),I=a.i(225152),J=a.i(3688),K=a.i(30553),L=Object.defineProperty,M=(a,b)=>L(a,"name",{value:b,configurable:!0}),N="Switch",[O,P]=(0,H.f)(N),[Q,R]=O(N);function S(a){let{__scopeSwitch:c,checked:d,children:e,defaultChecked:f,disabled:g,form:h,name:i,onCheckedChange:j,required:k,value:l="on",internal_do_not_use_render:m}=a,[n,o]=(0,I.f)({prop:d,defaultProp:f??!1,onChange:j,caller:N}),[p,q]=r.useState(null),[s,t]=r.useState(null),[u,v]=r.useState(null),w=!p||!!h||!!p.closest("form"),x={checked:n,setChecked:o,disabled:g,control:p,setControl:q,name:i,form:h,value:l,userClick:u,onUserClick:v,required:k,defaultChecked:f,isFormControl:w,bubbleInput:s,setBubbleInput:t};return(0,b.jsx)(Q,{scope:c,...x,children:X(m)?m(x):e})}M(S,"SwitchProvider");var T=r.forwardRef(M(function({__scopeSwitch:a,onClick:c,...d},e){let{control:f,form:g,value:h,disabled:i,checked:j,required:k,setControl:l,setChecked:m,onUserClick:n,isFormControl:o,bubbleInput:p}=R("SwitchTrigger",a),q=(0,G.f)(e,l),s=r.useRef(j);return r.useEffect(()=>{let a=g?f?.ownerDocument.getElementById(g):f?.form;if(a instanceof HTMLFormElement){let b=M(()=>m(s.current),"reset");return a.addEventListener("reset",b),()=>a.removeEventListener("reset",b)}},[f,g,m]),(0,b.jsx)(K.V.button,{type:"button",role:"switch","aria-checked":j,"aria-required":k,"data-state":Y(j),"data-disabled":i?"":void 0,disabled:i,value:h,...d,ref:q,onClick:(0,F.f)(c,a=>{let b=a.isPropagationStopped();n({requestedChecked:!j,hasConsumerStoppedPropagation:b}),m(a=>!a),p&&o&&!b&&a.stopPropagation()})})},"SwitchTrigger")),U=r.forwardRef(M(function(a,c){let{__scopeSwitch:d,name:e,checked:f,defaultChecked:g,required:h,disabled:i,value:j,onCheckedChange:k,form:l,...m}=a;return(0,b.jsx)(S,{__scopeSwitch:d,checked:f,defaultChecked:g,disabled:i,required:h,onCheckedChange:k,name:e,form:l,value:j,internal_do_not_use_render:({isFormControl:a})=>(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(T,{...m,ref:c,__scopeSwitch:d}),a&&(0,b.jsx)(W,{__scopeSwitch:d})]})})},"Switch")),V=r.forwardRef(M(function(a,c){let{__scopeSwitch:d,...e}=a,f=R("SwitchThumb",d);return(0,b.jsx)(K.V.span,{"data-state":Y(f.checked),"data-disabled":f.disabled?"":void 0,...e,ref:c})},"SwitchThumb")),W=r.forwardRef(M(function({__scopeSwitch:a,onClick:c,...d},e){let{control:f,userClick:g,checked:h,defaultChecked:i,required:j,disabled:k,name:l,value:m,form:n,bubbleInput:o,setBubbleInput:p}=R("SwitchBubbleInput",a),q=(0,G.f)(e,p),s=(0,J.f)(f),t=r.useRef(!1),u=r.useRef(h),v=r.useRef(g),w=r.useRef(null);r.useEffect(()=>{if(!o)return;let a=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(!a)return;let b=u.current!==h;u.current=h;let c=null!==g&&g!==v.current;if(v.current=g,c)w.current=b?null:g,b&&a.call(o,h),o.dispatchEvent(new Event("click",{bubbles:!g.hasConsumerStoppedPropagation}));else if(b){let b=w.current;w.current=null;let c=b?.requestedChecked===h;t.current=!0,a.call(o,h),o.dispatchEvent(new Event("click",{bubbles:!(c&&b.hasConsumerStoppedPropagation)})),t.current=!1}},[o,h,g]);let x=r.useRef(h);return(0,b.jsx)(K.V.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??x.current,required:j,disabled:k,name:l,value:m,form:n,...d,tabIndex:-1,ref:q,onClick:(0,F.f)(c,a=>{t.current&&a.stopPropagation()}),style:{...d.style,...s,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function X(a){return"function"==typeof a}function Y(a){return a?"checked":"unchecked"}M(X,"isFunction"),M(Y,"getState");var Z=a.i(368114);let $=r.forwardRef(({className:a,...c},d)=>(0,b.jsx)(U,{className:(0,Z.f)("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",a),...c,ref:d,children:(0,b.jsx)(V,{className:(0,Z.f)("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));$.displayName=U.displayName;var _=a.i(866718),aa=a.i(870430);let ab=r.forwardRef(({className:a,...c},d)=>(0,b.jsx)("div",{className:"relative w-full overflow-auto",children:(0,b.jsx)("table",{ref:d,className:(0,Z.f)("w-full caption-bottom text-sm",a),...c})}));ab.displayName="Table";let ac=r.forwardRef(({className:a,...c},d)=>(0,b.jsx)("thead",{ref:d,className:(0,Z.f)("[&_tr]:border-b",a),...c}));ac.displayName="TableHeader";let ad=r.forwardRef(({className:a,...c},d)=>(0,b.jsx)("tbody",{ref:d,className:(0,Z.f)("[&_tr:last-child]:border-0",a),...c}));ad.displayName="TableBody",(r.forwardRef(({className:a,...c},d)=>(0,b.jsx)("tfoot",{ref:d,className:(0,Z.f)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",a),...c}))).displayName="TableFooter";let ae=r.forwardRef(({className:a,...c},d)=>(0,b.jsx)("tr",{ref:d,className:(0,Z.f)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",a),...c}));ae.displayName="TableRow";let af=r.forwardRef(({className:a,...c},d)=>(0,b.jsx)("th",{ref:d,className:(0,Z.f)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",a),...c}));af.displayName="TableHead";let ag=r.forwardRef(({className:a,...c},d)=>(0,b.jsx)("td",{ref:d,className:(0,Z.f)("p-4 align-middle [&:has([role=checkbox])]:pr-0",a),...c}));ag.displayName="TableCell",(r.forwardRef(({className:a,...c},d)=>(0,b.jsx)("caption",{ref:d,className:(0,Z.f)("mt-4 text-sm text-muted-foreground",a),...c}))).displayName="TableCaption";var ah=a.i(781560);let ai=(0,m.f)("ban",[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var aj=a.i(816201),ak=a.i(291938),al=a.i(710302),am=a.i(630534),an=a.i(960927);function ao(){let{timeZone:a}=(0,e.M)(),{data:f}=(0,d.useSession)(),{t:g}=(0,c.b)(),[h,i]=(0,r.useState)([]),[j,k]=(0,r.useState)(!0),[l,m]=(0,r.useState)(!1),[n,o]=(0,r.useState)(!1),[p,q]=(0,r.useState)("0"),[s,t]=(0,r.useState)(!1),u=(0,r.useCallback)(async()=>{k(!0);try{let a=await ak.f.get("/api/admin/users");i(a)}catch(a){am.f.error("[UserManagement]","Failed to fetch users",{error:a})}finally{k(!1)}},[]),v=(0,r.useCallback)(async()=>{try{let a=await ak.f.get("/api/settings");m(!0===a.allowRegistration),q(String(a.aiDailyLimit??0))}catch(a){am.f.error("[UserManagement]","Failed to fetch config",{error:a})}},[]);(0,r.useEffect)(()=>{u(),v()},[u,v]);let x=async a=>{o(!0);try{await ak.f.post("/api/settings",{allowRegistration:a}),m(a)}catch(a){am.f.error("[UserManagement]","Failed to update registration setting",{error:a}),al.c.error(g.common.error)}finally{o(!1)}},y=Number(p),z=""!==p.trim()&&Number.isInteger(y)&&y>=0,B=async()=>{if(z){t(!0);try{await ak.f.post("/api/settings",{aiDailyLimit:y}),al.c.success(g.admin.aiDailyLimitSaved)}catch(a){am.f.error("[UserManagement]","Failed to update AI daily limit",{error:a}),al.c.error(g.common.error)}finally{t(!1)}}},C=async a=>{let b=a.isActive?g.admin.confirmDisable:g.admin.confirmEnable;if(await (0,al.u)(b))try{await ak.f.patch(`/api/admin/users/${a.id}`,{isActive:!a.isActive}),u()}catch(a){am.f.error("[UserManagement]","Failed to update user status",{error:a}),al.c.error(g.common.error)}},F=async a=>{if(await (0,al.u)(g.admin.confirmDelete,{destructive:!0}))try{await ak.f.delete(`/api/admin/users/${a.id}`),u()}catch(b){am.f.error("[UserManagement]","Failed to delete user",{error:b});let a=(0,an.d)(b)||g.common.error;al.c.error(a)}};return j?(0,b.jsx)("div",{className:"flex justify-center py-8",children:(0,b.jsx)(w.f,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between p-4 border rounded-lg bg-muted/30",children:[(0,b.jsxs)("div",{className:"space-y-0.5",children:[(0,b.jsx)(aa.f,{className:"text-base",children:g.admin?.allowRegistration||"Allow New Registrations"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:g.admin?.allowRegistrationDesc||"When disabled, new users cannot register"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[n&&(0,b.jsx)(w.f,{className:"h-4 w-4 animate-spin"}),(0,b.jsx)($,{checked:l,onCheckedChange:x,disabled:n})]})]}),(0,b.jsxs)("div",{className:"flex flex-col gap-3 p-4 border rounded-lg bg-muted/30 sm:flex-row sm:items-center sm:justify-between",children:[(0,b.jsxs)("div",{className:"space-y-0.5",children:[(0,b.jsx)(aa.f,{htmlFor:"ai-daily-limit",className:"text-base",children:g.admin.aiDailyLimit}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:g.admin.aiDailyLimitDesc})]}),(0,b.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,b.jsx)(_.f,{id:"ai-daily-limit",type:"number",min:0,step:1,inputMode:"numeric",value:p,onChange:a=>q(a.target.value),"aria-invalid":!z,className:"w-24"}),(0,b.jsxs)(A.f,{size:"sm",onClick:B,disabled:s||!z,children:[s&&(0,b.jsx)(w.f,{className:"mr-2 h-4 w-4 animate-spin"}),g.common.save]})]})]}),(0,b.jsx)("div",{className:"sm:hidden space-y-3",children:h.map(c=>(0,b.jsxs)("div",{className:"border rounded-lg p-4 bg-card space-y-3",children:[(0,b.jsxs)("div",{className:"flex justify-between items-start",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"font-medium",children:c.name||"N/A"}),(0,b.jsx)("div",{className:"text-sm text-muted-foreground",children:c.email})]}),(0,b.jsx)(E.f,{variant:"admin"===c.role?"default":"secondary",children:"admin"===c.role?g.admin.admin:g.admin.user})]}),(0,b.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,b.jsxs)("div",{className:"text-muted-foreground",children:[g.admin.errors,": ",c._count.errorItems," | ",g.admin.practiceCount,": ",c._count.practiceRecords," | ",g.admin.aiUsageToday,": ",c.aiUsageToday]}),(0,b.jsx)(E.f,{variant:c.isActive?"default":"destructive",className:"text-xs",children:c.isActive?g.admin.active:g.admin.disabled})]}),(0,b.jsxs)("div",{className:"flex justify-between items-center pt-2 border-t",children:[(0,b.jsx)("div",{className:"text-xs text-muted-foreground",children:(0,D.r)(c.createdAt,"yyyy-MM-dd",a)}),(0,b.jsxs)("div",{className:"flex gap-2",children:[(0,b.jsx)(A.f,{variant:"ghost",size:"sm",onClick:()=>C(c),disabled:c.id===f?.user?.id,children:c.isActive?(0,b.jsx)(ai,{className:"h-4 w-4 text-orange-500"}):(0,b.jsx)(aj.f,{className:"h-4 w-4 text-green-500"})}),(0,b.jsx)(A.f,{variant:"ghost",size:"sm",onClick:()=>F(c),disabled:c.id===f?.user?.id,children:(0,b.jsx)(ah.f,{className:"h-4 w-4 text-destructive"})})]})]})]},c.id))}),(0,b.jsx)("div",{className:"hidden sm:block border rounded-lg overflow-hidden",children:(0,b.jsxs)(ab,{children:[(0,b.jsx)(ac,{children:(0,b.jsxs)(ae,{children:[(0,b.jsx)(af,{children:g.admin.nameEmail}),(0,b.jsx)(af,{children:g.admin.role}),(0,b.jsx)(af,{children:g.admin.stats}),(0,b.jsx)(af,{children:g.admin.createdAt}),(0,b.jsx)(af,{children:g.admin.status}),(0,b.jsx)(af,{className:"text-right",children:g.admin.actions})]})}),(0,b.jsx)(ad,{children:h.map(c=>(0,b.jsxs)(ae,{children:[(0,b.jsxs)(ag,{children:[(0,b.jsx)("div",{className:"font-medium",children:c.name||"N/A"}),(0,b.jsx)("div",{className:"text-sm text-muted-foreground",children:c.email})]}),(0,b.jsx)(ag,{children:(0,b.jsx)(E.f,{variant:"admin"===c.role?"default":"secondary",children:"admin"===c.role?g.admin.admin:g.admin.user})}),(0,b.jsxs)(ag,{children:[(0,b.jsxs)("div",{className:"text-sm",children:[g.admin.errors,": ",c._count.errorItems]}),(0,b.jsxs)("div",{className:"text-sm",children:[g.admin.practiceCount,": ",c._count.practiceRecords]}),(0,b.jsxs)("div",{className:"text-sm",children:[g.admin.aiUsageToday,": ",c.aiUsageToday]})]}),(0,b.jsx)(ag,{children:(0,D.r)(c.createdAt,"yyyy-MM-dd",a)}),(0,b.jsx)(ag,{children:(0,b.jsx)(E.f,{variant:c.isActive?"default":"destructive",children:c.isActive?g.admin.active:g.admin.disabled})}),(0,b.jsxs)(ag,{className:"text-right space-x-2",children:[(0,b.jsx)(A.f,{variant:"ghost",size:"sm",onClick:()=>C(c),disabled:c.id===f?.user?.id,title:c.isActive?g.admin.disable:g.admin.enable,children:c.isActive?(0,b.jsx)(ai,{className:"h-4 w-4 text-orange-500"}):(0,b.jsx)(aj.f,{className:"h-4 w-4 text-green-500"})}),(0,b.jsx)(A.f,{variant:"ghost",size:"sm",onClick:()=>F(c),disabled:c.id===f?.user?.id,title:g.admin.delete,children:(0,b.jsx)(ah.f,{className:"h-4 w-4 text-destructive"})})]})]},c.id))})]})})]})}let ap=(0,m.f)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]),aq=(0,m.f)("github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]),ar=(0,m.f)("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),as=(0,m.f)("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);function at(){return null}let au=()=>()=>void 0;function av(){let{t:a}=(0,c.b)(),d=(0,r.useSyncExternalStore)(au,at,()=>null);return d?d.isStandalone?.()?(0,b.jsx)("p",{className:"text-center text-sm text-muted-foreground",children:a.settings?.about?.androidStandalone||"Running on this device. Data is stored only on this device."}):(0,b.jsxs)("div",{className:"flex flex-col items-center gap-2 text-sm text-muted-foreground",children:[(0,b.jsxs)("span",{className:"break-all",children:[a.settings?.about?.androidServer||"Server",": ",d.getServerUrl()]}),(0,b.jsxs)(A.f,{variant:"outline",className:"gap-2",onClick:()=>d.changeServer(),children:[(0,b.jsx)(as,{className:"h-4 w-4"}),a.settings?.about?.changeServer||"Change server"]})]}):null}let aw="https://github.com/margrop/wrong-notebook";function ax(){let{t:a}=(0,c.b)(),[d,e]=(0,r.useState)("");(0,r.useEffect)(()=>{fetch("/api/version").then(a=>a.json()).then(a=>e(a.version)).catch(()=>{})},[]);let f=[{href:aw,icon:aq,label:a.settings?.about?.github||"GitHub Repository"},{href:`${aw}/releases`,icon:ar,label:a.settings?.about?.releaseNotes||"Release Notes"},{href:`${aw}/issues`,icon:x,label:a.settings?.about?.feedback||"Feedback"}];return(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center space-y-6 py-8 text-center bg-muted/30 rounded-lg border",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("h3",{className:"text-2xl font-bold",children:a.app?.title||"Smart Error Notebook"}),(0,b.jsx)("p",{className:"text-muted-foreground",children:a.settings?.about?.desc||"AI-powered learning assistant"})]}),(0,b.jsxs)("div",{className:"flex items-center space-x-2 text-sm text-muted-foreground border px-4 py-2 rounded-full bg-background",children:[(0,b.jsx)(u,{className:"h-4 w-4"}),(0,b.jsxs)("span",{children:[a.settings?.about?.version||"Version",": v",d||"unknown"]})]}),(0,b.jsx)(av,{}),(0,b.jsx)("div",{className:"flex flex-col sm:flex-row flex-wrap justify-center gap-4 w-full sm:w-auto px-4 sm:px-0",children:f.map(({href:a,icon:c,label:d})=>(0,b.jsx)(A.f,{variant:"outline",asChild:!0,className:"gap-2 w-full sm:w-auto",children:(0,b.jsxs)("a",{href:a,target:"_blank",rel:"noopener noreferrer",children:[(0,b.jsx)(c,{className:"h-4 w-4"}),d,(0,b.jsx)(ap,{className:"h-3 w-3 ml-1 opacity-50"})]})},a))}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mt-8",children:a.settings?.about?.copyright||"© 2026 margrop · Based on wttwins/wrong-notebook · MIT License"})]})}var ay=a.i(177156),az=a.i(141379);function aA({className:a,...d}){let{t:e}=(0,c.b)(),[f,g]=(0,r.useState)(!1);return(0,b.jsxs)("div",{className:"relative",children:[(0,b.jsx)(_.f,{type:f?"text":"password",className:(0,Z.f)("pr-10",a),...d}),(0,b.jsx)(A.f,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>g(!f),"aria-label":f?e.common.hidePassword:e.common.showPassword,tabIndex:-1,children:f?(0,b.jsx)(az.f,{className:"h-4 w-4 text-muted-foreground"}):(0,b.jsx)(ay.f,{className:"h-4 w-4 text-muted-foreground"})})]})}var aB=a.i(580701);let aC={name:"",email:"",educationStage:"",enrollmentYear:"",password:""};function aD(){let{t:a}=(0,c.b)(),[d,e]=(0,r.useState)(aC),[f,g]=(0,r.useState)(""),[h,i]=(0,r.useState)(!0),[j,k]=(0,r.useState)(!1),l=(0,r.useCallback)(async()=>{try{let a=await ak.f.get("/api/user");e({name:a.name||"",email:a.email||"",educationStage:a.educationStage||"",enrollmentYear:a.enrollmentYear||"",password:""})}catch(a){am.f.error("[AccountSettings]","Failed to fetch profile",{error:a})}finally{i(!1)}},[]);(0,r.useEffect)(()=>{l()},[l]);let m=async()=>{if(d.password&&d.password!==f)return void al.c.error(a.settings?.messages?.passwordMismatch||"Passwords do not match");k(!0);try{let b={name:d.name,email:d.email,educationStage:d.educationStage};d.enrollmentYear&&(b.enrollmentYear=parseInt(d.enrollmentYear.toString())),d.password&&(b.password=d.password),await ak.f.patch("/api/user",b),al.c.success(a.settings?.messages?.profileUpdated||"Profile updated"),e(a=>({...a,password:""})),g(""),window.location.reload()}catch(b){am.f.error("[AccountSettings]","Failed to update profile",{error:(0,an.d)(b)??(0,an.Z)(b)}),al.c.error((0,an.d)(b)||a.settings?.messages?.updateFailed||"Update failed")}finally{k(!1)}};return h?(0,b.jsx)("div",{className:"flex justify-center py-8",children:(0,b.jsx)(w.f,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,b.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:a.auth?.name||"Name"}),(0,b.jsx)(_.f,{value:d.name||"",onChange:a=>e({...d,name:a.target.value})})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:a.auth?.email||"Email"}),(0,b.jsx)(_.f,{value:d.email||"",onChange:a=>e({...d,email:a.target.value}),type:"email"})]})]}),(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:a.auth?.educationStage||"Education Stage"}),(0,b.jsxs)(aB.d,{value:d.educationStage||"",onValueChange:a=>e({...d,educationStage:a}),children:[(0,b.jsx)(aB.P,{children:(0,b.jsx)(aB.U,{placeholder:a.auth?.selectStage||"Select Stage"})}),(0,b.jsxs)(aB.r,{children:[(0,b.jsx)(aB.T,{value:"primary",children:a.auth?.primary||"Primary School"}),(0,b.jsx)(aB.T,{value:"junior_high",children:a.auth?.juniorHigh||"Junior High"}),(0,b.jsx)(aB.T,{value:"senior_high",children:a.auth?.seniorHigh||"Senior High"}),(0,b.jsx)(aB.T,{value:"university",children:a.auth?.university||"University"})]})]})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:a.auth?.enrollmentYear||"Enrollment Year"}),(0,b.jsx)(_.f,{type:"number",value:d.enrollmentYear||"",onChange:a=>e({...d,enrollmentYear:a.target.value}),placeholder:"YYYY"})]})]}),(0,b.jsxs)("div",{className:"space-y-3 pt-2 border-t",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:a.settings?.account?.changePassword||"Change Password (Leave empty to keep)"}),(0,b.jsx)(aA,{value:d.password,onChange:a=>e({...d,password:a.target.value}),placeholder:"******",minLength:6})]}),d.password&&(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:a.auth?.confirmPassword||"Confirm Password"}),(0,b.jsx)(aA,{value:f,onChange:a=>g(a.target.value),placeholder:"******",minLength:6})]})]}),(0,b.jsxs)(A.f,{onClick:m,disabled:j,className:"w-full",children:[j&&(0,b.jsx)(w.f,{className:"mr-2 h-4 w-4 animate-spin"}),a.settings?.account?.update||"Update Profile"]})]})}let aE=(0,m.f)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);var aF=a.i(862722);let aG=(0,m.f)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),aH={minimax:{name:"MiniMax",baseUrl:"https://api.minimax.cn/v1",model:"MiniMax-M3.1-Flash",envPrefix:"MINIMAX",consoleUrl:"https://platform.minimax.cn"},glm:{name:"智谱 GLM",baseUrl:"https://open.bigmodel.cn/api/paas/v4",model:"glm-5.3-flash",envPrefix:"GLM",consoleUrl:"https://open.bigmodel.cn"},deepseek:{name:"DeepSeek",baseUrl:"https://api.deepseek.com",model:"deepseek-flash",envPrefix:"DEEPSEEK",consoleUrl:"https://platform.deepseek.com"},kimi:{name:"Kimi",baseUrl:"https://api.moonshot.cn/v1",model:"kimi-k3",envPrefix:"KIMI",consoleUrl:"https://platform.kimi.com"}},aI=Object.keys(aH);function aJ(a){return"string"==typeof a&&Object.prototype.hasOwnProperty.call(aH,a)}function aK({config:a,saving:d,saveButton:e}){let{t:f,language:g}=(0,c.b)(),[h,i]=(0,r.useState)(!1),[j,k]=(0,r.useState)(null),l=a=>f.settings?.ai?.errors?.[a]||a.replace("UNKNOWN:",""),m=async()=>{let b=function(a,b){let c=a.aiProvider;if("openai"===c){let d=a.openai?.instances?.find(b=>b.id===a.openai?.activeInstanceId);return d?.apiKey?{ok:!0,body:{provider:c,apiKey:d.apiKey,baseUrl:d.baseUrl,model:d.model,language:b}}:{ok:!1,error:"API_KEY_REQUIRED"}}if("azure"===c){let d=a.azure;return d?.apiKey&&d.endpoint&&d.deploymentName?{ok:!0,body:{provider:c,apiKey:d.apiKey,endpoint:d.endpoint,deploymentName:d.deploymentName,apiVersion:d.apiVersion,model:d.model,language:b}}:{ok:!1,error:"AZURE_CONFIG_INCOMPLETE"}}if("minimax-code"===c)return{ok:!0,body:{provider:c,model:a.minimaxCode?.model,language:b}};if("gemini"===c||"anthropic"===c||aJ(c)){let d=a[c];return d?.apiKey?{ok:!0,body:{provider:c,apiKey:d.apiKey,baseUrl:d.baseUrl,model:d.model,language:b}}:{ok:!1,error:"API_KEY_REQUIRED"}}return{ok:!1,error:"UNSUPPORTED_PROVIDER"}}(a,g);if(!b.ok){if("UNSUPPORTED_PROVIDER"===b.error)return;k({success:!1,textSupport:!1,visionSupport:!1,textError:"AZURE_CONFIG_INCOMPLETE"===b.error?f.settings?.ai?.validationAzureEndpointRequired||"Azure config is incomplete":f.settings?.ai?.validationApiKeyRequired||"API Key is required"});return}i(!0),k(null);try{k(await ak.f.post("/api/ai/test",b.body))}catch(a){am.f.error("[AiConnectionTest]","AI connection test failed",{error:a}),k({success:!1,textSupport:!1,visionSupport:!1,textError:(0,an.Z)(a)})}finally{i(!1)}};return(0,b.jsxs)("div",{className:"space-y-3 pt-3 border-t",children:[(0,b.jsxs)("div",{className:"flex gap-2",children:[(0,b.jsxs)(A.f,{type:"button",variant:"outline",onClick:m,disabled:h||d,className:"flex-1",children:[h?(0,b.jsx)(w.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,b.jsx)(aG,{className:"mr-2 h-4 w-4"}),h?f.settings?.ai?.testing||"Testing...":f.settings?.ai?.testConnection||"Test Connection"]}),e]}),j&&(0,b.jsxs)("div",{className:`p-3 rounded-md text-sm ${j.success?"bg-green-50 border border-green-200":"bg-red-50 border border-red-200"}`,children:[(0,b.jsx)("div",{className:"flex items-center gap-2 font-medium mb-2",children:j.success?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(aE,{className:"h-4 w-4 text-green-600"}),(0,b.jsx)("span",{className:"text-green-700",children:f.settings?.ai?.testSuccess||"Connection Successful"}),j.modelInfo&&(0,b.jsxs)("span",{className:"text-green-600 text-xs",children:["(",j.modelInfo,")"]})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(aF.f,{className:"h-4 w-4 text-red-600"}),(0,b.jsx)("span",{className:"text-red-700",children:f.settings?.ai?.testFailed||"Connection Failed"})]})}),j.success&&(0,b.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsxs)("span",{className:"text-muted-foreground",children:[f.settings?.ai?.textSupport||"Text Generation",":"]}),(0,b.jsxs)("span",{className:"text-green-600",children:["✓ ",f.settings?.ai?.supported||"Supported"]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsxs)("span",{className:"text-muted-foreground",children:[f.settings?.ai?.visionSupport||"Vision/Multimodal",":"]}),j.visionSupport?(0,b.jsxs)("span",{className:"text-green-600",children:["✓ ",f.settings?.ai?.supported||"Supported"]}):(0,b.jsxs)("span",{className:"text-amber-600",children:["✗ ",j.visionError?l(j.visionError):f.settings?.ai?.notSupported||"Not Supported"]})]}),(0,b.jsx)("p",{className:"text-muted-foreground/60 text-[10px] pl-1",children:f.settings?.ai?.testNetworkNote})]}),!j.success&&j.textError&&(0,b.jsx)("p",{className:"text-red-600 text-xs mt-1",children:l(j.textError)})]})]})}var aL=a.i(669520);function aM({provider:a,apiKey:d,baseUrl:e,currentModel:f,onModelChange:g}){let{t:h}=(0,c.b)(),[i,j]=(0,r.useState)([]),[k,l]=(0,r.useState)(!1),[m,n]=(0,r.useState)(null),[o,p]=(0,r.useState)(f||""),[q,s]=(0,r.useState)(!1),[t,u]=(0,r.useState)(f);f!==t&&(u(f),p(f||""));let v=async()=>{if(!d)return void n(h.modelSelector?.enterApiKeyFirst||"Please enter API Key first");l(!0),n(null);try{let b=await ak.f.post("/api/ai/models",{provider:a,apiKey:d,...e&&{baseUrl:e}});if("error"in b&&"string"==typeof b.error){n(b.error),s(!0),j([]);return}j(b.models),0===b.models.length&&(n(h.modelSelector?.noVisionModel||"No vision model found, please enter manually"),s(!0))}catch(b){am.f.error("[ModelSelector]","Failed to fetch models",{error:b});let a=b instanceof Error&&b.message||h.modelSelector?.fetchFailed||"Failed to fetch models";n(a+(h.modelSelector?.enterManually||", please enter manually")),s(!0)}finally{l(!1)}};return(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(aa.f,{className:"flex-1",children:h.modelSelector?.modelName||"Model Name"}),(0,b.jsx)(A.f,{type:"button",variant:"outline",size:"sm",onClick:v,disabled:k||!d,children:k?(0,b.jsx)(w.f,{className:"h-3 w-3 animate-spin"}):(0,b.jsx)(aL.f,{className:"h-3 w-3"})})]}),m&&(0,b.jsx)("p",{className:"text-xs text-yellow-600",children:m}),q||0===i.length?(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(_.f,{value:o,onChange:a=>{var b;p(b=a.target.value),g(b)},placeholder:aJ(a)?aH[a].model:"openai"===a?"gpt-6.1-sol":"gemini-1.5-flash"}),i.length>0&&(0,b.jsx)(A.f,{type:"button",variant:"link",size:"sm",className:"h-auto p-0 text-xs",onClick:()=>s(!1),children:h.modelSelector?.selectFromList||"Select from List"})]}):(0,b.jsx)("div",{className:"space-y-2",children:(0,b.jsxs)(aB.d,{value:f,onValueChange:a=>{"_custom"===a?s(!0):(s(!1),p(a),g(a))},children:[(0,b.jsx)(aB.P,{children:(0,b.jsx)(aB.U,{placeholder:h.modelSelector?.selectModel||"Select Model"})}),(0,b.jsxs)(aB.r,{children:[i.map(a=>(0,b.jsxs)(aB.T,{value:a.id,children:[a.name,a.owned_by&&` (${a.owned_by})`]},a.id)),(0,b.jsx)(aB.T,{value:"_custom",children:h.modelSelector?.customInput||"Custom Input..."})]})]})})]})}function aN({value:a,onChange:d}){let{t:e}=(0,c.b)(),f=(b,c)=>d({...a,[b]:c});return(0,b.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:"API Key"}),(0,b.jsx)(aA,{value:a?.apiKey||"",onChange:a=>f("apiKey",a.target.value),placeholder:"sk-ant-..."})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:"Base URL (Optional)"}),(0,b.jsx)(_.f,{value:a?.baseUrl||"",onChange:a=>f("baseUrl",a.target.value),placeholder:"https://api.anthropic.com"}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:e.settings?.ai?.anthropicBaseUrlHint})]}),(0,b.jsx)(aM,{provider:"anthropic",apiKey:a?.apiKey,baseUrl:a?.baseUrl,currentModel:a?.model,onModelChange:a=>f("model",a)})]})}function aO({value:a,onChange:d}){let{t:e}=(0,c.b)(),f=(b,c)=>d({...a,[b]:c}),g=a=>a?.trim()?"":"border-destructive";return(0,b.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsxs)(aa.f,{children:[e.settings?.ai?.azureEndpoint||"Azure Endpoint"," ",(0,b.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,b.jsx)(_.f,{value:a?.endpoint||"",onChange:a=>f("endpoint",a.target.value),placeholder:e.settings?.ai?.azureEndpointPlaceholder||"https://your-resource.openai.azure.com",className:g(a?.endpoint)})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsxs)(aa.f,{children:[e.settings?.ai?.azureDeployment||"Deployment Name"," ",(0,b.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,b.jsx)(_.f,{value:a?.deploymentName||"",onChange:a=>f("deploymentName",a.target.value),placeholder:e.settings?.ai?.azureDeploymentPlaceholder||"gpt-4o-deployment",className:g(a?.deploymentName)})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsxs)(aa.f,{children:["API Key ",(0,b.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,b.jsx)(aA,{value:a?.apiKey||"",onChange:a=>f("apiKey",a.target.value),placeholder:"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",className:g(a?.apiKey)})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:e.settings?.ai?.azureApiVersion||"API Version"}),(0,b.jsx)(_.f,{value:a?.apiVersion||"",onChange:a=>f("apiVersion",a.target.value),placeholder:e.settings?.ai?.azureApiVersionPlaceholder||"2024-02-15-preview"})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:e.settings?.ai?.azureModel||"Model Display Name"}),(0,b.jsx)(_.f,{value:a?.model||"",onChange:a=>f("model",a.target.value),placeholder:"gpt-4o"})]})]})}function aP({value:a,onChange:c}){let d=(b,d)=>c({...a,[b]:d});return(0,b.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:"API Key"}),(0,b.jsx)(aA,{value:a?.apiKey||"",onChange:a=>d("apiKey",a.target.value),placeholder:"AIza..."})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:"Base URL (Optional)"}),(0,b.jsx)(_.f,{value:a?.baseUrl||"",onChange:a=>d("baseUrl",a.target.value),placeholder:"https://generativelanguage.googleapis.com"})]}),(0,b.jsx)(aM,{provider:"gemini",apiKey:a?.apiKey,baseUrl:a?.baseUrl,currentModel:a?.model,onModelChange:a=>d("model",a)})]})}let aQ=(0,m.f)("log-in",[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]]);function aR({checkin:a,autoCheckin:d,onAutoCheckinChange:f,busy:g,onCheckin:h}){let i,{t:j}=(0,c.b)(),{timeZone:l}=(0,e.M)(),m=j.settings?.ai?.minimaxCode,{today:n,last:o}=a,p=o&&"failed"!==o.status?o:null,q=!!(n?.checkedToday||p),r=String(p?.points??(n?n.points+n.bonusPoints:0)),s=String(p?.streakDays??n?.streakDays??0);return i=p?.trigger==="auto"&&"checked-in"===p.status?(m?.checkinAuto||"Checked in automatically today at {time} (+{points} credits, day {days} in a row)").replace("{time}",(0,D.r)(p.at,"HH:mm",l)).replace("{points}",r).replace("{days}",s):q?(m?.checkinDone||"Checked in today (+{points} credits, day {days} in a row)").replace("{points}",r).replace("{days}",s):o?.status==="failed"?(m?.checkinFailed||"Check-in failed: {error}").replace("{error}",o.error||""):a.autoCheckin?m?.checkinWillAuto||"Not checked in yet today. The app will check in automatically within the hour.":m?.checkinNotYet||"Not checked in yet today",(0,b.jsxs)("div",{className:"space-y-3 border-t pt-3",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 text-sm",children:[(0,b.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:m?.checkinToday||"Today's check-in"}),(0,b.jsxs)(E.f,{variant:q?"default":o?.status==="failed"?"destructive":"secondary",children:[(0,b.jsx)(k.f,{className:"mr-1 h-3 w-3"}),q?m?.checkinSuccess||"Checked in":m?.checkinNotYet||"Not yet"]})]}),!q&&(0,b.jsxs)(A.f,{size:"sm",variant:"outline",onClick:h,disabled:g,children:[g&&(0,b.jsx)(w.f,{className:"mr-2 h-4 w-4 animate-spin"}),m?.checkinNow||"Check in now"]})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground break-words",children:i}),(0,b.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)(aa.f,{htmlFor:"minimax-code-auto-checkin",children:m?.autoCheckin||"Daily auto check-in"}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:m?.autoCheckinHint})]}),(0,b.jsx)($,{id:"minimax-code-auto-checkin",checked:d,onCheckedChange:f})]})]})}let aS=["MiniMax-M3.1-Flash","MiniMax-M3","MiniMax-M2.7-highspeed","MiniMax-M2.7"];function aT({value:a,onChange:d}){let{t:e}=(0,c.b)(),f=e.settings?.ai?.minimaxCode,{status:g,loading:h,pending:i,busy:j,refresh:k,login:l,logout:m,checkin:o}=function(){let{t:a}=(0,c.b)(),b=a.settings?.ai?.minimaxCode,[d,e]=(0,r.useState)(null),[f,g]=(0,r.useState)(!0),[h,i]=(0,r.useState)(null),[j,k]=(0,r.useState)(!1),l=(0,r.useRef)(null),m=(0,r.useCallback)(async()=>{g(!0);try{let a=await ak.f.get("/api/minimax-code");e(a),a.pendingLogin&&i(a.pendingLogin)}catch(a){am.f.error("[MiniMaxCode]","Failed to load status",{error:a})}finally{g(!1)}},[]);(0,r.useEffect)(()=>{m()},[m]),(0,r.useEffect)(()=>{if(!h)return;let a=!1,c=async()=>{try{let d=await ak.f.get("/api/minimax-code/login");if(a)return;if("pending"===d.status){l.current=setTimeout(c,h.intervalMs);return}i(null),"ok"===d.status?al.c.success(b?.loginSuccess||"Signed in"):"expired"===d.status?al.c.error(b?.loginExpired||"Authorization timed out"):"denied"===d.status&&al.c.error(b?.loginDenied||"Authorization declined"),m()}catch(c){if(a)return;i(null),al.c.error(`${b?.loginFailed||"Sign-in failed"}: ${(0,an.Z)(c)}`)}};return l.current=setTimeout(c,h.intervalMs),()=>{a=!0,l.current&&clearTimeout(l.current)}},[h,m,b]);let n=async()=>{k(!0);try{await ak.f.delete("/api/minimax-code"),i(null),await m()}catch(a){al.c.error((0,an.Z)(a))}finally{k(!1)}},o=async()=>{k(!0);try{let a=await ak.f.post("/api/minimax-code/checkin",{});"failed"===a.status?al.c.error((b?.checkinFailed||"Check-in failed: {error}").replace("{error}",a.error||"")):al.c.success(b?.checkinSuccess||"Checked in"),await m()}catch(a){al.c.error((0,an.Z)(a))}finally{k(!1)}};return{status:d,loading:f,pending:h,busy:j,refresh:m,login:async()=>{k(!0);try{let a=await ak.f.post("/api/minimax-code/login",{});i(a),window.open(a.url,"_blank","noopener,noreferrer")}catch(a){al.c.error(`${b?.loginFailed||"Sign-in failed"}: ${(0,an.Z)(a)}`)}finally{k(!1)}},logout:n,checkin:o}}(),p=g?.login??"none",q=g?.account,s=g?.credits,t={none:f?.statusNone||"Not signed in",active:f?.statusActive||"Signed in",expired:f?.statusExpired||"Login expired"}[p];return(0,b.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:f?.intro}),(0,b.jsxs)("section",{className:"space-y-3 rounded-md border bg-background p-3","aria-label":f?.title||"MiniMax Code account",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,b.jsx)("h4",{className:"text-sm font-medium",children:f?.title||"MiniMax Code account"}),(0,b.jsx)(A.f,{variant:"ghost",size:"sm",onClick:()=>void k(),disabled:h,"aria-label":f?.refresh||"Refresh",children:(0,b.jsx)(aL.f,{className:`h-4 w-4 ${h?"animate-spin":""}`})})]}),(0,b.jsxs)("dl",{className:"grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 text-sm",children:[(0,b.jsx)("dt",{className:"text-muted-foreground",children:f?.loginStatus||"Login status"}),(0,b.jsxs)("dd",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,b.jsx)(E.f,{variant:"active"===p?"default":"expired"===p?"destructive":"secondary",children:t}),q&&(0,b.jsx)("span",{className:"truncate text-muted-foreground",children:q.name||q.email||q.userId})]}),"active"===p&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("dt",{className:"text-muted-foreground",children:f?.credits||"Remaining credits"}),(0,b.jsx)("dd",{children:s?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:"font-medium tabular-nums",children:s.total}),(0,b.jsx)("span",{className:"ml-2 text-xs text-muted-foreground",children:(f?.creditsDetail||"Free {free} · Purchased {purchased}").replace("{free}",String(s.free)).replace("{purchased}",String(s.purchased))})]}):(0,b.jsx)("span",{className:"text-muted-foreground",children:f?.creditsUnavailable||"Unavailable"})})]})]}),"active"===p&&g&&(0,b.jsx)(aR,{checkin:g.checkin,autoCheckin:a?.autoCheckin!==!1,onAutoCheckinChange:b=>d({...a,autoCheckin:b}),busy:j,onCheckin:()=>void o()}),i?(0,b.jsxs)("div",{className:"space-y-1 rounded-md bg-muted/50 p-3 text-sm",children:[(0,b.jsxs)("p",{className:"flex items-center gap-2",children:[(0,b.jsx)(w.f,{className:"h-4 w-4 animate-spin"}),f?.waiting]}),i.userCode&&(0,b.jsxs)("p",{children:[f?.userCode||"Verification code",": ",(0,b.jsx)("span",{className:"font-mono font-medium",children:i.userCode})]}),(0,b.jsxs)("a",{href:i.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 underline",children:[f?.openLink||"Open the authorization page"," ",(0,b.jsx)(ap,{className:"h-3 w-3"})]})]}):(0,b.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,b.jsxs)(A.f,{size:"sm",onClick:()=>void l(),disabled:j,children:[j?(0,b.jsx)(w.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,b.jsx)(aQ,{className:"mr-2 h-4 w-4"}),"none"===p?f?.login||"Sign in with browser":f?.relogin||"Sign in again"]}),"none"!==p&&(0,b.jsxs)(A.f,{size:"sm",variant:"outline",onClick:()=>void m(),disabled:j,children:[(0,b.jsx)(n,{className:"mr-2 h-4 w-4"}),f?.logout||"Sign out"]})]})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{htmlFor:"minimax-code-model",children:f?.model||"Model"}),(0,b.jsx)(_.f,{id:"minimax-code-model",list:"minimax-code-models",value:a?.model||"",onChange:b=>d({...a,model:b.target.value}),placeholder:"MiniMax-M3.1-Flash"}),(0,b.jsx)("datalist",{id:"minimax-code-models",children:aS.map(a=>(0,b.jsx)("option",{value:a},a))}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:f?.modelHint})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:f?.risk})]})}var aU=a.i(915618);function aV({value:a,onChange:d}){let{t:e}=(0,c.b)(),f=a?.instances||[],g=a?.activeInstanceId,h=f.find(a=>a.id===g),i=(b,c)=>{d({...a,instances:f.map(a=>a.id===g?{...a,[b]:c}:a)})},j=async()=>{if(!g||!await (0,al.u)(e.settings?.ai?.confirmDelete||"Delete this instance?",{destructive:!0}))return;let a=f.filter(a=>a.id!==g);d({instances:a,activeInstanceId:a[0]?.id})};return(0,b.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)(aa.f,{children:e.settings?.ai?.instances||"Instance"}),(0,b.jsxs)(A.f,{type:"button",variant:"outline",size:"sm",onClick:()=>{if(f.length>=10)return;let a={id:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{let b=16*Math.random()|0;return("x"===a?b:3&b|8).toString(16)}),name:`Instance ${f.length+1}`,apiKey:"",baseUrl:"https://api.openai.com/v1",model:"gpt-6.1-sol"};d({instances:[...f,a],activeInstanceId:a.id})},disabled:f.length>=10,className:"h-7 px-2 text-xs",children:[(0,b.jsx)(aU.f,{className:"h-3 w-3 mr-1"}),e.settings?.ai?.addInstance||"Add"]})]}),f.length>0?(0,b.jsxs)("div",{className:"flex gap-2",children:[(0,b.jsxs)(aB.d,{value:g||"",onValueChange:b=>d({...a,activeInstanceId:b}),children:[(0,b.jsx)(aB.P,{className:"flex-1",children:(0,b.jsx)(aB.U,{placeholder:e.settings?.ai?.selectInstance||"Select Instance"})}),(0,b.jsx)(aB.r,{children:f.map(a=>(0,b.jsx)(aB.T,{value:a.id,children:a.name},a.id))})]}),f.length>1&&(0,b.jsx)(A.f,{type:"button",variant:"outline",size:"icon",onClick:j,className:"h-10 w-10 text-destructive hover:text-destructive",children:(0,b.jsx)(ah.f,{className:"h-4 w-4"})})]}):(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:e.settings?.ai?.noInstances||"No instances configured. Click 'Add' to create one."}),f.length>=10&&(0,b.jsx)("p",{className:"text-xs text-amber-600",children:e.settings?.ai?.maxInstancesReached||"Maximum instances reached (10)"})]}),h&&(0,b.jsxs)("div",{className:"space-y-3 p-3 border rounded-md bg-background",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsxs)(aa.f,{children:[e.settings?.ai?.instanceName||"Instance Name"," ",(0,b.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,b.jsx)(_.f,{value:h.name||"",onChange:a=>i("name",a.target.value),placeholder:"e.g. 智谱 GLM-4V",className:h.name?.trim()?"":"border-destructive"})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsxs)(aa.f,{children:["API Key ",(0,b.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,b.jsx)(aA,{value:h.apiKey||"",onChange:a=>i("apiKey",a.target.value),placeholder:"sk-...",className:h.apiKey?.trim()?"":"border-destructive"})]}),(0,b.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,b.jsxs)(aa.f,{children:["Base URL ",(0,b.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,b.jsx)(_.f,{value:h.baseUrl||"",onChange:a=>i("baseUrl",a.target.value),placeholder:"https://api.openai.com/v1",className:h.baseUrl?.trim()?"":"border-destructive"})]}),(0,b.jsx)(aM,{provider:"openai",apiKey:h.apiKey,baseUrl:h.baseUrl,currentModel:h.model,onModelChange:a=>i("model",a)})]})]})}function aW({provider:a,value:d,onChange:e}){let{t:f}=(0,c.b)(),g=aH[a],h=(a,b)=>e({...d,[a]:b});return(0,b.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:"API Key"}),(0,b.jsx)(aA,{value:d?.apiKey||"",onChange:a=>h("apiKey",a.target.value),placeholder:"sk-..."}),(0,b.jsxs)("p",{className:"text-xs text-muted-foreground",children:[f.settings?.ai?.vendorApiKeyHint||"Get an API key from the console:"," ",(0,b.jsx)("a",{href:g.consoleUrl,target:"_blank",rel:"noopener noreferrer",className:"underline break-all",children:g.consoleUrl})]})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:"Base URL (Optional)"}),(0,b.jsx)(_.f,{value:d?.baseUrl||"",onChange:a=>h("baseUrl",a.target.value),placeholder:g.baseUrl}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:f.settings?.ai?.vendorBaseUrlHint})]}),(0,b.jsx)(aM,{provider:a,apiKey:d?.apiKey,baseUrl:d?.baseUrl,currentModel:d?.model||g.model,onModelChange:a=>h("model",a)})]})}function aX({config:a,setConfig:d,loading:e,saving:f,onSave:g}){let{t:h}=(0,c.b)();return e?(0,b.jsx)("div",{className:"flex justify-center py-4",children:(0,b.jsx)(w.f,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):(0,b.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:h.settings?.tabs?.ai||"AI Provider"}),(0,b.jsxs)(aB.d,{value:a.aiProvider,onValueChange:a=>d(b=>({...b,aiProvider:a})),children:[(0,b.jsx)(aB.P,{children:(0,b.jsx)(aB.U,{})}),(0,b.jsxs)(aB.r,{children:[(0,b.jsx)(aB.T,{value:"minimax",children:aH.minimax.name}),(0,b.jsx)(aB.T,{value:"minimax-code",children:"MiniMax Code OAuth"}),aI.filter(a=>"minimax"!==a).map(a=>(0,b.jsx)(aB.T,{value:a,children:aH[a].name},a)),(0,b.jsx)(aB.T,{value:"anthropic",children:"Anthropic / Compatible"}),(0,b.jsx)(aB.T,{value:"azure",children:"Azure OpenAI"}),(0,b.jsx)(aB.T,{value:"openai",children:"OpenAI / Compatible"}),(0,b.jsx)(aB.T,{value:"gemini",children:"Google Gemini"})]})]})]}),"openai"===a.aiProvider&&(0,b.jsx)(aV,{value:a.openai,onChange:a=>d(b=>({...b,openai:a}))}),"gemini"===a.aiProvider&&(0,b.jsx)(aP,{value:a.gemini,onChange:a=>d(b=>({...b,gemini:a}))}),"minimax-code"===a.aiProvider&&(0,b.jsx)(aT,{value:a.minimaxCode,onChange:a=>d(b=>({...b,minimaxCode:a}))}),"anthropic"===a.aiProvider&&(0,b.jsx)(aN,{value:a.anthropic,onChange:a=>d(b=>({...b,anthropic:a}))}),aJ(a.aiProvider)&&(0,b.jsx)(aW,{provider:a.aiProvider,value:a[a.aiProvider],onChange:a=>d(b=>({...b,[b.aiProvider]:a}))},a.aiProvider),"azure"===a.aiProvider&&(0,b.jsx)(aO,{value:a.azure,onChange:a=>d(b=>({...b,azure:a}))}),(0,b.jsx)(aK,{config:a,saving:f,saveButton:(0,b.jsxs)(A.f,{onClick:g,disabled:f,className:"flex-1",children:[f&&(0,b.jsx)(w.f,{className:"mr-2 h-4 w-4 animate-spin"}),h.settings?.ai?.save||"Save AI Settings"]})})]})}let aY={info:{card:"border-blue-200 bg-blue-50",title:"text-blue-900 font-bold",desc:"text-blue-800 font-medium",button:"bg-blue-100 hover:bg-blue-200 text-blue-900 border-blue-300"},danger:{card:"border-red-200 bg-red-50",title:"text-red-700 font-medium",desc:"text-red-600",button:""},critical:{card:"border-red-600/50 bg-red-100/50",title:"text-red-900 font-bold",desc:"text-red-800 font-medium",button:"bg-red-700 hover:bg-red-800"}};function aZ({title:a,description:c,tone:d,busy:e,icon:f,onClick:g}){let h=aY[d];return(0,b.jsxs)("div",{className:`p-4 border rounded-lg ${h.card}`,children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)("span",{className:`text-sm flex items-center gap-2 ${h.title}`,children:a}),(0,b.jsx)(A.f,{variant:"info"===d?"outline":"destructive",size:"sm",onClick:g,disabled:e,className:h.button,children:e?(0,b.jsx)(w.f,{className:"h-4 w-4 animate-spin"}):f})]}),(0,b.jsx)("p",{className:`text-xs mt-2 ${h.desc}`,children:c})]})}function a$({isAdmin:a}){let{t:d}=(0,c.b)(),[e,f]=(0,r.useState)(null),g=async(a,b,c,d)=>{f(a);try{al.c.success(await b()),d&&window.location.reload()}catch(b){am.f.error("[DangerZoneSettings]",`${a} failed`,{error:b}),al.c.error(c)}finally{f(null)}},h=d.settings?.clearSuccess||"Success",i=d.settings?.clearError||"Failed",j=async()=>{await (0,al.u)(d.settings?.migrateTagsConfirm||"This will reset system tags. Confirm?",{destructive:!0})&&await g("migrateTags",async()=>{let a=await ak.f.post("/api/admin/migrate-tags",{});return`${h}: ${a.count||0} tags migrated.`},d.settings?.clearError||"Failed to migrate tags",!1)},k=async()=>{await (0,al.u)(d.settings?.clearDataConfirm||"Are you sure?",{destructive:!0})&&await g("clearPractice",async()=>(await ak.f.delete("/api/stats/practice/clear"),h),i,!0)},l=async()=>{await (0,al.u)(d.settings?.clearErrorDataConfirm||"Are you sure?",{destructive:!0})&&await g("clearErrors",async()=>(await ak.f.delete("/api/error-items/clear"),h),i,!0)},m=async()=>{if(!await (0,al.u)(d.settings?.systemResetConfirm||"WARNING: Deleting ALL data. Undoing is impossible. Are you sure?",{destructive:!0}))return;let a=prompt(d.settings?.systemResetPrompt||"Type 'RESET' to confirm system initialization:","");if("RESET"!==a){null!==a&&al.c.error(d.common?.error||"Confirmation failed");return}await g("systemReset",async()=>(await ak.f.post("/api/admin/system-reset",{}),d.settings?.clearSuccess||"Success - System Reset Complete"),d.settings?.clearError||"Failed to reset system",!0)};return(0,b.jsxs)(b.Fragment,{children:[a&&(0,b.jsx)(aZ,{tone:"info",title:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(aL.f,{className:"h-4 w-4"}),d.settings?.migrateTags||"Migrate Tags"]}),description:d.settings?.migrateTagsDesc||"Re-populates standard tags from file",busy:"migrateTags"===e,icon:(0,b.jsx)(aL.f,{className:"h-4 w-4"}),onClick:j}),(0,b.jsx)(aZ,{tone:"danger",title:d.settings?.clearData||"Clear Practice Data",description:d.settings?.clearDataDesc||"This will permanently delete all practice history. Irreversible.",busy:"clearPractice"===e,icon:(0,b.jsx)(ah.f,{className:"h-4 w-4"}),onClick:k}),(0,b.jsx)(aZ,{tone:"danger",title:d.settings?.clearErrorData||"Clear Error Data",description:d.settings?.clearErrorDataDesc||"This will permanently delete all error items. Irreversible.",busy:"clearErrors"===e,icon:(0,b.jsx)(ah.f,{className:"h-4 w-4"}),onClick:l}),a&&(0,b.jsx)(aZ,{tone:"critical",title:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(s,{className:"h-4 w-4"}),d.settings?.systemReset||"System Initialization"]}),description:d.settings?.systemResetDesc||"Resets the system to factory state. Deletes ALL data.",busy:"systemReset"===e,icon:(0,b.jsx)(ah.f,{className:"h-4 w-4"}),onClick:m})]})}var a_=a.i(284505);let a0=(0,m.f)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);async function a1(a,b){let c=await fetch(a);if(!c.ok)throw Error((await c.json().catch(()=>({}))).message||"Export failed");let d=await c.blob(),e=window.URL.createObjectURL(d),f=document.createElement("a");f.href=e;let g=c.headers.get("Content-Disposition")?.match(/filename="(.+)"/);f.download=g?g[1]:b,document.body.appendChild(f),f.click(),document.body.removeChild(f),window.URL.revokeObjectURL(e)}function a2({isAdmin:a}){let{t:d}=(0,c.b)(),[e,f]=(0,r.useState)(!1),[g,h]=(0,r.useState)(!1),[i,j]=(0,r.useState)(null),k=async a=>{if(!a||await (0,al.u)(d.settings?.exportAllConfirm||"Export all users' data? This may take a while.")){f(!0);try{await a1(a?"/api/export?all=true":"/api/export",a?"wrong-notebook-export-all.json":"wrong-notebook-export.json"),al.c.success(d.settings?.exportSuccess||"Export successful")}catch(b){am.f.error("[DataBackupSettings]",a?"Export all failed":"Export failed",{error:b}),al.c.error(d.settings?.exportFailed||"Export failed")}finally{f(!1)}}},l=async a=>{if(!i)return;let b=a?d.settings?.importAllConfirm||"Import all users' data? This will restore data for all users from the export file.":d.settings?.importConfirm||"Are you sure you want to import?";if(await (0,al.u)(b)){h(!0);try{let b=JSON.parse(await i.text()),{stats:c}=await ak.f.post(a?"/api/import?all=true":"/api/import",b);al.c.success((d.settings?.importResultDesc||"Imported {subjects} notebooks, {tags} tags, {items} error items, {schedules} review schedules, {records} practice records, {papers} exam papers.").replace("{subjects}",String(c.subjectsCreated)).replace("{tags}",String(c.tagsCreated)).replace("{items}",String(c.errorItemsCreated)).replace("{schedules}",String(c.reviewSchedulesCreated)).replace("{records}",String(c.practiceRecordsCreated)).replace("{papers}",String(c.examPapersCreated??0)).replace("{duplicates}",String(c.duplicateErrorItems??0))),j(null),window.location.reload()}catch(b){am.f.error("[DataBackupSettings]",a?"Import all failed":"Import failed",{error:b}),al.c.error(d.settings?.importFailed||"Import failed")}finally{h(!1)}}},m=(a,c)=>a?(0,b.jsx)(w.f,{className:"mr-2 h-4 w-4 animate-spin"}):c;return(0,b.jsxs)("div",{className:"p-4 border border-blue-200 rounded-lg bg-blue-50",children:[(0,b.jsx)("h4",{className:"text-sm font-bold text-blue-900 mb-3",children:d.settings?.dataManagement||"Data Management"}),(0,b.jsxs)("div",{className:"mb-4",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,b.jsx)("span",{className:"text-sm text-blue-800 font-medium",children:d.settings?.exportData||"Export Data"}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsxs)(A.f,{variant:"outline",size:"sm",onClick:()=>k(!1),disabled:e,className:"bg-blue-100 hover:bg-blue-200 text-blue-900 border-blue-300",children:[m(e,(0,b.jsx)(a_.f,{className:"mr-2 h-4 w-4"})),d.settings?.exportData||"Export"]}),a&&(0,b.jsxs)(A.f,{variant:"outline",size:"sm",onClick:()=>k(!0),disabled:e,className:"bg-orange-100 hover:bg-orange-200 text-orange-900 border-orange-300",children:[m(e,(0,b.jsx)(a_.f,{className:"mr-2 h-4 w-4"})),d.settings?.exportAllData||"Export All"]})]})]}),(0,b.jsx)("p",{className:"text-xs text-blue-700",children:d.settings?.exportDataDesc||"Export all data as JSON file."})]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,b.jsx)("span",{className:"text-sm text-blue-800 font-medium",children:d.settings?.importData||"Import Data"}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("input",{type:"file",accept:".json",onChange:a=>j(a.target.files?.[0]??i),className:"hidden",id:"import-file-input",disabled:g}),(0,b.jsxs)(A.f,{variant:"outline",size:"sm",onClick:()=>document.getElementById("import-file-input")?.click(),disabled:g,className:"bg-blue-100 hover:bg-blue-200 text-blue-900 border-blue-300",children:[m(g,(0,b.jsx)(a0,{className:"mr-2 h-4 w-4"})),i?.name||d.settings?.selectFile||"Select File"]}),i&&(0,b.jsxs)(A.f,{variant:"outline",size:"sm",onClick:()=>l(!1),disabled:g,className:"bg-green-100 hover:bg-green-200 text-green-900 border-green-300",children:[m(g,(0,b.jsx)(aE,{className:"mr-2 h-4 w-4"})),d.settings?.importData||"Import"]}),i&&a&&(0,b.jsxs)(A.f,{variant:"outline",size:"sm",onClick:()=>l(!0),disabled:g,className:"bg-orange-100 hover:bg-orange-200 text-orange-900 border-orange-300",children:[m(g,(0,b.jsx)(aE,{className:"mr-2 h-4 w-4"})),d.settings?.importAllData||"Import All"]})]})]}),(0,b.jsx)("p",{className:"text-xs text-blue-700",children:d.settings?.importDataDesc||"Import data from JSON file. Existing data will be skipped."})]})]})}var a3=a.i(225949);function a4({field:a,label:d,description:e}){let{t:f}=(0,c.b)(),[g,h]=(0,r.useState)(!1),[i,j]=(0,r.useState)(!1),[k,l]=(0,r.useState)(!1),[m,n]=(0,r.useState)(null),o=`preference-${a}`;(0,r.useEffect)(()=>{ak.f.get("/api/user").then(b=>h(!!b[a])).catch(()=>void 0).finally(()=>j(!0))},[a]);let p=async b=>{h(b),l(!0);try{await ak.f.patch("/api/user",{[a]:b}),n(f.importFlow.preferenceSaved)}catch(c){h(!b),n(f.importFlow.preferenceSaveFailed),am.f.error("[Settings]","Failed to save user preference",{field:a,error:c instanceof Error?c.message:String(c)})}finally{l(!1)}};return(0,b.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,b.jsx)(aa.f,{htmlFor:o,children:d}),(0,b.jsx)($,{id:o,checked:g,onCheckedChange:p,disabled:!i||k})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:e}),m&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:m})]})}function a5(){let{t:a}=(0,c.b)();return(0,b.jsx)(a4,{field:"enableGeogebra",label:a.importFlow.enableGeogebra,description:a.importFlow.enableGeogebraDesc})}function a6(){let{t:a}=(0,c.b)();return(0,b.jsx)(a4,{field:"confirmBeforeImport",label:a.importFlow.confirmBeforeImport,description:a.importFlow.confirmBeforeImportDesc})}function a7(){let{t:a}=(0,c.b)();return(0,b.jsx)(a4,{field:"enableSvgAnimation",label:a.importFlow.enableSvgAnimation,description:a.importFlow.enableSvgAnimationDesc})}function a8({value:a,onChange:d,disabled:e}){let{t:f}=(0,c.b)();return(0,b.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,b.jsx)(aa.f,{htmlFor:"app-time-zone",children:f.settings.general.timeZoneLabel}),(0,b.jsx)(_.f,{id:"app-time-zone",value:a,onChange:a=>d(a.target.value),disabled:e,list:"app-time-zones",placeholder:"Asia/Shanghai"}),(0,b.jsx)("datalist",{id:"app-time-zones",children:["Asia/Shanghai","Asia/Hong_Kong","Asia/Tokyo","Asia/Singapore","Europe/London","America/New_York","America/Los_Angeles","UTC"].map(a=>(0,b.jsx)("option",{value:a},a))}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:f.settings.general.timeZoneDesc})]})}function a9({config:a,setConfig:d,isAdmin:f,disabled:g}){let{t:h,language:i,setLanguage:j}=(0,c.b)(),{timeZone:k}=(0,e.M)(),l=a=>d(b=>({...b,timeouts:{...b.timeouts,analyze:1e3*a}}));return(0,b.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aa.f,{children:h.settings?.language||"Language"}),(0,b.jsxs)(aB.d,{value:i,onValueChange:a=>j(a),children:[(0,b.jsx)(aB.P,{children:(0,b.jsx)(aB.U,{})}),(0,b.jsxs)(aB.r,{children:[(0,b.jsx)(aB.T,{value:"zh",children:"中文 (Chinese)"}),(0,b.jsx)(aB.T,{value:"en",children:"English"})]})]})]}),(0,b.jsx)(a8,{value:a.timeZone??k,onChange:a=>d(b=>({...b,timeZone:a})),disabled:!f||g}),f&&(0,b.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,b.jsx)(aa.f,{children:h.settings?.general?.timeoutLabel||"AI Analysis Timeout (Seconds)"}),(0,b.jsx)(_.f,{type:"number",value:a.timeouts?.analyze?a.timeouts.analyze/1e3:"",onChange:a=>{let b=""===a.target.value?0:parseInt(a.target.value);l(isNaN(b)?0:b)},onBlur:()=>{let b=(a.timeouts?.analyze||0)/1e3,c=Math.min(600,Math.max(120,b));c!==b&&l(c)},min:120,max:600}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:h.settings?.general?.timeoutDesc||"Increase this value if you experience frequent timeouts during AI analysis."})]}),(0,b.jsx)(a6,{}),(0,b.jsx)(a7,{}),(0,b.jsx)(a5,{}),(0,b.jsx)(a3.f,{})]})}var ba=a.i(429246);let bb={trace:10,debug:20,info:30,warn:40,error:50,fatal:60};function bc(a,b={}){let c,d=bb[a],e=(c=process.env.LOG_LEVEL?.toLowerCase())&&void 0!==bb[c]?bb[c]:bb.info;return(c,f)=>{let g,h;if(d<e)return;let i=new Date;"string"==typeof c?(g={},h=c):(g=c,h=f||"");{let c=JSON.stringify({level:a,time:i.toISOString(),...b,...g,msg:h});switch(a){case"error":case"fatal":console.error(c);break;case"warn":console.warn(c);break;default:console.log(c)}}}}(function a(b={}){return b.module,{trace:bc("trace",b),debug:bc("debug",b),info:bc("info",b),warn:bc("warn",b),error:bc("error",b),fatal:bc("fatal",b),child:c=>a({...b,...c}),box:(a,c,d="📋")=>{console.log(JSON.stringify({level:"info",time:new Date().toISOString(),...b,title:a,..."string"==typeof c?{content:c}:c||{},msg:a}))},divider:(a="-")=>{}}})({env:"production"}).child({module:"ai:prompts"});let bd=`请参考《高思学校竞赛数学导引》(每讲分兴趣篇、拓展篇、超越篇,题目左侧标 1~5 颗星)的星级标准,结合题目所在年级评定难度:
2
2
  - 1 星:课本基础题,直接套用概念、公式或简单计算即可(相当于兴趣篇前几题)。
3
3
  - 2 星:校内拔高题,需要两三步推理或简单综合(相当于兴趣篇后几题)。
4
4
  - 3 星:常规奥数题,小升初、杯赛常见难度,需要掌握该专题的典型方法(相当于拓展篇)。
5
5
  - 4 星:较难奥数题,需要构造、分类讨论、转化或多种方法综合(相当于拓展篇末题、超越篇前几题)。
6
6
  - 5 星:竞赛压轴题,集训队水平,思路巧妙、步骤长(相当于超越篇难题)。
7
- 非数学学科按同样的 1~5 级划分:1 星为基础识记,3 星为综合应用,5 星为竞赛或压轴难度。`,ba=`- 输出一个完整的 <svg> 元素,包含 xmlns="http://www.w3.org/2000/svg" 和 viewBox(建议宽 400~600),不要用 Markdown 代码块包裹。
7
+ 非数学学科按同样的 1~5 级划分:1 星为基础识记,3 星为综合应用,5 星为竞赛或压轴难度。`,be=`- 输出一个完整的 <svg> 元素,包含 xmlns="http://www.w3.org/2000/svg" 和 viewBox(建议宽 400~600),不要用 Markdown 代码块包裹。
8
8
  - 白色背景、黑色线条(stroke="#000",线宽 1.5~2),需要区分的区域可用浅灰填充;不要使用彩色装饰。
9
9
  - 按原图比例和相对位置绘制,保留所有标注:顶点字母、数字、长度、角度、单位、箭头和虚线等,文字用 <text>(font-size 14~18)。
10
10
  - 只使用基本图形元素:line、polyline、polygon、rect、circle、ellipse、path、text、g、defs、marker。
11
- - 严禁使用 <image>、<script>、<foreignObject>、外部链接、外部字体或事件属性。`,bb=String.raw`- 行内公式用 $...$,独立公式用 $$...$$;不要用 \(...\) 或 \[...\],每个 $ 必须成对出现。
11
+ - 严禁使用 <image>、<script>、<foreignObject>、外部链接、外部字体或事件属性。`,bf=String.raw`- 行内公式用 $...$,独立公式用 $$...$$;不要用 \(...\) 或 \[...\],每个 $ 必须成对出现。
12
12
  - 所有 LaTeX 命令(如 \frac、\sqrt、\times、\angle)都必须写在 $...$ 内,公式外不能出现反斜杠命令。
13
13
  - 只使用 KaTeX 支持的命令和环境:方程组用 \begin{cases}...\end{cases},多行推导用 \begin{aligned}...\end{aligned}(放在 $$...$$ 中),不要用 align、eqnarray、\newcommand、\usepackage、\label、\tag 等。
14
14
  - 大括号 {} 必须成对,\left 与 \right 必须成对,\begin{...} 与 \end{...} 必须对应。
15
15
  - 公式中的中文写在 \text{...} 里,或放到公式外;百分号写成 \%,美元符号写成 \$。
16
- - 反斜杠只写一个(\frac),不要写成 \\frac;换行符 \\ 只能用在 cases、aligned 等环境里。`,bc=`【角色与核心任务 (ROLE AND CORE TASK)】
16
+ - 反斜杠只写一个(\frac),不要写成 \\frac;换行符 \\ 只能用在 cases、aligned 等环境里。`,bg=`【角色与核心任务 (ROLE AND CORE TASK)】
17
17
  你是一位世界顶尖的、经验丰富的、专业的跨学科考试分析专家(Interdisciplinary Exam Analysis Expert)。你的核心任务是极致准确地分析用户提供的考试题目图片,全面理解所有文本、图表和隐含约束,并提供一个完整、高度结构化且专业的解决方案。
18
18
 
19
19
  {{language_instruction}}
@@ -41,7 +41,7 @@ module.exports=[418175,a=>{"use strict";var b=a.i(187924),c=a.i(550194),d=a.i(87
41
41
 
42
42
  <figure_svg>
43
43
  如果 has_figure 为 true,用 SVG 重新绘制题目配图:
44
- ${ba}
44
+ ${be}
45
45
  如果 has_figure 为 false,请留空。
46
46
  </figure_svg>
47
47
 
@@ -55,7 +55,7 @@ ${ba}
55
55
 
56
56
  <difficulty_stars>
57
57
  只填写 1 到 5 之间的一个整数,表示题目难度星级。
58
- ${a9}
58
+ ${bd}
59
59
  </difficulty_stars>
60
60
 
61
61
  <mistake_analysis>
@@ -130,10 +130,10 @@ ${a9}
130
130
  3. **内容完整**:如果包含子问题,请在 question_text 中完整列出。
131
131
  4. **禁止图片**:严禁包含任何图片链接或 markdown 图片语法。
132
132
  5. **LaTeX 规范**:
133
- ${bb}
133
+ ${bf}
134
134
 
135
135
  {{grade_instruction}}
136
- {{provider_hints}}`,bd=`你是一位资深的K12教育题目生成专家,具备跨学科的题目创作能力。你的核心任务是**根据以下原题和知识点,举一反三生成高质量教学题目**,帮助学生巩固知识并拓展解题思路。
136
+ {{provider_hints}}`,bh=`你是一位资深的K12教育题目生成专家,具备跨学科的题目创作能力。你的核心任务是**根据以下原题和知识点,举一反三生成高质量教学题目**,帮助学生巩固知识并拓展解题思路。
137
137
  ### 角色定义
138
138
  1. **学科全能专家**
139
139
  - 精通K12阶段所有学科(数学/语文/英语/物理/化学/生物/历史/地理/政治)
@@ -185,9 +185,9 @@ ${bb}
185
185
  ###关键格式与内容约束 (CRITICAL RULES) !!!
186
186
  1. **纯文本**:内容作为纯文本处理,**不要转义反斜杠**。
187
187
  2. **LaTeX 规范**:
188
- ${bb}
188
+ ${bf}
189
189
 
190
190
  {{grade_instruction}}
191
- {{provider_hints}}`;var be=a.i(787654);function bf({name:a,description:c}){return(0,b.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start gap-1 sm:gap-2 text-xs py-1",children:[(0,b.jsx)("code",{className:"bg-muted px-1.5 py-0.5 rounded font-mono text-primary shrink-0 w-fit",children:`{{${a}}}`}),(0,b.jsx)("span",{className:"text-muted-foreground",children:c})]})}function bg(){let{t:a}=(0,c.b)();return(0,b.jsxs)("div",{className:"bg-amber-50 border border-amber-200 rounded-md p-3 flex items-start gap-3 text-amber-900 text-sm mb-4",children:[(0,b.jsx)(s,{className:"h-5 w-5 shrink-0 text-amber-600"}),(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("p",{className:"font-medium",children:a.settings?.prompts?.caution||"Modify with Caution"}),(0,b.jsx)("p",{className:"text-amber-800/90 text-xs",children:a.settings?.prompts?.warning||"Variables in {{brackets}} are used to inject dynamic content. Please preserve these variables, otherwise the AI providing may fail to get question context or return invalid formats."})]})]})}function bh({config:a,onUpdate:d}){let{t:e}=(0,c.b)(),f=a.prompts?.analyze||bc,g=a.prompts?.similar||bd,h=async a=>{await (0,al.u)(e.settings?.prompts?.resetConfirm||"Are you sure you want to reset to default?",{destructive:!0})&&d(a,"analyze"===a?bc:bd)},i=(a,b)=>{d(a,b)};return(0,b.jsx)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:(0,b.jsxs)(C.i,{defaultValue:"analyze",className:"w-full",children:[(0,b.jsxs)(C.U,{className:"grid w-full grid-cols-2",children:[(0,b.jsx)(C.k,{value:"analyze",children:e.settings?.prompts?.analysisTab||"Analysis Prompt"}),(0,b.jsx)(C.k,{value:"similar",children:e.settings?.prompts?.similarTab||"Similar Question Prompt"})]}),(0,b.jsx)(C.S,{value:"analyze",className:"space-y-4 py-4",children:(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex justify-between items-center",children:[(0,b.jsx)(aa.f,{className:"text-base font-semibold",children:e.settings?.prompts?.customAnalysis||"Custom Analysis Template"}),(0,b.jsxs)(A.f,{variant:"outline",size:"sm",onClick:()=>h("analyze"),children:[(0,b.jsx)(be.f,{className:"w-4 h-4 mr-2"}),e.settings?.prompts?.reset||"Reset Default"]})]}),(0,b.jsx)(bg,{}),(0,b.jsxs)("div",{className:"space-y-2 border rounded-md p-3 bg-background",children:[(0,b.jsxs)("h4",{className:"text-xs font-medium flex items-center gap-1.5 mb-2",children:[(0,b.jsx)(u,{className:"h-3.5 w-3.5"}),e.settings?.prompts?.variables||"Available Variables"]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)(bf,{name:"language_instruction",description:e.settings?.prompts?.vars?.languageInstruction||"Injects instructions based on target language (e.g., keep English questions in English but analysis in Chinese)."}),(0,b.jsx)(bf,{name:"knowledge_points_list",description:e.settings?.prompts?.vars?.knowledgePointsList||"Injects the standard list of knowledge point tags for the specific subject."}),(0,b.jsx)(bf,{name:"provider_hints",description:e.settings?.prompts?.vars?.providerHints||"System-injected hints (e.g., enforcing JSON format)."})]})]}),(0,b.jsx)(a6.f,{value:f,onChange:a=>i("analyze",a.target.value),className:"font-mono text-xs min-h-[400px]",placeholder:bc})]})}),(0,b.jsx)(C.S,{value:"similar",className:"space-y-4 py-4",children:(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex justify-between items-center",children:[(0,b.jsx)(aa.f,{className:"text-base font-semibold",children:e.settings?.prompts?.customSimilar||"Custom Similar Question Template"}),(0,b.jsxs)(A.f,{variant:"outline",size:"sm",onClick:()=>h("similar"),children:[(0,b.jsx)(be.f,{className:"w-4 h-4 mr-2"}),e.settings?.prompts?.reset||"Reset Default"]})]}),(0,b.jsx)(bg,{}),(0,b.jsxs)("div",{className:"space-y-2 border rounded-md p-3 bg-background",children:[(0,b.jsxs)("h4",{className:"text-xs font-medium flex items-center gap-1.5 mb-2",children:[(0,b.jsx)(u,{className:"h-3.5 w-3.5"}),e.settings?.prompts?.variables||"Available Variables"]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)(bf,{name:"difficulty_level",description:e.settings?.prompts?.vars?.difficultyLevel||"Target difficulty level."}),(0,b.jsx)(bf,{name:"difficulty_instruction",description:e.settings?.prompts?.vars?.difficultyInstruction||"Specific writing instructions for the target difficulty."}),(0,b.jsx)(bf,{name:"original_question",description:e.settings?.prompts?.vars?.originalQuestion||"The full text of the original question."}),(0,b.jsx)(bf,{name:"knowledge_points",description:e.settings?.prompts?.vars?.knowledgePoints||"List of knowledge points to test."}),(0,b.jsx)(bf,{name:"language_instruction",description:e.settings?.prompts?.vars?.languageInstructionShort||"Language formatting instructions."})]})]}),(0,b.jsx)(a6.f,{value:g,onChange:a=>i("similar",a.target.value),className:"font-mono text-xs min-h-[400px]",placeholder:bd})]})})]})})}function bi({value:a,icon:c,label:d}){return(0,b.jsxs)(C.k,{value:a,className:"px-2 sm:px-3",children:[c,(0,b.jsx)("span",{className:"hidden sm:inline",children:d})]})}function bj(){let{setTimeZone:a}=(0,e.M)(),{data:f}=(0,d.useSession)(),g=f?.user?.role==="admin",{t:j}=(0,c.b)(),k=(0,h.useRouter)(),[l,m]=(0,r.useState)(!1),n=(0,r.useRef)(null),[o,q]=(0,r.useState)(!1),[E,F]=(0,r.useState)(!1),[G,H]=(0,r.useState)({aiProvider:"minimax"}),I=(0,r.useCallback)(async()=>{F(!0);try{H(await ak.f.get("/api/settings"))}catch(a){am.f.error("[SettingsDialog]","Failed to fetch settings",{error:a})}finally{F(!1)}},[]);(0,r.useEffect)(()=>{l&&I()},[l,I]);let J=async()=>{let b=function(a,b){if(!(0,D.L)(a.timeZone??D.J))return b.settings.general.invalidTimeZone;if("openai"===a.aiProvider)for(let c of a.openai?.instances||[]){if(!c.name?.trim())return b.settings?.ai?.validationNameRequired||"Instance name is required";if(!c.apiKey?.trim())return b.settings?.ai?.validationApiKeyRequired||"API Key is required";if(!c.baseUrl?.trim())return b.settings?.ai?.validationBaseUrlRequired||"Base URL is required";if(!c.model?.trim())return b.settings?.ai?.validationModelRequired||"Model name is required"}if("azure"===a.aiProvider){if(!a.azure?.endpoint?.trim())return b.settings?.ai?.validationAzureEndpointRequired||"Azure Endpoint is required";if(!a.azure?.deploymentName?.trim())return b.settings?.ai?.validationAzureDeploymentRequired||"Deployment Name is required";if(!a.azure?.apiKey?.trim())return b.settings?.ai?.validationApiKeyRequired||"API Key is required"}return null}(G,j);if(b)return void al.c.error(b);q(!0);try{let b=await ak.f.post("/api/settings",G);H(b),a(b.timeZone||D.J),al.c.success(j.settings?.messages?.saved||"Settings saved"),n.current?.scrollTo({top:0,behavior:"smooth"})}catch(a){am.f.error("[SettingsDialog]","Failed to save settings",{error:a}),al.c.error(j.settings?.messages?.saveFailed||"Failed to save")}finally{q(!1)}},K=a=>(0,b.jsxs)(A.f,{onClick:J,disabled:o,className:"w-full",children:[o&&(0,b.jsx)(w.f,{className:"mr-2 h-4 w-4 animate-spin"}),a]});return(0,b.jsxs)(B.N,{open:l,onOpenChange:m,children:[(0,b.jsx)(B.a,{asChild:!0,children:(0,b.jsxs)(A.f,{variant:"ghost",size:"icon",className:"rounded-full",children:[(0,b.jsx)(y,{className:"h-5 w-5"}),(0,b.jsx)("span",{className:"sr-only",children:j.settings?.title||"Settings"})]})}),(0,b.jsxs)(B.d,{ref:n,className:"w-[calc(100vw-2rem)] sm:max-w-[900px] max-h-[85vh] overflow-y-auto",children:[(0,b.jsxs)(B.s,{children:[(0,b.jsx)(B.F,{children:j.settings?.title||"Settings"}),(0,b.jsx)(B.C,{children:j.settings?.desc||"Manage your preferences and data."})]}),(0,b.jsxs)(C.i,{defaultValue:"general",className:"w-full",children:[(0,b.jsxs)(C.U,{className:`grid w-full grid-cols-4 ${g?"sm:grid-cols-7":"sm:grid-cols-4"} gap-1 h-auto`,children:[(0,b.jsx)(bi,{value:"general",icon:(0,b.jsx)(v.f,{className:"h-4 w-4 sm:mr-2"}),label:j.settings?.tabs?.general||"General"}),(0,b.jsx)(bi,{value:"account",icon:(0,b.jsx)(z.f,{className:"h-4 w-4 sm:mr-2"}),label:j.settings?.tabs?.account||"Account"}),g&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(bi,{value:"ai",icon:(0,b.jsx)(t,{className:"h-4 w-4 sm:mr-2"}),label:j.settings?.tabs?.ai||"AI Provider"}),(0,b.jsx)(bi,{value:"prompts",icon:(0,b.jsx)(x,{className:"h-4 w-4 sm:mr-2"}),label:j.settings?.tabs?.prompts||"Prompts"}),(0,b.jsx)(bi,{value:"admin",icon:(0,b.jsx)(p,{className:"h-4 w-4 sm:mr-2"}),label:j.settings?.tabs?.admin||"User Management"})]}),(0,b.jsx)(bi,{value:"danger",icon:(0,b.jsx)(s,{className:"h-4 w-4 sm:mr-2"}),label:j.settings?.tabs?.danger||"Danger"}),(0,b.jsx)(bi,{value:"about",icon:(0,b.jsx)(u,{className:"h-4 w-4 sm:mr-2"}),label:j.settings?.tabs?.about||"About"})]}),(0,b.jsxs)(C.S,{value:"general",className:"space-y-4 py-4",children:[(0,b.jsx)(a5,{config:G,setConfig:H,isAdmin:g,disabled:E||o}),g&&K(j.settings?.save||"Save Settings")]}),(0,b.jsx)(C.S,{value:"account",className:"space-y-4 py-4",children:(0,b.jsx)(aD,{})}),(0,b.jsx)(C.S,{value:"ai",className:"space-y-4 py-4",children:(0,b.jsx)(aT,{config:G,setConfig:H,loading:E,saving:o,onSave:J})}),(0,b.jsxs)(C.S,{value:"prompts",className:"space-y-4 py-4",children:[(0,b.jsx)(bh,{config:G,onUpdate:(a,b)=>H(c=>({...c,prompts:{...c.prompts,[a]:b}}))}),K(j.settings?.prompts?.save||"Save Prompt Settings")]}),g&&(0,b.jsxs)(C.S,{value:"admin",className:"space-y-4 py-4",children:[(0,b.jsxs)(A.f,{variant:"outline",className:"w-full justify-start gap-2",onClick:()=>{m(!1),k.push("/admin")},children:[(0,b.jsx)(i.f,{className:"h-4 w-4"}),j.admin?.dashboard?.title||"Admin Dashboard"]}),(0,b.jsx)("div",{className:"border-t pt-4",children:(0,b.jsx)(ao,{})})]}),(0,b.jsx)(C.S,{value:"danger",className:"space-y-4 py-4",children:(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsx)(a$,{isAdmin:g}),(0,b.jsx)(aW,{isAdmin:g})]})}),(0,b.jsx)(C.S,{value:"about",className:"space-y-4 py-4",children:(0,b.jsx)(ax,{})})]})]})]})}let bk=[/^\/login/,/^\/register/,/^\/print-preview/,/^\/exams\/[^/]+\/print/],bl=[{key:"home",href:"/",icon:o,match:a=>"/"===a},{key:"notebooks",href:"/notebooks",icon:j.f,match:a=>a.startsWith("/notebooks")||a.startsWith("/error-items")||a.startsWith("/practice")},{key:"review",href:"/review",icon:k.f,match:a=>a.startsWith("/review")},{key:"tags",href:"/tags",icon:q,match:a=>a.startsWith("/tags")},{key:"stats",href:"/stats",icon:i.f,match:a=>a.startsWith("/stats")},{key:"exams",href:"/exams",icon:l.f,match:a=>a.startsWith("/exams")}];function bm({children:a}){let e=(0,h.usePathname)()||"/",{t:i}=(0,c.b)(),{data:j,status:k}=(0,d.useSession)();if(bk.some(a=>a.test(e))||"unauthenticated"===k)return(0,b.jsx)(b.Fragment,{children:a});let l=j?.user?.role==="admin",m=j?.user?.name||j?.user?.email||"";return(0,b.jsxs)("div",{className:"min-h-screen",children:[(0,b.jsx)("header",{className:"sticky top-0 z-40 border-b bg-card/80 backdrop-blur-md supports-[backdrop-filter]:bg-card/70 print:hidden",children:(0,b.jsxs)("div",{className:"mx-auto flex h-14 max-w-6xl items-center gap-3 px-4 md:h-16 md:px-8",children:[(0,b.jsxs)(g.default,{href:"/",className:"flex shrink-0 items-center gap-2",children:[(0,b.jsx)(f.default,{src:"/icons/icon.png",alt:"",width:32,height:32,className:"rounded-lg",priority:!0,unoptimized:!0}),(0,b.jsx)("span",{className:"text-base font-semibold tracking-tight",children:i.pageTitle.base})]}),(0,b.jsx)("nav",{className:"ml-4 hidden items-center gap-1 md:flex",children:bl.map(a=>{let c=a.match(e),d=a.icon;return(0,b.jsxs)(g.default,{href:a.href,className:(0,Z.f)("flex items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors",c?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground"),"aria-current":c?"page":void 0,children:[(0,b.jsx)(d,{className:"h-4 w-4"}),i.nav[a.key]]},a.key)})}),(0,b.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[m&&(0,b.jsxs)("span",{className:"mr-2 hidden max-w-40 items-center gap-2 truncate text-sm text-muted-foreground lg:flex",children:[(0,b.jsx)("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-semibold text-primary",children:m.slice(0,1).toUpperCase()}),(0,b.jsx)("span",{className:"truncate",children:m})]}),l&&(0,b.jsx)(g.default,{href:"/admin",title:i.nav.admin,children:(0,b.jsxs)(A.f,{variant:"ghost",size:"icon",className:"rounded-full",children:[(0,b.jsx)(p,{className:"h-5 w-5"}),(0,b.jsx)("span",{className:"sr-only",children:i.nav.admin})]})}),(0,b.jsx)(bj,{}),(0,b.jsx)(A.f,{variant:"ghost",size:"icon",className:"rounded-full text-muted-foreground hover:text-destructive",onClick:()=>(0,d.signOut)({callbackUrl:"/login"}),title:i.app.logout,children:(0,b.jsx)(n,{className:"h-5 w-5"})})]})]})}),(0,b.jsx)("div",{className:"pb-20 md:pb-0",children:a}),(0,b.jsx)("nav",{className:"pb-safe fixed inset-x-0 bottom-0 z-40 border-t bg-card/90 backdrop-blur-md md:hidden print:hidden",children:(0,b.jsx)("div",{className:"grid h-16 grid-cols-6",children:bl.map(a=>{let c=a.match(e),d=a.icon;return(0,b.jsxs)(g.default,{href:a.href,className:(0,Z.f)("flex flex-col items-center justify-center gap-1 text-[11px] font-medium transition-colors",c?"text-primary":"text-muted-foreground"),"aria-current":c?"page":void 0,children:[(0,b.jsx)("span",{className:(0,Z.f)("flex h-7 w-12 items-center justify-center rounded-full transition-colors",c&&"bg-accent"),children:(0,b.jsx)(d,{className:"h-5 w-5"})}),i.nav[a.key]]},a.key)})})})]})}let bn=(0,m.f)("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]),bo=[/^\/login/,/^\/register/,/^\/print-preview/,/^\/exams\/[^/]+\/print/];function bp(){let{t:a}=(0,c.b)(),{timeZone:f}=(0,e.M)(),{status:i}=(0,d.useSession)(),j=(0,h.usePathname)(),[k,l]=(0,r.useState)(!1),[m,n]=(0,r.useState)([]),[o,p]=(0,r.useState)(()=>Date.now()),q="authenticated"!==i||bo.some(a=>a.test(j||"")),s=(0,r.useCallback)(async()=>{if("u"<typeof document||"hidden"!==document.visibilityState)try{let a=await ak.f.get("/api/tasks");n(a.tasks),p(Date.now())}catch{}},[]);if((0,r.useEffect)(()=>{if(q)return;let a=setTimeout(s,0),b=setInterval(s,k?2e3:15e3);return()=>{clearTimeout(a),clearInterval(b)}},[q,k,s]),q)return null;let t=m.filter(a=>"running"===a.status).length,u=m.some(a=>"running"!==a.status),v=async()=>{try{let a=await ak.f.delete("/api/tasks");n(a.tasks)}catch{}};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(A.f,{variant:"outline",size:"icon",className:"fixed bottom-20 right-4 z-40 h-11 w-11 rounded-full shadow-lg md:bottom-6 md:right-6 print:hidden",onClick:()=>l(!0),"aria-label":a.backgroundTasks.title,title:a.backgroundTasks.title,children:[t>0?(0,b.jsx)(w.f,{className:"h-5 w-5 animate-spin"}):(0,b.jsx)(bn,{className:"h-5 w-5"}),t>0&&(0,b.jsx)("span",{className:"absolute -right-1 -top-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1 text-xs text-primary-foreground",children:t})]}),(0,b.jsx)(B.N,{open:k,onOpenChange:l,children:(0,b.jsxs)(B.d,{className:"max-h-[85vh] overflow-y-auto sm:max-w-lg",children:[(0,b.jsxs)(B.s,{children:[(0,b.jsx)(B.F,{children:a.backgroundTasks.title}),(0,b.jsx)(B.C,{children:a.backgroundTasks.description})]}),0===m.length?(0,b.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:a.backgroundTasks.empty}):(0,b.jsx)("ul",{className:"space-y-2",children:m.map(c=>{var d,e;let h;return(0,b.jsx)("li",{className:"rounded-md border p-3 text-sm",children:(0,b.jsxs)("div",{className:"flex items-start gap-2",children:["running"===c.status&&(0,b.jsx)(w.f,{className:"mt-0.5 h-4 w-4 shrink-0 animate-spin text-primary"}),"succeeded"===c.status&&(0,b.jsx)(aE,{className:"mt-0.5 h-4 w-4 shrink-0 text-green-600"}),"failed"===c.status&&(0,b.jsx)(aF.f,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),(0,b.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,b.jsxs)("div",{className:"font-medium",children:[a.backgroundTasks.kinds[c.kind],(0,b.jsxs)("span",{className:"font-normal text-muted-foreground",children:[" · ",a.backgroundTasks.status[c.status]]})]}),c.subject&&(0,b.jsx)("div",{className:"break-words text-muted-foreground",children:c.subject}),c.progress&&c.progress.total>0&&(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("div",{className:"h-1.5 overflow-hidden rounded bg-muted",children:(0,b.jsx)("div",{className:"h-full bg-primary transition-all",style:{width:`${Math.round(c.progress.done/c.progress.total*100)}%`}})}),(0,b.jsxs)("div",{className:"text-xs text-muted-foreground",children:[a.backgroundTasks.progress.replace("{done}",String(c.progress.done)).replace("{total}",String(c.progress.total)),c.progress.failed>0&&` \xb7 ${a.backgroundTasks.failedCount.replace("{count}",String(c.progress.failed))}`]})]}),c.error&&(0,b.jsx)("div",{className:"text-xs text-destructive",children:(b=>{if(!b)return null;let c=a.backgroundTasks.errors[b]??a.errors[b];return"string"==typeof c?c:b})(c.error)}),(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 text-xs text-muted-foreground",children:[(0,b.jsx)("span",{children:a.backgroundTasks.startedAt.replace("{time}",(0,D.r)(c.startedAt,"HH:mm:ss",f))}),(0,b.jsx)("span",{children:a.backgroundTasks.elapsed.replace("{time}",(d=c.startedAt,e=c.finishedAt,h=Math.max(0,Math.round(((e?Date.parse(e):o)-Date.parse(d))/1e3)),`${Math.floor(h/60)}:${String(h%60).padStart(2,"0")}`))}),c.link&&(0,b.jsx)(g.default,{href:c.link,className:"text-primary hover:underline",onClick:()=>l(!1),children:a.backgroundTasks.view})]})]})]})},c.id)})}),(0,b.jsxs)("div",{className:"flex items-center justify-between gap-2 pt-1",children:[(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:a.backgroundTasks.retentionHint}),u&&(0,b.jsx)(A.f,{variant:"ghost",size:"sm",onClick:v,children:a.backgroundTasks.clearFinished})]})]})})]})}var bq=a.i(633508);let br={success:{icon:aE,className:"text-success"},error:{icon:aF.f,className:"text-destructive"},warning:{icon:s,className:"text-warning"},info:{icon:u,className:"text-primary"}};function bs(){let{t:a}=(0,c.b)(),[d,e]=(0,r.useState)([]),[f,g]=(0,r.useState)(null);return(0,r.useEffect)(()=>(0,al.M)(a=>{e(a.toasts),g(a.confirm)}),[]),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"pointer-events-none fixed inset-x-0 top-3 z-[100] flex flex-col items-center gap-2 px-4 print:hidden",role:"status","aria-live":"polite",children:d.map(c=>{let{icon:d,className:e}=br[c.type];return(0,b.jsxs)("div",{className:"pointer-events-auto flex w-full max-w-sm items-start gap-3 rounded-xl border bg-card/95 px-4 py-3 text-sm shadow-lg backdrop-blur animate-in fade-in slide-in-from-top-2 duration-200",children:[(0,b.jsx)(d,{className:(0,Z.f)("mt-0.5 h-4 w-4 shrink-0",e)}),(0,b.jsx)("p",{className:"min-w-0 flex-1 whitespace-pre-line break-words leading-relaxed",children:c.message}),(0,b.jsx)("button",{type:"button",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:text-foreground",onClick:()=>(0,al.p)(c.id),"aria-label":a.common.close,children:(0,b.jsx)(bq.X,{className:"h-3.5 w-3.5"})})]},c.id)})}),(0,b.jsx)(B.N,{open:!!f,onOpenChange:a=>{a||f?.resolve(!1)},children:(0,b.jsxs)(B.d,{className:"sm:max-w-md",children:[(0,b.jsxs)(B.s,{children:[(0,b.jsxs)(B.F,{className:"flex items-center gap-2",children:[f?.destructive&&(0,b.jsx)(s,{className:"h-5 w-5 text-destructive"}),f?.title||a.common.confirmTitle]}),(0,b.jsx)(B.C,{className:"whitespace-pre-line pt-1 text-left leading-relaxed",children:f?.message})]}),(0,b.jsxs)(B.c,{className:"gap-2",children:[(0,b.jsx)(A.f,{variant:"outline",onClick:()=>f?.resolve(!1),children:f?.cancelText||a.common.cancel}),(0,b.jsx)(A.f,{variant:f?.destructive?"destructive":"default",onClick:()=>f?.resolve(!0),autoFocus:!0,children:f?.confirmText||a.common.confirm})]})]})})]})}function bt(){return(0,r.useEffect)(()=>{"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js",{scope:"/"}).catch(a=>{am.f.warn("[PWA]","Service worker registration failed",{error:String(a)})})},[]),null}a.s(["Providers",0,function({children:a,timeZone:f}){return(0,b.jsx)(d.SessionProvider,{children:(0,b.jsx)(c.w,{children:(0,b.jsxs)(e.n,{initialTimeZone:f,children:[(0,b.jsx)(bm,{children:a}),(0,b.jsx)(bp,{}),(0,b.jsx)(bs,{}),(0,b.jsx)(bt,{})]})})})}],418175)}];
191
+ {{provider_hints}}`;var bi=a.i(787654);function bj({name:a,description:c}){return(0,b.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start gap-1 sm:gap-2 text-xs py-1",children:[(0,b.jsx)("code",{className:"bg-muted px-1.5 py-0.5 rounded font-mono text-primary shrink-0 w-fit",children:`{{${a}}}`}),(0,b.jsx)("span",{className:"text-muted-foreground",children:c})]})}function bk(){let{t:a}=(0,c.b)();return(0,b.jsxs)("div",{className:"bg-amber-50 border border-amber-200 rounded-md p-3 flex items-start gap-3 text-amber-900 text-sm mb-4",children:[(0,b.jsx)(s,{className:"h-5 w-5 shrink-0 text-amber-600"}),(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("p",{className:"font-medium",children:a.settings?.prompts?.caution||"Modify with Caution"}),(0,b.jsx)("p",{className:"text-amber-800/90 text-xs",children:a.settings?.prompts?.warning||"Variables in {{brackets}} are used to inject dynamic content. Please preserve these variables, otherwise the AI providing may fail to get question context or return invalid formats."})]})]})}function bl({config:a,onUpdate:d}){let{t:e}=(0,c.b)(),f=a.prompts?.analyze||bg,g=a.prompts?.similar||bh,h=async a=>{await (0,al.u)(e.settings?.prompts?.resetConfirm||"Are you sure you want to reset to default?",{destructive:!0})&&d(a,"analyze"===a?bg:bh)},i=(a,b)=>{d(a,b)};return(0,b.jsx)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:(0,b.jsxs)(C.i,{defaultValue:"analyze",className:"w-full",children:[(0,b.jsxs)(C.U,{className:"grid w-full grid-cols-2",children:[(0,b.jsx)(C.k,{value:"analyze",children:e.settings?.prompts?.analysisTab||"Analysis Prompt"}),(0,b.jsx)(C.k,{value:"similar",children:e.settings?.prompts?.similarTab||"Similar Question Prompt"})]}),(0,b.jsx)(C.S,{value:"analyze",className:"space-y-4 py-4",children:(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex justify-between items-center",children:[(0,b.jsx)(aa.f,{className:"text-base font-semibold",children:e.settings?.prompts?.customAnalysis||"Custom Analysis Template"}),(0,b.jsxs)(A.f,{variant:"outline",size:"sm",onClick:()=>h("analyze"),children:[(0,b.jsx)(bi.f,{className:"w-4 h-4 mr-2"}),e.settings?.prompts?.reset||"Reset Default"]})]}),(0,b.jsx)(bk,{}),(0,b.jsxs)("div",{className:"space-y-2 border rounded-md p-3 bg-background",children:[(0,b.jsxs)("h4",{className:"text-xs font-medium flex items-center gap-1.5 mb-2",children:[(0,b.jsx)(u,{className:"h-3.5 w-3.5"}),e.settings?.prompts?.variables||"Available Variables"]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)(bj,{name:"language_instruction",description:e.settings?.prompts?.vars?.languageInstruction||"Injects instructions based on target language (e.g., keep English questions in English but analysis in Chinese)."}),(0,b.jsx)(bj,{name:"knowledge_points_list",description:e.settings?.prompts?.vars?.knowledgePointsList||"Injects the standard list of knowledge point tags for the specific subject."}),(0,b.jsx)(bj,{name:"provider_hints",description:e.settings?.prompts?.vars?.providerHints||"System-injected hints (e.g., enforcing JSON format)."})]})]}),(0,b.jsx)(ba.f,{value:f,onChange:a=>i("analyze",a.target.value),className:"font-mono text-xs min-h-[400px]",placeholder:bg})]})}),(0,b.jsx)(C.S,{value:"similar",className:"space-y-4 py-4",children:(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex justify-between items-center",children:[(0,b.jsx)(aa.f,{className:"text-base font-semibold",children:e.settings?.prompts?.customSimilar||"Custom Similar Question Template"}),(0,b.jsxs)(A.f,{variant:"outline",size:"sm",onClick:()=>h("similar"),children:[(0,b.jsx)(bi.f,{className:"w-4 h-4 mr-2"}),e.settings?.prompts?.reset||"Reset Default"]})]}),(0,b.jsx)(bk,{}),(0,b.jsxs)("div",{className:"space-y-2 border rounded-md p-3 bg-background",children:[(0,b.jsxs)("h4",{className:"text-xs font-medium flex items-center gap-1.5 mb-2",children:[(0,b.jsx)(u,{className:"h-3.5 w-3.5"}),e.settings?.prompts?.variables||"Available Variables"]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)(bj,{name:"difficulty_level",description:e.settings?.prompts?.vars?.difficultyLevel||"Target difficulty level."}),(0,b.jsx)(bj,{name:"difficulty_instruction",description:e.settings?.prompts?.vars?.difficultyInstruction||"Specific writing instructions for the target difficulty."}),(0,b.jsx)(bj,{name:"original_question",description:e.settings?.prompts?.vars?.originalQuestion||"The full text of the original question."}),(0,b.jsx)(bj,{name:"knowledge_points",description:e.settings?.prompts?.vars?.knowledgePoints||"List of knowledge points to test."}),(0,b.jsx)(bj,{name:"language_instruction",description:e.settings?.prompts?.vars?.languageInstructionShort||"Language formatting instructions."})]})]}),(0,b.jsx)(ba.f,{value:g,onChange:a=>i("similar",a.target.value),className:"font-mono text-xs min-h-[400px]",placeholder:bh})]})})]})})}function bm({value:a,icon:c,label:d}){return(0,b.jsxs)(C.k,{value:a,className:"px-2 sm:px-3",children:[c,(0,b.jsx)("span",{className:"hidden sm:inline",children:d})]})}function bn(){let{setTimeZone:a}=(0,e.M)(),{data:f}=(0,d.useSession)(),g=f?.user?.role==="admin",{t:j}=(0,c.b)(),k=(0,h.useRouter)(),[l,m]=(0,r.useState)(!1),n=(0,r.useRef)(null),[o,q]=(0,r.useState)(!1),[E,F]=(0,r.useState)(!1),[G,H]=(0,r.useState)({aiProvider:"minimax"}),I=(0,r.useCallback)(async()=>{F(!0);try{H(await ak.f.get("/api/settings"))}catch(a){am.f.error("[SettingsDialog]","Failed to fetch settings",{error:a})}finally{F(!1)}},[]);(0,r.useEffect)(()=>{l&&I()},[l,I]);let J=async()=>{let b=function(a,b){if(!(0,D.L)(a.timeZone??D.J))return b.settings.general.invalidTimeZone;if("openai"===a.aiProvider)for(let c of a.openai?.instances||[]){if(!c.name?.trim())return b.settings?.ai?.validationNameRequired||"Instance name is required";if(!c.apiKey?.trim())return b.settings?.ai?.validationApiKeyRequired||"API Key is required";if(!c.baseUrl?.trim())return b.settings?.ai?.validationBaseUrlRequired||"Base URL is required";if(!c.model?.trim())return b.settings?.ai?.validationModelRequired||"Model name is required"}if("azure"===a.aiProvider){if(!a.azure?.endpoint?.trim())return b.settings?.ai?.validationAzureEndpointRequired||"Azure Endpoint is required";if(!a.azure?.deploymentName?.trim())return b.settings?.ai?.validationAzureDeploymentRequired||"Deployment Name is required";if(!a.azure?.apiKey?.trim())return b.settings?.ai?.validationApiKeyRequired||"API Key is required"}return null}(G,j);if(b)return void al.c.error(b);q(!0);try{let b=await ak.f.post("/api/settings",G);H(b),a(b.timeZone||D.J),al.c.success(j.settings?.messages?.saved||"Settings saved"),n.current?.scrollTo({top:0,behavior:"smooth"})}catch(a){am.f.error("[SettingsDialog]","Failed to save settings",{error:a}),al.c.error(j.settings?.messages?.saveFailed||"Failed to save")}finally{q(!1)}},K=a=>(0,b.jsxs)(A.f,{onClick:J,disabled:o,className:"w-full",children:[o&&(0,b.jsx)(w.f,{className:"mr-2 h-4 w-4 animate-spin"}),a]});return(0,b.jsxs)(B.N,{open:l,onOpenChange:m,children:[(0,b.jsx)(B.a,{asChild:!0,children:(0,b.jsxs)(A.f,{variant:"ghost",size:"icon",className:"rounded-full",children:[(0,b.jsx)(y,{className:"h-5 w-5"}),(0,b.jsx)("span",{className:"sr-only",children:j.settings?.title||"Settings"})]})}),(0,b.jsxs)(B.d,{ref:n,className:"w-[calc(100vw-2rem)] sm:max-w-[900px] max-h-[85vh] overflow-y-auto",children:[(0,b.jsxs)(B.s,{children:[(0,b.jsx)(B.F,{children:j.settings?.title||"Settings"}),(0,b.jsx)(B.C,{children:j.settings?.desc||"Manage your preferences and data."})]}),(0,b.jsxs)(C.i,{defaultValue:"general",className:"w-full",children:[(0,b.jsxs)(C.U,{className:`grid w-full grid-cols-4 ${g?"sm:grid-cols-7":"sm:grid-cols-4"} gap-1 h-auto`,children:[(0,b.jsx)(bm,{value:"general",icon:(0,b.jsx)(v.f,{className:"h-4 w-4 sm:mr-2"}),label:j.settings?.tabs?.general||"General"}),(0,b.jsx)(bm,{value:"account",icon:(0,b.jsx)(z.f,{className:"h-4 w-4 sm:mr-2"}),label:j.settings?.tabs?.account||"Account"}),g&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(bm,{value:"ai",icon:(0,b.jsx)(t,{className:"h-4 w-4 sm:mr-2"}),label:j.settings?.tabs?.ai||"AI Provider"}),(0,b.jsx)(bm,{value:"prompts",icon:(0,b.jsx)(x,{className:"h-4 w-4 sm:mr-2"}),label:j.settings?.tabs?.prompts||"Prompts"}),(0,b.jsx)(bm,{value:"admin",icon:(0,b.jsx)(p,{className:"h-4 w-4 sm:mr-2"}),label:j.settings?.tabs?.admin||"User Management"})]}),(0,b.jsx)(bm,{value:"danger",icon:(0,b.jsx)(s,{className:"h-4 w-4 sm:mr-2"}),label:j.settings?.tabs?.danger||"Danger"}),(0,b.jsx)(bm,{value:"about",icon:(0,b.jsx)(u,{className:"h-4 w-4 sm:mr-2"}),label:j.settings?.tabs?.about||"About"})]}),(0,b.jsxs)(C.S,{value:"general",className:"space-y-4 py-4",children:[(0,b.jsx)(a9,{config:G,setConfig:H,isAdmin:g,disabled:E||o}),g&&K(j.settings?.save||"Save Settings")]}),(0,b.jsx)(C.S,{value:"account",className:"space-y-4 py-4",children:(0,b.jsx)(aD,{})}),(0,b.jsx)(C.S,{value:"ai",className:"space-y-4 py-4",children:(0,b.jsx)(aX,{config:G,setConfig:H,loading:E,saving:o,onSave:J})}),(0,b.jsxs)(C.S,{value:"prompts",className:"space-y-4 py-4",children:[(0,b.jsx)(bl,{config:G,onUpdate:(a,b)=>H(c=>({...c,prompts:{...c.prompts,[a]:b}}))}),K(j.settings?.prompts?.save||"Save Prompt Settings")]}),g&&(0,b.jsxs)(C.S,{value:"admin",className:"space-y-4 py-4",children:[(0,b.jsxs)(A.f,{variant:"outline",className:"w-full justify-start gap-2",onClick:()=>{m(!1),k.push("/admin")},children:[(0,b.jsx)(i.f,{className:"h-4 w-4"}),j.admin?.dashboard?.title||"Admin Dashboard"]}),(0,b.jsx)("div",{className:"border-t pt-4",children:(0,b.jsx)(ao,{})})]}),(0,b.jsx)(C.S,{value:"danger",className:"space-y-4 py-4",children:(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsx)(a2,{isAdmin:g}),(0,b.jsx)(a$,{isAdmin:g})]})}),(0,b.jsx)(C.S,{value:"about",className:"space-y-4 py-4",children:(0,b.jsx)(ax,{})})]})]})]})}let bo=[/^\/login/,/^\/register/,/^\/print-preview/,/^\/exams\/[^/]+\/print/],bp=[{key:"home",href:"/",icon:o,match:a=>"/"===a},{key:"notebooks",href:"/notebooks",icon:j.f,match:a=>a.startsWith("/notebooks")||a.startsWith("/error-items")||a.startsWith("/practice")},{key:"review",href:"/review",icon:k.f,match:a=>a.startsWith("/review")},{key:"tags",href:"/tags",icon:q,match:a=>a.startsWith("/tags")},{key:"stats",href:"/stats",icon:i.f,match:a=>a.startsWith("/stats")},{key:"exams",href:"/exams",icon:l.f,match:a=>a.startsWith("/exams")}];function bq({children:a}){let e=(0,h.usePathname)()||"/",{t:i}=(0,c.b)(),{data:j,status:k}=(0,d.useSession)();if(bo.some(a=>a.test(e))||"unauthenticated"===k)return(0,b.jsx)(b.Fragment,{children:a});let l=j?.user?.role==="admin",m=j?.user?.name||j?.user?.email||"";return(0,b.jsxs)("div",{className:"min-h-screen",children:[(0,b.jsx)("header",{className:"sticky top-0 z-40 border-b bg-card/80 backdrop-blur-md supports-[backdrop-filter]:bg-card/70 print:hidden",children:(0,b.jsxs)("div",{className:"mx-auto flex h-14 max-w-6xl items-center gap-3 px-4 md:h-16 md:px-8",children:[(0,b.jsxs)(g.default,{href:"/",className:"flex shrink-0 items-center gap-2",children:[(0,b.jsx)(f.default,{src:"/icons/icon.png",alt:"",width:32,height:32,className:"rounded-lg",priority:!0,unoptimized:!0}),(0,b.jsx)("span",{className:"text-base font-semibold tracking-tight",children:i.pageTitle.base})]}),(0,b.jsx)("nav",{className:"ml-4 hidden items-center gap-1 md:flex",children:bp.map(a=>{let c=a.match(e),d=a.icon;return(0,b.jsxs)(g.default,{href:a.href,className:(0,Z.f)("flex items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors",c?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground"),"aria-current":c?"page":void 0,children:[(0,b.jsx)(d,{className:"h-4 w-4"}),i.nav[a.key]]},a.key)})}),(0,b.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[m&&(0,b.jsxs)("span",{className:"mr-2 hidden max-w-40 items-center gap-2 truncate text-sm text-muted-foreground lg:flex",children:[(0,b.jsx)("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-semibold text-primary",children:m.slice(0,1).toUpperCase()}),(0,b.jsx)("span",{className:"truncate",children:m})]}),l&&(0,b.jsx)(g.default,{href:"/admin",title:i.nav.admin,children:(0,b.jsxs)(A.f,{variant:"ghost",size:"icon",className:"rounded-full",children:[(0,b.jsx)(p,{className:"h-5 w-5"}),(0,b.jsx)("span",{className:"sr-only",children:i.nav.admin})]})}),(0,b.jsx)(bn,{}),(0,b.jsx)(A.f,{variant:"ghost",size:"icon",className:"rounded-full text-muted-foreground hover:text-destructive",onClick:()=>(0,d.signOut)({callbackUrl:"/login"}),title:i.app.logout,children:(0,b.jsx)(n,{className:"h-5 w-5"})})]})]})}),(0,b.jsx)("div",{className:"pb-20 md:pb-0",children:a}),(0,b.jsx)("nav",{className:"pb-safe fixed inset-x-0 bottom-0 z-40 border-t bg-card/90 backdrop-blur-md md:hidden print:hidden",children:(0,b.jsx)("div",{className:"grid h-16 grid-cols-6",children:bp.map(a=>{let c=a.match(e),d=a.icon;return(0,b.jsxs)(g.default,{href:a.href,className:(0,Z.f)("flex flex-col items-center justify-center gap-1 text-[11px] font-medium transition-colors",c?"text-primary":"text-muted-foreground"),"aria-current":c?"page":void 0,children:[(0,b.jsx)("span",{className:(0,Z.f)("flex h-7 w-12 items-center justify-center rounded-full transition-colors",c&&"bg-accent"),children:(0,b.jsx)(d,{className:"h-5 w-5"})}),i.nav[a.key]]},a.key)})})})]})}let br=(0,m.f)("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]),bs=[/^\/login/,/^\/register/,/^\/print-preview/,/^\/exams\/[^/]+\/print/];function bt(){let{t:a}=(0,c.b)(),{timeZone:f}=(0,e.M)(),{status:i}=(0,d.useSession)(),j=(0,h.usePathname)(),[k,l]=(0,r.useState)(!1),[m,n]=(0,r.useState)([]),[o,p]=(0,r.useState)(()=>Date.now()),q="authenticated"!==i||bs.some(a=>a.test(j||"")),s=(0,r.useCallback)(async()=>{if("u"<typeof document||"hidden"!==document.visibilityState)try{let a=await ak.f.get("/api/tasks");n(a.tasks),p(Date.now())}catch{}},[]);if((0,r.useEffect)(()=>{if(q)return;let a=setTimeout(s,0),b=setInterval(s,k?2e3:15e3);return()=>{clearTimeout(a),clearInterval(b)}},[q,k,s]),q)return null;let t=m.filter(a=>"running"===a.status).length,u=m.some(a=>"running"!==a.status),v=async()=>{try{let a=await ak.f.delete("/api/tasks");n(a.tasks)}catch{}};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(A.f,{variant:"outline",size:"icon",className:"fixed bottom-20 right-4 z-40 h-11 w-11 rounded-full shadow-lg md:bottom-6 md:right-6 print:hidden",onClick:()=>l(!0),"aria-label":a.backgroundTasks.title,title:a.backgroundTasks.title,children:[t>0?(0,b.jsx)(w.f,{className:"h-5 w-5 animate-spin"}):(0,b.jsx)(br,{className:"h-5 w-5"}),t>0&&(0,b.jsx)("span",{className:"absolute -right-1 -top-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1 text-xs text-primary-foreground",children:t})]}),(0,b.jsx)(B.N,{open:k,onOpenChange:l,children:(0,b.jsxs)(B.d,{className:"max-h-[85vh] overflow-y-auto sm:max-w-lg",children:[(0,b.jsxs)(B.s,{children:[(0,b.jsx)(B.F,{children:a.backgroundTasks.title}),(0,b.jsx)(B.C,{children:a.backgroundTasks.description})]}),0===m.length?(0,b.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:a.backgroundTasks.empty}):(0,b.jsx)("ul",{className:"space-y-2",children:m.map(c=>{var d,e;let h;return(0,b.jsx)("li",{className:"rounded-md border p-3 text-sm",children:(0,b.jsxs)("div",{className:"flex items-start gap-2",children:["running"===c.status&&(0,b.jsx)(w.f,{className:"mt-0.5 h-4 w-4 shrink-0 animate-spin text-primary"}),"succeeded"===c.status&&(0,b.jsx)(aE,{className:"mt-0.5 h-4 w-4 shrink-0 text-green-600"}),"failed"===c.status&&(0,b.jsx)(aF.f,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),(0,b.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,b.jsxs)("div",{className:"font-medium",children:[a.backgroundTasks.kinds[c.kind],(0,b.jsxs)("span",{className:"font-normal text-muted-foreground",children:[" · ",a.backgroundTasks.status[c.status]]})]}),c.subject&&(0,b.jsx)("div",{className:"break-words text-muted-foreground",children:c.subject}),c.progress&&c.progress.total>0&&(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("div",{className:"h-1.5 overflow-hidden rounded bg-muted",children:(0,b.jsx)("div",{className:"h-full bg-primary transition-all",style:{width:`${Math.round(c.progress.done/c.progress.total*100)}%`}})}),(0,b.jsxs)("div",{className:"text-xs text-muted-foreground",children:[a.backgroundTasks.progress.replace("{done}",String(c.progress.done)).replace("{total}",String(c.progress.total)),c.progress.failed>0&&` \xb7 ${a.backgroundTasks.failedCount.replace("{count}",String(c.progress.failed))}`]})]}),c.error&&(0,b.jsx)("div",{className:"text-xs text-destructive",children:(b=>{if(!b)return null;let c=a.backgroundTasks.errors[b]??a.errors[b];return"string"==typeof c?c:b})(c.error)}),(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 text-xs text-muted-foreground",children:[(0,b.jsx)("span",{children:a.backgroundTasks.startedAt.replace("{time}",(0,D.r)(c.startedAt,"HH:mm:ss",f))}),(0,b.jsx)("span",{children:a.backgroundTasks.elapsed.replace("{time}",(d=c.startedAt,e=c.finishedAt,h=Math.max(0,Math.round(((e?Date.parse(e):o)-Date.parse(d))/1e3)),`${Math.floor(h/60)}:${String(h%60).padStart(2,"0")}`))}),c.link&&(0,b.jsx)(g.default,{href:c.link,className:"text-primary hover:underline",onClick:()=>l(!1),children:a.backgroundTasks.view})]})]})]})},c.id)})}),(0,b.jsxs)("div",{className:"flex items-center justify-between gap-2 pt-1",children:[(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:a.backgroundTasks.retentionHint}),u&&(0,b.jsx)(A.f,{variant:"ghost",size:"sm",onClick:v,children:a.backgroundTasks.clearFinished})]})]})})]})}var bu=a.i(633508);let bv={success:{icon:aE,className:"text-success"},error:{icon:aF.f,className:"text-destructive"},warning:{icon:s,className:"text-warning"},info:{icon:u,className:"text-primary"}};function bw(){let{t:a}=(0,c.b)(),[d,e]=(0,r.useState)([]),[f,g]=(0,r.useState)(null);return(0,r.useEffect)(()=>(0,al.M)(a=>{e(a.toasts),g(a.confirm)}),[]),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"pointer-events-none fixed inset-x-0 top-3 z-[100] flex flex-col items-center gap-2 px-4 print:hidden",role:"status","aria-live":"polite",children:d.map(c=>{let{icon:d,className:e}=bv[c.type];return(0,b.jsxs)("div",{className:"pointer-events-auto flex w-full max-w-sm items-start gap-3 rounded-xl border bg-card/95 px-4 py-3 text-sm shadow-lg backdrop-blur animate-in fade-in slide-in-from-top-2 duration-200",children:[(0,b.jsx)(d,{className:(0,Z.f)("mt-0.5 h-4 w-4 shrink-0",e)}),(0,b.jsx)("p",{className:"min-w-0 flex-1 whitespace-pre-line break-words leading-relaxed",children:c.message}),(0,b.jsx)("button",{type:"button",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:text-foreground",onClick:()=>(0,al.p)(c.id),"aria-label":a.common.close,children:(0,b.jsx)(bu.X,{className:"h-3.5 w-3.5"})})]},c.id)})}),(0,b.jsx)(B.N,{open:!!f,onOpenChange:a=>{a||f?.resolve(!1)},children:(0,b.jsxs)(B.d,{className:"sm:max-w-md",children:[(0,b.jsxs)(B.s,{children:[(0,b.jsxs)(B.F,{className:"flex items-center gap-2",children:[f?.destructive&&(0,b.jsx)(s,{className:"h-5 w-5 text-destructive"}),f?.title||a.common.confirmTitle]}),(0,b.jsx)(B.C,{className:"whitespace-pre-line pt-1 text-left leading-relaxed",children:f?.message})]}),(0,b.jsxs)(B.c,{className:"gap-2",children:[(0,b.jsx)(A.f,{variant:"outline",onClick:()=>f?.resolve(!1),children:f?.cancelText||a.common.cancel}),(0,b.jsx)(A.f,{variant:f?.destructive?"destructive":"default",onClick:()=>f?.resolve(!0),autoFocus:!0,children:f?.confirmText||a.common.confirm})]})]})})]})}function bx(){return(0,r.useEffect)(()=>{"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js",{scope:"/"}).catch(a=>{am.f.warn("[PWA]","Service worker registration failed",{error:String(a)})})},[]),null}a.s(["Providers",0,function({children:a,timeZone:f}){return(0,b.jsx)(d.SessionProvider,{children:(0,b.jsx)(c.w,{children:(0,b.jsxs)(e.n,{initialTimeZone:f,children:[(0,b.jsx)(bq,{children:a}),(0,b.jsx)(bt,{}),(0,b.jsx)(bw,{}),(0,b.jsx)(bx,{})]})})})}],418175)}];
192
192
 
193
193
  //# sourceMappingURL=src_components_providers_tsx_09kw-mv3nb6xs._.js.map
@@ -1,4 +1,4 @@
1
1
  var R=require("./chunks/[turbopack]_runtime.js")("server/instrumentation.js")
2
- R.c("server/chunks/src_0tzpy5j8n_1bx._.js")
2
+ R.c("server/chunks/src_03_og0nynnyx2._.js")
3
3
  R.m(397998)
4
4
  module.exports=R.m(397998).exports
@@ -7,9 +7,9 @@ globalThis.__BUILD_MANIFEST = {
7
7
  "static/chunks/0cz1d0mv5g_q7.js"
8
8
  ],
9
9
  "lowPriorityFiles": [
10
- "static/ZH3ew12HOzoE3JRl8c_8L/_buildManifest.js",
11
- "static/ZH3ew12HOzoE3JRl8c_8L/_ssgManifest.js",
12
- "static/ZH3ew12HOzoE3JRl8c_8L/_clientMiddlewareManifest.js"
10
+ "static/5uNP139l0DCSagwPDMOvD/_buildManifest.js",
11
+ "static/5uNP139l0DCSagwPDMOvD/_ssgManifest.js",
12
+ "static/5uNP139l0DCSagwPDMOvD/_clientMiddlewareManifest.js"
13
13
  ],
14
14
  "rootMainFiles": [
15
15
  "static/chunks/093w4w_19h9qh.js",
@@ -21,11 +21,11 @@
21
21
  "wasm": [],
22
22
  "assets": [],
23
23
  "env": {
24
- "__NEXT_BUILD_ID": "ZH3ew12HOzoE3JRl8c_8L",
25
- "NEXT_SERVER_ACTIONS_ENCRYPTION_KEY": "LZsm0CLj2k0e9DZIlL/xkU1++EvMUpvPLUB63bN8MiQ=",
26
- "__NEXT_PREVIEW_MODE_ID": "eeace75d2dbe6a548b19ef2c1e2edc29",
27
- "__NEXT_PREVIEW_MODE_ENCRYPTION_KEY": "5c9ec93e80a37e2eed42ff35e41f5ece3002b5de9c9e46003e6a5b50071e8c08",
28
- "__NEXT_PREVIEW_MODE_SIGNING_KEY": "f1accebdf9ac5f9b5a1d82bbc95e90ffa61c4f9adc1f939daf96b253b891f3cc"
24
+ "__NEXT_BUILD_ID": "5uNP139l0DCSagwPDMOvD",
25
+ "NEXT_SERVER_ACTIONS_ENCRYPTION_KEY": "+OsLY7pumyY5Z5lz22+Sq0Ve+RcWu6z5RzLNCuyHUzc=",
26
+ "__NEXT_PREVIEW_MODE_ID": "79fb983317562e6e57746100cf56c431",
27
+ "__NEXT_PREVIEW_MODE_ENCRYPTION_KEY": "5fa9db3fde8c8693795703bc54317ebdb1568db705f8fe9386608d2c5ad0280a",
28
+ "__NEXT_PREVIEW_MODE_SIGNING_KEY": "539dded85522da59b0939a3c8035d63b7e77b8eedb50892712f0c11d6037a728"
29
29
  }
30
30
  }
31
31
  },