wrong-notebook 2026.11.3 → 2026.11.4-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (426) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +3 -0
  3. package/.next/build-manifest.json +3 -3
  4. package/.next/routes-manifest.json +18 -0
  5. package/.next/server/app/_global-error.html +1 -1
  6. package/.next/server/app/_global-error.rsc +1 -1
  7. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  10. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  11. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  12. package/.next/server/app/admin/page.js.nft.json +1 -1
  13. package/.next/server/app/admin/page_client-reference-manifest.js +1 -1
  14. package/.next/server/app/admin/user/[id]/page.js.nft.json +1 -1
  15. package/.next/server/app/admin/user/[id]/page_client-reference-manifest.js +1 -1
  16. package/.next/server/app/api/admin/cnm-tags/route.js +5 -5
  17. package/.next/server/app/api/admin/cnm-tags/route.js.nft.json +1 -1
  18. package/.next/server/app/api/admin/dashboard/route.js +11 -11
  19. package/.next/server/app/api/admin/dashboard/route.js.nft.json +1 -1
  20. package/.next/server/app/api/admin/debug-logs/export/route.js +1 -1
  21. package/.next/server/app/api/admin/debug-logs/export/route.js.nft.json +1 -1
  22. package/.next/server/app/api/admin/debug-logs/route.js +4 -4
  23. package/.next/server/app/api/admin/debug-logs/route.js.nft.json +1 -1
  24. package/.next/server/app/api/admin/users/[id]/detail/route.js +11 -11
  25. package/.next/server/app/api/admin/users/[id]/detail/route.js.nft.json +1 -1
  26. package/.next/server/app/api/admin/users/route.js +1 -1
  27. package/.next/server/app/api/admin/users/route.js.nft.json +1 -1
  28. package/.next/server/app/api/ai/models/route.js +11 -11
  29. package/.next/server/app/api/ai/models/route.js.nft.json +1 -1
  30. package/.next/server/app/api/ai/test/route.js +10 -10
  31. package/.next/server/app/api/ai/test/route.js.nft.json +1 -1
  32. package/.next/server/app/api/analytics/route.js +16 -15
  33. package/.next/server/app/api/analytics/route.js.nft.json +1 -1
  34. package/.next/server/app/api/analyze/route.js +12 -12
  35. package/.next/server/app/api/analyze/route.js.nft.json +1 -1
  36. package/.next/server/app/api/error-items/[id]/figure/route.js +16 -16
  37. package/.next/server/app/api/error-items/[id]/figure/route.js.nft.json +1 -1
  38. package/.next/server/app/api/error-items/[id]/fix-latex/route.js +15 -15
  39. package/.next/server/app/api/error-items/[id]/fix-latex/route.js.nft.json +1 -1
  40. package/.next/server/app/api/error-items/[id]/geogebra/route.js +11 -11
  41. package/.next/server/app/api/error-items/[id]/geogebra/route.js.nft.json +1 -1
  42. package/.next/server/app/api/error-items/[id]/image/route.js +4 -4
  43. package/.next/server/app/api/error-items/[id]/image/route.js.nft.json +1 -1
  44. package/.next/server/app/api/error-items/[id]/reanswer/route.js +16 -16
  45. package/.next/server/app/api/error-items/[id]/reanswer/route.js.nft.json +1 -1
  46. package/.next/server/app/api/error-items/[id]/retag/route.js +13 -12
  47. package/.next/server/app/api/error-items/[id]/retag/route.js.nft.json +1 -1
  48. package/.next/server/app/api/error-items/[id]/route.js +1 -1
  49. package/.next/server/app/api/error-items/[id]/route.js.nft.json +1 -1
  50. package/.next/server/app/api/error-items/[id]/svg-animation/narration/route.js +16 -16
  51. package/.next/server/app/api/error-items/[id]/svg-animation/narration/route.js.nft.json +1 -1
  52. package/.next/server/app/api/error-items/[id]/svg-animation/route.js +16 -16
  53. package/.next/server/app/api/error-items/[id]/svg-animation/route.js.nft.json +1 -1
  54. package/.next/server/app/api/error-items/answer-space/route.js +4 -4
  55. package/.next/server/app/api/error-items/answer-space/route.js.nft.json +1 -1
  56. package/.next/server/app/api/error-items/list/route.js +1 -1
  57. package/.next/server/app/api/error-items/list/route.js.nft.json +1 -1
  58. package/.next/server/app/api/error-items/route.js +19 -18
  59. package/.next/server/app/api/error-items/route.js.nft.json +1 -1
  60. package/.next/server/app/api/error-items/similarity/route.js +4 -4
  61. package/.next/server/app/api/error-items/similarity/route.js.nft.json +1 -1
  62. package/.next/server/app/api/exams/[id]/questions/[questionId]/regenerate/route.js +16 -16
  63. package/.next/server/app/api/exams/[id]/questions/[questionId]/regenerate/route.js.nft.json +1 -1
  64. package/.next/server/app/api/exams/[id]/results/route.js +15 -14
  65. package/.next/server/app/api/exams/[id]/results/route.js.nft.json +1 -1
  66. package/.next/server/app/api/exams/[id]/retry/route.js +15 -14
  67. package/.next/server/app/api/exams/[id]/retry/route.js.nft.json +1 -1
  68. package/.next/server/app/api/exams/[id]/route.js +15 -15
  69. package/.next/server/app/api/exams/[id]/route.js.nft.json +1 -1
  70. package/.next/server/app/api/exams/route.js +17 -16
  71. package/.next/server/app/api/exams/route.js.nft.json +1 -1
  72. package/.next/server/app/api/export/route.js +1 -1
  73. package/.next/server/app/api/export/route.js.nft.json +1 -1
  74. package/.next/server/app/api/geogebra-analyze/route.js +13 -13
  75. package/.next/server/app/api/geogebra-analyze/route.js.nft.json +1 -1
  76. package/.next/server/app/api/import/route.js +15 -15
  77. package/.next/server/app/api/import/route.js.nft.json +1 -1
  78. package/.next/server/app/api/import-batches/[id]/confirm-all/route.js +21 -21
  79. package/.next/server/app/api/import-batches/[id]/confirm-all/route.js.nft.json +1 -1
  80. package/.next/server/app/api/import-batches/[id]/fix-text/route.js +15 -14
  81. package/.next/server/app/api/import-batches/[id]/fix-text/route.js.nft.json +1 -1
  82. package/.next/server/app/api/import-batches/[id]/read/route.js +21 -21
  83. package/.next/server/app/api/import-batches/[id]/read/route.js.nft.json +1 -1
  84. package/.next/server/app/api/import-batches/[id]/retry/route.js +21 -21
  85. package/.next/server/app/api/import-batches/[id]/retry/route.js.nft.json +1 -1
  86. package/.next/server/app/api/import-batches/[id]/route.js +21 -21
  87. package/.next/server/app/api/import-batches/[id]/route.js.nft.json +1 -1
  88. package/.next/server/app/api/import-batches/[id]/start/route.js +21 -21
  89. package/.next/server/app/api/import-batches/[id]/start/route.js.nft.json +1 -1
  90. package/.next/server/app/api/import-batches/route.js +21 -21
  91. package/.next/server/app/api/import-batches/route.js.nft.json +1 -1
  92. package/.next/server/app/api/import-tasks/[id]/confirm/route.js +17 -17
  93. package/.next/server/app/api/import-tasks/[id]/confirm/route.js.nft.json +1 -1
  94. package/.next/server/app/api/import-tasks/[id]/read/route.js +17 -17
  95. package/.next/server/app/api/import-tasks/[id]/read/route.js.nft.json +1 -1
  96. package/.next/server/app/api/import-tasks/[id]/retry/route.js +17 -17
  97. package/.next/server/app/api/import-tasks/[id]/retry/route.js.nft.json +1 -1
  98. package/.next/server/app/api/import-tasks/[id]/route.js +17 -17
  99. package/.next/server/app/api/import-tasks/[id]/route.js.nft.json +1 -1
  100. package/.next/server/app/api/import-tasks/route.js +21 -21
  101. package/.next/server/app/api/import-tasks/route.js.nft.json +1 -1
  102. package/.next/server/app/api/initialize/route.js +3 -3
  103. package/.next/server/app/api/initialize/route.js.nft.json +1 -1
  104. package/.next/server/app/api/minimax-code/checkin/route.js +1 -1
  105. package/.next/server/app/api/minimax-code/checkin/route.js.nft.json +1 -1
  106. package/.next/server/app/api/minimax-code/route.js +1 -1
  107. package/.next/server/app/api/minimax-code/route.js.nft.json +1 -1
  108. package/.next/server/app/api/notebooks/[id]/retag/route.js +15 -14
  109. package/.next/server/app/api/notebooks/[id]/retag/route.js.nft.json +1 -1
  110. package/.next/server/app/api/notebooks/route.js +1 -1
  111. package/.next/server/app/api/notebooks/route.js.nft.json +1 -1
  112. package/.next/server/app/api/openclaw/batch-upload/route.js +14 -14
  113. package/.next/server/app/api/openclaw/batch-upload/route.js.nft.json +1 -1
  114. package/.next/server/app/api/paper-groups/[id]/route.js +4 -4
  115. package/.next/server/app/api/paper-groups/[id]/route.js.nft.json +1 -1
  116. package/.next/server/app/api/paper-groups/route.js +5 -5
  117. package/.next/server/app/api/paper-groups/route.js.nft.json +1 -1
  118. package/.next/server/app/api/practice/generate/route.js +13 -13
  119. package/.next/server/app/api/practice/generate/route.js.nft.json +1 -1
  120. package/.next/server/app/api/practice/grade/route.js +12 -12
  121. package/.next/server/app/api/practice/grade/route.js.nft.json +1 -1
  122. package/.next/server/app/api/practice/record/[id]/route.js +11 -11
  123. package/.next/server/app/api/practice/record/[id]/route.js.nft.json +1 -1
  124. package/.next/server/app/api/practice/record/route.js +14 -14
  125. package/.next/server/app/api/practice/record/route.js.nft.json +1 -1
  126. package/.next/server/app/api/reanswer/route.js +15 -15
  127. package/.next/server/app/api/reanswer/route.js.nft.json +1 -1
  128. package/.next/server/app/api/register/route.js +5 -5
  129. package/.next/server/app/api/register/route.js.nft.json +1 -1
  130. package/.next/server/app/api/register/status/route.js +5 -5
  131. package/.next/server/app/api/register/status/route.js.nft.json +1 -1
  132. package/.next/server/app/api/review/due/route.js +11 -11
  133. package/.next/server/app/api/review/due/route.js.nft.json +1 -1
  134. package/.next/server/app/api/settings/route.js +5 -5
  135. package/.next/server/app/api/settings/route.js.nft.json +1 -1
  136. package/.next/server/app/api/setup/route.js +1 -1
  137. package/.next/server/app/api/setup/route.js.nft.json +1 -1
  138. package/.next/server/app/api/stats/activity/route/app-paths-manifest.json +3 -0
  139. package/.next/server/app/api/stats/activity/route/build-manifest.json +12 -0
  140. package/.next/server/app/api/stats/activity/route/server-reference-manifest.json +4 -0
  141. package/.next/server/app/api/stats/activity/route.js +14 -0
  142. package/.next/server/app/api/stats/activity/route.js.map +5 -0
  143. package/.next/server/app/api/stats/activity/route.js.nft.json +1 -0
  144. package/.next/server/app/api/stats/activity/route_client-reference-manifest.js +3 -0
  145. package/.next/server/app/api/stats/practice/route.js +6 -5
  146. package/.next/server/app/api/stats/practice/route.js.nft.json +1 -1
  147. package/.next/server/app/api/stats/repeated-mistakes/route/app-paths-manifest.json +3 -0
  148. package/.next/server/app/api/stats/repeated-mistakes/route/build-manifest.json +12 -0
  149. package/.next/server/app/api/stats/repeated-mistakes/route/server-reference-manifest.json +4 -0
  150. package/.next/server/app/api/stats/repeated-mistakes/route.js +26 -0
  151. package/.next/server/app/api/stats/repeated-mistakes/route.js.map +5 -0
  152. package/.next/server/app/api/stats/repeated-mistakes/route.js.nft.json +1 -0
  153. package/.next/server/app/api/stats/repeated-mistakes/route_client-reference-manifest.js +3 -0
  154. package/.next/server/app/api/stats/weak-tags/route/app-paths-manifest.json +3 -0
  155. package/.next/server/app/api/stats/weak-tags/route/build-manifest.json +12 -0
  156. package/.next/server/app/api/stats/weak-tags/route/server-reference-manifest.json +4 -0
  157. package/.next/server/app/api/stats/weak-tags/route.js +26 -0
  158. package/.next/server/app/api/stats/weak-tags/route.js.map +5 -0
  159. package/.next/server/app/api/stats/weak-tags/route.js.nft.json +1 -0
  160. package/.next/server/app/api/stats/weak-tags/route_client-reference-manifest.js +3 -0
  161. package/.next/server/app/api/tags/route.js.nft.json +1 -1
  162. package/.next/server/app/api/tags/stats/route.js.nft.json +1 -1
  163. package/.next/server/app/api/tasks/route.js.nft.json +1 -1
  164. package/.next/server/app/api/tts/[id]/route.js +1 -1
  165. package/.next/server/app/api/tts/[id]/route.js.nft.json +1 -1
  166. package/.next/server/app/api/tts/batch/route.js +9 -9
  167. package/.next/server/app/api/tts/batch/route.js.nft.json +1 -1
  168. package/.next/server/app/api/tts/route.js +7 -7
  169. package/.next/server/app/api/tts/route.js.nft.json +1 -1
  170. package/.next/server/app/api/tts/status/route.js +8 -8
  171. package/.next/server/app/api/tts/status/route.js.nft.json +1 -1
  172. package/.next/server/app/api/user/route.js +14 -13
  173. package/.next/server/app/api/user/route.js.nft.json +1 -1
  174. package/.next/server/app/error-items/[id]/page.js.nft.json +1 -1
  175. package/.next/server/app/error-items/[id]/page_client-reference-manifest.js +1 -1
  176. package/.next/server/app/exams/[id]/page.js.nft.json +1 -1
  177. package/.next/server/app/exams/[id]/page_client-reference-manifest.js +1 -1
  178. package/.next/server/app/exams/[id]/print/page.js.nft.json +1 -1
  179. package/.next/server/app/exams/[id]/print/page_client-reference-manifest.js +1 -1
  180. package/.next/server/app/exams/page.js.nft.json +1 -1
  181. package/.next/server/app/exams/page_client-reference-manifest.js +1 -1
  182. package/.next/server/app/import-batches/[id]/page.js.nft.json +1 -1
  183. package/.next/server/app/import-batches/[id]/page_client-reference-manifest.js +1 -1
  184. package/.next/server/app/import-tasks/[id]/page.js.nft.json +1 -1
  185. package/.next/server/app/import-tasks/[id]/page_client-reference-manifest.js +1 -1
  186. package/.next/server/app/import-tasks/page.js.nft.json +1 -1
  187. package/.next/server/app/import-tasks/page_client-reference-manifest.js +1 -1
  188. package/.next/server/app/initialize/page.js.nft.json +1 -1
  189. package/.next/server/app/initialize/page_client-reference-manifest.js +1 -1
  190. package/.next/server/app/login/page.js.nft.json +1 -1
  191. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  192. package/.next/server/app/notebooks/[id]/add/page.js.nft.json +1 -1
  193. package/.next/server/app/notebooks/[id]/add/page_client-reference-manifest.js +1 -1
  194. package/.next/server/app/notebooks/[id]/page.js.nft.json +1 -1
  195. package/.next/server/app/notebooks/[id]/page_client-reference-manifest.js +1 -1
  196. package/.next/server/app/notebooks/page.js.nft.json +1 -1
  197. package/.next/server/app/notebooks/page_client-reference-manifest.js +1 -1
  198. package/.next/server/app/page.js.nft.json +1 -1
  199. package/.next/server/app/page_client-reference-manifest.js +1 -1
  200. package/.next/server/app/practice/page.js.nft.json +1 -1
  201. package/.next/server/app/practice/page_client-reference-manifest.js +1 -1
  202. package/.next/server/app/print-preview/page.js.nft.json +1 -1
  203. package/.next/server/app/print-preview/page_client-reference-manifest.js +1 -1
  204. package/.next/server/app/register/page.js.nft.json +1 -1
  205. package/.next/server/app/register/page_client-reference-manifest.js +1 -1
  206. package/.next/server/app/review/page.js.nft.json +1 -1
  207. package/.next/server/app/review/page_client-reference-manifest.js +1 -1
  208. package/.next/server/app/setup/page.js.nft.json +1 -1
  209. package/.next/server/app/setup/page_client-reference-manifest.js +1 -1
  210. package/.next/server/app/stats/page.js.nft.json +1 -1
  211. package/.next/server/app/stats/page_client-reference-manifest.js +1 -1
  212. package/.next/server/app/tags/page.js.nft.json +1 -1
  213. package/.next/server/app/tags/page_client-reference-manifest.js +1 -1
  214. package/.next/server/app-paths-manifest.json +3 -0
  215. package/.next/server/chunks/1oeh_server_app_api_stats_repeated-mistakes_route_actions_06q2817k49p9f.js +3 -0
  216. package/.next/server/chunks/{[root-of-the-server]__0ddvoqy3a719u._.js → [root-of-the-server]__006u92h_madgn._.js} +1 -1
  217. package/.next/server/chunks/[root-of-the-server]__012pau7crikop._.js +3 -0
  218. package/.next/server/chunks/[root-of-the-server]__01jc87mm42cex._.js +3 -0
  219. package/.next/server/chunks/[root-of-the-server]__01newhoirvvb2._.js +3 -0
  220. package/.next/server/chunks/[root-of-the-server]__057qz9ucs7lib._.js +3 -0
  221. package/.next/server/chunks/[root-of-the-server]__06_pvs6rg70ri._.js +3 -0
  222. package/.next/server/chunks/{[root-of-the-server]__0opuw_bsktcnc._.js → [root-of-the-server]__09pkxauucdf_0._.js} +2 -2
  223. package/.next/server/chunks/[root-of-the-server]__0_vinl1oembls._.js +3 -0
  224. package/.next/server/chunks/{[root-of-the-server]__12u4jc5x2ss9k._.js → [root-of-the-server]__0ahni9caaouya._.js} +2 -2
  225. package/.next/server/chunks/[root-of-the-server]__0aq01totjzgkp._.js +3 -0
  226. package/.next/server/chunks/[root-of-the-server]__0b_zf20owrv7l._.js +3 -0
  227. package/.next/server/chunks/[root-of-the-server]__0cel4yig3zcho._.js +3 -0
  228. package/.next/server/chunks/[root-of-the-server]__0fg20m1i6x4y9._.js +3 -0
  229. package/.next/server/chunks/[root-of-the-server]__0fhy87hr0_glw._.js +3 -0
  230. package/.next/server/chunks/{[root-of-the-server]__0ijmyxflggama._.js → [root-of-the-server]__0geynfn2xmdle._.js} +2 -2
  231. package/.next/server/chunks/[root-of-the-server]__0glupa52ge074._.js +3 -0
  232. package/.next/server/chunks/[root-of-the-server]__0imuc7gi1ii-e._.js +3 -0
  233. package/.next/server/chunks/[root-of-the-server]__0jk-9m6ra-_um._.js +3 -0
  234. package/.next/server/chunks/[root-of-the-server]__0jvusk64khb-a._.js +3 -0
  235. package/.next/server/chunks/{[root-of-the-server]__0a5qx2roo_50n._.js → [root-of-the-server]__0k4cyyyh6z6_p._.js} +2 -2
  236. package/.next/server/chunks/[root-of-the-server]__0lqv0n5j2fg24._.js +3 -0
  237. package/.next/server/chunks/[root-of-the-server]__0n5l60oyv1n-1._.js +3 -0
  238. package/.next/server/chunks/[root-of-the-server]__0nkrql6or-tf_._.js +3 -0
  239. package/.next/server/chunks/[root-of-the-server]__0ovdiut1h8kkt._.js +3 -0
  240. package/.next/server/chunks/[root-of-the-server]__0p8wlug4uvmvi._.js +3 -0
  241. package/.next/server/chunks/[root-of-the-server]__0r7f34_38kmvk._.js +3 -0
  242. package/.next/server/chunks/[root-of-the-server]__0ualui9b50ufh._.js +3 -0
  243. package/.next/server/chunks/[root-of-the-server]__0ujfft7untkmq._.js +3 -0
  244. package/.next/server/chunks/[root-of-the-server]__0vw7u-y__gk7p._.js +3 -0
  245. package/.next/server/chunks/[root-of-the-server]__0xj_313186tqc._.js +3 -0
  246. package/.next/server/chunks/{[root-of-the-server]__1679e_8h0w86j._.js → [root-of-the-server]__0z0knsep33lsx._.js} +2 -2
  247. package/.next/server/chunks/{[root-of-the-server]__1sggr1m3ukvts._.js → [root-of-the-server]__1-djdd7tnb-n7._.js} +2 -2
  248. package/.next/server/chunks/{[root-of-the-server]__1r0s6pktkiqkf._.js → [root-of-the-server]__10gp75p89v9a2._.js} +2 -2
  249. package/.next/server/chunks/[root-of-the-server]__112w8xm57okk5._.js +3 -0
  250. package/.next/server/chunks/[root-of-the-server]__12h4ckd6f76pb._.js +3 -0
  251. package/.next/server/chunks/[root-of-the-server]__12ig6-5hpb7s-._.js +3 -0
  252. package/.next/server/chunks/[root-of-the-server]__14c50fhuh_abo._.js +3 -0
  253. package/.next/server/chunks/{[root-of-the-server]__1l-2u-q625i2a._.js → [root-of-the-server]__166997w1su5wq._.js} +2 -2
  254. package/.next/server/chunks/[root-of-the-server]__16xl11-irmhu3._.js +3 -0
  255. package/.next/server/chunks/[root-of-the-server]__19i64i9v32y8o._.js +3 -0
  256. package/.next/server/chunks/[root-of-the-server]__19jqc7tzna13p._.js +3 -0
  257. package/.next/server/chunks/[root-of-the-server]__1azaa45m60iqm._.js +3 -0
  258. package/.next/server/chunks/[root-of-the-server]__1d159cxbdta68._.js +3 -0
  259. package/.next/server/chunks/{[root-of-the-server]__1yct9oj28kq_h._.js → [root-of-the-server]__1dmp3ynxbcyjz._.js} +2 -2
  260. package/.next/server/chunks/[root-of-the-server]__1e5tjfwab0exu._.js +3 -0
  261. package/.next/server/chunks/{[root-of-the-server]__0ahnj8vp1pywj._.js → [root-of-the-server]__1eu_g0k_nr3i-._.js} +2 -2
  262. package/.next/server/chunks/[root-of-the-server]__1f-7-l2abs15s._.js +3 -0
  263. package/.next/server/chunks/[root-of-the-server]__1fepss7g57apj._.js +3 -0
  264. package/.next/server/chunks/[root-of-the-server]__1g11271g0z55n._.js +3 -0
  265. package/.next/server/chunks/[root-of-the-server]__1he8kk4382-0h._.js +3 -0
  266. package/.next/server/chunks/[root-of-the-server]__1j44_t992y-1-._.js +3 -0
  267. package/.next/server/chunks/[root-of-the-server]__1k4f33-z95_7c._.js +3 -0
  268. package/.next/server/chunks/[root-of-the-server]__1kiolpvl5u4e-._.js +3 -0
  269. package/.next/server/chunks/{[root-of-the-server]__0_fisu5brhyk_._.js → [root-of-the-server]__1kx3a0dm7l2wl._.js} +2 -2
  270. package/.next/server/chunks/[root-of-the-server]__1m_y4afrn94oy._.js +3 -0
  271. package/.next/server/chunks/[root-of-the-server]__1o9pbkx7ejxu0._.js +3 -0
  272. package/.next/server/chunks/[root-of-the-server]__1tffqae521gxo._.js +3 -0
  273. package/.next/server/chunks/[root-of-the-server]__1u5c7agj_phnb._.js +3 -0
  274. package/.next/server/chunks/[root-of-the-server]__1vg8sj020j9pp._.js +3 -0
  275. package/.next/server/chunks/[root-of-the-server]__1wfhdwfdvc6j3._.js +3 -0
  276. package/.next/server/chunks/[root-of-the-server]__1zqfz2rc4i280._.js +3 -0
  277. package/.next/server/chunks/[root-of-the-server]__212aaltyh6kc2._.js +3 -0
  278. package/.next/server/chunks/_0-ne-bwuvd_6w._.js +1 -1
  279. package/.next/server/chunks/_01y7-j4vx6cu5._.js +3 -0
  280. package/.next/server/chunks/_0edfmbz_jbxsu._.js +3 -0
  281. package/.next/server/chunks/{_0x3jdlmx-bey5._.js → _0lj59y-ytysr5._.js} +2 -2
  282. package/.next/server/chunks/_0lo1_vwfiel-b._.js +3 -0
  283. package/.next/server/chunks/_0r0hnbjdq-k9-._.js +3 -0
  284. package/.next/server/chunks/_0v762_h-sp94d._.js +3 -0
  285. package/.next/server/chunks/_0vshwghrjetxu._.js +3 -0
  286. package/.next/server/chunks/_0wegi_sv1s4wx._.js +1 -1
  287. package/.next/server/chunks/_11w6ynlxuzl55._.js +1 -1
  288. package/.next/server/chunks/_1a1oatugfke1p._.js +3 -0
  289. package/.next/server/chunks/_1fgb9ve_nfat4._.js +1 -1
  290. package/.next/server/chunks/_1fki7pamd4s-7._.js +3 -0
  291. package/.next/server/chunks/{_1ox156inx113o._.js → _1fsfy4c3rj36b._.js} +2 -2
  292. package/.next/server/chunks/_1hc_es1a3cl6a._.js +3 -0
  293. package/.next/server/chunks/_1ns6y6y2tq8sh._.js +3 -0
  294. package/.next/server/chunks/_next-internal_server_app_api_stats_activity_route_actions_1yux8iszfudpr.js +3 -0
  295. package/.next/server/chunks/_next-internal_server_app_api_stats_weak-tags_route_actions_037n-g-nwrsh6.js +3 -0
  296. package/.next/server/chunks/{node_modules_zod_v4_classic_external_0cradpuc4fjmm.js → node_modules_zod_v4_classic_external_0qoqh-q5drsgn.js} +3 -3
  297. package/.next/server/chunks/src_lib_0fedb0fkc3km1._.js +3 -0
  298. package/.next/server/chunks/src_lib_0okewfjk6p2ci._.js +3 -0
  299. package/.next/server/chunks/ssr/[root-of-the-server]__03208_liub81h._.js +3 -0
  300. package/.next/server/chunks/ssr/[root-of-the-server]__08j-3_6cl3898._.js +3 -0
  301. package/.next/server/chunks/ssr/[root-of-the-server]__0ht0nkzazbnl9._.js +3 -0
  302. package/.next/server/chunks/ssr/[root-of-the-server]__0mqo18mv_ooyq._.js +3 -0
  303. package/.next/server/chunks/ssr/[root-of-the-server]__0r18qmblwuijm._.js +3 -0
  304. package/.next/server/chunks/ssr/[root-of-the-server]__1z2o77biewl3j._.js +3 -0
  305. package/.next/server/chunks/ssr/_002crzzz_cqha._.js +3 -0
  306. package/.next/server/chunks/ssr/_01qu892bisrf0._.js +3 -0
  307. package/.next/server/chunks/ssr/_01rfvhncgnpvl._.js +3 -0
  308. package/.next/server/chunks/ssr/_0k8_zrcalckn6._.js +3 -0
  309. package/.next/server/chunks/ssr/_0rd-teluypcd2._.js +1 -1
  310. package/.next/server/chunks/ssr/_0w83jztp72o20._.js +3 -0
  311. package/.next/server/chunks/ssr/_0wculltrlnokg._.js +3 -0
  312. package/.next/server/chunks/ssr/{_0f2k-q7kimi4o._.js → _0xkk9yj75j2gl._.js} +1 -1
  313. package/.next/server/chunks/ssr/_1-5vj-nfmgwz8._.js +3 -0
  314. package/.next/server/chunks/ssr/_18dt93-y95n-0._.js +3 -0
  315. package/.next/server/chunks/ssr/_1b3pell8an7q7._.js +3 -0
  316. package/.next/server/chunks/ssr/_1gbbaroe3f8p2._.js +3 -0
  317. package/.next/server/chunks/ssr/_1sztendo5e5tf._.js +3 -0
  318. package/.next/server/chunks/ssr/_1ujx-n3muyaxs._.js +1 -1
  319. package/.next/server/chunks/ssr/_1xv0q8o3g3r5d._.js +3 -0
  320. package/.next/server/chunks/ssr/{node_modules_1-mokx4fe30es._.js → node_modules_1d2ueqm41z04k._.js} +2 -2
  321. package/.next/server/chunks/ssr/node_modules_heic-to_dist_csp_heic-to_1_wfmqq00b4vx.js +3 -0
  322. package/.next/server/chunks/ssr/{node_modules_zod_v4_classic_external_0n-w9zu3b6q41.js → node_modules_zod_v4_classic_external_0veaboc415l0m.js} +3 -3
  323. package/.next/server/chunks/ssr/src_app_import-batches_[id]_page_tsx_0mhg_vriwmkkw._.js +1 -1
  324. package/.next/server/chunks/ssr/src_app_notebooks_[id]_page_tsx_08njm-5-txm8_._.js +1 -1
  325. package/.next/server/middleware-build-manifest.js +3 -3
  326. package/.next/server/pages/500.html +1 -1
  327. package/.next/static/chunks/081x3sje_s-_s.js +1 -0
  328. package/.next/static/chunks/093fbi_f_vb46.js +1 -0
  329. package/.next/static/chunks/0_xcjg47jv3ur.js +1 -0
  330. package/.next/static/chunks/0wcwopwk4us6h.js +9 -0
  331. package/.next/static/chunks/{1ywx2_e5apnra.js → 17dk_oppf9-hv.js} +4 -4
  332. package/.next/static/chunks/1a9_ien1xt883.js +1 -0
  333. package/.next/static/chunks/21qaa-gzvurvc.js +1 -0
  334. package/.next/static/chunks/2ebh36q8lvor_.js +1 -0
  335. package/.next/static/chunks/{210o9wkszynk8.js → 2j0linvpqza7u.js} +4 -4
  336. package/.next/static/chunks/2r5aeenvfl93p.js +1 -0
  337. package/.next/static/chunks/3ayhhtp8n8w82.css +3 -0
  338. package/.next/static/chunks/3fh32b9da9l_5.js +1 -0
  339. package/.next/static/chunks/3kr4ynzxd4_6d.js +2 -0
  340. package/.next/static/chunks/{3u2qw-orhi1q3.js → 3oz37kz8n7y3b.js} +1 -1
  341. package/.next/static/chunks/3tv07cyoo_hat.js +1 -0
  342. package/.next/static/chunks/3wch6vphcivq5.js +1 -0
  343. package/package.json +1 -1
  344. package/prisma/seed.db +0 -0
  345. package/.next/server/chunks/[root-of-the-server]__0-f1ktua0hz_g._.js +0 -3
  346. package/.next/server/chunks/[root-of-the-server]__01mz72wf0po36._.js +0 -3
  347. package/.next/server/chunks/[root-of-the-server]__02ez4rqh6y7uu._.js +0 -3
  348. package/.next/server/chunks/[root-of-the-server]__02jcq4nj_tb6l._.js +0 -3
  349. package/.next/server/chunks/[root-of-the-server]__08aldp-j0e_op._.js +0 -3
  350. package/.next/server/chunks/[root-of-the-server]__08crf3zxl7fnv._.js +0 -3
  351. package/.next/server/chunks/[root-of-the-server]__094fb72-14c6v._.js +0 -3
  352. package/.next/server/chunks/[root-of-the-server]__0d31vt-7stly0._.js +0 -3
  353. package/.next/server/chunks/[root-of-the-server]__0h3er81lqy7-3._.js +0 -3
  354. package/.next/server/chunks/[root-of-the-server]__0hy5-7_ikat1_._.js +0 -3
  355. package/.next/server/chunks/[root-of-the-server]__0ik-49062qe6v._.js +0 -3
  356. package/.next/server/chunks/[root-of-the-server]__0j-1ri4yahq6t._.js +0 -3
  357. package/.next/server/chunks/[root-of-the-server]__0l30p58xnmw13._.js +0 -3
  358. package/.next/server/chunks/[root-of-the-server]__0ob0n0xzc2--7._.js +0 -3
  359. package/.next/server/chunks/[root-of-the-server]__0rwxa2doabk45._.js +0 -3
  360. package/.next/server/chunks/[root-of-the-server]__0s-etfexh0i4a._.js +0 -3
  361. package/.next/server/chunks/[root-of-the-server]__0v5o3aoha3nct._.js +0 -3
  362. package/.next/server/chunks/[root-of-the-server]__0xasoo-1cispc._.js +0 -3
  363. package/.next/server/chunks/[root-of-the-server]__121tnm6bol8ow._.js +0 -3
  364. package/.next/server/chunks/[root-of-the-server]__13ofz2qkhwdmd._.js +0 -3
  365. package/.next/server/chunks/[root-of-the-server]__13ogen7pkq8aa._.js +0 -3
  366. package/.next/server/chunks/[root-of-the-server]__18tzik6wyd5b2._.js +0 -3
  367. package/.next/server/chunks/[root-of-the-server]__196oikyiyhn_9._.js +0 -3
  368. package/.next/server/chunks/[root-of-the-server]__19qwvtmhzhh9_._.js +0 -3
  369. package/.next/server/chunks/[root-of-the-server]__19wv3dxe-dx43._.js +0 -3
  370. package/.next/server/chunks/[root-of-the-server]__1azlmjwymm3nj._.js +0 -3
  371. package/.next/server/chunks/[root-of-the-server]__1c5_00hz3u1z7._.js +0 -3
  372. package/.next/server/chunks/[root-of-the-server]__1dtpezu7cisnu._.js +0 -3
  373. package/.next/server/chunks/[root-of-the-server]__1eli1ues3akzx._.js +0 -3
  374. package/.next/server/chunks/[root-of-the-server]__1h545soby66hi._.js +0 -3
  375. package/.next/server/chunks/[root-of-the-server]__1ixotu0p11op8._.js +0 -3
  376. package/.next/server/chunks/[root-of-the-server]__1j0l1jz1c3mpt._.js +0 -3
  377. package/.next/server/chunks/[root-of-the-server]__1ll7fod21jjr6._.js +0 -3
  378. package/.next/server/chunks/[root-of-the-server]__1nv28fsr0vd5p._.js +0 -3
  379. package/.next/server/chunks/[root-of-the-server]__1o_zqaie6w0vc._.js +0 -3
  380. package/.next/server/chunks/[root-of-the-server]__1q-7krekgvk1w._.js +0 -3
  381. package/.next/server/chunks/[root-of-the-server]__1qzd0dm9ny797._.js +0 -3
  382. package/.next/server/chunks/[root-of-the-server]__1rqu8zxkn8yj1._.js +0 -3
  383. package/.next/server/chunks/[root-of-the-server]__1seev7pmug-hj._.js +0 -3
  384. package/.next/server/chunks/[root-of-the-server]__1xkmo8s1c258u._.js +0 -3
  385. package/.next/server/chunks/[root-of-the-server]__1z56ua9u9hadc._.js +0 -3
  386. package/.next/server/chunks/_0ymqtnritje40._.js +0 -3
  387. package/.next/server/chunks/_1duugm0s3-6nw._.js +0 -3
  388. package/.next/server/chunks/_1gjtds8ik0l6x._.js +0 -3
  389. package/.next/server/chunks/_1hvmjv_7xksea._.js +0 -3
  390. package/.next/server/chunks/_1rreh3rgx8xan._.js +0 -3
  391. package/.next/server/chunks/_1wnggnglg9_n1._.js +0 -3
  392. package/.next/server/chunks/src_lib_0dxltm34zaclb._.js +0 -3
  393. package/.next/server/chunks/src_lib_date-time_ts_14chb270f3epb._.js +0 -3
  394. package/.next/server/chunks/ssr/[root-of-the-server]__0_bi5ljcm1i1c._.js +0 -3
  395. package/.next/server/chunks/ssr/[root-of-the-server]__0fy6mc47ccfce._.js +0 -3
  396. package/.next/server/chunks/ssr/[root-of-the-server]__0q_1ml4ix5ftb._.js +0 -3
  397. package/.next/server/chunks/ssr/[root-of-the-server]__0r_5r-242wwqy._.js +0 -3
  398. package/.next/server/chunks/ssr/[root-of-the-server]__1eutot_8-s4s4._.js +0 -3
  399. package/.next/server/chunks/ssr/[root-of-the-server]__2019hdxvtb4e0._.js +0 -3
  400. package/.next/server/chunks/ssr/_05szyj465au6e._.js +0 -3
  401. package/.next/server/chunks/ssr/_0nt5dm7rmsp4f._.js +0 -3
  402. package/.next/server/chunks/ssr/_0ueequ0gysrs-._.js +0 -3
  403. package/.next/server/chunks/ssr/_15fdum1ye-k0z._.js +0 -3
  404. package/.next/server/chunks/ssr/_1b8cip9y91_br._.js +0 -3
  405. package/.next/server/chunks/ssr/_1d91l8e5qt82w._.js +0 -3
  406. package/.next/server/chunks/ssr/_1hbrn0tcfh7hd._.js +0 -3
  407. package/.next/server/chunks/ssr/_1j21wzv797ipf._.js +0 -3
  408. package/.next/server/chunks/ssr/_1w1qijzykerpu._.js +0 -3
  409. package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_icons_1bq471wvtkwrl._.js +0 -3
  410. package/.next/server/chunks/ssr/src_components_difficulty-stars_tsx_1af9qqfurq7_t._.js +0 -3
  411. package/.next/static/chunks/0455_qx26n4sc.js +0 -1
  412. package/.next/static/chunks/0_0cdw71x2r9p.js +0 -1
  413. package/.next/static/chunks/0ajfstfi1ibjf.js +0 -1
  414. package/.next/static/chunks/1ppadg8s8wyf0.js +0 -1
  415. package/.next/static/chunks/1upvap68fad8i.js +0 -1
  416. package/.next/static/chunks/1v3rj6mh3f3-l.js +0 -1
  417. package/.next/static/chunks/25_80i03m2bsy.css +0 -3
  418. package/.next/static/chunks/2e4yhd7hvrn4n.js +0 -1
  419. package/.next/static/chunks/2urhwgx3nt7lq.js +0 -1
  420. package/.next/static/chunks/3-se55-6uc0mx.js +0 -2
  421. package/.next/static/chunks/3-w46lg1a_qse.js +0 -1
  422. package/.next/static/chunks/34lp-hkkywd8r.js +0 -1
  423. package/.next/static/chunks/3jvftad10pwwg.js +0 -9
  424. /package/.next/static/{rhXQeIgvoLtutrDHSq6bR → 0_A8rshkxRGdIAt8Ht93Q}/_buildManifest.js +0 -0
  425. /package/.next/static/{rhXQeIgvoLtutrDHSq6bR → 0_A8rshkxRGdIAt8Ht93Q}/_clientMiddlewareManifest.js +0 -0
  426. /package/.next/static/{rhXQeIgvoLtutrDHSq6bR → 0_A8rshkxRGdIAt8Ht93Q}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,864272,e=>{"use strict";var t=e.i(843476),a=e.i(271645),i=e.i(522016),r=e.i(618566),s=e.i(13285),n=e.i(853138),l=e.i(632781),c=e.i(77071),o=e.i(456420);let d={name:"undo-2",size:24,node:[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]};d.node;let m=(0,o.f)(d),u={name:"arrow-right",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]};u.node;let x=(0,o.f)(u);var h=e.i(111110);function p({inputProps:e,created:a}){let{t:r}=(0,h.b)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{type:"file",accept:"image/*",className:"hidden","data-testid":"continuation-input",...e}),a.length>0&&(0,t.jsx)("ul",{className:"space-y-1 rounded-lg border border-primary/40 bg-primary/5 p-3 text-sm","data-testid":"continuation-notice",children:a.map((e,a)=>(0,t.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)(s.f,{className:"h-4 w-4 text-primary"}),r.importBatch.continuation.notice.replace("{n}",String(a+2))]}),(0,t.jsxs)(i.default,{href:`/import-batches/${e}`,className:"flex items-center gap-1 text-primary underline-offset-2 hover:underline",children:[r.importBatch.continuation.open,(0,t.jsx)(x,{className:"h-3 w-3"})]})]},e))})]})}let f={name:"arrow-down",size:24,node:[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]};f.node;let g=(0,o.f)(f),y={name:"arrow-up",size:24,node:[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]};y.node;let b=(0,o.f)(y);var j=e.i(716327),v=e.i(456539),k=e.i(508734);let w={name:"crop",size:24,node:[["path",{d:"M6 2v14a2 2 0 0 0 2 2h14",key:"ron5a4"}],["path",{d:"M18 22V8a2 2 0 0 0-2-2H2",key:"7s9ehn"}]]};w.node;let N=(0,o.f)(w),B={name:"file-plus-corner",size:24,node:[["path",{d:"M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35",key:"17jvcc"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M14 19h6",key:"bvotb8"}],["path",{d:"M17 16v6",key:"18yu1i"}]],aliases:["file-plus-2"]};B.node;let C=(0,o.f)(B),S={name:"merge",size:24,node:[["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22",key:"1hyw0i"}],["path",{d:"m20 22-5-5",key:"1m27yz"}]]};S.node;let z=(0,o.f)(S),T={name:"scissors",size:24,node:[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]};T.node;let I=(0,o.f)(T);var M=e.i(328623),R=e.i(759659),$=e.i(411382),E=e.i(978056),A=e.i(54105),F=e.i(772325),D=e.i(722219),D=D,H=e.i(282492),U=e.i(825624);let q=$.z.object({x:E.z.number().min(0).max(1),y:E.z.number().min(0).max(1),width:E.z.number().min(.01).max(1),height:E.z.number().min(.01).max(1)}).refine(e=>e.x+e.width<=1.0001&&e.y+e.height<=1.0001,{message:"REGION_OUT_OF_BOUNDS"}),_=["unclear","partial","unlocated"],L=$.z.object({original:A.z.string().max(2e4),text:A.z.string().max(2e4),uncertain:F.z.array(A.z.string().max(200)).max(20)}),O=$.z.object({key:A.z.string().regex(/^[A-Za-z0-9_-]{1,40}$/),label:A.z.string().max(20).nullable(),text:A.z.string().max(2e4),material:A.z.string().max(2e4).nullable(),section:A.z.string().max(500).nullable(),selected:D.boolean(),regions:F.z.array(q).max(4),hasFigure:D.boolean(),flags:F.z.array(H.z.enum(_)).max(_.length),fix:L.nullish()}),P=["blurry","partial","truncated","tooMany"];function V(e=[]){let t=new Set(e);for(;;){let e=`q${Math.random().toString(36).slice(2,10)}`;if(!t.has(e))return e}}function K(e,t){return"image"===t?e.regions.length>0:e.text.trim().length>0}$.z.object({items:F.z.array(O).max(U.S),ignored:F.z.array(A.z.string().max(2e4)).max(200),warnings:F.z.array(H.z.enum(P)).max(P.length)}).superRefine((e,t)=>{let a=new Set;for(let i of e.items)a.has(i.key)&&t.addIssue({code:"custom",message:"DUPLICATE_ITEM_KEY"}),a.add(i.key)});var G=e.i(975157);function Q({imageUrl:e,imageSize:a,regions:i,className:r}){let s=function(e){if(0===e.length)return null;let t=Math.min(...e.map(e=>e.x)),a=Math.min(...e.map(e=>e.y));return{x:t,y:a,width:Math.max(...e.map(e=>e.x+e.width))-t,height:Math.max(...e.map(e=>e.y+e.height))-a}}(i);if(!s)return null;let n=s.width*a.width/Math.max(1,s.height*a.height);return(0,t.jsx)("div",{className:(0,G.f)("relative w-full overflow-hidden rounded-md border bg-white",r),style:{aspectRatio:String(Math.max(.25,Math.min(8,n)))},"aria-hidden":!0,children:(0,t.jsx)("img",{src:e,alt:"",className:"absolute max-w-none select-none",draggable:!1,style:{width:`${100/s.width}%`,height:`${100/s.height}%`,left:`${-s.x/s.width*100}%`,top:`${-s.y/s.height*100}%`}})})}var W=e.i(689664),Y=e.i(263676),J=e.i(519455);function X(e,t,a){if(!a)return;let i=e[e.length-1];i&&i.type===t?i.text+=a:e.push({type:t,text:a})}function Z({fix:e,onAccept:i,onReject:r}){let{t:s}=(0,h.b)(),n=(0,a.useMemo)(()=>(function(e,t){let a=Array.from(e),i=Array.from(t),r=0;for(;r<a.length&&r<i.length&&a[r]===i[r];)r++;let s=a.length,n=i.length;for(;s>r&&n>r&&a[s-1]===i[n-1];)s--,n--;let l=[];X(l,"same",a.slice(0,r).join(""));let c=a.slice(r,s),o=i.slice(r,n),d=c.length,m=o.length;if(d*m>2e6)X(l,"removed",c.join("")),X(l,"added",o.join(""));else{let e=m+1,t=new Uint32Array((d+1)*e);for(let a=d-1;a>=0;a--)for(let i=m-1;i>=0;i--)t[a*e+i]=c[a]===o[i]?t[(a+1)*e+i+1]+1:Math.max(t[(a+1)*e+i],t[a*e+i+1]);let a=0,i=0;for(;a<d&&i<m;)c[a]===o[i]?(X(l,"same",c[a]),a++,i++):t[(a+1)*e+i]>=t[a*e+i+1]?X(l,"removed",c[a++]):X(l,"added",o[i++]);X(l,"removed",c.slice(a).join("")),X(l,"added",o.slice(i).join(""))}return X(l,"same",a.slice(s).join("")),l})(e.original,e.text),[e.original,e.text]);return(0,t.jsxs)("div",{className:"space-y-2 rounded-lg border border-violet-300 bg-violet-50/60 p-2 text-sm dark:border-violet-800 dark:bg-violet-950/30","data-testid":"text-fix-panel",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-1",children:[(0,t.jsxs)("span",{className:"flex items-center gap-1 text-xs font-medium text-violet-700 dark:text-violet-300",children:[(0,t.jsx)(M.f,{className:"h-3 w-3"}),s.importBatch.fixText.title]}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:s.importBatch.fixText.legend})]}),(0,t.jsx)("p",{className:"whitespace-pre-wrap break-words font-mono text-sm","data-testid":"text-fix-diff",children:n.map((e,a)=>"same"===e.type?(0,t.jsx)("span",{children:e.text},a):"removed"===e.type?(0,t.jsx)("del",{className:"bg-red-100 text-red-700 decoration-red-500 dark:bg-red-950/50 dark:text-red-300",children:e.text},a):(0,t.jsx)("ins",{className:"bg-emerald-100 text-emerald-800 no-underline dark:bg-emerald-950/50 dark:text-emerald-300",children:e.text},a))}),e.uncertain.length>0&&(0,t.jsxs)("div",{className:"text-xs text-amber-800 dark:text-amber-300",children:[(0,t.jsx)("span",{children:s.importBatch.fixText.uncertain}),(0,t.jsx)("ul",{className:"mt-0.5 list-inside list-disc",children:e.uncertain.map((e,a)=>(0,t.jsx)("li",{className:"break-words",children:e},a))})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsxs)(J.f,{type:"button",size:"sm",onClick:i,children:[(0,t.jsx)(W.f,{className:"mr-1 h-4 w-4"}),s.importBatch.fixText.accept]}),(0,t.jsxs)(J.f,{type:"button",size:"sm",variant:"ghost",onClick:r,children:[(0,t.jsx)(Y.X,{className:"mr-1 h-4 w-4"}),s.importBatch.fixText.reject]})]})]})}var ee=e.i(487486),et=e.i(257428),ea=e.i(624687);function ei(e,t){return{...e,items:t}}function er(e,t){return e.items.findIndex(e=>e.key===t)}function es(e,t,a){return ei(e,e.items.map(e=>{if(e.key!==t)return e;let i={...e,...a};return void 0!==a.text&&(i.text=a.text.slice(0,2e4),i.text!==e.text&&(i.fix=null)),void 0!==a.regions&&(i.regions=a.regions.slice(0,4),i.flags=i.regions.length>0?e.flags.filter(e=>"unlocated"!==e):[...new Set([...e.flags,"unlocated"])]),i}))}function en(e,t){return ei(e,e.items.filter(e=>e.key!==t))}function el(e,t,a){let i=er(e,t),r=i+a;if(i<0||r<0||r>=e.items.length)return e;let s=[...e.items];return[s[i],s[r]]=[s[r],s[i]],ei(e,s)}function ec(e,t){let a=t?new Set(t):null,i=!1,r=e.items.map(e=>e.fix&&(!a||a.has(e.key))?(i=!0,e.fix.original===e.text?{...e,text:e.fix.text,fix:null}:{...e,fix:null}):e);return i?ei(e,r):e}function eo({item:e,index:i,total:r,source:s,expanded:c,onToggleExpand:o,onEdit:d,image:m,onAdjustRegion:u,highlighted:x,onFixText:p,fixing:f,fixBusy:y,onContinue:w,continuing:B}){let{t:S}=(0,h.b)(),T=(0,a.useRef)(null),$=K(e,s),E=`draft-item-${e.key}`,A=e.fix&&e.fix.original===e.text?e.fix:null;return(0,t.jsxs)("li",{id:E,className:(0,G.f)("rounded-xl border bg-card p-3 transition-colors",!e.selected&&"opacity-70",x&&"border-primary ring-2 ring-primary/30"),"data-testid":"draft-item","data-selected":e.selected,"data-fix-pending":A?"true":void 0,children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)(et.f,{className:"mt-1 h-5 w-5",checked:e.selected,disabled:!$,onCheckedChange:t=>d(a=>{var i,r;return i=e.key,r=!0===t,ei(a,a.items.map(e=>e.key===i?{...e,selected:r}:e))}),"aria-label":S.importBatch.question.replace("{index}",String(i+1))}),(0,t.jsxs)("button",{type:"button",className:"min-w-0 flex-1 text-left",onClick:o,"aria-expanded":c,"aria-controls":`${E}-body`,children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[(0,t.jsx)("span",{className:"font-semibold",children:S.importBatch.question.replace("{index}",String(i+1))}),e.label&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:S.importBatch.originalLabel.replace("{label}",e.label)}),e.material&&(0,t.jsx)(ee.f,{variant:"secondary",children:S.importBatch.material}),e.hasFigure&&(0,t.jsx)(ee.f,{variant:"outline",children:S.importBatch.hasFigure}),A&&(0,t.jsx)(ee.f,{className:"bg-violet-600 text-white hover:bg-violet-600",children:S.importBatch.fixText.pending}),e.section&&(0,t.jsx)("span",{className:"truncate text-xs text-muted-foreground",children:e.section.split("\n")[0]})]}),!c&&!A&&e.text&&(0,t.jsx)("p",{className:"mt-1 line-clamp-3 whitespace-pre-line break-words text-sm text-muted-foreground",children:e.text}),e.flags.length>0&&(0,t.jsx)("ul",{className:"mt-1 space-y-0.5",children:e.flags.map(e=>(0,t.jsxs)("li",{className:"flex items-center gap-1 text-xs text-amber-700 dark:text-amber-300",children:[(0,t.jsx)(n.f,{className:"h-3 w-3 shrink-0"}),S.importBatch.flags[e]]},e))})]}),(0,t.jsx)(J.f,{type:"button",size:"icon",variant:"ghost",className:"h-8 w-8 shrink-0",onClick:o,"aria-label":c?S.importBatch.collapse:S.importBatch.edit,children:c?(0,t.jsx)(v.f,{className:"h-4 w-4"}):(0,t.jsx)(j.f,{className:"h-4 w-4"})})]}),m&&e.regions.length>0&&(0,t.jsx)("button",{type:"button",className:"mt-2 block w-full max-w-md pl-8",onClick:u,"aria-label":S.importBatch.adjustRegion,children:(0,t.jsx)(Q,{imageUrl:m.url,imageSize:m,regions:e.regions,className:"max-h-48"})}),w&&(0,t.jsx)("div",{className:"mt-2 pl-8",children:(0,t.jsxs)(J.f,{type:"button",size:"sm",variant:"outline",onClick:w,disabled:B,"data-testid":"draft-continue",children:[B?(0,t.jsx)(l.f,{className:"mr-1 h-4 w-4 animate-spin"}):(0,t.jsx)(C,{className:"mr-1 h-4 w-4"}),B?S.importBatch.continuation.working:S.importBatch.continuation.button]})}),A&&(0,t.jsx)("div",{className:"mt-2 pl-8",children:(0,t.jsx)(Z,{fix:A,onAccept:()=>d(t=>ec(t,[e.key])),onReject:()=>d(t=>{var a;return a=e.key,ei(t,t.items.map(e=>e.key===a&&e.fix?{...e,fix:null}:e))})})}),c&&(0,t.jsxs)("div",{id:`${E}-body`,className:"mt-3 space-y-3 pl-8",children:[e.material&&(0,t.jsxs)("div",{className:"rounded-lg bg-muted/60 p-2 text-sm",children:[(0,t.jsxs)("div",{className:"mb-1 flex items-center justify-between gap-2",children:[(0,t.jsxs)("span",{className:"text-xs font-medium",children:[S.importBatch.material," · ",S.importBatch.materialHint]}),(0,t.jsx)(J.f,{type:"button",size:"sm",variant:"ghost",className:"h-7 px-2 text-xs",onClick:()=>d(t=>es(t,e.key,{material:null})),children:S.importBatch.removeMaterial})]}),(0,t.jsx)("p",{className:"line-clamp-6 whitespace-pre-line break-words text-muted-foreground",children:e.material})]}),"text"===s?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ea.f,{ref:T,"aria-label":S.importBatch.questionText,value:e.text,onChange:t=>d(a=>es(a,e.key,{text:t.target.value}),`text-${e.key}`),className:"min-h-28 font-mono text-sm"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:S.importBatch.splitHint})]}):(0,t.jsxs)(t.Fragment,{children:[e.text&&(0,t.jsx)("p",{className:"whitespace-pre-line break-words text-sm text-muted-foreground",children:e.text}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:S.importBatch.imageTextHint})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:["text"===s?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(J.f,{type:"button",size:"sm",variant:"outline",onClick:()=>{let t=T.current?.selectionStart??0;d(a=>(function(e,t,a){let i=er(e,t);if(i<0||e.items.length>=U.S)return e;let r=e.items[i],s=r.text.slice(0,a).replace(/\s+$/,""),n=r.text.slice(a).replace(/^\s+/,"");if(!s||!n)return e;let l={...r,key:V(e.items.map(e=>e.key)),label:null,text:n,regions:[],flags:r.regions.length>0?["unlocated"]:[],selected:!(r.regions.length>0)&&r.selected,fix:null},c=[...e.items];return c.splice(i,1,{...r,text:s,fix:null},l),ei(e,c)})(a,e.key,t))},children:[(0,t.jsx)(I,{className:"mr-1 h-4 w-4"}),S.importBatch.splitHere]}),p&&(0,t.jsxs)(J.f,{type:"button",size:"sm",variant:"outline",onClick:p,disabled:y||!e.text.trim(),children:[f?(0,t.jsx)(l.f,{className:"mr-1 h-4 w-4 animate-spin"}):(0,t.jsx)(M.f,{className:"mr-1 h-4 w-4"}),f?S.importBatch.fixText.running:S.importBatch.fixText.one]})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(J.f,{type:"button",size:"sm",variant:"outline",onClick:u,children:[(0,t.jsx)(N,{className:"mr-1 h-4 w-4"}),e.regions.length?S.importBatch.adjustRegion:S.importBatch.locate]}),(0,t.jsxs)(J.f,{type:"button",size:"sm",variant:"outline",onClick:()=>d(t=>(function(e,t){let a=er(e,t);if(a<0||e.items.length>=U.S)return e;let i=e.items[a],r={...i,key:V(e.items.map(e=>e.key)),label:null,regions:i.regions.map(e=>({...e}))},s=[...e.items];return s.splice(a+1,0,r),ei(e,s)})(t,e.key)),children:[(0,t.jsx)(k.f,{className:"mr-1 h-4 w-4"}),S.importBatch.duplicate]})]}),(0,t.jsxs)(J.f,{type:"button",size:"sm",variant:"outline",disabled:0===i,onClick:()=>d(t=>(function(e,t){let a=er(e,t);if(a<=0)return e;let i=e.items[a-1],r=e.items[a],s={...i,text:[i.text,r.text].filter(e=>e.trim()).join("\n").slice(0,2e4),material:i.material??r.material,selected:i.selected||r.selected,regions:[...i.regions,...r.regions].slice(0,4),hasFigure:i.hasFigure||r.hasFigure,flags:[...new Set([...i.flags,...r.flags])].filter(e=>"unlocated"!==e||i.regions.length+r.regions.length===0),fix:null},n=[...e.items];return n.splice(a-1,2,s),ei(e,n)})(t,e.key)),children:[(0,t.jsx)(z,{className:"mr-1 h-4 w-4"}),S.importBatch.mergeUp]}),(0,t.jsx)(J.f,{type:"button",size:"sm",variant:"ghost",disabled:0===i,onClick:()=>d(t=>el(t,e.key,-1)),"aria-label":S.importBatch.moveUp,children:(0,t.jsx)(b,{className:"h-4 w-4"})}),(0,t.jsx)(J.f,{type:"button",size:"sm",variant:"ghost",disabled:i===r-1,onClick:()=>d(t=>el(t,e.key,1)),"aria-label":S.importBatch.moveDown,children:(0,t.jsx)(g,{className:"h-4 w-4"})}),(0,t.jsxs)(J.f,{type:"button",size:"sm",variant:"ghost",className:"text-destructive",onClick:()=>d(t=>en(t,e.key)),children:[(0,t.jsx)(R.f,{className:"mr-1 h-4 w-4"}),S.importBatch.delete]})]})]})]})}function ed({count:e,missingRegions:a,pendingFixes:i=0,confirmBeforeImport:r,starting:s,onStart:n,onDiscard:c}){let{t:o}=(0,h.b)(),d=(r?o.importBatch.startReview:o.importBatch.startAuto).replace("{count}",String(e)),m=0===e?o.importBatch.nothingSelected:a>0?o.importBatch.needsRegion.replace("{count}",String(a)):i>0?o.importBatch.fixText.pendingHint.replace("{count}",String(i)):r?o.importBatch.startHintReview:o.importBatch.startHintAuto;return(0,t.jsx)("div",{className:"fixed inset-x-0 bottom-[calc(4rem+env(safe-area-inset-bottom))] z-30 border-t bg-background/95 py-3 pl-4 pr-16 shadow-[0_-4px_12px_rgba(0,0,0,0.06)] backdrop-blur md:sticky md:bottom-4 md:rounded-xl md:border md:px-4","data-testid":"draft-start-bar",children:(0,t.jsxs)("div",{className:"mx-auto flex max-w-4xl flex-col gap-2 md:flex-row md:items-center md:justify-between",children:[(0,t.jsx)("p",{className:"text-xs text-muted-foreground md:max-w-md","data-testid":"draft-start-hint",children:s??m}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(J.f,{type:"button",variant:"ghost",onClick:c,disabled:!!s,className:"shrink-0",children:o.importBatch.discard}),(0,t.jsxs)(J.f,{type:"button",onClick:n,disabled:0===e||!!s,className:"min-w-0 flex-1 md:flex-none","data-testid":"draft-start",children:[s?(0,t.jsx)(l.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,t.jsx)(M.f,{className:"mr-2 h-4 w-4"}),(0,t.jsx)("span",{className:"truncate",children:d})]})]})]})})}function em({ignored:e,onRestore:i}){let{t:r}=(0,h.b)(),[s,n]=(0,a.useState)(!1);return 0===e.length?null:(0,t.jsxs)("section",{className:"rounded-xl border p-3",children:[(0,t.jsxs)("button",{type:"button",className:"flex w-full items-center justify-between text-left text-sm font-medium",onClick:()=>n(e=>!e),"aria-expanded":s,children:[r.importBatch.ignoredTitle.replace("{count}",String(e.length)),s?(0,t.jsx)(v.f,{className:"h-4 w-4"}):(0,t.jsx)(j.f,{className:"h-4 w-4"})]}),s&&(0,t.jsxs)("div",{className:"mt-2 space-y-2",children:[(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:r.importBatch.ignoredHint}),(0,t.jsx)("ul",{className:"space-y-2",children:e.map((e,a)=>(0,t.jsxs)("li",{className:"flex items-start gap-2 rounded-lg bg-muted/50 p-2 text-sm",children:[(0,t.jsx)("p",{className:"min-w-0 flex-1 whitespace-pre-line break-words text-muted-foreground",children:e}),(0,t.jsx)(J.f,{type:"button",size:"sm",variant:"outline",className:"h-7 shrink-0",onClick:()=>i(a),children:r.importBatch.addAsQuestion})]},`${a}-${e.slice(0,20)}`))})]})]})}function eu({imageUrl:e,items:i,onSelectItem:r,highlightedKey:s}){let{t:n}=(0,h.b)(),[l,c]=(0,a.useState)(!0);return(0,t.jsxs)("section",{className:"rounded-xl border bg-card p-3","data-testid":"page-image-overview",children:[(0,t.jsxs)(J.f,{type:"button",variant:"ghost",size:"sm",className:"mb-2 h-8 px-2 md:hidden",onClick:()=>c(e=>!e),"aria-expanded":l,children:[l?(0,t.jsx)(v.f,{className:"mr-1 h-4 w-4"}):(0,t.jsx)(j.f,{className:"mr-1 h-4 w-4"}),l?n.importBatch.hideImage:n.importBatch.showImage]}),(0,t.jsxs)("div",{className:(0,G.f)("relative mx-auto w-fit max-w-full",!l&&"hidden md:block"),children:[(0,t.jsx)("img",{src:e,alt:"",className:"block max-h-[70vh] max-w-full select-none rounded-md",draggable:!1}),i.map((e,a)=>e.regions.map((i,l)=>(0,t.jsx)("button",{type:"button",onClick:()=>r(e.key),className:(0,G.f)("absolute rounded-sm border-2 transition-colors",e.selected?"border-primary bg-primary/10":"border-dashed border-muted-foreground/70 bg-transparent",s===e.key&&"border-amber-500 bg-amber-400/20"),style:{left:`${100*i.x}%`,top:`${100*i.y}%`,width:`${100*i.width}%`,height:`${100*i.height}%`},"aria-label":n.importBatch.question.replace("{index}",String(a+1)),children:0===l&&(0,t.jsx)("span",{className:(0,G.f)("absolute -left-0.5 -top-0.5 rounded-br-md px-1.5 text-xs font-semibold text-white",e.selected?"bg-primary":"bg-muted-foreground"),children:a+1})},`${e.key}-${l}`)))]})]})}var ex=e.i(232660),eh=e.i(776639);let ep={x:.1,y:.1,width:.8,height:.3};function ef(e){return{unit:"%",x:100*e.x,y:100*e.y,width:100*e.width,height:100*e.height}}function eg(e){let t={x:e.x/100,y:e.y/100,width:e.width/100,height:e.height/100};return t.width>=.01&&t.height>=.01?t:null}function ey({open:e,imageUrl:i,regions:r,onClose:s,onSave:n}){let{t:l}=(0,h.b)(),[o,d]=(0,a.useState)(()=>(r.length?r:[ep]).map(ef)),[m,u]=(0,a.useState)(0),x=o[Math.min(m,o.length-1)];return(0,t.jsx)(eh.N,{open:e,onOpenChange:e=>!e&&s(),children:(0,t.jsxs)(eh.d,{className:"flex h-[90vh] max-w-3xl flex-col gap-0 p-0",children:[(0,t.jsxs)(eh.s,{className:"shrink-0 border-b p-4",children:[(0,t.jsx)(eh.F,{children:l.importBatch.regionDialogTitle}),(0,t.jsx)(eh.C,{children:l.importBatch.regionDialogHint})]}),(0,t.jsx)("div",{className:"min-h-0 flex-1 overflow-auto bg-black p-3",children:(0,t.jsx)("div",{className:"mx-auto w-fit",children:(0,t.jsx)(ex.f,{crop:x,onChange:(e,t)=>d(e=>e.map((e,a)=>a===m?t:e)),children:(0,t.jsx)("img",{src:i,alt:"",className:"block max-h-[65vh] max-w-full",draggable:!1})})})}),(0,t.jsxs)("div",{className:"shrink-0 space-y-3 border-t p-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[o.map((e,a)=>(0,t.jsx)("button",{type:"button",onClick:()=>u(a),className:(0,G.f)("rounded-md border px-3 py-1 text-sm",a===m?"border-primary bg-primary/10 font-medium":"text-muted-foreground"),children:l.importBatch.regionTab.replace("{index}",String(a+1))},a)),o.length<4&&(0,t.jsxs)(J.f,{type:"button",size:"sm",variant:"ghost",onClick:()=>{d(e=>[...e,ef(ep)]),u(o.length)},children:[(0,t.jsx)(c.f,{className:"mr-1 h-4 w-4"}),l.importBatch.addRegion]}),o.length>1&&(0,t.jsxs)(J.f,{type:"button",size:"sm",variant:"ghost",className:"text-destructive",onClick:()=>{d(e=>e.filter((e,t)=>t!==m)),u(0)},children:[(0,t.jsx)(R.f,{className:"mr-1 h-4 w-4"}),l.importBatch.removeRegion]})]}),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(J.f,{type:"button",variant:"outline",onClick:s,children:l.common.cancel}),(0,t.jsx)(J.f,{type:"button",onClick:()=>{let e=o.map(eg).filter(e=>null!==e);e.length&&n(e)},children:l.importBatch.saveRegion})]})]})]})})}let eb={name:"check-check",size:24,node:[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]};eb.node;let ej=(0,o.f)(eb);function ev({targetCount:e,pendingCount:a,fixing:i,onFix:r,onAcceptAll:s}){let{t:n}=(0,h.b)();return(0,t.jsxs)("div",{className:"space-y-1 rounded-lg border border-dashed p-3","data-testid":"text-fix-toolbar",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxs)(J.f,{type:"button",size:"sm",variant:"outline",onClick:r,disabled:i||0===e,children:[i?(0,t.jsx)(l.f,{className:"mr-1 h-4 w-4 animate-spin"}):(0,t.jsx)(M.f,{className:"mr-1 h-4 w-4"}),i?n.importBatch.fixText.running:n.importBatch.fixText.selected.replace("{count}",String(e))]}),a>0&&(0,t.jsxs)(J.f,{type:"button",size:"sm",onClick:s,children:[(0,t.jsx)(ej,{className:"mr-1 h-4 w-4"}),n.importBatch.fixText.acceptAll.replace("{count}",String(a))]})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:n.importBatch.fixText.hint})]})}var ek=e.i(61425),ew=e.i(810104),eN=e.i(294114),eB=e.i(201276),eC=e.i(575557),eS=e.i(213761);function ez({batch:e,draft:i,onEdit:r,onUndo:s,canUndo:o,saveState:d,image:u,confirmBeforeImport:x,starting:f,onStart:g,onDiscard:y,hasConflictCopy:b,onRestoreConflict:j,onDismissConflict:v}){let{t:k}=(0,h.b)(),w=e.source,[N,B]=(0,a.useState)(null),[C,S]=(0,a.useState)(null),[z,T]=(0,a.useState)(null),I=i.items.filter(e=>e.selected&&K(e,w)),M=i.items.length>0&&i.items.every(e=>e.selected||!K(e,w)),R=i.items.filter(e=>e.selected&&!K(e,w)).length,$=function(e,t,i){let{t:r}=(0,h.b)(),[s,n]=(0,a.useState)([]);return{fix:(0,a.useCallback)(async a=>{let s=t.items.filter(e=>a.includes(e.key)&&e.text.trim()).map(e=>({key:e.key,text:e.text}));if(0!==s.length){n(s.map(e=>e.key));try{let t=await (0,eC.$)(e,s);t.fixes.length>0&&i(e=>{let a,i,r;return a=new Map(t.fixes.map(e=>[e.key,e])),i=!1,r=e.items.map(e=>{let t=a.get(e.key);return t&&e.text===t.original&&t.text!==t.original?(i=!0,{...e,fix:{original:t.original,text:t.text,uncertain:t.uncertain}}):e}),i?ei(e,r):e});let a=[t.fixes.length>0?r.importBatch.fixText.done.replace("{count}",String(t.fixes.length)):null,t.unchanged.length>0?r.importBatch.fixText.unchanged.replace("{count}",String(t.unchanged.length)):null,t.failed.length>0?r.importBatch.fixText.failed.replace("{count}",String(t.failed.length)):null].filter(Boolean).join(" ");t.failed.length>0?eN.c.warning(a):eN.c.success(a)}catch(e){eB.V.error("[ImportBatch]","Text fix failed",{error:e}),eN.c.error((0,ek.f)(e,r))}finally{n([])}}},[e,t,i,r]),fixingKeys:s,fixing:s.length>0}}(e.id,i,r),E=function(e,t,i,r){let{t:s,language:n}=(0,h.b)(),l=(0,a.useRef)(null),c=(0,a.useRef)(null),[o,d]=(0,a.useState)(null),[m,u]=(0,a.useState)([]),x=async a=>{let l=a.target.files?.[0];a.target.value="";let o=i.items.find(e=>e.key===c.current);if(l&&o&&t){d(o.key);try{let a=await (0,eS.p)(l);try{let i=await (0,ew.y)(t),l=await (0,ew.k)(i,o.regions,a),c={...(0,eS.N)(a,l),sourceType:"continuation"},d=await (0,eC.v)({source:"image",imageBase64:l.dataUrl,imageInfo:c,language:n,subjectId:e.subjectId,targetSubjectId:e.targetSubjectId,paperLevel:e.paperLevel});r(e=>en(e,o.key)),u(e=>[...e,d.id]),eB.V.info("[ImportBatch]","Continuation batch created",{batchId:d.id,...c}),eN.c.success(s.importBatch.continuation.created)}finally{a.dispose()}}catch(e){eB.V.error("[ImportBatch]","Continuation failed",{error:e}),eN.c.error(e instanceof eS.o?s.upload.decodeErrors[e.code].replace("{format}",e.format.toUpperCase()):(0,ek.f)(e,s))}finally{d(null)}}};return{pick:e=>{c.current=e,l.current?.click()},busyKey:o,created:m,inputProps:{ref:l,onChange:e=>void x(e)}}}(e,u?.url??null,i,r),A="text"===w?i.items.filter(e=>e.fix&&e.fix.original===e.text).length:0,F="text"===w?I.filter(e=>!(e.fix&&e.fix.original===e.text)).map(e=>e.key):[];return(0,t.jsxs)("div",{className:"space-y-4 pb-36 md:pb-24",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,t.jsxs)("p",{className:"text-base font-semibold","data-testid":"draft-summary",children:[k.importBatch.detected.replace("{count}",String(i.items.length)),(0,t.jsx)("span",{className:"mx-2 text-muted-foreground",children:"·"}),k.importBatch.selected.replace("{count}",String(I.length))]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsxs)("span",{className:"mr-2 flex items-center gap-1 text-xs text-muted-foreground","aria-live":"polite","data-testid":"draft-save-state","data-state":d,children:["saving"===d&&(0,t.jsx)(l.f,{className:"h-3 w-3 animate-spin"}),k.importBatch.save[d]]}),(0,t.jsxs)(J.f,{type:"button",size:"sm",variant:"ghost",disabled:!o,onClick:s,children:[(0,t.jsx)(m,{className:"mr-1 h-4 w-4"}),k.importBatch.undo]}),(0,t.jsx)(J.f,{type:"button",size:"sm",variant:"ghost",onClick:()=>r(e=>(function(e,t,a=()=>!0){return ei(e,e.items.map(e=>({...e,selected:t&&a(e)})))})(e,!M,e=>K(e,w))),children:M?k.importBatch.selectNone:k.importBatch.selectAll})]})]}),b&&(0,t.jsxs)("div",{className:"space-y-2 rounded-lg border border-primary/40 bg-primary/5 p-3 text-sm",role:"status","data-testid":"draft-conflict",children:[(0,t.jsx)("p",{children:k.importBatch.conflictKept}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(J.f,{type:"button",size:"sm",onClick:j,children:k.importBatch.restoreMine}),(0,t.jsx)(J.f,{type:"button",size:"sm",variant:"ghost",onClick:v,children:k.importBatch.discardMine})]})]}),"text"===w&&i.items.length>0&&(0,t.jsx)(ev,{targetCount:F.length,pendingCount:A,fixing:$.fixing,onFix:()=>void $.fix(F),onAcceptAll:()=>r(e=>ec(e))}),i.warnings.length>0&&(0,t.jsx)("ul",{className:"space-y-1 rounded-lg border border-amber-300 bg-amber-50 p-3 text-sm text-amber-900 dark:border-amber-700 dark:bg-amber-950/40 dark:text-amber-200",children:i.warnings.map(e=>(0,t.jsxs)("li",{className:"flex items-start gap-2",children:[(0,t.jsx)(n.f,{className:"mt-0.5 h-4 w-4 shrink-0"}),k.importBatch.warnings[e]]},e))}),(0,t.jsx)(p,{inputProps:E.inputProps,created:E.created}),u&&(0,t.jsx)(eu,{imageUrl:u.url,items:i.items,onSelectItem:e=>{S(e),B(e),document.getElementById(`draft-item-${e}`)?.scrollIntoView({behavior:"smooth",block:"center"})},highlightedKey:C}),0===i.items.length?(0,t.jsx)("p",{className:"rounded-xl border border-dashed p-6 text-center text-sm text-muted-foreground",children:k.importBatch.emptyDraft}):(0,t.jsx)("ol",{className:"space-y-3",children:i.items.map((e,a)=>{var s;return(0,t.jsx)(eo,{item:e,index:a,total:i.items.length,source:w,expanded:N===e.key,onToggleExpand:()=>B(t=>t===e.key?null:e.key),onEdit:r,image:u,onAdjustRegion:()=>T({key:e.key,regions:e.regions}),highlighted:C===e.key,onFixText:"text"===w?()=>void $.fix([e.key]):void 0,fixing:$.fixingKeys.includes(e.key),fixBusy:$.fixing,onContinue:u&&(s=i.items.length,e.regions.length>0&&(e.flags.includes("partial")||a===s-1))?()=>E.pick(e.key):void 0,continuing:E.busyKey===e.key},e.key)})}),u&&(0,t.jsxs)(J.f,{type:"button",variant:"outline",size:"sm",onClick:()=>T({key:null,regions:[]}),children:[(0,t.jsx)(c.f,{className:"mr-1 h-4 w-4"}),k.importBatch.addQuestion]}),(0,t.jsx)(em,{ignored:i.ignored,onRestore:e=>r(t=>(function(e,t){let a=e.ignored[t];if(void 0===a||e.items.length>=U.S)return e;let i={key:V(e.items.map(e=>e.key)),label:null,text:a,material:null,section:null,selected:!0,regions:[],hasFigure:!1,flags:[]};return{...e,items:[...e.items,i],ignored:e.ignored.filter((e,a)=>a!==t)}})(t,e))}),(0,t.jsx)(ed,{count:I.length,missingRegions:R,pendingFixes:A,confirmBeforeImport:x,starting:f,onStart:g,onDiscard:y}),u&&z&&(0,t.jsx)(ey,{open:!0,imageUrl:u.url,regions:z.regions,onClose:()=>T(null),onSave:e=>{let t=z.key;r(a=>t?es(a,t,{regions:e,selected:!0}):function(e,t){if(e.items.length>=U.S)return e;let a={key:V(e.items.map(e=>e.key)),label:null,text:"",material:null,section:null,selected:!0,regions:[t],hasFigure:!1,flags:[]};return{...e,items:[...e.items,a]}}(a,e[0])),T(null)}})]})}var eT=e.i(399847),eI=e.i(395925);function eM({batch:e,busy:a,onRetry:i,onDiscard:r}){let{t:s}=(0,h.b)(),n=s.errors,c=e.error?"string"==typeof n[e.error]?n[e.error]:e.error:null;return"splitting"===e.phase?(0,t.jsxs)("section",{className:"flex items-start gap-3 rounded-xl border bg-card p-4",role:"status","data-testid":"batch-splitting",children:[(0,t.jsx)(l.f,{className:"mt-0.5 h-5 w-5 shrink-0 animate-spin text-primary"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 space-y-2",children:[(0,t.jsx)("p",{className:"font-medium",children:s.importBatch.phase.splitting}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:s.importBatch.splittingHint}),(0,t.jsx)(J.f,{type:"button",size:"sm",variant:"ghost",onClick:r,children:s.importBatch.discard})]})]}):(0,t.jsxs)("section",{className:"flex items-start gap-3 rounded-xl border border-destructive/40 bg-card p-4","data-testid":"batch-failed",children:[(0,t.jsx)(eT.f,{className:"mt-0.5 h-5 w-5 shrink-0 text-destructive"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 space-y-2",children:[(0,t.jsx)("p",{className:"font-medium",children:s.importBatch.phase.failed}),c&&(0,t.jsx)("p",{className:"text-sm text-destructive",children:c}),"image"===e.source&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:s.importBatch.manualFallback}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsxs)(J.f,{type:"button",size:"sm",onClick:i,disabled:a,children:[(0,t.jsx)(eI.f,{className:"mr-1 h-4 w-4"}),s.importBatch.retrySplit]}),(0,t.jsx)(J.f,{type:"button",size:"sm",variant:"ghost",onClick:r,children:s.importBatch.discard})]})]})]})}var eR=e.i(551757),e$=e.i(615568),eE=e.i(168148);let eA={analyzing:.5,saving:.9,review:1,saved:1,failed:1};function eF({task:e}){let{t:a}=(0,h.b)(),i=a.importBatch.itemStatus;if("saved"===e.status){let a=e.errorItemId?e.duplicate?i.duplicate:i.saved:i.deleted;return(0,t.jsxs)("span",{className:"flex items-center gap-1 text-green-700 dark:text-green-300",children:[(0,t.jsx)(eR.f,{className:"h-4 w-4"}),a]})}return"failed"===e.status?(0,t.jsxs)("span",{className:"flex items-center gap-1 text-destructive",children:[(0,t.jsx)(eT.f,{className:"h-4 w-4"}),i.failed]}):"review"===e.status?(0,t.jsxs)("span",{className:"flex items-center gap-1 text-primary",children:[(0,t.jsx)(e$.f,{className:"h-4 w-4"}),i.review]}):(0,t.jsxs)("span",{className:"flex items-center gap-1 text-muted-foreground",children:[(0,t.jsx)(l.f,{className:"h-4 w-4 animate-spin"}),i[e.status]]})}function eD({batch:e,image:a,busy:r,onRetryFailed:s,onRetryOne:n,onConfirmAll:l}){let{t:c}=(0,h.b)(),{counts:o}=e,d=o.total-o.active,m=o.total?Math.round(e.tasks.reduce((e,t)=>e+eA[t.status],0)/o.total*100):0,u=new Map((e.draft?.items??[]).map((e,t)=>[e.key,{item:e,index:t}])),x=c.errors;return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("section",{className:"space-y-3 rounded-xl border bg-card p-4","data-testid":"batch-progress","data-phase":e.phase,children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[(0,t.jsx)("p",{className:"text-base font-semibold",children:c.importBatch.progress.replace("{done}",String(d)).replace("{total}",String(o.total))}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:c.importTasks.stageEstimate})]}),(0,t.jsx)(eE.f,{value:m,"aria-label":c.importTasks.stageEstimate,"aria-valuetext":c.common.progress.estimated.replace("{percent}",String(m)),className:"h-2"}),(0,t.jsxs)("ul",{className:"flex flex-wrap gap-x-4 gap-y-1 text-sm","data-testid":"batch-counts",children:[(0,t.jsx)("li",{className:"text-green-700 dark:text-green-300",children:c.importBatch.counts.saved.replace("{count}",String(o.saved-o.duplicate))}),o.duplicate>0&&(0,t.jsx)("li",{className:"text-muted-foreground",children:c.importBatch.counts.duplicate.replace("{count}",String(o.duplicate))}),o.review>0&&(0,t.jsx)("li",{className:"text-primary",children:c.importBatch.counts.review.replace("{count}",String(o.review))}),o.failed>0&&(0,t.jsx)("li",{className:"text-destructive",children:c.importBatch.counts.failed.replace("{count}",String(o.failed))}),o.active>0&&(0,t.jsx)("li",{className:"text-muted-foreground",children:c.importBatch.counts.active.replace("{count}",String(o.active))})]}),o.active>0&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:c.importBatch.leaveHint}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[o.failed>0&&(0,t.jsxs)(J.f,{type:"button",size:"sm",onClick:s,disabled:r,children:[(0,t.jsx)(eI.f,{className:"mr-1 h-4 w-4"}),c.importBatch.retryFailed.replace("{count}",String(o.failed))]}),o.review>0&&(0,t.jsx)(J.f,{type:"button",size:"sm",variant:"outline",onClick:l,disabled:r,children:c.importBatch.confirmAll.replace("{count}",String(o.review))})]})]}),(0,t.jsx)("ol",{className:"space-y-3",children:e.tasks.map(e=>{let s=u.get(e.batchItemKey??""),l=e.error?"string"==typeof x[e.error]?x[e.error]:e.error:null;return(0,t.jsxs)("li",{className:(0,G.f)("flex gap-3 rounded-xl border bg-card p-3 text-sm",e.unread&&"review"===e.status&&"border-primary/50"),"data-testid":"batch-task","data-status":e.status,children:[a&&s&&s.item.regions.length>0&&(0,t.jsx)(Q,{imageUrl:a.url,imageSize:a,regions:s.item.regions,className:"w-20 shrink-0 self-start sm:w-28"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,t.jsx)("span",{className:"font-medium",children:c.importBatch.question.replace("{index}",String((s?.index??0)+1))}),(0,t.jsx)(eF,{task:e})]}),(0,t.jsx)("p",{className:"line-clamp-2 break-words text-muted-foreground",children:e.excerpt||s?.item.text}),"saved"===e.status&&e.errorItemId&&!e.duplicate&&e.notebookName&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:c.importTasks.savedTo.replace("{notebook}",e.notebookName).replace("{id}",e.errorItemShortId||"-")}),l&&"failed"===e.status&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:l}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 pt-1",children:["review"===e.status&&(0,t.jsx)(J.f,{asChild:!0,size:"sm",children:(0,t.jsx)(i.default,{href:`/import-tasks/${e.id}`,children:c.importBatch.review})}),"saved"===e.status&&e.errorItemId&&(0,t.jsx)(J.f,{asChild:!0,size:"sm",variant:"outline",children:(0,t.jsx)(i.default,{href:`/error-items/${e.errorItemId}`,children:c.importBatch.viewItem})}),"failed"===e.status&&(0,t.jsxs)(J.f,{type:"button",size:"sm",variant:"outline",onClick:()=>n(e),disabled:r,children:[(0,t.jsx)(eI.f,{className:"mr-1 h-3 w-3"}),c.importTasks.retry]})]})]})]},e.id)})})]})}var eH=e.i(912505),eU=e.i(393842),eq=e.i(86963),e_=e.i(116331),eL=e.i(35209),eO=e.i(364002);e.s(["default",0,function(){let e=(0,r.useParams)(),n=(0,r.useRouter)(),l=e.id,{t:c}=(0,h.b)();(0,eL.f)(c.importBatch.title);let o=function(e,t={}){let[i,r]=(0,a.useState)(null),[s,n]=(0,a.useState)(!1),[l,c]=(0,a.useState)(null),[o,d]=(0,a.useState)("saved"),m=(0,a.useRef)([]),[u,x]=(0,a.useState)(!1),h=(0,a.useRef)(0),p=(0,a.useRef)(0),f=(0,a.useRef)(0),g=(0,a.useRef)(null),y=(0,a.useRef)(null),b=(0,a.useRef)(null),j=(0,a.useRef)(async()=>!0),[v,k]=(0,a.useState)(null),w=(0,a.useRef)(t.onConflict);(0,a.useEffect)(()=>{w.current=t.onConflict},[t.onConflict]);let N=(0,a.useCallback)((e,t=!1)=>{r(t=>t&&!e.imageData&&t.imageData&&t.id===e.id?{...e,imageData:t.imageData}:e);let a=p.current!==f.current;(t||!a||"draft"!==e.status)&&(null!==g.current&&e.version!==h.current&&(m.current=[],x(!1)),h.current=e.version,g.current=e.draft,c(e.draft),f.current=p.current,d("saved"))},[]),B=(0,a.useCallback)(async()=>{if("u"<typeof document||"hidden"!==document.visibilityState)try{N(await (0,eC.w)(e)),n(!1)}catch(e){e?.status===404&&n(!0)}},[e,N]);(0,a.useEffect)(()=>{let t=!1;(0,eC.w)(e,{image:!0}).then(e=>{t||N(e,!0)}).catch(e=>{t||e?.status!==404||n(!0)});let a=(0,e_.E)(()=>void B());return()=>{t=!0,a()}},[e,N,B]);let C=i?.phase==="splitting"||i?.phase==="processing";(0,a.useEffect)(()=>{if(!C)return;let e=setInterval(()=>void B(),2500);return()=>clearInterval(e)},[C,B]);let S=(0,a.useCallback)(async()=>{let t=p.current;d("saving");try{let a=await (0,eC.S)(e,h.current,g.current);return h.current=a.version,f.current=t,r(e=>e?{...a,imageData:e.imageData}:a),d(p.current===t?"saved":"dirty"),"ok"}catch(t){let e=(0,eC.n)(t);if(e){let t=g.current;return"draft"===e.status&&t&&k(t),N(e,!0),w.current?.(),"conflict"}return d("error"),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>void j.current(),5e3),"error"}},[e,N]),z=(0,a.useCallback)(async()=>{for(b.current&&(clearTimeout(b.current),b.current=null);;){let e=y.current??(y.current=(async()=>{try{for(;p.current!==f.current&&g.current;)if(await S()!=="ok")return!1;return!0}finally{y.current=null}})());if(!await e)return!1;if(p.current===f.current)return!0}},[S]);(0,a.useEffect)(()=>{j.current=z},[z]),(0,a.useEffect)(()=>{let e=()=>{"hidden"===document.visibilityState&&p.current!==f.current&&z()};return document.addEventListener("visibilitychange",e),window.addEventListener("pagehide",e),()=>{document.removeEventListener("visibilitychange",e),window.removeEventListener("pagehide",e)}},[z]),(0,a.useEffect)(()=>()=>{b.current&&clearTimeout(b.current)},[]);let T=(0,a.useCallback)(e=>{g.current=e,c(e),p.current+=1,d("dirty"),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>void z(),800)},[z]),I=(0,a.useRef)(null),M=(0,a.useCallback)((e,t)=>{let a=g.current;if(!a)return;let i=e(a);if(i===a)return;let r=Date.now(),s=t&&I.current?.group===t&&r-I.current.at<1500;I.current=t?{group:t,at:r}:null,s||(m.current=[...m.current.slice(-29),a],x(!0)),T(i)},[T]),R=(0,a.useCallback)(()=>{let e=m.current.pop();I.current=null,x(m.current.length>0),e&&T(e)},[T]),$=(0,a.useCallback)(()=>{k(null),v&&M(()=>v)},[v,M]);return{batch:i,draft:l,notFound:s,saveState:o,refresh:B,save:z,edit:M,undo:R,canUndo:u,conflictCopy:v,restoreConflictCopy:$,dismissConflictCopy:()=>k(null),version:()=>h.current,replace:e=>N(e,!0)}}(l,{onConflict:()=>eN.c.info(c.importBatch.conflict)}),{batch:d,draft:m,notFound:u}=o,x=function(e){let[t,i]=(0,a.useState)(null);return(0,a.useEffect)(()=>{if(!e)return;let t=!1,a=new Image;return a.onload=()=>{t||i({url:e,width:a.naturalWidth,height:a.naturalHeight})},a.src=e,()=>{t=!0}},[e]),t&&t.url===e?t:null}(d?.source==="image"?d.imageData:null),[p,f]=(0,a.useState)(null),[g,y]=(0,a.useState)(null),[b,j]=(0,a.useState)(!1),v=(0,a.useRef)(null);if((0,a.useEffect)(()=>{(0,eO.x)().then(f)},[]),(0,a.useEffect)(()=>{d?.unread&&v.current!==`${d.id}:${d.phase}:${d.counts.active}`&&(v.current=`${d.id}:${d.phase}:${d.counts.active}`,(0,eC.f)(d.id).catch(e=>eB.V.warn("[ImportBatch]","Mark read failed",{error:e})))},[d]),u)return(0,t.jsx)("main",{className:"mx-auto max-w-3xl px-4 py-6 md:px-8 md:py-8",children:(0,t.jsx)(eH.f,{icon:s.f,title:c.importBatch.notFound,action:(0,t.jsx)(i.default,{href:"/import-tasks",children:(0,t.jsx)(J.f,{children:c.importTasks.viewTasks})})})});if(!d||null===p||"image"===d.source&&"draft"===d.status&&!x)return(0,t.jsx)(eq.f,{});let k=async e=>{j(!0);try{await e()}catch(t){let e=(0,eC.n)(t);e?(o.replace(e),eN.c.info(c.importBatch.conflict)):eN.c.error((0,ek.f)(t,c))}finally{j(!1)}},w=async()=>{if(m){y(c.importBatch.submitting);try{let e;if(!await o.save())return;if("image"===d.source){if(!d.imageData)throw Error("IMAGE_EMPTY");let t=await (0,ew.y)(d.imageData),a=m.items.filter(e=>e.selected&&K(e,"image"));e=[];let i=0;for(let r of a){y(c.importBatch.cropping.replace("{done}",String(e.length+1)).replace("{total}",String(a.length)));let s=await (0,ew.M)(t,r.regions);i+=s.bytes,e.push({key:r.key,imageBase64:s.dataUrl,imageInfo:{outputWidth:s.width,outputHeight:s.height,outputBytes:s.bytes,quality:s.quality}})}if(e.reduce((e,t)=>e+t.imageBase64.length,0)>0x3c00000)return void eN.c.error(c.errors.IMPORT_BATCH_TOO_LARGE);y(c.importBatch.uploadingImages.replace("{count}",String(e.length)).replace("{size}",`${(i/1024/1024).toFixed(1)}MB`))}o.replace(await (0,eC.g)(d.id,o.version(),e)),window.scrollTo({top:0})}catch(t){eB.V.error("[ImportBatch]","Start failed",{error:t});let e=(0,eC.n)(t);e?(o.replace(e),eN.c.info(c.importBatch.conflict)):eN.c.error((0,ek.f)(t,c))}finally{y(null)}}},N=async()=>{await (0,eN.u)(c.importBatch.discardConfirm)&&await k(async()=>{await (0,eC.o)(d.id),eN.c.success(c.importBatch.discarded),n.push("/import-tasks")})},B=()=>k(async()=>{o.replace(await (0,eC.s)(d.id)),eN.c.info(c.importTasks.retried)}),C=`${c.importBatch.source[d.source]} \xb7 ${c.importBatch.phase[d.phase]}`;return(0,t.jsxs)("main",{className:"mx-auto max-w-4xl space-y-4 px-4 py-6 md:px-8 md:py-8",children:[(0,t.jsx)(eU.f,{backHref:"/import-tasks",title:c.importBatch.title,description:C}),"splitting"===d.phase||"failed"===d.phase?(0,t.jsx)(eM,{batch:d,busy:b,onRetry:B,onDiscard:N}):"draft"===d.status&&m?(0,t.jsx)(ez,{batch:d,draft:m,onEdit:o.edit,onUndo:o.undo,canUndo:o.canUndo,saveState:o.saveState,image:x,confirmBeforeImport:p,starting:g,onStart:w,onDiscard:N,hasConflictCopy:!!o.conflictCopy,onRestoreConflict:o.restoreConflictCopy,onDismissConflict:o.dismissConflictCopy}):(0,t.jsx)(eD,{batch:d,image:x,busy:b,onRetryFailed:B,onRetryOne:e=>k(async()=>{await (0,e_.R)(e.id),eN.c.info(c.importTasks.retried),await o.refresh()}),onConfirmAll:()=>k(async()=>{let e=await (0,eC.J)(d.id);o.replace(e.batch),eN.c.success(c.importBatch.confirmAllDone.replace("{count}",String(e.saved)))})})]})}],864272)}]);