wrong-notebook 2026.11.1 → 2026.11.2-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +1 -0
- package/.next/build-manifest.json +3 -3
- package/.next/prerender-manifest.json +3 -3
- package/.next/routes-manifest.json +6 -0
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/admin/page.js.nft.json +1 -1
- package/.next/server/app/admin/page_client-reference-manifest.js +1 -1
- package/.next/server/app/admin/user/[id]/page.js.nft.json +1 -1
- package/.next/server/app/admin/user/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/api/admin/cnm-tags/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/admin/cnm-tags/route/build-manifest.json +12 -0
- package/.next/server/app/api/admin/cnm-tags/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/admin/cnm-tags/route.js +12 -0
- package/.next/server/app/api/admin/cnm-tags/route.js.map +5 -0
- package/.next/server/app/api/admin/cnm-tags/route.js.nft.json +1 -0
- package/.next/server/app/api/admin/cnm-tags/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/admin/dashboard/route.js +10 -10
- package/.next/server/app/api/admin/dashboard/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/debug-logs/export/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/debug-logs/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/migrate-tags/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/system-reset/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/users/[id]/detail/route.js +10 -10
- package/.next/server/app/api/admin/users/[id]/detail/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/users/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/users/route.js.nft.json +1 -1
- package/.next/server/app/api/ai/models/route.js +4 -4
- package/.next/server/app/api/ai/models/route.js.nft.json +1 -1
- package/.next/server/app/api/ai/test/route.js +8 -8
- package/.next/server/app/api/ai/test/route.js.nft.json +1 -1
- package/.next/server/app/api/analytics/route.js +8 -8
- package/.next/server/app/api/analytics/route.js.nft.json +1 -1
- package/.next/server/app/api/analyze/route.js +4 -4
- package/.next/server/app/api/analyze/route.js.nft.json +1 -1
- package/.next/server/app/api/auth/[...nextauth]/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/delete/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/figure/route.js +10 -10
- package/.next/server/app/api/error-items/[id]/figure/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/fix-latex/route.js +7 -7
- package/.next/server/app/api/error-items/[id]/fix-latex/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/geogebra/route.js +13 -13
- package/.next/server/app/api/error-items/[id]/geogebra/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/image/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/notes/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/practice-records/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/reanswer/route.js +10 -10
- package/.next/server/app/api/error-items/[id]/reanswer/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/retag/route.js +9 -9
- package/.next/server/app/api/error-items/[id]/retag/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/svg-animation/narration/route.js +10 -10
- package/.next/server/app/api/error-items/[id]/svg-animation/narration/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/svg-animation/route.js +10 -10
- package/.next/server/app/api/error-items/[id]/svg-animation/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/batch-delete/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/clear/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/list/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/route.js +11 -11
- package/.next/server/app/api/error-items/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/short/[shortId]/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/similarity/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/questions/[questionId]/regenerate/route.js +13 -13
- package/.next/server/app/api/exams/[id]/questions/[questionId]/regenerate/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/results/route.js +10 -10
- package/.next/server/app/api/exams/[id]/results/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/retry/route.js +9 -9
- package/.next/server/app/api/exams/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/route.js +13 -13
- package/.next/server/app/api/exams/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/route.js +12 -12
- package/.next/server/app/api/exams/route.js.nft.json +1 -1
- package/.next/server/app/api/export/route.js.nft.json +1 -1
- package/.next/server/app/api/geogebra-analyze/route.js +6 -6
- package/.next/server/app/api/geogebra-analyze/route.js.nft.json +1 -1
- package/.next/server/app/api/health/route.js.nft.json +1 -1
- package/.next/server/app/api/import/route.js +13 -13
- package/.next/server/app/api/import/route.js.nft.json +1 -1
- package/.next/server/app/api/initialize/route.js.nft.json +1 -1
- package/.next/server/app/api/logs/frontend/route.js.nft.json +1 -1
- package/.next/server/app/api/minimax-code/checkin/route.js.nft.json +1 -1
- package/.next/server/app/api/minimax-code/login/route.js.nft.json +1 -1
- package/.next/server/app/api/minimax-code/route.js.nft.json +1 -1
- package/.next/server/app/api/notebooks/[id]/retag/route.js +12 -12
- package/.next/server/app/api/notebooks/[id]/retag/route.js.nft.json +1 -1
- package/.next/server/app/api/notebooks/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/notebooks/route.js.nft.json +1 -1
- package/.next/server/app/api/openclaw/batch-upload/route.js +8 -8
- package/.next/server/app/api/openclaw/batch-upload/route.js.nft.json +1 -1
- package/.next/server/app/api/paper-groups/[id]/route.js +1 -1
- package/.next/server/app/api/paper-groups/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/paper-groups/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/generate/route.js +9 -9
- package/.next/server/app/api/practice/generate/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/grade/route.js +6 -6
- package/.next/server/app/api/practice/grade/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/record/[id]/route.js +10 -10
- package/.next/server/app/api/practice/record/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/record/route.js +10 -10
- package/.next/server/app/api/practice/record/route.js.nft.json +1 -1
- package/.next/server/app/api/reanswer/route.js +4 -4
- package/.next/server/app/api/reanswer/route.js.nft.json +1 -1
- package/.next/server/app/api/register/route.js.nft.json +1 -1
- package/.next/server/app/api/register/status/route.js.nft.json +1 -1
- package/.next/server/app/api/requests/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/review/due/route.js +8 -8
- package/.next/server/app/api/review/due/route.js.nft.json +1 -1
- package/.next/server/app/api/settings/route.js.nft.json +1 -1
- package/.next/server/app/api/setup/route.js.nft.json +1 -1
- package/.next/server/app/api/stats/practice/clear/route.js.nft.json +1 -1
- package/.next/server/app/api/stats/practice/route.js.nft.json +1 -1
- package/.next/server/app/api/tags/route.js.nft.json +1 -1
- package/.next/server/app/api/tags/stats/route.js.nft.json +1 -1
- package/.next/server/app/api/tags/suggestions/route.js.nft.json +1 -1
- package/.next/server/app/api/tasks/route.js.nft.json +1 -1
- package/.next/server/app/api/tts/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/tts/batch/route.js +6 -6
- package/.next/server/app/api/tts/batch/route.js.nft.json +1 -1
- package/.next/server/app/api/tts/route.js +5 -5
- package/.next/server/app/api/tts/route.js.nft.json +1 -1
- package/.next/server/app/api/tts/status/route.js +4 -4
- package/.next/server/app/api/tts/status/route.js.nft.json +1 -1
- package/.next/server/app/api/user/route.js +9 -9
- package/.next/server/app/api/user/route.js.nft.json +1 -1
- package/.next/server/app/api/version/route.js.nft.json +1 -1
- package/.next/server/app/error-items/[id]/page.js.nft.json +1 -1
- package/.next/server/app/error-items/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/exams/[id]/page.js.nft.json +1 -1
- package/.next/server/app/exams/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/exams/[id]/print/page.js.nft.json +1 -1
- package/.next/server/app/exams/[id]/print/page_client-reference-manifest.js +1 -1
- package/.next/server/app/exams/page.js.nft.json +1 -1
- package/.next/server/app/exams/page_client-reference-manifest.js +1 -1
- package/.next/server/app/initialize/page.js.nft.json +1 -1
- package/.next/server/app/initialize/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login/page.js.nft.json +1 -1
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/notebooks/[id]/add/page.js.nft.json +1 -1
- package/.next/server/app/notebooks/[id]/add/page_client-reference-manifest.js +1 -1
- package/.next/server/app/notebooks/[id]/page.js.nft.json +1 -1
- package/.next/server/app/notebooks/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/notebooks/page.js.nft.json +1 -1
- package/.next/server/app/notebooks/page_client-reference-manifest.js +1 -1
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/practice/page.js.nft.json +1 -1
- package/.next/server/app/practice/page_client-reference-manifest.js +1 -1
- package/.next/server/app/print-preview/page.js.nft.json +1 -1
- package/.next/server/app/print-preview/page_client-reference-manifest.js +1 -1
- package/.next/server/app/register/page.js.nft.json +1 -1
- package/.next/server/app/register/page_client-reference-manifest.js +1 -1
- package/.next/server/app/review/page.js.nft.json +1 -1
- package/.next/server/app/review/page_client-reference-manifest.js +1 -1
- package/.next/server/app/setup/page.js.nft.json +1 -1
- package/.next/server/app/setup/page_client-reference-manifest.js +1 -1
- package/.next/server/app/stats/page.js.nft.json +1 -1
- package/.next/server/app/stats/page_client-reference-manifest.js +1 -1
- package/.next/server/app/tags/page.js.nft.json +1 -1
- package/.next/server/app/tags/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +1 -0
- package/.next/server/chunks/[root-of-the-server]__02dkbynj2vxld._.js +1 -1
- package/.next/server/chunks/{[root-of-the-server]__0z24ffpp1rsf3._.js → [root-of-the-server]__08t21dbk1cidn._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__09jqnx_673l93._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0_uvtfu0yr-na._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0nujsu6qbn-8o._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0tflqqgyujt1r._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__13_k7w8nrx7ie._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__18z_cczwqkonn._.js +1 -1
- package/.next/server/chunks/{[root-of-the-server]__0rpqerm37sl_v._.js → [root-of-the-server]__1f_lrxzw_n-6-._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__1ptzu7aqoga2n._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1r0s6pktkiqkf._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1r_x7moz0opqt._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__1mfrik5p09lu9._.js → [root-of-the-server]__1sggr1m3ukvts._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__1v1p83o4ygnyt._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1wh65tfd7apxx._.js +3 -0
- package/.next/server/chunks/_0dicq393_0h3i._.js +3 -0
- package/.next/server/chunks/{_0jgk7kwvf4_6i._.js → _0x3jdlmx-bey5._.js} +1 -1
- package/.next/server/chunks/_10tpt8iizl4v3._.js +3 -3
- package/.next/server/chunks/_1dvka-waihfum._.js +3 -3
- package/.next/server/chunks/_1yujnc0thk8ab._.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_admin_cnm-tags_route_actions_1en5m631bmjfo.js +3 -0
- package/.next/server/chunks/src_lib_0r67kyyoh6ky6._.js +1 -1
- package/.next/server/chunks/src_lib_1_m3-y2t3e4xi._.js +46 -42
- package/.next/server/chunks/src_lib_1geq39r7va9gy._.js +1 -1
- package/.next/server/chunks/src_lib_logger_ts_1a0ve505bb0y2._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0fy6mc47ccfce._.js +1 -1
- package/.next/server/chunks/ssr/_02zfjls23g-o4._.js +1 -1
- package/.next/server/chunks/ssr/_09y2uhjubswp4._.js +1 -1
- package/.next/server/chunks/ssr/_0cmd1ubdlo_by._.js +1 -1
- package/.next/server/chunks/ssr/_0ltqx22v65imo._.js +1 -1
- package/.next/server/chunks/ssr/_0lzeodofsq9pe._.js +1 -1
- package/.next/server/chunks/ssr/_0ozptnii2nxuw._.js +1 -1
- package/.next/server/chunks/ssr/_0rd-teluypcd2._.js +1 -1
- package/.next/server/chunks/ssr/_0tr-7klbcz1r7._.js +3 -0
- package/.next/server/chunks/ssr/_0xsd7dy2sxg53._.js +3 -0
- package/.next/server/chunks/ssr/_1-i5cy964i_s9._.js +3 -0
- package/.next/server/chunks/ssr/_12toteu0ut39i._.js +3 -0
- package/.next/server/chunks/ssr/_1cc3psc9rvrwn._.js +1 -1
- package/.next/server/chunks/ssr/_1qgg_ll5hkjaf._.js +2 -2
- package/.next/server/chunks/ssr/_1ux6eqqkupo6v._.js +2 -2
- package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_icons_play_mjs_1al5hft92dlrg._.js +1 -1
- package/.next/server/chunks/ssr/src_1gayunqs8u2e2._.js +1 -1
- package/.next/server/chunks/ssr/src_app_admin_page_tsx_0ublbd0w90cx_._.js +1 -1
- package/.next/server/chunks/ssr/src_app_admin_user_[id]_page_tsx_0zidp-8hr5upa._.js +1 -1
- package/.next/server/chunks/ssr/src_app_error-items_[id]_page_tsx_04xwwdmyh7_9q._.js +1 -1
- package/.next/server/chunks/ssr/src_app_exams_[id]_page_tsx_0xcjflkgkwzgd._.js +1 -1
- package/.next/server/chunks/ssr/src_app_exams_[id]_print_page_tsx_1i-xvhk8ul1l1._.js +9 -9
- package/.next/server/chunks/ssr/src_app_exams_page_tsx_17_d4_gy2i1ds._.js +1 -1
- package/.next/server/chunks/ssr/src_app_notebooks_[id]_add_page_tsx_179tow1ql6vc_._.js +1 -1
- package/.next/server/chunks/ssr/src_app_notebooks_[id]_page_tsx_08njm-5-txm8_._.js +1 -1
- package/.next/server/chunks/ssr/src_app_notebooks_page_tsx_1p9src5gnz_40._.js +1 -1
- package/.next/server/chunks/ssr/src_app_page_tsx_1chiuahujsxm1._.js +1 -1
- package/.next/server/chunks/ssr/src_app_practice_page_tsx_10gnx53v3kpzb._.js +1 -1
- package/.next/server/chunks/ssr/src_app_print-preview_page_tsx_001yt-fzrj7tf._.js +1 -1
- package/.next/server/chunks/ssr/src_app_register_page_tsx_0l87b3754fa2j._.js +1 -1
- package/.next/server/chunks/ssr/src_app_review_page_tsx_1rq4ygvo_szv0._.js +1 -1
- package/.next/server/chunks/ssr/src_app_setup_page_tsx_0szlnxow_9skp._.js +1 -1
- package/.next/server/chunks/ssr/src_components_1od0rowgu8w6v._.js +1 -1
- package/.next/server/chunks/ssr/src_components_create-notebook-dialog_tsx_0c5teagim70r7._.js +1 -1
- package/.next/server/chunks/ssr/src_components_mastery-panel_tsx_1--j5c7mhomdp._.js +1 -1
- package/.next/server/chunks/ssr/src_components_print-preview_answer-space-control_tsx_02kuswyxklzp_._.js +33 -0
- package/.next/server/chunks/ssr/src_components_providers_tsx_09kw-mv3nb6xs._.js +73 -17
- package/.next/server/chunks/ssr/src_components_tag-input_tsx_0b9sxffna5c9i._.js +1 -1
- package/.next/server/chunks/ssr/src_lib_api-client_ts_04r2_ex-gua5i._.js +1 -1
- package/.next/server/chunks/ssr/src_lib_short-id-client_ts_1v7n6pg50kguj._.js +1 -1
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/pages/500.html +1 -1
- package/.next/server/preview-props.json +3 -3
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/{42p60iwe4ayfi.js → 06bfusm1eqhzt.js} +1 -1
- package/.next/static/chunks/{1oqx_8e83xfjr.js → 0fu1xttg42yzk.js} +1 -1
- package/.next/static/chunks/{1wq7na8axxyfd.js → 0nq5_ne_bugdp.js} +1 -1
- package/.next/static/chunks/0xuzdy0dn7jkp.js +63 -0
- package/.next/static/chunks/{1dyf1qqv2ckxs.js → 1-00icoq9w3_i.js} +1 -1
- package/.next/static/chunks/{2r4x8vhlmc092.js → 1b5jj8zk0mtzk.js} +1 -1
- package/.next/static/chunks/{3fohh6i-hrda9.js → 1d-3q230sjpsa.js} +1 -1
- package/.next/static/chunks/{1gvev34tv39bd.js → 1fa2xv93zl8oj.js} +1 -1
- package/.next/static/chunks/{370c45nip4mld.js → 1g13qcek7-0du.js} +1 -1
- package/.next/static/chunks/1iixgyplm7q17.js +247 -0
- package/.next/static/chunks/{10xs8eu3rd2lt.js → 1ou17klnb8gu_.js} +1 -1
- package/.next/static/chunks/{1sjf69friyuwh.js → 1pdlii0oox0-7.js} +1 -1
- package/.next/static/chunks/{26-0j9v7hswqr.js → 1rzk5q74nsv73.js} +1 -1
- package/.next/static/chunks/{25emavlvjqnb_.js → 1sisl9ld-ag-o.js} +2 -2
- package/.next/static/chunks/{2hihgd7vu8tw5.js → 1z_0hbg6kxv58.js} +1 -1
- package/.next/static/chunks/{41j6vve1unchm.js → 2cfz0fumc6ghe.js} +1 -1
- package/.next/static/chunks/2dml0yrklxocr.js +31 -0
- package/.next/static/chunks/{2p9s6dcxnj129.js → 2e0fqyqddz02g.js} +1 -1
- package/.next/static/chunks/{2qvnb2d_gv2o5.js → 2huy9i-dnxshq.js} +1 -1
- package/.next/static/chunks/{2h1-bjeib7r-u.js → 2mu8zu6zd59z2.js} +1 -1
- package/.next/static/chunks/{09z8ds-9g-ble.js → 2urhwgx3nt7lq.js} +1 -1
- package/.next/static/chunks/{1c36uw_9rc8oc.js → 2xibor-sxcc67.js} +1 -1
- package/.next/static/chunks/3-7dqhvzmyl4y.css +3 -0
- package/.next/static/chunks/{31pvc0nv10j93.js → 3-w46lg1a_qse.js} +1 -1
- package/.next/static/chunks/{0zj83pnid72u3.js → 34lp-hkkywd8r.js} +1 -1
- package/.next/static/chunks/37d6vrdascsro.js +1 -0
- package/.next/static/chunks/{0lwd5-772ng4i.js → 3difxy8vzqlxn.js} +1 -1
- package/.next/static/chunks/3zs0fu6zcu0lb.js +1 -0
- package/dist-scripts/src/lib/debug-log.js +6 -6
- package/package.json +1 -1
- package/prisma/seed.db +0 -0
- package/.next/server/chunks/ssr/_037_l3ca0s_0m._.js +0 -3
- package/.next/server/chunks/ssr/_0_snnfou-vj50._.js +0 -3
- package/.next/server/chunks/ssr/_19-9r85m2zwkm._.js +0 -3
- package/.next/server/chunks/ssr/_1b5bo2mgv9_4a._.js +0 -3
- package/.next/static/chunks/0i1q2hqzk7ojc.css +0 -3
- package/.next/static/chunks/24mest-vas-bu.js +0 -33
- package/.next/static/chunks/2ju2bi0z49pn1.js +0 -1
- package/.next/static/chunks/2rx6yjo9suvmj.js +0 -1
- package/.next/static/chunks/2zgqd5dt_6z_7.js +0 -1
- package/.next/static/chunks/3cyz6w014ooxj.js +0 -191
- /package/.next/static/{6sBeEDpD-TPpDMfiFpz9K → RjcLZuifR9iENqJ77CSYI}/_buildManifest.js +0 -0
- /package/.next/static/{6sBeEDpD-TPpDMfiFpz9K → RjcLZuifR9iENqJ77CSYI}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{6sBeEDpD-TPpDMfiFpz9K → RjcLZuifR9iENqJ77CSYI}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,367784,699375,e=>{var s=e.i(456420);let i={name:"log-out",size:24,node:[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]};i.node;let t=(0,s.f)(i);e.s(["f",0,t],367784);var n=e.i(843476),a=e.i(271645),r=e.i(981140),l=e.i(820783),o=e.i(30030),c=e.i(369340),d=e.i(635804),m=e.i(248425),p=Object.defineProperty,u=(e,s)=>p(e,"name",{value:s,configurable:!0}),h="Switch",[x,f]=(0,o.f)(h),[g,v]=x(h);function j(e){let{__scopeSwitch:s,checked:i,children:t,defaultChecked:r,disabled:l,form:o,name:d,onCheckedChange:m,required:p,value:u="on",internal_do_not_use_render:x}=e,[f,v]=(0,c.f)({prop:i,defaultProp:r??!1,onChange:m,caller:h}),[j,y]=a.useState(null),[b,N]=a.useState(null),[k,C]=a.useState(null),S=!j||!!o||!!j.closest("form"),U={checked:f,setChecked:v,disabled:l,control:j,setControl:y,name:d,form:o,value:u,userClick:k,onUserClick:C,required:p,defaultChecked:r,isFormControl:S,bubbleInput:b,setBubbleInput:N};return(0,n.jsx)(g,{scope:s,...U,children:w(x)?x(U):t})}u(j,"SwitchProvider");var y=a.forwardRef(u(function({__scopeSwitch:e,onClick:s,...i},t){let{control:o,form:c,value:d,disabled:p,checked:h,required:x,setControl:f,setChecked:g,onUserClick:j,isFormControl:y,bubbleInput:b}=v("SwitchTrigger",e),N=(0,l.f)(t,f),k=a.useRef(h);return a.useEffect(()=>{let e=c?o?.ownerDocument.getElementById(c):o?.form;if(e instanceof HTMLFormElement){let s=u(()=>g(k.current),"reset");return e.addEventListener("reset",s),()=>e.removeEventListener("reset",s)}},[o,c,g]),(0,n.jsx)(m.V.button,{type:"button",role:"switch","aria-checked":h,"aria-required":x,"data-state":C(h),"data-disabled":p?"":void 0,disabled:p,value:d,...i,ref:N,onClick:(0,r.f)(s,e=>{let s=e.isPropagationStopped();j({requestedChecked:!h,hasConsumerStoppedPropagation:s}),g(e=>!e),b&&y&&!s&&e.stopPropagation()})})},"SwitchTrigger")),b=a.forwardRef(u(function(e,s){let{__scopeSwitch:i,name:t,checked:a,defaultChecked:r,required:l,disabled:o,value:c,onCheckedChange:d,form:m,...p}=e;return(0,n.jsx)(j,{__scopeSwitch:i,checked:a,defaultChecked:r,disabled:o,required:l,onCheckedChange:d,name:t,form:m,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(y,{...p,ref:s,__scopeSwitch:i}),e&&(0,n.jsx)(k,{__scopeSwitch:i})]})})},"Switch")),N=a.forwardRef(u(function(e,s){let{__scopeSwitch:i,...t}=e,a=v("SwitchThumb",i);return(0,n.jsx)(m.V.span,{"data-state":C(a.checked),"data-disabled":a.disabled?"":void 0,...t,ref:s})},"SwitchThumb")),k=a.forwardRef(u(function({__scopeSwitch:e,onClick:s,...i},t){let{control:o,userClick:c,checked:p,defaultChecked:u,required:h,disabled:x,name:f,value:g,form:j,bubbleInput:y,setBubbleInput:b}=v("SwitchBubbleInput",e),N=(0,l.f)(t,b),k=(0,d.f)(o),w=a.useRef(!1),C=a.useRef(p),S=a.useRef(c),U=a.useRef(null);a.useEffect(()=>{if(!y)return;let e=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(!e)return;let s=C.current!==p;C.current=p;let i=null!==c&&c!==S.current;if(S.current=c,i)U.current=s?null:c,s&&e.call(y,p),y.dispatchEvent(new Event("click",{bubbles:!c.hasConsumerStoppedPropagation}));else if(s){let s=U.current;U.current=null;let i=s?.requestedChecked===p;w.current=!0,e.call(y,p),y.dispatchEvent(new Event("click",{bubbles:!(i&&s.hasConsumerStoppedPropagation)})),w.current=!1}},[y,p,c]);let K=a.useRef(p);return(0,n.jsx)(m.V.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??K.current,required:h,disabled:x,name:f,value:g,form:j,...i,tabIndex:-1,ref:N,onClick:(0,r.f)(s,e=>{w.current&&e.stopPropagation()}),style:{...i.style,...k,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function w(e){return"function"==typeof e}function C(e){return e?"checked":"unchecked"}u(w,"isFunction"),u(C,"getState");var S=e.i(975157);let U=a.forwardRef(({className:e,...s},i)=>(0,n.jsx)(b,{className:(0,S.f)("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...s,ref:i,children:(0,n.jsx)(N,{className:(0,S.f)("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));U.displayName=b.displayName,e.s(["f",0,U],699375)},713452,551757,753817,128093,e=>{var s=e.i(843476),i=e.i(271645),t=e.i(456420);let n={name:"circle-check",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 9-5.5 5.5L8 12",key:"xofnsj"}]],aliases:["check-circle-2"]};n.node;let a=(0,t.f)(n);e.s(["f",0,a],551757);var r=e.i(632781),l=e.i(583967);let o={name:"zap",size:24,node:[["path",{d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z",key:"1v7up4"}]]};o.node;let c=(0,t.f)(o);var d=e.i(519455),m=e.i(111110);function p({detail:e}){let{t:i}=(0,m.b)();return e?(0,s.jsxs)("p",{className:"mt-1 rounded bg-background/60 px-2 py-1 font-mono text-[11px] leading-relaxed text-red-700 dark:text-red-300 break-all select-text",children:[(0,s.jsx)("span",{className:"font-sans text-muted-foreground",children:i.settings.ai.providerErrorDetail}),e]}):null}e.s(["f",0,p],753817);let u={minimax:{name:"MiniMax",nameEn:"MiniMax",baseUrl:"https://api.minimax.cn/v1",model:"MiniMax-M3.1-Flash",envPrefix:"MINIMAX",consoleUrl:"https://platform.minimax.cn",docs:{cn:"https://platform.minimax.cn/docs/api-reference/api-overview",intl:"https://platform.minimax.io/docs/api-reference/api-overview",apiKey:"https://platform.minimax.cn/docs/guides/quickstart-preparation",models:"https://platform.minimax.cn/docs/guides/models-intro"}},glm:{name:"智谱 GLM",nameEn:"Zhipu GLM",baseUrl:"https://open.bigmodel.cn/api/paas/v4",model:"glm-5.3-flash",envPrefix:"GLM",consoleUrl:"https://open.bigmodel.cn",docs:{cn:"https://docs.bigmodel.cn/cn/guide/start/quick-start",intl:"https://docs.z.ai/guides/overview/quick-start",apiKey:"https://docs.bigmodel.cn/cn/guide/start/quick-start",models:"https://docs.bigmodel.cn/cn/guide/start/model-overview"}},deepseek:{name:"DeepSeek",nameEn:"DeepSeek",baseUrl:"https://api.deepseek.com",model:"deepseek-v4-flash",envPrefix:"DEEPSEEK",consoleUrl:"https://platform.deepseek.com",docs:{cn:"https://api-docs.deepseek.com/zh-cn/",apiKey:"https://api-docs.deepseek.com/zh-cn/",models:"https://api-docs.deepseek.com/zh-cn/quick_start/pricing"}},kimi:{name:"Kimi",nameEn:"Kimi",baseUrl:"https://api.moonshot.cn/v1",model:"kimi-k3.1-pro",envPrefix:"KIMI",consoleUrl:"https://platform.kimi.com",docs:{cn:"https://platform.moonshot.cn/docs/introduction",intl:"https://platform.moonshot.ai/docs/introduction",apiKey:"https://platform.moonshot.cn/docs/introduction",models:"https://platform.moonshot.cn/docs/pricing/chat"}},qwen:{name:"千问 Qwen",nameEn:"Qwen",baseUrl:"https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",model:"qwen3.8-max",envPrefix:"QWEN",consoleUrl:"https://bailian.console.aliyun.com",docs:{cn:"https://help.aliyun.com/zh/model-studio/token-plan-personal-quick-start",intl:"https://www.alibabacloud.com/help/en/model-studio/token-plan-personal-quick-start",apiKey:"https://help.aliyun.com/zh/model-studio/token-plan-personal-quick-start",models:"https://help.aliyun.com/zh/model-studio/models"}},stepfun:{name:"阶跃星辰 StepFun",nameEn:"StepFun",baseUrl:"https://api.stepfun.com/step_plan/v1",model:"step-5-preview",envPrefix:"STEPFUN",consoleUrl:"https://platform.stepfun.com",docs:{cn:"https://platform.stepfun.com/docs/zh/guides/developer/openai",intl:"https://platform.stepfun.ai/docs/en/guides/developer/openai",apiKey:"https://platform.stepfun.com/docs/zh/guides/developer/openai",models:"https://platform.stepfun.com/docs/zh/guides/models/list"}},volcengine:{name:"火山引擎 豆包",nameEn:"Volcengine Doubao",baseUrl:"https://ark.cn-beijing.volces.com/api/v3",model:"doubao-seed-evolving",envPrefix:"VOLCENGINE",consoleUrl:"https://console.volcengine.com/ark",docs:{cn:"https://www.volcengine.com/docs/82379/1330626",intl:"https://docs.byteplus.com/en/docs/ModelArk/1330626",apiKey:"https://www.volcengine.com/docs/82379/1541594",models:"https://www.volcengine.com/docs/82379/1330310"}},"volcengine-agent":{name:"火山引擎 Agent Plan",nameEn:"Volcengine Agent Plan",baseUrl:"https://ark.cn-beijing.volces.com/api/plan/v3",model:"doubao-seed-evolving",envPrefix:"VOLCENGINE_AGENT",consoleUrl:"https://console.volcengine.com/ark",docs:{cn:"https://ark.volcengine.com/region:cn-beijing/docs/82379/2160841?lang=zh",apiKey:"https://ark.volcengine.com/region:cn-beijing/docs/82379/2160841?lang=zh",models:"https://www.volcengine.com/docs/82379/2366394"}},"volcengine-coding":{name:"火山引擎 Coding Plan",nameEn:"Volcengine Coding Plan",baseUrl:"https://ark.cn-beijing.volces.com/api/coding/v3",model:"doubao-seed-evolving",envPrefix:"VOLCENGINE_CODING",consoleUrl:"https://console.volcengine.com/ark",docs:{cn:"https://www.volcengine.com/docs/82379/1928261",apiKey:"https://www.volcengine.com/docs/82379/1928261",models:"https://www.volcengine.com/docs/82379/1928261"}},"volcengine-free":{name:"火山引擎(免费试用)",nameEn:"Volcengine (free trial)",baseUrl:"https://ark.cn-beijing.volces.com/api/v3",model:"doubao-seed-evolving",envPrefix:"VOLCENGINE_FREE",consoleUrl:"https://console.volcengine.com/ark",docs:{cn:"https://www.volcengine.com/docs/82379/1399514",apiKey:"https://www.volcengine.com/docs/82379/1541594",models:"https://www.volcengine.com/docs/82379/1330310"}}},h=Object.keys(u);function x(e){return"string"==typeof e&&Object.prototype.hasOwnProperty.call(u,e)}e.s(["$",0,u,"U",0,h,"z",0,function(e,s){let i=u[e];return"zh"===s?i.name:i.nameEn},"j",0,x,"k",0,function(e,s){let i=u[e];return{apiKey:s?.apiKey||"",baseUrl:s?.baseUrl||i.baseUrl,model:s?.model||i.model}}],128093);var f=e.i(41931),g=e.i(303163),v=e.i(201276);e.s(["f",0,function({config:e,saving:t,saveButton:n}){let{t:o,language:u}=(0,m.b)(),[h,j]=(0,i.useState)(!1),[y,b]=(0,i.useState)(null),N=e=>o.settings?.ai?.errors?.[e]||e.replace("UNKNOWN:",""),k=async()=>{let s=function(e,s){let i=e.aiProvider;if("openai"===i){let t=e.openai?.instances?.find(s=>s.id===e.openai?.activeInstanceId);return t?.apiKey?{ok:!0,body:{provider:i,apiKey:t.apiKey,baseUrl:t.baseUrl,model:t.model,language:s}}:{ok:!1,error:"API_KEY_REQUIRED"}}if("azure"===i){let t=e.azure;return t?.apiKey&&t.endpoint&&t.deploymentName?{ok:!0,body:{provider:i,apiKey:t.apiKey,endpoint:t.endpoint,deploymentName:t.deploymentName,apiVersion:t.apiVersion,model:t.model,language:s}}:{ok:!1,error:"AZURE_CONFIG_INCOMPLETE"}}if("minimax-code"===i)return{ok:!0,body:{provider:i,model:e.minimaxCode?.model,language:s}};if("gemini"===i||"anthropic"===i||x(i)){let t=e[i];return t?.apiKey?{ok:!0,body:{provider:i,apiKey:t.apiKey,baseUrl:t.baseUrl,model:t.model,language:s}}:{ok:!1,error:"API_KEY_REQUIRED"}}return{ok:!1,error:"UNSUPPORTED_PROVIDER"}}(e,u);if(!s.ok){if("UNSUPPORTED_PROVIDER"===s.error)return;b({success:!1,textSupport:!1,visionSupport:!1,textError:"AZURE_CONFIG_INCOMPLETE"===s.error?o.settings?.ai?.validationAzureEndpointRequired||"Azure config is incomplete":o.settings?.ai?.validationApiKeyRequired||"API Key is required"});return}j(!0),b(null);try{b(await f.f.post("/api/ai/test",s.body))}catch(e){v.V.error("[AiConnectionTest]","AI connection test failed",{error:e}),b({success:!1,textSupport:!1,visionSupport:!1,textError:(0,g.Z)(e)})}finally{j(!1)}};return(0,s.jsxs)("div",{className:"space-y-3 pt-3 border-t",children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)(d.f,{type:"button",variant:"outline",onClick:k,disabled:h||t,className:"flex-1",children:[h?(0,s.jsx)(r.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(c,{className:"mr-2 h-4 w-4"}),h?o.settings?.ai?.testing||"Testing...":o.settings?.ai?.testConnection||"Test Connection"]}),n]}),y&&(0,s.jsxs)("div",{className:`p-3 rounded-md text-sm ${y.success?"bg-green-50 dark:bg-green-950/40 border border-green-200 dark:border-green-900":"bg-red-50 dark:bg-red-950/40 border border-red-200 dark:border-red-900"}`,children:[(0,s.jsx)("div",{className:"flex items-center gap-2 font-medium mb-2",children:y.success?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a,{className:"h-4 w-4 text-green-600"}),(0,s.jsx)("span",{className:"text-green-700 dark:text-green-300",children:o.settings?.ai?.testSuccess||"Connection Successful"}),y.modelInfo&&(0,s.jsxs)("span",{className:"text-green-600 text-xs",children:["(",y.modelInfo,")"]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.f,{className:"h-4 w-4 text-red-600"}),(0,s.jsx)("span",{className:"text-red-700 dark:text-red-300",children:o.settings?.ai?.testFailed||"Connection Failed"})]})}),y.success&&(0,s.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("span",{className:"text-muted-foreground",children:[o.settings?.ai?.textSupport||"Text Generation",":"]}),(0,s.jsxs)("span",{className:"text-green-600",children:["✓ ",o.settings?.ai?.supported||"Supported"]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("span",{className:"text-muted-foreground",children:[o.settings?.ai?.visionSupport||"Vision/Multimodal",":"]}),y.visionSupport?(0,s.jsxs)("span",{className:"text-green-600",children:["✓ ",o.settings?.ai?.supported||"Supported"]}):(0,s.jsxs)("span",{className:"text-amber-600",children:["✗ ",y.visionError?N(y.visionError):o.settings?.ai?.notSupported||"Not Supported"]})]}),!y.visionSupport&&(0,s.jsx)(p,{detail:y.visionErrorDetail}),(0,s.jsx)("p",{className:"text-muted-foreground/60 text-[10px] pl-1",children:o.settings?.ai?.testNetworkNote})]}),!y.success&&y.textError&&(0,s.jsx)("p",{className:"text-red-600 text-xs mt-1",children:N(y.textError)}),!y.success&&(0,s.jsx)(p,{detail:y.textErrorDetail})]})]})}],713452)},10038,835467,e=>{var s=e.i(843476),i=e.i(632781),t=e.i(519455),n=e.i(110204),a=e.i(967489),r=e.i(713452),l=e.i(459649),o=e.i(118585),c=e.i(75977),d=e.i(482022),m=e.i(97923),p=e.i(367784),u=e.i(741120),h=e.i(487486),x=e.i(793479),f=e.i(975153),g=e.i(699375),v=e.i(111110),j=e.i(215519),y=e.i(306831);function b({checkin:e,autoCheckin:a,onAutoCheckinChange:r,busy:l,onCheckin:o}){let c,{t:d}=(0,v.b)(),{timeZone:m}=(0,j.M)(),p=d.settings?.ai?.minimaxCode,{today:u,last:x}=e,N=x&&"failed"!==x.status?x:null,k=!!(u?.checkedToday||N),w=String(N?.points??(u?u.points+u.bonusPoints:0)),C=String(N?.streakDays??u?.streakDays??0);return c=N?.trigger==="auto"&&"checked-in"===N.status?(p?.checkinAuto||"Checked in automatically today at {time} (+{points} credits, day {days} in a row)").replace("{time}",(0,y.r)(N.at,"HH:mm",m)).replace("{points}",w).replace("{days}",C):k?(p?.checkinDone||"Checked in today (+{points} credits, day {days} in a row)").replace("{points}",w).replace("{days}",C):x?.status==="failed"?(p?.checkinFailed||"Check-in failed: {error}").replace("{error}",x.error||""):e.autoCheckin?p?.checkinWillAuto||"Not checked in yet today. The app will check in automatically within the hour.":p?.checkinNotYet||"Not checked in yet today",(0,s.jsxs)("div",{className:"space-y-3 border-t pt-3",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 text-sm",children:[(0,s.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,s.jsx)("span",{className:"text-muted-foreground",children:p?.checkinToday||"Today's check-in"}),(0,s.jsxs)(h.f,{variant:k?"default":x?.status==="failed"?"destructive":"secondary",children:[(0,s.jsx)(f.f,{className:"mr-1 h-3 w-3"}),k?p?.checkinSuccess||"Checked in":p?.checkinNotYet||"Not yet"]})]}),!k&&(0,s.jsxs)(t.f,{size:"sm",variant:"outline",onClick:o,disabled:l,children:[l&&(0,s.jsx)(i.f,{className:"mr-2 h-4 w-4 animate-spin"}),p?.checkinNow||"Check in now"]})]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground break-words",children:c}),(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)(n.f,{htmlFor:"minimax-code-auto-checkin",children:p?.autoCheckin||"Daily auto check-in"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:p?.autoCheckinHint})]}),(0,s.jsx)(g.f,{id:"minimax-code-auto-checkin",checked:a,onCheckedChange:r})]})]})}let N=["MiniMax-M3.1-Flash","MiniMax-M3","MiniMax-M2.7-highspeed","MiniMax-M2.7"];var k=e.i(271645),w=e.i(41931),C=e.i(303163),S=e.i(294114),U=e.i(201276);function K({value:e,onChange:a}){let{t:r}=(0,v.b)(),l=r.settings?.ai?.minimaxCode,{status:o,loading:c,pending:f,busy:g,refresh:j,login:y,logout:P,checkin:E}=function(){let{t:e}=(0,v.b)(),s=e.settings?.ai?.minimaxCode,[i,t]=(0,k.useState)(null),[n,a]=(0,k.useState)(!0),[r,l]=(0,k.useState)(null),[o,c]=(0,k.useState)(!1),d=(0,k.useRef)(null),m=(0,k.useCallback)(async()=>{a(!0);try{let e=await w.f.get("/api/minimax-code");t(e),e.pendingLogin&&l(e.pendingLogin)}catch(e){U.V.error("[MiniMaxCode]","Failed to load status",{error:e})}finally{a(!1)}},[]);(0,k.useEffect)(()=>{m()},[m]),(0,k.useEffect)(()=>{if(!r)return;let e=!1,i=async()=>{try{let t=await w.f.get("/api/minimax-code/login");if(e)return;if("pending"===t.status){d.current=setTimeout(i,r.intervalMs);return}l(null),"ok"===t.status?S.c.success(s?.loginSuccess||"Signed in"):"expired"===t.status?S.c.error(s?.loginExpired||"Authorization timed out"):"denied"===t.status&&S.c.error(s?.loginDenied||"Authorization declined"),m()}catch(i){if(e)return;l(null),S.c.error(`${s?.loginFailed||"Sign-in failed"}: ${(0,C.Z)(i)}`)}};return d.current=setTimeout(i,r.intervalMs),()=>{e=!0,d.current&&clearTimeout(d.current)}},[r,m,s]);let p=async()=>{c(!0);try{await w.f.delete("/api/minimax-code"),l(null),await m()}catch(e){S.c.error((0,C.Z)(e))}finally{c(!1)}},u=async()=>{c(!0);try{let e=await w.f.post("/api/minimax-code/checkin",{});"failed"===e.status?S.c.error((s?.checkinFailed||"Check-in failed: {error}").replace("{error}",e.error||"")):S.c.success(s?.checkinSuccess||"Checked in"),await m()}catch(e){S.c.error((0,C.Z)(e))}finally{c(!1)}};return{status:i,loading:n,pending:r,busy:o,refresh:m,login:async()=>{c(!0);try{let e=await w.f.post("/api/minimax-code/login",{});l(e),window.open(e.url,"_blank","noopener,noreferrer")}catch(e){S.c.error(`${s?.loginFailed||"Sign-in failed"}: ${(0,C.Z)(e)}`)}finally{c(!1)}},logout:p,checkin:u}}(),M=o?.login??"none",I=o?.account,z=o?.credits,A={none:l?.statusNone||"Not signed in",active:l?.statusActive||"Signed in",expired:l?.statusExpired||"Login expired"}[M];return(0,s.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:l?.intro}),(0,s.jsxs)("section",{className:"space-y-3 rounded-md border bg-background p-3","aria-label":l?.title||"MiniMax Code account",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)("h4",{className:"text-sm font-medium",children:l?.title||"MiniMax Code account"}),(0,s.jsx)(t.f,{variant:"ghost",size:"sm",onClick:()=>void j(),disabled:c,"aria-label":l?.refresh||"Refresh",children:(0,s.jsx)(u.f,{className:`h-4 w-4 ${c?"animate-spin":""}`})})]}),(0,s.jsxs)("dl",{className:"grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 text-sm",children:[(0,s.jsx)("dt",{className:"text-muted-foreground",children:l?.loginStatus||"Login status"}),(0,s.jsxs)("dd",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,s.jsx)(h.f,{variant:"active"===M?"default":"expired"===M?"destructive":"secondary",children:A}),I&&(0,s.jsx)("span",{className:"truncate text-muted-foreground",children:I.name||I.email||I.userId})]}),"active"===M&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("dt",{className:"text-muted-foreground",children:l?.credits||"Remaining credits"}),(0,s.jsx)("dd",{children:z?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"font-medium tabular-nums",children:z.total}),(0,s.jsx)("span",{className:"ml-2 text-xs text-muted-foreground",children:(l?.creditsDetail||"Free {free} · Purchased {purchased}").replace("{free}",String(z.free)).replace("{purchased}",String(z.purchased))})]}):(0,s.jsx)("span",{className:"text-muted-foreground",children:l?.creditsUnavailable||"Unavailable"})})]})]}),"active"===M&&o&&(0,s.jsx)(b,{checkin:o.checkin,autoCheckin:e?.autoCheckin!==!1,onAutoCheckinChange:s=>a({...e,autoCheckin:s}),busy:g,onCheckin:()=>void E()}),f?(0,s.jsxs)("div",{className:"space-y-1 rounded-md bg-muted/50 p-3 text-sm",children:[(0,s.jsxs)("p",{className:"flex items-center gap-2",children:[(0,s.jsx)(i.f,{className:"h-4 w-4 animate-spin"}),l?.waiting]}),f.userCode&&(0,s.jsxs)("p",{children:[l?.userCode||"Verification code",": ",(0,s.jsx)("span",{className:"font-mono font-medium",children:f.userCode})]}),(0,s.jsxs)("a",{href:f.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 underline",children:[l?.openLink||"Open the authorization page"," ",(0,s.jsx)(d.f,{className:"h-3 w-3"})]})]}):(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsxs)(t.f,{size:"sm",onClick:()=>void y(),disabled:g,children:[g?(0,s.jsx)(i.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(m.f,{className:"mr-2 h-4 w-4"}),"none"===M?l?.login||"Sign in with browser":l?.relogin||"Sign in again"]}),"none"!==M&&(0,s.jsxs)(t.f,{size:"sm",variant:"outline",onClick:()=>void P(),disabled:g,children:[(0,s.jsx)(p.f,{className:"mr-2 h-4 w-4"}),l?.logout||"Sign out"]})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{htmlFor:"minimax-code-model",children:l?.model||"Model"}),(0,s.jsx)(x.f,{id:"minimax-code-model",list:"minimax-code-models",value:e?.model||"",onChange:s=>a({...e,model:s.target.value}),placeholder:"MiniMax-M3.1-Flash"}),(0,s.jsx)("datalist",{id:"minimax-code-models",children:N.map(e=>(0,s.jsx)("option",{value:e},e))}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:l?.modelHint})]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:l?.risk})]})}var P=e.i(77071),E=e.i(759659),M=e.i(464034),I=e.i(434901),z=e.i(37038),A=e.i(62189);function R({value:e,onChange:i}){let{t:r}=(0,v.b)(),l=(0,A.f)("openai"),o=e?.instances||[],c=e?.activeInstanceId,d=o.find(e=>e.id===c),m=(s,t)=>{i({...e,instances:o.map(e=>e.id===c?{...e,[s]:t}:e)})},p=async()=>{if(!c||!await (0,S.u)(r.settings?.ai?.confirmDelete||"Delete this instance?",{destructive:!0}))return;let e=o.filter(e=>e.id!==c);i({instances:e,activeInstanceId:e[0]?.id})};return(0,s.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)(n.f,{children:r.settings?.ai?.instances||"Instance"}),(0,s.jsxs)(t.f,{type:"button",variant:"outline",size:"sm",onClick:()=>{if(o.length>=10)return;let e={id:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let s=16*Math.random()|0;return("x"===e?s:3&s|8).toString(16)}),name:`Instance ${o.length+1}`,apiKey:"",baseUrl:"https://api.openai.com/v1",model:"gpt-6.1-sol"};i({instances:[...o,e],activeInstanceId:e.id})},disabled:o.length>=10,className:"h-7 px-2 text-xs",children:[(0,s.jsx)(P.f,{className:"h-3 w-3 mr-1"}),r.settings?.ai?.addInstance||"Add"]})]}),o.length>0?(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)(a.d,{value:c||"",onValueChange:s=>i({...e,activeInstanceId:s}),children:[(0,s.jsx)(a.P,{className:"flex-1",children:(0,s.jsx)(a.U,{placeholder:r.settings?.ai?.selectInstance||"Select Instance"})}),(0,s.jsx)(a.r,{children:o.map(e=>(0,s.jsx)(a.T,{value:e.id,children:e.name},e.id))})]}),o.length>1&&(0,s.jsx)(t.f,{type:"button",variant:"outline",size:"icon",onClick:p,className:"h-10 w-10 text-destructive hover:text-destructive",children:(0,s.jsx)(E.f,{className:"h-4 w-4"})})]}):(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:r.settings?.ai?.noInstances||"No instances configured. Click 'Add' to create one."}),o.length>=10&&(0,s.jsx)("p",{className:"text-xs text-amber-600",children:r.settings?.ai?.maxInstancesReached||"Maximum instances reached (10)"})]}),d&&(0,s.jsxs)("div",{className:"space-y-3 p-3 border rounded-md bg-background",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(n.f,{children:[r.settings?.ai?.instanceName||"Instance Name"," ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsx)(x.f,{value:d.name||"",onChange:e=>m("name",e.target.value),placeholder:"e.g. GLM-4V",className:d.name?.trim()?"":"border-destructive"})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I.f,{label:(0,s.jsxs)(s.Fragment,{children:["API Key ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),href:l?.apiKey,linkText:r.settings.ai.docLinks.apiKey}),(0,s.jsx)(z.f,{value:d.apiKey||"",onChange:e=>m("apiKey",e.target.value),placeholder:"sk-...",className:d.apiKey?.trim()?"":"border-destructive"})]}),(0,s.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,s.jsxs)(n.f,{children:["Base URL ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsx)(x.f,{value:d.baseUrl||"",onChange:e=>m("baseUrl",e.target.value),placeholder:"https://api.openai.com/v1",className:d.baseUrl?.trim()?"":"border-destructive"})]}),(0,s.jsx)(M.f,{provider:"openai",apiKey:d.apiKey,baseUrl:d.baseUrl,currentModel:d.model,onModelChange:e=>m("model",e),docsHref:l?.models})]})]})}function T({provider:e}){let{t:i}=(0,v.b)(),t=i.settings.ai.providerDocs,n=(0,A.f)(e);if(!n)return null;let a=[n.cn&&{href:n.cn,label:n.intl?t.cn:t.official},n.intl&&{href:n.intl,label:n.cn?t.intl:t.official}].filter(e=>!!e);return(0,s.jsxs)("p",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[(0,s.jsx)("span",{children:t.title}),a.map(e=>(0,s.jsxs)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 underline",children:[e.label,(0,s.jsx)(d.f,{className:"h-3 w-3"})]},e.href))]})}var F=e.i(128093);function L({provider:e,value:i,onChange:t}){let{t:a}=(0,v.b)(),r=F.$[e],l=(e,s)=>t({...i,[e]:s}),o={qwen:a.settings?.ai?.qwenBaseUrlHint,stepfun:a.settings?.ai?.stepfunBaseUrlHint,volcengine:a.settings?.ai?.volcengineBaseUrlHint,"volcengine-agent":a.settings?.ai?.volcengineAgentBaseUrlHint,"volcengine-coding":a.settings?.ai?.volcengineCodingBaseUrlHint};return(0,s.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:["volcengine-free"===e&&(0,s.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:[(0,s.jsx)("p",{className:"font-medium",children:a.settings.ai.volcengineFree.title}),(0,s.jsx)("p",{className:"mt-1",children:a.settings.ai.volcengineFree.body})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I.f,{label:"API Key",href:r.docs.apiKey,linkText:a.settings.ai.docLinks.apiKey}),(0,s.jsx)(z.f,{value:i?.apiKey||"",onChange:e=>l("apiKey",e.target.value),placeholder:"sk-..."}),(0,s.jsxs)("p",{className:"text-xs text-muted-foreground",children:[a.settings?.ai?.vendorApiKeyHint||"Get an API key from the console:"," ",(0,s.jsx)("a",{href:r.consoleUrl,target:"_blank",rel:"noopener noreferrer",className:"underline break-all",children:r.consoleUrl})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{children:"Base URL (Optional)"}),(0,s.jsx)(x.f,{value:i?.baseUrl||"",onChange:e=>l("baseUrl",e.target.value),placeholder:r.baseUrl}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:o[e]??a.settings?.ai?.vendorBaseUrlHint})]}),(0,s.jsx)(M.f,{provider:e,apiKey:i?.apiKey,baseUrl:i?.baseUrl,currentModel:i?.model||r.model,onModelChange:e=>l("model",e),docsHref:r.docs.models})]})}e.s(["f",0,function({config:e,setConfig:d,loading:m,saving:p,onSave:u}){let{t:h,language:x}=(0,v.b)();return m?(0,s.jsx)("div",{className:"flex justify-center py-4",children:(0,s.jsx)(i.f,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):(0,s.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{children:h.settings?.tabs?.ai||"AI Provider"}),(0,s.jsxs)(a.d,{value:e.aiProvider,onValueChange:e=>d(s=>({...s,aiProvider:e})),children:[(0,s.jsx)(a.P,{children:(0,s.jsx)(a.U,{})}),(0,s.jsxs)(a.r,{children:[(0,s.jsx)(a.T,{value:"minimax",children:(0,F.z)("minimax",x)}),(0,s.jsx)(a.T,{value:"minimax-code",children:"MiniMax Code OAuth"}),F.U.filter(e=>"minimax"!==e).map(e=>(0,s.jsx)(a.T,{value:e,children:(0,F.z)(e,x)},e)),(0,s.jsx)(a.T,{value:"anthropic",children:"Anthropic / Compatible"}),(0,s.jsx)(a.T,{value:"azure",children:"Azure OpenAI"}),(0,s.jsx)(a.T,{value:"openai",children:"OpenAI / Compatible"}),(0,s.jsx)(a.T,{value:"gemini",children:"Google Gemini"})]})]}),(0,s.jsx)(T,{provider:e.aiProvider})]}),"openai"===e.aiProvider&&(0,s.jsx)(R,{value:e.openai,onChange:e=>d(s=>({...s,openai:e}))}),"gemini"===e.aiProvider&&(0,s.jsx)(c.f,{value:e.gemini,onChange:e=>d(s=>({...s,gemini:e}))}),"minimax-code"===e.aiProvider&&(0,s.jsx)(K,{value:e.minimaxCode,onChange:e=>d(s=>({...s,minimaxCode:e}))}),"anthropic"===e.aiProvider&&(0,s.jsx)(l.f,{value:e.anthropic,onChange:e=>d(s=>({...s,anthropic:e}))}),(0,F.j)(e.aiProvider)&&(0,s.jsx)(L,{provider:e.aiProvider,value:e[e.aiProvider],onChange:e=>d(s=>({...s,[s.aiProvider]:e}))},e.aiProvider),"azure"===e.aiProvider&&(0,s.jsx)(o.f,{value:e.azure,onChange:e=>d(s=>({...s,azure:e}))}),(0,s.jsx)(r.f,{config:e,saving:p,saveButton:(0,s.jsxs)(t.f,{onClick:u,disabled:p,className:"flex-1",children:[p&&(0,s.jsx)(i.f,{className:"mr-2 h-4 w-4 animate-spin"}),h.settings?.ai?.save||"Save AI Settings"]})})]})}],10038),e.s(["f",0,function(e,s){if(!(0,y.L)(e.timeZone??y.J))return s.settings.general.invalidTimeZone;if("openai"===e.aiProvider)for(let i of e.openai?.instances||[]){if(!i.name?.trim())return s.settings?.ai?.validationNameRequired||"Instance name is required";if(!i.apiKey?.trim())return s.settings?.ai?.validationApiKeyRequired||"API Key is required";if(!i.baseUrl?.trim())return s.settings?.ai?.validationBaseUrlRequired||"Base URL is required";if(!i.model?.trim())return s.settings?.ai?.validationModelRequired||"Model name is required"}if("azure"===e.aiProvider){if(!e.azure?.endpoint?.trim())return s.settings?.ai?.validationAzureEndpointRequired||"Azure Endpoint is required";if(!e.azure?.deploymentName?.trim())return s.settings?.ai?.validationAzureDeploymentRequired||"Deployment Name is required";if(!e.azure?.apiKey?.trim())return s.settings?.ai?.validationApiKeyRequired||"API Key is required"}return null}],835467)},459649,464034,434901,62189,118585,75977,97923,e=>{var s=e.i(843476),i=e.i(793479),t=e.i(37038),n=e.i(110204),a=e.i(271645),r=e.i(519455),l=e.i(967489),o=e.i(482022),c=e.i(741120),d=e.i(632781),m=e.i(41931),p=e.i(111110),u=e.i(128093),h=e.i(201276);function x({provider:e,apiKey:t,baseUrl:f,currentModel:g,onModelChange:v,docsHref:j}){let{t:y}=(0,p.b)(),[b,N]=(0,a.useState)([]),[k,w]=(0,a.useState)(!1),[C,S]=(0,a.useState)(null),[U,K]=(0,a.useState)(g||""),[P,E]=(0,a.useState)(!1),[M,I]=(0,a.useState)(g);g!==M&&(I(g),K(g||""));let z=async()=>{if(!t)return void S(y.modelSelector?.enterApiKeyFirst||"Please enter API Key first");w(!0),S(null);try{let s=await m.f.post("/api/ai/models",{provider:e,apiKey:t,...f&&{baseUrl:f}});if("error"in s&&"string"==typeof s.error){S(s.error),E(!0),N([]);return}N(s.models),0===s.models.length&&(S(y.modelSelector?.noVisionModel||"No vision model found, please enter manually"),E(!0))}catch(s){h.V.error("[ModelSelector]","Failed to fetch models",{error:s});let e=s instanceof Error&&s.message||y.modelSelector?.fetchFailed||"Failed to fetch models";S(e+(y.modelSelector?.enterManually||", please enter manually")),E(!0)}finally{w(!1)}};return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(n.f,{className:"flex-1",children:y.modelSelector?.modelName||"Model Name"}),j&&(0,s.jsxs)("a",{href:j,target:"_blank",rel:"noopener noreferrer",className:"inline-flex shrink-0 items-center gap-1 text-xs text-muted-foreground underline",children:[y.settings.ai.docLinks.models,(0,s.jsx)(o.f,{className:"h-3 w-3"})]}),(0,s.jsx)(r.f,{type:"button",variant:"outline",size:"sm",onClick:z,disabled:k||!t,children:k?(0,s.jsx)(d.f,{className:"h-3 w-3 animate-spin"}):(0,s.jsx)(c.f,{className:"h-3 w-3"})})]}),C&&(0,s.jsx)("p",{className:"text-xs text-yellow-600",children:C}),P||0===b.length?(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(i.f,{value:U,onChange:e=>{var s;K(s=e.target.value),v(s)},placeholder:(0,u.j)(e)?u.$[e].model:"openai"===e?"gpt-6.1-sol":"gemini-1.5-flash"}),b.length>0&&(0,s.jsx)(r.f,{type:"button",variant:"link",size:"sm",className:"h-auto p-0 text-xs",onClick:()=>E(!1),children:y.modelSelector?.selectFromList||"Select from List"})]}):(0,s.jsx)("div",{className:"space-y-2",children:(0,s.jsxs)(l.d,{value:g,onValueChange:e=>{"_custom"===e?E(!0):(E(!1),K(e),v(e))},children:[(0,s.jsx)(l.P,{children:(0,s.jsx)(l.U,{placeholder:y.modelSelector?.selectModel||"Select Model"})}),(0,s.jsxs)(l.r,{children:[b.map(e=>(0,s.jsxs)(l.T,{value:e.id,children:[e.name,e.owned_by&&` (${e.owned_by})`]},e.id)),(0,s.jsx)(l.T,{value:"_custom",children:y.modelSelector?.customInput||"Custom Input..."})]})]})})]})}function f({label:e,href:i,linkText:t}){return i?(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)(n.f,{children:e}),(0,s.jsxs)("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"inline-flex shrink-0 items-center gap-1 text-xs text-muted-foreground underline",children:[t,(0,s.jsx)(o.f,{className:"h-3 w-3"})]})]}):(0,s.jsx)(n.f,{children:e})}e.s(["f",0,x],464034),e.s(["f",0,f],434901);let g={openai:{intl:"https://platform.openai.com/docs/api-reference",apiKey:"https://platform.openai.com/docs/quickstart",models:"https://platform.openai.com/docs/models"},anthropic:{intl:"https://docs.anthropic.com/en/api/overview",apiKey:"https://docs.anthropic.com/en/api/getting-started",models:"https://docs.anthropic.com/en/docs/about-claude/models/overview"},azure:{intl:"https://learn.microsoft.com/azure/ai-foundry/openai/reference",apiKey:"https://learn.microsoft.com/azure/ai-foundry/openai/how-to/create-resource",models:"https://learn.microsoft.com/azure/ai-foundry/openai/concepts/models"},gemini:{intl:"https://ai.google.dev/gemini-api/docs",apiKey:"https://ai.google.dev/gemini-api/docs/api-key",models:"https://ai.google.dev/gemini-api/docs/models"}};function v(e){return(0,u.j)(e)?u.$[e].docs:g[e]??null}e.s(["f",0,v],62189),e.s(["f",0,function({value:e,onChange:a}){let{t:r}=(0,p.b)(),l=v("anthropic"),o=(s,i)=>a({...e,[s]:i});return(0,s.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(f,{label:"API Key",href:l?.apiKey,linkText:r.settings.ai.docLinks.apiKey}),(0,s.jsx)(t.f,{value:e?.apiKey||"",onChange:e=>o("apiKey",e.target.value),placeholder:"sk-ant-..."})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{children:"Base URL (Optional)"}),(0,s.jsx)(i.f,{value:e?.baseUrl||"",onChange:e=>o("baseUrl",e.target.value),placeholder:"https://api.anthropic.com"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:r.settings?.ai?.anthropicBaseUrlHint})]}),(0,s.jsx)(x,{provider:"anthropic",apiKey:e?.apiKey,baseUrl:e?.baseUrl,currentModel:e?.model,onModelChange:e=>o("model",e),docsHref:l?.models})]})}],459649),e.s(["f",0,function({value:e,onChange:a}){let{t:r}=(0,p.b)(),l=v("azure"),o=(s,i)=>a({...e,[s]:i}),c=e=>e?.trim()?"":"border-destructive";return(0,s.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(n.f,{children:[r.settings?.ai?.azureEndpoint||"Azure Endpoint"," ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsx)(i.f,{value:e?.endpoint||"",onChange:e=>o("endpoint",e.target.value),placeholder:r.settings?.ai?.azureEndpointPlaceholder||"https://your-resource.openai.azure.com",className:c(e?.endpoint)})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(f,{label:(0,s.jsxs)(s.Fragment,{children:[r.settings?.ai?.azureDeployment||"Deployment Name"," ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),href:l?.models,linkText:r.settings.ai.docLinks.models}),(0,s.jsx)(i.f,{value:e?.deploymentName||"",onChange:e=>o("deploymentName",e.target.value),placeholder:r.settings?.ai?.azureDeploymentPlaceholder||"gpt-4o-deployment",className:c(e?.deploymentName)})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(f,{label:(0,s.jsxs)(s.Fragment,{children:["API Key ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),href:l?.apiKey,linkText:r.settings.ai.docLinks.apiKey}),(0,s.jsx)(t.f,{value:e?.apiKey||"",onChange:e=>o("apiKey",e.target.value),placeholder:"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",className:c(e?.apiKey)})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{children:r.settings?.ai?.azureApiVersion||"API Version"}),(0,s.jsx)(i.f,{value:e?.apiVersion||"",onChange:e=>o("apiVersion",e.target.value),placeholder:r.settings?.ai?.azureApiVersionPlaceholder||"2024-02-15-preview"})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{children:r.settings?.ai?.azureModel||"Model Display Name"}),(0,s.jsx)(i.f,{value:e?.model||"",onChange:e=>o("model",e.target.value),placeholder:"gpt-4o"})]})]})}],118585),e.s(["f",0,function({value:e,onChange:a}){let{t:r}=(0,p.b)(),l=v("gemini"),o=(s,i)=>a({...e,[s]:i});return(0,s.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(f,{label:"API Key",href:l?.apiKey,linkText:r.settings.ai.docLinks.apiKey}),(0,s.jsx)(t.f,{value:e?.apiKey||"",onChange:e=>o("apiKey",e.target.value),placeholder:"AIza..."})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{children:"Base URL (Optional)"}),(0,s.jsx)(i.f,{value:e?.baseUrl||"",onChange:e=>o("baseUrl",e.target.value),placeholder:"https://generativelanguage.googleapis.com"})]}),(0,s.jsx)(x,{provider:"gemini",apiKey:e?.apiKey,baseUrl:e?.baseUrl,currentModel:e?.model,onModelChange:e=>o("model",e),docsHref:l?.models})]})}],75977);var j=e.i(456420);let y={name:"log-in",size:24,node:[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]]};y.node;let b=(0,j.f)(y);e.s(["f",0,b],97923)},37038,e=>{var s=e.i(843476),i=e.i(271645),t=e.i(772382),n=e.i(580860),a=e.i(519455),r=e.i(793479),l=e.i(111110),o=e.i(975157);e.s(["f",0,function({className:e,...c}){let{t:d}=(0,l.b)(),[m,p]=(0,i.useState)(!1);return(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(r.f,{type:m?"text":"password",className:(0,o.f)("pr-10",e),...c}),(0,s.jsx)(a.f,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>p(!m),"aria-label":m?d.common.hidePassword:d.common.showPassword,tabIndex:-1,children:m?(0,s.jsx)(n.f,{className:"h-4 w-4 text-muted-foreground"}):(0,s.jsx)(t.f,{className:"h-4 w-4 text-muted-foreground"})})]})}])}])})();
|
|
1
|
+
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,367784,699375,e=>{var s=e.i(456420);let i={name:"log-out",size:24,node:[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]};i.node;let t=(0,s.f)(i);e.s(["f",0,t],367784);var n=e.i(843476),a=e.i(271645),r=e.i(981140),l=e.i(820783),o=e.i(30030),c=e.i(369340),d=e.i(635804),m=e.i(248425),p=Object.defineProperty,u=(e,s)=>p(e,"name",{value:s,configurable:!0}),h="Switch",[x,f]=(0,o.f)(h),[g,v]=x(h);function j(e){let{__scopeSwitch:s,checked:i,children:t,defaultChecked:r,disabled:l,form:o,name:d,onCheckedChange:m,required:p,value:u="on",internal_do_not_use_render:x}=e,[f,v]=(0,c.f)({prop:i,defaultProp:r??!1,onChange:m,caller:h}),[j,y]=a.useState(null),[b,N]=a.useState(null),[k,C]=a.useState(null),S=!j||!!o||!!j.closest("form"),U={checked:f,setChecked:v,disabled:l,control:j,setControl:y,name:d,form:o,value:u,userClick:k,onUserClick:C,required:p,defaultChecked:r,isFormControl:S,bubbleInput:b,setBubbleInput:N};return(0,n.jsx)(g,{scope:s,...U,children:w(x)?x(U):t})}u(j,"SwitchProvider");var y=a.forwardRef(u(function({__scopeSwitch:e,onClick:s,...i},t){let{control:o,form:c,value:d,disabled:p,checked:h,required:x,setControl:f,setChecked:g,onUserClick:j,isFormControl:y,bubbleInput:b}=v("SwitchTrigger",e),N=(0,l.f)(t,f),k=a.useRef(h);return a.useEffect(()=>{let e=c?o?.ownerDocument.getElementById(c):o?.form;if(e instanceof HTMLFormElement){let s=u(()=>g(k.current),"reset");return e.addEventListener("reset",s),()=>e.removeEventListener("reset",s)}},[o,c,g]),(0,n.jsx)(m.V.button,{type:"button",role:"switch","aria-checked":h,"aria-required":x,"data-state":C(h),"data-disabled":p?"":void 0,disabled:p,value:d,...i,ref:N,onClick:(0,r.f)(s,e=>{let s=e.isPropagationStopped();j({requestedChecked:!h,hasConsumerStoppedPropagation:s}),g(e=>!e),b&&y&&!s&&e.stopPropagation()})})},"SwitchTrigger")),b=a.forwardRef(u(function(e,s){let{__scopeSwitch:i,name:t,checked:a,defaultChecked:r,required:l,disabled:o,value:c,onCheckedChange:d,form:m,...p}=e;return(0,n.jsx)(j,{__scopeSwitch:i,checked:a,defaultChecked:r,disabled:o,required:l,onCheckedChange:d,name:t,form:m,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(y,{...p,ref:s,__scopeSwitch:i}),e&&(0,n.jsx)(k,{__scopeSwitch:i})]})})},"Switch")),N=a.forwardRef(u(function(e,s){let{__scopeSwitch:i,...t}=e,a=v("SwitchThumb",i);return(0,n.jsx)(m.V.span,{"data-state":C(a.checked),"data-disabled":a.disabled?"":void 0,...t,ref:s})},"SwitchThumb")),k=a.forwardRef(u(function({__scopeSwitch:e,onClick:s,...i},t){let{control:o,userClick:c,checked:p,defaultChecked:u,required:h,disabled:x,name:f,value:g,form:j,bubbleInput:y,setBubbleInput:b}=v("SwitchBubbleInput",e),N=(0,l.f)(t,b),k=(0,d.f)(o),w=a.useRef(!1),C=a.useRef(p),S=a.useRef(c),U=a.useRef(null);a.useEffect(()=>{if(!y)return;let e=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(!e)return;let s=C.current!==p;C.current=p;let i=null!==c&&c!==S.current;if(S.current=c,i)U.current=s?null:c,s&&e.call(y,p),y.dispatchEvent(new Event("click",{bubbles:!c.hasConsumerStoppedPropagation}));else if(s){let s=U.current;U.current=null;let i=s?.requestedChecked===p;w.current=!0,e.call(y,p),y.dispatchEvent(new Event("click",{bubbles:!(i&&s.hasConsumerStoppedPropagation)})),w.current=!1}},[y,p,c]);let K=a.useRef(p);return(0,n.jsx)(m.V.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??K.current,required:h,disabled:x,name:f,value:g,form:j,...i,tabIndex:-1,ref:N,onClick:(0,r.f)(s,e=>{w.current&&e.stopPropagation()}),style:{...i.style,...k,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function w(e){return"function"==typeof e}function C(e){return e?"checked":"unchecked"}u(w,"isFunction"),u(C,"getState");var S=e.i(975157);let U=a.forwardRef(({className:e,...s},i)=>(0,n.jsx)(b,{className:(0,S.f)("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...s,ref:i,children:(0,n.jsx)(N,{className:(0,S.f)("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));U.displayName=b.displayName,e.s(["f",0,U],699375)},713452,551757,753817,128093,e=>{var s=e.i(843476),i=e.i(271645),t=e.i(456420);let n={name:"circle-check",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 9-5.5 5.5L8 12",key:"xofnsj"}]],aliases:["check-circle-2"]};n.node;let a=(0,t.f)(n);e.s(["f",0,a],551757);var r=e.i(632781),l=e.i(583967);let o={name:"zap",size:24,node:[["path",{d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z",key:"1v7up4"}]]};o.node;let c=(0,t.f)(o);var d=e.i(519455),m=e.i(111110);function p({detail:e}){let{t:i}=(0,m.b)();return e?(0,s.jsxs)("p",{className:"mt-1 rounded bg-background/60 px-2 py-1 font-mono text-[11px] leading-relaxed text-red-700 dark:text-red-300 break-all select-text",children:[(0,s.jsx)("span",{className:"font-sans text-muted-foreground",children:i.settings.ai.providerErrorDetail}),e]}):null}e.s(["f",0,p],753817);let u={minimax:{name:"MiniMax",nameEn:"MiniMax",baseUrl:"https://api.minimax.cn/v1",model:"MiniMax-M3.1-Flash",envPrefix:"MINIMAX",consoleUrl:"https://platform.minimax.cn",docs:{cn:"https://platform.minimax.cn/docs/api-reference/api-overview",intl:"https://platform.minimax.io/docs/api-reference/api-overview",apiKey:"https://platform.minimax.cn/docs/guides/quickstart-preparation",models:"https://platform.minimax.cn/docs/guides/models-intro"}},glm:{name:"智谱 GLM",nameEn:"Zhipu GLM",baseUrl:"https://open.bigmodel.cn/api/paas/v4",model:"glm-5.3-flash",envPrefix:"GLM",consoleUrl:"https://open.bigmodel.cn",docs:{cn:"https://docs.bigmodel.cn/cn/guide/start/quick-start",intl:"https://docs.z.ai/guides/overview/quick-start",apiKey:"https://docs.bigmodel.cn/cn/guide/start/quick-start",models:"https://docs.bigmodel.cn/cn/guide/start/model-overview"}},deepseek:{name:"DeepSeek",nameEn:"DeepSeek",baseUrl:"https://api.deepseek.com",model:"deepseek-v4-flash",envPrefix:"DEEPSEEK",consoleUrl:"https://platform.deepseek.com",docs:{cn:"https://api-docs.deepseek.com/zh-cn/",apiKey:"https://api-docs.deepseek.com/zh-cn/",models:"https://api-docs.deepseek.com/zh-cn/quick_start/pricing"}},kimi:{name:"Kimi",nameEn:"Kimi",baseUrl:"https://api.moonshot.cn/v1",model:"kimi-k3.1-pro",envPrefix:"KIMI",consoleUrl:"https://platform.kimi.com",docs:{cn:"https://platform.moonshot.cn/docs/introduction",intl:"https://platform.moonshot.ai/docs/introduction",apiKey:"https://platform.moonshot.cn/docs/introduction",models:"https://platform.moonshot.cn/docs/pricing/chat"}},qwen:{name:"千问 Qwen",nameEn:"Qwen",baseUrl:"https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",model:"qwen3.8-max",envPrefix:"QWEN",consoleUrl:"https://bailian.console.aliyun.com",docs:{cn:"https://help.aliyun.com/zh/model-studio/token-plan-personal-quick-start",intl:"https://www.alibabacloud.com/help/en/model-studio/token-plan-personal-quick-start",apiKey:"https://help.aliyun.com/zh/model-studio/token-plan-personal-quick-start",models:"https://help.aliyun.com/zh/model-studio/models"}},stepfun:{name:"阶跃星辰 StepFun",nameEn:"StepFun",baseUrl:"https://api.stepfun.com/step_plan/v1",model:"step-5-preview",envPrefix:"STEPFUN",consoleUrl:"https://platform.stepfun.com",docs:{cn:"https://platform.stepfun.com/docs/zh/guides/developer/openai",intl:"https://platform.stepfun.ai/docs/en/guides/developer/openai",apiKey:"https://platform.stepfun.com/docs/zh/guides/developer/openai",models:"https://platform.stepfun.com/docs/zh/guides/models/list"}},volcengine:{name:"火山引擎 豆包",nameEn:"Volcengine Doubao",baseUrl:"https://ark.cn-beijing.volces.com/api/v3",model:"doubao-seed-evolving",envPrefix:"VOLCENGINE",consoleUrl:"https://console.volcengine.com/ark",docs:{cn:"https://www.volcengine.com/docs/82379/1330626",intl:"https://docs.byteplus.com/en/docs/ModelArk/1330626",apiKey:"https://www.volcengine.com/docs/82379/1541594",models:"https://www.volcengine.com/docs/82379/1330310"}},"volcengine-agent":{name:"火山引擎 Agent Plan",nameEn:"Volcengine Agent Plan",baseUrl:"https://ark.cn-beijing.volces.com/api/plan/v3",model:"doubao-seed-evolving",envPrefix:"VOLCENGINE_AGENT",consoleUrl:"https://console.volcengine.com/ark",docs:{cn:"https://ark.volcengine.com/region:cn-beijing/docs/82379/2160841?lang=zh",apiKey:"https://ark.volcengine.com/region:cn-beijing/docs/82379/2160841?lang=zh",models:"https://www.volcengine.com/docs/82379/2366394"}},"volcengine-coding":{name:"火山引擎 Coding Plan",nameEn:"Volcengine Coding Plan",baseUrl:"https://ark.cn-beijing.volces.com/api/coding/v3",model:"doubao-seed-evolving",envPrefix:"VOLCENGINE_CODING",consoleUrl:"https://console.volcengine.com/ark",docs:{cn:"https://www.volcengine.com/docs/82379/1928261",apiKey:"https://www.volcengine.com/docs/82379/1928261",models:"https://www.volcengine.com/docs/82379/1928261"}},"volcengine-free":{name:"火山引擎(免费试用)",nameEn:"Volcengine (free trial)",baseUrl:"https://ark.cn-beijing.volces.com/api/v3",model:"doubao-seed-evolving",envPrefix:"VOLCENGINE_FREE",consoleUrl:"https://console.volcengine.com/ark",docs:{cn:"https://www.volcengine.com/docs/82379/1399514",apiKey:"https://www.volcengine.com/docs/82379/1541594",models:"https://www.volcengine.com/docs/82379/1330310"}}},h=Object.keys(u);function x(e){return"string"==typeof e&&Object.prototype.hasOwnProperty.call(u,e)}e.s(["$",0,u,"U",0,h,"z",0,function(e,s){let i=u[e];return"zh"===s?i.name:i.nameEn},"j",0,x,"k",0,function(e,s){let i=u[e];return{apiKey:s?.apiKey||"",baseUrl:s?.baseUrl||i.baseUrl,model:s?.model||i.model}}],128093);var f=e.i(41931),g=e.i(303163),v=e.i(201276);e.s(["f",0,function({config:e,saving:t,saveButton:n}){let{t:o,language:u}=(0,m.b)(),[h,j]=(0,i.useState)(!1),[y,b]=(0,i.useState)(null),N=e=>o.settings?.ai?.errors?.[e]||e.replace("UNKNOWN:",""),k=async()=>{let s=function(e,s){let i=e.aiProvider;if("openai"===i){let t=e.openai?.instances?.find(s=>s.id===e.openai?.activeInstanceId);return t?.apiKey?{ok:!0,body:{provider:i,apiKey:t.apiKey,baseUrl:t.baseUrl,model:t.model,language:s}}:{ok:!1,error:"API_KEY_REQUIRED"}}if("azure"===i){let t=e.azure;return t?.apiKey&&t.endpoint&&t.deploymentName?{ok:!0,body:{provider:i,apiKey:t.apiKey,endpoint:t.endpoint,deploymentName:t.deploymentName,apiVersion:t.apiVersion,model:t.model,language:s}}:{ok:!1,error:"AZURE_CONFIG_INCOMPLETE"}}if("minimax-code"===i)return{ok:!0,body:{provider:i,model:e.minimaxCode?.model,language:s}};if("gemini"===i||"anthropic"===i||x(i)){let t=e[i];return t?.apiKey?{ok:!0,body:{provider:i,apiKey:t.apiKey,baseUrl:t.baseUrl,model:t.model,language:s}}:{ok:!1,error:"API_KEY_REQUIRED"}}return{ok:!1,error:"UNSUPPORTED_PROVIDER"}}(e,u);if(!s.ok){if("UNSUPPORTED_PROVIDER"===s.error)return;b({success:!1,textSupport:!1,visionSupport:!1,textError:"AZURE_CONFIG_INCOMPLETE"===s.error?o.settings?.ai?.validationAzureEndpointRequired||"Azure config is incomplete":o.settings?.ai?.validationApiKeyRequired||"API Key is required"});return}j(!0),b(null);try{b(await f.k.post("/api/ai/test",s.body))}catch(e){v.V.error("[AiConnectionTest]","AI connection test failed",{error:e}),b({success:!1,textSupport:!1,visionSupport:!1,textError:(0,g.Z)(e)})}finally{j(!1)}};return(0,s.jsxs)("div",{className:"space-y-3 pt-3 border-t",children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)(d.f,{type:"button",variant:"outline",onClick:k,disabled:h||t,className:"flex-1",children:[h?(0,s.jsx)(r.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(c,{className:"mr-2 h-4 w-4"}),h?o.settings?.ai?.testing||"Testing...":o.settings?.ai?.testConnection||"Test Connection"]}),n]}),y&&(0,s.jsxs)("div",{className:`p-3 rounded-md text-sm ${y.success?"bg-green-50 dark:bg-green-950/40 border border-green-200 dark:border-green-900":"bg-red-50 dark:bg-red-950/40 border border-red-200 dark:border-red-900"}`,children:[(0,s.jsx)("div",{className:"flex items-center gap-2 font-medium mb-2",children:y.success?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a,{className:"h-4 w-4 text-green-600"}),(0,s.jsx)("span",{className:"text-green-700 dark:text-green-300",children:o.settings?.ai?.testSuccess||"Connection Successful"}),y.modelInfo&&(0,s.jsxs)("span",{className:"text-green-600 text-xs",children:["(",y.modelInfo,")"]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.f,{className:"h-4 w-4 text-red-600"}),(0,s.jsx)("span",{className:"text-red-700 dark:text-red-300",children:o.settings?.ai?.testFailed||"Connection Failed"})]})}),y.success&&(0,s.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("span",{className:"text-muted-foreground",children:[o.settings?.ai?.textSupport||"Text Generation",":"]}),(0,s.jsxs)("span",{className:"text-green-600",children:["✓ ",o.settings?.ai?.supported||"Supported"]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("span",{className:"text-muted-foreground",children:[o.settings?.ai?.visionSupport||"Vision/Multimodal",":"]}),y.visionSupport?(0,s.jsxs)("span",{className:"text-green-600",children:["✓ ",o.settings?.ai?.supported||"Supported"]}):(0,s.jsxs)("span",{className:"text-amber-600",children:["✗ ",y.visionError?N(y.visionError):o.settings?.ai?.notSupported||"Not Supported"]})]}),!y.visionSupport&&(0,s.jsx)(p,{detail:y.visionErrorDetail}),(0,s.jsx)("p",{className:"text-muted-foreground/60 text-[10px] pl-1",children:o.settings?.ai?.testNetworkNote})]}),!y.success&&y.textError&&(0,s.jsx)("p",{className:"text-red-600 text-xs mt-1",children:N(y.textError)}),!y.success&&(0,s.jsx)(p,{detail:y.textErrorDetail})]})]})}],713452)},10038,835467,e=>{var s=e.i(843476),i=e.i(632781),t=e.i(519455),n=e.i(110204),a=e.i(967489),r=e.i(713452),l=e.i(459649),o=e.i(118585),c=e.i(75977),d=e.i(482022),m=e.i(97923),p=e.i(367784),u=e.i(741120),h=e.i(487486),x=e.i(793479),f=e.i(975153),g=e.i(699375),v=e.i(111110),j=e.i(215519),y=e.i(306831);function b({checkin:e,autoCheckin:a,onAutoCheckinChange:r,busy:l,onCheckin:o}){let c,{t:d}=(0,v.b)(),{timeZone:m}=(0,j.M)(),p=d.settings?.ai?.minimaxCode,{today:u,last:x}=e,N=x&&"failed"!==x.status?x:null,k=!!(u?.checkedToday||N),w=String(N?.points??(u?u.points+u.bonusPoints:0)),C=String(N?.streakDays??u?.streakDays??0);return c=N?.trigger==="auto"&&"checked-in"===N.status?(p?.checkinAuto||"Checked in automatically today at {time} (+{points} credits, day {days} in a row)").replace("{time}",(0,y.r)(N.at,"HH:mm",m)).replace("{points}",w).replace("{days}",C):k?(p?.checkinDone||"Checked in today (+{points} credits, day {days} in a row)").replace("{points}",w).replace("{days}",C):x?.status==="failed"?(p?.checkinFailed||"Check-in failed: {error}").replace("{error}",x.error||""):e.autoCheckin?p?.checkinWillAuto||"Not checked in yet today. The app will check in automatically within the hour.":p?.checkinNotYet||"Not checked in yet today",(0,s.jsxs)("div",{className:"space-y-3 border-t pt-3",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 text-sm",children:[(0,s.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,s.jsx)("span",{className:"text-muted-foreground",children:p?.checkinToday||"Today's check-in"}),(0,s.jsxs)(h.f,{variant:k?"default":x?.status==="failed"?"destructive":"secondary",children:[(0,s.jsx)(f.f,{className:"mr-1 h-3 w-3"}),k?p?.checkinSuccess||"Checked in":p?.checkinNotYet||"Not yet"]})]}),!k&&(0,s.jsxs)(t.f,{size:"sm",variant:"outline",onClick:o,disabled:l,children:[l&&(0,s.jsx)(i.f,{className:"mr-2 h-4 w-4 animate-spin"}),p?.checkinNow||"Check in now"]})]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground break-words",children:c}),(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)(n.f,{htmlFor:"minimax-code-auto-checkin",children:p?.autoCheckin||"Daily auto check-in"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:p?.autoCheckinHint})]}),(0,s.jsx)(g.f,{id:"minimax-code-auto-checkin",checked:a,onCheckedChange:r})]})]})}let N=["MiniMax-M3.1-Flash","MiniMax-M3","MiniMax-M2.7-highspeed","MiniMax-M2.7"];var k=e.i(271645),w=e.i(41931),C=e.i(303163),S=e.i(294114),U=e.i(201276);function K({value:e,onChange:a}){let{t:r}=(0,v.b)(),l=r.settings?.ai?.minimaxCode,{status:o,loading:c,pending:f,busy:g,refresh:j,login:y,logout:P,checkin:E}=function(){let{t:e}=(0,v.b)(),s=e.settings?.ai?.minimaxCode,[i,t]=(0,k.useState)(null),[n,a]=(0,k.useState)(!0),[r,l]=(0,k.useState)(null),[o,c]=(0,k.useState)(!1),d=(0,k.useRef)(null),m=(0,k.useCallback)(async()=>{a(!0);try{let e=await w.k.get("/api/minimax-code");t(e),e.pendingLogin&&l(e.pendingLogin)}catch(e){U.V.error("[MiniMaxCode]","Failed to load status",{error:e})}finally{a(!1)}},[]);(0,k.useEffect)(()=>{m()},[m]),(0,k.useEffect)(()=>{if(!r)return;let e=!1,i=async()=>{try{let t=await w.k.get("/api/minimax-code/login");if(e)return;if("pending"===t.status){d.current=setTimeout(i,r.intervalMs);return}l(null),"ok"===t.status?S.c.success(s?.loginSuccess||"Signed in"):"expired"===t.status?S.c.error(s?.loginExpired||"Authorization timed out"):"denied"===t.status&&S.c.error(s?.loginDenied||"Authorization declined"),m()}catch(i){if(e)return;l(null),S.c.error(`${s?.loginFailed||"Sign-in failed"}: ${(0,C.Z)(i)}`)}};return d.current=setTimeout(i,r.intervalMs),()=>{e=!0,d.current&&clearTimeout(d.current)}},[r,m,s]);let p=async()=>{c(!0);try{await w.k.delete("/api/minimax-code"),l(null),await m()}catch(e){S.c.error((0,C.Z)(e))}finally{c(!1)}},u=async()=>{c(!0);try{let e=await w.k.post("/api/minimax-code/checkin",{});"failed"===e.status?S.c.error((s?.checkinFailed||"Check-in failed: {error}").replace("{error}",e.error||"")):S.c.success(s?.checkinSuccess||"Checked in"),await m()}catch(e){S.c.error((0,C.Z)(e))}finally{c(!1)}};return{status:i,loading:n,pending:r,busy:o,refresh:m,login:async()=>{c(!0);try{let e=await w.k.post("/api/minimax-code/login",{});l(e),window.open(e.url,"_blank","noopener,noreferrer")}catch(e){S.c.error(`${s?.loginFailed||"Sign-in failed"}: ${(0,C.Z)(e)}`)}finally{c(!1)}},logout:p,checkin:u}}(),M=o?.login??"none",I=o?.account,z=o?.credits,A={none:l?.statusNone||"Not signed in",active:l?.statusActive||"Signed in",expired:l?.statusExpired||"Login expired"}[M];return(0,s.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:l?.intro}),(0,s.jsxs)("section",{className:"space-y-3 rounded-md border bg-background p-3","aria-label":l?.title||"MiniMax Code account",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)("h4",{className:"text-sm font-medium",children:l?.title||"MiniMax Code account"}),(0,s.jsx)(t.f,{variant:"ghost",size:"sm",onClick:()=>void j(),disabled:c,"aria-label":l?.refresh||"Refresh",children:(0,s.jsx)(u.f,{className:`h-4 w-4 ${c?"animate-spin":""}`})})]}),(0,s.jsxs)("dl",{className:"grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 text-sm",children:[(0,s.jsx)("dt",{className:"text-muted-foreground",children:l?.loginStatus||"Login status"}),(0,s.jsxs)("dd",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,s.jsx)(h.f,{variant:"active"===M?"default":"expired"===M?"destructive":"secondary",children:A}),I&&(0,s.jsx)("span",{className:"truncate text-muted-foreground",children:I.name||I.email||I.userId})]}),"active"===M&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("dt",{className:"text-muted-foreground",children:l?.credits||"Remaining credits"}),(0,s.jsx)("dd",{children:z?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"font-medium tabular-nums",children:z.total}),(0,s.jsx)("span",{className:"ml-2 text-xs text-muted-foreground",children:(l?.creditsDetail||"Free {free} · Purchased {purchased}").replace("{free}",String(z.free)).replace("{purchased}",String(z.purchased))})]}):(0,s.jsx)("span",{className:"text-muted-foreground",children:l?.creditsUnavailable||"Unavailable"})})]})]}),"active"===M&&o&&(0,s.jsx)(b,{checkin:o.checkin,autoCheckin:e?.autoCheckin!==!1,onAutoCheckinChange:s=>a({...e,autoCheckin:s}),busy:g,onCheckin:()=>void E()}),f?(0,s.jsxs)("div",{className:"space-y-1 rounded-md bg-muted/50 p-3 text-sm",children:[(0,s.jsxs)("p",{className:"flex items-center gap-2",children:[(0,s.jsx)(i.f,{className:"h-4 w-4 animate-spin"}),l?.waiting]}),f.userCode&&(0,s.jsxs)("p",{children:[l?.userCode||"Verification code",": ",(0,s.jsx)("span",{className:"font-mono font-medium",children:f.userCode})]}),(0,s.jsxs)("a",{href:f.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 underline",children:[l?.openLink||"Open the authorization page"," ",(0,s.jsx)(d.f,{className:"h-3 w-3"})]})]}):(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsxs)(t.f,{size:"sm",onClick:()=>void y(),disabled:g,children:[g?(0,s.jsx)(i.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(m.f,{className:"mr-2 h-4 w-4"}),"none"===M?l?.login||"Sign in with browser":l?.relogin||"Sign in again"]}),"none"!==M&&(0,s.jsxs)(t.f,{size:"sm",variant:"outline",onClick:()=>void P(),disabled:g,children:[(0,s.jsx)(p.f,{className:"mr-2 h-4 w-4"}),l?.logout||"Sign out"]})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{htmlFor:"minimax-code-model",children:l?.model||"Model"}),(0,s.jsx)(x.f,{id:"minimax-code-model",list:"minimax-code-models",value:e?.model||"",onChange:s=>a({...e,model:s.target.value}),placeholder:"MiniMax-M3.1-Flash"}),(0,s.jsx)("datalist",{id:"minimax-code-models",children:N.map(e=>(0,s.jsx)("option",{value:e},e))}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:l?.modelHint})]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:l?.risk})]})}var P=e.i(77071),E=e.i(759659),M=e.i(464034),I=e.i(434901),z=e.i(37038),A=e.i(62189);function R({value:e,onChange:i}){let{t:r}=(0,v.b)(),l=(0,A.f)("openai"),o=e?.instances||[],c=e?.activeInstanceId,d=o.find(e=>e.id===c),m=(s,t)=>{i({...e,instances:o.map(e=>e.id===c?{...e,[s]:t}:e)})},p=async()=>{if(!c||!await (0,S.u)(r.settings?.ai?.confirmDelete||"Delete this instance?",{destructive:!0}))return;let e=o.filter(e=>e.id!==c);i({instances:e,activeInstanceId:e[0]?.id})};return(0,s.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)(n.f,{children:r.settings?.ai?.instances||"Instance"}),(0,s.jsxs)(t.f,{type:"button",variant:"outline",size:"sm",onClick:()=>{if(o.length>=10)return;let e={id:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let s=16*Math.random()|0;return("x"===e?s:3&s|8).toString(16)}),name:`Instance ${o.length+1}`,apiKey:"",baseUrl:"https://api.openai.com/v1",model:"gpt-6.1-sol"};i({instances:[...o,e],activeInstanceId:e.id})},disabled:o.length>=10,className:"h-7 px-2 text-xs",children:[(0,s.jsx)(P.f,{className:"h-3 w-3 mr-1"}),r.settings?.ai?.addInstance||"Add"]})]}),o.length>0?(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)(a.d,{value:c||"",onValueChange:s=>i({...e,activeInstanceId:s}),children:[(0,s.jsx)(a.P,{className:"flex-1",children:(0,s.jsx)(a.U,{placeholder:r.settings?.ai?.selectInstance||"Select Instance"})}),(0,s.jsx)(a.r,{children:o.map(e=>(0,s.jsx)(a.T,{value:e.id,children:e.name},e.id))})]}),o.length>1&&(0,s.jsx)(t.f,{type:"button",variant:"outline",size:"icon",onClick:p,className:"h-10 w-10 text-destructive hover:text-destructive",children:(0,s.jsx)(E.f,{className:"h-4 w-4"})})]}):(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:r.settings?.ai?.noInstances||"No instances configured. Click 'Add' to create one."}),o.length>=10&&(0,s.jsx)("p",{className:"text-xs text-amber-600",children:r.settings?.ai?.maxInstancesReached||"Maximum instances reached (10)"})]}),d&&(0,s.jsxs)("div",{className:"space-y-3 p-3 border rounded-md bg-background",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(n.f,{children:[r.settings?.ai?.instanceName||"Instance Name"," ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsx)(x.f,{value:d.name||"",onChange:e=>m("name",e.target.value),placeholder:"e.g. GLM-4V",className:d.name?.trim()?"":"border-destructive"})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I.f,{label:(0,s.jsxs)(s.Fragment,{children:["API Key ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),href:l?.apiKey,linkText:r.settings.ai.docLinks.apiKey}),(0,s.jsx)(z.f,{value:d.apiKey||"",onChange:e=>m("apiKey",e.target.value),placeholder:"sk-...",className:d.apiKey?.trim()?"":"border-destructive"})]}),(0,s.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,s.jsxs)(n.f,{children:["Base URL ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsx)(x.f,{value:d.baseUrl||"",onChange:e=>m("baseUrl",e.target.value),placeholder:"https://api.openai.com/v1",className:d.baseUrl?.trim()?"":"border-destructive"})]}),(0,s.jsx)(M.f,{provider:"openai",apiKey:d.apiKey,baseUrl:d.baseUrl,currentModel:d.model,onModelChange:e=>m("model",e),docsHref:l?.models})]})]})}function T({provider:e}){let{t:i}=(0,v.b)(),t=i.settings.ai.providerDocs,n=(0,A.f)(e);if(!n)return null;let a=[n.cn&&{href:n.cn,label:n.intl?t.cn:t.official},n.intl&&{href:n.intl,label:n.cn?t.intl:t.official}].filter(e=>!!e);return(0,s.jsxs)("p",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[(0,s.jsx)("span",{children:t.title}),a.map(e=>(0,s.jsxs)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 underline",children:[e.label,(0,s.jsx)(d.f,{className:"h-3 w-3"})]},e.href))]})}var F=e.i(128093);function L({provider:e,value:i,onChange:t}){let{t:a}=(0,v.b)(),r=F.$[e],l=(e,s)=>t({...i,[e]:s}),o={qwen:a.settings?.ai?.qwenBaseUrlHint,stepfun:a.settings?.ai?.stepfunBaseUrlHint,volcengine:a.settings?.ai?.volcengineBaseUrlHint,"volcengine-agent":a.settings?.ai?.volcengineAgentBaseUrlHint,"volcengine-coding":a.settings?.ai?.volcengineCodingBaseUrlHint};return(0,s.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:["volcengine-free"===e&&(0,s.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:[(0,s.jsx)("p",{className:"font-medium",children:a.settings.ai.volcengineFree.title}),(0,s.jsx)("p",{className:"mt-1",children:a.settings.ai.volcengineFree.body})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I.f,{label:"API Key",href:r.docs.apiKey,linkText:a.settings.ai.docLinks.apiKey}),(0,s.jsx)(z.f,{value:i?.apiKey||"",onChange:e=>l("apiKey",e.target.value),placeholder:"sk-..."}),(0,s.jsxs)("p",{className:"text-xs text-muted-foreground",children:[a.settings?.ai?.vendorApiKeyHint||"Get an API key from the console:"," ",(0,s.jsx)("a",{href:r.consoleUrl,target:"_blank",rel:"noopener noreferrer",className:"underline break-all",children:r.consoleUrl})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{children:"Base URL (Optional)"}),(0,s.jsx)(x.f,{value:i?.baseUrl||"",onChange:e=>l("baseUrl",e.target.value),placeholder:r.baseUrl}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:o[e]??a.settings?.ai?.vendorBaseUrlHint})]}),(0,s.jsx)(M.f,{provider:e,apiKey:i?.apiKey,baseUrl:i?.baseUrl,currentModel:i?.model||r.model,onModelChange:e=>l("model",e),docsHref:r.docs.models})]})}e.s(["f",0,function({config:e,setConfig:d,loading:m,saving:p,onSave:u}){let{t:h,language:x}=(0,v.b)();return m?(0,s.jsx)("div",{className:"flex justify-center py-4",children:(0,s.jsx)(i.f,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):(0,s.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{children:h.settings?.tabs?.ai||"AI Provider"}),(0,s.jsxs)(a.d,{value:e.aiProvider,onValueChange:e=>d(s=>({...s,aiProvider:e})),children:[(0,s.jsx)(a.P,{children:(0,s.jsx)(a.U,{})}),(0,s.jsxs)(a.r,{children:[(0,s.jsx)(a.T,{value:"minimax",children:(0,F.z)("minimax",x)}),(0,s.jsx)(a.T,{value:"minimax-code",children:"MiniMax Code OAuth"}),F.U.filter(e=>"minimax"!==e).map(e=>(0,s.jsx)(a.T,{value:e,children:(0,F.z)(e,x)},e)),(0,s.jsx)(a.T,{value:"anthropic",children:"Anthropic / Compatible"}),(0,s.jsx)(a.T,{value:"azure",children:"Azure OpenAI"}),(0,s.jsx)(a.T,{value:"openai",children:"OpenAI / Compatible"}),(0,s.jsx)(a.T,{value:"gemini",children:"Google Gemini"})]})]}),(0,s.jsx)(T,{provider:e.aiProvider})]}),"openai"===e.aiProvider&&(0,s.jsx)(R,{value:e.openai,onChange:e=>d(s=>({...s,openai:e}))}),"gemini"===e.aiProvider&&(0,s.jsx)(c.f,{value:e.gemini,onChange:e=>d(s=>({...s,gemini:e}))}),"minimax-code"===e.aiProvider&&(0,s.jsx)(K,{value:e.minimaxCode,onChange:e=>d(s=>({...s,minimaxCode:e}))}),"anthropic"===e.aiProvider&&(0,s.jsx)(l.f,{value:e.anthropic,onChange:e=>d(s=>({...s,anthropic:e}))}),(0,F.j)(e.aiProvider)&&(0,s.jsx)(L,{provider:e.aiProvider,value:e[e.aiProvider],onChange:e=>d(s=>({...s,[s.aiProvider]:e}))},e.aiProvider),"azure"===e.aiProvider&&(0,s.jsx)(o.f,{value:e.azure,onChange:e=>d(s=>({...s,azure:e}))}),(0,s.jsx)(r.f,{config:e,saving:p,saveButton:(0,s.jsxs)(t.f,{onClick:u,disabled:p,className:"flex-1",children:[p&&(0,s.jsx)(i.f,{className:"mr-2 h-4 w-4 animate-spin"}),h.settings?.ai?.save||"Save AI Settings"]})})]})}],10038),e.s(["f",0,function(e,s){if(!(0,y.L)(e.timeZone??y.J))return s.settings.general.invalidTimeZone;if("openai"===e.aiProvider)for(let i of e.openai?.instances||[]){if(!i.name?.trim())return s.settings?.ai?.validationNameRequired||"Instance name is required";if(!i.apiKey?.trim())return s.settings?.ai?.validationApiKeyRequired||"API Key is required";if(!i.baseUrl?.trim())return s.settings?.ai?.validationBaseUrlRequired||"Base URL is required";if(!i.model?.trim())return s.settings?.ai?.validationModelRequired||"Model name is required"}if("azure"===e.aiProvider){if(!e.azure?.endpoint?.trim())return s.settings?.ai?.validationAzureEndpointRequired||"Azure Endpoint is required";if(!e.azure?.deploymentName?.trim())return s.settings?.ai?.validationAzureDeploymentRequired||"Deployment Name is required";if(!e.azure?.apiKey?.trim())return s.settings?.ai?.validationApiKeyRequired||"API Key is required"}return null}],835467)},459649,464034,434901,62189,118585,75977,97923,e=>{var s=e.i(843476),i=e.i(793479),t=e.i(37038),n=e.i(110204),a=e.i(271645),r=e.i(519455),l=e.i(967489),o=e.i(482022),c=e.i(741120),d=e.i(632781),m=e.i(41931),p=e.i(111110),u=e.i(128093),h=e.i(201276);function x({provider:e,apiKey:t,baseUrl:f,currentModel:g,onModelChange:v,docsHref:j}){let{t:y}=(0,p.b)(),[b,N]=(0,a.useState)([]),[k,w]=(0,a.useState)(!1),[C,S]=(0,a.useState)(null),[U,K]=(0,a.useState)(g||""),[P,E]=(0,a.useState)(!1),[M,I]=(0,a.useState)(g);g!==M&&(I(g),K(g||""));let z=async()=>{if(!t)return void S(y.modelSelector?.enterApiKeyFirst||"Please enter API Key first");w(!0),S(null);try{let s=await m.k.post("/api/ai/models",{provider:e,apiKey:t,...f&&{baseUrl:f}});if("error"in s&&"string"==typeof s.error){S(s.error),E(!0),N([]);return}N(s.models),0===s.models.length&&(S(y.modelSelector?.noVisionModel||"No vision model found, please enter manually"),E(!0))}catch(s){h.V.error("[ModelSelector]","Failed to fetch models",{error:s});let e=s instanceof Error&&s.message||y.modelSelector?.fetchFailed||"Failed to fetch models";S(e+(y.modelSelector?.enterManually||", please enter manually")),E(!0)}finally{w(!1)}};return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(n.f,{className:"flex-1",children:y.modelSelector?.modelName||"Model Name"}),j&&(0,s.jsxs)("a",{href:j,target:"_blank",rel:"noopener noreferrer",className:"inline-flex shrink-0 items-center gap-1 text-xs text-muted-foreground underline",children:[y.settings.ai.docLinks.models,(0,s.jsx)(o.f,{className:"h-3 w-3"})]}),(0,s.jsx)(r.f,{type:"button",variant:"outline",size:"sm",onClick:z,disabled:k||!t,children:k?(0,s.jsx)(d.f,{className:"h-3 w-3 animate-spin"}):(0,s.jsx)(c.f,{className:"h-3 w-3"})})]}),C&&(0,s.jsx)("p",{className:"text-xs text-yellow-600",children:C}),P||0===b.length?(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(i.f,{value:U,onChange:e=>{var s;K(s=e.target.value),v(s)},placeholder:(0,u.j)(e)?u.$[e].model:"openai"===e?"gpt-6.1-sol":"gemini-1.5-flash"}),b.length>0&&(0,s.jsx)(r.f,{type:"button",variant:"link",size:"sm",className:"h-auto p-0 text-xs",onClick:()=>E(!1),children:y.modelSelector?.selectFromList||"Select from List"})]}):(0,s.jsx)("div",{className:"space-y-2",children:(0,s.jsxs)(l.d,{value:g,onValueChange:e=>{"_custom"===e?E(!0):(E(!1),K(e),v(e))},children:[(0,s.jsx)(l.P,{children:(0,s.jsx)(l.U,{placeholder:y.modelSelector?.selectModel||"Select Model"})}),(0,s.jsxs)(l.r,{children:[b.map(e=>(0,s.jsxs)(l.T,{value:e.id,children:[e.name,e.owned_by&&` (${e.owned_by})`]},e.id)),(0,s.jsx)(l.T,{value:"_custom",children:y.modelSelector?.customInput||"Custom Input..."})]})]})})]})}function f({label:e,href:i,linkText:t}){return i?(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)(n.f,{children:e}),(0,s.jsxs)("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"inline-flex shrink-0 items-center gap-1 text-xs text-muted-foreground underline",children:[t,(0,s.jsx)(o.f,{className:"h-3 w-3"})]})]}):(0,s.jsx)(n.f,{children:e})}e.s(["f",0,x],464034),e.s(["f",0,f],434901);let g={openai:{intl:"https://platform.openai.com/docs/api-reference",apiKey:"https://platform.openai.com/docs/quickstart",models:"https://platform.openai.com/docs/models"},anthropic:{intl:"https://docs.anthropic.com/en/api/overview",apiKey:"https://docs.anthropic.com/en/api/getting-started",models:"https://docs.anthropic.com/en/docs/about-claude/models/overview"},azure:{intl:"https://learn.microsoft.com/azure/ai-foundry/openai/reference",apiKey:"https://learn.microsoft.com/azure/ai-foundry/openai/how-to/create-resource",models:"https://learn.microsoft.com/azure/ai-foundry/openai/concepts/models"},gemini:{intl:"https://ai.google.dev/gemini-api/docs",apiKey:"https://ai.google.dev/gemini-api/docs/api-key",models:"https://ai.google.dev/gemini-api/docs/models"}};function v(e){return(0,u.j)(e)?u.$[e].docs:g[e]??null}e.s(["f",0,v],62189),e.s(["f",0,function({value:e,onChange:a}){let{t:r}=(0,p.b)(),l=v("anthropic"),o=(s,i)=>a({...e,[s]:i});return(0,s.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(f,{label:"API Key",href:l?.apiKey,linkText:r.settings.ai.docLinks.apiKey}),(0,s.jsx)(t.f,{value:e?.apiKey||"",onChange:e=>o("apiKey",e.target.value),placeholder:"sk-ant-..."})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{children:"Base URL (Optional)"}),(0,s.jsx)(i.f,{value:e?.baseUrl||"",onChange:e=>o("baseUrl",e.target.value),placeholder:"https://api.anthropic.com"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:r.settings?.ai?.anthropicBaseUrlHint})]}),(0,s.jsx)(x,{provider:"anthropic",apiKey:e?.apiKey,baseUrl:e?.baseUrl,currentModel:e?.model,onModelChange:e=>o("model",e),docsHref:l?.models})]})}],459649),e.s(["f",0,function({value:e,onChange:a}){let{t:r}=(0,p.b)(),l=v("azure"),o=(s,i)=>a({...e,[s]:i}),c=e=>e?.trim()?"":"border-destructive";return(0,s.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(n.f,{children:[r.settings?.ai?.azureEndpoint||"Azure Endpoint"," ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsx)(i.f,{value:e?.endpoint||"",onChange:e=>o("endpoint",e.target.value),placeholder:r.settings?.ai?.azureEndpointPlaceholder||"https://your-resource.openai.azure.com",className:c(e?.endpoint)})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(f,{label:(0,s.jsxs)(s.Fragment,{children:[r.settings?.ai?.azureDeployment||"Deployment Name"," ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),href:l?.models,linkText:r.settings.ai.docLinks.models}),(0,s.jsx)(i.f,{value:e?.deploymentName||"",onChange:e=>o("deploymentName",e.target.value),placeholder:r.settings?.ai?.azureDeploymentPlaceholder||"gpt-4o-deployment",className:c(e?.deploymentName)})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(f,{label:(0,s.jsxs)(s.Fragment,{children:["API Key ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),href:l?.apiKey,linkText:r.settings.ai.docLinks.apiKey}),(0,s.jsx)(t.f,{value:e?.apiKey||"",onChange:e=>o("apiKey",e.target.value),placeholder:"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",className:c(e?.apiKey)})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{children:r.settings?.ai?.azureApiVersion||"API Version"}),(0,s.jsx)(i.f,{value:e?.apiVersion||"",onChange:e=>o("apiVersion",e.target.value),placeholder:r.settings?.ai?.azureApiVersionPlaceholder||"2024-02-15-preview"})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{children:r.settings?.ai?.azureModel||"Model Display Name"}),(0,s.jsx)(i.f,{value:e?.model||"",onChange:e=>o("model",e.target.value),placeholder:"gpt-4o"})]})]})}],118585),e.s(["f",0,function({value:e,onChange:a}){let{t:r}=(0,p.b)(),l=v("gemini"),o=(s,i)=>a({...e,[s]:i});return(0,s.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(f,{label:"API Key",href:l?.apiKey,linkText:r.settings.ai.docLinks.apiKey}),(0,s.jsx)(t.f,{value:e?.apiKey||"",onChange:e=>o("apiKey",e.target.value),placeholder:"AIza..."})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{children:"Base URL (Optional)"}),(0,s.jsx)(i.f,{value:e?.baseUrl||"",onChange:e=>o("baseUrl",e.target.value),placeholder:"https://generativelanguage.googleapis.com"})]}),(0,s.jsx)(x,{provider:"gemini",apiKey:e?.apiKey,baseUrl:e?.baseUrl,currentModel:e?.model,onModelChange:e=>o("model",e),docsHref:l?.models})]})}],75977);var j=e.i(456420);let y={name:"log-in",size:24,node:[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]]};y.node;let b=(0,j.f)(y);e.s(["f",0,b],97923)},37038,e=>{var s=e.i(843476),i=e.i(271645),t=e.i(772382),n=e.i(580860),a=e.i(519455),r=e.i(793479),l=e.i(111110),o=e.i(975157);e.s(["f",0,function({className:e,...c}){let{t:d}=(0,l.b)(),[m,p]=(0,i.useState)(!1);return(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(r.f,{type:m?"text":"password",className:(0,o.f)("pr-10",e),...c}),(0,s.jsx)(a.f,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>p(!m),"aria-label":m?d.common.hidePassword:d.common.showPassword,tabIndex:-1,children:m?(0,s.jsx)(n.f,{className:"h-4 w-4 text-muted-foreground"}):(0,s.jsx)(t.f,{className:"h-4 w-4 text-muted-foreground"})})]})}])}])})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,711241,e=>{var t=e.i(456420);let s={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};s.node;let a=(0,t.f)(s);e.s(["f",0,a],711241)},666776,e=>{var t=e.i(843476),s=e.i(271645),a=e.i(618566),i=e.i(519455),n=e.i(912505),o=e.i(393842),r=e.i(86963),l=e.i(632781),c=e.i(456420);let d={name:"locate-fixed",size:24,node:[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};d.node;let h=(0,c.f)(d);var m=e.i(793479),u=e.i(111110),x=e.i(833547),g=e.i(747279);function f(){let{t:e}=(0,u.b)(),n=(0,a.useRouter)(),[o,r]=(0,s.useState)(""),[c,d]=(0,s.useState)(null),[f,b]=(0,s.useState)(!1),y=async t=>{t.preventDefault();let s=o.trim();if(!(0,g.f)(s))return void d(e.shortId.invalid);b(!0),d(null);let a=await (0,x.f)(s);b(!1),a?n.push(`/error-items/${a}`):d(e.shortId.notFound)};return(0,t.jsxs)("form",{onSubmit:y,className:"space-y-1",children:[(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(m.f,{value:o,onChange:e=>{r(e.target.value),d(null)},placeholder:e.shortId.locatePlaceholder,maxLength:6,className:"font-mono sm:max-w-xs","aria-label":e.shortId.locateTitle}),(0,t.jsxs)(i.f,{type:"submit",variant:"outline",disabled:f||!o.trim(),children:[f?(0,t.jsx)(l.f,{className:"h-4 w-4 animate-spin"}):(0,t.jsx)(h,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"ml-2",children:e.shortId.locate})]})]}),c&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:c})]})}var b=e.i(856423),y=e.i(77071);let p={name:"atom",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M20.2 20.2c2.04-2.03.02-7.36-4.5-11.9-4.54-4.52-9.87-6.54-11.9-4.5-2.04 2.03-.02 7.36 4.5 11.9 4.54 4.52 9.87 6.54 11.9 4.5Z",key:"1l2ple"}],["path",{d:"M15.7 15.7c4.52-4.54 6.54-9.87 4.5-11.9-2.03-2.04-7.36-.02-11.9 4.5-4.52 4.54-6.54 9.87-4.5 11.9 2.03 2.04 7.36.02 11.9-4.5Z",key:"1wam0m"}]]};p.node;let k=(0,c.f)(p),j={name:"book-text",size:24,node:[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M8 11h8",key:"vwpz6n"}],["path",{d:"M8 7h6",key:"1f0q6e"}]]};j.node;let v=(0,c.f)(j);var N=e.i(867927);let w={name:"flask-conical",size:24,node:[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]};w.node;let C=(0,c.f)(w),M={name:"globe",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]};M.node;let z=(0,c.f)(M),S={name:"landmark",size:24,node:[["path",{d:"M10 18v-7",key:"wt116b"}],["path",{d:"M11.119 2.205a2 2 0 0 1 1.762 0l7.84 3.846A.5.5 0 0 1 20.5 7h-17a.5.5 0 0 1-.22-.949z",key:"yxxwt6"}],["path",{d:"M14 18v-7",key:"vav6t3"}],["path",{d:"M18 18v-7",key:"aexdmj"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M6 18v-7",key:"1ivflk"}]]};S.node;let F=(0,c.f)(S);var H=e.i(999092);let V={name:"leaf",size:24,node:[["path",{d:"M11 20a10 10 0 0010-10 25.9 25.9 0 00-1.04-7.281 1 1 0 00-1.755-.325C15.833 5.5 13 5.5 9.8 6.1A7 7 0 0011 20",key:"1wjnjv"}],["path",{d:"M2 21a5 5 0 012.911-4.544C7.613 15.212 8.351 15.24 11 13",key:"c1ejpn"}]]};V.node;let E=(0,c.f)(V),L={name:"scale",size:24,node:[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"m19 8 3 8a5 5 0 0 1-6 0zV7",key:"zcdpyk"}],["path",{d:"M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1",key:"1yorad"}],["path",{d:"m5 8 3 8a5 5 0 0 1-6 0zV7",key:"eua70x"}],["path",{d:"M7 21h10",key:"1b0cd5"}]]};L.node;let T=(0,c.f)(L),I={name:"sigma",size:24,node:[["path",{d:"M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2",key:"wuwx1p"}]]};I.node;let K=(0,c.f)(I);var P=e.i(709830),A=e.i(76824);let R={math:{icon:K,className:"bg-blue-100 text-blue-600 dark:bg-blue-500/15 dark:text-blue-300"},english:{icon:H.f,className:"bg-emerald-100 text-emerald-600 dark:bg-emerald-500/15 dark:text-emerald-300"},chinese:{icon:v,className:"bg-rose-100 text-rose-600 dark:bg-rose-500/15 dark:text-rose-300"},physics:{icon:k,className:"bg-amber-100 text-amber-600 dark:bg-amber-500/15 dark:text-amber-300"},chemistry:{icon:C,className:"bg-teal-100 text-teal-600 dark:bg-teal-500/15 dark:text-teal-300"},biology:{icon:E,className:"bg-lime-100 text-lime-700 dark:bg-lime-500/15 dark:text-lime-300"},history:{icon:F,className:"bg-orange-100 text-orange-600 dark:bg-orange-500/15 dark:text-orange-300"},geography:{icon:z,className:"bg-cyan-100 text-cyan-600 dark:bg-cyan-500/15 dark:text-cyan-300"},politics:{icon:T,className:"bg-red-100 text-red-600 dark:bg-red-500/15 dark:text-red-300"}},U={icon:b.f,className:"bg-accent text-accent-foreground"};function O({name:e,stage:s,subjectKey:a,errorCount:i,onClick:n,itemLabel:o="items"}){let r=(0,A.v)({name:e,stage:s,subjectKey:a}),{icon:l,className:c}=r.subject?R[r.subject]:U;return(0,t.jsxs)("div",{role:"link",tabIndex:0,className:"group relative flex cursor-pointer items-center gap-4 rounded-2xl border bg-card p-4 shadow-sm transition-all hover:-translate-y-0.5 hover:border-primary/40 hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:n,onKeyDown:e=>{"Enter"===e.key&&n()},children:[(0,t.jsx)("div",{className:`flex h-12 w-12 shrink-0 items-center justify-center rounded-xl ${c}`,children:(0,t.jsx)(l,{className:"h-6 w-6"})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("h3",{className:"truncate font-semibold",children:e}),(0,t.jsxs)("p",{className:"mt-0.5 flex items-center gap-1.5 text-sm text-muted-foreground",children:[(0,t.jsx)("span",{className:"font-medium tabular-nums text-foreground",children:i}),o,(0,t.jsx)("span",{className:"text-border",children:"|"}),(0,t.jsx)(P.E,{notebook:{name:e,stage:s,subjectKey:a},className:"truncate"})]})]}),(0,t.jsx)(N.f,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]})}var _=e.i(527161),W=e.i(41931),$=e.i(35209),D=e.i(294114),B=e.i(201276),q=e.i(303163);e.s(["default",0,function(){let e=(0,a.useRouter)(),{t:l}=(0,u.b)();(0,$.f)(l.notebooks.title);let[c,d]=(0,s.useState)([]),[h,m]=(0,s.useState)(!0),[x,g]=(0,s.useState)(!1),p=(0,s.useCallback)(async()=>{try{let e=await W.f.get("/api/notebooks");d(e)}catch(e){B.V.error("[Notebooks]","Failed to fetch notebooks",{error:e})}finally{m(!1)}},[]);(0,s.useEffect)(()=>{p()},[p]);let k=async e=>{try{await W.f.post("/api/notebooks",e),await p()}catch(t){B.V.error("[Notebooks]","Failed to create notebook",{error:t});let e=(0,q.d)(t)||l.notebooks?.createError||"Failed to create";D.c.error(e)}};return h?(0,t.jsx)(r.f,{label:l.common.loading}):(0,t.jsx)("main",{className:"mx-auto min-h-screen max-w-6xl px-4 py-6 md:px-8 md:py-8",children:(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)(o.f,{title:l.notebooks?.title||"My Notebooks",description:l.notebooks?.subtitle||"Manage your mistakes by subject",actions:(0,t.jsxs)(i.f,{onClick:()=>g(!0),"aria-label":l.notebooks?.create||"New Notebook",children:[(0,t.jsx)(y.f,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"hidden sm:inline",children:l.notebooks?.create||"New Notebook"})]})}),(0,t.jsx)(f,{}),0===c.length?(0,t.jsx)(n.f,{icon:b.f,title:l.notebooks?.empty||"No notebooks yet.",action:(0,t.jsxs)(i.f,{onClick:()=>g(!0),children:[(0,t.jsx)(y.f,{className:"h-4 w-4"}),l.notebooks?.createFirst||"Create Notebook"]})}):(0,t.jsx)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:c.map(s=>(0,t.jsx)(O,{name:s.name,stage:s.stage,subjectKey:s.subjectKey,errorCount:s._count?.errorItems||0,onClick:()=>{var t;return t=s.id,void e.push(`/notebooks/${t}`)},itemLabel:l.notebooks.cardItems},s.id))}),(0,t.jsx)(_.f,{open:x,onOpenChange:g,onCreate:k},l.common.loading)]})})}],666776)},527161,e=>{var t=e.i(843476),s=e.i(271645),a=e.i(776639),i=e.i(519455),n=e.i(793479),o=e.i(110204),r=e.i(967489),l=e.i(709830),c=e.i(111110),d=e.i(76824),h=e.i(41931),m=e.i(294114),u=e.i(201276);async function x(){try{let e=await h.f.get("/api/tags?tagSetsOnly=true");return e.tagSets?.length?e.tagSets:["default"]}catch{return["default"]}}e.s(["f",0,function({open:e,onOpenChange:h,onCreate:g}){let[f,b]=(0,s.useState)(""),[y,p]=(0,s.useState)(d.j),[k,j]=(0,s.useState)(d.W[d.j][0]),[v,N]=(0,s.useState)("default"),[w,C]=(0,s.useState)(["default"]),[M,z]=(0,s.useState)(!1),{t:S}=(0,c.b)(),{stageLabel:F,subjectLabel:H}=(0,l.O)();(0,s.useEffect)(()=>{e&&x().then(C)},[e]);let V=async()=>{if(!f.trim())return void m.c.warning(S.notebooks?.dialog?.enterName||"Please enter notebook name");z(!0);try{await g({name:f.trim(),stage:y,subjectKey:k,tagSet:v}),b(""),h(!1)}catch(e){u.V.error("[CreateNotebook]","Failed to create notebook",{error:e})}finally{z(!1)}};return(0,t.jsx)(a.N,{open:e,onOpenChange:h,children:(0,t.jsxs)(a.d,{children:[(0,t.jsxs)(a.s,{children:[(0,t.jsx)(a.F,{children:S.notebooks?.dialog?.title||"Create New Notebook"}),(0,t.jsx)(a.C,{children:S.notebooks?.dialog?.desc||"Create separate notebooks for different subjects or chapters"})]}),(0,t.jsxs)("div",{className:"space-y-4 py-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(o.f,{htmlFor:"notebook-stage",children:S.notebooks.dialog.stageLabel}),(0,t.jsxs)(r.d,{value:y,onValueChange:e=>{p(e),d.W[e].includes(k)||j(d.W[e][0])},children:[(0,t.jsx)(r.P,{id:"notebook-stage",children:(0,t.jsx)(r.U,{})}),(0,t.jsx)(r.r,{children:d.c.map(e=>(0,t.jsx)(r.T,{value:e,children:F(e)},e))})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(o.f,{htmlFor:"notebook-subject",children:S.notebooks.dialog.subjectLabel}),(0,t.jsxs)(r.d,{value:k,onValueChange:e=>j(e),children:[(0,t.jsx)(r.P,{id:"notebook-subject",children:(0,t.jsx)(r.U,{})}),(0,t.jsx)(r.r,{children:d.W[y].map(e=>(0,t.jsx)(r.T,{value:e,children:H(e)},e))})]})]})]}),w.length>1&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(o.f,{htmlFor:"notebook-tagset",children:S.notebooks.dialog.tagSetLabel}),(0,t.jsxs)(r.d,{value:v,onValueChange:N,children:[(0,t.jsx)(r.P,{id:"notebook-tagset",children:(0,t.jsx)(r.U,{})}),(0,t.jsx)(r.r,{children:w.map(e=>(0,t.jsx)(r.T,{value:e,children:"default"===e?S.notebooks.dialog.tagSetDefault||"Built-in":S.notebooks.dialog.tagSetNames?.[e]||e},e))})]})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:S.notebooks.dialog.scopeHint}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(o.f,{htmlFor:"name",children:S.notebooks?.dialog?.nameLabel||"Notebook Name"}),(0,t.jsx)(n.f,{id:"name",placeholder:S.notebooks?.dialog?.placeholder||"e.g. Math, Physics, Chemistry...",value:f,onChange:e=>b(e.target.value),onKeyDown:e=>"Enter"===e.key&&V()})]})]}),(0,t.jsxs)(a.c,{children:[(0,t.jsx)(i.f,{variant:"outline",onClick:()=>h(!1),children:S.common.cancel}),(0,t.jsx)(i.f,{onClick:V,disabled:M||!f.trim(),children:M?S.notebooks?.dialog?.creating||"Creating...":S.notebooks?.dialog?.create||"Create"})]})]})})}])},709830,76824,e=>{var t=e.i(843476),s=e.i(111110),a=e.i(952122);let i=["primary","junior_high","senior_high"],n="primary",o=["math","english","chinese","physics","chemistry","biology","history","geography","politics"];function r(e){return"string"==typeof e&&o.includes(e)}function l(e){var t;let s=r(e.subjectKey)?e.subjectKey:(0,a.f)(e.name);return{stage:"string"==typeof(t=e.stage)&&i.includes(t)?e.stage:n,subject:s&&r(s)?s:null}}function c(){let{t:e}=(0,s.b)();return{stageLabel:t=>({primary:e.auth.primary,junior_high:e.auth.juniorHigh,senior_high:e.auth.seniorHigh})[t],subjectLabel:t=>e.tags.subjects[t]}}e.s(["j",0,n,"c",0,i,"W",0,{primary:["math","english","chinese"],junior_high:o,senior_high:o},"v",0,l],76824),e.s(["E",0,function({notebook:e,className:s}){let{stageLabel:a,subjectLabel:i}=c(),n=l(e);return(0,t.jsxs)("span",{className:s,children:[a(n.stage),n.subject?` \xb7 ${i(n.subject)}`:""]})},"O",0,c],709830)},590546,e=>{var t=e.i(843476),s=e.i(618566),a=e.i(519455),i=e.i(711241);e.s(["f",0,function({fallbackUrl:e,className:n}){let o=(0,s.useRouter)();return(0,t.jsx)(a.f,{variant:"ghost",size:"icon",onClick:()=>{o.push(e)},className:n,children:(0,t.jsx)(i.f,{className:"h-5 w-5"})})}])},912505,e=>{var t=e.i(843476),s=e.i(975157);e.s(["f",0,function({icon:e,title:a,description:i,action:n,className:o}){return(0,t.jsxs)("div",{className:(0,s.f)("flex flex-col items-center justify-center rounded-2xl border border-dashed bg-card/50 px-6 py-14 text-center",o),children:[(0,t.jsx)("div",{className:"mb-4 flex h-14 w-14 items-center justify-center rounded-2xl bg-accent text-accent-foreground",children:(0,t.jsx)(e,{className:"h-7 w-7"})}),(0,t.jsx)("p",{className:"font-medium",children:a}),i&&(0,t.jsx)("p",{className:"mt-1 max-w-sm text-sm text-muted-foreground",children:i}),n&&(0,t.jsx)("div",{className:"mt-5",children:n})]})}])},393842,e=>{var t=e.i(843476),s=e.i(590546),a=e.i(975157);e.s(["f",0,function({title:e,description:i,backHref:n,actions:o,titleAddon:r,className:l}){return(0,t.jsxs)("div",{className:(0,a.f)("flex items-start gap-3",l),children:[n&&(0,t.jsx)(s.f,{fallbackUrl:n,className:"-ml-2 shrink-0"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("h1",{className:"truncate text-2xl font-bold tracking-tight sm:text-3xl",children:e}),r]}),i&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground sm:text-base",children:i})]}),o&&(0,t.jsx)("div",{className:"flex shrink-0 items-center gap-2",children:o})]})}])},86963,e=>{var t=e.i(843476),s=e.i(632781);e.s(["f",0,function({label:e}){return(0,t.jsxs)("div",{className:"flex min-h-[50vh] flex-col items-center justify-center gap-3 text-muted-foreground",children:[(0,t.jsx)(s.f,{className:"h-7 w-7 animate-spin text-primary"}),e&&(0,t.jsx)("p",{className:"text-sm",children:e})]})}])},952122,e=>{e.i(306831),e.s(["f",0,function(e){if(!e)return null;let t=e.toLowerCase();return t.includes("math")||t.includes("数学")?"math":t.includes("physics")||t.includes("物理")?"physics":t.includes("chemistry")||t.includes("化学")?"chemistry":t.includes("biology")||t.includes("生物")?"biology":t.includes("english")||t.includes("英语")?"english":t.includes("chinese")||t.includes("语文")?"chinese":t.includes("history")||t.includes("历史")?"history":t.includes("geography")||t.includes("地理")?"geography":t.includes("politics")||t.includes("政治")?"politics":null}])},35209,e=>{var t=e.i(271645),s=e.i(111110);e.s(["f",0,function(...e){let{t:a}=(0,s.b)(),i=[a.pageTitle.base,...e.map(e=>"string"==typeof e?e.trim():"").filter(e=>e.length>0)].join("-");(0,t.useEffect)(()=>{document.title=i},[i])}])},833547,747279,e=>{var t=e.i(41931);async function s(e){try{return(await t.f.get(`/api/error-items/short/${encodeURIComponent(e)}`)).id}catch{return null}}e.s(["f",0,s],833547);let a=RegExp("^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{6}$");e.s(["f",0,function(e){return"string"==typeof e&&a.test(e)}],747279)}])})();
|
|
1
|
+
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,711241,e=>{var t=e.i(456420);let s={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};s.node;let a=(0,t.f)(s);e.s(["f",0,a],711241)},666776,e=>{var t=e.i(843476),s=e.i(271645),a=e.i(618566),i=e.i(519455),n=e.i(912505),o=e.i(393842),r=e.i(86963),l=e.i(632781),c=e.i(456420);let d={name:"locate-fixed",size:24,node:[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};d.node;let h=(0,c.f)(d);var m=e.i(793479),u=e.i(111110),x=e.i(833547),g=e.i(747279);function b(){let{t:e}=(0,u.b)(),n=(0,a.useRouter)(),[o,r]=(0,s.useState)(""),[c,d]=(0,s.useState)(null),[b,f]=(0,s.useState)(!1),y=async t=>{t.preventDefault();let s=o.trim();if(!(0,g.f)(s))return void d(e.shortId.invalid);f(!0),d(null);let a=await (0,x.f)(s);f(!1),a?n.push(`/error-items/${a}`):d(e.shortId.notFound)};return(0,t.jsxs)("form",{onSubmit:y,className:"space-y-1",children:[(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(m.f,{value:o,onChange:e=>{r(e.target.value),d(null)},placeholder:e.shortId.locatePlaceholder,maxLength:6,className:"font-mono sm:max-w-xs","aria-label":e.shortId.locateTitle}),(0,t.jsxs)(i.f,{type:"submit",variant:"outline",disabled:b||!o.trim(),children:[b?(0,t.jsx)(l.f,{className:"h-4 w-4 animate-spin"}):(0,t.jsx)(h,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"ml-2",children:e.shortId.locate})]})]}),c&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:c})]})}var f=e.i(856423),y=e.i(77071);let p={name:"atom",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M20.2 20.2c2.04-2.03.02-7.36-4.5-11.9-4.54-4.52-9.87-6.54-11.9-4.5-2.04 2.03-.02 7.36 4.5 11.9 4.54 4.52 9.87 6.54 11.9 4.5Z",key:"1l2ple"}],["path",{d:"M15.7 15.7c4.52-4.54 6.54-9.87 4.5-11.9-2.03-2.04-7.36-.02-11.9 4.5-4.52 4.54-6.54 9.87-4.5 11.9 2.03 2.04 7.36.02 11.9-4.5Z",key:"1wam0m"}]]};p.node;let k=(0,c.f)(p),j={name:"book-text",size:24,node:[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M8 11h8",key:"vwpz6n"}],["path",{d:"M8 7h6",key:"1f0q6e"}]]};j.node;let v=(0,c.f)(j);var N=e.i(867927);let w={name:"flask-conical",size:24,node:[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]};w.node;let C=(0,c.f)(w),M={name:"globe",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]};M.node;let z=(0,c.f)(M),S={name:"landmark",size:24,node:[["path",{d:"M10 18v-7",key:"wt116b"}],["path",{d:"M11.119 2.205a2 2 0 0 1 1.762 0l7.84 3.846A.5.5 0 0 1 20.5 7h-17a.5.5 0 0 1-.22-.949z",key:"yxxwt6"}],["path",{d:"M14 18v-7",key:"vav6t3"}],["path",{d:"M18 18v-7",key:"aexdmj"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M6 18v-7",key:"1ivflk"}]]};S.node;let F=(0,c.f)(S);var H=e.i(999092);let V={name:"leaf",size:24,node:[["path",{d:"M11 20a10 10 0 0010-10 25.9 25.9 0 00-1.04-7.281 1 1 0 00-1.755-.325C15.833 5.5 13 5.5 9.8 6.1A7 7 0 0011 20",key:"1wjnjv"}],["path",{d:"M2 21a5 5 0 012.911-4.544C7.613 15.212 8.351 15.24 11 13",key:"c1ejpn"}]]};V.node;let E=(0,c.f)(V),L={name:"scale",size:24,node:[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"m19 8 3 8a5 5 0 0 1-6 0zV7",key:"zcdpyk"}],["path",{d:"M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1",key:"1yorad"}],["path",{d:"m5 8 3 8a5 5 0 0 1-6 0zV7",key:"eua70x"}],["path",{d:"M7 21h10",key:"1b0cd5"}]]};L.node;let T=(0,c.f)(L),I={name:"sigma",size:24,node:[["path",{d:"M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2",key:"wuwx1p"}]]};I.node;let K=(0,c.f)(I);var P=e.i(709830),A=e.i(76824);let R={math:{icon:K,className:"bg-blue-100 text-blue-600 dark:bg-blue-500/15 dark:text-blue-300"},english:{icon:H.f,className:"bg-emerald-100 text-emerald-600 dark:bg-emerald-500/15 dark:text-emerald-300"},chinese:{icon:v,className:"bg-rose-100 text-rose-600 dark:bg-rose-500/15 dark:text-rose-300"},physics:{icon:k,className:"bg-amber-100 text-amber-600 dark:bg-amber-500/15 dark:text-amber-300"},chemistry:{icon:C,className:"bg-teal-100 text-teal-600 dark:bg-teal-500/15 dark:text-teal-300"},biology:{icon:E,className:"bg-lime-100 text-lime-700 dark:bg-lime-500/15 dark:text-lime-300"},history:{icon:F,className:"bg-orange-100 text-orange-600 dark:bg-orange-500/15 dark:text-orange-300"},geography:{icon:z,className:"bg-cyan-100 text-cyan-600 dark:bg-cyan-500/15 dark:text-cyan-300"},politics:{icon:T,className:"bg-red-100 text-red-600 dark:bg-red-500/15 dark:text-red-300"}},U={icon:f.f,className:"bg-accent text-accent-foreground"};function O({name:e,stage:s,subjectKey:a,errorCount:i,onClick:n,itemLabel:o="items"}){let r=(0,A.v)({name:e,stage:s,subjectKey:a}),{icon:l,className:c}=r.subject?R[r.subject]:U;return(0,t.jsxs)("div",{role:"link",tabIndex:0,className:"group relative flex cursor-pointer items-center gap-4 rounded-2xl border bg-card p-4 shadow-sm transition-all hover:-translate-y-0.5 hover:border-primary/40 hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:n,onKeyDown:e=>{"Enter"===e.key&&n()},children:[(0,t.jsx)("div",{className:`flex h-12 w-12 shrink-0 items-center justify-center rounded-xl ${c}`,children:(0,t.jsx)(l,{className:"h-6 w-6"})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("h3",{className:"truncate font-semibold",children:e}),(0,t.jsxs)("p",{className:"mt-0.5 flex items-center gap-1.5 text-sm text-muted-foreground",children:[(0,t.jsx)("span",{className:"font-medium tabular-nums text-foreground",children:i}),o,(0,t.jsx)("span",{className:"text-border",children:"|"}),(0,t.jsx)(P.E,{notebook:{name:e,stage:s,subjectKey:a},className:"truncate"})]})]}),(0,t.jsx)(N.f,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]})}var _=e.i(527161),W=e.i(41931),$=e.i(35209),D=e.i(294114),B=e.i(201276),q=e.i(303163);e.s(["default",0,function(){let e=(0,a.useRouter)(),{t:l}=(0,u.b)();(0,$.f)(l.notebooks.title);let[c,d]=(0,s.useState)([]),[h,m]=(0,s.useState)(!0),[x,g]=(0,s.useState)(!1),p=(0,s.useCallback)(async()=>{try{let e=await W.k.get("/api/notebooks");d(e)}catch(e){B.V.error("[Notebooks]","Failed to fetch notebooks",{error:e})}finally{m(!1)}},[]);(0,s.useEffect)(()=>{p()},[p]);let k=async e=>{try{await W.k.post("/api/notebooks",e),await p()}catch(t){B.V.error("[Notebooks]","Failed to create notebook",{error:t});let e=(0,q.d)(t)||l.notebooks?.createError||"Failed to create";D.c.error(e)}};return h?(0,t.jsx)(r.f,{label:l.common.loading}):(0,t.jsx)("main",{className:"mx-auto min-h-screen max-w-6xl px-4 py-6 md:px-8 md:py-8",children:(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)(o.f,{title:l.notebooks?.title||"My Notebooks",description:l.notebooks?.subtitle||"Manage your mistakes by subject",actions:(0,t.jsxs)(i.f,{onClick:()=>g(!0),"aria-label":l.notebooks?.create||"New Notebook",children:[(0,t.jsx)(y.f,{className:"h-4 w-4"}),(0,t.jsx)("span",{className:"hidden sm:inline",children:l.notebooks?.create||"New Notebook"})]})}),(0,t.jsx)(b,{}),0===c.length?(0,t.jsx)(n.f,{icon:f.f,title:l.notebooks?.empty||"No notebooks yet.",action:(0,t.jsxs)(i.f,{onClick:()=>g(!0),children:[(0,t.jsx)(y.f,{className:"h-4 w-4"}),l.notebooks?.createFirst||"Create Notebook"]})}):(0,t.jsx)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:c.map(s=>(0,t.jsx)(O,{name:s.name,stage:s.stage,subjectKey:s.subjectKey,errorCount:s._count?.errorItems||0,onClick:()=>{var t;return t=s.id,void e.push(`/notebooks/${t}`)},itemLabel:l.notebooks.cardItems},s.id))}),(0,t.jsx)(_.f,{open:x,onOpenChange:g,onCreate:k},l.common.loading)]})})}],666776)},527161,e=>{var t=e.i(843476),s=e.i(271645),a=e.i(776639),i=e.i(519455),n=e.i(793479),o=e.i(110204),r=e.i(967489),l=e.i(709830),c=e.i(111110),d=e.i(76824),h=e.i(41931),m=e.i(294114),u=e.i(201276);async function x(){try{let e=await h.k.get("/api/tags?tagSetsOnly=true");return e.tagSets?.length?e.tagSets:["default"]}catch{return["default"]}}e.s(["f",0,function({open:e,onOpenChange:h,onCreate:g}){let[b,f]=(0,s.useState)(""),[y,p]=(0,s.useState)(d.j),[k,j]=(0,s.useState)(d.W[d.j][0]),[v,N]=(0,s.useState)("default"),[w,C]=(0,s.useState)(["default"]),[M,z]=(0,s.useState)(!1),{t:S}=(0,c.b)(),{stageLabel:F,subjectLabel:H}=(0,l.O)();(0,s.useEffect)(()=>{e&&x().then(C)},[e]);let V=async()=>{if(!b.trim())return void m.c.warning(S.notebooks?.dialog?.enterName||"Please enter notebook name");z(!0);try{await g({name:b.trim(),stage:y,subjectKey:k,tagSet:v}),f(""),h(!1)}catch(e){u.V.error("[CreateNotebook]","Failed to create notebook",{error:e})}finally{z(!1)}};return(0,t.jsx)(a.N,{open:e,onOpenChange:h,children:(0,t.jsxs)(a.d,{children:[(0,t.jsxs)(a.s,{children:[(0,t.jsx)(a.F,{children:S.notebooks?.dialog?.title||"Create New Notebook"}),(0,t.jsx)(a.C,{children:S.notebooks?.dialog?.desc||"Create separate notebooks for different subjects or chapters"})]}),(0,t.jsxs)("div",{className:"space-y-4 py-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(o.f,{htmlFor:"notebook-stage",children:S.notebooks.dialog.stageLabel}),(0,t.jsxs)(r.d,{value:y,onValueChange:e=>{p(e),d.W[e].includes(k)||j(d.W[e][0])},children:[(0,t.jsx)(r.P,{id:"notebook-stage",children:(0,t.jsx)(r.U,{})}),(0,t.jsx)(r.r,{children:d.c.map(e=>(0,t.jsx)(r.T,{value:e,children:F(e)},e))})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(o.f,{htmlFor:"notebook-subject",children:S.notebooks.dialog.subjectLabel}),(0,t.jsxs)(r.d,{value:k,onValueChange:e=>j(e),children:[(0,t.jsx)(r.P,{id:"notebook-subject",children:(0,t.jsx)(r.U,{})}),(0,t.jsx)(r.r,{children:d.W[y].map(e=>(0,t.jsx)(r.T,{value:e,children:H(e)},e))})]})]})]}),w.length>1&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(o.f,{htmlFor:"notebook-tagset",children:S.notebooks.dialog.tagSetLabel}),(0,t.jsxs)(r.d,{value:v,onValueChange:N,children:[(0,t.jsx)(r.P,{id:"notebook-tagset",children:(0,t.jsx)(r.U,{})}),(0,t.jsx)(r.r,{children:w.map(e=>(0,t.jsx)(r.T,{value:e,children:"default"===e?S.notebooks.dialog.tagSetDefault||"Built-in":S.notebooks.dialog.tagSetNames?.[e]||e},e))})]})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:S.notebooks.dialog.scopeHint}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(o.f,{htmlFor:"name",children:S.notebooks?.dialog?.nameLabel||"Notebook Name"}),(0,t.jsx)(n.f,{id:"name",placeholder:S.notebooks?.dialog?.placeholder||"e.g. Math, Physics, Chemistry...",value:b,onChange:e=>f(e.target.value),onKeyDown:e=>"Enter"===e.key&&V()})]})]}),(0,t.jsxs)(a.c,{children:[(0,t.jsx)(i.f,{variant:"outline",onClick:()=>h(!1),children:S.common.cancel}),(0,t.jsx)(i.f,{onClick:V,disabled:M||!b.trim(),children:M?S.notebooks?.dialog?.creating||"Creating...":S.notebooks?.dialog?.create||"Create"})]})]})})}])},709830,76824,e=>{var t=e.i(843476),s=e.i(111110),a=e.i(952122);let i=["primary","junior_high","senior_high"],n="primary",o=["math","english","chinese","physics","chemistry","biology","history","geography","politics"];function r(e){return"string"==typeof e&&o.includes(e)}function l(e){var t;let s=r(e.subjectKey)?e.subjectKey:(0,a.f)(e.name);return{stage:"string"==typeof(t=e.stage)&&i.includes(t)?e.stage:n,subject:s&&r(s)?s:null}}function c(){let{t:e}=(0,s.b)();return{stageLabel:t=>({primary:e.auth.primary,junior_high:e.auth.juniorHigh,senior_high:e.auth.seniorHigh})[t],subjectLabel:t=>e.tags.subjects[t]}}e.s(["j",0,n,"c",0,i,"W",0,{primary:["math","english","chinese"],junior_high:o,senior_high:o},"v",0,l],76824),e.s(["E",0,function({notebook:e,className:s}){let{stageLabel:a,subjectLabel:i}=c(),n=l(e);return(0,t.jsxs)("span",{className:s,children:[a(n.stage),n.subject?` \xb7 ${i(n.subject)}`:""]})},"O",0,c],709830)},590546,e=>{var t=e.i(843476),s=e.i(618566),a=e.i(519455),i=e.i(711241);e.s(["f",0,function({fallbackUrl:e,className:n}){let o=(0,s.useRouter)();return(0,t.jsx)(a.f,{variant:"ghost",size:"icon",onClick:()=>{o.push(e)},className:n,children:(0,t.jsx)(i.f,{className:"h-5 w-5"})})}])},912505,e=>{var t=e.i(843476),s=e.i(975157);e.s(["f",0,function({icon:e,title:a,description:i,action:n,className:o}){return(0,t.jsxs)("div",{className:(0,s.f)("flex flex-col items-center justify-center rounded-2xl border border-dashed bg-card/50 px-6 py-14 text-center",o),children:[(0,t.jsx)("div",{className:"mb-4 flex h-14 w-14 items-center justify-center rounded-2xl bg-accent text-accent-foreground",children:(0,t.jsx)(e,{className:"h-7 w-7"})}),(0,t.jsx)("p",{className:"font-medium",children:a}),i&&(0,t.jsx)("p",{className:"mt-1 max-w-sm text-sm text-muted-foreground",children:i}),n&&(0,t.jsx)("div",{className:"mt-5",children:n})]})}])},393842,e=>{var t=e.i(843476),s=e.i(590546),a=e.i(975157);e.s(["f",0,function({title:e,description:i,backHref:n,actions:o,titleAddon:r,className:l}){return(0,t.jsxs)("div",{className:(0,a.f)("flex items-start gap-3",l),children:[n&&(0,t.jsx)(s.f,{fallbackUrl:n,className:"-ml-2 shrink-0"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("h1",{className:"truncate text-2xl font-bold tracking-tight sm:text-3xl",children:e}),r]}),i&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground sm:text-base",children:i})]}),o&&(0,t.jsx)("div",{className:"flex shrink-0 items-center gap-2",children:o})]})}])},86963,e=>{var t=e.i(843476),s=e.i(632781);e.s(["f",0,function({label:e}){return(0,t.jsxs)("div",{className:"flex min-h-[50vh] flex-col items-center justify-center gap-3 text-muted-foreground",children:[(0,t.jsx)(s.f,{className:"h-7 w-7 animate-spin text-primary"}),e&&(0,t.jsx)("p",{className:"text-sm",children:e})]})}])},952122,e=>{e.i(306831),e.s(["f",0,function(e){if(!e)return null;let t=e.toLowerCase();return t.includes("math")||t.includes("数学")?"math":t.includes("physics")||t.includes("物理")?"physics":t.includes("chemistry")||t.includes("化学")?"chemistry":t.includes("biology")||t.includes("生物")?"biology":t.includes("english")||t.includes("英语")?"english":t.includes("chinese")||t.includes("语文")?"chinese":t.includes("history")||t.includes("历史")?"history":t.includes("geography")||t.includes("地理")?"geography":t.includes("politics")||t.includes("政治")?"politics":null}])},35209,e=>{var t=e.i(271645),s=e.i(111110);e.s(["f",0,function(...e){let{t:a}=(0,s.b)(),i=[a.pageTitle.base,...e.map(e=>"string"==typeof e?e.trim():"").filter(e=>e.length>0)].join("-");(0,t.useEffect)(()=>{document.title=i},[i])}])},833547,747279,e=>{var t=e.i(41931);async function s(e){try{return(await t.k.get(`/api/error-items/short/${encodeURIComponent(e)}`)).id}catch{return null}}e.s(["f",0,s],833547);let a=RegExp("^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]{6}$");e.s(["f",0,function(e){return"string"==typeof e&&a.test(e)}],747279)}])})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,218964,e=>{var t=e.i(456420);let s={name:"list-checks",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"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]]};s.node;let a=(0,t.f)(s);e.s(["f",0,a],218964)},856522,e=>{var t=e.i(456420);let s={name:"save",size:24,node:[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]};s.node;let a=(0,t.f)(s);e.s(["f",0,a],856522)},328623,e=>{var t=e.i(456420);let s={name:"sparkles",size:24,node:[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],aliases:["stars"]};s.node;let a=(0,t.f)(s);e.s(["f",0,a],328623)},697886,e=>{var t=e.i(456420);let s={name:"target",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]};s.node;let a=(0,t.f)(s);e.s(["f",0,a],697886)},952683,e=>{var t=e.i(843476),s=e.i(271645),a=e.i(618566),i=e.i(518515),n=e.i(325597),l=e.i(328623),r=e.i(747819),o=e.i(866531),c=e.i(515288),d=e.i(519455),u=e.i(624687),m=e.i(110204),h=e.i(856522),x=e.i(632781),f=e.i(772382),p=e.i(7891),p=p,g=e.i(395925),v=e.i(111110),y=e.i(511445),b=e.i(574041),j=e.i(438465),w=e.i(674166),k=e.i(967489),N=e.i(952122),S=e.i(294114);function C({onSubmit:e,defaultNotebookId:a,defaultNotebookName:i,isSaving:l}){let{t:r}=(0,v.b)(),[o,E]=(0,s.useState)(null),[A,T]=(0,s.useState)(""),[I,z]=(0,s.useState)(""),[P,$]=(0,s.useState)(""),[M,H]=(0,s.useState)(""),[q,D]=(0,s.useState)(""),[L,_]=(0,s.useState)("unknown"),[R,B]=(0,s.useState)([]),[F,U]=(0,s.useState)(a||""),[V,K]=(0,s.useState)(""),[W,O]=(0,s.useState)(""),Q=async()=>{if(A.trim()){if(!F)return void S.c.warning(r.editor.messages?.selectNotebook||"Please select a notebook");await e({questionText:A.trim(),answerText:I.trim(),analysis:P.trim(),wrongAnswerText:M.trim(),mistakeAnalysis:q.trim(),mistakeStatus:L,knowledgePoints:R,subjectId:F,gradeSemester:V||void 0,paperLevel:W||void 0})}},G=e=>{(e.ctrlKey||e.metaKey)&&"Enter"===e.key&&(e.preventDefault(),A.trim()&&F&&!l&&Q())},X=[{key:"question",label:r.editor?.question||"Question Text",value:A,setter:T,placeholder:r.directEntry.questionPlaceholder,minHeight:"min-h-[180px]",required:!0},{key:"answer",label:r.editor?.answer||"Answer",value:I,setter:z,placeholder:r.directEntry.answerPlaceholder,minHeight:"min-h-[120px]"},{key:"analysis",label:r.editor?.analysis||"Analysis / Explanation",value:P,setter:$,placeholder:r.directEntry.analysisPlaceholder,minHeight:"min-h-[150px]"},{key:"wrongAnswer",label:r.editor?.wrongAnswerText||"Wrong Answer / Work",value:M,setter:H,placeholder:r.directEntry.wrongAnswerPlaceholder,minHeight:"min-h-[100px]"},{key:"mistakeAnalysis",label:r.editor?.mistakeAnalysis||"Mistake Cause Analysis",value:q,setter:D,placeholder:r.directEntry.mistakeAnalysisPlaceholder,minHeight:"min-h-[100px]"}];return(0,t.jsx)(c.N,{className:"rounded-2xl",children:(0,t.jsxs)(c.O,{className:"p-6 space-y-5",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(n.f,{className:"h-5 w-5"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:r.directEntry.title})]}),(0,t.jsxs)(d.f,{variant:"ghost",size:"sm",onClick:()=>{T(""),z(""),$(""),H(""),D(""),_("unknown"),B([]),K(""),O("")},disabled:l,className:"text-muted-foreground hover:text-destructive",children:[(0,t.jsx)(g.f,{className:"h-4 w-4 mr-1"}),r.directEntry.reset]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)(m.f,{children:[r.editor?.selectNotebook||"Select Notebook"," *"]}),(0,t.jsx)(j.f,{value:F,onChange:U})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(m.f,{children:r.editor?.gradeSemester||"Grade/Semester"}),(0,t.jsx)("input",{type:"text",value:V,onChange:e=>K(e.target.value),placeholder:r.directEntry.gradeSemesterPlaceholder,className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(m.f,{children:r.editor?.paperLevel||"Paper Level"}),(0,t.jsx)(w.f,{value:W,onChange:O})]})]}),X.map(e=>(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)(m.f,{className:e.required?"text-primary font-semibold":"",children:[e.label," ",e.required&&"*"]}),(0,t.jsx)(d.f,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>E(o===e.key?null:e.key),disabled:!e.value,children:o===e.key?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.f,{className:"h-3 w-3 mr-1"}),r.directEntry.edit]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f.f,{className:"h-3 w-3 mr-1"}),r.directEntry.preview]})})]}),o===e.key?(0,t.jsx)("div",{className:`rounded-md border bg-muted/30 p-4 ${e.minHeight} overflow-auto cursor-pointer`,onClick:()=>E(null),children:(0,t.jsx)(y.f,{content:e.value})}):(0,t.jsx)(u.f,{value:e.value,onChange:t=>e.setter(t.target.value),onKeyDown:G,placeholder:e.placeholder,className:`${e.minHeight} font-mono text-sm resize-y`,disabled:l})]},e.key)),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(m.f,{children:r.editor?.mistakeStatus||"Attempt Status"}),(0,t.jsxs)(k.d,{value:L,onValueChange:e=>_(e),children:[(0,t.jsx)(k.P,{className:"w-[200px]",children:(0,t.jsx)(k.U,{})}),(0,t.jsxs)(k.r,{children:[(0,t.jsx)(k.T,{value:"not_attempted",children:r.editor?.mistakeStatuses?.notAttempted||"Not attempted"}),(0,t.jsx)(k.T,{value:"wrong_attempt",children:r.editor?.mistakeStatuses?.wrongAttempt||"Wrong attempt"}),(0,t.jsx)(k.T,{value:"unknown",children:r.editor?.mistakeStatuses?.unknown||"Unknown"})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(m.f,{children:r.editor?.tags||"Knowledge Points (Press Enter to add)"}),(0,t.jsx)(b.f,{value:R,onChange:B,placeholder:r.editor?.tagsPlaceholder||"Enter knowledge tags, select from suggestions...",enterHint:r.editor?.createTagHint,subject:(0,N.f)(i||null)||void 0}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:r.editor?.tagsHint||"💡 Tag suggestions will appear as you type"})]}),(0,t.jsxs)("div",{className:"flex flex-col items-center gap-2 pt-2",children:[(0,t.jsx)(d.f,{onClick:Q,disabled:!A.trim()||!F||l,className:"w-full bg-gradient-to-r from-indigo-600 to-violet-500 hover:from-indigo-700 hover:to-violet-600 text-white font-medium",size:"lg",children:l?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}),r.directEntry.saving]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.f,{className:"mr-2 h-4 w-4"}),r.directEntry.save]})}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground text-center",children:r.directEntry.hint})]})]})})}var E=e.i(522016),A=e.i(217255),T=e.i(856423),I=e.i(975153),z=e.i(218964),P=e.i(697886);let $=()=>()=>{};function M({href:e,icon:s,label:a,value:i}){return(0,t.jsxs)(E.default,{href:e,className:"rounded-xl bg-white/15 px-4 py-3 backdrop-blur-sm transition-colors hover:bg-white/20",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-white/75",children:[(0,t.jsx)(s,{className:"h-3.5 w-3.5 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:a})]}),(0,t.jsx)("div",{className:"mt-1 text-2xl font-bold tabular-nums",children:i??"–"})]})}function H({notebookCount:e,itemCount:a,dueCount:i,targetNotebook:n}){let{t:l,language:r}=(0,v.b)(),{data:o}=(0,A.useSession)(),c=(0,s.useSyncExternalStore)($,()=>new Date().getHours(),()=>null),d=null===c?l.common.welcome.replace(/[,,\s]+$/,""):c<12?l.home.greetingMorning:c<18?l.home.greetingAfternoon:l.home.greetingEvening,u=o?.user?.name||o?.user?.email||"";return(0,t.jsxs)("section",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-indigo-600 via-indigo-500 to-violet-500 p-5 text-white shadow-lg shadow-indigo-500/20 md:p-7",children:[(0,t.jsx)("div",{className:"pointer-events-none absolute -right-10 -top-12 h-44 w-44 rounded-full bg-white/10 blur-2xl"}),(0,t.jsx)("div",{className:"pointer-events-none absolute -bottom-16 right-24 h-40 w-40 rounded-full bg-fuchsia-300/20 blur-2xl"}),(0,t.jsxs)("div",{className:"relative flex flex-col gap-5 md:flex-row md:items-end md:justify-between",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)("h1",{className:"text-xl font-bold tracking-tight md:text-2xl",children:[d,u&&`${"zh"===r?",":", "}${u}`]}),(0,t.jsx)("p",{className:"max-w-md text-sm text-white/80",children:l.home.heroSubtitle}),n&&(0,t.jsxs)("p",{className:"inline-flex items-center gap-1.5 rounded-full bg-white/15 px-3 py-1 text-xs font-medium",children:[(0,t.jsx)(P.f,{className:"h-3.5 w-3.5"}),l.home.targetNotebook.replace("{name}",n)]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-3 md:w-96",children:[(0,t.jsx)(M,{href:"/notebooks",icon:T.f,label:l.home.notebookCount,value:e}),(0,t.jsx)(M,{href:"/notebooks",icon:z.f,label:l.home.itemCount,value:a}),(0,t.jsx)(M,{href:"/review",icon:I.f,label:l.home.dueCount,value:i})]})]})]})}var q=e.i(12130),D=e.i(430634),L=e.i(717448),_=e.i(798469),R=e.i(86963),B=e.i(956738),F=e.i(185592),U=e.i(41931),V=e.i(201276),K=e.i(35209),W=e.i(267275);function O(){let{t:e}=(0,v.b)();(0,K.f)(e.pageTitle.home);let c=(0,a.useSearchParams)().get("notebook"),[d,u]=(0,s.useState)([]),[m,h]=(0,s.useState)(null),[x,f]=(0,s.useState)(null),[p,g]=(0,s.useState)("image"),y=c||m,b=y?d.find(e=>e.id===y):void 0,j=(0,W.f)({logPrefix:"[Home]",analyzeSubjectId:y,importSubjectId:c,textNotebook:b&&{id:b.id,name:b.name},onParsed:e=>{let t=e.subject&&d.find(t=>t.name.includes(e.subject)||e.subject.includes(t.name));t&&h(t.id)}});(0,s.useEffect)(()=>{U.f.get("/api/notebooks").then(e=>u(e)).catch(e=>V.V.error("[Home]","Failed to fetch notebooks",{error:e})),U.f.get("/api/review/due?pageSize=1").then(e=>f(e.total)).catch(e=>V.V.error("[Home]","Failed to fetch due reviews",{error:e}))},[]);let w=async e=>{j.setAnalysisStep("saving"),await j.saveQuestion({...e,wrongAnswerText:e.wrongAnswerText||null,mistakeAnalysis:e.mistakeAnalysis||null,mistakeStatus:e.mistakeStatus||"unknown",originalImageUrl:""}),j.setAnalysisStep("idle")},k=d.reduce((e,t)=>e+(t._count?.errorItems||0),0),N=[{value:"image",icon:i.f,label:e.app?.uploadImage||"Take Photo"},{value:"text",icon:l.f,label:e.app?.manualInput||"Manual Input"},{value:"direct",icon:n.f,label:e.app?.directInput||"Manual Entry"}];return(0,t.jsxs)("main",{className:"min-h-screen",children:[(0,t.jsx)(B.f,{status:j.analysisStep}),(0,t.jsxs)("div",{className:`mx-auto space-y-6 px-4 py-6 md:px-8 md:py-8 ${"review"===j.step?"max-w-6xl":"max-w-4xl"}`,children:["upload"===j.step&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(H,{notebookCount:d.length,itemCount:k,dueCount:x,targetNotebook:c?b?.name:void 0}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(F.f,{options:N,value:p,onChange:g}),j.lastImported&&(0,t.jsx)(D.f,{imported:j.lastImported,onDismiss:j.dismissImported}),j.batchBlobs?(0,t.jsx)(r.f,{blobs:j.batchBlobs,subjectId:c,timeout:j.aiTimeout,onClose:j.closeBatch}):"image"===p?(0,t.jsx)(_.f,{onImageSelect:j.selectImage,isAnalyzing:j.isBusy}):"text"===p?(0,t.jsx)(L.f,{onSubmit:j.submitText,isAnalyzing:j.isBusy,defaultNotebookName:b?.name}):(0,t.jsx)(C,{onSubmit:w,defaultNotebookId:y||void 0,defaultNotebookName:b?.name,isSaving:"saving"===j.analysisStep})]})]}),j.croppingImage&&(0,t.jsx)(q.f,{imageSrc:j.croppingImage,open:j.isCropperOpen,onClose:j.closeCropper,onCropComplete:j.cropComplete,onMultiCropComplete:j.startBatch}),"review"===j.step&&j.parsedData&&(0,t.jsx)(o.f,{initialData:j.parsedData,onSave:j.saveReviewed,onCancel:j.cancelReview,imagePreview:j.currentImage,initialSubjectId:y||void 0,aiTimeout:j.aiTimeout})]})]})}e.s(["default",0,function(){return(0,t.jsx)(s.Suspense,{fallback:(0,t.jsx)(R.f,{}),children:(0,t.jsx)(O,{})})}],952683)},469937,62825,e=>{var t=e.i(843476),s=e.i(456420);let a={name:"star",size:24,node:[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]};a.node;let i=(0,s.f)(a);var n=e.i(111110),l=e.i(975157);let r=[1,2,3,4,5];function o(e){return"not_attempted"===e||"wrong_attempt"===e||"unknown"===e?e:"unknown"}e.s(["f",0,function({value:e,onChange:s,disabled:a,size:o="sm",showUnrated:c=!0,className:d}){let{t:u}=(0,n.b)(),m=e??0,h="sm"===o?"h-3.5 w-3.5":"h-5 w-5",x=m?u.difficulty.starsLabel.replace("{n}",String(m)):u.difficulty.unrated;return s?(0,t.jsxs)("span",{className:(0,l.f)("inline-flex items-center gap-0.5",d),role:"group","aria-label":`${u.difficulty.label}${u.common.colon}${x}`,title:u.difficulty.clearHint,children:[r.map(e=>(0,t.jsx)("button",{type:"button",disabled:a,onClick:()=>s(e===m?null:e),"aria-label":u.difficulty.setStars.replace("{n}",String(e)),"aria-pressed":e<=m,className:"rounded p-0.5 hover:bg-muted disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:(0,t.jsx)(i,{className:(0,l.f)(h,e<=m?"fill-amber-400 text-amber-400":"text-muted-foreground/40")})},e)),!m&&c&&(0,t.jsx)("span",{className:"ml-1 text-xs text-muted-foreground",children:u.difficulty.unrated})]}):m?(0,t.jsx)("span",{className:(0,l.f)("inline-flex items-center",d),role:"img","aria-label":`${u.difficulty.label}${u.common.colon}${x}`,title:x,children:r.map(e=>(0,t.jsx)(i,{className:(0,l.f)(h,e<=m?"fill-amber-400 text-amber-400":"text-muted-foreground/30"),"aria-hidden":!0},e))}):c?(0,t.jsx)("span",{className:(0,l.f)("text-xs text-muted-foreground",d),children:u.difficulty.unrated}):null}],469937),e.s(["i",0,function(e,t="zh"){return("en"===t?{not_attempted:"Not attempted",wrong_attempt:"Wrong attempt",unknown:"Unknown"}:{not_attempted:"不会做",wrong_attempt:"做错了",unknown:"未判断"})[o(e)]},"h",0,o,"x",0,function(e,t){return(t||"").trim()?"wrong_attempt":o(e)}],62825)},149704,e=>{var t=e.i(843476),s=e.i(111110),a=e.i(398019),i=e.i(184110),n=e.i(975157);let l={left:"mr-auto",center:"mx-auto",right:"ml-auto"};e.s(["f",0,function({svg:e,scale:r,align:o,className:c}){let{t:d}=(0,s.b)();if(!e)return null;let u=(0,i.V)(r),m=(0,i.o)(o);return(0,t.jsx)("figure",{className:(0,n.f)("question-figure my-3",c),children:(0,t.jsx)("img",{src:(0,a.f)(e),alt:d.figure.alt,className:(0,n.f)(l[m],"block h-auto max-w-full rounded border bg-white p-2"),style:{..."left"===m?{marginLeft:0,marginRight:"auto"}:"right"===m?{marginLeft:"auto",marginRight:0}:{},maxHeight:360,zoom:u/100,maxWidth:`${Math.min(u,100)}%`}})})}])},574041,e=>{var t=e.i(843476),s=e.i(271645),a=e.i(263676),i=e.i(487486),n=e.i(793479),l=e.i(41931),r=e.i(201276);e.s(["f",0,function({value:e=[],onChange:o,placeholder:c="Enter tags...",className:d="",enterHint:u,subject:m,gradeStage:h}){let[x,f]=(0,s.useState)(""),[p,g]=(0,s.useState)([]),[v,y]=(0,s.useState)(!1),[b,j]=(0,s.useState)(0),w=(0,s.useRef)(null),k=(0,s.useRef)(null),N=(0,s.useCallback)(async t=>{try{let s=new URLSearchParams({q:t});m&&s.append("subject",m),h&&s.append("stage",h);let a=((await l.f.get(`/api/tags/suggestions?${s.toString()}`)).suggestions||[]).filter(t=>!e.includes(t));g(a.slice(0,20)),y(a.length>0),j(0)}catch(e){r.V.error("[TagInput]","Failed to fetch suggestions",{error:e})}},[m,h,e]);(0,s.useEffect)(()=>{x.trim()&&N(x)},[x,N]);let S=t=>{t.trim()&&!e.includes(t.trim())&&(o([...e,t.trim()]),f(""),g([]),y(!1),j(0))},C=t=>{o(e.filter(e=>e!==t))};return(0,s.useEffect)(()=>{let e=e=>{!k.current||k.current.contains(e.target)||w.current?.contains(e.target)||y(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,t.jsxs)("div",{className:`relative ${d}`,children:[(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 p-2 border rounded-lg bg-background min-h-[42px]",children:[e.map(e=>(0,t.jsxs)(i.f,{variant:"secondary",className:"flex items-center gap-1 px-2 py-1",children:[e,(0,t.jsx)("button",{type:"button",onClick:()=>C(e),className:"hover:text-destructive ml-1",children:(0,t.jsx)(a.X,{className:"h-3 w-3"})})]},e)),(0,t.jsx)(n.f,{ref:w,type:"text",value:x,onChange:e=>{f(e.target.value),e.target.value.trim()||(g([]),y(!1))},onKeyDown:t=>{"Enter"===t.key?(t.preventDefault(),b>=0&&p[b]?S(p[b]):x.trim()&&S(x)):"ArrowDown"===t.key?(t.preventDefault(),j(e=>Math.min(e+1,p.length-1))):"ArrowUp"===t.key?(t.preventDefault(),j(e=>Math.max(e-1,0))):"Escape"===t.key?(y(!1),j(0)):"Backspace"===t.key&&!x&&e.length>0&&C(e[e.length-1])},onFocus:()=>{p.length>0&&y(!0)},placeholder:0===e.length?c:"",className:"flex-1 min-w-[120px] border-none focus-visible:ring-0 focus-visible:ring-offset-0 h-8 px-0"})]}),v&&p.length>0&&(0,t.jsx)("div",{ref:k,className:"absolute z-50 w-full mt-1 bg-popover border rounded-md shadow-md max-h-48 overflow-y-auto",children:p.map((e,s)=>(0,t.jsx)("div",{className:`px-3 py-2 cursor-pointer hover:bg-accent ${s===b?"bg-accent":""}`,onClick:()=>S(e),onMouseEnter:()=>j(s),children:e},e))}),x&&!v&&(0,t.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:u?`${u} "${x}"`:`Press Enter to create "${x}"`})]})}])},86963,e=>{var t=e.i(843476),s=e.i(632781);e.s(["f",0,function({label:e}){return(0,t.jsxs)("div",{className:"flex min-h-[50vh] flex-col items-center justify-center gap-3 text-muted-foreground",children:[(0,t.jsx)(s.f,{className:"h-7 w-7 animate-spin text-primary"}),e&&(0,t.jsx)("p",{className:"text-sm",children:e})]})}])},184110,e=>{let t=["left","center","right"],s="center";function a(e){return"number"==typeof e&&Number.isInteger(e)&&e>=10&&e<=200}e.s(["E",0,s,"n",0,100,"j",0,t,"a",0,200,"_",0,10,"x",0,a,"o",0,function(e){return"string"==typeof e&&t.includes(e)?e:s},"V",0,function(e){return a(e)?e:100}])},398019,e=>{e.s(["f",0,function(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}])},952122,e=>{e.i(306831),e.s(["f",0,function(e){if(!e)return null;let t=e.toLowerCase();return t.includes("math")||t.includes("数学")?"math":t.includes("physics")||t.includes("物理")?"physics":t.includes("chemistry")||t.includes("化学")?"chemistry":t.includes("biology")||t.includes("生物")?"biology":t.includes("english")||t.includes("英语")?"english":t.includes("chinese")||t.includes("语文")?"chinese":t.includes("history")||t.includes("历史")?"history":t.includes("geography")||t.includes("地理")?"geography":t.includes("politics")||t.includes("政治")?"politics":null}])},35209,e=>{var t=e.i(271645),s=e.i(111110);e.s(["f",0,function(...e){let{t:a}=(0,s.b)(),i=[a.pageTitle.base,...e.map(e=>"string"==typeof e?e.trim():"").filter(e=>e.length>0)].join("-");(0,t.useEffect)(()=>{document.title=i},[i])}])}])})();
|
|
1
|
+
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,218964,e=>{var t=e.i(456420);let s={name:"list-checks",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"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]]};s.node;let a=(0,t.f)(s);e.s(["f",0,a],218964)},856522,e=>{var t=e.i(456420);let s={name:"save",size:24,node:[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]};s.node;let a=(0,t.f)(s);e.s(["f",0,a],856522)},328623,e=>{var t=e.i(456420);let s={name:"sparkles",size:24,node:[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],aliases:["stars"]};s.node;let a=(0,t.f)(s);e.s(["f",0,a],328623)},697886,e=>{var t=e.i(456420);let s={name:"target",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]};s.node;let a=(0,t.f)(s);e.s(["f",0,a],697886)},952683,e=>{var t=e.i(843476),s=e.i(271645),a=e.i(618566),i=e.i(518515),n=e.i(325597),l=e.i(328623),r=e.i(747819),o=e.i(866531),c=e.i(515288),d=e.i(519455),u=e.i(624687),m=e.i(110204),h=e.i(856522),x=e.i(632781),p=e.i(772382),f=e.i(7891),f=f,g=e.i(395925),v=e.i(111110),y=e.i(511445),b=e.i(574041),j=e.i(438465),w=e.i(674166),k=e.i(967489),N=e.i(952122),S=e.i(294114);function C({onSubmit:e,defaultNotebookId:a,defaultNotebookName:i,isSaving:l}){let{t:r}=(0,v.b)(),[o,E]=(0,s.useState)(null),[A,T]=(0,s.useState)(""),[I,z]=(0,s.useState)(""),[P,$]=(0,s.useState)(""),[M,H]=(0,s.useState)(""),[q,D]=(0,s.useState)(""),[L,_]=(0,s.useState)("unknown"),[R,B]=(0,s.useState)([]),[F,U]=(0,s.useState)(a||""),[V,K]=(0,s.useState)(""),[W,O]=(0,s.useState)(""),Q=async()=>{if(A.trim()){if(!F)return void S.c.warning(r.editor.messages?.selectNotebook||"Please select a notebook");await e({questionText:A.trim(),answerText:I.trim(),analysis:P.trim(),wrongAnswerText:M.trim(),mistakeAnalysis:q.trim(),mistakeStatus:L,knowledgePoints:R,subjectId:F,gradeSemester:V||void 0,paperLevel:W||void 0})}},G=e=>{(e.ctrlKey||e.metaKey)&&"Enter"===e.key&&(e.preventDefault(),A.trim()&&F&&!l&&Q())},X=[{key:"question",label:r.editor?.question||"Question Text",value:A,setter:T,placeholder:r.directEntry.questionPlaceholder,minHeight:"min-h-[180px]",required:!0},{key:"answer",label:r.editor?.answer||"Answer",value:I,setter:z,placeholder:r.directEntry.answerPlaceholder,minHeight:"min-h-[120px]"},{key:"analysis",label:r.editor?.analysis||"Analysis / Explanation",value:P,setter:$,placeholder:r.directEntry.analysisPlaceholder,minHeight:"min-h-[150px]"},{key:"wrongAnswer",label:r.editor?.wrongAnswerText||"Wrong Answer / Work",value:M,setter:H,placeholder:r.directEntry.wrongAnswerPlaceholder,minHeight:"min-h-[100px]"},{key:"mistakeAnalysis",label:r.editor?.mistakeAnalysis||"Mistake Cause Analysis",value:q,setter:D,placeholder:r.directEntry.mistakeAnalysisPlaceholder,minHeight:"min-h-[100px]"}];return(0,t.jsx)(c.N,{className:"rounded-2xl",children:(0,t.jsxs)(c.O,{className:"p-6 space-y-5",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,t.jsx)(n.f,{className:"h-5 w-5"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:r.directEntry.title})]}),(0,t.jsxs)(d.f,{variant:"ghost",size:"sm",onClick:()=>{T(""),z(""),$(""),H(""),D(""),_("unknown"),B([]),K(""),O("")},disabled:l,className:"text-muted-foreground hover:text-destructive",children:[(0,t.jsx)(g.f,{className:"h-4 w-4 mr-1"}),r.directEntry.reset]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)(m.f,{children:[r.editor?.selectNotebook||"Select Notebook"," *"]}),(0,t.jsx)(j.f,{value:F,onChange:U})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(m.f,{children:r.editor?.gradeSemester||"Grade/Semester"}),(0,t.jsx)("input",{type:"text",value:V,onChange:e=>K(e.target.value),placeholder:r.directEntry.gradeSemesterPlaceholder,className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(m.f,{children:r.editor?.paperLevel||"Paper Level"}),(0,t.jsx)(w.f,{value:W,onChange:O})]})]}),X.map(e=>(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)(m.f,{className:e.required?"text-primary font-semibold":"",children:[e.label," ",e.required&&"*"]}),(0,t.jsx)(d.f,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>E(o===e.key?null:e.key),disabled:!e.value,children:o===e.key?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(f.f,{className:"h-3 w-3 mr-1"}),r.directEntry.edit]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.f,{className:"h-3 w-3 mr-1"}),r.directEntry.preview]})})]}),o===e.key?(0,t.jsx)("div",{className:`rounded-md border bg-muted/30 p-4 ${e.minHeight} overflow-auto cursor-pointer`,onClick:()=>E(null),children:(0,t.jsx)(y.f,{content:e.value})}):(0,t.jsx)(u.f,{value:e.value,onChange:t=>e.setter(t.target.value),onKeyDown:G,placeholder:e.placeholder,className:`${e.minHeight} font-mono text-sm resize-y`,disabled:l})]},e.key)),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(m.f,{children:r.editor?.mistakeStatus||"Attempt Status"}),(0,t.jsxs)(k.d,{value:L,onValueChange:e=>_(e),children:[(0,t.jsx)(k.P,{className:"w-[200px]",children:(0,t.jsx)(k.U,{})}),(0,t.jsxs)(k.r,{children:[(0,t.jsx)(k.T,{value:"not_attempted",children:r.editor?.mistakeStatuses?.notAttempted||"Not attempted"}),(0,t.jsx)(k.T,{value:"wrong_attempt",children:r.editor?.mistakeStatuses?.wrongAttempt||"Wrong attempt"}),(0,t.jsx)(k.T,{value:"unknown",children:r.editor?.mistakeStatuses?.unknown||"Unknown"})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(m.f,{children:r.editor?.tags||"Knowledge Points (Press Enter to add)"}),(0,t.jsx)(b.f,{value:R,onChange:B,placeholder:r.editor?.tagsPlaceholder||"Enter knowledge tags, select from suggestions...",enterHint:r.editor?.createTagHint,subject:(0,N.f)(i||null)||void 0}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:r.editor?.tagsHint||"💡 Tag suggestions will appear as you type"})]}),(0,t.jsxs)("div",{className:"flex flex-col items-center gap-2 pt-2",children:[(0,t.jsx)(d.f,{onClick:Q,disabled:!A.trim()||!F||l,className:"w-full bg-gradient-to-r from-indigo-600 to-violet-500 hover:from-indigo-700 hover:to-violet-600 text-white font-medium",size:"lg",children:l?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}),r.directEntry.saving]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.f,{className:"mr-2 h-4 w-4"}),r.directEntry.save]})}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground text-center",children:r.directEntry.hint})]})]})})}var E=e.i(522016),A=e.i(217255),T=e.i(856423),I=e.i(975153),z=e.i(218964),P=e.i(697886);let $=()=>()=>{};function M({href:e,icon:s,label:a,value:i}){return(0,t.jsxs)(E.default,{href:e,className:"rounded-xl bg-white/15 px-4 py-3 backdrop-blur-sm transition-colors hover:bg-white/20",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-white/75",children:[(0,t.jsx)(s,{className:"h-3.5 w-3.5 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:a})]}),(0,t.jsx)("div",{className:"mt-1 text-2xl font-bold tabular-nums",children:i??"–"})]})}function H({notebookCount:e,itemCount:a,dueCount:i,targetNotebook:n}){let{t:l,language:r}=(0,v.b)(),{data:o}=(0,A.useSession)(),c=(0,s.useSyncExternalStore)($,()=>new Date().getHours(),()=>null),d=null===c?l.common.welcome.replace(/[,,\s]+$/,""):c<12?l.home.greetingMorning:c<18?l.home.greetingAfternoon:l.home.greetingEvening,u=o?.user?.name||o?.user?.email||"";return(0,t.jsxs)("section",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-indigo-600 via-indigo-500 to-violet-500 p-5 text-white shadow-lg shadow-indigo-500/20 md:p-7",children:[(0,t.jsx)("div",{className:"pointer-events-none absolute -right-10 -top-12 h-44 w-44 rounded-full bg-white/10 blur-2xl"}),(0,t.jsx)("div",{className:"pointer-events-none absolute -bottom-16 right-24 h-40 w-40 rounded-full bg-fuchsia-300/20 blur-2xl"}),(0,t.jsxs)("div",{className:"relative flex flex-col gap-5 md:flex-row md:items-end md:justify-between",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)("h1",{className:"text-xl font-bold tracking-tight md:text-2xl",children:[d,u&&`${"zh"===r?",":", "}${u}`]}),(0,t.jsx)("p",{className:"max-w-md text-sm text-white/80",children:l.home.heroSubtitle}),n&&(0,t.jsxs)("p",{className:"inline-flex items-center gap-1.5 rounded-full bg-white/15 px-3 py-1 text-xs font-medium",children:[(0,t.jsx)(P.f,{className:"h-3.5 w-3.5"}),l.home.targetNotebook.replace("{name}",n)]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-3 md:w-96",children:[(0,t.jsx)(M,{href:"/notebooks",icon:T.f,label:l.home.notebookCount,value:e}),(0,t.jsx)(M,{href:"/notebooks",icon:z.f,label:l.home.itemCount,value:a}),(0,t.jsx)(M,{href:"/review",icon:I.f,label:l.home.dueCount,value:i})]})]})]})}var q=e.i(12130),D=e.i(430634),L=e.i(717448),_=e.i(798469),R=e.i(86963),B=e.i(956738),F=e.i(185592),U=e.i(41931),V=e.i(201276),K=e.i(35209),W=e.i(267275);function O(){let{t:e}=(0,v.b)();(0,K.f)(e.pageTitle.home);let c=(0,a.useSearchParams)().get("notebook"),[d,u]=(0,s.useState)([]),[m,h]=(0,s.useState)(null),[x,p]=(0,s.useState)(null),[f,g]=(0,s.useState)("image"),y=c||m,b=y?d.find(e=>e.id===y):void 0,j=(0,W.f)({logPrefix:"[Home]",analyzeSubjectId:y,importSubjectId:c,textNotebook:b&&{id:b.id,name:b.name},onParsed:e=>{let t=e.subject&&d.find(t=>t.name.includes(e.subject)||e.subject.includes(t.name));t&&h(t.id)}});(0,s.useEffect)(()=>{U.k.get("/api/notebooks").then(e=>u(e)).catch(e=>V.V.error("[Home]","Failed to fetch notebooks",{error:e})),U.k.get("/api/review/due?pageSize=1").then(e=>p(e.total)).catch(e=>V.V.error("[Home]","Failed to fetch due reviews",{error:e}))},[]);let w=async e=>{j.setAnalysisStep("saving"),await j.saveQuestion({...e,wrongAnswerText:e.wrongAnswerText||null,mistakeAnalysis:e.mistakeAnalysis||null,mistakeStatus:e.mistakeStatus||"unknown",originalImageUrl:""}),j.setAnalysisStep("idle")},k=d.reduce((e,t)=>e+(t._count?.errorItems||0),0),N=[{value:"image",icon:i.f,label:e.app?.uploadImage||"Take Photo"},{value:"text",icon:l.f,label:e.app?.manualInput||"Manual Input"},{value:"direct",icon:n.f,label:e.app?.directInput||"Manual Entry"}];return(0,t.jsxs)("main",{className:"min-h-screen",children:[(0,t.jsx)(B.f,{status:j.analysisStep}),(0,t.jsxs)("div",{className:`mx-auto space-y-6 px-4 py-6 md:px-8 md:py-8 ${"review"===j.step?"max-w-6xl":"max-w-4xl"}`,children:["upload"===j.step&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(H,{notebookCount:d.length,itemCount:k,dueCount:x,targetNotebook:c?b?.name:void 0}),(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(F.f,{options:N,value:f,onChange:g}),j.lastImported&&(0,t.jsx)(D.f,{imported:j.lastImported,onDismiss:j.dismissImported}),j.batchBlobs?(0,t.jsx)(r.f,{blobs:j.batchBlobs,subjectId:c,timeout:j.aiTimeout,onClose:j.closeBatch}):"image"===f?(0,t.jsx)(_.f,{onImageSelect:j.selectImage,isAnalyzing:j.isBusy}):"text"===f?(0,t.jsx)(L.f,{onSubmit:j.submitText,isAnalyzing:j.isBusy,defaultNotebookName:b?.name}):(0,t.jsx)(C,{onSubmit:w,defaultNotebookId:y||void 0,defaultNotebookName:b?.name,isSaving:"saving"===j.analysisStep})]})]}),j.croppingImage&&(0,t.jsx)(q.f,{imageSrc:j.croppingImage,open:j.isCropperOpen,onClose:j.closeCropper,onCropComplete:j.cropComplete,onMultiCropComplete:j.startBatch}),"review"===j.step&&j.parsedData&&(0,t.jsx)(o.f,{initialData:j.parsedData,onSave:j.saveReviewed,onCancel:j.cancelReview,imagePreview:j.currentImage,initialSubjectId:y||void 0,aiTimeout:j.aiTimeout})]})]})}e.s(["default",0,function(){return(0,t.jsx)(s.Suspense,{fallback:(0,t.jsx)(R.f,{}),children:(0,t.jsx)(O,{})})}],952683)},469937,62825,e=>{var t=e.i(843476),s=e.i(456420);let a={name:"star",size:24,node:[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]};a.node;let i=(0,s.f)(a);var n=e.i(111110),l=e.i(975157);let r=[1,2,3,4,5];function o(e){return"not_attempted"===e||"wrong_attempt"===e||"unknown"===e?e:"unknown"}e.s(["f",0,function({value:e,onChange:s,disabled:a,size:o="sm",showUnrated:c=!0,className:d}){let{t:u}=(0,n.b)(),m=e??0,h="sm"===o?"h-3.5 w-3.5":"h-5 w-5",x=m?u.difficulty.starsLabel.replace("{n}",String(m)):u.difficulty.unrated;return s?(0,t.jsxs)("span",{className:(0,l.f)("inline-flex items-center gap-0.5",d),role:"group","aria-label":`${u.difficulty.label}${u.common.colon}${x}`,title:u.difficulty.clearHint,children:[r.map(e=>(0,t.jsx)("button",{type:"button",disabled:a,onClick:()=>s(e===m?null:e),"aria-label":u.difficulty.setStars.replace("{n}",String(e)),"aria-pressed":e<=m,className:"rounded p-0.5 hover:bg-muted disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:(0,t.jsx)(i,{className:(0,l.f)(h,e<=m?"fill-amber-400 text-amber-400":"text-muted-foreground/40")})},e)),!m&&c&&(0,t.jsx)("span",{className:"ml-1 text-xs text-muted-foreground",children:u.difficulty.unrated})]}):m?(0,t.jsx)("span",{className:(0,l.f)("inline-flex items-center",d),role:"img","aria-label":`${u.difficulty.label}${u.common.colon}${x}`,title:x,children:r.map(e=>(0,t.jsx)(i,{className:(0,l.f)(h,e<=m?"fill-amber-400 text-amber-400":"text-muted-foreground/30"),"aria-hidden":!0},e))}):c?(0,t.jsx)("span",{className:(0,l.f)("text-xs text-muted-foreground",d),children:u.difficulty.unrated}):null}],469937),e.s(["i",0,function(e,t="zh"){return("en"===t?{not_attempted:"Not attempted",wrong_attempt:"Wrong attempt",unknown:"Unknown"}:{not_attempted:"不会做",wrong_attempt:"做错了",unknown:"未判断"})[o(e)]},"h",0,o,"x",0,function(e,t){return(t||"").trim()?"wrong_attempt":o(e)}],62825)},149704,e=>{var t=e.i(843476),s=e.i(111110),a=e.i(398019),i=e.i(184110),n=e.i(975157);let l={left:"mr-auto",center:"mx-auto",right:"ml-auto"};e.s(["f",0,function({svg:e,scale:r,align:o,className:c}){let{t:d}=(0,s.b)();if(!e)return null;let u=(0,i.V)(r),m=(0,i.o)(o);return(0,t.jsx)("figure",{className:(0,n.f)("question-figure my-3",c),children:(0,t.jsx)("img",{src:(0,a.f)(e),alt:d.figure.alt,className:(0,n.f)(l[m],"block h-auto max-w-full rounded border bg-white p-2"),style:{..."left"===m?{marginLeft:0,marginRight:"auto"}:"right"===m?{marginLeft:"auto",marginRight:0}:{},maxHeight:360,zoom:u/100,maxWidth:`${Math.min(u,100)}%`}})})}])},574041,e=>{var t=e.i(843476),s=e.i(271645),a=e.i(263676),i=e.i(487486),n=e.i(793479),l=e.i(41931),r=e.i(201276);e.s(["f",0,function({value:e=[],onChange:o,placeholder:c="Enter tags...",className:d="",enterHint:u,subject:m,gradeStage:h}){let[x,p]=(0,s.useState)(""),[f,g]=(0,s.useState)([]),[v,y]=(0,s.useState)(!1),[b,j]=(0,s.useState)(0),w=(0,s.useRef)(null),k=(0,s.useRef)(null),N=(0,s.useCallback)(async t=>{try{let s=new URLSearchParams({q:t});m&&s.append("subject",m),h&&s.append("stage",h);let a=((await l.k.get(`/api/tags/suggestions?${s.toString()}`)).suggestions||[]).filter(t=>!e.includes(t));g(a.slice(0,20)),y(a.length>0),j(0)}catch(e){r.V.error("[TagInput]","Failed to fetch suggestions",{error:e})}},[m,h,e]);(0,s.useEffect)(()=>{x.trim()&&N(x)},[x,N]);let S=t=>{t.trim()&&!e.includes(t.trim())&&(o([...e,t.trim()]),p(""),g([]),y(!1),j(0))},C=t=>{o(e.filter(e=>e!==t))};return(0,s.useEffect)(()=>{let e=e=>{!k.current||k.current.contains(e.target)||w.current?.contains(e.target)||y(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,t.jsxs)("div",{className:`relative ${d}`,children:[(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 p-2 border rounded-lg bg-background min-h-[42px]",children:[e.map(e=>(0,t.jsxs)(i.f,{variant:"secondary",className:"flex items-center gap-1 px-2 py-1",children:[e,(0,t.jsx)("button",{type:"button",onClick:()=>C(e),className:"hover:text-destructive ml-1",children:(0,t.jsx)(a.X,{className:"h-3 w-3"})})]},e)),(0,t.jsx)(n.f,{ref:w,type:"text",value:x,onChange:e=>{p(e.target.value),e.target.value.trim()||(g([]),y(!1))},onKeyDown:t=>{"Enter"===t.key?(t.preventDefault(),b>=0&&f[b]?S(f[b]):x.trim()&&S(x)):"ArrowDown"===t.key?(t.preventDefault(),j(e=>Math.min(e+1,f.length-1))):"ArrowUp"===t.key?(t.preventDefault(),j(e=>Math.max(e-1,0))):"Escape"===t.key?(y(!1),j(0)):"Backspace"===t.key&&!x&&e.length>0&&C(e[e.length-1])},onFocus:()=>{f.length>0&&y(!0)},placeholder:0===e.length?c:"",className:"flex-1 min-w-[120px] border-none focus-visible:ring-0 focus-visible:ring-offset-0 h-8 px-0"})]}),v&&f.length>0&&(0,t.jsx)("div",{ref:k,className:"absolute z-50 w-full mt-1 bg-popover border rounded-md shadow-md max-h-48 overflow-y-auto",children:f.map((e,s)=>(0,t.jsx)("div",{className:`px-3 py-2 cursor-pointer hover:bg-accent ${s===b?"bg-accent":""}`,onClick:()=>S(e),onMouseEnter:()=>j(s),children:e},e))}),x&&!v&&(0,t.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:u?`${u} "${x}"`:`Press Enter to create "${x}"`})]})}])},86963,e=>{var t=e.i(843476),s=e.i(632781);e.s(["f",0,function({label:e}){return(0,t.jsxs)("div",{className:"flex min-h-[50vh] flex-col items-center justify-center gap-3 text-muted-foreground",children:[(0,t.jsx)(s.f,{className:"h-7 w-7 animate-spin text-primary"}),e&&(0,t.jsx)("p",{className:"text-sm",children:e})]})}])},184110,e=>{let t=["left","center","right"],s="center";function a(e){return"number"==typeof e&&Number.isInteger(e)&&e>=10&&e<=200}e.s(["E",0,s,"n",0,100,"j",0,t,"a",0,200,"_",0,10,"x",0,a,"o",0,function(e){return"string"==typeof e&&t.includes(e)?e:s},"V",0,function(e){return a(e)?e:100}])},398019,e=>{e.s(["f",0,function(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}])},952122,e=>{e.i(306831),e.s(["f",0,function(e){if(!e)return null;let t=e.toLowerCase();return t.includes("math")||t.includes("数学")?"math":t.includes("physics")||t.includes("物理")?"physics":t.includes("chemistry")||t.includes("化学")?"chemistry":t.includes("biology")||t.includes("生物")?"biology":t.includes("english")||t.includes("英语")?"english":t.includes("chinese")||t.includes("语文")?"chinese":t.includes("history")||t.includes("历史")?"history":t.includes("geography")||t.includes("地理")?"geography":t.includes("politics")||t.includes("政治")?"politics":null}])},35209,e=>{var t=e.i(271645),s=e.i(111110);e.s(["f",0,function(...e){let{t:a}=(0,s.b)(),i=[a.pageTitle.base,...e.map(e=>"string"==typeof e?e.trim():"").filter(e=>e.length>0)].join("-");(0,t.useEffect)(()=>{document.title=i},[i])}])}])})();
|