wrong-notebook 2026.11.1 → 2026.11.2-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.
- package/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +1 -0
- package/.next/build-manifest.json +3 -3
- package/.next/prerender-manifest.json +3 -3
- package/.next/routes-manifest.json +6 -0
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/admin/page.js.nft.json +1 -1
- package/.next/server/app/admin/page_client-reference-manifest.js +1 -1
- package/.next/server/app/admin/user/[id]/page.js.nft.json +1 -1
- package/.next/server/app/admin/user/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/api/admin/cnm-tags/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/admin/cnm-tags/route/build-manifest.json +12 -0
- package/.next/server/app/api/admin/cnm-tags/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/admin/cnm-tags/route.js +12 -0
- package/.next/server/app/api/admin/cnm-tags/route.js.map +5 -0
- package/.next/server/app/api/admin/cnm-tags/route.js.nft.json +1 -0
- package/.next/server/app/api/admin/cnm-tags/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/admin/dashboard/route.js +10 -10
- package/.next/server/app/api/admin/dashboard/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/debug-logs/export/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/debug-logs/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/migrate-tags/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/system-reset/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/users/[id]/detail/route.js +10 -10
- package/.next/server/app/api/admin/users/[id]/detail/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/users/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/users/route.js.nft.json +1 -1
- package/.next/server/app/api/ai/models/route.js +4 -4
- package/.next/server/app/api/ai/models/route.js.nft.json +1 -1
- package/.next/server/app/api/ai/test/route.js +8 -8
- package/.next/server/app/api/ai/test/route.js.nft.json +1 -1
- package/.next/server/app/api/analytics/route.js +8 -8
- package/.next/server/app/api/analytics/route.js.nft.json +1 -1
- package/.next/server/app/api/analyze/route.js +4 -4
- package/.next/server/app/api/analyze/route.js.nft.json +1 -1
- package/.next/server/app/api/auth/[...nextauth]/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/delete/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/figure/route.js +10 -10
- package/.next/server/app/api/error-items/[id]/figure/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/fix-latex/route.js +7 -7
- package/.next/server/app/api/error-items/[id]/fix-latex/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/geogebra/route.js +13 -13
- package/.next/server/app/api/error-items/[id]/geogebra/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/image/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/notes/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/practice-records/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/reanswer/route.js +10 -10
- package/.next/server/app/api/error-items/[id]/reanswer/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/retag/route.js +9 -9
- package/.next/server/app/api/error-items/[id]/retag/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/svg-animation/narration/route.js +10 -10
- package/.next/server/app/api/error-items/[id]/svg-animation/narration/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/svg-animation/route.js +10 -10
- package/.next/server/app/api/error-items/[id]/svg-animation/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/batch-delete/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/clear/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/list/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/route.js +11 -11
- package/.next/server/app/api/error-items/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/short/[shortId]/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/similarity/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/questions/[questionId]/regenerate/route.js +13 -13
- package/.next/server/app/api/exams/[id]/questions/[questionId]/regenerate/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/results/route.js +10 -10
- package/.next/server/app/api/exams/[id]/results/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/retry/route.js +9 -9
- package/.next/server/app/api/exams/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/route.js +13 -13
- package/.next/server/app/api/exams/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/route.js +12 -12
- package/.next/server/app/api/exams/route.js.nft.json +1 -1
- package/.next/server/app/api/export/route.js.nft.json +1 -1
- package/.next/server/app/api/geogebra-analyze/route.js +6 -6
- package/.next/server/app/api/geogebra-analyze/route.js.nft.json +1 -1
- package/.next/server/app/api/health/route.js.nft.json +1 -1
- package/.next/server/app/api/import/route.js +13 -13
- package/.next/server/app/api/import/route.js.nft.json +1 -1
- package/.next/server/app/api/initialize/route.js.nft.json +1 -1
- package/.next/server/app/api/logs/frontend/route.js.nft.json +1 -1
- package/.next/server/app/api/minimax-code/checkin/route.js.nft.json +1 -1
- package/.next/server/app/api/minimax-code/login/route.js.nft.json +1 -1
- package/.next/server/app/api/minimax-code/route.js.nft.json +1 -1
- package/.next/server/app/api/notebooks/[id]/retag/route.js +12 -12
- package/.next/server/app/api/notebooks/[id]/retag/route.js.nft.json +1 -1
- package/.next/server/app/api/notebooks/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/notebooks/route.js.nft.json +1 -1
- package/.next/server/app/api/openclaw/batch-upload/route.js +8 -8
- package/.next/server/app/api/openclaw/batch-upload/route.js.nft.json +1 -1
- package/.next/server/app/api/paper-groups/[id]/route.js +1 -1
- package/.next/server/app/api/paper-groups/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/paper-groups/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/generate/route.js +9 -9
- package/.next/server/app/api/practice/generate/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/grade/route.js +6 -6
- package/.next/server/app/api/practice/grade/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/record/[id]/route.js +10 -10
- package/.next/server/app/api/practice/record/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/record/route.js +10 -10
- package/.next/server/app/api/practice/record/route.js.nft.json +1 -1
- package/.next/server/app/api/reanswer/route.js +4 -4
- package/.next/server/app/api/reanswer/route.js.nft.json +1 -1
- package/.next/server/app/api/register/route.js.nft.json +1 -1
- package/.next/server/app/api/register/status/route.js.nft.json +1 -1
- package/.next/server/app/api/requests/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/review/due/route.js +8 -8
- package/.next/server/app/api/review/due/route.js.nft.json +1 -1
- package/.next/server/app/api/settings/route.js.nft.json +1 -1
- package/.next/server/app/api/setup/route.js.nft.json +1 -1
- package/.next/server/app/api/stats/practice/clear/route.js.nft.json +1 -1
- package/.next/server/app/api/stats/practice/route.js.nft.json +1 -1
- package/.next/server/app/api/tags/route.js.nft.json +1 -1
- package/.next/server/app/api/tags/stats/route.js.nft.json +1 -1
- package/.next/server/app/api/tags/suggestions/route.js.nft.json +1 -1
- package/.next/server/app/api/tasks/route.js.nft.json +1 -1
- package/.next/server/app/api/tts/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/tts/batch/route.js +6 -6
- package/.next/server/app/api/tts/batch/route.js.nft.json +1 -1
- package/.next/server/app/api/tts/route.js +5 -5
- package/.next/server/app/api/tts/route.js.nft.json +1 -1
- package/.next/server/app/api/tts/status/route.js +4 -4
- package/.next/server/app/api/tts/status/route.js.nft.json +1 -1
- package/.next/server/app/api/user/route.js +9 -9
- package/.next/server/app/api/user/route.js.nft.json +1 -1
- package/.next/server/app/api/version/route.js.nft.json +1 -1
- package/.next/server/app/error-items/[id]/page.js.nft.json +1 -1
- package/.next/server/app/error-items/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/exams/[id]/page.js.nft.json +1 -1
- package/.next/server/app/exams/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/exams/[id]/print/page.js.nft.json +1 -1
- package/.next/server/app/exams/[id]/print/page_client-reference-manifest.js +1 -1
- package/.next/server/app/exams/page.js.nft.json +1 -1
- package/.next/server/app/exams/page_client-reference-manifest.js +1 -1
- package/.next/server/app/initialize/page.js.nft.json +1 -1
- package/.next/server/app/initialize/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login/page.js.nft.json +1 -1
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/notebooks/[id]/add/page.js.nft.json +1 -1
- package/.next/server/app/notebooks/[id]/add/page_client-reference-manifest.js +1 -1
- package/.next/server/app/notebooks/[id]/page.js.nft.json +1 -1
- package/.next/server/app/notebooks/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/notebooks/page.js.nft.json +1 -1
- package/.next/server/app/notebooks/page_client-reference-manifest.js +1 -1
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/practice/page.js.nft.json +1 -1
- package/.next/server/app/practice/page_client-reference-manifest.js +1 -1
- package/.next/server/app/print-preview/page.js.nft.json +1 -1
- package/.next/server/app/print-preview/page_client-reference-manifest.js +1 -1
- package/.next/server/app/register/page.js.nft.json +1 -1
- package/.next/server/app/register/page_client-reference-manifest.js +1 -1
- package/.next/server/app/review/page.js.nft.json +1 -1
- package/.next/server/app/review/page_client-reference-manifest.js +1 -1
- package/.next/server/app/setup/page.js.nft.json +1 -1
- package/.next/server/app/setup/page_client-reference-manifest.js +1 -1
- package/.next/server/app/stats/page.js.nft.json +1 -1
- package/.next/server/app/stats/page_client-reference-manifest.js +1 -1
- package/.next/server/app/tags/page.js.nft.json +1 -1
- package/.next/server/app/tags/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +1 -0
- package/.next/server/chunks/[root-of-the-server]__02dkbynj2vxld._.js +1 -1
- package/.next/server/chunks/{[root-of-the-server]__0z24ffpp1rsf3._.js → [root-of-the-server]__08t21dbk1cidn._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__09jqnx_673l93._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0_uvtfu0yr-na._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0nujsu6qbn-8o._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0tflqqgyujt1r._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__13_k7w8nrx7ie._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__18z_cczwqkonn._.js +1 -1
- package/.next/server/chunks/{[root-of-the-server]__0rpqerm37sl_v._.js → [root-of-the-server]__1f_lrxzw_n-6-._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__1ptzu7aqoga2n._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1r0s6pktkiqkf._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1r_x7moz0opqt._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__1mfrik5p09lu9._.js → [root-of-the-server]__1sggr1m3ukvts._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__1v1p83o4ygnyt._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1wh65tfd7apxx._.js +3 -0
- package/.next/server/chunks/_0dicq393_0h3i._.js +3 -0
- package/.next/server/chunks/{_0jgk7kwvf4_6i._.js → _0x3jdlmx-bey5._.js} +1 -1
- package/.next/server/chunks/_10tpt8iizl4v3._.js +3 -3
- package/.next/server/chunks/_1dvka-waihfum._.js +3 -3
- package/.next/server/chunks/_1yujnc0thk8ab._.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_admin_cnm-tags_route_actions_1en5m631bmjfo.js +3 -0
- package/.next/server/chunks/src_lib_0r67kyyoh6ky6._.js +1 -1
- package/.next/server/chunks/src_lib_1_m3-y2t3e4xi._.js +46 -42
- package/.next/server/chunks/src_lib_1geq39r7va9gy._.js +1 -1
- package/.next/server/chunks/src_lib_logger_ts_1a0ve505bb0y2._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0fy6mc47ccfce._.js +1 -1
- package/.next/server/chunks/ssr/_02zfjls23g-o4._.js +1 -1
- package/.next/server/chunks/ssr/_09y2uhjubswp4._.js +1 -1
- package/.next/server/chunks/ssr/_0cmd1ubdlo_by._.js +1 -1
- package/.next/server/chunks/ssr/_0ltqx22v65imo._.js +1 -1
- package/.next/server/chunks/ssr/_0lzeodofsq9pe._.js +1 -1
- package/.next/server/chunks/ssr/_0ozptnii2nxuw._.js +1 -1
- package/.next/server/chunks/ssr/_0rd-teluypcd2._.js +1 -1
- package/.next/server/chunks/ssr/_0tr-7klbcz1r7._.js +3 -0
- package/.next/server/chunks/ssr/_0xsd7dy2sxg53._.js +3 -0
- package/.next/server/chunks/ssr/_1-i5cy964i_s9._.js +3 -0
- package/.next/server/chunks/ssr/_12toteu0ut39i._.js +3 -0
- package/.next/server/chunks/ssr/_1cc3psc9rvrwn._.js +1 -1
- package/.next/server/chunks/ssr/_1qgg_ll5hkjaf._.js +2 -2
- package/.next/server/chunks/ssr/_1ux6eqqkupo6v._.js +2 -2
- package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_icons_play_mjs_1al5hft92dlrg._.js +1 -1
- package/.next/server/chunks/ssr/src_1gayunqs8u2e2._.js +1 -1
- package/.next/server/chunks/ssr/src_app_admin_page_tsx_0ublbd0w90cx_._.js +1 -1
- package/.next/server/chunks/ssr/src_app_admin_user_[id]_page_tsx_0zidp-8hr5upa._.js +1 -1
- package/.next/server/chunks/ssr/src_app_error-items_[id]_page_tsx_04xwwdmyh7_9q._.js +1 -1
- package/.next/server/chunks/ssr/src_app_exams_[id]_page_tsx_0xcjflkgkwzgd._.js +1 -1
- package/.next/server/chunks/ssr/src_app_exams_[id]_print_page_tsx_1i-xvhk8ul1l1._.js +9 -9
- package/.next/server/chunks/ssr/src_app_exams_page_tsx_17_d4_gy2i1ds._.js +1 -1
- package/.next/server/chunks/ssr/src_app_notebooks_[id]_add_page_tsx_179tow1ql6vc_._.js +1 -1
- package/.next/server/chunks/ssr/src_app_notebooks_[id]_page_tsx_08njm-5-txm8_._.js +1 -1
- package/.next/server/chunks/ssr/src_app_notebooks_page_tsx_1p9src5gnz_40._.js +1 -1
- package/.next/server/chunks/ssr/src_app_page_tsx_1chiuahujsxm1._.js +1 -1
- package/.next/server/chunks/ssr/src_app_practice_page_tsx_10gnx53v3kpzb._.js +1 -1
- package/.next/server/chunks/ssr/src_app_print-preview_page_tsx_001yt-fzrj7tf._.js +1 -1
- package/.next/server/chunks/ssr/src_app_register_page_tsx_0l87b3754fa2j._.js +1 -1
- package/.next/server/chunks/ssr/src_app_review_page_tsx_1rq4ygvo_szv0._.js +1 -1
- package/.next/server/chunks/ssr/src_app_setup_page_tsx_0szlnxow_9skp._.js +1 -1
- package/.next/server/chunks/ssr/src_components_1od0rowgu8w6v._.js +1 -1
- package/.next/server/chunks/ssr/src_components_create-notebook-dialog_tsx_0c5teagim70r7._.js +1 -1
- package/.next/server/chunks/ssr/src_components_mastery-panel_tsx_1--j5c7mhomdp._.js +1 -1
- package/.next/server/chunks/ssr/src_components_print-preview_answer-space-control_tsx_02kuswyxklzp_._.js +33 -0
- package/.next/server/chunks/ssr/src_components_providers_tsx_09kw-mv3nb6xs._.js +73 -17
- package/.next/server/chunks/ssr/src_components_tag-input_tsx_0b9sxffna5c9i._.js +1 -1
- package/.next/server/chunks/ssr/src_lib_api-client_ts_04r2_ex-gua5i._.js +1 -1
- package/.next/server/chunks/ssr/src_lib_short-id-client_ts_1v7n6pg50kguj._.js +1 -1
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/pages/500.html +1 -1
- package/.next/server/preview-props.json +3 -3
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/{42p60iwe4ayfi.js → 06bfusm1eqhzt.js} +1 -1
- package/.next/static/chunks/{1oqx_8e83xfjr.js → 0fu1xttg42yzk.js} +1 -1
- package/.next/static/chunks/{1wq7na8axxyfd.js → 0nq5_ne_bugdp.js} +1 -1
- package/.next/static/chunks/0xuzdy0dn7jkp.js +63 -0
- package/.next/static/chunks/{1dyf1qqv2ckxs.js → 1-00icoq9w3_i.js} +1 -1
- package/.next/static/chunks/{2r4x8vhlmc092.js → 1b5jj8zk0mtzk.js} +1 -1
- package/.next/static/chunks/{3fohh6i-hrda9.js → 1d-3q230sjpsa.js} +1 -1
- package/.next/static/chunks/{1gvev34tv39bd.js → 1fa2xv93zl8oj.js} +1 -1
- package/.next/static/chunks/{370c45nip4mld.js → 1g13qcek7-0du.js} +1 -1
- package/.next/static/chunks/1iixgyplm7q17.js +247 -0
- package/.next/static/chunks/{10xs8eu3rd2lt.js → 1ou17klnb8gu_.js} +1 -1
- package/.next/static/chunks/{1sjf69friyuwh.js → 1pdlii0oox0-7.js} +1 -1
- package/.next/static/chunks/{26-0j9v7hswqr.js → 1rzk5q74nsv73.js} +1 -1
- package/.next/static/chunks/{25emavlvjqnb_.js → 1sisl9ld-ag-o.js} +2 -2
- package/.next/static/chunks/{2hihgd7vu8tw5.js → 1z_0hbg6kxv58.js} +1 -1
- package/.next/static/chunks/{41j6vve1unchm.js → 2cfz0fumc6ghe.js} +1 -1
- package/.next/static/chunks/2dml0yrklxocr.js +31 -0
- package/.next/static/chunks/{2p9s6dcxnj129.js → 2e0fqyqddz02g.js} +1 -1
- package/.next/static/chunks/{2qvnb2d_gv2o5.js → 2huy9i-dnxshq.js} +1 -1
- package/.next/static/chunks/{2h1-bjeib7r-u.js → 2mu8zu6zd59z2.js} +1 -1
- package/.next/static/chunks/{09z8ds-9g-ble.js → 2urhwgx3nt7lq.js} +1 -1
- package/.next/static/chunks/{1c36uw_9rc8oc.js → 2xibor-sxcc67.js} +1 -1
- package/.next/static/chunks/3-7dqhvzmyl4y.css +3 -0
- package/.next/static/chunks/{31pvc0nv10j93.js → 3-w46lg1a_qse.js} +1 -1
- package/.next/static/chunks/{0zj83pnid72u3.js → 34lp-hkkywd8r.js} +1 -1
- package/.next/static/chunks/37d6vrdascsro.js +1 -0
- package/.next/static/chunks/{0lwd5-772ng4i.js → 3difxy8vzqlxn.js} +1 -1
- package/.next/static/chunks/3zs0fu6zcu0lb.js +1 -0
- package/dist-scripts/src/lib/debug-log.js +6 -6
- package/package.json +1 -1
- package/prisma/seed.db +0 -0
- package/.next/server/chunks/ssr/_037_l3ca0s_0m._.js +0 -3
- package/.next/server/chunks/ssr/_0_snnfou-vj50._.js +0 -3
- package/.next/server/chunks/ssr/_19-9r85m2zwkm._.js +0 -3
- package/.next/server/chunks/ssr/_1b5bo2mgv9_4a._.js +0 -3
- package/.next/static/chunks/0i1q2hqzk7ojc.css +0 -3
- package/.next/static/chunks/24mest-vas-bu.js +0 -33
- package/.next/static/chunks/2ju2bi0z49pn1.js +0 -1
- package/.next/static/chunks/2rx6yjo9suvmj.js +0 -1
- package/.next/static/chunks/2zgqd5dt_6z_7.js +0 -1
- package/.next/static/chunks/3cyz6w014ooxj.js +0 -191
- /package/.next/static/{6sBeEDpD-TPpDMfiFpz9K → RjcLZuifR9iENqJ77CSYI}/_buildManifest.js +0 -0
- /package/.next/static/{6sBeEDpD-TPpDMfiFpz9K → RjcLZuifR9iENqJ77CSYI}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{6sBeEDpD-TPpDMfiFpz9K → RjcLZuifR9iENqJ77CSYI}/_ssgManifest.js +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,518515,e=>{var t=e.i(456420);let r={name:"camera",size:24,node:[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]};r.node;let a=(0,t.f)(r);e.s(["f",0,a],518515)},325597,7891,e=>{var t=e.i(456420);let r={name:"pen-line",size:24,node:[["path",{d:"M13 21h8",key:"1jsn5i"}],["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"}]],aliases:["edit-3"]};r.node;let a=(0,t.f)(r);e.s(["f",0,a],7891),e.s(["f",0,a],325597)},747819,364002,866531,430634,e=>{var t=e.i(843476),r=e.i(271645),a=e.i(522016),s=e.i(548161),n=e.i(632781),i=e.i(395925),l=e.i(583967),o=e.i(519455),c=e.i(515288),d=e.i(111110),u=e.i(201276),m=e.i(41931),f=e.i(28928);async function p(){try{return!!(await m.f.get("/api/user")).confirmBeforeImport}catch{return!1}}async function g(e,t){let r=await m.f.post("/api/analyze",{imageBase64:e,language:t.language,subjectId:t.subjectId||void 0},{timeout:t.timeout,recoverable:!0});if(!r||"object"!=typeof r)throw Error("Invalid API response: data is null or not an object");return r}async function h(e,t){let r=await m.f.post("/api/error-items",{questionText:e.questionText,answerText:e.answerText,analysis:e.analysis,wrongAnswerText:e.wrongAnswerText||null,mistakeAnalysis:e.mistakeAnalysis||null,mistakeStatus:e.mistakeStatus||"unknown",knowledgePoints:e.knowledgePoints||[],difficultyStars:e.difficultyStars??null,recognizedGradeSemester:e.gradeSemester??null,hasFigure:e.hasFigure??!1,figureSvg:e.figureSvg??null,subjectId:t.subjectId||void 0,subjectName:t.subjectId?void 0:e.subject,originalImageUrl:t.imageUrl||"",paperLevel:t.paperLevel||void 0});return{id:r.id,shortId:r.shortId??null,subjectId:r.subjectId??null,notebookName:r.subject?.name??null,duplicate:r.duplicate}}async function x(e,t){let r=await (0,f.f)(e instanceof File?e:new File([e],"question.jpg",{type:e.type||"image/jpeg"}));t.onStage?.("analyzing");let a=await g(r,t);return t.onStage?.("saving"),h(a,{subjectId:t.subjectId,imageUrl:r,paperLevel:t.paperLevel})}function v({item:e}){let{t:r}=(0,d.b)(),a=r.batchImport.status[e.status];return"success"===e.status?(0,t.jsxs)("span",{className:"flex items-start gap-1 text-green-700 dark:text-green-300",children:[(0,t.jsx)(s.f,{className:"h-4 w-4 shrink-0 mt-0.5"}),e.imported?.duplicate?r.importFlow.duplicate:a]}):"failed"===e.status?(0,t.jsxs)("span",{className:"flex items-center gap-1 text-destructive",children:[(0,t.jsx)(l.f,{className:"h-4 w-4"}),a]}):(0,t.jsxs)("span",{className:"flex items-center gap-1 text-muted-foreground",children:["pending"!==e.status&&(0,t.jsx)(n.f,{className:"h-4 w-4 animate-spin"}),a]})}function y({blob:e}){let a=(0,r.useRef)(null);return(0,r.useEffect)(()=>{let t=URL.createObjectURL(e);return a.current&&(a.current.src=t),()=>URL.revokeObjectURL(t)},[e]),(0,t.jsx)("img",{ref:a,alt:"",className:"h-20 w-20 shrink-0 rounded object-contain bg-muted"})}e.s(["x",0,p,"w",0,x,"a",0,h],364002),e.s(["f",0,function({blobs:e,subjectId:s,timeout:n,onClose:l}){let{t:m,language:f}=(0,d.b)(),[p,g]=(0,r.useState)(()=>e.map(()=>({status:"pending"}))),h=(0,r.useRef)(!1),w=(0,r.useCallback)((e,t)=>{g(r=>r.map((r,a)=>a===e?{...r,...t}:r))},[]),j=(0,r.useCallback)(async t=>{w(t,{status:"analyzing",error:void 0});try{let r=await x(e[t],{language:f,subjectId:s,timeout:n,onStage:e=>w(t,{status:e})});w(t,{status:"success",imported:r})}catch(s){let e=s?.data,r=e?.message||(s instanceof Error?s.message:String(s)),a=m.errors[r];w(t,{status:"failed",error:"string"==typeof a?a:r}),u.V.error("[BatchImport]","Question import failed",{index:t,error:r})}},[e,f,s,n,m.errors,w]),b=(0,r.useCallback)(async e=>{let t=[...e],r=async()=>{for(;t.length>0;)await j(t.shift())};await Promise.all(Array.from({length:Math.min(3,t.length)},r))},[j]);(0,r.useEffect)(()=>{h.current||(h.current=!0,b(e.map((e,t)=>t)))},[e,b]);let k=p.filter(e=>"success"===e.status).length,N=p.flatMap((e,t)=>"failed"===e.status?[t]:[]),S=p.some(e=>"pending"===e.status||"analyzing"===e.status||"saving"===e.status);return(0,t.jsxs)(c.N,{children:[(0,t.jsxs)(c.Y,{className:"flex flex-row items-center justify-between gap-2 space-y-0",children:[(0,t.jsx)(c.v,{className:"text-base",children:m.batchImport.title}),(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:m.batchImport.summary.replace("{done}",String(k)).replace("{total}",String(p.length)).replace("{failed}",String(N.length))})]}),(0,t.jsxs)(c.O,{className:"space-y-4",children:[(0,t.jsx)("ul",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:p.map((r,s)=>(0,t.jsxs)("li",{className:"flex gap-3 rounded-lg border p-3",children:[(0,t.jsx)(y,{blob:e[s]}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 space-y-1 text-sm",children:[(0,t.jsx)("div",{className:"font-medium",children:m.batchImport.question.replace("{index}",String(s+1))}),(0,t.jsx)(v,{item:r}),"success"===r.status&&r.imported&&(0,t.jsxs)(a.default,{href:`/error-items/${r.imported.id}`,className:"block truncate text-xs text-primary hover:underline",children:[r.imported.notebookName," · ",r.imported.shortId]}),"failed"===r.status&&(0,t.jsxs)(t.Fragment,{children:[r.error&&(0,t.jsx)("p",{className:"line-clamp-2 text-xs text-destructive",children:r.error}),(0,t.jsxs)(o.f,{size:"sm",variant:"outline",className:"h-7",onClick:()=>j(s),children:[(0,t.jsx)(i.f,{className:"mr-1 h-3 w-3"}),m.batchImport.retry]})]})]})]},s))}),(0,t.jsxs)("div",{className:"flex flex-col-reverse sm:flex-row sm:justify-end gap-2",children:[N.length>1&&!S&&(0,t.jsxs)(o.f,{variant:"outline",onClick:()=>b(N),children:[(0,t.jsx)(i.f,{className:"mr-2 h-4 w-4"}),m.batchImport.retryFailed]}),(0,t.jsx)(o.f,{onClick:l,disabled:S,children:m.batchImport.finish})]})]})]})}],747819);var w=e.i(741120),j=e.i(856522),b=e.i(314381),k=e.i(3198),N=e.i(294114);function S({data:e,onChange:a}){let{t:s}=(0,d.b)(),[i,l]=(0,r.useState)(!1),[c,f]=(0,r.useState)(null),p=async()=>{if(!e.questionText.trim())return void N.c.warning(s.editor.enterQuestionFirst||"Please enter question text first");if(!e.answerText.trim())return void N.c.warning(s.geogebra.answerRequired);l(!0),f(null);try{let t=await m.f.post("/api/geogebra-analyze",{questionText:e.questionText,answerText:e.answerText,analysis:e.analysis},{timeout:18e4,recoverable:!0});t.suitable&&t.commands&&t.commands.length>0?a({geogebraCommands:JSON.stringify(t.commands)}):f(t.description||s.geogebra.notSuitable)}catch(e){u.V.error("[CorrectionEditor]","GeoGebra analysis failed",{error:e}),f(s.geogebra.analyzeFailed)}finally{l(!1)}};return e.geogebraCommands?(0,t.jsx)(k.f,{commands:e.geogebraCommands,height:350,onRegenerate:p,onDelete:async()=>a({geogebraCommands:void 0})}):e.questionText.trim()&&e.answerText.trim()?(0,t.jsxs)("div",{className:"rounded-lg border border-dashed p-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(b.f,{className:"h-4 w-4"}),(0,t.jsx)("span",{children:s.geogebra.title})]}),(0,t.jsx)(o.f,{variant:"outline",size:"sm",onClick:p,disabled:i,children:i?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.f,{className:"mr-2 h-4 w-4 animate-spin"}),s.geogebra.analyzing]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(b.f,{className:"mr-2 h-4 w-4"}),s.geogebra.generate]})})]}),c&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-2",children:c}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-2",children:s.geogebra.hint})]}):null}var A=e.i(469937),D=e.i(28342),E=e.i(438465),T=e.i(674166),C=e.i(110204);function I({data:e,paperLevel:r,onChange:a}){let{t:s}=(0,d.b)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:s.editor.selectNotebook||"Select Notebook"}),(0,t.jsx)(E.f,{value:e.subjectId,onChange:e=>a({subjectId:e})})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{htmlFor:"correction-grade-semester",children:s.editor.gradeSemester||"Grade/Semester"}),(0,t.jsx)(D.f,{id:"correction-grade-semester",value:e.gradeSemester||"",onChange:e=>a({gradeSemester:e})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:s.editor.paperLevel||"Paper Level"}),(0,t.jsx)(T.f,{value:r,onChange:e=>a({paperLevel:e})})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:s.difficulty.label}),(0,t.jsx)("div",{children:(0,t.jsx)(A.f,{size:"md",value:e.difficultyStars,onChange:e=>a({difficultyStars:e})})})]})]})}var F=e.i(141176),P=e.i(967489);function R({data:e,onChange:r}){let{t:a}=(0,d.b)();return(0,t.jsxs)(c.N,{children:[(0,t.jsx)(c.Y,{children:(0,t.jsx)(c.v,{children:a.editor.mistakeAnalysisTitle||"Mistake Analysis"})}),(0,t.jsxs)(c.O,{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:a.editor.mistakeStatus||"Attempt Status"}),(0,t.jsxs)(P.d,{value:e.mistakeStatus||"unknown",onValueChange:e=>r({mistakeStatus:e}),children:[(0,t.jsx)(P.P,{children:(0,t.jsx)(P.U,{})}),(0,t.jsxs)(P.r,{children:[(0,t.jsx)(P.T,{value:"not_attempted",children:a.editor.mistakeStatuses?.notAttempted||"Not attempted"}),(0,t.jsx)(P.T,{value:"wrong_attempt",children:a.editor.mistakeStatuses?.wrongAttempt||"Wrong attempt"}),(0,t.jsx)(P.T,{value:"unknown",children:a.editor.mistakeStatuses?.unknown||"Unknown"})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:a.editor.wrongAnswerText||"Wrong Answer / Work"}),(0,t.jsx)(F.f,{value:e.wrongAnswerText||"",onChange:t=>r({wrongAnswerText:t,mistakeStatus:t.trim()?"wrong_attempt":e.mistakeStatus}),className:"min-h-[100px] font-mono text-sm",placeholder:a.editor.wrongAnswerPlaceholder||"Leave blank if no wrong answer is visible"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:a.editor.mistakeAnalysis||"Mistake Cause Analysis"}),(0,t.jsx)(F.f,{value:e.mistakeAnalysis||"",onChange:e=>r({mistakeAnalysis:e}),className:"min-h-[140px] font-mono text-sm",placeholder:a.editor.mistakeAnalysisPlaceholder||"Explain where and why the mistake happened"})]})]})]})}var O=e.i(511445),M=e.i(149704);function z({title:e,children:r,className:a}){return(0,t.jsxs)(c.N,{children:[(0,t.jsx)(c.Y,{children:(0,t.jsx)(c.v,{children:e})}),(0,t.jsx)(c.O,{className:a,children:r})]})}function L({data:e,children:r}){let{t:a}=(0,d.b)(),s={wrong_attempt:a.editor.mistakeStatuses?.wrongAttempt||"Wrong attempt",not_attempted:a.editor.mistakeStatuses?.notAttempted||"Not attempted",unknown:a.editor.mistakeStatuses?.unknown||"Unknown"};return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)(z,{title:a.editor.preview?.question||"Question Preview",children:[(0,t.jsx)(O.f,{content:e.questionText}),(0,t.jsx)(M.f,{svg:e.figureSvg})]}),r,(0,t.jsx)(z,{title:a.editor.preview?.answer||"Answer Preview",children:(0,t.jsx)(O.f,{content:e.answerText})}),(0,t.jsx)(z,{title:a.editor.preview?.analysis||"Analysis Preview",children:(0,t.jsx)(O.f,{content:e.analysis})}),(0,t.jsxs)(z,{title:a.editor.preview?.mistakeAnalysis||"Mistake Analysis Preview",className:"space-y-3 text-sm",children:[(0,t.jsxs)("div",{className:"text-muted-foreground",children:[a.editor.mistakeStatus||"Attempt Status",a.common.colon,s[e.mistakeStatus]??s.unknown]}),e.wrongAnswerText&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"font-medium mb-1",children:a.editor.wrongAnswerText||"Wrong Answer / Work"}),(0,t.jsx)(O.f,{content:e.wrongAnswerText})]}),e.mistakeAnalysis&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"font-medium mb-1",children:a.editor.mistakeAnalysis||"Mistake Cause Analysis"}),(0,t.jsx)(O.f,{content:e.mistakeAnalysis})]})]})]})}var $=e.i(574041),G=e.i(215519),U=e.i(306831);e.i(676167);var _=e.i(952122),q=e.i(62825),V=e.i(664030),B=e.i(303163);e.s(["f",0,function({initialData:e,onSave:a,onCancel:s,imagePreview:i,initialSubjectId:l,aiTimeout:f}){let{timeZone:p}=(0,G.M)(),{t:g,language:h}=(0,d.b)(),[x,v]=(0,r.useState)({...e,wrongAnswerText:e.wrongAnswerText||"",mistakeAnalysis:e.mistakeAnalysis||"",mistakeStatus:e.mistakeStatus||"unknown",subjectId:l,gradeSemester:e.gradeSemester||""}),y=(0,r.useRef)(!1),b=e=>{"gradeSemester"in e&&(y.current=!0),v(t=>({...t,...e}))},{groups:k}=(0,V.f)(),A=(()=>{if(x.paperLevel)return x.paperLevel;let e="number"==typeof x.difficultyStars&&x.difficultyStars>=4?"b":"a";return k.find(t=>t.key===e&&t.isActive)?.id||""})(),D=x.paperLevel??A,[E,T]=(0,r.useState)(!1),[P,O]=(0,r.useState)(!1),[M,z]=(0,r.useState)(!1),[H,W]=(0,r.useState)(void 0),[Z,J]=(0,r.useState)([]);(0,r.useEffect)(()=>{m.f.get("/api/notebooks").then(J).catch(e=>u.V.error("[CorrectionEditor]","Failed to fetch notebooks",{error:e})),m.f.get("/api/user").then(e=>{if(z(!!e?.enableGeogebra),e){let t=function(e,t=U.J){return"ai"===e.gradeRecognitionMode?null:e.fixedGradeSemester?e.fixedGradeSemester:e.educationStage&&e.enrollmentYear?function(e,t,r=new Date,a="en",s=U.J){let n=(0,U.c)(r,s),i=n.getFullYear(),l=n.getMonth()+1,o=i-t,c="2nd";l>=9?(o+=1,c="1st"):c=l<2?"1st":"2nd";let d="zh"===a,u=d?"1st"===c?"上期":"下期":"1st"===c?"1st Semester":"2nd Semester",m=(d?{primary:["一年级","二年级","三年级","四年级","五年级","六年级"],junior_high:["初一","初二","初三"],senior_high:["高一","高二","高三"],university:["大一","大二","大三","大四"]}:{primary:["Grade 1","Grade 2","Grade 3","Grade 4","Grade 5","Grade 6"],junior_high:["Junior High Grade 1","Junior High Grade 2","Junior High Grade 3"],senior_high:["Senior High Grade 1","Senior High Grade 2","Senior High Grade 3"],university:["Freshman","Sophomore","Junior","Senior"]})[e]||[],f=`${o}`;if(f=o>0&&o<=m.length?m[o-1]:o>m.length?d?"已毕业":"Graduated":d?"学前":"Pre-school",!d)return`${f}, ${u}`;{let e="1st"===c?"上":"下";return`${f}${e}`}}(e.educationStage,e.enrollmentYear,new Date,"zh",t):null}(e,p);v(e=>e.gradeSemester||y.current?e:{...e,gradeSemester:t||""}),W(e.educationStage||void 0)}}).catch(e=>u.V.error("[CorrectionEditor]","Failed to fetch user info for grade calculation",{error:e}))},[h,p]);let K=async()=>{if(!x.questionText.trim())return void N.c.warning(g.editor.enterQuestionFirst||"Please enter question text first");T(!0);try{let e=function({questionText:e,language:t,subject:r,imagePreview:a,gradeSemester:s,subjectId:n}){let i={questionText:e,language:t,subject:r};return a&&(i.imageBase64=a),s&&(i.gradeSemester=s),n&&(i.subjectId=n),i}({questionText:x.questionText,language:h,subject:x.subject,imagePreview:i,gradeSemester:x.gradeSemester??void 0,subjectId:x.subjectId});u.V.info("[Reanswer]",e.imageBase64?"Sending image + text (image available for mistake analysis)":"Sending text only (no image available)",{timeout:f});let t=await m.f.post("/api/reanswer",e,{timeout:f||18e4,recoverable:!0});v(e=>({...e,answerText:t.answerText,analysis:t.analysis,knowledgePoints:t.knowledgePoints,wrongAnswerText:t.wrongAnswerText||"",mistakeAnalysis:t.mistakeAnalysis||"",mistakeStatus:(0,q.x)(t.mistakeStatus,t.wrongAnswerText),difficultyStars:t.difficultyStars??e.difficultyStars})),N.c.success(g.editor.reanswerSuccess||"✅ Answer and analysis updated!")}catch(a){let e,t,r;u.V.error("[CorrectionEditor]","Reanswer failed",{error:a}),N.c.error((e=(0,B.d)(a)||"",r=(t=g.errors?.reanswer||{}).default||"Reanswer failed",e.includes("AI_AUTH_ERROR")?t.authError||g.errors?.AI_AUTH_ERROR||r:e.includes("AI_CONNECTION_FAILED")?t.connectionFailed||g.errors?.AI_CONNECTION_FAILED||r:e.includes("AI_RESPONSE_ERROR")&&(t.responseError||g.errors?.AI_RESPONSE_ERROR)||r))}finally{T(!1)}},Y=async()=>{if(!x.subjectId)return void N.c.warning(g.editor.messages?.selectNotebook||"Please select a notebook");if(!P){O(!0);try{await a({...x,paperLevel:D,mistakeStatus:(0,q.x)(x.mistakeStatus,x.wrongAnswerText)})}finally{O(!1)}}},Q=g.editor.placeholder||"Supports Markdown and LaTeX...",X=(0,_.f)(Z.find(e=>e.id===x.subjectId)?.name||null)||(0,_.f)(x.subject||null)||void 0;return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("h2",{className:"text-2xl font-bold",children:g.editor.title}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(o.f,{variant:"outline",onClick:s,children:g.editor.cancel}),(0,t.jsxs)(o.f,{onClick:Y,disabled:P,children:[P?(0,t.jsx)(n.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,t.jsx)(j.f,{className:"mr-2 h-4 w-4"}),P?g.common?.pleaseWait||"Please wait...":g.editor.save]})]})]}),(0,t.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[i&&(0,t.jsx)(c.N,{children:(0,t.jsx)(c.O,{className:"p-4",children:(0,t.jsx)("img",{src:i,alt:"Original",className:"w-full rounded-md"})})}),(0,t.jsx)(I,{data:x,paperLevel:D,onChange:b}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:g.editor.question}),(0,t.jsx)(F.f,{value:x.questionText,onChange:e=>b({questionText:e}),className:"min-h-[150px] font-mono text-sm",placeholder:Q}),(0,t.jsx)(o.f,{variant:"default",size:"sm",onClick:K,disabled:E||!x.questionText.trim(),className:"w-full bg-gradient-to-r from-indigo-600 to-violet-500 hover:from-indigo-700 hover:to-violet-600 text-white font-medium",children:E?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.f,{className:"mr-2 h-4 w-4 animate-spin"}),g.editor.reanswering||"AI solving..."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(w.f,{className:"mr-2 h-4 w-4"}),g.editor.reanswer||"🔄 Reanswer (based on corrected question)"]})}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:g.editor.reanswerHint||"💡 If the question was misrecognized, correct it and click to regenerate answer"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:g.editor.tags}),(0,t.jsx)($.f,{value:x.knowledgePoints,onChange:e=>b({knowledgePoints:e}),placeholder:g.editor.tagsPlaceholder||"Enter knowledge tags...",enterHint:g.editor.createTagHint,subject:X,gradeStage:H}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:g.editor.tagsHint||"💡 Tag suggestions will appear as you type"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:g.editor.answer}),(0,t.jsx)(F.f,{value:x.answerText,onChange:e=>b({answerText:e}),className:"min-h-[100px] font-mono text-sm",placeholder:Q})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:g.editor.analysis}),(0,t.jsx)(F.f,{value:x.analysis,onChange:e=>b({analysis:e}),className:"min-h-[200px] font-mono text-sm",placeholder:Q})]}),(0,t.jsx)(R,{data:x,onChange:b})]}),(0,t.jsx)(L,{data:x,children:M&&(0,t.jsx)(S,{data:x,onChange:b})})]})]})}],866531);var H=e.i(263676);e.s(["f",0,function({imported:e,onDismiss:r}){let{t:n}=(0,d.b)(),i=(e.duplicate?n.importFlow.duplicate:n.importFlow.imported).replace("{notebook}",e.notebookName||"-").replace("{id}",e.shortId||"-");return(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3 rounded-lg border border-green-300 dark:border-green-800 bg-green-50 dark:bg-green-950/40 p-3 text-sm text-green-800 dark:text-green-200",role:"status",children:[(0,t.jsxs)("span",{className:"flex items-start gap-2 flex-1",children:[(0,t.jsx)(s.f,{className:"h-4 w-4 mt-0.5 shrink-0"}),i]}),(0,t.jsxs)("div",{className:"flex gap-2 shrink-0",children:[(0,t.jsx)(a.default,{href:`/error-items/${e.id}`,children:(0,t.jsx)(o.f,{size:"sm",variant:"outline",className:"bg-background",children:n.importFlow.viewItem})}),(0,t.jsx)(o.f,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:r,"aria-label":n.detail.close,children:(0,t.jsx)(H.X,{className:"h-4 w-4"})})]})]})}],430634)},717448,798469,956738,185592,267275,e=>{var t=e.i(843476),r=e.i(271645),a=e.i(515288),s=e.i(519455),n=e.i(624687),i=e.i(110204),l=e.i(632781),o=e.i(325597),c=e.i(328623),d=e.i(111110);e.s(["f",0,function({onSubmit:e,isAnalyzing:u,defaultNotebookName:m}){let{t:f}=(0,d.b)(),[p,g]=(0,r.useState)(""),h=async()=>{p.trim()&&await e(p.trim())};return(0,t.jsx)(a.N,{className:"rounded-2xl",children:(0,t.jsxs)(a.O,{className:"p-6 space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground mb-2",children:[(0,t.jsx)(o.f,{className:"h-5 w-5"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:f.app?.textInputHint||"Enter question text"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(i.f,{htmlFor:"question-text",children:f.editor?.question||"Question Text"}),(0,t.jsx)(n.f,{id:"question-text",value:p,onChange:e=>g(e.target.value),onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&"Enter"===e.key&&(e.preventDefault(),p.trim()&&!u&&h())},placeholder:f.app?.textInputPlaceholder||"Paste or type question text here...\nSupports Markdown and LaTeX formulas (e.g. $x^2 + y^2 = 1$)\n\nCtrl+Enter to submit",className:"min-h-[200px] font-mono text-sm resize-y",disabled:u})]}),m&&(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[f.notebooks?.title||"My Notebooks",": ",m]}),(0,t.jsx)(s.f,{onClick:h,disabled:!p.trim()||u,className:"w-full bg-gradient-to-r from-indigo-600 to-violet-500 font-medium text-white hover:from-indigo-700 hover:to-violet-600",size:"lg",children:u?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(l.f,{className:"mr-2 h-4 w-4 animate-spin"}),f.editor?.reanswering||"AI solving..."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(c.f,{className:"mr-2 h-4 w-4"}),f.app?.aiSolve||"AI Solve"]})}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground text-center",children:f.app?.textInputTip||"After entering the question, AI will automatically solve and generate analysis"})]})})}],717448);let u=new Map([["avif","image/avif"],["bmp","image/bmp"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["gif","image/gif"],["gz","application/gzip"],["htm","text/html"],["html","text/html"],["ico","image/x-icon"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","application/javascript"],["json","application/json"],["md","text/markdown"],["mjs","application/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["ogg","audio/ogg"],["pdf","application/pdf"],["png","image/png"],["ppt","application/powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["svg","image/svg+xml"],["tif","image/tiff"],["tiff","image/tiff"],["txt","text/plain"],["wasm","application/wasm"],["wav","audio/x-wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["zip","application/zip"]]);var m=class extends Error{constructor(e){super("DataTransferItem is not a file"),this.item=e,this.name="UnexpectedObjectError"}};function f(e,t,r){let{webkitRelativePath:a}=e,s="string"==typeof t?t:"string"==typeof a&&a.length>0?a:`./${e.name}`;return"string"!=typeof e.path&&p(e,"path",s),void 0!==r&&Object.defineProperty(e,"handle",{value:r,writable:!1,configurable:!1,enumerable:!0}),p(e,"relativePath",s),e}function p(e,t,r){Object.defineProperty(e,t,{value:r,writable:!1,configurable:!1,enumerable:!0})}let g=[".DS_Store","Thumbs.db"];async function h(e,{mimeTypes:t=u}={}){return(await x(e)).map(e=>"path"in e?function(e,t=u){let{name:r}=e;if(r&&-1!==r.lastIndexOf(".")&&!e.type){let a=r.split(".").pop().toLowerCase(),s=t.get(a);s&&Object.defineProperty(e,"type",{value:s,writable:!1,configurable:!1,enumerable:!0})}return e}(e,t):e)}async function x(e){var t,r,a;if(v(e)&&v(e.dataTransfer))return w(e.dataTransfer,e.type);if(v(t=e)&&v(t.clipboardData)){let t;return j(((t=b((r=e.clipboardData).items).filter(e=>"file"===e.kind).map(e=>e.getAsFile()).filter(e=>null!==e)).length>0?t:b(r.files)).map(e=>f(e)))}if(v(a=e)&&v(a.target))return b(e.target.files).map(e=>f(e));return Array.isArray(e)&&e.every(e=>"getFile"in e&&"function"==typeof e.getFile)?y(e):[]}function v(e){return"object"==typeof e&&null!==e}async function y(e){return(await Promise.all(e.map(e=>e.getFile()))).map(e=>f(e))}async function w(e,t){let r=b(e.items).filter(e=>"file"===e.kind);return"drop"!==t?r:j(function e(t){let r=[];for(let a of t)Array.isArray(a)?r.push(...e(a)):r.push(a);return r}(await Promise.all(r.map(k))))}function j(e){return e.filter(e=>-1===g.indexOf(e.name))}function b(e){return null===e?[]:Array.from(e)}async function k(e){if("function"!=typeof e.webkitGetAsEntry)return N(e);let t=e.webkitGetAsEntry();if(t?.isDirectory){let r=await S(e);return r?.kind==="directory"?A(r,`/${r.name}`):E(t)}return N(e,t)}async function N(e,t){let r=e.getAsFile(),a=await S(e);if(null!=a){let e=r??await a.getFile();return e.handle=a,f(e)}if(!r)throw new m(e);return f(r,t?.fullPath??void 0)}async function S(e){if(globalThis.isSecureContext&&"function"==typeof e.getAsFileSystemHandle)return e.getAsFileSystemHandle()}async function A(e,t){let r=[];for await(let a of e.values()){let e=`${t}/${a.name}`;if("directory"===a.kind)r.push(...await A(a,e));else{let t=await a.getFile();r.push(f(t,e,a))}}return r}async function D(e){return e.isDirectory?E(e):T(e)}function E(e){let t=e.createReader();return new Promise((e,r)=>{let a=[];!function s(){t.readEntries(async t=>{if(t.length){let e=Promise.all(t.map(D));a.push(e),s()}else try{e(await Promise.all(a))}catch(e){r(e)}},e=>{r(e)})}()})}async function T(e){return new Promise((t,r)=>{e.file(r=>{t(f(r,e.fullPath))},e=>{r(e)})})}let C=function(e,t){if(e&&t){let r=(Array.isArray(t)?t:t.split(",")).filter(e=>""!==e.trim());if(0===r.length)return!0;let a=e.name||"",s=(e.type||"").toLowerCase(),n=s.replace(/\/.*$/,"");return r.some(e=>{let t=e.trim().toLowerCase();return"."===t.charAt(0)?a.toLowerCase().endsWith(t):t.endsWith("/*")?n===t.replace(/\/.*$/,""):s===t})}return!0},I=["KB","MB","GB","TB","PB"];function F(e){if(e<1024)return`${e} ${1===e?"byte":"bytes"}`;let t=e/1024,r=0;for(;t>=1024&&r<I.length-1;)t/=1024,r++;return`${Number(t.toFixed(2))} ${I[r]}`}function P(e){return{code:"file-too-large",message:`File is larger than ${F(e)}`}}function R(e){return{code:"file-too-small",message:`File is smaller than ${F(e)}`}}let O={code:"too-many-files",message:"Too many files"};function M(e,t){let r="application/x-moz-file"===e.type||C(e,t??"")||""===e.type&&"function"==typeof e.getAsFile;return[r,r?null:function(e=""){let t=e.split(","),r=t.length>1?`one of ${t.join(", ")}`:t[0];return{code:"file-invalid-type",message:`File type must be ${r}`}}(t)]}function z(e,t,r){if(L(e.size)){if(L(t)&&L(r)){if(e.size>r)return[!1,P(r)];if(e.size<t)return[!1,R(t)]}else if(L(t)&&e.size<t)return[!1,R(t)];else if(L(r)&&e.size>r)return[!1,P(r)]}return[!0,null]}function L(e){return null!=e}function $(e){return"function"==typeof e.isPropagationStopped?e.isPropagationStopped():void 0!==e.cancelBubble&&e.cancelBubble}function G(e){let t=e.dataTransfer??e.clipboardData;return t?Array.prototype.some.call(t.types,e=>"Files"===e||"application/x-moz-file"===e)||Array.prototype.some.call(t.items??[],U):!!e.target&&!!e.target.files}function U(e){return"object"==typeof e&&null!==e&&"file"===e.kind}function _(e){e.preventDefault()}function q(...e){return(t,...r)=>e.some(e=>(!$(t)&&e&&e(t,...r),$(t)))}function V(e){return Array.isArray(e)?e:"string"==typeof e?[e]:[]}function B(e){if(L(e))return Array.isArray(e)?e.filter(e=>L(e)&&L(e.accept)):[{accept:e}]}function H(e,{omitWildcardMimeTypesWithExtensions:t=!1}={}){if(L(e))return Object.entries(e).reduce((e,[r,a])=>{let s=V(a);return t&&r.endsWith("/*")&&s.some(Z)?e.push(...s):e.push(r,...s),e},[]).filter(e=>W(e)||Z(e)).join(",")}function W(e){return"audio/*"===e||"video/*"===e||"image/*"===e||"text/*"===e||"application/*"===e||/\w+\/[-+.\w]+/g.test(e)}function Z(e){return/^.*\.[\w]+$/.test(e)}(0,r.forwardRef)(({children:e,...a},s)=>{let{open:n,...i}=K(a);return(0,r.useImperativeHandle)(s,()=>({open:n}),[n]),(0,t.jsx)(t.Fragment,{children:e?.({...i,open:n})})}).displayName="Dropzone";let J={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragUnknown:!1,isDragGlobal:!1,isProcessing:!1,acceptedFiles:[],fileRejections:[],dragFileRejections:[]};function K(e={}){let{accept:t,disabled:a=!1,getFilesFromEvent:s=h,maxSize:n=1/0,minSize:i=0,multiple:l=!0,maxFiles:o=0,onDragEnter:c,onDragLeave:d,onDragOver:u,onDrop:m,onDropAccepted:f,onDropRejected:p,onFileDialogCancel:g,onFileDialogOpen:x,useFsAccessApi:v=!1,autoFocus:y=!1,preventDropOnDocument:w=!0,noClick:j=!1,noKeyboard:b=!1,noDrag:k=!1,noDragEventsBubbling:N=!1,noPaste:S=!1,onError:A,validator:D,getErrorMessage:E}=e,T=(0,r.useMemo)(()=>(function(e){let t=B(e);if(!L(t))return;let r={};for(let e of t)for(let[t,a]of Object.entries(e.accept)){let e=r[t]??(r[t]=[]);for(let t of V(a))e.includes(t)||e.push(t)}return r})(t),[t]),C=(0,r.useMemo)(()=>H(T),[T]),I=(0,r.useMemo)(()=>H(T,{omitWildcardMimeTypesWithExtensions:!0}),[T]),F=(0,r.useMemo)(()=>(function(e){let t=B(e);if(!L(t))return;let r=t.map(e=>{let t=Object.entries(e.accept).filter(([e,t])=>{let r=!0;return W(e)||(console.warn(`Skipped "${e}" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.`),r=!1),(Array.isArray(t)||"string"==typeof t)&&V(t).every(Z)||(console.warn(`Skipped "${e}" because an invalid file extension was provided.`),r=!1),r}).reduce((e,[t,r])=>(e[t]=V(r),e),{});return{description:L(e.description)&&""!==e.description?e.description:function(e){let t=[],r=Object.keys(e);for(let r of Object.values(e))for(let e of V(r))t.includes(e)||t.push(e);return t.length>0?t.join(", "):r.length>0?r.join(", "):"Files"}(t),accept:t}}).filter(e=>Object.keys(e.accept).length>0);return r.length>0?r:void 0})(t),[t]),P=(0,r.useMemo)(()=>"function"==typeof x?x:Q,[x]),R=(0,r.useMemo)(()=>"function"==typeof g?g:Q,[g]),U=(0,r.useRef)(null),X=(0,r.useRef)(null),[ee,et]=(0,r.useReducer)(Y,J),{isFocused:er,isFileDialogActive:ea}=ee,es=(0,r.useRef)(ea);es.current=ea;let en=(0,r.useRef)(null),ei=(0,r.useCallback)(()=>{en.current?.abort();let e=new AbortController;return en.current=e,et({type:"setProcessing",isProcessing:!0}),e.signal},[]),el=(0,r.useCallback)(e=>{e.aborted||et({type:"setProcessing",isProcessing:!1})},[]);(0,r.useEffect)(()=>()=>en.current?.abort(),[]);let eo=(0,r.useRef)("u">typeof window&&window.isSecureContext&&v&&"showOpenFilePicker"in window),ec=()=>{!eo.current&&ea&&setTimeout(()=>{if(X.current){let{files:e}=X.current;e?.length||(et({type:"closeDialog"}),R())}},300)};(0,r.useEffect)(()=>(window.addEventListener("focus",ec,!1),()=>{window.removeEventListener("focus",ec,!1)}),[X,ea,R,eo]);let ed=(0,r.useRef)([]),eu=(0,r.useRef)([]),em=e=>{U.current&&e.target&&U.current.contains(e.target)&&e.defaultPrevented||(e.preventDefault(),ed.current=[])};(0,r.useEffect)(()=>(w&&(document.addEventListener("dragover",_,!1),document.addEventListener("drop",em,!1)),()=>{w&&(document.removeEventListener("dragover",_),document.removeEventListener("drop",em))}),[U,w]),(0,r.useEffect)(()=>{let e=e=>{e.target&&(eu.current=[...eu.current,e.target]),G(e)&&et({isDragGlobal:!0,type:"setDragGlobal"})},t=e=>{eu.current=eu.current.filter(t=>t!==e.target&&null!==t),eu.current.length>0||et({isDragGlobal:!1,type:"setDragGlobal"})},r=()=>{eu.current=[],et({isDragGlobal:!1,type:"setDragGlobal"})},a=()=>{eu.current=[],et({isDragGlobal:!1,type:"setDragGlobal"})};return document.addEventListener("dragenter",e,!1),document.addEventListener("dragleave",t,!1),document.addEventListener("dragend",r,!1),document.addEventListener("drop",a,!1),()=>{document.removeEventListener("dragenter",e),document.removeEventListener("dragleave",t),document.removeEventListener("dragend",r),document.removeEventListener("drop",a)}},[U]),(0,r.useEffect)(()=>(!a&&y&&U.current&&U.current.focus(),()=>{}),[U,y,a]);let ef=(0,r.useCallback)(e=>{A?A(e):console.error(e)},[A]),ep=(0,r.useCallback)(e=>{e.preventDefault(),e.persist?.(),eE(e),!es.current&&(ed.current=[...ed.current,e.target],G(e)&&Promise.resolve(s(e)).then(t=>{if($(e)&&!N)return;let r=t.length>0?function({files:e,accept:t,minSize:r,maxSize:a,multiple:s,maxFiles:n=0,validator:i,getErrorMessage:l}){let o=[],c=[],d=(e,t)=>l&&"u">typeof File&&t instanceof File?{...e,message:l(e,t)}:e;e.forEach(e=>{let[s,n]=M(e,t),[i,l]=z(e,r,a);s&&i?o.push(e):c.push({file:e,errors:[n,l].filter(e=>null!=e).map(t=>d(t,e))})});let u=s?n>=1?n:1/0:1;return(o.length>u&&o.slice(u).forEach(e=>{c.push({file:e,errors:[d(O,e)]})}),c.length>0)?{verdict:"reject",rejections:c}:{verdict:i?"unknown":"accept",rejections:c}}({files:t,accept:C,minSize:i,maxSize:n,multiple:l,maxFiles:o,validator:D,getErrorMessage:E}):null;et({isDragAccept:r?.verdict==="accept",isDragReject:r?.verdict==="reject",isDragUnknown:r?.verdict==="unknown",isDragActive:!0,dragFileRejections:r?.rejections??[],type:"setDraggedFiles"}),c&&c(e)}).catch(e=>ef(e)))},[s,c,ef,N,C,i,n,l,o,D,E]),eg=(0,r.useCallback)(e=>{if(e.preventDefault(),e.persist?.(),eE(e),es.current)return!1;let t=G(e);if(t&&e.dataTransfer)try{e.dataTransfer.dropEffect="copy"}catch{}return t&&u&&u(e),!1},[u,N]),eh=(0,r.useCallback)(e=>{e.preventDefault(),e.persist?.(),eE(e);let t=ed.current.filter(e=>U.current?.contains(e)),r=t.indexOf(e.target);-1!==r&&t.splice(r,1),ed.current=t,!(t.length>0)&&(et({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragUnknown:!1,dragFileRejections:[]}),G(e)&&d&&d(e))},[U,d,N]),ex=(0,r.useCallback)(async(e,t,r)=>{let a,s=(e,t)=>E?{...e,message:E(e,t)}:e,c=e=>{let r=[],a=[];e.forEach(({file:e,accepted:t,acceptError:n,sizeMatch:i,sizeError:l,customErrors:o})=>{let c=!o||Array.isArray(o)&&0===o.length;if(t&&i&&c)r.push(e);else{let t=[n,l];o&&(t=t.concat(o)),a.push({file:e,errors:t.filter(e=>null!=e).map(t=>s(t,e))})}});let n=l?o>=1?o:1/0:1;r.length>n&&r.splice(n).forEach(e=>{a.push({file:e,errors:[s(O,e)]})}),et({acceptedFiles:r,fileRejections:a,type:"setFiles"}),m&&m(r,a,t),a.length>0&&p&&p(a,t),r.length>0&&f&&f(r,t)},d=e.map(e=>{let[t,r]=M(e,I),[a,s]=z(e,i,n);return{file:e,accepted:t,acceptError:r,sizeMatch:a,sizeError:s,customErrors:D?D(e):null}});if(!d.some(({customErrors:e})=>null!=e&&"function"==typeof e.then))return void c(d);try{a=await Promise.all(d.map(async({customErrors:e,...t})=>({...t,customErrors:await e})))}catch(e){r.aborted||(el(r),ef(e));return}r.aborted||c(a)},[et,l,I,i,n,o,m,f,p,D,E,ef,el]),ev=(0,r.useCallback)(e=>{if(e.preventDefault(),e.persist?.(),eE(e),ed.current=[],(!es.current||!e.dataTransfer)&&(et({type:"reset"}),G(e))){let t=ei();Promise.resolve(s(e)).then(r=>{if(!t.aborted)return $(e)&&!N?void el(t):ex(r,e,t)}).catch(e=>{t.aborted||(el(t),ef(e))})}},[s,ex,ef,N,ei,el]),ey=(0,r.useCallback)(e=>{if(!G(e))return;e.preventDefault(),e.persist?.(),eE(e);let t=ei();Promise.resolve(s(e)).then(r=>{if(!t.aborted)return $(e)&&!N?void el(t):ex(r,e,t)}).catch(e=>{t.aborted||(el(t),ef(e))})},[s,ex,ef,N,ei,el]),ew=(0,r.useCallback)(()=>{if(eo.current){let e;et({type:"openDialog"}),P(),window.showOpenFilePicker({multiple:l,types:F}).then(t=>(e=ei(),s(t))).then(t=>{if(et({type:"closeDialog"}),!e.aborted)return ex(t,null,e)}).catch(t=>{(e&&el(e),t instanceof DOMException&&("AbortError"===t.name||t.code===t.ABORT_ERR))?(R(t),et({type:"closeDialog"})):t instanceof DOMException&&("SecurityError"===t.name||t.code===t.SECURITY_ERR)||t instanceof DOMException&&"NotAllowedError"===t.name?(eo.current=!1,X.current?(X.current.value="",X.current.click()):ef(Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):ef(t)});return}X.current&&(et({type:"openDialog"}),P(),X.current.value="",X.current.click())},[et,P,R,v,ex,ef,F,l,ei,el]),ej=(0,r.useCallback)(e=>{U.current?.isEqualNode(e.target)&&(" "===e.key||"Enter"===e.key||32===e.keyCode||13===e.keyCode)&&(e.preventDefault(),ew())},[U,ew]),eb=(0,r.useCallback)(()=>{et({type:"focus"})},[]),ek=(0,r.useCallback)(()=>{et({type:"blur"})},[]),eN=(0,r.useCallback)(()=>{j||(function(e=window.navigator.userAgent){return -1!==e.indexOf("MSIE")||-1!==e.indexOf("Trident/")||-1!==e.indexOf("Edge/")}()?setTimeout(ew,0):ew())},[j,ew]),eS=e=>a?null:e,eA=e=>b?null:eS(e),eD=e=>k?null:eS(e),eE=e=>{N&&e.stopPropagation()},eT=(0,r.useMemo)(()=>({refKey:e="ref",role:t,onKeyDown:r,onFocus:s,onBlur:n,onClick:i,onDragEnter:l,onDragOver:o,onDragLeave:c,onDrop:d,onPaste:u,...m}={})=>{let f;return{onKeyDown:eA(q(r,ej)),onFocus:eA(q(s,eb)),onBlur:eA(q(n,ek)),onClick:eS(q(i,eN)),onDragEnter:eD(q(l,ep)),onDragOver:eD(q(o,eg)),onDragLeave:eD(q(c,eh)),onDrop:eD(q(d,ev)),onPaste:(f=q(u,ey),S?null:eS(f)),role:"string"==typeof t&&""!==t?t:"presentation",[e]:U,...!a&&!b?{tabIndex:0}:{},...a?{"aria-disabled":!0}:{},...m}},[U,ej,eb,ek,eN,ep,eg,eh,ev,ey,b,k,S,a]),eC=(0,r.useCallback)(e=>{e.stopPropagation()},[]),eI=(0,r.useMemo)(()=>({refKey:e="ref",onChange:t,onClick:r,...a}={})=>({accept:I,multiple:l,type:"file","aria-label":"file upload",style:{border:0,display:"block",height:0,margin:0,maxWidth:0,opacity:0,overflow:"hidden",padding:0,width:0},onChange:eS(q(t,ev)),onClick:eS(q(r,eC)),tabIndex:-1,[e]:X,...a}),[X,t,l,ev,a]);return{...ee,isFocused:er&&!a,getRootProps:eT,getInputProps:eI,rootRef:U,inputRef:X,open:eS(ew)}}function Y(e,t){switch(t.type){case"focus":return{...e,isFocused:!0};case"blur":return{...e,isFocused:!1};case"openDialog":return{...J,isFileDialogActive:!0};case"closeDialog":return{...e,isFileDialogActive:!1};case"setDraggedFiles":return{...e,isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject,isDragUnknown:t.isDragUnknown,dragFileRejections:t.dragFileRejections};case"setProcessing":return{...e,isProcessing:t.isProcessing};case"setFiles":return{...e,acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,dragFileRejections:[],isProcessing:!1,isDragReject:!1,isDragUnknown:!1};case"setDragGlobal":return{...e,isDragGlobal:t.isDragGlobal};case"reset":return{...J};default:return e}}function Q(){}var X=e.i(456420);let ee={name:"cloud-upload",size:24,node:[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],aliases:["upload-cloud"]};ee.node;let et=(0,X.f)(ee);var er=e.i(446513);let ea={name:"clipboard-paste",size:24,node:[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]]};ea.node;let es=(0,X.f)(ea);var en=e.i(201276),ei=e.i(294114);let el=()=>()=>{};function eo(){return(0,r.useSyncExternalStore)(el,()=>!0,()=>!1)}e.s(["f",0,function({onImageSelect:e,isAnalyzing:n}){let{t:i}=(0,d.b)(),[o,c]=(0,r.useState)(!1),u=eo();(0,r.useEffect)(()=>{"Notification"in window&&"default"===Notification.permission&&Notification.requestPermission()},[]);let{getRootProps:m,getInputProps:f,isDragActive:p}=K({onDrop:(0,r.useCallback)(t=>{let r=t[0];r&&e(r)},[e]),accept:{"image/*":[".jpeg",".jpg",".png"]},maxFiles:1,disabled:n}),g=(0,r.useCallback)(t=>{let r=t.type||"image/png",a=r.split("/")[1]||"png";e(t instanceof File&&t.name?t:new File([t],`clipboard-${Date.now()}.${a}`,{type:r}))},[e]);(0,r.useEffect)(()=>{let e=e=>{if(n)return;let t=e.target;if(t&&(t.isContentEditable||["INPUT","TEXTAREA"].includes(t.tagName)))return;let r=Array.from(e.clipboardData?.items??[]).find(e=>"file"===e.kind&&e.type.startsWith("image/")),a=r?.getAsFile();a&&(e.preventDefault(),g(a))};return window.addEventListener("paste",e),()=>window.removeEventListener("paste",e)},[n,g]);let h=async()=>{if(!(u&&"u">typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.read))return void ei.c.warning(i.upload.pasteNotSupported);try{for(let e of(await navigator.clipboard.read())){let t=e.types.find(e=>e.startsWith("image/"));if(t){let r=await e.getType(t);g(r);return}}ei.c.warning(i.upload.pasteNoImage)}catch(e){en.V.warn("[UploadZone]","Clipboard read failed",{error:e instanceof Error?e.message:String(e)}),e instanceof Error&&"NotAllowedError"===e.name?ei.c.warning(i.upload.pastePermissionDenied):ei.c.error(i.upload.pasteFailed)}},x=()=>u&&"u">typeof navigator&&"mediaDevices"in navigator&&"getDisplayMedia"in navigator.mediaDevices,v=async()=>{if(!x())return void ei.c.warning(i.upload.screenshotNotSupported);c(!0);try{let t;"CaptureController"in window&&(t=new window.CaptureController);let r={video:!0,audio:!1,preferCurrentTab:!1};t&&(r.controller=t);let a=await navigator.mediaDevices.getDisplayMedia(r),[s]=a.getVideoTracks(),n=s.getSettings().displaySurface;if(t&&("browser"===n||"window"===n))try{t.setFocusBehavior("no-focus-change"),en.V.info("[UploadZone]","Screenshot focus behavior set to no-change",void 0,{sendToBackend:!1})}catch(e){en.V.warn("[UploadZone]","Unable to set screenshot focus behavior",{error:e})}let i=document.createElement("video");if(i.srcObject=a,i.muted=!0,i.autoplay=!0,i.playsInline=!0,await new Promise((e,t)=>{i.onloadedmetadata=()=>{i.play().then(()=>{e()}).catch(t)},i.onerror=t}),await new Promise(e=>setTimeout(e,500)),0===i.videoWidth||0===i.videoHeight)throw Error("视频没有有效尺寸");let l=document.createElement("canvas");l.width=i.videoWidth,l.height=i.videoHeight;let o=l.getContext("2d");if(!o)throw Error("无法获取canvas上下文");o.drawImage(i,0,0),a.getTracks().forEach(e=>e.stop()),l.toBlob(t=>{t?(e(new File([t],`screenshot-${Date.now()}.png`,{type:"image/png"})),en.V.info("[UploadZone]","Screenshot captured",void 0,{sendToBackend:!1})):ei.c.error("截图转换失败")},"image/png",1)}catch(e){en.V.error("[UploadZone]","Screenshot failed",{error:e}),e instanceof Error&&("NotAllowedError"===e.name?ei.c.warning(i.upload.screenshotPermissionDenied):ei.c.error(`${i.upload.screenshotFailed}: ${e.message}`))}finally{c(!1)}};return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(a.N,{...m(),className:`group cursor-pointer rounded-2xl border-2 border-dashed shadow-none transition-all hover:border-primary/60 hover:bg-accent/40 ${p?"border-primary bg-accent/60":"border-border bg-card"}`,children:(0,t.jsxs)(a.O,{className:"flex min-h-[260px] flex-col items-center justify-center space-y-4 py-10 text-center md:min-h-[300px]",children:[(0,t.jsx)("input",{...f()}),(0,t.jsx)("div",{className:"rounded-2xl bg-accent p-4 text-primary transition-transform group-hover:scale-105",children:n?(0,t.jsx)(l.f,{className:"h-10 w-10 animate-spin"}):(0,t.jsx)(et,{className:"h-10 w-10"})}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("h3",{className:"text-lg font-semibold",children:n?i.app.analyzing:i.upload.analyze}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:n?i.app.analyzing:i.app.dragDrop}),(0,t.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:i.upload.support})]})]})}),(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:flex-wrap items-stretch sm:items-start justify-center gap-4",children:[u&&(0,t.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,t.jsxs)(s.f,{variant:"outline",onClick:h,disabled:n,className:"flex items-center gap-2 w-full sm:w-auto",children:[(0,t.jsx)(es,{className:"h-4 w-4"}),i.upload.paste]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground text-center",children:i.upload.pasteDesc})]}),x()&&(0,t.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,t.jsxs)(s.f,{variant:"outline",onClick:v,disabled:n||o,className:"flex items-center gap-2 w-full sm:w-auto",children:[o?(0,t.jsx)(l.f,{className:"h-4 w-4 animate-spin"}):(0,t.jsx)(er.f,{className:"h-4 w-4"}),o?i.common.pleaseWait:i.upload.screenshot]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground text-center",children:i.upload.screenshotDesc})]})]})]})}],798469);var ec=e.i(30030),ed=e.i(248425),eu=Object.defineProperty,em=(e,t)=>eu(e,"name",{value:t,configurable:!0}),ef="Progress",[ep,eg]=(0,ec.f)(ef),[eh,ex]=ep(ef),ev=r.forwardRef(em(function(e,r){let{__scopeProgress:a,value:s=null,max:n,getValueLabel:i=ew,...l}=e;(n||0===n)&&!ek(n)&&console.error(eS(`${n}`,"Progress"));let o=ek(n)?n:100;null===s||eN(s,o)||console.error(eA(`${s}`,"Progress"));let c=eN(s,o)?s:null,d=eb(c)?i(c,o):void 0;return(0,t.jsx)(eh,{scope:a,value:c,max:o,children:(0,t.jsx)(ed.V.div,{"aria-valuemax":o,"aria-valuemin":0,"aria-valuenow":eb(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":ej(c,o),"data-value":c??void 0,"data-max":o,...l,ref:r})})},"Progress")),ey=r.forwardRef(em(function(e,r){let{__scopeProgress:a,...s}=e,n=ex("ProgressIndicator",a);return(0,t.jsx)(ed.V.div,{"data-state":ej(n.value,n.max),"data-value":n.value??void 0,"data-max":n.max,...s,ref:r})},"ProgressIndicator"));function ew(e,t){return`${Math.round(e/t*100)}%`}function ej(e,t){return null==e?"indeterminate":e===t?"complete":"loading"}function eb(e){return"number"==typeof e}function ek(e){return eb(e)&&!isNaN(e)&&e>0}function eN(e,t){return eb(e)&&!isNaN(e)&&e<=t&&e>=0}function eS(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`100\`.`}function eA(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
|
|
1
|
+
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,518515,e=>{var t=e.i(456420);let r={name:"camera",size:24,node:[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]};r.node;let a=(0,t.f)(r);e.s(["f",0,a],518515)},325597,7891,e=>{var t=e.i(456420);let r={name:"pen-line",size:24,node:[["path",{d:"M13 21h8",key:"1jsn5i"}],["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"}]],aliases:["edit-3"]};r.node;let a=(0,t.f)(r);e.s(["f",0,a],7891),e.s(["f",0,a],325597)},747819,364002,866531,430634,e=>{var t=e.i(843476),r=e.i(271645),a=e.i(522016),s=e.i(548161),n=e.i(632781),i=e.i(395925),l=e.i(583967),o=e.i(519455),c=e.i(515288),d=e.i(111110),u=e.i(201276),m=e.i(41931),p=e.i(28928);async function f(){try{return!!(await m.k.get("/api/user")).confirmBeforeImport}catch{return!1}}async function g(e,t){let r=await m.k.post("/api/analyze",{imageBase64:e,language:t.language,subjectId:t.subjectId||void 0},{timeout:t.timeout,recoverable:!0});if(!r||"object"!=typeof r)throw Error("Invalid API response: data is null or not an object");return r}async function h(e,t){let r=await m.k.post("/api/error-items",{questionText:e.questionText,answerText:e.answerText,analysis:e.analysis,wrongAnswerText:e.wrongAnswerText||null,mistakeAnalysis:e.mistakeAnalysis||null,mistakeStatus:e.mistakeStatus||"unknown",knowledgePoints:e.knowledgePoints||[],difficultyStars:e.difficultyStars??null,recognizedGradeSemester:e.gradeSemester??null,hasFigure:e.hasFigure??!1,figureSvg:e.figureSvg??null,subjectId:t.subjectId||void 0,subjectName:t.subjectId?void 0:e.subject,originalImageUrl:t.imageUrl||"",paperLevel:t.paperLevel||void 0});return{id:r.id,shortId:r.shortId??null,subjectId:r.subjectId??null,notebookName:r.subject?.name??null,duplicate:r.duplicate}}async function x(e,t){let r=await (0,p.f)(e instanceof File?e:new File([e],"question.jpg",{type:e.type||"image/jpeg"}));t.onStage?.("analyzing");let a=await g(r,t);return t.onStage?.("saving"),h(a,{subjectId:t.subjectId,imageUrl:r,paperLevel:t.paperLevel})}function v({item:e}){let{t:r}=(0,d.b)(),a=r.batchImport.status[e.status];return"success"===e.status?(0,t.jsxs)("span",{className:"flex items-start gap-1 text-green-700 dark:text-green-300",children:[(0,t.jsx)(s.f,{className:"h-4 w-4 shrink-0 mt-0.5"}),e.imported?.duplicate?r.importFlow.duplicate:a]}):"failed"===e.status?(0,t.jsxs)("span",{className:"flex items-center gap-1 text-destructive",children:[(0,t.jsx)(l.f,{className:"h-4 w-4"}),a]}):(0,t.jsxs)("span",{className:"flex items-center gap-1 text-muted-foreground",children:["pending"!==e.status&&(0,t.jsx)(n.f,{className:"h-4 w-4 animate-spin"}),a]})}function y({blob:e}){let a=(0,r.useRef)(null);return(0,r.useEffect)(()=>{let t=URL.createObjectURL(e);return a.current&&(a.current.src=t),()=>URL.revokeObjectURL(t)},[e]),(0,t.jsx)("img",{ref:a,alt:"",className:"h-20 w-20 shrink-0 rounded object-contain bg-muted"})}e.s(["x",0,f,"w",0,x,"a",0,h],364002),e.s(["f",0,function({blobs:e,subjectId:s,timeout:n,onClose:l}){let{t:m,language:p}=(0,d.b)(),[f,g]=(0,r.useState)(()=>e.map(()=>({status:"pending"}))),h=(0,r.useRef)(!1),w=(0,r.useCallback)((e,t)=>{g(r=>r.map((r,a)=>a===e?{...r,...t}:r))},[]),j=(0,r.useCallback)(async t=>{w(t,{status:"analyzing",error:void 0});try{let r=await x(e[t],{language:p,subjectId:s,timeout:n,onStage:e=>w(t,{status:e})});w(t,{status:"success",imported:r})}catch(s){let e=s?.data,r=e?.message||(s instanceof Error?s.message:String(s)),a=m.errors[r];w(t,{status:"failed",error:"string"==typeof a?a:r}),u.V.error("[BatchImport]","Question import failed",{index:t,error:r})}},[e,p,s,n,m.errors,w]),b=(0,r.useCallback)(async e=>{let t=[...e],r=async()=>{for(;t.length>0;)await j(t.shift())};await Promise.all(Array.from({length:Math.min(3,t.length)},r))},[j]);(0,r.useEffect)(()=>{h.current||(h.current=!0,b(e.map((e,t)=>t)))},[e,b]);let k=f.filter(e=>"success"===e.status).length,N=f.flatMap((e,t)=>"failed"===e.status?[t]:[]),S=f.some(e=>"pending"===e.status||"analyzing"===e.status||"saving"===e.status);return(0,t.jsxs)(c.N,{children:[(0,t.jsxs)(c.Y,{className:"flex flex-row items-center justify-between gap-2 space-y-0",children:[(0,t.jsx)(c.v,{className:"text-base",children:m.batchImport.title}),(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:m.batchImport.summary.replace("{done}",String(k)).replace("{total}",String(f.length)).replace("{failed}",String(N.length))})]}),(0,t.jsxs)(c.O,{className:"space-y-4",children:[(0,t.jsx)("ul",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:f.map((r,s)=>(0,t.jsxs)("li",{className:"flex gap-3 rounded-lg border p-3",children:[(0,t.jsx)(y,{blob:e[s]}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 space-y-1 text-sm",children:[(0,t.jsx)("div",{className:"font-medium",children:m.batchImport.question.replace("{index}",String(s+1))}),(0,t.jsx)(v,{item:r}),"success"===r.status&&r.imported&&(0,t.jsxs)(a.default,{href:`/error-items/${r.imported.id}`,className:"block truncate text-xs text-primary hover:underline",children:[r.imported.notebookName," · ",r.imported.shortId]}),"failed"===r.status&&(0,t.jsxs)(t.Fragment,{children:[r.error&&(0,t.jsx)("p",{className:"line-clamp-2 text-xs text-destructive",children:r.error}),(0,t.jsxs)(o.f,{size:"sm",variant:"outline",className:"h-7",onClick:()=>j(s),children:[(0,t.jsx)(i.f,{className:"mr-1 h-3 w-3"}),m.batchImport.retry]})]})]})]},s))}),(0,t.jsxs)("div",{className:"flex flex-col-reverse sm:flex-row sm:justify-end gap-2",children:[N.length>1&&!S&&(0,t.jsxs)(o.f,{variant:"outline",onClick:()=>b(N),children:[(0,t.jsx)(i.f,{className:"mr-2 h-4 w-4"}),m.batchImport.retryFailed]}),(0,t.jsx)(o.f,{onClick:l,disabled:S,children:m.batchImport.finish})]})]})]})}],747819);var w=e.i(741120),j=e.i(856522),b=e.i(314381),k=e.i(3198),N=e.i(294114);function S({data:e,onChange:a}){let{t:s}=(0,d.b)(),[i,l]=(0,r.useState)(!1),[c,p]=(0,r.useState)(null),f=async()=>{if(!e.questionText.trim())return void N.c.warning(s.editor.enterQuestionFirst||"Please enter question text first");if(!e.answerText.trim())return void N.c.warning(s.geogebra.answerRequired);l(!0),p(null);try{let t=await m.k.post("/api/geogebra-analyze",{questionText:e.questionText,answerText:e.answerText,analysis:e.analysis},{timeout:18e4,recoverable:!0});t.suitable&&t.commands&&t.commands.length>0?a({geogebraCommands:JSON.stringify(t.commands)}):p(t.description||s.geogebra.notSuitable)}catch(e){u.V.error("[CorrectionEditor]","GeoGebra analysis failed",{error:e}),p(s.geogebra.analyzeFailed)}finally{l(!1)}};return e.geogebraCommands?(0,t.jsx)(k.f,{commands:e.geogebraCommands,height:350,onRegenerate:f,onDelete:async()=>a({geogebraCommands:void 0})}):e.questionText.trim()&&e.answerText.trim()?(0,t.jsxs)("div",{className:"rounded-lg border border-dashed p-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(b.f,{className:"h-4 w-4"}),(0,t.jsx)("span",{children:s.geogebra.title})]}),(0,t.jsx)(o.f,{variant:"outline",size:"sm",onClick:f,disabled:i,children:i?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.f,{className:"mr-2 h-4 w-4 animate-spin"}),s.geogebra.analyzing]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(b.f,{className:"mr-2 h-4 w-4"}),s.geogebra.generate]})})]}),c&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-2",children:c}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-2",children:s.geogebra.hint})]}):null}var A=e.i(469937),D=e.i(28342),E=e.i(438465),T=e.i(674166),C=e.i(110204);function I({data:e,paperLevel:r,onChange:a}){let{t:s}=(0,d.b)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:s.editor.selectNotebook||"Select Notebook"}),(0,t.jsx)(E.f,{value:e.subjectId,onChange:e=>a({subjectId:e})})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{htmlFor:"correction-grade-semester",children:s.editor.gradeSemester||"Grade/Semester"}),(0,t.jsx)(D.f,{id:"correction-grade-semester",value:e.gradeSemester||"",onChange:e=>a({gradeSemester:e})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:s.editor.paperLevel||"Paper Level"}),(0,t.jsx)(T.f,{value:r,onChange:e=>a({paperLevel:e})})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:s.difficulty.label}),(0,t.jsx)("div",{children:(0,t.jsx)(A.f,{size:"md",value:e.difficultyStars,onChange:e=>a({difficultyStars:e})})})]})]})}var F=e.i(141176),P=e.i(967489);function R({data:e,onChange:r}){let{t:a}=(0,d.b)();return(0,t.jsxs)(c.N,{children:[(0,t.jsx)(c.Y,{children:(0,t.jsx)(c.v,{children:a.editor.mistakeAnalysisTitle||"Mistake Analysis"})}),(0,t.jsxs)(c.O,{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:a.editor.mistakeStatus||"Attempt Status"}),(0,t.jsxs)(P.d,{value:e.mistakeStatus||"unknown",onValueChange:e=>r({mistakeStatus:e}),children:[(0,t.jsx)(P.P,{children:(0,t.jsx)(P.U,{})}),(0,t.jsxs)(P.r,{children:[(0,t.jsx)(P.T,{value:"not_attempted",children:a.editor.mistakeStatuses?.notAttempted||"Not attempted"}),(0,t.jsx)(P.T,{value:"wrong_attempt",children:a.editor.mistakeStatuses?.wrongAttempt||"Wrong attempt"}),(0,t.jsx)(P.T,{value:"unknown",children:a.editor.mistakeStatuses?.unknown||"Unknown"})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:a.editor.wrongAnswerText||"Wrong Answer / Work"}),(0,t.jsx)(F.f,{value:e.wrongAnswerText||"",onChange:t=>r({wrongAnswerText:t,mistakeStatus:t.trim()?"wrong_attempt":e.mistakeStatus}),className:"min-h-[100px] font-mono text-sm",placeholder:a.editor.wrongAnswerPlaceholder||"Leave blank if no wrong answer is visible"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:a.editor.mistakeAnalysis||"Mistake Cause Analysis"}),(0,t.jsx)(F.f,{value:e.mistakeAnalysis||"",onChange:e=>r({mistakeAnalysis:e}),className:"min-h-[140px] font-mono text-sm",placeholder:a.editor.mistakeAnalysisPlaceholder||"Explain where and why the mistake happened"})]})]})]})}var O=e.i(511445),M=e.i(149704);function z({title:e,children:r,className:a}){return(0,t.jsxs)(c.N,{children:[(0,t.jsx)(c.Y,{children:(0,t.jsx)(c.v,{children:e})}),(0,t.jsx)(c.O,{className:a,children:r})]})}function L({data:e,children:r}){let{t:a}=(0,d.b)(),s={wrong_attempt:a.editor.mistakeStatuses?.wrongAttempt||"Wrong attempt",not_attempted:a.editor.mistakeStatuses?.notAttempted||"Not attempted",unknown:a.editor.mistakeStatuses?.unknown||"Unknown"};return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)(z,{title:a.editor.preview?.question||"Question Preview",children:[(0,t.jsx)(O.f,{content:e.questionText}),(0,t.jsx)(M.f,{svg:e.figureSvg})]}),r,(0,t.jsx)(z,{title:a.editor.preview?.answer||"Answer Preview",children:(0,t.jsx)(O.f,{content:e.answerText})}),(0,t.jsx)(z,{title:a.editor.preview?.analysis||"Analysis Preview",children:(0,t.jsx)(O.f,{content:e.analysis})}),(0,t.jsxs)(z,{title:a.editor.preview?.mistakeAnalysis||"Mistake Analysis Preview",className:"space-y-3 text-sm",children:[(0,t.jsxs)("div",{className:"text-muted-foreground",children:[a.editor.mistakeStatus||"Attempt Status",a.common.colon,s[e.mistakeStatus]??s.unknown]}),e.wrongAnswerText&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"font-medium mb-1",children:a.editor.wrongAnswerText||"Wrong Answer / Work"}),(0,t.jsx)(O.f,{content:e.wrongAnswerText})]}),e.mistakeAnalysis&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"font-medium mb-1",children:a.editor.mistakeAnalysis||"Mistake Cause Analysis"}),(0,t.jsx)(O.f,{content:e.mistakeAnalysis})]})]})]})}var $=e.i(574041),G=e.i(215519),U=e.i(306831);e.i(676167);var _=e.i(952122),q=e.i(62825),V=e.i(664030),B=e.i(303163);e.s(["f",0,function({initialData:e,onSave:a,onCancel:s,imagePreview:i,initialSubjectId:l,aiTimeout:p}){let{timeZone:f}=(0,G.M)(),{t:g,language:h}=(0,d.b)(),[x,v]=(0,r.useState)({...e,wrongAnswerText:e.wrongAnswerText||"",mistakeAnalysis:e.mistakeAnalysis||"",mistakeStatus:e.mistakeStatus||"unknown",subjectId:l,gradeSemester:e.gradeSemester||""}),y=(0,r.useRef)(!1),b=e=>{"gradeSemester"in e&&(y.current=!0),v(t=>({...t,...e}))},{groups:k}=(0,V.f)(),A=(()=>{if(x.paperLevel)return x.paperLevel;let e="number"==typeof x.difficultyStars&&x.difficultyStars>=4?"b":"a";return k.find(t=>t.key===e&&t.isActive)?.id||""})(),D=x.paperLevel??A,[E,T]=(0,r.useState)(!1),[P,O]=(0,r.useState)(!1),[M,z]=(0,r.useState)(!1),[H,W]=(0,r.useState)(void 0),[Z,J]=(0,r.useState)([]);(0,r.useEffect)(()=>{m.k.get("/api/notebooks").then(J).catch(e=>u.V.error("[CorrectionEditor]","Failed to fetch notebooks",{error:e})),m.k.get("/api/user").then(e=>{if(z(!!e?.enableGeogebra),e){let t=function(e,t=U.J){return"ai"===e.gradeRecognitionMode?null:e.fixedGradeSemester?e.fixedGradeSemester:e.educationStage&&e.enrollmentYear?function(e,t,r=new Date,a="en",s=U.J){let n=(0,U.c)(r,s),i=n.getFullYear(),l=n.getMonth()+1,o=i-t,c="2nd";l>=9?(o+=1,c="1st"):c=l<2?"1st":"2nd";let d="zh"===a,u=d?"1st"===c?"上期":"下期":"1st"===c?"1st Semester":"2nd Semester",m=(d?{primary:["一年级","二年级","三年级","四年级","五年级","六年级"],junior_high:["初一","初二","初三"],senior_high:["高一","高二","高三"],university:["大一","大二","大三","大四"]}:{primary:["Grade 1","Grade 2","Grade 3","Grade 4","Grade 5","Grade 6"],junior_high:["Junior High Grade 1","Junior High Grade 2","Junior High Grade 3"],senior_high:["Senior High Grade 1","Senior High Grade 2","Senior High Grade 3"],university:["Freshman","Sophomore","Junior","Senior"]})[e]||[],p=`${o}`;if(p=o>0&&o<=m.length?m[o-1]:o>m.length?d?"已毕业":"Graduated":d?"学前":"Pre-school",!d)return`${p}, ${u}`;{let e="1st"===c?"上":"下";return`${p}${e}`}}(e.educationStage,e.enrollmentYear,new Date,"zh",t):null}(e,f);v(e=>e.gradeSemester||y.current?e:{...e,gradeSemester:t||""}),W(e.educationStage||void 0)}}).catch(e=>u.V.error("[CorrectionEditor]","Failed to fetch user info for grade calculation",{error:e}))},[h,f]);let K=async()=>{if(!x.questionText.trim())return void N.c.warning(g.editor.enterQuestionFirst||"Please enter question text first");T(!0);try{let e=function({questionText:e,language:t,subject:r,imagePreview:a,gradeSemester:s,subjectId:n}){let i={questionText:e,language:t,subject:r};return a&&(i.imageBase64=a),s&&(i.gradeSemester=s),n&&(i.subjectId=n),i}({questionText:x.questionText,language:h,subject:x.subject,imagePreview:i,gradeSemester:x.gradeSemester??void 0,subjectId:x.subjectId});u.V.info("[Reanswer]",e.imageBase64?"Sending image + text (image available for mistake analysis)":"Sending text only (no image available)",{timeout:p});let t=await m.k.post("/api/reanswer",e,{timeout:p||18e4,recoverable:!0});v(e=>({...e,answerText:t.answerText,analysis:t.analysis,knowledgePoints:t.knowledgePoints,wrongAnswerText:t.wrongAnswerText||"",mistakeAnalysis:t.mistakeAnalysis||"",mistakeStatus:(0,q.x)(t.mistakeStatus,t.wrongAnswerText),difficultyStars:t.difficultyStars??e.difficultyStars})),N.c.success(g.editor.reanswerSuccess||"✅ Answer and analysis updated!")}catch(a){let e,t,r;u.V.error("[CorrectionEditor]","Reanswer failed",{error:a}),N.c.error((e=(0,B.d)(a)||"",r=(t=g.errors?.reanswer||{}).default||"Reanswer failed",e.includes("AI_AUTH_ERROR")?t.authError||g.errors?.AI_AUTH_ERROR||r:e.includes("AI_CONNECTION_FAILED")?t.connectionFailed||g.errors?.AI_CONNECTION_FAILED||r:e.includes("AI_RESPONSE_ERROR")&&(t.responseError||g.errors?.AI_RESPONSE_ERROR)||r))}finally{T(!1)}},Y=async()=>{if(!x.subjectId)return void N.c.warning(g.editor.messages?.selectNotebook||"Please select a notebook");if(!P){O(!0);try{await a({...x,paperLevel:D,mistakeStatus:(0,q.x)(x.mistakeStatus,x.wrongAnswerText)})}finally{O(!1)}}},Q=g.editor.placeholder||"Supports Markdown and LaTeX...",X=(0,_.f)(Z.find(e=>e.id===x.subjectId)?.name||null)||(0,_.f)(x.subject||null)||void 0;return(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("h2",{className:"text-2xl font-bold",children:g.editor.title}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(o.f,{variant:"outline",onClick:s,children:g.editor.cancel}),(0,t.jsxs)(o.f,{onClick:Y,disabled:P,children:[P?(0,t.jsx)(n.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,t.jsx)(j.f,{className:"mr-2 h-4 w-4"}),P?g.common?.pleaseWait||"Please wait...":g.editor.save]})]})]}),(0,t.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2",children:[(0,t.jsxs)("div",{className:"space-y-6",children:[i&&(0,t.jsx)(c.N,{children:(0,t.jsx)(c.O,{className:"p-4",children:(0,t.jsx)("img",{src:i,alt:"Original",className:"w-full rounded-md"})})}),(0,t.jsx)(I,{data:x,paperLevel:D,onChange:b}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:g.editor.question}),(0,t.jsx)(F.f,{value:x.questionText,onChange:e=>b({questionText:e}),className:"min-h-[150px] font-mono text-sm",placeholder:Q}),(0,t.jsx)(o.f,{variant:"default",size:"sm",onClick:K,disabled:E||!x.questionText.trim(),className:"w-full bg-gradient-to-r from-indigo-600 to-violet-500 hover:from-indigo-700 hover:to-violet-600 text-white font-medium",children:E?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.f,{className:"mr-2 h-4 w-4 animate-spin"}),g.editor.reanswering||"AI solving..."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(w.f,{className:"mr-2 h-4 w-4"}),g.editor.reanswer||"🔄 Reanswer (based on corrected question)"]})}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:g.editor.reanswerHint||"💡 If the question was misrecognized, correct it and click to regenerate answer"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:g.editor.tags}),(0,t.jsx)($.f,{value:x.knowledgePoints,onChange:e=>b({knowledgePoints:e}),placeholder:g.editor.tagsPlaceholder||"Enter knowledge tags...",enterHint:g.editor.createTagHint,subject:X,gradeStage:H}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:g.editor.tagsHint||"💡 Tag suggestions will appear as you type"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:g.editor.answer}),(0,t.jsx)(F.f,{value:x.answerText,onChange:e=>b({answerText:e}),className:"min-h-[100px] font-mono text-sm",placeholder:Q})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(C.f,{children:g.editor.analysis}),(0,t.jsx)(F.f,{value:x.analysis,onChange:e=>b({analysis:e}),className:"min-h-[200px] font-mono text-sm",placeholder:Q})]}),(0,t.jsx)(R,{data:x,onChange:b})]}),(0,t.jsx)(L,{data:x,children:M&&(0,t.jsx)(S,{data:x,onChange:b})})]})]})}],866531);var H=e.i(263676);e.s(["f",0,function({imported:e,onDismiss:r}){let{t:n}=(0,d.b)(),i=(e.duplicate?n.importFlow.duplicate:n.importFlow.imported).replace("{notebook}",e.notebookName||"-").replace("{id}",e.shortId||"-");return(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-3 rounded-lg border border-green-300 dark:border-green-800 bg-green-50 dark:bg-green-950/40 p-3 text-sm text-green-800 dark:text-green-200",role:"status",children:[(0,t.jsxs)("span",{className:"flex items-start gap-2 flex-1",children:[(0,t.jsx)(s.f,{className:"h-4 w-4 mt-0.5 shrink-0"}),i]}),(0,t.jsxs)("div",{className:"flex gap-2 shrink-0",children:[(0,t.jsx)(a.default,{href:`/error-items/${e.id}`,children:(0,t.jsx)(o.f,{size:"sm",variant:"outline",className:"bg-background",children:n.importFlow.viewItem})}),(0,t.jsx)(o.f,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:r,"aria-label":n.detail.close,children:(0,t.jsx)(H.X,{className:"h-4 w-4"})})]})]})}],430634)},717448,798469,956738,185592,267275,e=>{var t=e.i(843476),r=e.i(271645),a=e.i(515288),s=e.i(519455),n=e.i(624687),i=e.i(110204),l=e.i(632781),o=e.i(325597),c=e.i(328623),d=e.i(111110);e.s(["f",0,function({onSubmit:e,isAnalyzing:u,defaultNotebookName:m}){let{t:p}=(0,d.b)(),[f,g]=(0,r.useState)(""),h=async()=>{f.trim()&&await e(f.trim())};return(0,t.jsx)(a.N,{className:"rounded-2xl",children:(0,t.jsxs)(a.O,{className:"p-6 space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground mb-2",children:[(0,t.jsx)(o.f,{className:"h-5 w-5"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:p.app?.textInputHint||"Enter question text"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(i.f,{htmlFor:"question-text",children:p.editor?.question||"Question Text"}),(0,t.jsx)(n.f,{id:"question-text",value:f,onChange:e=>g(e.target.value),onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&"Enter"===e.key&&(e.preventDefault(),f.trim()&&!u&&h())},placeholder:p.app?.textInputPlaceholder||"Paste or type question text here...\nSupports Markdown and LaTeX formulas (e.g. $x^2 + y^2 = 1$)\n\nCtrl+Enter to submit",className:"min-h-[200px] font-mono text-sm resize-y",disabled:u})]}),m&&(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[p.notebooks?.title||"My Notebooks",": ",m]}),(0,t.jsx)(s.f,{onClick:h,disabled:!f.trim()||u,className:"w-full bg-gradient-to-r from-indigo-600 to-violet-500 font-medium text-white hover:from-indigo-700 hover:to-violet-600",size:"lg",children:u?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(l.f,{className:"mr-2 h-4 w-4 animate-spin"}),p.editor?.reanswering||"AI solving..."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(c.f,{className:"mr-2 h-4 w-4"}),p.app?.aiSolve||"AI Solve"]})}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground text-center",children:p.app?.textInputTip||"After entering the question, AI will automatically solve and generate analysis"})]})})}],717448);let u=new Map([["avif","image/avif"],["bmp","image/bmp"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["gif","image/gif"],["gz","application/gzip"],["htm","text/html"],["html","text/html"],["ico","image/x-icon"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","application/javascript"],["json","application/json"],["md","text/markdown"],["mjs","application/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["ogg","audio/ogg"],["pdf","application/pdf"],["png","image/png"],["ppt","application/powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["svg","image/svg+xml"],["tif","image/tiff"],["tiff","image/tiff"],["txt","text/plain"],["wasm","application/wasm"],["wav","audio/x-wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["zip","application/zip"]]);var m=class extends Error{constructor(e){super("DataTransferItem is not a file"),this.item=e,this.name="UnexpectedObjectError"}};function p(e,t,r){let{webkitRelativePath:a}=e,s="string"==typeof t?t:"string"==typeof a&&a.length>0?a:`./${e.name}`;return"string"!=typeof e.path&&f(e,"path",s),void 0!==r&&Object.defineProperty(e,"handle",{value:r,writable:!1,configurable:!1,enumerable:!0}),f(e,"relativePath",s),e}function f(e,t,r){Object.defineProperty(e,t,{value:r,writable:!1,configurable:!1,enumerable:!0})}let g=[".DS_Store","Thumbs.db"];async function h(e,{mimeTypes:t=u}={}){return(await x(e)).map(e=>"path"in e?function(e,t=u){let{name:r}=e;if(r&&-1!==r.lastIndexOf(".")&&!e.type){let a=r.split(".").pop().toLowerCase(),s=t.get(a);s&&Object.defineProperty(e,"type",{value:s,writable:!1,configurable:!1,enumerable:!0})}return e}(e,t):e)}async function x(e){var t,r,a;if(v(e)&&v(e.dataTransfer))return w(e.dataTransfer,e.type);if(v(t=e)&&v(t.clipboardData)){let t;return j(((t=b((r=e.clipboardData).items).filter(e=>"file"===e.kind).map(e=>e.getAsFile()).filter(e=>null!==e)).length>0?t:b(r.files)).map(e=>p(e)))}if(v(a=e)&&v(a.target))return b(e.target.files).map(e=>p(e));return Array.isArray(e)&&e.every(e=>"getFile"in e&&"function"==typeof e.getFile)?y(e):[]}function v(e){return"object"==typeof e&&null!==e}async function y(e){return(await Promise.all(e.map(e=>e.getFile()))).map(e=>p(e))}async function w(e,t){let r=b(e.items).filter(e=>"file"===e.kind);return"drop"!==t?r:j(function e(t){let r=[];for(let a of t)Array.isArray(a)?r.push(...e(a)):r.push(a);return r}(await Promise.all(r.map(k))))}function j(e){return e.filter(e=>-1===g.indexOf(e.name))}function b(e){return null===e?[]:Array.from(e)}async function k(e){if("function"!=typeof e.webkitGetAsEntry)return N(e);let t=e.webkitGetAsEntry();if(t?.isDirectory){let r=await S(e);return r?.kind==="directory"?A(r,`/${r.name}`):E(t)}return N(e,t)}async function N(e,t){let r=e.getAsFile(),a=await S(e);if(null!=a){let e=r??await a.getFile();return e.handle=a,p(e)}if(!r)throw new m(e);return p(r,t?.fullPath??void 0)}async function S(e){if(globalThis.isSecureContext&&"function"==typeof e.getAsFileSystemHandle)return e.getAsFileSystemHandle()}async function A(e,t){let r=[];for await(let a of e.values()){let e=`${t}/${a.name}`;if("directory"===a.kind)r.push(...await A(a,e));else{let t=await a.getFile();r.push(p(t,e,a))}}return r}async function D(e){return e.isDirectory?E(e):T(e)}function E(e){let t=e.createReader();return new Promise((e,r)=>{let a=[];!function s(){t.readEntries(async t=>{if(t.length){let e=Promise.all(t.map(D));a.push(e),s()}else try{e(await Promise.all(a))}catch(e){r(e)}},e=>{r(e)})}()})}async function T(e){return new Promise((t,r)=>{e.file(r=>{t(p(r,e.fullPath))},e=>{r(e)})})}let C=function(e,t){if(e&&t){let r=(Array.isArray(t)?t:t.split(",")).filter(e=>""!==e.trim());if(0===r.length)return!0;let a=e.name||"",s=(e.type||"").toLowerCase(),n=s.replace(/\/.*$/,"");return r.some(e=>{let t=e.trim().toLowerCase();return"."===t.charAt(0)?a.toLowerCase().endsWith(t):t.endsWith("/*")?n===t.replace(/\/.*$/,""):s===t})}return!0},I=["KB","MB","GB","TB","PB"];function F(e){if(e<1024)return`${e} ${1===e?"byte":"bytes"}`;let t=e/1024,r=0;for(;t>=1024&&r<I.length-1;)t/=1024,r++;return`${Number(t.toFixed(2))} ${I[r]}`}function P(e){return{code:"file-too-large",message:`File is larger than ${F(e)}`}}function R(e){return{code:"file-too-small",message:`File is smaller than ${F(e)}`}}let O={code:"too-many-files",message:"Too many files"};function M(e,t){let r="application/x-moz-file"===e.type||C(e,t??"")||""===e.type&&"function"==typeof e.getAsFile;return[r,r?null:function(e=""){let t=e.split(","),r=t.length>1?`one of ${t.join(", ")}`:t[0];return{code:"file-invalid-type",message:`File type must be ${r}`}}(t)]}function z(e,t,r){if(L(e.size)){if(L(t)&&L(r)){if(e.size>r)return[!1,P(r)];if(e.size<t)return[!1,R(t)]}else if(L(t)&&e.size<t)return[!1,R(t)];else if(L(r)&&e.size>r)return[!1,P(r)]}return[!0,null]}function L(e){return null!=e}function $(e){return"function"==typeof e.isPropagationStopped?e.isPropagationStopped():void 0!==e.cancelBubble&&e.cancelBubble}function G(e){let t=e.dataTransfer??e.clipboardData;return t?Array.prototype.some.call(t.types,e=>"Files"===e||"application/x-moz-file"===e)||Array.prototype.some.call(t.items??[],U):!!e.target&&!!e.target.files}function U(e){return"object"==typeof e&&null!==e&&"file"===e.kind}function _(e){e.preventDefault()}function q(...e){return(t,...r)=>e.some(e=>(!$(t)&&e&&e(t,...r),$(t)))}function V(e){return Array.isArray(e)?e:"string"==typeof e?[e]:[]}function B(e){if(L(e))return Array.isArray(e)?e.filter(e=>L(e)&&L(e.accept)):[{accept:e}]}function H(e,{omitWildcardMimeTypesWithExtensions:t=!1}={}){if(L(e))return Object.entries(e).reduce((e,[r,a])=>{let s=V(a);return t&&r.endsWith("/*")&&s.some(Z)?e.push(...s):e.push(r,...s),e},[]).filter(e=>W(e)||Z(e)).join(",")}function W(e){return"audio/*"===e||"video/*"===e||"image/*"===e||"text/*"===e||"application/*"===e||/\w+\/[-+.\w]+/g.test(e)}function Z(e){return/^.*\.[\w]+$/.test(e)}(0,r.forwardRef)(({children:e,...a},s)=>{let{open:n,...i}=K(a);return(0,r.useImperativeHandle)(s,()=>({open:n}),[n]),(0,t.jsx)(t.Fragment,{children:e?.({...i,open:n})})}).displayName="Dropzone";let J={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragUnknown:!1,isDragGlobal:!1,isProcessing:!1,acceptedFiles:[],fileRejections:[],dragFileRejections:[]};function K(e={}){let{accept:t,disabled:a=!1,getFilesFromEvent:s=h,maxSize:n=1/0,minSize:i=0,multiple:l=!0,maxFiles:o=0,onDragEnter:c,onDragLeave:d,onDragOver:u,onDrop:m,onDropAccepted:p,onDropRejected:f,onFileDialogCancel:g,onFileDialogOpen:x,useFsAccessApi:v=!1,autoFocus:y=!1,preventDropOnDocument:w=!0,noClick:j=!1,noKeyboard:b=!1,noDrag:k=!1,noDragEventsBubbling:N=!1,noPaste:S=!1,onError:A,validator:D,getErrorMessage:E}=e,T=(0,r.useMemo)(()=>(function(e){let t=B(e);if(!L(t))return;let r={};for(let e of t)for(let[t,a]of Object.entries(e.accept)){let e=r[t]??(r[t]=[]);for(let t of V(a))e.includes(t)||e.push(t)}return r})(t),[t]),C=(0,r.useMemo)(()=>H(T),[T]),I=(0,r.useMemo)(()=>H(T,{omitWildcardMimeTypesWithExtensions:!0}),[T]),F=(0,r.useMemo)(()=>(function(e){let t=B(e);if(!L(t))return;let r=t.map(e=>{let t=Object.entries(e.accept).filter(([e,t])=>{let r=!0;return W(e)||(console.warn(`Skipped "${e}" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.`),r=!1),(Array.isArray(t)||"string"==typeof t)&&V(t).every(Z)||(console.warn(`Skipped "${e}" because an invalid file extension was provided.`),r=!1),r}).reduce((e,[t,r])=>(e[t]=V(r),e),{});return{description:L(e.description)&&""!==e.description?e.description:function(e){let t=[],r=Object.keys(e);for(let r of Object.values(e))for(let e of V(r))t.includes(e)||t.push(e);return t.length>0?t.join(", "):r.length>0?r.join(", "):"Files"}(t),accept:t}}).filter(e=>Object.keys(e.accept).length>0);return r.length>0?r:void 0})(t),[t]),P=(0,r.useMemo)(()=>"function"==typeof x?x:Q,[x]),R=(0,r.useMemo)(()=>"function"==typeof g?g:Q,[g]),U=(0,r.useRef)(null),X=(0,r.useRef)(null),[ee,et]=(0,r.useReducer)(Y,J),{isFocused:er,isFileDialogActive:ea}=ee,es=(0,r.useRef)(ea);es.current=ea;let en=(0,r.useRef)(null),ei=(0,r.useCallback)(()=>{en.current?.abort();let e=new AbortController;return en.current=e,et({type:"setProcessing",isProcessing:!0}),e.signal},[]),el=(0,r.useCallback)(e=>{e.aborted||et({type:"setProcessing",isProcessing:!1})},[]);(0,r.useEffect)(()=>()=>en.current?.abort(),[]);let eo=(0,r.useRef)("u">typeof window&&window.isSecureContext&&v&&"showOpenFilePicker"in window),ec=()=>{!eo.current&&ea&&setTimeout(()=>{if(X.current){let{files:e}=X.current;e?.length||(et({type:"closeDialog"}),R())}},300)};(0,r.useEffect)(()=>(window.addEventListener("focus",ec,!1),()=>{window.removeEventListener("focus",ec,!1)}),[X,ea,R,eo]);let ed=(0,r.useRef)([]),eu=(0,r.useRef)([]),em=e=>{U.current&&e.target&&U.current.contains(e.target)&&e.defaultPrevented||(e.preventDefault(),ed.current=[])};(0,r.useEffect)(()=>(w&&(document.addEventListener("dragover",_,!1),document.addEventListener("drop",em,!1)),()=>{w&&(document.removeEventListener("dragover",_),document.removeEventListener("drop",em))}),[U,w]),(0,r.useEffect)(()=>{let e=e=>{e.target&&(eu.current=[...eu.current,e.target]),G(e)&&et({isDragGlobal:!0,type:"setDragGlobal"})},t=e=>{eu.current=eu.current.filter(t=>t!==e.target&&null!==t),eu.current.length>0||et({isDragGlobal:!1,type:"setDragGlobal"})},r=()=>{eu.current=[],et({isDragGlobal:!1,type:"setDragGlobal"})},a=()=>{eu.current=[],et({isDragGlobal:!1,type:"setDragGlobal"})};return document.addEventListener("dragenter",e,!1),document.addEventListener("dragleave",t,!1),document.addEventListener("dragend",r,!1),document.addEventListener("drop",a,!1),()=>{document.removeEventListener("dragenter",e),document.removeEventListener("dragleave",t),document.removeEventListener("dragend",r),document.removeEventListener("drop",a)}},[U]),(0,r.useEffect)(()=>(!a&&y&&U.current&&U.current.focus(),()=>{}),[U,y,a]);let ep=(0,r.useCallback)(e=>{A?A(e):console.error(e)},[A]),ef=(0,r.useCallback)(e=>{e.preventDefault(),e.persist?.(),eE(e),!es.current&&(ed.current=[...ed.current,e.target],G(e)&&Promise.resolve(s(e)).then(t=>{if($(e)&&!N)return;let r=t.length>0?function({files:e,accept:t,minSize:r,maxSize:a,multiple:s,maxFiles:n=0,validator:i,getErrorMessage:l}){let o=[],c=[],d=(e,t)=>l&&"u">typeof File&&t instanceof File?{...e,message:l(e,t)}:e;e.forEach(e=>{let[s,n]=M(e,t),[i,l]=z(e,r,a);s&&i?o.push(e):c.push({file:e,errors:[n,l].filter(e=>null!=e).map(t=>d(t,e))})});let u=s?n>=1?n:1/0:1;return(o.length>u&&o.slice(u).forEach(e=>{c.push({file:e,errors:[d(O,e)]})}),c.length>0)?{verdict:"reject",rejections:c}:{verdict:i?"unknown":"accept",rejections:c}}({files:t,accept:C,minSize:i,maxSize:n,multiple:l,maxFiles:o,validator:D,getErrorMessage:E}):null;et({isDragAccept:r?.verdict==="accept",isDragReject:r?.verdict==="reject",isDragUnknown:r?.verdict==="unknown",isDragActive:!0,dragFileRejections:r?.rejections??[],type:"setDraggedFiles"}),c&&c(e)}).catch(e=>ep(e)))},[s,c,ep,N,C,i,n,l,o,D,E]),eg=(0,r.useCallback)(e=>{if(e.preventDefault(),e.persist?.(),eE(e),es.current)return!1;let t=G(e);if(t&&e.dataTransfer)try{e.dataTransfer.dropEffect="copy"}catch{}return t&&u&&u(e),!1},[u,N]),eh=(0,r.useCallback)(e=>{e.preventDefault(),e.persist?.(),eE(e);let t=ed.current.filter(e=>U.current?.contains(e)),r=t.indexOf(e.target);-1!==r&&t.splice(r,1),ed.current=t,!(t.length>0)&&(et({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragUnknown:!1,dragFileRejections:[]}),G(e)&&d&&d(e))},[U,d,N]),ex=(0,r.useCallback)(async(e,t,r)=>{let a,s=(e,t)=>E?{...e,message:E(e,t)}:e,c=e=>{let r=[],a=[];e.forEach(({file:e,accepted:t,acceptError:n,sizeMatch:i,sizeError:l,customErrors:o})=>{let c=!o||Array.isArray(o)&&0===o.length;if(t&&i&&c)r.push(e);else{let t=[n,l];o&&(t=t.concat(o)),a.push({file:e,errors:t.filter(e=>null!=e).map(t=>s(t,e))})}});let n=l?o>=1?o:1/0:1;r.length>n&&r.splice(n).forEach(e=>{a.push({file:e,errors:[s(O,e)]})}),et({acceptedFiles:r,fileRejections:a,type:"setFiles"}),m&&m(r,a,t),a.length>0&&f&&f(a,t),r.length>0&&p&&p(r,t)},d=e.map(e=>{let[t,r]=M(e,I),[a,s]=z(e,i,n);return{file:e,accepted:t,acceptError:r,sizeMatch:a,sizeError:s,customErrors:D?D(e):null}});if(!d.some(({customErrors:e})=>null!=e&&"function"==typeof e.then))return void c(d);try{a=await Promise.all(d.map(async({customErrors:e,...t})=>({...t,customErrors:await e})))}catch(e){r.aborted||(el(r),ep(e));return}r.aborted||c(a)},[et,l,I,i,n,o,m,p,f,D,E,ep,el]),ev=(0,r.useCallback)(e=>{if(e.preventDefault(),e.persist?.(),eE(e),ed.current=[],(!es.current||!e.dataTransfer)&&(et({type:"reset"}),G(e))){let t=ei();Promise.resolve(s(e)).then(r=>{if(!t.aborted)return $(e)&&!N?void el(t):ex(r,e,t)}).catch(e=>{t.aborted||(el(t),ep(e))})}},[s,ex,ep,N,ei,el]),ey=(0,r.useCallback)(e=>{if(!G(e))return;e.preventDefault(),e.persist?.(),eE(e);let t=ei();Promise.resolve(s(e)).then(r=>{if(!t.aborted)return $(e)&&!N?void el(t):ex(r,e,t)}).catch(e=>{t.aborted||(el(t),ep(e))})},[s,ex,ep,N,ei,el]),ew=(0,r.useCallback)(()=>{if(eo.current){let e;et({type:"openDialog"}),P(),window.showOpenFilePicker({multiple:l,types:F}).then(t=>(e=ei(),s(t))).then(t=>{if(et({type:"closeDialog"}),!e.aborted)return ex(t,null,e)}).catch(t=>{(e&&el(e),t instanceof DOMException&&("AbortError"===t.name||t.code===t.ABORT_ERR))?(R(t),et({type:"closeDialog"})):t instanceof DOMException&&("SecurityError"===t.name||t.code===t.SECURITY_ERR)||t instanceof DOMException&&"NotAllowedError"===t.name?(eo.current=!1,X.current?(X.current.value="",X.current.click()):ep(Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):ep(t)});return}X.current&&(et({type:"openDialog"}),P(),X.current.value="",X.current.click())},[et,P,R,v,ex,ep,F,l,ei,el]),ej=(0,r.useCallback)(e=>{U.current?.isEqualNode(e.target)&&(" "===e.key||"Enter"===e.key||32===e.keyCode||13===e.keyCode)&&(e.preventDefault(),ew())},[U,ew]),eb=(0,r.useCallback)(()=>{et({type:"focus"})},[]),ek=(0,r.useCallback)(()=>{et({type:"blur"})},[]),eN=(0,r.useCallback)(()=>{j||(function(e=window.navigator.userAgent){return -1!==e.indexOf("MSIE")||-1!==e.indexOf("Trident/")||-1!==e.indexOf("Edge/")}()?setTimeout(ew,0):ew())},[j,ew]),eS=e=>a?null:e,eA=e=>b?null:eS(e),eD=e=>k?null:eS(e),eE=e=>{N&&e.stopPropagation()},eT=(0,r.useMemo)(()=>({refKey:e="ref",role:t,onKeyDown:r,onFocus:s,onBlur:n,onClick:i,onDragEnter:l,onDragOver:o,onDragLeave:c,onDrop:d,onPaste:u,...m}={})=>{let p;return{onKeyDown:eA(q(r,ej)),onFocus:eA(q(s,eb)),onBlur:eA(q(n,ek)),onClick:eS(q(i,eN)),onDragEnter:eD(q(l,ef)),onDragOver:eD(q(o,eg)),onDragLeave:eD(q(c,eh)),onDrop:eD(q(d,ev)),onPaste:(p=q(u,ey),S?null:eS(p)),role:"string"==typeof t&&""!==t?t:"presentation",[e]:U,...!a&&!b?{tabIndex:0}:{},...a?{"aria-disabled":!0}:{},...m}},[U,ej,eb,ek,eN,ef,eg,eh,ev,ey,b,k,S,a]),eC=(0,r.useCallback)(e=>{e.stopPropagation()},[]),eI=(0,r.useMemo)(()=>({refKey:e="ref",onChange:t,onClick:r,...a}={})=>({accept:I,multiple:l,type:"file","aria-label":"file upload",style:{border:0,display:"block",height:0,margin:0,maxWidth:0,opacity:0,overflow:"hidden",padding:0,width:0},onChange:eS(q(t,ev)),onClick:eS(q(r,eC)),tabIndex:-1,[e]:X,...a}),[X,t,l,ev,a]);return{...ee,isFocused:er&&!a,getRootProps:eT,getInputProps:eI,rootRef:U,inputRef:X,open:eS(ew)}}function Y(e,t){switch(t.type){case"focus":return{...e,isFocused:!0};case"blur":return{...e,isFocused:!1};case"openDialog":return{...J,isFileDialogActive:!0};case"closeDialog":return{...e,isFileDialogActive:!1};case"setDraggedFiles":return{...e,isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject,isDragUnknown:t.isDragUnknown,dragFileRejections:t.dragFileRejections};case"setProcessing":return{...e,isProcessing:t.isProcessing};case"setFiles":return{...e,acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,dragFileRejections:[],isProcessing:!1,isDragReject:!1,isDragUnknown:!1};case"setDragGlobal":return{...e,isDragGlobal:t.isDragGlobal};case"reset":return{...J};default:return e}}function Q(){}var X=e.i(456420);let ee={name:"cloud-upload",size:24,node:[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],aliases:["upload-cloud"]};ee.node;let et=(0,X.f)(ee);var er=e.i(446513);let ea={name:"clipboard-paste",size:24,node:[["path",{d:"M11 14h10",key:"1w8e9d"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v1.344",key:"1e62lh"}],["path",{d:"m17 18 4-4-4-4",key:"z2g111"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113",key:"bjbb7m"}],["rect",{x:"8",y:"2",width:"8",height:"4",rx:"1",key:"ublpy"}]]};ea.node;let es=(0,X.f)(ea);var en=e.i(201276),ei=e.i(294114);let el=()=>()=>{};function eo(){return(0,r.useSyncExternalStore)(el,()=>!0,()=>!1)}e.s(["f",0,function({onImageSelect:e,isAnalyzing:n}){let{t:i}=(0,d.b)(),[o,c]=(0,r.useState)(!1),u=eo();(0,r.useEffect)(()=>{"Notification"in window&&"default"===Notification.permission&&Notification.requestPermission()},[]);let{getRootProps:m,getInputProps:p,isDragActive:f}=K({onDrop:(0,r.useCallback)(t=>{let r=t[0];r&&e(r)},[e]),accept:{"image/*":[".jpeg",".jpg",".png"]},maxFiles:1,disabled:n}),g=(0,r.useCallback)(t=>{let r=t.type||"image/png",a=r.split("/")[1]||"png";e(t instanceof File&&t.name?t:new File([t],`clipboard-${Date.now()}.${a}`,{type:r}))},[e]);(0,r.useEffect)(()=>{let e=e=>{if(n)return;let t=e.target;if(t&&(t.isContentEditable||["INPUT","TEXTAREA"].includes(t.tagName)))return;let r=Array.from(e.clipboardData?.items??[]).find(e=>"file"===e.kind&&e.type.startsWith("image/")),a=r?.getAsFile();a&&(e.preventDefault(),g(a))};return window.addEventListener("paste",e),()=>window.removeEventListener("paste",e)},[n,g]);let h=async()=>{if(!(u&&"u">typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.read))return void ei.c.warning(i.upload.pasteNotSupported);try{for(let e of(await navigator.clipboard.read())){let t=e.types.find(e=>e.startsWith("image/"));if(t){let r=await e.getType(t);g(r);return}}ei.c.warning(i.upload.pasteNoImage)}catch(e){en.V.warn("[UploadZone]","Clipboard read failed",{error:e instanceof Error?e.message:String(e)}),e instanceof Error&&"NotAllowedError"===e.name?ei.c.warning(i.upload.pastePermissionDenied):ei.c.error(i.upload.pasteFailed)}},x=()=>u&&"u">typeof navigator&&"mediaDevices"in navigator&&"getDisplayMedia"in navigator.mediaDevices,v=async()=>{if(!x())return void ei.c.warning(i.upload.screenshotNotSupported);c(!0);try{let t;"CaptureController"in window&&(t=new window.CaptureController);let r={video:!0,audio:!1,preferCurrentTab:!1};t&&(r.controller=t);let a=await navigator.mediaDevices.getDisplayMedia(r),[s]=a.getVideoTracks(),n=s.getSettings().displaySurface;if(t&&("browser"===n||"window"===n))try{t.setFocusBehavior("no-focus-change"),en.V.info("[UploadZone]","Screenshot focus behavior set to no-change",void 0,{sendToBackend:!1})}catch(e){en.V.warn("[UploadZone]","Unable to set screenshot focus behavior",{error:e})}let i=document.createElement("video");if(i.srcObject=a,i.muted=!0,i.autoplay=!0,i.playsInline=!0,await new Promise((e,t)=>{i.onloadedmetadata=()=>{i.play().then(()=>{e()}).catch(t)},i.onerror=t}),await new Promise(e=>setTimeout(e,500)),0===i.videoWidth||0===i.videoHeight)throw Error("视频没有有效尺寸");let l=document.createElement("canvas");l.width=i.videoWidth,l.height=i.videoHeight;let o=l.getContext("2d");if(!o)throw Error("无法获取canvas上下文");o.drawImage(i,0,0),a.getTracks().forEach(e=>e.stop()),l.toBlob(t=>{t?(e(new File([t],`screenshot-${Date.now()}.png`,{type:"image/png"})),en.V.info("[UploadZone]","Screenshot captured",void 0,{sendToBackend:!1})):ei.c.error("截图转换失败")},"image/png",1)}catch(e){en.V.error("[UploadZone]","Screenshot failed",{error:e}),e instanceof Error&&("NotAllowedError"===e.name?ei.c.warning(i.upload.screenshotPermissionDenied):ei.c.error(`${i.upload.screenshotFailed}: ${e.message}`))}finally{c(!1)}};return(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(a.N,{...m(),className:`group cursor-pointer rounded-2xl border-2 border-dashed shadow-none transition-all hover:border-primary/60 hover:bg-accent/40 ${f?"border-primary bg-accent/60":"border-border bg-card"}`,children:(0,t.jsxs)(a.O,{className:"flex min-h-[260px] flex-col items-center justify-center space-y-4 py-10 text-center md:min-h-[300px]",children:[(0,t.jsx)("input",{...p()}),(0,t.jsx)("div",{className:"rounded-2xl bg-accent p-4 text-primary transition-transform group-hover:scale-105",children:n?(0,t.jsx)(l.f,{className:"h-10 w-10 animate-spin"}):(0,t.jsx)(et,{className:"h-10 w-10"})}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("h3",{className:"text-lg font-semibold",children:n?i.app.analyzing:i.upload.analyze}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:n?i.app.analyzing:i.app.dragDrop}),(0,t.jsx)("p",{className:"mt-2 text-xs text-muted-foreground",children:i.upload.support})]})]})}),(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:flex-wrap items-stretch sm:items-start justify-center gap-4",children:[u&&(0,t.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,t.jsxs)(s.f,{variant:"outline",onClick:h,disabled:n,className:"flex items-center gap-2 w-full sm:w-auto",children:[(0,t.jsx)(es,{className:"h-4 w-4"}),i.upload.paste]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground text-center",children:i.upload.pasteDesc})]}),x()&&(0,t.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,t.jsxs)(s.f,{variant:"outline",onClick:v,disabled:n||o,className:"flex items-center gap-2 w-full sm:w-auto",children:[o?(0,t.jsx)(l.f,{className:"h-4 w-4 animate-spin"}):(0,t.jsx)(er.f,{className:"h-4 w-4"}),o?i.common.pleaseWait:i.upload.screenshot]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground text-center",children:i.upload.screenshotDesc})]})]})]})}],798469);var ec=e.i(30030),ed=e.i(248425),eu=Object.defineProperty,em=(e,t)=>eu(e,"name",{value:t,configurable:!0}),ep="Progress",[ef,eg]=(0,ec.f)(ep),[eh,ex]=ef(ep),ev=r.forwardRef(em(function(e,r){let{__scopeProgress:a,value:s=null,max:n,getValueLabel:i=ew,...l}=e;(n||0===n)&&!ek(n)&&console.error(eS(`${n}`,"Progress"));let o=ek(n)?n:100;null===s||eN(s,o)||console.error(eA(`${s}`,"Progress"));let c=eN(s,o)?s:null,d=eb(c)?i(c,o):void 0;return(0,t.jsx)(eh,{scope:a,value:c,max:o,children:(0,t.jsx)(ed.V.div,{"aria-valuemax":o,"aria-valuemin":0,"aria-valuenow":eb(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":ej(c,o),"data-value":c??void 0,"data-max":o,...l,ref:r})})},"Progress")),ey=r.forwardRef(em(function(e,r){let{__scopeProgress:a,...s}=e,n=ex("ProgressIndicator",a);return(0,t.jsx)(ed.V.div,{"data-state":ej(n.value,n.max),"data-value":n.value??void 0,"data-max":n.max,...s,ref:r})},"ProgressIndicator"));function ew(e,t){return`${Math.round(e/t*100)}%`}function ej(e,t){return null==e?"indeterminate":e===t?"complete":"loading"}function eb(e){return"number"==typeof e}function ek(e){return eb(e)&&!isNaN(e)&&e>0}function eN(e,t){return eb(e)&&!isNaN(e)&&e<=t&&e>=0}function eS(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`100\`.`}function eA(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
|
|
2
2
|
- a positive number
|
|
3
3
|
- less than the value passed to \`max\` (or 100 if no \`max\` prop is set)
|
|
4
4
|
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
5
5
|
|
|
6
|
-
Defaulting to \`null\`.`}em(ew,"defaultGetValueLabel"),em(ej,"getProgressState"),em(eb,"isNumber"),em(ek,"isValidMaxNumber"),em(eN,"isValidValueNumber"),em(eS,"getInvalidMaxError"),em(eA,"getInvalidValueError");var eD=e.i(975157);let eE=r.forwardRef(({className:e,value:r,...a},s)=>(0,t.jsx)(ev,{ref:s,value:r,className:(0,eD.f)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...a,children:(0,t.jsx)(ey,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(r||0)}%)`}})}));eE.displayName=ev.displayName;let eT={compressing:10,uploading:20,analyzing:50,processing:85,saving:95};function eC({status:e,message:a,className:s}){let n,{t:i}=(0,d.b)(),[o]=(0,r.useState)(()=>Date.now()),[c,u]=(0,r.useState)(0);(0,r.useEffect)(()=>{let e=setInterval(()=>{u(Math.max(0,Math.floor((Date.now()-o)/1e3)))},1e3);return()=>clearInterval(e)},[o]);let m=eT[e],
|
|
6
|
+
Defaulting to \`null\`.`}em(ew,"defaultGetValueLabel"),em(ej,"getProgressState"),em(eb,"isNumber"),em(ek,"isValidMaxNumber"),em(eN,"isValidValueNumber"),em(eS,"getInvalidMaxError"),em(eA,"getInvalidValueError");var eD=e.i(975157);let eE=r.forwardRef(({className:e,value:r,...a},s)=>(0,t.jsx)(ev,{ref:s,value:r,className:(0,eD.f)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...a,children:(0,t.jsx)(ey,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(r||0)}%)`}})}));eE.displayName=ev.displayName;let eT={compressing:10,uploading:20,analyzing:50,processing:85,saving:95};function eC({status:e,message:a,className:s}){let n,{t:i}=(0,d.b)(),[o]=(0,r.useState)(()=>Date.now()),[c,u]=(0,r.useState)(0);(0,r.useEffect)(()=>{let e=setInterval(()=>{u(Math.max(0,Math.floor((Date.now()-o)/1e3)))},1e3);return()=>clearInterval(e)},[o]);let m=eT[e],p=i.common.progress.estimated.replace("{percent}",String(m));return(0,t.jsx)("div",{className:(0,eD.f)("fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",s),children:(0,t.jsx)("div",{className:"w-full max-w-md p-6 space-y-6 bg-card rounded-lg border shadow-lg mx-4",children:(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center space-y-4 text-center",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(l.f,{className:"h-12 w-12 animate-spin text-primary"}),(0,t.jsx)("div",{className:"absolute inset-0 flex items-center justify-center"})]}),(0,t.jsxs)("div",{className:"space-y-2 w-full",children:[(0,t.jsx)("h3",{className:"text-lg font-semibold tracking-tight","aria-live":"polite",children:a||i.common.progress[e]}),(0,t.jsx)(eE,{value:m,"aria-label":p,"aria-valuetext":p,className:"h-2 w-full"})]}),(0,t.jsxs)("div",{className:"flex w-full flex-wrap items-center justify-between gap-2 text-sm text-muted-foreground tabular-nums",children:[(0,t.jsx)("span",{children:p}),(0,t.jsx)("span",{role:"timer","aria-live":"off",children:i.common.progress.elapsed.replace("{time}",(n=[Math.floor(c/60)%60,c%60],c>=3600&&n.unshift(Math.floor(c/3600)),n.map(e=>String(e).padStart(2,"0")).join(":")))})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:i.common.progress.estimateHint})]})})})}e.s(["f",0,function({status:e,message:r,className:a}){return eo()&&"idle"!==e?(0,t.jsx)(eC,{status:e,message:r,className:a}):null}],956738),e.s(["f",0,function({options:e,value:r,onChange:a,className:s}){return(0,t.jsx)("div",{className:(0,eD.f)("grid gap-1 rounded-xl bg-muted p-1",s),style:{gridTemplateColumns:`repeat(${e.length}, minmax(0, 1fr))`},role:"tablist",children:e.map(({value:e,label:s,icon:n})=>{let i=e===r;return(0,t.jsxs)("button",{type:"button",role:"tab","aria-selected":i,className:(0,eD.f)("flex items-center justify-center gap-1.5 rounded-lg px-2 py-2.5 text-sm font-medium transition-all",i?"bg-card text-primary shadow-sm":"text-muted-foreground hover:text-foreground"),onClick:()=>a(e),children:[n&&(0,t.jsx)(n,{className:"h-4 w-4 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:s})]},e)})})}],185592);var eI=e.i(618566),eF=e.i(303163);function eP(e,t){let r=t.common?.messages?.analysisFailed||"Analysis failed, please try again",a=(0,eF.d)(e);if(a){let e=t.errors??{};if(!(a in e))return a;let s=e[a];return"string"==typeof s?s:r}let s=(0,eF.Z)(e);if(s.includes("fetch")||s.includes("network"))return t.errors?.AI_CONNECTION_FAILED||"网络连接失败";if("object"==typeof e&&null!==e&&"data"in e&&"string"==typeof e.data){let t="status"in e&&"number"==typeof e.status?e.status:"Error";return`${r} (${t})`}return r}var eR=e.i(41931),eO=e.i(28928),eM=e.i(62825),ez=e.i(364002);e.s(["f",0,function({logPrefix:e,analyzeSubjectId:t,importSubjectId:a,textNotebook:s,fixedSubjectId:n,onParsed:i}){let{t:l,language:o}=(0,d.b)(),c=(0,eI.useRouter)(),[u,m]=(0,r.useState)("upload"),[p,f]=(0,r.useState)("idle"),[g,h]=(0,r.useState)(null),[x,v]=(0,r.useState)(null),[y,w]=(0,r.useState)(null),[j,b]=(0,r.useState)(null),[k,N]=(0,r.useState)(!1),[S,A]=(0,r.useState)(!1),[D,E]=(0,r.useState)(null),[T,C]=(0,r.useState)(null),I=y?.timeouts?.analyze||18e4,F=I+1e4;(0,r.useEffect)(()=>()=>{j&&URL.revokeObjectURL(j)},[j]),(0,r.useEffect)(()=>{(0,ez.x)().then(A),eR.k.get("/api/settings").then(w).catch(t=>en.V.error(e,"Failed to fetch config",{error:t}))},[e]),(0,r.useEffect)(()=>{if("idle"===p)return;let e=setTimeout(()=>{en.V.warn("[Progress]","处理超时,关闭进度提示",{analysisStep:p,safetyTimeout:F}),f("idle")},F);return()=>clearTimeout(e)},[p,F]);let P=async(t,r,s)=>{if(!S){f("saving");let n=await (0,ez.a)(t,{subjectId:a,imageUrl:r,paperLevel:s});E(n),v(null),en.V.info(e,"Imported without review",{id:n.id});return}v(r),h(t),m("review")},R=async r=>{let a=Date.now();en.V.info(e,"Starting analysis flow",{apiTimeout:I,safetyTimeout:F});try{f("compressing");let s=await (0,eO.f)(r);f("analyzing");let n=await eR.k.post("/api/analyze",{imageBase64:s,language:o,subjectId:t||void 0},{timeout:I,recoverable:!0});if(!n||"object"!=typeof n)throw Error("Invalid API response: data is null or not an object");f("processing"),S&&i?.(n),await P(n,s),en.V.info(e,"Analysis completed",{totalDuration:Date.now()-a})}catch(t){en.V.error(e,"Analysis failed",{errorDuration:Date.now()-a,error:(0,eF.Z)(t)}),ei.c.error(eP(t,l))}finally{f("idle")}},O=async t=>{let r=Date.now();en.V.info(e,"Starting text-based analysis",{textLength:t.length});try{f("analyzing");let a=await eR.k.post("/api/reanswer",{questionText:t,language:o,forImport:!0,subject:s?.name,subjectId:s?.id},{timeout:I,recoverable:!0});f("processing"),await P({questionText:t,answerText:a.answerText,analysis:a.analysis,knowledgePoints:a.knowledgePoints||[],wrongAnswerText:a.wrongAnswerText||"",mistakeAnalysis:a.mistakeAnalysis||"",mistakeStatus:(0,eM.h)(a.mistakeStatus),subject:a.subject||"其他",requiresImage:!1,difficultyStars:a.difficultyStars??null,gradeSemester:a.gradeSemester??null},null),en.V.info(e,"Text analysis completed",{totalDuration:Date.now()-r})}catch(t){en.V.error(e,"Text analysis failed",{errorDuration:Date.now()-r,error:(0,eF.Z)(t)}),ei.c.error(eP(t,l))}finally{f("idle")}},M=async t=>{try{let e=await eR.k.post("/api/error-items",t);return ei.c.success(e.duplicate?l.importFlow.duplicate:l.common.messages.saveSuccess),e.duplicate?c.push(`/error-items/${e.id}`):t.subjectId&&c.push(`/notebooks/${t.subjectId}`),!0}catch(t){return en.V.error(e,"Save failed",{errorMessage:(0,eF.d)(t)??(0,eF.Z)(t)}),ei.c.error(l.common?.messages?.saveFailed||"Failed to save"),!1}},z=async e=>{await M({...e,originalImageUrl:x||"",...n?{subjectId:n}:{}})&&(m("upload"),h(null),v(null))};return{step:u,cancelReview:()=>m("upload"),analysisStep:p,setAnalysisStep:f,isBusy:"idle"!==p,parsedData:g,currentImage:x,aiTimeout:I,croppingImage:j,isCropperOpen:k,closeCropper:()=>N(!1),lastImported:D,dismissImported:()=>E(null),batchBlobs:T,closeBatch:()=>C(null),selectImage:e=>{E(null),b(URL.createObjectURL(e)),N(!0)},cropComplete:e=>{N(!1),R(new File([e],"cropped-image.jpg",{type:"image/jpeg"}))},startBatch:e=>{N(!1),E(null),C(e)},submitText:O,saveQuestion:M,saveReviewed:z}}],267275)}])})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,399847,e=>{var t=e.i(456420);let s={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"]};s.node;let a=(0,t.f)(s);e.s(["f",0,a],399847)},586906,e=>{var t=e.i(843476),s=e.i(271645),a=e.i(618566),i=e.i(519455),r=e.i(793479),l=e.i(515288),n=e.i(522016),o=e.i(480342),c=e.i(111110),d=e.i(35209),u=e.i(215519),m=e.i(306831),h=e.i(772382),x=e.i(580860),g=e.i(632781),f=e.i(399847),p=e.i(41931),j=e.i(294114),v=e.i(201276),b=e.i(303163);e.s(["default",0,function(){let{timeZone:e}=(0,u.M)(),y=(0,a.useRouter)(),{t:N}=(0,c.b)();(0,d.f)(N.pageTitle.register);let[w,S]=(0,s.useState)(""),[k,C]=(0,s.useState)(""),[P,Y]=(0,s.useState)(""),[R,T]=(0,s.useState)(""),[q,F]=(0,s.useState)("junior_high"),[A,E]=(0,s.useState)("2025"),[z,H]=(0,s.useState)(""),[L,M]=(0,s.useState)(!1),[O,U]=(0,s.useState)(!1),[B,D]=(0,s.useState)(!1),[I,_]=(0,s.useState)(null),K=(0,s.useCallback)(async()=>{try{let e=await fetch("/api/register/status"),t=await e.json();_(t.allowRegistration)}catch(e){v.V.error("[Register]","Failed to check registration status",{error:e}),_(!1)}},[]);(0,s.useEffect)(()=>{K()},[K]);let J=async e=>{if(e.preventDefault(),M(!0),H(""),P!==R){H(N.auth?.register?.passwordMismatch||"Passwords do not match"),M(!1);return}try{await p.
|
|
1
|
+
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,399847,e=>{var t=e.i(456420);let s={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"]};s.node;let a=(0,t.f)(s);e.s(["f",0,a],399847)},586906,e=>{var t=e.i(843476),s=e.i(271645),a=e.i(618566),i=e.i(519455),r=e.i(793479),l=e.i(515288),n=e.i(522016),o=e.i(480342),c=e.i(111110),d=e.i(35209),u=e.i(215519),m=e.i(306831),h=e.i(772382),x=e.i(580860),g=e.i(632781),f=e.i(399847),p=e.i(41931),j=e.i(294114),v=e.i(201276),b=e.i(303163);e.s(["default",0,function(){let{timeZone:e}=(0,u.M)(),y=(0,a.useRouter)(),{t:N}=(0,c.b)();(0,d.f)(N.pageTitle.register);let[w,S]=(0,s.useState)(""),[k,C]=(0,s.useState)(""),[P,Y]=(0,s.useState)(""),[R,T]=(0,s.useState)(""),[q,F]=(0,s.useState)("junior_high"),[A,E]=(0,s.useState)("2025"),[z,H]=(0,s.useState)(""),[L,M]=(0,s.useState)(!1),[O,U]=(0,s.useState)(!1),[B,D]=(0,s.useState)(!1),[I,_]=(0,s.useState)(null),K=(0,s.useCallback)(async()=>{try{let e=await fetch("/api/register/status"),t=await e.json();_(t.allowRegistration)}catch(e){v.V.error("[Register]","Failed to check registration status",{error:e}),_(!1)}},[]);(0,s.useEffect)(()=>{K()},[K]);let J=async e=>{if(e.preventDefault(),M(!0),H(""),P!==R){H(N.auth?.register?.passwordMismatch||"Passwords do not match"),M(!1);return}try{await p.k.post("/api/register",{name:w,email:k,password:P,educationStage:q,enrollmentYear:parseInt(A)}),j.c.success(N.auth?.register?.success||"Registration successful! Please login"),y.push("/login")}catch(t){let e=(0,b.d)(t);e="User with this email already exists"===e?N.auth?.register?.emailExists||e:"Too many requests"===e?N.auth?.register?.tooManyAttempts||e:e||N.auth?.register?.failed||"Registration failed",H(e)}finally{M(!1)}};return null===I?(0,t.jsx)(o.f,{children:(0,t.jsx)("div",{className:"flex justify-center",children:(0,t.jsx)(g.f,{className:"h-8 w-8 animate-spin text-primary"})})}):!1===I?(0,t.jsx)(o.f,{children:(0,t.jsxs)(l.N,{className:"w-full rounded-2xl border-0 shadow-xl shadow-indigo-500/5 ring-1 ring-border",children:[(0,t.jsx)(l.Y,{children:(0,t.jsx)(l.v,{className:"text-2xl text-center",children:N.auth?.register?.disabled||"Registration Disabled"})}),(0,t.jsxs)(l.O,{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center gap-4 py-6",children:[(0,t.jsx)(f.f,{className:"h-12 w-12 text-muted-foreground"}),(0,t.jsx)("p",{className:"text-center text-muted-foreground",children:N.auth?.register?.disabledMessage||"Registration is currently disabled by administrator. Please contact admin for access."})]}),(0,t.jsx)("div",{className:"text-center",children:(0,t.jsx)(n.default,{href:"/login",className:"text-primary hover:underline",children:N.auth?.register?.backToLogin||"Back to Login"})})]})]})}):(0,t.jsx)(o.f,{children:(0,t.jsxs)(l.N,{className:"w-full rounded-2xl border-0 shadow-xl shadow-indigo-500/5 ring-1 ring-border",children:[(0,t.jsx)(l.Y,{children:(0,t.jsx)(l.v,{className:"text-2xl text-center",children:N.auth?.register?.title||"Create an Account"})}),(0,t.jsx)(l.O,{children:(0,t.jsxs)("form",{onSubmit:J,className:"space-y-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{htmlFor:"name",className:"text-sm font-medium",children:N.auth?.name||"Name"}),(0,t.jsx)(r.f,{id:"name",name:"name",type:"text",value:w,onChange:e=>S(e.target.value),required:!0})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{htmlFor:"email",className:"text-sm font-medium",children:N.auth?.email||"Email"}),(0,t.jsx)(r.f,{id:"email",name:"email",type:"email",value:k,onChange:e=>C(e.target.value),required:!0})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{htmlFor:"password",className:"text-sm font-medium",children:N.auth?.password||"Password"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(r.f,{id:"password",name:"password",type:O?"text":"password",value:P,onChange:e=>Y(e.target.value),required:!0,minLength:6,className:"pr-10"}),(0,t.jsx)(i.f,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>U(!O),tabIndex:-1,children:O?(0,t.jsx)(x.f,{className:"h-4 w-4 text-muted-foreground"}):(0,t.jsx)(h.f,{className:"h-4 w-4 text-muted-foreground"})})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{htmlFor:"confirmPassword",className:"text-sm font-medium",children:N.auth?.confirmPassword||"Confirm Password"}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(r.f,{id:"confirmPassword",name:"confirmPassword",type:B?"text":"password",value:R,onChange:e=>T(e.target.value),required:!0,minLength:6,className:"pr-10"}),(0,t.jsx)(i.f,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>D(!B),tabIndex:-1,children:B?(0,t.jsx)(x.f,{className:"h-4 w-4 text-muted-foreground"}):(0,t.jsx)(h.f,{className:"h-4 w-4 text-muted-foreground"})})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{htmlFor:"educationStage",className:"text-sm font-medium",children:N.auth?.educationStage||"Education Stage"}),(0,t.jsxs)("select",{id:"educationStage",name:"educationStage",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",value:q,onChange:e=>F(e.target.value),required:!0,children:[(0,t.jsx)("option",{value:"",disabled:!0,children:N.auth?.selectStage||"Select Stage"}),(0,t.jsx)("option",{value:"primary",children:N.auth?.primary||"Primary School"}),(0,t.jsx)("option",{value:"junior_high",children:N.auth?.juniorHigh||"Junior High"}),(0,t.jsx)("option",{value:"senior_high",children:N.auth?.seniorHigh||"Senior High"}),(0,t.jsx)("option",{value:"university",children:N.auth?.university||"University"})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{htmlFor:"enrollmentYear",className:"text-sm font-medium",children:N.auth?.enrollmentYear||"Enrollment Year"}),(0,t.jsx)(r.f,{id:"enrollmentYear",name:"enrollmentYear",type:"number",value:A,onChange:e=>E(e.target.value),placeholder:"YYYY",required:!0,min:1990,max:Number((0,m.r)(new Date,"yyyy",e))})]}),z&&(0,t.jsx)("div",{className:"rounded-lg bg-destructive/10 px-3 py-2 text-center text-sm text-destructive",children:z}),(0,t.jsx)(i.f,{type:"submit",size:"lg",className:"w-full",disabled:L,children:L?N.auth?.register?.registering||"Registering...":N.auth?.register?.action||"Register"}),(0,t.jsxs)("div",{className:"text-center text-sm text-muted-foreground",children:[N.auth?.register?.hasAccount||"Already have an account? ",(0,t.jsx)(n.default,{href:"/login",className:"text-primary hover:underline",children:N.auth?.register?.loginHere||"Login here"})]})]})})]})})}])},480342,e=>{var t=e.i(843476),s=e.i(325164),a=e.i(111110);e.s(["f",0,function({children:e,wide:i=!1}){let{t:r}=(0,a.b)();return(0,t.jsxs)("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[(0,t.jsx)("div",{className:"pointer-events-none absolute -left-32 -top-32 h-96 w-96 rounded-full bg-indigo-400/25 blur-3xl"}),(0,t.jsx)("div",{className:"pointer-events-none absolute -bottom-40 -right-24 h-[28rem] w-[28rem] rounded-full bg-violet-400/20 blur-3xl"}),(0,t.jsxs)("div",{className:`relative w-full space-y-6 py-8 ${i?"max-w-xl":"max-w-md"}`,children:[(0,t.jsxs)("div",{className:"flex flex-col items-center gap-3 text-center",children:[(0,t.jsx)(s.default,{src:"/icons/icon.png",alt:"",width:64,height:64,className:"rounded-2xl shadow-lg shadow-indigo-500/30",priority:!0,unoptimized:!0}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("p",{className:"text-xl font-bold tracking-tight",children:r.pageTitle.base}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:r.app.subtitle})]})]}),e]})]})}])},35209,e=>{var t=e.i(271645),s=e.i(111110);e.s(["f",0,function(...e){let{t:a}=(0,s.b)(),i=[a.pageTitle.base,...e.map(e=>"string"==typeof e?e.trim():"").filter(e=>e.length>0)].join("-");(0,t.useEffect)(()=>{document.title=i},[i])}])}])})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,770307,e=>{var s=e.i(843476),t=e.i(271645),a=e.i(618566),i=e.i(217255),r=e.i(632781),n=e.i(480342),o=e.i(519455),l=e.i(111110),c=e.i(41931),d=e.i(294114),u=e.i(201276),h=e.i(10038),p=e.i(835467);function m({onSaved:e}){let{t:a}=(0,l.b)(),[i,r]=(0,t.useState)({aiProvider:"minimax"}),[n,o]=(0,t.useState)(!0),[g,x]=(0,t.useState)(!1);(0,t.useEffect)(()=>{c.f.get("/api/settings").then(e=>{r("minimax"!==e.aiProvider||e.minimax?.apiKey?e:{...e,aiProvider:"minimax-code"})}).catch(e=>u.V.error("[Setup]","Failed to fetch settings",{error:e})).finally(()=>o(!1))},[]);let f=async()=>{let s=(0,p.f)(i,a);if(s)return void d.c.error(s);x(!0);try{r(await c.f.post("/api/settings",i)),d.c.success(a.settings?.messages?.saved||"Settings saved"),e()}catch(e){u.V.error("[Setup]","Failed to save AI settings",{error:e}),d.c.error(a.settings?.messages?.saveFailed||"Failed to save")}finally{x(!1)}};return(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:a.setup.ai.title}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:a.setup.ai.desc})]}),(0,s.jsx)(h.f,{config:i,setConfig:r,loading:n,saving:g,onSave:f})]})}var g=e.i(856423),x=e.i(551757),f=e.i(527161),j=e.i(303163);function b(){let{t:e}=(0,l.b)(),[a,i]=(0,t.useState)(!1),[r,n]=(0,t.useState)([]),h=async s=>{try{await c.f.post("/api/notebooks",s),n(e=>[...e,s.name])}catch(s){throw u.V.error("[Setup]","Failed to create notebook",{error:s}),d.c.error((0,j.d)(s)||e.notebooks?.createError||"Failed to create"),s}};return(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:e.setup.notebook.title}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:e.setup.notebook.desc})]}),r.map(t=>(0,s.jsxs)("p",{className:"flex items-center gap-2 text-sm text-emerald-600 dark:text-emerald-400",children:[(0,s.jsx)(x.f,{className:"h-4 w-4 shrink-0"}),e.setup.notebook.created.replace("{name}",t)]},t)),(0,s.jsxs)(o.f,{type:"button",variant:"outline",className:"w-full",onClick:()=>i(!0),children:[(0,s.jsx)(g.f,{className:"mr-2 h-4 w-4"}),e.setup.notebook.create]}),(0,s.jsx)(f.f,{open:a,onOpenChange:i,onCreate:h})]})}var v=e.i(110204),y=e.i(37038),w=e.i(553753);function N({onDone:e}){let{t:a}=(0,l.b)(),{update:n}=(0,i.useSession)(),[h,p]=(0,t.useState)(""),[m,g]=(0,t.useState)(""),[x,f]=(0,t.useState)(!1),b=async s=>{if(s.preventDefault(),h.length<6)return void d.c.error(a.setup.password.tooShort);if(h===w.v)return void d.c.error(a.setup.password.sameAsDefault);if(h!==m)return void d.c.error(a.setup.password.mismatch);f(!0);try{await c.f.patch("/api/user",{password:h}),await n(),d.c.success(a.setup.password.success),e()}catch(e){u.V.error("[Setup]","Failed to change default password",{error:e}),d.c.error((0,j.d)(e)||a.setup.password.failed)}finally{f(!1)}};return(0,s.jsxs)("form",{onSubmit:b,className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:a.setup.password.title}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:a.setup.password.desc})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(v.f,{htmlFor:"setup-new-password",children:a.setup.password.newPassword}),(0,s.jsx)(y.f,{id:"setup-new-password",autoComplete:"new-password",value:h,onChange:e=>p(e.target.value)})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(v.f,{htmlFor:"setup-confirm-password",children:a.setup.password.confirmPassword}),(0,s.jsx)(y.f,{id:"setup-confirm-password",autoComplete:"new-password",value:m,onChange:e=>g(e.target.value)})]}),(0,s.jsxs)(o.f,{type:"submit",className:"w-full",disabled:x,children:[x&&(0,s.jsx)(r.f,{className:"mr-2 h-4 w-4 animate-spin"}),a.setup.password.submit]})]})}function k({mustChangePassword:e,setupCompleted:i}){let{t:n}=(0,l.b)(),h=(0,a.useRouter)(),[p]=(0,t.useState)(()=>e&&i?["password"]:e?["password","ai","notebook"]:["ai","notebook"]),[g,x]=(0,t.useState)(0),[f,j]=(0,t.useState)(!1),v=p[g],y=g===p.length-1,w=async()=>{j(!0);try{await c.f.post("/api/setup",{}),d.c.success(n.setup.finished),h.replace("/")}catch(e){u.V.error("[Setup]","Failed to complete setup",{error:e}),d.c.error(n.setup.completeFailed),j(!1)}},S=()=>{y?w():x(e=>e+1)};return(0,s.jsxs)("div",{className:"space-y-5",children:[p.length>1&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("p",{className:"text-xs font-medium text-muted-foreground",children:n.setup.step.replace("{current}",String(g+1)).replace("{total}",String(p.length))}),(0,s.jsx)("div",{className:"flex gap-1.5",children:p.map((e,t)=>(0,s.jsx)("div",{className:`h-1.5 flex-1 rounded-full ${t<=g?"bg-primary":"bg-muted"}`},e))})]}),"password"===v&&(0,s.jsx)(N,{onDone:S}),"ai"===v&&(0,s.jsx)(m,{onSaved:S}),"notebook"===v&&(0,s.jsx)(b,{}),"password"!==v&&(y?(0,s.jsxs)(o.f,{type:"button",className:"w-full",onClick:w,disabled:f,children:[f&&(0,s.jsx)(r.f,{className:"mr-2 h-4 w-4 animate-spin"}),n.setup.finish]}):(0,s.jsxs)("div",{className:"flex flex-col-reverse gap-2 sm:flex-row sm:justify-between",children:[(0,s.jsx)(o.f,{type:"button",variant:"ghost",onClick:w,disabled:f,children:n.setup.skipAll}),(0,s.jsx)(o.f,{type:"button",variant:"outline",onClick:S,disabled:f,children:n.setup.skip})]}))]})}var S=e.i(515288),C=e.i(35209);e.s(["default",0,function(){let{t:e}=(0,l.b)();(0,C.f)(e.setup.pageTitle);let o=(0,a.useRouter)(),{data:d,status:h}=(0,i.useSession)(),p=d?.user?.role==="admin",m=d?.user?.mustChangePassword===!0,[g,x]=(0,t.useState)(null);return(0,t.useEffect)(()=>{if("authenticated"===h&&!g){if(!p)return void o.replace("/");c.f.get("/api/setup").then(e=>x({mustChangePassword:m,setupCompleted:e.setupCompleted})).catch(e=>{u.V.error("[Setup]","Failed to fetch setup status",{error:e}),x({mustChangePassword:m,setupCompleted:!1})})}},[h,p,m,g,o]),(0,s.jsx)(n.f,{wide:!0,children:(0,s.jsx)(S.N,{children:(0,s.jsxs)(S.O,{className:"space-y-4",children:[g?(0,s.jsx)(k,{mustChangePassword:g.mustChangePassword,setupCompleted:g.setupCompleted}):(0,s.jsx)("div",{className:"flex justify-center py-8",children:(0,s.jsx)(r.f,{className:"h-6 w-6 animate-spin text-muted-foreground"})}),(0,s.jsx)("button",{type:"button",onClick:()=>(0,i.signOut)({callbackUrl:"/login"}),className:"w-full text-center text-sm text-muted-foreground hover:text-foreground",children:e.setup.logout})]})})})}],770307)},480342,e=>{var s=e.i(843476),t=e.i(325164),a=e.i(111110);e.s(["f",0,function({children:e,wide:i=!1}){let{t:r}=(0,a.b)();return(0,s.jsxs)("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[(0,s.jsx)("div",{className:"pointer-events-none absolute -left-32 -top-32 h-96 w-96 rounded-full bg-indigo-400/25 blur-3xl"}),(0,s.jsx)("div",{className:"pointer-events-none absolute -bottom-40 -right-24 h-[28rem] w-[28rem] rounded-full bg-violet-400/20 blur-3xl"}),(0,s.jsxs)("div",{className:`relative w-full space-y-6 py-8 ${i?"max-w-xl":"max-w-md"}`,children:[(0,s.jsxs)("div",{className:"flex flex-col items-center gap-3 text-center",children:[(0,s.jsx)(t.default,{src:"/icons/icon.png",alt:"",width:64,height:64,className:"rounded-2xl shadow-lg shadow-indigo-500/30",priority:!0,unoptimized:!0}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("p",{className:"text-xl font-bold tracking-tight",children:r.pageTitle.base}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:r.app.subtitle})]})]}),e]})]})}])},527161,e=>{var s=e.i(843476),t=e.i(271645),a=e.i(776639),i=e.i(519455),r=e.i(793479),n=e.i(110204),o=e.i(967489),l=e.i(709830),c=e.i(111110),d=e.i(76824),u=e.i(41931),h=e.i(294114),p=e.i(201276);async function m(){try{let e=await u.f.get("/api/tags?tagSetsOnly=true");return e.tagSets?.length?e.tagSets:["default"]}catch{return["default"]}}e.s(["f",0,function({open:e,onOpenChange:u,onCreate:g}){let[x,f]=(0,t.useState)(""),[j,b]=(0,t.useState)(d.j),[v,y]=(0,t.useState)(d.W[d.j][0]),[w,N]=(0,t.useState)("default"),[k,S]=(0,t.useState)(["default"]),[C,F]=(0,t.useState)(!1),{t:P}=(0,c.b)(),{stageLabel:T,subjectLabel:V}=(0,l.O)();(0,t.useEffect)(()=>{e&&m().then(S)},[e]);let O=async()=>{if(!x.trim())return void h.c.warning(P.notebooks?.dialog?.enterName||"Please enter notebook name");F(!0);try{await g({name:x.trim(),stage:j,subjectKey:v,tagSet:w}),f(""),u(!1)}catch(e){p.V.error("[CreateNotebook]","Failed to create notebook",{error:e})}finally{F(!1)}};return(0,s.jsx)(a.N,{open:e,onOpenChange:u,children:(0,s.jsxs)(a.d,{children:[(0,s.jsxs)(a.s,{children:[(0,s.jsx)(a.F,{children:P.notebooks?.dialog?.title||"Create New Notebook"}),(0,s.jsx)(a.C,{children:P.notebooks?.dialog?.desc||"Create separate notebooks for different subjects or chapters"})]}),(0,s.jsxs)("div",{className:"space-y-4 py-4",children:[(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{htmlFor:"notebook-stage",children:P.notebooks.dialog.stageLabel}),(0,s.jsxs)(o.d,{value:j,onValueChange:e=>{b(e),d.W[e].includes(v)||y(d.W[e][0])},children:[(0,s.jsx)(o.P,{id:"notebook-stage",children:(0,s.jsx)(o.U,{})}),(0,s.jsx)(o.r,{children:d.c.map(e=>(0,s.jsx)(o.T,{value:e,children:T(e)},e))})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{htmlFor:"notebook-subject",children:P.notebooks.dialog.subjectLabel}),(0,s.jsxs)(o.d,{value:v,onValueChange:e=>y(e),children:[(0,s.jsx)(o.P,{id:"notebook-subject",children:(0,s.jsx)(o.U,{})}),(0,s.jsx)(o.r,{children:d.W[j].map(e=>(0,s.jsx)(o.T,{value:e,children:V(e)},e))})]})]})]}),k.length>1&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{htmlFor:"notebook-tagset",children:P.notebooks.dialog.tagSetLabel}),(0,s.jsxs)(o.d,{value:w,onValueChange:N,children:[(0,s.jsx)(o.P,{id:"notebook-tagset",children:(0,s.jsx)(o.U,{})}),(0,s.jsx)(o.r,{children:k.map(e=>(0,s.jsx)(o.T,{value:e,children:"default"===e?P.notebooks.dialog.tagSetDefault||"Built-in":P.notebooks.dialog.tagSetNames?.[e]||e},e))})]})]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:P.notebooks.dialog.scopeHint}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{htmlFor:"name",children:P.notebooks?.dialog?.nameLabel||"Notebook Name"}),(0,s.jsx)(r.f,{id:"name",placeholder:P.notebooks?.dialog?.placeholder||"e.g. Math, Physics, Chemistry...",value:x,onChange:e=>f(e.target.value),onKeyDown:e=>"Enter"===e.key&&O()})]})]}),(0,s.jsxs)(a.c,{children:[(0,s.jsx)(i.f,{variant:"outline",onClick:()=>u(!1),children:P.common.cancel}),(0,s.jsx)(i.f,{onClick:O,disabled:C||!x.trim(),children:C?P.notebooks?.dialog?.creating||"Creating...":P.notebooks?.dialog?.create||"Create"})]})]})})}])},709830,76824,e=>{var s=e.i(843476),t=e.i(111110),a=e.i(952122);let i=["primary","junior_high","senior_high"],r="primary",n=["math","english","chinese","physics","chemistry","biology","history","geography","politics"];function o(e){return"string"==typeof e&&n.includes(e)}function l(e){var s;let t=o(e.subjectKey)?e.subjectKey:(0,a.f)(e.name);return{stage:"string"==typeof(s=e.stage)&&i.includes(s)?e.stage:r,subject:t&&o(t)?t:null}}function c(){let{t:e}=(0,t.b)();return{stageLabel:s=>({primary:e.auth.primary,junior_high:e.auth.juniorHigh,senior_high:e.auth.seniorHigh})[s],subjectLabel:s=>e.tags.subjects[s]}}e.s(["j",0,r,"c",0,i,"W",0,{primary:["math","english","chinese"],junior_high:n,senior_high:n},"v",0,l],76824),e.s(["E",0,function({notebook:e,className:t}){let{stageLabel:a,subjectLabel:i}=c(),r=l(e);return(0,s.jsxs)("span",{className:t,children:[a(r.stage),r.subject?` \xb7 ${i(r.subject)}`:""]})},"O",0,c],709830)},553753,e=>{e.s(["J",0,"admin@localhost","v",0,"123456"])},952122,e=>{e.i(306831),e.s(["f",0,function(e){if(!e)return null;let s=e.toLowerCase();return s.includes("math")||s.includes("数学")?"math":s.includes("physics")||s.includes("物理")?"physics":s.includes("chemistry")||s.includes("化学")?"chemistry":s.includes("biology")||s.includes("生物")?"biology":s.includes("english")||s.includes("英语")?"english":s.includes("chinese")||s.includes("语文")?"chinese":s.includes("history")||s.includes("历史")?"history":s.includes("geography")||s.includes("地理")?"geography":s.includes("politics")||s.includes("政治")?"politics":null}])},35209,e=>{var s=e.i(271645),t=e.i(111110);e.s(["f",0,function(...e){let{t:a}=(0,t.b)(),i=[a.pageTitle.base,...e.map(e=>"string"==typeof e?e.trim():"").filter(e=>e.length>0)].join("-");(0,s.useEffect)(()=>{document.title=i},[i])}])}])})();
|
|
1
|
+
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,770307,e=>{var s=e.i(843476),t=e.i(271645),a=e.i(618566),i=e.i(217255),r=e.i(632781),n=e.i(480342),o=e.i(519455),l=e.i(111110),c=e.i(41931),d=e.i(294114),u=e.i(201276),h=e.i(10038),p=e.i(835467);function m({onSaved:e}){let{t:a}=(0,l.b)(),[i,r]=(0,t.useState)({aiProvider:"minimax"}),[n,o]=(0,t.useState)(!0),[g,x]=(0,t.useState)(!1);(0,t.useEffect)(()=>{c.k.get("/api/settings").then(e=>{r("minimax"!==e.aiProvider||e.minimax?.apiKey?e:{...e,aiProvider:"minimax-code"})}).catch(e=>u.V.error("[Setup]","Failed to fetch settings",{error:e})).finally(()=>o(!1))},[]);let f=async()=>{let s=(0,p.f)(i,a);if(s)return void d.c.error(s);x(!0);try{r(await c.k.post("/api/settings",i)),d.c.success(a.settings?.messages?.saved||"Settings saved"),e()}catch(e){u.V.error("[Setup]","Failed to save AI settings",{error:e}),d.c.error(a.settings?.messages?.saveFailed||"Failed to save")}finally{x(!1)}};return(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:a.setup.ai.title}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:a.setup.ai.desc})]}),(0,s.jsx)(h.f,{config:i,setConfig:r,loading:n,saving:g,onSave:f})]})}var g=e.i(856423),x=e.i(551757),f=e.i(527161),j=e.i(303163);function b(){let{t:e}=(0,l.b)(),[a,i]=(0,t.useState)(!1),[r,n]=(0,t.useState)([]),h=async s=>{try{await c.k.post("/api/notebooks",s),n(e=>[...e,s.name])}catch(s){throw u.V.error("[Setup]","Failed to create notebook",{error:s}),d.c.error((0,j.d)(s)||e.notebooks?.createError||"Failed to create"),s}};return(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:e.setup.notebook.title}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:e.setup.notebook.desc})]}),r.map(t=>(0,s.jsxs)("p",{className:"flex items-center gap-2 text-sm text-emerald-600 dark:text-emerald-400",children:[(0,s.jsx)(x.f,{className:"h-4 w-4 shrink-0"}),e.setup.notebook.created.replace("{name}",t)]},t)),(0,s.jsxs)(o.f,{type:"button",variant:"outline",className:"w-full",onClick:()=>i(!0),children:[(0,s.jsx)(g.f,{className:"mr-2 h-4 w-4"}),e.setup.notebook.create]}),(0,s.jsx)(f.f,{open:a,onOpenChange:i,onCreate:h})]})}var v=e.i(110204),y=e.i(37038),w=e.i(553753);function N({onDone:e}){let{t:a}=(0,l.b)(),{update:n}=(0,i.useSession)(),[h,p]=(0,t.useState)(""),[m,g]=(0,t.useState)(""),[x,f]=(0,t.useState)(!1),b=async s=>{if(s.preventDefault(),h.length<6)return void d.c.error(a.setup.password.tooShort);if(h===w.v)return void d.c.error(a.setup.password.sameAsDefault);if(h!==m)return void d.c.error(a.setup.password.mismatch);f(!0);try{await c.k.patch("/api/user",{password:h}),await n(),d.c.success(a.setup.password.success),e()}catch(e){u.V.error("[Setup]","Failed to change default password",{error:e}),d.c.error((0,j.d)(e)||a.setup.password.failed)}finally{f(!1)}};return(0,s.jsxs)("form",{onSubmit:b,className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",children:a.setup.password.title}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:a.setup.password.desc})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(v.f,{htmlFor:"setup-new-password",children:a.setup.password.newPassword}),(0,s.jsx)(y.f,{id:"setup-new-password",autoComplete:"new-password",value:h,onChange:e=>p(e.target.value)})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(v.f,{htmlFor:"setup-confirm-password",children:a.setup.password.confirmPassword}),(0,s.jsx)(y.f,{id:"setup-confirm-password",autoComplete:"new-password",value:m,onChange:e=>g(e.target.value)})]}),(0,s.jsxs)(o.f,{type:"submit",className:"w-full",disabled:x,children:[x&&(0,s.jsx)(r.f,{className:"mr-2 h-4 w-4 animate-spin"}),a.setup.password.submit]})]})}function k({mustChangePassword:e,setupCompleted:i}){let{t:n}=(0,l.b)(),h=(0,a.useRouter)(),[p]=(0,t.useState)(()=>e&&i?["password"]:e?["password","ai","notebook"]:["ai","notebook"]),[g,x]=(0,t.useState)(0),[f,j]=(0,t.useState)(!1),v=p[g],y=g===p.length-1,w=async()=>{j(!0);try{await c.k.post("/api/setup",{}),d.c.success(n.setup.finished),h.replace("/")}catch(e){u.V.error("[Setup]","Failed to complete setup",{error:e}),d.c.error(n.setup.completeFailed),j(!1)}},S=()=>{y?w():x(e=>e+1)};return(0,s.jsxs)("div",{className:"space-y-5",children:[p.length>1&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("p",{className:"text-xs font-medium text-muted-foreground",children:n.setup.step.replace("{current}",String(g+1)).replace("{total}",String(p.length))}),(0,s.jsx)("div",{className:"flex gap-1.5",children:p.map((e,t)=>(0,s.jsx)("div",{className:`h-1.5 flex-1 rounded-full ${t<=g?"bg-primary":"bg-muted"}`},e))})]}),"password"===v&&(0,s.jsx)(N,{onDone:S}),"ai"===v&&(0,s.jsx)(m,{onSaved:S}),"notebook"===v&&(0,s.jsx)(b,{}),"password"!==v&&(y?(0,s.jsxs)(o.f,{type:"button",className:"w-full",onClick:w,disabled:f,children:[f&&(0,s.jsx)(r.f,{className:"mr-2 h-4 w-4 animate-spin"}),n.setup.finish]}):(0,s.jsxs)("div",{className:"flex flex-col-reverse gap-2 sm:flex-row sm:justify-between",children:[(0,s.jsx)(o.f,{type:"button",variant:"ghost",onClick:w,disabled:f,children:n.setup.skipAll}),(0,s.jsx)(o.f,{type:"button",variant:"outline",onClick:S,disabled:f,children:n.setup.skip})]}))]})}var S=e.i(515288),C=e.i(35209);e.s(["default",0,function(){let{t:e}=(0,l.b)();(0,C.f)(e.setup.pageTitle);let o=(0,a.useRouter)(),{data:d,status:h}=(0,i.useSession)(),p=d?.user?.role==="admin",m=d?.user?.mustChangePassword===!0,[g,x]=(0,t.useState)(null);return(0,t.useEffect)(()=>{if("authenticated"===h&&!g){if(!p)return void o.replace("/");c.k.get("/api/setup").then(e=>x({mustChangePassword:m,setupCompleted:e.setupCompleted})).catch(e=>{u.V.error("[Setup]","Failed to fetch setup status",{error:e}),x({mustChangePassword:m,setupCompleted:!1})})}},[h,p,m,g,o]),(0,s.jsx)(n.f,{wide:!0,children:(0,s.jsx)(S.N,{children:(0,s.jsxs)(S.O,{className:"space-y-4",children:[g?(0,s.jsx)(k,{mustChangePassword:g.mustChangePassword,setupCompleted:g.setupCompleted}):(0,s.jsx)("div",{className:"flex justify-center py-8",children:(0,s.jsx)(r.f,{className:"h-6 w-6 animate-spin text-muted-foreground"})}),(0,s.jsx)("button",{type:"button",onClick:()=>(0,i.signOut)({callbackUrl:"/login"}),className:"w-full text-center text-sm text-muted-foreground hover:text-foreground",children:e.setup.logout})]})})})}],770307)},480342,e=>{var s=e.i(843476),t=e.i(325164),a=e.i(111110);e.s(["f",0,function({children:e,wide:i=!1}){let{t:r}=(0,a.b)();return(0,s.jsxs)("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[(0,s.jsx)("div",{className:"pointer-events-none absolute -left-32 -top-32 h-96 w-96 rounded-full bg-indigo-400/25 blur-3xl"}),(0,s.jsx)("div",{className:"pointer-events-none absolute -bottom-40 -right-24 h-[28rem] w-[28rem] rounded-full bg-violet-400/20 blur-3xl"}),(0,s.jsxs)("div",{className:`relative w-full space-y-6 py-8 ${i?"max-w-xl":"max-w-md"}`,children:[(0,s.jsxs)("div",{className:"flex flex-col items-center gap-3 text-center",children:[(0,s.jsx)(t.default,{src:"/icons/icon.png",alt:"",width:64,height:64,className:"rounded-2xl shadow-lg shadow-indigo-500/30",priority:!0,unoptimized:!0}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("p",{className:"text-xl font-bold tracking-tight",children:r.pageTitle.base}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:r.app.subtitle})]})]}),e]})]})}])},527161,e=>{var s=e.i(843476),t=e.i(271645),a=e.i(776639),i=e.i(519455),r=e.i(793479),n=e.i(110204),o=e.i(967489),l=e.i(709830),c=e.i(111110),d=e.i(76824),u=e.i(41931),h=e.i(294114),p=e.i(201276);async function m(){try{let e=await u.k.get("/api/tags?tagSetsOnly=true");return e.tagSets?.length?e.tagSets:["default"]}catch{return["default"]}}e.s(["f",0,function({open:e,onOpenChange:u,onCreate:g}){let[x,f]=(0,t.useState)(""),[j,b]=(0,t.useState)(d.j),[v,y]=(0,t.useState)(d.W[d.j][0]),[w,N]=(0,t.useState)("default"),[k,S]=(0,t.useState)(["default"]),[C,F]=(0,t.useState)(!1),{t:P}=(0,c.b)(),{stageLabel:T,subjectLabel:V}=(0,l.O)();(0,t.useEffect)(()=>{e&&m().then(S)},[e]);let O=async()=>{if(!x.trim())return void h.c.warning(P.notebooks?.dialog?.enterName||"Please enter notebook name");F(!0);try{await g({name:x.trim(),stage:j,subjectKey:v,tagSet:w}),f(""),u(!1)}catch(e){p.V.error("[CreateNotebook]","Failed to create notebook",{error:e})}finally{F(!1)}};return(0,s.jsx)(a.N,{open:e,onOpenChange:u,children:(0,s.jsxs)(a.d,{children:[(0,s.jsxs)(a.s,{children:[(0,s.jsx)(a.F,{children:P.notebooks?.dialog?.title||"Create New Notebook"}),(0,s.jsx)(a.C,{children:P.notebooks?.dialog?.desc||"Create separate notebooks for different subjects or chapters"})]}),(0,s.jsxs)("div",{className:"space-y-4 py-4",children:[(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{htmlFor:"notebook-stage",children:P.notebooks.dialog.stageLabel}),(0,s.jsxs)(o.d,{value:j,onValueChange:e=>{b(e),d.W[e].includes(v)||y(d.W[e][0])},children:[(0,s.jsx)(o.P,{id:"notebook-stage",children:(0,s.jsx)(o.U,{})}),(0,s.jsx)(o.r,{children:d.c.map(e=>(0,s.jsx)(o.T,{value:e,children:T(e)},e))})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{htmlFor:"notebook-subject",children:P.notebooks.dialog.subjectLabel}),(0,s.jsxs)(o.d,{value:v,onValueChange:e=>y(e),children:[(0,s.jsx)(o.P,{id:"notebook-subject",children:(0,s.jsx)(o.U,{})}),(0,s.jsx)(o.r,{children:d.W[j].map(e=>(0,s.jsx)(o.T,{value:e,children:V(e)},e))})]})]})]}),k.length>1&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{htmlFor:"notebook-tagset",children:P.notebooks.dialog.tagSetLabel}),(0,s.jsxs)(o.d,{value:w,onValueChange:N,children:[(0,s.jsx)(o.P,{id:"notebook-tagset",children:(0,s.jsx)(o.U,{})}),(0,s.jsx)(o.r,{children:k.map(e=>(0,s.jsx)(o.T,{value:e,children:"default"===e?P.notebooks.dialog.tagSetDefault||"Built-in":P.notebooks.dialog.tagSetNames?.[e]||e},e))})]})]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:P.notebooks.dialog.scopeHint}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{htmlFor:"name",children:P.notebooks?.dialog?.nameLabel||"Notebook Name"}),(0,s.jsx)(r.f,{id:"name",placeholder:P.notebooks?.dialog?.placeholder||"e.g. Math, Physics, Chemistry...",value:x,onChange:e=>f(e.target.value),onKeyDown:e=>"Enter"===e.key&&O()})]})]}),(0,s.jsxs)(a.c,{children:[(0,s.jsx)(i.f,{variant:"outline",onClick:()=>u(!1),children:P.common.cancel}),(0,s.jsx)(i.f,{onClick:O,disabled:C||!x.trim(),children:C?P.notebooks?.dialog?.creating||"Creating...":P.notebooks?.dialog?.create||"Create"})]})]})})}])},709830,76824,e=>{var s=e.i(843476),t=e.i(111110),a=e.i(952122);let i=["primary","junior_high","senior_high"],r="primary",n=["math","english","chinese","physics","chemistry","biology","history","geography","politics"];function o(e){return"string"==typeof e&&n.includes(e)}function l(e){var s;let t=o(e.subjectKey)?e.subjectKey:(0,a.f)(e.name);return{stage:"string"==typeof(s=e.stage)&&i.includes(s)?e.stage:r,subject:t&&o(t)?t:null}}function c(){let{t:e}=(0,t.b)();return{stageLabel:s=>({primary:e.auth.primary,junior_high:e.auth.juniorHigh,senior_high:e.auth.seniorHigh})[s],subjectLabel:s=>e.tags.subjects[s]}}e.s(["j",0,r,"c",0,i,"W",0,{primary:["math","english","chinese"],junior_high:n,senior_high:n},"v",0,l],76824),e.s(["E",0,function({notebook:e,className:t}){let{stageLabel:a,subjectLabel:i}=c(),r=l(e);return(0,s.jsxs)("span",{className:t,children:[a(r.stage),r.subject?` \xb7 ${i(r.subject)}`:""]})},"O",0,c],709830)},553753,e=>{e.s(["J",0,"admin@localhost","v",0,"123456"])},952122,e=>{e.i(306831),e.s(["f",0,function(e){if(!e)return null;let s=e.toLowerCase();return s.includes("math")||s.includes("数学")?"math":s.includes("physics")||s.includes("物理")?"physics":s.includes("chemistry")||s.includes("化学")?"chemistry":s.includes("biology")||s.includes("生物")?"biology":s.includes("english")||s.includes("英语")?"english":s.includes("chinese")||s.includes("语文")?"chinese":s.includes("history")||s.includes("历史")?"history":s.includes("geography")||s.includes("地理")?"geography":s.includes("politics")||s.includes("政治")?"politics":null}])},35209,e=>{var s=e.i(271645),t=e.i(111110);e.s(["f",0,function(...e){let{t:a}=(0,t.b)(),i=[a.pageTitle.base,...e.map(e=>"string"==typeof e?e.trim():"").filter(e=>e.length>0)].join("-");(0,s.useEffect)(()=>{document.title=i},[i])}])}])})();
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,711241,e=>{var t=e.i(456420);let s={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};s.node;let a=(0,t.f)(s);e.s(["f",0,a],711241)},666944,e=>{var t=e.i(843476),s=e.i(271645),a=e.i(618566),n=e.i(762368),r=e.i(519455),i=e.i(590546),l=e.i(111110);function o({items:e,selectedIds:s,selectedCount:a,onToggle:n,onSelectAll:i,onClear:c}){let{t:m}=(0,l.b)();return(0,t.jsxs)("div",{className:"rounded-md border bg-muted/20 p-3 space-y-2",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,t.jsxs)("div",{className:"text-sm font-medium",children:[m.printPreview?.selectItems||"Select Items"," (",a,"/",e.length,")"]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(r.f,{variant:"outline",size:"sm",onClick:i,children:m.printPreview?.selectAll||"Select All"}),(0,t.jsx)(r.f,{variant:"outline",size:"sm",onClick:c,children:m.printPreview?.clearSelection||"Clear Selection"})]})]}),(0,t.jsx)("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-3 max-h-44 overflow-y-auto pr-1",children:e.map((e,a)=>(0,t.jsxs)("label",{className:"flex items-start gap-2 rounded border bg-background p-2 text-xs cursor-pointer hover:border-primary/50",children:[(0,t.jsx)("input",{type:"checkbox",checked:s.has(e.id),onChange:()=>n(e.id),className:"mt-0.5 rounded border-gray-300 text-primary focus:ring-primary"}),(0,t.jsxs)("span",{className:"line-clamp-2",children:[(0,t.jsx)("span",{className:"font-semibold",children:m.printPreview?.questionNumber?.replace("{num}",String(a+1))||`Question ${a+1}`}),e.questionText?`${m.common.colon}${e.questionText}`:""]})]},e.id))})]})}var c=e.i(995677);function m({checked:e,onChange:s,label:a}){return(0,t.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,t.jsx)("input",{type:"checkbox",checked:e,onChange:e=>s(e.target.checked),className:"rounded border-gray-300 text-primary focus:ring-primary w-3.5 h-3.5 sm:w-4 sm:h-4"}),a]})}function p({options:e,onChange:s,hasCustomSpaces:a,onResetCustomSpaces:n}){let{t:i}=(0,l.b)(),o=e.answerSpace??"auto";return(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-2 sm:gap-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm bg-muted/50 px-2 sm:px-3 py-1 rounded-md",children:[(0,t.jsxs)("span",{className:"whitespace-nowrap text-xs sm:text-sm",children:[i.printPreview?.imageScale||"Image Scale",": ",e.imageScale,"%"]}),(0,t.jsx)("input",{type:"range",min:"30",max:"100",value:e.imageScale,onChange:e=>s({imageScale:Number(e.target.value)}),className:"w-16 sm:w-20 accent-primary"})]}),(0,t.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,t.jsxs)("label",{htmlFor:"print-preview-answer-space",className:"whitespace-nowrap",children:[i.exam.answerSpace,":"]}),(0,t.jsxs)("select",{id:"print-preview-answer-space",value:o,onChange:e=>{(0,c.I)(e.target.value)&&s({answerSpace:e.target.value})},className:"bg-background border rounded px-2 py-0.5 text-xs sm:text-sm",children:[(0,t.jsx)("option",{value:"auto",children:i.exam.answerSpaceAuto}),(0,t.jsx)("option",{value:"none",children:i.exam.answerSpaceNone}),(0,t.jsx)("option",{value:"small",children:i.exam.answerSpaceSmall}),(0,t.jsx)("option",{value:"medium",children:i.exam.answerSpaceMedium}),(0,t.jsx)("option",{value:"large",children:i.exam.answerSpaceLarge})]}),a&&n&&(0,t.jsx)(r.f,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:n,children:i.exam.resetAllQuestionAnswerSpaces})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-x-3 gap-y-1 sm:gap-4",children:[(0,t.jsx)(m,{checked:e.showQuestionText,onChange:e=>s({showQuestionText:e}),label:i.printPreview?.showQuestionText||"Question Text"}),(0,t.jsx)(m,{checked:e.showAnswers,onChange:e=>s({showAnswers:e}),label:i.printPreview?.showAnswers||"Show Answers"}),(0,t.jsx)(m,{checked:e.showAnalysis,onChange:e=>s({showAnalysis:e}),label:i.printPreview?.showAnalysis||"Show Analysis"}),(0,t.jsx)(m,{checked:e.showTags,onChange:e=>s({showTags:e}),label:i.printPreview?.showTags||"Show Tags"})]})]})}var d=e.i(511445),g=e.i(84583),u=e.i(149704);function h(e){if(e.tags&&e.tags.length>0)return e.tags.map(e=>e.name);try{let t=JSON.parse(e.knowledgePoints||"[]");return Array.isArray(t)?t.filter(e=>"string"==typeof e):[]}catch{return[]}}var x=e.i(664030);function f({item:e,index:s,options:a,reserveAnswerSpace:n,customAnswerSpacePx:r,onCustomAnswerSpaceChange:i}){let{t:o}=(0,l.b)(),m=h(e),{groups:p}=(0,x.f)(),w=e.paperLevel?p.find(t=>t.id===e.paperLevel)?.name||e.paperLevel:null,b=n?(0,c.z)(a.answerSpace??"auto",e.questionText||"",r):0;return(0,t.jsxs)("div",{className:`mb-4 border-b last:border-b-0 print:break-inside-avoid ${n?"pb-4":"pb-6"}`,children:[(0,t.jsxs)("div",{className:"mb-4 flex flex-wrap items-center gap-x-4 gap-y-2 leading-7",children:[(0,t.jsx)("span",{className:"text-lg font-bold",children:o.printPreview?.questionNumber?.replace("{num}",String(s+1))||`Question ${s+1}`}),e.shortId&&(0,t.jsx)("span",{className:"font-mono text-sm text-muted-foreground whitespace-nowrap",children:o.printPreview.source.replace("{id}",e.shortId)}),e.subject&&(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:e.subject.name}),e.gradeSemester&&(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:e.gradeSemester}),w&&(0,t.jsxs)("span",{className:"text-sm text-muted-foreground",children:[o.printPreview?.paperLevel||"Paper Level",": ",w]}),a.showTags&&m.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{className:"font-semibold",children:[o.printPreview?.knowledgePoints||"Knowledge Points",":"]}),m.map((e,s)=>(0,t.jsx)("span",{className:"px-2 py-1 bg-muted rounded text-sm",children:e},`${e}-${s}`))]})]}),a.showQuestionText&&e.questionText?(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)(d.f,{content:e.questionText}),(0,t.jsx)(u.f,{svg:e.figureSvg,scale:e.figureScale,align:e.figureAlign})]}):e.originalImageUrl&&(0,t.jsx)("div",{className:"mb-4",children:(0,t.jsx)("img",{src:e.originalImageUrl,alt:o.detail?.originalProblem||"Question Image",className:"h-auto border rounded",style:{maxWidth:`${a.imageScale}%`}})}),a.showAnswers&&e.answerText&&(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsxs)("h3",{className:"font-semibold mb-2",children:[o.printPreview?.referenceAnswer||"Reference Answer",":"]}),(0,t.jsx)(d.f,{content:e.answerText})]}),a.showAnalysis&&e.analysis&&(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsxs)("h3",{className:"font-semibold mb-2",children:[o.printPreview?.analysis||"Analysis",":"]}),(0,t.jsx)(d.f,{content:e.analysis})]}),n&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"print-answer-space",style:{minHeight:`${b}px`}}),i&&(0,t.jsx)(g.f,{effectivePx:b,isCustom:"number"==typeof r,onChange:e=>i(e),onReset:()=>i(null)})]})]})}var w=e.i(41931),b=e.i(918611),v=e.i(35209),y=e.i(469817),j=e.i(201276);function P(){var e,m,d,g,u,P;let A=(0,a.useSearchParams)(),{t:$}=(0,l.b)(),[S,N]=(0,s.useState)([]);(0,v.f)($.printPreview.title);let[T,U]=(0,s.useState)(!0),[C,D]=(0,s.useState)({showQuestionText:!1,showAnswers:!1,showAnalysis:!1,showTags:!1,imageScale:70,answerSpace:"auto"}),[k,z]=(0,s.useState)(new Set),[B,q]=(0,s.useState)({}),[L,I]=(0,s.useState)(!1),{groups:R}=(0,x.f)(),_=(0,s.useCallback)(async()=>{try{let e=new URLSearchParams(A.toString());e.set("pageSize",String(y.A)),e.set("view","print");let t=await w.k.get(`/api/error-items/list?${e.toString()}`);N(t.items),z(new Set(t.items.map(e=>e.id)))}catch(e){j.V.error("[PrintPreview]","Failed to fetch items",{error:e})}finally{U(!1)}},[A]);(0,s.useEffect)(()=>{_()},[_]);let M=S.filter(e=>k.has(e.id)),F=(e=C.showAnswers,m=C.showAnalysis,!e&&!m),H=(d=S.length,(g=M.length)===d?String(d):`${g}/${d}`),E=(u=S.length,P=M.length,0===u?"noItems":0===P?"noSelection":null),O=async()=>{if(!L&&0!==M.length){I(!0);try{let e=await Promise.all(M.map(async(e,t)=>{let s=h(e),a=e.paperLevel?R.find(t=>t.id===e.paperLevel)?.name||e.paperLevel:null,n=[e.shortId?$.printPreview.source.replace("{id}",e.shortId):null,e.subject?.name??null,e.gradeSemester??null,a?`${$.printPreview.paperLevel}: ${a}`:null,C.showTags&&s.length>0?`${$.printPreview.knowledgePoints}: ${s.join("、")}`:null].filter(e=>!!e),r=!!(C.showQuestionText&&e.questionText),i=r?await (0,b.N)(e.figureSvg,e.figureScale,e.figureAlign):e.originalImageUrl?await (0,b.e)(e.originalImageUrl,{scalePercent:C.imageScale,maxBaseWidthPx:560,align:"left"}):null;return{heading:$.printPreview.questionNumber.replace("{num}",String(t+1)),meta:n.join(" · "),questionText:r?e.questionText??"":void 0,image:i,inlineAnswerLabel:C.showAnswers&&e.answerText?$.printPreview.referenceAnswer:void 0,inlineAnswerText:C.showAnswers&&e.answerText?e.answerText:void 0,inlineAnalysisLabel:C.showAnalysis&&e.analysis?$.printPreview.analysis:void 0,inlineAnalysisText:C.showAnalysis&&e.analysis?e.analysis:void 0,answerSpacePx:F?(0,c.z)(C.answerSpace??"auto",e.questionText||"",B[e.id]):0}})),t=(0,b.x)({title:$.printPreview.title,questions:e});(0,b.X)(t,$.printPreview.title)}finally{I(!1)}}};return T?(0,t.jsx)("div",{className:"min-h-screen flex items-center justify-center",children:(0,t.jsx)("p",{className:"text-muted-foreground",children:$.common.loading})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"print:hidden sticky top-0 z-10 bg-background border-b p-3 sm:p-4 shadow-sm",children:(0,t.jsxs)("div",{className:"max-w-6xl mx-auto space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(i.f,{fallbackUrl:"/notebooks"}),(0,t.jsxs)("h1",{className:"text-lg sm:text-xl font-bold flex-1",children:[$.printPreview?.title||"Print Preview"," (",H," ",$.notebooks?.items||"items",")"]}),(0,t.jsxs)(r.f,{variant:"outline",size:"sm",className:"whitespace-nowrap",onClick:O,disabled:0===M.length||L,children:[(0,t.jsx)(n.f,{className:"mr-1.5 h-4 w-4"}),L?$.printPreview.exportingDocx:$.printPreview.downloadDocx]}),(0,t.jsx)(r.f,{onClick:()=>{window.print()},size:"sm",className:"whitespace-nowrap",disabled:0===M.length,children:$.printPreview?.printButton||"Print / Save PDF"})]}),(0,t.jsx)(p,{options:C,onChange:e=>D(t=>({...t,...e})),hasCustomSpaces:Object.keys(B).length>0,onResetCustomSpaces:()=>q({})}),(0,t.jsx)(o,{items:S,selectedIds:k,selectedCount:M.length,onToggle:e=>{z(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},onSelectAll:()=>{z(new Set(S.map(e=>e.id)))},onClear:()=>{z(new Set)}})]})}),(0,t.jsxs)("div",{className:"max-w-4xl mx-auto p-8 print:p-0",children:[M.map((e,s)=>(0,t.jsx)(f,{item:e,index:s,options:C,reserveAnswerSpace:F,customAnswerSpacePx:B[e.id],onCustomAnswerSpaceChange:t=>{var s;return s=e.id,void q(e=>{if(null===t){let t={...e};return delete t[s],t}return{...e,[s]:t}})}},e.id)),E&&(0,t.jsx)("div",{className:"text-center py-12 text-muted-foreground",children:"noSelection"===E?$.printPreview?.noSelection||"No items selected":$.printPreview?.noItems||"No matching error items"})]})]})}e.s(["default",0,function(){let{t:e}=(0,l.b)();return(0,t.jsx)(s.Suspense,{fallback:(0,t.jsx)("div",{className:"min-h-screen flex items-center justify-center",children:e.common.loading}),children:(0,t.jsx)(P,{})})}],666944)},84583,995677,918611,e=>{var t=e.i(843476),s=e.i(519455),a=e.i(111110);let n=["auto","none","small","medium","large"],r={none:0,small:60,medium:120,large:240},i={choice:12,judgment:12,fill:16,solution:240};function l(e){return Number.isFinite(e)?Math.min(600,Math.max(0,Math.round(e))):0}let o=/(?:(?:^|[\s*+\-))::。??;;,,_])([A-D])\s*[..::]|(?:^|\s{2,}|[))::。??])([A-D])\s*、|[((]([A-D])[))])/gm,c=/判断(?:下列|以下|正误|对错|题)|对的(?:打|画)|错的(?:打|画)|true\s*(?:or|\/)\s*false/i,m=/_{2,}|(?:\\_){2,}|\\underline|\\rule\b|\\hspace\b|(\s*)|【\s*】|\[\s+\]|(?<![A-Za-z0-9_])\(\s*\)|[==]\s*[。??]?\s*$|填空/,p=/求证|证明[::,,]|写出(?:解题|计算|推导|推理)?过程|解答下列|试说明理由|请说明理由/,d=/(\s*(\d{1,2})\s*)/g,g=/(?:^|[\n。;;::??!!]\s*)\(\s*(\d{1,2})\s*\)/g;function u(e){let t=new Set;for(let s of e.matchAll(d))t.add(s[1]);for(let s of e.matchAll(g))t.add(s[1]);return Math.max(1,t.size)}e.s(["p",0,"exam-print-answer-space","W",0,20,"q",0,"auto","R",0,600,"r",0,0,"O",0,l,"I",0,function(e){return"string"==typeof e&&n.includes(e)},"z",0,function(e,t,s){let a;if("number"==typeof s&&Number.isFinite(s))return l(s);if("auto"!==e)return r[e];let n=(a=new Set(Array.from(t.matchAll(o),e=>e[1]??e[2]??e[3]))).has("A")&&a.has("B")&&a.has("C")?"choice":c.test(t)?"judgment":u(t)>1||p.test(t)?"solution":m.test(t)?"fill":"solution";if("solution"!==n)return i[n];let d=(u(t)-1)*120;return Math.min(560,i.solution+d)}],995677),e.s(["f",0,function({effectivePx:e,isCustom:n,onChange:r,onReset:i}){let{t:o}=(0,a.b)(),c=l(e);return(0,t.jsxs)("div",{className:"answer-space-controls print:hidden flex flex-wrap items-center gap-2 text-xs text-muted-foreground mt-2 pt-1",children:[(0,t.jsxs)("span",{children:[o.exam.questionAnswerSpace,": ",c,"px"]}),(0,t.jsx)(s.f,{type:"button",variant:"outline",size:"sm",className:"h-6 px-2 text-xs","aria-label":o.exam.decreaseAnswerSpace,disabled:c<=0,onClick:()=>r(l(c-20)),children:"-"}),(0,t.jsx)("input",{type:"range",min:0,max:600,step:10,value:c,"aria-label":o.exam.questionAnswerSpaceSlider,onChange:e=>r(l(Number(e.target.value))),className:"w-24 sm:w-32 accent-primary"}),(0,t.jsx)(s.f,{type:"button",variant:"outline",size:"sm",className:"h-6 px-2 text-xs","aria-label":o.exam.increaseAnswerSpace,disabled:c>=600,onClick:()=>r(l(c+20)),children:"+"}),n&&(0,t.jsx)(s.f,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:i,children:o.exam.resetQuestionAnswerSpace})]})}],84583);var h=e.i(184110),x=e.i(398019),f=e.i(369939);let w={0:"⁰",1:"¹",2:"²",3:"³",4:"⁴",5:"⁵",6:"⁶",7:"⁷",8:"⁸",9:"⁹","+":"⁺","-":"⁻","=":"⁼","(":"⁽",")":"⁾",n:"ⁿ"},b={0:"₀",1:"₁",2:"₂",3:"₃",4:"₄",5:"₅",6:"₆",7:"₇",8:"₈",9:"₉","+":"₊","-":"₋","=":"₌","(":"₍",")":"₎"},v=[[/\\times\b/g,"×"],[/\\div\b/g,"÷"],[/\\cdot\b/g,"·"],[/\\pm\b/g,"±"],[/\\mp\b/g,"∓"],[/\\(?:le|leq)\b/g,"≤"],[/\\(?:ge|geq)\b/g,"≥"],[/\\(?:ne|neq)\b/g,"≠"],[/\\approx\b/g,"≈"],[/\\equiv\b/g,"≡"],[/\\cong\b/g,"≌"],[/\\sim\b/g,"∽"],[/\\propto\b/g,"∝"],[/\\infty\b/g,"∞"],[/\\triangle\b/g,"△"],[/\\angle\b/g,"∠"],[/\\perp\b/g,"⊥"],[/\\parallel\b/g,"∥"],[/\\because\b/g,"∵"],[/\\therefore\b/g,"∴"],[/\\notin\b/g,"∉"],[/\\in\b/g,"∈"],[/\\subseteq\b/g,"⊆"],[/\\subset\b/g,"⊂"],[/\\cup\b/g,"∪"],[/\\cap\b/g,"∩"],[/\\(?:emptyset|varnothing)\b/g,"∅"],[/\\forall\b/g,"∀"],[/\\exists\b/g,"∃"],[/\\Leftrightarrow\b/g,"⇔"],[/\\Rightarrow\b/g,"⇒"],[/\\(?:to|rightarrow)\b/g,"→"],[/\\leftarrow\b/g,"←"],[/\\alpha\b/g,"α"],[/\\beta\b/g,"β"],[/\\gamma\b/g,"γ"],[/\\delta\b/g,"δ"],[/\\Delta\b/g,"Δ"],[/\\(?:epsilon|varepsilon)\b/g,"ε"],[/\\theta\b/g,"θ"],[/\\lambda\b/g,"λ"],[/\\mu\b/g,"μ"],[/\\pi\b/g,"π"],[/\\rho\b/g,"ρ"],[/\\sigma\b/g,"σ"],[/\\tau\b/g,"τ"],[/\\(?:phi|varphi)\b/g,"φ"],[/\\omega\b/g,"ω"],[/\\Omega\b/g,"Ω"],[/\\sum\b/g,"∑"],[/\\prod\b/g,"∏"],[/\\int\b/g,"∫"]];function y(e,t,s){let a=e.trim();if(!a)return"";let n=Array.from(a).map(e=>t[e]);return n.every(Boolean)?n.join(""):1===a.length?`${s}${a}`:`${s}(${a})`}let j=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let s=t;for(let e=0;e<8;e++)s=1&s?0xedb88320^s>>>1:s>>>1;e[t]=s>>>0}return e})();function P(e,t){let s=[];if(t?.pageBreakBefore&&s.push("<w:pageBreakBefore/>"),t?.align&&"left"!==t.align&&s.push(`<w:jc w:val="${t.align}"/>`),t?.spaceBeforeDxa!==void 0||t?.spaceAfterDxa!==void 0){let e=t.spaceBeforeDxa??0,a=t.spaceAfterDxa??80;s.push(`<w:spacing w:before="${e}" w:after="${a}" w:line="320" w:lineRule="auto"/>`)}t?.bottomBorder&&s.push('<w:pBdr><w:bottom w:val="dashed" w:sz="4" w:space="4" w:color="CCCCCC"/></w:pBdr>');let a=s.length>0?`<w:pPr>${s.join("")}</w:pPr>`:"";return`<w:p>${a}${e}</w:p>`}function A(e,t){let s=['<w:rFonts w:ascii="Calibri" w:hAnsi="Calibri" w:eastAsia="Microsoft YaHei" w:cs="Calibri"/>'];return t?.bold&&s.push("<w:b/>"),t?.sizeHalfPt&&s.push(`<w:sz w:val="${t.sizeHalfPt}"/><w:szCs w:val="${t.sizeHalfPt}"/>`),t?.colorHex&&s.push(`<w:color w:val="${t.colorHex}"/>`),`<w:r><w:rPr>${s.join("")}</w:rPr><w:t xml:space="preserve">${e.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g,"").replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}</w:t></w:r>`}function $(e,t){return(function(e){let t=e.replace(/<!--[\s\S]*?-->/g,"").replace(/\r\n/g,"\n").replace(/\\_/g,"_");t=t.replace(/\\underline\{\s*(?:\\quad|\\qquad|\\hspace\{[^}]*\}|\s)*\}/g,"______").replace(/\\underline\{([^{}]*)\}/g,"$1").replace(/\\rule\{[^}]*\}\{[^}]*\}/g,"______").replace(/\\hspace\{[^}]*\}/g," ");for(let e=0;e<2;e++)t=(t=(t=t.replace(/\\(?:d|t)?frac\{([^{}]*)\}\{([^{}]*)\}/g,(e,t,s)=>{let a=t.trim(),n=s.trim(),r=/^[A-Za-z0-9α-ωΑ-Ω]+$/.test(a)?a:`(${a})`,i=/^[A-Za-z0-9α-ωΑ-Ω]+$/.test(n)?n:`(${n})`;return`${r}/${i}`})).replace(/\\sqrt\[([^{}\]]*)\]\{([^{}]*)\}/g,(e,t,s)=>{let a=y(t,w,"^"),n=s.trim();return/^[A-Za-z0-9]+$/.test(n)?`${a}√${n}`:`${a}√(${n})`})).replace(/\\sqrt\{([^{}]*)\}/g,(e,t)=>{let s=t.trim();return/^[A-Za-z0-9]+$/.test(s)?`√${s}`:`√(${s})`});for(let[e,s]of(t=(t=t.replace(/\^\{\\circ\}|\^\\circ/g,"°").replace(/\^\{([^{}]+)\}/g,(e,t)=>y(t,w,"^")).replace(/\^([0-9n+-])/g,(e,t)=>y(t,w,"^")).replace(/_\{([^{}]+)\}/g,(e,t)=>y(t,b,"_")).replace(/_([0-9+-])/g,(e,t)=>y(t,b,"_"))).replace(/\\(?:text|mathrm|mathbf|mathit|mathbb|mathcal)\{([^{}]*)\}/g,"$1").replace(/\\(?:left|right)\s*([()[\]|.{])/g,"$1").replace(/\\(?:quad|qquad)\b/g," ").replace(/\\[,;!]/g," "),v))t=t.replace(e,s);return t=t.replace(/\$\$([\s\S]*?)\$\$/g,"$1").replace(/\$([^$\n]+)\$/g,"$1").replace(/\\([{}%&#])/g,"$1").replace(/\*\*([^*]+)\*\*/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/^#{1,6}\s+/gm,""),(0,f.n)(t.trim(),"\n")})(e).split("\n").map((e,s)=>0===s&&t?P(`${A(t,{bold:!0,colorHex:"333333"})}${A(e)}`,{spaceBeforeDxa:40,spaceAfterDxa:60}):P(A(e),{spaceBeforeDxa:20,spaceAfterDxa:60}))}async function S(e,t){return"u"<typeof document||"u"<typeof Image?null:new Promise(s=>{let a=new Image;a.crossOrigin="anonymous",a.onload=()=>{try{let e=a.naturalWidth||a.width||320,n=a.naturalHeight||a.height||200,r=t?.maxBaseWidthPx??560,i=e>r?r/e:1,l=(t?.scalePercent??100)/100,o=Math.max(40,Math.round(e*i*l)),c=Math.max(30,Math.round(n*i*l)),m=document.createElement("canvas");m.width=2*o,m.height=2*c;let p=m.getContext("2d");if(!p)return void s(null);p.fillStyle="#ffffff",p.fillRect(0,0,m.width,m.height),p.drawImage(a,0,0,m.width,m.height);let d=function(e){let t=e.indexOf(",");if(t<0)return null;let s=atob(e.slice(t+1)),a=new Uint8Array(s.length);for(let e=0;e<s.length;e++)a[e]=s.charCodeAt(e);return a}(m.toDataURL("image/png"));if(!d)return void s(null);s({data:d,extension:"png",widthPx:o,heightPx:c,align:(0,h.o)(t?.align)})}catch{s(null)}},a.onerror=()=>s(null),a.src=e})}async function N(e,t,s){return e?S((0,x.f)(e),{scalePercent:(0,h.V)(t??void 0),maxBaseWidthPx:360,align:s}):null}e.s(["x",0,function(e){let t=new TextEncoder,s=[],a=[],n=[],r=0;for(let t of(s.push(P(A(e.title,{bold:!0,sizeHalfPt:36}),{align:"center",spaceBeforeDxa:0,spaceAfterDxa:160})),e.metaItems&&e.metaItems.length>0&&s.push(P(A(e.metaItems.join(" "),{sizeHalfPt:22}),{align:"center",spaceBeforeDxa:0,spaceAfterDxa:240})),e.questions)){let e=[A(t.heading,{bold:!0,sizeHalfPt:24}),...t.meta?[A(` ${t.meta}`,{sizeHalfPt:18,colorHex:"666666"})]:[]].join("");if(s.push(P(e,{spaceBeforeDxa:160,spaceAfterDxa:80})),t.questionText&&s.push(...$(t.questionText)),t.image&&t.image.data.length>0){r+=1;let e=`rIdImg${r}`,i=`image${r}.${t.image.extension}`;a.push({name:`word/media/${i}`,data:t.image.data}),n.push(`<Relationship Id="${e}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/${i}"/>`),s.push(function(e,t,s){let a=s.widthPx>600?600/s.widthPx:1,n=Math.max(9525,Math.round(s.widthPx*a*9525)),r=Math.max(9525,Math.round(s.heightPx*a*9525)),i=(0,h.o)(s.align);return P(`<w:r><w:drawing><wp:inline distT="0" distB="0" distL="0" distR="0"><wp:extent cx="${n}" cy="${r}"/><wp:docPr id="${t}" name="Figure ${t}"/><wp:cNvGraphicFramePr><a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1"/></wp:cNvGraphicFramePr><a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:nvPicPr><pic:cNvPr id="${t}" name="image${t}.${s.extension}"/><pic:cNvPicPr/></pic:nvPicPr><pic:blipFill><a:blip r:embed="${e}"/><a:stretch><a:fillRect/></a:stretch></pic:blipFill><pic:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${n}" cy="${r}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></pic:spPr></pic:pic></a:graphicData></a:graphic></wp:inline></w:drawing></w:r>`,{align:i,spaceBeforeDxa:80,spaceAfterDxa:80})}(e,r,t.image))}t.inlineAnswerText&&s.push(...$(t.inlineAnswerText,t.inlineAnswerLabel?`${t.inlineAnswerLabel}:`:void 0)),t.inlineAnalysisText&&s.push(...$(t.inlineAnalysisText,t.inlineAnalysisLabel?`${t.inlineAnalysisLabel}:`:void 0)),s.push(...function(e){let t=Math.max(0,Math.round(e));if(t<=0)return[P("",{spaceBeforeDxa:0,spaceAfterDxa:80,bottomBorder:!0})];let s=Math.max(1,Math.round(t/28)),a=[];for(let e=0;e<s;e++){let t=e===s-1;a.push(P("",{spaceBeforeDxa:0,spaceAfterDxa:t?120:80,bottomBorder:t}))}return a}(t.answerSpacePx))}if(e.answerKey&&e.answerKey.length>0)for(let t of(s.push(P(A(e.answerKeyTitle||"参考答案与解析",{bold:!0,sizeHalfPt:30}),{align:"center",pageBreakBefore:!0,spaceBeforeDxa:120,spaceAfterDxa:200})),e.answerKey)){let e=[A(t.heading,{bold:!0,sizeHalfPt:22}),...t.meta?[A(` ${t.meta}`,{sizeHalfPt:18,colorHex:"666666"})]:[]].join("");s.push(P(e,{spaceBeforeDxa:120,spaceAfterDxa:60})),t.answerText&&s.push(...$(t.answerText,t.answerLabel?`${t.answerLabel}:`:void 0)),t.analysisText&&s.push(...$(t.analysisText,t.analysisLabel?`${t.analysisLabel}:`:void 0))}let i=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
2
|
+
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture">
|
|
3
|
+
<w:body>
|
|
4
|
+
${s.join("\n")}
|
|
5
|
+
<w:sectPr>
|
|
6
|
+
<w:pgSz w:w="11906" w:h="16838"/>
|
|
7
|
+
<w:pgMar w:top="850" w:right="850" w:bottom="850" w:left="850" w:header="450" w:footer="450" w:gutter="0"/>
|
|
8
|
+
</w:sectPr>
|
|
9
|
+
</w:body>
|
|
10
|
+
</w:document>`,l=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
11
|
+
<w:styles xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
|
|
12
|
+
<w:docDefaults>
|
|
13
|
+
<w:rPrDefault><w:rPr><w:rFonts w:ascii="Calibri" w:hAnsi="Calibri" w:eastAsia="Microsoft YaHei" w:cs="Calibri"/><w:sz w:val="22"/><w:szCs w:val="22"/><w:color w:val="111111"/></w:rPr></w:rPrDefault>
|
|
14
|
+
<w:pPrDefault><w:pPr><w:spacing w:after="80" w:line="320" w:lineRule="auto"/></w:pPr></w:pPrDefault>
|
|
15
|
+
</w:docDefaults>
|
|
16
|
+
</w:styles>`,o=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
17
|
+
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
|
|
18
|
+
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
|
|
19
|
+
<Default Extension="xml" ContentType="application/xml"/>
|
|
20
|
+
<Default Extension="png" ContentType="image/png"/>
|
|
21
|
+
<Default Extension="jpeg" ContentType="image/jpeg"/>
|
|
22
|
+
<Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/>
|
|
23
|
+
<Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/>
|
|
24
|
+
</Types>`,c=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
25
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
26
|
+
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/>
|
|
27
|
+
</Relationships>`,m=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
28
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
29
|
+
<Relationship Id="rIdStyles" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>
|
|
30
|
+
${n.join("\n")}
|
|
31
|
+
</Relationships>`;return function(e){let t=new TextEncoder,s=[],a=[],n=0;for(let r of e){let e=t.encode(r.name),i=r.data,l=function(e){let t=0xffffffff;for(let s=0;s<e.length;s++)t=j[(t^e[s])&255]^t>>>8;return(0xffffffff^t)>>>0}(i),o=new Uint8Array(30+e.length),c=new DataView(o.buffer);c.setUint32(0,0x4034b50,!0),c.setUint16(4,20,!0),c.setUint16(6,2048,!0),c.setUint16(8,0,!0),c.setUint16(10,0,!0),c.setUint16(12,33,!0),c.setUint32(14,l,!0),c.setUint32(18,i.length,!0),c.setUint32(22,i.length,!0),c.setUint16(26,e.length,!0),c.setUint16(28,0,!0),o.set(e,30);let m=new Uint8Array(46+e.length),p=new DataView(m.buffer);p.setUint32(0,0x2014b50,!0),p.setUint16(4,20,!0),p.setUint16(6,20,!0),p.setUint16(8,2048,!0),p.setUint16(10,0,!0),p.setUint16(12,0,!0),p.setUint16(14,33,!0),p.setUint32(16,l,!0),p.setUint32(20,i.length,!0),p.setUint32(24,i.length,!0),p.setUint16(28,e.length,!0),p.setUint16(30,0,!0),p.setUint16(32,0,!0),p.setUint16(34,0,!0),p.setUint16(36,0,!0),p.setUint32(38,0,!0),p.setUint32(42,n,!0),m.set(e,46),s.push(o,i),a.push(m),n+=o.length+i.length}let r=a.reduce((e,t)=>e+t.length,0),i=new Uint8Array(22),l=new DataView(i.buffer);l.setUint32(0,0x6054b50,!0),l.setUint16(4,0,!0),l.setUint16(6,0,!0),l.setUint16(8,e.length,!0),l.setUint16(10,e.length,!0),l.setUint32(12,r,!0),l.setUint32(16,n,!0),l.setUint16(20,0,!0);let o=new Uint8Array(n+r+i.length),c=0;for(let e of s)o.set(e,c),c+=e.length;for(let e of a)o.set(e,c),c+=e.length;return o.set(i,c),o}([{name:"[Content_Types].xml",data:t.encode(o)},{name:"_rels/.rels",data:t.encode(c)},{name:"word/document.xml",data:t.encode(i)},{name:"word/styles.xml",data:t.encode(l)},{name:"word/_rels/document.xml.rels",data:t.encode(m)},...a])},"e",0,S,"N",0,N,"X",0,function(e,t){let s,a=new ArrayBuffer(e.byteLength);new Uint8Array(a).set(e);let n=new Blob([a],{type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}),r=URL.createObjectURL(n),i=document.createElement("a");i.href=r,s=t.trim().replace(/[\\/:*?"<>|\s]+/g,"_").replace(/^_+|_+$/g,"").slice(0,80),i.download=`${s||"document"}.docx`,i.click(),URL.revokeObjectURL(r)}],918611)},149704,e=>{var t=e.i(843476),s=e.i(111110),a=e.i(398019),n=e.i(184110),r=e.i(975157);let i={left:"mr-auto",center:"mx-auto",right:"ml-auto"};e.s(["f",0,function({svg:e,scale:l,align:o,className:c}){let{t:m}=(0,s.b)();if(!e)return null;let p=(0,n.V)(l),d=(0,n.o)(o);return(0,t.jsx)("figure",{className:(0,r.f)("question-figure my-3",c),children:(0,t.jsx)("img",{src:(0,a.f)(e),alt:m.figure.alt,className:(0,r.f)(i[d],"block h-auto max-w-full rounded border bg-white p-2"),style:{..."left"===d?{marginLeft:0,marginRight:"auto"}:"right"===d?{marginLeft:"auto",marginRight:0}:{},maxHeight:360,zoom:p/100,maxWidth:`${Math.min(p,100)}%`}})})}])},590546,e=>{var t=e.i(843476),s=e.i(618566),a=e.i(519455),n=e.i(711241);e.s(["f",0,function({fallbackUrl:e,className:r}){let i=(0,s.useRouter)();return(0,t.jsx)(a.f,{variant:"ghost",size:"icon",onClick:()=>{i.push(e)},className:r,children:(0,t.jsx)(n.f,{className:"h-5 w-5"})})}])},469817,e=>{e.s(["$",0,18,"u",0,5,"A",0,200])},184110,e=>{let t=["left","center","right"],s="center";function a(e){return"number"==typeof e&&Number.isInteger(e)&&e>=10&&e<=200}e.s(["E",0,s,"n",0,100,"j",0,t,"a",0,200,"_",0,10,"x",0,a,"o",0,function(e){return"string"==typeof e&&t.includes(e)?e:s},"V",0,function(e){return a(e)?e:100}])},398019,e=>{e.s(["f",0,function(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}])},35209,e=>{var t=e.i(271645),s=e.i(111110);e.s(["f",0,function(...e){let{t:a}=(0,s.b)(),n=[a.pageTitle.base,...e.map(e=>"string"==typeof e?e.trim():"").filter(e=>e.length>0)].join("-");(0,t.useEffect)(()=>{document.title=n},[n])}])}])})();
|