wrong-notebook 2026.10.21 → 2026.10.22-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/build-manifest.json +3 -3
- package/.next/prerender-manifest.json +3 -3
- 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/dashboard/route.js +1 -1
- package/.next/server/app/api/admin/dashboard/route.js.nft.json +1 -1
- package/.next/server/app/api/ai/models/route.js +2 -2
- package/.next/server/app/api/ai/models/route.js.nft.json +1 -1
- package/.next/server/app/api/ai/test/route.js +3 -3
- package/.next/server/app/api/ai/test/route.js.nft.json +1 -1
- package/.next/server/app/api/analytics/route.js +1 -1
- package/.next/server/app/api/analytics/route.js.nft.json +1 -1
- package/.next/server/app/api/analyze/route.js +2 -2
- package/.next/server/app/api/analyze/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/figure/route.js +2 -2
- 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 +2 -2
- 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 +4 -3
- package/.next/server/app/api/error-items/[id]/geogebra/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/reanswer/route.js +5 -4
- 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 +6 -6
- package/.next/server/app/api/error-items/[id]/retag/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/svg-animation/route.js +2 -2
- package/.next/server/app/api/error-items/[id]/svg-animation/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/list/route.js +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 +6 -6
- package/.next/server/app/api/error-items/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/questions/[questionId]/regenerate/route.js +5 -5
- 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 +6 -6
- package/.next/server/app/api/exams/[id]/results/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/retry/route.js +5 -5
- package/.next/server/app/api/exams/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/route.js +3 -3
- package/.next/server/app/api/exams/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/route.js +4 -4
- package/.next/server/app/api/exams/route.js.nft.json +1 -1
- package/.next/server/app/api/export/route.js +1 -1
- package/.next/server/app/api/export/route.js.nft.json +1 -1
- package/.next/server/app/api/geogebra-analyze/route.js +4 -4
- package/.next/server/app/api/geogebra-analyze/route.js.nft.json +1 -1
- package/.next/server/app/api/import/route.js +6 -6
- package/.next/server/app/api/import/route.js.nft.json +1 -1
- package/.next/server/app/api/notebooks/[id]/retag/route.js +3 -3
- package/.next/server/app/api/notebooks/[id]/retag/route.js.nft.json +1 -1
- package/.next/server/app/api/openclaw/batch-upload/route.js +5 -5
- package/.next/server/app/api/openclaw/batch-upload/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/generate/route.js +4 -4
- package/.next/server/app/api/practice/generate/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/record/[id]/route.js +4 -4
- package/.next/server/app/api/practice/record/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/record/route.js +4 -3
- 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 +1 -1
- package/.next/server/app/api/register/route.js.nft.json +1 -1
- package/.next/server/app/api/register/status/route.js +1 -1
- package/.next/server/app/api/register/status/route.js.nft.json +1 -1
- package/.next/server/app/api/settings/route.js +5 -4
- package/.next/server/app/api/settings/route.js.nft.json +1 -1
- package/.next/server/app/api/stats/practice/route.js +1 -1
- package/.next/server/app/api/stats/practice/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/latex-test/page.js.nft.json +1 -1
- package/.next/server/app/latex-test/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/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/chunks/{[root-of-the-server]__0-8hf14._.js → [root-of-the-server]__02j1w81._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__08gak8r._.js → [root-of-the-server]__03nfvnm._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__0gpohuv._.js → [root-of-the-server]__06_nln5._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__07jl92a._.js +1 -1
- package/.next/server/chunks/{[root-of-the-server]__08zi-xg._.js → [root-of-the-server]__0be5c5r._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__0994h9l._.js → [root-of-the-server]__0bqawi0._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__0bsw5c9._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0cmxmwt._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__1utxo11._.js → [root-of-the-server]__0d5dpu4._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__05no8nw._.js → [root-of-the-server]__0d9ijed._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__0fnyu4s._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0j5231l._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__0m_f8ct._.js → [root-of-the-server]__0k-nf6a._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__0k-p1pj._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0lrdm1u._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0lro5a7._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0mfjf2y._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__0yds0ae._.js → [root-of-the-server]__0mqorxb._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__0no6umu._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0o9gtvd._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__0ynfeq-._.js → [root-of-the-server]__0obb4y-._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__0p3u6_q._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0rmrkd_._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0tdibjz._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0vhjihq._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0vz88er._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0wf9znr._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0zv7jom._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__11_-ncy._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__11_1z7m._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__11n87go._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__11p4ahb._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__122xu-0._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__131taws._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__14dnbrn._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__14jqm9_._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__152lbaw._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__04mu6-m._.js → [root-of-the-server]__16begv4._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__17duis5._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__17q3k-v._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__184u6de._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__18atlj8._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__18c7l6u._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__18zrkky._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1aaux7e._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1cceu4b._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1h09r50._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1j6mx-v._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1jdi-1f._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1ju8z29._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1kpo44g._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1lct0vi._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1loecue._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1mkpya8._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__1a4i9sz._.js → [root-of-the-server]__1nwf3ua._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__1p8hw44._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1rsn804._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1u-1vx4._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1v6nwhq._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1vw740y._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__20465pr._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__207mxv8._.js +3 -0
- package/.next/server/chunks/_0-eguqv._.js +3 -0
- package/.next/server/chunks/_0389uce._.js +3 -0
- package/.next/server/chunks/_0_o8yhv._.js +3 -0
- package/.next/server/chunks/_0gwg6ba._.js +3 -0
- package/.next/server/chunks/_0rdo0a4._.js +3 -0
- package/.next/server/chunks/_13ffmxv._.js +1 -1
- package/.next/server/chunks/_167vv93._.js +3 -0
- package/.next/server/chunks/_16jdov0._.js +1 -1
- package/.next/server/chunks/{_1ve0z0w._.js → _1e1h1f1._.js} +1 -1
- package/.next/server/chunks/_1flar98._.js +3 -0
- package/.next/server/chunks/_1pvqo-q._.js +3 -0
- package/.next/server/chunks/src_lib_ai_prompts_ts_0z36zms._.js +15 -8
- package/.next/server/chunks/ssr/src_1gayunq._.js +1 -1
- package/.next/server/chunks/ssr/src_1o363ao._.js +1 -1
- package/.next/server/chunks/ssr/src_app_error-items_[id]_page_tsx_04xwwdm._.js +1 -1
- package/.next/server/chunks/ssr/src_app_notebooks_[id]_page_tsx_08njm-5._.js +1 -1
- package/.next/server/chunks/ssr/src_components_providers_tsx_09kw-mv._.js +10 -10
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/middleware-manifest.json +5 -5
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/130ch9mnvb6mp.css +3 -0
- package/.next/static/chunks/17wdtw8hml2n6.js +191 -0
- package/.next/static/chunks/2a0kgntckcbvf.js +1 -0
- package/.next/static/chunks/{05q4yafxnvtzs.js → 2wnnnmbh85mq_.js} +1 -1
- package/.next/static/chunks/3hz1l3qoxv84t.js +1 -0
- package/launcher.js +16 -0
- package/package.json +1 -1
- package/prisma/seed.db +0 -0
- package/.next/server/chunks/[root-of-the-server]__00m7v48._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__01m28mx._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__07nvz1d._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0b3nww4._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0bs5unr._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0dfbwm3._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0els3c1._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0grkic-._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0hj9oe2._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0j-gv3-._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0je3zje._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0na-z2m._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0ns_tws._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0p3hkz7._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0pli74s._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0qaih8c._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0ra48rd._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0sh6-yu._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0ssagl1._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0ws6c0v._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0ydrrdj._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0z-sjqh._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0zp1e41._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__108ydjw._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__10yghm_._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__11-sf2-._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__11wobg2._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__13_c7nc._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__14pcopd._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__150ei9u._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__15g7yjy._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__19nm3y_._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1e3crdc._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1g-xe1f._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1g3usdn._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1hmv25w._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1hq73__._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1ouzjax._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1pcgq22._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1q5nt5y._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1qt6_3b._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1v1dgs2._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1v9b8go._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1vzxn91._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1wgn76g._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1wkh9sj._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1xcmja4._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1y6fx9-._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1zos_p4._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1zp0oig._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__203q6el._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__20bun16._.js +0 -3
- package/.next/server/chunks/_0ae3z2e._.js +0 -3
- package/.next/server/chunks/_0o1p57f._.js +0 -3
- package/.next/server/chunks/_0t6g4yt._.js +0 -3
- package/.next/server/chunks/_19fidvw._.js +0 -3
- package/.next/server/chunks/_1oqpwh8._.js +0 -3
- package/.next/server/chunks/_1q5w9fc._.js +0 -3
- package/.next/static/chunks/1ad3ir88_e_v6.css +0 -3
- package/.next/static/chunks/29erttsjondpe.js +0 -1
- package/.next/static/chunks/31rxdwy0u_t29.js +0 -1
- package/.next/static/chunks/37g3bsrs22xg7.js +0 -191
- /package/.next/static/{OpwRvHtdhPgxve2rKkWkK → PipzREVX2s4mdvp2gs1DS}/_buildManifest.js +0 -0
- /package/.next/static/{OpwRvHtdhPgxve2rKkWkK → PipzREVX2s4mdvp2gs1DS}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{OpwRvHtdhPgxve2rKkWkK → PipzREVX2s4mdvp2gs1DS}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,1661,e=>{"use strict";var s=e.i(18050),t=e.i(11110),a=e.i(17255),r=e.i(15519),i=e.i(57688),n=e.i(22016),l=e.i(18566),o=e.i(17923),c=e.i(10980),d=e.i(78583),m=e.i(75254);let u=(0,m.default)("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]),p=(0,m.default)("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),x=(0,m.default)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]),h=(0,m.default)("tags",[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]]);var g=e.i(71645),f=e.i(19455),j=e.i(76639),v=e.i(93479),y=e.i(10204),b=e.i(67489),N=e.i(77572);let w=(0,m.default)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);var k=e.i(27612),S=e.i(31278);let C=(0,m.default)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var I=e.i(86536),T=e.i(77705),L=e.i(63639),E=e.i(84614);let z=(0,m.default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);var A=e.i(16715),D=e.i(7233);let M=(0,m.default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),R=(0,m.default)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);var P=e.i(73884),_=e.i(40160);let U=(0,m.default)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);var K=e.i(30691),B=e.i(87486),F=e.i(81140),O=e.i(20783),$=e.i(30030),q=e.i(69340),V=e.i(99682),H=e.i(35804);e.i(74080);var X=Symbol("radix.slottable");function W(e){return g.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===X}var Y=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var a,r;let i,n,l,o=(r=a=`Primitive.${t}`,(i=g.forwardRef((e,s)=>{let{children:t,...a}=e;if(g.isValidElement(t)){var r;let e,i,n=(r=t,(i=(e=Object.getOwnPropertyDescriptor(r.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?r.ref:(i=(e=Object.getOwnPropertyDescriptor(r,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?r.props.ref:r.props.ref||r.ref),l=function(e,s){let t={...s};for(let a in s){let r=e[a],i=s[a];/^on[A-Z]/.test(a)?r&&i?t[a]=(...e)=>{let s=i(...e);return r(...e),s}:r&&(t[a]=r):"style"===a?t[a]={...r,...i}:"className"===a&&(t[a]=[r,i].filter(Boolean).join(" "))}return{...e,...t}}(a,t.props);return t.type!==g.Fragment&&(l.ref=s?(0,O.composeRefs)(s,n):n),g.cloneElement(t,l)}return g.Children.count(t)>1?g.Children.only(null):null})).displayName=`${r}.SlotClone`,n=i,(l=g.forwardRef((e,t)=>{let{children:a,...r}=e,i=g.Children.toArray(a),l=i.find(W);if(l){let e=l.props.children,a=i.map(s=>s!==l?s:g.Children.count(e)>1?g.Children.only(null):g.isValidElement(e)?e.props.children:null);return(0,s.jsx)(n,{...r,ref:t,children:g.isValidElement(e)?g.cloneElement(e,void 0,a):null})}return(0,s.jsx)(n,{...r,ref:t,children:a})})).displayName=`${a}.Slot`,l),c=g.forwardRef((e,a)=>{let{asChild:r,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,s.jsx)(r?o:t,{...i,ref:a})});return c.displayName=`Primitive.${t}`,{...e,[t]:c}},{}),Z="Switch",[G,J]=(0,$.createContextScope)(Z),[Q,ee]=G(Z),es=g.forwardRef((e,t)=>{let{__scopeSwitch:a,name:r,checked:i,defaultChecked:n,required:l,disabled:o,value:c="on",onCheckedChange:d,form:m,...u}=e,[p,x]=g.useState(null),h=(0,O.useComposedRefs)(t,e=>x(e)),f=g.useRef(!1),j=!p||m||!!p.closest("form"),[v,y]=(0,q.useControllableState)({prop:i,defaultProp:n??!1,onChange:d,caller:Z});return(0,s.jsxs)(Q,{scope:a,checked:v,disabled:o,children:[(0,s.jsx)(Y.button,{type:"button",role:"switch","aria-checked":v,"aria-required":l,"data-state":ei(v),"data-disabled":o?"":void 0,disabled:o,value:c,...u,ref:h,onClick:(0,F.composeEventHandlers)(e.onClick,e=>{y(e=>!e),j&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})}),j&&(0,s.jsx)(er,{control:p,bubbles:!f.current,name:r,value:c,checked:v,required:l,disabled:o,form:m,style:{transform:"translateX(-100%)"}})]})});es.displayName=Z;var et="SwitchThumb",ea=g.forwardRef((e,t)=>{let{__scopeSwitch:a,...r}=e,i=ee(et,a);return(0,s.jsx)(Y.span,{"data-state":ei(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:t})});ea.displayName=et;var er=g.forwardRef(({__scopeSwitch:e,control:t,checked:a,bubbles:r=!0,...i},n)=>{let l=g.useRef(null),o=(0,O.useComposedRefs)(l,n),c=(0,V.usePrevious)(a),d=(0,H.useSize)(t);return g.useEffect(()=>{let e=l.current;if(!e)return;let s=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(c!==a&&s){let t=new Event("click",{bubbles:r});s.call(e,a),e.dispatchEvent(t)}},[c,a,r]),(0,s.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a,...i,tabIndex:-1,ref:o,style:{...i.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function ei(e){return e?"checked":"unchecked"}er.displayName="SwitchBubbleInput";var en=e.i(75157);let el=g.forwardRef(({className:e,...t},a)=>(0,s.jsx)(es,{className:(0,en.cn)("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:a,children:(0,s.jsx)(ea,{className:(0,en.cn)("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));el.displayName=es.displayName;let eo=g.forwardRef(({className:e,...t},a)=>(0,s.jsx)("div",{className:"relative w-full overflow-auto",children:(0,s.jsx)("table",{ref:a,className:(0,en.cn)("w-full caption-bottom text-sm",e),...t})}));eo.displayName="Table";let ec=g.forwardRef(({className:e,...t},a)=>(0,s.jsx)("thead",{ref:a,className:(0,en.cn)("[&_tr]:border-b",e),...t}));ec.displayName="TableHeader";let ed=g.forwardRef(({className:e,...t},a)=>(0,s.jsx)("tbody",{ref:a,className:(0,en.cn)("[&_tr:last-child]:border-0",e),...t}));ed.displayName="TableBody",g.forwardRef(({className:e,...t},a)=>(0,s.jsx)("tfoot",{ref:a,className:(0,en.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t})).displayName="TableFooter";let em=g.forwardRef(({className:e,...t},a)=>(0,s.jsx)("tr",{ref:a,className:(0,en.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));em.displayName="TableRow";let eu=g.forwardRef(({className:e,...t},a)=>(0,s.jsx)("th",{ref:a,className:(0,en.cn)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));eu.displayName="TableHead";let ep=g.forwardRef(({className:e,...t},a)=>(0,s.jsx)("td",{ref:a,className:(0,en.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));ep.displayName="TableCell",g.forwardRef(({className:e,...t},a)=>(0,s.jsx)("caption",{ref:a,className:(0,en.cn)("mt-4 text-sm text-muted-foreground",e),...t})).displayName="TableCaption";let ex=(0,m.default)("ban",[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var eh=e.i(69638),eg=e.i(41931),ef=e.i(94114);function ej(){let{timeZone:e}=(0,r.useTimeZone)(),{data:i}=(0,a.useSession)(),{t:n,language:l}=(0,t.useLanguage)(),[o,c]=(0,g.useState)([]),[d,m]=(0,g.useState)(!0),[u,p]=(0,g.useState)(!0),[x,h]=(0,g.useState)(!1);(0,g.useEffect)(()=>{b(),j()},[]);let j=async()=>{try{let e=await eg.apiClient.get("/api/settings");p(!1!==e.allowRegistration)}catch(e){console.error("Failed to fetch config",e)}},v=async e=>{h(!0);try{await eg.apiClient.post("/api/settings",{allowRegistration:e}),p(e)}catch(e){console.error("Failed to update registration setting",e),ef.toast.error(n.common.error)}finally{h(!1)}},b=async()=>{m(!0);try{let e=await eg.apiClient.get("/api/admin/users");c(e)}catch(e){console.error("Failed to fetch users",e)}finally{m(!1)}},N=async e=>{let s=e.isActive?n.admin.confirmDisable:n.admin.confirmEnable;if(await (0,ef.confirmDialog)(s))try{await eg.apiClient.patch(`/api/admin/users/${e.id}`,{isActive:!e.isActive}),b()}catch(e){console.error("Failed to update user status",e),ef.toast.error(n.common.error)}},w=async e=>{if(await (0,ef.confirmDialog)(n.admin.confirmDelete,{destructive:!0}))try{await eg.apiClient.delete(`/api/admin/users/${e.id}`),b()}catch(s){console.error("Failed to delete user",s);let e=s.data?.message||n.common.error;ef.toast.error(e)}};return d?(0,s.jsx)("div",{className:"flex justify-center py-8",children:(0,s.jsx)(S.Loader2,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 border rounded-lg bg-muted/30",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(y.Label,{className:"text-base",children:n.admin?.allowRegistration||"Allow New Registrations"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:n.admin?.allowRegistrationDesc||"When disabled, new users cannot register"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[x&&(0,s.jsx)(S.Loader2,{className:"h-4 w-4 animate-spin"}),(0,s.jsx)(el,{checked:u,onCheckedChange:v,disabled:x})]})]}),(0,s.jsx)("div",{className:"sm:hidden space-y-3",children:o.map(t=>(0,s.jsxs)("div",{className:"border rounded-lg p-4 bg-card space-y-3",children:[(0,s.jsxs)("div",{className:"flex justify-between items-start",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-medium",children:t.name||"N/A"}),(0,s.jsx)("div",{className:"text-sm text-muted-foreground",children:t.email})]}),(0,s.jsx)(B.Badge,{variant:"admin"===t.role?"default":"secondary",children:"admin"===t.role?n.admin.admin:n.admin.user})]}),(0,s.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,s.jsxs)("div",{className:"text-muted-foreground",children:[n.admin.errors,": ",t._count.errorItems," | ",n.admin.practiceCount,": ",t._count.practiceRecords]}),(0,s.jsx)(B.Badge,{variant:t.isActive?"default":"destructive",className:"text-xs",children:t.isActive?n.admin.active:n.admin.disabled})]}),(0,s.jsxs)("div",{className:"flex justify-between items-center pt-2 border-t",children:[(0,s.jsx)("div",{className:"text-xs text-muted-foreground",children:(0,K.formatDateTime)(t.createdAt,"yyyy-MM-dd",e)}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(f.Button,{variant:"ghost",size:"sm",onClick:()=>N(t),disabled:t.id===(i?.user).id,children:t.isActive?(0,s.jsx)(ex,{className:"h-4 w-4 text-orange-500"}):(0,s.jsx)(eh.CheckCircle,{className:"h-4 w-4 text-green-500"})}),(0,s.jsx)(f.Button,{variant:"ghost",size:"sm",onClick:()=>w(t),disabled:t.id===(i?.user).id,children:(0,s.jsx)(k.Trash2,{className:"h-4 w-4 text-destructive"})})]})]})]},t.id))}),(0,s.jsx)("div",{className:"hidden sm:block border rounded-lg overflow-hidden",children:(0,s.jsxs)(eo,{children:[(0,s.jsx)(ec,{children:(0,s.jsxs)(em,{children:[(0,s.jsx)(eu,{children:n.admin.nameEmail}),(0,s.jsx)(eu,{children:n.admin.role}),(0,s.jsx)(eu,{children:n.admin.stats}),(0,s.jsx)(eu,{children:n.admin.createdAt}),(0,s.jsx)(eu,{children:n.admin.status}),(0,s.jsx)(eu,{className:"text-right",children:n.admin.actions})]})}),(0,s.jsx)(ed,{children:o.map(t=>(0,s.jsxs)(em,{children:[(0,s.jsxs)(ep,{children:[(0,s.jsx)("div",{className:"font-medium",children:t.name||"N/A"}),(0,s.jsx)("div",{className:"text-sm text-muted-foreground",children:t.email})]}),(0,s.jsx)(ep,{children:(0,s.jsx)(B.Badge,{variant:"admin"===t.role?"default":"secondary",children:"admin"===t.role?n.admin.admin:n.admin.user})}),(0,s.jsxs)(ep,{children:[(0,s.jsxs)("div",{className:"text-sm",children:[n.admin.errors,": ",t._count.errorItems]}),(0,s.jsxs)("div",{className:"text-sm",children:[n.admin.practiceCount,": ",t._count.practiceRecords]})]}),(0,s.jsx)(ep,{children:(0,K.formatDateTime)(t.createdAt,"yyyy-MM-dd",e)}),(0,s.jsx)(ep,{children:(0,s.jsx)(B.Badge,{variant:t.isActive?"default":"destructive",children:t.isActive?n.admin.active:n.admin.disabled})}),(0,s.jsxs)(ep,{className:"text-right space-x-2",children:[(0,s.jsx)(f.Button,{variant:"ghost",size:"sm",onClick:()=>N(t),disabled:t.id===(i?.user).id,title:t.isActive?n.admin.disable:n.admin.enable,children:t.isActive?(0,s.jsx)(ex,{className:"h-4 w-4 text-orange-500"}):(0,s.jsx)(eh.CheckCircle,{className:"h-4 w-4 text-green-500"})}),(0,s.jsx)(f.Button,{variant:"ghost",size:"sm",onClick:()=>w(t),disabled:t.id===(i?.user).id,title:n.admin.delete,children:(0,s.jsx)(k.Trash2,{className:"h-4 w-4 text-destructive"})})]})]},t.id))})]})})]})}var ev=e.i(1276);let ey={minimax:{name:"MiniMax",baseUrl:"https://api.minimax.cn/v1",model:"MiniMax-M3.1-Flash",envPrefix:"MINIMAX",consoleUrl:"https://platform.minimax.cn"},glm:{name:"智谱 GLM",baseUrl:"https://open.bigmodel.cn/api/paas/v4",model:"glm-5.3-flash",envPrefix:"GLM",consoleUrl:"https://open.bigmodel.cn"},deepseek:{name:"DeepSeek",baseUrl:"https://api.deepseek.com",model:"deepseek-flash",envPrefix:"DEEPSEEK",consoleUrl:"https://platform.deepseek.com"},kimi:{name:"Kimi",baseUrl:"https://api.moonshot.cn/v1",model:"kimi-k3",envPrefix:"KIMI",consoleUrl:"https://platform.kimi.com"}},eb=Object.keys(ey);function eN(e){return"string"==typeof e&&Object.prototype.hasOwnProperty.call(ey,e)}function ew({provider:e,apiKey:a,baseUrl:r,currentModel:i,onModelChange:n}){let{t:l}=(0,t.useLanguage)(),[o,c]=(0,g.useState)([]),[d,m]=(0,g.useState)(!1),[u,p]=(0,g.useState)(null),[x,h]=(0,g.useState)(i||""),[j,N]=(0,g.useState)(!1);(0,g.useEffect)(()=>{h(i||"")},[i]);let w=async()=>{if(!a)return void p(l.modelSelector?.enterApiKeyFirst||"Please enter API Key first");m(!0),p(null);try{let s=await eg.apiClient.post("/api/ai/models",{provider:e,apiKey:a,...r&&{baseUrl:r}});if("error"in s&&"string"==typeof s.error){p(s.error),N(!0),c([]);return}c(s.models),0===s.models.length&&(p(l.modelSelector?.noVisionModel||"No vision model found, please enter manually"),N(!0))}catch(e){console.error("Failed to fetch models:",e),p((e?.message||l.modelSelector?.fetchFailed||"Failed to fetch models")+(l.modelSelector?.enterManually||", please enter manually")),N(!0)}finally{m(!1)}};return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(y.Label,{className:"flex-1",children:l.modelSelector?.modelName||"Model Name"}),(0,s.jsx)(f.Button,{type:"button",variant:"outline",size:"sm",onClick:w,disabled:d||!a,children:d?(0,s.jsx)(S.Loader2,{className:"h-3 w-3 animate-spin"}):(0,s.jsx)(A.RefreshCw,{className:"h-3 w-3"})})]}),u&&(0,s.jsx)("p",{className:"text-xs text-yellow-600",children:u}),j||0===o.length?(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(v.Input,{value:x,onChange:e=>{var s;h(s=e.target.value),n(s)},placeholder:eN(e)?ey[e].model:"openai"===e?"gpt-6.1-sol":"gemini-1.5-flash"}),o.length>0&&(0,s.jsx)(f.Button,{type:"button",variant:"link",size:"sm",className:"h-auto p-0 text-xs",onClick:()=>N(!1),children:l.modelSelector?.selectFromList||"Select from List"})]}):(0,s.jsx)("div",{className:"space-y-2",children:(0,s.jsxs)(b.Select,{value:i,onValueChange:e=>{"_custom"===e?N(!0):(N(!1),h(e),n(e))},children:[(0,s.jsx)(b.SelectTrigger,{children:(0,s.jsx)(b.SelectValue,{placeholder:l.modelSelector?.selectModel||"Select Model"})}),(0,s.jsxs)(b.SelectContent,{children:[o.map(e=>(0,s.jsxs)(b.SelectItem,{value:e.id,children:[e.name,e.owned_by&&` (${e.owned_by})`]},e.id)),(0,s.jsx)(b.SelectItem,{value:"_custom",children:l.modelSelector?.customInput||"Custom Input..."})]})]})})]})}var ek=e.i(24687);let eS=`请参考《高思学校竞赛数学导引》(每讲分兴趣篇、拓展篇、超越篇,题目左侧标 1~5 颗星)的星级标准,结合题目所在年级评定难度:
|
|
2
|
+
- 1 星:课本基础题,直接套用概念、公式或简单计算即可(相当于兴趣篇前几题)。
|
|
3
|
+
- 2 星:校内拔高题,需要两三步推理或简单综合(相当于兴趣篇后几题)。
|
|
4
|
+
- 3 星:常规奥数题,小升初、杯赛常见难度,需要掌握该专题的典型方法(相当于拓展篇)。
|
|
5
|
+
- 4 星:较难奥数题,需要构造、分类讨论、转化或多种方法综合(相当于拓展篇末题、超越篇前几题)。
|
|
6
|
+
- 5 星:竞赛压轴题,集训队水平,思路巧妙、步骤长(相当于超越篇难题)。
|
|
7
|
+
非数学学科按同样的 1~5 级划分:1 星为基础识记,3 星为综合应用,5 星为竞赛或压轴难度。`,eC=`- 输出一个完整的 <svg> 元素,包含 xmlns="http://www.w3.org/2000/svg" 和 viewBox(建议宽 400~600),不要用 Markdown 代码块包裹。
|
|
8
|
+
- 白色背景、黑色线条(stroke="#000",线宽 1.5~2),需要区分的区域可用浅灰填充;不要使用彩色装饰。
|
|
9
|
+
- 按原图比例和相对位置绘制,保留所有标注:顶点字母、数字、长度、角度、单位、箭头和虚线等,文字用 <text>(font-size 14~18)。
|
|
10
|
+
- 只使用基本图形元素:line、polyline、polygon、rect、circle、ellipse、path、text、g、defs、marker。
|
|
11
|
+
- 严禁使用 <image>、<script>、<foreignObject>、外部链接、外部字体或事件属性。`,eI=String.raw`- 行内公式用 $...$,独立公式用 $$...$$;不要用 \(...\) 或 \[...\],每个 $ 必须成对出现。
|
|
12
|
+
- 所有 LaTeX 命令(如 \frac、\sqrt、\times、\angle)都必须写在 $...$ 内,公式外不能出现反斜杠命令。
|
|
13
|
+
- 只使用 KaTeX 支持的命令和环境:方程组用 \begin{cases}...\end{cases},多行推导用 \begin{aligned}...\end{aligned}(放在 $$...$$ 中),不要用 align、eqnarray、\newcommand、\usepackage、\label、\tag 等。
|
|
14
|
+
- 大括号 {} 必须成对,\left 与 \right 必须成对,\begin{...} 与 \end{...} 必须对应。
|
|
15
|
+
- 公式中的中文写在 \text{...} 里,或放到公式外;百分号写成 \%,美元符号写成 \$。
|
|
16
|
+
- 反斜杠只写一个(\frac),不要写成 \\frac;换行符 \\ 只能用在 cases、aligned 等环境里。`,eT=`【角色与核心任务 (ROLE AND CORE TASK)】
|
|
17
|
+
你是一位世界顶尖的、经验丰富的、专业的跨学科考试分析专家(Interdisciplinary Exam Analysis Expert)。你的核心任务是极致准确地分析用户提供的考试题目图片,全面理解所有文本、图表和隐含约束,并提供一个完整、高度结构化且专业的解决方案。
|
|
18
|
+
|
|
19
|
+
{{language_instruction}}
|
|
20
|
+
|
|
21
|
+
【核心输出要求 (OUTPUT REQUIREMENTS)】
|
|
22
|
+
你的响应输出**必须严格遵循以下自定义标签格式**。**严禁**使用 JSON 或 Markdown 代码块。**严禁**对 LaTeX 公式中的反斜杠进行二次转义(如 "\\frac" 是错误的,必须是 "\frac")。
|
|
23
|
+
|
|
24
|
+
请严格按照以下结构输出内容:
|
|
25
|
+
|
|
26
|
+
<subject>
|
|
27
|
+
在此处填写学科,必须是以下之一:"数学", "物理", "化学", "生物", "英语", "语文", "历史", "地理", "政治", "其他"。
|
|
28
|
+
</subject>
|
|
29
|
+
|
|
30
|
+
<knowledge_points>
|
|
31
|
+
在此处填写知识点,使用逗号分隔,例如:知识点1, 知识点2, 知识点3
|
|
32
|
+
</knowledge_points>
|
|
33
|
+
|
|
34
|
+
<requires_image>
|
|
35
|
+
判断这道题是否需要依赖图片才能正确解答。如果题目包含几何图形、函数图像、实验装置图、电路图等必须看图才能理解的内容,填写 true;如果只需要文字描述即可理解(如英语题、纯文字数学题),填写 false。
|
|
36
|
+
</requires_image>
|
|
37
|
+
|
|
38
|
+
<has_figure>
|
|
39
|
+
判断题目本身是否带有配图(几何图形、函数图像、示意图、统计图、实验装置图、电路图等;不含学生的作答痕迹和纯文字表格)。有配图填 true,否则填 false。
|
|
40
|
+
</has_figure>
|
|
41
|
+
|
|
42
|
+
<figure_svg>
|
|
43
|
+
如果 has_figure 为 true,用 SVG 重新绘制题目配图:
|
|
44
|
+
${eC}
|
|
45
|
+
如果 has_figure 为 false,请留空。
|
|
46
|
+
</figure_svg>
|
|
47
|
+
|
|
48
|
+
<wrong_answer_text>
|
|
49
|
+
如果图片中包含学生已经写出的错误解答、错误步骤、草稿或错误答案,请尽量按原样摘录;如果没有看到学生错误解答,请留空。
|
|
50
|
+
</wrong_answer_text>
|
|
51
|
+
|
|
52
|
+
<mistake_status>
|
|
53
|
+
填写以下值之一:wrong_attempt(图片中有错误解答或错误步骤)、not_attempted(没有错误解答,像是完全不会做或未作答)、unknown(无法判断)。
|
|
54
|
+
</mistake_status>
|
|
55
|
+
|
|
56
|
+
<difficulty_stars>
|
|
57
|
+
只填写 1 到 5 之间的一个整数,表示题目难度星级。
|
|
58
|
+
${eS}
|
|
59
|
+
</difficulty_stars>
|
|
60
|
+
|
|
61
|
+
<mistake_analysis>
|
|
62
|
+
如果图片中包含错误解答,请分析错误可能发生在哪一步、为什么错、导致了什么后果;如果没有错误解答,请留空。
|
|
63
|
+
</mistake_analysis>
|
|
64
|
+
|
|
65
|
+
<question_text>
|
|
66
|
+
在此处填写题目的完整文本。使用 Markdown 格式。所有数学公式使用 LaTeX 符号(行内 $...$,块级 $$...$$)。
|
|
67
|
+
|
|
68
|
+
【题干转录规则】
|
|
69
|
+
1. **逐字照录**:按图片原文转录题干(含题号、分值和标点),不要改写、概括、增删字词或调整语序;看不清的字用 [?] 标注。
|
|
70
|
+
2. **填空统一**:所有填空处统一写作 ____(4 个下划线),不论原图横线长短。
|
|
71
|
+
3. **图形描述**:如果题目依赖图形,在题干原文之后空一行,单独写**一段**以「图示:」开头的图形描述;只能使用「图示:」这一种写法(不要写「图示信息」「图示说明」等),描述中不要重复题干已有的文字。题目不依赖图形时不要写图示段落。
|
|
72
|
+
|
|
73
|
+
【表格处理规则】
|
|
74
|
+
如果图片中包含表格,必须完整转录表格内容,遵循以下原则:
|
|
75
|
+
|
|
76
|
+
1. **标准表格**:使用 Markdown 表格语法
|
|
77
|
+
| 列标题1 | 列标题2 | 列标题3 |
|
|
78
|
+
|---------|---------|---------|
|
|
79
|
+
| 数据1 | 数据2 | 数据3 |
|
|
80
|
+
|
|
81
|
+
2. **复杂表格**(合并单元格/多级表头/不规则布局):
|
|
82
|
+
- 优先尝试用 Markdown 表格近似表示
|
|
83
|
+
- 如果 Markdown 无法准确表达,在表格前用文字说明结构,然后用简化的 Markdown 表格 + 注释
|
|
84
|
+
- 示例:
|
|
85
|
+
> 注:第1行为主标题,横跨3列;第2-3行为数据行
|
|
86
|
+
|
|
87
|
+
| 项目 | 数值A | 数值B |
|
|
88
|
+
|------|-------|-------|
|
|
89
|
+
| 测试1 | 10 | 20 |
|
|
90
|
+
| 测试2 | 15 | 25 |
|
|
91
|
+
|
|
92
|
+
3. **表格完整性要求**:
|
|
93
|
+
- 必须转录所有单元格内容(包括空单元格用 - 或空格表示)
|
|
94
|
+
- 保留表格标题、单位、注释
|
|
95
|
+
- 保留数据的对齐关系和分组信息
|
|
96
|
+
- 表格中的数学公式使用 LaTeX 语法
|
|
97
|
+
|
|
98
|
+
4. **表格上下文**:
|
|
99
|
+
- 如果表格有标题或编号(如"表1"),保留在表格前
|
|
100
|
+
- 如果表格后有注释或说明,保留在表格后
|
|
101
|
+
- 保持表格在题目中的位置关系
|
|
102
|
+
|
|
103
|
+
5. **特殊情况处理**:
|
|
104
|
+
- 图表混合:如果表格旁边有图形,用文字说明位置关系
|
|
105
|
+
- 手写表格:尽力识别手写内容,不确定的用 [?] 标注
|
|
106
|
+
- 模糊表格:如果表格不清晰,在表格前注明"(表格内容可能不完整)"
|
|
107
|
+
</question_text>
|
|
108
|
+
|
|
109
|
+
<answer_text>
|
|
110
|
+
在此处填写正确答案。使用 Markdown 和 LaTeX 符号。如果答案包含表格,遵循上述【表格处理规则】。
|
|
111
|
+
</answer_text>
|
|
112
|
+
|
|
113
|
+
<analysis>
|
|
114
|
+
在此处填写详细的步骤解析。
|
|
115
|
+
* 必须使用简体中文。
|
|
116
|
+
* **直接使用标准的 LaTeX 符号**(如 $\frac{1}{2}$),**不要**进行 JSON 转义(不要写成 \\frac)。
|
|
117
|
+
* 如果解析过程需要表格(如列表对比、分步计算表),遵循上述【表格处理规则】。
|
|
118
|
+
</analysis>
|
|
119
|
+
|
|
120
|
+
【知识点标签列表(KNOWLEDGE POINT LIST)】
|
|
121
|
+
{{knowledge_points_list}}
|
|
122
|
+
|
|
123
|
+
【标签使用规则 (TAG RULES)】
|
|
124
|
+
- 标签必须与题目实际考查的知识点精准匹配。
|
|
125
|
+
- 每题最多 5 个标签。
|
|
126
|
+
|
|
127
|
+
【!!! 关键格式与内容约束 (CRITICAL RULES) !!!】
|
|
128
|
+
1. **格式严格**:必须严格包含上述 12 个 XML 标签,除此之外不要输出任何其他“开场白”或“结束语”。
|
|
129
|
+
2. **纯文本**:内容作为纯文本处理,**不要转义反斜杠**。
|
|
130
|
+
3. **内容完整**:如果包含子问题,请在 question_text 中完整列出。
|
|
131
|
+
4. **禁止图片**:严禁包含任何图片链接或 markdown 图片语法。
|
|
132
|
+
5. **LaTeX 规范**:
|
|
133
|
+
${eI}
|
|
134
|
+
|
|
135
|
+
{{grade_instruction}}
|
|
136
|
+
{{provider_hints}}`,eL=`你是一位资深的K12教育题目生成专家,具备跨学科的题目创作能力。你的核心任务是**根据以下原题和知识点,举一反三生成高质量教学题目**,帮助学生巩固知识并拓展解题思路。
|
|
137
|
+
### 角色定义
|
|
138
|
+
1. **学科全能专家**
|
|
139
|
+
- 精通K12阶段所有学科(数学/语文/英语/物理/化学/生物/历史/地理/政治)
|
|
140
|
+
- 熟悉各年级课程标准与知识点分布
|
|
141
|
+
- 能准确识别题目考察的核心能力点(计算/推理/分析/应用/创新)
|
|
142
|
+
2. **题目变异大师**
|
|
143
|
+
- 掌握12种变式技法:条件替换/情境迁移/问题转化/数据重构/图形变形/角色反转/跨学科融合/难度阶梯/开放拓展/陷阱设计/逆向思维/生活应用
|
|
144
|
+
- 确保变式题目保持原题核心考点,改变题目表现形式
|
|
145
|
+
3. **学情分析师**
|
|
146
|
+
- 预判学生易错点(认知盲区/概念混淆/计算失误/审题偏差)
|
|
147
|
+
- 在变式题目中针对性强化易错点训练
|
|
148
|
+
### 执行流程
|
|
149
|
+
1. **接收任务**
|
|
150
|
+
原题: "{{original_question}}"
|
|
151
|
+
{{language_instruction}}
|
|
152
|
+
DIFFICULTY LEVEL: {{difficulty_level}}
|
|
153
|
+
{{difficulty_instruction}}
|
|
154
|
+
Knowledge Points: {{knowledge_points}}
|
|
155
|
+
2. **解构分析**
|
|
156
|
+
- 提取核心考点与能力要求
|
|
157
|
+
- 分析题目陷阱与解题路径
|
|
158
|
+
3. **质量管控**
|
|
159
|
+
- 确保每道题:
|
|
160
|
+
✓ 覆盖相同核心知识点
|
|
161
|
+
✓ 保持解题逻辑一致性
|
|
162
|
+
✓ 答案唯一且可验证
|
|
163
|
+
✓ 无知识性错误
|
|
164
|
+
### 输出规范
|
|
165
|
+
你的响应输出**必须严格遵循以下自定义标签格式**。**严禁**使用 JSON 或 Markdown 代码块。**严禁**返回 \`\`\`json ... \`\`\`。
|
|
166
|
+
|
|
167
|
+
请严格按照以下结构输出内容(不要包含任何其他文字):
|
|
168
|
+
|
|
169
|
+
<question_text>
|
|
170
|
+
在此处填写新生成的填空题或解答题。不要包含题号、分值或选择题选项。
|
|
171
|
+
</question_text>
|
|
172
|
+
|
|
173
|
+
<answer_text>
|
|
174
|
+
在此处填写新题目的正确答案。
|
|
175
|
+
</answer_text>
|
|
176
|
+
|
|
177
|
+
<analysis>
|
|
178
|
+
在此处填写新题目的详细解析。
|
|
179
|
+
* 必须使用简体中文。
|
|
180
|
+
* **直接使用标准的 LaTeX 符号**(如 $\frac{1}{2}$),**不要**进行 JSON 转义。
|
|
181
|
+
</analysis>
|
|
182
|
+
|
|
183
|
+
{{figure_instruction}}
|
|
184
|
+
|
|
185
|
+
###关键格式与内容约束 (CRITICAL RULES) !!!
|
|
186
|
+
1. **纯文本**:内容作为纯文本处理,**不要转义反斜杠**。
|
|
187
|
+
2. **LaTeX 规范**:
|
|
188
|
+
${eI}
|
|
189
|
+
|
|
190
|
+
{{grade_instruction}}
|
|
191
|
+
{{provider_hints}}`;var eE=e.i(67240);let ez=(0,m.default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);function eA({name:e,description:t}){return(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start gap-1 sm:gap-2 text-xs py-1",children:[(0,s.jsx)("code",{className:"bg-muted px-1.5 py-0.5 rounded font-mono text-primary shrink-0 w-fit",children:`{{${e}}}`}),(0,s.jsx)("span",{className:"text-muted-foreground",children:t})]})}function eD({config:e,onUpdate:a}){let{language:r,t:i}=(0,t.useLanguage)(),[n,l]=(0,g.useState)(""),[o,c]=(0,g.useState)("");(0,g.useEffect)(()=>{l(e.prompts?.analyze||eT),c(e.prompts?.similar||eL)},[e.prompts]);let d=async e=>{if(!await (0,ef.confirmDialog)(i.settings?.prompts?.resetConfirm||"Are you sure you want to reset to default?",{destructive:!0}))return;let s="analyze"===e?eT:eL;"analyze"===e?(l(s),a("analyze",s)):(c(s),a("similar",s))},m=(e,s)=>{"analyze"===e?(l(s),a("analyze",s)):(c(s),a("similar",s))},u=()=>(0,s.jsxs)("div",{className:"bg-amber-50 border border-amber-200 rounded-md p-3 flex items-start gap-3 text-amber-900 text-sm mb-4",children:[(0,s.jsx)(C,{className:"h-5 w-5 shrink-0 text-amber-600"}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("p",{className:"font-medium",children:i.settings?.prompts?.caution||"Modify with Caution"}),(0,s.jsx)("p",{className:"text-amber-800/90 text-xs",children:i.settings?.prompts?.warning||"Variables in {{brackets}} are used to inject dynamic content. Please preserve these variables, otherwise the AI providing may fail to get question context or return invalid formats."})]})]});return(0,s.jsx)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:(0,s.jsxs)(N.Tabs,{defaultValue:"analyze",className:"w-full",children:[(0,s.jsxs)(N.TabsList,{className:"grid w-full grid-cols-2",children:[(0,s.jsx)(N.TabsTrigger,{value:"analyze",children:i.settings?.prompts?.analysisTab||"Analysis Prompt"}),(0,s.jsx)(N.TabsTrigger,{value:"similar",children:i.settings?.prompts?.similarTab||"Similar Question Prompt"})]}),(0,s.jsx)(N.TabsContent,{value:"analyze",className:"space-y-4 py-4",children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(y.Label,{className:"text-base font-semibold",children:i.settings?.prompts?.customAnalysis||"Custom Analysis Template"}),(0,s.jsxs)(f.Button,{variant:"outline",size:"sm",onClick:()=>d("analyze"),children:[(0,s.jsx)(eE.RotateCcw,{className:"w-4 h-4 mr-2"}),i.settings?.prompts?.reset||"Reset Default"]})]}),(0,s.jsx)(u,{}),(0,s.jsxs)("div",{className:"space-y-2 border rounded-md p-3 bg-background",children:[(0,s.jsxs)("h4",{className:"text-xs font-medium flex items-center gap-1.5 mb-2",children:[(0,s.jsx)(ez,{className:"h-3.5 w-3.5"}),i.settings?.prompts?.variables||"Available Variables"]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(eA,{name:"language_instruction",description:i.settings?.prompts?.vars?.languageInstruction||"Injects instructions based on target language (e.g., keep English questions in English but analysis in Chinese)."}),(0,s.jsx)(eA,{name:"knowledge_points_list",description:i.settings?.prompts?.vars?.knowledgePointsList||"Injects the standard list of knowledge point tags for the specific subject."}),(0,s.jsx)(eA,{name:"provider_hints",description:i.settings?.prompts?.vars?.providerHints||"System-injected hints (e.g., enforcing JSON format)."})]})]}),(0,s.jsx)(ek.Textarea,{value:n,onChange:e=>m("analyze",e.target.value),className:"font-mono text-xs min-h-[400px]",placeholder:eT})]})}),(0,s.jsx)(N.TabsContent,{value:"similar",className:"space-y-4 py-4",children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(y.Label,{className:"text-base font-semibold",children:i.settings?.prompts?.customSimilar||"Custom Similar Question Template"}),(0,s.jsxs)(f.Button,{variant:"outline",size:"sm",onClick:()=>d("similar"),children:[(0,s.jsx)(eE.RotateCcw,{className:"w-4 h-4 mr-2"}),i.settings?.prompts?.reset||"Reset Default"]})]}),(0,s.jsx)(u,{}),(0,s.jsxs)("div",{className:"space-y-2 border rounded-md p-3 bg-background",children:[(0,s.jsxs)("h4",{className:"text-xs font-medium flex items-center gap-1.5 mb-2",children:[(0,s.jsx)(ez,{className:"h-3.5 w-3.5"}),i.settings?.prompts?.variables||"Available Variables"]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(eA,{name:"difficulty_level",description:i.settings?.prompts?.vars?.difficultyLevel||"Target difficulty level."}),(0,s.jsx)(eA,{name:"difficulty_instruction",description:i.settings?.prompts?.vars?.difficultyInstruction||"Specific writing instructions for the target difficulty."}),(0,s.jsx)(eA,{name:"original_question",description:i.settings?.prompts?.vars?.originalQuestion||"The full text of the original question."}),(0,s.jsx)(eA,{name:"knowledge_points",description:i.settings?.prompts?.vars?.knowledgePoints||"List of knowledge points to test."}),(0,s.jsx)(eA,{name:"language_instruction",description:i.settings?.prompts?.vars?.languageInstructionShort||"Language formatting instructions."})]})]}),(0,s.jsx)(ek.Textarea,{value:o,onChange:e=>m("similar",e.target.value),className:"font-mono text-xs min-h-[400px]",placeholder:eL})]})})]})})}function eM({field:e,label:a,description:r}){let{t:i}=(0,t.useLanguage)(),[n,l]=(0,g.useState)(!1),[o,c]=(0,g.useState)(!1),[d,m]=(0,g.useState)(!1),[u,p]=(0,g.useState)(null),x=`preference-${e}`;(0,g.useEffect)(()=>{eg.apiClient.get("/api/user").then(s=>l(!!s[e])).catch(()=>void 0).finally(()=>c(!0))},[e]);let h=async s=>{l(s),m(!0);try{await eg.apiClient.patch("/api/user",{[e]:s}),p(i.importFlow.preferenceSaved)}catch(t){l(!s),p(i.importFlow.preferenceSaveFailed),ev.frontendLogger.error("[Settings]","Failed to save user preference",{field:e,error:t instanceof Error?t.message:String(t)})}finally{m(!1)}};return(0,s.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,s.jsx)(y.Label,{htmlFor:x,children:a}),(0,s.jsx)(el,{id:x,checked:n,onCheckedChange:h,disabled:!o||d})]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:r}),u&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:u})]})}function eR(){let{t:e}=(0,t.useLanguage)();return(0,s.jsx)(eM,{field:"confirmBeforeImport",label:e.importFlow.confirmBeforeImport,description:e.importFlow.confirmBeforeImportDesc})}function eP(){let{t:e}=(0,t.useLanguage)();return(0,s.jsx)(eM,{field:"enableGeogebra",label:e.importFlow.enableGeogebra,description:e.importFlow.enableGeogebraDesc})}function e_(){let{t:e}=(0,t.useLanguage)();return(0,s.jsx)(eM,{field:"enableSvgAnimation",label:e.importFlow.enableSvgAnimation,description:e.importFlow.enableSvgAnimationDesc})}function eU({value:e,onChange:a}){let{t:r}=(0,t.useLanguage)(),[i,n]=(0,g.useState)(!1),l=(s,t)=>a({...e,[s]:t});return(0,s.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:"API Key"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(v.Input,{type:i?"text":"password",value:e?.apiKey||"",onChange:e=>l("apiKey",e.target.value),placeholder:"sk-ant-...",className:"pr-10"}),(0,s.jsx)(f.Button,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>n(!i),"aria-label":i?"Hide API Key":"Show API Key",children:i?(0,s.jsx)(T.EyeOff,{className:"h-4 w-4 text-muted-foreground"}):(0,s.jsx)(I.Eye,{className:"h-4 w-4 text-muted-foreground"})})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:"Base URL (Optional)"}),(0,s.jsx)(v.Input,{value:e?.baseUrl||"",onChange:e=>l("baseUrl",e.target.value),placeholder:"https://api.anthropic.com"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:r.settings?.ai?.anthropicBaseUrlHint})]}),(0,s.jsx)(ew,{provider:"anthropic",apiKey:e?.apiKey,baseUrl:e?.baseUrl,currentModel:e?.model,onModelChange:e=>l("model",e)})]})}function eK({provider:e,value:a,onChange:r}){let{t:i}=(0,t.useLanguage)(),[n,l]=(0,g.useState)(!1),o=ey[e],c=(e,s)=>r({...a,[e]:s});return(0,s.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:"API Key"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(v.Input,{type:n?"text":"password",value:a?.apiKey||"",onChange:e=>c("apiKey",e.target.value),placeholder:"sk-...",className:"pr-10"}),(0,s.jsx)(f.Button,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>l(!n),"aria-label":n?"Hide API Key":"Show API Key",children:n?(0,s.jsx)(T.EyeOff,{className:"h-4 w-4 text-muted-foreground"}):(0,s.jsx)(I.Eye,{className:"h-4 w-4 text-muted-foreground"})})]}),(0,s.jsxs)("p",{className:"text-xs text-muted-foreground",children:[i.settings?.ai?.vendorApiKeyHint||"Get an API key from the console:"," ",(0,s.jsx)("a",{href:o.consoleUrl,target:"_blank",rel:"noopener noreferrer",className:"underline break-all",children:o.consoleUrl})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:"Base URL (Optional)"}),(0,s.jsx)(v.Input,{value:a?.baseUrl||"",onChange:e=>c("baseUrl",e.target.value),placeholder:o.baseUrl}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:i.settings?.ai?.vendorBaseUrlHint})]}),(0,s.jsx)(ew,{provider:e,apiKey:a?.apiKey,baseUrl:a?.baseUrl,currentModel:a?.model||o.model,onModelChange:e=>c("model",e)})]})}var eB=e.i(7364);function eF({value:e,onChange:a,disabled:r}){let{t:i}=(0,t.useLanguage)();return(0,s.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,s.jsx)(y.Label,{htmlFor:"app-time-zone",children:i.settings.general.timeZoneLabel}),(0,s.jsx)(v.Input,{id:"app-time-zone",value:e,onChange:e=>a(e.target.value),disabled:r,list:"app-time-zones",placeholder:"Asia/Shanghai"}),(0,s.jsx)("datalist",{id:"app-time-zones",children:["Asia/Shanghai","Asia/Hong_Kong","Asia/Tokyo","Asia/Singapore","Europe/London","America/New_York","America/Los_Angeles","UTC"].map(e=>(0,s.jsx)("option",{value:e},e))}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:i.settings.general.timeZoneDesc})]})}let eO=(0,m.default)("message-square-text",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]]),e$=(0,m.default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]),eq=(0,m.default)("github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]),eV=(0,m.default)("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);function eH(){let{timeZone:e,setTimeZone:i}=(0,r.useTimeZone)(),{data:n}=(0,a.useSession)(),c=n?.user?.role==="admin",{t:d,language:m,setLanguage:u}=(0,t.useLanguage)(),[p,h]=(0,g.useState)(!1),B=(0,g.useRef)(null),[F,O]=(0,g.useState)(!1),[$,q]=(0,g.useState)(!1),[V,H]=(0,g.useState)(!1),[X,W]=(0,g.useState)(!1),[Y,Z]=(0,g.useState)(!1),[G,J]=(0,g.useState)(!1),[Q,ee]=(0,g.useState)(""),[es,et]=(0,g.useState)(!1),[ea,er]=(0,g.useState)({aiProvider:"minimax"}),[ei,en]=(0,g.useState)(void 0),[el,eo]=(0,g.useState)(!1),[ec,ed]=(0,g.useState)(null),[em,eu]=(0,g.useState)({name:"",email:"",educationStage:"",enrollmentYear:"",password:""}),[ep,ex]=(0,g.useState)(""),[eh,ek]=(0,g.useState)(!1),[eS,eC]=(0,g.useState)(!1),[eI,eT]=(0,g.useState)(!1),[eL,eE]=(0,g.useState)(!1),[eA,eM]=(0,g.useState)(!1),[eH,eX]=(0,g.useState)(!1),[eW,eY]=(0,g.useState)(null),[eZ,eG]=(0,g.useState)(""),eJ=(0,l.useRouter)();(0,g.useEffect)(()=>{p&&(eQ(),e0()),fetch("/api/version").then(e=>e.json()).then(e=>ee(e.version)).catch(()=>{})},[p]);let eQ=async()=>{J(!0);try{let e=await eg.apiClient.get("/api/settings");er(e)}catch(e){ev.frontendLogger.error("[SettingsDialog]","Failed to fetch settings",{error:e instanceof Error?e.message:String(e)})}finally{J(!1)}},e0=async()=>{ek(!0);try{let e=await eg.apiClient.get("/api/user");eu({name:e.name||"",email:e.email||"",educationStage:e.educationStage||"",enrollmentYear:e.enrollmentYear||"",password:""})}catch(e){ev.frontendLogger.error("[SettingsDialog]","Failed to fetch profile",{error:e instanceof Error?e.message:String(e)})}finally{ek(!1)}},e1=async()=>{if(!(0,K.isValidTimeZone)(ea.timeZone??K.DEFAULT_TIME_ZONE))return void ef.toast.error(d.settings.general.invalidTimeZone);let e=(()=>{if("openai"!==ea.aiProvider)return null;for(let e of ea.openai?.instances||[]){if(!e.name?.trim())return d.settings?.ai?.validationNameRequired||"实例名称不能为空";if(!e.apiKey?.trim())return d.settings?.ai?.validationApiKeyRequired||"API Key 不能为空";if(!e.baseUrl?.trim())return d.settings?.ai?.validationBaseUrlRequired||"Base URL 不能为空";if(!e.model?.trim())return d.settings?.ai?.validationModelRequired||"模型名称不能为空"}return null})();if(e)return void ef.toast.error(e);let s="azure"!==ea.aiProvider?null:ea.azure?.endpoint?.trim()?ea.azure?.deploymentName?.trim()?ea.azure?.apiKey?.trim()?null:d.settings?.ai?.validationApiKeyRequired||"API Key is required":d.settings?.ai?.validationAzureDeploymentRequired||"Deployment Name is required":d.settings?.ai?.validationAzureEndpointRequired||"Azure Endpoint is required";if(s)return void ef.toast.error(s);Z(!0);try{let e=await eg.apiClient.post("/api/settings",ea);er(e),i(e.timeZone||K.DEFAULT_TIME_ZONE),ef.toast.success(d.settings?.messages?.saved||"Settings saved"),B.current?.scrollTo({top:0,behavior:"smooth"})}catch(e){ev.frontendLogger.error("[SettingsDialog]","Failed to save settings",{error:e instanceof Error?e.message:String(e)}),ef.toast.error(d.settings?.messages?.saveFailed||"Failed to save")}finally{Z(!1)}},e2=async()=>{eC(!0);try{if(em.password&&em.password!==ep){ef.toast.error(d.settings?.messages?.passwordMismatch||"Passwords do not match"),eC(!1);return}let e={name:em.name,email:em.email,educationStage:em.educationStage};em.enrollmentYear&&(e.enrollmentYear=parseInt(em.enrollmentYear.toString())),em.password&&(e.password=em.password),await eg.apiClient.patch("/api/user",e),ef.toast.success(d.settings?.messages?.profileUpdated||"Profile updated"),eu(e=>({...e,password:""})),ex(""),eT(!1),eE(!1),window.location.reload()}catch(s){ev.frontendLogger.error("[SettingsDialog]","Failed to update profile",{error:s?.data?.message||s?.message||String(s)});let e=s.data?.message||d.settings?.messages?.updateFailed||"Update failed";ef.toast.error(e)}finally{eC(!1)}},e4=async()=>{if(await (0,ef.confirmDialog)(d.settings?.clearDataConfirm||"Are you sure?",{destructive:!0})){O(!0);try{await eg.apiClient.delete("/api/stats/practice/clear"),ef.toast.success(d.settings?.clearSuccess||"Success"),h(!1),window.location.reload()}catch(e){ev.frontendLogger.error("[SettingsDialog]","Failed to clear practice data",{error:e instanceof Error?e.message:String(e)}),ef.toast.error(d.settings?.clearError||"Failed")}finally{O(!1)}}},e3=async()=>{if(await (0,ef.confirmDialog)(d.settings?.clearErrorDataConfirm||"Are you sure?",{destructive:!0})){q(!0);try{await eg.apiClient.delete("/api/error-items/clear"),ef.toast.success(d.settings?.clearSuccess||"Success"),h(!1),window.location.reload()}catch(e){ev.frontendLogger.error("[SettingsDialog]","Failed to clear error data",{error:e instanceof Error?e.message:String(e)}),ef.toast.error(d.settings?.clearError||"Failed")}finally{q(!1)}}},e5=async()=>{if(!await (0,ef.confirmDialog)(d.settings?.systemResetConfirm||"WARNING: Deleting ALL data. Undoing is impossible. Are you sure?",{destructive:!0}))return;let e=prompt(d.settings?.systemResetPrompt||"Type 'RESET' to confirm system initialization:","");if("RESET"!==e){null!==e&&ef.toast.error(d.common?.error||"Confirmation failed");return}H(!0);try{await eg.apiClient.post("/api/admin/system-reset",{}),ef.toast.success(d.settings?.clearSuccess||"Success - System Reset Complete"),h(!1),window.location.reload()}catch(e){ev.frontendLogger.error("[SettingsDialog]","System reset failed",{error:e instanceof Error?e.message:String(e)}),ef.toast.error(d.settings?.clearError||"Failed to reset system")}finally{H(!1)}},e6=async()=>{eM(!0);try{let e=await fetch("/api/export");if(!e.ok)throw Error("Export failed");let s=await e.blob(),t=window.URL.createObjectURL(s),a=document.createElement("a");a.href=t;let r=e.headers.get("Content-Disposition"),i=r?.match(/filename="(.+)"/);a.download=i?i[1]:"wrong-notebook-export.json",document.body.appendChild(a),a.click(),document.body.removeChild(a),window.URL.revokeObjectURL(t),ef.toast.success(d.settings?.exportSuccess||"Export successful")}catch(e){ev.frontendLogger.error("[SettingsDialog]","Export failed",{error:e instanceof Error?e.message:String(e)}),ef.toast.error(d.settings?.exportFailed||"Export failed")}finally{eM(!1)}},e8=async()=>{if(await (0,ef.confirmDialog)(d.settings?.exportAllConfirm||"Export all users' data? This may take a while.")){eM(!0);try{let e=await fetch("/api/export?all=true");if(!e.ok){let s=await e.json();throw Error(s.message||"Export failed")}let s=await e.blob(),t=window.URL.createObjectURL(s),a=document.createElement("a");a.href=t;let r=e.headers.get("Content-Disposition"),i=r?.match(/filename="(.+)"/);a.download=i?i[1]:"wrong-notebook-export-all.json",document.body.appendChild(a),a.click(),document.body.removeChild(a),window.URL.revokeObjectURL(t),ef.toast.success(d.settings?.exportSuccess||"Export successful")}catch(e){ev.frontendLogger.error("[SettingsDialog]","Export all failed",{error:e instanceof Error?e.message:String(e)}),ef.toast.error(d.settings?.exportFailed||"Export failed")}finally{eM(!1)}}},e7=async()=>{if(eW&&await (0,ef.confirmDialog)(d.settings?.importConfirm||"Are you sure you want to import?")){eX(!0);try{let e=await eW.text(),s=JSON.parse(e),t=(await eg.apiClient.post("/api/import",s)).stats;ef.toast.success((d.settings?.importResultDesc||"Imported {subjects} notebooks, {tags} tags, {items} error items, {schedules} review schedules, {records} practice records.").replace("{subjects}",String(t.subjectsCreated)).replace("{tags}",String(t.tagsCreated)).replace("{items}",String(t.errorItemsCreated)).replace("{schedules}",String(t.reviewSchedulesCreated)).replace("{records}",String(t.practiceRecordsCreated)).replace("{duplicates}",String(t.duplicateErrorItems??0))),eY(null),eG(""),window.location.reload()}catch(e){ev.frontendLogger.error("[SettingsDialog]","Import failed",{error:e instanceof Error?e.message:String(e)}),ef.toast.error(d.settings?.importFailed||"Import failed")}finally{eX(!1)}}},e9=async()=>{if(eW&&await (0,ef.confirmDialog)(d.settings?.importAllConfirm||"Import all users' data? This will restore data for all users from the export file.")){eX(!0);try{let e=await eW.text(),s=JSON.parse(e),t=await fetch("/api/import?all=true",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}),a=await t.json();if(a.success){let e=a.stats;ef.toast.success((d.settings?.importResultDesc||"Imported {subjects} notebooks, {tags} tags, {items} error items, {schedules} review schedules, {records} practice records.").replace("{subjects}",String(e.subjectsCreated)).replace("{tags}",String(e.tagsCreated)).replace("{items}",String(e.errorItemsCreated)).replace("{schedules}",String(e.reviewSchedulesCreated)).replace("{records}",String(e.practiceRecordsCreated)).replace("{duplicates}",String(e.duplicateErrorItems??0))),eY(null),eG(""),window.location.reload()}else throw Error(a.message||"Import failed")}catch(e){ev.frontendLogger.error("[SettingsDialog]","Import all failed",{error:e instanceof Error?e.message:String(e)}),ef.toast.error(d.settings?.importFailed||"Import failed")}finally{eX(!1)}}},se=async()=>{if(await (0,ef.confirmDialog)(d.settings?.migrateTagsConfirm||"This will reset system tags. Confirm?",{destructive:!0})){W(!0);try{let e=await eg.apiClient.post("/api/admin/migrate-tags",{});ef.toast.success(`${d.settings?.clearSuccess||"Success"}: ${e.count||0} tags migrated.`)}catch(e){ev.frontendLogger.error("[SettingsDialog]","Tag migration failed",{error:e instanceof Error?e.message:String(e)}),ef.toast.error(d.settings?.clearError||"Failed to migrate tags")}finally{W(!1)}}},ss=(e,s,t)=>{"gemini"===e&&er(e=>({...e,gemini:{...e.gemini,[s]:t}}))},st=()=>{let e=ea.openai?.instances||[],s=ei||ea.openai?.activeInstanceId;return e.find(e=>e.id===s)},sa=(e,s)=>{let t=ea.openai?.instances||[],a=ei||ea.openai?.activeInstanceId,r=t.map(t=>t.id===a?{...t,[e]:s}:t);er(e=>({...e,openai:{...e.openai,instances:r}}))};(0,g.useEffect)(()=>{ea.openai?.activeInstanceId&&!ei&&en(ea.openai.activeInstanceId)},[ea.openai?.activeInstanceId,ei]);let sr=async()=>{eo(!0),ed(null);try{let e;if("openai"===ea.aiProvider){let s=st();if(!s?.apiKey){ed({success:!1,textSupport:!1,visionSupport:!1,textError:d.settings?.ai?.validationApiKeyRequired||"API Key is required"}),eo(!1);return}e={provider:"openai",apiKey:s.apiKey,baseUrl:s.baseUrl,model:s.model,language:m}}else if("gemini"===ea.aiProvider){if(!ea.gemini?.apiKey){ed({success:!1,textSupport:!1,visionSupport:!1,textError:d.settings?.ai?.validationApiKeyRequired||"API Key is required"}),eo(!1);return}e={provider:"gemini",apiKey:ea.gemini.apiKey,baseUrl:ea.gemini.baseUrl,model:ea.gemini.model,language:m}}else if("anthropic"===ea.aiProvider){if(!ea.anthropic?.apiKey){ed({success:!1,textSupport:!1,visionSupport:!1,textError:d.settings?.ai?.validationApiKeyRequired||"API Key is required"}),eo(!1);return}e={provider:"anthropic",apiKey:ea.anthropic.apiKey,baseUrl:ea.anthropic.baseUrl,model:ea.anthropic.model,language:m}}else if(eN(ea.aiProvider)){let s=ea[ea.aiProvider];if(!s?.apiKey){ed({success:!1,textSupport:!1,visionSupport:!1,textError:d.settings?.ai?.validationApiKeyRequired||"API Key is required"}),eo(!1);return}e={provider:ea.aiProvider,apiKey:s.apiKey,baseUrl:s.baseUrl,model:s.model,language:m}}else{if("azure"!==ea.aiProvider)return void eo(!1);if(!ea.azure?.apiKey||!ea.azure?.endpoint||!ea.azure?.deploymentName){ed({success:!1,textSupport:!1,visionSupport:!1,textError:d.settings?.ai?.validationAzureEndpointRequired||"Azure config is incomplete"}),eo(!1);return}e={provider:"azure",apiKey:ea.azure.apiKey,endpoint:ea.azure.endpoint,deploymentName:ea.azure.deploymentName,apiVersion:ea.azure.apiVersion,model:ea.azure.model,language:m}}let s=await eg.apiClient.post("/api/ai/test",e);ed(s)}catch(e){ev.frontendLogger.error("[SettingsDialog]","AI connection test failed",{error:e instanceof Error?e.message:String(e)}),ed({success:!1,textSupport:!1,visionSupport:!1,textError:e instanceof Error?e.message:String(e)})}finally{eo(!1)}};return(0,s.jsxs)(j.Dialog,{open:p,onOpenChange:h,children:[(0,s.jsx)(j.DialogTrigger,{asChild:!0,children:(0,s.jsxs)(f.Button,{variant:"ghost",size:"icon",className:"rounded-full",children:[(0,s.jsx)(w,{className:"h-5 w-5"}),(0,s.jsx)("span",{className:"sr-only",children:d.settings?.title||"Settings"})]})}),(0,s.jsxs)(j.DialogContent,{ref:B,className:"w-[calc(100vw-2rem)] sm:max-w-[900px] max-h-[85vh] overflow-y-auto",children:[(0,s.jsxs)(j.DialogHeader,{children:[(0,s.jsx)(j.DialogTitle,{children:d.settings?.title||"Settings"}),(0,s.jsx)(j.DialogDescription,{children:d.settings?.desc||"Manage your preferences and data."})]}),(0,s.jsxs)(N.Tabs,{defaultValue:"general",className:"w-full",children:[(0,s.jsxs)(N.TabsList,{className:`grid w-full grid-cols-4 ${n?.user?.role==="admin"?"sm:grid-cols-7":"sm:grid-cols-4"} gap-1 h-auto`,children:[(0,s.jsxs)(N.TabsTrigger,{value:"general",className:"px-2 sm:px-3",children:[(0,s.jsx)(L.Languages,{className:"h-4 w-4 sm:mr-2"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:d.settings?.tabs?.general||"General"})]}),(0,s.jsxs)(N.TabsTrigger,{value:"account",className:"px-2 sm:px-3",children:[(0,s.jsx)(E.User,{className:"h-4 w-4 sm:mr-2"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:d.settings?.tabs?.account||"Account"})]}),n?.user?.role==="admin"&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(N.TabsTrigger,{value:"ai",className:"px-2 sm:px-3",children:[(0,s.jsx)(z,{className:"h-4 w-4 sm:mr-2"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:d.settings?.tabs?.ai||"AI Provider"})]}),(0,s.jsxs)(N.TabsTrigger,{value:"prompts",className:"px-2 sm:px-3",children:[(0,s.jsx)(eO,{className:"h-4 w-4 sm:mr-2"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:d.settings?.tabs?.prompts||"Prompts"})]}),(0,s.jsxs)(N.TabsTrigger,{value:"admin",className:"px-2 sm:px-3",children:[(0,s.jsx)(x,{className:"h-4 w-4 sm:mr-2"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:d.settings?.tabs?.admin||"User Management"})]})]}),(0,s.jsxs)(N.TabsTrigger,{value:"danger",className:"px-2 sm:px-3",children:[(0,s.jsx)(C,{className:"h-4 w-4 sm:mr-2"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:d.settings?.tabs?.danger||"Danger"})]}),(0,s.jsxs)(N.TabsTrigger,{value:"about",className:"px-2 sm:px-3",children:[(0,s.jsx)(ez,{className:"h-4 w-4 sm:mr-2"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:d.settings?.tabs?.about||"About"})]})]}),(0,s.jsxs)(N.TabsContent,{value:"general",className:"space-y-4 py-4",children:[(0,s.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:d.settings?.language||"Language"}),(0,s.jsxs)(b.Select,{value:m,onValueChange:e=>u(e),children:[(0,s.jsx)(b.SelectTrigger,{children:(0,s.jsx)(b.SelectValue,{})}),(0,s.jsxs)(b.SelectContent,{children:[(0,s.jsx)(b.SelectItem,{value:"zh",children:"中文 (Chinese)"}),(0,s.jsx)(b.SelectItem,{value:"en",children:"English"})]})]})]}),(0,s.jsx)(eF,{value:ea.timeZone??e,onChange:e=>er(s=>({...s,timeZone:e})),disabled:!c||G||Y}),c&&(0,s.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,s.jsx)(y.Label,{children:d.settings?.general?.timeoutLabel||"AI Analysis Timeout (Seconds)"}),(0,s.jsx)(v.Input,{type:"number",value:ea.timeouts?.analyze?ea.timeouts.analyze/1e3:"",onChange:e=>{let s=""===e.target.value?0:parseInt(e.target.value);er(e=>({...e,timeouts:{...e.timeouts,analyze:isNaN(s)?0:1e3*s}}))},onBlur:()=>{let e=(ea.timeouts?.analyze||0)/1e3,s=e;s<120&&(s=120),s>600&&(s=600),s!==e&&er(e=>({...e,timeouts:{...e.timeouts,analyze:1e3*s}}))},min:120,max:600}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:d.settings?.general?.timeoutDesc||"Increase this value if you experience frequent timeouts during AI analysis."})]}),(0,s.jsx)(eR,{}),(0,s.jsx)(e_,{}),(0,s.jsx)(eP,{}),(0,s.jsx)(eB.DuplicateThresholdSetting,{})]}),c&&(0,s.jsxs)(f.Button,{onClick:e1,disabled:Y,className:"w-full",children:[Y&&(0,s.jsx)(S.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),d.settings?.save||"Save Settings"]})]}),(0,s.jsx)(N.TabsContent,{value:"account",className:"space-y-4 py-4",children:eh?(0,s.jsx)("div",{className:"flex justify-center py-8",children:(0,s.jsx)(S.Loader2,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,s.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:d.auth?.name||"Name"}),(0,s.jsx)(v.Input,{value:em.name||"",onChange:e=>eu({...em,name:e.target.value})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:d.auth?.email||"Email"}),(0,s.jsx)(v.Input,{value:em.email||"",onChange:e=>eu({...em,email:e.target.value}),type:"email"})]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:d.auth?.educationStage||"Education Stage"}),(0,s.jsxs)(b.Select,{value:em.educationStage||"",onValueChange:e=>eu({...em,educationStage:e}),children:[(0,s.jsx)(b.SelectTrigger,{children:(0,s.jsx)(b.SelectValue,{placeholder:d.auth?.selectStage||"Select Stage"})}),(0,s.jsxs)(b.SelectContent,{children:[(0,s.jsx)(b.SelectItem,{value:"primary",children:d.auth?.primary||"Primary School"}),(0,s.jsx)(b.SelectItem,{value:"junior_high",children:d.auth?.juniorHigh||"Junior High"}),(0,s.jsx)(b.SelectItem,{value:"senior_high",children:d.auth?.seniorHigh||"Senior High"}),(0,s.jsx)(b.SelectItem,{value:"university",children:d.auth?.university||"University"})]})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:d.auth?.enrollmentYear||"Enrollment Year"}),(0,s.jsx)(v.Input,{type:"number",value:em.enrollmentYear||"",onChange:e=>eu({...em,enrollmentYear:e.target.value}),placeholder:"YYYY"})]})]}),(0,s.jsxs)("div",{className:"space-y-3 pt-2 border-t",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:d.settings?.account?.changePassword||"Change Password (Leave empty to keep)"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(v.Input,{type:eI?"text":"password",value:em.password,onChange:e=>eu({...em,password:e.target.value}),placeholder:"******",minLength:6,className:"pr-10"}),(0,s.jsx)(f.Button,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>eT(!eI),tabIndex:-1,children:eI?(0,s.jsx)(T.EyeOff,{className:"h-4 w-4 text-muted-foreground"}):(0,s.jsx)(I.Eye,{className:"h-4 w-4 text-muted-foreground"})})]})]}),em.password&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:d.auth?.confirmPassword||"Confirm Password"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(v.Input,{type:eL?"text":"password",value:ep,onChange:e=>ex(e.target.value),placeholder:"******",minLength:6,className:"pr-10"}),(0,s.jsx)(f.Button,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>eE(!eL),tabIndex:-1,children:eL?(0,s.jsx)(T.EyeOff,{className:"h-4 w-4 text-muted-foreground"}):(0,s.jsx)(I.Eye,{className:"h-4 w-4 text-muted-foreground"})})]})]})]}),(0,s.jsxs)(f.Button,{onClick:e2,disabled:eS,className:"w-full",children:[eS&&(0,s.jsx)(S.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),d.settings?.account?.update||"Update Profile"]})]})}),(0,s.jsx)(N.TabsContent,{value:"ai",className:"space-y-4 py-4",children:G?(0,s.jsx)("div",{className:"flex justify-center py-4",children:(0,s.jsx)(S.Loader2,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):(0,s.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:d.settings?.tabs?.ai||"AI Provider"}),(0,s.jsxs)(b.Select,{value:ea.aiProvider,onValueChange:e=>er(s=>({...s,aiProvider:e})),children:[(0,s.jsx)(b.SelectTrigger,{children:(0,s.jsx)(b.SelectValue,{})}),(0,s.jsxs)(b.SelectContent,{children:[eb.map(e=>(0,s.jsx)(b.SelectItem,{value:e,children:ey[e].name},e)),(0,s.jsx)(b.SelectItem,{value:"anthropic",children:"Anthropic / Compatible"}),(0,s.jsx)(b.SelectItem,{value:"azure",children:"Azure OpenAI"}),(0,s.jsx)(b.SelectItem,{value:"openai",children:"OpenAI / Compatible"}),(0,s.jsx)(b.SelectItem,{value:"gemini",children:"Google Gemini"})]})]})]}),"openai"===ea.aiProvider&&(0,s.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)(y.Label,{children:d.settings?.ai?.instances||"Instance"}),(0,s.jsxs)(f.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>{let e=ea.openai?.instances||[];if(e.length>=10)return;let s={id:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let s=16*Math.random()|0;return("x"===e?s:3&s|8).toString(16)}),name:`Instance ${e.length+1}`,apiKey:"",baseUrl:"https://api.openai.com/v1",model:"gpt-6.1-sol"};er(e=>({...e,openai:{instances:[...e.openai?.instances||[],s],activeInstanceId:s.id}})),en(s.id)},disabled:(ea.openai?.instances?.length||0)>=10,className:"h-7 px-2 text-xs",children:[(0,s.jsx)(D.Plus,{className:"h-3 w-3 mr-1"}),d.settings?.ai?.addInstance||"Add"]})]}),(ea.openai?.instances?.length||0)>0?(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)(b.Select,{value:ei||ea.openai?.activeInstanceId||"",onValueChange:e=>{en(e),er(s=>({...s,openai:{...s.openai,activeInstanceId:e}}))},children:[(0,s.jsx)(b.SelectTrigger,{className:"flex-1",children:(0,s.jsx)(b.SelectValue,{placeholder:d.settings?.ai?.selectInstance||"Select Instance"})}),(0,s.jsx)(b.SelectContent,{children:(ea.openai?.instances||[]).map(e=>(0,s.jsx)(b.SelectItem,{value:e.id,children:e.name},e.id))})]}),(ea.openai?.instances?.length||0)>1&&(0,s.jsx)(f.Button,{type:"button",variant:"outline",size:"icon",onClick:async()=>{let e,s,t=ei||ea.openai?.activeInstanceId;t&&await (0,ef.confirmDialog)(d.settings?.ai?.confirmDelete||"Delete this instance?",{destructive:!0})&&(s=(e=(ea.openai?.instances||[]).filter(e=>e.id!==t)).length>0?e[0].id:void 0,er(t=>({...t,openai:{instances:e,activeInstanceId:s}})),en(s))},className:"h-10 w-10 text-destructive hover:text-destructive",children:(0,s.jsx)(k.Trash2,{className:"h-4 w-4"})})]}):(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:d.settings?.ai?.noInstances||"No instances configured. Click 'Add' to create one."}),(ea.openai?.instances?.length||0)>=10&&(0,s.jsx)("p",{className:"text-xs text-amber-600",children:d.settings?.ai?.maxInstancesReached||"Maximum instances reached (10)"})]}),st()&&(0,s.jsxs)("div",{className:"space-y-3 p-3 border rounded-md bg-background",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(y.Label,{children:[d.settings?.ai?.instanceName||"Instance Name"," ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsx)(v.Input,{value:st()?.name||"",onChange:e=>sa("name",e.target.value),placeholder:"e.g. 智谱 GLM-4V",className:st()?.name?.trim()?"":"border-destructive"})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(y.Label,{children:["API Key ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(v.Input,{type:es?"text":"password",value:st()?.apiKey||"",onChange:e=>sa("apiKey",e.target.value),placeholder:"sk-...",className:`pr-10 ${!st()?.apiKey?.trim()?"border-destructive":""}`}),(0,s.jsx)(f.Button,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>et(!es),children:es?(0,s.jsx)(T.EyeOff,{className:"h-4 w-4 text-muted-foreground"}):(0,s.jsx)(I.Eye,{className:"h-4 w-4 text-muted-foreground"})})]})]}),(0,s.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,s.jsxs)(y.Label,{children:["Base URL ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsx)(v.Input,{value:st()?.baseUrl||"",onChange:e=>sa("baseUrl",e.target.value),placeholder:"https://api.openai.com/v1",className:st()?.baseUrl?.trim()?"":"border-destructive"})]}),(0,s.jsx)(ew,{provider:"openai",apiKey:st()?.apiKey,baseUrl:st()?.baseUrl,currentModel:st()?.model,onModelChange:e=>sa("model",e)})]})]}),"gemini"===ea.aiProvider&&(0,s.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:"API Key"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(v.Input,{type:es?"text":"password",value:ea.gemini?.apiKey||"",onChange:e=>ss("gemini","apiKey",e.target.value),placeholder:"AIza...",className:"pr-10"}),(0,s.jsx)(f.Button,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>et(!es),children:es?(0,s.jsx)(T.EyeOff,{className:"h-4 w-4 text-muted-foreground"}):(0,s.jsx)(I.Eye,{className:"h-4 w-4 text-muted-foreground"})})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:"Base URL (Optional)"}),(0,s.jsx)(v.Input,{value:ea.gemini?.baseUrl||"",onChange:e=>ss("gemini","baseUrl",e.target.value),placeholder:"https://generativelanguage.googleapis.com"})]}),(0,s.jsx)(ew,{provider:"gemini",apiKey:ea.gemini?.apiKey,baseUrl:ea.gemini?.baseUrl,currentModel:ea.gemini?.model,onModelChange:e=>ss("gemini","model",e)})]}),"anthropic"===ea.aiProvider&&(0,s.jsx)(eU,{value:ea.anthropic,onChange:e=>er(s=>({...s,anthropic:e}))}),eN(ea.aiProvider)&&(0,s.jsx)(eK,{provider:ea.aiProvider,value:ea[ea.aiProvider],onChange:e=>er(s=>({...s,[s.aiProvider]:e}))},ea.aiProvider),"azure"===ea.aiProvider&&(0,s.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(y.Label,{children:[d.settings?.ai?.azureEndpoint||"Azure Endpoint"," ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsx)(v.Input,{value:ea.azure?.endpoint||"",onChange:e=>er(s=>({...s,azure:{...s.azure,endpoint:e.target.value}})),placeholder:d.settings?.ai?.azureEndpointPlaceholder||"https://your-resource.openai.azure.com",className:ea.azure?.endpoint?.trim()?"":"border-destructive"})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(y.Label,{children:[d.settings?.ai?.azureDeployment||"Deployment Name"," ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsx)(v.Input,{value:ea.azure?.deploymentName||"",onChange:e=>er(s=>({...s,azure:{...s.azure,deploymentName:e.target.value}})),placeholder:d.settings?.ai?.azureDeploymentPlaceholder||"gpt-4o-deployment",className:ea.azure?.deploymentName?.trim()?"":"border-destructive"})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(y.Label,{children:["API Key ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(v.Input,{type:es?"text":"password",value:ea.azure?.apiKey||"",onChange:e=>er(s=>({...s,azure:{...s.azure,apiKey:e.target.value}})),placeholder:"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",className:`pr-10 ${!ea.azure?.apiKey?.trim()?"border-destructive":""}`}),(0,s.jsx)(f.Button,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>et(!es),children:es?(0,s.jsx)(T.EyeOff,{className:"h-4 w-4 text-muted-foreground"}):(0,s.jsx)(I.Eye,{className:"h-4 w-4 text-muted-foreground"})})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:d.settings?.ai?.azureApiVersion||"API Version"}),(0,s.jsx)(v.Input,{value:ea.azure?.apiVersion||"",onChange:e=>er(s=>({...s,azure:{...s.azure,apiVersion:e.target.value}})),placeholder:d.settings?.ai?.azureApiVersionPlaceholder||"2024-02-15-preview"})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:d.settings?.ai?.azureModel||"Model Display Name"}),(0,s.jsx)(v.Input,{value:ea.azure?.model||"",onChange:e=>er(s=>({...s,azure:{...s.azure,model:e.target.value}})),placeholder:"gpt-4o"})]})]}),(0,s.jsxs)("div",{className:"space-y-3 pt-3 border-t",children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)(f.Button,{type:"button",variant:"outline",onClick:sr,disabled:el||Y,className:"flex-1",children:[el?(0,s.jsx)(S.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(M,{className:"mr-2 h-4 w-4"}),el?d.settings?.ai?.testing||"测试中...":d.settings?.ai?.testConnection||"测试连接"]}),(0,s.jsxs)(f.Button,{onClick:e1,disabled:Y||el,className:"flex-1",children:[Y&&(0,s.jsx)(S.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),d.settings?.ai?.save||"Save AI Settings"]})]}),ec&&(0,s.jsxs)("div",{className:`p-3 rounded-md text-sm ${ec.success?"bg-green-50 border border-green-200":"bg-red-50 border border-red-200"}`,children:[(0,s.jsx)("div",{className:"flex items-center gap-2 font-medium mb-2",children:ec.success?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(R,{className:"h-4 w-4 text-green-600"}),(0,s.jsx)("span",{className:"text-green-700",children:d.settings?.ai?.testSuccess||"连接成功"}),ec.modelInfo&&(0,s.jsxs)("span",{className:"text-green-600 text-xs",children:["(",ec.modelInfo,")"]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(P.XCircle,{className:"h-4 w-4 text-red-600"}),(0,s.jsx)("span",{className:"text-red-700",children:d.settings?.ai?.testFailed||"连接失败"})]})}),ec.success&&(0,s.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("span",{className:"text-muted-foreground",children:[d.settings?.ai?.textSupport||"文本生成",":"]}),(0,s.jsxs)("span",{className:"text-green-600",children:["✓ ",d.settings?.ai?.supported||"支持"]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("span",{className:"text-muted-foreground",children:[d.settings?.ai?.visionSupport||"图像识别/多模态",":"]}),ec.visionSupport?(0,s.jsxs)("span",{className:"text-green-600",children:["✓ ",d.settings?.ai?.supported||"支持"]}):(0,s.jsxs)("span",{className:"text-amber-600",children:["✗ ",ec.visionError?d.settings?.ai?.errors?.[ec.visionError]||ec.visionError.replace("UNKNOWN:",""):d.settings?.ai?.notSupported||"不支持"]})]}),(0,s.jsx)("p",{className:"text-muted-foreground/60 text-[10px] pl-1",children:"* 由于网络问题,可能测试结果不准确"})]}),!ec.success&&ec.textError&&(0,s.jsx)("p",{className:"text-red-600 text-xs mt-1",children:d.settings?.ai?.errors?.[ec.textError]||ec.textError.replace("UNKNOWN:","")})]})]})]})}),(0,s.jsxs)(N.TabsContent,{value:"prompts",className:"space-y-4 py-4",children:[(0,s.jsx)(eD,{config:ea,onUpdate:(e,s)=>{er(t=>({...t,prompts:{...t.prompts,[e]:s}}))}}),(0,s.jsxs)(f.Button,{onClick:e1,disabled:Y,className:"w-full",children:[Y&&(0,s.jsx)(S.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),d.settings?.prompts?.save||"Save Prompt Settings"]})]}),n?.user?.role==="admin"&&(0,s.jsxs)(N.TabsContent,{value:"admin",className:"space-y-4 py-4",children:[(0,s.jsxs)(f.Button,{variant:"outline",className:"w-full justify-start gap-2",onClick:()=>{h(!1),eJ.push("/admin")},children:[(0,s.jsx)(o.BarChart3,{className:"h-4 w-4"}),d.admin?.dashboard?.title||"Admin Dashboard"]}),(0,s.jsx)("div",{className:"border-t pt-4",children:(0,s.jsx)(ej,{})})]}),(0,s.jsx)(N.TabsContent,{value:"danger",className:"space-y-4 py-4",children:(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{className:"p-4 border border-blue-200 rounded-lg bg-blue-50",children:[(0,s.jsx)("h4",{className:"text-sm font-bold text-blue-900 mb-3",children:d.settings?.dataManagement||"Data Management"}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("span",{className:"text-sm text-blue-800 font-medium",children:d.settings?.exportData||"Export Data"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)(f.Button,{variant:"outline",size:"sm",onClick:e6,disabled:eA,className:"bg-blue-100 hover:bg-blue-200 text-blue-900 border-blue-300",children:[eA?(0,s.jsx)(S.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(_.Download,{className:"mr-2 h-4 w-4"}),d.settings?.exportData||"Export"]}),n?.user?.role==="admin"&&(0,s.jsxs)(f.Button,{variant:"outline",size:"sm",onClick:e8,disabled:eA,className:"bg-orange-100 hover:bg-orange-200 text-orange-900 border-orange-300",children:[eA?(0,s.jsx)(S.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(_.Download,{className:"mr-2 h-4 w-4"}),d.settings?.exportAllData||"Export All"]})]})]}),(0,s.jsx)("p",{className:"text-xs text-blue-700",children:d.settings?.exportDataDesc||"Export all data as JSON file."})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("span",{className:"text-sm text-blue-800 font-medium",children:d.settings?.importData||"Import Data"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("input",{type:"file",accept:".json",onChange:e=>{let s=e.target.files?.[0];s&&(eY(s),eG(s.name))},className:"hidden",id:"import-file-input",disabled:eH}),(0,s.jsxs)(f.Button,{variant:"outline",size:"sm",onClick:()=>document.getElementById("import-file-input")?.click(),disabled:eH,className:"bg-blue-100 hover:bg-blue-200 text-blue-900 border-blue-300",children:[eH?(0,s.jsx)(S.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(U,{className:"mr-2 h-4 w-4"}),eZ||d.settings?.selectFile||"Select File"]}),eW&&(0,s.jsxs)(f.Button,{variant:"outline",size:"sm",onClick:e7,disabled:eH,className:"bg-green-100 hover:bg-green-200 text-green-900 border-green-300",children:[eH?(0,s.jsx)(S.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(R,{className:"mr-2 h-4 w-4"}),d.settings?.importData||"Import"]}),eW&&n?.user?.role==="admin"&&(0,s.jsxs)(f.Button,{variant:"outline",size:"sm",onClick:e9,disabled:eH,className:"bg-orange-100 hover:bg-orange-200 text-orange-900 border-orange-300",children:[eH?(0,s.jsx)(S.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(R,{className:"mr-2 h-4 w-4"}),d.settings?.importAllData||"Import All"]})]})]}),(0,s.jsx)("p",{className:"text-xs text-blue-700",children:d.settings?.importDataDesc||"Import data from JSON file. Existing data will be skipped."})]})]}),n?.user?.role==="admin"&&(0,s.jsxs)("div",{className:"p-4 border border-blue-200 rounded-lg bg-blue-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("div",{className:"flex flex-col",children:(0,s.jsxs)("span",{className:"text-sm text-blue-900 font-bold flex items-center gap-2",children:[(0,s.jsx)(A.RefreshCw,{className:"h-4 w-4"}),d.settings?.migrateTags||"Migrate Tags"]})}),(0,s.jsx)(f.Button,{variant:"outline",size:"sm",onClick:se,disabled:X,className:"bg-blue-100 hover:bg-blue-200 text-blue-900 border-blue-300",children:X?(0,s.jsx)(S.Loader2,{className:"h-4 w-4 animate-spin"}):(0,s.jsx)(A.RefreshCw,{className:"h-4 w-4"})})]}),(0,s.jsx)("p",{className:"text-xs text-blue-800 mt-2 font-medium",children:d.settings?.migrateTagsDesc||"Re-populates standard tags from file"})]}),(0,s.jsxs)("div",{className:"p-4 border border-red-200 rounded-lg bg-red-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-sm text-red-700 font-medium",children:d.settings?.clearData||"Clear Practice Data"}),(0,s.jsx)(f.Button,{variant:"destructive",size:"sm",onClick:e4,disabled:F,children:F?(0,s.jsx)(S.Loader2,{className:"h-4 w-4 animate-spin"}):(0,s.jsx)(k.Trash2,{className:"h-4 w-4"})})]}),(0,s.jsx)("p",{className:"text-xs text-red-600 mt-2",children:d.settings?.clearDataDesc||"This will permanently delete all practice history. Irreversible."})]}),(0,s.jsxs)("div",{className:"p-4 border border-red-200 rounded-lg bg-red-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-sm text-red-700 font-medium",children:d.settings?.clearErrorData||"Clear Error Data"}),(0,s.jsx)(f.Button,{variant:"destructive",size:"sm",onClick:e3,disabled:$,children:$?(0,s.jsx)(S.Loader2,{className:"h-4 w-4 animate-spin"}):(0,s.jsx)(k.Trash2,{className:"h-4 w-4"})})]}),(0,s.jsx)("p",{className:"text-xs text-red-600 mt-2",children:d.settings?.clearErrorDataDesc||"This will permanently delete all error items. Irreversible."})]}),n?.user?.role==="admin"&&(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"p-4 border border-red-600/50 rounded-lg bg-red-100/50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("div",{className:"flex flex-col",children:(0,s.jsxs)("span",{className:"text-sm text-red-900 font-bold flex items-center gap-2",children:[(0,s.jsx)(C,{className:"h-4 w-4"}),d.settings?.systemReset||"System Initialization"]})}),(0,s.jsx)(f.Button,{variant:"destructive",size:"sm",onClick:e5,disabled:V,className:"bg-red-700 hover:bg-red-800",children:V?(0,s.jsx)(S.Loader2,{className:"h-4 w-4 animate-spin"}):(0,s.jsx)(k.Trash2,{className:"h-4 w-4"})})]}),(0,s.jsx)("p",{className:"text-xs text-red-800 mt-2 font-medium",children:d.settings?.systemResetDesc||"Resets the system to factory state. Deletes ALL data."})]})})]})}),(0,s.jsx)(N.TabsContent,{value:"about",className:"space-y-4 py-4",children:(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center space-y-6 py-8 text-center bg-muted/30 rounded-lg border",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("h3",{className:"text-2xl font-bold",children:d.app?.title||"Smart Error Notebook"}),(0,s.jsx)("p",{className:"text-muted-foreground",children:d.settings?.about?.desc||"AI-powered learning assistant"})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2 text-sm text-muted-foreground border px-4 py-2 rounded-full bg-background",children:[(0,s.jsx)(ez,{className:"h-4 w-4"}),(0,s.jsxs)("span",{children:[d.settings?.about?.version||"Version",": v",Q||"unknown"]})]}),(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row flex-wrap justify-center gap-4 w-full sm:w-auto px-4 sm:px-0",children:[(0,s.jsx)(f.Button,{variant:"outline",asChild:!0,className:"gap-2 w-full sm:w-auto",children:(0,s.jsxs)("a",{href:"https://github.com/wttwins/wrong-notebook",target:"_blank",rel:"noopener noreferrer",children:[(0,s.jsx)(eq,{className:"h-4 w-4"}),d.settings?.about?.github||"GitHub Repository",(0,s.jsx)(e$,{className:"h-3 w-3 ml-1 opacity-50"})]})}),(0,s.jsx)(f.Button,{variant:"outline",asChild:!0,className:"gap-2 w-full sm:w-auto",children:(0,s.jsxs)("a",{href:"https://github.com/wttwins/wrong-notebook/releases",target:"_blank",rel:"noopener noreferrer",children:[(0,s.jsx)(eV,{className:"h-4 w-4"}),d.settings?.about?.releaseNotes||"Release Notes",(0,s.jsx)(e$,{className:"h-3 w-3 ml-1 opacity-50"})]})}),(0,s.jsx)(f.Button,{variant:"outline",asChild:!0,className:"gap-2 w-full sm:w-auto",children:(0,s.jsxs)("a",{href:"https://github.com/wttwins/wrong-notebook/issues",target:"_blank",rel:"noopener noreferrer",children:[(0,s.jsx)(eO,{className:"h-4 w-4"}),d.settings?.about?.feedback||"Feedback",(0,s.jsx)(e$,{className:"h-3 w-3 ml-1 opacity-50"})]})})]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground mt-8",children:d.settings?.about?.copyright||"© 2025 Wttwins. All rights reserved."})]})})]})]})]})}let eX=[/^\/login/,/^\/register/,/^\/print-preview/,/^\/exams\/[^/]+\/print/],eW=[{key:"home",href:"/",icon:p,match:e=>"/"===e},{key:"notebooks",href:"/notebooks",icon:c.BookOpen,match:e=>e.startsWith("/notebooks")||e.startsWith("/error-items")||e.startsWith("/practice")},{key:"tags",href:"/tags",icon:h,match:e=>e.startsWith("/tags")},{key:"stats",href:"/stats",icon:o.BarChart3,match:e=>e.startsWith("/stats")},{key:"exams",href:"/exams",icon:d.FileText,match:e=>e.startsWith("/exams")}];function eY({children:e}){let r=(0,l.usePathname)()||"/",{t:o}=(0,t.useLanguage)(),{data:c,status:d}=(0,a.useSession)();if(eX.some(e=>e.test(r))||"unauthenticated"===d)return(0,s.jsx)(s.Fragment,{children:e});let m=c?.user?.role==="admin",p=c?.user?.name||c?.user?.email||"";return(0,s.jsxs)("div",{className:"min-h-screen",children:[(0,s.jsx)("header",{className:"sticky top-0 z-40 border-b bg-card/80 backdrop-blur-md supports-[backdrop-filter]:bg-card/70 print:hidden",children:(0,s.jsxs)("div",{className:"mx-auto flex h-14 max-w-6xl items-center gap-3 px-4 md:h-16 md:px-8",children:[(0,s.jsxs)(n.default,{href:"/",className:"flex shrink-0 items-center gap-2",children:[(0,s.jsx)(i.default,{src:"/icons/icon.png",alt:"",width:32,height:32,className:"rounded-lg",priority:!0,unoptimized:!0}),(0,s.jsx)("span",{className:"text-base font-semibold tracking-tight",children:o.pageTitle.base})]}),(0,s.jsx)("nav",{className:"ml-4 hidden items-center gap-1 md:flex",children:eW.map(e=>{let t=e.match(r),a=e.icon;return(0,s.jsxs)(n.default,{href:e.href,className:(0,en.cn)("flex items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors",t?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground"),"aria-current":t?"page":void 0,children:[(0,s.jsx)(a,{className:"h-4 w-4"}),o.nav[e.key]]},e.key)})}),(0,s.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[p&&(0,s.jsxs)("span",{className:"mr-2 hidden max-w-40 items-center gap-2 truncate text-sm text-muted-foreground lg:flex",children:[(0,s.jsx)("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-semibold text-primary",children:p.slice(0,1).toUpperCase()}),(0,s.jsx)("span",{className:"truncate",children:p})]}),m&&(0,s.jsx)(n.default,{href:"/admin",title:o.nav.admin,children:(0,s.jsxs)(f.Button,{variant:"ghost",size:"icon",className:"rounded-full",children:[(0,s.jsx)(x,{className:"h-5 w-5"}),(0,s.jsx)("span",{className:"sr-only",children:o.nav.admin})]})}),(0,s.jsx)(eH,{}),(0,s.jsx)(f.Button,{variant:"ghost",size:"icon",className:"rounded-full text-muted-foreground hover:text-destructive",onClick:()=>(0,a.signOut)({callbackUrl:"/login"}),title:o.app.logout,children:(0,s.jsx)(u,{className:"h-5 w-5"})})]})]})}),(0,s.jsx)("div",{className:"pb-20 md:pb-0",children:e}),(0,s.jsx)("nav",{className:"pb-safe fixed inset-x-0 bottom-0 z-40 border-t bg-card/90 backdrop-blur-md md:hidden print:hidden",children:(0,s.jsx)("div",{className:"grid h-16 grid-cols-5",children:eW.map(e=>{let t=e.match(r),a=e.icon;return(0,s.jsxs)(n.default,{href:e.href,className:(0,en.cn)("flex flex-col items-center justify-center gap-1 text-[11px] font-medium transition-colors",t?"text-primary":"text-muted-foreground"),"aria-current":t?"page":void 0,children:[(0,s.jsx)("span",{className:(0,en.cn)("flex h-7 w-12 items-center justify-center rounded-full transition-colors",t&&"bg-accent"),children:(0,s.jsx)(a,{className:"h-5 w-5"})}),o.nav[e.key]]},e.key)})})})]})}let eZ=(0,m.default)("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]),eG=[/^\/login/,/^\/register/,/^\/print-preview/,/^\/exams\/[^/]+\/print/];function eJ(){let{t:e}=(0,t.useLanguage)(),{timeZone:i}=(0,r.useTimeZone)(),{status:o}=(0,a.useSession)(),c=(0,l.usePathname)(),[d,m]=(0,g.useState)(!1),[u,p]=(0,g.useState)([]),[x,h]=(0,g.useState)(()=>Date.now()),v="authenticated"!==o||eG.some(e=>e.test(c||"")),y=(0,g.useCallback)(async()=>{if("u"<typeof document||"hidden"!==document.visibilityState)try{let e=await eg.apiClient.get("/api/tasks");p(e.tasks),h(Date.now())}catch{}},[]);if((0,g.useEffect)(()=>{if(v)return;let e=setTimeout(y,0),s=setInterval(y,d?2e3:15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v,d,y]),v)return null;let b=u.filter(e=>"running"===e.status).length,N=u.some(e=>"running"!==e.status),w=async()=>{try{let e=await eg.apiClient.delete("/api/tasks");p(e.tasks)}catch{}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(f.Button,{variant:"outline",size:"icon",className:"fixed bottom-20 right-4 z-40 h-11 w-11 rounded-full shadow-lg md:bottom-6 md:right-6 print:hidden",onClick:()=>m(!0),"aria-label":e.backgroundTasks.title,title:e.backgroundTasks.title,children:[b>0?(0,s.jsx)(S.Loader2,{className:"h-5 w-5 animate-spin"}):(0,s.jsx)(eZ,{className:"h-5 w-5"}),b>0&&(0,s.jsx)("span",{className:"absolute -right-1 -top-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1 text-xs text-primary-foreground",children:b})]}),(0,s.jsx)(j.Dialog,{open:d,onOpenChange:m,children:(0,s.jsxs)(j.DialogContent,{className:"max-h-[85vh] overflow-y-auto sm:max-w-lg",children:[(0,s.jsxs)(j.DialogHeader,{children:[(0,s.jsx)(j.DialogTitle,{children:e.backgroundTasks.title}),(0,s.jsx)(j.DialogDescription,{children:e.backgroundTasks.description})]}),0===u.length?(0,s.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:e.backgroundTasks.empty}):(0,s.jsx)("ul",{className:"space-y-2",children:u.map(t=>{var a,r;let l;return(0,s.jsx)("li",{className:"rounded-md border p-3 text-sm",children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:["running"===t.status&&(0,s.jsx)(S.Loader2,{className:"mt-0.5 h-4 w-4 shrink-0 animate-spin text-primary"}),"succeeded"===t.status&&(0,s.jsx)(R,{className:"mt-0.5 h-4 w-4 shrink-0 text-green-600"}),"failed"===t.status&&(0,s.jsx)(P.XCircle,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),(0,s.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,s.jsxs)("div",{className:"font-medium",children:[e.backgroundTasks.kinds[t.kind],(0,s.jsxs)("span",{className:"font-normal text-muted-foreground",children:[" · ",e.backgroundTasks.status[t.status]]})]}),t.subject&&(0,s.jsx)("div",{className:"break-words text-muted-foreground",children:t.subject}),t.progress&&t.progress.total>0&&(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("div",{className:"h-1.5 overflow-hidden rounded bg-muted",children:(0,s.jsx)("div",{className:"h-full bg-primary transition-all",style:{width:`${Math.round(t.progress.done/t.progress.total*100)}%`}})}),(0,s.jsxs)("div",{className:"text-xs text-muted-foreground",children:[e.backgroundTasks.progress.replace("{done}",String(t.progress.done)).replace("{total}",String(t.progress.total)),t.progress.failed>0&&` \xb7 ${e.backgroundTasks.failedCount.replace("{count}",String(t.progress.failed))}`]})]}),t.error&&(0,s.jsx)("div",{className:"text-xs text-destructive",children:(s=>{if(!s)return null;let t=e.backgroundTasks.errors[s]??e.errors[s];return"string"==typeof t?t:s})(t.error)}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 text-xs text-muted-foreground",children:[(0,s.jsx)("span",{children:e.backgroundTasks.startedAt.replace("{time}",(0,K.formatDateTime)(t.startedAt,"HH:mm:ss",i))}),(0,s.jsx)("span",{children:e.backgroundTasks.elapsed.replace("{time}",(a=t.startedAt,r=t.finishedAt,l=Math.max(0,Math.round(((r?Date.parse(r):x)-Date.parse(a))/1e3)),`${Math.floor(l/60)}:${String(l%60).padStart(2,"0")}`))}),t.link&&(0,s.jsx)(n.default,{href:t.link,className:"text-primary hover:underline",onClick:()=>m(!1),children:e.backgroundTasks.view})]})]})]})},t.id)})}),(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2 pt-1",children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:e.backgroundTasks.retentionHint}),N&&(0,s.jsx)(f.Button,{variant:"ghost",size:"sm",onClick:w,children:e.backgroundTasks.clearFinished})]})]})})]})}var eQ=e.i(37727);let e0={success:{icon:R,className:"text-success"},error:{icon:P.XCircle,className:"text-destructive"},warning:{icon:C,className:"text-warning"},info:{icon:ez,className:"text-primary"}};function e1(){let{t:e}=(0,t.useLanguage)(),[a,r]=(0,g.useState)([]),[i,n]=(0,g.useState)(null);return(0,g.useEffect)(()=>(0,ef.subscribeFeedback)(e=>{r(e.toasts),n(e.confirm)}),[]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"pointer-events-none fixed inset-x-0 top-3 z-[100] flex flex-col items-center gap-2 px-4 print:hidden",role:"status","aria-live":"polite",children:a.map(t=>{let{icon:a,className:r}=e0[t.type];return(0,s.jsxs)("div",{className:"pointer-events-auto flex w-full max-w-sm items-start gap-3 rounded-xl border bg-card/95 px-4 py-3 text-sm shadow-lg backdrop-blur animate-in fade-in slide-in-from-top-2 duration-200",children:[(0,s.jsx)(a,{className:(0,en.cn)("mt-0.5 h-4 w-4 shrink-0",r)}),(0,s.jsx)("p",{className:"min-w-0 flex-1 whitespace-pre-line break-words leading-relaxed",children:t.message}),(0,s.jsx)("button",{type:"button",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:text-foreground",onClick:()=>(0,ef.dismissToast)(t.id),"aria-label":e.common.close,children:(0,s.jsx)(eQ.X,{className:"h-3.5 w-3.5"})})]},t.id)})}),(0,s.jsx)(j.Dialog,{open:!!i,onOpenChange:e=>{e||i?.resolve(!1)},children:(0,s.jsxs)(j.DialogContent,{className:"sm:max-w-md",children:[(0,s.jsxs)(j.DialogHeader,{children:[(0,s.jsxs)(j.DialogTitle,{className:"flex items-center gap-2",children:[i?.destructive&&(0,s.jsx)(C,{className:"h-5 w-5 text-destructive"}),i?.title||e.common.confirmTitle]}),(0,s.jsx)(j.DialogDescription,{className:"whitespace-pre-line pt-1 text-left leading-relaxed",children:i?.message})]}),(0,s.jsxs)(j.DialogFooter,{className:"gap-2",children:[(0,s.jsx)(f.Button,{variant:"outline",onClick:()=>i?.resolve(!1),children:i?.cancelText||e.common.cancel}),(0,s.jsx)(f.Button,{variant:i?.destructive?"destructive":"default",onClick:()=>i?.resolve(!0),autoFocus:!0,children:i?.confirmText||e.common.confirm})]})]})})]})}e.s(["Providers",0,function({children:e,timeZone:i}){return(0,s.jsx)(a.SessionProvider,{children:(0,s.jsx)(t.LanguageProvider,{children:(0,s.jsxs)(r.TimeZoneProvider,{initialTimeZone:i,children:[(0,s.jsx)(eY,{children:e}),(0,s.jsx)(eJ,{}),(0,s.jsx)(e1,{})]})})})}],1661)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,98591,e=>{"use strict";var t=e.i(18050),r=e.i(71645),n=e.i(18566),a=e.i(19455),o=e.i(93842),l=e.i(86963),i=e.i(7233),s=e.i(88699),c=e.i(22016),d=e.i(15288),u=e.i(87486),p=e.i(93479),f=e.i(57428),h=e.i(12505),m=e.i(75254);let g=(0,m.default)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]),x=(0,m.default)("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]);var v=e.i(69638),y=e.i(3116),j=e.i(64659),w=e.i(3281),b=e.i(63804);let C=(0,m.default)("git-compare-arrows",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]]),k=(0,m.default)("inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);var S=e.i(15519),N=e.i(30691),R=e.i(11110),E=e.i(81140),M=e.i(20783),D=e.i(30030),P=e.i(69340),I=e.i(74080),A=Symbol("radix.slottable");function T(e){return r.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===A}var _=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,n)=>{var a,o;let l,i,s,c=(o=a=`Primitive.${n}`,(l=r.forwardRef((e,t)=>{let{children:n,...a}=e;if(r.isValidElement(n)){var o;let e,l,i=(o=n,(l=(e=Object.getOwnPropertyDescriptor(o.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?o.ref:(l=(e=Object.getOwnPropertyDescriptor(o,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?o.props.ref:o.props.ref||o.ref),s=function(e,t){let r={...t};for(let n in t){let a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{let t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,n.props);return n.type!==r.Fragment&&(s.ref=t?(0,M.composeRefs)(t,i):i),r.cloneElement(n,s)}return r.Children.count(n)>1?r.Children.only(null):null})).displayName=`${o}.SlotClone`,i=l,(s=r.forwardRef((e,n)=>{let{children:a,...o}=e,l=r.Children.toArray(a),s=l.find(T);if(s){let e=s.props.children,a=l.map(t=>t!==s?t:r.Children.count(e)>1?r.Children.only(null):r.isValidElement(e)?e.props.children:null);return(0,t.jsx)(i,{...o,ref:n,children:r.isValidElement(e)?r.cloneElement(e,void 0,a):null})}return(0,t.jsx)(i,{...o,ref:n,children:a})})).displayName=`${a}.Slot`,s),d=r.forwardRef((e,r)=>{let{asChild:a,...o}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,t.jsx)(a?c:n,{...o,ref:r})});return d.displayName=`Primitive.${n}`,{...e,[n]:d}},{}),L=e.i(75830),F=e.i(86318),B=e.i(26330),O=e.i(3536),$=e.i(65491),H=e.i(10772),z=e.i(53660),q=e.i(74606),G=e.i(96626);function K(e){var n;let a,o=(n=e,(a=r.forwardRef((e,t)=>{let{children:n,...a}=e;if(r.isValidElement(n)){var o;let e,l,i=(o=n,(l=(e=Object.getOwnPropertyDescriptor(o.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?o.ref:(l=(e=Object.getOwnPropertyDescriptor(o,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?o.props.ref:o.props.ref||o.ref),s=function(e,t){let r={...t};for(let n in t){let a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...e)=>{let t=o(...e);return a(...e),t}:a&&(r[n]=a):"style"===n?r[n]={...a,...o}:"className"===n&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}(a,n.props);return n.type!==r.Fragment&&(s.ref=t?(0,M.composeRefs)(t,i):i),r.cloneElement(n,s)}return r.Children.count(n)>1?r.Children.only(null):null})).displayName=`${n}.SlotClone`,a),l=r.forwardRef((e,n)=>{let{children:a,...l}=e,i=r.Children.toArray(a),s=i.find(U);if(s){let e=s.props.children,a=i.map(t=>t!==s?t:r.Children.count(e)>1?r.Children.only(null):r.isValidElement(e)?e.props.children:null);return(0,t.jsx)(o,{...l,ref:n,children:r.isValidElement(e)?r.cloneElement(e,void 0,a):null})}return(0,t.jsx)(o,{...l,ref:n,children:a})});return l.displayName=`${e}.Slot`,l}var V=Symbol("radix.slottable");function U(e){return r.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===V}var W=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,n)=>{let a=K(`Primitive.${n}`),o=r.forwardRef((e,r)=>{let{asChild:o,...l}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,t.jsx)(o?a:n,{...l,ref:r})});return o.displayName=`Primitive.${n}`,{...e,[n]:o}},{}),Z=e.i(42727),X=e.i(30207),Q=e.i(86312),Y=e.i(85369),J=["Enter"," "],ee=["ArrowUp","PageDown","End"],et=["ArrowDown","PageUp","Home",...ee],er={ltr:[...J,"ArrowRight"],rtl:[...J,"ArrowLeft"]},en={ltr:["ArrowLeft"],rtl:["ArrowRight"]},ea="Menu",[eo,el,ei]=(0,L.createCollection)(ea),[es,ec]=(0,D.createContextScope)(ea,[ei,z.createPopperScope,Z.createRovingFocusGroupScope]),ed=(0,z.createPopperScope)(),eu=(0,Z.createRovingFocusGroupScope)(),[ep,ef]=es(ea),[eh,em]=es(ea),eg=e=>{let{__scopeMenu:n,open:a=!1,children:o,dir:l,onOpenChange:i,modal:s=!0}=e,c=ed(n),[d,u]=r.useState(null),p=r.useRef(!1),f=(0,X.useCallbackRef)(i),h=(0,F.useDirection)(l);return r.useEffect(()=>{let e=()=>{p.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>p.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),(0,t.jsx)(z.Root,{...c,children:(0,t.jsx)(ep,{scope:n,open:a,onOpenChange:f,content:d,onContentChange:u,children:(0,t.jsx)(eh,{scope:n,onClose:r.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:p,dir:h,modal:s,children:o})})})};eg.displayName=ea;var ex=r.forwardRef((e,r)=>{let{__scopeMenu:n,...a}=e,o=ed(n);return(0,t.jsx)(z.Anchor,{...o,...a,ref:r})});ex.displayName="MenuAnchor";var ev="MenuPortal",[ey,ej]=es(ev,{forceMount:void 0}),ew=e=>{let{__scopeMenu:r,forceMount:n,children:a,container:o}=e,l=ef(ev,r);return(0,t.jsx)(ey,{scope:r,forceMount:n,children:(0,t.jsx)(G.Presence,{present:n||l.open,children:(0,t.jsx)(q.Portal,{asChild:!0,container:o,children:a})})})};ew.displayName=ev;var eb="MenuContent",[eC,ek]=es(eb),eS=r.forwardRef((e,r)=>{let n=ej(eb,e.__scopeMenu),{forceMount:a=n.forceMount,...o}=e,l=ef(eb,e.__scopeMenu),i=em(eb,e.__scopeMenu);return(0,t.jsx)(eo.Provider,{scope:e.__scopeMenu,children:(0,t.jsx)(G.Presence,{present:a||l.open,children:(0,t.jsx)(eo.Slot,{scope:e.__scopeMenu,children:i.modal?(0,t.jsx)(eN,{...o,ref:r}):(0,t.jsx)(eR,{...o,ref:r})})})})}),eN=r.forwardRef((e,n)=>{let a=ef(eb,e.__scopeMenu),o=r.useRef(null),l=(0,M.useComposedRefs)(n,o);return r.useEffect(()=>{let e=o.current;if(e)return(0,Q.hideOthers)(e)},[]),(0,t.jsx)(eM,{...e,ref:l,trapFocus:a.open,disableOutsidePointerEvents:a.open,disableOutsideScroll:!0,onFocusOutside:(0,E.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>a.onOpenChange(!1)})}),eR=r.forwardRef((e,r)=>{let n=ef(eb,e.__scopeMenu);return(0,t.jsx)(eM,{...e,ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),eE=K("MenuContent.ScrollLock"),eM=r.forwardRef((e,n)=>{let{__scopeMenu:a,loop:o=!1,trapFocus:l,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:d,onEscapeKeyDown:u,onPointerDownOutside:p,onFocusOutside:f,onInteractOutside:h,onDismiss:m,disableOutsideScroll:g,...x}=e,v=ef(eb,a),y=em(eb,a),j=ed(a),w=eu(a),b=el(a),[C,k]=r.useState(null),S=r.useRef(null),N=(0,M.useComposedRefs)(n,S,v.onContentChange),R=r.useRef(0),D=r.useRef(""),P=r.useRef(0),I=r.useRef(null),A=r.useRef("right"),T=r.useRef(0),_=g?Y.RemoveScroll:r.Fragment;r.useEffect(()=>()=>window.clearTimeout(R.current),[]),(0,O.useFocusGuards)();let L=r.useCallback(e=>{var t,r;return A.current===I.current?.side&&(t=e,!!(r=I.current?.area)&&function(e,t){let{x:r,y:n}=e,a=!1;for(let e=0,o=t.length-1;e<t.length;o=e++){let l=t[e],i=t[o],s=l.x,c=l.y,d=i.x,u=i.y;c>n!=u>n&&r<(d-s)*(n-c)/(u-c)+s&&(a=!a)}return a}({x:t.clientX,y:t.clientY},r))},[]);return(0,t.jsx)(eC,{scope:a,searchRef:D,onItemEnter:r.useCallback(e=>{L(e)&&e.preventDefault()},[L]),onItemLeave:r.useCallback(e=>{L(e)||(S.current?.focus(),k(null))},[L]),onTriggerLeave:r.useCallback(e=>{L(e)&&e.preventDefault()},[L]),pointerGraceTimerRef:P,onPointerGraceIntentChange:r.useCallback(e=>{I.current=e},[]),children:(0,t.jsx)(_,{...g?{as:eE,allowPinchZoom:!0}:void 0,children:(0,t.jsx)($.FocusScope,{asChild:!0,trapped:l,onMountAutoFocus:(0,E.composeEventHandlers)(i,e=>{e.preventDefault(),S.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:(0,t.jsx)(B.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:u,onPointerDownOutside:p,onFocusOutside:f,onInteractOutside:h,onDismiss:m,children:(0,t.jsx)(Z.Root,{asChild:!0,...w,dir:y.dir,orientation:"vertical",loop:o,currentTabStopId:C,onCurrentTabStopIdChange:k,onEntryFocus:(0,E.composeEventHandlers)(d,e=>{y.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,t.jsx)(z.Content,{role:"menu","aria-orientation":"vertical","data-state":e1(v.open),"data-radix-menu-content":"",dir:y.dir,...j,...x,ref:N,style:{outline:"none",...x.style},onKeyDown:(0,E.composeEventHandlers)(x.onKeyDown,e=>{let t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,r=e.ctrlKey||e.altKey||e.metaKey,n=1===e.key.length;if(t){var a;let t,o,l,i,s,c;"Tab"===e.key&&e.preventDefault(),!r&&n&&(a=e.key,t=D.current+a,o=b().filter(e=>!e.disabled),l=document.activeElement,i=o.find(e=>e.ref.current===l)?.textValue,s=function(e,t,r){var n;let a=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,o=r?e.indexOf(r):-1,l=(n=Math.max(o,0),e.map((t,r)=>e[(n+r)%e.length]));1===a.length&&(l=l.filter(e=>e!==r));let i=l.find(e=>e.toLowerCase().startsWith(a.toLowerCase()));return i!==r?i:void 0}(o.map(e=>e.textValue),t,i),c=o.find(e=>e.textValue===s)?.ref.current,function e(t){D.current=t,window.clearTimeout(R.current),""!==t&&(R.current=window.setTimeout(()=>e(""),1e3))}(t),c&&setTimeout(()=>c.focus()))}let o=S.current;if(e.target!==o||!et.includes(e.key))return;e.preventDefault();let l=b().filter(e=>!e.disabled).map(e=>e.ref.current);ee.includes(e.key)&&l.reverse(),function(e){let t=document.activeElement;for(let r of e)if(r===t||(r.focus(),document.activeElement!==t))return}(l)}),onBlur:(0,E.composeEventHandlers)(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(R.current),D.current="")}),onPointerMove:(0,E.composeEventHandlers)(e.onPointerMove,e5(e=>{let t=e.target,r=T.current!==e.clientX;e.currentTarget.contains(t)&&r&&(A.current=e.clientX>T.current?"right":"left",T.current=e.clientX)}))})})})})})})});eS.displayName=eb;var eD=r.forwardRef((e,r)=>{let{__scopeMenu:n,...a}=e;return(0,t.jsx)(W.div,{role:"group",...a,ref:r})});eD.displayName="MenuGroup";var eP=r.forwardRef((e,r)=>{let{__scopeMenu:n,...a}=e;return(0,t.jsx)(W.div,{...a,ref:r})});eP.displayName="MenuLabel";var eI="MenuItem",eA="menu.itemSelect",eT=r.forwardRef((e,n)=>{let{disabled:a=!1,onSelect:o,...l}=e,i=r.useRef(null),s=em(eI,e.__scopeMenu),c=ek(eI,e.__scopeMenu),d=(0,M.useComposedRefs)(n,i),u=r.useRef(!1);return(0,t.jsx)(e_,{...l,ref:d,disabled:a,onClick:(0,E.composeEventHandlers)(e.onClick,()=>{let e=i.current;if(!a&&e){let t=new CustomEvent(eA,{bubbles:!0,cancelable:!0});e.addEventListener(eA,e=>o?.(e),{once:!0}),e&&I.flushSync(()=>e.dispatchEvent(t)),t.defaultPrevented?u.current=!1:s.onClose()}}),onPointerDown:t=>{e.onPointerDown?.(t),u.current=!0},onPointerUp:(0,E.composeEventHandlers)(e.onPointerUp,e=>{u.current||e.currentTarget?.click()}),onKeyDown:(0,E.composeEventHandlers)(e.onKeyDown,e=>{let t=""!==c.searchRef.current;a||t&&" "===e.key||J.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});eT.displayName=eI;var e_=r.forwardRef((e,n)=>{let{__scopeMenu:a,disabled:o=!1,textValue:l,...i}=e,s=ek(eI,a),c=eu(a),d=r.useRef(null),u=(0,M.useComposedRefs)(n,d),[p,f]=r.useState(!1),[h,m]=r.useState("");return r.useEffect(()=>{let e=d.current;e&&m((e.textContent??"").trim())},[i.children]),(0,t.jsx)(eo.ItemSlot,{scope:a,disabled:o,textValue:l??h,children:(0,t.jsx)(Z.Item,{asChild:!0,...c,focusable:!o,children:(0,t.jsx)(W.div,{role:"menuitem","data-highlighted":p?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...i,ref:u,onPointerMove:(0,E.composeEventHandlers)(e.onPointerMove,e5(e=>{o?s.onItemLeave(e):(s.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:(0,E.composeEventHandlers)(e.onPointerLeave,e5(e=>s.onItemLeave(e))),onFocus:(0,E.composeEventHandlers)(e.onFocus,()=>f(!0)),onBlur:(0,E.composeEventHandlers)(e.onBlur,()=>f(!1))})})})}),eL=r.forwardRef((e,r)=>{let{checked:n=!1,onCheckedChange:a,...o}=e;return(0,t.jsx)(eG,{scope:e.__scopeMenu,checked:n,children:(0,t.jsx)(eT,{role:"menuitemcheckbox","aria-checked":e2(n)?"mixed":n,...o,ref:r,"data-state":e4(n),onSelect:(0,E.composeEventHandlers)(o.onSelect,()=>a?.(!!e2(n)||!n),{checkForDefaultPrevented:!1})})})});eL.displayName="MenuCheckboxItem";var eF="MenuRadioGroup",[eB,eO]=es(eF,{value:void 0,onValueChange:()=>{}}),e$=r.forwardRef((e,r)=>{let{value:n,onValueChange:a,...o}=e,l=(0,X.useCallbackRef)(a);return(0,t.jsx)(eB,{scope:e.__scopeMenu,value:n,onValueChange:l,children:(0,t.jsx)(eD,{...o,ref:r})})});e$.displayName=eF;var eH="MenuRadioItem",ez=r.forwardRef((e,r)=>{let{value:n,...a}=e,o=eO(eH,e.__scopeMenu),l=n===o.value;return(0,t.jsx)(eG,{scope:e.__scopeMenu,checked:l,children:(0,t.jsx)(eT,{role:"menuitemradio","aria-checked":l,...a,ref:r,"data-state":e4(l),onSelect:(0,E.composeEventHandlers)(a.onSelect,()=>o.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});ez.displayName=eH;var eq="MenuItemIndicator",[eG,eK]=es(eq,{checked:!1}),eV=r.forwardRef((e,r)=>{let{__scopeMenu:n,forceMount:a,...o}=e,l=eK(eq,n);return(0,t.jsx)(G.Presence,{present:a||e2(l.checked)||!0===l.checked,children:(0,t.jsx)(W.span,{...o,ref:r,"data-state":e4(l.checked)})})});eV.displayName=eq;var eU=r.forwardRef((e,r)=>{let{__scopeMenu:n,...a}=e;return(0,t.jsx)(W.div,{role:"separator","aria-orientation":"horizontal",...a,ref:r})});eU.displayName="MenuSeparator";var eW=r.forwardRef((e,r)=>{let{__scopeMenu:n,...a}=e,o=ed(n);return(0,t.jsx)(z.Arrow,{...o,...a,ref:r})});eW.displayName="MenuArrow";var[eZ,eX]=es("MenuSub"),eQ="MenuSubTrigger",eY=r.forwardRef((e,n)=>{let a=ef(eQ,e.__scopeMenu),o=em(eQ,e.__scopeMenu),l=eX(eQ,e.__scopeMenu),i=ek(eQ,e.__scopeMenu),s=r.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:d}=i,u={__scopeMenu:e.__scopeMenu},p=r.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return r.useEffect(()=>p,[p]),r.useEffect(()=>{let e=c.current;return()=>{window.clearTimeout(e),d(null)}},[c,d]),(0,t.jsx)(ex,{asChild:!0,...u,children:(0,t.jsx)(e_,{id:l.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":l.contentId,"data-state":e1(a.open),...e,ref:(0,M.composeRefs)(n,l.onTriggerChange),onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),a.open||a.onOpenChange(!0))},onPointerMove:(0,E.composeEventHandlers)(e.onPointerMove,e5(t=>{i.onItemEnter(t),!t.defaultPrevented&&(e.disabled||a.open||s.current||(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{a.onOpenChange(!0),p()},100)))})),onPointerLeave:(0,E.composeEventHandlers)(e.onPointerLeave,e5(e=>{p();let t=a.content?.getBoundingClientRect();if(t){let r=a.content?.dataset.side,n="right"===r,o=t[n?"left":"right"],l=t[n?"right":"left"];i.onPointerGraceIntentChange({area:[{x:e.clientX+(n?-5:5),y:e.clientY},{x:o,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:o,y:t.bottom}],side:r}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(e),e.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:(0,E.composeEventHandlers)(e.onKeyDown,t=>{let r=""!==i.searchRef.current;e.disabled||r&&" "===t.key||er[o.dir].includes(t.key)&&(a.onOpenChange(!0),a.content?.focus(),t.preventDefault())})})})});eY.displayName=eQ;var eJ="MenuSubContent",e0=r.forwardRef((e,n)=>{let a=ej(eb,e.__scopeMenu),{forceMount:o=a.forceMount,...l}=e,i=ef(eb,e.__scopeMenu),s=em(eb,e.__scopeMenu),c=eX(eJ,e.__scopeMenu),d=r.useRef(null),u=(0,M.useComposedRefs)(n,d);return(0,t.jsx)(eo.Provider,{scope:e.__scopeMenu,children:(0,t.jsx)(G.Presence,{present:o||i.open,children:(0,t.jsx)(eo.Slot,{scope:e.__scopeMenu,children:(0,t.jsx)(eM,{id:c.contentId,"aria-labelledby":c.triggerId,...l,ref:u,align:"start",side:"rtl"===s.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{s.isUsingKeyboardRef.current&&d.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:(0,E.composeEventHandlers)(e.onFocusOutside,e=>{e.target!==c.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:(0,E.composeEventHandlers)(e.onEscapeKeyDown,e=>{s.onClose(),e.preventDefault()}),onKeyDown:(0,E.composeEventHandlers)(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),r=en[s.dir].includes(e.key);t&&r&&(i.onOpenChange(!1),c.trigger?.focus(),e.preventDefault())})})})})})});function e1(e){return e?"open":"closed"}function e2(e){return"indeterminate"===e}function e4(e){return e2(e)?"indeterminate":e?"checked":"unchecked"}function e5(e){return t=>"mouse"===t.pointerType?e(t):void 0}e0.displayName=eJ;var e3="DropdownMenu",[e6,e8]=(0,D.createContextScope)(e3,[ec]),e7=ec(),[e9,te]=e6(e3),tt=e=>{let{__scopeDropdownMenu:n,children:a,dir:o,open:l,defaultOpen:i,onOpenChange:s,modal:c=!0}=e,d=e7(n),u=r.useRef(null),[p,f]=(0,P.useControllableState)({prop:l,defaultProp:i??!1,onChange:s,caller:e3});return(0,t.jsx)(e9,{scope:n,triggerId:(0,H.useId)(),triggerRef:u,contentId:(0,H.useId)(),open:p,onOpenChange:f,onOpenToggle:r.useCallback(()=>f(e=>!e),[f]),modal:c,children:(0,t.jsx)(eg,{...d,open:p,onOpenChange:f,dir:o,modal:c,children:a})})};tt.displayName=e3;var tr="DropdownMenuTrigger",tn=r.forwardRef((e,r)=>{let{__scopeDropdownMenu:n,disabled:a=!1,...o}=e,l=te(tr,n),i=e7(n);return(0,t.jsx)(ex,{asChild:!0,...i,children:(0,t.jsx)(_.button,{type:"button",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.contentId:void 0,"data-state":l.open?"open":"closed","data-disabled":a?"":void 0,disabled:a,...o,ref:(0,M.composeRefs)(r,l.triggerRef),onPointerDown:(0,E.composeEventHandlers)(e.onPointerDown,e=>{!a&&0===e.button&&!1===e.ctrlKey&&(l.onOpenToggle(),l.open||e.preventDefault())}),onKeyDown:(0,E.composeEventHandlers)(e.onKeyDown,e=>{!a&&(["Enter"," "].includes(e.key)&&l.onOpenToggle(),"ArrowDown"===e.key&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})});tn.displayName=tr;var ta=e=>{let{__scopeDropdownMenu:r,...n}=e,a=e7(r);return(0,t.jsx)(ew,{...a,...n})};ta.displayName="DropdownMenuPortal";var to="DropdownMenuContent",tl=r.forwardRef((e,n)=>{let{__scopeDropdownMenu:a,...o}=e,l=te(to,a),i=e7(a),s=r.useRef(!1);return(0,t.jsx)(eS,{id:l.contentId,"aria-labelledby":l.triggerId,...i,...o,ref:n,onCloseAutoFocus:(0,E.composeEventHandlers)(e.onCloseAutoFocus,e=>{s.current||l.triggerRef.current?.focus(),s.current=!1,e.preventDefault()}),onInteractOutside:(0,E.composeEventHandlers)(e.onInteractOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;(!l.modal||n)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});tl.displayName=to,r.forwardRef((e,r)=>{let{__scopeDropdownMenu:n,...a}=e,o=e7(n);return(0,t.jsx)(eD,{...o,...a,ref:r})}).displayName="DropdownMenuGroup";var ti=r.forwardRef((e,r)=>{let{__scopeDropdownMenu:n,...a}=e,o=e7(n);return(0,t.jsx)(eP,{...o,...a,ref:r})});ti.displayName="DropdownMenuLabel";var ts=r.forwardRef((e,r)=>{let{__scopeDropdownMenu:n,...a}=e,o=e7(n);return(0,t.jsx)(eT,{...o,...a,ref:r})});ts.displayName="DropdownMenuItem";var tc=r.forwardRef((e,r)=>{let{__scopeDropdownMenu:n,...a}=e,o=e7(n);return(0,t.jsx)(eL,{...o,...a,ref:r})});tc.displayName="DropdownMenuCheckboxItem",r.forwardRef((e,r)=>{let{__scopeDropdownMenu:n,...a}=e,o=e7(n);return(0,t.jsx)(e$,{...o,...a,ref:r})}).displayName="DropdownMenuRadioGroup";var td=r.forwardRef((e,r)=>{let{__scopeDropdownMenu:n,...a}=e,o=e7(n);return(0,t.jsx)(ez,{...o,...a,ref:r})});td.displayName="DropdownMenuRadioItem";var tu=r.forwardRef((e,r)=>{let{__scopeDropdownMenu:n,...a}=e,o=e7(n);return(0,t.jsx)(eV,{...o,...a,ref:r})});tu.displayName="DropdownMenuItemIndicator";var tp=r.forwardRef((e,r)=>{let{__scopeDropdownMenu:n,...a}=e,o=e7(n);return(0,t.jsx)(eU,{...o,...a,ref:r})});tp.displayName="DropdownMenuSeparator",r.forwardRef((e,r)=>{let{__scopeDropdownMenu:n,...a}=e,o=e7(n);return(0,t.jsx)(eW,{...o,...a,ref:r})}).displayName="DropdownMenuArrow";var tf=r.forwardRef((e,r)=>{let{__scopeDropdownMenu:n,...a}=e,o=e7(n);return(0,t.jsx)(eY,{...o,...a,ref:r})});tf.displayName="DropdownMenuSubTrigger";var th=r.forwardRef((e,r)=>{let{__scopeDropdownMenu:n,...a}=e,o=e7(n);return(0,t.jsx)(e0,{...o,...a,ref:r,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});th.displayName="DropdownMenuSubContent";var tm=e.i(43531),tg=e.i(63059);let tx=(0,m.default)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var tv=e.i(75157);r.forwardRef(({className:e,inset:r,children:n,...a},o)=>(0,t.jsxs)(tf,{ref:o,className:(0,tv.cn)("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",r&&"pl-8",e),...a,children:[n,(0,t.jsx)(tg.ChevronRight,{className:"ml-auto h-4 w-4"})]})).displayName=tf.displayName,r.forwardRef(({className:e,...r},n)=>(0,t.jsx)(th,{ref:n,className:(0,tv.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})).displayName=th.displayName;let ty=r.forwardRef(({className:e,sideOffset:r=4,...n},a)=>(0,t.jsx)(ta,{children:(0,t.jsx)(tl,{ref:a,sideOffset:r,className:(0,tv.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));ty.displayName=tl.displayName;let tj=r.forwardRef(({className:e,inset:r,...n},a)=>(0,t.jsx)(ts,{ref:a,className:(0,tv.cn)("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r&&"pl-8",e),...n}));tj.displayName=ts.displayName,r.forwardRef(({className:e,children:r,checked:n,...a},o)=>(0,t.jsxs)(tc,{ref:o,className:(0,tv.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...a,children:[(0,t.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,t.jsx)(tu,{children:(0,t.jsx)(tm.Check,{className:"h-4 w-4"})})}),r]})).displayName=tc.displayName,r.forwardRef(({className:e,children:r,...n},a)=>(0,t.jsxs)(td,{ref:a,className:(0,tv.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[(0,t.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,t.jsx)(tu,{children:(0,t.jsx)(tx,{className:"h-2 w-2 fill-current"})})}),r]})).displayName=td.displayName;let tw=r.forwardRef(({className:e,inset:r,...n},a)=>(0,t.jsx)(ti,{ref:a,className:(0,tv.cn)("px-2 py-1.5 text-sm font-semibold",r&&"pl-8",e),...n}));tw.displayName=ti.displayName;let tb=r.forwardRef(({className:e,...r},n)=>(0,t.jsx)(tp,{ref:n,className:(0,tv.cn)("-mx-1 my-1 h-px bg-muted",e),...r}));tb.displayName=tp.displayName;var tC=e.i(27612),tk=e.i(37727),tS=e.i(31278),tN=e.i(76639),tR=e.i(7364),tE=e.i(11445),tM=e.i(41931),tD=e.i(1276);function tP({ids:e}){let{t:n}=(0,R.useLanguage)(),[o,l]=(0,r.useState)(!1),[i,s]=(0,r.useState)(null),[d,u]=(0,r.useState)(!1),[p,f]=(0,r.useState)(null),[h,m]=(0,r.useState)(0),[g,x]=e,v=()=>{u(!0),s(null),f(null),m(e=>e+1)};return(0,r.useEffect)(()=>{if(!o||!g||!x)return;let e=!0;return tM.apiClient.post("/api/error-items/similarity",{ids:[g,x]}).then(t=>{e&&s(t)}).catch(t=>{e&&(f("Question text is required for similarity comparison"===t?.data?.message?n.questionSimilarity.missingText:n.questionSimilarity.failed),tD.frontendLogger.error("[Similarity]","相似度比较失败",{error:t instanceof Error?t.message:String(t)}))}).finally(()=>{e&&u(!1)}),()=>{e=!1}},[o,g,x,h,n.questionSimilarity.failed,n.questionSimilarity.missingText]),(0,t.jsxs)(tN.Dialog,{open:o,onOpenChange:e=>{l(e),e&&v()},children:[(0,t.jsx)(tN.DialogTrigger,{asChild:!0,children:(0,t.jsxs)(a.Button,{variant:"outline",disabled:2!==e.length,title:n.questionSimilarity.selectTwo,children:[(0,t.jsx)(C,{className:"mr-2 h-4 w-4"}),n.questionSimilarity.title]})}),(0,t.jsxs)(tN.DialogContent,{className:"w-[calc(100vw-2rem)] sm:max-w-3xl max-h-[85vh] overflow-y-auto",children:[(0,t.jsxs)(tN.DialogHeader,{children:[(0,t.jsx)(tN.DialogTitle,{children:n.questionSimilarity.title}),(0,t.jsx)(tN.DialogDescription,{children:n.questionSimilarity.description})]}),d&&(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm",role:"status",children:[(0,t.jsx)(tS.Loader2,{className:"h-4 w-4 animate-spin"}),n.common.loading]}),p&&(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:p}),p&&(0,t.jsx)(a.Button,{variant:"outline",onClick:v,children:n.questionSimilarity.retry}),i&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"space-y-2 rounded-lg bg-muted p-4",role:"status",children:[(0,t.jsx)("p",{className:"text-sm",children:n.questionSimilarity.score}),(0,t.jsxs)("p",{className:"text-3xl font-bold tabular-nums",children:[Number((100*i.similarity).toFixed(4)),"%"]}),(0,t.jsx)("p",{className:"text-sm",children:n.questionSimilarity.threshold.replace("{threshold}",String(i.threshold))}),(0,t.jsx)("p",{className:"text-sm font-medium",children:i.duplicate?n.questionSimilarity.duplicate:n.questionSimilarity.different})]}),(0,t.jsx)("div",{className:"grid gap-3 sm:grid-cols-2",children:i.items.map((e,r)=>(0,t.jsxs)("div",{className:"min-w-0 space-y-2 rounded-lg border p-3",children:[(0,t.jsxs)(c.default,{href:`/error-items/${e.id}`,className:"text-sm font-medium text-primary hover:underline",children:[n.questionSimilarity.question.replace("{index}",String(r+1))," · ",e.shortId||"-"]}),e.notebookName&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:e.notebookName}),(0,t.jsx)("div",{className:"max-h-56 overflow-auto text-sm",children:(0,t.jsx)(tE.MarkdownRenderer,{content:e.questionText})})]},e.id))})]}),(0,t.jsx)(tR.DuplicateThresholdSetting,{onSaved:v})]})]})}function tI({selectedIds:e,deleting:r,onCancel:n,onDelete:o}){let{t:l}=(0,R.useLanguage)();return(0,t.jsx)("div",{className:"pb-safe fixed bottom-0 left-0 right-0 z-50 border-t bg-card/95 p-4 shadow-lg backdrop-blur",children:(0,t.jsxs)("div",{className:"mx-auto flex max-w-6xl flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,t.jsxs)("div",{className:"space-y-1 text-sm text-muted-foreground",children:[(0,t.jsx)("p",{children:l.notebook.selectedCount.replace("{count}",String(e.length))}),(0,t.jsx)("p",{className:"text-xs",children:l.questionSimilarity.selectTwo})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(tP,{ids:e}),(0,t.jsxs)(a.Button,{variant:"outline",onClick:n,children:[(0,t.jsx)(tk.X,{className:"mr-2 h-4 w-4"}),l.notebook.cancelSelect]}),(0,t.jsxs)(a.Button,{variant:"destructive",onClick:o,disabled:0===e.length||r,children:[(0,t.jsx)(tC.Trash2,{className:"mr-2 h-4 w-4"}),l.notebook.deleteSelected]})]})]})})}var tA=e.i(69937),tT=e.i(67489),t_=e.i(52122);let tL={1:["一年级"],2:["二年级"],3:["三年级"],4:["四年级"],5:["五年级"],6:["六年级"],7:["七年级上","七年级下","七年级"],8:["八年级上","八年级下","八年级"],9:["九年级上","九年级下","九年级"],10:["高一上","高一下","高一"],11:["高二上","高二下","高二"],12:["高三上","高三下","高三"]};function tF({gradeSemester:e,tag:n,subjectName:a,onFilterChange:o,className:l}){let{t:i}=(0,R.useLanguage)(),{timeZone:s}=(0,S.useTimeZone)(),[c,d]=(0,r.useState)(e||""),[u,p]=(0,r.useState)(""),[f,h]=(0,r.useState)(n||""),[m,g]=(0,r.useState)([]),[x,v]=(0,r.useState)(!0),[y,j]=(0,r.useState)({}),[w,b]=(0,r.useState)([]);(0,r.useEffect)(()=>{void 0!==e&&d(e)},[e]),(0,r.useEffect)(()=>{void 0!==n&&h(n||"")},[n]);let C=(0,r.useCallback)((e,t)=>{let r=(0,N.getCalendarDate)(new Date,s),n=r.getFullYear(),a=(r.getMonth()+1>=9?n:n-1)-t+1;return"primary"===e?a:"junior_high"===e?a+6:"senior_high"===e?a+9:0},[s]),k=(0,r.useCallback)((e,t)=>{let r=[];return e?"primary"===e?r=[1,2,3,4,5,6]:"junior_high"===e?(r=[7,8,9],t&&C(e,t)>=10&&r.push(10,11,12)):r="senior_high"===e?[10,11,12]:[1,2,3,4,5,6,7,8,9,10,11,12]:r=[1,2,3,4,5,6,7,8,9,10,11,12],r.flatMap(e=>tL[e]||[])},[C]);(0,r.useEffect)(()=>{(async()=>{v(!0);try{let e=await tM.apiClient.get("/api/user");j(e);let t=k(e.educationStage,e.enrollmentYear);b(t);let r=a?(0,t_.inferSubjectFromName)(a):"math";try{let e=await tM.apiClient.get(`/api/tags?subject=${r}`);g(e.tags)}catch(e){console.warn(`Failed to fetch tags for subject ${r}`,e),g([])}}catch(e){console.error("Failed to load filter data:",e)}finally{v(!1)}})()},[a,k]);let E=m.find(e=>e.name===c),M=E?.children||[],D=M.find(e=>e.name===u),P=e=>0===e.children.length?[e.name]:e.children.flatMap(e=>P(e)),I=D?[...new Set(P(D))]:[],A=w.filter(e=>m.some(t=>t.name===e));return(0,t.jsxs)("div",{className:`flex gap-2 ${l}`,children:[(0,t.jsxs)(tT.Select,{value:c,onValueChange:e=>{d(e),p(""),h(""),o({gradeSemester:"all"===e?void 0:e,chapter:void 0,tag:void 0})},disabled:x,children:[(0,t.jsx)(tT.SelectTrigger,{className:"w-[140px]",children:(0,t.jsx)(tT.SelectValue,{placeholder:i.filter?.gradeShort||"Grade"})}),(0,t.jsxs)(tT.SelectContent,{children:[(0,t.jsx)(tT.SelectItem,{value:"all",children:i.filter?.allGrades||"All grades"}),A.map(e=>(0,t.jsx)(tT.SelectItem,{value:e,children:e},e))]})]}),(0,t.jsxs)(tT.Select,{value:u,onValueChange:e=>{p(e),h(""),o({gradeSemester:"all"===c?void 0:c,chapter:"all"===e?void 0:e,tag:void 0})},disabled:!c||"all"===c,children:[(0,t.jsx)(tT.SelectTrigger,{className:"w-[180px]",children:(0,t.jsx)(tT.SelectValue,{placeholder:i.filter?.chapter||"Chapter"})}),(0,t.jsxs)(tT.SelectContent,{children:[(0,t.jsx)(tT.SelectItem,{value:"all",children:i.filter?.allChapters||"All chapters"}),M.map(e=>(0,t.jsx)(tT.SelectItem,{value:e.name,children:e.name.replace(/^第\d+章\s*/,"")},e.id))]})]}),(0,t.jsxs)(tT.Select,{value:f,onValueChange:e=>{h(e),o({gradeSemester:"all"===c?void 0:c,chapter:"all"===u?void 0:u,tag:"all"===e?void 0:e})},disabled:!u||"all"===u,children:[(0,t.jsx)(tT.SelectTrigger,{className:"w-[140px]",children:(0,t.jsx)(tT.SelectValue,{placeholder:i.filter?.knowledgePoint||"Tag"})}),(0,t.jsxs)(tT.SelectContent,{children:[(0,t.jsx)(tT.SelectItem,{value:"all",children:i.filter?.allKnowledgePoints||"All tags"}),I.map(e=>(0,t.jsx)(tT.SelectItem,{value:e,children:e},e))]})]})]})}var tB=e.i(13059);let tO={}.hasOwnProperty,t$={}.hasOwnProperty;var tH=e.i(83664),tz=e.i(32066),tq=e.i(86281);let tG=[function(e,t,r,n){if("code"===t.type&&(0,tz.formatCodeAsIndented)(t,n)&&("list"===e.type||e.type===t.type&&(0,tz.formatCodeAsIndented)(e,n)))return!1;if("spread"in r&&"boolean"==typeof r.spread){if("paragraph"===e.type&&(e.type===t.type||"definition"===t.type||"heading"===t.type&&(0,tq.formatHeadingAsSetext)(t,n)))return;return+!!r.spread}}],tK=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],tV=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:"\n",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:tK},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:"(?:[\r\n]|$)"},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:tK},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:"(?:[ \r\n*])"},{character:"*",inConstruct:"phrasing",notInConstruct:tK},{atBreak:!0,character:"+",after:"(?:[ \r\n])"},{atBreak:!0,character:"-",after:"(?:[ \r\n-])"},{atBreak:!0,before:"\\d+",character:".",after:"(?:[ \r\n]|$)"},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:tK},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:tK},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:tK},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:tK},{atBreak:!0,character:"~"}];var tU=e.i(35198);function tW(e){return e.label||!e.identifier?e.label||"":(0,tU.decodeString)(e.identifier)}function tZ(e){if(!e._compiled){let t=(e.atBreak?"[\\r\\n][\\t ]*":"")+(e.before?"(?:"+e.before+")":"");e._compiled=RegExp((t?"("+t+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(e.character)?"\\":"")+e.character+(e.after?"(?:"+e.after+")":""),"g")}return e._compiled}var tX=e.i(77049);let tQ=/\r?\n|\r/g;function tY(e,t){let r,n=[],a=0,o=0;for(;r=tQ.exec(e);)l(e.slice(a,r.index)),n.push(r[0]),a=r.index+r[0].length,o++;return l(e.slice(a)),n.join("");function l(e){n.push(t(e,o,!e))}}var tJ=e.i(54751);function t0(e,t){return e-t}function t1(e,t){let r,n=/\\(?=[!-/:-@[-`{-~])/g,a=[],o=[],l=e+t,i=-1,s=0;for(;r=n.exec(l);)a.push(r.index);for(;++i<a.length;)s!==a[i]&&o.push(e.slice(s,a[i])),o.push("\\"),s=a[i];return o.push(e.slice(s)),o.join("")}function t2(e){let t=e||{},r=t.now||{},n=t.lineShift||0,a=r.line||1,o=r.column||1;return{move:function(e){let t=e||"",r=t.split(/\r?\n|\r/g),l=r[r.length-1];return a+=r.length-1,o=1===r.length?o+l.length:1+l.length+n,t},current:function(){return{now:{line:a,column:o},lineShift:n}},shift:function(e){n+=e}}}function t4(e){throw Error("Cannot handle value `"+e+"`, expected node")}function t5(e){throw Error("Cannot handle unknown node `"+e.type+"`")}function t3(e,t){if("definition"===e.type&&e.type===t.type)return 0}function t6(e,t){return function(e,t,r){let n,a=t.indexStack,o=e.children||[],l=[],i=-1,s=r.before;a.push(-1);let c=t.createTracker(r);for(;++i<o.length;){let d,u=o[i];if(a[a.length-1]=i,i+1<o.length){let r=t.handle.handlers[o[i+1].type];r&&r.peek&&(r=r.peek),d=r?r(o[i+1],e,t,{before:"",after:"",...c.current()}).charAt(0):""}else d=r.after;l.length>0&&("\r"===s||"\n"===s)&&"html"===u.type&&(l[l.length-1]=l[l.length-1].replace(/(\r?\n|\r)$/," "),s=" ",(c=t.createTracker(r)).move(l.join("")));let p=t.handle(u,e,t,{...c.current(),after:d,before:s});n&&n===p.slice(0,1)&&(p=(0,tX.encodeCharacterReference)(n.charCodeAt(0))+p.slice(1));let f=t.attentionEncodeSurroundingInfo;t.attentionEncodeSurroundingInfo=void 0,n=void 0,f&&(l.length>0&&f.before&&s===l[l.length-1].slice(-1)&&(l[l.length-1]=l[l.length-1].slice(0,-1)+(0,tX.encodeCharacterReference)(s.charCodeAt(0))),f.after&&(n=d)),c.move(p),l.push(p),s=p.slice(-1)}return a.pop(),l.join("")}(e,this,t)}function t8(e,t){return function(e,t,r){let n=t.indexStack,a=e.children||[],o=t.createTracker(r),l=[],i=-1;for(n.push(-1);++i<a.length;){let r=a[i];n[n.length-1]=i,l.push(o.move(t.handle(r,e,t,{before:"\n",after:"\n",...o.current()}))),"list"!==r.type&&(t.bulletLastUsed=void 0),i<a.length-1&&l.push(o.move(function(e,t,r,n){let a=n.join.length;for(;a--;){let o=n.join[a](e,t,r,n);if(!0===o||1===o)break;if("number"==typeof o)return"\n".repeat(1+o);if(!1===o)return"\n\n<!---->\n\n"}return"\n\n"}(r,a[i+1],e,t)))}return n.pop(),l.join("")}(e,this,t)}function t7(e,t){return function(e,t,r){let n=(r.before||"")+(t||"")+(r.after||""),a=[],o=[],l={},i=-1;for(;++i<e.unsafe.length;){let t,r=e.unsafe[i];if(!(0,tJ.patternInScope)(e.stack,r))continue;let o=e.compilePattern(r);for(;t=o.exec(n);){let e="before"in r||!!r.atBreak,n="after"in r,o=t.index+(e?t[1].length:0);a.includes(o)?(l[o].before&&!e&&(l[o].before=!1),l[o].after&&!n&&(l[o].after=!1)):(a.push(o),l[o]={before:e,after:n})}}a.sort(t0);let s=r.before?r.before.length:0,c=n.length-(r.after?r.after.length:0);for(i=-1;++i<a.length;){let e=a[i];!(e<s)&&!(e>=c)&&(!(e+1<c)||a[i+1]!==e+1||!l[e].after||l[e+1].before||l[e+1].after)&&(a[i-1]!==e-1||!l[e].before||l[e-1].before||l[e-1].after)&&(s!==e&&o.push(t1(n.slice(s,e),"\\")),s=e,!/[!-/:-@[-`{-~]/.test(n.charAt(e))||r.encode&&r.encode.includes(n.charAt(e))?(o.push((0,tX.encodeCharacterReference)(n.charCodeAt(e))),s++):o.push("\\"))}return o.push(t1(n.slice(s,c),r.after)),o.join("")}(this,e,t)}let t9=(0,e.i(75765).unified)().use(tB.default).use(function(e){let t=this;t.compiler=function(r){var n;let a,o;return n={...t.data("settings"),...e,extensions:t.data("toMarkdownExtensions")||[]},!function e(t,r){var n,a,o,l;let i,s=-1;if(r.extensions)for(;++s<r.extensions.length;)e(t,r.extensions[s]);for(i in r)if(t$.call(r,i))switch(i){case"extensions":break;case"unsafe":case"join":n=t[i],(a=r[i])&&n.push(...a);break;case"handlers":o=t[i],(l=r[i])&&Object.assign(o,l);break;default:t.options[i]=r[i]}return t}(a={associationId:tW,containerPhrasing:t6,containerFlow:t8,createTracker:t2,compilePattern:tZ,enter:function(e){return a.stack.push(e),function(){a.stack.pop()}},handlers:{...tH.handle},handle:void 0,indentLines:tY,indexStack:[],join:[...tG],options:{},safe:t7,stack:[],unsafe:[...tV]},n||{}),a.options.tightDefinitions&&a.join.push(t3),a.handle=function(e,t){let r=t||{};function n(t,...r){let a=n.invalid,o=n.handlers;if(t&&tO.call(t,e)){let r=String(t[e]);a=tO.call(o,r)?o[r]:n.unknown}if(a)return a.call(this,t,...r)}return n.handlers=r.handlers||{},n.invalid=r.invalid,n.unknown=r.unknown,n}("type",{invalid:t4,unknown:t5,handlers:a.handlers}),(o=a.handle(r,void 0,a,{before:"\n",after:"\n",now:{line:1,column:1},lineShift:0}))&&10!==o.charCodeAt(o.length-1)&&13!==o.charCodeAt(o.length-1)&&(o+="\n"),o}}).freeze(),re={blockquote:rl,break:function(){return{type:"text",value:"\n"}},code:ri,definition:ri,delete:rl,emphasis:rl,footnoteReference:ri,footnoteDefinition:ri,heading:function(e){return{type:"paragraph",children:e.children}},html:ri,image:ra,imageReference:ra,inlineCode:ro,list:rl,listItem:rl,link:rl,linkReference:rl,strong:rl,table:ri,tableCell:ri,text:ro,thematicBreak:ri,toml:ri,yaml:ri},rt={},rr=[];function rn(e){let t={...re},r=e||rt,n=r.keep||rr,a=r.remove||rr,o=-1;for(;++o<a.length;){let e=a[o];"string"==typeof e?t[e]=ri:t[e[0]]=e[1]}let l={};if(0===n.length)l=t;else{let e;for(e in t)n.includes(e)||(l[e]=t[e]);for(o=-1;++o<n.length;)if(!Object.hasOwn(t,e=n[o]))throw Error("Unknown node type `"+e+"` in `keep`, use a replace tuple with a handle instead: `remove: [['"+e+"', handle]]`")}return function(e){return i(e)};function i(e){let t=e.type,r=e;if(Object.hasOwn(l,t)){let e=l[t];e&&(r=e(r)||void 0)}return(r=Array.isArray(r)?s(r):r)&&"children"in r&&(r.children=s(r.children)),r}function s(e){let t=-1,r=[];for(;++t<e.length;){let n=i(e[t]);Array.isArray(n)?r.push(...s(n)):n&&r.push(n)}var n=r;let a,o=-1,l=[];for(;++o<n.length;){let e=n[o];a&&e.type===a.type&&"value"in e&&"value"in a?a.value+=e.value:(l.push(e),a=e)}return l}}function ra(e){let t="title"in e?e.title:"",r=e.alt||t||"";return r?{type:"text",value:r}:void 0}function ro(e){return{type:"text",value:e.value}}function rl(e){return e.children}function ri(){}let rs=(0,m.default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]),rc=(0,m.default)("chevrons-left",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]),rd=(0,m.default)("chevrons-right",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);var ru=e.i(69817);function rp({page:e,totalPages:r,onPageChange:n,total:o,pageSize:l}){let{t:i}=(0,R.useLanguage)();if(r<=1)return null;let s=e>1,c=e<r,d=(()=>{let t=[];if(r<=ru.MAX_VISIBLE_PAGES)for(let e=1;e<=r;e++)t.push(e);else{t.push(1),e>3&&t.push("ellipsis");let n=Math.max(2,e-1),a=Math.min(r-1,e+1);for(let e=n;e<=a;e++)t.push(e);e<r-2&&t.push("ellipsis"),t.push(r)}return t})();return(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 py-4",children:[void 0!==o&&void 0!==l&&(0,t.jsx)("div",{className:"text-sm text-muted-foreground order-2 sm:order-1",children:(i.pagination?.showing||"Showing {start}-{end} of {total}").replace("{start}",((e-1)*l+1).toString()).replace("{end}",Math.min(e*l,o).toString()).replace("{total}",o.toString())}),(0,t.jsxs)("div",{className:"flex items-center gap-1 order-1 sm:order-2",children:[(0,t.jsx)(a.Button,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>n(1),disabled:!s,title:i.pagination?.first||"First page",children:(0,t.jsx)(rc,{className:"h-4 w-4"})}),(0,t.jsx)(a.Button,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>n(e-1),disabled:!s,title:i.pagination?.prev||"Previous page",children:(0,t.jsx)(rs,{className:"h-4 w-4"})}),(0,t.jsx)("div",{className:"hidden sm:flex items-center gap-1",children:d.map((r,o)=>"ellipsis"===r?(0,t.jsx)("span",{className:"px-2 text-muted-foreground",children:"..."},`ellipsis-${o}`):(0,t.jsx)(a.Button,{variant:r===e?"default":"outline",size:"icon",className:"h-8 w-8",onClick:()=>n(r),children:r},r))}),(0,t.jsxs)("span",{className:"sm:hidden text-sm px-2",children:[e," / ",r]}),(0,t.jsx)(a.Button,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>n(e+1),disabled:!c,title:i.pagination?.next||"Next page",children:(0,t.jsx)(tg.ChevronRight,{className:"h-4 w-4"})}),(0,t.jsx)(a.Button,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>n(r),disabled:!c,title:i.pagination?.last||"Last page",children:(0,t.jsx)(rd,{className:"h-4 w-4"})})]})]})}var rf=e.i(62825),rh=e.i(47279),rm=e.i(33547),rg=e.i(94114);function rx({subjectId:e,subjectName:o}={}){let{timeZone:l}=(0,S.useTimeZone)(),[i,s]=(0,r.useState)([]),[m,E]=(0,r.useState)(!0),[M,D]=(0,r.useState)(""),[P,I]=(0,r.useState)("all"),[A,T]=(0,r.useState)("all"),[_,L]=(0,r.useState)(""),[F,B]=(0,r.useState)(""),[O,$]=(0,r.useState)("all"),[H,z]=(0,r.useState)(null),[q,G]=(0,r.useState)(new Set),[K,V]=(0,r.useState)(1),[U]=(0,r.useState)(ru.DEFAULT_PAGE_SIZE),[W,Z]=(0,r.useState)(0),[X,Q]=(0,r.useState)(0),[Y,J]=(0,r.useState)(!1),[ee,et]=(0,r.useState)(new Set),[er,en]=(0,r.useState)(!1),{t:ea,language:eo}=(0,R.useLanguage)(),el=(0,n.useRouter)(),ei=()=>{J(!Y),et(new Set)},es=async()=>{if(0===ee.size)return;let e=(ea.notebook?.confirmBatchDelete||"Delete {count} items?").replace("{count}",ee.size.toString());if(await (0,rg.confirmDialog)(e,{destructive:!0})){en(!0);try{await tM.apiClient.post("/api/error-items/batch-delete",{ids:Array.from(ee)}),rg.toast.success(ea.notebook?.batchDeleteSuccess||"Deleted successfully"),J(!1),et(new Set),ed()}catch(e){console.error(e),rg.toast.error(ea.common?.messages?.deleteFailed||"Delete failed")}finally{en(!1)}}},ec=(0,r.useRef)({search:M,masteryFilter:P,timeFilter:A,selectedTag:H,subjectId:e,gradeFilter:_,chapterFilter:F,paperLevelFilter:O});(0,r.useEffect)(()=>{let t=ec.current,r=t.search!==M||t.masteryFilter!==P||t.timeFilter!==A||t.selectedTag!==H||t.subjectId!==e||t.gradeFilter!==_||t.chapterFilter!==F||t.paperLevelFilter!==O;(ec.current={search:M,masteryFilter:P,timeFilter:A,selectedTag:H,subjectId:e,gradeFilter:_,chapterFilter:F,paperLevelFilter:O},r&&1!==K)?V(1):ed()},[K,M,P,A,H,e,_,F,O]);let ed=async()=>{E(!0);try{let t=new URLSearchParams;e&&t.append("subjectId",e),M&&t.append("query",M),"all"!==P&&t.append("mastery","mastered"===P?"1":"0"),"all"!==A&&t.append("timeRange",A),H&&t.append("tag",H),_&&t.append("gradeSemester",_),F&&t.append("chapter",F),"all"!==O&&t.append("paperLevel",O),t.append("page",K.toString()),t.append("pageSize",U.toString());let r=await tM.apiClient.get(`/api/error-items/list?${t.toString()}`);s(r.items),Z(r.total),Q(r.totalPages)}catch(e){console.error(e)}finally{E(!1)}};return(0,t.jsxs)("div",{className:`space-y-6 ${Y?"pb-40 sm:pb-24":""}`,children:[(0,t.jsxs)("div",{className:"flex flex-col gap-3 lg:flex-row",children:[(0,t.jsxs)("div",{className:"relative w-full lg:flex-1",children:[(0,t.jsx)(g,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(p.Input,{placeholder:ea.notebook.search,title:ea.shortId.searchHint,className:"h-10 rounded-xl bg-card pl-9",value:M,onChange:e=>D(e.target.value),onKeyDown:async e=>{let t=M.trim();if("Enter"!==e.key||!(0,rh.isShortId)(t))return;let r=await (0,rm.locateByShortId)(t);r&&el.push(`/error-items/${r}`)}})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsxs)(tt,{children:[(0,t.jsx)(tn,{asChild:!0,children:(0,t.jsxs)(a.Button,{variant:"outline",size:"sm",className:"h-10",children:[(0,t.jsx)(x,{className:"mr-2 h-4 w-4"}),ea.notebook.filter,(0,t.jsx)(j.ChevronDown,{className:"ml-2 h-4 w-4"})]})}),(0,t.jsxs)(ty,{align:"end",className:"w-48",children:[(0,t.jsx)(tw,{children:ea.filter.masteryStatus||"Mastery Status"}),(0,t.jsxs)(tj,{onClick:()=>I("all"),children:["all"===P&&"✓ ",ea.filter.all||"All"]}),(0,t.jsxs)(tj,{onClick:()=>I("unmastered"),children:["unmastered"===P&&"✓ ",ea.filter.review||"To Review"]}),(0,t.jsxs)(tj,{onClick:()=>I("mastered"),children:["mastered"===P&&"✓ ",ea.filter.mastered||"Mastered"]}),(0,t.jsx)(tb,{}),(0,t.jsx)(tw,{children:ea.filter.timeRange||"Time Range"}),(0,t.jsxs)(tj,{onClick:()=>T("all"),children:["all"===A&&"✓ ",ea.filter.allTime||"All Time"]}),(0,t.jsxs)(tj,{onClick:()=>T("week"),children:["week"===A&&"✓ ",ea.filter.lastWeek||"Last Week"]}),(0,t.jsxs)(tj,{onClick:()=>T("month"),children:["month"===A&&"✓ ",ea.filter.lastMonth||"Last Month"]})]})]}),(0,t.jsxs)(a.Button,{variant:"outline",size:"sm",className:"h-10",onClick:()=>{let t=new URLSearchParams;e&&t.append("subjectId",e),M&&t.append("query",M),"all"!==P&&t.append("mastery","mastered"===P?"1":"0"),"all"!==A&&t.append("timeRange",A),H&&t.append("tag",H),_&&t.append("gradeSemester",_),F&&t.append("chapter",F),"all"!==O&&t.append("paperLevel",O),el.push(`/print-preview?${t.toString()}`)},children:[(0,t.jsx)(w.Printer,{className:"mr-2 h-4 w-4"}),ea.notebook?.exportPrint||"导出打印"]}),!Y&&(0,t.jsxs)(a.Button,{variant:"outline",size:"sm",className:"h-10",onClick:ei,children:[(0,t.jsx)(C,{className:"mr-2 h-4 w-4"}),ea.questionSimilarity.title]}),(0,t.jsxs)(a.Button,{variant:Y?"secondary":"outline",size:"sm",className:"h-10",onClick:ei,children:[(0,t.jsx)(b.ListChecks,{className:"mr-2 h-4 w-4"}),Y?ea.notebook?.cancelSelect||"取消":ea.notebook?.selectMode||"多选"]})]})]}),(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row gap-4 items-stretch sm:items-center",children:[(0,t.jsx)("div",{className:"w-full sm:w-auto",children:(0,t.jsx)(tF,{gradeSemester:_,tag:H,onFilterChange:({gradeSemester:e,chapter:t,tag:r})=>{void 0!==e&&L(e),void 0!==t&&B(t),z(void 0===r?null:r),e?t||B(""):(L(""),B(""),z(null)),V(1)},subjectName:o})}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(a.Button,{variant:"all"===O?"default":"outline",size:"sm",className:"rounded-full",onClick:()=>$("all"),children:ea.filter.all||"All"}),(0,t.jsx)(a.Button,{variant:"a"===O?"default":"outline",size:"sm",className:"rounded-full",onClick:()=>$("a"),children:ea.editor.paperLevels?.a||"Paper A"}),(0,t.jsx)(a.Button,{variant:"b"===O?"default":"outline",size:"sm",className:"rounded-full",onClick:()=>$("b"),children:ea.editor.paperLevels?.b||"Paper B"}),(0,t.jsx)(a.Button,{variant:"other"===O?"default":"outline",size:"sm",className:"rounded-full",onClick:()=>$("other"),children:ea.editor.paperLevels?.other||"Other"})]})]}),H&&(0,t.jsxs)("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-lg",children:[(0,t.jsxs)("span",{className:"text-sm text-muted-foreground",children:[ea.filter.filteringByTag||"Filtering by tag",":"]}),(0,t.jsxs)(u.Badge,{variant:"secondary",className:"cursor-pointer",onClick:()=>z(null),children:[H,(0,t.jsx)("span",{className:"ml-1 text-xs",children:"×"})]})]}),!m&&0===i.length&&(0,t.jsx)(h.EmptyState,{icon:k,title:ea.notebook.emptyList,description:ea.notebook.emptyListHint}),m&&0===i.length&&(0,t.jsx)("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:Array.from({length:6},(e,r)=>(0,t.jsx)("div",{className:"h-44 animate-pulse rounded-2xl bg-muted"},r))}),(0,t.jsx)("div",{className:`grid gap-4 md:grid-cols-2 lg:grid-cols-3 transition-opacity ${m?"opacity-60":""}`,children:i.map(e=>{let r,n=[];if(e.tags&&e.tags.length>0)n=e.tags.map(e=>e.name);else try{n=JSON.parse(e.knowledgePoints||"[]")}catch{n=[]}return(0,t.jsxs)("div",{className:"relative animate-in fade-in duration-300",children:[Y&&(0,t.jsx)("div",{className:"absolute top-2 left-2 z-10",onClick:t=>{var r;return r=e.id,void(t.preventDefault(),t.stopPropagation(),et(e=>{let t=new Set(e);return t.has(r)?t.delete(r):t.add(r),t}))},children:(0,t.jsx)(f.Checkbox,{checked:ee.has(e.id),"aria-label":ea.questionSimilarity.selectQuestion.replace("{id}",e.shortId||e.id),className:"h-5 w-5 border-2 bg-background shadow-sm"})}),(0,t.jsx)(c.default,{href:Y?"#":`/error-items/${e.id}`,onClick:e=>Y&&e.preventDefault(),children:(0,t.jsxs)(d.Card,{className:`h-full cursor-pointer gap-2 rounded-2xl border-l-4 pt-4 transition-all hover:-translate-y-0.5 hover:shadow-md ${e.masteryLevel>0?"border-l-success/70":"border-l-warning/70"} ${Y&&ee.has(e.id)?"ring-2 ring-primary":"hover:border-primary/40"}`,children:[(0,t.jsx)(d.CardHeader,{className:"pb-0",children:(0,t.jsxs)("div",{className:`flex justify-between items-start ${Y?"pl-7":""}`,children:[(0,t.jsx)(u.Badge,{variant:"secondary",className:e.masteryLevel>0?"bg-success/15 text-success":"bg-warning/15 text-amber-700 dark:text-warning",children:e.masteryLevel>0?(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)(v.CheckCircle,{className:"h-3 w-3"})," ",ea.notebook.mastered]}):(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)(y.Clock,{className:"h-3 w-3"})," ",ea.notebook.review]})}),(0,t.jsxs)("span",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:["number"==typeof e.masteryProbability&&(0,t.jsxs)("span",{title:ea.mastery.probability,children:[Math.round(100*e.masteryProbability),"%"]}),e.shortId&&(0,t.jsx)("span",{className:"font-mono",children:e.shortId}),(0,N.formatDateTime)(e.createdAt,"MM/dd",l)]})]})}),(0,t.jsxs)(d.CardContent,{children:[(0,t.jsx)("div",{className:"text-sm line-clamp-3",children:(r=function(e){if(!e)return"";try{let t=e.replace(/\\_/g,"_"),r=t9().use(rn).processSync(t);return t=(t=String(r)).replace(/\\left/g,"").replace(/\\right/g,"").replace(/\\begin\{.*?\}/g,"").replace(/\\end\{.*?\}/g,"").replace(/\\text\{.*?\}/g,"").replace(/\\mbox\{.*?\}/g,"").replace(/\\frac\s*\{([^{}]+)\}\s*\{([^{}]+)\}/g,"$1/$2").replace(/\\sqrt\s*\{([^{}]+)\}/g,"√$1").replace(/\^\{([^{}]+)\}/g,"^$1").replace(/_\{([^{}]+)\}/g,"_$1").replace(/\\times/g,"×").replace(/\\div/g,"÷").replace(/\\cdot/g,"·").replace(/\\le/g,"≤").replace(/\\ge/g,"≥").replace(/\\neq/g,"≠").replace(/\\approx/g,"≈").replace(/\\pm/g,"±").replace(/\\infty/g,"∞").replace(/\\circ/g,"°").replace(/\\triangle/g,"△").replace(/\\angle/g,"∠").replace(/\\because/g,"∵").replace(/\\therefore/g,"∴").replace(/\$/g,"").replace(/\\/g,"").trim()}catch(t){return console.error("Failed to strip markdown:",t),e}}((e.questionText||"").split("\n\n")[0])).length>80?r.substring(0,80)+"...":r}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-3",children:[(0,t.jsx)(u.Badge,{variant:"secondary",className:"text-xs",children:(0,rf.getMistakeStatusLabel)(e.mistakeStatus,eo)}),(0,t.jsx)(tA.DifficultyStars,{value:e.difficultyStars,showUnrated:!1})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 mt-3",children:[(q.has(e.id)?n:n.slice(0,3)).map(e=>(0,t.jsx)(u.Badge,{variant:H===e?"default":"outline",className:"text-xs cursor-pointer hover:bg-primary/10 transition-colors",onClick:t=>{t.preventDefault(),z(H===e?null:e)},children:e},e)),n.length>3&&(0,t.jsx)(u.Badge,{variant:"secondary",className:"text-xs cursor-pointer hover:bg-secondary/80 transition-colors",title:q.has(e.id)?ea.notebooks?.collapseTagsTooltip||"Click to collapse":(ea.notebooks?.expandTagsTooltip||"Click to expand {count} tags").replace("{count}",(n.length-3).toString()),onClick:t=>{var r;return r=e.id,void(t.preventDefault(),t.stopPropagation(),G(e=>{let t=new Set(e);return t.has(r)?t.delete(r):t.add(r),t}))},children:q.has(e.id)?(0,t.jsx)(t.Fragment,{children:ea.notebooks?.collapseTags||"Collapse"}):(0,t.jsx)(t.Fragment,{children:(ea.notebooks?.expandTags||"+{count} more").replace("{count}",(n.length-3).toString())})})]})]})]})})]},e.id)})}),(0,t.jsx)(rp,{page:K,totalPages:X,total:W,pageSize:U,onPageChange:V}),Y&&(0,t.jsx)(tI,{selectedIds:[...ee],deleting:er,onCancel:ei,onDelete:es})]})}var rv=e.i(67153),ry=e.i(83086);function rj({notebookId:e,onFinished:n}){let{t:o}=(0,R.useLanguage)(),[l,i]=(0,r.useState)(null),[s,c]=(0,r.useState)(null),d=(0,r.useRef)(!1),u=(0,r.useCallback)(()=>{tM.apiClient.get(`/api/notebooks/${e}/retag`).then(e=>{d.current&&e&&!e.running&&n?.(),d.current=!!e?.running,i(e)}).catch(()=>void 0)},[e,n]);(0,r.useEffect)(u,[u]),(0,r.useEffect)(()=>{if(!l?.running)return;let e=setTimeout(u,2e3);return()=>clearTimeout(e)},[l,u]);let p=async()=>{if(await (0,rg.confirmDialog)(o.retag.notebookConfirm)){c(null);try{let t=await tM.apiClient.post(`/api/notebooks/${e}/retag`,{});if(0===t.total)return void c(o.retag.empty);d.current=t.running,i(t)}catch{c(o.retag.itemFailed)}}},f=s??(l?.running?o.retag.progress.replace("{done}",String(l.done)).replace("{total}",String(l.total)):l?.finishedAt&&l.total>0?o.retag.finished.replace("{success}",String(l.total-l.failed)).replace("{failed}",String(l.failed)):null);return(0,t.jsxs)("div",{className:"flex flex-col items-start sm:items-end gap-1",children:[(0,t.jsxs)(a.Button,{variant:"outline",size:"sm",onClick:p,disabled:l?.running,"aria-label":o.retag.notebookButton,children:[l?.running?(0,t.jsx)(tS.Loader2,{className:"h-4 w-4 animate-spin sm:mr-2"}):(0,t.jsx)(ry.Sparkles,{className:"h-4 w-4 sm:mr-2"}),(0,t.jsx)("span",{className:"hidden sm:inline",children:o.retag.notebookButton})]}),f&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:f})]})}var rw=e.i(9830),rb=e.i(35209);e.s(["default",0,function(){let e=(0,n.useParams)(),d=(0,n.useRouter)(),{t:u}=(0,R.useLanguage)(),[p,f]=(0,r.useState)(null);(0,rb.usePageTitle)(u.notebooks.title,p?.name);let[h,m]=(0,r.useState)(!0),[g,x]=(0,r.useState)(!1),[v,y]=(0,r.useState)(0);(0,r.useEffect)(()=>{e.id&&j(e.id)},[e.id]);let j=async e=>{try{let t=await tM.apiClient.get(`/api/notebooks/${e}`);f(t)}catch(e){console.error("Failed to fetch notebook:",e),rg.toast.error(u.notebooks?.notFound||"Notebook not found"),d.push("/notebooks")}finally{m(!1)}},w=async e=>{p&&f(await tM.apiClient.put(`/api/notebooks/${p.id}`,{name:e}))};return h?(0,t.jsx)(l.PageLoading,{label:u.common.loading}):p?(0,t.jsx)("main",{className:"mx-auto min-h-screen max-w-6xl px-4 py-6 md:px-8 md:py-8",children:(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)(o.PageHeader,{backHref:"/notebooks",title:p.name,titleAddon:(0,t.jsx)(a.Button,{variant:"ghost",size:"icon-sm",className:"shrink-0 text-muted-foreground",onClick:()=>x(!0),title:u.notebooks?.rename||"Rename",children:(0,t.jsx)(s.Pencil,{className:"h-4 w-4"})}),description:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(rw.NotebookScopeLabel,{notebook:p})," · ",(u.notebooks?.totalErrors||"Total {count} errors").replace("{count}",(p._count?.errorItems||0).toString())]}),actions:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(rj,{notebookId:p.id,onFinished:()=>y(e=>e+1)}),(0,t.jsx)(c.default,{href:`/notebooks/${p.id}/add`,children:(0,t.jsxs)(a.Button,{"aria-label":u.notebooks?.addError||"Add Error",children:[(0,t.jsx)(i.Plus,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"hidden sm:inline",children:u.notebooks?.addError||"Add Error"})]})})]})}),(0,t.jsx)(rx,{subjectId:p.id,subjectName:p.name},v),(0,t.jsx)(rv.RenameNotebookDialog,{open:g,onOpenChange:x,currentName:p.name,onRename:w})]})}):null}],98591)}]);
|