wrong-notebook 2026.10.26 → 2026.10.30-1

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 (297) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +1 -0
  3. package/.next/build-manifest.json +3 -3
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/routes-manifest.json +8 -0
  6. package/.next/server/app/_global-error.html +1 -1
  7. package/.next/server/app/_global-error.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  11. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  12. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  13. package/.next/server/app/admin/page.js.nft.json +1 -1
  14. package/.next/server/app/admin/page_client-reference-manifest.js +1 -1
  15. package/.next/server/app/admin/user/[id]/page.js.nft.json +1 -1
  16. package/.next/server/app/admin/user/[id]/page_client-reference-manifest.js +1 -1
  17. package/.next/server/app/api/admin/dashboard/route.js +4 -4
  18. package/.next/server/app/api/admin/dashboard/route.js.nft.json +1 -1
  19. package/.next/server/app/api/admin/migrate-tags/route.js.nft.json +1 -1
  20. package/.next/server/app/api/admin/system-reset/route.js.nft.json +1 -1
  21. package/.next/server/app/api/admin/users/[id]/detail/route.js +4 -4
  22. package/.next/server/app/api/admin/users/[id]/detail/route.js.nft.json +1 -1
  23. package/.next/server/app/api/admin/users/[id]/route.js.nft.json +1 -1
  24. package/.next/server/app/api/admin/users/route.js.nft.json +1 -1
  25. package/.next/server/app/api/ai/models/route.js +3 -3
  26. package/.next/server/app/api/ai/models/route.js.nft.json +1 -1
  27. package/.next/server/app/api/ai/test/route.js +7 -7
  28. package/.next/server/app/api/ai/test/route.js.nft.json +1 -1
  29. package/.next/server/app/api/analytics/route.js +11 -2
  30. package/.next/server/app/api/analytics/route.js.nft.json +1 -1
  31. package/.next/server/app/api/analyze/route.js +6 -6
  32. package/.next/server/app/api/analyze/route.js.nft.json +1 -1
  33. package/.next/server/app/api/auth/[...nextauth]/route.js.nft.json +1 -1
  34. package/.next/server/app/api/error-items/[id]/delete/route.js.nft.json +1 -1
  35. package/.next/server/app/api/error-items/[id]/figure/route.js +5 -5
  36. package/.next/server/app/api/error-items/[id]/figure/route.js.nft.json +1 -1
  37. package/.next/server/app/api/error-items/[id]/fix-latex/route.js +5 -5
  38. package/.next/server/app/api/error-items/[id]/fix-latex/route.js.nft.json +1 -1
  39. package/.next/server/app/api/error-items/[id]/geogebra/route.js +4 -4
  40. package/.next/server/app/api/error-items/[id]/geogebra/route.js.nft.json +1 -1
  41. package/.next/server/app/api/error-items/[id]/image/route.js.nft.json +1 -1
  42. package/.next/server/app/api/error-items/[id]/notes/route.js.nft.json +1 -1
  43. package/.next/server/app/api/error-items/[id]/practice-records/route.js.nft.json +1 -1
  44. package/.next/server/app/api/error-items/[id]/reanswer/route.js +5 -5
  45. package/.next/server/app/api/error-items/[id]/reanswer/route.js.nft.json +1 -1
  46. package/.next/server/app/api/error-items/[id]/retag/route.js +4 -4
  47. package/.next/server/app/api/error-items/[id]/retag/route.js.nft.json +1 -1
  48. package/.next/server/app/api/error-items/[id]/route.js.nft.json +1 -1
  49. package/.next/server/app/api/error-items/[id]/svg-animation/narration/route/app-paths-manifest.json +3 -0
  50. package/.next/server/app/api/error-items/[id]/svg-animation/narration/route/build-manifest.json +12 -0
  51. package/.next/server/app/api/error-items/[id]/svg-animation/narration/route/server-reference-manifest.json +4 -0
  52. package/.next/server/app/api/error-items/[id]/svg-animation/narration/route.js +21 -0
  53. package/.next/server/app/api/error-items/[id]/svg-animation/narration/route.js.map +5 -0
  54. package/.next/server/app/api/error-items/[id]/svg-animation/narration/route.js.nft.json +1 -0
  55. package/.next/server/app/api/error-items/[id]/svg-animation/narration/route_client-reference-manifest.js +3 -0
  56. package/.next/server/app/api/error-items/[id]/svg-animation/route.js +5 -5
  57. package/.next/server/app/api/error-items/[id]/svg-animation/route.js.nft.json +1 -1
  58. package/.next/server/app/api/error-items/batch-delete/route.js.nft.json +1 -1
  59. package/.next/server/app/api/error-items/clear/route.js.nft.json +1 -1
  60. package/.next/server/app/api/error-items/list/route.js.nft.json +1 -1
  61. package/.next/server/app/api/error-items/route.js +5 -5
  62. package/.next/server/app/api/error-items/route.js.nft.json +1 -1
  63. package/.next/server/app/api/error-items/short/[shortId]/route.js.nft.json +1 -1
  64. package/.next/server/app/api/error-items/similarity/route.js.nft.json +1 -1
  65. package/.next/server/app/api/exams/[id]/questions/[questionId]/regenerate/route.js +14 -13
  66. package/.next/server/app/api/exams/[id]/questions/[questionId]/regenerate/route.js.nft.json +1 -1
  67. package/.next/server/app/api/exams/[id]/results/route.js +8 -8
  68. package/.next/server/app/api/exams/[id]/results/route.js.nft.json +1 -1
  69. package/.next/server/app/api/exams/[id]/retry/route.js +14 -13
  70. package/.next/server/app/api/exams/[id]/retry/route.js.nft.json +1 -1
  71. package/.next/server/app/api/exams/[id]/route.js +12 -11
  72. package/.next/server/app/api/exams/[id]/route.js.nft.json +1 -1
  73. package/.next/server/app/api/exams/route.js +11 -10
  74. package/.next/server/app/api/exams/route.js.nft.json +1 -1
  75. package/.next/server/app/api/export/route.js.nft.json +1 -1
  76. package/.next/server/app/api/geogebra-analyze/route.js +5 -5
  77. package/.next/server/app/api/geogebra-analyze/route.js.nft.json +1 -1
  78. package/.next/server/app/api/health/route.js.nft.json +1 -1
  79. package/.next/server/app/api/import/route.js +10 -10
  80. package/.next/server/app/api/import/route.js.nft.json +1 -1
  81. package/.next/server/app/api/logs/frontend/route.js.nft.json +1 -1
  82. package/.next/server/app/api/minimax-code/checkin/route.js.nft.json +1 -1
  83. package/.next/server/app/api/minimax-code/login/route.js.nft.json +1 -1
  84. package/.next/server/app/api/minimax-code/route.js.nft.json +1 -1
  85. package/.next/server/app/api/notebooks/[id]/retag/route.js +6 -6
  86. package/.next/server/app/api/notebooks/[id]/retag/route.js.nft.json +1 -1
  87. package/.next/server/app/api/notebooks/[id]/route.js.nft.json +1 -1
  88. package/.next/server/app/api/notebooks/route.js.nft.json +1 -1
  89. package/.next/server/app/api/openclaw/batch-upload/route.js +11 -11
  90. package/.next/server/app/api/openclaw/batch-upload/route.js.nft.json +1 -1
  91. package/.next/server/app/api/practice/generate/route.js +4 -4
  92. package/.next/server/app/api/practice/generate/route.js.nft.json +1 -1
  93. package/.next/server/app/api/practice/grade/route.js +4 -4
  94. package/.next/server/app/api/practice/grade/route.js.nft.json +1 -1
  95. package/.next/server/app/api/practice/record/[id]/route.js +7 -7
  96. package/.next/server/app/api/practice/record/[id]/route.js.nft.json +1 -1
  97. package/.next/server/app/api/practice/record/route.js +4 -4
  98. package/.next/server/app/api/practice/record/route.js.nft.json +1 -1
  99. package/.next/server/app/api/reanswer/route.js +4 -4
  100. package/.next/server/app/api/reanswer/route.js.nft.json +1 -1
  101. package/.next/server/app/api/register/route.js.nft.json +1 -1
  102. package/.next/server/app/api/review/due/route.js +14 -5
  103. package/.next/server/app/api/review/due/route.js.nft.json +1 -1
  104. package/.next/server/app/api/settings/route.js.nft.json +1 -1
  105. package/.next/server/app/api/setup/route.js.nft.json +1 -1
  106. package/.next/server/app/api/stats/practice/clear/route.js.nft.json +1 -1
  107. package/.next/server/app/api/stats/practice/route.js.nft.json +1 -1
  108. package/.next/server/app/api/tags/route.js.nft.json +1 -1
  109. package/.next/server/app/api/tags/stats/route.js.nft.json +1 -1
  110. package/.next/server/app/api/tags/suggestions/route.js.nft.json +1 -1
  111. package/.next/server/app/api/tasks/route.js.nft.json +1 -1
  112. package/.next/server/app/api/user/route.js +14 -4
  113. package/.next/server/app/api/user/route.js.nft.json +1 -1
  114. package/.next/server/app/error-items/[id]/page.js.nft.json +1 -1
  115. package/.next/server/app/error-items/[id]/page_client-reference-manifest.js +1 -1
  116. package/.next/server/app/exams/[id]/page.js.nft.json +1 -1
  117. package/.next/server/app/exams/[id]/page_client-reference-manifest.js +1 -1
  118. package/.next/server/app/exams/[id]/print/page.js.nft.json +1 -1
  119. package/.next/server/app/exams/[id]/print/page_client-reference-manifest.js +1 -1
  120. package/.next/server/app/exams/page.js.nft.json +1 -1
  121. package/.next/server/app/exams/page_client-reference-manifest.js +1 -1
  122. package/.next/server/app/login/page.js.nft.json +1 -1
  123. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  124. package/.next/server/app/notebooks/[id]/add/page.js.nft.json +1 -1
  125. package/.next/server/app/notebooks/[id]/add/page_client-reference-manifest.js +1 -1
  126. package/.next/server/app/notebooks/[id]/page.js.nft.json +1 -1
  127. package/.next/server/app/notebooks/[id]/page_client-reference-manifest.js +1 -1
  128. package/.next/server/app/notebooks/page.js.nft.json +1 -1
  129. package/.next/server/app/notebooks/page_client-reference-manifest.js +1 -1
  130. package/.next/server/app/page.js.nft.json +1 -1
  131. package/.next/server/app/page_client-reference-manifest.js +1 -1
  132. package/.next/server/app/practice/page.js.nft.json +1 -1
  133. package/.next/server/app/practice/page_client-reference-manifest.js +1 -1
  134. package/.next/server/app/print-preview/page.js.nft.json +1 -1
  135. package/.next/server/app/print-preview/page_client-reference-manifest.js +1 -1
  136. package/.next/server/app/register/page.js.nft.json +1 -1
  137. package/.next/server/app/register/page_client-reference-manifest.js +1 -1
  138. package/.next/server/app/review/page.js.nft.json +1 -1
  139. package/.next/server/app/review/page_client-reference-manifest.js +1 -1
  140. package/.next/server/app/setup/page.js.nft.json +1 -1
  141. package/.next/server/app/setup/page_client-reference-manifest.js +1 -1
  142. package/.next/server/app/stats/page.js.nft.json +1 -1
  143. package/.next/server/app/stats/page_client-reference-manifest.js +1 -1
  144. package/.next/server/app/tags/page.js.nft.json +1 -1
  145. package/.next/server/app/tags/page_client-reference-manifest.js +1 -1
  146. package/.next/server/app-paths-manifest.json +1 -0
  147. package/.next/server/chunks/1jng_app_api_error-items_[id]_svg-animation_narration_route_actions_0p9r8ebr7d00l.js +3 -0
  148. package/.next/server/chunks/{[root-of-the-server]__0gql12o_mf7e8._.js → [root-of-the-server]__0-_fe0i5gihj2._.js} +2 -2
  149. package/.next/server/chunks/{[root-of-the-server]__1hrdz_-5s3775._.js → [root-of-the-server]__0-mtuz1y2hrt_._.js} +2 -2
  150. package/.next/server/chunks/{[root-of-the-server]__0lt6zgk4xq6fk._.js → [root-of-the-server]__01zmywofxv44d._.js} +2 -2
  151. package/.next/server/chunks/{[root-of-the-server]__067bnq3j3z-3_._.js → [root-of-the-server]__02w4yny5gt2b4._.js} +1 -1
  152. package/.next/server/chunks/{[root-of-the-server]__0vqtidz1lisc6._.js → [root-of-the-server]__038gf2djjn0rg._.js} +2 -2
  153. package/.next/server/chunks/{[root-of-the-server]__04vkejt7399qm._.js → [root-of-the-server]__03_hg4dbjr6gm._.js} +2 -2
  154. package/.next/server/chunks/{[root-of-the-server]__0f505ene-6a0j._.js → [root-of-the-server]__040kfzc4zv5ji._.js} +2 -2
  155. package/.next/server/chunks/{[root-of-the-server]__015ejcb8twm6c._.js → [root-of-the-server]__04r2yjj4knt9x._.js} +1 -1
  156. package/.next/server/chunks/{[root-of-the-server]__077qr39ck1pcs._.js → [root-of-the-server]__061x45fxd07dm._.js} +1 -1
  157. package/.next/server/chunks/{[root-of-the-server]__09944y8f_7dhf._.js → [root-of-the-server]__07k4_ion4ou6d._.js} +1 -1
  158. package/.next/server/chunks/[root-of-the-server]__07ztt1wy26yvz._.js +3 -0
  159. package/.next/server/chunks/[root-of-the-server]__08fwru7fkvvl6._.js +3 -0
  160. package/.next/server/chunks/{[root-of-the-server]__0uzkv_2-76muc._.js → [root-of-the-server]__0aos0p_8a5gky._.js} +2 -2
  161. package/.next/server/chunks/{[root-of-the-server]__1930xo407ogqu._.js → [root-of-the-server]__0aq32mo414sro._.js} +2 -2
  162. package/.next/server/chunks/[root-of-the-server]__0c0x5d85vbcbv._.js +3 -0
  163. package/.next/server/chunks/[root-of-the-server]__0c4jdg0ga4zfe._.js +3 -0
  164. package/.next/server/chunks/[root-of-the-server]__0dqbew6anw2kd._.js +3 -0
  165. package/.next/server/chunks/[root-of-the-server]__0e7_0-o90esy-._.js +3 -0
  166. package/.next/server/chunks/{[root-of-the-server]__1wjrhbs_gcrzx._.js → [root-of-the-server]__0f5t2o0i9tjar._.js} +2 -2
  167. package/.next/server/chunks/[root-of-the-server]__0fn8r9f73fzd3._.js +3 -0
  168. package/.next/server/chunks/[root-of-the-server]__0i_w6t6qj_061._.js +3 -0
  169. package/.next/server/chunks/{[root-of-the-server]__05d1rfm7p02tv._.js → [root-of-the-server]__0ih72ek59msql._.js} +2 -2
  170. package/.next/server/chunks/{[root-of-the-server]__1-9hu4j35d9ao._.js → [root-of-the-server]__0of1031_q21po._.js} +1 -1
  171. package/.next/server/chunks/[root-of-the-server]__0p-cdsmp78i6-._.js +3 -0
  172. package/.next/server/chunks/{[root-of-the-server]__0zjg773epx4r_._.js → [root-of-the-server]__0qo744v4hy8lp._.js} +1 -1
  173. package/.next/server/chunks/[root-of-the-server]__0rdo2-j-gxelt._.js +3 -0
  174. package/.next/server/chunks/[root-of-the-server]__0suoe7tm4396u._.js +3 -0
  175. package/.next/server/chunks/[root-of-the-server]__0tflseuizxpen._.js +3 -0
  176. package/.next/server/chunks/[root-of-the-server]__0ue14np4llg3a._.js +3 -0
  177. package/.next/server/chunks/[root-of-the-server]__0ufhocguvoxt4._.js +3 -0
  178. package/.next/server/chunks/[root-of-the-server]__0uwpcliduox5r._.js +3 -0
  179. package/.next/server/chunks/[root-of-the-server]__0uyibcf2mejgf._.js +3 -0
  180. package/.next/server/chunks/{[root-of-the-server]__118rtr0shk1ii._.js → [root-of-the-server]__0v93i_mmy7uws._.js} +2 -2
  181. package/.next/server/chunks/{[root-of-the-server]__1awckh2w31m-1._.js → [root-of-the-server]__0wbt3upu-nuk1._.js} +2 -2
  182. package/.next/server/chunks/{[root-of-the-server]__0q_db5a74evdw._.js → [root-of-the-server]__0wm4qw5cu0956._.js} +1 -1
  183. package/.next/server/chunks/[root-of-the-server]__0zb48en2m8yk0._.js +7 -7
  184. package/.next/server/chunks/{[root-of-the-server]__17aiova74blq9._.js → [root-of-the-server]__0zvdl3gsgb2ll._.js} +2 -2
  185. package/.next/server/chunks/[root-of-the-server]__11l6a17qelkj9._.js +3 -0
  186. package/.next/server/chunks/[root-of-the-server]__13m9-20223lsw._.js +3 -0
  187. package/.next/server/chunks/{[root-of-the-server]__041tflu88yv18._.js → [root-of-the-server]__15fllrli2pdl7._.js} +1 -1
  188. package/.next/server/chunks/[root-of-the-server]__15t37vaiu6w-o._.js +3 -0
  189. package/.next/server/chunks/{[root-of-the-server]__0y48od_b_qxct._.js → [root-of-the-server]__169hdi7jji3vn._.js} +2 -2
  190. package/.next/server/chunks/[root-of-the-server]__171ybavo0fgfi._.js +3 -0
  191. package/.next/server/chunks/[root-of-the-server]__17_l38epg4gtn._.js +3 -0
  192. package/.next/server/chunks/[root-of-the-server]__18ok9-8819efr._.js +3 -0
  193. package/.next/server/chunks/{[root-of-the-server]__03g_n15zojhn2._.js → [root-of-the-server]__19uj-sk5cp6hw._.js} +2 -2
  194. package/.next/server/chunks/{[root-of-the-server]__1jhz19cuxjpmb._.js → [root-of-the-server]__1_8btngjew64q._.js} +1 -1
  195. package/.next/server/chunks/[root-of-the-server]__1_d4relv8gw0p._.js +3 -0
  196. package/.next/server/chunks/[root-of-the-server]__1auvj24i6np5g._.js +3 -0
  197. package/.next/server/chunks/[root-of-the-server]__1bvjyahgm4s-0._.js +1 -1
  198. package/.next/server/chunks/{[root-of-the-server]__1f1o5gbmw9gv7._.js → [root-of-the-server]__1dkb17rbhyexw._.js} +2 -2
  199. package/.next/server/chunks/[root-of-the-server]__1dnyhpafiwmyb._.js +3 -0
  200. package/.next/server/chunks/[root-of-the-server]__1euogp-jmbdbn._.js +3 -0
  201. package/.next/server/chunks/[root-of-the-server]__1gg8lq2q9gzg2._.js +7 -7
  202. package/.next/server/chunks/[root-of-the-server]__1h2gs1l_ocut-._.js +3 -0
  203. package/.next/server/chunks/[root-of-the-server]__1k750v6l878d9._.js +3 -0
  204. package/.next/server/chunks/[root-of-the-server]__1ks5l0ekcojb6._.js +3 -0
  205. package/.next/server/chunks/[root-of-the-server]__1l-xwnx9zl7n6._.js +3 -0
  206. package/.next/server/chunks/{[root-of-the-server]__0a62guogezjl6._.js → [root-of-the-server]__1l5g6cixzgviv._.js} +2 -2
  207. package/.next/server/chunks/[root-of-the-server]__1o82fhau9qctf._.js +3 -0
  208. package/.next/server/chunks/{[root-of-the-server]__035mztvplnh0_._.js → [root-of-the-server]__1qb-t64xfqxeo._.js} +2 -2
  209. package/.next/server/chunks/[root-of-the-server]__1sat028hivrbm._.js +3 -0
  210. package/.next/server/chunks/[root-of-the-server]__1sfc4ds1btvga._.js +3 -0
  211. package/.next/server/chunks/[root-of-the-server]__1stqxoanvvams._.js +3 -0
  212. package/.next/server/chunks/{[root-of-the-server]__0v0mt3v8gyonn._.js → [root-of-the-server]__1v3wvxwq41y9e._.js} +2 -2
  213. package/.next/server/chunks/[root-of-the-server]__1z6kziwgi04qw._.js +3 -0
  214. package/.next/server/chunks/[root-of-the-server]__1zu5sxvfb5vuo._.js +3 -0
  215. package/.next/server/chunks/{[root-of-the-server]__1pfiautl3zc2f._.js → [root-of-the-server]__213biwztbhh9-._.js} +2 -2
  216. package/.next/server/chunks/_0-ne-bwuvd_6w._.js +1 -1
  217. package/.next/server/chunks/_08i9pskmlafnp._.js +3 -0
  218. package/.next/server/chunks/_0_rhee7wb6tcg._.js +1 -1
  219. package/.next/server/chunks/_0gxi3zrkhyvx_._.js +1 -1
  220. package/.next/server/chunks/{_0geyrqrvyak26._.js → _0hkdm23o05kvp._.js} +6 -6
  221. package/.next/server/chunks/{_0kkvpy2s_y3-n._.js → _0lsw6_-5hpp0x._.js} +6 -6
  222. package/.next/server/chunks/_0tz5wpjdgntj3._.js +1 -1
  223. package/.next/server/chunks/_12w5k19rc45j_._.js +1 -1
  224. package/.next/server/chunks/_1_273cgnpyl9j._.js +1 -1
  225. package/.next/server/chunks/_1_ns7o3cqznv6._.js +1 -1
  226. package/.next/server/chunks/_1hj7iit2u6xez._.js +1 -1
  227. package/.next/server/chunks/{_0ne4rbj35w-io._.js → _1w_arlbn0o07b._.js} +6 -6
  228. package/.next/server/chunks/{src_lib_ai_prompts_ts_0z36zms4djibp._.js → src_lib_0es8upktx5_5c._.js} +77 -51
  229. package/.next/server/chunks/src_lib_15kwif87cuv22._.js +1 -1
  230. package/.next/server/chunks/src_lib_1k0xki4wmn54_._.js +1 -1
  231. package/.next/server/chunks/src_lib_1wm8ay-jqxakc._.js +1 -1
  232. package/.next/server/chunks/src_lib_exam_ts_0d3a4q4r41hcf._.js +1 -1
  233. package/.next/server/chunks/src_lib_mastery_ts_0ybi94uxn8ut6._.js +1 -1
  234. package/.next/server/chunks/ssr/_00np6xqvkg6u-._.js +1 -1
  235. package/.next/server/chunks/ssr/_0h6qsip9mphaq._.js +1 -1
  236. package/.next/server/chunks/ssr/_1g8mzz6qxv2mr._.js +1 -1
  237. package/.next/server/chunks/ssr/{node_modules_207wmjzllytiz._.js → _1gjb-bqi25yci._.js} +2 -2
  238. package/.next/server/chunks/ssr/{_1yaa5p1rk6i7c._.js → _1mw-oovvzrn8_._.js} +1 -1
  239. package/.next/server/chunks/ssr/src_app_error-items_[id]_page_tsx_04xwwdmyh7_9q._.js +1 -1
  240. package/.next/server/chunks/ssr/src_components_mastery-panel_tsx_1--j5c7mhomdp._.js +1 -1
  241. package/.next/server/chunks/ssr/src_components_providers_tsx_09kw-mv3nb6xs._.js +10 -10
  242. package/.next/server/middleware-build-manifest.js +3 -3
  243. package/.next/server/middleware-manifest.json +5 -5
  244. package/.next/server/pages/500.html +1 -1
  245. package/.next/server/preview-props.json +3 -3
  246. package/.next/server/server-reference-manifest.js +1 -1
  247. package/.next/server/server-reference-manifest.json +1 -1
  248. package/.next/static/chunks/0152ije6oxbik.js +1 -0
  249. package/.next/static/chunks/{45c1obyfb78ht.js → 0t58h5wfgi75w.js} +1 -1
  250. package/.next/static/chunks/{29ctahruklp-r.js → 0znojfm3iv2d7.js} +1 -1
  251. package/.next/static/chunks/{0hfox3n5lesf0.js → 1kx-lcqi4aref.js} +10 -10
  252. package/.next/static/chunks/22inup6g2i-7n.js +1 -0
  253. package/.next/static/chunks/{1zplgew-00wdz.js → 29cafv3hz5hzj.js} +1 -1
  254. package/.next/static/chunks/3zt-rwod7li6h.js +1 -0
  255. package/package.json +1 -1
  256. package/prisma/migrations/20261029000000_add_mastery_threshold/migration.sql +2 -0
  257. package/prisma/schema.prisma +1 -0
  258. package/prisma/seed.db +0 -0
  259. package/.next/server/chunks/[root-of-the-server]__00l2rz_disfkg._.js +0 -3
  260. package/.next/server/chunks/[root-of-the-server]__0aequ2pnoemzu._.js +0 -3
  261. package/.next/server/chunks/[root-of-the-server]__0msiy_bvtvaqo._.js +0 -3
  262. package/.next/server/chunks/[root-of-the-server]__0ul_64h5yov45._.js +0 -3
  263. package/.next/server/chunks/[root-of-the-server]__0vqoda1k-uvtz._.js +0 -3
  264. package/.next/server/chunks/[root-of-the-server]__0zxrtk19v5vnf._.js +0 -3
  265. package/.next/server/chunks/[root-of-the-server]__0zxxkvf-ns40a._.js +0 -3
  266. package/.next/server/chunks/[root-of-the-server]__1-i5zhzxr_18g._.js +0 -3
  267. package/.next/server/chunks/[root-of-the-server]__10_vi76_sexvg._.js +0 -3
  268. package/.next/server/chunks/[root-of-the-server]__10lamgabz68ix._.js +0 -3
  269. package/.next/server/chunks/[root-of-the-server]__11nevdba2vhtt._.js +0 -3
  270. package/.next/server/chunks/[root-of-the-server]__17o-ysd_xsch6._.js +0 -3
  271. package/.next/server/chunks/[root-of-the-server]__17pktht8hd051._.js +0 -3
  272. package/.next/server/chunks/[root-of-the-server]__1a1fr6o2wf7qx._.js +0 -3
  273. package/.next/server/chunks/[root-of-the-server]__1d39wr4nvawz9._.js +0 -3
  274. package/.next/server/chunks/[root-of-the-server]__1lbtlpnl59fx4._.js +0 -3
  275. package/.next/server/chunks/[root-of-the-server]__1n00d73k7_qf5._.js +0 -3
  276. package/.next/server/chunks/[root-of-the-server]__1nos0_eby5gj4._.js +0 -3
  277. package/.next/server/chunks/[root-of-the-server]__1np0y-f3_9a11._.js +0 -3
  278. package/.next/server/chunks/[root-of-the-server]__1q-qp9_6drnjc._.js +0 -3
  279. package/.next/server/chunks/[root-of-the-server]__1r0p8cbxayfm4._.js +0 -3
  280. package/.next/server/chunks/[root-of-the-server]__1uamx3r_5niri._.js +0 -3
  281. package/.next/server/chunks/[root-of-the-server]__1ubqs9ptth-gi._.js +0 -3
  282. package/.next/server/chunks/[root-of-the-server]__1ve3j8ooyhjgv._.js +0 -3
  283. package/.next/server/chunks/[root-of-the-server]__1wvpsikw739ko._.js +0 -3
  284. package/.next/server/chunks/[root-of-the-server]__1y4bactsi95qg._.js +0 -3
  285. package/.next/server/chunks/[root-of-the-server]__1yribihoxvucv._.js +0 -3
  286. package/.next/server/chunks/[root-of-the-server]__1zt-23c4kv6ca._.js +0 -3
  287. package/.next/server/chunks/[root-of-the-server]__1zyka21s1ahtj._.js +0 -3
  288. package/.next/server/chunks/[root-of-the-server]__20al_f02-oyfd._.js +0 -3
  289. package/.next/server/chunks/_0qsjdkq-39qbo._.js +0 -11
  290. package/.next/server/chunks/_1lrt8e26anbnm._.js +0 -11
  291. package/.next/server/chunks/node_modules_zod_v4_classic_external_19886v847zvfd.js +0 -3
  292. package/.next/static/chunks/1cp-v-3d-80iz.js +0 -1
  293. package/.next/static/chunks/23v229-qd9o6o.js +0 -1
  294. package/.next/static/chunks/2ods71pgjc-e2.js +0 -1
  295. /package/.next/static/{RKk8t6MmArFLi1wGSWXua → KvipY98Rm0kvPB-UaObQu}/_buildManifest.js +0 -0
  296. /package/.next/static/{RKk8t6MmArFLi1wGSWXua → KvipY98Rm0kvPB-UaObQu}/_clientMiddlewareManifest.js +0 -0
  297. /package/.next/static/{RKk8t6MmArFLi1wGSWXua → KvipY98Rm0kvPB-UaObQu}/_ssgManifest.js +0 -0
@@ -1,19 +1,19 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,1661,e=>{"use strict";var s=e.i(843476),t=e.i(111110),a=e.i(217255),r=e.i(215519),i=e.i(325164),n=e.i(522016),l=e.i(618566),c=e.i(217923),o=e.i(810980),d=e.i(551804),m=e.i(178583),u=e.i(292270),x=e.i(475254);let h=(0,x.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,x.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"}]]);var g=e.i(271645);let f=(0,x.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"}]]),j=(0,x.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"}]]),b=(0,x.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=e.i(763639),y=e.i(531278);let w=(0,x.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"}]]),N=(0,x.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 k=e.i(284614),S=e.i(733060),C=e.i(519455),T=e.i(776639),A=e.i(677572),M=e.i(306831),_=e.i(487486),E=e.i(699375),D=e.i(793479),z=e.i(110204),R=e.i(975157);let I=g.forwardRef(({className:e,...t},a)=>(0,s.jsx)("div",{className:"relative w-full overflow-auto",children:(0,s.jsx)("table",{ref:a,className:(0,R.f)("w-full caption-bottom text-sm",e),...t})}));I.displayName="Table";let L=g.forwardRef(({className:e,...t},a)=>(0,s.jsx)("thead",{ref:a,className:(0,R.f)("[&_tr]:border-b",e),...t}));L.displayName="TableHeader";let F=g.forwardRef(({className:e,...t},a)=>(0,s.jsx)("tbody",{ref:a,className:(0,R.f)("[&_tr:last-child]:border-0",e),...t}));F.displayName="TableBody",(g.forwardRef(({className:e,...t},a)=>(0,s.jsx)("tfoot",{ref:a,className:(0,R.f)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}))).displayName="TableFooter";let $=g.forwardRef(({className:e,...t},a)=>(0,s.jsx)("tr",{ref:a,className:(0,R.f)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));$.displayName="TableRow";let U=g.forwardRef(({className:e,...t},a)=>(0,s.jsx)("th",{ref:a,className:(0,R.f)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));U.displayName="TableHead";let P=g.forwardRef(({className:e,...t},a)=>(0,s.jsx)("td",{ref:a,className:(0,R.f)("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));P.displayName="TableCell",(g.forwardRef(({className:e,...t},a)=>(0,s.jsx)("caption",{ref:a,className:(0,R.f)("mt-4 text-sm text-muted-foreground",e),...t}))).displayName="TableCaption";var O=e.i(727612);let q=(0,x.f)("ban",[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var H=e.i(269638),V=e.i(41931),Y=e.i(294114),W=e.i(201276),B=e.i(303163);function J(){let{timeZone:e}=(0,r.M)(),{data:i}=(0,a.useSession)(),{t:n}=(0,t.b)(),[l,c]=(0,g.useState)([]),[o,d]=(0,g.useState)(!0),[m,u]=(0,g.useState)(!1),[x,h]=(0,g.useState)(!1),[p,f]=(0,g.useState)("0"),[j,b]=(0,g.useState)(!1),v=(0,g.useCallback)(async()=>{d(!0);try{let e=await V.f.get("/api/admin/users");c(e)}catch(e){W.f.error("[UserManagement]","Failed to fetch users",{error:e})}finally{d(!1)}},[]),w=(0,g.useCallback)(async()=>{try{let e=await V.f.get("/api/settings");u(!0===e.allowRegistration),f(String(e.aiDailyLimit??0))}catch(e){W.f.error("[UserManagement]","Failed to fetch config",{error:e})}},[]);(0,g.useEffect)(()=>{v(),w()},[v,w]);let N=async e=>{h(!0);try{await V.f.post("/api/settings",{allowRegistration:e}),u(e)}catch(e){W.f.error("[UserManagement]","Failed to update registration setting",{error:e}),Y.c.error(n.common.error)}finally{h(!1)}},k=Number(p),S=""!==p.trim()&&Number.isInteger(k)&&k>=0,T=async()=>{if(S){b(!0);try{await V.f.post("/api/settings",{aiDailyLimit:k}),Y.c.success(n.admin.aiDailyLimitSaved)}catch(e){W.f.error("[UserManagement]","Failed to update AI daily limit",{error:e}),Y.c.error(n.common.error)}finally{b(!1)}}},A=async e=>{let s=e.isActive?n.admin.confirmDisable:n.admin.confirmEnable;if(await (0,Y.u)(s))try{await V.f.patch(`/api/admin/users/${e.id}`,{isActive:!e.isActive}),v()}catch(e){W.f.error("[UserManagement]","Failed to update user status",{error:e}),Y.c.error(n.common.error)}},R=async e=>{if(await (0,Y.u)(n.admin.confirmDelete,{destructive:!0}))try{await V.f.delete(`/api/admin/users/${e.id}`),v()}catch(s){W.f.error("[UserManagement]","Failed to delete user",{error:s});let e=(0,B.d)(s)||n.common.error;Y.c.error(e)}};return o?(0,s.jsx)("div",{className:"flex justify-center py-8",children:(0,s.jsx)(y.f,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 border rounded-lg bg-muted/30",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(z.f,{className:"text-base",children:n.admin?.allowRegistration||"Allow New Registrations"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:n.admin?.allowRegistrationDesc||"When disabled, new users cannot register"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[x&&(0,s.jsx)(y.f,{className:"h-4 w-4 animate-spin"}),(0,s.jsx)(E.f,{checked:m,onCheckedChange:N,disabled:x})]})]}),(0,s.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,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(z.f,{htmlFor:"ai-daily-limit",className:"text-base",children:n.admin.aiDailyLimit}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:n.admin.aiDailyLimitDesc})]}),(0,s.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,s.jsx)(D.f,{id:"ai-daily-limit",type:"number",min:0,step:1,inputMode:"numeric",value:p,onChange:e=>f(e.target.value),"aria-invalid":!S,className:"w-24"}),(0,s.jsxs)(C.f,{size:"sm",onClick:T,disabled:j||!S,children:[j&&(0,s.jsx)(y.f,{className:"mr-2 h-4 w-4 animate-spin"}),n.common.save]})]})]}),(0,s.jsx)("div",{className:"sm:hidden space-y-3",children:l.map(t=>(0,s.jsxs)("div",{className:"border rounded-lg p-4 bg-card space-y-3",children:[(0,s.jsxs)("div",{className:"flex justify-between items-start",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-medium",children:t.name||"N/A"}),(0,s.jsx)("div",{className:"text-sm text-muted-foreground",children:t.email})]}),(0,s.jsx)(_.f,{variant:"admin"===t.role?"default":"secondary",children:"admin"===t.role?n.admin.admin:n.admin.user})]}),(0,s.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,s.jsxs)("div",{className:"text-muted-foreground",children:[n.admin.errors,": ",t._count.errorItems," | ",n.admin.practiceCount,": ",t._count.practiceRecords," | ",n.admin.aiUsageToday,": ",t.aiUsageToday]}),(0,s.jsx)(_.f,{variant:t.isActive?"default":"destructive",className:"text-xs",children:t.isActive?n.admin.active:n.admin.disabled})]}),(0,s.jsxs)("div",{className:"flex justify-between items-center pt-2 border-t",children:[(0,s.jsx)("div",{className:"text-xs text-muted-foreground",children:(0,M.r)(t.createdAt,"yyyy-MM-dd",e)}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(C.f,{variant:"ghost",size:"sm",onClick:()=>A(t),disabled:t.id===i?.user?.id,children:t.isActive?(0,s.jsx)(q,{className:"h-4 w-4 text-orange-500"}):(0,s.jsx)(H.f,{className:"h-4 w-4 text-green-500"})}),(0,s.jsx)(C.f,{variant:"ghost",size:"sm",onClick:()=>R(t),disabled:t.id===i?.user?.id,children:(0,s.jsx)(O.f,{className:"h-4 w-4 text-destructive"})})]})]})]},t.id))}),(0,s.jsx)("div",{className:"hidden sm:block border rounded-lg overflow-hidden",children:(0,s.jsxs)(I,{children:[(0,s.jsx)(L,{children:(0,s.jsxs)($,{children:[(0,s.jsx)(U,{children:n.admin.nameEmail}),(0,s.jsx)(U,{children:n.admin.role}),(0,s.jsx)(U,{children:n.admin.stats}),(0,s.jsx)(U,{children:n.admin.createdAt}),(0,s.jsx)(U,{children:n.admin.status}),(0,s.jsx)(U,{className:"text-right",children:n.admin.actions})]})}),(0,s.jsx)(F,{children:l.map(t=>(0,s.jsxs)($,{children:[(0,s.jsxs)(P,{children:[(0,s.jsx)("div",{className:"font-medium",children:t.name||"N/A"}),(0,s.jsx)("div",{className:"text-sm text-muted-foreground",children:t.email})]}),(0,s.jsx)(P,{children:(0,s.jsx)(_.f,{variant:"admin"===t.role?"default":"secondary",children:"admin"===t.role?n.admin.admin:n.admin.user})}),(0,s.jsxs)(P,{children:[(0,s.jsxs)("div",{className:"text-sm",children:[n.admin.errors,": ",t._count.errorItems]}),(0,s.jsxs)("div",{className:"text-sm",children:[n.admin.practiceCount,": ",t._count.practiceRecords]}),(0,s.jsxs)("div",{className:"text-sm",children:[n.admin.aiUsageToday,": ",t.aiUsageToday]})]}),(0,s.jsx)(P,{children:(0,M.r)(t.createdAt,"yyyy-MM-dd",e)}),(0,s.jsx)(P,{children:(0,s.jsx)(_.f,{variant:t.isActive?"default":"destructive",children:t.isActive?n.admin.active:n.admin.disabled})}),(0,s.jsxs)(P,{className:"text-right space-x-2",children:[(0,s.jsx)(C.f,{variant:"ghost",size:"sm",onClick:()=>A(t),disabled:t.id===i?.user?.id,title:t.isActive?n.admin.disable:n.admin.enable,children:t.isActive?(0,s.jsx)(q,{className:"h-4 w-4 text-orange-500"}):(0,s.jsx)(H.f,{className:"h-4 w-4 text-green-500"})}),(0,s.jsx)(C.f,{variant:"ghost",size:"sm",onClick:()=>R(t),disabled:t.id===i?.user?.id,title:n.admin.delete,children:(0,s.jsx)(O.f,{className:"h-4 w-4 text-destructive"})})]})]},t.id))})]})})]})}var X=e.i(778917);let G=(0,x.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"}]]),K=(0,x.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"}]]),Z=(0,x.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 Q(){return window.WrongNotebookAndroid??null}let ee=()=>()=>void 0;function es(){let{t:e}=(0,t.b)(),a=(0,g.useSyncExternalStore)(ee,Q,()=>null);return a?a.isStandalone?.()?(0,s.jsx)("p",{className:"text-center text-sm text-muted-foreground",children:e.settings?.about?.androidStandalone||"Running on this device. Data is stored only on this device."}):(0,s.jsxs)("div",{className:"flex flex-col items-center gap-2 text-sm text-muted-foreground",children:[(0,s.jsxs)("span",{className:"break-all",children:[e.settings?.about?.androidServer||"Server",": ",a.getServerUrl()]}),(0,s.jsxs)(C.f,{variant:"outline",className:"gap-2",onClick:()=>a.changeServer(),children:[(0,s.jsx)(Z,{className:"h-4 w-4"}),e.settings?.about?.changeServer||"Change server"]})]}):null}let et="https://github.com/margrop/wrong-notebook";function ea(){let{t:e}=(0,t.b)(),[a,r]=(0,g.useState)("");(0,g.useEffect)(()=>{fetch("/api/version").then(e=>e.json()).then(e=>r(e.version)).catch(()=>{})},[]);let i=[{href:et,icon:G,label:e.settings?.about?.github||"GitHub Repository"},{href:`${et}/releases`,icon:K,label:e.settings?.about?.releaseNotes||"Release Notes"},{href:`${et}/issues`,icon:w,label:e.settings?.about?.feedback||"Feedback"}];return(0,s.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,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("h3",{className:"text-2xl font-bold",children:e.app?.title||"Smart Error Notebook"}),(0,s.jsx)("p",{className:"text-muted-foreground",children:e.settings?.about?.desc||"AI-powered learning assistant"})]}),(0,s.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,s.jsx)(b,{className:"h-4 w-4"}),(0,s.jsxs)("span",{children:[e.settings?.about?.version||"Version",": v",a||"unknown"]})]}),(0,s.jsx)(es,{}),(0,s.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:i.map(({href:e,icon:t,label:a})=>(0,s.jsx)(C.f,{variant:"outline",asChild:!0,className:"gap-2 w-full sm:w-auto",children:(0,s.jsxs)("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:[(0,s.jsx)(t,{className:"h-4 w-4"}),a,(0,s.jsx)(X.f,{className:"h-3 w-3 ml-1 opacity-50"})]})},e))}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground mt-8",children:e.settings?.about?.copyright||"© 2026 margrop · Based on wttwins/wrong-notebook · MIT License"})]})}var er=e.i(37038),ei=e.i(967489);let en={name:"",email:"",educationStage:"",enrollmentYear:"",password:""};function el(){let{t:e}=(0,t.b)(),[a,r]=(0,g.useState)(en),[i,n]=(0,g.useState)(""),[l,c]=(0,g.useState)(!0),[o,d]=(0,g.useState)(!1),m=(0,g.useCallback)(async()=>{try{let e=await V.f.get("/api/user");r({name:e.name||"",email:e.email||"",educationStage:e.educationStage||"",enrollmentYear:e.enrollmentYear||"",password:""})}catch(e){W.f.error("[AccountSettings]","Failed to fetch profile",{error:e})}finally{c(!1)}},[]);(0,g.useEffect)(()=>{m()},[m]);let u=async()=>{if(a.password&&a.password!==i)return void Y.c.error(e.settings?.messages?.passwordMismatch||"Passwords do not match");d(!0);try{let s={name:a.name,email:a.email,educationStage:a.educationStage};a.enrollmentYear&&(s.enrollmentYear=parseInt(a.enrollmentYear.toString())),a.password&&(s.password=a.password),await V.f.patch("/api/user",s),Y.c.success(e.settings?.messages?.profileUpdated||"Profile updated"),r(e=>({...e,password:""})),n(""),window.location.reload()}catch(s){W.f.error("[AccountSettings]","Failed to update profile",{error:(0,B.d)(s)??(0,B.Z)(s)}),Y.c.error((0,B.d)(s)||e.settings?.messages?.updateFailed||"Update failed")}finally{d(!1)}};return l?(0,s.jsx)("div",{className:"flex justify-center py-8",children:(0,s.jsx)(y.f,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,s.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(z.f,{children:e.auth?.name||"Name"}),(0,s.jsx)(D.f,{value:a.name||"",onChange:e=>r({...a,name:e.target.value})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(z.f,{children:e.auth?.email||"Email"}),(0,s.jsx)(D.f,{value:a.email||"",onChange:e=>r({...a,email:e.target.value}),type:"email"})]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(z.f,{children:e.auth?.educationStage||"Education Stage"}),(0,s.jsxs)(ei.d,{value:a.educationStage||"",onValueChange:e=>r({...a,educationStage:e}),children:[(0,s.jsx)(ei.P,{children:(0,s.jsx)(ei.U,{placeholder:e.auth?.selectStage||"Select Stage"})}),(0,s.jsxs)(ei.r,{children:[(0,s.jsx)(ei.T,{value:"primary",children:e.auth?.primary||"Primary School"}),(0,s.jsx)(ei.T,{value:"junior_high",children:e.auth?.juniorHigh||"Junior High"}),(0,s.jsx)(ei.T,{value:"senior_high",children:e.auth?.seniorHigh||"Senior High"}),(0,s.jsx)(ei.T,{value:"university",children:e.auth?.university||"University"})]})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(z.f,{children:e.auth?.enrollmentYear||"Enrollment Year"}),(0,s.jsx)(D.f,{type:"number",value:a.enrollmentYear||"",onChange:e=>r({...a,enrollmentYear:e.target.value}),placeholder:"YYYY"})]})]}),(0,s.jsxs)("div",{className:"space-y-3 pt-2 border-t",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(z.f,{children:e.settings?.account?.changePassword||"Change Password (Leave empty to keep)"}),(0,s.jsx)(er.f,{value:a.password,onChange:e=>r({...a,password:e.target.value}),placeholder:"******",minLength:6})]}),a.password&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(z.f,{children:e.auth?.confirmPassword||"Confirm Password"}),(0,s.jsx)(er.f,{value:i,onChange:e=>n(e.target.value),placeholder:"******",minLength:6})]})]}),(0,s.jsxs)(C.f,{onClick:u,disabled:o,className:"w-full",children:[o&&(0,s.jsx)(y.f,{className:"mr-2 h-4 w-4 animate-spin"}),e.settings?.account?.update||"Update Profile"]})]})}var ec=e.i(10038),eo=e.i(16715);let ed={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 em({title:e,description:t,tone:a,busy:r,icon:i,onClick:n}){let l=ed[a];return(0,s.jsxs)("div",{className:`p-4 border rounded-lg ${l.card}`,children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:`text-sm flex items-center gap-2 ${l.title}`,children:e}),(0,s.jsx)(C.f,{variant:"info"===a?"outline":"destructive",size:"sm",onClick:n,disabled:r,className:l.button,children:r?(0,s.jsx)(y.f,{className:"h-4 w-4 animate-spin"}):i})]}),(0,s.jsx)("p",{className:`text-xs mt-2 ${l.desc}`,children:t})]})}function eu({isAdmin:e}){let{t:a}=(0,t.b)(),[r,i]=(0,g.useState)(null),n=async(e,s,t,a)=>{i(e);try{Y.c.success(await s()),a&&window.location.reload()}catch(s){W.f.error("[DangerZoneSettings]",`${e} failed`,{error:s}),Y.c.error(t)}finally{i(null)}},l=a.settings?.clearSuccess||"Success",c=a.settings?.clearError||"Failed",o=async()=>{await (0,Y.u)(a.settings?.migrateTagsConfirm||"This will reset system tags. Confirm?",{destructive:!0})&&await n("migrateTags",async()=>{let e=await V.f.post("/api/admin/migrate-tags",{});return`${l}: ${e.count||0} tags migrated.`},a.settings?.clearError||"Failed to migrate tags",!1)},d=async()=>{await (0,Y.u)(a.settings?.clearDataConfirm||"Are you sure?",{destructive:!0})&&await n("clearPractice",async()=>(await V.f.delete("/api/stats/practice/clear"),l),c,!0)},m=async()=>{await (0,Y.u)(a.settings?.clearErrorDataConfirm||"Are you sure?",{destructive:!0})&&await n("clearErrors",async()=>(await V.f.delete("/api/error-items/clear"),l),c,!0)},u=async()=>{if(!await (0,Y.u)(a.settings?.systemResetConfirm||"WARNING: Deleting ALL data. Undoing is impossible. Are you sure?",{destructive:!0}))return;let e=prompt(a.settings?.systemResetPrompt||"Type 'RESET' to confirm system initialization:","");if("RESET"!==e){null!==e&&Y.c.error(a.common?.error||"Confirmation failed");return}await n("systemReset",async()=>(await V.f.post("/api/admin/system-reset",{}),a.settings?.clearSuccess||"Success - System Reset Complete"),a.settings?.clearError||"Failed to reset system",!0)};return(0,s.jsxs)(s.Fragment,{children:[e&&(0,s.jsx)(em,{tone:"info",title:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eo.f,{className:"h-4 w-4"}),a.settings?.migrateTags||"Migrate Tags"]}),description:a.settings?.migrateTagsDesc||"Re-populates standard tags from file",busy:"migrateTags"===r,icon:(0,s.jsx)(eo.f,{className:"h-4 w-4"}),onClick:o}),(0,s.jsx)(em,{tone:"danger",title:a.settings?.clearData||"Clear Practice Data",description:a.settings?.clearDataDesc||"This will permanently delete all practice history. Irreversible.",busy:"clearPractice"===r,icon:(0,s.jsx)(O.f,{className:"h-4 w-4"}),onClick:d}),(0,s.jsx)(em,{tone:"danger",title:a.settings?.clearErrorData||"Clear Error Data",description:a.settings?.clearErrorDataDesc||"This will permanently delete all error items. Irreversible.",busy:"clearErrors"===r,icon:(0,s.jsx)(O.f,{className:"h-4 w-4"}),onClick:m}),e&&(0,s.jsx)(em,{tone:"critical",title:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(f,{className:"h-4 w-4"}),a.settings?.systemReset||"System Initialization"]}),description:a.settings?.systemResetDesc||"Resets the system to factory state. Deletes ALL data.",busy:"systemReset"===r,icon:(0,s.jsx)(O.f,{className:"h-4 w-4"}),onClick:u})]})}var ex=e.i(595468),eh=e.i(440160);let ep=(0,x.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 eg(e,s){let t=await fetch(e);if(!t.ok)throw Error((await t.json().catch(()=>({}))).message||"Export failed");let a=await t.blob(),r=window.URL.createObjectURL(a),i=document.createElement("a");i.href=r;let n=t.headers.get("Content-Disposition")?.match(/filename="(.+)"/);i.download=n?n[1]:s,document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(r)}function ef({isAdmin:e}){let{t:a}=(0,t.b)(),[r,i]=(0,g.useState)(!1),[n,l]=(0,g.useState)(!1),[c,o]=(0,g.useState)(null),d=async e=>{if(!e||await (0,Y.u)(a.settings?.exportAllConfirm||"Export all users' data? This may take a while.")){i(!0);try{await eg(e?"/api/export?all=true":"/api/export",e?"wrong-notebook-export-all.json":"wrong-notebook-export.json"),Y.c.success(a.settings?.exportSuccess||"Export successful")}catch(s){W.f.error("[DataBackupSettings]",e?"Export all failed":"Export failed",{error:s}),Y.c.error(a.settings?.exportFailed||"Export failed")}finally{i(!1)}}},m=async e=>{if(!c)return;let s=e?a.settings?.importAllConfirm||"Import all users' data? This will restore data for all users from the export file.":a.settings?.importConfirm||"Are you sure you want to import?";if(await (0,Y.u)(s)){l(!0);try{let s=JSON.parse(await c.text()),{stats:t}=await V.f.post(e?"/api/import?all=true":"/api/import",s);Y.c.success((a.settings?.importResultDesc||"Imported {subjects} notebooks, {tags} tags, {items} error items, {schedules} review schedules, {records} practice records, {papers} exam papers.").replace("{subjects}",String(t.subjectsCreated)).replace("{tags}",String(t.tagsCreated)).replace("{items}",String(t.errorItemsCreated)).replace("{schedules}",String(t.reviewSchedulesCreated)).replace("{records}",String(t.practiceRecordsCreated)).replace("{papers}",String(t.examPapersCreated??0)).replace("{duplicates}",String(t.duplicateErrorItems??0))),o(null),window.location.reload()}catch(s){W.f.error("[DataBackupSettings]",e?"Import all failed":"Import failed",{error:s}),Y.c.error(a.settings?.importFailed||"Import failed")}finally{l(!1)}}},u=(e,t)=>e?(0,s.jsx)(y.f,{className:"mr-2 h-4 w-4 animate-spin"}):t;return(0,s.jsxs)("div",{className:"p-4 border border-blue-200 rounded-lg bg-blue-50",children:[(0,s.jsx)("h4",{className:"text-sm font-bold text-blue-900 mb-3",children:a.settings?.dataManagement||"Data Management"}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("span",{className:"text-sm text-blue-800 font-medium",children:a.settings?.exportData||"Export Data"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>d(!1),disabled:r,className:"bg-blue-100 hover:bg-blue-200 text-blue-900 border-blue-300",children:[u(r,(0,s.jsx)(eh.f,{className:"mr-2 h-4 w-4"})),a.settings?.exportData||"Export"]}),e&&(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>d(!0),disabled:r,className:"bg-orange-100 hover:bg-orange-200 text-orange-900 border-orange-300",children:[u(r,(0,s.jsx)(eh.f,{className:"mr-2 h-4 w-4"})),a.settings?.exportAllData||"Export All"]})]})]}),(0,s.jsx)("p",{className:"text-xs text-blue-700",children:a.settings?.exportDataDesc||"Export all data as JSON file."})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("span",{className:"text-sm text-blue-800 font-medium",children:a.settings?.importData||"Import Data"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("input",{type:"file",accept:".json",onChange:e=>o(e.target.files?.[0]??c),className:"hidden",id:"import-file-input",disabled:n}),(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>document.getElementById("import-file-input")?.click(),disabled:n,className:"bg-blue-100 hover:bg-blue-200 text-blue-900 border-blue-300",children:[u(n,(0,s.jsx)(ep,{className:"mr-2 h-4 w-4"})),c?.name||a.settings?.selectFile||"Select File"]}),c&&(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>m(!1),disabled:n,className:"bg-green-100 hover:bg-green-200 text-green-900 border-green-300",children:[u(n,(0,s.jsx)(ex.f,{className:"mr-2 h-4 w-4"})),a.settings?.importData||"Import"]}),c&&e&&(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>m(!0),disabled:n,className:"bg-orange-100 hover:bg-orange-200 text-orange-900 border-orange-300",children:[u(n,(0,s.jsx)(ex.f,{className:"mr-2 h-4 w-4"})),a.settings?.importAllData||"Import All"]})]})]}),(0,s.jsx)("p",{className:"text-xs text-blue-700",children:a.settings?.importDataDesc||"Import data from JSON file. Existing data will be skipped."})]})]})}var ej=e.i(307364);function eb({field:e,label:a,description:r}){let{t:i}=(0,t.b)(),[n,l]=(0,g.useState)(!1),[c,o]=(0,g.useState)(!1),[d,m]=(0,g.useState)(!1),[u,x]=(0,g.useState)(null),h=`preference-${e}`;(0,g.useEffect)(()=>{V.f.get("/api/user").then(s=>l(!!s[e])).catch(()=>void 0).finally(()=>o(!0))},[e]);let p=async s=>{l(s),m(!0);try{await V.f.patch("/api/user",{[e]:s}),x(i.importFlow.preferenceSaved)}catch(t){l(!s),x(i.importFlow.preferenceSaveFailed),W.f.error("[Settings]","Failed to save user preference",{field:e,error:t instanceof Error?t.message:String(t)})}finally{m(!1)}};return(0,s.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,s.jsx)(z.f,{htmlFor:h,children:a}),(0,s.jsx)(E.f,{id:h,checked:n,onCheckedChange:p,disabled:!c||d})]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:r}),u&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:u})]})}function ev(){let{t:e}=(0,t.b)();return(0,s.jsx)(eb,{field:"enableGeogebra",label:e.importFlow.enableGeogebra,description:e.importFlow.enableGeogebraDesc})}function ey(){let{t:e}=(0,t.b)();return(0,s.jsx)(eb,{field:"confirmBeforeImport",label:e.importFlow.confirmBeforeImport,description:e.importFlow.confirmBeforeImportDesc})}function ew(){let{t:e}=(0,t.b)();return(0,s.jsx)(eb,{field:"enableSvgAnimation",label:e.importFlow.enableSvgAnimation,description:e.importFlow.enableSvgAnimationDesc})}function eN({value:e,onChange:a,disabled:r}){let{t:i}=(0,t.b)();return(0,s.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,s.jsx)(z.f,{htmlFor:"app-time-zone",children:i.settings.general.timeZoneLabel}),(0,s.jsx)(D.f,{id:"app-time-zone",value:e,onChange:e=>a(e.target.value),disabled:r,list:"app-time-zones",placeholder:"Asia/Shanghai"}),(0,s.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(e=>(0,s.jsx)("option",{value:e},e))}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:i.settings.general.timeZoneDesc})]})}function ek({config:e,setConfig:a,isAdmin:i,disabled:n}){let{t:l,language:c,setLanguage:o}=(0,t.b)(),{timeZone:d}=(0,r.M)(),m=e=>a(s=>({...s,timeouts:{...s.timeouts,analyze:1e3*e}}));return(0,s.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(z.f,{children:l.settings?.language||"Language"}),(0,s.jsxs)(ei.d,{value:c,onValueChange:e=>o(e),children:[(0,s.jsx)(ei.P,{children:(0,s.jsx)(ei.U,{})}),(0,s.jsxs)(ei.r,{children:[(0,s.jsx)(ei.T,{value:"zh",children:"中文 (Chinese)"}),(0,s.jsx)(ei.T,{value:"en",children:"English"})]})]})]}),(0,s.jsx)(eN,{value:e.timeZone??d,onChange:e=>a(s=>({...s,timeZone:e})),disabled:!i||n}),i&&(0,s.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,s.jsx)(z.f,{children:l.settings?.general?.timeoutLabel||"AI Analysis Timeout (Seconds)"}),(0,s.jsx)(D.f,{type:"number",value:e.timeouts?.analyze?e.timeouts.analyze/1e3:"",onChange:e=>{let s=""===e.target.value?0:parseInt(e.target.value);m(isNaN(s)?0:s)},onBlur:()=>{let s=(e.timeouts?.analyze||0)/1e3,t=Math.min(600,Math.max(120,s));t!==s&&m(t)},min:120,max:600}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:l.settings?.general?.timeoutDesc||"Increase this value if you experience frequent timeouts during AI analysis."})]}),(0,s.jsx)(ey,{}),(0,s.jsx)(ew,{}),(0,s.jsx)(ev,{}),(0,s.jsx)(ej.f,{})]})}var eS=e.i(624687),eC=e.i(247167);let eT={trace:10,debug:20,info:30,warn:40,error:50,fatal:60};function eA(e,s={}){let t,a=eT[e],r=(t=eC.default.env.LOG_LEVEL?.toLowerCase())&&void 0!==eT[t]?eT[t]:eT.info;return(t,i)=>{let n,l;if(a<r)return;let c=new Date;"string"==typeof t?(n={},l=t):(n=t,l=i||"");{let t=JSON.stringify({level:e,time:c.toISOString(),...s,...n,msg:l});switch(e){case"error":case"fatal":console.error(t);break;case"warn":console.warn(t);break;default:console.log(t)}}}}(function e(s={}){return s.module,{trace:eA("trace",s),debug:eA("debug",s),info:eA("info",s),warn:eA("warn",s),error:eA("error",s),fatal:eA("fatal",s),child:t=>e({...s,...t}),box:(e,t,a="📋")=>{console.log(JSON.stringify({level:"info",time:new Date().toISOString(),...s,title:e,..."string"==typeof t?{content:t}:t||{},msg:e}))},divider:(e="-")=>{}}})({env:"production"}).child({module:"ai:prompts"});let eM=`请参考《高思学校竞赛数学导引》(每讲分兴趣篇、拓展篇、超越篇,题目左侧标 1~5 颗星)的星级标准,结合题目所在年级评定难度:
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,1661,e=>{"use strict";var s=e.i(843476),t=e.i(111110),a=e.i(217255),r=e.i(215519),i=e.i(325164),n=e.i(522016),l=e.i(618566),c=e.i(217923),o=e.i(810980),d=e.i(551804),m=e.i(178583),u=e.i(292270),x=e.i(475254);let h=(0,x.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,x.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"}]]);var f=e.i(271645);let g=(0,x.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"}]]),j=(0,x.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"}]]),b=(0,x.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 y=e.i(763639),v=e.i(531278);let w=(0,x.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"}]]),N=(0,x.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 k=e.i(284614),S=e.i(733060),C=e.i(519455),T=e.i(776639),A=e.i(677572),M=e.i(306831),_=e.i(487486),E=e.i(699375),D=e.i(793479),z=e.i(110204),F=e.i(975157);let L=f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("div",{className:"relative w-full overflow-auto",children:(0,s.jsx)("table",{ref:a,className:(0,F.f)("w-full caption-bottom text-sm",e),...t})}));L.displayName="Table";let R=f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("thead",{ref:a,className:(0,F.f)("[&_tr]:border-b",e),...t}));R.displayName="TableHeader";let I=f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("tbody",{ref:a,className:(0,F.f)("[&_tr:last-child]:border-0",e),...t}));I.displayName="TableBody",(f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("tfoot",{ref:a,className:(0,F.f)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}))).displayName="TableFooter";let $=f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("tr",{ref:a,className:(0,F.f)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));$.displayName="TableRow";let U=f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("th",{ref:a,className:(0,F.f)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));U.displayName="TableHead";let P=f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("td",{ref:a,className:(0,F.f)("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));P.displayName="TableCell",(f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("caption",{ref:a,className:(0,F.f)("mt-4 text-sm text-muted-foreground",e),...t}))).displayName="TableCaption";var O=e.i(727612);let q=(0,x.f)("ban",[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var H=e.i(269638),V=e.i(41931),Y=e.i(294114),W=e.i(201276),B=e.i(303163);function J(){let{timeZone:e}=(0,r.M)(),{data:i}=(0,a.useSession)(),{t:n}=(0,t.b)(),[l,c]=(0,f.useState)([]),[o,d]=(0,f.useState)(!0),[m,u]=(0,f.useState)(!1),[x,h]=(0,f.useState)(!1),[p,g]=(0,f.useState)("0"),[j,b]=(0,f.useState)(!1),y=(0,f.useCallback)(async()=>{d(!0);try{let e=await V.f.get("/api/admin/users");c(e)}catch(e){W.f.error("[UserManagement]","Failed to fetch users",{error:e})}finally{d(!1)}},[]),w=(0,f.useCallback)(async()=>{try{let e=await V.f.get("/api/settings");u(!0===e.allowRegistration),g(String(e.aiDailyLimit??0))}catch(e){W.f.error("[UserManagement]","Failed to fetch config",{error:e})}},[]);(0,f.useEffect)(()=>{y(),w()},[y,w]);let N=async e=>{h(!0);try{await V.f.post("/api/settings",{allowRegistration:e}),u(e)}catch(e){W.f.error("[UserManagement]","Failed to update registration setting",{error:e}),Y.c.error(n.common.error)}finally{h(!1)}},k=Number(p),S=""!==p.trim()&&Number.isInteger(k)&&k>=0,T=async()=>{if(S){b(!0);try{await V.f.post("/api/settings",{aiDailyLimit:k}),Y.c.success(n.admin.aiDailyLimitSaved)}catch(e){W.f.error("[UserManagement]","Failed to update AI daily limit",{error:e}),Y.c.error(n.common.error)}finally{b(!1)}}},A=async e=>{let s=e.isActive?n.admin.confirmDisable:n.admin.confirmEnable;if(await (0,Y.u)(s))try{await V.f.patch(`/api/admin/users/${e.id}`,{isActive:!e.isActive}),y()}catch(e){W.f.error("[UserManagement]","Failed to update user status",{error:e}),Y.c.error(n.common.error)}},F=async e=>{if(await (0,Y.u)(n.admin.confirmDelete,{destructive:!0}))try{await V.f.delete(`/api/admin/users/${e.id}`),y()}catch(s){W.f.error("[UserManagement]","Failed to delete user",{error:s});let e=(0,B.d)(s)||n.common.error;Y.c.error(e)}};return o?(0,s.jsx)("div",{className:"flex justify-center py-8",children:(0,s.jsx)(v.f,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 border rounded-lg bg-muted/30",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(z.f,{className:"text-base",children:n.admin?.allowRegistration||"Allow New Registrations"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:n.admin?.allowRegistrationDesc||"When disabled, new users cannot register"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[x&&(0,s.jsx)(v.f,{className:"h-4 w-4 animate-spin"}),(0,s.jsx)(E.f,{checked:m,onCheckedChange:N,disabled:x})]})]}),(0,s.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,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(z.f,{htmlFor:"ai-daily-limit",className:"text-base",children:n.admin.aiDailyLimit}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:n.admin.aiDailyLimitDesc})]}),(0,s.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,s.jsx)(D.f,{id:"ai-daily-limit",type:"number",min:0,step:1,inputMode:"numeric",value:p,onChange:e=>g(e.target.value),"aria-invalid":!S,className:"w-24"}),(0,s.jsxs)(C.f,{size:"sm",onClick:T,disabled:j||!S,children:[j&&(0,s.jsx)(v.f,{className:"mr-2 h-4 w-4 animate-spin"}),n.common.save]})]})]}),(0,s.jsx)("div",{className:"sm:hidden space-y-3",children:l.map(t=>(0,s.jsxs)("div",{className:"border rounded-lg p-4 bg-card space-y-3",children:[(0,s.jsxs)("div",{className:"flex justify-between items-start",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-medium",children:t.name||"N/A"}),(0,s.jsx)("div",{className:"text-sm text-muted-foreground",children:t.email})]}),(0,s.jsx)(_.f,{variant:"admin"===t.role?"default":"secondary",children:"admin"===t.role?n.admin.admin:n.admin.user})]}),(0,s.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,s.jsxs)("div",{className:"text-muted-foreground",children:[n.admin.errors,": ",t._count.errorItems," | ",n.admin.practiceCount,": ",t._count.practiceRecords," | ",n.admin.aiUsageToday,": ",t.aiUsageToday]}),(0,s.jsx)(_.f,{variant:t.isActive?"default":"destructive",className:"text-xs",children:t.isActive?n.admin.active:n.admin.disabled})]}),(0,s.jsxs)("div",{className:"flex justify-between items-center pt-2 border-t",children:[(0,s.jsx)("div",{className:"text-xs text-muted-foreground",children:(0,M.r)(t.createdAt,"yyyy-MM-dd",e)}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(C.f,{variant:"ghost",size:"sm",onClick:()=>A(t),disabled:t.id===i?.user?.id,children:t.isActive?(0,s.jsx)(q,{className:"h-4 w-4 text-orange-500"}):(0,s.jsx)(H.f,{className:"h-4 w-4 text-green-500"})}),(0,s.jsx)(C.f,{variant:"ghost",size:"sm",onClick:()=>F(t),disabled:t.id===i?.user?.id,children:(0,s.jsx)(O.f,{className:"h-4 w-4 text-destructive"})})]})]})]},t.id))}),(0,s.jsx)("div",{className:"hidden sm:block border rounded-lg overflow-hidden",children:(0,s.jsxs)(L,{children:[(0,s.jsx)(R,{children:(0,s.jsxs)($,{children:[(0,s.jsx)(U,{children:n.admin.nameEmail}),(0,s.jsx)(U,{children:n.admin.role}),(0,s.jsx)(U,{children:n.admin.stats}),(0,s.jsx)(U,{children:n.admin.createdAt}),(0,s.jsx)(U,{children:n.admin.status}),(0,s.jsx)(U,{className:"text-right",children:n.admin.actions})]})}),(0,s.jsx)(I,{children:l.map(t=>(0,s.jsxs)($,{children:[(0,s.jsxs)(P,{children:[(0,s.jsx)("div",{className:"font-medium",children:t.name||"N/A"}),(0,s.jsx)("div",{className:"text-sm text-muted-foreground",children:t.email})]}),(0,s.jsx)(P,{children:(0,s.jsx)(_.f,{variant:"admin"===t.role?"default":"secondary",children:"admin"===t.role?n.admin.admin:n.admin.user})}),(0,s.jsxs)(P,{children:[(0,s.jsxs)("div",{className:"text-sm",children:[n.admin.errors,": ",t._count.errorItems]}),(0,s.jsxs)("div",{className:"text-sm",children:[n.admin.practiceCount,": ",t._count.practiceRecords]}),(0,s.jsxs)("div",{className:"text-sm",children:[n.admin.aiUsageToday,": ",t.aiUsageToday]})]}),(0,s.jsx)(P,{children:(0,M.r)(t.createdAt,"yyyy-MM-dd",e)}),(0,s.jsx)(P,{children:(0,s.jsx)(_.f,{variant:t.isActive?"default":"destructive",children:t.isActive?n.admin.active:n.admin.disabled})}),(0,s.jsxs)(P,{className:"text-right space-x-2",children:[(0,s.jsx)(C.f,{variant:"ghost",size:"sm",onClick:()=>A(t),disabled:t.id===i?.user?.id,title:t.isActive?n.admin.disable:n.admin.enable,children:t.isActive?(0,s.jsx)(q,{className:"h-4 w-4 text-orange-500"}):(0,s.jsx)(H.f,{className:"h-4 w-4 text-green-500"})}),(0,s.jsx)(C.f,{variant:"ghost",size:"sm",onClick:()=>F(t),disabled:t.id===i?.user?.id,title:n.admin.delete,children:(0,s.jsx)(O.f,{className:"h-4 w-4 text-destructive"})})]})]},t.id))})]})})]})}var X=e.i(778917);let G=(0,x.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"}]]),K=(0,x.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"}]]),Z=(0,x.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 Q(){return window.WrongNotebookAndroid??null}let ee=()=>()=>void 0;function es(){let{t:e}=(0,t.b)(),a=(0,f.useSyncExternalStore)(ee,Q,()=>null);return a?a.isStandalone?.()?(0,s.jsx)("p",{className:"text-center text-sm text-muted-foreground",children:e.settings?.about?.androidStandalone||"Running on this device. Data is stored only on this device."}):(0,s.jsxs)("div",{className:"flex flex-col items-center gap-2 text-sm text-muted-foreground",children:[(0,s.jsxs)("span",{className:"break-all",children:[e.settings?.about?.androidServer||"Server",": ",a.getServerUrl()]}),(0,s.jsxs)(C.f,{variant:"outline",className:"gap-2",onClick:()=>a.changeServer(),children:[(0,s.jsx)(Z,{className:"h-4 w-4"}),e.settings?.about?.changeServer||"Change server"]})]}):null}let et="https://github.com/margrop/wrong-notebook";function ea(){let{t:e}=(0,t.b)(),[a,r]=(0,f.useState)("");(0,f.useEffect)(()=>{fetch("/api/version").then(e=>e.json()).then(e=>r(e.version)).catch(()=>{})},[]);let i=[{href:et,icon:G,label:e.settings?.about?.github||"GitHub Repository"},{href:`${et}/releases`,icon:K,label:e.settings?.about?.releaseNotes||"Release Notes"},{href:`${et}/issues`,icon:w,label:e.settings?.about?.feedback||"Feedback"}];return(0,s.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,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("h3",{className:"text-2xl font-bold",children:e.app?.title||"Smart Error Notebook"}),(0,s.jsx)("p",{className:"text-muted-foreground",children:e.settings?.about?.desc||"AI-powered learning assistant"})]}),(0,s.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,s.jsx)(b,{className:"h-4 w-4"}),(0,s.jsxs)("span",{children:[e.settings?.about?.version||"Version",": v",a||"unknown"]})]}),(0,s.jsx)(es,{}),(0,s.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:i.map(({href:e,icon:t,label:a})=>(0,s.jsx)(C.f,{variant:"outline",asChild:!0,className:"gap-2 w-full sm:w-auto",children:(0,s.jsxs)("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:[(0,s.jsx)(t,{className:"h-4 w-4"}),a,(0,s.jsx)(X.f,{className:"h-3 w-3 ml-1 opacity-50"})]})},e))}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground mt-8",children:e.settings?.about?.copyright||"© 2026 margrop · Based on wttwins/wrong-notebook · MIT License"})]})}var er=e.i(37038),ei=e.i(967489);let en={name:"",email:"",educationStage:"",enrollmentYear:"",password:""};function el(){let{t:e}=(0,t.b)(),[a,r]=(0,f.useState)(en),[i,n]=(0,f.useState)(""),[l,c]=(0,f.useState)(!0),[o,d]=(0,f.useState)(!1),m=(0,f.useCallback)(async()=>{try{let e=await V.f.get("/api/user");r({name:e.name||"",email:e.email||"",educationStage:e.educationStage||"",enrollmentYear:e.enrollmentYear||"",password:""})}catch(e){W.f.error("[AccountSettings]","Failed to fetch profile",{error:e})}finally{c(!1)}},[]);(0,f.useEffect)(()=>{m()},[m]);let u=async()=>{if(a.password&&a.password!==i)return void Y.c.error(e.settings?.messages?.passwordMismatch||"Passwords do not match");d(!0);try{let s={name:a.name,email:a.email,educationStage:a.educationStage};a.enrollmentYear&&(s.enrollmentYear=parseInt(a.enrollmentYear.toString())),a.password&&(s.password=a.password),await V.f.patch("/api/user",s),Y.c.success(e.settings?.messages?.profileUpdated||"Profile updated"),r(e=>({...e,password:""})),n(""),window.location.reload()}catch(s){W.f.error("[AccountSettings]","Failed to update profile",{error:(0,B.d)(s)??(0,B.Z)(s)}),Y.c.error((0,B.d)(s)||e.settings?.messages?.updateFailed||"Update failed")}finally{d(!1)}};return l?(0,s.jsx)("div",{className:"flex justify-center py-8",children:(0,s.jsx)(v.f,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,s.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(z.f,{children:e.auth?.name||"Name"}),(0,s.jsx)(D.f,{value:a.name||"",onChange:e=>r({...a,name:e.target.value})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(z.f,{children:e.auth?.email||"Email"}),(0,s.jsx)(D.f,{value:a.email||"",onChange:e=>r({...a,email:e.target.value}),type:"email"})]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(z.f,{children:e.auth?.educationStage||"Education Stage"}),(0,s.jsxs)(ei.d,{value:a.educationStage||"",onValueChange:e=>r({...a,educationStage:e}),children:[(0,s.jsx)(ei.P,{children:(0,s.jsx)(ei.U,{placeholder:e.auth?.selectStage||"Select Stage"})}),(0,s.jsxs)(ei.r,{children:[(0,s.jsx)(ei.T,{value:"primary",children:e.auth?.primary||"Primary School"}),(0,s.jsx)(ei.T,{value:"junior_high",children:e.auth?.juniorHigh||"Junior High"}),(0,s.jsx)(ei.T,{value:"senior_high",children:e.auth?.seniorHigh||"Senior High"}),(0,s.jsx)(ei.T,{value:"university",children:e.auth?.university||"University"})]})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(z.f,{children:e.auth?.enrollmentYear||"Enrollment Year"}),(0,s.jsx)(D.f,{type:"number",value:a.enrollmentYear||"",onChange:e=>r({...a,enrollmentYear:e.target.value}),placeholder:"YYYY"})]})]}),(0,s.jsxs)("div",{className:"space-y-3 pt-2 border-t",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(z.f,{children:e.settings?.account?.changePassword||"Change Password (Leave empty to keep)"}),(0,s.jsx)(er.f,{value:a.password,onChange:e=>r({...a,password:e.target.value}),placeholder:"******",minLength:6})]}),a.password&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(z.f,{children:e.auth?.confirmPassword||"Confirm Password"}),(0,s.jsx)(er.f,{value:i,onChange:e=>n(e.target.value),placeholder:"******",minLength:6})]})]}),(0,s.jsxs)(C.f,{onClick:u,disabled:o,className:"w-full",children:[o&&(0,s.jsx)(v.f,{className:"mr-2 h-4 w-4 animate-spin"}),e.settings?.account?.update||"Update Profile"]})]})}var ec=e.i(10038),eo=e.i(16715);let ed={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 em({title:e,description:t,tone:a,busy:r,icon:i,onClick:n}){let l=ed[a];return(0,s.jsxs)("div",{className:`p-4 border rounded-lg ${l.card}`,children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:`text-sm flex items-center gap-2 ${l.title}`,children:e}),(0,s.jsx)(C.f,{variant:"info"===a?"outline":"destructive",size:"sm",onClick:n,disabled:r,className:l.button,children:r?(0,s.jsx)(v.f,{className:"h-4 w-4 animate-spin"}):i})]}),(0,s.jsx)("p",{className:`text-xs mt-2 ${l.desc}`,children:t})]})}function eu({isAdmin:e}){let{t:a}=(0,t.b)(),[r,i]=(0,f.useState)(null),n=async(e,s,t,a)=>{i(e);try{Y.c.success(await s()),a&&window.location.reload()}catch(s){W.f.error("[DangerZoneSettings]",`${e} failed`,{error:s}),Y.c.error(t)}finally{i(null)}},l=a.settings?.clearSuccess||"Success",c=a.settings?.clearError||"Failed",o=async()=>{await (0,Y.u)(a.settings?.migrateTagsConfirm||"This will reset system tags. Confirm?",{destructive:!0})&&await n("migrateTags",async()=>{let e=await V.f.post("/api/admin/migrate-tags",{});return`${l}: ${e.count||0} tags migrated.`},a.settings?.clearError||"Failed to migrate tags",!1)},d=async()=>{await (0,Y.u)(a.settings?.clearDataConfirm||"Are you sure?",{destructive:!0})&&await n("clearPractice",async()=>(await V.f.delete("/api/stats/practice/clear"),l),c,!0)},m=async()=>{await (0,Y.u)(a.settings?.clearErrorDataConfirm||"Are you sure?",{destructive:!0})&&await n("clearErrors",async()=>(await V.f.delete("/api/error-items/clear"),l),c,!0)},u=async()=>{if(!await (0,Y.u)(a.settings?.systemResetConfirm||"WARNING: Deleting ALL data. Undoing is impossible. Are you sure?",{destructive:!0}))return;let e=prompt(a.settings?.systemResetPrompt||"Type 'RESET' to confirm system initialization:","");if("RESET"!==e){null!==e&&Y.c.error(a.common?.error||"Confirmation failed");return}await n("systemReset",async()=>(await V.f.post("/api/admin/system-reset",{}),a.settings?.clearSuccess||"Success - System Reset Complete"),a.settings?.clearError||"Failed to reset system",!0)};return(0,s.jsxs)(s.Fragment,{children:[e&&(0,s.jsx)(em,{tone:"info",title:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eo.f,{className:"h-4 w-4"}),a.settings?.migrateTags||"Migrate Tags"]}),description:a.settings?.migrateTagsDesc||"Re-populates standard tags from file",busy:"migrateTags"===r,icon:(0,s.jsx)(eo.f,{className:"h-4 w-4"}),onClick:o}),(0,s.jsx)(em,{tone:"danger",title:a.settings?.clearData||"Clear Practice Data",description:a.settings?.clearDataDesc||"This will permanently delete all practice history. Irreversible.",busy:"clearPractice"===r,icon:(0,s.jsx)(O.f,{className:"h-4 w-4"}),onClick:d}),(0,s.jsx)(em,{tone:"danger",title:a.settings?.clearErrorData||"Clear Error Data",description:a.settings?.clearErrorDataDesc||"This will permanently delete all error items. Irreversible.",busy:"clearErrors"===r,icon:(0,s.jsx)(O.f,{className:"h-4 w-4"}),onClick:m}),e&&(0,s.jsx)(em,{tone:"critical",title:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(g,{className:"h-4 w-4"}),a.settings?.systemReset||"System Initialization"]}),description:a.settings?.systemResetDesc||"Resets the system to factory state. Deletes ALL data.",busy:"systemReset"===r,icon:(0,s.jsx)(O.f,{className:"h-4 w-4"}),onClick:u})]})}var ex=e.i(595468),eh=e.i(440160);let ep=(0,x.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 ef(e,s){let t=await fetch(e);if(!t.ok)throw Error((await t.json().catch(()=>({}))).message||"Export failed");let a=await t.blob(),r=window.URL.createObjectURL(a),i=document.createElement("a");i.href=r;let n=t.headers.get("Content-Disposition")?.match(/filename="(.+)"/);i.download=n?n[1]:s,document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(r)}function eg({isAdmin:e}){let{t:a}=(0,t.b)(),[r,i]=(0,f.useState)(!1),[n,l]=(0,f.useState)(!1),[c,o]=(0,f.useState)(null),d=async e=>{if(!e||await (0,Y.u)(a.settings?.exportAllConfirm||"Export all users' data? This may take a while.")){i(!0);try{await ef(e?"/api/export?all=true":"/api/export",e?"wrong-notebook-export-all.json":"wrong-notebook-export.json"),Y.c.success(a.settings?.exportSuccess||"Export successful")}catch(s){W.f.error("[DataBackupSettings]",e?"Export all failed":"Export failed",{error:s}),Y.c.error(a.settings?.exportFailed||"Export failed")}finally{i(!1)}}},m=async e=>{if(!c)return;let s=e?a.settings?.importAllConfirm||"Import all users' data? This will restore data for all users from the export file.":a.settings?.importConfirm||"Are you sure you want to import?";if(await (0,Y.u)(s)){l(!0);try{let s=JSON.parse(await c.text()),{stats:t}=await V.f.post(e?"/api/import?all=true":"/api/import",s);Y.c.success((a.settings?.importResultDesc||"Imported {subjects} notebooks, {tags} tags, {items} error items, {schedules} review schedules, {records} practice records, {papers} exam papers.").replace("{subjects}",String(t.subjectsCreated)).replace("{tags}",String(t.tagsCreated)).replace("{items}",String(t.errorItemsCreated)).replace("{schedules}",String(t.reviewSchedulesCreated)).replace("{records}",String(t.practiceRecordsCreated)).replace("{papers}",String(t.examPapersCreated??0)).replace("{duplicates}",String(t.duplicateErrorItems??0))),o(null),window.location.reload()}catch(s){W.f.error("[DataBackupSettings]",e?"Import all failed":"Import failed",{error:s}),Y.c.error(a.settings?.importFailed||"Import failed")}finally{l(!1)}}},u=(e,t)=>e?(0,s.jsx)(v.f,{className:"mr-2 h-4 w-4 animate-spin"}):t;return(0,s.jsxs)("div",{className:"p-4 border border-blue-200 rounded-lg bg-blue-50",children:[(0,s.jsx)("h4",{className:"text-sm font-bold text-blue-900 mb-3",children:a.settings?.dataManagement||"Data Management"}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("span",{className:"text-sm text-blue-800 font-medium",children:a.settings?.exportData||"Export Data"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>d(!1),disabled:r,className:"bg-blue-100 hover:bg-blue-200 text-blue-900 border-blue-300",children:[u(r,(0,s.jsx)(eh.f,{className:"mr-2 h-4 w-4"})),a.settings?.exportData||"Export"]}),e&&(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>d(!0),disabled:r,className:"bg-orange-100 hover:bg-orange-200 text-orange-900 border-orange-300",children:[u(r,(0,s.jsx)(eh.f,{className:"mr-2 h-4 w-4"})),a.settings?.exportAllData||"Export All"]})]})]}),(0,s.jsx)("p",{className:"text-xs text-blue-700",children:a.settings?.exportDataDesc||"Export all data as JSON file."})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("span",{className:"text-sm text-blue-800 font-medium",children:a.settings?.importData||"Import Data"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("input",{type:"file",accept:".json",onChange:e=>o(e.target.files?.[0]??c),className:"hidden",id:"import-file-input",disabled:n}),(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>document.getElementById("import-file-input")?.click(),disabled:n,className:"bg-blue-100 hover:bg-blue-200 text-blue-900 border-blue-300",children:[u(n,(0,s.jsx)(ep,{className:"mr-2 h-4 w-4"})),c?.name||a.settings?.selectFile||"Select File"]}),c&&(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>m(!1),disabled:n,className:"bg-green-100 hover:bg-green-200 text-green-900 border-green-300",children:[u(n,(0,s.jsx)(ex.f,{className:"mr-2 h-4 w-4"})),a.settings?.importData||"Import"]}),c&&e&&(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>m(!0),disabled:n,className:"bg-orange-100 hover:bg-orange-200 text-orange-900 border-orange-300",children:[u(n,(0,s.jsx)(ex.f,{className:"mr-2 h-4 w-4"})),a.settings?.importAllData||"Import All"]})]})]}),(0,s.jsx)("p",{className:"text-xs text-blue-700",children:a.settings?.importDataDesc||"Import data from JSON file. Existing data will be skipped."})]})]})}var ej=e.i(307364);function eb({field:e,label:a,description:r}){let{t:i}=(0,t.b)(),[n,l]=(0,f.useState)(!1),[c,o]=(0,f.useState)(!1),[d,m]=(0,f.useState)(!1),[u,x]=(0,f.useState)(null),h=`preference-${e}`;(0,f.useEffect)(()=>{V.f.get("/api/user").then(s=>l(!!s[e])).catch(()=>void 0).finally(()=>o(!0))},[e]);let p=async s=>{l(s),m(!0);try{await V.f.patch("/api/user",{[e]:s}),x(i.importFlow.preferenceSaved)}catch(t){l(!s),x(i.importFlow.preferenceSaveFailed),W.f.error("[Settings]","Failed to save user preference",{field:e,error:t instanceof Error?t.message:String(t)})}finally{m(!1)}};return(0,s.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,s.jsx)(z.f,{htmlFor:h,children:a}),(0,s.jsx)(E.f,{id:h,checked:n,onCheckedChange:p,disabled:!c||d})]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:r}),u&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:u})]})}function ey(){let{t:e}=(0,t.b)();return(0,s.jsx)(eb,{field:"enableGeogebra",label:e.importFlow.enableGeogebra,description:e.importFlow.enableGeogebraDesc})}function ev(){let{t:e}=(0,t.b)();return(0,s.jsx)(eb,{field:"confirmBeforeImport",label:e.importFlow.confirmBeforeImport,description:e.importFlow.confirmBeforeImportDesc})}var ew=e.i(905110);function eN(){let{t:e}=(0,t.b)(),[a,r]=(0,f.useState)(String(ew.z)),[i,n]=(0,f.useState)(null),[l,c]=(0,f.useState)(!0),[o,d]=(0,f.useState)(!1),[m,u]=(0,f.useState)(null),x=Number(a),h=""!==a.trim()&&Number.isInteger(x)&&x>=ew.P&&x<=ew.o,p=(0,f.useCallback)(async()=>{c(!0),u(null);try{let e=(await V.f.get("/api/user")).masteryThreshold??ew.z;r(String(e)),n(e)}catch(s){u(e.mastery.thresholdLoadFailed),W.f.error("[Settings]","加载已掌握阈值失败",{error:s instanceof Error?s.message:String(s)})}finally{c(!1)}},[e.mastery.thresholdLoadFailed]);(0,f.useEffect)(()=>{p()},[p]);let g=async()=>{if(h&&null!==i){d(!0),u(null);try{let s=(await V.f.patch("/api/user",{masteryThreshold:x})).masteryThreshold??x;n(s),r(String(s)),u(e.importFlow.preferenceSaved)}catch(s){u(e.importFlow.preferenceSaveFailed),W.f.error("[Settings]","保存已掌握阈值失败",{error:s instanceof Error?s.message:String(s)})}finally{d(!1)}}};return(0,s.jsxs)("div",{className:"space-y-2 border-t pt-4",children:[(0,s.jsx)(z.f,{htmlFor:"mastery-threshold",children:e.mastery.thresholdLabel}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)(D.f,{id:"mastery-threshold",type:"number",min:ew.P,max:ew.o,step:1,value:a,onChange:e=>{r(e.target.value),u(null)},disabled:l||o||null===i,className:"w-28","aria-describedby":"mastery-threshold-hint"}),(0,s.jsx)("span",{"aria-hidden":"true",children:"%"}),(0,s.jsxs)(C.f,{type:"button",size:"sm",variant:"outline",onClick:g,disabled:l||o||null===i||!h||x===i,children:[(l||o)&&(0,s.jsx)(v.f,{className:"mr-2 h-4 w-4 animate-spin"}),e.importFlow.saveThreshold]}),!l&&null===i&&(0,s.jsx)(C.f,{type:"button",size:"sm",variant:"outline",onClick:p,children:e.importFlow.retryLoad})]}),(0,s.jsx)("p",{id:"mastery-threshold-hint",className:"text-xs text-muted-foreground",children:e.mastery.thresholdDescription}),null!==i&&!h&&(0,s.jsx)("p",{className:"text-xs text-destructive",role:"alert",children:e.mastery.thresholdInvalid}),m&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground",role:"status",children:m})]})}function ek(){let{t:e}=(0,t.b)();return(0,s.jsx)(eb,{field:"enableSvgAnimation",label:e.importFlow.enableSvgAnimation,description:e.importFlow.enableSvgAnimationDesc})}function eS({value:e,onChange:a,disabled:r}){let{t:i}=(0,t.b)();return(0,s.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,s.jsx)(z.f,{htmlFor:"app-time-zone",children:i.settings.general.timeZoneLabel}),(0,s.jsx)(D.f,{id:"app-time-zone",value:e,onChange:e=>a(e.target.value),disabled:r,list:"app-time-zones",placeholder:"Asia/Shanghai"}),(0,s.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(e=>(0,s.jsx)("option",{value:e},e))}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:i.settings.general.timeZoneDesc})]})}function eC({config:e,setConfig:a,isAdmin:i,disabled:n}){let{t:l,language:c,setLanguage:o}=(0,t.b)(),{timeZone:d}=(0,r.M)(),m=e=>a(s=>({...s,timeouts:{...s.timeouts,analyze:1e3*e}}));return(0,s.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(z.f,{children:l.settings?.language||"Language"}),(0,s.jsxs)(ei.d,{value:c,onValueChange:e=>o(e),children:[(0,s.jsx)(ei.P,{children:(0,s.jsx)(ei.U,{})}),(0,s.jsxs)(ei.r,{children:[(0,s.jsx)(ei.T,{value:"zh",children:"中文 (Chinese)"}),(0,s.jsx)(ei.T,{value:"en",children:"English"})]})]})]}),(0,s.jsx)(eS,{value:e.timeZone??d,onChange:e=>a(s=>({...s,timeZone:e})),disabled:!i||n}),i&&(0,s.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,s.jsx)(z.f,{children:l.settings?.general?.timeoutLabel||"AI Analysis Timeout (Seconds)"}),(0,s.jsx)(D.f,{type:"number",value:e.timeouts?.analyze?e.timeouts.analyze/1e3:"",onChange:e=>{let s=""===e.target.value?0:parseInt(e.target.value);m(isNaN(s)?0:s)},onBlur:()=>{let s=(e.timeouts?.analyze||0)/1e3,t=Math.min(600,Math.max(120,s));t!==s&&m(t)},min:120,max:600}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:l.settings?.general?.timeoutDesc||"Increase this value if you experience frequent timeouts during AI analysis."})]}),(0,s.jsx)(ev,{}),(0,s.jsx)(ek,{}),(0,s.jsx)(ey,{}),(0,s.jsx)(ej.f,{}),(0,s.jsx)(eN,{})]})}var eT=e.i(624687),eA=e.i(247167);let eM={trace:10,debug:20,info:30,warn:40,error:50,fatal:60};function e_(e,s={}){let t,a=eM[e],r=(t=eA.default.env.LOG_LEVEL?.toLowerCase())&&void 0!==eM[t]?eM[t]:eM.info;return(t,i)=>{let n,l;if(a<r)return;let c=new Date;"string"==typeof t?(n={},l=t):(n=t,l=i||"");{let t=JSON.stringify({level:e,time:c.toISOString(),...s,...n,msg:l});switch(e){case"error":case"fatal":console.error(t);break;case"warn":console.warn(t);break;default:console.log(t)}}}}(function e(s={}){return s.module,{trace:e_("trace",s),debug:e_("debug",s),info:e_("info",s),warn:e_("warn",s),error:e_("error",s),fatal:e_("fatal",s),child:t=>e({...s,...t}),box:(e,t,a="📋")=>{console.log(JSON.stringify({level:"info",time:new Date().toISOString(),...s,title:e,..."string"==typeof t?{content:t}:t||{},msg:e}))},divider:(e="-")=>{}}})({env:"production"}).child({module:"ai:prompts"});let eE=`请参考《高思学校竞赛数学导引》(每讲分兴趣篇、拓展篇、超越篇,题目左侧标 1~5 颗星)的星级标准,结合题目所在年级评定难度:
2
2
  - 1 星:课本基础题,直接套用概念、公式或简单计算即可(相当于兴趣篇前几题)。
3
3
  - 2 星:校内拔高题,需要两三步推理或简单综合(相当于兴趣篇后几题)。
4
4
  - 3 星:常规奥数题,小升初、杯赛常见难度,需要掌握该专题的典型方法(相当于拓展篇)。
5
5
  - 4 星:较难奥数题,需要构造、分类讨论、转化或多种方法综合(相当于拓展篇末题、超越篇前几题)。
6
6
  - 5 星:竞赛压轴题,集训队水平,思路巧妙、步骤长(相当于超越篇难题)。
7
- 非数学学科按同样的 1~5 级划分:1 星为基础识记,3 星为综合应用,5 星为竞赛或压轴难度。`,e_=`- 输出一个完整的 <svg> 元素,包含 xmlns="http://www.w3.org/2000/svg" 和 viewBox(建议宽 400~600),不要用 Markdown 代码块包裹。
7
+ 非数学学科按同样的 1~5 级划分:1 星为基础识记,3 星为综合应用,5 星为竞赛或压轴难度。`,eD=`- 输出一个完整的 <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>、外部链接、外部字体或事件属性。`,eE=String.raw`- 行内公式用 $...$,独立公式用 $$...$$;不要用 \(...\) 或 \[...\],每个 $ 必须成对出现。
11
+ - 严禁使用 <image>、<script>、<foreignObject>、外部链接、外部字体或事件属性。`,ez=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 等环境里。`,eD=`【角色与核心任务 (ROLE AND CORE TASK)】
16
+ - 反斜杠只写一个(\frac),不要写成 \\frac;换行符 \\ 只能用在 cases、aligned 等环境里。`,eF=`【角色与核心任务 (ROLE AND CORE TASK)】
17
17
  你是一位世界顶尖的、经验丰富的、专业的跨学科考试分析专家(Interdisciplinary Exam Analysis Expert)。你的核心任务是极致准确地分析用户提供的考试题目图片,全面理解所有文本、图表和隐含约束,并提供一个完整、高度结构化且专业的解决方案。
18
18
 
19
19
  {{language_instruction}}
@@ -41,7 +41,7 @@
41
41
 
42
42
  <figure_svg>
43
43
  如果 has_figure 为 true,用 SVG 重新绘制题目配图:
44
- ${e_}
44
+ ${eD}
45
45
  如果 has_figure 为 false,请留空。
46
46
  </figure_svg>
47
47
 
@@ -55,7 +55,7 @@ ${e_}
55
55
 
56
56
  <difficulty_stars>
57
57
  只填写 1 到 5 之间的一个整数,表示题目难度星级。
58
- ${eM}
58
+ ${eE}
59
59
  </difficulty_stars>
60
60
 
61
61
  <mistake_analysis>
@@ -130,10 +130,10 @@ ${eM}
130
130
  3. **内容完整**:如果包含子问题,请在 question_text 中完整列出。
131
131
  4. **禁止图片**:严禁包含任何图片链接或 markdown 图片语法。
132
132
  5. **LaTeX 规范**:
133
- ${eE}
133
+ ${ez}
134
134
 
135
135
  {{grade_instruction}}
136
- {{provider_hints}}`,ez=`你是一位资深的K12教育题目生成专家,具备跨学科的题目创作能力。你的核心任务是**根据以下原题和知识点,举一反三生成高质量教学题目**,帮助学生巩固知识并拓展解题思路。
136
+ {{provider_hints}}`,eL=`你是一位资深的K12教育题目生成专家,具备跨学科的题目创作能力。你的核心任务是**根据以下原题和知识点,举一反三生成高质量教学题目**,帮助学生巩固知识并拓展解题思路。
137
137
  ### 角色定义
138
138
  1. **学科全能专家**
139
139
  - 精通K12阶段所有学科(数学/语文/英语/物理/化学/生物/历史/地理/政治)
@@ -185,7 +185,7 @@ ${eE}
185
185
  ###关键格式与内容约束 (CRITICAL RULES) !!!
186
186
  1. **纯文本**:内容作为纯文本处理,**不要转义反斜杠**。
187
187
  2. **LaTeX 规范**:
188
- ${eE}
188
+ ${ez}
189
189
 
190
190
  {{grade_instruction}}
191
- {{provider_hints}}`;var eR=e.i(367240);function eI({name:e,description:t}){return(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start gap-1 sm:gap-2 text-xs py-1",children:[(0,s.jsx)("code",{className:"bg-muted px-1.5 py-0.5 rounded font-mono text-primary shrink-0 w-fit",children:`{{${e}}}`}),(0,s.jsx)("span",{className:"text-muted-foreground",children:t})]})}function eL(){let{t:e}=(0,t.b)();return(0,s.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,s.jsx)(f,{className:"h-5 w-5 shrink-0 text-amber-600"}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("p",{className:"font-medium",children:e.settings?.prompts?.caution||"Modify with Caution"}),(0,s.jsx)("p",{className:"text-amber-800/90 text-xs",children:e.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 eF({config:e,onUpdate:a}){let{t:r}=(0,t.b)(),i=e.prompts?.analyze||eD,n=e.prompts?.similar||ez,l=async e=>{await (0,Y.u)(r.settings?.prompts?.resetConfirm||"Are you sure you want to reset to default?",{destructive:!0})&&a(e,"analyze"===e?eD:ez)},c=(e,s)=>{a(e,s)};return(0,s.jsx)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:(0,s.jsxs)(A.i,{defaultValue:"analyze",className:"w-full",children:[(0,s.jsxs)(A.U,{className:"grid w-full grid-cols-2",children:[(0,s.jsx)(A.k,{value:"analyze",children:r.settings?.prompts?.analysisTab||"Analysis Prompt"}),(0,s.jsx)(A.k,{value:"similar",children:r.settings?.prompts?.similarTab||"Similar Question Prompt"})]}),(0,s.jsx)(A.S,{value:"analyze",className:"space-y-4 py-4",children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(z.f,{className:"text-base font-semibold",children:r.settings?.prompts?.customAnalysis||"Custom Analysis Template"}),(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>l("analyze"),children:[(0,s.jsx)(eR.f,{className:"w-4 h-4 mr-2"}),r.settings?.prompts?.reset||"Reset Default"]})]}),(0,s.jsx)(eL,{}),(0,s.jsxs)("div",{className:"space-y-2 border rounded-md p-3 bg-background",children:[(0,s.jsxs)("h4",{className:"text-xs font-medium flex items-center gap-1.5 mb-2",children:[(0,s.jsx)(b,{className:"h-3.5 w-3.5"}),r.settings?.prompts?.variables||"Available Variables"]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(eI,{name:"language_instruction",description:r.settings?.prompts?.vars?.languageInstruction||"Injects instructions based on target language (e.g., keep English questions in English but analysis in Chinese)."}),(0,s.jsx)(eI,{name:"knowledge_points_list",description:r.settings?.prompts?.vars?.knowledgePointsList||"Injects the standard list of knowledge point tags for the specific subject."}),(0,s.jsx)(eI,{name:"provider_hints",description:r.settings?.prompts?.vars?.providerHints||"System-injected hints (e.g., enforcing JSON format)."})]})]}),(0,s.jsx)(eS.f,{value:i,onChange:e=>c("analyze",e.target.value),className:"font-mono text-xs min-h-[400px]",placeholder:eD})]})}),(0,s.jsx)(A.S,{value:"similar",className:"space-y-4 py-4",children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(z.f,{className:"text-base font-semibold",children:r.settings?.prompts?.customSimilar||"Custom Similar Question Template"}),(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>l("similar"),children:[(0,s.jsx)(eR.f,{className:"w-4 h-4 mr-2"}),r.settings?.prompts?.reset||"Reset Default"]})]}),(0,s.jsx)(eL,{}),(0,s.jsxs)("div",{className:"space-y-2 border rounded-md p-3 bg-background",children:[(0,s.jsxs)("h4",{className:"text-xs font-medium flex items-center gap-1.5 mb-2",children:[(0,s.jsx)(b,{className:"h-3.5 w-3.5"}),r.settings?.prompts?.variables||"Available Variables"]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(eI,{name:"difficulty_level",description:r.settings?.prompts?.vars?.difficultyLevel||"Target difficulty level."}),(0,s.jsx)(eI,{name:"difficulty_instruction",description:r.settings?.prompts?.vars?.difficultyInstruction||"Specific writing instructions for the target difficulty."}),(0,s.jsx)(eI,{name:"original_question",description:r.settings?.prompts?.vars?.originalQuestion||"The full text of the original question."}),(0,s.jsx)(eI,{name:"knowledge_points",description:r.settings?.prompts?.vars?.knowledgePoints||"List of knowledge points to test."}),(0,s.jsx)(eI,{name:"language_instruction",description:r.settings?.prompts?.vars?.languageInstructionShort||"Language formatting instructions."})]})]}),(0,s.jsx)(eS.f,{value:n,onChange:e=>c("similar",e.target.value),className:"font-mono text-xs min-h-[400px]",placeholder:ez})]})})]})})}var e$=e.i(835467);function eU({value:e,icon:t,label:a}){return(0,s.jsxs)(A.k,{value:e,className:"px-2 sm:px-3",children:[t,(0,s.jsx)("span",{className:"hidden sm:inline",children:a})]})}function eP(){let{setTimeZone:e}=(0,r.M)(),{data:i}=(0,a.useSession)(),n=i?.user?.role==="admin",{t:o}=(0,t.b)(),d=(0,l.useRouter)(),[m,u]=(0,g.useState)(!1),x=(0,g.useRef)(null),[h,_]=(0,g.useState)(!1),[E,D]=(0,g.useState)(!1),[z,R]=(0,g.useState)({aiProvider:"minimax"}),I=(0,g.useCallback)(async()=>{D(!0);try{R(await V.f.get("/api/settings"))}catch(e){W.f.error("[SettingsDialog]","Failed to fetch settings",{error:e})}finally{D(!1)}},[]);(0,g.useEffect)(()=>{m&&I()},[m,I]);let L=async()=>{let s=(0,e$.f)(z,o);if(s)return void Y.c.error(s);_(!0);try{let s=await V.f.post("/api/settings",z);R(s),e(s.timeZone||M.J),Y.c.success(o.settings?.messages?.saved||"Settings saved"),x.current?.scrollTo({top:0,behavior:"smooth"})}catch(e){W.f.error("[SettingsDialog]","Failed to save settings",{error:e}),Y.c.error(o.settings?.messages?.saveFailed||"Failed to save")}finally{_(!1)}},F=e=>(0,s.jsxs)(C.f,{onClick:L,disabled:h,className:"w-full",children:[h&&(0,s.jsx)(y.f,{className:"mr-2 h-4 w-4 animate-spin"}),e]});return(0,s.jsxs)(T.N,{open:m,onOpenChange:u,children:[(0,s.jsx)(T.a,{asChild:!0,children:(0,s.jsxs)(C.f,{variant:"ghost",size:"icon",className:"rounded-full",children:[(0,s.jsx)(N,{className:"h-5 w-5"}),(0,s.jsx)("span",{className:"sr-only",children:o.settings?.title||"Settings"})]})}),(0,s.jsxs)(T.d,{ref:x,className:"w-[calc(100vw-2rem)] sm:max-w-[900px] max-h-[85vh] overflow-y-auto",children:[(0,s.jsxs)(T.s,{children:[(0,s.jsx)(T.F,{children:o.settings?.title||"Settings"}),(0,s.jsx)(T.C,{children:o.settings?.desc||"Manage your preferences and data."})]}),(0,s.jsxs)(A.i,{defaultValue:"general",className:"w-full",children:[(0,s.jsxs)(A.U,{className:`grid w-full grid-cols-4 ${n?"sm:grid-cols-7":"sm:grid-cols-4"} gap-1 h-auto`,children:[(0,s.jsx)(eU,{value:"general",icon:(0,s.jsx)(v.f,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.general||"General"}),(0,s.jsx)(eU,{value:"account",icon:(0,s.jsx)(k.f,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.account||"Account"}),n&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eU,{value:"ai",icon:(0,s.jsx)(j,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.ai||"AI Provider"}),(0,s.jsx)(eU,{value:"prompts",icon:(0,s.jsx)(w,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.prompts||"Prompts"}),(0,s.jsx)(eU,{value:"admin",icon:(0,s.jsx)(p,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.admin||"User Management"})]}),(0,s.jsx)(eU,{value:"danger",icon:(0,s.jsx)(f,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.danger||"Danger"}),(0,s.jsx)(eU,{value:"about",icon:(0,s.jsx)(b,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.about||"About"})]}),(0,s.jsxs)(A.S,{value:"general",className:"space-y-4 py-4",children:[(0,s.jsx)(ek,{config:z,setConfig:R,isAdmin:n,disabled:E||h}),n&&F(o.settings?.save||"Save Settings")]}),(0,s.jsx)(A.S,{value:"account",className:"space-y-4 py-4",children:(0,s.jsx)(el,{})}),(0,s.jsx)(A.S,{value:"ai",className:"space-y-4 py-4",children:(0,s.jsx)(ec.f,{config:z,setConfig:R,loading:E,saving:h,onSave:L})}),(0,s.jsxs)(A.S,{value:"prompts",className:"space-y-4 py-4",children:[(0,s.jsx)(eF,{config:z,onUpdate:(e,s)=>R(t=>({...t,prompts:{...t.prompts,[e]:s}}))}),F(o.settings?.prompts?.save||"Save Prompt Settings")]}),n&&(0,s.jsxs)(A.S,{value:"admin",className:"space-y-4 py-4",children:[(0,s.jsxs)(C.f,{variant:"outline",className:"w-full justify-start gap-2",onClick:()=>{u(!1),d.push("/admin")},children:[(0,s.jsx)(c.f,{className:"h-4 w-4"}),o.admin?.dashboard?.title||"Admin Dashboard"]}),(0,s.jsxs)(C.f,{variant:"outline",className:"w-full justify-start gap-2",onClick:()=>{u(!1),d.push("/setup")},children:[(0,s.jsx)(S.f,{className:"h-4 w-4"}),o.setup.rerun]}),(0,s.jsx)("div",{className:"border-t pt-4",children:(0,s.jsx)(J,{})})]}),(0,s.jsx)(A.S,{value:"danger",className:"space-y-4 py-4",children:(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)(ef,{isAdmin:n}),(0,s.jsx)(eu,{isAdmin:n})]})}),(0,s.jsx)(A.S,{value:"about",className:"space-y-4 py-4",children:(0,s.jsx)(ea,{})})]})]})]})}let eO=[/^\/login/,/^\/register/,/^\/setup/,/^\/print-preview/,/^\/exams\/[^/]+\/print/],eq=[{key:"home",href:"/",icon:h,match:e=>"/"===e},{key:"notebooks",href:"/notebooks",icon:o.f,match:e=>e.startsWith("/notebooks")||e.startsWith("/error-items")||e.startsWith("/practice")},{key:"review",href:"/review",icon:d.f,match:e=>e.startsWith("/review")},{key:"stats",href:"/stats",icon:c.f,match:e=>e.startsWith("/stats")||e.startsWith("/tags")},{key:"exams",href:"/exams",icon:m.f,match:e=>e.startsWith("/exams")}];function eH({children:e}){var r;let c,o,d=(0,l.usePathname)()||"/",{t:m}=(0,t.b)(),{data:x,status:h}=(0,a.useSession)(),f=x?.user?.role==="admin",j=eO.some(e=>e.test(d));if(r=f&&!j,c=(0,l.useRouter)(),o=(0,g.useRef)(!1),(0,g.useEffect)(()=>{r&&!o.current&&(o.current=!0,V.f.get("/api/setup").then(e=>{e.needsSetup&&c.replace("/setup")}).catch(e=>W.f.warn("[Setup]","Failed to check setup status",{error:e})))},[r,c]),j||"unauthenticated"===h)return(0,s.jsx)(s.Fragment,{children:e});let b=x?.user?.name||x?.user?.email||"";return(0,s.jsxs)("div",{className:"min-h-screen",children:[(0,s.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,s.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,s.jsxs)(n.default,{href:"/",className:"flex shrink-0 items-center gap-2",children:[(0,s.jsx)(i.default,{src:"/icons/icon.png",alt:"",width:32,height:32,className:"rounded-lg",priority:!0,unoptimized:!0}),(0,s.jsx)("span",{className:"text-base font-semibold tracking-tight",children:m.pageTitle.base})]}),(0,s.jsx)("nav",{className:"ml-4 hidden items-center gap-1 md:flex",children:eq.map(e=>{let t=e.match(d),a=e.icon;return(0,s.jsxs)(n.default,{href:e.href,className:(0,R.f)("flex items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors",t?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground"),"aria-current":t?"page":void 0,children:[(0,s.jsx)(a,{className:"h-4 w-4"}),m.nav[e.key]]},e.key)})}),(0,s.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[b&&(0,s.jsxs)("span",{className:"mr-2 hidden max-w-40 items-center gap-2 truncate text-sm text-muted-foreground lg:flex",children:[(0,s.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:b.slice(0,1).toUpperCase()}),(0,s.jsx)("span",{className:"truncate",children:b})]}),f&&(0,s.jsx)(n.default,{href:"/admin",title:m.nav.admin,children:(0,s.jsxs)(C.f,{variant:"ghost",size:"icon",className:"rounded-full",children:[(0,s.jsx)(p,{className:"h-5 w-5"}),(0,s.jsx)("span",{className:"sr-only",children:m.nav.admin})]})}),(0,s.jsx)(eP,{}),(0,s.jsx)(C.f,{variant:"ghost",size:"icon",className:"rounded-full text-muted-foreground hover:text-destructive",onClick:()=>(0,a.signOut)({callbackUrl:"/login"}),title:m.app.logout,children:(0,s.jsx)(u.f,{className:"h-5 w-5"})})]})]})}),(0,s.jsx)("div",{className:"pb-20 md:pb-0",children:e}),(0,s.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,s.jsx)("div",{className:"grid h-16 grid-cols-5",children:eq.map(e=>{let t=e.match(d),a=e.icon;return(0,s.jsxs)(n.default,{href:e.href,className:(0,R.f)("flex flex-col items-center justify-center gap-1 text-[11px] font-medium transition-colors",t?"text-primary":"text-muted-foreground"),"aria-current":t?"page":void 0,children:[(0,s.jsx)("span",{className:(0,R.f)("flex h-7 w-12 items-center justify-center rounded-full transition-colors",t&&"bg-accent"),children:(0,s.jsx)(a,{className:"h-5 w-5"})}),m.nav[e.key]]},e.key)})})})]})}let eV=(0,x.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"}]]);var eY=e.i(373884);let eW=[/^\/login/,/^\/register/,/^\/print-preview/,/^\/exams\/[^/]+\/print/];function eB(){let{t:e}=(0,t.b)(),{timeZone:i}=(0,r.M)(),{status:c}=(0,a.useSession)(),o=(0,l.usePathname)(),[d,m]=(0,g.useState)(!1),[u,x]=(0,g.useState)([]),[h,p]=(0,g.useState)(()=>Date.now()),f="authenticated"!==c||eW.some(e=>e.test(o||"")),j=(0,g.useCallback)(async()=>{if("u"<typeof document||"hidden"!==document.visibilityState)try{let e=await V.f.get("/api/tasks");x(e.tasks),p(Date.now())}catch{}},[]);if((0,g.useEffect)(()=>{if(f)return;let e=setTimeout(j,0),s=setInterval(j,d?2e3:15e3);return()=>{clearTimeout(e),clearInterval(s)}},[f,d,j]),f)return null;let b=u.filter(e=>"running"===e.status).length,v=u.some(e=>"running"!==e.status),w=async()=>{try{let e=await V.f.delete("/api/tasks");x(e.tasks)}catch{}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(C.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:()=>m(!0),"aria-label":e.backgroundTasks.title,title:e.backgroundTasks.title,children:[b>0?(0,s.jsx)(y.f,{className:"h-5 w-5 animate-spin"}):(0,s.jsx)(eV,{className:"h-5 w-5"}),b>0&&(0,s.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:b})]}),(0,s.jsx)(T.N,{open:d,onOpenChange:m,children:(0,s.jsxs)(T.d,{className:"max-h-[85vh] overflow-y-auto sm:max-w-lg",children:[(0,s.jsxs)(T.s,{children:[(0,s.jsx)(T.F,{children:e.backgroundTasks.title}),(0,s.jsx)(T.C,{children:e.backgroundTasks.description})]}),0===u.length?(0,s.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:e.backgroundTasks.empty}):(0,s.jsx)("ul",{className:"space-y-2",children:u.map(t=>{var a,r;let l;return(0,s.jsx)("li",{className:"rounded-md border p-3 text-sm",children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:["running"===t.status&&(0,s.jsx)(y.f,{className:"mt-0.5 h-4 w-4 shrink-0 animate-spin text-primary"}),"succeeded"===t.status&&(0,s.jsx)(ex.f,{className:"mt-0.5 h-4 w-4 shrink-0 text-green-600"}),"failed"===t.status&&(0,s.jsx)(eY.f,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),(0,s.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,s.jsxs)("div",{className:"font-medium",children:[e.backgroundTasks.kinds[t.kind],(0,s.jsxs)("span",{className:"font-normal text-muted-foreground",children:[" · ",e.backgroundTasks.status[t.status]]})]}),t.subject&&(0,s.jsx)("div",{className:"break-words text-muted-foreground",children:t.subject}),t.progress&&t.progress.total>0&&(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("div",{className:"h-1.5 overflow-hidden rounded bg-muted",children:(0,s.jsx)("div",{className:"h-full bg-primary transition-all",style:{width:`${Math.round(t.progress.done/t.progress.total*100)}%`}})}),(0,s.jsxs)("div",{className:"text-xs text-muted-foreground",children:[e.backgroundTasks.progress.replace("{done}",String(t.progress.done)).replace("{total}",String(t.progress.total)),t.progress.failed>0&&` \xb7 ${e.backgroundTasks.failedCount.replace("{count}",String(t.progress.failed))}`]})]}),t.error&&(0,s.jsx)("div",{className:"text-xs text-destructive",children:(s=>{if(!s)return null;let t=e.backgroundTasks.errors[s]??e.errors[s];return"string"==typeof t?t:s})(t.error)}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 text-xs text-muted-foreground",children:[(0,s.jsx)("span",{children:e.backgroundTasks.startedAt.replace("{time}",(0,M.r)(t.startedAt,"HH:mm:ss",i))}),(0,s.jsx)("span",{children:e.backgroundTasks.elapsed.replace("{time}",(a=t.startedAt,r=t.finishedAt,l=Math.max(0,Math.round(((r?Date.parse(r):h)-Date.parse(a))/1e3)),`${Math.floor(l/60)}:${String(l%60).padStart(2,"0")}`))}),t.link&&(0,s.jsx)(n.default,{href:t.link,className:"text-primary hover:underline",onClick:()=>m(!1),children:e.backgroundTasks.view})]})]})]})},t.id)})}),(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2 pt-1",children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:e.backgroundTasks.retentionHint}),v&&(0,s.jsx)(C.f,{variant:"ghost",size:"sm",onClick:w,children:e.backgroundTasks.clearFinished})]})]})})]})}var eJ=e.i(37727);let eX={success:{icon:ex.f,className:"text-success"},error:{icon:eY.f,className:"text-destructive"},warning:{icon:f,className:"text-warning"},info:{icon:b,className:"text-primary"}};function eG(){let{t:e}=(0,t.b)(),[a,r]=(0,g.useState)([]),[i,n]=(0,g.useState)(null);return(0,g.useEffect)(()=>(0,Y.M)(e=>{r(e.toasts),n(e.confirm)}),[]),(0,s.jsxs)(s.Fragment,{children:[(0,s.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:a.map(t=>{let{icon:a,className:r}=eX[t.type];return(0,s.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,s.jsx)(a,{className:(0,R.f)("mt-0.5 h-4 w-4 shrink-0",r)}),(0,s.jsx)("p",{className:"min-w-0 flex-1 whitespace-pre-line break-words leading-relaxed",children:t.message}),(0,s.jsx)("button",{type:"button",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:text-foreground",onClick:()=>(0,Y.p)(t.id),"aria-label":e.common.close,children:(0,s.jsx)(eJ.X,{className:"h-3.5 w-3.5"})})]},t.id)})}),(0,s.jsx)(T.N,{open:!!i,onOpenChange:e=>{e||i?.resolve(!1)},children:(0,s.jsxs)(T.d,{className:"sm:max-w-md",children:[(0,s.jsxs)(T.s,{children:[(0,s.jsxs)(T.F,{className:"flex items-center gap-2",children:[i?.destructive&&(0,s.jsx)(f,{className:"h-5 w-5 text-destructive"}),i?.title||e.common.confirmTitle]}),(0,s.jsx)(T.C,{className:"whitespace-pre-line pt-1 text-left leading-relaxed",children:i?.message})]}),(0,s.jsxs)(T.c,{className:"gap-2",children:[(0,s.jsx)(C.f,{variant:"outline",onClick:()=>i?.resolve(!1),children:i?.cancelText||e.common.cancel}),(0,s.jsx)(C.f,{variant:i?.destructive?"destructive":"default",onClick:()=>i?.resolve(!0),autoFocus:!0,children:i?.confirmText||e.common.confirm})]})]})})]})}function eK(){return(0,g.useEffect)(()=>{"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js",{scope:"/"}).catch(e=>{W.f.warn("[PWA]","Service worker registration failed",{error:String(e)})})},[]),null}e.s(["Providers",0,function({children:e,timeZone:i}){return(0,s.jsx)(a.SessionProvider,{children:(0,s.jsx)(t.w,{children:(0,s.jsxs)(r.n,{initialTimeZone:i,children:[(0,s.jsx)(eH,{children:e}),(0,s.jsx)(eB,{}),(0,s.jsx)(eG,{}),(0,s.jsx)(eK,{})]})})})}],1661)}]);
191
+ {{provider_hints}}`;var eR=e.i(367240);function eI({name:e,description:t}){return(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start gap-1 sm:gap-2 text-xs py-1",children:[(0,s.jsx)("code",{className:"bg-muted px-1.5 py-0.5 rounded font-mono text-primary shrink-0 w-fit",children:`{{${e}}}`}),(0,s.jsx)("span",{className:"text-muted-foreground",children:t})]})}function e$(){let{t:e}=(0,t.b)();return(0,s.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,s.jsx)(g,{className:"h-5 w-5 shrink-0 text-amber-600"}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("p",{className:"font-medium",children:e.settings?.prompts?.caution||"Modify with Caution"}),(0,s.jsx)("p",{className:"text-amber-800/90 text-xs",children:e.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 eU({config:e,onUpdate:a}){let{t:r}=(0,t.b)(),i=e.prompts?.analyze||eF,n=e.prompts?.similar||eL,l=async e=>{await (0,Y.u)(r.settings?.prompts?.resetConfirm||"Are you sure you want to reset to default?",{destructive:!0})&&a(e,"analyze"===e?eF:eL)},c=(e,s)=>{a(e,s)};return(0,s.jsx)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:(0,s.jsxs)(A.i,{defaultValue:"analyze",className:"w-full",children:[(0,s.jsxs)(A.U,{className:"grid w-full grid-cols-2",children:[(0,s.jsx)(A.k,{value:"analyze",children:r.settings?.prompts?.analysisTab||"Analysis Prompt"}),(0,s.jsx)(A.k,{value:"similar",children:r.settings?.prompts?.similarTab||"Similar Question Prompt"})]}),(0,s.jsx)(A.S,{value:"analyze",className:"space-y-4 py-4",children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(z.f,{className:"text-base font-semibold",children:r.settings?.prompts?.customAnalysis||"Custom Analysis Template"}),(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>l("analyze"),children:[(0,s.jsx)(eR.f,{className:"w-4 h-4 mr-2"}),r.settings?.prompts?.reset||"Reset Default"]})]}),(0,s.jsx)(e$,{}),(0,s.jsxs)("div",{className:"space-y-2 border rounded-md p-3 bg-background",children:[(0,s.jsxs)("h4",{className:"text-xs font-medium flex items-center gap-1.5 mb-2",children:[(0,s.jsx)(b,{className:"h-3.5 w-3.5"}),r.settings?.prompts?.variables||"Available Variables"]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(eI,{name:"language_instruction",description:r.settings?.prompts?.vars?.languageInstruction||"Injects instructions based on target language (e.g., keep English questions in English but analysis in Chinese)."}),(0,s.jsx)(eI,{name:"knowledge_points_list",description:r.settings?.prompts?.vars?.knowledgePointsList||"Injects the standard list of knowledge point tags for the specific subject."}),(0,s.jsx)(eI,{name:"provider_hints",description:r.settings?.prompts?.vars?.providerHints||"System-injected hints (e.g., enforcing JSON format)."})]})]}),(0,s.jsx)(eT.f,{value:i,onChange:e=>c("analyze",e.target.value),className:"font-mono text-xs min-h-[400px]",placeholder:eF})]})}),(0,s.jsx)(A.S,{value:"similar",className:"space-y-4 py-4",children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(z.f,{className:"text-base font-semibold",children:r.settings?.prompts?.customSimilar||"Custom Similar Question Template"}),(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>l("similar"),children:[(0,s.jsx)(eR.f,{className:"w-4 h-4 mr-2"}),r.settings?.prompts?.reset||"Reset Default"]})]}),(0,s.jsx)(e$,{}),(0,s.jsxs)("div",{className:"space-y-2 border rounded-md p-3 bg-background",children:[(0,s.jsxs)("h4",{className:"text-xs font-medium flex items-center gap-1.5 mb-2",children:[(0,s.jsx)(b,{className:"h-3.5 w-3.5"}),r.settings?.prompts?.variables||"Available Variables"]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(eI,{name:"difficulty_level",description:r.settings?.prompts?.vars?.difficultyLevel||"Target difficulty level."}),(0,s.jsx)(eI,{name:"difficulty_instruction",description:r.settings?.prompts?.vars?.difficultyInstruction||"Specific writing instructions for the target difficulty."}),(0,s.jsx)(eI,{name:"original_question",description:r.settings?.prompts?.vars?.originalQuestion||"The full text of the original question."}),(0,s.jsx)(eI,{name:"knowledge_points",description:r.settings?.prompts?.vars?.knowledgePoints||"List of knowledge points to test."}),(0,s.jsx)(eI,{name:"language_instruction",description:r.settings?.prompts?.vars?.languageInstructionShort||"Language formatting instructions."})]})]}),(0,s.jsx)(eT.f,{value:n,onChange:e=>c("similar",e.target.value),className:"font-mono text-xs min-h-[400px]",placeholder:eL})]})})]})})}var eP=e.i(835467);function eO({value:e,icon:t,label:a}){return(0,s.jsxs)(A.k,{value:e,className:"px-2 sm:px-3",children:[t,(0,s.jsx)("span",{className:"hidden sm:inline",children:a})]})}function eq(){let{setTimeZone:e}=(0,r.M)(),{data:i}=(0,a.useSession)(),n=i?.user?.role==="admin",{t:o}=(0,t.b)(),d=(0,l.useRouter)(),[m,u]=(0,f.useState)(!1),x=(0,f.useRef)(null),[h,_]=(0,f.useState)(!1),[E,D]=(0,f.useState)(!1),[z,F]=(0,f.useState)({aiProvider:"minimax"}),L=(0,f.useCallback)(async()=>{D(!0);try{F(await V.f.get("/api/settings"))}catch(e){W.f.error("[SettingsDialog]","Failed to fetch settings",{error:e})}finally{D(!1)}},[]);(0,f.useEffect)(()=>{m&&L()},[m,L]);let R=async()=>{let s=(0,eP.f)(z,o);if(s)return void Y.c.error(s);_(!0);try{let s=await V.f.post("/api/settings",z);F(s),e(s.timeZone||M.J),Y.c.success(o.settings?.messages?.saved||"Settings saved"),x.current?.scrollTo({top:0,behavior:"smooth"})}catch(e){W.f.error("[SettingsDialog]","Failed to save settings",{error:e}),Y.c.error(o.settings?.messages?.saveFailed||"Failed to save")}finally{_(!1)}},I=e=>(0,s.jsxs)(C.f,{onClick:R,disabled:h,className:"w-full",children:[h&&(0,s.jsx)(v.f,{className:"mr-2 h-4 w-4 animate-spin"}),e]});return(0,s.jsxs)(T.N,{open:m,onOpenChange:u,children:[(0,s.jsx)(T.a,{asChild:!0,children:(0,s.jsxs)(C.f,{variant:"ghost",size:"icon",className:"rounded-full",children:[(0,s.jsx)(N,{className:"h-5 w-5"}),(0,s.jsx)("span",{className:"sr-only",children:o.settings?.title||"Settings"})]})}),(0,s.jsxs)(T.d,{ref:x,className:"w-[calc(100vw-2rem)] sm:max-w-[900px] max-h-[85vh] overflow-y-auto",children:[(0,s.jsxs)(T.s,{children:[(0,s.jsx)(T.F,{children:o.settings?.title||"Settings"}),(0,s.jsx)(T.C,{children:o.settings?.desc||"Manage your preferences and data."})]}),(0,s.jsxs)(A.i,{defaultValue:"general",className:"w-full",children:[(0,s.jsxs)(A.U,{className:`grid w-full grid-cols-4 ${n?"sm:grid-cols-7":"sm:grid-cols-4"} gap-1 h-auto`,children:[(0,s.jsx)(eO,{value:"general",icon:(0,s.jsx)(y.f,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.general||"General"}),(0,s.jsx)(eO,{value:"account",icon:(0,s.jsx)(k.f,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.account||"Account"}),n&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eO,{value:"ai",icon:(0,s.jsx)(j,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.ai||"AI Provider"}),(0,s.jsx)(eO,{value:"prompts",icon:(0,s.jsx)(w,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.prompts||"Prompts"}),(0,s.jsx)(eO,{value:"admin",icon:(0,s.jsx)(p,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.admin||"User Management"})]}),(0,s.jsx)(eO,{value:"danger",icon:(0,s.jsx)(g,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.danger||"Danger"}),(0,s.jsx)(eO,{value:"about",icon:(0,s.jsx)(b,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.about||"About"})]}),(0,s.jsxs)(A.S,{value:"general",className:"space-y-4 py-4",children:[(0,s.jsx)(eC,{config:z,setConfig:F,isAdmin:n,disabled:E||h}),n&&I(o.settings?.save||"Save Settings")]}),(0,s.jsx)(A.S,{value:"account",className:"space-y-4 py-4",children:(0,s.jsx)(el,{})}),(0,s.jsx)(A.S,{value:"ai",className:"space-y-4 py-4",children:(0,s.jsx)(ec.f,{config:z,setConfig:F,loading:E,saving:h,onSave:R})}),(0,s.jsxs)(A.S,{value:"prompts",className:"space-y-4 py-4",children:[(0,s.jsx)(eU,{config:z,onUpdate:(e,s)=>F(t=>({...t,prompts:{...t.prompts,[e]:s}}))}),I(o.settings?.prompts?.save||"Save Prompt Settings")]}),n&&(0,s.jsxs)(A.S,{value:"admin",className:"space-y-4 py-4",children:[(0,s.jsxs)(C.f,{variant:"outline",className:"w-full justify-start gap-2",onClick:()=>{u(!1),d.push("/admin")},children:[(0,s.jsx)(c.f,{className:"h-4 w-4"}),o.admin?.dashboard?.title||"Admin Dashboard"]}),(0,s.jsxs)(C.f,{variant:"outline",className:"w-full justify-start gap-2",onClick:()=>{u(!1),d.push("/setup")},children:[(0,s.jsx)(S.f,{className:"h-4 w-4"}),o.setup.rerun]}),(0,s.jsx)("div",{className:"border-t pt-4",children:(0,s.jsx)(J,{})})]}),(0,s.jsx)(A.S,{value:"danger",className:"space-y-4 py-4",children:(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)(eg,{isAdmin:n}),(0,s.jsx)(eu,{isAdmin:n})]})}),(0,s.jsx)(A.S,{value:"about",className:"space-y-4 py-4",children:(0,s.jsx)(ea,{})})]})]})]})}let eH=[/^\/login/,/^\/register/,/^\/setup/,/^\/print-preview/,/^\/exams\/[^/]+\/print/],eV=[{key:"home",href:"/",icon:h,match:e=>"/"===e},{key:"notebooks",href:"/notebooks",icon:o.f,match:e=>e.startsWith("/notebooks")||e.startsWith("/error-items")||e.startsWith("/practice")},{key:"review",href:"/review",icon:d.f,match:e=>e.startsWith("/review")},{key:"stats",href:"/stats",icon:c.f,match:e=>e.startsWith("/stats")||e.startsWith("/tags")},{key:"exams",href:"/exams",icon:m.f,match:e=>e.startsWith("/exams")}];function eY({children:e}){var r;let c,o,d=(0,l.usePathname)()||"/",{t:m}=(0,t.b)(),{data:x,status:h}=(0,a.useSession)(),g=x?.user?.role==="admin",j=eH.some(e=>e.test(d));if(r=g&&!j,c=(0,l.useRouter)(),o=(0,f.useRef)(!1),(0,f.useEffect)(()=>{r&&!o.current&&(o.current=!0,V.f.get("/api/setup").then(e=>{e.needsSetup&&c.replace("/setup")}).catch(e=>W.f.warn("[Setup]","Failed to check setup status",{error:e})))},[r,c]),j||"unauthenticated"===h)return(0,s.jsx)(s.Fragment,{children:e});let b=x?.user?.name||x?.user?.email||"";return(0,s.jsxs)("div",{className:"min-h-screen",children:[(0,s.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,s.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,s.jsxs)(n.default,{href:"/",className:"flex shrink-0 items-center gap-2",children:[(0,s.jsx)(i.default,{src:"/icons/icon.png",alt:"",width:32,height:32,className:"rounded-lg",priority:!0,unoptimized:!0}),(0,s.jsx)("span",{className:"text-base font-semibold tracking-tight",children:m.pageTitle.base})]}),(0,s.jsx)("nav",{className:"ml-4 hidden items-center gap-1 md:flex",children:eV.map(e=>{let t=e.match(d),a=e.icon;return(0,s.jsxs)(n.default,{href:e.href,className:(0,F.f)("flex items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors",t?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground"),"aria-current":t?"page":void 0,children:[(0,s.jsx)(a,{className:"h-4 w-4"}),m.nav[e.key]]},e.key)})}),(0,s.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[b&&(0,s.jsxs)("span",{className:"mr-2 hidden max-w-40 items-center gap-2 truncate text-sm text-muted-foreground lg:flex",children:[(0,s.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:b.slice(0,1).toUpperCase()}),(0,s.jsx)("span",{className:"truncate",children:b})]}),g&&(0,s.jsx)(n.default,{href:"/admin",title:m.nav.admin,children:(0,s.jsxs)(C.f,{variant:"ghost",size:"icon",className:"rounded-full",children:[(0,s.jsx)(p,{className:"h-5 w-5"}),(0,s.jsx)("span",{className:"sr-only",children:m.nav.admin})]})}),(0,s.jsx)(eq,{}),(0,s.jsx)(C.f,{variant:"ghost",size:"icon",className:"rounded-full text-muted-foreground hover:text-destructive",onClick:()=>(0,a.signOut)({callbackUrl:"/login"}),title:m.app.logout,children:(0,s.jsx)(u.f,{className:"h-5 w-5"})})]})]})}),(0,s.jsx)("div",{className:"pb-20 md:pb-0",children:e}),(0,s.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,s.jsx)("div",{className:"grid h-16 grid-cols-5",children:eV.map(e=>{let t=e.match(d),a=e.icon;return(0,s.jsxs)(n.default,{href:e.href,className:(0,F.f)("flex flex-col items-center justify-center gap-1 text-[11px] font-medium transition-colors",t?"text-primary":"text-muted-foreground"),"aria-current":t?"page":void 0,children:[(0,s.jsx)("span",{className:(0,F.f)("flex h-7 w-12 items-center justify-center rounded-full transition-colors",t&&"bg-accent"),children:(0,s.jsx)(a,{className:"h-5 w-5"})}),m.nav[e.key]]},e.key)})})})]})}let eW=(0,x.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"}]]);var eB=e.i(373884);let eJ=[/^\/login/,/^\/register/,/^\/print-preview/,/^\/exams\/[^/]+\/print/];function eX(){let{t:e}=(0,t.b)(),{timeZone:i}=(0,r.M)(),{status:c}=(0,a.useSession)(),o=(0,l.usePathname)(),[d,m]=(0,f.useState)(!1),[u,x]=(0,f.useState)([]),[h,p]=(0,f.useState)(()=>Date.now()),g="authenticated"!==c||eJ.some(e=>e.test(o||"")),j=(0,f.useCallback)(async()=>{if("u"<typeof document||"hidden"!==document.visibilityState)try{let e=await V.f.get("/api/tasks");x(e.tasks),p(Date.now())}catch{}},[]);if((0,f.useEffect)(()=>{if(g)return;let e=setTimeout(j,0),s=setInterval(j,d?2e3:15e3);return()=>{clearTimeout(e),clearInterval(s)}},[g,d,j]),g)return null;let b=u.filter(e=>"running"===e.status).length,y=u.some(e=>"running"!==e.status),w=async()=>{try{let e=await V.f.delete("/api/tasks");x(e.tasks)}catch{}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(C.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:()=>m(!0),"aria-label":e.backgroundTasks.title,title:e.backgroundTasks.title,children:[b>0?(0,s.jsx)(v.f,{className:"h-5 w-5 animate-spin"}):(0,s.jsx)(eW,{className:"h-5 w-5"}),b>0&&(0,s.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:b})]}),(0,s.jsx)(T.N,{open:d,onOpenChange:m,children:(0,s.jsxs)(T.d,{className:"max-h-[85vh] overflow-y-auto sm:max-w-lg",children:[(0,s.jsxs)(T.s,{children:[(0,s.jsx)(T.F,{children:e.backgroundTasks.title}),(0,s.jsx)(T.C,{children:e.backgroundTasks.description})]}),0===u.length?(0,s.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:e.backgroundTasks.empty}):(0,s.jsx)("ul",{className:"space-y-2",children:u.map(t=>{var a,r;let l;return(0,s.jsx)("li",{className:"rounded-md border p-3 text-sm",children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:["running"===t.status&&(0,s.jsx)(v.f,{className:"mt-0.5 h-4 w-4 shrink-0 animate-spin text-primary"}),"succeeded"===t.status&&(0,s.jsx)(ex.f,{className:"mt-0.5 h-4 w-4 shrink-0 text-green-600"}),"failed"===t.status&&(0,s.jsx)(eB.f,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),(0,s.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,s.jsxs)("div",{className:"font-medium",children:[e.backgroundTasks.kinds[t.kind],(0,s.jsxs)("span",{className:"font-normal text-muted-foreground",children:[" · ",e.backgroundTasks.status[t.status]]})]}),t.subject&&(0,s.jsx)("div",{className:"break-words text-muted-foreground",children:t.subject}),t.progress&&t.progress.total>0&&(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("div",{className:"h-1.5 overflow-hidden rounded bg-muted",children:(0,s.jsx)("div",{className:"h-full bg-primary transition-all",style:{width:`${Math.round(t.progress.done/t.progress.total*100)}%`}})}),(0,s.jsxs)("div",{className:"text-xs text-muted-foreground",children:[e.backgroundTasks.progress.replace("{done}",String(t.progress.done)).replace("{total}",String(t.progress.total)),t.progress.failed>0&&` \xb7 ${e.backgroundTasks.failedCount.replace("{count}",String(t.progress.failed))}`]})]}),t.error&&(0,s.jsx)("div",{className:"text-xs text-destructive",children:(s=>{if(!s)return null;let t=e.backgroundTasks.errors[s]??e.errors[s];return"string"==typeof t?t:s})(t.error)}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 text-xs text-muted-foreground",children:[(0,s.jsx)("span",{children:e.backgroundTasks.startedAt.replace("{time}",(0,M.r)(t.startedAt,"HH:mm:ss",i))}),(0,s.jsx)("span",{children:e.backgroundTasks.elapsed.replace("{time}",(a=t.startedAt,r=t.finishedAt,l=Math.max(0,Math.round(((r?Date.parse(r):h)-Date.parse(a))/1e3)),`${Math.floor(l/60)}:${String(l%60).padStart(2,"0")}`))}),t.link&&(0,s.jsx)(n.default,{href:t.link,className:"text-primary hover:underline",onClick:()=>m(!1),children:e.backgroundTasks.view})]})]})]})},t.id)})}),(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2 pt-1",children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:e.backgroundTasks.retentionHint}),y&&(0,s.jsx)(C.f,{variant:"ghost",size:"sm",onClick:w,children:e.backgroundTasks.clearFinished})]})]})})]})}var eG=e.i(37727);let eK={success:{icon:ex.f,className:"text-success"},error:{icon:eB.f,className:"text-destructive"},warning:{icon:g,className:"text-warning"},info:{icon:b,className:"text-primary"}};function eZ(){let{t:e}=(0,t.b)(),[a,r]=(0,f.useState)([]),[i,n]=(0,f.useState)(null);return(0,f.useEffect)(()=>(0,Y.M)(e=>{r(e.toasts),n(e.confirm)}),[]),(0,s.jsxs)(s.Fragment,{children:[(0,s.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:a.map(t=>{let{icon:a,className:r}=eK[t.type];return(0,s.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,s.jsx)(a,{className:(0,F.f)("mt-0.5 h-4 w-4 shrink-0",r)}),(0,s.jsx)("p",{className:"min-w-0 flex-1 whitespace-pre-line break-words leading-relaxed",children:t.message}),(0,s.jsx)("button",{type:"button",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:text-foreground",onClick:()=>(0,Y.p)(t.id),"aria-label":e.common.close,children:(0,s.jsx)(eG.X,{className:"h-3.5 w-3.5"})})]},t.id)})}),(0,s.jsx)(T.N,{open:!!i,onOpenChange:e=>{e||i?.resolve(!1)},children:(0,s.jsxs)(T.d,{className:"sm:max-w-md",children:[(0,s.jsxs)(T.s,{children:[(0,s.jsxs)(T.F,{className:"flex items-center gap-2",children:[i?.destructive&&(0,s.jsx)(g,{className:"h-5 w-5 text-destructive"}),i?.title||e.common.confirmTitle]}),(0,s.jsx)(T.C,{className:"whitespace-pre-line pt-1 text-left leading-relaxed",children:i?.message})]}),(0,s.jsxs)(T.c,{className:"gap-2",children:[(0,s.jsx)(C.f,{variant:"outline",onClick:()=>i?.resolve(!1),children:i?.cancelText||e.common.cancel}),(0,s.jsx)(C.f,{variant:i?.destructive?"destructive":"default",onClick:()=>i?.resolve(!0),autoFocus:!0,children:i?.confirmText||e.common.confirm})]})]})})]})}function eQ(){return(0,f.useEffect)(()=>{"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js",{scope:"/"}).catch(e=>{W.f.warn("[PWA]","Service worker registration failed",{error:String(e)})})},[]),null}e.s(["Providers",0,function({children:e,timeZone:i}){return(0,s.jsx)(a.SessionProvider,{children:(0,s.jsx)(t.w,{children:(0,s.jsxs)(r.n,{initialTimeZone:i,children:[(0,s.jsx)(eY,{children:e}),(0,s.jsx)(eX,{}),(0,s.jsx)(eZ,{}),(0,s.jsx)(eQ,{})]})})})}],1661)}]);