wrong-notebook 2026.11.4-1 → 2026.11.4-2

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 (209) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +3 -3
  3. package/.next/server/app/_global-error.html +1 -1
  4. package/.next/server/app/_global-error.rsc +1 -1
  5. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  6. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  7. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  8. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  9. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  10. package/.next/server/app/admin/page.js.nft.json +1 -1
  11. package/.next/server/app/admin/page_client-reference-manifest.js +1 -1
  12. package/.next/server/app/admin/user/[id]/page.js.nft.json +1 -1
  13. package/.next/server/app/admin/user/[id]/page_client-reference-manifest.js +1 -1
  14. package/.next/server/app/api/admin/cnm-tags/route.js.nft.json +1 -1
  15. package/.next/server/app/api/admin/dashboard/route.js.nft.json +1 -1
  16. package/.next/server/app/api/admin/debug-logs/export/route.js.nft.json +1 -1
  17. package/.next/server/app/api/admin/debug-logs/route.js.nft.json +1 -1
  18. package/.next/server/app/api/admin/migrate-tags/route.js.nft.json +1 -1
  19. package/.next/server/app/api/admin/system-reset/route.js.nft.json +1 -1
  20. package/.next/server/app/api/admin/users/[id]/detail/route.js.nft.json +1 -1
  21. package/.next/server/app/api/admin/users/[id]/route.js.nft.json +1 -1
  22. package/.next/server/app/api/admin/users/route.js.nft.json +1 -1
  23. package/.next/server/app/api/ai/models/route.js.nft.json +1 -1
  24. package/.next/server/app/api/ai/test/route.js.nft.json +1 -1
  25. package/.next/server/app/api/analytics/route.js.nft.json +1 -1
  26. package/.next/server/app/api/analyze/route.js.nft.json +1 -1
  27. package/.next/server/app/api/auth/[...nextauth]/route.js.nft.json +1 -1
  28. package/.next/server/app/api/error-items/[id]/delete/route.js.nft.json +1 -1
  29. package/.next/server/app/api/error-items/[id]/figure/route.js.nft.json +1 -1
  30. package/.next/server/app/api/error-items/[id]/fix-latex/route.js.nft.json +1 -1
  31. package/.next/server/app/api/error-items/[id]/geogebra/route.js.nft.json +1 -1
  32. package/.next/server/app/api/error-items/[id]/image/route.js.nft.json +1 -1
  33. package/.next/server/app/api/error-items/[id]/notes/route.js.nft.json +1 -1
  34. package/.next/server/app/api/error-items/[id]/practice-records/route.js.nft.json +1 -1
  35. package/.next/server/app/api/error-items/[id]/reanswer/route.js.nft.json +1 -1
  36. package/.next/server/app/api/error-items/[id]/retag/route.js.nft.json +1 -1
  37. package/.next/server/app/api/error-items/[id]/route.js.nft.json +1 -1
  38. package/.next/server/app/api/error-items/[id]/svg-animation/narration/route.js.nft.json +1 -1
  39. package/.next/server/app/api/error-items/[id]/svg-animation/route.js.nft.json +1 -1
  40. package/.next/server/app/api/error-items/answer-space/route.js.nft.json +1 -1
  41. package/.next/server/app/api/error-items/batch-delete/route.js.nft.json +1 -1
  42. package/.next/server/app/api/error-items/clear/route.js.nft.json +1 -1
  43. package/.next/server/app/api/error-items/list/route.js.nft.json +1 -1
  44. package/.next/server/app/api/error-items/route.js.nft.json +1 -1
  45. package/.next/server/app/api/error-items/short/[shortId]/route.js.nft.json +1 -1
  46. package/.next/server/app/api/error-items/similarity/route.js.nft.json +1 -1
  47. package/.next/server/app/api/exams/[id]/questions/[questionId]/regenerate/route.js.nft.json +1 -1
  48. package/.next/server/app/api/exams/[id]/results/route.js.nft.json +1 -1
  49. package/.next/server/app/api/exams/[id]/retry/route.js.nft.json +1 -1
  50. package/.next/server/app/api/exams/[id]/route.js.nft.json +1 -1
  51. package/.next/server/app/api/exams/route.js.nft.json +1 -1
  52. package/.next/server/app/api/export/route.js +4 -4
  53. package/.next/server/app/api/export/route.js.nft.json +1 -1
  54. package/.next/server/app/api/geogebra-analyze/route.js.nft.json +1 -1
  55. package/.next/server/app/api/health/route.js.nft.json +1 -1
  56. package/.next/server/app/api/import/route.js +9 -9
  57. package/.next/server/app/api/import/route.js.nft.json +1 -1
  58. package/.next/server/app/api/import-batches/[id]/confirm-all/route.js.nft.json +1 -1
  59. package/.next/server/app/api/import-batches/[id]/fix-text/route.js.nft.json +1 -1
  60. package/.next/server/app/api/import-batches/[id]/read/route.js.nft.json +1 -1
  61. package/.next/server/app/api/import-batches/[id]/retry/route.js.nft.json +1 -1
  62. package/.next/server/app/api/import-batches/[id]/route.js.nft.json +1 -1
  63. package/.next/server/app/api/import-batches/[id]/start/route.js.nft.json +1 -1
  64. package/.next/server/app/api/import-batches/route.js.nft.json +1 -1
  65. package/.next/server/app/api/import-tasks/[id]/confirm/route.js.nft.json +1 -1
  66. package/.next/server/app/api/import-tasks/[id]/read/route.js.nft.json +1 -1
  67. package/.next/server/app/api/import-tasks/[id]/retry/route.js.nft.json +1 -1
  68. package/.next/server/app/api/import-tasks/[id]/route.js.nft.json +1 -1
  69. package/.next/server/app/api/import-tasks/route.js.nft.json +1 -1
  70. package/.next/server/app/api/initialize/route.js.nft.json +1 -1
  71. package/.next/server/app/api/logs/frontend/route.js.nft.json +1 -1
  72. package/.next/server/app/api/minimax-code/checkin/route.js.nft.json +1 -1
  73. package/.next/server/app/api/minimax-code/login/route.js.nft.json +1 -1
  74. package/.next/server/app/api/minimax-code/route.js.nft.json +1 -1
  75. package/.next/server/app/api/notebooks/[id]/retag/route.js.nft.json +1 -1
  76. package/.next/server/app/api/notebooks/[id]/route.js.nft.json +1 -1
  77. package/.next/server/app/api/notebooks/route.js.nft.json +1 -1
  78. package/.next/server/app/api/openclaw/batch-upload/route.js.nft.json +1 -1
  79. package/.next/server/app/api/paper-groups/[id]/route.js.nft.json +1 -1
  80. package/.next/server/app/api/paper-groups/route.js.nft.json +1 -1
  81. package/.next/server/app/api/practice/generate/route.js.nft.json +1 -1
  82. package/.next/server/app/api/practice/grade/route.js.nft.json +1 -1
  83. package/.next/server/app/api/practice/record/[id]/route.js.nft.json +1 -1
  84. package/.next/server/app/api/practice/record/route.js.nft.json +1 -1
  85. package/.next/server/app/api/reanswer/route.js.nft.json +1 -1
  86. package/.next/server/app/api/register/route.js.nft.json +1 -1
  87. package/.next/server/app/api/register/status/route.js.nft.json +1 -1
  88. package/.next/server/app/api/requests/[id]/route.js.nft.json +1 -1
  89. package/.next/server/app/api/review/due/route.js.nft.json +1 -1
  90. package/.next/server/app/api/settings/route.js.nft.json +1 -1
  91. package/.next/server/app/api/setup/route.js.nft.json +1 -1
  92. package/.next/server/app/api/stats/activity/route.js.nft.json +1 -1
  93. package/.next/server/app/api/stats/practice/clear/route.js.nft.json +1 -1
  94. package/.next/server/app/api/stats/practice/route.js.nft.json +1 -1
  95. package/.next/server/app/api/stats/repeated-mistakes/route.js.nft.json +1 -1
  96. package/.next/server/app/api/stats/weak-tags/route.js.nft.json +1 -1
  97. package/.next/server/app/api/tags/route.js.nft.json +1 -1
  98. package/.next/server/app/api/tags/stats/route.js.nft.json +1 -1
  99. package/.next/server/app/api/tags/suggestions/route.js.nft.json +1 -1
  100. package/.next/server/app/api/tasks/route.js.nft.json +1 -1
  101. package/.next/server/app/api/tts/[id]/route.js.nft.json +1 -1
  102. package/.next/server/app/api/tts/batch/route.js.nft.json +1 -1
  103. package/.next/server/app/api/tts/route.js.nft.json +1 -1
  104. package/.next/server/app/api/tts/status/route.js.nft.json +1 -1
  105. package/.next/server/app/api/user/route.js.nft.json +1 -1
  106. package/.next/server/app/error-items/[id]/page.js.nft.json +1 -1
  107. package/.next/server/app/error-items/[id]/page_client-reference-manifest.js +1 -1
  108. package/.next/server/app/exams/[id]/page.js.nft.json +1 -1
  109. package/.next/server/app/exams/[id]/page_client-reference-manifest.js +1 -1
  110. package/.next/server/app/exams/[id]/print/page.js.nft.json +1 -1
  111. package/.next/server/app/exams/[id]/print/page_client-reference-manifest.js +1 -1
  112. package/.next/server/app/exams/page.js.nft.json +1 -1
  113. package/.next/server/app/exams/page_client-reference-manifest.js +1 -1
  114. package/.next/server/app/import-batches/[id]/page.js.nft.json +1 -1
  115. package/.next/server/app/import-batches/[id]/page_client-reference-manifest.js +1 -1
  116. package/.next/server/app/import-tasks/[id]/page.js.nft.json +1 -1
  117. package/.next/server/app/import-tasks/[id]/page_client-reference-manifest.js +1 -1
  118. package/.next/server/app/import-tasks/page.js.nft.json +1 -1
  119. package/.next/server/app/import-tasks/page_client-reference-manifest.js +1 -1
  120. package/.next/server/app/initialize/page.js.nft.json +1 -1
  121. package/.next/server/app/initialize/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/chunks/[root-of-the-server]__0p5_lv_pjxr5f._.js +3 -0
  147. package/.next/server/chunks/{[root-of-the-server]__0wj82qshtrskw._.js → [root-of-the-server]__1y0n2tg-0l636._.js} +1 -1
  148. package/.next/server/chunks/_03ovgh1-4xf3f._.js +1 -1
  149. package/.next/server/chunks/_07amw8ha9rney._.js +1 -1
  150. package/.next/server/chunks/_0_rhee7wb6tcg._.js +1 -1
  151. package/.next/server/chunks/_0d66myj_8567o._.js +1 -1
  152. package/.next/server/chunks/_0ge95_bkwrkmc._.js +1 -1
  153. package/.next/server/chunks/_12w5k19rc45j_._.js +1 -1
  154. package/.next/server/chunks/_1ex6ovo_j2jzv._.js +1 -1
  155. package/.next/server/chunks/src_lib_0rb6u4i7kn30r._.js +3 -0
  156. package/.next/server/chunks/src_lib_1chbt4n9_vpoj._.js +3 -0
  157. package/.next/server/chunks/src_lib_exam_ts_0d3a4q4r41hcf._.js +1 -1
  158. package/.next/server/chunks/ssr/[root-of-the-server]__01z2m5q6l60fn._.js +3 -0
  159. package/.next/server/chunks/ssr/{[root-of-the-server]__1z2o77biewl3j._.js → [root-of-the-server]__0sb3jhytba2xr._.js} +1 -1
  160. package/.next/server/chunks/ssr/_0qgs--x99c558._.js +3 -0
  161. package/.next/server/chunks/ssr/_0zacgi5-qgqwr._.js +3 -0
  162. package/.next/server/chunks/ssr/_11820i-k62560._.js +3 -0
  163. package/.next/server/chunks/ssr/_1a4u3f5sc05kb._.js +3 -0
  164. package/.next/server/chunks/ssr/_1ujx-n3muyaxs._.js +1 -1
  165. package/.next/server/chunks/ssr/{node_modules_1d2ueqm41z04k._.js → node_modules_02k42jp0_uoqr._.js} +1 -1
  166. package/.next/server/chunks/ssr/{node_modules_heic-to_dist_csp_heic-to_1_wfmqq00b4vx.js → node_modules_heic-to_dist_csp_heic-to_0byqh-lbfcigr.js} +1 -1
  167. package/.next/server/chunks/ssr/{node_modules_heic-to_dist_csp_heic-to_1myi81wrj4gw4.js → node_modules_heic-to_dist_csp_heic-to_19_dv9gdzg_e7.js} +1 -1
  168. package/.next/server/chunks/ssr/src_0z149pjrheeb7._.js +3 -0
  169. package/.next/server/chunks/ssr/src_app_exams_[id]_page_tsx_0xcjflkgkwzgd._.js +1 -1
  170. package/.next/server/chunks/ssr/src_app_exams_page_tsx_17_d4_gy2i1ds._.js +1 -1
  171. package/.next/server/chunks/ssr/src_app_notebooks_[id]_page_tsx_08njm-5-txm8_._.js +1 -1
  172. package/.next/server/chunks/ssr/src_app_print-preview_page_tsx_001yt-fzrj7tf._.js +1 -1
  173. package/.next/server/chunks/ssr/src_components_providers_tsx_09kw-mv3nb6xs._.js +10 -10
  174. package/.next/server/middleware-build-manifest.js +3 -3
  175. package/.next/server/pages/500.html +1 -1
  176. package/.next/static/chunks/0e6ximjg-pqgt.js +1 -0
  177. package/.next/static/chunks/17-num1x7o1m2.js +1 -0
  178. package/.next/static/chunks/1egd1e1483_lj.js +1 -0
  179. package/.next/static/chunks/1o_q928xcfjs3.js +1 -0
  180. package/.next/static/chunks/25flylmb_qz91.js +1 -0
  181. package/.next/static/chunks/2924d0kl-68z7.js +193 -0
  182. package/.next/static/chunks/2cpsg6e2vg7fx.css +3 -0
  183. package/.next/static/chunks/3s_fq__cff-ps.js +2 -0
  184. package/.next/static/chunks/42rupczfyygo1.js +1 -0
  185. package/package.json +1 -1
  186. package/prisma/migrations/20261103231825_exam_paper_mode/migration.sql +25 -0
  187. package/prisma/schema.prisma +1 -0
  188. package/prisma/seed.db +0 -0
  189. package/.next/server/chunks/[root-of-the-server]__0xnu_7ck-z9do._.js +0 -3
  190. package/.next/server/chunks/src_lib_1xdguwkq8k_gz._.js +0 -3
  191. package/.next/server/chunks/src_lib_tag-hierarchy_ts_1illun--8v3_9._.js +0 -3
  192. package/.next/server/chunks/ssr/[root-of-the-server]__0vgnixmnie9dg._.js +0 -3
  193. package/.next/server/chunks/ssr/_0wculltrlnokg._.js +0 -3
  194. package/.next/server/chunks/ssr/_1-5vj-nfmgwz8._.js +0 -3
  195. package/.next/server/chunks/ssr/_18dt93-y95n-0._.js +0 -3
  196. package/.next/server/chunks/ssr/_1b3pell8an7q7._.js +0 -3
  197. package/.next/server/chunks/ssr/_1gbbaroe3f8p2._.js +0 -3
  198. package/.next/static/chunks/081x3sje_s-_s.js +0 -1
  199. package/.next/static/chunks/093fbi_f_vb46.js +0 -1
  200. package/.next/static/chunks/0nq5_ne_bugdp.js +0 -1
  201. package/.next/static/chunks/1a9_ien1xt883.js +0 -1
  202. package/.next/static/chunks/1b5jj8zk0mtzk.js +0 -1
  203. package/.next/static/chunks/2ic9ath-r3jvf.js +0 -193
  204. package/.next/static/chunks/38fux_rbsoiif.js +0 -1
  205. package/.next/static/chunks/3ayhhtp8n8w82.css +0 -3
  206. package/.next/static/chunks/3kr4ynzxd4_6d.js +0 -2
  207. /package/.next/static/{0_A8rshkxRGdIAt8Ht93Q → E10D9dv115hLNvX7vE6qA}/_buildManifest.js +0 -0
  208. /package/.next/static/{0_A8rshkxRGdIAt8Ht93Q → E10D9dv115hLNvX7vE6qA}/_clientMiddlewareManifest.js +0 -0
  209. /package/.next/static/{0_A8rshkxRGdIAt8Ht93Q → E10D9dv115hLNvX7vE6qA}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
1
1
  module.exports=[[97546,a=>{var b=a.i(164831);let c={name:"circle-alert",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],aliases:["alert-circle"]};c.node;let d=(0,b.f)(c);a.s(["f",0,d],97546)},585650,a=>{var b=a.i(164831);let c={name:"copy",size:24,node:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]};c.node;let d=(0,b.f)(c);a.s(["f",0,d],585650)},308658,a=>{var b=a.i(164831);let c={name:"layers",size:24,node:[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],aliases:["layers-3"]};c.node;let d=(0,b.f)(c);a.s(["f",0,d],308658)},986708,a=>{var b=a.i(164831);let c={name:"sparkles",size:24,node:[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],aliases:["stars"]};c.node;let d=(0,b.f)(c);a.s(["f",0,d],986708)},445233,a=>{var b=a.i(57441);a.s(["z",0,b])}],627280,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_heic-to_dist_csp_heic-to_1a1i_ppryp81y.js"].map(b=>a.l(b))).then(()=>b(469425)))}];
2
2
 
3
- //# sourceMappingURL=node_modules_1d2ueqm41z04k._.js.map
3
+ //# sourceMappingURL=node_modules_02k42jp0_uoqr._.js.map
@@ -1,3 +1,3 @@
1
1
  module.exports=[627280,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_heic-to_dist_csp_heic-to_1a1i_ppryp81y.js"].map(b=>a.l(b))).then(()=>b(469425)))}];
2
2
 
3
- //# sourceMappingURL=node_modules_heic-to_dist_csp_heic-to_1_wfmqq00b4vx.js.map
3
+ //# sourceMappingURL=node_modules_heic-to_dist_csp_heic-to_0byqh-lbfcigr.js.map
@@ -1,3 +1,3 @@
1
1
  module.exports=[627280,a=>{a.v(b=>Promise.all(["server/chunks/ssr/node_modules_heic-to_dist_csp_heic-to_1a1i_ppryp81y.js"].map(b=>a.l(b))).then(()=>b(469425)))}];
2
2
 
3
- //# sourceMappingURL=node_modules_heic-to_dist_csp_heic-to_1myi81wrj4gw4.js.map
3
+ //# sourceMappingURL=node_modules_heic-to_dist_csp_heic-to_19_dv9gdzg_e7.js.map
@@ -0,0 +1,3 @@
1
+ (()=>{"use strict";module.exports=[870430,a=>{var b=a.i(187924),c=a.i(572131),d=a.i(30553),e=Object.defineProperty,f=c.forwardRef(e(function(a,c){return(0,b.jsx)(d.V.label,{...a,ref:c,onMouseDown:b=>{b.target.closest("button, input, select, textarea")||(a.onMouseDown?.(b),!b.defaultPrevented&&b.detail>1&&b.preventDefault())}})},"name",{value:"Label",configurable:!0})),g=a.i(368114);a.s(["f",0,function({className:a,...c}){return(0,b.jsx)(f,{"data-slot":"label",className:(0,g.f)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",a),...c})}],870430)},960927,a=>{a.s(["L",0,function(a){if("object"!=typeof a||null===a||!("data"in a))return;let{data:b}=a;if("object"==typeof b&&null!==b&&"details"in b)return"string"==typeof b.details&&b.details?b.details:void 0},"d",0,function(a){if("object"!=typeof a||null===a||!("data"in a))return;let{data:b}=a;if("object"==typeof b&&null!==b&&"message"in b)return"string"==typeof b.message?b.message:void 0},"Z",0,function(a){return a instanceof Error?a.message:String(a)}])},515108,a=>{var b=a.i(572131),c=a.i(291938),d=a.i(630534);let e=null,f=0,g=new Set;a.s(["f",0,function(){let[a,h]=(0,b.useState)(e??[]),[i,j]=(0,b.useState)(!e),[k,l]=(0,b.useState)(null),m=(0,b.useCallback)(async(a=!1)=>{let b=Date.now();if(!a&&e&&b-f<3e4){h(e),j(!1);return}try{j(!0);let a=await c.k.get("/api/paper-groups");e=a,f=b,g.forEach(b=>b(a)),l(null)}catch(a){d.V.error("[usePaperGroups]","Failed to fetch paper groups",{error:a}),l("Failed to load paper groups")}finally{j(!1)}},[]);return(0,b.useEffect)(()=>(g.add(h),m(),()=>{g.delete(h)}),[m]),{groups:a,loading:i,error:k,refetch:(0,b.useCallback)(()=>(e=null,f=0,m(!0)),[m])}}])}]})();
2
+
3
+ //# sourceMappingURL=src_0z149pjrheeb7._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[108561,a=>{"use strict";var b=a.i(187924),c=a.i(572131),d=a.i(238246),e=a.i(50944),f=a.i(529759),g=a.i(986705),h=a.i(164831);let i={name:"clipboard-check",size:24,node:[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]};i.node;let j=(0,h.f)(i);var k=a.i(875160),l=a.i(88444),m=a.i(533838),n=a.i(879675),o=a.i(951675),p=a.i(699570),q=a.i(866718),r=a.i(695001),s=a.i(506376),t=a.i(184518),u=a.i(589027),v=a.i(113608),w=a.i(474215),x=a.i(786304),y=a.i(591119),z=a.i(93907),A=a.i(946862),B=a.i(226897),C=a.i(418943),D=a.i(185844),E=a.i(519783),F=a.i(329890),G=a.i(550194),H=a.i(291938),I=a.i(630534),J=a.i(710302);function K({paperId:a,question:d,onDone:e}){let{t:f,language:g}=(0,G.b)(),[h,i]=(0,c.useState)(null),j=0===d.attempts.length&&!!d.errorItemId&&"pending"!==d.status,l="ready"===d.status&&!!d.questionText?.trim();if(!j&&!l)return null;let m=async b=>{let c="question"===b?f.exam.regenerateQuestionConfirm:f.exam.regenerateAnswerConfirm;if(await (0,J.u)(c)){i(b);try{let c=await H.k.post(`/api/exams/${a}/questions/${d.id}/regenerate`,{mode:b,language:g},{timeout:6e5,recoverable:!0});e(c)}catch(d){let a=d?.data?.message||"",c=f.errors[a];I.V.error("[ExamRegenerate]","Failed to regenerate exam question",{mode:b,code:a}),J.c.error("HAS_RESULTS"===a?f.exam.regenerateHasResults:"string"==typeof c?c:f.exam.regenerateFailed)}finally{i(null)}}};return(0,b.jsxs)("div",{className:"flex flex-wrap gap-1",children:[j&&(0,b.jsxs)(p.f,{variant:"ghost",size:"sm",onClick:()=>m("question"),disabled:null!==h,children:["question"===h?(0,b.jsx)(k.f,{className:"mr-1 h-4 w-4 animate-spin"}):(0,b.jsx)(E.f,{className:"mr-1 h-4 w-4"}),"question"===h?f.exam.regenerating:f.exam.regenerateQuestion]}),l&&(0,b.jsxs)(p.f,{variant:"ghost",size:"sm",onClick:()=>m("answer"),disabled:null!==h,children:["answer"===h?(0,b.jsx)(k.f,{className:"mr-1 h-4 w-4 animate-spin"}):(0,b.jsx)(F.f,{className:"mr-1 h-4 w-4"}),"answer"===h?f.exam.regenerating:f.exam.regenerateAnswer]})]})}function L({paperId:a,question:e,editingResult:h,onResultChange:i,onDeleteAttempt:j,onRegenerated:l,previewFigureScale:m,previewFigureAlign:n,onSaveFigureScale:o}){let{t:p}=(0,G.b)(),{timeZone:q}=(0,f.M)(),[r,s]=(0,c.useState)(!1),t=void 0!==h,E=(()=>{if(!e.error)return"";if("SOURCE_DELETED"===e.error)return p.exam.sourceDeleted;let a=e.error.split(":")[0].trim(),b=p.errors[a];return"string"==typeof b?b:e.error})();return(0,b.jsx)(y.N,{children:(0,b.jsxs)(y.O,{className:"space-y-3 pt-4",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[(0,b.jsxs)("span",{className:"font-semibold",children:[e.order,"."]}),e.errorItemId?(0,b.jsxs)(d.default,{href:`/error-items/${e.errorItemId}`,className:"font-mono text-xs text-primary hover:underline",children:[p.exam.source," ",e.sourceShortId]}):(0,b.jsxs)("span",{className:"font-mono text-xs text-muted-foreground",children:[e.sourceShortId," · ",p.exam.sourceDeleted]}),e.notebookName&&(0,b.jsx)(x.f,{variant:"secondary",children:e.notebookName})]}),e.attempts.length>0&&(0,b.jsx)("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:e.attempts.map((a,c)=>(0,b.jsxs)(x.f,{variant:"outline",className:`gap-1 font-normal ${A.x[a.result]||""}`,children:[(0,b.jsx)("span",{children:p.exam.attemptLabel.replace("{n}",String(c+1))}),(0,b.jsx)("span",{className:"tabular-nums",children:(0,g.r)(a.createdAt,"MM-dd",q)}),(0,b.jsx)("span",{className:"font-semibold",children:p.mastery.results[a.result]}),t&&j&&(0,b.jsx)("button",{type:"button","aria-label":p.mastery.deleteRecord,className:"-mr-1 rounded hover:bg-black/10",onClick:()=>j(a.id),children:(0,b.jsx)(w.X,{className:"h-3 w-3"})})]},a.id))}),"pending"===e.status&&(0,b.jsxs)("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,b.jsx)(k.f,{className:"h-4 w-4 animate-spin"}),p.exam.questionPending]}),"failed"===e.status&&(0,b.jsxs)("p",{className:"text-sm text-destructive",children:[p.exam.questionFailed,E?`${p.common.colon}${E}`:""]}),"ready"===e.status&&e.questionText&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(z.f,{content:e.questionText}),o?(0,b.jsx)(D.f,{svg:e.figureSvg,scale:e.figureScale,align:e.figureAlign,previewScaleOverride:m,previewAlignOverride:n,onSave:(a,b)=>o(e.id,a,b)},`${e.id}-${e.figureScale??100}-${e.figureAlign??"center"}`):(0,b.jsx)(C.f,{svg:e.figureSvg,scale:m??e.figureScale,align:n??e.figureAlign}),(0,b.jsxs)("button",{type:"button",className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",onClick:()=>s(!r),children:[r?(0,b.jsx)(v.f,{className:"h-3 w-3"}):(0,b.jsx)(u.f,{className:"h-3 w-3"}),p.exam.showAnswer]}),r&&(0,b.jsxs)("div",{className:"space-y-2 rounded-md bg-muted/40 p-3",children:[e.answerText&&(0,b.jsx)(z.f,{content:e.answerText,className:"font-semibold"}),e.analysis&&(0,b.jsx)(z.f,{content:e.analysis})]})]}),!t&&l&&(0,b.jsx)(K,{paperId:a,question:e,onDone:l}),t&&"ready"===e.status&&e.errorItemId&&i&&(0,b.jsx)(B.f,{value:h,onChange:i,size:"sm"})]})})}var M=a.i(726319),N=a.i(557999);a.s(["default",0,function(){let{timeZone:a}=(0,f.M)(),h=(0,e.useParams)(),i=(0,e.useRouter)(),{t:u,language:v}=(0,G.b)(),w=h.id,[x,y]=(0,c.useState)(null);(0,N.f)(u.exam.title,x?.title);let[z,A]=(0,c.useState)(!1),[B,C]=(0,c.useState)(null),[D,E]=(0,c.useState)((0,g.r)(new Date,"yyyy-MM-dd",a)),[F,I]=(0,c.useState)(!1),[K,O]=(0,c.useState)(null),[P,Q]=(0,c.useState)({scale:null,align:null}),R=(0,c.useCallback)(async()=>{try{y(await H.k.get(`/api/exams/${w}`))}catch{A(!0)}},[w]);if((0,c.useEffect)(()=>{R()},[R]),(0,c.useEffect)(()=>{if(x?.status!=="generating")return;let a=setTimeout(R,3e3);return()=>clearTimeout(a)},[x,R]),z)return(0,b.jsx)("div",{className:"p-8 text-center",children:u.exam.notFound});if(!x)return(0,b.jsx)(s.f,{label:u.common.loading});let S=x.questions.filter(a=>"ready"===a.status).length,T=x.questions.some(a=>a.attempts.length>0),U=x.questions.some(a=>"failed"===a.status),V=x.questions.filter(a=>"ready"===a.status&&a.errorItemId),W=x.questions.filter(a=>"ready"===a.status&&!!a.figureSvg),X=B?V.filter(a=>B[a.id]).length:0,Y=async()=>{if(B&&0!==X){I(!0),O(null);try{await H.k.post(`/api/exams/${x.id}/results`,{takenAt:(0,g.$)(D,a),results:V.filter(a=>B[a.id]).map(a=>({questionId:a.id,result:B[a.id]}))}),C(null),O(u.exam.resultsSaved),await R()}catch{O(u.exam.resultsSaveFailed)}finally{I(!1)}}},Z=async a=>{if(await (0,J.u)(u.mastery.deleteRecordConfirm,{destructive:!0}))try{await H.k.delete(`/api/practice/record/${a}`),await R()}catch{O(u.mastery.deleteRecordFailed)}},$=async()=>{await H.k.post(`/api/exams/${x.id}/retry`,{language:v}),await R()},_=async()=>{await (0,J.u)(u.exam.deleteConfirm,{destructive:!0})&&(await H.k.delete(`/api/exams/${x.id}`),i.push("/exams"))},aa=async(a,b,c)=>{await H.k.patch(`/api/exams/${x.id}`,{questionId:a,figureScale:b,figureAlign:c}),y(d=>d?{...d,questions:d.questions.map(d=>d.id===a?{...d,figureScale:b,figureAlign:c}:d)}:d)},ab=async a=>{await H.k.patch(`/api/exams/${x.id}`,a),y(b=>b?{...b,questions:b.questions.map(b=>({...b,...a}))}:b)};return(0,b.jsx)("main",{className:"mx-auto min-h-screen max-w-6xl px-4 py-6 md:px-8 md:py-8",children:(0,b.jsxs)("div",{className:"space-y-6 pb-24",children:[(0,b.jsxs)("div",{className:"flex items-start gap-3",children:[(0,b.jsx)(r.f,{fallbackUrl:"/exams",className:"-ml-2 shrink-0"}),(0,b.jsxs)("div",{className:"flex-1 min-w-0 space-y-2",children:[(0,b.jsx)("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight break-words",children:x.title}),(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[(0,b.jsx)(M.f,{status:x.status,recorded:T}),(0,b.jsx)("span",{children:u.exam.progress.replace("{ready}",String(S)).replace("{total}",String(x.questions.length))}),(0,b.jsx)("span",{children:(0,g.r)(x.createdAt,"yyyy-MM-dd HH:mm",a)})]})]})]}),(0,b.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,b.jsx)(d.default,{href:`/exams/${x.id}/print`,children:(0,b.jsxs)(p.f,{variant:"outline",size:"sm",disabled:0===S,children:[(0,b.jsx)(l.f,{className:"mr-2 h-4 w-4"}),u.exam.print]})}),!B&&V.length>0&&(0,b.jsxs)(p.f,{size:"sm",onClick:()=>{O(null),C({}),E((0,g.r)(new Date,"yyyy-MM-dd",a))},children:[(0,b.jsx)(j,{className:"mr-2 h-4 w-4"}),u.exam.recordResults]}),U&&"generating"!==x.status&&(0,b.jsxs)(p.f,{variant:"outline",size:"sm",onClick:$,children:[(0,b.jsx)(m.f,{className:"mr-2 h-4 w-4"}),u.exam.retryFailed]}),(0,b.jsxs)(p.f,{variant:"ghost",size:"sm",onClick:_,className:"text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 hover:bg-red-50 dark:hover:bg-red-950/40 sm:ml-auto",children:[(0,b.jsx)(o.f,{className:"mr-2 h-4 w-4"}),u.exam.delete]})]}),x.questions.length<x.requestedCount&&(0,b.jsx)("p",{className:"rounded-md border border-amber-200 dark:border-amber-900 bg-amber-50 dark:bg-amber-950/40 p-3 text-sm text-amber-800 dark:text-amber-200",children:u.exam.fewerThanRequested.replaceAll("{actual}",String(x.questions.length))}),K&&(0,b.jsx)("p",{className:"rounded-md border p-3 text-sm",children:K}),B&&(0,b.jsxs)("div",{className:"space-y-2 rounded-md border bg-muted/30 p-3",children:[(0,b.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,b.jsx)("label",{htmlFor:"exam-taken-at",className:"text-sm font-medium",children:u.exam.takenAt}),(0,b.jsx)(q.f,{id:"exam-taken-at",type:"date",value:D,onChange:a=>E(a.target.value),className:"sm:w-48"})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:u.exam.recordHint})]}),W.length>0&&(0,b.jsx)(t.f,{scales:W.map(a=>a.figureScale),aligns:W.map(a=>a.figureAlign),onPreviewChange:Q,onSave:ab}),(0,b.jsx)("div",{className:"space-y-3",children:x.questions.map(a=>(0,b.jsx)(L,{paperId:x.id,question:a,editingResult:B?B[a.id]??null:void 0,onResultChange:b=>C(c=>c?{...c,[a.id]:b}:c),onDeleteAttempt:Z,onRegenerated:R,previewFigureScale:P.scale,previewFigureAlign:P.align,onSaveFigureScale:aa},a.id))}),B&&(0,b.jsx)("div",{className:"fixed inset-x-0 bottom-16 z-30 border-t bg-background/95 p-3 backdrop-blur md:bottom-0",children:(0,b.jsxs)("div",{className:"max-w-4xl mx-auto flex items-center justify-end gap-2",children:[0===X&&(0,b.jsx)("span",{className:"mr-auto text-xs text-muted-foreground",children:u.exam.noResultSelected}),(0,b.jsx)(p.f,{variant:"outline",onClick:()=>C(null),disabled:F,children:u.exam.cancel}),(0,b.jsxs)(p.f,{onClick:Y,disabled:F||!D||0===X,children:[F?(0,b.jsx)(k.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,b.jsx)(n.f,{className:"mr-2 h-4 w-4"}),u.exam.saveResults]})]})})]})})}],108561)}];
1
+ module.exports=[108561,a=>{"use strict";var b=a.i(187924),c=a.i(572131),d=a.i(238246),e=a.i(50944),f=a.i(529759),g=a.i(986705),h=a.i(164831);let i={name:"clipboard-check",size:24,node:[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]};i.node;let j=(0,h.f)(i);var k=a.i(875160),l=a.i(88444),m=a.i(533838),n=a.i(879675),o=a.i(951675),p=a.i(786304),q=a.i(699570),r=a.i(866718),s=a.i(695001),t=a.i(506376),u=a.i(184518),v=a.i(589027),w=a.i(113608),x=a.i(474215),y=a.i(591119),z=a.i(93907),A=a.i(946862),B=a.i(226897),C=a.i(418943),D=a.i(185844),E=a.i(519783),F=a.i(329890),G=a.i(550194),H=a.i(291938),I=a.i(630534),J=a.i(710302);function K({paperId:a,paperMode:d,question:e,onDone:f}){let{t:g,language:h}=(0,G.b)(),[i,j]=(0,c.useState)(null),l="original"!==d&&0===e.attempts.length&&!!e.errorItemId&&"pending"!==e.status,m="ready"===e.status&&!!e.questionText?.trim();if(!l&&!m)return null;let n=async b=>{let c="question"===b?g.exam.regenerateQuestionConfirm:g.exam.regenerateAnswerConfirm;if(await (0,J.u)(c)){j(b);try{let c=await H.k.post(`/api/exams/${a}/questions/${e.id}/regenerate`,{mode:b,language:h},{timeout:6e5,recoverable:!0});f(c)}catch(d){let a=d?.data?.message||"",c=g.errors[a];I.V.error("[ExamRegenerate]","Failed to regenerate exam question",{mode:b,code:a}),J.c.error("HAS_RESULTS"===a?g.exam.regenerateHasResults:"string"==typeof c?c:g.exam.regenerateFailed)}finally{j(null)}}};return(0,b.jsxs)("div",{className:"flex flex-wrap gap-1",children:[l&&(0,b.jsxs)(q.f,{variant:"ghost",size:"sm",onClick:()=>n("question"),disabled:null!==i,children:["question"===i?(0,b.jsx)(k.f,{className:"mr-1 h-4 w-4 animate-spin"}):(0,b.jsx)(E.f,{className:"mr-1 h-4 w-4"}),"question"===i?g.exam.regenerating:g.exam.regenerateQuestion]}),m&&(0,b.jsxs)(q.f,{variant:"ghost",size:"sm",onClick:()=>n("answer"),disabled:null!==i,children:["answer"===i?(0,b.jsx)(k.f,{className:"mr-1 h-4 w-4 animate-spin"}):(0,b.jsx)(F.f,{className:"mr-1 h-4 w-4"}),"answer"===i?g.exam.regenerating:g.exam.regenerateAnswer]})]})}function L({paperId:a,paperMode:e,question:h,editingResult:i,onResultChange:j,onDeleteAttempt:l,onRegenerated:m,previewFigureScale:n,previewFigureAlign:o,onSaveFigureScale:q}){let{t:r}=(0,G.b)(),{timeZone:s}=(0,f.M)(),[t,u]=(0,c.useState)(!1),E=void 0!==i,F=(()=>{if(!h.error)return"";if("SOURCE_DELETED"===h.error)return r.exam.sourceDeleted;let a=h.error.split(":")[0].trim(),b=r.errors[a];return"string"==typeof b?b:h.error})();return(0,b.jsx)(y.N,{children:(0,b.jsxs)(y.O,{className:"space-y-3 pt-4",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[(0,b.jsxs)("span",{className:"font-semibold",children:[h.order,"."]}),h.errorItemId?(0,b.jsxs)(d.default,{href:`/error-items/${h.errorItemId}`,className:"font-mono text-xs text-primary hover:underline",children:[r.exam.source," ",h.sourceShortId]}):(0,b.jsxs)("span",{className:"font-mono text-xs text-muted-foreground",children:[h.sourceShortId," · ",r.exam.sourceDeleted]}),h.notebookName&&(0,b.jsx)(p.f,{variant:"secondary",children:h.notebookName})]}),h.attempts.length>0&&(0,b.jsx)("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:h.attempts.map((a,c)=>(0,b.jsxs)(p.f,{variant:"outline",className:`gap-1 font-normal ${A.x[a.result]||""}`,children:[(0,b.jsx)("span",{children:r.exam.attemptLabel.replace("{n}",String(c+1))}),(0,b.jsx)("span",{className:"tabular-nums",children:(0,g.r)(a.createdAt,"MM-dd",s)}),(0,b.jsx)("span",{className:"font-semibold",children:r.mastery.results[a.result]}),E&&l&&(0,b.jsx)("button",{type:"button","aria-label":r.mastery.deleteRecord,className:"-mr-1 rounded hover:bg-black/10",onClick:()=>l(a.id),children:(0,b.jsx)(x.X,{className:"h-3 w-3"})})]},a.id))}),"pending"===h.status&&(0,b.jsxs)("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,b.jsx)(k.f,{className:"h-4 w-4 animate-spin"}),r.exam.questionPending]}),"failed"===h.status&&(0,b.jsxs)("p",{className:"text-sm text-destructive",children:[r.exam.questionFailed,F?`${r.common.colon}${F}`:""]}),"ready"===h.status&&h.questionText&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(z.f,{content:h.questionText}),q?(0,b.jsx)(D.f,{svg:h.figureSvg,scale:h.figureScale,align:h.figureAlign,previewScaleOverride:n,previewAlignOverride:o,onSave:(a,b)=>q(h.id,a,b)},`${h.id}-${h.figureScale??100}-${h.figureAlign??"center"}`):(0,b.jsx)(C.f,{svg:h.figureSvg,scale:n??h.figureScale,align:o??h.figureAlign}),(0,b.jsxs)("button",{type:"button",className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",onClick:()=>u(!t),children:[t?(0,b.jsx)(w.f,{className:"h-3 w-3"}):(0,b.jsx)(v.f,{className:"h-3 w-3"}),r.exam.showAnswer]}),t&&(0,b.jsxs)("div",{className:"space-y-2 rounded-md bg-muted/40 p-3",children:[h.answerText&&(0,b.jsx)(z.f,{content:h.answerText,className:"font-semibold"}),h.analysis&&(0,b.jsx)(z.f,{content:h.analysis})]})]}),!E&&m&&(0,b.jsx)(K,{paperId:a,paperMode:e,question:h,onDone:m}),E&&"ready"===h.status&&h.errorItemId&&j&&(0,b.jsx)(B.f,{value:i,onChange:j,size:"sm"})]})})}var M=a.i(726319),N=a.i(557999);a.s(["default",0,function(){let{timeZone:a}=(0,f.M)(),h=(0,e.useParams)(),i=(0,e.useRouter)(),{t:v,language:w}=(0,G.b)(),x=h.id,[y,z]=(0,c.useState)(null);(0,N.f)(v.exam.title,y?.title);let[A,B]=(0,c.useState)(!1),[C,D]=(0,c.useState)(null),[E,F]=(0,c.useState)((0,g.r)(new Date,"yyyy-MM-dd",a)),[I,K]=(0,c.useState)(!1),[O,P]=(0,c.useState)(null),[Q,R]=(0,c.useState)({scale:null,align:null}),S=(0,c.useCallback)(async()=>{try{z(await H.k.get(`/api/exams/${x}`))}catch{B(!0)}},[x]);if((0,c.useEffect)(()=>{S()},[S]),(0,c.useEffect)(()=>{if(y?.status!=="generating")return;let a=setTimeout(S,3e3);return()=>clearTimeout(a)},[y,S]),A)return(0,b.jsx)("div",{className:"p-8 text-center",children:v.exam.notFound});if(!y)return(0,b.jsx)(t.f,{label:v.common.loading});let T=y.questions.filter(a=>"ready"===a.status).length,U=y.questions.some(a=>a.attempts.length>0),V=y.questions.some(a=>"failed"===a.status),W=y.questions.filter(a=>"ready"===a.status&&a.errorItemId),X=y.questions.filter(a=>"ready"===a.status&&!!a.figureSvg),Y=C?W.filter(a=>C[a.id]).length:0,Z=async()=>{if(C&&0!==Y){K(!0),P(null);try{await H.k.post(`/api/exams/${y.id}/results`,{takenAt:(0,g.$)(E,a),results:W.filter(a=>C[a.id]).map(a=>({questionId:a.id,result:C[a.id]}))}),D(null),P(v.exam.resultsSaved),await S()}catch{P(v.exam.resultsSaveFailed)}finally{K(!1)}}},$=async a=>{if(await (0,J.u)(v.mastery.deleteRecordConfirm,{destructive:!0}))try{await H.k.delete(`/api/practice/record/${a}`),await S()}catch{P(v.mastery.deleteRecordFailed)}},_=async()=>{await H.k.post(`/api/exams/${y.id}/retry`,{language:w}),await S()},aa=async()=>{await (0,J.u)(v.exam.deleteConfirm,{destructive:!0})&&(await H.k.delete(`/api/exams/${y.id}`),i.push("/exams"))},ab=async(a,b,c)=>{await H.k.patch(`/api/exams/${y.id}`,{questionId:a,figureScale:b,figureAlign:c}),z(d=>d?{...d,questions:d.questions.map(d=>d.id===a?{...d,figureScale:b,figureAlign:c}:d)}:d)},ac=async a=>{await H.k.patch(`/api/exams/${y.id}`,a),z(b=>b?{...b,questions:b.questions.map(b=>({...b,...a}))}:b)};return(0,b.jsx)("main",{className:"mx-auto min-h-screen max-w-6xl px-4 py-6 md:px-8 md:py-8",children:(0,b.jsxs)("div",{className:"space-y-6 pb-24",children:[(0,b.jsxs)("div",{className:"flex items-start gap-3",children:[(0,b.jsx)(s.f,{fallbackUrl:"/exams",className:"-ml-2 shrink-0"}),(0,b.jsxs)("div",{className:"flex-1 min-w-0 space-y-2",children:[(0,b.jsx)("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight break-words",children:y.title}),(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[(0,b.jsx)(M.f,{status:y.status,recorded:U}),"original"===y.mode&&(0,b.jsx)(p.f,{variant:"secondary",children:v.exam.modes.original}),(0,b.jsx)("span",{children:v.exam.progress.replace("{ready}",String(T)).replace("{total}",String(y.questions.length))}),(0,b.jsx)("span",{children:(0,g.r)(y.createdAt,"yyyy-MM-dd HH:mm",a)})]})]})]}),(0,b.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,b.jsx)(d.default,{href:`/exams/${y.id}/print`,children:(0,b.jsxs)(q.f,{variant:"outline",size:"sm",disabled:0===T,children:[(0,b.jsx)(l.f,{className:"mr-2 h-4 w-4"}),v.exam.print]})}),!C&&W.length>0&&(0,b.jsxs)(q.f,{size:"sm",onClick:()=>{P(null),D({}),F((0,g.r)(new Date,"yyyy-MM-dd",a))},children:[(0,b.jsx)(j,{className:"mr-2 h-4 w-4"}),v.exam.recordResults]}),V&&"generating"!==y.status&&(0,b.jsxs)(q.f,{variant:"outline",size:"sm",onClick:_,children:[(0,b.jsx)(m.f,{className:"mr-2 h-4 w-4"}),v.exam.retryFailed]}),(0,b.jsxs)(q.f,{variant:"ghost",size:"sm",onClick:aa,className:"text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 hover:bg-red-50 dark:hover:bg-red-950/40 sm:ml-auto",children:[(0,b.jsx)(o.f,{className:"mr-2 h-4 w-4"}),v.exam.delete]})]}),y.questions.length<y.requestedCount&&(0,b.jsx)("p",{className:"rounded-md border border-amber-200 dark:border-amber-900 bg-amber-50 dark:bg-amber-950/40 p-3 text-sm text-amber-800 dark:text-amber-200",children:v.exam.fewerThanRequested.replaceAll("{actual}",String(y.questions.length))}),O&&(0,b.jsx)("p",{className:"rounded-md border p-3 text-sm",children:O}),C&&(0,b.jsxs)("div",{className:"space-y-2 rounded-md border bg-muted/30 p-3",children:[(0,b.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,b.jsx)("label",{htmlFor:"exam-taken-at",className:"text-sm font-medium",children:v.exam.takenAt}),(0,b.jsx)(r.f,{id:"exam-taken-at",type:"date",value:E,onChange:a=>F(a.target.value),className:"sm:w-48"})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:v.exam.recordHint})]}),X.length>0&&(0,b.jsx)(u.f,{scales:X.map(a=>a.figureScale),aligns:X.map(a=>a.figureAlign),onPreviewChange:R,onSave:ac}),(0,b.jsx)("div",{className:"space-y-3",children:y.questions.map(a=>(0,b.jsx)(L,{paperId:y.id,paperMode:y.mode,question:a,editingResult:C?C[a.id]??null:void 0,onResultChange:b=>D(c=>c?{...c,[a.id]:b}:c),onDeleteAttempt:$,onRegenerated:S,previewFigureScale:Q.scale,previewFigureAlign:Q.align,onSaveFigureScale:ab},a.id))}),C&&(0,b.jsx)("div",{className:"fixed inset-x-0 bottom-16 z-30 border-t bg-background/95 p-3 backdrop-blur md:bottom-0",children:(0,b.jsxs)("div",{className:"max-w-4xl mx-auto flex items-center justify-end gap-2",children:[0===Y&&(0,b.jsx)("span",{className:"mr-auto text-xs text-muted-foreground",children:v.exam.noResultSelected}),(0,b.jsx)(q.f,{variant:"outline",onClick:()=>D(null),disabled:I,children:v.exam.cancel}),(0,b.jsxs)(q.f,{onClick:Z,disabled:I||!E||0===Y,children:[I?(0,b.jsx)(k.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,b.jsx)(n.f,{className:"mr-2 h-4 w-4"}),v.exam.saveResults]})]})})]})})}],108561)}];
2
2
 
3
3
  //# sourceMappingURL=src_app_exams_%5Bid%5D_page_tsx_0xcjflkgkwzgd._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[790861,a=>{"use strict";var b=a.i(187924),c=a.i(572131),d=a.i(238246),e=a.i(529759),f=a.i(986705),g=a.i(483138),h=a.i(403512),i=a.i(699570),j=a.i(591119),k=a.i(579834),l=a.i(251538),m=a.i(506376),n=a.i(50944),o=a.i(875160),p=a.i(930363),q=a.i(315055),r=a.i(866718),s=a.i(870430),t=a.i(699814),u=a.i(550194),v=a.i(291938),w=a.i(515108);let x=["unmastered","mastered","all"],y=["least_practiced","random"],z=["easy","medium","hard","harder"];function A(){let{t:a,language:d}=(0,u.b)(),e=(0,n.useRouter)(),[f,g]=(0,c.useState)([]),[h,k]=(0,c.useState)([]),[l,m]=(0,c.useState)([]),[A,B]=(0,c.useState)([]),[C,D]=(0,c.useState)("unmastered"),[E,F]=(0,c.useState)("least_practiced"),[G,H]=(0,c.useState)(10),[I,J]=(0,c.useState)("medium"),[K,L]=(0,c.useState)(""),[M,N]=(0,c.useState)(!1),[O,P]=(0,c.useState)(null),{groups:Q,loading:R}=(0,w.f)();(0,c.useEffect)(()=>{v.k.get("/api/notebooks").then(a=>{g(a),1===a.length&&k([a[0].id])}).catch(()=>g([]))},[]);let S=async b=>{if(b.preventDefault(),0===h.length)return void P(a.exam.noNotebook);N(!0),P(null);try{let a=await v.k.post("/api/exams",{subjectIds:h,tagNames:l,paperLevelIds:A.length>0?A:void 0,scope:C,pickRule:E,count:G,difficulty:I,title:K.trim()||void 0,language:d});e.push(`/exams/${a.id}`)}catch(b){P("NO_SOURCE_ITEMS"===b?.data?.message?a.exam.noSource:a.common.messages?.saveFailed||"Failed"),N(!1)}},T=a.practice.difficulty;return(0,b.jsxs)(j.N,{children:[(0,b.jsx)(j.Y,{children:(0,b.jsx)(j.v,{className:"text-lg",children:a.exam.createTitle})}),(0,b.jsx)(j.O,{children:(0,b.jsxs)("form",{onSubmit:S,className:"space-y-5",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)(s.f,{children:a.exam.notebooks}),f.length>1&&(0,b.jsx)("button",{type:"button",className:"text-xs text-primary hover:underline",onClick:()=>k(h.length===f.length?[]:f.map(a=>a.id)),children:a.exam.selectAll})]}),(0,b.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:f.map(a=>(0,b.jsxs)("label",{className:"flex items-center gap-2 rounded-md border p-2 text-sm cursor-pointer hover:bg-muted/50",children:[(0,b.jsx)(q.f,{checked:h.includes(a.id),onCheckedChange:()=>{var b;return b=a.id,void k(a=>a.includes(b)?a.filter(a=>a!==b):[...a,b])}}),(0,b.jsx)("span",{className:"truncate",children:a.name}),(0,b.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:a._count?.errorItems??""})]},a.id))})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(s.f,{children:a.exam.tags}),(0,b.jsx)(t.f,{value:l,onChange:m,placeholder:a.exam.tagsPlaceholder})]}),!R&&Q.filter(a=>a.isActive).length>0&&(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(s.f,{children:a.filter.paperLevel}),(0,b.jsx)("div",{className:"flex flex-wrap gap-2",children:Q.filter(a=>a.isActive).map(a=>(0,b.jsx)("button",{type:"button",onClick:()=>{var b;return b=a.id,void B(a=>a.includes(b)?a.filter(a=>a!==b):[...a,b])},className:`rounded-full border px-3 py-1.5 text-sm transition-colors ${A.includes(a.id)?"border-primary bg-primary text-primary-foreground":"border-input bg-background hover:bg-muted"}`,children:a.name},a.id))})]}),(0,b.jsxs)("div",{className:"grid gap-4 sm:grid-cols-3",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(s.f,{children:a.exam.scope}),(0,b.jsx)("div",{className:"grid grid-cols-3 gap-1 rounded-md bg-muted p-1",children:x.map(c=>(0,b.jsx)("button",{type:"button",onClick:()=>D(c),className:`rounded px-2 py-1.5 text-sm transition-colors ${C===c?"bg-background shadow-sm font-medium":"text-muted-foreground"}`,children:a.exam.scopes[c]},c))})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(s.f,{htmlFor:"exam-count",children:a.exam.count}),(0,b.jsx)(r.f,{id:"exam-count",type:"number",min:1,max:50,value:G,onChange:a=>H(Math.min(50,Math.max(1,parseInt(a.target.value,10)||1)))})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(s.f,{htmlFor:"exam-difficulty",children:a.exam.difficulty}),(0,b.jsx)("select",{id:"exam-difficulty",value:I,onChange:a=>J(a.target.value),className:"h-9 w-full rounded-md border bg-background px-3 text-sm",children:z.map(a=>(0,b.jsx)("option",{value:a,children:T[a]},a))})]})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(s.f,{children:a.exam.pickRule}),(0,b.jsx)("div",{className:"grid grid-cols-2 gap-1 rounded-md bg-muted p-1 sm:max-w-sm",children:y.map(c=>(0,b.jsx)("button",{type:"button",onClick:()=>F(c),className:`rounded px-2 py-1.5 text-sm transition-colors ${E===c?"bg-background shadow-sm font-medium":"text-muted-foreground"}`,children:a.exam.pickRules[c]},c))}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:a.exam.pickRuleHints[E]})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(s.f,{htmlFor:"exam-title",children:a.exam.titleLabel}),(0,b.jsx)(r.f,{id:"exam-title",value:K,maxLength:100,onChange:a=>L(a.target.value)})]}),O&&(0,b.jsx)("p",{className:"text-sm text-destructive",children:O}),(0,b.jsxs)(i.f,{type:"submit",disabled:M,className:"w-full sm:w-auto",children:[M?(0,b.jsx)(o.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,b.jsx)(p.f,{className:"mr-2 h-4 w-4"}),M?a.exam.creating:a.exam.generate]})]})})]})}var B=a.i(726319),C=a.i(557999);a.s(["default",0,function(){let{timeZone:a}=(0,e.M)(),{t:n}=(0,u.b)();(0,C.f)(n.exam.title);let[o,p]=(0,c.useState)(null),[q,r]=(0,c.useState)(!1);(0,c.useEffect)(()=>{v.k.get("/api/exams").then(a=>{p(a),0===a.length&&r(!0)}).catch(()=>p([]))},[]);let s=n.practice.difficulty;return(0,b.jsx)("main",{className:"mx-auto min-h-screen max-w-6xl px-4 py-6 md:px-8 md:py-8",children:(0,b.jsxs)("div",{className:"space-y-6",children:[(0,b.jsx)(l.f,{title:n.exam.title,description:n.exam.subtitle,actions:!q&&(0,b.jsxs)(i.f,{onClick:()=>r(!0),"aria-label":n.exam.create,children:[(0,b.jsx)(h.f,{className:"h-4 w-4"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:n.exam.create})]})}),q&&(0,b.jsx)(A,{}),(0,b.jsxs)("section",{className:"space-y-3",children:[(0,b.jsx)("h2",{className:"text-lg font-semibold",children:n.exam.list}),null===o?(0,b.jsx)(m.f,{}):0===o.length?(0,b.jsx)(k.f,{icon:g.f,title:n.exam.empty,className:"py-10"}):(0,b.jsx)("div",{className:"grid gap-3 md:grid-cols-2",children:o.map(c=>(0,b.jsx)(d.default,{href:`/exams/${c.id}`,children:(0,b.jsx)(j.N,{className:"h-full rounded-2xl transition-all hover:-translate-y-0.5 hover:border-primary/40 hover:shadow-md",children:(0,b.jsxs)(j.O,{className:"space-y-2 pt-4",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,b.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,b.jsx)(g.f,{className:"h-4 w-4 shrink-0 text-primary"}),c.title]}),(0,b.jsx)(B.f,{status:c.status,recorded:c.recordedCount>0})]}),(0,b.jsxs)("div",{className:"flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[(0,b.jsx)("span",{children:(0,f.r)(c.createdAt,"yyyy-MM-dd HH:mm",a)}),(0,b.jsx)("span",{children:n.exam.questionCount.replace("{count}",String(c.questionCount))}),(0,b.jsx)("span",{children:n.exam.scopes[c.scope]}),(0,b.jsx)("span",{children:s[c.difficulty]||c.difficulty}),(0,b.jsx)("span",{children:c.recordedCount>0?n.exam.recorded:n.exam.notRecorded})]})]})})},c.id))})]})]})})}],790861)}];
1
+ module.exports=[790861,a=>{"use strict";var b=a.i(187924),c=a.i(572131),d=a.i(238246),e=a.i(529759),f=a.i(986705),g=a.i(483138),h=a.i(403512),i=a.i(699570),j=a.i(591119),k=a.i(579834),l=a.i(251538),m=a.i(506376),n=a.i(50944),o=a.i(875160),p=a.i(930363),q=a.i(315055),r=a.i(866718),s=a.i(870430),t=a.i(699814),u=a.i(550194);let v=["generate","original"];function w({value:a,onChange:c}){let{t:d}=(0,u.b)();return(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(s.f,{children:d.exam.modeLabel}),(0,b.jsx)("div",{className:"grid grid-cols-2 gap-1 rounded-md bg-muted p-1 sm:max-w-sm",role:"group","aria-label":d.exam.modeLabel,children:v.map(e=>(0,b.jsx)("button",{type:"button","aria-pressed":a===e,onClick:()=>c(e),className:`rounded px-2 py-1.5 text-sm transition-colors ${a===e?"bg-background shadow-sm font-medium":"text-muted-foreground"}`,children:d.exam.modes[e]},e))}),"original"===a&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:d.exam.originalHint})]})}var x=a.i(291938),y=a.i(515108);let z=["unmastered","mastered","all"],A=["least_practiced","random"],B=["easy","medium","hard","harder"];function C(){let{t:a,language:d}=(0,u.b)(),e=(0,n.useRouter)(),[f,g]=(0,c.useState)([]),[h,k]=(0,c.useState)([]),[l,m]=(0,c.useState)([]),[v,C]=(0,c.useState)([]),[D,E]=(0,c.useState)("unmastered"),[F,G]=(0,c.useState)("least_practiced"),[H,I]=(0,c.useState)(10),[J,K]=(0,c.useState)("medium"),[L,M]=(0,c.useState)("generate"),[N,O]=(0,c.useState)(""),[P,Q]=(0,c.useState)(!1),[R,S]=(0,c.useState)(null),{groups:T,loading:U}=(0,y.f)();(0,c.useEffect)(()=>{x.k.get("/api/notebooks").then(a=>{g(a),1===a.length&&k([a[0].id])}).catch(()=>g([]))},[]);let V=async b=>{if(b.preventDefault(),0===h.length)return void S(a.exam.noNotebook);Q(!0),S(null);try{let a=await x.k.post("/api/exams",{subjectIds:h,tagNames:l,paperLevelIds:v.length>0?v:void 0,scope:D,pickRule:F,count:H,difficulty:"original"===L?void 0:J,mode:L,title:N.trim()||void 0,language:d});e.push(`/exams/${a.id}`)}catch(b){S("NO_SOURCE_ITEMS"===b?.data?.message?a.exam.noSource:a.common.messages?.saveFailed||"Failed"),Q(!1)}},W=a.practice.difficulty;return(0,b.jsxs)(j.N,{children:[(0,b.jsx)(j.Y,{children:(0,b.jsx)(j.v,{className:"text-lg",children:a.exam.createTitle})}),(0,b.jsx)(j.O,{children:(0,b.jsxs)("form",{onSubmit:V,className:"space-y-5",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)(s.f,{children:a.exam.notebooks}),f.length>1&&(0,b.jsx)("button",{type:"button",className:"text-xs text-primary hover:underline",onClick:()=>k(h.length===f.length?[]:f.map(a=>a.id)),children:a.exam.selectAll})]}),(0,b.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:f.map(a=>(0,b.jsxs)("label",{className:"flex items-center gap-2 rounded-md border p-2 text-sm cursor-pointer hover:bg-muted/50",children:[(0,b.jsx)(q.f,{checked:h.includes(a.id),onCheckedChange:()=>{var b;return b=a.id,void k(a=>a.includes(b)?a.filter(a=>a!==b):[...a,b])}}),(0,b.jsx)("span",{className:"truncate",children:a.name}),(0,b.jsx)("span",{className:"ml-auto text-xs text-muted-foreground",children:a._count?.errorItems??""})]},a.id))})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(s.f,{children:a.exam.tags}),(0,b.jsx)(t.f,{value:l,onChange:m,placeholder:a.exam.tagsPlaceholder})]}),!U&&T.filter(a=>a.isActive).length>0&&(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(s.f,{children:a.filter.paperLevel}),(0,b.jsx)("div",{className:"flex flex-wrap gap-2",children:T.filter(a=>a.isActive).map(a=>(0,b.jsx)("button",{type:"button",onClick:()=>{var b;return b=a.id,void C(a=>a.includes(b)?a.filter(a=>a!==b):[...a,b])},className:`rounded-full border px-3 py-1.5 text-sm transition-colors ${v.includes(a.id)?"border-primary bg-primary text-primary-foreground":"border-input bg-background hover:bg-muted"}`,children:a.name},a.id))})]}),(0,b.jsx)(w,{value:L,onChange:M}),(0,b.jsxs)("div",{className:`grid gap-4 ${"generate"===L?"sm:grid-cols-3":"sm:grid-cols-2"}`,children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(s.f,{children:a.exam.scope}),(0,b.jsx)("div",{className:"grid grid-cols-3 gap-1 rounded-md bg-muted p-1",children:z.map(c=>(0,b.jsx)("button",{type:"button",onClick:()=>E(c),className:`rounded px-2 py-1.5 text-sm transition-colors ${D===c?"bg-background shadow-sm font-medium":"text-muted-foreground"}`,children:a.exam.scopes[c]},c))})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(s.f,{htmlFor:"exam-count",children:a.exam.count}),(0,b.jsx)(r.f,{id:"exam-count",type:"number",min:1,max:50,value:H,onChange:a=>I(Math.min(50,Math.max(1,parseInt(a.target.value,10)||1)))})]}),"generate"===L&&(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(s.f,{htmlFor:"exam-difficulty",children:a.exam.difficulty}),(0,b.jsx)("select",{id:"exam-difficulty",value:J,onChange:a=>K(a.target.value),className:"h-9 w-full rounded-md border bg-background px-3 text-sm",children:B.map(a=>(0,b.jsx)("option",{value:a,children:W[a]},a))})]})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(s.f,{children:a.exam.pickRule}),(0,b.jsx)("div",{className:"grid grid-cols-2 gap-1 rounded-md bg-muted p-1 sm:max-w-sm",children:A.map(c=>(0,b.jsx)("button",{type:"button",onClick:()=>G(c),className:`rounded px-2 py-1.5 text-sm transition-colors ${F===c?"bg-background shadow-sm font-medium":"text-muted-foreground"}`,children:a.exam.pickRules[c]},c))}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:a.exam.pickRuleHints[F]})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(s.f,{htmlFor:"exam-title",children:a.exam.titleLabel}),(0,b.jsx)(r.f,{id:"exam-title",value:N,maxLength:100,onChange:a=>O(a.target.value)})]}),R&&(0,b.jsx)("p",{className:"text-sm text-destructive",children:R}),(0,b.jsxs)(i.f,{type:"submit",disabled:P,className:"w-full sm:w-auto",children:[P?(0,b.jsx)(o.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,b.jsx)(p.f,{className:"mr-2 h-4 w-4"}),P?a.exam.creating:"original"===L?a.exam.createOriginal:a.exam.generate]})]})})]})}var D=a.i(726319),E=a.i(786304),F=a.i(557999);a.s(["default",0,function(){let{timeZone:a}=(0,e.M)(),{t:n}=(0,u.b)();(0,F.f)(n.exam.title);let[o,p]=(0,c.useState)(null),[q,r]=(0,c.useState)(!1);(0,c.useEffect)(()=>{x.k.get("/api/exams").then(a=>{p(a),0===a.length&&r(!0)}).catch(()=>p([]))},[]);let s=n.practice.difficulty;return(0,b.jsx)("main",{className:"mx-auto min-h-screen max-w-6xl px-4 py-6 md:px-8 md:py-8",children:(0,b.jsxs)("div",{className:"space-y-6",children:[(0,b.jsx)(l.f,{title:n.exam.title,description:n.exam.subtitle,actions:!q&&(0,b.jsxs)(i.f,{onClick:()=>r(!0),"aria-label":n.exam.create,children:[(0,b.jsx)(h.f,{className:"h-4 w-4"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:n.exam.create})]})}),q&&(0,b.jsx)(C,{}),(0,b.jsxs)("section",{className:"space-y-3",children:[(0,b.jsx)("h2",{className:"text-lg font-semibold",children:n.exam.list}),null===o?(0,b.jsx)(m.f,{}):0===o.length?(0,b.jsx)(k.f,{icon:g.f,title:n.exam.empty,className:"py-10"}):(0,b.jsx)("div",{className:"grid gap-3 md:grid-cols-2",children:o.map(c=>(0,b.jsx)(d.default,{href:`/exams/${c.id}`,children:(0,b.jsx)(j.N,{className:"h-full rounded-2xl transition-all hover:-translate-y-0.5 hover:border-primary/40 hover:shadow-md",children:(0,b.jsxs)(j.O,{className:"space-y-2 pt-4",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,b.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[(0,b.jsx)(g.f,{className:"h-4 w-4 shrink-0 text-primary"}),c.title]}),(0,b.jsx)(D.f,{status:c.status,recorded:c.recordedCount>0})]}),(0,b.jsxs)("div",{className:"flex flex-wrap gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[(0,b.jsx)("span",{children:(0,f.r)(c.createdAt,"yyyy-MM-dd HH:mm",a)}),(0,b.jsx)("span",{children:n.exam.questionCount.replace("{count}",String(c.questionCount))}),(0,b.jsx)("span",{children:n.exam.scopes[c.scope]}),"original"===c.mode?(0,b.jsx)(E.f,{variant:"secondary",children:n.exam.modes.original}):(0,b.jsx)("span",{children:s[c.difficulty]||c.difficulty}),(0,b.jsx)("span",{children:c.recordedCount>0?n.exam.recorded:n.exam.notRecorded})]})]})})},c.id))})]})]})})}],790861)}];
2
2
 
3
3
  //# sourceMappingURL=src_app_exams_page_tsx_17_d4_gy2i1ds._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[701453,a=>{"use strict";var b=a.i(187924),c=a.i(572131),d=a.i(50944),e=a.i(699570),f=a.i(251538),g=a.i(506376),h=a.i(403512),i=a.i(164831);let j={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};j.node;let k=(0,i.f)(j);var l=a.i(951675),m=a.i(238246);let n={name:"git-compare-arrows",size:24,node:[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]]};n.node;let o=(0,i.f)(n);var p=a.i(478958),q=a.i(62140),r=a.i(88444);let s={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]};s.node;let t=(0,i.f)(s);var u=a.i(263323),v=a.i(589027);let w={name:"funnel",size:24,node:[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],aliases:["filter"]};w.node;let x=(0,i.f)(w);var y=a.i(335732),z=a.i(550194);function A({mastery:a,timeRange:c,onMasteryChange:d,onTimeRangeChange:f}){let{t:g}=(0,z.b)(),h=[{value:"all",label:g.filter.all||"All"},{value:"new",label:g.filter.review||"To Review"},{value:"reviewing",label:g.filter.reviewing||"Reviewing"},{value:"mastered",label:g.filter.mastered||"Mastered"}],i=[{value:"all",label:g.filter.allTime||"All Time"},{value:"week",label:g.filter.lastWeek||"Last Week"},{value:"month",label:g.filter.lastMonth||"Last Month"}];return(0,b.jsxs)(y.G,{children:[(0,b.jsx)(y.X,{asChild:!0,children:(0,b.jsxs)(e.f,{variant:"outline",size:"sm",className:"h-10",children:[(0,b.jsx)(x,{className:"mr-2 h-4 w-4"}),g.notebook.filter,(0,b.jsx)(v.f,{className:"ml-2 h-4 w-4"})]})}),(0,b.jsxs)(y.L,{align:"end",className:"w-48",children:[(0,b.jsx)(y.B,{children:g.filter.masteryStatus||"Mastery Status"}),h.map(({value:c,label:e})=>(0,b.jsxs)(y.r,{onClick:()=>d(c),children:[a===c&&"✓ ",e]},c)),(0,b.jsx)(y.U,{}),(0,b.jsx)(y.B,{children:g.filter.timeRange||"Time Range"}),i.map(({value:a,label:d})=>(0,b.jsxs)(y.r,{onClick:()=>f(a),children:[c===a&&"✓ ",d]},a))]})]})}var B=a.i(515108);function C({value:a,onChange:c}){let{t:d}=(0,z.b)(),{groups:f,loading:g}=(0,B.f)(),h=f.filter(a=>a.isActive);return g?null:(0,b.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,b.jsx)(e.f,{variant:"all"===a?"default":"outline",size:"sm",className:"rounded-full",onClick:()=>c("all"),children:d.filter.all||"All"}),h.map(d=>(0,b.jsx)(e.f,{variant:a===d.id?"default":"outline",size:"sm",className:"rounded-full",onClick:()=>c(d.id),children:d.name},d.id))]})}var D=a.i(474215),E=a.i(875160),F=a.i(814574),G=a.i(225949),H=a.i(93907),I=a.i(291938),J=a.i(630534);function K({ids:a}){let{t:d}=(0,z.b)(),[f,g]=(0,c.useState)(!1),[h,i]=(0,c.useState)(null),[j,k]=(0,c.useState)(!1),[l,n]=(0,c.useState)(null),[p,q]=(0,c.useState)(0),[r,s]=a,t=()=>{k(!0),i(null),n(null),q(a=>a+1)};return(0,c.useEffect)(()=>{if(!f||!r||!s)return;let a=!0;return I.k.post("/api/error-items/similarity",{ids:[r,s]}).then(b=>{a&&i(b)}).catch(b=>{a&&(n("Question text is required for similarity comparison"===b?.data?.message?d.questionSimilarity.missingText:d.questionSimilarity.failed),J.V.error("[Similarity]","相似度比较失败",{error:b instanceof Error?b.message:String(b)}))}).finally(()=>{a&&k(!1)}),()=>{a=!1}},[f,r,s,p,d.questionSimilarity.failed,d.questionSimilarity.missingText]),(0,b.jsxs)(F.N,{open:f,onOpenChange:a=>{g(a),a&&t()},children:[(0,b.jsx)(F.a,{asChild:!0,children:(0,b.jsxs)(e.f,{variant:"outline",disabled:2!==a.length,title:d.questionSimilarity.selectTwo,children:[(0,b.jsx)(o,{className:"mr-2 h-4 w-4"}),d.questionSimilarity.title]})}),(0,b.jsxs)(F.d,{className:"w-[calc(100vw-2rem)] sm:max-w-3xl max-h-[85vh] overflow-y-auto",children:[(0,b.jsxs)(F.s,{children:[(0,b.jsx)(F.F,{children:d.questionSimilarity.title}),(0,b.jsx)(F.C,{children:d.questionSimilarity.description})]}),j&&(0,b.jsxs)("div",{className:"flex items-center gap-2 text-sm",role:"status",children:[(0,b.jsx)(E.f,{className:"h-4 w-4 animate-spin"}),d.common.loading]}),l&&(0,b.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:l}),l&&(0,b.jsx)(e.f,{variant:"outline",onClick:t,children:d.questionSimilarity.retry}),h&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"space-y-2 rounded-lg bg-muted p-4",role:"status",children:[(0,b.jsx)("p",{className:"text-sm",children:d.questionSimilarity.score}),(0,b.jsxs)("p",{className:"text-3xl font-bold tabular-nums",children:[Number((100*h.similarity).toFixed(4)),"%"]}),(0,b.jsx)("p",{className:"text-sm",children:d.questionSimilarity.threshold.replace("{threshold}",String(h.threshold))}),(0,b.jsx)("p",{className:"text-sm font-medium",children:h.duplicate?d.questionSimilarity.duplicate:d.questionSimilarity.different})]}),(0,b.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:h.items.map((a,c)=>(0,b.jsxs)("div",{className:"min-w-0 space-y-2 rounded-lg border p-3",children:[(0,b.jsxs)(m.default,{href:`/error-items/${a.id}`,className:"text-sm font-medium text-primary hover:underline",children:[d.questionSimilarity.question.replace("{index}",String(c+1))," · ",a.shortId||"-"]}),a.notebookName&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:a.notebookName}),(0,b.jsx)("div",{className:"max-h-56 overflow-auto text-sm",children:(0,b.jsx)(H.f,{content:a.questionText})})]},a.id))})]}),(0,b.jsx)(G.f,{onSaved:t})]})]})}function L({selectedIds:a,deleting:c,onCancel:d,onDelete:f}){let{t:g}=(0,z.b)();return(0,b.jsx)("div",{className:"pb-safe fixed bottom-0 left-0 right-0 z-50 border-t bg-card/95 p-4 shadow-lg backdrop-blur",children:(0,b.jsxs)("div",{className:"mx-auto flex max-w-6xl flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,b.jsxs)("div",{className:"space-y-1 text-sm text-muted-foreground",children:[(0,b.jsx)("p",{children:g.notebook.selectedCount.replace("{count}",String(a.length))}),(0,b.jsx)("p",{className:"text-xs",children:g.questionSimilarity.selectTwo})]}),(0,b.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,b.jsx)(K,{ids:a}),(0,b.jsxs)(e.f,{variant:"outline",onClick:d,children:[(0,b.jsx)(D.X,{className:"mr-2 h-4 w-4"}),g.notebook.cancelSelect]}),(0,b.jsxs)(e.f,{variant:"destructive",onClick:f,disabled:0===a.length||c,children:[(0,b.jsx)(l.f,{className:"mr-2 h-4 w-4"}),g.notebook.deleteSelected]})]})]})})}var M=a.i(529759),N=a.i(986705),O=a.i(580701),P=a.i(957292);let Q={1:["一年级"],2:["二年级"],3:["三年级"],4:["四年级"],5:["五年级"],6:["六年级"],7:["七年级上","七年级下","七年级"],8:["八年级上","八年级下","八年级"],9:["九年级上","九年级下","九年级"],10:["高一上","高一下","高一"],11:["高二上","高二下","高二"],12:["高三上","高三下","高三"]};function R({gradeSemester:a,tag:d,subjectName:e,tagSet:f="default",onFilterChange:g,className:h}){let{t:i}=(0,z.b)(),{timeZone:j}=(0,M.M)(),[k,l]=(0,c.useState)(a||""),[m,n]=(0,c.useState)(""),[o,p]=(0,c.useState)(d||""),[q,r]=(0,c.useState)([]),[s,t]=(0,c.useState)(!0),[u,v]=(0,c.useState)([]),[w,x]=(0,c.useState)(a);a!==w&&(x(a),void 0!==a&&l(a));let[y,A]=(0,c.useState)(d);d!==y&&(A(d),void 0!==d&&p(d||""));let B=(0,c.useCallback)((a,b)=>{let c=(0,N.c)(new Date,j),d=c.getFullYear(),e=(c.getMonth()+1>=9?d:d-1)-b+1;return"primary"===a?e:"junior_high"===a?e+6:"senior_high"===a?e+9:0},[j]),C=(0,c.useCallback)((a,b)=>{let c=[];return a?"primary"===a?c=[1,2,3,4,5,6]:"junior_high"===a?(c=[7,8,9],b&&B(a,b)>=10&&c.push(10,11,12)):c="senior_high"===a?[10,11,12]:[1,2,3,4,5,6,7,8,9,10,11,12]:c=[1,2,3,4,5,6,7,8,9,10,11,12],c.flatMap(a=>Q[a]||[])},[B]);(0,c.useEffect)(()=>{(async()=>{t(!0);try{let a=await I.k.get("/api/user"),b=C(a.educationStage,a.enrollmentYear);v(b);let c=e?(0,P.f)(e):"math";try{let a=await I.k.get(`/api/tags?subject=${c}&tagSet=${encodeURIComponent(f)}`);r(a.tags)}catch(a){J.V.warn("[KnowledgeFilter]","Failed to fetch tags for subject",{subject:c,tagSet:f,error:a}),r([])}}catch(a){J.V.error("[KnowledgeFilter]","Failed to load filter data",{error:a})}finally{t(!1)}})()},[e,f,C]);let D=q.find(a=>a.name===k),E=D?.children||[],F=E.find(a=>a.name===m),G=a=>0===a.children.length?[a.name]:a.children.flatMap(a=>G(a)),H=F?[...new Set(G(F))]:[],K=u.filter(a=>q.some(b=>b.name===a));return(0,b.jsxs)("div",{className:`flex gap-2 ${h}`,children:[(0,b.jsxs)(O.d,{value:k,onValueChange:a=>{l(a),n(""),p(""),g({gradeSemester:"all"===a?void 0:a,chapter:void 0,tag:void 0})},disabled:s,children:[(0,b.jsx)(O.P,{className:"w-[140px]",children:(0,b.jsx)(O.U,{placeholder:i.filter?.gradeShort||"Grade"})}),(0,b.jsxs)(O.r,{children:[(0,b.jsx)(O.T,{value:"all",children:i.filter?.allGrades||"All grades"}),K.map(a=>(0,b.jsx)(O.T,{value:a,children:a},a))]})]}),(0,b.jsxs)(O.d,{value:m,onValueChange:a=>{n(a),p(""),g({gradeSemester:"all"===k?void 0:k,chapter:"all"===a?void 0:a,tag:void 0})},disabled:!k||"all"===k,children:[(0,b.jsx)(O.P,{className:"w-[180px]",children:(0,b.jsx)(O.U,{placeholder:i.filter?.chapter||"Chapter"})}),(0,b.jsxs)(O.r,{children:[(0,b.jsx)(O.T,{value:"all",children:i.filter?.allChapters||"All chapters"}),E.map(a=>(0,b.jsx)(O.T,{value:a.name,children:a.name.replace(/^第\d+章\s*/,"")},a.id))]})]}),(0,b.jsxs)(O.d,{value:o,onValueChange:a=>{p(a),g({gradeSemester:"all"===k?void 0:k,chapter:"all"===m?void 0:m,tag:"all"===a?void 0:a})},disabled:!m||"all"===m,children:[(0,b.jsx)(O.P,{className:"w-[140px]",children:(0,b.jsx)(O.U,{placeholder:i.filter?.knowledgePoint||"Tag"})}),(0,b.jsxs)(O.r,{children:[(0,b.jsx)(O.T,{value:"all",children:i.filter?.allKnowledgePoints||"All tags"}),H.map(a=>(0,b.jsx)(O.T,{value:a,children:a},a))]})]})]})}var S=a.i(786304),T=a.i(579834),U=a.i(866718),V=a.i(882524),W=a.i(697902),X=a.i(249479);function Y(a){let b=new URLSearchParams;return a.subjectId&&b.append("subjectId",a.subjectId),a.search&&b.append("query",a.search),"all"!==a.mastery&&b.append("mastery",a.mastery),"all"!==a.timeRange&&b.append("timeRange",a.timeRange),a.tag&&b.append("tag",a.tag),a.gradeSemester&&b.append("gradeSemester",a.gradeSemester),a.chapter&&b.append("chapter",a.chapter),"all"!==a.paperLevel&&b.append("paperLevel",a.paperLevel),b}var Z=a.i(710302),$=a.i(879188),_=a.i(83715);function aa({subjectId:a,subjectName:f,tagSet:g="default",initialMastery:h,initialTag:i}){let{t:j}=(0,z.b)(),k=(0,d.useRouter)(),[l,m]=(0,c.useState)([]),[n,s]=(0,c.useState)(!0),[v,w]=(0,c.useState)(""),[x,y]=(0,c.useState)(h??"all"),[B,D]=(0,c.useState)("all"),[E,F]=(0,c.useState)(""),[G,H]=(0,c.useState)(""),[K,M]=(0,c.useState)("all"),[N,O]=(0,c.useState)(i??null),[P,Q]=(0,c.useState)(1),X=W.$,[ab,ac]=(0,c.useState)(0),[ad,ae]=(0,c.useState)(0),[af,ag]=(0,c.useState)(!1),[ah,ai]=(0,c.useState)(new Set),[aj,ak]=(0,c.useState)(!1),al=(0,c.useMemo)(()=>({subjectId:a,search:v,mastery:x,timeRange:B,tag:N,gradeSemester:E,chapter:G,paperLevel:K}),[a,v,x,B,N,E,G,K]),am=()=>{ag(!af),ai(new Set)},an=(0,c.useCallback)(async()=>{s(!0);try{let a=Y(al);a.append("page",P.toString()),a.append("pageSize",X.toString());let b=await I.k.get(`/api/error-items/list?${a.toString()}`);m(b.items),ac(b.total),ae(b.totalPages)}catch(a){J.V.error("[ErrorList]","Failed to fetch error items",{error:a})}finally{s(!1)}},[al,P,X]),ao=async()=>{if(0===ah.size)return;let a=(j.notebook?.confirmBatchDelete||"Delete {count} items?").replace("{count}",ah.size.toString());if(await (0,Z.u)(a,{destructive:!0})){ak(!0);try{await I.k.post("/api/error-items/batch-delete",{ids:Array.from(ah)}),Z.c.success(j.notebook?.batchDeleteSuccess||"Deleted successfully"),ag(!1),ai(new Set),an()}catch(a){J.V.error("[ErrorList]","Batch delete failed",{error:a}),Z.c.error(j.common?.messages?.deleteFailed||"Delete failed")}finally{ak(!1)}}},ap=(0,c.useRef)(al);return(0,c.useEffect)(()=>{let a=ap.current!==al;(ap.current=al,a&&1!==P)?Q(1):an()},[P,al,an]),(0,b.jsxs)("div",{className:`space-y-6 ${af?"pb-40 sm:pb-24":""}`,children:[(0,b.jsxs)("div",{className:"flex flex-col gap-3 lg:flex-row",children:[(0,b.jsxs)("div",{className:"relative w-full lg:flex-1",children:[(0,b.jsx)(t,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),(0,b.jsx)(U.f,{placeholder:j.notebook.search,title:j.shortId.searchHint,className:"h-10 rounded-xl bg-card pl-9",value:v,onChange:a=>w(a.target.value),onKeyDown:async a=>{let b=v.trim();if("Enter"!==a.key||!(0,_.f)(b))return;let c=await (0,$.f)(b);c&&k.push(`/error-items/${c}`)}})]}),(0,b.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,b.jsx)(A,{mastery:x,timeRange:B,onMasteryChange:y,onTimeRangeChange:D}),(0,b.jsxs)(e.f,{variant:"outline",size:"sm",className:"h-10",onClick:()=>k.push(`/print-preview?${Y(al).toString()}`),children:[(0,b.jsx)(r.f,{className:"mr-2 h-4 w-4"}),j.notebook?.exportPrint||"Export for Print"]}),!af&&(0,b.jsxs)(e.f,{variant:"outline",size:"sm",className:"h-10",onClick:am,children:[(0,b.jsx)(o,{className:"mr-2 h-4 w-4"}),j.questionSimilarity.title]}),(0,b.jsxs)(e.f,{variant:af?"secondary":"outline",size:"sm",className:"h-10",onClick:am,children:[(0,b.jsx)(q.f,{className:"mr-2 h-4 w-4"}),af?j.notebook?.cancelSelect||"Cancel":j.notebook?.selectMode||"Select"]})]})]}),(0,b.jsxs)("div",{className:"flex flex-col sm:flex-row gap-4 items-stretch sm:items-center",children:[(0,b.jsx)("div",{className:"w-full sm:w-auto",children:(0,b.jsx)(R,{gradeSemester:E,tag:N,onFilterChange:({gradeSemester:a,chapter:b,tag:c})=>{void 0!==a&&F(a),void 0!==b&&H(b),O(void 0===c?null:c),a?b||H(""):(F(""),H(""),O(null)),Q(1)},subjectName:f,tagSet:g})}),(0,b.jsx)(C,{value:K,onChange:M})]}),N&&(0,b.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-lg",children:[(0,b.jsxs)("span",{className:"text-sm text-muted-foreground",children:[j.filter.filteringByTag||"Filtering by tag",":"]}),(0,b.jsxs)(S.f,{variant:"secondary",className:"cursor-pointer",onClick:()=>O(null),children:[N,(0,b.jsx)("span",{className:"ml-1 text-xs",children:"×"})]})]}),!n&&0===l.length&&(0,b.jsx)(T.f,{icon:p.f,title:j.notebook.emptyList,description:j.notebook.emptyListHint}),n&&0===l.length&&(0,b.jsx)("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:Array.from({length:6},(a,c)=>(0,b.jsx)("div",{className:"h-44 animate-pulse rounded-2xl bg-muted"},c))}),(0,b.jsx)("div",{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-3 transition-opacity ${n?"opacity-60":""}`,children:l.map(a=>(0,b.jsx)(u.f,{item:a,selectMode:af,selected:ah.has(a.id),onToggleSelect:()=>{var b;return b=a.id,void ai(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},selectedTag:N,onTagClick:a=>O(N===a?null:a)},a.id))}),(0,b.jsx)(V.f,{page:P,totalPages:ad,total:ab,pageSize:X,onPageChange:Q}),af&&(0,b.jsx)(L,{selectedIds:[...ah],deleting:aj,onCancel:am,onDelete:ao})]})}function ab(a){let e=(0,d.useSearchParams)(),f=(0,c.useMemo)(()=>{let a,b,c;return a={},b=e.get("mastery"),(0,X.A)(b)&&(a.mastery=b),(c=e.get("tag"))&&(a.tag=c),a},[e]);return(0,b.jsx)(aa,{...a,initialMastery:f.mastery,initialTag:f.tag})}function ac(a){return(0,b.jsx)(c.Suspense,{fallback:null,children:(0,b.jsx)(ab,{...a})})}var ad=a.i(870430);function ae({open:a,onOpenChange:d,currentName:f,onRename:g}){let[h,i]=(0,c.useState)(f),[j,k]=(0,c.useState)(!1),{t:l}=(0,z.b)(),[m,n]=(0,c.useState)(f);f!==m&&(n(f),i(f));let o=async()=>{if(!h.trim())return void Z.c.warning(l.notebooks?.renameDialog?.enterName||"Please enter notebook name");k(!0);try{await g(h.trim()),d(!1)}catch(a){J.V.error("[RenameNotebook]","Failed to rename notebook",{error:a})}finally{k(!1)}};return(0,b.jsx)(F.N,{open:a,onOpenChange:d,children:(0,b.jsxs)(F.d,{children:[(0,b.jsx)(F.s,{children:(0,b.jsx)(F.F,{children:l.notebooks?.renameDialog?.title||"Rename Notebook"})}),(0,b.jsx)("div",{className:"space-y-4 py-4",children:(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ad.f,{htmlFor:"rename-name",children:l.notebooks?.renameDialog?.nameLabel||"New Name"}),(0,b.jsx)(U.f,{id:"rename-name",placeholder:l.notebooks?.renameDialog?.placeholder||"Enter new notebook name",value:h,onChange:a=>i(a.target.value),onKeyDown:a=>"Enter"===a.key&&o()})]})}),(0,b.jsxs)(F.c,{children:[(0,b.jsx)(e.f,{variant:"outline",onClick:()=>d(!1),children:l.common.cancel}),(0,b.jsx)(e.f,{onClick:o,disabled:j||!h.trim(),children:j?l.notebooks?.renameDialog?.renaming||"Renaming...":l.notebooks?.renameDialog?.rename||"Rename"})]})]})})}var af=a.i(986708);function ag({notebookId:a,onFinished:d}){let{t:f}=(0,z.b)(),[g,h]=(0,c.useState)(null),[i,j]=(0,c.useState)(null),k=(0,c.useRef)(!1),l=(0,c.useCallback)(()=>{I.k.get(`/api/notebooks/${a}/retag`).then(a=>{k.current&&a&&!a.running&&d?.(),k.current=!!a?.running,h(a)}).catch(()=>void 0)},[a,d]);(0,c.useEffect)(l,[l]),(0,c.useEffect)(()=>{if(!g?.running)return;let a=setTimeout(l,2e3);return()=>clearTimeout(a)},[g,l]);let m=async()=>{if(await (0,Z.u)(f.retag.notebookConfirm)){j(null);try{let b=await I.k.post(`/api/notebooks/${a}/retag`,{});if(0===b.total)return void j(f.retag.empty);k.current=b.running,h(b)}catch{j(f.retag.itemFailed)}}},n=i??(g?.running?f.retag.progress.replace("{done}",String(g.done)).replace("{total}",String(g.total)):g?.finishedAt&&g.total>0?f.retag.finished.replace("{success}",String(g.total-g.failed)).replace("{failed}",String(g.failed)):null);return(0,b.jsxs)("div",{className:"flex flex-col items-start sm:items-end gap-1",children:[(0,b.jsxs)(e.f,{variant:"outline",size:"sm",onClick:m,disabled:g?.running,"aria-label":f.retag.notebookButton,children:[g?.running?(0,b.jsx)(E.f,{className:"h-4 w-4 animate-spin sm:mr-2"}):(0,b.jsx)(af.f,{className:"h-4 w-4 sm:mr-2"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:f.retag.notebookButton})]}),n&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:n})]})}var ah=a.i(468368),ai=a.i(557999),aj=a.i(960927);a.s(["default",0,function(){let a=(0,d.useParams)(),i=(0,d.useRouter)(),{t:j}=(0,z.b)(),[n,o]=(0,c.useState)(null);(0,ai.f)(j.notebooks.title,n?.name);let[p,q]=(0,c.useState)(!0),[r,s]=(0,c.useState)(!1),[t,u]=(0,c.useState)(0),v=(0,c.useCallback)(async a=>{try{let b=await I.k.get(`/api/notebooks/${a}`);o(b)}catch(a){J.V.error("[NotebookDetail]","Failed to fetch notebook",{error:a}),Z.c.error(j.notebooks?.notFound||"Notebook not found"),i.push("/notebooks")}finally{q(!1)}},[i,j]);(0,c.useEffect)(()=>{a.id&&v(a.id)},[a.id,v]);let w=async a=>{n&&o(await I.k.put(`/api/notebooks/${n.id}`,{name:a}))},x=async()=>{if(n)try{let a=await I.k.get(`/api/notebooks/${n.id}`);if((a._count?.errorItems||0)>0)return void Z.c.warning(j.notebooks?.deleteNotEmpty||"Please clear all items in this notebook first.");if(!await (0,Z.u)((j.notebooks?.deleteConfirm||"Are you sure?").replace("{name}",n.name),{destructive:!0}))return;await I.k.delete(`/api/notebooks/${n.id}`),i.replace("/notebooks")}catch(a){J.V.error("[NotebookDetail]","Failed to delete notebook",{error:a}),Z.c.error((0,aj.d)(a)||j.notebooks?.deleteError||"Failed to delete")}};return p?(0,b.jsx)(g.f,{label:j.common.loading}):n?(0,b.jsx)("main",{className:"mx-auto min-h-screen max-w-6xl px-4 py-6 md:px-8 md:py-8",children:(0,b.jsxs)("div",{className:"space-y-6",children:[(0,b.jsx)(f.f,{backHref:"/notebooks",title:n.name,titleAddon:(0,b.jsx)(e.f,{variant:"ghost",size:"icon-sm",className:"shrink-0 text-muted-foreground",onClick:()=>s(!0),title:j.notebooks?.rename||"Rename",children:(0,b.jsx)(k,{className:"h-4 w-4"})}),description:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(ah.E,{notebook:n})," · ",(j.notebooks?.totalErrors||"Total {count} errors").replace("{count}",(n._count?.errorItems||0).toString())]}),actions:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(e.f,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:x,"aria-label":j.common.delete,children:[(0,b.jsx)(l.f,{className:"h-4 w-4"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:j.common.delete})]}),(0,b.jsx)(ag,{notebookId:n.id,onFinished:()=>u(a=>a+1)}),(0,b.jsx)(m.default,{href:`/notebooks/${n.id}/add`,children:(0,b.jsxs)(e.f,{"aria-label":j.notebooks?.addError||"Add Error",children:[(0,b.jsx)(h.f,{className:"h-4 w-4"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:j.notebooks?.addError||"Add Error"})]})})]})}),(0,b.jsx)(ac,{subjectId:n.id,subjectName:n.name,tagSet:n.tagSet||"default"},t),(0,b.jsx)(ae,{open:r,onOpenChange:s,currentName:n.name,onRename:w})]})}):null}],701453)}];
1
+ module.exports=[701453,a=>{"use strict";var b=a.i(187924),c=a.i(572131),d=a.i(50944),e=a.i(699570),f=a.i(251538),g=a.i(506376),h=a.i(403512),i=a.i(164831);let j={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};j.node;let k=(0,i.f)(j);var l=a.i(951675),m=a.i(238246);let n={name:"git-compare-arrows",size:24,node:[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]]};n.node;let o=(0,i.f)(n);var p=a.i(478958),q=a.i(62140),r=a.i(88444),s=a.i(233540),t=a.i(263323),u=a.i(589027);let v={name:"funnel",size:24,node:[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],aliases:["filter"]};v.node;let w=(0,i.f)(v);var x=a.i(335732),y=a.i(550194);function z({mastery:a,timeRange:c,onMasteryChange:d,onTimeRangeChange:f}){let{t:g}=(0,y.b)(),h=[{value:"all",label:g.filter.all||"All"},{value:"new",label:g.filter.review||"To Review"},{value:"reviewing",label:g.filter.reviewing||"Reviewing"},{value:"mastered",label:g.filter.mastered||"Mastered"}],i=[{value:"all",label:g.filter.allTime||"All Time"},{value:"week",label:g.filter.lastWeek||"Last Week"},{value:"month",label:g.filter.lastMonth||"Last Month"}];return(0,b.jsxs)(x.G,{children:[(0,b.jsx)(x.X,{asChild:!0,children:(0,b.jsxs)(e.f,{variant:"outline",size:"sm",className:"h-10",children:[(0,b.jsx)(w,{className:"mr-2 h-4 w-4"}),g.notebook.filter,(0,b.jsx)(u.f,{className:"ml-2 h-4 w-4"})]})}),(0,b.jsxs)(x.L,{align:"end",className:"w-48",children:[(0,b.jsx)(x.B,{children:g.filter.masteryStatus||"Mastery Status"}),h.map(({value:c,label:e})=>(0,b.jsxs)(x.r,{onClick:()=>d(c),children:[a===c&&"✓ ",e]},c)),(0,b.jsx)(x.U,{}),(0,b.jsx)(x.B,{children:g.filter.timeRange||"Time Range"}),i.map(({value:a,label:d})=>(0,b.jsxs)(x.r,{onClick:()=>f(a),children:[c===a&&"✓ ",d]},a))]})]})}var A=a.i(515108);function B({value:a,onChange:c}){let{t:d}=(0,y.b)(),{groups:f,loading:g}=(0,A.f)(),h=f.filter(a=>a.isActive);return g?null:(0,b.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,b.jsx)(e.f,{variant:"all"===a?"default":"outline",size:"sm",className:"rounded-full",onClick:()=>c("all"),children:d.filter.all||"All"}),h.map(d=>(0,b.jsx)(e.f,{variant:a===d.id?"default":"outline",size:"sm",className:"rounded-full",onClick:()=>c(d.id),children:d.name},d.id))]})}var C=a.i(474215),D=a.i(875160),E=a.i(814574),F=a.i(225949),G=a.i(93907),H=a.i(291938),I=a.i(630534);function J({ids:a}){let{t:d}=(0,y.b)(),[f,g]=(0,c.useState)(!1),[h,i]=(0,c.useState)(null),[j,k]=(0,c.useState)(!1),[l,n]=(0,c.useState)(null),[p,q]=(0,c.useState)(0),[r,s]=a,t=()=>{k(!0),i(null),n(null),q(a=>a+1)};return(0,c.useEffect)(()=>{if(!f||!r||!s)return;let a=!0;return H.k.post("/api/error-items/similarity",{ids:[r,s]}).then(b=>{a&&i(b)}).catch(b=>{a&&(n("Question text is required for similarity comparison"===b?.data?.message?d.questionSimilarity.missingText:d.questionSimilarity.failed),I.V.error("[Similarity]","相似度比较失败",{error:b instanceof Error?b.message:String(b)}))}).finally(()=>{a&&k(!1)}),()=>{a=!1}},[f,r,s,p,d.questionSimilarity.failed,d.questionSimilarity.missingText]),(0,b.jsxs)(E.N,{open:f,onOpenChange:a=>{g(a),a&&t()},children:[(0,b.jsx)(E.a,{asChild:!0,children:(0,b.jsxs)(e.f,{variant:"outline",disabled:2!==a.length,title:d.questionSimilarity.selectTwo,children:[(0,b.jsx)(o,{className:"mr-2 h-4 w-4"}),d.questionSimilarity.title]})}),(0,b.jsxs)(E.d,{className:"w-[calc(100vw-2rem)] sm:max-w-3xl max-h-[85vh] overflow-y-auto",children:[(0,b.jsxs)(E.s,{children:[(0,b.jsx)(E.F,{children:d.questionSimilarity.title}),(0,b.jsx)(E.C,{children:d.questionSimilarity.description})]}),j&&(0,b.jsxs)("div",{className:"flex items-center gap-2 text-sm",role:"status",children:[(0,b.jsx)(D.f,{className:"h-4 w-4 animate-spin"}),d.common.loading]}),l&&(0,b.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:l}),l&&(0,b.jsx)(e.f,{variant:"outline",onClick:t,children:d.questionSimilarity.retry}),h&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"space-y-2 rounded-lg bg-muted p-4",role:"status",children:[(0,b.jsx)("p",{className:"text-sm",children:d.questionSimilarity.score}),(0,b.jsxs)("p",{className:"text-3xl font-bold tabular-nums",children:[Number((100*h.similarity).toFixed(4)),"%"]}),(0,b.jsx)("p",{className:"text-sm",children:d.questionSimilarity.threshold.replace("{threshold}",String(h.threshold))}),(0,b.jsx)("p",{className:"text-sm font-medium",children:h.duplicate?d.questionSimilarity.duplicate:d.questionSimilarity.different})]}),(0,b.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:h.items.map((a,c)=>(0,b.jsxs)("div",{className:"min-w-0 space-y-2 rounded-lg border p-3",children:[(0,b.jsxs)(m.default,{href:`/error-items/${a.id}`,className:"text-sm font-medium text-primary hover:underline",children:[d.questionSimilarity.question.replace("{index}",String(c+1))," · ",a.shortId||"-"]}),a.notebookName&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:a.notebookName}),(0,b.jsx)("div",{className:"max-h-56 overflow-auto text-sm",children:(0,b.jsx)(G.f,{content:a.questionText})})]},a.id))})]}),(0,b.jsx)(F.f,{onSaved:t})]})]})}function K({selectedIds:a,deleting:c,onCancel:d,onDelete:f}){let{t:g}=(0,y.b)();return(0,b.jsx)("div",{className:"pb-safe fixed bottom-0 left-0 right-0 z-50 border-t bg-card/95 p-4 shadow-lg backdrop-blur",children:(0,b.jsxs)("div",{className:"mx-auto flex max-w-6xl flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,b.jsxs)("div",{className:"space-y-1 text-sm text-muted-foreground",children:[(0,b.jsx)("p",{children:g.notebook.selectedCount.replace("{count}",String(a.length))}),(0,b.jsx)("p",{className:"text-xs",children:g.questionSimilarity.selectTwo})]}),(0,b.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,b.jsx)(J,{ids:a}),(0,b.jsxs)(e.f,{variant:"outline",onClick:d,children:[(0,b.jsx)(C.X,{className:"mr-2 h-4 w-4"}),g.notebook.cancelSelect]}),(0,b.jsxs)(e.f,{variant:"destructive",onClick:f,disabled:0===a.length||c,children:[(0,b.jsx)(l.f,{className:"mr-2 h-4 w-4"}),g.notebook.deleteSelected]})]})]})})}var L=a.i(529759),M=a.i(986705),N=a.i(580701),O=a.i(957292);let P={1:["一年级"],2:["二年级"],3:["三年级"],4:["四年级"],5:["五年级"],6:["六年级"],7:["七年级上","七年级下","七年级"],8:["八年级上","八年级下","八年级"],9:["九年级上","九年级下","九年级"],10:["高一上","高一下","高一"],11:["高二上","高二下","高二"],12:["高三上","高三下","高三"]};function Q({gradeSemester:a,tag:d,subjectName:e,tagSet:f="default",onFilterChange:g,className:h}){let{t:i}=(0,y.b)(),{timeZone:j}=(0,L.M)(),[k,l]=(0,c.useState)(a||""),[m,n]=(0,c.useState)(""),[o,p]=(0,c.useState)(d||""),[q,r]=(0,c.useState)([]),[s,t]=(0,c.useState)(!0),[u,v]=(0,c.useState)([]),[w,x]=(0,c.useState)(a);a!==w&&(x(a),void 0!==a&&l(a));let[z,A]=(0,c.useState)(d);d!==z&&(A(d),void 0!==d&&p(d||""));let B=(0,c.useCallback)((a,b)=>{let c=(0,M.c)(new Date,j),d=c.getFullYear(),e=(c.getMonth()+1>=9?d:d-1)-b+1;return"primary"===a?e:"junior_high"===a?e+6:"senior_high"===a?e+9:0},[j]),C=(0,c.useCallback)((a,b)=>{let c=[];return a?"primary"===a?c=[1,2,3,4,5,6]:"junior_high"===a?(c=[7,8,9],b&&B(a,b)>=10&&c.push(10,11,12)):c="senior_high"===a?[10,11,12]:[1,2,3,4,5,6,7,8,9,10,11,12]:c=[1,2,3,4,5,6,7,8,9,10,11,12],c.flatMap(a=>P[a]||[])},[B]);(0,c.useEffect)(()=>{(async()=>{t(!0);try{let a=await H.k.get("/api/user"),b=C(a.educationStage,a.enrollmentYear);v(b);let c=e?(0,O.f)(e):"math";try{let a=await H.k.get(`/api/tags?subject=${c}&tagSet=${encodeURIComponent(f)}`);r(a.tags)}catch(a){I.V.warn("[KnowledgeFilter]","Failed to fetch tags for subject",{subject:c,tagSet:f,error:a}),r([])}}catch(a){I.V.error("[KnowledgeFilter]","Failed to load filter data",{error:a})}finally{t(!1)}})()},[e,f,C]);let D=q.find(a=>a.name===k),E=D?.children||[],F=E.find(a=>a.name===m),G=a=>0===a.children.length?[a.name]:a.children.flatMap(a=>G(a)),J=F?[...new Set(G(F))]:[],K=u.filter(a=>q.some(b=>b.name===a));return(0,b.jsxs)("div",{className:`flex gap-2 ${h}`,children:[(0,b.jsxs)(N.d,{value:k,onValueChange:a=>{l(a),n(""),p(""),g({gradeSemester:"all"===a?void 0:a,chapter:void 0,tag:void 0})},disabled:s,children:[(0,b.jsx)(N.P,{className:"w-[140px]",children:(0,b.jsx)(N.U,{placeholder:i.filter?.gradeShort||"Grade"})}),(0,b.jsxs)(N.r,{children:[(0,b.jsx)(N.T,{value:"all",children:i.filter?.allGrades||"All grades"}),K.map(a=>(0,b.jsx)(N.T,{value:a,children:a},a))]})]}),(0,b.jsxs)(N.d,{value:m,onValueChange:a=>{n(a),p(""),g({gradeSemester:"all"===k?void 0:k,chapter:"all"===a?void 0:a,tag:void 0})},disabled:!k||"all"===k,children:[(0,b.jsx)(N.P,{className:"w-[180px]",children:(0,b.jsx)(N.U,{placeholder:i.filter?.chapter||"Chapter"})}),(0,b.jsxs)(N.r,{children:[(0,b.jsx)(N.T,{value:"all",children:i.filter?.allChapters||"All chapters"}),E.map(a=>(0,b.jsx)(N.T,{value:a.name,children:a.name.replace(/^第\d+章\s*/,"")},a.id))]})]}),(0,b.jsxs)(N.d,{value:o,onValueChange:a=>{p(a),g({gradeSemester:"all"===k?void 0:k,chapter:"all"===m?void 0:m,tag:"all"===a?void 0:a})},disabled:!m||"all"===m,children:[(0,b.jsx)(N.P,{className:"w-[140px]",children:(0,b.jsx)(N.U,{placeholder:i.filter?.knowledgePoint||"Tag"})}),(0,b.jsxs)(N.r,{children:[(0,b.jsx)(N.T,{value:"all",children:i.filter?.allKnowledgePoints||"All tags"}),J.map(a=>(0,b.jsx)(N.T,{value:a,children:a},a))]})]})]})}var R=a.i(786304),S=a.i(579834),T=a.i(866718),U=a.i(882524),V=a.i(697902),W=a.i(249479);function X(a){let b=new URLSearchParams;return a.subjectId&&b.append("subjectId",a.subjectId),a.search&&b.append("query",a.search),"all"!==a.mastery&&b.append("mastery",a.mastery),"all"!==a.timeRange&&b.append("timeRange",a.timeRange),a.tag&&b.append("tag",a.tag),a.gradeSemester&&b.append("gradeSemester",a.gradeSemester),a.chapter&&b.append("chapter",a.chapter),"all"!==a.paperLevel&&b.append("paperLevel",a.paperLevel),b}var Y=a.i(710302),Z=a.i(879188),$=a.i(83715);function _({subjectId:a,subjectName:f,tagSet:g="default",initialMastery:h,initialTag:i}){let{t:j}=(0,y.b)(),k=(0,d.useRouter)(),[l,m]=(0,c.useState)([]),[n,u]=(0,c.useState)(!0),[v,w]=(0,c.useState)(""),[x,A]=(0,c.useState)(h??"all"),[C,D]=(0,c.useState)("all"),[E,F]=(0,c.useState)(""),[G,J]=(0,c.useState)(""),[L,M]=(0,c.useState)("all"),[N,O]=(0,c.useState)(i??null),[P,W]=(0,c.useState)(1),aa=V.$,[ab,ac]=(0,c.useState)(0),[ad,ae]=(0,c.useState)(0),[af,ag]=(0,c.useState)(!1),[ah,ai]=(0,c.useState)(new Set),[aj,ak]=(0,c.useState)(!1),al=(0,c.useMemo)(()=>({subjectId:a,search:v,mastery:x,timeRange:C,tag:N,gradeSemester:E,chapter:G,paperLevel:L}),[a,v,x,C,N,E,G,L]),am=()=>{ag(!af),ai(new Set)},an=(0,c.useCallback)(async()=>{u(!0);try{let a=X(al);a.append("page",P.toString()),a.append("pageSize",aa.toString());let b=await H.k.get(`/api/error-items/list?${a.toString()}`);m(b.items),ac(b.total),ae(b.totalPages)}catch(a){I.V.error("[ErrorList]","Failed to fetch error items",{error:a})}finally{u(!1)}},[al,P,aa]),ao=async()=>{if(0===ah.size)return;let a=(j.notebook?.confirmBatchDelete||"Delete {count} items?").replace("{count}",ah.size.toString());if(await (0,Y.u)(a,{destructive:!0})){ak(!0);try{await H.k.post("/api/error-items/batch-delete",{ids:Array.from(ah)}),Y.c.success(j.notebook?.batchDeleteSuccess||"Deleted successfully"),ag(!1),ai(new Set),an()}catch(a){I.V.error("[ErrorList]","Batch delete failed",{error:a}),Y.c.error(j.common?.messages?.deleteFailed||"Delete failed")}finally{ak(!1)}}},ap=(0,c.useRef)(al);return(0,c.useEffect)(()=>{let a=ap.current!==al;(ap.current=al,a&&1!==P)?W(1):an()},[P,al,an]),(0,b.jsxs)("div",{className:`space-y-6 ${af?"pb-40 sm:pb-24":""}`,children:[(0,b.jsxs)("div",{className:"flex flex-col gap-3 lg:flex-row",children:[(0,b.jsxs)("div",{className:"relative w-full lg:flex-1",children:[(0,b.jsx)(s.f,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),(0,b.jsx)(T.f,{placeholder:j.notebook.search,title:j.shortId.searchHint,className:"h-10 rounded-xl bg-card pl-9",value:v,onChange:a=>w(a.target.value),onKeyDown:async a=>{let b=v.trim();if("Enter"!==a.key||!(0,$.f)(b))return;let c=await (0,Z.f)(b);c&&k.push(`/error-items/${c}`)}})]}),(0,b.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,b.jsx)(z,{mastery:x,timeRange:C,onMasteryChange:A,onTimeRangeChange:D}),(0,b.jsxs)(e.f,{variant:"outline",size:"sm",className:"h-10",onClick:()=>k.push(`/print-preview?${X(al).toString()}`),children:[(0,b.jsx)(r.f,{className:"mr-2 h-4 w-4"}),j.notebook?.exportPrint||"Export for Print"]}),!af&&(0,b.jsxs)(e.f,{variant:"outline",size:"sm",className:"h-10",onClick:am,children:[(0,b.jsx)(o,{className:"mr-2 h-4 w-4"}),j.questionSimilarity.title]}),(0,b.jsxs)(e.f,{variant:af?"secondary":"outline",size:"sm",className:"h-10",onClick:am,children:[(0,b.jsx)(q.f,{className:"mr-2 h-4 w-4"}),af?j.notebook?.cancelSelect||"Cancel":j.notebook?.selectMode||"Select"]})]})]}),(0,b.jsxs)("div",{className:"flex flex-col sm:flex-row gap-4 items-stretch sm:items-center",children:[(0,b.jsx)("div",{className:"w-full sm:w-auto",children:(0,b.jsx)(Q,{gradeSemester:E,tag:N,onFilterChange:({gradeSemester:a,chapter:b,tag:c})=>{void 0!==a&&F(a),void 0!==b&&J(b),O(void 0===c?null:c),a?b||J(""):(F(""),J(""),O(null)),W(1)},subjectName:f,tagSet:g})}),(0,b.jsx)(B,{value:L,onChange:M})]}),N&&(0,b.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-lg",children:[(0,b.jsxs)("span",{className:"text-sm text-muted-foreground",children:[j.filter.filteringByTag||"Filtering by tag",":"]}),(0,b.jsxs)(R.f,{variant:"secondary",className:"cursor-pointer",onClick:()=>O(null),children:[N,(0,b.jsx)("span",{className:"ml-1 text-xs",children:"×"})]})]}),!n&&0===l.length&&(0,b.jsx)(S.f,{icon:p.f,title:j.notebook.emptyList,description:j.notebook.emptyListHint}),n&&0===l.length&&(0,b.jsx)("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:Array.from({length:6},(a,c)=>(0,b.jsx)("div",{className:"h-44 animate-pulse rounded-2xl bg-muted"},c))}),(0,b.jsx)("div",{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-3 transition-opacity ${n?"opacity-60":""}`,children:l.map(a=>(0,b.jsx)(t.f,{item:a,selectMode:af,selected:ah.has(a.id),onToggleSelect:()=>{var b;return b=a.id,void ai(a=>{let c=new Set(a);return c.has(b)?c.delete(b):c.add(b),c})},selectedTag:N,onTagClick:a=>O(N===a?null:a)},a.id))}),(0,b.jsx)(U.f,{page:P,totalPages:ad,total:ab,pageSize:aa,onPageChange:W}),af&&(0,b.jsx)(K,{selectedIds:[...ah],deleting:aj,onCancel:am,onDelete:ao})]})}function aa(a){let e=(0,d.useSearchParams)(),f=(0,c.useMemo)(()=>{let a,b,c;return a={},b=e.get("mastery"),(0,W.A)(b)&&(a.mastery=b),(c=e.get("tag"))&&(a.tag=c),a},[e]);return(0,b.jsx)(_,{...a,initialMastery:f.mastery,initialTag:f.tag})}function ab(a){return(0,b.jsx)(c.Suspense,{fallback:null,children:(0,b.jsx)(aa,{...a})})}var ac=a.i(870430);function ad({open:a,onOpenChange:d,currentName:f,onRename:g}){let[h,i]=(0,c.useState)(f),[j,k]=(0,c.useState)(!1),{t:l}=(0,y.b)(),[m,n]=(0,c.useState)(f);f!==m&&(n(f),i(f));let o=async()=>{if(!h.trim())return void Y.c.warning(l.notebooks?.renameDialog?.enterName||"Please enter notebook name");k(!0);try{await g(h.trim()),d(!1)}catch(a){I.V.error("[RenameNotebook]","Failed to rename notebook",{error:a})}finally{k(!1)}};return(0,b.jsx)(E.N,{open:a,onOpenChange:d,children:(0,b.jsxs)(E.d,{children:[(0,b.jsx)(E.s,{children:(0,b.jsx)(E.F,{children:l.notebooks?.renameDialog?.title||"Rename Notebook"})}),(0,b.jsx)("div",{className:"space-y-4 py-4",children:(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ac.f,{htmlFor:"rename-name",children:l.notebooks?.renameDialog?.nameLabel||"New Name"}),(0,b.jsx)(T.f,{id:"rename-name",placeholder:l.notebooks?.renameDialog?.placeholder||"Enter new notebook name",value:h,onChange:a=>i(a.target.value),onKeyDown:a=>"Enter"===a.key&&o()})]})}),(0,b.jsxs)(E.c,{children:[(0,b.jsx)(e.f,{variant:"outline",onClick:()=>d(!1),children:l.common.cancel}),(0,b.jsx)(e.f,{onClick:o,disabled:j||!h.trim(),children:j?l.notebooks?.renameDialog?.renaming||"Renaming...":l.notebooks?.renameDialog?.rename||"Rename"})]})]})})}var ae=a.i(986708);function af({notebookId:a,onFinished:d}){let{t:f}=(0,y.b)(),[g,h]=(0,c.useState)(null),[i,j]=(0,c.useState)(null),k=(0,c.useRef)(!1),l=(0,c.useCallback)(()=>{H.k.get(`/api/notebooks/${a}/retag`).then(a=>{k.current&&a&&!a.running&&d?.(),k.current=!!a?.running,h(a)}).catch(()=>void 0)},[a,d]);(0,c.useEffect)(l,[l]),(0,c.useEffect)(()=>{if(!g?.running)return;let a=setTimeout(l,2e3);return()=>clearTimeout(a)},[g,l]);let m=async()=>{if(await (0,Y.u)(f.retag.notebookConfirm)){j(null);try{let b=await H.k.post(`/api/notebooks/${a}/retag`,{});if(0===b.total)return void j(f.retag.empty);k.current=b.running,h(b)}catch{j(f.retag.itemFailed)}}},n=i??(g?.running?f.retag.progress.replace("{done}",String(g.done)).replace("{total}",String(g.total)):g?.finishedAt&&g.total>0?f.retag.finished.replace("{success}",String(g.total-g.failed)).replace("{failed}",String(g.failed)):null);return(0,b.jsxs)("div",{className:"flex flex-col items-start sm:items-end gap-1",children:[(0,b.jsxs)(e.f,{variant:"outline",size:"sm",onClick:m,disabled:g?.running,"aria-label":f.retag.notebookButton,children:[g?.running?(0,b.jsx)(D.f,{className:"h-4 w-4 animate-spin sm:mr-2"}):(0,b.jsx)(ae.f,{className:"h-4 w-4 sm:mr-2"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:f.retag.notebookButton})]}),n&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:n})]})}var ag=a.i(468368),ah=a.i(557999),ai=a.i(960927);a.s(["default",0,function(){let a=(0,d.useParams)(),i=(0,d.useRouter)(),{t:j}=(0,y.b)(),[n,o]=(0,c.useState)(null);(0,ah.f)(j.notebooks.title,n?.name);let[p,q]=(0,c.useState)(!0),[r,s]=(0,c.useState)(!1),[t,u]=(0,c.useState)(0),v=(0,c.useCallback)(async a=>{try{let b=await H.k.get(`/api/notebooks/${a}`);o(b)}catch(a){I.V.error("[NotebookDetail]","Failed to fetch notebook",{error:a}),Y.c.error(j.notebooks?.notFound||"Notebook not found"),i.push("/notebooks")}finally{q(!1)}},[i,j]);(0,c.useEffect)(()=>{a.id&&v(a.id)},[a.id,v]);let w=async a=>{n&&o(await H.k.put(`/api/notebooks/${n.id}`,{name:a}))},x=async()=>{if(n)try{let a=await H.k.get(`/api/notebooks/${n.id}`);if((a._count?.errorItems||0)>0)return void Y.c.warning(j.notebooks?.deleteNotEmpty||"Please clear all items in this notebook first.");if(!await (0,Y.u)((j.notebooks?.deleteConfirm||"Are you sure?").replace("{name}",n.name),{destructive:!0}))return;await H.k.delete(`/api/notebooks/${n.id}`),i.replace("/notebooks")}catch(a){I.V.error("[NotebookDetail]","Failed to delete notebook",{error:a}),Y.c.error((0,ai.d)(a)||j.notebooks?.deleteError||"Failed to delete")}};return p?(0,b.jsx)(g.f,{label:j.common.loading}):n?(0,b.jsx)("main",{className:"mx-auto min-h-screen max-w-6xl px-4 py-6 md:px-8 md:py-8",children:(0,b.jsxs)("div",{className:"space-y-6",children:[(0,b.jsx)(f.f,{backHref:"/notebooks",title:n.name,titleAddon:(0,b.jsx)(e.f,{variant:"ghost",size:"icon-sm",className:"shrink-0 text-muted-foreground",onClick:()=>s(!0),title:j.notebooks?.rename||"Rename",children:(0,b.jsx)(k,{className:"h-4 w-4"})}),description:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(ag.E,{notebook:n})," · ",(j.notebooks?.totalErrors||"Total {count} errors").replace("{count}",(n._count?.errorItems||0).toString())]}),actions:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(e.f,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:x,"aria-label":j.common.delete,children:[(0,b.jsx)(l.f,{className:"h-4 w-4"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:j.common.delete})]}),(0,b.jsx)(af,{notebookId:n.id,onFinished:()=>u(a=>a+1)}),(0,b.jsx)(m.default,{href:`/notebooks/${n.id}/add`,children:(0,b.jsxs)(e.f,{"aria-label":j.notebooks?.addError||"Add Error",children:[(0,b.jsx)(h.f,{className:"h-4 w-4"}),(0,b.jsx)("span",{className:"hidden sm:inline",children:j.notebooks?.addError||"Add Error"})]})})]})}),(0,b.jsx)(ab,{subjectId:n.id,subjectName:n.name,tagSet:n.tagSet||"default"},t),(0,b.jsx)(ad,{open:r,onOpenChange:s,currentName:n.name,onRename:w})]})}):null}],701453)}];
2
2
 
3
3
  //# sourceMappingURL=src_app_notebooks_%5Bid%5D_page_tsx_08njm-5-txm8_._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[771706,a=>{"use strict";var b=a.i(187924),c=a.i(572131),d=a.i(50944),e=a.i(699570),f=a.i(695001),g=a.i(550194);function h({items:a,selectedIds:c,selectedCount:d,onToggle:f,onSelectAll:i,onClear:j}){let{t:k}=(0,g.b)();return(0,b.jsxs)("div",{className:"rounded-md border bg-muted/20 p-3 space-y-2",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,b.jsxs)("div",{className:"text-sm font-medium",children:[k.printPreview?.selectItems||"Select Items"," (",d,"/",a.length,")"]}),(0,b.jsxs)("div",{className:"flex gap-2",children:[(0,b.jsx)(e.f,{variant:"outline",size:"sm",onClick:i,children:k.printPreview?.selectAll||"Select All"}),(0,b.jsx)(e.f,{variant:"outline",size:"sm",onClick:j,children:k.printPreview?.clearSelection||"Clear Selection"})]})]}),(0,b.jsx)("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-3 max-h-44 overflow-y-auto pr-1",children:a.map((a,d)=>(0,b.jsxs)("label",{className:"flex items-start gap-2 rounded border bg-background p-2 text-xs cursor-pointer hover:border-primary/50",children:[(0,b.jsx)("input",{type:"checkbox",checked:c.has(a.id),onChange:()=>f(a.id),className:"mt-0.5 rounded border-gray-300 text-primary focus:ring-primary"}),(0,b.jsxs)("span",{className:"line-clamp-2",children:[(0,b.jsx)("span",{className:"font-semibold",children:k.printPreview?.questionNumber?.replace("{num}",String(d+1))||`Question ${d+1}`}),a.questionText?`${k.common.colon}${a.questionText}`:""]})]},a.id))})]})}var i=a.i(249632);function j({checked:a,onChange:c,label:d}){return(0,b.jsxs)("label",{className:"flex items-center gap-1.5 text-xs sm:text-sm cursor-pointer whitespace-nowrap hover:text-primary transition-colors",children:[(0,b.jsx)("input",{type:"checkbox",checked:a,onChange:a=>c(a.target.checked),className:"rounded border-gray-300 text-primary focus:ring-primary w-3.5 h-3.5 sm:w-4 sm:h-4"}),d]})}function k({options:a,onChange:c,hasCustomSpaces:d,onResetCustomSpaces:f}){let{t:h}=(0,g.b)(),l=a.answerSpace??"auto";return(0,b.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-2 sm:gap-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 text-sm bg-muted/50 px-2 sm:px-3 py-1 rounded-md",children:[(0,b.jsxs)("span",{className:"whitespace-nowrap text-xs sm:text-sm",children:[h.printPreview?.imageScale||"Image Scale",": ",a.imageScale,"%"]}),(0,b.jsx)("input",{type:"range",min:"30",max:"100",value:a.imageScale,onChange:a=>c({imageScale:Number(a.target.value)}),className:"w-16 sm:w-20 accent-primary"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 text-xs sm:text-sm bg-muted/50 px-2 sm:px-3 py-1 rounded-md",children:[(0,b.jsxs)("label",{htmlFor:"print-preview-answer-space",className:"whitespace-nowrap",children:[h.exam.answerSpace,":"]}),(0,b.jsxs)("select",{id:"print-preview-answer-space",value:l,onChange:a=>{(0,i.I)(a.target.value)&&c({answerSpace:a.target.value})},className:"bg-background border rounded px-2 py-0.5 text-xs sm:text-sm",children:[(0,b.jsx)("option",{value:"auto",children:h.exam.answerSpaceAuto}),(0,b.jsx)("option",{value:"none",children:h.exam.answerSpaceNone}),(0,b.jsx)("option",{value:"small",children:h.exam.answerSpaceSmall}),(0,b.jsx)("option",{value:"medium",children:h.exam.answerSpaceMedium}),(0,b.jsx)("option",{value:"large",children:h.exam.answerSpaceLarge})]}),d&&f&&(0,b.jsx)(e.f,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:f,children:h.exam.resetAllQuestionAnswerSpaces})]}),(0,b.jsxs)("div",{className:"flex flex-wrap gap-x-3 gap-y-1 sm:gap-4",children:[(0,b.jsx)(j,{checked:a.showQuestionText,onChange:a=>c({showQuestionText:a}),label:h.printPreview?.showQuestionText||"Question Text"}),(0,b.jsx)(j,{checked:a.showAnswers,onChange:a=>c({showAnswers:a}),label:h.printPreview?.showAnswers||"Show Answers"}),(0,b.jsx)(j,{checked:a.showAnalysis,onChange:a=>c({showAnalysis:a}),label:h.printPreview?.showAnalysis||"Show Analysis"}),(0,b.jsx)(j,{checked:a.showTags,onChange:a=>c({showTags:a}),label:h.printPreview?.showTags||"Show Tags"})]})]})}var l=a.i(93907),m=a.i(897555),n=a.i(418943),o=a.i(515108);function p({item:a,index:c,options:d,reserveAnswerSpace:e,customAnswerSpacePx:f,onCustomAnswerSpaceChange:h}){let{t:j}=(0,g.b)(),k=function(a){if(a.tags&&a.tags.length>0)return a.tags.map(a=>a.name);try{let b=JSON.parse(a.knowledgePoints||"[]");return Array.isArray(b)?b.filter(a=>"string"==typeof a):[]}catch{return[]}}(a),{groups:q}=(0,o.f)(),r=a.paperLevel?q.find(b=>b.id===a.paperLevel)?.name||a.paperLevel:null,s=e?(0,i.z)(d.answerSpace??"auto",a.questionText||"",f):0;return(0,b.jsxs)("div",{className:`mb-4 border-b last:border-b-0 print:break-inside-avoid ${e?"pb-4":"pb-6"}`,children:[(0,b.jsxs)("div",{className:"mb-4 flex flex-wrap items-center gap-x-4 gap-y-2 leading-7",children:[(0,b.jsx)("span",{className:"text-lg font-bold",children:j.printPreview?.questionNumber?.replace("{num}",String(c+1))||`Question ${c+1}`}),a.shortId&&(0,b.jsx)("span",{className:"font-mono text-sm text-muted-foreground whitespace-nowrap",children:j.printPreview.source.replace("{id}",a.shortId)}),a.subject&&(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:a.subject.name}),a.gradeSemester&&(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:a.gradeSemester}),r&&(0,b.jsxs)("span",{className:"text-sm text-muted-foreground",children:[j.printPreview?.paperLevel||"Paper Level",": ",r]}),d.showTags&&k.length>0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("span",{className:"font-semibold",children:[j.printPreview?.knowledgePoints||"Knowledge Points",":"]}),k.map((a,c)=>(0,b.jsx)("span",{className:"px-2 py-1 bg-muted rounded text-sm",children:a},`${a}-${c}`))]})]}),d.showQuestionText&&a.questionText?(0,b.jsxs)("div",{className:"mb-4",children:[(0,b.jsx)(l.f,{content:a.questionText}),(0,b.jsx)(n.f,{svg:a.figureSvg,scale:a.figureScale,align:a.figureAlign})]}):a.originalImageUrl&&(0,b.jsx)("div",{className:"mb-4",children:(0,b.jsx)("img",{src:a.originalImageUrl,alt:j.detail?.originalProblem||"Question Image",className:"h-auto border rounded",style:{maxWidth:`${d.imageScale}%`}})}),d.showAnswers&&a.answerText&&(0,b.jsxs)("div",{className:"mb-4",children:[(0,b.jsxs)("h3",{className:"font-semibold mb-2",children:[j.printPreview?.referenceAnswer||"Reference Answer",":"]}),(0,b.jsx)(l.f,{content:a.answerText})]}),d.showAnalysis&&a.analysis&&(0,b.jsxs)("div",{className:"mb-4",children:[(0,b.jsxs)("h3",{className:"font-semibold mb-2",children:[j.printPreview?.analysis||"Analysis",":"]}),(0,b.jsx)(l.f,{content:a.analysis})]}),e&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"print-answer-space",style:{minHeight:`${s}px`}}),h&&(0,b.jsx)(m.f,{effectivePx:s,isCustom:"number"==typeof f,onChange:a=>h(a),onReset:()=>h(null)})]})]})}var q=a.i(291938),r=a.i(557999),s=a.i(103006),t=a.i(697902),u=a.i(630534);async function v(a){await q.k.put("/api/error-items/answer-space",{items:a})}function w(){var a,i,j,l,m,n;let o=(0,d.useSearchParams)(),{t:w}=(0,g.b)(),[x,y]=(0,c.useState)([]);(0,r.f)(w.printPreview.title);let[z,A]=(0,c.useState)(!0),[B,C]=(0,c.useState)({showQuestionText:!1,showAnswers:!1,showAnalysis:!1,showTags:!1,imageScale:70,answerSpace:"auto"}),[D,E]=(0,c.useState)(new Set),{customSpaces:F,setSpace:G,resetAll:H,saveFailed:I}=(0,s.f)(x,v),J=(0,c.useCallback)(async()=>{try{let a=new URLSearchParams(o.toString());a.set("pageSize",String(t.A)),a.set("view","print");let b=await q.k.get(`/api/error-items/list?${a.toString()}`);y(b.items),E(new Set(b.items.map(a=>a.id)))}catch(a){u.V.error("[PrintPreview]","Failed to fetch items",{error:a})}finally{A(!1)}},[o]);(0,c.useEffect)(()=>{J()},[J]);let K=x.filter(a=>D.has(a.id)),L=(a=B.showAnswers,i=B.showAnalysis,!a&&!i),M=(j=x.length,(l=K.length)===j?String(j):`${l}/${j}`),N=(m=x.length,n=K.length,0===m?"noItems":0===n?"noSelection":null);return z?(0,b.jsx)("div",{className:"min-h-screen flex items-center justify-center",children:(0,b.jsx)("p",{className:"text-muted-foreground",children:w.common.loading})}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"print:hidden sticky top-0 z-10 bg-background border-b p-3 sm:p-4 shadow-sm",children:(0,b.jsxs)("div",{className:"max-w-6xl mx-auto space-y-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)(f.f,{fallbackUrl:"/notebooks"}),(0,b.jsxs)("h1",{className:"text-lg sm:text-xl font-bold flex-1",children:[w.printPreview?.title||"Print Preview"," (",M," ",w.notebooks?.items||"items",")"]}),(0,b.jsx)(e.f,{onClick:()=>{window.print()},size:"sm",className:"whitespace-nowrap",disabled:0===K.length,children:w.printPreview?.printButton||"Print / Save PDF"})]}),(0,b.jsx)(k,{options:B,onChange:a=>C(b=>({...b,...a})),hasCustomSpaces:Object.keys(F).length>0,onResetCustomSpaces:H}),I&&(0,b.jsx)("p",{className:"text-xs text-destructive",children:w.exam.answerSpaceSaveFailed}),(0,b.jsx)(h,{items:x,selectedIds:D,selectedCount:K.length,onToggle:a=>{E(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},onSelectAll:()=>{E(new Set(x.map(a=>a.id)))},onClear:()=>{E(new Set)}})]})}),(0,b.jsxs)("div",{className:"max-w-4xl mx-auto p-8 print:p-0",children:[K.map((a,c)=>(0,b.jsx)(p,{item:a,index:c,options:B,reserveAnswerSpace:L,customAnswerSpacePx:F[a.id],onCustomAnswerSpaceChange:b=>G(a.id,b)},a.id)),N&&(0,b.jsx)("div",{className:"text-center py-12 text-muted-foreground",children:"noSelection"===N?w.printPreview?.noSelection||"No items selected":w.printPreview?.noItems||"No matching error items"})]})]})}a.s(["default",0,function(){let{t:a}=(0,g.b)();return(0,b.jsx)(c.Suspense,{fallback:(0,b.jsx)("div",{className:"min-h-screen flex items-center justify-center",children:a.common.loading}),children:(0,b.jsx)(w,{})})}],771706)}];
1
+ module.exports=[771706,a=>{"use strict";var b=a.i(187924),c=a.i(572131),d=a.i(50944),e=a.i(699570),f=a.i(695001),g=a.i(589027),h=a.i(113608),i=a.i(233540),j=a.i(866718),k=a.i(550194);function l(a){if(a.tags&&a.tags.length>0)return a.tags.map(a=>a.name);try{let b=JSON.parse(a.knowledgePoints||"[]");return Array.isArray(b)?b.filter(a=>"string"==typeof a):[]}catch{return[]}}async function m(a){let b=[];for(let c=1;;c+=1){let d=await a(c);if(b.push(...d.items),0===d.items.length||c>=d.totalPages)return b}}function n({items:a,selectedIds:d,selectedCount:f,printNumbers:m,onToggle:o,onSelectionChange:p}){let{t:q}=(0,k.b)(),[r,s]=(0,c.useState)(a.length<=20),[t,u]=(0,c.useState)(""),v=(0,c.useMemo)(()=>a.filter(a=>{let b;return!(b=t.trim().toLowerCase())||[a.questionText??"",a.shortId??"",...l(a)].some(a=>a.toLowerCase().includes(b))}),[a,t]),w=t.trim().length>0,x=a=>p(function(a,b,c){let d=new Set(a);for(let e of b)"select"!==c&&("invert"!==c||a.has(e))?d.delete(e):d.add(e);return d}(d,v.map(a=>a.id),a));return(0,b.jsxs)("div",{className:"rounded-md border bg-muted/20 p-3 space-y-2",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,b.jsxs)("button",{type:"button",className:"flex items-center gap-1 text-sm font-medium hover:text-primary","aria-expanded":r,onClick:()=>s(a=>!a),children:[r?(0,b.jsx)(h.f,{className:"h-4 w-4"}):(0,b.jsx)(g.f,{className:"h-4 w-4"}),q.printPreview.selectItems," (",f,"/",a.length,")"]}),(0,b.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,b.jsx)(e.f,{variant:"outline",size:"sm",onClick:()=>x("select"),children:w?q.printPreview.selectFiltered:q.printPreview.selectAll}),(0,b.jsx)(e.f,{variant:"outline",size:"sm",onClick:()=>x("clear"),children:w?q.printPreview.clearFiltered:q.printPreview.clearSelection}),(0,b.jsx)(e.f,{variant:"outline",size:"sm",onClick:()=>x("invert"),children:q.printPreview.invertSelection})]})]}),r&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"relative",children:[(0,b.jsx)(i.f,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),(0,b.jsx)(j.f,{type:"search",value:t,onChange:a=>u(a.target.value),placeholder:q.printPreview.searchPlaceholder,"aria-label":q.printPreview.searchPlaceholder,className:"h-8 pl-8 text-sm"})]}),(0,b.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-3 max-h-[40vh] overflow-y-auto pr-1",children:[v.map(a=>{let c=m.get(a.id);return(0,b.jsxs)("label",{className:"flex items-start gap-2 rounded border bg-background p-2 text-xs cursor-pointer hover:border-primary/50",children:[(0,b.jsx)("input",{type:"checkbox",checked:d.has(a.id),onChange:()=>o(a.id),className:"mt-0.5 rounded border-gray-300 text-primary focus:ring-primary"}),(0,b.jsxs)("span",{className:"line-clamp-2",children:[void 0!==c&&(0,b.jsxs)("span",{className:"font-semibold",children:[q.printPreview.questionNumber.replace("{num}",String(c)),q.common.colon]}),a.shortId&&(0,b.jsxs)("span",{className:"font-mono text-muted-foreground",children:[a.shortId," "]}),a.questionText]})]},a.id)}),0===v.length&&(0,b.jsx)("p",{className:"col-span-full py-2 text-center text-xs text-muted-foreground",children:q.printPreview.noSearchResult})]})]})]})}var o=a.i(249632);function p({checked:a,onChange:c,label:d}){return(0,b.jsxs)("label",{className:"flex items-center gap-1.5 text-xs sm:text-sm cursor-pointer whitespace-nowrap hover:text-primary transition-colors",children:[(0,b.jsx)("input",{type:"checkbox",checked:a,onChange:a=>c(a.target.checked),className:"rounded border-gray-300 text-primary focus:ring-primary w-3.5 h-3.5 sm:w-4 sm:h-4"}),d]})}function q({options:a,onChange:c,hasCustomSpaces:d,onResetCustomSpaces:f}){let{t:g}=(0,k.b)(),h=a.answerSpace??"auto";return(0,b.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-2 sm:gap-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 text-sm bg-muted/50 px-2 sm:px-3 py-1 rounded-md",children:[(0,b.jsxs)("span",{className:"whitespace-nowrap text-xs sm:text-sm",children:[g.printPreview?.imageScale||"Image Scale",": ",a.imageScale,"%"]}),(0,b.jsx)("input",{type:"range",min:"30",max:"100",value:a.imageScale,onChange:a=>c({imageScale:Number(a.target.value)}),className:"w-16 sm:w-20 accent-primary"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 text-xs sm:text-sm bg-muted/50 px-2 sm:px-3 py-1 rounded-md",children:[(0,b.jsxs)("label",{htmlFor:"print-preview-answer-space",className:"whitespace-nowrap",children:[g.exam.answerSpace,":"]}),(0,b.jsxs)("select",{id:"print-preview-answer-space",value:h,onChange:a=>{(0,o.I)(a.target.value)&&c({answerSpace:a.target.value})},className:"bg-background border rounded px-2 py-0.5 text-xs sm:text-sm",children:[(0,b.jsx)("option",{value:"auto",children:g.exam.answerSpaceAuto}),(0,b.jsx)("option",{value:"none",children:g.exam.answerSpaceNone}),(0,b.jsx)("option",{value:"small",children:g.exam.answerSpaceSmall}),(0,b.jsx)("option",{value:"medium",children:g.exam.answerSpaceMedium}),(0,b.jsx)("option",{value:"large",children:g.exam.answerSpaceLarge})]}),d&&f&&(0,b.jsx)(e.f,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:f,children:g.exam.resetAllQuestionAnswerSpaces})]}),(0,b.jsxs)("div",{className:"flex flex-wrap gap-x-3 gap-y-1 sm:gap-4",children:[(0,b.jsx)(p,{checked:a.showQuestionText,onChange:a=>c({showQuestionText:a}),label:g.printPreview?.showQuestionText||"Question Text"}),(0,b.jsx)(p,{checked:a.showAnswers,onChange:a=>c({showAnswers:a}),label:g.printPreview?.showAnswers||"Show Answers"}),(0,b.jsx)(p,{checked:a.showAnalysis,onChange:a=>c({showAnalysis:a}),label:g.printPreview?.showAnalysis||"Show Analysis"}),(0,b.jsx)(p,{checked:a.showTags,onChange:a=>c({showTags:a}),label:g.printPreview?.showTags||"Show Tags"})]})]})}var r=a.i(474215),s=a.i(93907),t=a.i(897555),u=a.i(418943);let v=(0,c.memo)(function({item:a,index:c,options:d,reserveAnswerSpace:e,customAnswerSpacePx:f,onCustomAnswerSpaceChange:g,paperGroupName:h,onRemove:i}){let{t:j}=(0,k.b)(),m=l(a),n=e?(0,o.z)(d.answerSpace??"auto",a.questionText||"",f):0;return(0,b.jsxs)("div",{className:`mb-4 border-b last:border-b-0 print:break-inside-avoid [content-visibility:auto] [contain-intrinsic-size:auto_480px] print:[content-visibility:visible] ${e?"pb-4":"pb-6"}`,children:[(0,b.jsxs)("div",{className:"mb-4 flex flex-wrap items-center gap-x-4 gap-y-2 leading-7",children:[(0,b.jsx)("span",{className:"text-lg font-bold",children:j.printPreview?.questionNumber?.replace("{num}",String(c+1))||`Question ${c+1}`}),a.shortId&&(0,b.jsx)("span",{className:"font-mono text-sm text-muted-foreground whitespace-nowrap",children:j.printPreview.source.replace("{id}",a.shortId)}),a.subject&&(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:a.subject.name}),a.gradeSemester&&(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:a.gradeSemester}),h&&(0,b.jsxs)("span",{className:"text-sm text-muted-foreground",children:[j.printPreview?.paperLevel||"Paper Level",": ",h]}),d.showTags&&m.length>0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("span",{className:"font-semibold",children:[j.printPreview?.knowledgePoints||"Knowledge Points",":"]}),m.map((a,c)=>(0,b.jsx)("span",{className:"px-2 py-1 bg-muted rounded text-sm",children:a},`${a}-${c}`))]}),i&&(0,b.jsxs)("button",{type:"button",className:"print:hidden ml-auto flex items-center gap-1 rounded px-2 py-1 text-xs text-muted-foreground hover:bg-muted hover:text-destructive",onClick:()=>i(a.id),children:[(0,b.jsx)(r.X,{className:"h-3.5 w-3.5"}),j.printPreview.removeFromPrint]})]}),d.showQuestionText&&a.questionText?(0,b.jsxs)("div",{className:"mb-4",children:[(0,b.jsx)(s.f,{content:a.questionText}),(0,b.jsx)(u.f,{svg:a.figureSvg,scale:a.figureScale,align:a.figureAlign})]}):a.originalImageUrl&&(0,b.jsx)("div",{className:"mb-4",children:(0,b.jsx)("img",{src:a.originalImageUrl,alt:j.detail?.originalProblem||"Question Image",loading:"lazy",decoding:"async",className:"h-auto border rounded",style:{maxWidth:`${d.imageScale}%`}})}),d.showAnswers&&a.answerText&&(0,b.jsxs)("div",{className:"mb-4",children:[(0,b.jsxs)("h3",{className:"font-semibold mb-2",children:[j.printPreview?.referenceAnswer||"Reference Answer",":"]}),(0,b.jsx)(s.f,{content:a.answerText})]}),d.showAnalysis&&a.analysis&&(0,b.jsxs)("div",{className:"mb-4",children:[(0,b.jsxs)("h3",{className:"font-semibold mb-2",children:[j.printPreview?.analysis||"Analysis",":"]}),(0,b.jsx)(s.f,{content:a.analysis})]}),e&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"print-answer-space",style:{minHeight:`${n}px`}}),g&&(0,b.jsx)(t.f,{effectivePx:n,isCustom:"number"==typeof f,onChange:b=>g(a.id,b),onReset:()=>g(a.id,null)})]})]})});var w=a.i(291938),x=a.i(557999),y=a.i(103006),z=a.i(697902),A=a.i(630534);async function B(a,{timeoutMs:b=3e4,onProgress:c}={}){let d,e=Array.from(a.querySelectorAll("img")),f=0;c?.(f,e.length);let g=Promise.all(e.map(async a=>{a.loading="eager",await (a.complete?Promise.resolve():new Promise(b=>{a.addEventListener("load",()=>b(),{once:!0}),a.addEventListener("error",()=>b(),{once:!0})})),f+=1,c?.(f,e.length)})),h=new Promise(a=>{d=setTimeout(a,b)});await Promise.race([g,h]),clearTimeout(d)}let C="print-preview-options",D={showQuestionText:!1,showAnswers:!1,showAnalysis:!1,showTags:!1,imageScale:70,answerSpace:"auto"},E=["showQuestionText","showAnswers","showAnalysis","showTags"];var F=a.i(515108);async function G(a){for(let b of function(a,b){let c=[];for(let d=0;d<a.length;d+=b)c.push(a.slice(d,d+b));return c}(a,z.A))await w.k.put("/api/error-items/answer-space",{items:b})}function H(){var a,g,h,i,j,l;let p=(0,d.useSearchParams)(),{t:r}=(0,k.b)(),[s,t]=(0,c.useState)([]);(0,x.f)(r.printPreview.title);let[u,H]=(0,c.useState)(!0),[I,J]=(0,c.useState)(D);(0,c.useEffect)(()=>{J(function(){try{return function(a){let b,c={...D};if(!a)return c;try{b=JSON.parse(a)}catch{return c}if(!b||"object"!=typeof b)return c;let d=b;for(let a of E)"boolean"==typeof d[a]&&(c[a]=d[a]);return"number"==typeof d.imageScale&&Number.isFinite(d.imageScale)&&(c.imageScale=Math.min(100,Math.max(30,Math.round(d.imageScale)))),(0,o.I)(d.answerSpace)&&(c.answerSpace=d.answerSpace),c}(localStorage.getItem(C))}catch{return{...D}}}())},[]);let[K,L]=(0,c.useState)(new Set),{customSpaces:M,setSpace:N,resetAll:O,saveFailed:P}=(0,y.f)(s,G),Q=(0,c.useCallback)(async()=>{try{let a=await m(a=>{let b=new URLSearchParams(p.toString());return b.set("page",String(a)),b.set("pageSize",String(z.A)),b.set("view","print"),w.k.get(`/api/error-items/list?${b.toString()}`)});t(a),L(new Set(a.map(a=>a.id)))}catch(a){A.V.error("[PrintPreview]","Failed to fetch items",{error:a})}finally{H(!1)}},[p]);(0,c.useEffect)(()=>{Q()},[Q]);let R=(0,c.useRef)(null),[S,T]=(0,c.useState)(null),U=async()=>{R.current&&await B(R.current,{onProgress:(a,b)=>T({loaded:a,total:b})}),T(null),window.print()},{groups:V}=(0,F.f)(),W=(0,c.useMemo)(()=>new Map(V.map(a=>[a.id,a.name])),[V]),X=(0,c.useMemo)(()=>s.filter(a=>K.has(a.id)),[s,K]),Y=(0,c.useMemo)(()=>new Map(X.map((a,b)=>[a.id,b+1])),[X]),Z=(a=I.showAnswers,g=I.showAnalysis,!a&&!g),$=(h=s.length,(i=X.length)===h?String(h):`${i}/${h}`),_=(j=s.length,l=X.length,0===j?"noItems":0===l?"noSelection":null),aa=(0,c.useCallback)(a=>{L(b=>{let c=new Set(b);return c.has(a)?c.delete(a):c.add(a),c})},[]),ab=(0,c.useCallback)(a=>{L(b=>{let c=new Set(b);return c.delete(a),c})},[]);return u?(0,b.jsx)("div",{className:"min-h-screen flex items-center justify-center",children:(0,b.jsx)("p",{className:"text-muted-foreground",children:r.common.loading})}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"print:hidden sticky top-0 z-10 bg-background border-b p-3 sm:p-4 shadow-sm",children:(0,b.jsxs)("div",{className:"max-w-6xl mx-auto space-y-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)(f.f,{fallbackUrl:"/notebooks"}),(0,b.jsxs)("h1",{className:"text-lg sm:text-xl font-bold flex-1",children:[r.printPreview?.title||"Print Preview"," (",$," ",r.notebooks?.items||"items",")"]}),(0,b.jsx)(e.f,{onClick:U,size:"sm",className:"whitespace-nowrap",disabled:0===X.length||null!==S,children:S?r.printPreview.loadingImages.replace("{loaded}",String(S.loaded)).replace("{total}",String(S.total)):r.printPreview?.printButton||"Print / Save PDF"})]}),(0,b.jsx)(q,{options:I,onChange:a=>J(b=>{let c={...b,...a};try{localStorage.setItem(C,JSON.stringify(c))}catch{}return c}),hasCustomSpaces:Object.keys(M).length>0,onResetCustomSpaces:O}),P&&(0,b.jsx)("p",{className:"text-xs text-destructive",children:r.exam.answerSpaceSaveFailed})]})}),(0,b.jsx)("div",{className:"print:hidden border-b p-3 sm:p-4",children:(0,b.jsx)("div",{className:"max-w-6xl mx-auto",children:(0,b.jsx)(n,{items:s,selectedIds:K,selectedCount:X.length,printNumbers:Y,onToggle:aa,onSelectionChange:L})})}),(0,b.jsxs)("div",{ref:R,className:"max-w-4xl mx-auto p-8 print:p-0",children:[X.map((a,c)=>(0,b.jsx)(v,{item:a,index:c,options:I,reserveAnswerSpace:Z,customAnswerSpacePx:M[a.id],onCustomAnswerSpaceChange:N,paperGroupName:a.paperLevel?W.get(a.paperLevel)??a.paperLevel:null,onRemove:ab},a.id)),_&&(0,b.jsx)("div",{className:"text-center py-12 text-muted-foreground",children:"noSelection"===_?r.printPreview?.noSelection||"No items selected":r.printPreview?.noItems||"No matching error items"})]})]})}a.s(["default",0,function(){let{t:a}=(0,k.b)();return(0,b.jsx)(c.Suspense,{fallback:(0,b.jsx)("div",{className:"min-h-screen flex items-center justify-center",children:a.common.loading}),children:(0,b.jsx)(H,{})})}],771706)}];
2
2
 
3
3
  //# sourceMappingURL=src_app_print-preview_page_tsx_001yt-fzrj7tf._.js.map