wrong-notebook 2026.11.11 → 2026.11.12-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +1 -0
- package/.next/build-manifest.json +3 -3
- package/.next/prerender-manifest.json +3 -3
- package/.next/routes-manifest.json +8 -0
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/admin/page.js.nft.json +1 -1
- package/.next/server/app/admin/page_client-reference-manifest.js +1 -1
- package/.next/server/app/admin/user/[id]/page.js.nft.json +1 -1
- package/.next/server/app/admin/user/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/api/admin/cnm-tags/route.js +2 -2
- package/.next/server/app/api/admin/cnm-tags/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/dashboard/route.js +17 -17
- package/.next/server/app/api/admin/dashboard/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/debug-logs/export/route.js +2 -2
- package/.next/server/app/api/admin/debug-logs/export/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/debug-logs/route.js +2 -2
- package/.next/server/app/api/admin/debug-logs/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/eula/accept/route.js +2 -2
- package/.next/server/app/api/admin/eula/accept/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/migrate-tags/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/system-reset/route.js +2 -2
- package/.next/server/app/api/admin/system-reset/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/telemetry/route.js +2 -2
- package/.next/server/app/api/admin/telemetry/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/users/[id]/detail/route.js +17 -17
- package/.next/server/app/api/admin/users/[id]/detail/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/users/[id]/route.js +2 -2
- package/.next/server/app/api/admin/users/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/users/route.js +2 -2
- package/.next/server/app/api/admin/users/route.js.nft.json +1 -1
- package/.next/server/app/api/ai/models/route.js +9 -9
- package/.next/server/app/api/ai/models/route.js.nft.json +1 -1
- package/.next/server/app/api/ai/test/route.js +12 -12
- package/.next/server/app/api/ai/test/route.js.nft.json +1 -1
- package/.next/server/app/api/analytics/route.js +18 -18
- package/.next/server/app/api/analytics/route.js.nft.json +1 -1
- package/.next/server/app/api/analyze/route.js +20 -20
- package/.next/server/app/api/analyze/route.js.nft.json +1 -1
- package/.next/server/app/api/auth/[...nextauth]/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/delete/route.js +2 -2
- package/.next/server/app/api/error-items/[id]/delete/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/figure/route.js +13 -13
- 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 +15 -15
- 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 +17 -17
- package/.next/server/app/api/error-items/[id]/geogebra/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/image/route.js +2 -2
- package/.next/server/app/api/error-items/[id]/image/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/notes/route.js +2 -2
- package/.next/server/app/api/error-items/[id]/notes/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/practice-records/route.js +2 -2
- package/.next/server/app/api/error-items/[id]/practice-records/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/reanswer/route.js +19 -19
- 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 +21 -21
- package/.next/server/app/api/error-items/[id]/retag/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/route.js +2 -2
- package/.next/server/app/api/error-items/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/svg-animation/narration/route.js +17 -17
- package/.next/server/app/api/error-items/[id]/svg-animation/narration/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/svg-animation/route.js +17 -17
- package/.next/server/app/api/error-items/[id]/svg-animation/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/answer-space/route.js +2 -2
- package/.next/server/app/api/error-items/answer-space/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/batch-delete/route.js +2 -2
- package/.next/server/app/api/error-items/batch-delete/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/batch-move/route.js +2 -2
- package/.next/server/app/api/error-items/batch-move/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/clear/route.js +2 -2
- package/.next/server/app/api/error-items/clear/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/export-questions/route.js +6 -6
- package/.next/server/app/api/error-items/export-questions/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/list/route.js +2 -2
- package/.next/server/app/api/error-items/list/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/route.js +20 -20
- package/.next/server/app/api/error-items/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/short/[shortId]/route.js +2 -2
- package/.next/server/app/api/error-items/short/[shortId]/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/similarity/route.js +2 -2
- package/.next/server/app/api/error-items/similarity/route.js.nft.json +1 -1
- package/.next/server/app/api/eula/status/route.js +2 -2
- package/.next/server/app/api/eula/status/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/questions/[questionId]/regenerate/route.js +18 -18
- 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 +16 -16
- package/.next/server/app/api/exams/[id]/results/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/retry/route.js +15 -15
- package/.next/server/app/api/exams/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/route.js +20 -20
- package/.next/server/app/api/exams/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/route.js +14 -14
- package/.next/server/app/api/exams/route.js.nft.json +1 -1
- package/.next/server/app/api/export/route.js +10 -9
- package/.next/server/app/api/export/route.js.nft.json +1 -1
- package/.next/server/app/api/geogebra-analyze/route.js +14 -14
- package/.next/server/app/api/geogebra-analyze/route.js.nft.json +1 -1
- package/.next/server/app/api/health/route.js.nft.json +1 -1
- package/.next/server/app/api/import/route.js +17 -17
- package/.next/server/app/api/import/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/confirm-all/route.js +24 -24
- package/.next/server/app/api/import-batches/[id]/confirm-all/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/fix-text/route.js +17 -17
- package/.next/server/app/api/import-batches/[id]/fix-text/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/read/route.js +22 -22
- package/.next/server/app/api/import-batches/[id]/read/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/retry/route.js +24 -24
- package/.next/server/app/api/import-batches/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/route.js +22 -22
- package/.next/server/app/api/import-batches/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/start/route.js +22 -22
- package/.next/server/app/api/import-batches/[id]/start/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/route.js +22 -22
- package/.next/server/app/api/import-batches/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/confirm/route.js +20 -20
- package/.next/server/app/api/import-tasks/[id]/confirm/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/figure/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/import-tasks/[id]/figure/route/build-manifest.json +12 -0
- package/.next/server/app/api/import-tasks/[id]/figure/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/import-tasks/[id]/figure/route.js +38 -0
- package/.next/server/app/api/import-tasks/[id]/figure/route.js.map +5 -0
- package/.next/server/app/api/import-tasks/[id]/figure/route.js.nft.json +1 -0
- package/.next/server/app/api/import-tasks/[id]/figure/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/import-tasks/[id]/read/route.js +20 -20
- package/.next/server/app/api/import-tasks/[id]/read/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/retry/route.js +19 -19
- package/.next/server/app/api/import-tasks/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/route.js +20 -20
- package/.next/server/app/api/import-tasks/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/route.js +22 -22
- package/.next/server/app/api/import-tasks/route.js.nft.json +1 -1
- package/.next/server/app/api/initialize/route.js +2 -2
- package/.next/server/app/api/initialize/route.js.nft.json +1 -1
- package/.next/server/app/api/logs/frontend/route.js +2 -2
- package/.next/server/app/api/logs/frontend/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/route.js +20 -20
- package/.next/server/app/api/mcp/route.js.nft.json +1 -1
- package/.next/server/app/api/minimax-code/checkin/route.js +2 -2
- package/.next/server/app/api/minimax-code/checkin/route.js.nft.json +1 -1
- package/.next/server/app/api/minimax-code/login/route.js +2 -2
- package/.next/server/app/api/minimax-code/login/route.js.nft.json +1 -1
- package/.next/server/app/api/minimax-code/route.js +2 -2
- package/.next/server/app/api/minimax-code/route.js.nft.json +1 -1
- package/.next/server/app/api/notebooks/[id]/retag/route.js +18 -18
- package/.next/server/app/api/notebooks/[id]/retag/route.js.nft.json +1 -1
- package/.next/server/app/api/notebooks/[id]/route.js +2 -2
- package/.next/server/app/api/notebooks/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/notebooks/route.js +2 -2
- package/.next/server/app/api/notebooks/route.js.nft.json +1 -1
- package/.next/server/app/api/openclaw/batch-upload/route.js +15 -15
- package/.next/server/app/api/openclaw/batch-upload/route.js.nft.json +1 -1
- package/.next/server/app/api/paper-groups/[id]/route.js +2 -2
- package/.next/server/app/api/paper-groups/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/paper-groups/route.js +2 -2
- package/.next/server/app/api/paper-groups/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/generate/route.js +19 -19
- package/.next/server/app/api/practice/generate/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/grade/route.js +13 -13
- package/.next/server/app/api/practice/grade/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/record/[id]/route.js +12 -12
- package/.next/server/app/api/practice/record/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/record/route.js +12 -12
- package/.next/server/app/api/practice/record/route.js.nft.json +1 -1
- package/.next/server/app/api/question-banks/[id]/questions/[qid]/route.js +19 -19
- package/.next/server/app/api/question-banks/[id]/questions/[qid]/route.js.nft.json +1 -1
- package/.next/server/app/api/question-banks/[id]/route.js +2 -2
- package/.next/server/app/api/question-banks/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/question-banks/route.js +15 -15
- package/.next/server/app/api/question-banks/route.js.nft.json +1 -1
- package/.next/server/app/api/reanswer/route.js +15 -15
- package/.next/server/app/api/reanswer/route.js.nft.json +1 -1
- package/.next/server/app/api/register/route.js +2 -2
- 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/requests/[id]/route.js +2 -2
- package/.next/server/app/api/requests/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/review/due/route.js +16 -16
- package/.next/server/app/api/review/due/route.js.nft.json +1 -1
- package/.next/server/app/api/settings/route.js +2 -2
- package/.next/server/app/api/settings/route.js.nft.json +1 -1
- package/.next/server/app/api/setup/route.js +2 -2
- package/.next/server/app/api/setup/route.js.nft.json +1 -1
- package/.next/server/app/api/stats/activity/route.js +2 -2
- package/.next/server/app/api/stats/activity/route.js.nft.json +1 -1
- package/.next/server/app/api/stats/practice/clear/route.js +2 -2
- package/.next/server/app/api/stats/practice/clear/route.js.nft.json +1 -1
- package/.next/server/app/api/stats/practice/route.js +2 -2
- package/.next/server/app/api/stats/practice/route.js.nft.json +1 -1
- package/.next/server/app/api/stats/repeated-mistakes/route.js +14 -14
- package/.next/server/app/api/stats/repeated-mistakes/route.js.nft.json +1 -1
- package/.next/server/app/api/stats/weak-tags/route.js +17 -17
- package/.next/server/app/api/stats/weak-tags/route.js.nft.json +1 -1
- package/.next/server/app/api/tags/route.js +2 -2
- package/.next/server/app/api/tags/route.js.nft.json +1 -1
- package/.next/server/app/api/tags/stats/route.js +2 -2
- package/.next/server/app/api/tags/stats/route.js.nft.json +1 -1
- package/.next/server/app/api/tags/suggestions/route.js.nft.json +1 -1
- package/.next/server/app/api/tasks/route.js +2 -2
- package/.next/server/app/api/tasks/route.js.nft.json +1 -1
- package/.next/server/app/api/telemetry/route.js +2 -2
- package/.next/server/app/api/telemetry/route.js.nft.json +1 -1
- package/.next/server/app/api/tts/[id]/route.js +10 -9
- package/.next/server/app/api/tts/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/tts/batch/route.js +10 -10
- package/.next/server/app/api/tts/batch/route.js.nft.json +1 -1
- package/.next/server/app/api/tts/route.js +12 -12
- package/.next/server/app/api/tts/route.js.nft.json +1 -1
- package/.next/server/app/api/tts/status/route.js +11 -10
- package/.next/server/app/api/tts/status/route.js.nft.json +1 -1
- package/.next/server/app/api/user/ai-consent/route.js +2 -2
- package/.next/server/app/api/user/ai-consent/route.js.nft.json +1 -1
- package/.next/server/app/api/user/route.js +17 -17
- package/.next/server/app/api/user/route.js.nft.json +1 -1
- package/.next/server/app/api/version/route.js.nft.json +1 -1
- package/.next/server/app/banks/page.js.nft.json +1 -1
- package/.next/server/app/banks/page_client-reference-manifest.js +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/eula/page.js.nft.json +1 -1
- package/.next/server/app/eula/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/import-batches/[id]/page.js.nft.json +1 -1
- package/.next/server/app/import-batches/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/import-tasks/[id]/page.js.nft.json +1 -1
- package/.next/server/app/import-tasks/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/import-tasks/page.js.nft.json +1 -1
- package/.next/server/app/import-tasks/page_client-reference-manifest.js +1 -1
- package/.next/server/app/initialize/page.js.nft.json +1 -1
- package/.next/server/app/initialize/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login/page.js.nft.json +1 -1
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/notebooks/[id]/add/page.js.nft.json +1 -1
- package/.next/server/app/notebooks/[id]/add/page_client-reference-manifest.js +1 -1
- package/.next/server/app/notebooks/[id]/page.js.nft.json +1 -1
- package/.next/server/app/notebooks/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/notebooks/page.js.nft.json +1 -1
- package/.next/server/app/notebooks/page_client-reference-manifest.js +1 -1
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/practice/page.js.nft.json +1 -1
- package/.next/server/app/practice/page_client-reference-manifest.js +1 -1
- package/.next/server/app/print-preview/page.js.nft.json +1 -1
- package/.next/server/app/print-preview/page_client-reference-manifest.js +1 -1
- package/.next/server/app/register/page.js.nft.json +1 -1
- package/.next/server/app/register/page_client-reference-manifest.js +1 -1
- package/.next/server/app/review/page.js.nft.json +1 -1
- package/.next/server/app/review/page_client-reference-manifest.js +1 -1
- package/.next/server/app/setup/page.js.nft.json +1 -1
- package/.next/server/app/setup/page_client-reference-manifest.js +1 -1
- package/.next/server/app/stats/page.js.nft.json +1 -1
- package/.next/server/app/stats/page_client-reference-manifest.js +1 -1
- package/.next/server/app/tags/page.js.nft.json +1 -1
- package/.next/server/app/tags/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +1 -0
- package/.next/server/chunks/1oeh_server_app_api_import-tasks_[id]_figure_route_actions_07t3sxicgrvqr.js +3 -0
- package/.next/server/chunks/[externals]_sharp_1oez0x5rqseka._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__07dbynh_bs54x._.js → [root-of-the-server]__0-r2vceyjczka._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__00hfrpu611kxz._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__013623_984_wi._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__0095ttqaxkura._.js → [root-of-the-server]__01jyhq0v_cplw._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__00gh00nfppv7c._.js → [root-of-the-server]__01s81h4r_wr7k._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__01y74y1sbftpl._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__04k-j5q4c3fxh._.js → [root-of-the-server]__02h788neoqam-._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__04g1e8vi5hfmd._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__05atxd5g005-v._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__05uvm20_ghlnt._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__0lrgjyg38b9j1._.js → [root-of-the-server]__05zjk4mg9o5bv._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__003zs5cdrhp0h._.js → [root-of-the-server]__06-rcig4c1yoi._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__062hvv8ak-oyy._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0641i4sk5le-6._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__0afxho639gukq._.js → [root-of-the-server]__07wwsmnm6c7tk._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__089m-6oa-1kno._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0967yqvt09vz7._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0a_ecneq0n2b5._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0akyh53zxosbo._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0brk57wvbcfpl._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0cii6-t-ut8rq._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0dcdxupilu8ps._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__0clg30mkk8i71._.js → [root-of-the-server]__0djdn_u8nx3u7._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__0gj0qch0bepug._.js → [root-of-the-server]__0dnuv-9lcdxy8._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__0eey2k4ofnktm._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0evv12a34qcy6._.js +4 -4
- package/.next/server/chunks/[root-of-the-server]__0f5q7s0be5giy._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__0nmxuavodh1jp._.js → [root-of-the-server]__0g488rb67hy0-._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__0gthpb6naqjok._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0gzv8vk-d9emt._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__06g_4_o5xkej2._.js → [root-of-the-server]__0h6pglkyy2x3q._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__0h847w3u8eb36._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0hez9_c-ql0l9._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__06zr2kkbkdddm._.js → [root-of-the-server]__0hvn2l27vwx0v._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__0j1zb5bzw2xv8._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0jjzw3cvnav4v._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__1qh6ja_35h8e9._.js → [root-of-the-server]__0jzs_wjt-0rfc._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__0k9j7fqmb4exm._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0kp13lo3ui21-._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0l_-7s2on-68u._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0lgvndry1slzy._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0llcnfms-yrs4._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0nhx-q7q39svl._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0o7_7cyj3bn7f._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0o_r0mba36419._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0pocdr1ee9wrc._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0qzdou15f0nqi._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0r0zkh318us2a._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0rc-e3e9tdpd8._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0rfhyd4wlbfsr._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0rn3n8kt44idx._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0rp9uv98dzbks._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0rppsy2asakww._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0rrg8wylziciz._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0sr8vnpwvch60._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0svu2z4tuq3gc._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0t_lgrjb84q9r._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0uamrne8reway._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__0re-_v5h69w84._.js → [root-of-the-server]__0vf9vw20h61ti._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__0vmrcy5nfzxfa._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0wdh-wbumllhk._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0wy320i-uiwbo._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0xb185_p8aooa._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0xejmebuz3k8i._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0xo-zdn9rs3o8._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0xrbxtd_3u4sa._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__0eu-sj70e2vc_._.js → [root-of-the-server]__0xwmebw7zp9tt._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__0yrlrh1p4cec7._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0yrpuslw7wzra._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0zamz3etpuhq4._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__10ql7etwm_88-._.js → [root-of-the-server]__1-wk5ean1w4p1._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__0i0wx-z-qadeh._.js → [root-of-the-server]__11rmrrnyv5b4p._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__12u3l0tebwh50._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__15iidg73pqdyw._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__16vgkd1nbih47._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__178zx6aeday20._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__18rq0m4-obnu5._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__19_kfpiw060ww._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1_3nn0g7kp6bt._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1a46lw8uo36i5._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1assq-8cgzn69._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1bbtj9n-_vgqf._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__1c7b35-fdxgfn._.js → [root-of-the-server]__1buxopu3mpdl0._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__1c4k2j-vj_c4w._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1c_v_a0qajr1b._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1cvo0cuc69r5x._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1e8_j43j1t1m3._.js +4 -4
- package/.next/server/chunks/[root-of-the-server]__1ekfctwwvxhhx._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1fndyj3k-9qht._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1goozrpjh5dhf._.js +1 -1
- package/.next/server/chunks/{[root-of-the-server]__074shufbnm6ni._.js → [root-of-the-server]__1hesgf_s-d142._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__1i9p9-997567t._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1il8wpv38s2q1._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1itwjaosu_pc4._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1k0dtosqlnvel._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1k67g4w53li1h._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1kjyafxshmutx._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1kucx2jgzzdfv._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1l63lc79i6lzk._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1lu98yoyk9xgv._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1mg93bb--5j6n._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1mudwm3o1ce5v._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1nflmic-zdbs7._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1oh9gjy8j_p0p._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1owyqp175q-5j._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1polyx47npwja._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1q6q9n_tozwzv._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1qmbbudn1-e1n._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1sbck_cb7he3n._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__1ttyfy9dd2omo._.js → [root-of-the-server]__1u_tog_9ppp6g._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__1ujkugqt8idce._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1ukyh4_c7az0t._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1uvva2pl7fdcg._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1uxgz59p3wbmp._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1uzikfdr7_qck._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1vjgmkf6i-x1b._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1vonc1_0_mxxe._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1w9y_vm2scbhn._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1whbzt_ur5lvt._.js +3 -0
- package/.next/server/chunks/_0-b-yoyb6zjkc._.js +3 -0
- package/.next/server/chunks/{_17dkyjg1d51kw._.js → _04_gplm_vpnmc._.js} +1 -1
- package/.next/server/chunks/{_101n94i9f9jx_._.js → _095yf3i01g28p._.js} +1 -1
- package/.next/server/chunks/{_0b6eoc8pstjna._.js → _0dhbpyuf83y2o._.js} +1 -1
- package/.next/server/chunks/_0dnxlicg7tx6u._.js +3 -0
- package/.next/server/chunks/_0dx_p2ysozhgf._.js +841 -0
- package/.next/server/chunks/{_0vidw039o5x0k._.js → _0i1c91qa8oj31._.js} +1 -1
- package/.next/server/chunks/{_0xlf42pjv7whr._.js → _0jb5ab0xc3c7y._.js} +1 -1
- package/.next/server/chunks/{_1beds3k7qxfby._.js → _0jm058p_78ekx._.js} +1 -1
- package/.next/server/chunks/{_1wdbh7n2egysd._.js → _0ogiiv8sxw73u._.js} +1 -1
- package/.next/server/chunks/_0pwgjewofdq3e._.js +841 -0
- package/.next/server/chunks/{_1-nifxdtdpf_3._.js → _0s-6w2kg279kq._.js} +1 -1
- package/.next/server/chunks/{_1efoql5qkyxx7._.js → _0sc_5yy08ea6p._.js} +1 -1
- package/.next/server/chunks/_0tqcx59z8zd0h._.js +841 -0
- package/.next/server/chunks/{_10iqdc8-yics0._.js → _0ulpt4wfpigjk._.js} +1 -1
- package/.next/server/chunks/{_00uecgrfe4u3v._.js → _113pyiw74ak3j._.js} +1 -1
- package/.next/server/chunks/_17zw8m241gfs3._.js +1 -1
- package/.next/server/chunks/{_1t19v24mb3ia0._.js → _1956v4ld1ovus._.js} +1 -1
- package/.next/server/chunks/{_1feimqjhlznj8._.js → _19x-7yu46vx3k._.js} +1 -1
- package/.next/server/chunks/_1a0msd7dpzbda._.js +3 -0
- package/.next/server/chunks/_1cfply45lnr-v._.js +3 -0
- package/.next/server/chunks/_1eqnx6dcz6a03._.js +4 -4
- package/.next/server/chunks/{_08znit_7g_ij-._.js → _1lw2_a_07qroy._.js} +1 -1
- package/.next/server/chunks/_1n183a1sca95j._.js +841 -0
- package/.next/server/chunks/_1ooq1_fguyb4w._.js +4 -4
- package/.next/server/chunks/_1pcqwf-fb4sdr._.js +3 -0
- package/.next/server/chunks/_1pvqo-qnv-nqm._.js +1 -1
- package/.next/server/chunks/{_0lefxjtzxvqe3._.js → _1qy44t5i_818z._.js} +1 -1
- package/.next/server/chunks/{_1q6syu3thw-it._.js → _1rs9mf471vkaj._.js} +1 -1
- package/.next/server/chunks/_1uy09ha0hf55x._.js +3 -0
- package/.next/server/chunks/_1v6bg00q81vb-._.js +1 -1
- package/.next/server/chunks/_1yeszprfll4cs._.js +3 -0
- package/.next/server/chunks/{_02h2mvtyvz-d4._.js → _1ypqw07g8jd_n._.js} +2 -2
- package/.next/server/chunks/{src_lib_08pkzyxoaihvr._.js → src_lib_00uau0bqmpvis._.js} +1 -1
- package/.next/server/chunks/{src_lib_1o3tjd1o5cimp._.js → src_lib_09bx-uxwxed4-._.js} +1 -1
- package/.next/server/chunks/{src_lib_0wnimconywq6b._.js → src_lib_0_-jpw7s-8ecj._.js} +1 -1
- package/.next/server/chunks/{src_lib_0h-tponh1-7j6._.js → src_lib_0jpf045jl52g2._.js} +1 -1
- package/.next/server/chunks/{src_lib_1sq92-zezp0_w._.js → src_lib_0ms2ela_oq337._.js} +1 -1
- package/.next/server/chunks/{src_lib_0j02yeqekyrst._.js → src_lib_0r93_bc9ivv-1._.js} +1 -1
- package/.next/server/chunks/{src_lib_0ugn3ny6rrd7v._.js → src_lib_0w7hq3kllb8fm._.js} +1 -1
- package/.next/server/chunks/src_lib_0xbzfk8i26a49._.js +3 -0
- package/.next/server/chunks/{src_lib_0lmersyim_y14._.js → src_lib_0zvev6trtcwx1._.js} +1 -1
- package/.next/server/chunks/src_lib_15mqgve64x8-5._.js +3 -0
- package/.next/server/chunks/src_lib_1e9dyictf98m_._.js +3 -0
- package/.next/server/chunks/src_lib_1fsvsl9tcr4l3._.js +3 -0
- package/.next/server/chunks/src_lib_1m687lzqosan4._.js +3 -0
- package/.next/server/chunks/src_lib_1mi27lltp518i._.js +3 -0
- package/.next/server/chunks/{src_lib_1lhg90rnfvakd._.js → src_lib_1n_nr7-ex_2jg._.js} +1 -1
- package/.next/server/chunks/src_lib_1tdv7ldmphkg6._.js +3 -0
- package/.next/server/chunks/src_lib_1vlf46urukq7z._.js +3 -0
- package/.next/server/chunks/{src_lib_14vlkix_t4jf2._.js → src_lib_20kah0e9oxkct._.js} +1 -1
- package/.next/server/chunks/src_lib_config_index_ts_14-9cq9wn5r30._.js +1 -1
- package/.next/server/chunks/src_lib_error-list_1o9rfcd_k01kv._.js +1 -1
- package/.next/server/chunks/src_lib_figure-svg_ts_1fiy7od-bmqnp._.js +3 -0
- package/.next/server/chunks/src_lib_import_import-tasks_ts_01f-g_upv7llt._.js +1 -1
- package/.next/server/chunks/src_lib_question_0uw17e6at-i_h._.js +1 -1
- package/.next/server/chunks/src_lib_seq-no_seq-no_ts_0j4u6wdt1alkz._.js +3 -0
- package/.next/server/chunks/{src_lib_telemetry_server_ts_03b98rv_b2seb._.js → src_lib_telemetry_server_ts_00f83-9rm2y-g._.js} +1 -1
- package/.next/server/chunks/{src_lib_telemetry_server_ts_0mdq-bx1yd8hn._.js → src_lib_telemetry_server_ts_03m2wrq9mhqmy._.js} +1 -1
- package/.next/server/chunks/src_lib_telemetry_server_ts_0_290xuag9bk5._.js +1 -1
- package/.next/server/chunks/{src_lib_telemetry_server_ts_02pcxs3asq5uc._.js → src_lib_telemetry_server_ts_0avmta_fv98hh._.js} +1 -1
- package/.next/server/chunks/{src_lib_telemetry_server_ts_03-yhnattpl91._.js → src_lib_telemetry_server_ts_0r0-kds9criy8._.js} +1 -1
- package/.next/server/chunks/src_lib_telemetry_server_ts_0xkkbyrxnwwnl._.js +3 -0
- package/.next/server/chunks/src_lib_telemetry_server_ts_1jtchrrgcoul1._.js +3 -0
- package/.next/server/chunks/src_lib_telemetry_server_ts_1pqqp2kf9ck61._.js +3 -0
- package/.next/server/chunks/ssr/{[root-of-the-server]__1abszuh7g1t6l._.js → [root-of-the-server]__10unzufmav9zw._.js} +1 -1
- package/.next/server/chunks/ssr/{[root-of-the-server]__0l72nsu73r1ie._.js → [root-of-the-server]__1mg9k8tfno_09._.js} +1 -1
- package/.next/server/chunks/ssr/_0-n_0o1abjz82._.js +27 -0
- package/.next/server/chunks/ssr/_03atl17c9_-vx._.js +27 -0
- package/.next/server/chunks/ssr/_05k02824g2tpo._.js +1 -1
- package/.next/server/chunks/ssr/_0bciku5a2h26m._.js +3 -0
- package/.next/server/chunks/ssr/_0env0bwoisi0c._.js +27 -0
- package/.next/server/chunks/ssr/_0qiirfq71m0ty._.js +1 -1
- package/.next/server/chunks/ssr/_0xlbgtld9_r3o._.js +1 -1
- package/.next/server/chunks/ssr/{_1dl7pg0vhu_7m._.js → _0ziiroepnqofs._.js} +2 -2
- package/.next/server/chunks/ssr/{_13546ppmec5po._.js → _1-h4lwdk_0mmw._.js} +2 -2
- package/.next/server/chunks/ssr/_10ivi6sd9yfpo._.js +3 -0
- package/.next/server/chunks/ssr/_128aje59sq0aw._.js +3 -0
- package/.next/server/chunks/ssr/_1dx7u1_w4db4k._.js +3 -0
- package/.next/server/chunks/ssr/_1ifkzsu9-qoq1._.js +3 -0
- package/.next/server/chunks/ssr/_1m7f_7kfoqzo_._.js +1 -1
- package/.next/server/chunks/ssr/_1q2ycfcq7dkpb._.js +3 -0
- package/.next/server/chunks/ssr/{node_modules_0howjysrkg79j._.js → node_modules_0deqqlqvj1a1o._.js} +1 -1
- package/.next/server/chunks/ssr/node_modules_0gnkuxqh809kz._.js +3 -0
- package/.next/server/chunks/ssr/{node_modules_0h9ta63mxl6gx._.js → node_modules_10xv23_q8lfn_._.js} +1 -1
- package/.next/server/chunks/ssr/node_modules_1yn2jiaa6_mg5._.js +3 -0
- package/.next/server/chunks/ssr/{node_modules_heic-to_dist_csp_heic-to_0lnmp65mgz816.js → node_modules_heic-to_dist_csp_heic-to_1n_v7tldjfiru.js} +1 -1
- package/.next/server/chunks/ssr/src_05l93k3zbix2t._.js +3 -0
- package/.next/server/chunks/ssr/src_1-khp-yw2gt4c._.js +3 -0
- package/.next/server/chunks/ssr/src_130ww76krpws_._.js +1 -1
- package/.next/server/chunks/ssr/src_1gayunqs8u2e2._.js +1 -1
- package/.next/server/chunks/ssr/src_1qo2yxfbt1sy_._.js +3 -0
- package/.next/server/chunks/ssr/src_1xvnkkhvub372._.js +1 -1
- package/.next/server/chunks/ssr/src_app_error-items_[id]_page_tsx_04xwwdmyh7_9q._.js +1 -1
- package/.next/server/chunks/ssr/src_app_import-batches_[id]_page_tsx_0mhg_vriwmkkw._.js +1 -1
- package/.next/server/chunks/ssr/src_app_import-tasks_[id]_page_tsx_0_grj11-jdqqc._.js +1 -1
- package/.next/server/chunks/ssr/src_app_notebooks_page_tsx_1p9src5gnz_40._.js +1 -1
- package/.next/server/chunks/ssr/src_app_page_tsx_1chiuahujsxm1._.js +3 -3
- package/.next/server/chunks/ssr/src_app_print-preview_page_tsx_001yt-fzrj7tf._.js +1 -1
- package/.next/server/chunks/ssr/src_components_correction-editor_tsx_1p7z02t66tndx._.js +3 -3
- package/.next/server/chunks/ssr/src_components_error-list_error-item-card_tsx_1zsiqsrj-jjd7._.js +1 -1
- package/.next/server/chunks/ssr/src_components_exam_exam-status-badge_tsx_0rozdbhlqsq71._.js +3 -0
- package/.next/server/chunks/ssr/src_components_import-tasks_import-task-card_tsx_01r47qh8ryspb._.js +1 -1
- package/.next/server/chunks/ssr/src_components_providers_tsx_09kw-mv3nb6xs._.js +17 -23
- package/.next/server/chunks/ssr/src_components_regenerate-figure-button_tsx_192vheo8-vjk8._.js +3 -0
- package/.next/server/chunks/ssr/src_contexts_LanguageContext_tsx_0r6xucmeu1k5z._.js +1 -1
- package/.next/server/chunks/ssr/src_lib_0773v8b5gb93o._.js +1 -1
- package/.next/server/chunks/ssr/src_lib_1qhs590-z9xnh._.js +1 -1
- package/.next/server/chunks/ssr/src_lib_1sh_-tq3rk_q3._.js +3 -0
- package/.next/server/chunks/ssr/src_lib_1z8akixo3j8ti._.js +1 -1
- package/.next/server/chunks/ssr/src_lib_i18n_en_ts_08zkpwnoqey5s._.js +1 -1
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/pages/500.html +1 -1
- package/.next/server/preview-props.json +3 -3
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/{1inmkqwqys755.js → 0-qegqxruurc3.js} +1 -1
- package/.next/static/chunks/04stcxch-i9qh.js +25 -0
- package/.next/static/chunks/0dc_n2xk5zd91.js +1 -0
- package/.next/static/chunks/0f_c5x7iw_zv8.css +3 -0
- package/.next/static/chunks/0x3-d2etp7q2a.js +16 -0
- package/.next/static/chunks/0zivil0520_ld.js +16 -0
- package/.next/static/chunks/10eu5r75zudvr.js +6 -0
- package/.next/static/chunks/{1s6os79cobfn_.js → 11j7t5iljen8x.js} +1 -1
- package/.next/static/chunks/131ggx8zkjsbo.js +25 -0
- package/.next/static/chunks/1cr9hgf4scqy2.js +1 -0
- package/.next/static/chunks/{05o2so3pmerou.js → 1hpf-0s8plyn9.js} +6 -6
- package/.next/static/chunks/1ibhiaqcn1uus.js +9 -0
- package/.next/static/chunks/{0xwz3h9d_e7kb.js → 1iq_4mjmtcew5.js} +1 -1
- package/.next/static/chunks/1na9ehxfr43xo.js +1 -0
- package/.next/static/chunks/1nr8kof_vhti_.js +1 -0
- package/.next/static/chunks/{3_xu3ke2zp8fv.js → 1tcgtsir3l_ag.js} +1 -1
- package/.next/static/chunks/{0jujm58tnoh6g.js → 1vor8pe1wgr3p.js} +1 -1
- package/.next/static/chunks/210a3wjue6a_4.js +1 -0
- package/.next/static/chunks/2ind4-0ptuzzz.js +1 -0
- package/.next/static/chunks/2l68c92ptk45y.js +37 -0
- package/.next/static/chunks/2l7tdxiv63wo4.js +2 -0
- package/.next/static/chunks/2la51tl94aeid.js +2 -0
- package/.next/static/chunks/2p3_vg4r1uzob.js +1 -0
- package/.next/static/chunks/2ypkmlirtgvw8.js +258 -0
- package/.next/static/chunks/{229eh2g7m2yeo.js → 33ek6omo-pplm.js} +1 -1
- package/.next/static/chunks/36shjdf6v5iqq.js +1 -0
- package/.next/static/chunks/3b5i3d4tmkg5d.js +1 -0
- package/.next/static/chunks/3u_zln7q59xr5.js +1 -0
- package/.next/static/chunks/{11-wz53_clo14.js → 3y96p9bhgoeyp.js} +1 -1
- package/package.json +1 -1
- package/prisma/migrations/20261111000001_error_item_seq_no/migration.sql +17 -0
- package/prisma/schema.prisma +3 -0
- package/prisma/seed.db +0 -0
- package/.next/server/chunks/[root-of-the-server]__02cwazw3laf8n._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__03mzwpgmelgxq._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__07za3z2qd-ri5._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__09a7mqqvpb5iw._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__09uxdlb0atubd._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0as_tqxtximnv._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0b110dxj2qk5d._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0bey3smu2frko._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0cyq3g7ztpx7w._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0dxid01zcz8sh._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0gspnsyl2sr50._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0h7v77lf4fj2l._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0hfzltniz674f._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0iw2v5f6ccxl0._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0iz5qf7p--9io._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0o64d13on6cmz._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0oou2pf7_339_._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0pfjf0rwvysy7._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0pzhwzricdm-8._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0q7tfn1jdwvpx._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0qcuz-9of1fv5._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0shmk9rqg_zs_._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0sthzz27i2a2z._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0svsyv06lv5b6._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0u5ilae_0p228._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0ve9pg6dcdyog._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0vf7un104o30d._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0vg4zd1ewm4lh._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0vyu7gon1mqle._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0w9f5-xtpane-._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0wb0hryzh-40d._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0xryaobvas7wn._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0y88hdobvv_cu._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0ykbbyo6dhbr6._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0yqilo886f-ap._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__10gksjgitow13._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__11abvzxq0gnxd._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__11k2f-h9fwj0r._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__132wdxrrngo1f._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1338_d0rrpmqi._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__13k69ibnw4thj._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__14971xq-txgd-._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__159kla6_fcldu._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__167-list_13wk._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__16lnqkbxm2wvd._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__190kzk1zqnnnh._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1_1_1tvp-qw4m._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1_n49ooywukvu._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1a71wr5gfcvuh._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1bc2146vwwx0n._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1chl_j6-66d0z._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1d_eia02z8s27._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1dg09yxfyy2d-._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1fp_biblbk1dj._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1h4469dzsx9y_._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1hg-nksvhu11h._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1hq4b2pmltb_l._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1hr87f6mg8xi6._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1i04dsau7foki._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1i8ob9ye9_osl._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1jaf9l240am9o._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1jcv8k2sx2ptr._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1juyqvp5sctaz._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1kqyyoqumu2k3._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1ktelnqkakjyk._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1kxlw9suxnfs2._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1nmtvzuc1uv-5._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1oaxm5scx4anf._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1oc9d5av5hr08._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1opijjenrark5._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1otoj-v6_5y0o._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1qbwy5a1mwohf._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1rfpsbaml9gvv._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1rzzqjvucnhdy._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1s9wsfyjfjfsw._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1svy-pnpe1pwu._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1t6v0c67wrtj7._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1tcmfyputqswh._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1uk_9g9b1wxp5._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1v5j-xo97hloh._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1wt1lpxbrwtyt._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1y7j4fig86u8c._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1z61l-vv1munx._.js +0 -3
- package/.next/server/chunks/_0-4_eys63g0m9._.js +0 -16
- package/.next/server/chunks/_07_mi9-a9cp01._.js +0 -3
- package/.next/server/chunks/_0b2q7l141kz7e._.js +0 -3
- package/.next/server/chunks/_0f13poypqhhoi._.js +0 -3
- package/.next/server/chunks/_0fsupxpep5knb._.js +0 -16
- package/.next/server/chunks/_0j_08_iij6lec._.js +0 -3
- package/.next/server/chunks/_0sreqb-d5c0h6._.js +0 -16
- package/.next/server/chunks/_1c-nysoxl9gha._.js +0 -16
- package/.next/server/chunks/_1lxrt-tu_a2ul._.js +0 -3
- package/.next/server/chunks/_1u9u2jcj407s4._.js +0 -3
- package/.next/server/chunks/src_lib_0tg0r917l7yn-._.js +0 -3
- package/.next/server/chunks/src_lib_0whd_w99i5vmm._.js +0 -3
- package/.next/server/chunks/src_lib_1-q39dava8lyt._.js +0 -3
- package/.next/server/chunks/src_lib_10ykmf7h-50q1._.js +0 -3
- package/.next/server/chunks/src_lib_1_m3-y2t3e4xi._.js +0 -765
- package/.next/server/chunks/src_lib_1ejhz5p1wt0op._.js +0 -3
- package/.next/server/chunks/src_lib_1hq7hqwsh9h5t._.js +0 -3
- package/.next/server/chunks/src_lib_1v7rk87xys5cb._.js +0 -3
- package/.next/server/chunks/src_lib_1z4t4i-xke74u._.js +0 -3
- package/.next/server/chunks/src_lib_2019ko5qy0_13._.js +0 -3
- package/.next/server/chunks/src_lib_question_question-deduplication_ts_0gumctesi3szc._.js +0 -3
- package/.next/server/chunks/src_lib_telemetry_server_ts_121v_vzqx287h._.js +0 -3
- package/.next/server/chunks/src_lib_telemetry_server_ts_1cd1qcjm2imrt._.js +0 -3
- package/.next/server/chunks/src_lib_telemetry_server_ts_1n-wydymc9ayv._.js +0 -3
- package/.next/server/chunks/src_lib_telemetry_server_ts_1nwnpm99c4ae8._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__127jl-l56wp65._.js +0 -3
- package/.next/server/chunks/ssr/_0-nyc5xhnkj97._.js +0 -3
- package/.next/server/chunks/ssr/_00bsw28n2tkm8._.js +0 -3
- package/.next/server/chunks/ssr/_02_avk2sj3zf5._.js +0 -3
- package/.next/server/chunks/ssr/_0p3bqrojxwfs0._.js +0 -3
- package/.next/server/chunks/ssr/_1bpiiswbxudjs._.js +0 -3
- package/.next/server/chunks/ssr/_1ctycpq4tb8xw._.js +0 -3
- package/.next/server/chunks/ssr/_1gdar99uip6w4._.js +0 -3
- package/.next/server/chunks/ssr/_1ywwrbmzxhzuj._.js +0 -3
- package/.next/server/chunks/ssr/node_modules_1gehjcp51qewp._.js +0 -3
- package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_icons_1qsyz9_vm6jfk._.js +0 -3
- package/.next/server/chunks/ssr/src_18crt94jrdkoz._.js +0 -3
- package/.next/server/chunks/ssr/src_components_image-cropper_tsx_0pcp8-ifruyx-._.js +0 -3
- package/.next/server/chunks/ssr/src_components_tag-input_tsx_0b9sxffna5c9i._.js +0 -3
- package/.next/static/chunks/0ce17zvy849pt.js +0 -1
- package/.next/static/chunks/0f9-00nh1upvn.js +0 -8
- package/.next/static/chunks/0l7p1okxbynzl.js +0 -6
- package/.next/static/chunks/0q-ubzpc3zt00.js +0 -264
- package/.next/static/chunks/0q3d845nwr3t9.js +0 -1
- package/.next/static/chunks/0qp2dju3vke54.js +0 -1
- package/.next/static/chunks/1vyad-frr447h.js +0 -2
- package/.next/static/chunks/1xe6wsozi5dph.js +0 -9
- package/.next/static/chunks/2-_veplkr98_e.js +0 -9
- package/.next/static/chunks/2g9sfd_hxpx8t.js +0 -9
- package/.next/static/chunks/2pg8rnt3z7y03.js +0 -9
- package/.next/static/chunks/2vka298e6x3mn.js +0 -13
- package/.next/static/chunks/2wrdjh0-kibv1.js +0 -1
- package/.next/static/chunks/2wwddiemqx680.js +0 -1
- package/.next/static/chunks/2xm7gxq5_ot8y.js +0 -1
- package/.next/static/chunks/348vc_z8o0lz1.js +0 -1
- package/.next/static/chunks/34r6_zyo8ux86.js +0 -1
- package/.next/static/chunks/3pu4qklwvr6i6.js +0 -1
- package/.next/static/chunks/3t23a8b3wz2sp.css +0 -3
- package/.next/static/chunks/3xonrwoptfy0c.js +0 -1
- package/.next/static/chunks/3ywx02bmgr0jm.js +0 -1
- package/.next/static/chunks/42kbpcy0oxrc-.js +0 -1
- package/.next/static/chunks/44v-w00lig6l4.js +0 -1
- /package/.next/static/{sPKUtI8kdV20M33Qv4OHi → xSCsOTmsNV4FbnY3KtfyD}/_buildManifest.js +0 -0
- /package/.next/static/{sPKUtI8kdV20M33Qv4OHi → xSCsOTmsNV4FbnY3KtfyD}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{sPKUtI8kdV20M33Qv4OHi → xSCsOTmsNV4FbnY3KtfyD}/_ssgManifest.js +0 -0
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
module.exports=[418175,a=>{"use strict";var b=a.i(187924),c=a.i(572131),d=a.i(550194),e=a.i(875003),f=a.i(291938),g=a.i(960927),h=a.i(630534);let i=["system","light","dark"],j="system",k="app-theme";function l(a){return"string"==typeof a&&i.includes(a)}let m=(0,c.createContext)({preference:j,theme:"light",setPreference:()=>void 0}),n="(prefers-color-scheme: dark)",o=new Set;function p(a){return o.add(a),window.addEventListener("storage",a),()=>{o.delete(a),window.removeEventListener("storage",a)}}function q(){try{let a=localStorage.getItem(k);return l(a)?a:j}catch{return j}}function r(a){try{localStorage.setItem(k,a)}catch{}o.forEach(a=>a())}function s(a){let b=window.matchMedia(n);return b.addEventListener("change",a),()=>b.removeEventListener("change",a)}let t=()=>window.matchMedia(n).matches;function u({children:a}){let{data:d,status:i}=(0,e.useSession)(),k="authenticated"===i,n=d?.user?.email,o=(0,c.useSyncExternalStore)(p,q,()=>j),v=(0,c.useSyncExternalStore)(s,t,()=>!1),w="system"===o?v?"dark":"light":o;(0,c.useEffect)(()=>{let a=document.documentElement,b=b=>{a.classList.toggle("dark","dark"===b),a.style.colorScheme=b};b(w);let c=()=>b("light"),d=()=>b(w);return window.addEventListener("beforeprint",c),window.addEventListener("afterprint",d),()=>{window.removeEventListener("beforeprint",c),window.removeEventListener("afterprint",d)}},[w]),(0,c.useEffect)(()=>{if(!k||!n)return;let a=!1;return f.k.get("/api/user").then(b=>{!a&&l(b.themePreference)&&b.themePreference!==q()&&r(b.themePreference)}).catch(a=>{h.V.warn("[Theme]","Failed to load theme preference",{error:(0,g.Z)(a)})}),()=>{a=!0}},[k,n]);let x=(0,c.useCallback)(a=>{r(a),k&&f.k.patch("/api/user",{themePreference:a}).catch(a=>{h.V.warn("[Theme]","Failed to save theme preference",{error:(0,g.Z)(a)})})},[k]),y=(0,c.useMemo)(()=>({preference:o,theme:w,setPreference:x}),[o,w,x]);return(0,b.jsx)(m.Provider,{value:y,children:a})}var v=a.i(529759),w=a.i(50944),x=a.i(875160),y=a.i(699570),z=a.i(814574),A=a.i(510606),B=a.i(283248),C=a.i(118688),D=a.i(895605),E=a.i(483138),F=a.i(462080),G=a.i(164831);let H={name:"circle-plus",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],aliases:["plus-circle"]};H.node;let I=(0,G.f)(H),J=[/^\/login/,/^\/register/,/^\/setup/,/^\/print-preview/,/^\/exams\/[^/]+\/print/],K=[{key:"home",href:"/",icon:I,match:a=>"/"===a},{key:"notebooks",href:"/notebooks",icon:C.f,match:a=>a.startsWith("/notebooks")||a.startsWith("/error-items")||a.startsWith("/practice")},{key:"review",href:"/review",icon:D.f,match:a=>a.startsWith("/review")},{key:"stats",href:"/stats",icon:B.f,match:a=>a.startsWith("/stats")||a.startsWith("/tags")},{key:"exams",href:"/exams",icon:E.f,match:a=>a.startsWith("/exams")},{key:"banks",href:"/banks",icon:F.f,match:a=>a.startsWith("/banks")}];function L(a){return J.some(b=>b.test(a))}var M=a.i(710302);let N="ai-consent-dismissed:";function O(){let{t:a,language:g}=(0,d.b)(),i=a.aiConsent,{data:j,status:k}=(0,e.useSession)(),l=(0,w.usePathname)()||"/",m="authenticated"===k?j?.user?.email??null:null,[n,o]=(0,c.useState)(null),[p,q]=(0,c.useState)(null),[r,s]=(0,c.useState)(!1);(0,c.useEffect)(()=>(0,A.y)(a=>o(b=>b??a)),[]);let t=L(l);(0,c.useEffect)(()=>{if(!m||t||function(a){try{return"1"===sessionStorage.getItem(a)}catch{return!1}}(N+m))return;let a=!1;return f.k.get("/api/user").then(b=>{a||!b||b.aiDataConsentAt||o(a=>a??"prompt")}).catch(a=>h.V.error("[AiConsentDialog]","load consent failed",{error:a})),()=>{a=!0}},[m,t]);let u=null!==n&&!!m;(0,c.useEffect)(()=>{if(!u)return;let a=!1;return f.k.get("/api/settings").then(b=>{a||q(b?.aiProvider??null)}).catch(()=>void 0),()=>{a=!0}},[u]);let v=()=>{o(null),s(!1)},B=async()=>{s(!0);try{await f.k.post("/api/user/ai-consent",{}),M.c.success("blocked"===n?i.agreedRetry:i.agreed),v()}catch(a){h.V.error("[AiConsentDialog]","save consent failed",{error:a}),M.c.error(i.failed),s(!1)}},C=()=>{m&&function(a){try{sessionStorage.setItem(a,"1")}catch{}}(N+m),M.c.info(i.declined),v()},D=(0,A.K)(p,g);return(0,b.jsx)(z.N,{open:u,onOpenChange:a=>{a||r||C()},children:(0,b.jsxs)(z.d,{className:"sm:max-w-lg",children:[(0,b.jsxs)(z.s,{children:[(0,b.jsx)(z.F,{children:i.title}),(0,b.jsx)(z.C,{children:"blocked"===n?i.blocked:i.intro})]}),(0,b.jsxs)("div",{className:"space-y-3 text-sm",children:["blocked"===n&&(0,b.jsx)("p",{children:i.intro}),(0,b.jsx)("ul",{className:"list-disc space-y-1 pl-5",children:i.items.map(a=>(0,b.jsx)("li",{children:a},a))}),(0,b.jsx)("p",{children:D?i.providerKnown.replace("{provider}",D):i.providerUnknown}),(0,b.jsxs)("p",{children:[i.policy,"en"===g?" ":"",(0,b.jsx)("a",{className:"underline underline-offset-2",href:(0,A.L)(g),target:"_blank",rel:"noopener noreferrer",children:i.policyLink}),"en"===g?".":"。"]}),(0,b.jsx)("p",{className:"text-muted-foreground",children:i.declineNote})]}),(0,b.jsxs)(z.c,{className:"gap-2",children:[(0,b.jsx)(y.f,{type:"button",variant:"outline",onClick:C,disabled:r,children:i.decline}),(0,b.jsxs)(y.f,{type:"button",onClick:B,disabled:r,children:[r&&(0,b.jsx)(x.f,{className:"h-4 w-4 animate-spin"}),i.agree]})]})]})})}var P=a.i(16644),Q=a.i(238246),R=a.i(557230);let S={name:"shield",size:24,node:[["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"}]]};S.node;let T=(0,G.f)(S);var U=a.i(303324);function V({status:a,onAccept:f}){let{t:g,language:i}=(0,d.b)(),[j,k]=(0,c.useState)(!1),l="en"===i?a.changes.en:a.changes.zh,m=async()=>{k(!0);try{await f()}catch(a){h.V.error("[EulaGate]","Failed to accept EULA",{error:a}),M.c.error(g.eula.acceptFailed)}finally{k(!1)}};return(0,b.jsx)("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/60 p-4",role:"dialog","aria-modal":"true","aria-labelledby":"eula-upgrade-title",children:(0,b.jsxs)("div",{className:"max-h-[90vh] w-full max-w-lg space-y-4 overflow-y-auto rounded-lg border bg-background p-5 shadow-lg",children:[(0,b.jsx)("h2",{id:"eula-upgrade-title",className:"text-lg font-semibold",children:g.eula.upgradeTitle}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:g.eula.upgradeDesc.replace("{accepted}",a.accepted??"-").replace("{current}",a.current)}),l.length>0&&(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("p",{className:"text-sm font-medium",children:g.eula.changesTitle}),(0,b.jsx)("ul",{className:"list-disc space-y-1 pl-5 text-sm",children:l.map(a=>(0,b.jsx)("li",{children:a},a))})]}),(0,b.jsx)(U.f,{}),(0,b.jsxs)("div",{className:"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",children:[(0,b.jsx)(y.f,{variant:"outline",onClick:()=>(0,e.signOut)({callbackUrl:"/login"}),disabled:j,children:g.eula.logout}),(0,b.jsxs)(y.f,{onClick:m,disabled:j,children:[j&&(0,b.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}),g.eula.accept]})]})]})})}var W=a.i(780767),X=a.i(682338),Y=a.i(368114);function Z({className:a}){let{t:e}=(0,d.b)(),{data:f}=(0,X.b)(),g=(0,c.useRef)(null);if((0,c.useEffect)(()=>{if(!f)return;let a=new Set([...f.tasks.filter(a=>"analyzing"===a.status||"saving"===a.status).map(a=>a.id),...(f.batches??[]).filter(a=>"splitting"===a.phase||"processing"===a.phase).map(a=>`batch:${a.id}`)]),b=new Set([...f.tasks.filter(a=>a.unread).map(a=>a.id),...(f.batches??[]).filter(a=>a.unread).map(a=>`batch:${a.id}`)]),c=g.current;c&&[...c].some(c=>!a.has(c)&&b.has(c))&&M.c.info(e.importTasks.finishedToast),g.current=a},[f,e.importTasks.finishedToast]),!f||0===f.tasks.length&&!f.batches?.length)return null;let{activeCount:h,unreadCount:i}=f,j=h>0?e.importTasks.entryActive.replace("{count}",String(h)):e.importTasks.entry;return(0,b.jsxs)(Q.default,{href:"/import-tasks",className:(0,Y.f)("relative flex h-9 items-center gap-1.5 rounded-full border px-3 text-sm font-medium transition-colors hover:bg-muted",i>0?"border-primary/50 text-primary":"text-muted-foreground",a),"data-testid":"import-tasks-entry","aria-label":i>0?`${j} \xb7 ${e.importTasks.entryUnread.replace("{count}",String(i))}`:j,children:[h>0?(0,b.jsx)(x.f,{className:"h-4 w-4 animate-spin"}):(0,b.jsx)(W.f,{className:"h-4 w-4"}),(0,b.jsx)("span",{className:"whitespace-nowrap",children:j}),i>0&&(0,b.jsx)("span",{className:"flex h-5 min-w-5 items-center justify-center rounded-full bg-destructive px-1 text-xs text-white","data-testid":"import-tasks-unread",children:i})]})}var $=a.i(390702);let _={name:"bot",size:24,node:[["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"}]]};_.node;let aa=(0,G.f)(_),ab={name:"info",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]};ab.node;let ac=(0,G.f)(ab);var ad=a.i(357204);let ae={name:"message-square-text",size:24,node:[["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"}]]};ae.node;let af=(0,G.f)(ae),ag={name:"settings",size:24,node:[["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"}]]};ag.node;let ah=(0,G.f)(ag);var ai=a.i(344451),aj=a.i(930363),ak=a.i(875083),al=a.i(986705),am=a.i(786304),an=a.i(563658),ao=a.i(866718),ap=a.i(870430);let aq=c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("div",{className:"relative w-full overflow-auto",children:(0,b.jsx)("table",{ref:d,className:(0,Y.f)("w-full caption-bottom text-sm",a),...c})}));aq.displayName="Table";let ar=c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("thead",{ref:d,className:(0,Y.f)("[&_tr]:border-b",a),...c}));ar.displayName="TableHeader";let as=c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("tbody",{ref:d,className:(0,Y.f)("[&_tr:last-child]:border-0",a),...c}));as.displayName="TableBody",(c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("tfoot",{ref:d,className:(0,Y.f)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",a),...c}))).displayName="TableFooter";let at=c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("tr",{ref:d,className:(0,Y.f)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",a),...c}));at.displayName="TableRow";let au=c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("th",{ref:d,className:(0,Y.f)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",a),...c}));au.displayName="TableHead";let av=c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("td",{ref:d,className:(0,Y.f)("p-4 align-middle [&:has([role=checkbox])]:pr-0",a),...c}));av.displayName="TableCell",(c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("caption",{ref:d,className:(0,Y.f)("mt-4 text-sm text-muted-foreground",a),...c}))).displayName="TableCaption";var aw=a.i(951675);let ax={name:"ban",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]]};ax.node;let ay=(0,G.f)(ax);var az=a.i(79362);function aA(){var a;let{t:e}=(0,d.b)(),[g,i]=(0,c.useState)(String(5)),[j,k]=(0,c.useState)(!1),l=(0,c.useCallback)(async()=>{try{let a=await f.k.get("/api/settings");i(String(a.aiConcurrencyLimit??5))}catch(a){h.V.error("[AiConcurrencyLimitSetting]","Failed to fetch config",{error:a})}},[]);(0,c.useEffect)(()=>{l()},[l]);let m=Number(g),n=""!==g.trim()&&"number"==typeof(a=m)&&Number.isInteger(a)&&a>=1&&a<=100,o=async()=>{if(n){k(!0);try{await f.k.post("/api/settings",{aiConcurrencyLimit:m}),M.c.success(e.admin.aiConcurrencyLimitSaved)}catch(a){h.V.error("[AiConcurrencyLimitSetting]","Failed to update AI concurrency limit",{error:a}),M.c.error(e.common.error)}finally{k(!1)}}};return(0,b.jsxs)("div",{className:"flex flex-col gap-3 p-4 border rounded-lg bg-muted/30 sm:flex-row sm:items-center sm:justify-between",children:[(0,b.jsxs)("div",{className:"space-y-0.5",children:[(0,b.jsx)(ap.f,{htmlFor:"ai-concurrency-limit",className:"text-base",children:e.admin.aiConcurrencyLimit}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:e.admin.aiConcurrencyLimitDesc})]}),(0,b.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,b.jsx)(ao.f,{id:"ai-concurrency-limit",type:"number",min:1,max:100,step:1,inputMode:"numeric",value:g,onChange:a=>i(a.target.value),"aria-invalid":!n,className:"w-24"}),(0,b.jsxs)(y.f,{size:"sm",onClick:o,disabled:j||!n,children:[j&&(0,b.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}),e.common.save]})]})]})}function aB(a,b){return new Intl.NumberFormat("zh"===b?"zh-CN":"en-US",{notation:"compact",maximumFractionDigits:1}).format(Math.max(0,a))}function aC({user:a}){let{t:c,language:e}=(0,d.b)(),f=c.admin.aiTokensDetail.replace("{input}",aB(a.aiTokensToday.input,e)).replace("{output}",aB(a.aiTokensToday.output,e));return(0,b.jsxs)(b.Fragment,{children:[c.admin.aiUsageToday,": ",a.aiUsageToday," | ",c.admin.aiTokensToday,": ",f]})}function aD(){let{timeZone:a}=(0,v.M)(),{data:i}=(0,e.useSession)(),{t:j}=(0,d.b)(),[k,l]=(0,c.useState)([]),[m,n]=(0,c.useState)(!0),[o,p]=(0,c.useState)(!1),[q,r]=(0,c.useState)(!1),[s,t]=(0,c.useState)("0"),[u,w]=(0,c.useState)(!1),z=(0,c.useCallback)(async()=>{n(!0);try{let a=await f.k.get("/api/admin/users");l(a)}catch(a){h.V.error("[UserManagement]","Failed to fetch users",{error:a})}finally{n(!1)}},[]),A=(0,c.useCallback)(async()=>{try{let a=await f.k.get("/api/settings");p(!0===a.allowRegistration),t(String(a.aiDailyLimit??0))}catch(a){h.V.error("[UserManagement]","Failed to fetch config",{error:a})}},[]);(0,c.useEffect)(()=>{z(),A()},[z,A]);let B=async a=>{r(!0);try{await f.k.post("/api/settings",{allowRegistration:a}),p(a)}catch(a){h.V.error("[UserManagement]","Failed to update registration setting",{error:a}),M.c.error(j.common.error)}finally{r(!1)}},C=Number(s),D=""!==s.trim()&&Number.isInteger(C)&&C>=0,E=async()=>{if(D){w(!0);try{await f.k.post("/api/settings",{aiDailyLimit:C}),M.c.success(j.admin.aiDailyLimitSaved)}catch(a){h.V.error("[UserManagement]","Failed to update AI daily limit",{error:a}),M.c.error(j.common.error)}finally{w(!1)}}},F=async a=>{let b=a.isActive?j.admin.confirmDisable:j.admin.confirmEnable;if(await (0,M.u)(b))try{await f.k.patch(`/api/admin/users/${a.id}`,{isActive:!a.isActive}),z()}catch(a){h.V.error("[UserManagement]","Failed to update user status",{error:a}),M.c.error(j.common.error)}},G=async a=>{if(await (0,M.u)(j.admin.confirmDelete,{destructive:!0}))try{await f.k.delete(`/api/admin/users/${a.id}`),z()}catch(b){h.V.error("[UserManagement]","Failed to delete user",{error:b});let a=(0,g.d)(b)||j.common.error;M.c.error(a)}};return m?(0,b.jsx)("div",{className:"flex justify-center py-8",children:(0,b.jsx)(x.f,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between p-4 border rounded-lg bg-muted/30",children:[(0,b.jsxs)("div",{className:"space-y-0.5",children:[(0,b.jsx)(ap.f,{className:"text-base",children:j.admin?.allowRegistration||"Allow New Registrations"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:j.admin?.allowRegistrationDesc||"When disabled, new users cannot register"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[q&&(0,b.jsx)(x.f,{className:"h-4 w-4 animate-spin"}),(0,b.jsx)(an.f,{checked:o,onCheckedChange:B,disabled:q})]})]}),(0,b.jsxs)("div",{className:"flex flex-col gap-3 p-4 border rounded-lg bg-muted/30 sm:flex-row sm:items-center sm:justify-between",children:[(0,b.jsxs)("div",{className:"space-y-0.5",children:[(0,b.jsx)(ap.f,{htmlFor:"ai-daily-limit",className:"text-base",children:j.admin.aiDailyLimit}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:j.admin.aiDailyLimitDesc})]}),(0,b.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,b.jsx)(ao.f,{id:"ai-daily-limit",type:"number",min:0,step:1,inputMode:"numeric",value:s,onChange:a=>t(a.target.value),"aria-invalid":!D,className:"w-24"}),(0,b.jsxs)(y.f,{size:"sm",onClick:E,disabled:u||!D,children:[u&&(0,b.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}),j.common.save]})]})]}),(0,b.jsx)(aA,{}),(0,b.jsx)("div",{className:"sm:hidden space-y-3",children:k.map(c=>(0,b.jsxs)("div",{className:"border rounded-lg p-4 bg-card space-y-3",children:[(0,b.jsxs)("div",{className:"flex justify-between items-start",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"font-medium",children:c.name||"N/A"}),(0,b.jsx)("div",{className:"text-sm text-muted-foreground",children:c.email})]}),(0,b.jsx)(am.f,{variant:"admin"===c.role?"default":"secondary",children:"admin"===c.role?j.admin.admin:j.admin.user})]}),(0,b.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,b.jsxs)("div",{className:"text-muted-foreground",children:[j.admin.errors,": ",c._count.errorItems," | ",j.admin.practiceCount,": ",c._count.practiceRecords," | ",(0,b.jsx)(aC,{user:c})]}),(0,b.jsx)(am.f,{variant:c.isActive?"default":"destructive",className:"text-xs",children:c.isActive?j.admin.active:j.admin.disabled})]}),(0,b.jsxs)("div",{className:"flex justify-between items-center pt-2 border-t",children:[(0,b.jsx)("div",{className:"text-xs text-muted-foreground",children:(0,al.r)(c.createdAt,"yyyy-MM-dd",a)}),(0,b.jsxs)("div",{className:"flex gap-2",children:[(0,b.jsx)(y.f,{variant:"ghost",size:"sm",onClick:()=>F(c),disabled:c.id===i?.user?.id,children:c.isActive?(0,b.jsx)(ay,{className:"h-4 w-4 text-orange-500"}):(0,b.jsx)(az.f,{className:"h-4 w-4 text-green-500"})}),(0,b.jsx)(y.f,{variant:"ghost",size:"sm",onClick:()=>G(c),disabled:c.id===i?.user?.id,children:(0,b.jsx)(aw.f,{className:"h-4 w-4 text-destructive"})})]})]})]},c.id))}),(0,b.jsx)("div",{className:"hidden sm:block border rounded-lg overflow-hidden",children:(0,b.jsxs)(aq,{children:[(0,b.jsx)(ar,{children:(0,b.jsxs)(at,{children:[(0,b.jsx)(au,{children:j.admin.nameEmail}),(0,b.jsx)(au,{children:j.admin.role}),(0,b.jsx)(au,{children:j.admin.stats}),(0,b.jsx)(au,{children:j.admin.createdAt}),(0,b.jsx)(au,{children:j.admin.status}),(0,b.jsx)(au,{className:"text-right",children:j.admin.actions})]})}),(0,b.jsx)(as,{children:k.map(c=>(0,b.jsxs)(at,{children:[(0,b.jsxs)(av,{children:[(0,b.jsx)("div",{className:"font-medium",children:c.name||"N/A"}),(0,b.jsx)("div",{className:"text-sm text-muted-foreground",children:c.email})]}),(0,b.jsx)(av,{children:(0,b.jsx)(am.f,{variant:"admin"===c.role?"default":"secondary",children:"admin"===c.role?j.admin.admin:j.admin.user})}),(0,b.jsxs)(av,{children:[(0,b.jsxs)("div",{className:"text-sm",children:[j.admin.errors,": ",c._count.errorItems]}),(0,b.jsxs)("div",{className:"text-sm",children:[j.admin.practiceCount,": ",c._count.practiceRecords]}),(0,b.jsx)("div",{className:"text-sm",children:(0,b.jsx)(aC,{user:c})})]}),(0,b.jsx)(av,{children:(0,al.r)(c.createdAt,"yyyy-MM-dd",a)}),(0,b.jsx)(av,{children:(0,b.jsx)(am.f,{variant:c.isActive?"default":"destructive",children:c.isActive?j.admin.active:j.admin.disabled})}),(0,b.jsxs)(av,{className:"text-right space-x-2",children:[(0,b.jsx)(y.f,{variant:"ghost",size:"sm",onClick:()=>F(c),disabled:c.id===i?.user?.id,title:c.isActive?j.admin.disable:j.admin.enable,children:c.isActive?(0,b.jsx)(ay,{className:"h-4 w-4 text-orange-500"}):(0,b.jsx)(az.f,{className:"h-4 w-4 text-green-500"})}),(0,b.jsx)(y.f,{variant:"ghost",size:"sm",onClick:()=>G(c),disabled:c.id===i?.user?.id,title:j.admin.delete,children:(0,b.jsx)(aw.f,{className:"h-4 w-4 text-destructive"})})]})]},c.id))})]})})]})}var aE=a.i(168370);let aF={name:"scroll-text",size:24,node:[["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"}]]};aF.node;let aG=(0,G.f)(aF);function aH(a){return(0,b.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a,children:[(0,b.jsx)("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"}),(0,b.jsx)("path",{d:"M9 18c-4.51 2-5-2-7-2"})]})}let aI={name:"server",size:24,node:[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]};aI.node;let aJ=(0,G.f)(aI);var aK=a.i(540553);let aL=()=>()=>void 0;function aM(){let{t:a}=(0,d.b)(),e=(0,c.useSyncExternalStore)(aL,aK.f,()=>null);return e?e.isStandalone?.()?(0,b.jsx)("p",{className:"text-center text-sm text-muted-foreground",children:a.settings?.about?.androidStandalone||"Running on this device. Data is stored only on this device."}):(0,b.jsxs)("div",{className:"flex flex-col items-center gap-2 text-sm text-muted-foreground",children:[(0,b.jsxs)("span",{className:"break-all",children:[a.settings?.about?.androidServer||"Server",": ",e.getServerUrl()]}),(0,b.jsxs)(y.f,{variant:"outline",className:"gap-2",onClick:()=>e.changeServer(),children:[(0,b.jsx)(aJ,{className:"h-4 w-4"}),a.settings?.about?.changeServer||"Change server"]})]}):null}var aN=a.i(424235);function aO(){let{t:a}=(0,d.b)(),[e,f]=(0,c.useState)("");(0,c.useEffect)(()=>{fetch("/api/version").then(a=>a.json()).then(a=>f(a.version)).catch(()=>{})},[]);let g=[{href:aN.f,icon:aH,label:a.settings?.about?.github||"GitHub Repository"},{href:`${aN.f}/releases`,icon:aG,label:a.settings?.about?.releaseNotes||"Release Notes"},{href:`${aN.f}/issues`,icon:af,label:a.settings?.about?.feedback||"Feedback"}];return(0,b.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,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("h3",{className:"text-2xl font-bold",children:a.app?.title||"Smart Error Notebook"}),(0,b.jsx)("p",{className:"text-muted-foreground",children:a.settings?.about?.desc||"AI-powered learning assistant"})]}),(0,b.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,b.jsx)(ac,{className:"h-4 w-4"}),(0,b.jsxs)("span",{children:[a.settings?.about?.version||"Version",": v",e||"unknown"]})]}),(0,b.jsx)(aM,{}),(0,b.jsx)("div",{className:"flex flex-col sm:flex-row flex-wrap justify-center gap-4 w-full sm:w-auto px-4 sm:px-0",children:g.map(({href:a,icon:c,label:d})=>(0,b.jsx)(y.f,{variant:"outline",asChild:!0,className:"gap-2 w-full sm:w-auto",children:(0,b.jsxs)("a",{href:a,target:"_blank",rel:"noopener noreferrer",children:[(0,b.jsx)(c,{className:"h-4 w-4"}),d,(0,b.jsx)(aE.f,{className:"h-3 w-3 ml-1 opacity-50"})]})},a))}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mt-8",children:a.settings?.about?.copyright||"© 2026 margrop · Based on wttwins/wrong-notebook · MIT License"})]})}var aP=a.i(152679),aQ=a.i(580701),aR=a.i(348966);let aS={name:"",email:"",educationStage:"",enrollmentYear:"",currentGrade:"",currentSemester:"",password:""};function aT(){let{t:a}=(0,d.b)(),[e,i]=(0,c.useState)(aS),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(!0),[n,o]=(0,c.useState)(!1),p=(0,c.useCallback)(async()=>{try{let a=await f.k.get("/api/user"),b=a.fixedGradeSemester?(0,aR.p)(a.fixedGradeSemester):null;i({name:a.name||"",email:a.email||"",educationStage:a.educationStage||"",enrollmentYear:a.enrollmentYear||"",currentGrade:b?.grade||"",currentSemester:b?.semester||"",password:""})}catch(a){h.V.error("[AccountSettings]","Failed to fetch profile",{error:a})}finally{m(!1)}},[]);(0,c.useEffect)(()=>{p()},[p]);let q=async()=>{if(e.password&&e.password!==j)return void M.c.error(a.settings?.messages?.passwordMismatch||"Passwords do not match");o(!0);try{let b={name:e.name,email:e.email,educationStage:e.educationStage};e.enrollmentYear&&(b.enrollmentYear=parseInt(e.enrollmentYear.toString())),e.password&&(b.password=e.password),e.currentGrade&&e.currentSemester?b.fixedGradeSemester=`${e.currentGrade}${e.currentSemester}`:e.currentGrade||(b.fixedGradeSemester=null),await f.k.patch("/api/user",b),M.c.success(a.settings?.messages?.profileUpdated||"Profile updated"),i(a=>({...a,password:""})),k(""),window.location.reload()}catch(b){h.V.error("[AccountSettings]","Failed to update profile",{error:(0,g.d)(b)??(0,g.Z)(b)}),M.c.error((0,g.d)(b)||a.settings?.messages?.updateFailed||"Update failed")}finally{o(!1)}};return l?(0,b.jsx)("div",{className:"flex justify-center py-8",children:(0,b.jsx)(x.f,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,b.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ap.f,{children:a.auth?.name||"Name"}),(0,b.jsx)(ao.f,{value:e.name||"",onChange:a=>i({...e,name:a.target.value})})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ap.f,{children:a.auth?.email||"Email"}),(0,b.jsx)(ao.f,{value:e.email||"",onChange:a=>i({...e,email:a.target.value}),type:"email"})]})]}),(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ap.f,{children:a.auth?.educationStage||"Education Stage"}),(0,b.jsxs)(aQ.d,{value:e.educationStage||"",onValueChange:a=>i({...e,educationStage:a,currentGrade:(0,aR.c)(a).includes(e.currentGrade)?e.currentGrade:"",currentSemester:(0,aR.c)(a).includes(e.currentGrade)?e.currentSemester:""}),children:[(0,b.jsx)(aQ.P,{children:(0,b.jsx)(aQ.U,{placeholder:a.auth?.selectStage||"Select Stage"})}),(0,b.jsxs)(aQ.r,{children:[(0,b.jsx)(aQ.T,{value:"primary",children:a.auth?.primary||"Primary School"}),(0,b.jsx)(aQ.T,{value:"junior_high",children:a.auth?.juniorHigh||"Junior High"}),(0,b.jsx)(aQ.T,{value:"senior_high",children:a.auth?.seniorHigh||"Senior High"}),(0,b.jsx)(aQ.T,{value:"university",children:a.auth?.university||"University"})]})]})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ap.f,{children:a.auth?.enrollmentYear||"Enrollment Year"}),(0,b.jsx)(ao.f,{type:"number",value:e.enrollmentYear||"",onChange:a=>i({...e,enrollmentYear:a.target.value}),placeholder:"YYYY"})]})]}),e.educationStage&&(0,aR.c)(e.educationStage).length>0&&(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ap.f,{children:a.settings?.account?.currentGrade||"Current Grade & Semester"}),(0,b.jsxs)(aQ.d,{value:e.currentGrade||"",onValueChange:a=>i({...e,currentGrade:a,currentSemester:a?e.currentSemester||"上":""}),children:[(0,b.jsx)(aQ.P,{children:(0,b.jsx)(aQ.U,{placeholder:a.settings?.account?.selectGrade||"Select Grade"})}),(0,b.jsx)(aQ.r,{children:(0,aR.c)(e.educationStage).map(a=>(0,b.jsx)(aQ.T,{value:a,children:a},a))})]})]}),e.currentGrade&&(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ap.f,{children:a.settings?.account?.selectSemester||"Select Semester"}),(0,b.jsxs)(aQ.d,{value:e.currentSemester||"",onValueChange:a=>i({...e,currentSemester:a}),children:[(0,b.jsx)(aQ.P,{children:(0,b.jsx)(aQ.U,{placeholder:a.settings?.account?.selectSemester||"Select Semester"})}),(0,b.jsxs)(aQ.r,{children:[(0,b.jsx)(aQ.T,{value:"上",children:a.settings?.account?.firstSemester||"1st Semester"}),(0,b.jsx)(aQ.T,{value:"下",children:a.settings?.account?.secondSemester||"2nd Semester"})]})]})]})]}),e.currentGrade&&e.currentSemester&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground -mt-2",children:a.settings?.account?.gradeAppliedHint||"New questions will default to this grade. You can also configure AI grade recognition in General Settings."}),(0,b.jsxs)("div",{className:"space-y-3 pt-2 border-t",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ap.f,{children:a.settings?.account?.changePassword||"Change Password (Leave empty to keep)"}),(0,b.jsx)(aP.f,{value:e.password,onChange:a=>i({...e,password:a.target.value}),placeholder:"******",minLength:6})]}),e.password&&(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ap.f,{children:a.auth?.confirmPassword||"Confirm Password"}),(0,b.jsx)(aP.f,{value:j,onChange:a=>k(a.target.value),placeholder:"******",minLength:6})]})]}),(0,b.jsxs)(y.f,{onClick:q,disabled:n,className:"w-full",children:[n&&(0,b.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}),a.settings?.account?.update||"Update Profile"]})]})}var aU=a.i(151304),aV=a.i(201661),aW=a.i(246059),aX=a.i(998868),aY=a.i(332485),aZ=a.i(861954);let a$="https://github.com/xiaoyang111222/cn-math-taxonomy",a_="https://raw.githubusercontent.com/xiaoyang111222/cn-math-taxonomy/HEAD/data/topics.json",a0=aW.z.object({id:aX.z.string().optional(),name:aX.z.string().trim().min(1),subject:aX.z.string().nullish(),grade:aY.z.number().int(),semester:aX.z.string().nullish(),chapter:aX.z.string().nullish()}).passthrough();aZ.z.array(a0).min(1);let a1="/api/admin/cnm-tags";function a2(){let{t:a}=(0,d.b)(),e=a.admin.cnmTags,[g,i]=(0,c.useState)(null),[j,k]=(0,c.useState)(!1),l=(0,c.useRef)(null),m=(0,c.useCallback)(async()=>{try{i(await f.k.get(a1))}catch(a){h.V.warn("[CnmTagImportSettings]","Failed to load status",{error:a})}},[]);(0,c.useEffect)(()=>{m()},[m]);let n=async a=>{if(a){k(!0);try{let b;try{b=JSON.parse(await a.text())}catch{M.c.error(e.invalidFile);return}let c=await f.k.post(a1,{topics:b},{timeout:3e5});i(c.status),M.c.success(e.imported.replace("{created}",String(c.result.created)).replace("{skipped}",String(c.result.skipped)))}catch(b){h.V.error("[CnmTagImportSettings]","Import failed",{error:b});let a=b instanceof f.a&&400===b.status;M.c.error(a?e.invalidFile:e.failed)}finally{k(!1),l.current&&(l.current.value="")}}},o=g?.knowledgePoints??0;return(0,b.jsxs)("div",{className:"space-y-3 rounded-lg border p-4",children:[(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsxs)("p",{className:"flex items-center gap-2 text-sm font-medium",children:[(0,b.jsx)(C.f,{className:"h-4 w-4"}),e.title]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:e.desc})]}),(0,b.jsxs)("div",{className:"space-y-1 rounded-md bg-muted/50 p-3 text-xs text-muted-foreground",children:[(0,b.jsx)("p",{children:e.downloadHint}),(0,b.jsx)("a",{href:a_,target:"_blank",rel:"noopener noreferrer",className:"block break-all text-primary underline",children:a_}),(0,b.jsxs)("p",{children:[e.sourceLabel," ",(0,b.jsx)("a",{href:a$,target:"_blank",rel:"noopener noreferrer",className:"break-all text-primary underline",children:a$})]})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:g?o>0?e.status.replace("{count}",String(o)):e.notImported:""}),(0,b.jsx)("input",{ref:l,type:"file",accept:".json,application/json",className:"hidden",onChange:a=>n(a.target.files?.[0]),disabled:j}),(0,b.jsxs)(y.f,{variant:"outline",size:"sm",className:"w-full sm:w-auto",onClick:()=>l.current?.click(),disabled:j,children:[j?(0,b.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,b.jsx)(aV.f,{className:"mr-2 h-4 w-4"}),j?e.importing:e.select]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:e.note})]})}var a3=a.i(519783);let a4={info:{card:"border-blue-200 dark:border-blue-900 bg-blue-50 dark:bg-blue-950/40",title:"text-blue-900 dark:text-blue-200 font-bold",desc:"text-blue-800 dark:text-blue-200 font-medium",button:"bg-blue-100 dark:bg-blue-900/40 hover:bg-blue-200 dark:hover:bg-blue-900/60 text-blue-900 dark:text-blue-200 border-blue-300 dark:border-blue-800"},danger:{card:"border-red-200 dark:border-red-900 bg-red-50 dark:bg-red-950/40",title:"text-red-700 dark:text-red-300 font-medium",desc:"text-red-600 dark:text-red-400",button:""},critical:{card:"border-red-600/50 bg-red-100/50 dark:bg-red-900/40",title:"text-red-900 dark:text-red-200 font-bold",desc:"text-red-800 dark:text-red-200 font-medium",button:"bg-red-700 hover:bg-red-800"}};function a5({title:a,description:c,tone:d,busy:e,icon:f,onClick:g}){let h=a4[d];return(0,b.jsxs)("div",{className:`p-4 border rounded-lg ${h.card}`,children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)("span",{className:`text-sm flex items-center gap-2 ${h.title}`,children:a}),(0,b.jsx)(y.f,{variant:"info"===d?"outline":"destructive",size:"sm",onClick:g,disabled:e,className:h.button,children:e?(0,b.jsx)(x.f,{className:"h-4 w-4 animate-spin"}):f})]}),(0,b.jsx)("p",{className:`text-xs mt-2 ${h.desc}`,children:c})]})}function a6({isAdmin:a}){let{t:e}=(0,d.b)(),[g,i]=(0,c.useState)(null),j=async(a,b,c,d)=>{i(a);try{M.c.success(await b()),d&&window.location.reload()}catch(b){h.V.error("[DangerZoneSettings]",`${a} failed`,{error:b}),M.c.error(c)}finally{i(null)}},k=e.settings?.clearSuccess||"Success",l=e.settings?.clearError||"Failed",m=async()=>{await (0,M.u)(e.settings?.migrateTagsConfirm||"This will reset system tags. Confirm?",{destructive:!0})&&await j("migrateTags",async()=>{let a=await f.k.post("/api/admin/migrate-tags",{});return`${k}: ${a.count||0} tags migrated.`},e.settings?.clearError||"Failed to migrate tags",!1)},n=async()=>{await (0,M.u)(e.settings?.clearDataConfirm||"Are you sure?",{destructive:!0})&&await j("clearPractice",async()=>(await f.k.delete("/api/stats/practice/clear"),k),l,!0)},o=async()=>{await (0,M.u)(e.settings?.clearErrorDataConfirm||"Are you sure?",{destructive:!0})&&await j("clearErrors",async()=>(await f.k.delete("/api/error-items/clear"),k),l,!0)},p=async()=>{if(!await (0,M.u)(e.settings?.systemResetConfirm||"WARNING: Deleting ALL data. Undoing is impossible. Are you sure?",{destructive:!0}))return;let a=prompt(e.settings?.systemResetPrompt||"Type 'RESET' to confirm system initialization:","");if("RESET"!==a){null!==a&&M.c.error(e.common?.error||"Confirmation failed");return}await j("systemReset",async()=>(await f.k.post("/api/admin/system-reset",{}),e.settings?.clearSuccess||"Success - System Reset Complete"),e.settings?.clearError||"Failed to reset system",!0)};return(0,b.jsxs)(b.Fragment,{children:[a&&(0,b.jsx)(a5,{tone:"info",title:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a3.f,{className:"h-4 w-4"}),e.settings?.migrateTags||"Migrate Tags"]}),description:e.settings?.migrateTagsDesc||"Re-populates standard tags from file",busy:"migrateTags"===g,icon:(0,b.jsx)(a3.f,{className:"h-4 w-4"}),onClick:m}),(0,b.jsx)(a5,{tone:"danger",title:e.settings?.clearData||"Clear Practice Data",description:e.settings?.clearDataDesc||"This will permanently delete all practice history. Irreversible.",busy:"clearPractice"===g,icon:(0,b.jsx)(aw.f,{className:"h-4 w-4"}),onClick:n}),(0,b.jsx)(a5,{tone:"danger",title:e.settings?.clearErrorData||"Clear Error Data",description:e.settings?.clearErrorDataDesc||"This will permanently delete all error items. Irreversible.",busy:"clearErrors"===g,icon:(0,b.jsx)(aw.f,{className:"h-4 w-4"}),onClick:o}),a&&(0,b.jsx)(a5,{tone:"critical",title:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)($.f,{className:"h-4 w-4"}),e.settings?.systemReset||"System Initialization"]}),description:e.settings?.systemResetDesc||"Resets the system to factory state. Deletes ALL data.",busy:"systemReset"===g,icon:(0,b.jsx)(aw.f,{className:"h-4 w-4"}),onClick:p})]})}let a7={name:"user-x",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]};a7.node;let a8=(0,G.f)(a7);function a9({isAdmin:a}){let{t:g}=(0,d.b)(),i=g.settings.deleteAccount,[j,k]=(0,c.useState)(!1),[l,m]=(0,c.useState)(""),[n,o]=(0,c.useState)(!1),p=a=>{!n&&(k(a),a||m(""))},q=async a=>{if(a.preventDefault(),l){o(!0);try{await f.k.delete("/api/user",{body:JSON.stringify({password:l})}),M.c.success(i.success),await (0,e.signOut)({callbackUrl:"/login"})}catch(b){let a=b instanceof f.a&&400===b.status;a||h.V.error("[DeleteAccountSettings]","delete account failed",{error:b}),M.c.error(a?i.wrongPassword:i.failed),o(!1)}}};return(0,b.jsxs)("div",{className:"p-4 border rounded-lg border-red-600/50 bg-red-100/50 dark:bg-red-900/40",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,b.jsxs)("span",{className:"text-sm flex items-center gap-2 text-red-900 dark:text-red-200 font-bold",children:[(0,b.jsx)(a8,{className:"h-4 w-4"}),i.title]}),(0,b.jsx)(y.f,{variant:"destructive",size:"sm",className:"bg-red-700 hover:bg-red-800",disabled:a,onClick:()=>k(!0),"aria-label":i.title,children:(0,b.jsx)(a8,{className:"h-4 w-4"})})]}),(0,b.jsx)("p",{className:"text-xs mt-2 text-red-800 dark:text-red-200 font-medium",children:a?i.adminDisabled:i.desc}),(0,b.jsx)(z.N,{open:j,onOpenChange:p,children:(0,b.jsx)(z.d,{className:"sm:max-w-md",children:(0,b.jsxs)("form",{onSubmit:q,className:"space-y-4",children:[(0,b.jsxs)(z.s,{children:[(0,b.jsx)(z.F,{children:i.confirmTitle}),(0,b.jsx)(z.C,{children:i.confirmDesc})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ap.f,{htmlFor:"delete-account-password",children:i.passwordLabel}),(0,b.jsx)(aP.f,{id:"delete-account-password",autoComplete:"current-password",value:l,onChange:a=>m(a.target.value),disabled:n})]}),(0,b.jsxs)(z.c,{className:"gap-2",children:[(0,b.jsx)(y.f,{type:"button",variant:"outline",onClick:()=>p(!1),disabled:n,children:i.cancel}),(0,b.jsxs)(y.f,{type:"submit",variant:"destructive",disabled:!l||n,children:[n&&(0,b.jsx)(x.f,{className:"h-4 w-4 animate-spin"}),i.confirm]})]})]})})})]})}let ba={name:"shield-check",size:24,node:[["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"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]};ba.node;let bb=(0,G.f)(ba);function bc(){let{t:a,language:e}=(0,d.b)(),g=a.aiConsent,[i,j]=(0,c.useState)(void 0),[k,l]=(0,c.useState)(!1);(0,c.useEffect)(()=>{let a=!1;return f.k.get("/api/user").then(b=>{a||j(b?.aiDataConsentAt??null)}).catch(a=>h.V.error("[AiConsentSetting]","load consent failed",{error:a})),()=>{a=!0}},[]);let m=async a=>{if(a||await (0,M.u)(g.revokeConfirm,{destructive:!0})){l(!0);try{let b=a?await f.k.post("/api/user/ai-consent",{}):await f.k.delete("/api/user/ai-consent");j(b.aiDataConsentAt),M.c.success(a?g.agreed:g.revoked)}catch(a){h.V.error("[AiConsentSetting]","update consent failed",{error:a}),M.c.error(g.failed)}finally{l(!1)}}};if(void 0===i)return null;let n=null!==i,o=n?new Date(i).toLocaleDateString("en"===e?"en-US":"zh-CN"):"";return(0,b.jsxs)("div",{className:"space-y-2 rounded-lg border p-4",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,b.jsxs)("span",{className:"flex items-center gap-2 text-sm font-medium",children:[(0,b.jsx)(bb,{className:"h-4 w-4"}),g.settingTitle]}),(0,b.jsxs)(y.f,{type:"button",size:"sm",variant:n?"outline":"default",onClick:()=>m(!n),disabled:k,children:[k&&(0,b.jsx)(x.f,{className:"h-4 w-4 animate-spin"}),n?g.revoke:g.grant]})]}),(0,b.jsxs)("p",{className:"text-xs text-muted-foreground",children:[n?g.settingGranted.replace("{date}",o):g.settingNotGranted," ",(0,b.jsx)("a",{className:"underline underline-offset-2",href:(0,A.L)(e),target:"_blank",rel:"noopener noreferrer",children:g.policyLink})]})]})}var bd=a.i(613412),be=a.i(536670),bf=a.i(288756),bg=a.i(64332),bh=a.i(747164);function bi({isAdmin:a,userId:e,userEmail:g}){let{t:i}=(0,d.b)(),[j,k]=(0,c.useState)(!1),[l,m]=(0,c.useState)(!1),[n,o]=(0,c.useState)(null),p=`user:${e}:data-import`,{running:q,refresh:r}=(0,bg.f)(p),s=(0,c.useRef)(!1);(0,c.useEffect)(()=>{if(q){s.current=!0;return}s.current&&(s.current=!1,window.location.reload())},[q]);let t=async a=>{if(!a||await (0,M.u)(i.settings?.exportAllConfirm||"Export all users' data? This may take a while.")){k(!0);try{await (0,bh.f)(a?"/api/export?all=true&compress=gzip":"/api/export?compress=gzip",a?"wrong-notebook-export-all.json":"wrong-notebook-export.json")&&M.c.success(i.settings?.exportSuccess||"Export successful")}catch(b){h.V.error("[DataBackupSettings]",a?"Export all failed":"Export failed",{error:b}),M.c.error(i.settings?.exportFailed||"Export failed")}finally{k(!1)}}},u=async a=>{let b;if(!n)return;if(n.size>0x10000000)return void M.c.error(i.importFile.tooLarge.replace("{max}",String(256)));try{let a=new Uint8Array(await n.arrayBuffer()),c=a.length>1&&31===a[0]&&139===a[1]?(0,bf.S)(a):a;if(c.length>0x10000000)return void M.c.error(i.importFile.tooLarge.replace("{max}",String(256)));b=JSON.parse(new TextDecoder().decode(c))}catch(a){h.V.error("[DataBackupSettings]","Import file is not valid JSON",{error:a}),M.c.error(i.settings?.importFailed||"Import failed");return}let c="object"==typeof b&&null!==b&&"user"in b?b.user:void 0,d="object"==typeof c&&null!==c&&"email"in c&&"string"==typeof c.email?c.email:null,e=!a&&!!d&&!!g&&d!==g,j=a?i.settings?.importAllConfirm||"Import all users' data? This will restore data for all users from the export file.":e?(i.settings?.importOtherAccountConfirm||"This backup belongs to {email}. Importing merges it into the current account without restoring that account's preferences. Continue?").replace("{email}",d??""):i.settings?.importConfirm||"Are you sure you want to import?";if(await (0,M.u)(j)){m(!0);try{let{stats:b}=await f.k.postRaw(a?"/api/import?all=true":e?"/api/import?merge=true":"/api/import",n,{timeout:3e5});M.c.success((i.settings?.importResultDesc||"Imported {subjects} notebooks, {tags} tags, {items} error items, {schedules} review schedules, {records} practice records, {papers} exam papers and {voices} cloud voice clips.").replace("{subjects}",String(b.subjectsCreated)).replace("{tags}",String(b.tagsCreated)).replace("{items}",String(b.errorItemsCreated)).replace("{schedules}",String(b.reviewSchedulesCreated)).replace("{records}",String(b.practiceRecordsCreated)).replace("{papers}",String(b.examPapersCreated??0)).replace("{voices}",String(b.ttsSpeechesImported??0)).replace("{duplicates}",String(b.duplicateErrorItems??0))),o(null),window.location.reload()}catch(b){b instanceof f.a&&409===b.status&&b.data?.code==="TASK_ALREADY_RUNNING"?(M.c.info(i.errors.TASK_ALREADY_RUNNING),await r()):(h.V.error("[DataBackupSettings]",a?"Import all failed":e?"Merge import failed":"Import failed",{error:b}),M.c.error(i.settings?.importFailed||"Import failed"))}finally{m(!1)}}},v=(a,c)=>a?(0,b.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}):c,w=l||!!q;return(0,b.jsxs)("div",{className:"p-4 border border-blue-200 dark:border-blue-900 rounded-lg bg-blue-50 dark:bg-blue-950/40",children:[(0,b.jsx)("h4",{className:"text-sm font-bold text-blue-900 dark:text-blue-200 mb-3",children:i.settings?.dataManagement||"Data Management"}),(0,b.jsxs)("div",{className:"mb-4",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,b.jsx)("span",{className:"text-sm text-blue-800 dark:text-blue-200 font-medium",children:i.settings?.exportData||"Export Data"}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsxs)(y.f,{variant:"outline",size:"sm",onClick:()=>t(!1),disabled:j,className:"bg-blue-100 dark:bg-blue-900/40 hover:bg-blue-200 dark:hover:bg-blue-900/60 text-blue-900 dark:text-blue-200 border-blue-300 dark:border-blue-800",children:[v(j,(0,b.jsx)(be.f,{className:"mr-2 h-4 w-4"})),i.settings?.exportData||"Export"]}),a&&(0,b.jsxs)(y.f,{variant:"outline",size:"sm",onClick:()=>t(!0),disabled:j,className:"bg-orange-100 dark:bg-orange-900/40 hover:bg-orange-200 dark:hover:bg-orange-900/60 text-orange-900 dark:text-orange-200 border-orange-300 dark:border-orange-800",children:[v(j,(0,b.jsx)(be.f,{className:"mr-2 h-4 w-4"})),i.settings?.exportAllData||"Export All"]})]})]}),(0,b.jsx)("p",{className:"text-xs text-blue-700 dark:text-blue-300",children:i.settings?.exportDataDesc||"Export all data as JSON file."})]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,b.jsx)("span",{className:"text-sm text-blue-800 dark:text-blue-200 font-medium",children:i.settings?.importData||"Import Data"}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("input",{type:"file",accept:".json",onChange:a=>o(a.target.files?.[0]??n),className:"hidden",id:"import-file-input",disabled:w}),(0,b.jsxs)(y.f,{variant:"outline",size:"sm",onClick:()=>document.getElementById("import-file-input")?.click(),disabled:w,className:"bg-blue-100 dark:bg-blue-900/40 hover:bg-blue-200 dark:hover:bg-blue-900/60 text-blue-900 dark:text-blue-200 border-blue-300 dark:border-blue-800",children:[v(w,(0,b.jsx)(aV.f,{className:"mr-2 h-4 w-4"})),n?.name||i.settings?.selectFile||"Select File"]}),n&&(0,b.jsxs)(y.f,{variant:"outline",size:"sm",onClick:()=>u(!1),disabled:w,className:"bg-green-100 dark:bg-green-900/40 hover:bg-green-200 dark:hover:bg-green-900/60 text-green-900 dark:text-green-200 border-green-300 dark:border-green-800",children:[v(w,(0,b.jsx)(bd.f,{className:"mr-2 h-4 w-4"})),i.settings?.importData||"Import"]}),n&&a&&(0,b.jsxs)(y.f,{variant:"outline",size:"sm",onClick:()=>u(!0),disabled:w,className:"bg-orange-100 dark:bg-orange-900/40 hover:bg-orange-200 dark:hover:bg-orange-900/60 text-orange-900 dark:text-orange-200 border-orange-300 dark:border-orange-800",children:[v(w,(0,b.jsx)(bd.f,{className:"mr-2 h-4 w-4"})),i.settings?.importAllData||"Import All"]})]})]}),(0,b.jsx)("p",{className:"text-xs text-blue-700 dark:text-blue-300",children:i.settings?.importDataDesc||"Import data from JSON file. Existing data will be skipped."})]})]})}let bj={name:"bug",size:24,node:[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]]};bj.node;let bk=(0,G.f)(bj),bl="/api/admin/debug-logs";function bm(){let{t:a}=(0,d.b)(),{timeZone:e}=(0,v.M)(),g=a.admin.debugLog,[i,j]=(0,c.useState)(null),[k,l]=(0,c.useState)(!1),m=(0,c.useCallback)(async()=>{try{j(await f.k.get(bl))}catch(a){h.V.warn("[DebugLogSettings]","Failed to load debug status",{error:a})}},[]);(0,c.useEffect)(()=>{m()},[m]),(0,c.useEffect)(()=>{if(!i?.enabled)return;let a=setInterval(m,5e3);return()=>clearInterval(a)},[i?.enabled,m]);let n=async(a,b)=>{l(!0);try{await a()!==!1&&M.c.success(b)}catch(a){h.V.error("[DebugLogSettings]","Debug log action failed",{error:a}),M.c.error(g.failed)}finally{l(!1)}},o=a=>a?(0,al.r)(a,"yyyy-MM-dd HH:mm",e):"",p=i?.enabled?g.enabledHint.replace("{since}",o(i.enabledAt)).replace("{until}",o(i.expiresAt)):g.disabledHint,q=(i?.entryCount??0)>0;return(0,b.jsxs)("div",{className:"space-y-3 rounded-lg border p-4",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsxs)(ap.f,{htmlFor:"debug-mode-switch",className:"flex items-center gap-2 font-medium",children:[(0,b.jsx)(bk,{className:"h-4 w-4"}),g.title]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:g.desc})]}),(0,b.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:g.enable}),(0,b.jsx)(an.f,{id:"debug-mode-switch",checked:!!i?.enabled,onCheckedChange:a=>n(async()=>{j(await f.k.post(bl,{enabled:a}))},a?g.enabled:g.disabled),disabled:k||!i})]})]}),(0,b.jsxs)("p",{className:`text-xs ${i?.enabled?"text-orange-600":"text-muted-foreground"}`,children:[p,i&&(0,b.jsxs)(b.Fragment,{children:[" ",g.entries.replace("{count}",String(i.entryCount)),i.droppedCount>0&&g.dropped.replace("{count}",String(i.droppedCount))]})]}),(0,b.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row",children:[(0,b.jsxs)(y.f,{variant:"outline",size:"sm",onClick:()=>n(async()=>{let a=await (0,bh.f)(`${bl}/export`,"wrong-notebook-debug.json");return await m(),a},g.exported),disabled:k||!q,className:"sm:flex-1",children:[k?(0,b.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,b.jsx)(be.f,{className:"mr-2 h-4 w-4"}),g.export]}),(0,b.jsxs)(y.f,{variant:"outline",size:"sm",onClick:()=>n(async()=>{j(await f.k.delete(bl))},g.cleared),disabled:k||!q,children:[(0,b.jsx)(aw.f,{className:"mr-2 h-4 w-4"}),g.clear]})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:g.privacyNote})]})}var bn=a.i(225949);function bo({field:a,label:e,description:g}){let{t:i}=(0,d.b)(),[j,k]=(0,c.useState)(!1),[l,m]=(0,c.useState)(!1),[n,o]=(0,c.useState)(!1),[p,q]=(0,c.useState)(null),r=`preference-${a}`;(0,c.useEffect)(()=>{f.k.get("/api/user").then(b=>k(!!b[a])).catch(()=>void 0).finally(()=>m(!0))},[a]);let s=async b=>{k(b),o(!0);try{await f.k.patch("/api/user",{[a]:b}),q(i.importFlow.preferenceSaved)}catch(c){k(!b),q(i.importFlow.preferenceSaveFailed),h.V.error("[Settings]","Failed to save user preference",{field:a,error:c instanceof Error?c.message:String(c)})}finally{o(!1)}};return(0,b.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,b.jsx)(ap.f,{htmlFor:r,children:e}),(0,b.jsx)(an.f,{id:r,checked:j,onCheckedChange:s,disabled:!l||n})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:g}),p&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:p})]})}function bp(){let{t:a}=(0,d.b)();return(0,b.jsx)(bo,{field:"enableGeogebra",label:a.importFlow.enableGeogebra,description:a.importFlow.enableGeogebraDesc})}function bq(){let{t:a}=(0,d.b)();return(0,b.jsx)(bo,{field:"confirmBeforeImport",label:a.importFlow.confirmBeforeImport,description:a.importFlow.confirmBeforeImportDesc})}var br=a.i(249479);function bs(){let{t:a}=(0,d.b)(),[e,g]=(0,c.useState)(String(br.z)),[i,j]=(0,c.useState)(null),[k,l]=(0,c.useState)(!0),[m,n]=(0,c.useState)(!1),[o,p]=(0,c.useState)(null),q=Number(e),r=""!==e.trim()&&Number.isInteger(q)&&q>=br.P&&q<=br.o,s=(0,c.useCallback)(async()=>{l(!0),p(null);try{let a=(await f.k.get("/api/user")).masteryThreshold??br.z;g(String(a)),j(a)}catch(b){p(a.mastery.thresholdLoadFailed),h.V.error("[Settings]","加载已掌握阈值失败",{error:b instanceof Error?b.message:String(b)})}finally{l(!1)}},[a.mastery.thresholdLoadFailed]);(0,c.useEffect)(()=>{s()},[s]);let t=async()=>{if(r&&null!==i){n(!0),p(null);try{let b=(await f.k.patch("/api/user",{masteryThreshold:q})).masteryThreshold??q;j(b),g(String(b)),p(a.importFlow.preferenceSaved)}catch(b){p(a.importFlow.preferenceSaveFailed),h.V.error("[Settings]","保存已掌握阈值失败",{error:b instanceof Error?b.message:String(b)})}finally{n(!1)}}};return(0,b.jsxs)("div",{className:"space-y-2 border-t pt-4",children:[(0,b.jsx)(ap.f,{htmlFor:"mastery-threshold",children:a.mastery.thresholdLabel}),(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,b.jsx)(ao.f,{id:"mastery-threshold",type:"number",min:br.P,max:br.o,step:1,value:e,onChange:a=>{g(a.target.value),p(null)},disabled:k||m||null===i,className:"w-28","aria-describedby":"mastery-threshold-hint"}),(0,b.jsx)("span",{"aria-hidden":"true",children:"%"}),(0,b.jsxs)(y.f,{type:"button",size:"sm",variant:"outline",onClick:t,disabled:k||m||null===i||!r||q===i,children:[(k||m)&&(0,b.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}),a.importFlow.saveThreshold]}),!k&&null===i&&(0,b.jsx)(y.f,{type:"button",size:"sm",variant:"outline",onClick:s,children:a.importFlow.retryLoad})]}),(0,b.jsx)("p",{id:"mastery-threshold-hint",className:"text-xs text-muted-foreground",children:a.mastery.thresholdDescription}),null!==i&&!r&&(0,b.jsx)("p",{className:"text-xs text-destructive",role:"alert",children:a.mastery.thresholdInvalid}),o&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground",role:"status",children:o})]})}var bt=a.i(393045);function bu(){let{t:a}=(0,d.b)(),[e,i]=(0,c.useState)({gradeRecognitionMode:"fixed",fixedGradeSemester:null}),[j,k]=(0,c.useState)(null),[l,m]=(0,c.useState)(!0),[n,o]=(0,c.useState)(!1),[p,q]=(0,c.useState)(null),r=(0,c.useRef)(0),s=(0,c.useCallback)(async()=>{let b=++r.current;m(!0),q(null);try{let a=await f.k.get("/api/user");if(b!==r.current)return;let c={gradeRecognitionMode:a.gradeRecognitionMode??"fixed",fixedGradeSemester:a.fixedGradeSemester??null};i(c),k(c)}catch(c){if(b!==r.current)return;q(a.questionGrade.loadFailed),h.V.error("[QuestionGradeSetting]","加载录入年级规则失败",{error:(0,g.Z)(c)})}finally{b===r.current&&m(!1)}},[a.questionGrade.loadFailed]);(0,c.useEffect)(()=>{s()},[s]);let t=async()=>{o(!0),q(null);try{let b=await f.k.patch("/api/user",e),c={gradeRecognitionMode:b.gradeRecognitionMode??e.gradeRecognitionMode,fixedGradeSemester:b.fixedGradeSemester??null};i(c),k(c),q(a.importFlow.preferenceSaved)}catch(b){q(a.importFlow.preferenceSaveFailed),h.V.error("[QuestionGradeSetting]","保存录入年级规则失败",{error:(0,g.Z)(b)})}finally{o(!1)}},u=l||n||null===j,v=j?.gradeRecognitionMode===e.gradeRecognitionMode&&j?.fixedGradeSemester===e.fixedGradeSemester;return(0,b.jsxs)("div",{className:"space-y-3 border-t pt-4",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ap.f,{htmlFor:"question-grade-mode",children:a.questionGrade.label}),(0,b.jsxs)("select",{id:"question-grade-mode",value:e.gradeRecognitionMode,disabled:u,onChange:a=>{i({...e,gradeRecognitionMode:a.target.value}),q(null)},className:"h-10 w-full rounded-md border border-input bg-background px-3 text-sm disabled:opacity-50",children:[(0,b.jsx)("option",{value:"fixed",children:a.questionGrade.fixed}),(0,b.jsx)("option",{value:"ai",children:a.questionGrade.ai})]})]}),"fixed"===e.gradeRecognitionMode&&(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ap.f,{htmlFor:"question-fixed-grade",children:a.editor.gradeSemester}),(0,b.jsx)(bt.f,{id:"question-fixed-grade",value:e.fixedGradeSemester??"",disabled:u,onChange:a=>{i({...e,fixedGradeSemester:a||null}),q(null)}})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"fixed"===e.gradeRecognitionMode?a.questionGrade.fixedDescription:a.questionGrade.aiDescription}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:a.questionGrade.description}),(0,b.jsxs)(y.f,{type:"button",variant:"outline",size:"sm",disabled:u||v,onClick:t,children:[(l||n)&&(0,b.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}),a.questionGrade.save]}),!l&&null===j&&(0,b.jsx)(y.f,{type:"button",variant:"outline",size:"sm",onClick:s,children:a.importFlow.retryLoad}),p&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground",role:"status",children:p})]})}function bv(){let{t:a}=(0,d.b)();return(0,b.jsx)(bo,{field:"enableSvgAnimation",label:a.importFlow.enableSvgAnimation,description:a.importFlow.enableSvgAnimationDesc})}function bw({value:a,onChange:c,disabled:e}){let{t:f}=(0,d.b)();return(0,b.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,b.jsx)(ap.f,{htmlFor:"app-time-zone",children:f.settings.general.timeZoneLabel}),(0,b.jsx)(ao.f,{id:"app-time-zone",value:a,onChange:a=>c(a.target.value),disabled:e,list:"app-time-zones",placeholder:"Asia/Shanghai"}),(0,b.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(a=>(0,b.jsx)("option",{value:a},a))}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:f.settings.general.timeZoneDesc})]})}function bx({config:a,setConfig:c,isAdmin:e,disabled:f}){let{t:g,language:h,setLanguage:i}=(0,d.b)(),{timeZone:j}=(0,v.M)(),k=a=>c(b=>({...b,timeouts:{...b.timeouts,analyze:1e3*a}}));return(0,b.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ap.f,{children:g.settings?.language||"Language"}),(0,b.jsxs)(aQ.d,{value:h,onValueChange:a=>i(a),children:[(0,b.jsx)(aQ.P,{children:(0,b.jsx)(aQ.U,{})}),(0,b.jsxs)(aQ.r,{children:[(0,b.jsx)(aQ.T,{value:"zh",children:"中文 (Chinese)"}),(0,b.jsx)(aQ.T,{value:"en",children:"English"})]})]})]}),(0,b.jsx)(bw,{value:a.timeZone??j,onChange:a=>c(b=>({...b,timeZone:a})),disabled:!e||f}),e&&(0,b.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,b.jsx)(ap.f,{children:g.settings?.general?.timeoutLabel||"AI Analysis Timeout (Seconds)"}),(0,b.jsx)(ao.f,{type:"number",value:a.timeouts?.analyze?a.timeouts.analyze/1e3:"",onChange:a=>{let b=""===a.target.value?0:parseInt(a.target.value);k(isNaN(b)?0:b)},onBlur:()=>{let b=(a.timeouts?.analyze||0)/1e3,c=Math.min(600,Math.max(120,b));c!==b&&k(c)},min:120,max:600}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:g.settings?.general?.timeoutDesc||"Increase this value if you experience frequent timeouts during AI analysis."})]}),(0,b.jsx)(bq,{}),(0,b.jsx)(bu,{}),(0,b.jsx)(bv,{}),(0,b.jsx)(bp,{}),(0,b.jsx)(bn.f,{}),(0,b.jsx)(bs,{})]})}var by=a.i(403512),bz=a.i(591119),bA=a.i(481132);function bB(){let{t:a}=(0,d.b)(),{groups:e,loading:g,refetch:i}=(0,bA.f)(),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(!1),n=async()=>{let b=j.trim();if(b){m(!0);try{await f.k.post("/api/paper-groups",{name:b}),k(""),M.c.success(a.common?.messages?.saveSuccess||"Saved"),i()}catch(b){h.V.error("[PaperGroupSettings]","Failed to add group",{error:b}),M.c.error(a.common?.messages?.saveFailed||"Failed to save")}finally{m(!1)}}},o=async(b,c)=>{let d=window.prompt(a.settings?.paperGroups?.renamePrompt||"Rename group",c);if(d&&d.trim()!==c)try{await f.k.patch(`/api/paper-groups/${b}`,{name:d.trim()}),M.c.success(a.common?.messages?.saveSuccess||"Saved"),i()}catch(b){h.V.error("[PaperGroupSettings]","Failed to rename group",{error:b}),M.c.error(a.common?.messages?.saveFailed||"Failed to save")}},p=async(b,c)=>{try{await f.k.patch(`/api/paper-groups/${b}`,{isActive:!c}),M.c.success(a.common?.messages?.saveSuccess||"Saved"),i()}catch(b){h.V.error("[PaperGroupSettings]","Failed to toggle group",{error:b}),M.c.error(a.common?.messages?.saveFailed||"Failed to save")}},q=async(b,c,d)=>{if(d>0){let e=(a.settings?.paperGroups?.deleteConfirmWithItems||'Group "{name}" has {count} questions. Deleting will clear their group assignment. Continue?').replace("{name}",c).replace("{count}",String(d));if(!await (0,M.u)(e,{destructive:!0}))return;try{await f.k.delete(`/api/paper-groups/${b}?clear=true`),M.c.success(a.common?.messages?.deleteSuccess||"Deleted"),i()}catch(b){h.V.error("[PaperGroupSettings]","Failed to delete group",{error:b}),M.c.error(a.common?.messages?.deleteFailed||"Delete failed")}return}let e=(a.settings?.paperGroups?.deleteConfirm||'Delete group "{name}"?').replace("{name}",c);if(await (0,M.u)(e,{destructive:!0}))try{await f.k.delete(`/api/paper-groups/${b}`),M.c.success(a.common?.messages?.deleteSuccess||"Deleted"),i()}catch(b){h.V.error("[PaperGroupSettings]","Failed to delete group",{error:b}),M.c.error(a.common?.messages?.deleteFailed||"Delete failed")}};return g?(0,b.jsx)(bz.N,{children:(0,b.jsx)(bz.O,{className:"py-12 flex items-center justify-center",children:(0,b.jsx)(x.f,{className:"h-6 w-6 animate-spin text-muted-foreground"})})}):(0,b.jsxs)(bz.N,{children:[(0,b.jsxs)(bz.Y,{children:[(0,b.jsxs)(bz.v,{className:"flex items-center gap-2 text-lg",children:[(0,b.jsx)(E.f,{className:"h-5 w-5"}),a.settings?.paperGroups?.title||"Paper Groups"]}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:a.settings?.paperGroups?.desc||"Customize paper groups like Unit Test, Midterm, Final. Default groups A/B/Other can be renamed but not deleted."})]}),(0,b.jsxs)(bz.O,{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex gap-2",children:[(0,b.jsx)(ao.f,{value:j,onChange:a=>k(a.target.value),placeholder:a.settings?.paperGroups?.addPlaceholder||"e.g. Unit Test",onKeyDown:a=>{"Enter"===a.key&&n()}}),(0,b.jsxs)(y.f,{onClick:n,disabled:l||!j.trim(),children:[l?(0,b.jsx)(x.f,{className:"h-4 w-4 animate-spin"}):(0,b.jsx)(by.f,{className:"h-4 w-4 mr-1"}),a.common?.add||"Add"]})]}),(0,b.jsx)("div",{className:"space-y-2",children:e.map(c=>(0,b.jsxs)("div",{className:`flex items-center justify-between rounded-lg border p-3 ${!c.isActive?"opacity-50":""}`,children:[(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("span",{className:"font-medium",children:c.name}),c.key&&(0,b.jsx)(am.f,{variant:"secondary",className:"text-xs",children:a.settings?.paperGroups?.systemBadge||"Default"}),!c.isActive&&(0,b.jsx)(am.f,{variant:"outline",className:"text-xs",children:a.common?.inactive||"Inactive"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1",children:[(0,b.jsx)(y.f,{variant:"ghost",size:"sm",onClick:()=>o(c.id,c.name),children:a.common?.rename||"Rename"}),(0,b.jsx)(y.f,{variant:"ghost",size:"sm",onClick:()=>p(c.id,c.isActive),children:c.isActive?a.common?.deactivate||"Deactivate":a.common?.activate||"Activate"}),!c.key&&(0,b.jsx)(y.f,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>q(c.id,c.name,c._count?.errorItems||0),children:(0,b.jsx)(aw.f,{className:"h-4 w-4"})})]})]},c.id))})]})]})}var bC=a.i(489970),bD=a.i(585650),bE=a.i(533838),bF=a.i(986708),bG=a.i(429246);async function bH(a,b){try{return await navigator.clipboard.writeText(a),!0}catch{return b(a),!1}}async function bI(){try{return await navigator.clipboard.readText()}catch{return null}}function bJ({value:a,defaultValue:e,onChange:f,onReset:g,title:h,variables:i}){let{t:j}=(0,d.b)(),[k,l]=(0,c.useState)(!1),m=(0,c.useMemo)(()=>{let b=new Set(Array.from(new Set(Array.from(a.matchAll(/\{\{(\w+)\}\}/g),a=>a[1]))));return i.filter(a=>!b.has(a.name))},[a,i]),n=async()=>{await bH(a,a=>window.prompt(j.settings?.prompts?.copyManual||"Copy the template manually:",a))&&(l(!0),setTimeout(()=>l(!1),1500),M.c.success(j.settings?.prompts?.copied||"Template copied"))},o=async()=>{let b=await bI();null===b?M.c.error(j.settings?.prompts?.pasteFailed||"Cannot read the clipboard. Paste into the box manually."):b.trim()?(!a.trim()||await (0,M.u)(j.settings?.prompts?.pasteConfirm||"Replace the current template with the clipboard content?",{destructive:!0}))&&(f(b),M.c.success(j.settings?.prompts?.pasted||"Template replaced from the clipboard")):M.c.error(j.settings?.prompts?.pasteEmpty||"The clipboard is empty")},p=async()=>{await (0,M.u)(j.settings?.prompts?.resetConfirm||"Are you sure you want to reset to default?",{destructive:!0})&&g()};return(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,b.jsx)(ap.f,{className:"text-base font-semibold",children:h}),(0,b.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,b.jsxs)(y.f,{variant:"outline",size:"sm",onClick:n,children:[(0,b.jsx)(bD.f,{className:"w-4 h-4 mr-2"}),k?j.settings?.prompts?.copied||"Copied":j.settings?.prompts?.copy||"Copy"]}),(0,b.jsxs)(y.f,{variant:"outline",size:"sm",onClick:o,children:[(0,b.jsx)(bC.f,{className:"w-4 h-4 mr-2"}),j.settings?.prompts?.pasteReplace||"Replace with clipboard"]}),(0,b.jsxs)(y.f,{variant:"outline",size:"sm",onClick:p,children:[(0,b.jsx)(bE.f,{className:"w-4 h-4 mr-2"}),j.settings?.prompts?.reset||"Reset Default"]})]})]}),(0,b.jsxs)("div",{className:"bg-amber-50 dark:bg-amber-950/40 border border-amber-200 dark:border-amber-900 rounded-md p-3 flex items-start gap-3 text-amber-900 dark:text-amber-200 text-sm",children:[(0,b.jsx)(bF.f,{className:"w-4 h-4 mt-0.5 shrink-0"}),(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("p",{className:"font-medium",children:j.settings?.prompts?.customizeTitle||"Tailor the prompt to your child"}),(0,b.jsx)("p",{children:j.settings?.prompts?.customizeBody||"Copy the default template, rewrite the role, tone and analysis steps to fit your child's grade, weak points and learning habits, then paste it back. Keep the {{variables}}: they are filled with each question's data."})]})]}),(0,b.jsxs)("div",{className:"space-y-2 border rounded-md p-3 bg-background",children:[(0,b.jsxs)("h4",{className:"text-xs font-medium flex items-center gap-1.5 mb-2",children:[(0,b.jsx)(ac,{className:"h-3.5 w-3.5"}),j.settings?.prompts?.variables||"Available Variables"]}),(0,b.jsx)("div",{className:"space-y-1.5",children:i.map(a=>(0,b.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start gap-1 sm:gap-2 text-xs py-1",children:[(0,b.jsx)("code",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[11px] shrink-0",children:`{{${a.name}}}`}),(0,b.jsx)("span",{className:"text-muted-foreground",children:a.description})]},a.name))}),m.length>0&&(0,b.jsx)("p",{className:"text-xs text-amber-700 dark:text-amber-300 pt-1",children:(j.settings?.prompts?.missingVariables||"Not referenced in this template: {names}. The app still adds the matching rules, but the data will not reach the model.").replace("{names}",m.map(a=>`{{${a.name}}}`).join("、"))})]}),(0,b.jsx)(bG.f,{value:a,onChange:a=>f(a.target.value),className:"font-mono text-xs min-h-[400px]",placeholder:e,"aria-label":h})]})}let bK="[REDACTED]",bL=/api[-_]?key|password|passwd|secret|authorization|cookie|credential|private[-_]?key|^(access|refresh|id|auth|api|bearer|session|csrf|setup)?[-_]?token$/i,bM=Symbol.for("wrong-notebook.debug-log");function bN(){let a=globalThis,b=a[bM];return b||(b={enabledAt:null,entries:[],totalSize:0,dropped:0},a[bM]=b),b}function bO(a){let b=a.replace(/data:([\w.+-]+\/[\w.+-]+);base64,[A-Za-z0-9+/=]+/g,(a,b)=>`[data:${b}, ${a.length} chars]`).replace(/(Bearer\s+)[\w\-.~+/]+=*/gi,`$1${bK}`).replace(/\bsk-[A-Za-z0-9_-]{8,}/g,bK).replace(/([?&](?:key|api_key|apikey|token|access_token)=)[^&\s"']+/gi,`$1${bK}`);return b.length>1e4&&(b=`${b.slice(0,1e4)}…[truncated ${b.length-1e4} chars]`),b}function bP(a,b,c,d=new Date){if(function(a=Date.now()){let b=bN();return null!==b.enabledAt&&(!(a-b.enabledAt>=864e5)||(b.enabledAt=null,!1))}(d.getTime()))try{let e={...function a(b,c=0,d=new WeakSet){if(null==b)return b;if("string"==typeof b)return bO(b);if("number"==typeof b||"boolean"==typeof b)return b;if("bigint"==typeof b)return b.toString();if("function"==typeof b||"symbol"==typeof b)return String(b);if(b instanceof Date)return b.toISOString();if(b instanceof Error){let e={name:b.name,message:bO(b.message)};return b.stack&&(e.stack=bO(b.stack)),void 0!==b.code&&(e.code=a(b.code,c+1,d)),void 0!==b.status&&(e.status=a(b.status,c+1,d)),void 0!==b.cause&&c<8&&(e.cause=a(b.cause,c+1,d)),e}if("object"!=typeof b)return String(b);if(d.has(b))return"[Circular]";if(c>=8)return"[Object]";if(d.add(b),Array.isArray(b)){let e=b.slice(0,100).map(b=>a(b,c+1,d));return b.length>100&&e.push(`…[${b.length-100} more items]`),e}return ArrayBuffer.isView(b)||b instanceof ArrayBuffer?`[Binary ${b.byteLength} bytes]`:Object.fromEntries(Object.entries(b).map(([b,e])=>[b,bL.test(b)&&null!=e&&""!==e?bK:a(e,c+1,d)]))}(b),time:d.toISOString(),level:a,msg:bO(c)},f=JSON.stringify(e).length,g=bN();for(g.entries.push({entry:e,size:f}),g.totalSize+=f;g.entries.length>5e3||g.totalSize>0x1400000&&g.entries.length>1;){let a=g.entries.shift();if(!a)break;g.totalSize-=a.size,g.dropped+=1}}catch{}}let bQ={trace:10,debug:20,info:30,warn:40,error:50,fatal:60};function bR(a,b={}){let c,d=bQ[a],e=(c=process.env.LOG_LEVEL?.toLowerCase())&&void 0!==bQ[c]?bQ[c]:bQ.info;return(c,f)=>{let g,h,i=new Date;if("string"==typeof c?(g={},h=c):(g=c,h=f||""),bP(a,{...b,...g},h,i),!(d<e)){let c=JSON.stringify({level:a,time:i.toISOString(),...b,...g,msg:h});switch(a){case"error":case"fatal":console.error(c);break;case"warn":console.warn(c);break;default:console.log(c)}}}}(function a(b={}){return b.module,{trace:bR("trace",b),debug:bR("debug",b),info:bR("info",b),warn:bR("warn",b),error:bR("error",b),fatal:bR("fatal",b),child:c=>a({...b,...c}),box:(a,c,d="📋")=>{bP("info",{...b,..."string"==typeof c?{content:c}:c},a);{let d="string"==typeof c?{content:c}:c||{};console.log(JSON.stringify({level:"info",time:new Date().toISOString(),...b,title:a,...d,msg:a}));return}},divider:(a="-")=>{}}})({env:"production"}).child({module:"ai:prompts"});let bS=`填写题目类型,只能是以下 key 之一:single_choice(单选题)、multiple_choice(多选题)、true_false(判断题)、fill_blank(填空题)、calculation(计算题)、solution(解答题)、reading(阅读理解)、cloze(完形填空)、writing(写作)、other(其他)。
|
|
2
|
-
若题型不明确,填 other。`,
|
|
1
|
+
module.exports=[418175,a=>{"use strict";var b=a.i(187924),c=a.i(572131),d=a.i(550194),e=a.i(875003),f=a.i(291938),g=a.i(960927),h=a.i(630534);let i=["system","light","dark"],j="system",k="app-theme";function l(a){return"string"==typeof a&&i.includes(a)}let m=(0,c.createContext)({preference:j,theme:"light",setPreference:()=>void 0}),n="(prefers-color-scheme: dark)",o=new Set;function p(a){return o.add(a),window.addEventListener("storage",a),()=>{o.delete(a),window.removeEventListener("storage",a)}}function q(){try{let a=localStorage.getItem(k);return l(a)?a:j}catch{return j}}function r(a){try{localStorage.setItem(k,a)}catch{}o.forEach(a=>a())}function s(a){let b=window.matchMedia(n);return b.addEventListener("change",a),()=>b.removeEventListener("change",a)}let t=()=>window.matchMedia(n).matches;function u({children:a}){let{data:d,status:i}=(0,e.useSession)(),k="authenticated"===i,n=d?.user?.email,o=(0,c.useSyncExternalStore)(p,q,()=>j),v=(0,c.useSyncExternalStore)(s,t,()=>!1),w="system"===o?v?"dark":"light":o;(0,c.useEffect)(()=>{let a=document.documentElement,b=b=>{a.classList.toggle("dark","dark"===b),a.style.colorScheme=b};b(w);let c=()=>b("light"),d=()=>b(w);return window.addEventListener("beforeprint",c),window.addEventListener("afterprint",d),()=>{window.removeEventListener("beforeprint",c),window.removeEventListener("afterprint",d)}},[w]),(0,c.useEffect)(()=>{if(!k||!n)return;let a=!1;return f.k.get("/api/user").then(b=>{!a&&l(b.themePreference)&&b.themePreference!==q()&&r(b.themePreference)}).catch(a=>{h.V.warn("[Theme]","Failed to load theme preference",{error:(0,g.Z)(a)})}),()=>{a=!0}},[k,n]);let x=(0,c.useCallback)(a=>{r(a),k&&f.k.patch("/api/user",{themePreference:a}).catch(a=>{h.V.warn("[Theme]","Failed to save theme preference",{error:(0,g.Z)(a)})})},[k]),y=(0,c.useMemo)(()=>({preference:o,theme:w,setPreference:x}),[o,w,x]);return(0,b.jsx)(m.Provider,{value:y,children:a})}var v=a.i(764800),w=a.i(529759),x=a.i(50944),y=a.i(875160),z=a.i(699570),A=a.i(814574),B=a.i(510606),C=a.i(283248),D=a.i(118688),E=a.i(895605),F=a.i(483138),G=a.i(462080),H=a.i(164831);let I={name:"circle-plus",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],aliases:["plus-circle"]};I.node;let J=(0,H.f)(I),K=[/^\/login/,/^\/register/,/^\/setup/,/^\/print-preview/,/^\/exams\/[^/]+\/print/],L=[{key:"home",href:"/",icon:J,match:a=>"/"===a},{key:"notebooks",href:"/notebooks",icon:D.f,match:a=>a.startsWith("/notebooks")||a.startsWith("/error-items")||a.startsWith("/practice")},{key:"review",href:"/review",icon:E.f,match:a=>a.startsWith("/review")},{key:"stats",href:"/stats",icon:C.f,match:a=>a.startsWith("/stats")||a.startsWith("/tags")},{key:"exams",href:"/exams",icon:F.f,match:a=>a.startsWith("/exams")},{key:"banks",href:"/banks",icon:G.f,match:a=>a.startsWith("/banks")}];function M(a){return K.some(b=>b.test(a))}var N=a.i(710302);let O="ai-consent-dismissed:";function P(){let{t:a,language:g}=(0,d.b)(),i=a.aiConsent,{data:j,status:k}=(0,e.useSession)(),l=(0,x.usePathname)()||"/",m="authenticated"===k?j?.user?.email??null:null,[n,o]=(0,c.useState)(null),[p,q]=(0,c.useState)(null),[r,s]=(0,c.useState)(!1);(0,c.useEffect)(()=>(0,B.y)(a=>o(b=>b??a)),[]);let t=M(l);(0,c.useEffect)(()=>{if(!m||t||function(a){try{return"1"===sessionStorage.getItem(a)}catch{return!1}}(O+m))return;let a=!1;return f.k.get("/api/user").then(b=>{a||!b||b.aiDataConsentAt||o(a=>a??"prompt")}).catch(a=>h.V.error("[AiConsentDialog]","load consent failed",{error:a})),()=>{a=!0}},[m,t]);let u=null!==n&&!!m;(0,c.useEffect)(()=>{if(!u)return;let a=!1;return f.k.get("/api/settings").then(b=>{a||q(b?.aiProvider??null)}).catch(()=>void 0),()=>{a=!0}},[u]);let v=()=>{o(null),s(!1)},w=async()=>{s(!0);try{await f.k.post("/api/user/ai-consent",{}),N.c.success("blocked"===n?i.agreedRetry:i.agreed),v()}catch(a){h.V.error("[AiConsentDialog]","save consent failed",{error:a}),N.c.error(i.failed),s(!1)}},C=()=>{m&&function(a){try{sessionStorage.setItem(a,"1")}catch{}}(O+m),N.c.info(i.declined),v()},D=(0,B.K)(p,g);return(0,b.jsx)(A.N,{open:u,onOpenChange:a=>{a||r||C()},children:(0,b.jsxs)(A.d,{className:"sm:max-w-lg",children:[(0,b.jsxs)(A.s,{children:[(0,b.jsx)(A.F,{children:i.title}),(0,b.jsx)(A.C,{children:"blocked"===n?i.blocked:i.intro})]}),(0,b.jsxs)("div",{className:"space-y-3 text-sm",children:["blocked"===n&&(0,b.jsx)("p",{children:i.intro}),(0,b.jsx)("ul",{className:"list-disc space-y-1 pl-5",children:i.items.map(a=>(0,b.jsx)("li",{children:a},a))}),(0,b.jsx)("p",{children:D?i.providerKnown.replace("{provider}",D):i.providerUnknown}),(0,b.jsxs)("p",{children:[i.policy,"en"===g?" ":"",(0,b.jsx)("a",{className:"underline underline-offset-2",href:(0,B.L)(g),target:"_blank",rel:"noopener noreferrer",children:i.policyLink}),"en"===g?".":"。"]}),(0,b.jsx)("p",{className:"text-muted-foreground",children:i.declineNote})]}),(0,b.jsxs)(A.c,{className:"gap-2",children:[(0,b.jsx)(z.f,{type:"button",variant:"outline",onClick:C,disabled:r,children:i.decline}),(0,b.jsxs)(z.f,{type:"button",onClick:w,disabled:r,children:[r&&(0,b.jsx)(y.f,{className:"h-4 w-4 animate-spin"}),i.agree]})]})]})})}var Q=a.i(16644),R=a.i(238246),S=a.i(557230);let T={name:"shield",size:24,node:[["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"}]]};T.node;let U=(0,H.f)(T);var V=a.i(303324);function W({status:a,onAccept:f}){let{t:g,language:i}=(0,d.b)(),[j,k]=(0,c.useState)(!1),l="en"===i?a.changes.en:a.changes.zh,m=async()=>{k(!0);try{await f()}catch(a){h.V.error("[EulaGate]","Failed to accept EULA",{error:a}),N.c.error(g.eula.acceptFailed)}finally{k(!1)}};return(0,b.jsx)("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/60 p-4",role:"dialog","aria-modal":"true","aria-labelledby":"eula-upgrade-title",children:(0,b.jsxs)("div",{className:"max-h-[90vh] w-full max-w-lg space-y-4 overflow-y-auto rounded-lg border bg-background p-5 shadow-lg",children:[(0,b.jsx)("h2",{id:"eula-upgrade-title",className:"text-lg font-semibold",children:g.eula.upgradeTitle}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:g.eula.upgradeDesc.replace("{accepted}",a.accepted??"-").replace("{current}",a.current)}),l.length>0&&(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("p",{className:"text-sm font-medium",children:g.eula.changesTitle}),(0,b.jsx)("ul",{className:"list-disc space-y-1 pl-5 text-sm",children:l.map(a=>(0,b.jsx)("li",{children:a},a))})]}),(0,b.jsx)(V.f,{}),(0,b.jsxs)("div",{className:"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",children:[(0,b.jsx)(z.f,{variant:"outline",onClick:()=>(0,e.signOut)({callbackUrl:"/login"}),disabled:j,children:g.eula.logout}),(0,b.jsxs)(z.f,{onClick:m,disabled:j,children:[j&&(0,b.jsx)(y.f,{className:"mr-2 h-4 w-4 animate-spin"}),g.eula.accept]})]})]})})}var X=a.i(780767),Y=a.i(682338),Z=a.i(368114);function $({className:a}){let{t:e}=(0,d.b)(),{data:f}=(0,Y.b)(),g=(0,c.useRef)(null);if((0,c.useEffect)(()=>{if(!f)return;let a=new Set([...f.tasks.filter(a=>"analyzing"===a.status||"saving"===a.status).map(a=>a.id),...(f.batches??[]).filter(a=>"splitting"===a.phase||"processing"===a.phase).map(a=>`batch:${a.id}`)]),b=new Set([...f.tasks.filter(a=>a.unread).map(a=>a.id),...(f.batches??[]).filter(a=>a.unread).map(a=>`batch:${a.id}`)]),c=g.current;c&&[...c].some(c=>!a.has(c)&&b.has(c))&&N.c.info(e.importTasks.finishedToast),g.current=a},[f,e.importTasks.finishedToast]),!f||0===f.tasks.length&&!f.batches?.length)return null;let{activeCount:h,unreadCount:i}=f,j=h>0?e.importTasks.entryActive.replace("{count}",String(h)):e.importTasks.entry;return(0,b.jsxs)(R.default,{href:"/import-tasks",className:(0,Z.f)("relative flex h-9 items-center gap-1.5 rounded-full border px-3 text-sm font-medium transition-colors hover:bg-muted",i>0?"border-primary/50 text-primary":"text-muted-foreground",a),"data-testid":"import-tasks-entry","aria-label":i>0?`${j} \xb7 ${e.importTasks.entryUnread.replace("{count}",String(i))}`:j,children:[h>0?(0,b.jsx)(y.f,{className:"h-4 w-4 animate-spin"}):(0,b.jsx)(X.f,{className:"h-4 w-4"}),(0,b.jsx)("span",{className:"whitespace-nowrap",children:j}),i>0&&(0,b.jsx)("span",{className:"flex h-5 min-w-5 items-center justify-center rounded-full bg-destructive px-1 text-xs text-white","data-testid":"import-tasks-unread",children:i})]})}var _=a.i(390702);let aa={name:"bot",size:24,node:[["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"}]]};aa.node;let ab=(0,H.f)(aa),ac={name:"info",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]};ac.node;let ad=(0,H.f)(ac);var ae=a.i(357204);let af={name:"message-square-text",size:24,node:[["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"}]]};af.node;let ag=(0,H.f)(af),ah={name:"settings",size:24,node:[["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"}]]};ah.node;let ai=(0,H.f)(ah);var aj=a.i(344451),ak=a.i(930363),al=a.i(875083),am=a.i(986705),an=a.i(786304),ao=a.i(563658),ap=a.i(866718),aq=a.i(870430);let ar=c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("div",{className:"relative w-full overflow-auto",children:(0,b.jsx)("table",{ref:d,className:(0,Z.f)("w-full caption-bottom text-sm",a),...c})}));ar.displayName="Table";let as=c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("thead",{ref:d,className:(0,Z.f)("[&_tr]:border-b",a),...c}));as.displayName="TableHeader";let at=c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("tbody",{ref:d,className:(0,Z.f)("[&_tr:last-child]:border-0",a),...c}));at.displayName="TableBody",(c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("tfoot",{ref:d,className:(0,Z.f)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",a),...c}))).displayName="TableFooter";let au=c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("tr",{ref:d,className:(0,Z.f)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",a),...c}));au.displayName="TableRow";let av=c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("th",{ref:d,className:(0,Z.f)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",a),...c}));av.displayName="TableHead";let aw=c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("td",{ref:d,className:(0,Z.f)("p-4 align-middle [&:has([role=checkbox])]:pr-0",a),...c}));aw.displayName="TableCell",(c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("caption",{ref:d,className:(0,Z.f)("mt-4 text-sm text-muted-foreground",a),...c}))).displayName="TableCaption";var ax=a.i(951675);let ay={name:"ban",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]]};ay.node;let az=(0,H.f)(ay);var aA=a.i(79362);function aB(){var a;let{t:e}=(0,d.b)(),[g,i]=(0,c.useState)(String(5)),[j,k]=(0,c.useState)(!1),l=(0,c.useCallback)(async()=>{try{let a=await f.k.get("/api/settings");i(String(a.aiConcurrencyLimit??5))}catch(a){h.V.error("[AiConcurrencyLimitSetting]","Failed to fetch config",{error:a})}},[]);(0,c.useEffect)(()=>{l()},[l]);let m=Number(g),n=""!==g.trim()&&"number"==typeof(a=m)&&Number.isInteger(a)&&a>=1&&a<=100,o=async()=>{if(n){k(!0);try{await f.k.post("/api/settings",{aiConcurrencyLimit:m}),N.c.success(e.admin.aiConcurrencyLimitSaved)}catch(a){h.V.error("[AiConcurrencyLimitSetting]","Failed to update AI concurrency limit",{error:a}),N.c.error(e.common.error)}finally{k(!1)}}};return(0,b.jsxs)("div",{className:"flex flex-col gap-3 p-4 border rounded-lg bg-muted/30 sm:flex-row sm:items-center sm:justify-between",children:[(0,b.jsxs)("div",{className:"space-y-0.5",children:[(0,b.jsx)(aq.f,{htmlFor:"ai-concurrency-limit",className:"text-base",children:e.admin.aiConcurrencyLimit}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:e.admin.aiConcurrencyLimitDesc})]}),(0,b.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,b.jsx)(ap.f,{id:"ai-concurrency-limit",type:"number",min:1,max:100,step:1,inputMode:"numeric",value:g,onChange:a=>i(a.target.value),"aria-invalid":!n,className:"w-24"}),(0,b.jsxs)(z.f,{size:"sm",onClick:o,disabled:j||!n,children:[j&&(0,b.jsx)(y.f,{className:"mr-2 h-4 w-4 animate-spin"}),e.common.save]})]})]})}function aC(a,b){return new Intl.NumberFormat("zh"===b?"zh-CN":"en-US",{notation:"compact",maximumFractionDigits:1}).format(Math.max(0,a))}function aD({user:a}){let{t:c,language:e}=(0,d.b)(),f=c.admin.aiTokensDetail.replace("{input}",aC(a.aiTokensToday.input,e)).replace("{output}",aC(a.aiTokensToday.output,e));return(0,b.jsxs)(b.Fragment,{children:[c.admin.aiUsageToday,": ",a.aiUsageToday," | ",c.admin.aiTokensToday,": ",f]})}function aE(){let{timeZone:a}=(0,w.M)(),{data:i}=(0,e.useSession)(),{t:j}=(0,d.b)(),[k,l]=(0,c.useState)([]),[m,n]=(0,c.useState)(!0),[o,p]=(0,c.useState)(!1),[q,r]=(0,c.useState)(!1),[s,t]=(0,c.useState)("0"),[u,v]=(0,c.useState)(!1),x=(0,c.useCallback)(async()=>{n(!0);try{let a=await f.k.get("/api/admin/users");l(a)}catch(a){h.V.error("[UserManagement]","Failed to fetch users",{error:a})}finally{n(!1)}},[]),A=(0,c.useCallback)(async()=>{try{let a=await f.k.get("/api/settings");p(!0===a.allowRegistration),t(String(a.aiDailyLimit??0))}catch(a){h.V.error("[UserManagement]","Failed to fetch config",{error:a})}},[]);(0,c.useEffect)(()=>{x(),A()},[x,A]);let B=async a=>{r(!0);try{await f.k.post("/api/settings",{allowRegistration:a}),p(a)}catch(a){h.V.error("[UserManagement]","Failed to update registration setting",{error:a}),N.c.error(j.common.error)}finally{r(!1)}},C=Number(s),D=""!==s.trim()&&Number.isInteger(C)&&C>=0,E=async()=>{if(D){v(!0);try{await f.k.post("/api/settings",{aiDailyLimit:C}),N.c.success(j.admin.aiDailyLimitSaved)}catch(a){h.V.error("[UserManagement]","Failed to update AI daily limit",{error:a}),N.c.error(j.common.error)}finally{v(!1)}}},F=async a=>{let b=a.isActive?j.admin.confirmDisable:j.admin.confirmEnable;if(await (0,N.u)(b))try{await f.k.patch(`/api/admin/users/${a.id}`,{isActive:!a.isActive}),x()}catch(a){h.V.error("[UserManagement]","Failed to update user status",{error:a}),N.c.error(j.common.error)}},G=async a=>{if(await (0,N.u)(j.admin.confirmDelete,{destructive:!0}))try{await f.k.delete(`/api/admin/users/${a.id}`),x()}catch(b){h.V.error("[UserManagement]","Failed to delete user",{error:b});let a=(0,g.d)(b)||j.common.error;N.c.error(a)}};return m?(0,b.jsx)("div",{className:"flex justify-center py-8",children:(0,b.jsx)(y.f,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between p-4 border rounded-lg bg-muted/30",children:[(0,b.jsxs)("div",{className:"space-y-0.5",children:[(0,b.jsx)(aq.f,{className:"text-base",children:j.admin?.allowRegistration||"Allow New Registrations"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:j.admin?.allowRegistrationDesc||"When disabled, new users cannot register"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[q&&(0,b.jsx)(y.f,{className:"h-4 w-4 animate-spin"}),(0,b.jsx)(ao.f,{checked:o,onCheckedChange:B,disabled:q})]})]}),(0,b.jsxs)("div",{className:"flex flex-col gap-3 p-4 border rounded-lg bg-muted/30 sm:flex-row sm:items-center sm:justify-between",children:[(0,b.jsxs)("div",{className:"space-y-0.5",children:[(0,b.jsx)(aq.f,{htmlFor:"ai-daily-limit",className:"text-base",children:j.admin.aiDailyLimit}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:j.admin.aiDailyLimitDesc})]}),(0,b.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,b.jsx)(ap.f,{id:"ai-daily-limit",type:"number",min:0,step:1,inputMode:"numeric",value:s,onChange:a=>t(a.target.value),"aria-invalid":!D,className:"w-24"}),(0,b.jsxs)(z.f,{size:"sm",onClick:E,disabled:u||!D,children:[u&&(0,b.jsx)(y.f,{className:"mr-2 h-4 w-4 animate-spin"}),j.common.save]})]})]}),(0,b.jsx)(aB,{}),(0,b.jsx)("div",{className:"sm:hidden space-y-3",children:k.map(c=>(0,b.jsxs)("div",{className:"border rounded-lg p-4 bg-card space-y-3",children:[(0,b.jsxs)("div",{className:"flex justify-between items-start",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"font-medium",children:c.name||"N/A"}),(0,b.jsx)("div",{className:"text-sm text-muted-foreground",children:c.email})]}),(0,b.jsx)(an.f,{variant:"admin"===c.role?"default":"secondary",children:"admin"===c.role?j.admin.admin:j.admin.user})]}),(0,b.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,b.jsxs)("div",{className:"text-muted-foreground",children:[j.admin.errors,": ",c._count.errorItems," | ",j.admin.practiceCount,": ",c._count.practiceRecords," | ",(0,b.jsx)(aD,{user:c})]}),(0,b.jsx)(an.f,{variant:c.isActive?"default":"destructive",className:"text-xs",children:c.isActive?j.admin.active:j.admin.disabled})]}),(0,b.jsxs)("div",{className:"flex justify-between items-center pt-2 border-t",children:[(0,b.jsx)("div",{className:"text-xs text-muted-foreground",children:(0,am.r)(c.createdAt,"yyyy-MM-dd",a)}),(0,b.jsxs)("div",{className:"flex gap-2",children:[(0,b.jsx)(z.f,{variant:"ghost",size:"sm",onClick:()=>F(c),disabled:c.id===i?.user?.id,children:c.isActive?(0,b.jsx)(az,{className:"h-4 w-4 text-orange-500"}):(0,b.jsx)(aA.f,{className:"h-4 w-4 text-green-500"})}),(0,b.jsx)(z.f,{variant:"ghost",size:"sm",onClick:()=>G(c),disabled:c.id===i?.user?.id,children:(0,b.jsx)(ax.f,{className:"h-4 w-4 text-destructive"})})]})]})]},c.id))}),(0,b.jsx)("div",{className:"hidden sm:block border rounded-lg overflow-hidden",children:(0,b.jsxs)(ar,{children:[(0,b.jsx)(as,{children:(0,b.jsxs)(au,{children:[(0,b.jsx)(av,{children:j.admin.nameEmail}),(0,b.jsx)(av,{children:j.admin.role}),(0,b.jsx)(av,{children:j.admin.stats}),(0,b.jsx)(av,{children:j.admin.createdAt}),(0,b.jsx)(av,{children:j.admin.status}),(0,b.jsx)(av,{className:"text-right",children:j.admin.actions})]})}),(0,b.jsx)(at,{children:k.map(c=>(0,b.jsxs)(au,{children:[(0,b.jsxs)(aw,{children:[(0,b.jsx)("div",{className:"font-medium",children:c.name||"N/A"}),(0,b.jsx)("div",{className:"text-sm text-muted-foreground",children:c.email})]}),(0,b.jsx)(aw,{children:(0,b.jsx)(an.f,{variant:"admin"===c.role?"default":"secondary",children:"admin"===c.role?j.admin.admin:j.admin.user})}),(0,b.jsxs)(aw,{children:[(0,b.jsxs)("div",{className:"text-sm",children:[j.admin.errors,": ",c._count.errorItems]}),(0,b.jsxs)("div",{className:"text-sm",children:[j.admin.practiceCount,": ",c._count.practiceRecords]}),(0,b.jsx)("div",{className:"text-sm",children:(0,b.jsx)(aD,{user:c})})]}),(0,b.jsx)(aw,{children:(0,am.r)(c.createdAt,"yyyy-MM-dd",a)}),(0,b.jsx)(aw,{children:(0,b.jsx)(an.f,{variant:c.isActive?"default":"destructive",children:c.isActive?j.admin.active:j.admin.disabled})}),(0,b.jsxs)(aw,{className:"text-right space-x-2",children:[(0,b.jsx)(z.f,{variant:"ghost",size:"sm",onClick:()=>F(c),disabled:c.id===i?.user?.id,title:c.isActive?j.admin.disable:j.admin.enable,children:c.isActive?(0,b.jsx)(az,{className:"h-4 w-4 text-orange-500"}):(0,b.jsx)(aA.f,{className:"h-4 w-4 text-green-500"})}),(0,b.jsx)(z.f,{variant:"ghost",size:"sm",onClick:()=>G(c),disabled:c.id===i?.user?.id,title:j.admin.delete,children:(0,b.jsx)(ax.f,{className:"h-4 w-4 text-destructive"})})]})]},c.id))})]})})]})}var aF=a.i(168370);let aG={name:"scroll-text",size:24,node:[["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"}]]};aG.node;let aH=(0,H.f)(aG);function aI(a){return(0,b.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a,children:[(0,b.jsx)("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"}),(0,b.jsx)("path",{d:"M9 18c-4.51 2-5-2-7-2"})]})}let aJ={name:"server",size:24,node:[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]};aJ.node;let aK=(0,H.f)(aJ);var aL=a.i(540553);let aM=()=>()=>void 0;function aN(){let{t:a}=(0,d.b)(),e=(0,c.useSyncExternalStore)(aM,aL.f,()=>null);return e?e.isStandalone?.()?(0,b.jsx)("p",{className:"text-center text-sm text-muted-foreground",children:a.settings?.about?.androidStandalone||"Running on this device. Data is stored only on this device."}):(0,b.jsxs)("div",{className:"flex flex-col items-center gap-2 text-sm text-muted-foreground",children:[(0,b.jsxs)("span",{className:"break-all",children:[a.settings?.about?.androidServer||"Server",": ",e.getServerUrl()]}),(0,b.jsxs)(z.f,{variant:"outline",className:"gap-2",onClick:()=>e.changeServer(),children:[(0,b.jsx)(aK,{className:"h-4 w-4"}),a.settings?.about?.changeServer||"Change server"]})]}):null}var aO=a.i(424235);function aP(){let{t:a}=(0,d.b)(),[e,f]=(0,c.useState)("");(0,c.useEffect)(()=>{fetch("/api/version").then(a=>a.json()).then(a=>f(a.version)).catch(()=>{})},[]);let g=[{href:aO.f,icon:aI,label:a.settings?.about?.github||"GitHub Repository"},{href:`${aO.f}/releases`,icon:aH,label:a.settings?.about?.releaseNotes||"Release Notes"},{href:`${aO.f}/issues`,icon:ag,label:a.settings?.about?.feedback||"Feedback"}];return(0,b.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,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("h3",{className:"text-2xl font-bold",children:a.app?.title||"Smart Error Notebook"}),(0,b.jsx)("p",{className:"text-muted-foreground",children:a.settings?.about?.desc||"AI-powered learning assistant"})]}),(0,b.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,b.jsx)(ad,{className:"h-4 w-4"}),(0,b.jsxs)("span",{children:[a.settings?.about?.version||"Version",": v",e||"unknown"]})]}),(0,b.jsx)(aN,{}),(0,b.jsx)("div",{className:"flex flex-col sm:flex-row flex-wrap justify-center gap-4 w-full sm:w-auto px-4 sm:px-0",children:g.map(({href:a,icon:c,label:d})=>(0,b.jsx)(z.f,{variant:"outline",asChild:!0,className:"gap-2 w-full sm:w-auto",children:(0,b.jsxs)("a",{href:a,target:"_blank",rel:"noopener noreferrer",children:[(0,b.jsx)(c,{className:"h-4 w-4"}),d,(0,b.jsx)(aF.f,{className:"h-3 w-3 ml-1 opacity-50"})]})},a))}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mt-8",children:a.settings?.about?.copyright||"© 2026 margrop · Based on wttwins/wrong-notebook · MIT License"})]})}var aQ=a.i(152679),aR=a.i(580701),aS=a.i(348966);let aT={name:"",email:"",educationStage:"",enrollmentYear:"",currentGrade:"",currentSemester:"",password:""};function aU(){let{t:a}=(0,d.b)(),[e,i]=(0,c.useState)(aT),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(!0),[n,o]=(0,c.useState)(!1),p=(0,c.useCallback)(async()=>{try{let a=await f.k.get("/api/user"),b=a.fixedGradeSemester?(0,aS.p)(a.fixedGradeSemester):null;i({name:a.name||"",email:a.email||"",educationStage:a.educationStage||"",enrollmentYear:a.enrollmentYear||"",currentGrade:b?.grade||"",currentSemester:b?.semester||"",password:""})}catch(a){h.V.error("[AccountSettings]","Failed to fetch profile",{error:a})}finally{m(!1)}},[]);(0,c.useEffect)(()=>{p()},[p]);let q=async()=>{if(e.password&&e.password!==j)return void N.c.error(a.settings?.messages?.passwordMismatch||"Passwords do not match");o(!0);try{let b={name:e.name,email:e.email,educationStage:e.educationStage};e.enrollmentYear&&(b.enrollmentYear=parseInt(e.enrollmentYear.toString())),e.password&&(b.password=e.password),e.currentGrade&&e.currentSemester?b.fixedGradeSemester=`${e.currentGrade}${e.currentSemester}`:e.currentGrade||(b.fixedGradeSemester=null),await f.k.patch("/api/user",b),N.c.success(a.settings?.messages?.profileUpdated||"Profile updated"),i(a=>({...a,password:""})),k(""),window.location.reload()}catch(b){h.V.error("[AccountSettings]","Failed to update profile",{error:(0,g.d)(b)??(0,g.Z)(b)}),N.c.error((0,g.d)(b)||a.settings?.messages?.updateFailed||"Update failed")}finally{o(!1)}};return l?(0,b.jsx)("div",{className:"flex justify-center py-8",children:(0,b.jsx)(y.f,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,b.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aq.f,{children:a.auth?.name||"Name"}),(0,b.jsx)(ap.f,{value:e.name||"",onChange:a=>i({...e,name:a.target.value})})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aq.f,{children:a.auth?.email||"Email"}),(0,b.jsx)(ap.f,{value:e.email||"",onChange:a=>i({...e,email:a.target.value}),type:"email"})]})]}),(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aq.f,{children:a.auth?.educationStage||"Education Stage"}),(0,b.jsxs)(aR.d,{value:e.educationStage||"",onValueChange:a=>i({...e,educationStage:a,currentGrade:(0,aS.c)(a).includes(e.currentGrade)?e.currentGrade:"",currentSemester:(0,aS.c)(a).includes(e.currentGrade)?e.currentSemester:""}),children:[(0,b.jsx)(aR.P,{children:(0,b.jsx)(aR.U,{placeholder:a.auth?.selectStage||"Select Stage"})}),(0,b.jsxs)(aR.r,{children:[(0,b.jsx)(aR.T,{value:"primary",children:a.auth?.primary||"Primary School"}),(0,b.jsx)(aR.T,{value:"junior_high",children:a.auth?.juniorHigh||"Junior High"}),(0,b.jsx)(aR.T,{value:"senior_high",children:a.auth?.seniorHigh||"Senior High"}),(0,b.jsx)(aR.T,{value:"university",children:a.auth?.university||"University"})]})]})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aq.f,{children:a.auth?.enrollmentYear||"Enrollment Year"}),(0,b.jsx)(ap.f,{type:"number",value:e.enrollmentYear||"",onChange:a=>i({...e,enrollmentYear:a.target.value}),placeholder:"YYYY"})]})]}),e.educationStage&&(0,aS.c)(e.educationStage).length>0&&(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aq.f,{children:a.settings?.account?.currentGrade||"Current Grade & Semester"}),(0,b.jsxs)(aR.d,{value:e.currentGrade||"",onValueChange:a=>i({...e,currentGrade:a,currentSemester:a?e.currentSemester||"上":""}),children:[(0,b.jsx)(aR.P,{children:(0,b.jsx)(aR.U,{placeholder:a.settings?.account?.selectGrade||"Select Grade"})}),(0,b.jsx)(aR.r,{children:(0,aS.c)(e.educationStage).map(a=>(0,b.jsx)(aR.T,{value:a,children:a},a))})]})]}),e.currentGrade&&(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aq.f,{children:a.settings?.account?.selectSemester||"Select Semester"}),(0,b.jsxs)(aR.d,{value:e.currentSemester||"",onValueChange:a=>i({...e,currentSemester:a}),children:[(0,b.jsx)(aR.P,{children:(0,b.jsx)(aR.U,{placeholder:a.settings?.account?.selectSemester||"Select Semester"})}),(0,b.jsxs)(aR.r,{children:[(0,b.jsx)(aR.T,{value:"上",children:a.settings?.account?.firstSemester||"1st Semester"}),(0,b.jsx)(aR.T,{value:"下",children:a.settings?.account?.secondSemester||"2nd Semester"})]})]})]})]}),e.currentGrade&&e.currentSemester&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground -mt-2",children:a.settings?.account?.gradeAppliedHint||"New questions will default to this grade. You can also configure AI grade recognition in General Settings."}),(0,b.jsxs)("div",{className:"space-y-3 pt-2 border-t",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aq.f,{children:a.settings?.account?.changePassword||"Change Password (Leave empty to keep)"}),(0,b.jsx)(aQ.f,{value:e.password,onChange:a=>i({...e,password:a.target.value}),placeholder:"******",minLength:6})]}),e.password&&(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aq.f,{children:a.auth?.confirmPassword||"Confirm Password"}),(0,b.jsx)(aQ.f,{value:j,onChange:a=>k(a.target.value),placeholder:"******",minLength:6})]})]}),(0,b.jsxs)(z.f,{onClick:q,disabled:n,className:"w-full",children:[n&&(0,b.jsx)(y.f,{className:"mr-2 h-4 w-4 animate-spin"}),a.settings?.account?.update||"Update Profile"]})]})}var aV=a.i(151304),aW=a.i(201661),aX=a.i(246059),aY=a.i(998868),aZ=a.i(332485),a$=a.i(861954);let a_="https://github.com/xiaoyang111222/cn-math-taxonomy",a0="https://raw.githubusercontent.com/xiaoyang111222/cn-math-taxonomy/HEAD/data/topics.json",a1=aX.z.object({id:aY.z.string().optional(),name:aY.z.string().trim().min(1),subject:aY.z.string().nullish(),grade:aZ.z.number().int(),semester:aY.z.string().nullish(),chapter:aY.z.string().nullish()}).passthrough();a$.z.array(a1).min(1);let a2="/api/admin/cnm-tags";function a3(){let{t:a}=(0,d.b)(),e=a.admin.cnmTags,[g,i]=(0,c.useState)(null),[j,k]=(0,c.useState)(!1),l=(0,c.useRef)(null),m=(0,c.useCallback)(async()=>{try{i(await f.k.get(a2))}catch(a){h.V.warn("[CnmTagImportSettings]","Failed to load status",{error:a})}},[]);(0,c.useEffect)(()=>{m()},[m]);let n=async a=>{if(a){k(!0);try{let b;try{b=JSON.parse(await a.text())}catch{N.c.error(e.invalidFile);return}let c=await f.k.post(a2,{topics:b},{timeout:3e5});i(c.status),N.c.success(e.imported.replace("{created}",String(c.result.created)).replace("{skipped}",String(c.result.skipped)))}catch(b){h.V.error("[CnmTagImportSettings]","Import failed",{error:b});let a=b instanceof f.a&&400===b.status;N.c.error(a?e.invalidFile:e.failed)}finally{k(!1),l.current&&(l.current.value="")}}},o=g?.knowledgePoints??0;return(0,b.jsxs)("div",{className:"space-y-3 rounded-lg border p-4",children:[(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsxs)("p",{className:"flex items-center gap-2 text-sm font-medium",children:[(0,b.jsx)(D.f,{className:"h-4 w-4"}),e.title]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:e.desc})]}),(0,b.jsxs)("div",{className:"space-y-1 rounded-md bg-muted/50 p-3 text-xs text-muted-foreground",children:[(0,b.jsx)("p",{children:e.downloadHint}),(0,b.jsx)("a",{href:a0,target:"_blank",rel:"noopener noreferrer",className:"block break-all text-primary underline",children:a0}),(0,b.jsxs)("p",{children:[e.sourceLabel," ",(0,b.jsx)("a",{href:a_,target:"_blank",rel:"noopener noreferrer",className:"break-all text-primary underline",children:a_})]})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:g?o>0?e.status.replace("{count}",String(o)):e.notImported:""}),(0,b.jsx)("input",{ref:l,type:"file",accept:".json,application/json",className:"hidden",onChange:a=>n(a.target.files?.[0]),disabled:j}),(0,b.jsxs)(z.f,{variant:"outline",size:"sm",className:"w-full sm:w-auto",onClick:()=>l.current?.click(),disabled:j,children:[j?(0,b.jsx)(y.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,b.jsx)(aW.f,{className:"mr-2 h-4 w-4"}),j?e.importing:e.select]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:e.note})]})}var a4=a.i(519783);let a5={info:{card:"border-blue-200 dark:border-blue-900 bg-blue-50 dark:bg-blue-950/40",title:"text-blue-900 dark:text-blue-200 font-bold",desc:"text-blue-800 dark:text-blue-200 font-medium",button:"bg-blue-100 dark:bg-blue-900/40 hover:bg-blue-200 dark:hover:bg-blue-900/60 text-blue-900 dark:text-blue-200 border-blue-300 dark:border-blue-800"},danger:{card:"border-red-200 dark:border-red-900 bg-red-50 dark:bg-red-950/40",title:"text-red-700 dark:text-red-300 font-medium",desc:"text-red-600 dark:text-red-400",button:""},critical:{card:"border-red-600/50 bg-red-100/50 dark:bg-red-900/40",title:"text-red-900 dark:text-red-200 font-bold",desc:"text-red-800 dark:text-red-200 font-medium",button:"bg-red-700 hover:bg-red-800"}};function a6({title:a,description:c,tone:d,busy:e,icon:f,onClick:g}){let h=a5[d];return(0,b.jsxs)("div",{className:`p-4 border rounded-lg ${h.card}`,children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)("span",{className:`text-sm flex items-center gap-2 ${h.title}`,children:a}),(0,b.jsx)(z.f,{variant:"info"===d?"outline":"destructive",size:"sm",onClick:g,disabled:e,className:h.button,children:e?(0,b.jsx)(y.f,{className:"h-4 w-4 animate-spin"}):f})]}),(0,b.jsx)("p",{className:`text-xs mt-2 ${h.desc}`,children:c})]})}function a7({isAdmin:a}){let{t:e}=(0,d.b)(),[g,i]=(0,c.useState)(null),j=async(a,b,c,d)=>{i(a);try{N.c.success(await b()),d&&window.location.reload()}catch(b){h.V.error("[DangerZoneSettings]",`${a} failed`,{error:b}),N.c.error(c)}finally{i(null)}},k=e.settings?.clearSuccess||"Success",l=e.settings?.clearError||"Failed",m=async()=>{await (0,N.u)(e.settings?.migrateTagsConfirm||"This will reset system tags. Confirm?",{destructive:!0})&&await j("migrateTags",async()=>{let a=await f.k.post("/api/admin/migrate-tags",{});return`${k}: ${a.count||0} tags migrated.`},e.settings?.clearError||"Failed to migrate tags",!1)},n=async()=>{await (0,N.u)(e.settings?.clearDataConfirm||"Are you sure?",{destructive:!0})&&await j("clearPractice",async()=>(await f.k.delete("/api/stats/practice/clear"),k),l,!0)},o=async()=>{await (0,N.u)(e.settings?.clearErrorDataConfirm||"Are you sure?",{destructive:!0})&&await j("clearErrors",async()=>(await f.k.delete("/api/error-items/clear"),k),l,!0)},p=async()=>{if(!await (0,N.u)(e.settings?.systemResetConfirm||"WARNING: Deleting ALL data. Undoing is impossible. Are you sure?",{destructive:!0}))return;let a=prompt(e.settings?.systemResetPrompt||"Type 'RESET' to confirm system initialization:","");if("RESET"!==a){null!==a&&N.c.error(e.common?.error||"Confirmation failed");return}await j("systemReset",async()=>(await f.k.post("/api/admin/system-reset",{}),e.settings?.clearSuccess||"Success - System Reset Complete"),e.settings?.clearError||"Failed to reset system",!0)};return(0,b.jsxs)(b.Fragment,{children:[a&&(0,b.jsx)(a6,{tone:"info",title:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a4.f,{className:"h-4 w-4"}),e.settings?.migrateTags||"Migrate Tags"]}),description:e.settings?.migrateTagsDesc||"Re-populates standard tags from file",busy:"migrateTags"===g,icon:(0,b.jsx)(a4.f,{className:"h-4 w-4"}),onClick:m}),(0,b.jsx)(a6,{tone:"danger",title:e.settings?.clearData||"Clear Practice Data",description:e.settings?.clearDataDesc||"This will permanently delete all practice history. Irreversible.",busy:"clearPractice"===g,icon:(0,b.jsx)(ax.f,{className:"h-4 w-4"}),onClick:n}),(0,b.jsx)(a6,{tone:"danger",title:e.settings?.clearErrorData||"Clear Error Data",description:e.settings?.clearErrorDataDesc||"This will permanently delete all error items. Irreversible.",busy:"clearErrors"===g,icon:(0,b.jsx)(ax.f,{className:"h-4 w-4"}),onClick:o}),a&&(0,b.jsx)(a6,{tone:"critical",title:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(_.f,{className:"h-4 w-4"}),e.settings?.systemReset||"System Initialization"]}),description:e.settings?.systemResetDesc||"Resets the system to factory state. Deletes ALL data.",busy:"systemReset"===g,icon:(0,b.jsx)(ax.f,{className:"h-4 w-4"}),onClick:p})]})}let a8={name:"user-x",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]};a8.node;let a9=(0,H.f)(a8);function ba({isAdmin:a}){let{t:g}=(0,d.b)(),i=g.settings.deleteAccount,[j,k]=(0,c.useState)(!1),[l,m]=(0,c.useState)(""),[n,o]=(0,c.useState)(!1),p=a=>{!n&&(k(a),a||m(""))},q=async a=>{if(a.preventDefault(),l){o(!0);try{await f.k.delete("/api/user",{body:JSON.stringify({password:l})}),N.c.success(i.success),await (0,e.signOut)({callbackUrl:"/login"})}catch(b){let a=b instanceof f.a&&400===b.status;a||h.V.error("[DeleteAccountSettings]","delete account failed",{error:b}),N.c.error(a?i.wrongPassword:i.failed),o(!1)}}};return(0,b.jsxs)("div",{className:"p-4 border rounded-lg border-red-600/50 bg-red-100/50 dark:bg-red-900/40",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,b.jsxs)("span",{className:"text-sm flex items-center gap-2 text-red-900 dark:text-red-200 font-bold",children:[(0,b.jsx)(a9,{className:"h-4 w-4"}),i.title]}),(0,b.jsx)(z.f,{variant:"destructive",size:"sm",className:"bg-red-700 hover:bg-red-800",disabled:a,onClick:()=>k(!0),"aria-label":i.title,children:(0,b.jsx)(a9,{className:"h-4 w-4"})})]}),(0,b.jsx)("p",{className:"text-xs mt-2 text-red-800 dark:text-red-200 font-medium",children:a?i.adminDisabled:i.desc}),(0,b.jsx)(A.N,{open:j,onOpenChange:p,children:(0,b.jsx)(A.d,{className:"sm:max-w-md",children:(0,b.jsxs)("form",{onSubmit:q,className:"space-y-4",children:[(0,b.jsxs)(A.s,{children:[(0,b.jsx)(A.F,{children:i.confirmTitle}),(0,b.jsx)(A.C,{children:i.confirmDesc})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aq.f,{htmlFor:"delete-account-password",children:i.passwordLabel}),(0,b.jsx)(aQ.f,{id:"delete-account-password",autoComplete:"current-password",value:l,onChange:a=>m(a.target.value),disabled:n})]}),(0,b.jsxs)(A.c,{className:"gap-2",children:[(0,b.jsx)(z.f,{type:"button",variant:"outline",onClick:()=>p(!1),disabled:n,children:i.cancel}),(0,b.jsxs)(z.f,{type:"submit",variant:"destructive",disabled:!l||n,children:[n&&(0,b.jsx)(y.f,{className:"h-4 w-4 animate-spin"}),i.confirm]})]})]})})})]})}let bb={name:"shield-check",size:24,node:[["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"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]};bb.node;let bc=(0,H.f)(bb);function bd(){let{t:a,language:e}=(0,d.b)(),g=a.aiConsent,[i,j]=(0,c.useState)(void 0),[k,l]=(0,c.useState)(!1);(0,c.useEffect)(()=>{let a=!1;return f.k.get("/api/user").then(b=>{a||j(b?.aiDataConsentAt??null)}).catch(a=>h.V.error("[AiConsentSetting]","load consent failed",{error:a})),()=>{a=!0}},[]);let m=async a=>{if(a||await (0,N.u)(g.revokeConfirm,{destructive:!0})){l(!0);try{let b=a?await f.k.post("/api/user/ai-consent",{}):await f.k.delete("/api/user/ai-consent");j(b.aiDataConsentAt),N.c.success(a?g.agreed:g.revoked)}catch(a){h.V.error("[AiConsentSetting]","update consent failed",{error:a}),N.c.error(g.failed)}finally{l(!1)}}};if(void 0===i)return null;let n=null!==i,o=n?new Date(i).toLocaleDateString("en"===e?"en-US":"zh-CN"):"";return(0,b.jsxs)("div",{className:"space-y-2 rounded-lg border p-4",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,b.jsxs)("span",{className:"flex items-center gap-2 text-sm font-medium",children:[(0,b.jsx)(bc,{className:"h-4 w-4"}),g.settingTitle]}),(0,b.jsxs)(z.f,{type:"button",size:"sm",variant:n?"outline":"default",onClick:()=>m(!n),disabled:k,children:[k&&(0,b.jsx)(y.f,{className:"h-4 w-4 animate-spin"}),n?g.revoke:g.grant]})]}),(0,b.jsxs)("p",{className:"text-xs text-muted-foreground",children:[n?g.settingGranted.replace("{date}",o):g.settingNotGranted," ",(0,b.jsx)("a",{className:"underline underline-offset-2",href:(0,B.L)(e),target:"_blank",rel:"noopener noreferrer",children:g.policyLink})]})]})}var be=a.i(613412),bf=a.i(536670),bg=a.i(288756),bh=a.i(64332),bi=a.i(747164);function bj({isAdmin:a,userId:e,userEmail:g}){let{t:i}=(0,d.b)(),[j,k]=(0,c.useState)(!1),[l,m]=(0,c.useState)(!1),[n,o]=(0,c.useState)(null),p=`user:${e}:data-import`,{running:q,refresh:r}=(0,bh.f)(p),s=(0,c.useRef)(!1);(0,c.useEffect)(()=>{if(q){s.current=!0;return}s.current&&(s.current=!1,window.location.reload())},[q]);let t=async a=>{if(!a||await (0,N.u)(i.settings?.exportAllConfirm||"Export all users' data? This may take a while.")){k(!0);try{await (0,bi.f)(a?"/api/export?all=true&compress=gzip":"/api/export?compress=gzip",a?"wrong-notebook-export-all.json":"wrong-notebook-export.json")&&N.c.success(i.settings?.exportSuccess||"Export successful")}catch(b){h.V.error("[DataBackupSettings]",a?"Export all failed":"Export failed",{error:b}),N.c.error(i.settings?.exportFailed||"Export failed")}finally{k(!1)}}},u=async a=>{let b;if(!n)return;if(n.size>0x10000000)return void N.c.error(i.importFile.tooLarge.replace("{max}",String(256)));try{let a=new Uint8Array(await n.arrayBuffer()),c=a.length>1&&31===a[0]&&139===a[1]?(0,bg.S)(a):a;if(c.length>0x10000000)return void N.c.error(i.importFile.tooLarge.replace("{max}",String(256)));b=JSON.parse(new TextDecoder().decode(c))}catch(a){h.V.error("[DataBackupSettings]","Import file is not valid JSON",{error:a}),N.c.error(i.settings?.importFailed||"Import failed");return}let c="object"==typeof b&&null!==b&&"user"in b?b.user:void 0,d="object"==typeof c&&null!==c&&"email"in c&&"string"==typeof c.email?c.email:null,e=!a&&!!d&&!!g&&d!==g,j=a?i.settings?.importAllConfirm||"Import all users' data? This will restore data for all users from the export file.":e?(i.settings?.importOtherAccountConfirm||"This backup belongs to {email}. Importing merges it into the current account without restoring that account's preferences. Continue?").replace("{email}",d??""):i.settings?.importConfirm||"Are you sure you want to import?";if(await (0,N.u)(j)){m(!0);try{let{stats:b}=await f.k.postRaw(a?"/api/import?all=true":e?"/api/import?merge=true":"/api/import",n,{timeout:3e5});N.c.success((i.settings?.importResultDesc||"Imported {subjects} notebooks, {tags} tags, {items} error items, {schedules} review schedules, {records} practice records, {papers} exam papers and {voices} cloud voice clips.").replace("{subjects}",String(b.subjectsCreated)).replace("{tags}",String(b.tagsCreated)).replace("{items}",String(b.errorItemsCreated)).replace("{schedules}",String(b.reviewSchedulesCreated)).replace("{records}",String(b.practiceRecordsCreated)).replace("{papers}",String(b.examPapersCreated??0)).replace("{voices}",String(b.ttsSpeechesImported??0)).replace("{duplicates}",String(b.duplicateErrorItems??0))),o(null),window.location.reload()}catch(b){b instanceof f.a&&409===b.status&&b.data?.code==="TASK_ALREADY_RUNNING"?(N.c.info(i.errors.TASK_ALREADY_RUNNING),await r()):(h.V.error("[DataBackupSettings]",a?"Import all failed":e?"Merge import failed":"Import failed",{error:b}),N.c.error(i.settings?.importFailed||"Import failed"))}finally{m(!1)}}},v=(a,c)=>a?(0,b.jsx)(y.f,{className:"mr-2 h-4 w-4 animate-spin"}):c,w=l||!!q;return(0,b.jsxs)("div",{className:"p-4 border border-blue-200 dark:border-blue-900 rounded-lg bg-blue-50 dark:bg-blue-950/40",children:[(0,b.jsx)("h4",{className:"text-sm font-bold text-blue-900 dark:text-blue-200 mb-3",children:i.settings?.dataManagement||"Data Management"}),(0,b.jsxs)("div",{className:"mb-4",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,b.jsx)("span",{className:"text-sm text-blue-800 dark:text-blue-200 font-medium",children:i.settings?.exportData||"Export Data"}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsxs)(z.f,{variant:"outline",size:"sm",onClick:()=>t(!1),disabled:j,className:"bg-blue-100 dark:bg-blue-900/40 hover:bg-blue-200 dark:hover:bg-blue-900/60 text-blue-900 dark:text-blue-200 border-blue-300 dark:border-blue-800",children:[v(j,(0,b.jsx)(bf.f,{className:"mr-2 h-4 w-4"})),i.settings?.exportData||"Export"]}),a&&(0,b.jsxs)(z.f,{variant:"outline",size:"sm",onClick:()=>t(!0),disabled:j,className:"bg-orange-100 dark:bg-orange-900/40 hover:bg-orange-200 dark:hover:bg-orange-900/60 text-orange-900 dark:text-orange-200 border-orange-300 dark:border-orange-800",children:[v(j,(0,b.jsx)(bf.f,{className:"mr-2 h-4 w-4"})),i.settings?.exportAllData||"Export All"]})]})]}),(0,b.jsx)("p",{className:"text-xs text-blue-700 dark:text-blue-300",children:i.settings?.exportDataDesc||"Export all data as JSON file."})]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,b.jsx)("span",{className:"text-sm text-blue-800 dark:text-blue-200 font-medium",children:i.settings?.importData||"Import Data"}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("input",{type:"file",accept:".json",onChange:a=>o(a.target.files?.[0]??n),className:"hidden",id:"import-file-input",disabled:w}),(0,b.jsxs)(z.f,{variant:"outline",size:"sm",onClick:()=>document.getElementById("import-file-input")?.click(),disabled:w,className:"bg-blue-100 dark:bg-blue-900/40 hover:bg-blue-200 dark:hover:bg-blue-900/60 text-blue-900 dark:text-blue-200 border-blue-300 dark:border-blue-800",children:[v(w,(0,b.jsx)(aW.f,{className:"mr-2 h-4 w-4"})),n?.name||i.settings?.selectFile||"Select File"]}),n&&(0,b.jsxs)(z.f,{variant:"outline",size:"sm",onClick:()=>u(!1),disabled:w,className:"bg-green-100 dark:bg-green-900/40 hover:bg-green-200 dark:hover:bg-green-900/60 text-green-900 dark:text-green-200 border-green-300 dark:border-green-800",children:[v(w,(0,b.jsx)(be.f,{className:"mr-2 h-4 w-4"})),i.settings?.importData||"Import"]}),n&&a&&(0,b.jsxs)(z.f,{variant:"outline",size:"sm",onClick:()=>u(!0),disabled:w,className:"bg-orange-100 dark:bg-orange-900/40 hover:bg-orange-200 dark:hover:bg-orange-900/60 text-orange-900 dark:text-orange-200 border-orange-300 dark:border-orange-800",children:[v(w,(0,b.jsx)(be.f,{className:"mr-2 h-4 w-4"})),i.settings?.importAllData||"Import All"]})]})]}),(0,b.jsx)("p",{className:"text-xs text-blue-700 dark:text-blue-300",children:i.settings?.importDataDesc||"Import data from JSON file. Existing data will be skipped."})]})]})}let bk={name:"bug",size:24,node:[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]]};bk.node;let bl=(0,H.f)(bk),bm="/api/admin/debug-logs";function bn(){let{t:a}=(0,d.b)(),{timeZone:e}=(0,w.M)(),g=a.admin.debugLog,[i,j]=(0,c.useState)(null),[k,l]=(0,c.useState)(!1),m=(0,c.useCallback)(async()=>{try{j(await f.k.get(bm))}catch(a){h.V.warn("[DebugLogSettings]","Failed to load debug status",{error:a})}},[]);(0,c.useEffect)(()=>{m()},[m]),(0,c.useEffect)(()=>{if(!i?.enabled)return;let a=setInterval(m,5e3);return()=>clearInterval(a)},[i?.enabled,m]);let n=async(a,b)=>{l(!0);try{await a()!==!1&&N.c.success(b)}catch(a){h.V.error("[DebugLogSettings]","Debug log action failed",{error:a}),N.c.error(g.failed)}finally{l(!1)}},o=a=>a?(0,am.r)(a,"yyyy-MM-dd HH:mm",e):"",p=i?.enabled?g.enabledHint.replace("{since}",o(i.enabledAt)).replace("{until}",o(i.expiresAt)):g.disabledHint,q=(i?.entryCount??0)>0;return(0,b.jsxs)("div",{className:"space-y-3 rounded-lg border p-4",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsxs)(aq.f,{htmlFor:"debug-mode-switch",className:"flex items-center gap-2 font-medium",children:[(0,b.jsx)(bl,{className:"h-4 w-4"}),g.title]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:g.desc})]}),(0,b.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:g.enable}),(0,b.jsx)(ao.f,{id:"debug-mode-switch",checked:!!i?.enabled,onCheckedChange:a=>n(async()=>{j(await f.k.post(bm,{enabled:a}))},a?g.enabled:g.disabled),disabled:k||!i})]})]}),(0,b.jsxs)("p",{className:`text-xs ${i?.enabled?"text-orange-600":"text-muted-foreground"}`,children:[p,i&&(0,b.jsxs)(b.Fragment,{children:[" ",g.entries.replace("{count}",String(i.entryCount)),i.droppedCount>0&&g.dropped.replace("{count}",String(i.droppedCount))]})]}),(0,b.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row",children:[(0,b.jsxs)(z.f,{variant:"outline",size:"sm",onClick:()=>n(async()=>{let a=await (0,bi.f)(`${bm}/export`,"wrong-notebook-debug.json");return await m(),a},g.exported),disabled:k||!q,className:"sm:flex-1",children:[k?(0,b.jsx)(y.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,b.jsx)(bf.f,{className:"mr-2 h-4 w-4"}),g.export]}),(0,b.jsxs)(z.f,{variant:"outline",size:"sm",onClick:()=>n(async()=>{j(await f.k.delete(bm))},g.cleared),disabled:k||!q,children:[(0,b.jsx)(ax.f,{className:"mr-2 h-4 w-4"}),g.clear]})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:g.privacyNote})]})}var bo=a.i(225949);function bp({field:a,label:e,description:g}){let{t:i}=(0,d.b)(),[j,k]=(0,c.useState)(!1),[l,m]=(0,c.useState)(!1),[n,o]=(0,c.useState)(!1),[p,q]=(0,c.useState)(null),r=`preference-${a}`;(0,c.useEffect)(()=>{f.k.get("/api/user").then(b=>k(!!b[a])).catch(()=>void 0).finally(()=>m(!0))},[a]);let s=async b=>{k(b),o(!0);try{await f.k.patch("/api/user",{[a]:b}),q(i.importFlow.preferenceSaved)}catch(c){k(!b),q(i.importFlow.preferenceSaveFailed),h.V.error("[Settings]","Failed to save user preference",{field:a,error:c instanceof Error?c.message:String(c)})}finally{o(!1)}};return(0,b.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,b.jsx)(aq.f,{htmlFor:r,children:e}),(0,b.jsx)(ao.f,{id:r,checked:j,onCheckedChange:s,disabled:!l||n})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:g}),p&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:p})]})}function bq(){let{t:a}=(0,d.b)();return(0,b.jsx)(bp,{field:"enableGeogebra",label:a.importFlow.enableGeogebra,description:a.importFlow.enableGeogebraDesc})}function br(){let{t:a}=(0,d.b)();return(0,b.jsx)(bp,{field:"confirmBeforeImport",label:a.importFlow.confirmBeforeImport,description:a.importFlow.confirmBeforeImportDesc})}var bs=a.i(249479);function bt(){let{t:a}=(0,d.b)(),[e,g]=(0,c.useState)(String(bs.z)),[i,j]=(0,c.useState)(null),[k,l]=(0,c.useState)(!0),[m,n]=(0,c.useState)(!1),[o,p]=(0,c.useState)(null),q=Number(e),r=""!==e.trim()&&Number.isInteger(q)&&q>=bs.P&&q<=bs.o,s=(0,c.useCallback)(async()=>{l(!0),p(null);try{let a=(await f.k.get("/api/user")).masteryThreshold??bs.z;g(String(a)),j(a)}catch(b){p(a.mastery.thresholdLoadFailed),h.V.error("[Settings]","加载已掌握阈值失败",{error:b instanceof Error?b.message:String(b)})}finally{l(!1)}},[a.mastery.thresholdLoadFailed]);(0,c.useEffect)(()=>{s()},[s]);let t=async()=>{if(r&&null!==i){n(!0),p(null);try{let b=(await f.k.patch("/api/user",{masteryThreshold:q})).masteryThreshold??q;j(b),g(String(b)),p(a.importFlow.preferenceSaved)}catch(b){p(a.importFlow.preferenceSaveFailed),h.V.error("[Settings]","保存已掌握阈值失败",{error:b instanceof Error?b.message:String(b)})}finally{n(!1)}}};return(0,b.jsxs)("div",{className:"space-y-2 border-t pt-4",children:[(0,b.jsx)(aq.f,{htmlFor:"mastery-threshold",children:a.mastery.thresholdLabel}),(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,b.jsx)(ap.f,{id:"mastery-threshold",type:"number",min:bs.P,max:bs.o,step:1,value:e,onChange:a=>{g(a.target.value),p(null)},disabled:k||m||null===i,className:"w-28","aria-describedby":"mastery-threshold-hint"}),(0,b.jsx)("span",{"aria-hidden":"true",children:"%"}),(0,b.jsxs)(z.f,{type:"button",size:"sm",variant:"outline",onClick:t,disabled:k||m||null===i||!r||q===i,children:[(k||m)&&(0,b.jsx)(y.f,{className:"mr-2 h-4 w-4 animate-spin"}),a.importFlow.saveThreshold]}),!k&&null===i&&(0,b.jsx)(z.f,{type:"button",size:"sm",variant:"outline",onClick:s,children:a.importFlow.retryLoad})]}),(0,b.jsx)("p",{id:"mastery-threshold-hint",className:"text-xs text-muted-foreground",children:a.mastery.thresholdDescription}),null!==i&&!r&&(0,b.jsx)("p",{className:"text-xs text-destructive",role:"alert",children:a.mastery.thresholdInvalid}),o&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground",role:"status",children:o})]})}var bu=a.i(393045);function bv(){let{t:a}=(0,d.b)(),[e,i]=(0,c.useState)({gradeRecognitionMode:"fixed",fixedGradeSemester:null}),[j,k]=(0,c.useState)(null),[l,m]=(0,c.useState)(!0),[n,o]=(0,c.useState)(!1),[p,q]=(0,c.useState)(null),r=(0,c.useRef)(0),s=(0,c.useCallback)(async()=>{let b=++r.current;m(!0),q(null);try{let a=await f.k.get("/api/user");if(b!==r.current)return;let c={gradeRecognitionMode:a.gradeRecognitionMode??"fixed",fixedGradeSemester:a.fixedGradeSemester??null};i(c),k(c)}catch(c){if(b!==r.current)return;q(a.questionGrade.loadFailed),h.V.error("[QuestionGradeSetting]","加载录入年级规则失败",{error:(0,g.Z)(c)})}finally{b===r.current&&m(!1)}},[a.questionGrade.loadFailed]);(0,c.useEffect)(()=>{s()},[s]);let t=async()=>{o(!0),q(null);try{let b=await f.k.patch("/api/user",e),c={gradeRecognitionMode:b.gradeRecognitionMode??e.gradeRecognitionMode,fixedGradeSemester:b.fixedGradeSemester??null};i(c),k(c),q(a.importFlow.preferenceSaved)}catch(b){q(a.importFlow.preferenceSaveFailed),h.V.error("[QuestionGradeSetting]","保存录入年级规则失败",{error:(0,g.Z)(b)})}finally{o(!1)}},u=l||n||null===j,v=j?.gradeRecognitionMode===e.gradeRecognitionMode&&j?.fixedGradeSemester===e.fixedGradeSemester;return(0,b.jsxs)("div",{className:"space-y-3 border-t pt-4",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aq.f,{htmlFor:"question-grade-mode",children:a.questionGrade.label}),(0,b.jsxs)("select",{id:"question-grade-mode",value:e.gradeRecognitionMode,disabled:u,onChange:a=>{i({...e,gradeRecognitionMode:a.target.value}),q(null)},className:"h-10 w-full rounded-md border border-input bg-background px-3 text-sm disabled:opacity-50",children:[(0,b.jsx)("option",{value:"fixed",children:a.questionGrade.fixed}),(0,b.jsx)("option",{value:"ai",children:a.questionGrade.ai})]})]}),"fixed"===e.gradeRecognitionMode&&(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aq.f,{htmlFor:"question-fixed-grade",children:a.editor.gradeSemester}),(0,b.jsx)(bu.f,{id:"question-fixed-grade",value:e.fixedGradeSemester??"",disabled:u,onChange:a=>{i({...e,fixedGradeSemester:a||null}),q(null)}})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"fixed"===e.gradeRecognitionMode?a.questionGrade.fixedDescription:a.questionGrade.aiDescription}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:a.questionGrade.description}),(0,b.jsxs)(z.f,{type:"button",variant:"outline",size:"sm",disabled:u||v,onClick:t,children:[(l||n)&&(0,b.jsx)(y.f,{className:"mr-2 h-4 w-4 animate-spin"}),a.questionGrade.save]}),!l&&null===j&&(0,b.jsx)(z.f,{type:"button",variant:"outline",size:"sm",onClick:s,children:a.importFlow.retryLoad}),p&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground",role:"status",children:p})]})}function bw(){let{t:a}=(0,d.b)();return(0,b.jsx)(bp,{field:"enableSvgAnimation",label:a.importFlow.enableSvgAnimation,description:a.importFlow.enableSvgAnimationDesc})}var bx=a.i(540648);function by({value:a,onChange:c,disabled:e}){let{t:f}=(0,d.b)(),g=f.settings.general;return(0,b.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,b.jsx)(aq.f,{htmlFor:"question-numbering",children:g.questionNumberingLabel}),(0,b.jsxs)(aR.d,{value:a,onValueChange:a=>{(0,bx.M)(a)&&c(a)},disabled:e,children:[(0,b.jsx)(aR.P,{id:"question-numbering",children:(0,b.jsx)(aR.U,{})}),(0,b.jsx)(aR.r,{children:bx.v.map(a=>(0,b.jsx)(aR.T,{value:a,children:g.questionNumberingOptions[a]},a))})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:g.questionNumberingDesc})]})}function bz({value:a,onChange:c,disabled:e}){let{t:f}=(0,d.b)(),g=f.settings.general;return(0,b.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,b.jsx)(aq.f,{htmlFor:"figure-review",children:g.figureReviewLabel}),(0,b.jsx)(ao.f,{id:"figure-review",checked:a,onCheckedChange:c,disabled:e})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:g.figureReviewDesc})]})}function bA({value:a,onChange:c,disabled:e}){let{t:f}=(0,d.b)();return(0,b.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,b.jsx)(aq.f,{htmlFor:"app-time-zone",children:f.settings.general.timeZoneLabel}),(0,b.jsx)(ap.f,{id:"app-time-zone",value:a,onChange:a=>c(a.target.value),disabled:e,list:"app-time-zones",placeholder:"Asia/Shanghai"}),(0,b.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(a=>(0,b.jsx)("option",{value:a},a))}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:f.settings.general.timeZoneDesc})]})}function bB({config:a,setConfig:c,isAdmin:e,disabled:f}){let{t:g,language:h,setLanguage:i}=(0,d.b)(),{timeZone:j}=(0,w.M)(),{numbering:k}=(0,v.I)(),l=a=>c(b=>({...b,timeouts:{...b.timeouts,analyze:1e3*a}}));return(0,b.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aq.f,{children:g.settings?.language||"Language"}),(0,b.jsxs)(aR.d,{value:h,onValueChange:a=>i(a),children:[(0,b.jsx)(aR.P,{children:(0,b.jsx)(aR.U,{})}),(0,b.jsxs)(aR.r,{children:[(0,b.jsx)(aR.T,{value:"zh",children:"中文 (Chinese)"}),(0,b.jsx)(aR.T,{value:"en",children:"English"})]})]})]}),(0,b.jsx)(bA,{value:a.timeZone??j,onChange:a=>c(b=>({...b,timeZone:a})),disabled:!e||f}),(0,b.jsx)(by,{value:a.questionNumbering??k,onChange:a=>c(b=>({...b,questionNumbering:a})),disabled:!e||f}),(0,b.jsx)(bz,{value:!0===a.figureReview,onChange:a=>c(b=>({...b,figureReview:a})),disabled:!e||f}),e&&(0,b.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,b.jsx)(aq.f,{children:g.settings?.general?.timeoutLabel||"AI Analysis Timeout (Seconds)"}),(0,b.jsx)(ap.f,{type:"number",value:a.timeouts?.analyze?a.timeouts.analyze/1e3:"",onChange:a=>{let b=""===a.target.value?0:parseInt(a.target.value);l(isNaN(b)?0:b)},onBlur:()=>{let b=(a.timeouts?.analyze||0)/1e3,c=Math.min(600,Math.max(120,b));c!==b&&l(c)},min:120,max:600}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:g.settings?.general?.timeoutDesc||"Increase this value if you experience frequent timeouts during AI analysis."})]}),(0,b.jsx)(br,{}),(0,b.jsx)(bv,{}),(0,b.jsx)(bw,{}),(0,b.jsx)(bq,{}),(0,b.jsx)(bo.f,{}),(0,b.jsx)(bt,{})]})}var bC=a.i(403512),bD=a.i(591119),bE=a.i(481132);function bF(){let{t:a}=(0,d.b)(),{groups:e,loading:g,refetch:i}=(0,bE.f)(),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(!1),n=async()=>{let b=j.trim();if(b){m(!0);try{await f.k.post("/api/paper-groups",{name:b}),k(""),N.c.success(a.common?.messages?.saveSuccess||"Saved"),i()}catch(b){h.V.error("[PaperGroupSettings]","Failed to add group",{error:b}),N.c.error(a.common?.messages?.saveFailed||"Failed to save")}finally{m(!1)}}},o=async(b,c)=>{let d=window.prompt(a.settings?.paperGroups?.renamePrompt||"Rename group",c);if(d&&d.trim()!==c)try{await f.k.patch(`/api/paper-groups/${b}`,{name:d.trim()}),N.c.success(a.common?.messages?.saveSuccess||"Saved"),i()}catch(b){h.V.error("[PaperGroupSettings]","Failed to rename group",{error:b}),N.c.error(a.common?.messages?.saveFailed||"Failed to save")}},p=async(b,c)=>{try{await f.k.patch(`/api/paper-groups/${b}`,{isActive:!c}),N.c.success(a.common?.messages?.saveSuccess||"Saved"),i()}catch(b){h.V.error("[PaperGroupSettings]","Failed to toggle group",{error:b}),N.c.error(a.common?.messages?.saveFailed||"Failed to save")}},q=async(b,c,d)=>{if(d>0){let e=(a.settings?.paperGroups?.deleteConfirmWithItems||'Group "{name}" has {count} questions. Deleting will clear their group assignment. Continue?').replace("{name}",c).replace("{count}",String(d));if(!await (0,N.u)(e,{destructive:!0}))return;try{await f.k.delete(`/api/paper-groups/${b}?clear=true`),N.c.success(a.common?.messages?.deleteSuccess||"Deleted"),i()}catch(b){h.V.error("[PaperGroupSettings]","Failed to delete group",{error:b}),N.c.error(a.common?.messages?.deleteFailed||"Delete failed")}return}let e=(a.settings?.paperGroups?.deleteConfirm||'Delete group "{name}"?').replace("{name}",c);if(await (0,N.u)(e,{destructive:!0}))try{await f.k.delete(`/api/paper-groups/${b}`),N.c.success(a.common?.messages?.deleteSuccess||"Deleted"),i()}catch(b){h.V.error("[PaperGroupSettings]","Failed to delete group",{error:b}),N.c.error(a.common?.messages?.deleteFailed||"Delete failed")}};return g?(0,b.jsx)(bD.N,{children:(0,b.jsx)(bD.O,{className:"py-12 flex items-center justify-center",children:(0,b.jsx)(y.f,{className:"h-6 w-6 animate-spin text-muted-foreground"})})}):(0,b.jsxs)(bD.N,{children:[(0,b.jsxs)(bD.Y,{children:[(0,b.jsxs)(bD.v,{className:"flex items-center gap-2 text-lg",children:[(0,b.jsx)(F.f,{className:"h-5 w-5"}),a.settings?.paperGroups?.title||"Paper Groups"]}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:a.settings?.paperGroups?.desc||"Customize paper groups like Unit Test, Midterm, Final. Default groups A/B/Other can be renamed but not deleted."})]}),(0,b.jsxs)(bD.O,{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex gap-2",children:[(0,b.jsx)(ap.f,{value:j,onChange:a=>k(a.target.value),placeholder:a.settings?.paperGroups?.addPlaceholder||"e.g. Unit Test",onKeyDown:a=>{"Enter"===a.key&&n()}}),(0,b.jsxs)(z.f,{onClick:n,disabled:l||!j.trim(),children:[l?(0,b.jsx)(y.f,{className:"h-4 w-4 animate-spin"}):(0,b.jsx)(bC.f,{className:"h-4 w-4 mr-1"}),a.common?.add||"Add"]})]}),(0,b.jsx)("div",{className:"space-y-2",children:e.map(c=>(0,b.jsxs)("div",{className:`flex items-center justify-between rounded-lg border p-3 ${!c.isActive?"opacity-50":""}`,children:[(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("span",{className:"font-medium",children:c.name}),c.key&&(0,b.jsx)(an.f,{variant:"secondary",className:"text-xs",children:a.settings?.paperGroups?.systemBadge||"Default"}),!c.isActive&&(0,b.jsx)(an.f,{variant:"outline",className:"text-xs",children:a.common?.inactive||"Inactive"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1",children:[(0,b.jsx)(z.f,{variant:"ghost",size:"sm",onClick:()=>o(c.id,c.name),children:a.common?.rename||"Rename"}),(0,b.jsx)(z.f,{variant:"ghost",size:"sm",onClick:()=>p(c.id,c.isActive),children:c.isActive?a.common?.deactivate||"Deactivate":a.common?.activate||"Activate"}),!c.key&&(0,b.jsx)(z.f,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>q(c.id,c.name,c._count?.errorItems||0),children:(0,b.jsx)(ax.f,{className:"h-4 w-4"})})]})]},c.id))})]})]})}var bG=a.i(489970),bH=a.i(585650),bI=a.i(533838),bJ=a.i(986708),bK=a.i(429246);async function bL(a,b){try{return await navigator.clipboard.writeText(a),!0}catch{return b(a),!1}}async function bM(){try{return await navigator.clipboard.readText()}catch{return null}}function bN({value:a,defaultValue:e,onChange:f,onReset:g,title:h,variables:i}){let{t:j}=(0,d.b)(),[k,l]=(0,c.useState)(!1),m=(0,c.useMemo)(()=>{let b=new Set(Array.from(new Set(Array.from(a.matchAll(/\{\{(\w+)\}\}/g),a=>a[1]))));return i.filter(a=>!b.has(a.name))},[a,i]),n=async()=>{await bL(a,a=>window.prompt(j.settings?.prompts?.copyManual||"Copy the template manually:",a))&&(l(!0),setTimeout(()=>l(!1),1500),N.c.success(j.settings?.prompts?.copied||"Template copied"))},o=async()=>{let b=await bM();null===b?N.c.error(j.settings?.prompts?.pasteFailed||"Cannot read the clipboard. Paste into the box manually."):b.trim()?(!a.trim()||await (0,N.u)(j.settings?.prompts?.pasteConfirm||"Replace the current template with the clipboard content?",{destructive:!0}))&&(f(b),N.c.success(j.settings?.prompts?.pasted||"Template replaced from the clipboard")):N.c.error(j.settings?.prompts?.pasteEmpty||"The clipboard is empty")},p=async()=>{await (0,N.u)(j.settings?.prompts?.resetConfirm||"Are you sure you want to reset to default?",{destructive:!0})&&g()};return(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,b.jsx)(aq.f,{className:"text-base font-semibold",children:h}),(0,b.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,b.jsxs)(z.f,{variant:"outline",size:"sm",onClick:n,children:[(0,b.jsx)(bH.f,{className:"w-4 h-4 mr-2"}),k?j.settings?.prompts?.copied||"Copied":j.settings?.prompts?.copy||"Copy"]}),(0,b.jsxs)(z.f,{variant:"outline",size:"sm",onClick:o,children:[(0,b.jsx)(bG.f,{className:"w-4 h-4 mr-2"}),j.settings?.prompts?.pasteReplace||"Replace with clipboard"]}),(0,b.jsxs)(z.f,{variant:"outline",size:"sm",onClick:p,children:[(0,b.jsx)(bI.f,{className:"w-4 h-4 mr-2"}),j.settings?.prompts?.reset||"Reset Default"]})]})]}),(0,b.jsxs)("div",{className:"bg-amber-50 dark:bg-amber-950/40 border border-amber-200 dark:border-amber-900 rounded-md p-3 flex items-start gap-3 text-amber-900 dark:text-amber-200 text-sm",children:[(0,b.jsx)(bJ.f,{className:"w-4 h-4 mt-0.5 shrink-0"}),(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("p",{className:"font-medium",children:j.settings?.prompts?.customizeTitle||"Tailor the prompt to your child"}),(0,b.jsx)("p",{children:j.settings?.prompts?.customizeBody||"Copy the default template, rewrite the role, tone and analysis steps to fit your child's grade, weak points and learning habits, then paste it back. Keep the {{variables}}: they are filled with each question's data."})]})]}),(0,b.jsxs)("div",{className:"space-y-2 border rounded-md p-3 bg-background",children:[(0,b.jsxs)("h4",{className:"text-xs font-medium flex items-center gap-1.5 mb-2",children:[(0,b.jsx)(ad,{className:"h-3.5 w-3.5"}),j.settings?.prompts?.variables||"Available Variables"]}),(0,b.jsx)("div",{className:"space-y-1.5",children:i.map(a=>(0,b.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start gap-1 sm:gap-2 text-xs py-1",children:[(0,b.jsx)("code",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[11px] shrink-0",children:`{{${a.name}}}`}),(0,b.jsx)("span",{className:"text-muted-foreground",children:a.description})]},a.name))}),m.length>0&&(0,b.jsx)("p",{className:"text-xs text-amber-700 dark:text-amber-300 pt-1",children:(j.settings?.prompts?.missingVariables||"Not referenced in this template: {names}. The app still adds the matching rules, but the data will not reach the model.").replace("{names}",m.map(a=>`{{${a.name}}}`).join("、"))})]}),(0,b.jsx)(bK.f,{value:a,onChange:a=>f(a.target.value),className:"font-mono text-xs min-h-[400px]",placeholder:e,"aria-label":h})]})}let bO="[REDACTED]",bP=/api[-_]?key|password|passwd|secret|authorization|cookie|credential|private[-_]?key|^(access|refresh|id|auth|api|bearer|session|csrf|setup)?[-_]?token$/i,bQ=Symbol.for("wrong-notebook.debug-log");function bR(){let a=globalThis,b=a[bQ];return b||(b={enabledAt:null,entries:[],totalSize:0,dropped:0},a[bQ]=b),b}function bS(a){let b=a.replace(/data:([\w.+-]+\/[\w.+-]+);base64,[A-Za-z0-9+/=]+/g,(a,b)=>`[data:${b}, ${a.length} chars]`).replace(/(Bearer\s+)[\w\-.~+/]+=*/gi,`$1${bO}`).replace(/\bsk-[A-Za-z0-9_-]{8,}/g,bO).replace(/([?&](?:key|api_key|apikey|token|access_token)=)[^&\s"']+/gi,`$1${bO}`);return b.length>1e4&&(b=`${b.slice(0,1e4)}…[truncated ${b.length-1e4} chars]`),b}function bT(a,b,c,d=new Date){if(function(a=Date.now()){let b=bR();return null!==b.enabledAt&&(!(a-b.enabledAt>=864e5)||(b.enabledAt=null,!1))}(d.getTime()))try{let e={...function a(b,c=0,d=new WeakSet){if(null==b)return b;if("string"==typeof b)return bS(b);if("number"==typeof b||"boolean"==typeof b)return b;if("bigint"==typeof b)return b.toString();if("function"==typeof b||"symbol"==typeof b)return String(b);if(b instanceof Date)return b.toISOString();if(b instanceof Error){let e={name:b.name,message:bS(b.message)};return b.stack&&(e.stack=bS(b.stack)),void 0!==b.code&&(e.code=a(b.code,c+1,d)),void 0!==b.status&&(e.status=a(b.status,c+1,d)),void 0!==b.cause&&c<8&&(e.cause=a(b.cause,c+1,d)),e}if("object"!=typeof b)return String(b);if(d.has(b))return"[Circular]";if(c>=8)return"[Object]";if(d.add(b),Array.isArray(b)){let e=b.slice(0,100).map(b=>a(b,c+1,d));return b.length>100&&e.push(`…[${b.length-100} more items]`),e}return ArrayBuffer.isView(b)||b instanceof ArrayBuffer?`[Binary ${b.byteLength} bytes]`:Object.fromEntries(Object.entries(b).map(([b,e])=>[b,bP.test(b)&&null!=e&&""!==e?bO:a(e,c+1,d)]))}(b),time:d.toISOString(),level:a,msg:bS(c)},f=JSON.stringify(e).length,g=bR();for(g.entries.push({entry:e,size:f}),g.totalSize+=f;g.entries.length>5e3||g.totalSize>0x1400000&&g.entries.length>1;){let a=g.entries.shift();if(!a)break;g.totalSize-=a.size,g.dropped+=1}}catch{}}let bU={trace:10,debug:20,info:30,warn:40,error:50,fatal:60};function bV(a,b={}){let c,d=bU[a],e=(c=process.env.LOG_LEVEL?.toLowerCase())&&void 0!==bU[c]?bU[c]:bU.info;return(c,f)=>{let g,h,i=new Date;if("string"==typeof c?(g={},h=c):(g=c,h=f||""),bT(a,{...b,...g},h,i),!(d<e)){let c=JSON.stringify({level:a,time:i.toISOString(),...b,...g,msg:h});switch(a){case"error":case"fatal":console.error(c);break;case"warn":console.warn(c);break;default:console.log(c)}}}}(function a(b={}){return b.module,{trace:bV("trace",b),debug:bV("debug",b),info:bV("info",b),warn:bV("warn",b),error:bV("error",b),fatal:bV("fatal",b),child:c=>a({...b,...c}),box:(a,c,d="📋")=>{bT("info",{...b,..."string"==typeof c?{content:c}:c},a);{let d="string"==typeof c?{content:c}:c||{};console.log(JSON.stringify({level:"info",time:new Date().toISOString(),...b,title:a,...d,msg:a}));return}},divider:(a="-")=>{}}})({env:"production"}).child({module:"ai:prompts"});let bW=`填写题目类型,只能是以下 key 之一:single_choice(单选题)、multiple_choice(多选题)、true_false(判断题)、fill_blank(填空题)、calculation(计算题)、solution(解答题)、reading(阅读理解)、cloze(完形填空)、writing(写作)、other(其他)。
|
|
2
|
+
若题型不明确,填 other。`,bX=`请参考《高思学校竞赛数学导引》(每讲分兴趣篇、拓展篇、超越篇,题目左侧标 1~5 颗星)的星级标准,结合题目所在年级评定难度:
|
|
3
3
|
- 1 星:课本基础题,直接套用概念、公式或简单计算即可(相当于兴趣篇前几题)。
|
|
4
4
|
- 2 星:校内拔高题,需要两三步推理或简单综合(相当于兴趣篇后几题)。
|
|
5
5
|
- 3 星:常规奥数题,小升初、杯赛常见难度,需要掌握该专题的典型方法(相当于拓展篇)。
|
|
6
6
|
- 4 星:较难奥数题,需要构造、分类讨论、转化或多种方法综合(相当于拓展篇末题、超越篇前几题)。
|
|
7
7
|
- 5 星:竞赛压轴题,集训队水平,思路巧妙、步骤长(相当于超越篇难题)。
|
|
8
|
-
非数学学科按同样的 1~5 级划分:1 星为基础识记,3 星为综合应用,5 星为竞赛或压轴难度。`,
|
|
9
|
-
- 白色背景、黑色线条(stroke="#000",线宽 1.5~2),需要区分的区域可用浅灰填充;不要使用彩色装饰。
|
|
10
|
-
- 按原图比例和相对位置绘制,保留原题印刷标注:顶点字母、数字、长度、角度、单位、箭头和虚线等,文字用 <text>(font-size 14~18);必须过滤掉人在图上手写的草稿、演算、思考批注、圈画和涂改痕迹。
|
|
11
|
-
- 只使用基本图形元素:line、polyline、polygon、rect、circle、ellipse、path、text、g、defs、marker。
|
|
12
|
-
- 严禁使用 <image>、<script>、<foreignObject>、外部链接、外部字体或事件属性。`,bV=String.raw`- 行内公式用 $...$,独立公式用 $$...$$;不要用 \(...\) 或 \[...\],每个 $ 必须成对出现。
|
|
8
|
+
非数学学科按同样的 1~5 级划分:1 星为基础识记,3 星为综合应用,5 星为竞赛或压轴难度。`,bY=String.raw`- 行内公式用 $...$,独立公式用 $$...$$;不要用 \(...\) 或 \[...\],每个 $ 必须成对出现。
|
|
13
9
|
- 所有 LaTeX 命令(如 \frac、\sqrt、\times、\angle)都必须写在 $...$ 内,公式外不能出现反斜杠命令。
|
|
14
10
|
- 只使用 KaTeX 支持的命令和环境:方程组用 \begin{cases}...\end{cases},多行推导用 \begin{aligned}...\end{aligned}(放在 $$...$$ 中),不要用 align、eqnarray、\newcommand、\usepackage、\label、\tag 等。
|
|
15
11
|
- 大括号 {} 必须成对,\left 与 \right 必须成对,\begin{...} 与 \end{...} 必须对应。
|
|
16
12
|
- 公式中的中文写在 \text{...} 里,或放到公式外;百分号写成 \%,美元符号写成 \$。
|
|
17
|
-
- 反斜杠只写一个(\frac),不要写成 \\frac;换行符 \\ 只能用在 cases、aligned 等环境里。`,
|
|
13
|
+
- 反斜杠只写一个(\frac),不要写成 \\frac;换行符 \\ 只能用在 cases、aligned 等环境里。`,bZ=`【角色与核心任务 (ROLE AND CORE TASK)】
|
|
18
14
|
你是一位世界顶尖的、经验丰富的、专业的跨学科考试分析专家(Interdisciplinary Exam Analysis Expert)。你的核心任务是极致准确地分析用户提供的考试题目图片,全面理解所有文本、图表和隐含约束,并提供一个完整、高度结构化且专业的解决方案。
|
|
19
15
|
|
|
20
16
|
{{language_instruction}}
|
|
@@ -40,11 +36,9 @@ module.exports=[418175,a=>{"use strict";var b=a.i(187924),c=a.i(572131),d=a.i(55
|
|
|
40
36
|
判断题目本身是否带有配图(几何图形、函数图像、示意图、统计图、实验装置图、电路图等;不含学生的作答痕迹和纯文字表格)。有配图填 true,否则填 false。
|
|
41
37
|
</has_figure>
|
|
42
38
|
|
|
43
|
-
<
|
|
44
|
-
如果 has_figure 为 true
|
|
45
|
-
|
|
46
|
-
如果 has_figure 为 false,请留空。
|
|
47
|
-
</figure_svg>
|
|
39
|
+
<figure_box>
|
|
40
|
+
如果 has_figure 为 true,填写配图在整张图片中的位置,格式为 x1,y1,x2,y2:(x1,y1) 为左上角、(x2,y2) 为右下角,坐标按图片宽高归一化到 0~1000(图片左上角为 0,0,右下角为 1000,1000)。框住整个配图及图中的标注文字,不要包含题干和选项文字;有多个配图时框住全部配图。如果 has_figure 为 false,请留空。
|
|
41
|
+
</figure_box>
|
|
48
42
|
|
|
49
43
|
<wrong_answer_text>
|
|
50
44
|
如果图片中包含学生针对本题提交的正式错误答案或正式解题步骤,请按原样摘录;必须过滤掉空白处或题干旁的草稿、竖式演算、试算数字、涂改痕迹、审题圈画以及人的思考过程批注。如果图片中只有草稿/思考痕迹或没有看到正式错误解答,请留空。
|
|
@@ -56,11 +50,11 @@ ${bU}
|
|
|
56
50
|
|
|
57
51
|
<difficulty_stars>
|
|
58
52
|
只填写 1 到 5 之间的一个整数,表示题目难度星级。
|
|
59
|
-
${
|
|
53
|
+
${bX}
|
|
60
54
|
</difficulty_stars>
|
|
61
55
|
|
|
62
56
|
<question_type>
|
|
63
|
-
${
|
|
57
|
+
${bW}
|
|
64
58
|
</question_type>
|
|
65
59
|
|
|
66
60
|
<mistake_analysis>
|
|
@@ -137,10 +131,10 @@ ${bS}
|
|
|
137
131
|
3. **内容完整**:如果包含子问题,请在 question_text 中完整列出。
|
|
138
132
|
4. **禁止图片**:严禁包含任何图片链接或 markdown 图片语法。
|
|
139
133
|
5. **LaTeX 规范**:
|
|
140
|
-
${
|
|
134
|
+
${bY}
|
|
141
135
|
|
|
142
136
|
{{grade_instruction}}
|
|
143
|
-
{{provider_hints}}`,
|
|
137
|
+
{{provider_hints}}`,b$=`你是一位资深的K12教育题目生成专家,具备跨学科的题目创作能力。你的核心任务是**根据以下原题和知识点,举一反三生成高质量教学题目**,帮助学生巩固知识并拓展解题思路。
|
|
144
138
|
### 角色定义
|
|
145
139
|
1. **学科全能专家**
|
|
146
140
|
- 精通K12阶段所有学科(数学/语文/英语/科学/物理/化学/生物/历史/地理/政治)
|
|
@@ -192,10 +186,10 @@ ${bV}
|
|
|
192
186
|
###关键格式与内容约束 (CRITICAL RULES) !!!
|
|
193
187
|
1. **纯文本**:内容作为纯文本处理,**不要转义反斜杠**。
|
|
194
188
|
2. **LaTeX 规范**:
|
|
195
|
-
${
|
|
189
|
+
${bY}
|
|
196
190
|
|
|
197
191
|
{{grade_instruction}}
|
|
198
|
-
{{provider_hints}}`,
|
|
192
|
+
{{provider_hints}}`,b_=`【角色与核心任务 (ROLE AND CORE TASK)】
|
|
199
193
|
你是一位经验丰富的专业教师。用户已经提供了一道**校正后的题目文本**,请你为这道题目提供正确的答案和详细的解析。
|
|
200
194
|
|
|
201
195
|
{{language_instruction}}
|
|
@@ -245,11 +239,11 @@ ${bV}
|
|
|
245
239
|
|
|
246
240
|
<difficulty_stars>
|
|
247
241
|
只填写 1 到 5 之间的一个整数,表示题目难度星级。
|
|
248
|
-
${
|
|
242
|
+
${bX}
|
|
249
243
|
</difficulty_stars>
|
|
250
244
|
|
|
251
245
|
<question_type>
|
|
252
|
-
${
|
|
246
|
+
${bW}
|
|
253
247
|
</question_type>
|
|
254
248
|
|
|
255
249
|
【!!! 关键格式与内容约束 (CRITICAL RULES) !!!】
|
|
@@ -258,9 +252,9 @@ ${bS}
|
|
|
258
252
|
3. **题目不变**:不要修改或重复题目内容,只提供答案和解析。
|
|
259
253
|
4. **解答完整**:答案要给出每一小问的最终结果;解析要写出完整的解题步骤,不要省略中间推导。
|
|
260
254
|
5. **LaTeX 规范**:
|
|
261
|
-
${
|
|
255
|
+
${bY}
|
|
262
256
|
|
|
263
257
|
{{grade_instruction}}
|
|
264
|
-
{{provider_hints}}`;var bZ=a.i(62832);function b$({config:a,onUpdate:c}){let{t:e}=(0,d.b)(),f=a.prompts?.analyze||bW,g=a.prompts?.similar||bX,h=a.prompts?.reanswer||bY,i=e.settings?.prompts?.vars,j=[{name:"language_instruction",description:i?.languageInstruction||"Language instructions."},{name:"knowledge_points_list",description:i?.knowledgePointsList||"Knowledge point tags for the subject."},{name:"grade_instruction",description:i?.gradeInstruction||"Grade and semester guidance."},{name:"provider_hints",description:i?.providerHints||"Provider compatibility hints."}],k=[{name:"original_question",description:i?.originalQuestion||"The full text of the original question."},{name:"knowledge_points",description:i?.knowledgePoints||"List of knowledge points to test."},{name:"difficulty_level",description:i?.difficultyLevel||"Target difficulty level."},{name:"difficulty_instruction",description:i?.difficultyInstruction||"Specific writing instructions for the target difficulty."},{name:"language_instruction",description:i?.languageInstructionShort||"Language formatting instructions."},{name:"figure_instruction",description:i?.figureInstruction||"Instructions for redrawing the original figure."},{name:"grade_instruction",description:i?.gradeInstruction||"Grade and semester guidance."}],l=[{name:"question_text",description:i?.questionText||"The corrected question text."},{name:"subject_hint",description:i?.subjectHint||"Subject of the question."},{name:"knowledge_points_rule",description:i?.knowledgePointsRule||"Candidate knowledge points to choose from."},{name:"language_instruction",description:i?.languageInstruction||"Language instructions."},{name:"grade_instruction",description:i?.gradeInstruction||"Grade and semester guidance."},{name:"provider_hints",description:i?.providerHints||"Provider compatibility hints."}];return(0,b.jsx)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:(0,b.jsxs)(ak.i,{defaultValue:"analyze",className:"w-full",children:[(0,b.jsxs)(ak.U,{className:"grid w-full grid-cols-3",children:[(0,b.jsx)(ak.k,{value:"analyze",className:"text-xs sm:text-sm",children:e.settings?.prompts?.analysisTab||"Analysis Prompt"}),(0,b.jsx)(ak.k,{value:"reanswer",className:"text-xs sm:text-sm",children:e.settings?.prompts?.reanswerTab||"Solving Prompt"}),(0,b.jsx)(ak.k,{value:"similar",className:"text-xs sm:text-sm",children:e.settings?.prompts?.similarTab||"Similar Question Prompt"})]}),(0,b.jsx)(ak.S,{value:"analyze",className:"py-4",children:(0,b.jsx)(bJ,{value:f,defaultValue:bW,onChange:a=>c("analyze",a),onReset:()=>c("analyze",bW),title:e.settings?.prompts?.customAnalysis||"Custom Analysis Template",variables:j})}),(0,b.jsx)(ak.S,{value:"reanswer",className:"py-4",children:(0,b.jsx)(bJ,{value:h,defaultValue:bY,onChange:a=>c("reanswer",a),onReset:()=>c("reanswer",bY),title:e.settings?.prompts?.customReanswer||"Custom Solving Template",variables:l})}),(0,b.jsx)(ak.S,{value:"similar",className:"py-4",children:(0,b.jsx)(bJ,{value:g,defaultValue:bX,onChange:a=>c("similar",a),onReset:()=>c("similar",bX),title:e.settings?.prompts?.customSimilar||"Custom Similar Question Template",variables:k})})]})})}bZ.I.join("、"),bZ.r.join("、");var b_=a.i(867147);function b0({open:a,onOpenChange:e,onConfirm:f}){let{t:g}=(0,d.b)(),[h,i]=(0,c.useState)(!1),[j,k]=(0,c.useState)(!1),l=async()=>{k(!0);try{await f(),i(!1),e(!1)}catch{}finally{k(!1)}};return(0,b.jsx)(z.N,{open:a,onOpenChange:a=>!j&&e(a),children:(0,b.jsxs)(z.d,{className:"w-[calc(100vw-2rem)] sm:max-w-lg",children:[(0,b.jsxs)(z.s,{children:[(0,b.jsx)(z.F,{children:g.eula.dialogTitle}),(0,b.jsx)(z.C,{children:g.eula.dialogDesc})]}),(0,b.jsx)(b_.f,{checked:h,onCheckedChange:i,disabled:j}),(0,b.jsxs)("div",{className:"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",children:[(0,b.jsx)(y.f,{variant:"outline",onClick:()=>e(!1),disabled:j,children:g.eula.cancel}),(0,b.jsxs)(y.f,{onClick:l,disabled:!h||j,children:[j&&(0,b.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}),g.eula.accept]})]})]})})}function b1({endpoint:a,retentionDays:e,disabled:f,onSave:g}){let{t:h}=(0,d.b)(),i=h.telemetrySettings,[j,k]=(0,c.useState)(""!==a),[l,m]=(0,c.useState)(a),[n,o]=(0,c.useState)(String(e)),p=Number(n),q=Number.isInteger(p)&&p>=1&&p<=365;return(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)(ap.f,{htmlFor:"telemetry-endpoint",children:i.endpoint}),j?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(ao.f,{id:"telemetry-endpoint",value:l,placeholder:i.endpointPlaceholder,disabled:f,onChange:a=>m(a.target.value)}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:i.endpointHint})]}):(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:i.endpointDefault}),(0,b.jsx)(y.f,{variant:"link",size:"sm",className:"h-auto p-0",disabled:f,onClick:()=>k(!0),children:i.endpointCustomize})]})]}),(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)(ap.f,{htmlFor:"telemetry-retention",children:i.retentionDays}),(0,b.jsx)(ao.f,{id:"telemetry-retention",type:"number",min:1,max:365,className:"w-32",value:n,disabled:f,onChange:a=>o(a.target.value)})]}),(0,b.jsx)(y.f,{size:"sm",variant:"outline",disabled:f||!q,onClick:()=>g({endpoint:l.trim(),retentionDays:p}),children:i.save})]})}function b2({events:a,errors:c,disabled:e,onClear:f}){let{t:g}=(0,d.b)(),{timeZone:h}=(0,v.M)(),i=g.telemetrySettings,j=a=>(0,al.r)(a,"MM-dd HH:mm",h),k=a=>a?i.forwarded:i.notForwarded,l=0===a.length&&0===c.length;return(0,b.jsxs)("details",{className:"rounded-md border p-3 text-sm",children:[(0,b.jsx)("summary",{className:"cursor-pointer font-medium",children:i.recentTitle}),(0,b.jsxs)("div",{className:"mt-3 space-y-3",children:[l&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:i.recentEmpty}),a.length>0&&(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("p",{className:"text-xs font-medium text-muted-foreground",children:i.recentEvents}),(0,b.jsx)("ul",{className:"space-y-1 font-mono text-xs",children:a.map(a=>(0,b.jsxs)("li",{className:"break-all",children:[j(a.createdAt)," ",a.name," ",a.payload??""," · ",k(a.forwardedAt)]},a.id))})]}),c.length>0&&(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("p",{className:"text-xs font-medium text-muted-foreground",children:i.recentErrors}),(0,b.jsx)("ul",{className:"space-y-1 font-mono text-xs",children:c.map(a=>(0,b.jsxs)("li",{className:"break-all",children:[j(a.createdAt)," ",a.kind," ",a.scope," ",a.name," #",a.fingerprint,a.path?` ${a.path}`:"",a.message?` — ${a.message}`:""," · ",k(a.forwardedAt)]},a.id))})]}),(0,b.jsxs)(y.f,{variant:"outline",size:"sm",onClick:f,disabled:e||l,children:[(0,b.jsx)(aw.f,{className:"mr-2 h-4 w-4"}),i.clear]})]})]})}function b3({id:a,label:c,description:d,checked:e,disabled:f,onCheckedChange:g}){return(0,b.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)(ap.f,{htmlFor:a,className:"font-medium",children:c}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:d})]}),(0,b.jsx)(an.f,{id:a,checked:e,disabled:f,onCheckedChange:g,className:"shrink-0"})]})}let b4="/api/admin/telemetry";async function b5(a){return await f.k.post("/api/admin/eula/accept",{version:a}),f.k.post(b4,{forwarding:!0})}function b6(a){return f.k.post(b4,a)}var b7=a.i(585982);function b8(){let{t:a}=(0,d.b)(),{timeZone:e}=(0,v.M)(),i=a.telemetrySettings,{data:j,update:k,enableWithConsent:l,clear:m}=function(){let[a,b]=(0,c.useState)(null),d=(0,c.useCallback)(async()=>{try{b(await f.k.get(b4))}catch(a){h.V.warn("[TelemetrySettings]","Failed to load telemetry status",{error:a})}},[]);return(0,c.useEffect)(()=>{d()},[d]),{data:a,update:async a=>b(await b6(a)),enableWithConsent:async a=>b(await b5(a)),clear:async()=>b(await f.k.delete(b4))}}(),[n,o]=(0,c.useState)(!1),[p,q]=(0,c.useState)(!1),r=async(a,b)=>{o(!0);try{await a(),M.c.success(b)}catch(a){throw h.V.error("[TelemetrySettings]","Telemetry action failed",{error:a}),M.c.error("INVALID_TELEMETRY_ENDPOINT"===(0,g.d)(a)?i.invalidEndpoint:i.failed),a}finally{o(!1)}},s=a=>r(async()=>{await k(a),(0,b7.z)("settings_changed",{section:"telemetry"})},i.saved).catch(()=>void 0);if(!j)return null;let t=j.lockedByEnv,u=n||t,w=a=>(0,al.r)(a,"yyyy-MM-dd HH:mm",e),x=async()=>{await (0,M.u)(i.clearConfirm)&&r(m,i.cleared).catch(()=>void 0)},y=j.lastFlushAt?i.lastFlush.replace("{time}",w(j.lastFlushAt)):i.neverFlushed;return j.lastAttempt?.status==="failed"&&(y=i.lastAttemptFailed.replace("{status}",String(j.lastAttempt.httpStatus??"network"))),j.lastAttempt?.status==="stopped"&&(y=i.lastAttemptStopped),(0,b.jsxs)("div",{className:"space-y-4 rounded-lg border p-4",children:[(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsxs)("p",{className:"flex items-center gap-2 font-medium",children:[(0,b.jsx)(bb,{className:"h-4 w-4"}),i.title]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:i.desc})]}),t&&(0,b.jsx)("p",{className:"text-xs text-orange-600",children:i.lockedByEnv}),j.consentPending&&(0,b.jsx)("p",{className:"text-xs text-orange-600",children:i.consentPending}),(0,b.jsxs)("p",{className:"text-xs text-muted-foreground",children:[j.eula.acceptedVersion?i.eulaStatus.replace("{version}",j.eula.acceptedVersion).replace("{time}",j.eula.acceptedAt?w(j.eula.acceptedAt):"-"):i.eulaNotAccepted," ",(0,b.jsx)("a",{href:"/eula",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:i.viewEula})]}),(0,b.jsx)(b3,{id:"telemetry-forwarding",label:i.forwarding,description:i.forwardingDesc,checked:j.forwarding,disabled:u,onCheckedChange:a=>{a&&(!j.eula.acceptedVersion||j.consentPending)?q(!0):s({forwarding:a})}}),j.forwarding&&(0,b.jsxs)("p",{className:"text-xs text-muted-foreground",children:[i.pending.replace("{count}",String(j.pending))," · ",y]}),(0,b.jsx)(b3,{id:"telemetry-recording",label:i.recording,description:i.recordingDesc,checked:j.recording,disabled:u,onCheckedChange:a=>s({recording:a})}),(0,b.jsx)(b3,{id:"telemetry-errors",label:i.errors,description:i.errorsDesc,checked:j.errors,disabled:u,onCheckedChange:a=>s({errors:a})}),(0,b.jsx)(b1,{endpoint:j.endpoint,retentionDays:j.retentionDays,disabled:u,onSave:s}),(0,b.jsx)(b2,{events:j.events,errors:j.errorRecords,disabled:n,onClear:x}),(0,b.jsx)(b0,{open:p,onOpenChange:q,onConfirm:()=>r(()=>l(j.eula.current),i.enabled)})]})}var b9=a.i(738835),ca=a.i(676330),cb=a.i(206194),cc=a.i(190622),cd=a.i(975484),ce=a.i(294655);function cf({config:a,setConfig:e,saving:i,onSave:j}){let{t:k,language:l}=(0,d.b)(),m=k.settings.tts,[n,o]=(0,c.useState)(!1),[p,q]=(0,c.useState)(null),r=a.tts?.mode??"browser",s=(0,ce.y)(r)?r:null,t=s?a.tts?.[s]:void 0,u=(a,b)=>{s&&e(c=>({...c,tts:{...c.tts,[s]:{...c.tts?.[s],[a]:b}}}))},v=!!s&&(0,ce.S)(s),w=s?(0,ce.L)(a,s):void 0,z=v?t?.apiKey:w?.apiKey,A=async()=>{(0,cd.p)(),o(!0),q(null);try{await j();let{id:a,version:b}=await f.k.post("/api/tts",{text:m.previewText,language:l},{timeout:12e4,recoverable:!0}),c=(0,cd.l)();if(!c)return;c.src=`/api/tts/${a}?v=${b}`,c.playbackRate=1,await c.play()}catch(b){h.V.error("[TtsSettings]","Preview failed",{error:b});let a=(0,g.d)(b);M.c.error("TTS_NOT_CONFIGURED"===a?m.notConfigured:"TTS_PROVIDER_ERROR"===a?m.providerError:m.previewFailed),q((0,g.L)(b)??null)}finally{o(!1)}};return(0,b.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ap.f,{children:m.title}),(0,b.jsxs)(aQ.d,{value:r,onValueChange:a=>e(b=>({...b,tts:{...b.tts,mode:a}})),children:[(0,b.jsx)(aQ.P,{children:(0,b.jsx)(aQ.U,{})}),(0,b.jsx)(aQ.r,{children:ce.l.map(a=>(0,b.jsx)(aQ.T,{value:a,children:m.modes[a]},a))})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:s?m.cloudHint:m.browserHint})]}),s&&(0,b.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[ce.D[s]&&(0,b.jsxs)("div",{className:"rounded-md border border-green-200 bg-green-50 p-3 text-xs text-green-800 dark:border-green-900 dark:bg-green-950/40 dark:text-green-300",children:[m.freeTrial," ",(0,b.jsx)("a",{href:ce.D[s],target:"_blank",rel:"noopener noreferrer",className:"underline",children:m.freeTrialLink})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ca.f,{label:"openai"===s?"OpenAI API Key":v?m.speechApiKey:`${(0,cc.z)(s,l)} API Key`,href:ce.r[s].apiKey,linkText:k.settings.ai.docLinks.apiKey}),(0,b.jsx)(aP.f,{value:z||"",onChange:a=>{var b;return b=a.target.value,void(s&&(v?u("apiKey",b):e(a=>({...a,[s]:{...a[s],apiKey:b}}))))},placeholder:"qwen"===s?"sk-sp-...":v?"":"sk-..."}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:m.apiKeyHint[s]})]}),(0,b.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ca.f,{label:m.model,href:ce.r[s].model,linkText:m.docs}),(0,b.jsx)(ao.f,{value:t?.model||"",onChange:a=>u("model",a.target.value),placeholder:ce.C[s].model})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ca.f,{label:m.voice,href:ce.r[s].voice,linkText:m.voiceList}),(0,b.jsx)(ao.f,{value:t?.voice||"",onChange:a=>u("voice",a.target.value),placeholder:ce.C[s].voice})]})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:m.voiceHint[s]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ca.f,{label:m.endpoint,href:ce.r[s].endpoint,linkText:m.docs}),(0,b.jsx)(ao.f,{value:t?.endpoint||"",onChange:a=>u("endpoint",a.target.value),placeholder:(0,ce.E)(s,w)}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:m.endpointHint})]})]},s),(0,b.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row",children:[s&&(0,b.jsxs)(y.f,{variant:"outline",onClick:A,disabled:i||n,className:"sm:w-auto",children:[n?(0,b.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,b.jsx)(b9.f,{className:"mr-2 h-4 w-4"}),m.preview]}),(0,b.jsxs)(y.f,{onClick:()=>void j(),disabled:i||n,className:"flex-1",children:[i&&(0,b.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}),m.save]})]}),s&&p&&(0,b.jsx)("div",{className:"rounded-md border border-red-200 bg-red-50 p-2 dark:border-red-900 dark:bg-red-950/40",children:(0,b.jsx)(cb.f,{detail:p})})]})}var cg=a.i(439830);function ch({value:a,icon:c,label:d}){return(0,b.jsxs)(ak.k,{value:a,className:"px-2 sm:px-3",children:[c,(0,b.jsx)("span",{className:"hidden sm:inline",children:d})]})}function ci(){let{setTimeZone:a}=(0,v.M)(),{data:g}=(0,e.useSession)(),i=g?.user?.role==="admin",j=g?.user?.id??"",k=g?.user?.email??"",{t:l}=(0,d.b)(),m=(0,w.useRouter)(),[n,o]=(0,c.useState)(!1),p=(0,c.useRef)(null),[q,r]=(0,c.useState)(!1),[s,t]=(0,c.useState)(!1),[u,A]=(0,c.useState)({aiProvider:"minimax"}),C=(0,c.useCallback)(async()=>{t(!0);try{A(await f.k.get("/api/settings"))}catch(a){h.V.error("[SettingsDialog]","Failed to fetch settings",{error:a})}finally{t(!1)}},[]);(0,c.useEffect)(()=>{n&&C()},[n,C]);let D=async b=>{let c=(0,cg.f)(u,l);if(c)return void M.c.error(c);r(!0);try{let c=await f.k.post("/api/settings",u);A(c),a(c.timeZone||al.J),M.c.success(l.settings?.messages?.saved||"Settings saved"),(0,b7.z)("settings_changed",{section:b}),p.current?.scrollTo({top:0,behavior:"smooth"})}catch(a){h.V.error("[SettingsDialog]","Failed to save settings",{error:a}),M.c.error(l.settings?.messages?.saveFailed||"Failed to save")}finally{r(!1)}},E=(a,c)=>(0,b.jsxs)(y.f,{onClick:()=>D(c),disabled:q,className:"w-full",children:[q&&(0,b.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}),a]});return(0,b.jsxs)(z.N,{open:n,onOpenChange:o,children:[(0,b.jsx)(z.a,{asChild:!0,children:(0,b.jsxs)(y.f,{variant:"ghost",size:"icon",className:"rounded-full",children:[(0,b.jsx)(ah,{className:"h-5 w-5"}),(0,b.jsx)("span",{className:"sr-only",children:l.settings?.title||"Settings"})]})}),(0,b.jsxs)(z.d,{ref:p,className:"w-[calc(100vw-2rem)] sm:max-w-[900px] max-h-[85vh] overflow-y-auto",children:[(0,b.jsxs)(z.s,{children:[(0,b.jsx)(z.F,{children:l.settings?.title||"Settings"}),(0,b.jsx)(z.C,{children:l.settings?.desc||"Manage your preferences and data."})]}),(0,b.jsxs)(ak.i,{defaultValue:"general",className:"w-full",children:[(0,b.jsxs)(ak.U,{className:`grid w-full grid-cols-4 ${i?"sm:grid-cols-7":"sm:grid-cols-4"} gap-1 h-auto`,children:[(0,b.jsx)(ch,{value:"general",icon:(0,b.jsx)(ad.f,{className:"h-4 w-4 sm:mr-2"}),label:l.settings?.tabs?.general||"General"}),(0,b.jsx)(ch,{value:"account",icon:(0,b.jsx)(ai.f,{className:"h-4 w-4 sm:mr-2"}),label:l.settings?.tabs?.account||"Account"}),i&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(ch,{value:"ai",icon:(0,b.jsx)(aa,{className:"h-4 w-4 sm:mr-2"}),label:l.settings?.tabs?.ai||"AI Provider"}),(0,b.jsx)(ch,{value:"prompts",icon:(0,b.jsx)(af,{className:"h-4 w-4 sm:mr-2"}),label:l.settings?.tabs?.prompts||"Prompts"}),(0,b.jsx)(ch,{value:"admin",icon:(0,b.jsx)(T,{className:"h-4 w-4 sm:mr-2"}),label:l.settings?.tabs?.admin||"User Management"})]}),(0,b.jsx)(ch,{value:"danger",icon:(0,b.jsx)($.f,{className:"h-4 w-4 sm:mr-2"}),label:l.settings?.tabs?.danger||"Danger"}),(0,b.jsx)(ch,{value:"about",icon:(0,b.jsx)(ac,{className:"h-4 w-4 sm:mr-2"}),label:l.settings?.tabs?.about||"About"})]}),(0,b.jsxs)(ak.S,{value:"general",className:"space-y-4 py-4",children:[(0,b.jsx)(bx,{config:u,setConfig:A,isAdmin:i,disabled:s||q}),(0,b.jsx)(bB,{}),i&&E(l.settings?.save||"Save Settings","general")]}),(0,b.jsxs)(ak.S,{value:"account",className:"space-y-4 py-4",children:[(0,b.jsx)(aT,{}),(0,b.jsx)(bc,{})]}),(0,b.jsxs)(ak.S,{value:"ai",className:"space-y-4 py-4",children:[(0,b.jsx)(aU.f,{config:u,setConfig:A,loading:s,saving:q,onSave:()=>D("ai")}),!s&&(0,b.jsx)(cf,{config:u,setConfig:A,saving:q,onSave:()=>D("tts")})]}),(0,b.jsxs)(ak.S,{value:"prompts",className:"space-y-4 py-4",children:[(0,b.jsx)(b$,{config:u,onUpdate:(a,b)=>A(c=>({...c,prompts:{...c.prompts,[a]:b}}))}),E(l.settings?.prompts?.save||"Save Prompt Settings","prompts")]}),i&&(0,b.jsxs)(ak.S,{value:"admin",className:"space-y-4 py-4",children:[(0,b.jsxs)(y.f,{variant:"outline",className:"w-full justify-start gap-2",onClick:()=>{o(!1),m.push("/admin")},children:[(0,b.jsx)(B.f,{className:"h-4 w-4"}),l.admin?.dashboard?.title||"Admin Dashboard"]}),(0,b.jsxs)(y.f,{variant:"outline",className:"w-full justify-start gap-2",onClick:()=>{o(!1),m.push("/setup")},children:[(0,b.jsx)(aj.f,{className:"h-4 w-4"}),l.setup.rerun]}),(0,b.jsx)(b8,{}),(0,b.jsx)(bm,{}),(0,b.jsx)(a2,{}),(0,b.jsx)("div",{className:"border-t pt-4",children:(0,b.jsx)(aD,{})})]}),(0,b.jsx)(ak.S,{value:"danger",className:"space-y-4 py-4",children:(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsx)(bi,{isAdmin:i,userId:j,userEmail:k}),(0,b.jsx)(a6,{isAdmin:i}),(0,b.jsx)(a9,{isAdmin:i})]})}),(0,b.jsx)(ak.S,{value:"about",className:"space-y-4 py-4",children:(0,b.jsx)(aO,{})})]})]})]})}var cj=a.i(474215);function ck({enabled:a}){let{t:e}=(0,d.b)(),g=e.telemetrySettings,[i,j]=(0,c.useState)(!1),[k,l]=(0,c.useState)(""),[m,n]=(0,c.useState)(!1);if((0,c.useEffect)(()=>{if(!a)return;let b=!1;return f.k.get(`${b4}?view=notice`).then(a=>{b||(l(a.eula.current),j(a.showNotice))}).catch(a=>h.V.warn("[TelemetryNotice]","Failed to load telemetry notice",{error:a})),()=>{b=!0}},[a]),!a||!i)return null;let o=async()=>{try{await b5(k),j(!1),M.c.success(g.enabled)}catch(a){throw h.V.error("[TelemetryNotice]","Failed to enable forwarding",{error:a}),M.c.error(g.failed),a}};return(0,b.jsxs)("div",{className:"border-b bg-primary/5 print:hidden",children:[(0,b.jsxs)("div",{className:"mx-auto flex max-w-6xl flex-col gap-2 px-4 py-2 text-sm sm:flex-row sm:items-center md:px-8",children:[(0,b.jsx)("p",{className:"flex-1 text-muted-foreground",children:g.noticeText}),(0,b.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,b.jsx)(y.f,{size:"sm",onClick:()=>n(!0),children:g.noticeEnable}),(0,b.jsxs)(y.f,{size:"sm",variant:"ghost",onClick:()=>{j(!1),b6({noticeDismissed:!0}).catch(a=>h.V.warn("[TelemetryNotice]","Failed to dismiss notice",{error:a}))},children:[(0,b.jsx)(cj.X,{className:"mr-1 h-4 w-4"}),g.noticeDismiss]})]})]}),(0,b.jsx)(b0,{open:m,onOpenChange:n,onConfirm:o})]})}var cl=a.i(505004);let cm={name:"moon",size:24,node:[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]};cm.node;let cn=(0,G.f)(cm),co={name:"sun",size:24,node:[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]};co.node;let cp=(0,G.f)(co);var cq=a.i(335732);let cr={system:cl.f,light:cp,dark:cn};function cs(){let{t:a}=(0,d.b)(),{preference:e,setPreference:f}=(0,c.useContext)(m),g=cr[e],h=`${a.theme.toggle}: ${a.theme[e]}`;return(0,b.jsxs)(cq.G,{children:[(0,b.jsx)(cq.X,{asChild:!0,children:(0,b.jsx)(y.f,{variant:"ghost",size:"icon",className:"rounded-full",title:h,"aria-label":h,children:(0,b.jsx)(g,{className:"h-5 w-5"})})}),(0,b.jsx)(cq.L,{align:"end",children:(0,b.jsx)(cq.O,{value:e,onValueChange:a=>{l(a)&&f(a)},children:i.map(c=>{let d=cr[c];return(0,b.jsxs)(cq.T,{value:c,className:"gap-2",children:[(0,b.jsx)(d,{className:"h-4 w-4"}),a.theme[c]]},c)})})})]})}var ct=a.i(445233),cu=a.i(694796),cv=a.i(57441),cv=cv;let cw=["gemini","openai","azure","anthropic","minimax-code",...cc.U],cx=["1","2-5","6-20",">20"],cy=["0","1-50","51-500",">500"],cz=ct.z.enum(cw),cA=cu.z.boolean();Object.keys({app_installed:cv.strictObject({method:ct.z.enum(["setup-token","preset-admin"])}),eula_accepted:cv.strictObject({version:aX.z.string().regex(/^v\d{1,4}$/),trigger:ct.z.enum(["install","upgrade","settings"])}),instance_alive:cv.strictObject({platform:ct.z.enum(["docker","npm","desktop","fnos","android","other"]),aiConfigured:cu.z.boolean()}),app_opened:cv.strictObject({client:ct.z.enum(["browser","pwa","desktop","android"])}),page_viewed:cv.strictObject({page:ct.z.enum(["home","notebooks","error_detail","practice","review","stats","tags","exams","settings","admin","imports","print","auth","setup","other"])}),ai_analyze_started:cv.strictObject({provider:cz}),ai_analyze_result:cv.strictObject({ok:cA,provider:cz,duration:ct.z.enum(["<3s","3-10s","10-30s",">30s"])}),ai_reanswer:cv.strictObject({ok:cA,provider:cz}),ai_practice_grading:cv.strictObject({ok:cA,count:ct.z.enum(cx)}),exam_paper_generation:cv.strictObject({ok:cA,count:ct.z.enum(cx)}),data_exported:cv.strictObject({scope:ct.z.enum(["user","all"]),rows:ct.z.enum(cy)}),data_imported:cv.strictObject({rows:ct.z.enum(cy)}),tts_used:cv.strictObject({mode:ct.z.enum(ce.l)}),settings_changed:cv.strictObject({section:ct.z.enum(["general","ai","tts","prompts","telemetry"])})});let cB=[[/^\/$/,"home"],[/^\/notebooks?(\/|$)/,"notebooks"],[/^\/error-items?\/[^/]+/,"error_detail"],[/^\/practice(\/|$)/,"practice"],[/^\/review(\/|$)/,"review"],[/^\/stats(\/|$)/,"stats"],[/^\/tags(\/|$)/,"tags"],[/^\/exams?(\/|$)/,"exams"],[/^\/import-(tasks|batches)?(\/|$)/,"imports"],[/^\/print-preview(\/|$)/,"print"],[/^\/(login|register)(\/|$)/,"auth"],[/^\/(initialize|eula)(\/|$)/,"setup"],[/^\/(settings|setup)(\/|$)/,"settings"],[/^\/admin(\/|$)/,"admin"]];function cC({children:a}){var g,i;let j,k,l,m=(0,w.usePathname)()||"/",{t:n}=(0,d.b)(),{data:o,status:p}=(0,e.useSession)(),q=o?.user?.role==="admin",r=L(m);g=q&&!r,j=(0,w.useRouter)(),k=(0,c.useRef)(!1),(0,c.useEffect)(()=>{g&&!k.current&&(k.current=!0,f.k.get("/api/setup").then(a=>{a.needsSetup&&j.replace("/setup")}).catch(a=>h.V.warn("[Setup]","Failed to check setup status",{error:a})))},[g,j]),i="authenticated"===p,l=(0,c.useRef)(null),(0,c.useEffect)(()=>{(0,b7.J)()},[]),(0,c.useEffect)(()=>{let a;if(!i)return;let b=(a=m.split(/[?#]/)[0]||"/",cB.find(([b])=>b.test(a))?.[1]??"other");b!==l.current&&(l.current=b,(0,b7.z)("page_viewed",{page:b}))},[m,i]);let s=function(a){let[b,d]=(0,c.useState)(null);(0,c.useEffect)(()=>{if(!a)return;let b=!1;return f.k.get("/api/eula/status").then(a=>{b||d(a)}).catch(a=>h.V.warn("[EulaGate]","Failed to check EULA status",{error:a})),()=>{b=!0}},[a]);let e=(0,c.useCallback)(async()=>{b&&d(await f.k.post("/api/admin/eula/accept",{version:b.current}))},[b]);return{pending:a&&!!b?.pending,status:b,accept:e}}(q&&"authenticated"===p),t=s.pending&&s.status?(0,b.jsx)(V,{status:s.status,onAccept:s.accept}):null;if(r||"unauthenticated"===p)return(0,b.jsxs)(b.Fragment,{children:[a,t]});let u=o?.user?.name||o?.user?.email||"";return(0,b.jsxs)("div",{className:"min-h-screen",children:[(0,b.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,b.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,b.jsxs)(Q.default,{href:"/",className:"flex shrink-0 items-center gap-2",children:[(0,b.jsx)(P.default,{src:"/icons/icon.png",alt:"",width:32,height:32,className:"rounded-lg",priority:!0,unoptimized:!0}),(0,b.jsx)("span",{className:"hidden text-base font-semibold tracking-tight sm:inline",children:n.pageTitle.base})]}),(0,b.jsx)("nav",{className:"ml-4 hidden items-center gap-1 md:flex",children:K.map(a=>{let c=a.match(m),d=a.icon;return(0,b.jsxs)(Q.default,{href:a.href,className:(0,Y.f)("flex items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors",c?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground"),"aria-current":c?"page":void 0,children:[(0,b.jsx)(d,{className:"h-4 w-4"}),n.nav[a.key]]},a.key)})}),(0,b.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[u&&(0,b.jsxs)("span",{className:"mr-2 hidden max-w-40 items-center gap-2 truncate text-sm text-muted-foreground lg:flex",children:[(0,b.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:u.slice(0,1).toUpperCase()}),(0,b.jsx)("span",{className:"truncate",children:u})]}),q&&(0,b.jsx)(Q.default,{href:"/admin",title:n.nav.admin,children:(0,b.jsxs)(y.f,{variant:"ghost",size:"icon",className:"rounded-full",children:[(0,b.jsx)(T,{className:"h-5 w-5"}),(0,b.jsx)("span",{className:"sr-only",children:n.nav.admin})]})}),(0,b.jsx)(Z,{className:"mr-1"}),(0,b.jsx)(cs,{}),(0,b.jsx)(ci,{}),(0,b.jsx)(y.f,{variant:"ghost",size:"icon",className:"rounded-full text-muted-foreground hover:text-destructive",onClick:()=>(0,e.signOut)({callbackUrl:"/login"}),title:n.app.logout,children:(0,b.jsx)(R.f,{className:"h-5 w-5"})})]})]})}),(0,b.jsx)(ck,{enabled:q&&"authenticated"===p&&!s.pending}),(0,b.jsx)("div",{className:"pb-20 md:pb-0",children:a}),t,(0,b.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,b.jsx)("div",{className:"grid h-16",style:{gridTemplateColumns:`repeat(${K.length}, minmax(0, 1fr))`},children:K.map(a=>{let c=a.match(m),d=a.icon;return(0,b.jsxs)(Q.default,{href:a.href,className:(0,Y.f)("flex flex-col items-center justify-center gap-1 text-[11px] font-medium transition-colors",c?"text-primary":"text-muted-foreground"),"aria-current":c?"page":void 0,children:[(0,b.jsx)("span",{className:(0,Y.f)("flex h-7 w-12 items-center justify-center rounded-full transition-colors",c&&"bg-accent"),children:(0,b.jsx)(d,{className:"h-5 w-5"})}),n.nav[a.key]]},a.key)})})})]})}let cD={name:"list-todo",size:24,node:[["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"}]]};cD.node;let cE=(0,G.f)(cD);var cF=a.i(211134),cG=a.i(374161);let cH=[/^\/login/,/^\/register/,/^\/print-preview/,/^\/exams\/[^/]+\/print/];function cI(){let{t:a}=(0,d.b)(),{timeZone:g}=(0,v.M)(),{status:h}=(0,e.useSession)(),i=(0,w.usePathname)(),[j,k]=(0,c.useState)(!1),[l,m]=(0,c.useState)(()=>cG.f.getSnapshot()),[n,o]=(0,c.useState)(()=>Date.now()),p="authenticated"!==h||cH.some(a=>a.test(i||""));if((0,c.useEffect)(()=>{if(!p)return cG.f.subscribe(a=>{m(a),o(Date.now())})},[p]),p)return null;let q=l.filter(a=>"running"===a.status).length,r=l.some(a=>"running"!==a.status),s=async()=>{try{await f.k.delete("/api/tasks"),await cG.f.refresh()}catch{}};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(y.f,{variant:"outline",size:"icon",className:"fixed bottom-20 right-4 z-40 h-11 w-11 rounded-full shadow-lg md:bottom-6 md:right-6 print:hidden",onClick:()=>k(!0),"aria-label":a.backgroundTasks.title,title:a.backgroundTasks.title,children:[q>0?(0,b.jsx)(x.f,{className:"h-5 w-5 animate-spin"}):(0,b.jsx)(cE,{className:"h-5 w-5"}),q>0&&(0,b.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:q})]}),(0,b.jsx)(z.N,{open:j,onOpenChange:k,children:(0,b.jsxs)(z.d,{className:"max-h-[85vh] overflow-y-auto sm:max-w-lg",children:[(0,b.jsxs)(z.s,{children:[(0,b.jsx)(z.F,{children:a.backgroundTasks.title}),(0,b.jsx)(z.C,{children:a.backgroundTasks.description})]}),0===l.length?(0,b.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:a.backgroundTasks.empty}):(0,b.jsx)("ul",{className:"space-y-2",children:l.map(c=>{var d,e;let f;return(0,b.jsx)("li",{className:"rounded-md border p-3 text-sm",children:(0,b.jsxs)("div",{className:"flex items-start gap-2",children:["running"===c.status&&(0,b.jsx)(x.f,{className:"mt-0.5 h-4 w-4 shrink-0 animate-spin text-primary"}),"succeeded"===c.status&&(0,b.jsx)(bd.f,{className:"mt-0.5 h-4 w-4 shrink-0 text-green-600"}),"failed"===c.status&&(0,b.jsx)(cF.f,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),(0,b.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,b.jsxs)("div",{className:"font-medium",children:[a.backgroundTasks.kinds[c.kind],(0,b.jsxs)("span",{className:"font-normal text-muted-foreground",children:[" · ",a.backgroundTasks.status[c.status]]})]}),c.subject&&(0,b.jsx)("div",{className:"break-words text-muted-foreground",children:c.subject}),c.progress&&c.progress.total>0&&(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("div",{className:"h-1.5 overflow-hidden rounded bg-muted",children:(0,b.jsx)("div",{className:"h-full bg-primary transition-all",style:{width:`${Math.round(c.progress.done/c.progress.total*100)}%`}})}),(0,b.jsxs)("div",{className:"text-xs text-muted-foreground",children:[a.backgroundTasks.progress.replace("{done}",String(c.progress.done)).replace("{total}",String(c.progress.total)),c.progress.failed>0&&` \xb7 ${a.backgroundTasks.failedCount.replace("{count}",String(c.progress.failed))}`]})]}),c.error&&(0,b.jsx)("div",{className:"text-xs text-destructive",children:(b=>{if(!b)return null;let c=a.backgroundTasks.errors[b]??a.errors[b];return"string"==typeof c?c:b})(c.error)}),(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 text-xs text-muted-foreground",children:[(0,b.jsx)("span",{children:a.backgroundTasks.startedAt.replace("{time}",(0,al.r)(c.startedAt,"HH:mm:ss",g))}),(0,b.jsx)("span",{children:a.backgroundTasks.elapsed.replace("{time}",(d=c.startedAt,e=c.finishedAt,f=Math.max(0,Math.round(((e?Date.parse(e):n)-Date.parse(d))/1e3)),`${Math.floor(f/60)}:${String(f%60).padStart(2,"0")}`))}),c.link&&(0,b.jsx)(Q.default,{href:c.link,className:"text-primary hover:underline",onClick:()=>k(!1),children:a.backgroundTasks.view})]})]})]})},c.id)})}),(0,b.jsxs)("div",{className:"flex items-center justify-between gap-2 pt-1",children:[(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:a.backgroundTasks.retentionHint}),r&&(0,b.jsx)(y.f,{variant:"ghost",size:"sm",onClick:s,children:a.backgroundTasks.clearFinished})]})]})})]})}var cJ=a.i(131900);function cK(){let{t:a}=(0,d.b)(),e=(0,cJ.f)(),[f,g]=(0,c.useState)(!1),h=e?function(a){let b=/\bChrome\/(\d+)\./.exec(a);if(!b)return null;let c=Number(b[1]);return c>=111?null:{kind:/; wv\)/.test(a)||a.includes("WrongNotebookAndroid/")?"webview":"browser",version:c}}(navigator.userAgent):null;if(!h||f)return null;let i="webview"===h.kind?a.browserSupport.outdatedWebView:a.browserSupport.outdatedBrowser;return(0,b.jsxs)("div",{role:"alert","data-testid":"outdated-browser-notice",className:"flex items-start gap-3 border-b border-amber-300 bg-amber-100 px-4 py-2 text-sm text-amber-900",children:[(0,b.jsx)("p",{className:"flex-1",children:i.replace("{version}",String(h.version))}),(0,b.jsx)("button",{type:"button",onClick:()=>g(!0),className:"shrink-0 font-medium underline",children:a.common.close})]})}let cL={success:{icon:bd.f,className:"text-success"},error:{icon:cF.f,className:"text-destructive"},warning:{icon:$.f,className:"text-warning"},info:{icon:ac,className:"text-primary"}};function cM(){let{t:a}=(0,d.b)(),[e,f]=(0,c.useState)([]),[g,h]=(0,c.useState)(null);return(0,c.useEffect)(()=>(0,M.M)(a=>{f(a.toasts),h(a.confirm)}),[]),(0,b.jsxs)(b.Fragment,{children:[(0,b.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:e.map(c=>{let{icon:d,className:e}=cL[c.type];return(0,b.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,b.jsx)(d,{className:(0,Y.f)("mt-0.5 h-4 w-4 shrink-0",e)}),(0,b.jsx)("p",{className:"min-w-0 flex-1 whitespace-pre-line break-words leading-relaxed",children:c.message}),(0,b.jsx)("button",{type:"button",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:text-foreground",onClick:()=>(0,M.p)(c.id),"aria-label":a.common.close,children:(0,b.jsx)(cj.X,{className:"h-3.5 w-3.5"})})]},c.id)})}),(0,b.jsx)(z.N,{open:!!g,onOpenChange:a=>{a||g?.resolve(!1)},children:(0,b.jsxs)(z.d,{className:"sm:max-w-md",children:[(0,b.jsxs)(z.s,{children:[(0,b.jsxs)(z.F,{className:"flex items-center gap-2",children:[g?.destructive&&(0,b.jsx)($.f,{className:"h-5 w-5 text-destructive"}),g?.title||a.common.confirmTitle]}),(0,b.jsx)(z.C,{className:"whitespace-pre-line pt-1 text-left leading-relaxed",children:g?.message})]}),(0,b.jsxs)(z.c,{className:"gap-2",children:[(0,b.jsx)(y.f,{variant:"outline",onClick:()=>g?.resolve(!1),children:g?.cancelText||a.common.cancel}),(0,b.jsx)(y.f,{variant:g?.destructive?"destructive":"default",onClick:()=>g?.resolve(!0),autoFocus:!0,children:g?.confirmText||a.common.confirm})]})]})})]})}function cN(){return(0,c.useEffect)(()=>{"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js",{scope:"/"}).catch(a=>{h.V.warn("[PWA]","Service worker registration failed",{error:String(a)})})},[]),null}a.s(["Providers",0,function({children:a,timeZone:f}){return(0,c.useEffect)(()=>(0,h.m)(),[]),(0,b.jsx)(e.SessionProvider,{children:(0,b.jsx)(u,{children:(0,b.jsx)(d.w,{children:(0,b.jsxs)(v.n,{initialTimeZone:f,children:[(0,b.jsx)(cK,{}),(0,b.jsx)(cC,{children:a}),(0,b.jsx)(cI,{}),(0,b.jsx)(O,{}),(0,b.jsx)(cM,{}),(0,b.jsx)(cN,{})]})})})})}],418175)}];
|
|
258
|
+
{{provider_hints}}`;var b0=a.i(62832);function b1({config:a,onUpdate:c}){let{t:e}=(0,d.b)(),f=a.prompts?.analyze||bZ,g=a.prompts?.similar||b$,h=a.prompts?.reanswer||b_,i=e.settings?.prompts?.vars,j=[{name:"language_instruction",description:i?.languageInstruction||"Language instructions."},{name:"knowledge_points_list",description:i?.knowledgePointsList||"Knowledge point tags for the subject."},{name:"grade_instruction",description:i?.gradeInstruction||"Grade and semester guidance."},{name:"provider_hints",description:i?.providerHints||"Provider compatibility hints."}],k=[{name:"original_question",description:i?.originalQuestion||"The full text of the original question."},{name:"knowledge_points",description:i?.knowledgePoints||"List of knowledge points to test."},{name:"difficulty_level",description:i?.difficultyLevel||"Target difficulty level."},{name:"difficulty_instruction",description:i?.difficultyInstruction||"Specific writing instructions for the target difficulty."},{name:"language_instruction",description:i?.languageInstructionShort||"Language formatting instructions."},{name:"figure_instruction",description:i?.figureInstruction||"Instructions for redrawing the original figure."},{name:"grade_instruction",description:i?.gradeInstruction||"Grade and semester guidance."}],l=[{name:"question_text",description:i?.questionText||"The corrected question text."},{name:"subject_hint",description:i?.subjectHint||"Subject of the question."},{name:"knowledge_points_rule",description:i?.knowledgePointsRule||"Candidate knowledge points to choose from."},{name:"language_instruction",description:i?.languageInstruction||"Language instructions."},{name:"grade_instruction",description:i?.gradeInstruction||"Grade and semester guidance."},{name:"provider_hints",description:i?.providerHints||"Provider compatibility hints."}];return(0,b.jsx)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:(0,b.jsxs)(al.i,{defaultValue:"analyze",className:"w-full",children:[(0,b.jsxs)(al.U,{className:"grid w-full grid-cols-3",children:[(0,b.jsx)(al.k,{value:"analyze",className:"text-xs sm:text-sm",children:e.settings?.prompts?.analysisTab||"Analysis Prompt"}),(0,b.jsx)(al.k,{value:"reanswer",className:"text-xs sm:text-sm",children:e.settings?.prompts?.reanswerTab||"Solving Prompt"}),(0,b.jsx)(al.k,{value:"similar",className:"text-xs sm:text-sm",children:e.settings?.prompts?.similarTab||"Similar Question Prompt"})]}),(0,b.jsx)(al.S,{value:"analyze",className:"py-4",children:(0,b.jsx)(bN,{value:f,defaultValue:bZ,onChange:a=>c("analyze",a),onReset:()=>c("analyze",bZ),title:e.settings?.prompts?.customAnalysis||"Custom Analysis Template",variables:j})}),(0,b.jsx)(al.S,{value:"reanswer",className:"py-4",children:(0,b.jsx)(bN,{value:h,defaultValue:b_,onChange:a=>c("reanswer",a),onReset:()=>c("reanswer",b_),title:e.settings?.prompts?.customReanswer||"Custom Solving Template",variables:l})}),(0,b.jsx)(al.S,{value:"similar",className:"py-4",children:(0,b.jsx)(bN,{value:g,defaultValue:b$,onChange:a=>c("similar",a),onReset:()=>c("similar",b$),title:e.settings?.prompts?.customSimilar||"Custom Similar Question Template",variables:k})})]})})}b0.I.join("、"),b0.r.join("、");var b2=a.i(867147);function b3({open:a,onOpenChange:e,onConfirm:f}){let{t:g}=(0,d.b)(),[h,i]=(0,c.useState)(!1),[j,k]=(0,c.useState)(!1),l=async()=>{k(!0);try{await f(),i(!1),e(!1)}catch{}finally{k(!1)}};return(0,b.jsx)(A.N,{open:a,onOpenChange:a=>!j&&e(a),children:(0,b.jsxs)(A.d,{className:"w-[calc(100vw-2rem)] sm:max-w-lg",children:[(0,b.jsxs)(A.s,{children:[(0,b.jsx)(A.F,{children:g.eula.dialogTitle}),(0,b.jsx)(A.C,{children:g.eula.dialogDesc})]}),(0,b.jsx)(b2.f,{checked:h,onCheckedChange:i,disabled:j}),(0,b.jsxs)("div",{className:"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",children:[(0,b.jsx)(z.f,{variant:"outline",onClick:()=>e(!1),disabled:j,children:g.eula.cancel}),(0,b.jsxs)(z.f,{onClick:l,disabled:!h||j,children:[j&&(0,b.jsx)(y.f,{className:"mr-2 h-4 w-4 animate-spin"}),g.eula.accept]})]})]})})}function b4({endpoint:a,retentionDays:e,disabled:f,onSave:g}){let{t:h}=(0,d.b)(),i=h.telemetrySettings,[j,k]=(0,c.useState)(""!==a),[l,m]=(0,c.useState)(a),[n,o]=(0,c.useState)(String(e)),p=Number(n),q=Number.isInteger(p)&&p>=1&&p<=365;return(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)(aq.f,{htmlFor:"telemetry-endpoint",children:i.endpoint}),j?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(ap.f,{id:"telemetry-endpoint",value:l,placeholder:i.endpointPlaceholder,disabled:f,onChange:a=>m(a.target.value)}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:i.endpointHint})]}):(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:i.endpointDefault}),(0,b.jsx)(z.f,{variant:"link",size:"sm",className:"h-auto p-0",disabled:f,onClick:()=>k(!0),children:i.endpointCustomize})]})]}),(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)(aq.f,{htmlFor:"telemetry-retention",children:i.retentionDays}),(0,b.jsx)(ap.f,{id:"telemetry-retention",type:"number",min:1,max:365,className:"w-32",value:n,disabled:f,onChange:a=>o(a.target.value)})]}),(0,b.jsx)(z.f,{size:"sm",variant:"outline",disabled:f||!q,onClick:()=>g({endpoint:l.trim(),retentionDays:p}),children:i.save})]})}function b5({events:a,errors:c,disabled:e,onClear:f}){let{t:g}=(0,d.b)(),{timeZone:h}=(0,w.M)(),i=g.telemetrySettings,j=a=>(0,am.r)(a,"MM-dd HH:mm",h),k=a=>a?i.forwarded:i.notForwarded,l=0===a.length&&0===c.length;return(0,b.jsxs)("details",{className:"rounded-md border p-3 text-sm",children:[(0,b.jsx)("summary",{className:"cursor-pointer font-medium",children:i.recentTitle}),(0,b.jsxs)("div",{className:"mt-3 space-y-3",children:[l&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:i.recentEmpty}),a.length>0&&(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("p",{className:"text-xs font-medium text-muted-foreground",children:i.recentEvents}),(0,b.jsx)("ul",{className:"space-y-1 font-mono text-xs",children:a.map(a=>(0,b.jsxs)("li",{className:"break-all",children:[j(a.createdAt)," ",a.name," ",a.payload??""," · ",k(a.forwardedAt)]},a.id))})]}),c.length>0&&(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("p",{className:"text-xs font-medium text-muted-foreground",children:i.recentErrors}),(0,b.jsx)("ul",{className:"space-y-1 font-mono text-xs",children:c.map(a=>(0,b.jsxs)("li",{className:"break-all",children:[j(a.createdAt)," ",a.kind," ",a.scope," ",a.name," #",a.fingerprint,a.path?` ${a.path}`:"",a.message?` — ${a.message}`:""," · ",k(a.forwardedAt)]},a.id))})]}),(0,b.jsxs)(z.f,{variant:"outline",size:"sm",onClick:f,disabled:e||l,children:[(0,b.jsx)(ax.f,{className:"mr-2 h-4 w-4"}),i.clear]})]})]})}function b6({id:a,label:c,description:d,checked:e,disabled:f,onCheckedChange:g}){return(0,b.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)(aq.f,{htmlFor:a,className:"font-medium",children:c}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:d})]}),(0,b.jsx)(ao.f,{id:a,checked:e,disabled:f,onCheckedChange:g,className:"shrink-0"})]})}let b7="/api/admin/telemetry";async function b8(a){return await f.k.post("/api/admin/eula/accept",{version:a}),f.k.post(b7,{forwarding:!0})}function b9(a){return f.k.post(b7,a)}var ca=a.i(585982);function cb(){let{t:a}=(0,d.b)(),{timeZone:e}=(0,w.M)(),i=a.telemetrySettings,{data:j,update:k,enableWithConsent:l,clear:m}=function(){let[a,b]=(0,c.useState)(null),d=(0,c.useCallback)(async()=>{try{b(await f.k.get(b7))}catch(a){h.V.warn("[TelemetrySettings]","Failed to load telemetry status",{error:a})}},[]);return(0,c.useEffect)(()=>{d()},[d]),{data:a,update:async a=>b(await b9(a)),enableWithConsent:async a=>b(await b8(a)),clear:async()=>b(await f.k.delete(b7))}}(),[n,o]=(0,c.useState)(!1),[p,q]=(0,c.useState)(!1),r=async(a,b)=>{o(!0);try{await a(),N.c.success(b)}catch(a){throw h.V.error("[TelemetrySettings]","Telemetry action failed",{error:a}),N.c.error("INVALID_TELEMETRY_ENDPOINT"===(0,g.d)(a)?i.invalidEndpoint:i.failed),a}finally{o(!1)}},s=a=>r(async()=>{await k(a),(0,ca.z)("settings_changed",{section:"telemetry"})},i.saved).catch(()=>void 0);if(!j)return null;let t=j.lockedByEnv,u=n||t,v=a=>(0,am.r)(a,"yyyy-MM-dd HH:mm",e),x=async()=>{await (0,N.u)(i.clearConfirm)&&r(m,i.cleared).catch(()=>void 0)},y=j.lastFlushAt?i.lastFlush.replace("{time}",v(j.lastFlushAt)):i.neverFlushed;return j.lastAttempt?.status==="failed"&&(y=i.lastAttemptFailed.replace("{status}",String(j.lastAttempt.httpStatus??"network"))),j.lastAttempt?.status==="stopped"&&(y=i.lastAttemptStopped),(0,b.jsxs)("div",{className:"space-y-4 rounded-lg border p-4",children:[(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsxs)("p",{className:"flex items-center gap-2 font-medium",children:[(0,b.jsx)(bc,{className:"h-4 w-4"}),i.title]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:i.desc})]}),t&&(0,b.jsx)("p",{className:"text-xs text-orange-600",children:i.lockedByEnv}),j.consentPending&&(0,b.jsx)("p",{className:"text-xs text-orange-600",children:i.consentPending}),(0,b.jsxs)("p",{className:"text-xs text-muted-foreground",children:[j.eula.acceptedVersion?i.eulaStatus.replace("{version}",j.eula.acceptedVersion).replace("{time}",j.eula.acceptedAt?v(j.eula.acceptedAt):"-"):i.eulaNotAccepted," ",(0,b.jsx)("a",{href:"/eula",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:i.viewEula})]}),(0,b.jsx)(b6,{id:"telemetry-forwarding",label:i.forwarding,description:i.forwardingDesc,checked:j.forwarding,disabled:u,onCheckedChange:a=>{a&&(!j.eula.acceptedVersion||j.consentPending)?q(!0):s({forwarding:a})}}),j.forwarding&&(0,b.jsxs)("p",{className:"text-xs text-muted-foreground",children:[i.pending.replace("{count}",String(j.pending))," · ",y]}),(0,b.jsx)(b6,{id:"telemetry-recording",label:i.recording,description:i.recordingDesc,checked:j.recording,disabled:u,onCheckedChange:a=>s({recording:a})}),(0,b.jsx)(b6,{id:"telemetry-errors",label:i.errors,description:i.errorsDesc,checked:j.errors,disabled:u,onCheckedChange:a=>s({errors:a})}),(0,b.jsx)(b4,{endpoint:j.endpoint,retentionDays:j.retentionDays,disabled:u,onSave:s}),(0,b.jsx)(b5,{events:j.events,errors:j.errorRecords,disabled:n,onClear:x}),(0,b.jsx)(b3,{open:p,onOpenChange:q,onConfirm:()=>r(()=>l(j.eula.current),i.enabled)})]})}var cc=a.i(738835),cd=a.i(676330),ce=a.i(206194),cf=a.i(190622),cg=a.i(975484),ch=a.i(294655);function ci({config:a,setConfig:e,saving:i,onSave:j}){let{t:k,language:l}=(0,d.b)(),m=k.settings.tts,[n,o]=(0,c.useState)(!1),[p,q]=(0,c.useState)(null),r=a.tts?.mode??"browser",s=(0,ch.y)(r)?r:null,t=s?a.tts?.[s]:void 0,u=(a,b)=>{s&&e(c=>({...c,tts:{...c.tts,[s]:{...c.tts?.[s],[a]:b}}}))},v=!!s&&(0,ch.S)(s),w=s?(0,ch.L)(a,s):void 0,x=v?t?.apiKey:w?.apiKey,A=async()=>{(0,cg.p)(),o(!0),q(null);try{await j();let{id:a,version:b}=await f.k.post("/api/tts",{text:m.previewText,language:l},{timeout:12e4,recoverable:!0}),c=(0,cg.l)();if(!c)return;c.src=`/api/tts/${a}?v=${b}`,c.playbackRate=1,await c.play()}catch(b){h.V.error("[TtsSettings]","Preview failed",{error:b});let a=(0,g.d)(b);N.c.error("TTS_NOT_CONFIGURED"===a?m.notConfigured:"TTS_PROVIDER_ERROR"===a?m.providerError:m.previewFailed),q((0,g.L)(b)??null)}finally{o(!1)}};return(0,b.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(aq.f,{children:m.title}),(0,b.jsxs)(aR.d,{value:r,onValueChange:a=>e(b=>({...b,tts:{...b.tts,mode:a}})),children:[(0,b.jsx)(aR.P,{children:(0,b.jsx)(aR.U,{})}),(0,b.jsx)(aR.r,{children:ch.l.map(a=>(0,b.jsx)(aR.T,{value:a,children:m.modes[a]},a))})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:s?m.cloudHint:m.browserHint})]}),s&&(0,b.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[ch.D[s]&&(0,b.jsxs)("div",{className:"rounded-md border border-green-200 bg-green-50 p-3 text-xs text-green-800 dark:border-green-900 dark:bg-green-950/40 dark:text-green-300",children:[m.freeTrial," ",(0,b.jsx)("a",{href:ch.D[s],target:"_blank",rel:"noopener noreferrer",className:"underline",children:m.freeTrialLink})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(cd.f,{label:"openai"===s?"OpenAI API Key":v?m.speechApiKey:`${(0,cf.z)(s,l)} API Key`,href:ch.r[s].apiKey,linkText:k.settings.ai.docLinks.apiKey}),(0,b.jsx)(aQ.f,{value:x||"",onChange:a=>{var b;return b=a.target.value,void(s&&(v?u("apiKey",b):e(a=>({...a,[s]:{...a[s],apiKey:b}}))))},placeholder:"qwen"===s?"sk-sp-...":v?"":"sk-..."}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:m.apiKeyHint[s]})]}),(0,b.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(cd.f,{label:m.model,href:ch.r[s].model,linkText:m.docs}),(0,b.jsx)(ap.f,{value:t?.model||"",onChange:a=>u("model",a.target.value),placeholder:ch.C[s].model})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(cd.f,{label:m.voice,href:ch.r[s].voice,linkText:m.voiceList}),(0,b.jsx)(ap.f,{value:t?.voice||"",onChange:a=>u("voice",a.target.value),placeholder:ch.C[s].voice})]})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:m.voiceHint[s]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(cd.f,{label:m.endpoint,href:ch.r[s].endpoint,linkText:m.docs}),(0,b.jsx)(ap.f,{value:t?.endpoint||"",onChange:a=>u("endpoint",a.target.value),placeholder:(0,ch.E)(s,w)}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:m.endpointHint})]})]},s),(0,b.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row",children:[s&&(0,b.jsxs)(z.f,{variant:"outline",onClick:A,disabled:i||n,className:"sm:w-auto",children:[n?(0,b.jsx)(y.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,b.jsx)(cc.f,{className:"mr-2 h-4 w-4"}),m.preview]}),(0,b.jsxs)(z.f,{onClick:()=>void j(),disabled:i||n,className:"flex-1",children:[i&&(0,b.jsx)(y.f,{className:"mr-2 h-4 w-4 animate-spin"}),m.save]})]}),s&&p&&(0,b.jsx)("div",{className:"rounded-md border border-red-200 bg-red-50 p-2 dark:border-red-900 dark:bg-red-950/40",children:(0,b.jsx)(ce.f,{detail:p})})]})}var cj=a.i(439830);function ck({value:a,icon:c,label:d}){return(0,b.jsxs)(al.k,{value:a,className:"px-2 sm:px-3",children:[c,(0,b.jsx)("span",{className:"hidden sm:inline",children:d})]})}function cl(){let{setTimeZone:a}=(0,w.M)(),{setNumbering:g}=(0,v.I)(),{data:i}=(0,e.useSession)(),j=i?.user?.role==="admin",k=i?.user?.id??"",l=i?.user?.email??"",{t:m}=(0,d.b)(),n=(0,x.useRouter)(),[o,p]=(0,c.useState)(!1),q=(0,c.useRef)(null),[r,s]=(0,c.useState)(!1),[t,u]=(0,c.useState)(!1),[B,D]=(0,c.useState)({aiProvider:"minimax"}),E=(0,c.useCallback)(async()=>{u(!0);try{D(await f.k.get("/api/settings"))}catch(a){h.V.error("[SettingsDialog]","Failed to fetch settings",{error:a})}finally{u(!1)}},[]);(0,c.useEffect)(()=>{o&&E()},[o,E]);let F=async b=>{let c=(0,cj.f)(B,m);if(c)return void N.c.error(c);s(!0);try{let c=await f.k.post("/api/settings",B);D(c),a(c.timeZone||am.J),g((0,bx.M)(c.questionNumbering)?c.questionNumbering:bx.L),N.c.success(m.settings?.messages?.saved||"Settings saved"),(0,ca.z)("settings_changed",{section:b}),q.current?.scrollTo({top:0,behavior:"smooth"})}catch(a){h.V.error("[SettingsDialog]","Failed to save settings",{error:a}),N.c.error(m.settings?.messages?.saveFailed||"Failed to save")}finally{s(!1)}},G=(a,c)=>(0,b.jsxs)(z.f,{onClick:()=>F(c),disabled:r,className:"w-full",children:[r&&(0,b.jsx)(y.f,{className:"mr-2 h-4 w-4 animate-spin"}),a]});return(0,b.jsxs)(A.N,{open:o,onOpenChange:p,children:[(0,b.jsx)(A.a,{asChild:!0,children:(0,b.jsxs)(z.f,{variant:"ghost",size:"icon",className:"rounded-full",children:[(0,b.jsx)(ai,{className:"h-5 w-5"}),(0,b.jsx)("span",{className:"sr-only",children:m.settings?.title||"Settings"})]})}),(0,b.jsxs)(A.d,{ref:q,className:"w-[calc(100vw-2rem)] sm:max-w-[900px] max-h-[85vh] overflow-y-auto",children:[(0,b.jsxs)(A.s,{children:[(0,b.jsx)(A.F,{children:m.settings?.title||"Settings"}),(0,b.jsx)(A.C,{children:m.settings?.desc||"Manage your preferences and data."})]}),(0,b.jsxs)(al.i,{defaultValue:"general",className:"w-full",children:[(0,b.jsxs)(al.U,{className:`grid w-full grid-cols-4 ${j?"sm:grid-cols-7":"sm:grid-cols-4"} gap-1 h-auto`,children:[(0,b.jsx)(ck,{value:"general",icon:(0,b.jsx)(ae.f,{className:"h-4 w-4 sm:mr-2"}),label:m.settings?.tabs?.general||"General"}),(0,b.jsx)(ck,{value:"account",icon:(0,b.jsx)(aj.f,{className:"h-4 w-4 sm:mr-2"}),label:m.settings?.tabs?.account||"Account"}),j&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(ck,{value:"ai",icon:(0,b.jsx)(ab,{className:"h-4 w-4 sm:mr-2"}),label:m.settings?.tabs?.ai||"AI Provider"}),(0,b.jsx)(ck,{value:"prompts",icon:(0,b.jsx)(ag,{className:"h-4 w-4 sm:mr-2"}),label:m.settings?.tabs?.prompts||"Prompts"}),(0,b.jsx)(ck,{value:"admin",icon:(0,b.jsx)(U,{className:"h-4 w-4 sm:mr-2"}),label:m.settings?.tabs?.admin||"User Management"})]}),(0,b.jsx)(ck,{value:"danger",icon:(0,b.jsx)(_.f,{className:"h-4 w-4 sm:mr-2"}),label:m.settings?.tabs?.danger||"Danger"}),(0,b.jsx)(ck,{value:"about",icon:(0,b.jsx)(ad,{className:"h-4 w-4 sm:mr-2"}),label:m.settings?.tabs?.about||"About"})]}),(0,b.jsxs)(al.S,{value:"general",className:"space-y-4 py-4",children:[(0,b.jsx)(bB,{config:B,setConfig:D,isAdmin:j,disabled:t||r}),(0,b.jsx)(bF,{}),j&&G(m.settings?.save||"Save Settings","general")]}),(0,b.jsxs)(al.S,{value:"account",className:"space-y-4 py-4",children:[(0,b.jsx)(aU,{}),(0,b.jsx)(bd,{})]}),(0,b.jsxs)(al.S,{value:"ai",className:"space-y-4 py-4",children:[(0,b.jsx)(aV.f,{config:B,setConfig:D,loading:t,saving:r,onSave:()=>F("ai")}),!t&&(0,b.jsx)(ci,{config:B,setConfig:D,saving:r,onSave:()=>F("tts")})]}),(0,b.jsxs)(al.S,{value:"prompts",className:"space-y-4 py-4",children:[(0,b.jsx)(b1,{config:B,onUpdate:(a,b)=>D(c=>({...c,prompts:{...c.prompts,[a]:b}}))}),G(m.settings?.prompts?.save||"Save Prompt Settings","prompts")]}),j&&(0,b.jsxs)(al.S,{value:"admin",className:"space-y-4 py-4",children:[(0,b.jsxs)(z.f,{variant:"outline",className:"w-full justify-start gap-2",onClick:()=>{p(!1),n.push("/admin")},children:[(0,b.jsx)(C.f,{className:"h-4 w-4"}),m.admin?.dashboard?.title||"Admin Dashboard"]}),(0,b.jsxs)(z.f,{variant:"outline",className:"w-full justify-start gap-2",onClick:()=>{p(!1),n.push("/setup")},children:[(0,b.jsx)(ak.f,{className:"h-4 w-4"}),m.setup.rerun]}),(0,b.jsx)(cb,{}),(0,b.jsx)(bn,{}),(0,b.jsx)(a3,{}),(0,b.jsx)("div",{className:"border-t pt-4",children:(0,b.jsx)(aE,{})})]}),(0,b.jsx)(al.S,{value:"danger",className:"space-y-4 py-4",children:(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsx)(bj,{isAdmin:j,userId:k,userEmail:l}),(0,b.jsx)(a7,{isAdmin:j}),(0,b.jsx)(ba,{isAdmin:j})]})}),(0,b.jsx)(al.S,{value:"about",className:"space-y-4 py-4",children:(0,b.jsx)(aP,{})})]})]})]})}var cm=a.i(474215);function cn({enabled:a}){let{t:e}=(0,d.b)(),g=e.telemetrySettings,[i,j]=(0,c.useState)(!1),[k,l]=(0,c.useState)(""),[m,n]=(0,c.useState)(!1);if((0,c.useEffect)(()=>{if(!a)return;let b=!1;return f.k.get(`${b7}?view=notice`).then(a=>{b||(l(a.eula.current),j(a.showNotice))}).catch(a=>h.V.warn("[TelemetryNotice]","Failed to load telemetry notice",{error:a})),()=>{b=!0}},[a]),!a||!i)return null;let o=async()=>{try{await b8(k),j(!1),N.c.success(g.enabled)}catch(a){throw h.V.error("[TelemetryNotice]","Failed to enable forwarding",{error:a}),N.c.error(g.failed),a}};return(0,b.jsxs)("div",{className:"border-b bg-primary/5 print:hidden",children:[(0,b.jsxs)("div",{className:"mx-auto flex max-w-6xl flex-col gap-2 px-4 py-2 text-sm sm:flex-row sm:items-center md:px-8",children:[(0,b.jsx)("p",{className:"flex-1 text-muted-foreground",children:g.noticeText}),(0,b.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,b.jsx)(z.f,{size:"sm",onClick:()=>n(!0),children:g.noticeEnable}),(0,b.jsxs)(z.f,{size:"sm",variant:"ghost",onClick:()=>{j(!1),b9({noticeDismissed:!0}).catch(a=>h.V.warn("[TelemetryNotice]","Failed to dismiss notice",{error:a}))},children:[(0,b.jsx)(cm.X,{className:"mr-1 h-4 w-4"}),g.noticeDismiss]})]})]}),(0,b.jsx)(b3,{open:m,onOpenChange:n,onConfirm:o})]})}var co=a.i(505004);let cp={name:"moon",size:24,node:[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]};cp.node;let cq=(0,H.f)(cp),cr={name:"sun",size:24,node:[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]};cr.node;let cs=(0,H.f)(cr);var ct=a.i(335732);let cu={system:co.f,light:cs,dark:cq};function cv(){let{t:a}=(0,d.b)(),{preference:e,setPreference:f}=(0,c.useContext)(m),g=cu[e],h=`${a.theme.toggle}: ${a.theme[e]}`;return(0,b.jsxs)(ct.G,{children:[(0,b.jsx)(ct.X,{asChild:!0,children:(0,b.jsx)(z.f,{variant:"ghost",size:"icon",className:"rounded-full",title:h,"aria-label":h,children:(0,b.jsx)(g,{className:"h-5 w-5"})})}),(0,b.jsx)(ct.L,{align:"end",children:(0,b.jsx)(ct.O,{value:e,onValueChange:a=>{l(a)&&f(a)},children:i.map(c=>{let d=cu[c];return(0,b.jsxs)(ct.T,{value:c,className:"gap-2",children:[(0,b.jsx)(d,{className:"h-4 w-4"}),a.theme[c]]},c)})})})]})}var cw=a.i(445233),cx=a.i(694796),cy=a.i(57441),cy=cy;let cz=["gemini","openai","azure","anthropic","minimax-code",...cf.U],cA=["1","2-5","6-20",">20"],cB=["0","1-50","51-500",">500"],cC=cw.z.enum(cz),cD=cx.z.boolean();Object.keys({app_installed:cy.strictObject({method:cw.z.enum(["setup-token","preset-admin"])}),eula_accepted:cy.strictObject({version:aY.z.string().regex(/^v\d{1,4}$/),trigger:cw.z.enum(["install","upgrade","settings"])}),instance_alive:cy.strictObject({platform:cw.z.enum(["docker","npm","desktop","fnos","android","other"]),aiConfigured:cx.z.boolean()}),app_opened:cy.strictObject({client:cw.z.enum(["browser","pwa","desktop","android"])}),page_viewed:cy.strictObject({page:cw.z.enum(["home","notebooks","error_detail","practice","review","stats","tags","exams","settings","admin","imports","print","auth","setup","other"])}),ai_analyze_started:cy.strictObject({provider:cC}),ai_analyze_result:cy.strictObject({ok:cD,provider:cC,duration:cw.z.enum(["<3s","3-10s","10-30s",">30s"])}),ai_reanswer:cy.strictObject({ok:cD,provider:cC}),ai_practice_grading:cy.strictObject({ok:cD,count:cw.z.enum(cA)}),exam_paper_generation:cy.strictObject({ok:cD,count:cw.z.enum(cA)}),data_exported:cy.strictObject({scope:cw.z.enum(["user","all"]),rows:cw.z.enum(cB)}),data_imported:cy.strictObject({rows:cw.z.enum(cB)}),tts_used:cy.strictObject({mode:cw.z.enum(ch.l)}),settings_changed:cy.strictObject({section:cw.z.enum(["general","ai","tts","prompts","telemetry"])})});let cE=[[/^\/$/,"home"],[/^\/notebooks?(\/|$)/,"notebooks"],[/^\/error-items?\/[^/]+/,"error_detail"],[/^\/practice(\/|$)/,"practice"],[/^\/review(\/|$)/,"review"],[/^\/stats(\/|$)/,"stats"],[/^\/tags(\/|$)/,"tags"],[/^\/exams?(\/|$)/,"exams"],[/^\/import-(tasks|batches)?(\/|$)/,"imports"],[/^\/print-preview(\/|$)/,"print"],[/^\/(login|register)(\/|$)/,"auth"],[/^\/(initialize|eula)(\/|$)/,"setup"],[/^\/(settings|setup)(\/|$)/,"settings"],[/^\/admin(\/|$)/,"admin"]];function cF({children:a}){var g,i;let j,k,l,m=(0,x.usePathname)()||"/",{t:n}=(0,d.b)(),{data:o,status:p}=(0,e.useSession)(),q=o?.user?.role==="admin",r=M(m);g=q&&!r,j=(0,x.useRouter)(),k=(0,c.useRef)(!1),(0,c.useEffect)(()=>{g&&!k.current&&(k.current=!0,f.k.get("/api/setup").then(a=>{a.needsSetup&&j.replace("/setup")}).catch(a=>h.V.warn("[Setup]","Failed to check setup status",{error:a})))},[g,j]),i="authenticated"===p,l=(0,c.useRef)(null),(0,c.useEffect)(()=>{(0,ca.J)()},[]),(0,c.useEffect)(()=>{let a;if(!i)return;let b=(a=m.split(/[?#]/)[0]||"/",cE.find(([b])=>b.test(a))?.[1]??"other");b!==l.current&&(l.current=b,(0,ca.z)("page_viewed",{page:b}))},[m,i]);let s=function(a){let[b,d]=(0,c.useState)(null);(0,c.useEffect)(()=>{if(!a)return;let b=!1;return f.k.get("/api/eula/status").then(a=>{b||d(a)}).catch(a=>h.V.warn("[EulaGate]","Failed to check EULA status",{error:a})),()=>{b=!0}},[a]);let e=(0,c.useCallback)(async()=>{b&&d(await f.k.post("/api/admin/eula/accept",{version:b.current}))},[b]);return{pending:a&&!!b?.pending,status:b,accept:e}}(q&&"authenticated"===p),t=s.pending&&s.status?(0,b.jsx)(W,{status:s.status,onAccept:s.accept}):null;if(r||"unauthenticated"===p)return(0,b.jsxs)(b.Fragment,{children:[a,t]});let u=o?.user?.name||o?.user?.email||"";return(0,b.jsxs)("div",{className:"min-h-screen",children:[(0,b.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,b.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,b.jsxs)(R.default,{href:"/",className:"flex shrink-0 items-center gap-2",children:[(0,b.jsx)(Q.default,{src:"/icons/icon.png",alt:"",width:32,height:32,className:"rounded-lg",priority:!0,unoptimized:!0}),(0,b.jsx)("span",{className:"hidden text-base font-semibold tracking-tight sm:inline",children:n.pageTitle.base})]}),(0,b.jsx)("nav",{className:"ml-4 hidden items-center gap-1 md:flex",children:L.map(a=>{let c=a.match(m),d=a.icon;return(0,b.jsxs)(R.default,{href:a.href,className:(0,Z.f)("flex items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors",c?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground"),"aria-current":c?"page":void 0,children:[(0,b.jsx)(d,{className:"h-4 w-4"}),n.nav[a.key]]},a.key)})}),(0,b.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[u&&(0,b.jsxs)("span",{className:"mr-2 hidden max-w-40 items-center gap-2 truncate text-sm text-muted-foreground lg:flex",children:[(0,b.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:u.slice(0,1).toUpperCase()}),(0,b.jsx)("span",{className:"truncate",children:u})]}),q&&(0,b.jsx)(R.default,{href:"/admin",title:n.nav.admin,children:(0,b.jsxs)(z.f,{variant:"ghost",size:"icon",className:"rounded-full",children:[(0,b.jsx)(U,{className:"h-5 w-5"}),(0,b.jsx)("span",{className:"sr-only",children:n.nav.admin})]})}),(0,b.jsx)($,{className:"mr-1"}),(0,b.jsx)(cv,{}),(0,b.jsx)(cl,{}),(0,b.jsx)(z.f,{variant:"ghost",size:"icon",className:"rounded-full text-muted-foreground hover:text-destructive",onClick:()=>(0,e.signOut)({callbackUrl:"/login"}),title:n.app.logout,children:(0,b.jsx)(S.f,{className:"h-5 w-5"})})]})]})}),(0,b.jsx)(cn,{enabled:q&&"authenticated"===p&&!s.pending}),(0,b.jsx)("div",{className:"pb-20 md:pb-0",children:a}),t,(0,b.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,b.jsx)("div",{className:"grid h-16",style:{gridTemplateColumns:`repeat(${L.length}, minmax(0, 1fr))`},children:L.map(a=>{let c=a.match(m),d=a.icon;return(0,b.jsxs)(R.default,{href:a.href,className:(0,Z.f)("flex flex-col items-center justify-center gap-1 text-[11px] font-medium transition-colors",c?"text-primary":"text-muted-foreground"),"aria-current":c?"page":void 0,children:[(0,b.jsx)("span",{className:(0,Z.f)("flex h-7 w-12 items-center justify-center rounded-full transition-colors",c&&"bg-accent"),children:(0,b.jsx)(d,{className:"h-5 w-5"})}),n.nav[a.key]]},a.key)})})})]})}let cG={name:"list-todo",size:24,node:[["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"}]]};cG.node;let cH=(0,H.f)(cG);var cI=a.i(211134),cJ=a.i(374161);let cK=[/^\/login/,/^\/register/,/^\/print-preview/,/^\/exams\/[^/]+\/print/];function cL(){let{t:a}=(0,d.b)(),{timeZone:g}=(0,w.M)(),{status:h}=(0,e.useSession)(),i=(0,x.usePathname)(),[j,k]=(0,c.useState)(!1),[l,m]=(0,c.useState)(()=>cJ.f.getSnapshot()),[n,o]=(0,c.useState)(()=>Date.now()),p="authenticated"!==h||cK.some(a=>a.test(i||""));if((0,c.useEffect)(()=>{if(!p)return cJ.f.subscribe(a=>{m(a),o(Date.now())})},[p]),p)return null;let q=l.filter(a=>"running"===a.status).length,r=l.some(a=>"running"!==a.status),s=async()=>{try{await f.k.delete("/api/tasks"),await cJ.f.refresh()}catch{}};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(z.f,{variant:"outline",size:"icon",className:"fixed bottom-20 right-4 z-40 h-11 w-11 rounded-full shadow-lg md:bottom-6 md:right-6 print:hidden",onClick:()=>k(!0),"aria-label":a.backgroundTasks.title,title:a.backgroundTasks.title,children:[q>0?(0,b.jsx)(y.f,{className:"h-5 w-5 animate-spin"}):(0,b.jsx)(cH,{className:"h-5 w-5"}),q>0&&(0,b.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:q})]}),(0,b.jsx)(A.N,{open:j,onOpenChange:k,children:(0,b.jsxs)(A.d,{className:"max-h-[85vh] overflow-y-auto sm:max-w-lg",children:[(0,b.jsxs)(A.s,{children:[(0,b.jsx)(A.F,{children:a.backgroundTasks.title}),(0,b.jsx)(A.C,{children:a.backgroundTasks.description})]}),0===l.length?(0,b.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:a.backgroundTasks.empty}):(0,b.jsx)("ul",{className:"space-y-2",children:l.map(c=>{var d,e;let f;return(0,b.jsx)("li",{className:"rounded-md border p-3 text-sm",children:(0,b.jsxs)("div",{className:"flex items-start gap-2",children:["running"===c.status&&(0,b.jsx)(y.f,{className:"mt-0.5 h-4 w-4 shrink-0 animate-spin text-primary"}),"succeeded"===c.status&&(0,b.jsx)(be.f,{className:"mt-0.5 h-4 w-4 shrink-0 text-green-600"}),"failed"===c.status&&(0,b.jsx)(cI.f,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),(0,b.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,b.jsxs)("div",{className:"font-medium",children:[a.backgroundTasks.kinds[c.kind],(0,b.jsxs)("span",{className:"font-normal text-muted-foreground",children:[" · ",a.backgroundTasks.status[c.status]]})]}),c.subject&&(0,b.jsx)("div",{className:"break-words text-muted-foreground",children:c.subject}),c.progress&&c.progress.total>0&&(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("div",{className:"h-1.5 overflow-hidden rounded bg-muted",children:(0,b.jsx)("div",{className:"h-full bg-primary transition-all",style:{width:`${Math.round(c.progress.done/c.progress.total*100)}%`}})}),(0,b.jsxs)("div",{className:"text-xs text-muted-foreground",children:[a.backgroundTasks.progress.replace("{done}",String(c.progress.done)).replace("{total}",String(c.progress.total)),c.progress.failed>0&&` \xb7 ${a.backgroundTasks.failedCount.replace("{count}",String(c.progress.failed))}`]})]}),c.error&&(0,b.jsx)("div",{className:"text-xs text-destructive",children:(b=>{if(!b)return null;let c=a.backgroundTasks.errors[b]??a.errors[b];return"string"==typeof c?c:b})(c.error)}),(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 text-xs text-muted-foreground",children:[(0,b.jsx)("span",{children:a.backgroundTasks.startedAt.replace("{time}",(0,am.r)(c.startedAt,"HH:mm:ss",g))}),(0,b.jsx)("span",{children:a.backgroundTasks.elapsed.replace("{time}",(d=c.startedAt,e=c.finishedAt,f=Math.max(0,Math.round(((e?Date.parse(e):n)-Date.parse(d))/1e3)),`${Math.floor(f/60)}:${String(f%60).padStart(2,"0")}`))}),c.link&&(0,b.jsx)(R.default,{href:c.link,className:"text-primary hover:underline",onClick:()=>k(!1),children:a.backgroundTasks.view})]})]})]})},c.id)})}),(0,b.jsxs)("div",{className:"flex items-center justify-between gap-2 pt-1",children:[(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:a.backgroundTasks.retentionHint}),r&&(0,b.jsx)(z.f,{variant:"ghost",size:"sm",onClick:s,children:a.backgroundTasks.clearFinished})]})]})})]})}var cM=a.i(131900);function cN(){let{t:a}=(0,d.b)(),e=(0,cM.f)(),[f,g]=(0,c.useState)(!1),h=e?function(a){let b=/\bChrome\/(\d+)\./.exec(a);if(!b)return null;let c=Number(b[1]);return c>=111?null:{kind:/; wv\)/.test(a)||a.includes("WrongNotebookAndroid/")?"webview":"browser",version:c}}(navigator.userAgent):null;if(!h||f)return null;let i="webview"===h.kind?a.browserSupport.outdatedWebView:a.browserSupport.outdatedBrowser;return(0,b.jsxs)("div",{role:"alert","data-testid":"outdated-browser-notice",className:"flex items-start gap-3 border-b border-amber-300 bg-amber-100 px-4 py-2 text-sm text-amber-900",children:[(0,b.jsx)("p",{className:"flex-1",children:i.replace("{version}",String(h.version))}),(0,b.jsx)("button",{type:"button",onClick:()=>g(!0),className:"shrink-0 font-medium underline",children:a.common.close})]})}let cO={success:{icon:be.f,className:"text-success"},error:{icon:cI.f,className:"text-destructive"},warning:{icon:_.f,className:"text-warning"},info:{icon:ad,className:"text-primary"}};function cP(){let{t:a}=(0,d.b)(),[e,f]=(0,c.useState)([]),[g,h]=(0,c.useState)(null);return(0,c.useEffect)(()=>(0,N.M)(a=>{f(a.toasts),h(a.confirm)}),[]),(0,b.jsxs)(b.Fragment,{children:[(0,b.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:e.map(c=>{let{icon:d,className:e}=cO[c.type];return(0,b.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,b.jsx)(d,{className:(0,Z.f)("mt-0.5 h-4 w-4 shrink-0",e)}),(0,b.jsx)("p",{className:"min-w-0 flex-1 whitespace-pre-line break-words leading-relaxed",children:c.message}),(0,b.jsx)("button",{type:"button",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:text-foreground",onClick:()=>(0,N.p)(c.id),"aria-label":a.common.close,children:(0,b.jsx)(cm.X,{className:"h-3.5 w-3.5"})})]},c.id)})}),(0,b.jsx)(A.N,{open:!!g,onOpenChange:a=>{a||g?.resolve(!1)},children:(0,b.jsxs)(A.d,{className:"sm:max-w-md",children:[(0,b.jsxs)(A.s,{children:[(0,b.jsxs)(A.F,{className:"flex items-center gap-2",children:[g?.destructive&&(0,b.jsx)(_.f,{className:"h-5 w-5 text-destructive"}),g?.title||a.common.confirmTitle]}),(0,b.jsx)(A.C,{className:"whitespace-pre-line pt-1 text-left leading-relaxed",children:g?.message})]}),(0,b.jsxs)(A.c,{className:"gap-2",children:[(0,b.jsx)(z.f,{variant:"outline",onClick:()=>g?.resolve(!1),children:g?.cancelText||a.common.cancel}),(0,b.jsx)(z.f,{variant:g?.destructive?"destructive":"default",onClick:()=>g?.resolve(!0),autoFocus:!0,children:g?.confirmText||a.common.confirm})]})]})})]})}function cQ(){return(0,c.useEffect)(()=>{"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js",{scope:"/"}).catch(a=>{h.V.warn("[PWA]","Service worker registration failed",{error:String(a)})})},[]),null}a.s(["Providers",0,function({children:a,timeZone:f,questionNumbering:g}){return(0,c.useEffect)(()=>(0,h.m)(),[]),(0,b.jsx)(e.SessionProvider,{children:(0,b.jsx)(u,{children:(0,b.jsx)(d.w,{children:(0,b.jsx)(w.n,{initialTimeZone:f,children:(0,b.jsxs)(v.K,{initialNumbering:g,children:[(0,b.jsx)(cN,{}),(0,b.jsx)(cF,{children:a}),(0,b.jsx)(cL,{}),(0,b.jsx)(P,{}),(0,b.jsx)(cP,{}),(0,b.jsx)(cQ,{})]})})})})})}],418175)}];
|
|
265
259
|
|
|
266
260
|
//# sourceMappingURL=src_components_providers_tsx_09kw-mv3nb6xs._.js.map
|