wrong-notebook 2026.11.10 → 2026.11.11-2
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 +5 -0
- package/.next/build-manifest.json +14 -3
- package/.next/prerender-manifest.json +3 -3
- package/.next/routes-manifest.json +35 -0
- package/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/admin/page.js.nft.json +1 -1
- package/.next/server/app/admin/page_client-reference-manifest.js +1 -1
- package/.next/server/app/admin/user/[id]/page.js.nft.json +1 -1
- package/.next/server/app/admin/user/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/api/admin/cnm-tags/route.js +1 -1
- package/.next/server/app/api/admin/cnm-tags/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/dashboard/route.js +3 -3
- package/.next/server/app/api/admin/dashboard/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/debug-logs/export/route.js +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 +1 -1
- package/.next/server/app/api/admin/debug-logs/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/eula/accept/route.js +1 -1
- package/.next/server/app/api/admin/eula/accept/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/migrate-tags/route.js +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 +1 -1
- package/.next/server/app/api/admin/system-reset/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/telemetry/route.js +1 -1
- package/.next/server/app/api/admin/telemetry/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/users/[id]/detail/route.js +3 -3
- 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 +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 +1 -1
- package/.next/server/app/api/admin/users/route.js.nft.json +1 -1
- package/.next/server/app/api/ai/models/route.js +3 -3
- package/.next/server/app/api/ai/models/route.js.nft.json +1 -1
- package/.next/server/app/api/ai/test/route.js +3 -3
- package/.next/server/app/api/ai/test/route.js.nft.json +1 -1
- package/.next/server/app/api/analytics/route.js +3 -3
- package/.next/server/app/api/analytics/route.js.nft.json +1 -1
- package/.next/server/app/api/analyze/route.js +3 -3
- package/.next/server/app/api/analyze/route.js.nft.json +1 -1
- package/.next/server/app/api/auth/[...nextauth]/route.js +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 +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 +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +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 +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 +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 +3 -3
- 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 +3 -3
- 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 +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 +3 -3
- 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 +3 -3
- package/.next/server/app/api/error-items/[id]/svg-animation/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/answer-space/route.js +1 -1
- package/.next/server/app/api/error-items/answer-space/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/batch-delete/route.js +1 -1
- package/.next/server/app/api/error-items/batch-delete/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/batch-move/route.js +1 -1
- package/.next/server/app/api/error-items/batch-move/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/clear/route.js +1 -1
- package/.next/server/app/api/error-items/clear/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/export-questions/route.js +1 -1
- package/.next/server/app/api/error-items/export-questions/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/list/route.js +8 -7
- package/.next/server/app/api/error-items/list/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/route.js +3 -3
- package/.next/server/app/api/error-items/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/short/[shortId]/route.js +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 +1 -1
- package/.next/server/app/api/error-items/similarity/route.js.nft.json +1 -1
- package/.next/server/app/api/eula/status/route.js +1 -1
- package/.next/server/app/api/eula/status/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/questions/[questionId]/regenerate/route.js +3 -3
- 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 +3 -3
- package/.next/server/app/api/exams/[id]/results/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/retry/route.js +3 -3
- package/.next/server/app/api/exams/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/route.js +3 -3
- package/.next/server/app/api/exams/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/route.js +3 -3
- package/.next/server/app/api/exams/route.js.nft.json +1 -1
- package/.next/server/app/api/export/route.js +7 -7
- package/.next/server/app/api/export/route.js.nft.json +1 -1
- package/.next/server/app/api/geogebra-analyze/route.js +3 -3
- package/.next/server/app/api/geogebra-analyze/route.js.nft.json +1 -1
- package/.next/server/app/api/health/route.js.nft.json +1 -1
- package/.next/server/app/api/import/route.js +17 -17
- package/.next/server/app/api/import/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/confirm-all/route.js +19 -19
- package/.next/server/app/api/import-batches/[id]/confirm-all/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/fix-text/route.js +3 -3
- package/.next/server/app/api/import-batches/[id]/fix-text/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/read/route.js +20 -20
- package/.next/server/app/api/import-batches/[id]/read/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/retry/route.js +19 -19
- package/.next/server/app/api/import-batches/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/route.js +20 -20
- package/.next/server/app/api/import-batches/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/[id]/start/route.js +20 -20
- package/.next/server/app/api/import-batches/[id]/start/route.js.nft.json +1 -1
- package/.next/server/app/api/import-batches/route.js +20 -20
- package/.next/server/app/api/import-batches/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/confirm/route.js +19 -19
- package/.next/server/app/api/import-tasks/[id]/confirm/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/read/route.js +19 -19
- package/.next/server/app/api/import-tasks/[id]/read/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/retry/route.js +20 -20
- package/.next/server/app/api/import-tasks/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/[id]/route.js +19 -19
- package/.next/server/app/api/import-tasks/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/import-tasks/route.js +20 -20
- package/.next/server/app/api/import-tasks/route.js.nft.json +1 -1
- package/.next/server/app/api/initialize/route.js +2 -2
- package/.next/server/app/api/initialize/route.js.nft.json +1 -1
- package/.next/server/app/api/logs/frontend/route.js +1 -1
- package/.next/server/app/api/logs/frontend/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/mcp/route/build-manifest.json +12 -0
- package/.next/server/app/api/mcp/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/mcp/route.js +33 -0
- package/.next/server/app/api/mcp/route.js.map +5 -0
- package/.next/server/app/api/mcp/route.js.nft.json +1 -0
- package/.next/server/app/api/mcp/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/minimax-code/checkin/route.js +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 +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 +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 +3 -3
- package/.next/server/app/api/notebooks/[id]/retag/route.js.nft.json +1 -1
- package/.next/server/app/api/notebooks/[id]/route.js +1 -1
- package/.next/server/app/api/notebooks/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/notebooks/route.js +1 -1
- package/.next/server/app/api/notebooks/route.js.nft.json +1 -1
- package/.next/server/app/api/openclaw/batch-upload/route.js +3 -3
- 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 +1 -1
- package/.next/server/app/api/paper-groups/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/generate/route.js +23 -17
- package/.next/server/app/api/practice/generate/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/grade/route.js +3 -3
- package/.next/server/app/api/practice/grade/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/record/[id]/route.js +3 -3
- package/.next/server/app/api/practice/record/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/record/route.js +3 -3
- package/.next/server/app/api/practice/record/route.js.nft.json +1 -1
- package/.next/server/app/api/question-banks/[id]/questions/[qid]/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/question-banks/[id]/questions/[qid]/route/build-manifest.json +12 -0
- package/.next/server/app/api/question-banks/[id]/questions/[qid]/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/question-banks/[id]/questions/[qid]/route.js +35 -0
- package/.next/server/app/api/question-banks/[id]/questions/[qid]/route.js.map +5 -0
- package/.next/server/app/api/question-banks/[id]/questions/[qid]/route.js.nft.json +1 -0
- package/.next/server/app/api/question-banks/[id]/questions/[qid]/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/question-banks/[id]/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/question-banks/[id]/route/build-manifest.json +12 -0
- package/.next/server/app/api/question-banks/[id]/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/question-banks/[id]/route.js +17 -0
- package/.next/server/app/api/question-banks/[id]/route.js.map +5 -0
- package/.next/server/app/api/question-banks/[id]/route.js.nft.json +1 -0
- package/.next/server/app/api/question-banks/[id]/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/question-banks/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/question-banks/route/build-manifest.json +12 -0
- package/.next/server/app/api/question-banks/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/question-banks/route.js +35 -0
- package/.next/server/app/api/question-banks/route.js.map +5 -0
- package/.next/server/app/api/question-banks/route.js.nft.json +1 -0
- package/.next/server/app/api/question-banks/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/reanswer/route.js +3 -3
- 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 +1 -1
- package/.next/server/app/api/requests/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/review/due/route.js +13 -13
- package/.next/server/app/api/review/due/route.js.nft.json +1 -1
- package/.next/server/app/api/settings/route.js +1 -1
- package/.next/server/app/api/settings/route.js.nft.json +1 -1
- package/.next/server/app/api/setup/route.js +1 -1
- package/.next/server/app/api/setup/route.js.nft.json +1 -1
- package/.next/server/app/api/stats/activity/route.js +1 -1
- package/.next/server/app/api/stats/activity/route.js.nft.json +1 -1
- package/.next/server/app/api/stats/practice/clear/route.js +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 +1 -1
- package/.next/server/app/api/stats/practice/route.js.nft.json +1 -1
- package/.next/server/app/api/stats/repeated-mistakes/route.js +3 -3
- package/.next/server/app/api/stats/repeated-mistakes/route.js.nft.json +1 -1
- package/.next/server/app/api/stats/weak-tags/route.js +16 -15
- package/.next/server/app/api/stats/weak-tags/route.js.nft.json +1 -1
- package/.next/server/app/api/tags/route.js +1 -1
- package/.next/server/app/api/tags/route.js.nft.json +1 -1
- package/.next/server/app/api/tags/stats/route.js +1 -1
- package/.next/server/app/api/tags/stats/route.js.nft.json +1 -1
- package/.next/server/app/api/tags/suggestions/route.js +1 -1
- package/.next/server/app/api/tags/suggestions/route.js.nft.json +1 -1
- package/.next/server/app/api/tasks/route.js +1 -1
- package/.next/server/app/api/tasks/route.js.nft.json +1 -1
- package/.next/server/app/api/telemetry/route.js.nft.json +1 -1
- package/.next/server/app/api/tts/[id]/route.js +1 -1
- package/.next/server/app/api/tts/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/tts/batch/route.js +1 -1
- package/.next/server/app/api/tts/batch/route.js.nft.json +1 -1
- package/.next/server/app/api/tts/route.js +1 -1
- package/.next/server/app/api/tts/route.js.nft.json +1 -1
- package/.next/server/app/api/tts/status/route.js +1 -1
- package/.next/server/app/api/tts/status/route.js.nft.json +1 -1
- package/.next/server/app/api/user/ai-consent/route.js +1 -1
- package/.next/server/app/api/user/ai-consent/route.js.nft.json +1 -1
- package/.next/server/app/api/user/route.js +3 -3
- package/.next/server/app/api/user/route.js.nft.json +1 -1
- package/.next/server/app/api/version/route.js.nft.json +1 -1
- package/.next/server/app/banks/page/app-paths-manifest.json +3 -0
- package/.next/server/app/banks/page/build-manifest.json +22 -0
- package/.next/server/app/banks/page/next-font-manifest.json +11 -0
- package/.next/server/app/banks/page/react-loadable-manifest.json +1 -0
- package/.next/server/app/banks/page/server-reference-manifest.json +4 -0
- package/.next/server/app/banks/page.js +15 -0
- package/.next/server/app/banks/page.js.map +5 -0
- package/.next/server/app/banks/page.js.nft.json +1 -0
- package/.next/server/app/banks/page_client-reference-manifest.js +3 -0
- package/.next/server/app/error-items/[id]/page.js.nft.json +1 -1
- package/.next/server/app/error-items/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/eula/page.js.nft.json +1 -1
- package/.next/server/app/eula/page_client-reference-manifest.js +1 -1
- package/.next/server/app/exams/[id]/page.js.nft.json +1 -1
- package/.next/server/app/exams/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/exams/[id]/print/page.js.nft.json +1 -1
- package/.next/server/app/exams/[id]/print/page_client-reference-manifest.js +1 -1
- package/.next/server/app/exams/page.js.nft.json +1 -1
- package/.next/server/app/exams/page_client-reference-manifest.js +1 -1
- package/.next/server/app/import-batches/[id]/page.js.nft.json +1 -1
- package/.next/server/app/import-batches/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/import-tasks/[id]/page.js.nft.json +1 -1
- package/.next/server/app/import-tasks/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/import-tasks/page.js.nft.json +1 -1
- package/.next/server/app/import-tasks/page_client-reference-manifest.js +1 -1
- package/.next/server/app/initialize/page.js.nft.json +1 -1
- package/.next/server/app/initialize/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login/page.js.nft.json +1 -1
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/notebooks/[id]/add/page.js.nft.json +1 -1
- package/.next/server/app/notebooks/[id]/add/page_client-reference-manifest.js +1 -1
- package/.next/server/app/notebooks/[id]/page.js.nft.json +1 -1
- package/.next/server/app/notebooks/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/notebooks/page.js.nft.json +1 -1
- package/.next/server/app/notebooks/page_client-reference-manifest.js +1 -1
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/practice/page.js.nft.json +1 -1
- package/.next/server/app/practice/page_client-reference-manifest.js +1 -1
- package/.next/server/app/print-preview/page.js.nft.json +1 -1
- package/.next/server/app/print-preview/page_client-reference-manifest.js +1 -1
- package/.next/server/app/register/page.js.nft.json +1 -1
- package/.next/server/app/register/page_client-reference-manifest.js +1 -1
- package/.next/server/app/review/page.js.nft.json +1 -1
- package/.next/server/app/review/page_client-reference-manifest.js +1 -1
- package/.next/server/app/setup/page.js.nft.json +1 -1
- package/.next/server/app/setup/page_client-reference-manifest.js +1 -1
- package/.next/server/app/stats/page.js.nft.json +1 -1
- package/.next/server/app/stats/page_client-reference-manifest.js +1 -1
- package/.next/server/app/tags/page.js.nft.json +1 -1
- package/.next/server/app/tags/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +5 -0
- package/.next/server/chunks/1oeh_server_app_api_question-banks_[id]_questions_[qid]_route_actions_0cut200tgdhrg.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__007euzraef-1_._.js → [root-of-the-server]__003zs5cdrhp0h._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__046l8-2oecq5e._.js → [root-of-the-server]__0095ttqaxkura._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__00d4vtmsmiyd_._.js → [root-of-the-server]__00gh00nfppv7c._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__1ld7m10shogtt._.js → [root-of-the-server]__02cwazw3laf8n._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__02p_mpxidnu0x._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__12u2irl6e293j._.js → [root-of-the-server]__03mzwpgmelgxq._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__04g1e8vi5hfmd._.js +1 -1
- package/.next/server/chunks/{[root-of-the-server]__06t523lsa-xt5._.js → [root-of-the-server]__04k-j5q4c3fxh._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__06g_4_o5xkej2._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__074shufbnm6ni._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__02m42nibzxxmr._.js → [root-of-the-server]__07dbynh_bs54x._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__06g0t8zt3udt7._.js → [root-of-the-server]__0afxho639gukq._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__17tyjwy7wmx2z._.js → [root-of-the-server]__0as_tqxtximnv._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__13cki3v6cufcx._.js → [root-of-the-server]__0b110dxj2qk5d._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__0r3grb-nk-tkn._.js → [root-of-the-server]__0bey3smu2frko._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__00lpxd_gni_y7._.js → [root-of-the-server]__0clg30mkk8i71._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__0zj60abydj_ho._.js → [root-of-the-server]__0cyq3g7ztpx7w._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__0dxid01zcz8sh._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0evv12a34qcy6._.js +4 -4
- package/.next/server/chunks/{[root-of-the-server]__0d_63r679gzzq._.js → [root-of-the-server]__0gj0qch0bepug._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__0gspnsyl2sr50._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__1i70uvkdts-q1._.js → [root-of-the-server]__0h7v77lf4fj2l._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__0m1vmtwh8l5-k._.js → [root-of-the-server]__0hfzltniz674f._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__0i0wx-z-qadeh._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__1gkabltrjg-t4._.js → [root-of-the-server]__0iw2v5f6ccxl0._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__0o5b_c35hufmg._.js → [root-of-the-server]__0iz5qf7p--9io._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__0llcnfms-yrs4._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0lrgjyg38b9j1._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0nmxuavodh1jp._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0o64d13on6cmz._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__1ln0042a-s6yz._.js → [root-of-the-server]__0oou2pf7_339_._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__0pfjf0rwvysy7._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0pzhwzricdm-8._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0q7tfn1jdwvpx._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0qcuz-9of1fv5._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0r0zkh318us2a._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0sr8vnpwvch60._.js +1 -1
- package/.next/server/chunks/{[root-of-the-server]__1ege7h8tb5rk0._.js → [root-of-the-server]__0sthzz27i2a2z._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__1jwj83lfyd4sd._.js → [root-of-the-server]__0svsyv06lv5b6._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__1w6vhjjteqg1c._.js → [root-of-the-server]__0u5ilae_0p228._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__0ve9pg6dcdyog._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0vf7un104o30d._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__1ya8xaf2pmzqp._.js → [root-of-the-server]__0wb0hryzh-40d._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__0xryaobvas7wn._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0y88hdobvv_cu._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__1pdsfjtgtncsg._.js → [root-of-the-server]__0ykbbyo6dhbr6._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__1v3kta6bd_kv9._.js → [root-of-the-server]__0yqilo886f-ap._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__10gksjgitow13._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__1i_tefn2lhztv._.js → [root-of-the-server]__11abvzxq0gnxd._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__11k2f-h9fwj0r._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__132wdxrrngo1f._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1338_d0rrpmqi._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__13k69ibnw4thj._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__14971xq-txgd-._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__159kla6_fcldu._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__167-list_13wk._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__1m2fnptuk23jt._.js → [root-of-the-server]__16lnqkbxm2wvd._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__190kzk1zqnnnh._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__0fxflgag7lsn4._.js → [root-of-the-server]__1_n49ooywukvu._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__1assq-8cgzn69._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1bc2146vwwx0n._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1chl_j6-66d0z._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__14_mjy9lqgp99._.js → [root-of-the-server]__1d_eia02z8s27._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__1dg09yxfyy2d-._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1e8_j43j1t1m3._.js +4 -4
- package/.next/server/chunks/{[root-of-the-server]__0wpt1mx3kryp7._.js → [root-of-the-server]__1expjjxwlr3rv._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__1fp_biblbk1dj._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1goozrpjh5dhf._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1h4469dzsx9y_._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1hg-nksvhu11h._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1hq4b2pmltb_l._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1hr87f6mg8xi6._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__1xpcaqsei77n2._.js → [root-of-the-server]__1i04dsau7foki._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__0obmdl7r6pt9d._.js → [root-of-the-server]__1i4c418rordji._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__1i8ob9ye9_osl._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1ii2yvizq9zx8._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1jcv8k2sx2ptr._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1juyqvp5sctaz._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1k67g4w53li1h._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1kqyyoqumu2k3._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1ktelnqkakjyk._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1kucx2jgzzdfv._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1l63lc79i6lzk._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1nmtvzuc1uv-5._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1oaxm5scx4anf._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1oc9d5av5hr08._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1opijjenrark5._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1otoj-v6_5y0o._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1qbwy5a1mwohf._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__0y82146_dftio._.js → [root-of-the-server]__1qch4uwoe4jbl._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__1qh6ja_35h8e9._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1qmbbudn1-e1n._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__1rfpsbaml9gvv._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1rzzqjvucnhdy._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1s9wsfyjfjfsw._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1svy-pnpe1pwu._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1t6v0c67wrtj7._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__0ztucyaloy2ub._.js → [root-of-the-server]__1tcmfyputqswh._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__1ttyfy9dd2omo._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1uk_9g9b1wxp5._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1v5j-xo97hloh._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1wt1lpxbrwtyt._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1y7j4fig86u8c._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__0q520ovb9262s._.js → [root-of-the-server]__1z61l-vv1munx._.js} +2 -2
- package/.next/server/chunks/{_02qwqg9i39x4_._.js → _0-4_eys63g0m9._.js} +6 -6
- package/.next/server/chunks/_020v6nmfgswzk._.js +1 -1
- package/.next/server/chunks/_06iu5mmu8wlcc._.js +3 -0
- package/.next/server/chunks/{_0tz5wpjdgntj3._.js → _09trvgfs0zumw._.js} +2 -2
- package/.next/server/chunks/_0c25unp5_llaq._.js +3 -0
- package/.next/server/chunks/{_1csx8ckltgali._.js → _0fsupxpep5knb._.js} +6 -6
- package/.next/server/chunks/{_0oppr1mpoh25l._.js → _0j_08_iij6lec._.js} +1 -1
- package/.next/server/chunks/_0pivjcgtfkjfw._.js +3 -0
- package/.next/server/chunks/_0rse5-saodpeb._.js +30 -0
- package/.next/server/chunks/{_1gtuhmdu6udof._.js → _0sreqb-d5c0h6._.js} +6 -6
- package/.next/server/chunks/_0vidw039o5x0k._.js +3 -0
- package/.next/server/chunks/_10xn2rcd87yd5._.js +3 -0
- package/.next/server/chunks/_12w5k19rc45j_._.js +1 -1
- package/.next/server/chunks/{_1yvd01woddaxt._.js → _1c-nysoxl9gha._.js} +6 -6
- package/.next/server/chunks/_1eqnx6dcz6a03._.js +1 -1
- package/.next/server/chunks/_1ooq1_fguyb4w._.js +1 -1
- package/.next/server/chunks/_1re5pp9fn2sv7._.js +3 -0
- package/.next/server/chunks/_1v6bg00q81vb-._.js +3 -0
- package/.next/server/chunks/_1y2rcqvbb2_-4._.js +3 -0
- package/.next/server/chunks/_1yx16tn5391kx._.js +1 -1
- package/.next/server/chunks/_1z_ujac_e_65s._.js +1 -1
- package/.next/server/chunks/_next-internal_server_app_api_mcp_route_actions_1thtlukwlrce1.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_question-banks_[id]_route_actions_06y5t4oimtusv.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_question-banks_route_actions_0h4hz83b0yf8g.js +3 -0
- package/.next/server/chunks/node_modules_zod_v4_classic_external_0yua5dbpvcjkf.js +5 -5
- package/.next/server/chunks/src_lib_078zldkqc-a67._.js +1 -1
- package/.next/server/chunks/src_lib_09_k-7vv0sy-e._.js +3 -0
- package/.next/server/chunks/src_lib_0clsw_ng7x3ih._.js +1 -1
- package/.next/server/chunks/src_lib_0gonw_e9wzfyz._.js +1 -1
- package/.next/server/chunks/src_lib_0whd_w99i5vmm._.js +1 -1
- package/.next/server/chunks/src_lib_1_m3-y2t3e4xi._.js +28 -19
- package/.next/server/chunks/src_lib_1b_d9xsuzjp3e._.js +1 -1
- package/.next/server/chunks/src_lib_1hw1dokd0kaxo._.js +3 -0
- package/.next/server/chunks/src_lib_1o3tjd1o5cimp._.js +1 -1
- package/.next/server/chunks/src_lib_error-list_1o9rfcd_k01kv._.js +3 -0
- package/.next/server/chunks/src_lib_import_import-batches_ts_0nq3mn0v5uj28._.js +1 -1
- package/.next/server/chunks/src_lib_import_import-tasks_ts_01f-g_upv7llt._.js +1 -1
- package/.next/server/chunks/src_lib_notebook-scope_ts_06eipvr6xztlf._.js +1 -1
- package/.next/server/chunks/src_lib_question-bank_import_ts_023xoc-kyom7m._.js +3 -0
- package/.next/server/chunks/src_lib_question_question-deduplication_ts_0gumctesi3szc._.js +1 -1
- package/.next/server/chunks/src_lib_tags_seed_1_ej3w-2450a0._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__032-uso7x2eqk._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0ekyw4b9xrrfl._.js +3 -0
- package/.next/server/chunks/ssr/{[root-of-the-server]__04nhi0374i4dp._.js → [root-of-the-server]__0l72nsu73r1ie._.js} +1 -1
- package/.next/server/chunks/ssr/{[root-of-the-server]__0xjcdrflb40xr._.js → [root-of-the-server]__0q4fkp0gm5j49._.js} +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__127jl-l56wp65._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__13a530hbs-5o-._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__1abszuh7g1t6l._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1czdp-cv_3o0y._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1u1nyl__o71y7._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1w_b5karqfj4p._.js +3 -0
- package/.next/server/chunks/ssr/{[root-of-the-server]__01z2m5q6l60fn._.js → [root-of-the-server]__1z7574v_ikkfm._.js} +1 -1
- package/.next/server/chunks/ssr/_0-nyc5xhnkj97._.js +3 -0
- package/.next/server/chunks/ssr/_00bsw28n2tkm8._.js +3 -0
- package/.next/server/chunks/ssr/_017305t8j_d1y._.js +3 -0
- package/.next/server/chunks/ssr/_02_avk2sj3zf5._.js +1 -1
- package/.next/server/chunks/ssr/_081vr-pfkkxm1._.js +3 -0
- package/.next/server/chunks/ssr/{_1h4fhwg03wbzm._.js → _08d_9wlphi_z1._.js} +1 -1
- package/.next/server/chunks/ssr/_093l-s8jylydj._.js +3 -0
- package/.next/server/chunks/ssr/_09np4pgpwe7dt._.js +3 -0
- package/.next/server/chunks/ssr/_09o1qheyspd5d._.js +3 -0
- package/.next/server/chunks/ssr/{_0ajvgy4u-t-py._.js → _0_6a-7_isz4ox._.js} +1 -1
- package/.next/server/chunks/ssr/_0p3bqrojxwfs0._.js +1 -1
- package/.next/server/chunks/ssr/_0rd-teluypcd2._.js +1 -1
- package/.next/server/chunks/ssr/_13546ppmec5po._.js +4 -0
- package/.next/server/chunks/ssr/{_0is6rtsx_9ka7._.js → _1bpiiswbxudjs._.js} +1 -1
- package/.next/server/chunks/ssr/_1ctycpq4tb8xw._.js +1 -1
- package/.next/server/chunks/ssr/_1gdar99uip6w4._.js +3 -0
- package/.next/server/chunks/ssr/_1m-8w6s67a81a._.js +3 -0
- package/.next/server/chunks/ssr/_1s1ithxs1-28e._.js +3 -0
- package/.next/server/chunks/ssr/_1ywwrbmzxhzuj._.js +3 -0
- package/.next/server/chunks/ssr/_207sw-k8wjyua._.js +4 -0
- package/.next/server/chunks/ssr/_next-internal_server_app_banks_page_actions_02im6pq6s__f4.js +3 -0
- package/.next/server/chunks/ssr/node_modules_0_n_aglnnr_pe._.js +3 -0
- package/.next/server/chunks/ssr/{node_modules_1i644g-kqgnm_._.js → node_modules_0h9ta63mxl6gx._.js} +1 -1
- package/.next/server/chunks/ssr/node_modules_0howjysrkg79j._.js +3 -0
- package/.next/server/chunks/ssr/node_modules_1gehjcp51qewp._.js +3 -0
- package/.next/server/chunks/ssr/{node_modules_05hncuf8243qe._.js → node_modules_@radix-ui_1c09orgee1uhq._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_heic-to_dist_csp_heic-to_0sz_snu3yd_63.js → node_modules_heic-to_dist_csp_heic-to_0lnmp65mgz816.js} +1 -1
- package/.next/server/chunks/ssr/node_modules_next_dist_0rsvep-qefr2x._.js +1 -1
- package/.next/server/chunks/ssr/node_modules_next_dist_1khq67j4vo9y4._.js +1 -1
- package/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_1v3-7fv6473ff.js +3 -0
- package/.next/server/chunks/ssr/src_0qrp0l9l_33ze._.js +3 -0
- package/.next/server/chunks/ssr/{src_0e73j7l6j__rh._.js → src_11my1u2jnbp_c._.js} +2 -2
- package/.next/server/chunks/ssr/src_18crt94jrdkoz._.js +3 -0
- package/.next/server/chunks/ssr/src_1m8frpkuirkx8._.js +1 -1
- package/.next/server/chunks/ssr/src_app_banks_page_tsx_0ln3jwg20xg0f._.js +3 -0
- 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 +2 -2
- package/.next/server/chunks/ssr/src_app_practice_page_tsx_10gnx53v3kpzb._.js +1 -1
- package/.next/server/chunks/ssr/src_app_review_page_tsx_1rq4ygvo_szv0._.js +1 -1
- package/.next/server/chunks/ssr/src_components_error-list_error-item-card_tsx_1zsiqsrj-jjd7._.js +1 -1
- package/.next/server/chunks/ssr/src_components_mastery-panel_tsx_1--j5c7mhomdp._.js +1 -1
- package/.next/server/chunks/ssr/src_components_providers_tsx_09kw-mv3nb6xs._.js +20 -20
- package/.next/server/chunks/ssr/src_contexts_LanguageContext_tsx_0r6xucmeu1k5z._.js +1 -1
- package/.next/server/chunks/ssr/src_lib_0rd9w12yo--s3._.js +3 -0
- package/.next/server/chunks/ssr/src_lib_130aann40fb28._.js +3 -0
- package/.next/server/chunks/ssr/src_lib_api-client_ts_04r2_ex-gua5i._.js +1 -1
- package/.next/server/chunks/ssr/src_lib_i18n_en_ts_08zkpwnoqey5s._.js +1 -1
- package/.next/server/functions-config-manifest.json +2 -1
- package/.next/server/middleware-build-manifest.js +14 -3
- package/.next/server/next-font-manifest.js +1 -1
- package/.next/server/next-font-manifest.json +4 -0
- 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/{3j92h-4k4_o_f.js → 01du700kl9vpy.js} +1 -1
- package/.next/static/chunks/0296boczx9jzp.js +1 -0
- package/.next/static/chunks/0ce17zvy849pt.js +1 -0
- package/.next/static/chunks/0jujm58tnoh6g.js +1 -0
- package/.next/static/chunks/{1rlw59dtd-wn9.js → 0l7p1okxbynzl.js} +2 -2
- package/.next/static/chunks/0q-ubzpc3zt00.js +264 -0
- package/.next/static/chunks/0q3d845nwr3t9.js +1 -0
- package/.next/static/chunks/{2s65brxj4r_r8.js → 0qp2dju3vke54.js} +1 -1
- package/.next/static/chunks/0wf-6-2_vym2v.js +1 -0
- package/.next/static/chunks/11-wz53_clo14.js +1 -0
- package/.next/static/chunks/{0_ysyni00uuve.js → 1inmkqwqys755.js} +1 -1
- package/.next/static/chunks/{2_0xdmmmic5_l.js → 1s6os79cobfn_.js} +1 -1
- package/.next/static/chunks/1vyad-frr447h.js +2 -0
- package/.next/static/chunks/1xe6wsozi5dph.js +9 -0
- package/.next/static/chunks/{1-p-0kczwnip9.js → 2-_veplkr98_e.js} +1 -1
- package/.next/static/chunks/{3f9t8cne6yfyl.js → 229eh2g7m2yeo.js} +1 -1
- package/.next/static/chunks/2bh5ydfa-1ijv.js +2 -0
- package/.next/static/chunks/{28qc_d51g0z--.js → 2g9sfd_hxpx8t.js} +1 -1
- package/.next/static/chunks/{13aykr4b9nzmt.js → 2pg8rnt3z7y03.js} +4 -4
- package/.next/static/chunks/2vka298e6x3mn.js +13 -0
- package/.next/static/chunks/2wwddiemqx680.js +1 -0
- package/.next/static/chunks/2xm7gxq5_ot8y.js +1 -0
- package/.next/static/chunks/{1joajsaunlqm-.js → 32feki_k6eulj.js} +1 -1
- package/.next/static/chunks/{3h3a7lg3-9cbn.js → 348vc_z8o0lz1.js} +1 -1
- package/.next/static/chunks/3_xu3ke2zp8fv.js +1 -0
- package/.next/static/chunks/3ghbptbmig2g6.js +1 -0
- package/.next/static/chunks/3pn9o00oxw1jh.js +1 -0
- package/.next/static/chunks/3pu4qklwvr6i6.js +1 -0
- package/.next/static/chunks/3t23a8b3wz2sp.css +3 -0
- package/.next/static/chunks/{3t9tbm4atwmw8.js → 3vdtiexr8nj05.js} +1 -1
- package/.next/static/chunks/3xonrwoptfy0c.js +1 -0
- package/dist-scripts/src/lib/tags/data/university.js +1 -1
- package/package.json +1 -1
- package/prisma/migrations/20261111000000_add_question_bank/migration.sql +54 -0
- package/prisma/schema.prisma +50 -0
- package/prisma/seed.db +0 -0
- package/.next/server/chunks/[root-of-the-server]__00ry5fb1607z0._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0191d7zm1bh5y._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0_3i3iyk5i5fu._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0d3nasp559369._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0ddx0pk-g57hh._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0euaxkmzk9kv8._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0evnxpsv44y-s._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0g2y0mex0x8zf._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0gjk0_s945vrt._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0gkhutsleo1es._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0gvfx4rsinijb._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0jutgg41pd-47._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0kc9gy1644-op._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0medeb4h2gk5t._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0prgnysrc2l5k._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0qwtk85kstlpq._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0rwbb97vk-mfk._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0smp3m3n89xs_._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0zsd45jad6b40._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0zux7hsnes_j2._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__10--fi__uy8y7._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__14b8pj1sucy1-._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__16t85d4p3aldo._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1_do4zybj0nvi._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1bz0s-wy2cxhl._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1d7_aw9ogigrd._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1gb1x1ubkdwig._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1gsm8s81ac08k._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1hc1bcnovtwo2._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1jwd70xukhvz4._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1ms_0h40h2rbg._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1nw9nkdb5uv4i._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1ogeha9-ljbre._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1p5s772lt24dg._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1pxyy29_t_ru1._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1s_ky5a7nhgas._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1txu2n-l6c6yu._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1ulrsdu0e8fjb._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1vg4na3a-hvwi._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1wi-k0dtwwxx3._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1wvm4n7d69s3x._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1x-u1u9mrt630._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1xx_3auad-kml._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1y0omyblg9j35._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1z2d4j9-oei44._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1znqtfuuspj0w._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__205o-7lep9jth._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__20c3hyqykubh2._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__20pn9h3od2anc._.js +0 -3
- package/.next/server/chunks/_0b9gke5b17vzh._.js +0 -3
- package/.next/server/chunks/_0ta62b-tktnk8._.js +0 -3
- package/.next/server/chunks/_12xi_xqvtrn3k._.js +0 -3
- package/.next/server/chunks/_14l8uqb__fhx_._.js +0 -3
- package/.next/server/chunks/_18hm5aaxkr500._.js +0 -3
- package/.next/server/chunks/_1b-7g4thtxfnp._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0l0hz47yn1ku_._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0w77craeuuak9._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__1rrcp_77jpv98._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__1xgyz8jfhhs4j._.js +0 -3
- package/.next/server/chunks/ssr/_07igsu8xjloky._.js +0 -3
- package/.next/server/chunks/ssr/_090e6vf_k0pe9._.js +0 -3
- package/.next/server/chunks/ssr/_09y2uhjubswp4._.js +0 -3
- package/.next/server/chunks/ssr/_0htmdb0udewwn._.js +0 -3
- package/.next/server/chunks/ssr/_0lzeodofsq9pe._.js +0 -3
- package/.next/server/chunks/ssr/_0mp06uu5odp8m._.js +0 -4
- package/.next/server/chunks/ssr/_0ozptnii2nxuw._.js +0 -3
- package/.next/server/chunks/ssr/_0r_8p9g00106y._.js +0 -3
- package/.next/server/chunks/ssr/_0znwyf0_b8ia6._.js +0 -3
- package/.next/server/chunks/ssr/_127aw5h992s9d._.js +0 -4
- package/.next/server/chunks/ssr/_1dx7u1_w4db4k._.js +0 -3
- package/.next/server/chunks/ssr/node_modules_0nslyotwav52f._.js +0 -3
- package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_icons_0mg8mlclupjv-._.js +0 -3
- package/.next/server/chunks/ssr/src_0_qzoo_03n_v-._.js +0 -3
- package/.next/server/chunks/ssr/src_0atwwo6buvs3b._.js +0 -3
- package/.next/server/chunks/ssr/src_1o5f_wr8vv-x0._.js +0 -3
- package/.next/server/chunks/ssr/src_lib_short-id_short-id-client_ts_03nnd3s0tat3l._.js +0 -3
- package/.next/static/chunks/08pb1_yl7fhsw.js +0 -1
- package/.next/static/chunks/0alfkmfoq-e76.js +0 -1
- package/.next/static/chunks/0c3tf7izst9o8.js +0 -1
- package/.next/static/chunks/0gs3bacq7z36z.js +0 -1
- package/.next/static/chunks/13oi1micj1ewp.js +0 -1
- package/.next/static/chunks/14zevcjua-k8z.js +0 -1
- package/.next/static/chunks/1797q5c62e7um.js +0 -1
- package/.next/static/chunks/1_4nz7m2jathb.js +0 -1
- package/.next/static/chunks/1ey5h3_143nwz.js +0 -2
- package/.next/static/chunks/23h8i_poncr7i.js +0 -1
- package/.next/static/chunks/26is31yphg3a0.css +0 -3
- package/.next/static/chunks/2e4y6sq3k0g-g.js +0 -1
- package/.next/static/chunks/2hl9d1rdb9hkq.js +0 -1
- package/.next/static/chunks/315-5a18eawtj.js +0 -13
- package/.next/static/chunks/33vv8ujyvnonj.js +0 -1
- package/.next/static/chunks/3keaieh9lgnr3.js +0 -2
- package/.next/static/chunks/3ls9d-zeu8xdr.js +0 -264
- package/.next/static/chunks/3m_jfkz23whuc.js +0 -1
- package/.next/static/chunks/431ssxm5rrwz9.js +0 -1
- /package/.next/static/{HqqfOtkWGYtFERkBGxueA → S4q1xCvMlvuYeRE4fI2-s}/_buildManifest.js +0 -0
- /package/.next/static/{HqqfOtkWGYtFERkBGxueA → S4q1xCvMlvuYeRE4fI2-s}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{HqqfOtkWGYtFERkBGxueA → S4q1xCvMlvuYeRE4fI2-s}/_ssgManifest.js +0 -0
|
@@ -4,13 +4,13 @@ ${a}
|
|
|
4
4
|
${t}`)}return a})(nm);class ny extends ne{create(e,t){let{user_profile_id:i,workspace_id:r,...s}=e;return this._client.post("/v1/messages/batches",{body:s,...t,headers:r$([{...null!=i?{"anthropic-user-profile-id":i}:void 0,...null!=r?{"anthropic-workspace-id":r}:void 0},t?.headers]),__span:rN(this._client,"anthropic.messages.batches.create",t,{route:"/v1/messages/batches",attributes:{"anthropic.message.batch.request_count":s.requests?.length},createdIDAttribute:"anthropic.message.batch.id"})})}retrieve(e,t={},i){let{workspace_id:r}=t??{};return this._client.get(nb`/v1/messages/batches/${e}`,{...i,headers:r$([{...null!=r?{"anthropic-workspace-id":r}:void 0},i?.headers]),__span:rN(this._client,"anthropic.messages.batches.retrieve",i,{route:"/v1/messages/batches/{message_batch_id}",attributes:{"anthropic.message.batch.id":e}})})}list(e={},t){let{workspace_id:i,...r}=e??{};return this._client.getAPIList("/v1/messages/batches",s6,{query:r,...t,headers:r$([{...null!=i?{"anthropic-workspace-id":i}:void 0},t?.headers]),__span:rN(this._client,"anthropic.messages.batches.list",t,{route:"/v1/messages/batches",queryParams:["after_id","before_id","limit"]})})}delete(e,t={},i){let{workspace_id:r}=t??{};return this._client.delete(nb`/v1/messages/batches/${e}`,{...i,headers:r$([{...null!=r?{"anthropic-workspace-id":r}:void 0},i?.headers]),__span:rN(this._client,"anthropic.messages.batches.delete",i,{route:"/v1/messages/batches/{message_batch_id}",attributes:{"anthropic.message.batch.id":e}})})}cancel(e,t={},i){let{workspace_id:r}=t??{};return this._client.post(nb`/v1/messages/batches/${e}/cancel`,{...i,headers:r$([{...null!=r?{"anthropic-workspace-id":r}:void 0},i?.headers]),__span:rN(this._client,"anthropic.messages.batches.cancel",i,{route:"/v1/messages/batches/{message_batch_id}/cancel",attributes:{"anthropic.message.batch.id":e}})})}async results(e,t={},i){let r=await this.retrieve(e,t,i);if(!r.results_url)throw new ry.v(`No batch \`results_url\`; Has it finished processing? ${r.processing_status} - ${r.id}`);let{workspace_id:s}=t??{};return this._client.get(r.results_url,{...i,headers:r$([{Accept:"application/binary",...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),stream:!0,__binaryResponse:!0,__span:rN(this._client,"anthropic.messages.batches.results",i,{route:"/v1/messages/batches/{message_batch_id}/results",attributes:{"anthropic.message.batch.id":e}})})._thenUnwrap((e,t)=>ng.fromResponse(t.response,t.controller))}}let nw={"claude-opus-4@20250514":8192,"anthropic.claude-opus-4-1-20250805-v1:0":8192,"claude-opus-4-1@20250805":8192};var nk=(()=>{class e extends ne{constructor(){super(...arguments),this.batches=new ny(this._client)}create(e,t){let{user_profile_id:i,workspace_id:r,...s}=e;s.model in nz&&console.warn(`The model '${s.model}' is deprecated and will reach end-of-life on ${nz[s.model]}
|
|
5
5
|
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`),nx.includes(s.model)&&s.thinking&&"enabled"===s.thinking.type&&console.warn(`Using Claude with ${s.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let n=t?.timeout??this._client._options.timeout;if(!s.stream&&null==n){let e=nw[s.model]??void 0;n=this._client.calculateNonstreamingTimeout(s.max_tokens,e)}let a=nl(e,t),o=this._client._tracer&&rN(this._client,"anthropic.messages.create",t,sz(this._client,s,a));sx(this._client,o,s);let l=this._client.post("/v1/messages",{body:s,timeout:n??6e5,...t,__span:o,headers:a,stream:e.stream??!1});return o?l._thenUnwrap(e=>(sS(this._client,o,s,e),e)):l}parse(e,t){return this.create(e,t).then(t=>nh(t,e,{logger:this._client.logger??console}))}stream(e,t){return nf.createMessage(this,e,t,{logger:this._client.logger??console,client:this._client})}countTokens(e,t){let{user_profile_id:i,workspace_id:r,...s}=e,n=r$([{...null!=i?{"anthropic-user-profile-id":i}:void 0,...null!=r?{"anthropic-workspace-id":r}:void 0},t?.headers]),a=rN(this._client,"anthropic.messages.count_tokens",t,{route:"/v1/messages/count_tokens",attributes:{[so]:s.model}}),o=this._client.post("/v1/messages/count_tokens",{body:s,...t,__span:a,headers:n});return a?o._thenUnwrap(e=>(sV(this._client,a,e),e)):o}}return e.Batches=ny,e})();let nz={"claude-sonnet-4-5":"November 30th, 2026","claude-sonnet-4-5-20250929":"November 30th, 2026"},nx=["claude-mythos-preview","claude-opus-4-6"];class nS extends ne{retrieve(e,t={},i){let{workspace_id:r}=t??{};return this._client.get(nb`/v1/models/${e}`,{...i,headers:r$([{...null!=r?{"anthropic-workspace-id":r}:void 0},i?.headers]),__span:rN(this._client,"anthropic.models.retrieve",i,{route:"/v1/models/{model_id}",attributes:{"anthropic.model.id":e}})})}list(e={},t){let{workspace_id:i,...r}=e??{};return this._client.getAPIList("/v1/models",s6,{query:r,...t,headers:r$([{...null!=i?{"anthropic-workspace-id":i}:void 0},t?.headers]),__span:rN(this._client,"anthropic.models.list",t,{route:"/v1/models",queryParams:["after_id","before_id","lifecycle","limit"]})})}}class nV extends ne{list(e={},t){let{workspace_id:i,...r}=e??{};return this._client.getAPIList("/v1/files",s4,{query:r,...t,headers:r$([{...null!=i?{"anthropic-workspace-id":i}:void 0},t?.headers]),__span:rN(this._client,"anthropic.files.list",t,{route:"/v1/files",queryParams:["ids","limit","page"]})})}delete(e,t={},i){let{workspace_id:r}=t??{};return this._client.delete(nb`/v1/files/${e}`,{...i,headers:r$([{...null!=r?{"anthropic-workspace-id":r}:void 0},i?.headers]),__span:rN(this._client,"anthropic.files.delete",i,{route:"/v1/files/{file_id}",attributes:{"anthropic.file.id":e}})})}download(e,t={},i){let{workspace_id:r}=t??{};return this._client.get(nb`/v1/files/${e}/content`,{...i,headers:r$([{Accept:"application/binary",...null!=r?{"anthropic-workspace-id":r}:void 0},i?.headers]),__binaryResponse:!0,__span:rN(this._client,"anthropic.files.download",i,{route:"/v1/files/{file_id}/content",attributes:{"anthropic.file.id":e}})})}retrieveMetadata(e,t={},i){let{workspace_id:r}=t??{};return this._client.get(nb`/v1/files/${e}`,{...i,headers:r$([{...null!=r?{"anthropic-workspace-id":r}:void 0},i?.headers]),__span:rN(this._client,"anthropic.files.retrieve_metadata",i,{route:"/v1/files/{file_id}",attributes:{"anthropic.file.id":e}})})}upload(e,t){let{workspace_id:i,...r}=e;return this._client.post("/v1/files",sG({body:r,...t,headers:r$([{...null!=i?{"anthropic-workspace-id":i}:void 0},no(r.file),t?.headers]),__span:rN(this._client,"anthropic.files.upload",t,{route:"/v1/files",createdIDAttribute:"anthropic.file.id"})},this._client))}}class nA extends ne{create(e,t,i){let{workspace_id:r,...s}=t;return this._client.post(nb`/v1/skills/${e}/versions`,sG({body:s,...i,headers:r$([{...null!=r?{"anthropic-workspace-id":r}:void 0},i?.headers]),__span:rN(this._client,"anthropic.skills.versions.create",i,{route:"/v1/skills/{skill_id}/versions",attributes:{"anthropic.skill.id":e},createdIDAttribute:"anthropic.skill.version.id"})},this._client,!1))}retrieve(e,t,i){let{skill_id:r,workspace_id:s}=t;return this._client.get(nb`/v1/skills/${r}/versions/${e}`,{...i,headers:r$([{...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__span:rN(this._client,"anthropic.skills.versions.retrieve",i,{route:"/v1/skills/{skill_id}/versions/{version}",attributes:{"anthropic.skill.id":r,"anthropic.skill.version.id":e}})})}list(e,t={},i){let{workspace_id:r,...s}=t??{};return this._client.getAPIList(nb`/v1/skills/${e}/versions`,s4,{query:s,...i,headers:r$([{...null!=r?{"anthropic-workspace-id":r}:void 0},i?.headers]),__span:rN(this._client,"anthropic.skills.versions.list",i,{route:"/v1/skills/{skill_id}/versions",queryParams:["limit","page"],attributes:{"anthropic.skill.id":e}})})}delete(e,t,i){let{skill_id:r,workspace_id:s}=t;return this._client.delete(nb`/v1/skills/${r}/versions/${e}`,{...i,headers:r$([{...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__span:rN(this._client,"anthropic.skills.versions.delete",i,{route:"/v1/skills/{skill_id}/versions/{version}",attributes:{"anthropic.skill.id":r,"anthropic.skill.version.id":e}})})}}var nI=(()=>{class e extends ne{constructor(){super(...arguments),this.versions=new nA(this._client)}create(e,t){let{workspace_id:i,...r}=e;return this._client.post("/v1/skills",sG({body:r,...t,headers:r$([{...null!=i?{"anthropic-workspace-id":i}:void 0},t?.headers]),__span:rN(this._client,"anthropic.skills.create",t,{route:"/v1/skills",createdIDAttribute:"anthropic.skill.id"})},this._client,!1))}retrieve(e,t={},i){let{workspace_id:r}=t??{};return this._client.get(nb`/v1/skills/${e}`,{...i,headers:r$([{...null!=r?{"anthropic-workspace-id":r}:void 0},i?.headers]),__span:rN(this._client,"anthropic.skills.retrieve",i,{route:"/v1/skills/{skill_id}",attributes:{"anthropic.skill.id":e}})})}list(e={},t){let{workspace_id:i,...r}=e??{};return this._client.getAPIList("/v1/skills",s4,{query:r,...t,headers:r$([{...null!=i?{"anthropic-workspace-id":i}:void 0},t?.headers]),__span:rN(this._client,"anthropic.skills.list",t,{route:"/v1/skills",queryParams:["limit","page","source"]})})}delete(e,t={},i){let{workspace_id:r}=t??{};return this._client.delete(nb`/v1/skills/${e}`,{...i,headers:r$([{...null!=r?{"anthropic-workspace-id":r}:void 0},i?.headers]),__span:rN(this._client,"anthropic.skills.delete",i,{route:"/v1/skills/{skill_id}",attributes:{"anthropic.skill.id":e}})})}}return e.Versions=nA,e})();class nq extends ne{create(e,t,i){let{workspace_id:r,...s}=t;return this._client.post(nb`/v1/user_profiles/${e}/action_urls`,{body:s,...i,headers:r$([{...null!=r?{"anthropic-workspace-id":r}:void 0},i?.headers]),__span:rN(this._client,"anthropic.user_profiles.action_urls.create",i,{route:"/v1/user_profiles/{user_profile_id}/action_urls",attributes:{"anthropic.user_profile.id":e}})})}}var nR=(()=>{class e extends ne{constructor(){super(...arguments),this.actionURLs=new nq(this._client)}create(e,t){let{workspace_id:i,...r}=e;return this._client.post("/v1/user_profiles",{body:r,...t,headers:r$([{...null!=i?{"anthropic-workspace-id":i}:void 0},t?.headers]),__span:rN(this._client,"anthropic.user_profiles.create",t,{route:"/v1/user_profiles",createdIDAttribute:"anthropic.user_profile.id"})})}retrieve(e,t={},i){let{workspace_id:r}=t??{};return this._client.get(nb`/v1/user_profiles/${e}`,{...i,headers:r$([{...null!=r?{"anthropic-workspace-id":r}:void 0},i?.headers]),__span:rN(this._client,"anthropic.user_profiles.retrieve",i,{route:"/v1/user_profiles/{user_profile_id}",attributes:{"anthropic.user_profile.id":e}})})}update(e,t,i){let{workspace_id:r,...s}=t;return this._client.post(nb`/v1/user_profiles/${e}`,{body:s,...i,headers:r$([{...null!=r?{"anthropic-workspace-id":r}:void 0},i?.headers]),__span:rN(this._client,"anthropic.user_profiles.update",i,{route:"/v1/user_profiles/{user_profile_id}",attributes:{"anthropic.user_profile.id":e}})})}list(e={},t){let{workspace_id:i,...r}=e??{};return this._client.getAPIList("/v1/user_profiles",s4,{query:r,...t,headers:r$([{...null!=i?{"anthropic-workspace-id":i}:void 0},t?.headers]),__span:rN(this._client,"anthropic.user_profiles.list",t,{route:"/v1/user_profiles",queryParams:["enforcement_status","limit","order","order_by","page"]})})}delete(e,t={},i){let{workspace_id:r}=t??{};return this._client.delete(nb`/v1/user_profiles/${e}`,{...i,headers:r$([{...null!=r?{"anthropic-workspace-id":r}:void 0},i?.headers]),__span:rN(this._client,"anthropic.user_profiles.delete",i,{route:"/v1/user_profiles/{user_profile_id}",attributes:{"anthropic.user_profile.id":e}})})}}return e.ActionURLs=nq,e})();class n$ extends ne{retrieve(e,t){return this._client.get(nb`/v1/organizations/api_keys/${e}`,{...t,__span:rN(this._client,"anthropic.organization.api_keys.retrieve",t,{route:"/v1/organizations/api_keys/{api_key_id}",attributes:{"anthropic.organization.api_key.id":e}})})}update(e,t,i){return this._client.post(nb`/v1/organizations/api_keys/${e}`,{body:t,...i,__span:rN(this._client,"anthropic.organization.api_keys.update",i,{route:"/v1/organizations/api_keys/{api_key_id}",attributes:{"anthropic.organization.api_key.id":e}})})}list(e={},t){return this._client.getAPIList("/v1/organizations/api_keys",s6,{query:e,...t,__span:rN(this._client,"anthropic.organization.api_keys.list",t,{route:"/v1/organizations/api_keys",queryParams:["after_id","before_id","created_by_user_id","limit","status","workspace_id"]})})}}class nT extends ne{retrieve(e){return this._client.get("/v1/organizations/compliance_settings",{...e,__span:rN(this._client,"anthropic.organization.compliance_settings.retrieve",e,{route:"/v1/organizations/compliance_settings"})})}update(e,t){return this._client.post("/v1/organizations/compliance_settings",{body:e,...t,__span:rN(this._client,"anthropic.organization.compliance_settings.update",t,{route:"/v1/organizations/compliance_settings"})})}}class nP extends ne{create(e,t){return this._client.post("/v1/organizations/external_keys",{body:e,...t,__span:rN(this._client,"anthropic.organization.external_keys.create",t,{route:"/v1/organizations/external_keys",createdIDAttribute:"anthropic.organization.external_key.id"})})}retrieve(e,t){return this._client.get(nb`/v1/organizations/external_keys/${e}`,{...t,__span:rN(this._client,"anthropic.organization.external_keys.retrieve",t,{route:"/v1/organizations/external_keys/{external_key_id}",attributes:{"anthropic.organization.external_key.id":e}})})}update(e,t,i){return this._client.post(nb`/v1/organizations/external_keys/${e}`,{body:t,...i,__span:rN(this._client,"anthropic.organization.external_keys.update",i,{route:"/v1/organizations/external_keys/{external_key_id}",attributes:{"anthropic.organization.external_key.id":e}})})}list(e={},t){return this._client.getAPIList("/v1/organizations/external_keys",s4,{query:e,...t,__span:rN(this._client,"anthropic.organization.external_keys.list",t,{route:"/v1/organizations/external_keys",queryParams:["limit","page"]})})}delete(e,t){return this._client.delete(nb`/v1/organizations/external_keys/${e}`,{...t,__span:rN(this._client,"anthropic.organization.external_keys.delete",t,{route:"/v1/organizations/external_keys/{external_key_id}",attributes:{"anthropic.organization.external_key.id":e}})})}validate(e,t){return this._client.post(nb`/v1/organizations/external_keys/${e}/validate`,{...t,__span:rN(this._client,"anthropic.organization.external_keys.validate",t,{route:"/v1/organizations/external_keys/{external_key_id}/validate",attributes:{"anthropic.organization.external_key.id":e}})})}}class nE extends ne{create(e,t){return this._client.post("/v1/organizations/invites",{body:e,...t,__span:rN(this._client,"anthropic.organization.invites.create",t,{route:"/v1/organizations/invites",createdIDAttribute:"anthropic.organization.invite.id"})})}retrieve(e,t){return this._client.get(nb`/v1/organizations/invites/${e}`,{...t,__span:rN(this._client,"anthropic.organization.invites.retrieve",t,{route:"/v1/organizations/invites/{invite_id}",attributes:{"anthropic.organization.invite.id":e}})})}list(e={},t){return this._client.getAPIList("/v1/organizations/invites",s6,{query:e,...t,__span:rN(this._client,"anthropic.organization.invites.list",t,{route:"/v1/organizations/invites",queryParams:["after_id","before_id","email","limit","roles","statuses"]})})}delete(e,t){return this._client.delete(nb`/v1/organizations/invites/${e}`,{...t,__span:rN(this._client,"anthropic.organization.invites.delete",t,{route:"/v1/organizations/invites/{invite_id}",attributes:{"anthropic.organization.invite.id":e}})})}}class nO extends ne{list(e={},t){return this._client.getAPIList("/v1/organizations/rate_limits",s4,{query:e,...t,__span:rN(this._client,"anthropic.organization.rate_limits.list",t,{route:"/v1/organizations/rate_limits",queryParams:["group_type","limit","model","page"]})})}}class nM extends ne{retrieve(e,t){return this._client.get(nb`/v1/organizations/users/${e}`,{...t,__span:rN(this._client,"anthropic.organization.users.retrieve",t,{route:"/v1/organizations/users/{user_id}",attributes:{"anthropic.organization.user.id":e}})})}update(e,t,i){return this._client.post(nb`/v1/organizations/users/${e}`,{body:t,...i,__span:rN(this._client,"anthropic.organization.users.update",i,{route:"/v1/organizations/users/{user_id}",attributes:{"anthropic.organization.user.id":e}})})}list(e={},t){return this._client.getAPIList("/v1/organizations/users",s6,{query:e,...t,__span:rN(this._client,"anthropic.organization.users.list",t,{route:"/v1/organizations/users",queryParams:["after_id","before_id","email","limit","roles"]})})}remove(e,t){return this._client.delete(nb`/v1/organizations/users/${e}`,{...t,__span:rN(this._client,"anthropic.organization.users.remove",t,{route:"/v1/organizations/users/{user_id}",attributes:{"anthropic.organization.user.id":e}})})}}class nL extends ne{create(e,t){return this._client.post("/v1/organizations/federation_issuers",{body:e,...t,__span:rN(this._client,"anthropic.organization.federation.issuers.create",t,{route:"/v1/organizations/federation_issuers",createdIDAttribute:"anthropic.organization.federation_issuer.id"})})}retrieve(e,t){return this._client.get(nb`/v1/organizations/federation_issuers/${e}`,{...t,__span:rN(this._client,"anthropic.organization.federation.issuers.retrieve",t,{route:"/v1/organizations/federation_issuers/{federation_issuer_id}",attributes:{"anthropic.organization.federation_issuer.id":e}})})}update(e,t,i){return this._client.post(nb`/v1/organizations/federation_issuers/${e}`,{body:t,...i,__span:rN(this._client,"anthropic.organization.federation.issuers.update",i,{route:"/v1/organizations/federation_issuers/{federation_issuer_id}",attributes:{"anthropic.organization.federation_issuer.id":e}})})}list(e={},t){return this._client.getAPIList("/v1/organizations/federation_issuers",s4,{query:e,...t,__span:rN(this._client,"anthropic.organization.federation.issuers.list",t,{route:"/v1/organizations/federation_issuers",queryParams:["include_archived","limit","page"]})})}archive(e,t){return this._client.post(nb`/v1/organizations/federation_issuers/${e}/archive`,{...t,__span:rN(this._client,"anthropic.organization.federation.issuers.archive",t,{route:"/v1/organizations/federation_issuers/{federation_issuer_id}/archive",attributes:{"anthropic.organization.federation_issuer.id":e}})})}}class nN extends ne{list(e,t={},i){return this._client.getAPIList(nb`/v1/organizations/federation_rules/${e}/workspaces`,s4,{query:t,...i,__span:rN(this._client,"anthropic.organization.federation.rules.workspaces.list",i,{route:"/v1/organizations/federation_rules/{federation_rule_id}/workspaces",queryParams:["limit","page"],attributes:{"anthropic.organization.federation_rule.id":e}})})}add(e,t,i){return this._client.post(nb`/v1/organizations/federation_rules/${e}/workspaces`,{body:t,...i,__span:rN(this._client,"anthropic.organization.federation.rules.workspaces.add",i,{route:"/v1/organizations/federation_rules/{federation_rule_id}/workspaces",attributes:{"anthropic.organization.federation_rule.id":e},createdIDAttribute:"anthropic.organization.federation_rule.workspace.id",createdIDField:"workspace_id"})})}remove(e,t,i){let{federation_rule_id:r}=t;return this._client.delete(nb`/v1/organizations/federation_rules/${r}/workspaces/${e}`,{...i,__span:rN(this._client,"anthropic.organization.federation.rules.workspaces.remove",i,{route:"/v1/organizations/federation_rules/{federation_rule_id}/workspaces/{workspace_id}",attributes:{"anthropic.organization.federation_rule.id":r,"anthropic.organization.federation_rule.workspace.id":e}})})}}var nC=(()=>{class e extends ne{constructor(){super(...arguments),this.workspaces=new nN(this._client)}create(e,t){return this._client.post("/v1/organizations/federation_rules",{body:e,...t,__span:rN(this._client,"anthropic.organization.federation.rules.create",t,{route:"/v1/organizations/federation_rules",createdIDAttribute:"anthropic.organization.federation_rule.id"})})}retrieve(e,t){return this._client.get(nb`/v1/organizations/federation_rules/${e}`,{...t,__span:rN(this._client,"anthropic.organization.federation.rules.retrieve",t,{route:"/v1/organizations/federation_rules/{federation_rule_id}",attributes:{"anthropic.organization.federation_rule.id":e}})})}update(e,t,i){return this._client.post(nb`/v1/organizations/federation_rules/${e}`,{body:t,...i,__span:rN(this._client,"anthropic.organization.federation.rules.update",i,{route:"/v1/organizations/federation_rules/{federation_rule_id}",attributes:{"anthropic.organization.federation_rule.id":e}})})}list(e={},t){return this._client.getAPIList("/v1/organizations/federation_rules",s4,{query:e,...t,__span:rN(this._client,"anthropic.organization.federation.rules.list",t,{route:"/v1/organizations/federation_rules",queryParams:["include_archived","issuer_id","limit","page"]})})}archive(e,t){return this._client.post(nb`/v1/organizations/federation_rules/${e}/archive`,{...t,__span:rN(this._client,"anthropic.organization.federation.rules.archive",t,{route:"/v1/organizations/federation_rules/{federation_rule_id}/archive",attributes:{"anthropic.organization.federation_rule.id":e}})})}}return e.Workspaces=nN,e})(),nj=(()=>{class e extends ne{constructor(){super(...arguments),this.issuers=new nL(this._client),this.rules=new nC(this._client)}}return e.Issuers=nL,e.Rules=nC,e})();class nD extends ne{list(e,t={},i){return this._client.getAPIList(nb`/v1/organizations/service_accounts/${e}/workspaces`,s4,{query:t,...i,__span:rN(this._client,"anthropic.organization.service_accounts.workspaces.list",i,{route:"/v1/organizations/service_accounts/{service_account_id}/workspaces",queryParams:["limit","page"],attributes:{"anthropic.organization.service_account.id":e}})})}add(e,t,i){return this._client.post(nb`/v1/organizations/service_accounts/${e}/workspaces`,{body:t,...i,__span:rN(this._client,"anthropic.organization.service_accounts.workspaces.add",i,{route:"/v1/organizations/service_accounts/{service_account_id}/workspaces",attributes:{"anthropic.organization.service_account.id":e},createdIDAttribute:"anthropic.organization.service_account.workspace.id",createdIDField:"workspace_id"})})}remove(e,t,i){let{service_account_id:r}=t;return this._client.delete(nb`/v1/organizations/service_accounts/${r}/workspaces/${e}`,{...i,__span:rN(this._client,"anthropic.organization.service_accounts.workspaces.remove",i,{route:"/v1/organizations/service_accounts/{service_account_id}/workspaces/{workspace_id}",attributes:{"anthropic.organization.service_account.id":r,"anthropic.organization.service_account.workspace.id":e}})})}}var nU=(()=>{class e extends ne{constructor(){super(...arguments),this.workspaces=new nD(this._client)}create(e,t){return this._client.post("/v1/organizations/service_accounts",{body:e,...t,__span:rN(this._client,"anthropic.organization.service_accounts.create",t,{route:"/v1/organizations/service_accounts",createdIDAttribute:"anthropic.organization.service_account.id"})})}retrieve(e,t){return this._client.get(nb`/v1/organizations/service_accounts/${e}`,{...t,__span:rN(this._client,"anthropic.organization.service_accounts.retrieve",t,{route:"/v1/organizations/service_accounts/{service_account_id}",attributes:{"anthropic.organization.service_account.id":e}})})}update(e,t,i){return this._client.post(nb`/v1/organizations/service_accounts/${e}`,{body:t,...i,__span:rN(this._client,"anthropic.organization.service_accounts.update",i,{route:"/v1/organizations/service_accounts/{service_account_id}",attributes:{"anthropic.organization.service_account.id":e}})})}list(e={},t){return this._client.getAPIList("/v1/organizations/service_accounts",s4,{query:e,...t,__span:rN(this._client,"anthropic.organization.service_accounts.list",t,{route:"/v1/organizations/service_accounts",queryParams:["include_archived","limit","page"]})})}archive(e,t){return this._client.post(nb`/v1/organizations/service_accounts/${e}/archive`,{...t,__span:rN(this._client,"anthropic.organization.service_accounts.archive",t,{route:"/v1/organizations/service_accounts/{service_account_id}/archive",attributes:{"anthropic.organization.service_account.id":e}})})}}return e.Workspaces=nD,e})();class nW extends ne{retrieve(e,t,i){let{workspace_id:r}=t;return this._client.get(nb`/v1/organizations/workspaces/${r}/members/${e}`,{...i,__span:rN(this._client,"anthropic.organization.workspaces.members.retrieve",i,{route:"/v1/organizations/workspaces/{workspace_id}/members/{user_id}",attributes:{"anthropic.organization.workspace.id":r,"anthropic.organization.workspace.member.id":e}})})}update(e,t,i){let{workspace_id:r,...s}=t;return this._client.post(nb`/v1/organizations/workspaces/${r}/members/${e}`,{body:s,...i,__span:rN(this._client,"anthropic.organization.workspaces.members.update",i,{route:"/v1/organizations/workspaces/{workspace_id}/members/{user_id}",attributes:{"anthropic.organization.workspace.id":r,"anthropic.organization.workspace.member.id":e}})})}list(e,t={},i){return this._client.getAPIList(nb`/v1/organizations/workspaces/${e}/members`,s6,{query:t,...i,__span:rN(this._client,"anthropic.organization.workspaces.members.list",i,{route:"/v1/organizations/workspaces/{workspace_id}/members",queryParams:["after_id","before_id","limit"],attributes:{"anthropic.organization.workspace.id":e}})})}add(e,t,i){return this._client.post(nb`/v1/organizations/workspaces/${e}/members`,{body:t,...i,__span:rN(this._client,"anthropic.organization.workspaces.members.add",i,{route:"/v1/organizations/workspaces/{workspace_id}/members",attributes:{"anthropic.organization.workspace.id":e},createdIDAttribute:"anthropic.organization.workspace.member.id",createdIDField:"user_id"})})}remove(e,t,i){let{workspace_id:r}=t;return this._client.delete(nb`/v1/organizations/workspaces/${r}/members/${e}`,{...i,__span:rN(this._client,"anthropic.organization.workspaces.members.remove",i,{route:"/v1/organizations/workspaces/{workspace_id}/members/{user_id}",attributes:{"anthropic.organization.workspace.id":r,"anthropic.organization.workspace.member.id":e}})})}}class nF extends ne{update(e,t,i){let{workspace_id:r,...s}=t;return this._client.post(nb`/v1/organizations/workspaces/${r}/rate_limits/${e}`,{body:s,...i,__span:rN(this._client,"anthropic.organization.workspaces.rate_limits.update",i,{route:"/v1/organizations/workspaces/{workspace_id}/rate_limits/{rate_limit_id}",attributes:{"anthropic.organization.workspace.id":r,"anthropic.organization.workspace.rate_limit.id":e}})})}list(e,t={},i){return this._client.getAPIList(nb`/v1/organizations/workspaces/${e}/rate_limits`,s4,{query:t,...i,__span:rN(this._client,"anthropic.organization.workspaces.rate_limits.list",i,{route:"/v1/organizations/workspaces/{workspace_id}/rate_limits",queryParams:["group_type","include_inherited","limit","page"],attributes:{"anthropic.organization.workspace.id":e}})})}}class nH extends ne{retrieve(e,t,i){let{workspace_id:r}=t;return this._client.get(nb`/v1/organizations/workspaces/${r}/service_accounts/${e}`,{...i,__span:rN(this._client,"anthropic.organization.workspaces.service_accounts.retrieve",i,{route:"/v1/organizations/workspaces/{workspace_id}/service_accounts/{service_account_id}",attributes:{"anthropic.organization.workspace.id":r,"anthropic.organization.workspace.service_account.id":e}})})}update(e,t,i){let{workspace_id:r,...s}=t;return this._client.post(nb`/v1/organizations/workspaces/${r}/service_accounts/${e}`,{body:s,...i,__span:rN(this._client,"anthropic.organization.workspaces.service_accounts.update",i,{route:"/v1/organizations/workspaces/{workspace_id}/service_accounts/{service_account_id}",attributes:{"anthropic.organization.workspace.id":r,"anthropic.organization.workspace.service_account.id":e}})})}list(e,t={},i){return this._client.getAPIList(nb`/v1/organizations/workspaces/${e}/service_accounts`,s4,{query:t,...i,__span:rN(this._client,"anthropic.organization.workspaces.service_accounts.list",i,{route:"/v1/organizations/workspaces/{workspace_id}/service_accounts",queryParams:["limit","page"],attributes:{"anthropic.organization.workspace.id":e}})})}add(e,t,i){return this._client.post(nb`/v1/organizations/workspaces/${e}/service_accounts`,{body:t,...i,__span:rN(this._client,"anthropic.organization.workspaces.service_accounts.add",i,{route:"/v1/organizations/workspaces/{workspace_id}/service_accounts",attributes:{"anthropic.organization.workspace.id":e},createdIDAttribute:"anthropic.organization.workspace.service_account.id",createdIDField:"service_account_id"})})}remove(e,t,i){let{workspace_id:r}=t;return this._client.delete(nb`/v1/organizations/workspaces/${r}/service_accounts/${e}`,{...i,__span:rN(this._client,"anthropic.organization.workspaces.service_accounts.remove",i,{route:"/v1/organizations/workspaces/{workspace_id}/service_accounts/{service_account_id}",attributes:{"anthropic.organization.workspace.id":r,"anthropic.organization.workspace.service_account.id":e}})})}}var nB=(()=>{class e extends ne{constructor(){super(...arguments),this.rateLimits=new nF(this._client),this.members=new nW(this._client),this.serviceAccounts=new nH(this._client)}create(e,t){return this._client.post("/v1/organizations/workspaces",{body:e,...t,__span:rN(this._client,"anthropic.organization.workspaces.create",t,{route:"/v1/organizations/workspaces",createdIDAttribute:"anthropic.organization.workspace.id"})})}retrieve(e,t){return this._client.get(nb`/v1/organizations/workspaces/${e}`,{...t,__span:rN(this._client,"anthropic.organization.workspaces.retrieve",t,{route:"/v1/organizations/workspaces/{workspace_id}",attributes:{"anthropic.organization.workspace.id":e}})})}update(e,t,i){return this._client.post(nb`/v1/organizations/workspaces/${e}`,{body:t,...i,__span:rN(this._client,"anthropic.organization.workspaces.update",i,{route:"/v1/organizations/workspaces/{workspace_id}",attributes:{"anthropic.organization.workspace.id":e}})})}list(e={},t){return this._client.getAPIList("/v1/organizations/workspaces",s6,{query:e,...t,__span:rN(this._client,"anthropic.organization.workspaces.list",t,{route:"/v1/organizations/workspaces",queryParams:["after_id","before_id","include_archived","include_default","limit"]})})}archive(e,t){return this._client.post(nb`/v1/organizations/workspaces/${e}/archive`,{...t,__span:rN(this._client,"anthropic.organization.workspaces.archive",t,{route:"/v1/organizations/workspaces/{workspace_id}/archive",attributes:{"anthropic.organization.workspace.id":e}})})}}return e.RateLimits=nF,e.Members=nW,e.ServiceAccounts=nH,e})(),nK=(()=>{class e extends ne{constructor(){super(...arguments),this.apiKeys=new n$(this._client),this.externalKeys=new nP(this._client),this.federation=new nj(this._client),this.invites=new nE(this._client),this.serviceAccounts=new nU(this._client),this.users=new nM(this._client),this.workspaces=new nB(this._client),this.rateLimits=new nO(this._client),this.complianceSettings=new nT(this._client)}retrieve(e){return this._client.get("/v1/organizations/me",{...e,__span:rN(this._client,"anthropic.organization.retrieve",e,{route:"/v1/organizations/me"})})}}return e.APIKeys=n$,e.ExternalKeys=nP,e.Federation=nj,e.Invites=nE,e.ServiceAccounts=nU,e.Users=nM,e.Workspaces=nB,e.RateLimits=nO,e.ComplianceSettings=nT,e})();class nJ extends ne{retrieve(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.get(nb`/v1/deployment_runs/${e}`,{...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.deployment_runs.retrieve",i,{route:"/v1/deployment_runs/{deployment_run_id}",attributes:{"anthropic.deployment_run.id":e}})})}list(e={},t){let{betas:i,workspace_id:r,...s}=e??{};return this._client.getAPIList("/v1/deployment_runs",s4,{query:s,...t,headers:r$([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...null!=r?{"anthropic-workspace-id":r}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.deployment_runs.list",t,{route:"/v1/deployment_runs",queryParams:["created_at[gt]","created_at[gte]","created_at[lt]","created_at[lte]","deployment_id","has_error","limit","page","trigger_type"]})})}}class nG extends ne{create(e,t){let{betas:i,workspace_id:r,...s}=e;return this._client.post("/v1/deployments",{body:s,...t,headers:r$([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...null!=r?{"anthropic-workspace-id":r}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.deployments.create",t,{route:"/v1/deployments",createdIDAttribute:"anthropic.deployment.id"})})}retrieve(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.get(nb`/v1/deployments/${e}`,{...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.deployments.retrieve",i,{route:"/v1/deployments/{deployment_id}",attributes:{"anthropic.deployment.id":e}})})}update(e,t,i){let{betas:r,workspace_id:s,...n}=t;return this._client.post(nb`/v1/deployments/${e}`,{body:n,...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.deployments.update",i,{route:"/v1/deployments/{deployment_id}",attributes:{"anthropic.deployment.id":e}})})}list(e={},t){let{betas:i,workspace_id:r,...s}=e??{};return this._client.getAPIList("/v1/deployments",s4,{query:s,...t,headers:r$([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...null!=r?{"anthropic-workspace-id":r}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.deployments.list",t,{route:"/v1/deployments",queryParams:["agent_id","created_at[gte]","created_at[lte]","include_archived","limit","page","status"]})})}archive(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.post(nb`/v1/deployments/${e}/archive`,{...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.deployments.archive",i,{route:"/v1/deployments/{deployment_id}/archive",attributes:{"anthropic.deployment.id":e}})})}pause(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.post(nb`/v1/deployments/${e}/pause`,{...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.deployments.pause",i,{route:"/v1/deployments/{deployment_id}/pause",attributes:{"anthropic.deployment.id":e}})})}run(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.post(nb`/v1/deployments/${e}/run`,{...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.deployments.run",i,{route:"/v1/deployments/{deployment_id}/run",attributes:{"anthropic.deployment.id":e}})})}unpause(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.post(nb`/v1/deployments/${e}/unpause`,{...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.deployments.unpause",i,{route:"/v1/deployments/{deployment_id}/unpause",attributes:{"anthropic.deployment.id":e}})})}}class nX extends ne{create(e,t){let{betas:i,workspace_id:r,...s}=e;return this._client.post("/v1/dreams",{body:s,...t,headers:r$([{"anthropic-beta":[...i??[],"dreaming-2026-04-21"].toString(),...null!=r?{"anthropic-workspace-id":r}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.dreams.create",t,{route:"/v1/dreams",createdIDAttribute:"anthropic.dream.id"})})}retrieve(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.get(nb`/v1/dreams/${e}`,{...i,headers:r$([{"anthropic-beta":[...r??[],"dreaming-2026-04-21"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.dreams.retrieve",i,{route:"/v1/dreams/{dream_id}",attributes:{"anthropic.dream.id":e}})})}list(e={},t){let{betas:i,workspace_id:r,...s}=e??{};return this._client.getAPIList("/v1/dreams",s4,{query:s,...t,headers:r$([{"anthropic-beta":[...i??[],"dreaming-2026-04-21"].toString(),...null!=r?{"anthropic-workspace-id":r}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.dreams.list",t,{route:"/v1/dreams",queryParams:["created_at[gt]","created_at[lt]","include_archived","limit","page","statuses"]})})}archive(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.post(nb`/v1/dreams/${e}/archive`,{...i,headers:r$([{"anthropic-beta":[...r??[],"dreaming-2026-04-21"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.dreams.archive",i,{route:"/v1/dreams/{dream_id}/archive",attributes:{"anthropic.dream.id":e}})})}cancel(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.post(nb`/v1/dreams/${e}/cancel`,{...i,headers:r$([{"anthropic-beta":[...r??[],"dreaming-2026-04-21"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.dreams.cancel",i,{route:"/v1/dreams/{dream_id}/cancel",attributes:{"anthropic.dream.id":e}})})}}class nQ extends ne{list(e={},t){let{betas:i,workspace_id:r,...s}=e??{};return this._client.getAPIList("/v1/files",s4,{query:s,...t,headers:r$([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0,...null!=r?{"anthropic-workspace-id":r}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.files.list",t,{route:"/v1/files",queryParams:["ids","limit","page","scope_id"]})})}delete(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.delete(nb`/v1/files/${e}`,{...i,headers:r$([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0,...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.files.delete",i,{route:"/v1/files/{file_id}",attributes:{"anthropic.file.id":e}})})}download(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.get(nb`/v1/files/${e}/content`,{...i,headers:r$([{Accept:"application/binary",...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0,...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__binaryResponse:!0,__span:rN(this._client,"anthropic.files.download",i,{route:"/v1/files/{file_id}/content",attributes:{"anthropic.file.id":e}})})}retrieveMetadata(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.get(nb`/v1/files/${e}`,{...i,headers:r$([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0,...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.files.retrieve_metadata",i,{route:"/v1/files/{file_id}",attributes:{"anthropic.file.id":e}})})}upload(e,t){let{betas:i,workspace_id:r,...s}=e;return this._client.post("/v1/files",sG({body:s,...t,headers:r$([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0,...null!=r?{"anthropic-workspace-id":r}:void 0},no(s.file),t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.files.upload",t,{route:"/v1/files",createdIDAttribute:"anthropic.file.id"})},this._client))}}class nY extends ne{retrieve(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.get(nb`/v1/models/${e}`,{...i,headers:r$([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0,...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.models.retrieve",i,{route:"/v1/models/{model_id}",attributes:{"anthropic.model.id":e}})})}list(e={},t){let{betas:i,workspace_id:r,...s}=e??{};return this._client.getAPIList("/v1/models",s6,{query:s,...t,headers:r$([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0,...null!=r?{"anthropic-workspace-id":r}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.models.list",t,{route:"/v1/models",queryParams:["after_id","before_id","lifecycle","limit"]})})}}var nZ=e.i(305518);class n0 extends ne{parseUnverified(e){return JSON.parse(e)}unwrap(e,t){let i=t?.headers;if(null==i)throw Error("Webhook headers are required in order to verify the signature");let r=void 0===t.key?this._client.webhookKey:t.key;if(!r)throw Error("Webhook key must not be null or empty in order to unwrap");return new nZ.Webhook(r).verify(e,i),JSON.parse(e)}}class n1 extends ne{list(e,t={},i){let{betas:r,workspace_id:s,...n}=t??{};return this._client.getAPIList(nb`/v1/agents/${e}/versions`,s4,{query:n,...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.agents.versions.list",i,{route:"/v1/agents/{agent_id}/versions",queryParams:["limit","page"],attributes:{"gen_ai.agent.id":e}})})}}var n2=(()=>{class e extends ne{constructor(){super(...arguments),this.versions=new n1(this._client)}create(e,t){let{betas:i,workspace_id:r,...s}=e;return this._client.post("/v1/agents",{body:s,...t,headers:r$([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...null!=r?{"anthropic-workspace-id":r}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.agents.create",t,{route:"/v1/agents",createdIDAttribute:"gen_ai.agent.id"})})}retrieve(e,t={},i){let{betas:r,workspace_id:s,...n}=t??{};return this._client.get(nb`/v1/agents/${e}`,{query:n,...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.agents.retrieve",i,{route:"/v1/agents/{agent_id}",queryParams:["version"],attributes:{"gen_ai.agent.id":e}})})}update(e,t,i){let{betas:r,workspace_id:s,...n}=t;return this._client.post(nb`/v1/agents/${e}`,{body:n,...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.agents.update",i,{route:"/v1/agents/{agent_id}",attributes:{"gen_ai.agent.id":e}})})}list(e={},t){let{betas:i,workspace_id:r,...s}=e??{};return this._client.getAPIList("/v1/agents",s4,{query:s,...t,headers:r$([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...null!=r?{"anthropic-workspace-id":r}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.agents.list",t,{route:"/v1/agents",queryParams:["created_at[gte]","created_at[lte]","include_archived","limit","page"]})})}archive(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.post(nb`/v1/agents/${e}/archive`,{...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.agents.archive",i,{route:"/v1/agents/{agent_id}/archive",attributes:{"gen_ai.agent.id":e}})})}}return e.Versions=n1,e})();let n6=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return n6=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),i=e?()=>e.getRandomValues(t)[0]:()=>255*Math.random()&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(e^i()&15>>e/4).toString(16))};function n4(e,t){if(!e)return()=>{};if(e.aborted)return t.abort(),()=>{};let i=()=>t.abort();return e.addEventListener("abort",i),()=>e.removeEventListener("abort",i)}var n5=e.i(198156);function n3(e,{authToken:t,helper:i}){if(!t)throw new ry.v(`copyClientForHelper: expected a non-empty authToken but received ${JSON.stringify(t)}`);let r=e._options.defaultHeaders,s=e._authState?.extraHeaders,n=r$([s?Object.fromEntries(Object.entries(s).filter(([e])=>{let t=e.toLowerCase();return"authorization"!==t&&"x-api-key"!==t})):void 0,r,{[nt]:i}]);return n.values.delete("x-api-key"),n.values.delete("authorization"),n.nulls.delete("authorization"),e.withOptions({authToken:t,baseURL:e.baseURL,defaultHeaders:n})}function n8(e,t){e?.isRecording()&&(t.aborted||e.setStatus({code:rb.OK}),e.end())}function n9(e,t,i){e?.isRecording()&&(t.aborted||rU(e,i),e.end())}async function n7(e,t,i,r){if(!t)return r();try{await iJ.with(rm.setSpan(iJ.active(),t),r)}catch(r){throw rL(e,()=>n9(t,i,r)),r}rL(e,()=>n8(t,i))}var ae=(()=>{class e{constructor(e){let t,i;N.set(this,void 0),C.set(this,!1),j.set(this,void 0),D.set(this,void 0),U.set(this,void 0),W.set(this,void 0),F.set(this,void 0),H.set(this,void 0),B.set(this,void 0),this.client=e.client,this.environmentId=e.environmentId,this.environmentKey=e.environmentKey,this.workerId=e.workerId??(t=globalThis.process?.env,(i=t?.HOSTNAME)?`${i}-${n6()}`:n6()),(0,id.b)(this,N,n3(e.client,{authToken:e.environmentKey,helper:"environments-work-poller"}),"f"),(0,id.b)(this,U,e.autoStop??!0,"f"),(0,id.b)(this,W,e.drain??!1,"f"),(0,id.b)(this,F,void 0===e.blockMs?999:e.blockMs,"f"),(0,id.b)(this,H,e.reclaimOlderThanMs??null,"f"),(0,id.b)(this,B,e.requestOptions,"f"),(0,id.b)(this,j,new AbortController,"f"),(0,id.b)(this,D,n4(e.signal,(0,id.V)(this,j,"f")),"f")}get signal(){return(0,id.V)(this,j,"f").signal}abort(){(0,id.V)(this,j,"f").abort()}async *[(N=new WeakMap,C=new WeakMap,j=new WeakMap,D=new WeakMap,U=new WeakMap,W=new WeakMap,F=new WeakMap,H=new WeakMap,B=new WeakMap,Symbol.asyncIterator)](){if((0,id.V)(this,C,"f"))throw new ry.v("Cannot iterate over a consumed WorkPoller");(0,id.b)(this,C,!0,"f");let e=iJ.active(),t=(0,rz.u)(this.client);t.info("poller starting",{component:"work-poller",environment_id:this.environmentId});let i=new at(t,this.environmentId);try{let s=0;for(;!(0,id.V)(this,j,"f").signal.aborted;){let n;try{n=await (0,id.V)(this,N,"f").beta.environments.work.poll(this.environmentId,{"Anthropic-Worker-ID":this.workerId,...null!==(0,id.V)(this,F,"f")?{block_ms:(0,id.V)(this,F,"f")}:{},...null!==(0,id.V)(this,H,"f")?{reclaim_older_than_ms:(0,id.V)(this,H,"f")}:{}},{headers:r$([(0,id.V)(this,B,"f")?.headers]),signal:(0,id.V)(this,j,"f").signal})}catch(i){var r;if((0,id.V)(this,j,"f").signal.aborted)return;if((0,n5.d)(i))throw t.error("poll failed permanently, stopping poller",{error:String(i)}),i;let e=(0,n5.o)((r=s,(0,n5.J)(r,1e3,6e4)));t.warn("poll failed, backing off",{error:String(i),backoff_ms:e}),s++,await i_(e,(0,id.V)(this,j,"f").signal);continue}if(s=0,null==n){if((0,id.V)(this,W,"f"))return;i.onEmptyPoll(),await i_((0,n5.e)(1e3,3e3),(0,id.V)(this,j,"f").signal);continue}i.onClaim(),this._workSpan=rL(this.client,()=>{var t,i,r;return t=this.client,i=n,r=e,t._tracer?.startSpan("anthropic.environment.work",{kind:rv.INTERNAL,attributes:{[rO]:t._genAIProviderName,"anthropic.environment.id":i.environment_id,"anthropic.environment.work.id":i.id,"anthropic.session.id":i.data.id}},r)}),t.info("claimed work",{component:"work-poller",environment_id:this.environmentId,work_id:n.id,work_type:n.data.type});try{await (0,id.V)(this,N,"f").beta.environments.work.ack(n.id,{environment_id:n.environment_id},{headers:r$([(0,id.V)(this,B,"f")?.headers]),signal:(0,id.V)(this,j,"f").signal})}catch(e){t.error("ack failed",{work_id:n.id,error:String(e)}),rL(this.client,()=>n9(this._workSpan,(0,id.V)(this,j,"f").signal,e));continue}try{yield n,e=iJ.active()}finally{if((0,id.V)(this,U,"f"))try{await (0,id.V)(this,N,"f").beta.environments.work.stop(n.id,{environment_id:n.environment_id},{headers:r$([(0,id.V)(this,B,"f")?.headers])})}catch(e){(0,n5.w)(e,409)||t.warn("stop failed",{work_id:n.id,error:String(e)})}rL(this.client,()=>n8(this._workSpan,(0,id.V)(this,j,"f").signal))}}}finally{(0,id.V)(this,D,"f").call(this)}}}return e})(),at=(K=new WeakMap,J=new WeakMap,G=new WeakMap,X=new WeakMap,class{constructor(e,t){K.set(this,void 0),J.set(this,void 0),G.set(this,void 0),X.set(this,0),(0,id.b)(this,K,e,"f"),(0,id.b)(this,J,t,"f")}onEmptyPoll(){let e=Date.now(),t={component:"work-poller",environment_id:(0,id.V)(this,J,"f")};void 0===(0,id.V)(this,G,"f")?((0,id.b)(this,G,(0,id.b)(this,X,e,"f"),"f"),(0,id.V)(this,K,"f").info("idle; polling for work",t)):e-(0,id.V)(this,X,"f")>=3e5?((0,id.b)(this,X,e,"f"),(0,id.V)(this,K,"f").info(`still polling; idle for ${Math.round((e-(0,id.V)(this,G,"f"))/1e3)}s`,t)):(0,id.V)(this,K,"f").debug("poll returned no work",t)}onClaim(){(0,id.b)(this,G,void 0,"f")}}),ai=(Q=new WeakMap,Y=new WeakMap,Z=new WeakMap,class{constructor(){Q.set(this,[]),Y.set(this,[]),Z.set(this,!1)}push(e){if((0,id.V)(this,Z,"f"))return!1;let t=(0,id.V)(this,Y,"f").shift();return t?t({done:!1,value:e}):(0,id.V)(this,Q,"f").push(e),!0}close(){if(!(0,id.V)(this,Z,"f"))for((0,id.b)(this,Z,!0,"f");(0,id.V)(this,Y,"f").length>0;)(0,id.V)(this,Y,"f").shift()({done:!0,value:void 0})}next(e){return(0,id.V)(this,Q,"f").length>0?Promise.resolve({done:!1,value:(0,id.V)(this,Q,"f").shift()}):(0,id.V)(this,Z,"f")||e?.aborted?Promise.resolve({done:!0,value:void 0}):new Promise(t=>{let i=i=>{e?.removeEventListener("abort",r),t(i)},r=()=>{let e=(0,id.V)(this,Y,"f").indexOf(i);e>=0&&(0,id.V)(this,Y,"f").splice(e,1),t({done:!0,value:void 0})};(0,id.V)(this,Y,"f").push(i),e?.addEventListener("abort",r,{once:!0})})}tryShift(){return(0,id.V)(this,Q,"f").shift()}}),ar=e.i(32014);let as=RegExp("[\\x00-\\x1f\\x7f-\\x9f\\u061c\\u200e\\u200f\\u2028\\u2029\\u202a-\\u202e\\u2066-\\u2069]+","g"),an=/[\uD800-\uDFFF]/gu;function aa(e){return e.replace(an,"�")}function ao(e){return(function(e,t=4096){return ac(aa(e).replace(as," ").trim(),t)})(e,200).replace(/[' ]+/g," ").trim()}function al(e){return`Error: ${e instanceof Error?e.message:String(e)}`}function ac(e,t){if(e.length<=t)return e;let i=0,r=0;for(let s of e){if(r===t)break;r+=1,i+=s.length}return e.slice(0,i)}function au(e){return"name"in e?e.name:"mcp_server_name"in e?e.mcp_server_name:e.type}async function ah(e,t,i){try{let r=e.parse?e.parse(t):t;return{content:await e.run(r,i),isError:!1}}catch(e){return{content:e instanceof ar.f?e.content:al(e),isError:!0}}}async function ad(e,t,i,r,s){let n,a=e._tracer;if(!a)return s();let{signal:o,conversationId:l,sessionID:c,parentContext:u=iJ.active()}=r,h="description"in t?t.description:void 0,d={[ss]:"execute_tool",[rO]:e._genAIProviderName,"gen_ai.tool.name":i.name,..."toolset_name"in i&&"string"==typeof i.toolset_name?{"anthropic.toolset.name":i.toolset_name}:void 0,...h?{"gen_ai.tool.description":h}:void 0,"gen_ai.tool.call.id":i.id,"gen_ai.tool.type":"function",...null!=l?{[rE]:l}:void 0,...null!=c?{"anthropic.session.id":c}:void 0,..."session_thread_id"in i&&null!=i.session_thread_id?{"anthropic.session.thread.id":i.session_thread_id}:void 0},p="agent.tool_use"===i.type?"anthropic.tool_use":ns(t)&&"mcpTool"===t[nr]?"anthropic.mcp_tool_use":"anthropic.custom_tool_use",_=rL(e,()=>a.startSpan(`${p} ${i.name}`,{kind:rv.INTERNAL,attributes:d},u));if(!_)return s();try{return n=await iJ.with(rm.setSpan(u,_),s)}finally{let t=void 0!==n&&!n.isError,r=!t&&o?.aborted===!0,{contentMode:s,maxContentBytes:a}=e.openTelemetry.traces;if("content"===s&&_.isRecording())try{sv(_,{"gen_ai.tool.call.arguments":i.input,[sh]:n&&!r?sg(n.content):void 0},a)}catch(t){(0,rz.u)(e).debug("could not record the tool run on its span",t)}rL(e,()=>{t?_.setStatus({code:rb.OK}):r||rU(_,n,"tool_error"),_.end()})}}function ap(e){return"session.status_idle"===e.type&&e.stop_reason?.type!=="requires_action"}var a_=(ee=new WeakMap,et=new WeakMap,ei=new WeakMap,er=new WeakMap,es=new WeakMap,class{constructor(e,t){ee.set(this,void 0),et.set(this,void 0),ei.set(this,new Set),er.set(this,!1),es.set(this,void 0),(0,id.b)(this,ee,e,"f"),(0,id.b)(this,et,t,"f")}noteEvent(e){"user.tool_confirmation"!==e.type&&(ap(e)?this.arm():this.disarm())}block(e){(0,id.V)(this,ei,"f").add(e),void 0!==(0,id.V)(this,es,"f")&&((0,id.b)(this,er,!0,"f"),clearTimeout((0,id.V)(this,es,"f")),(0,id.b)(this,es,void 0,"f"))}unblock(e){(0,id.V)(this,ei,"f").delete(e),0===(0,id.V)(this,ei,"f").size&&(0,id.V)(this,er,"f")&&this.arm()}arm(){if(!(0>=(0,id.V)(this,ee,"f"))){if((0,id.V)(this,ei,"f").size>0)return void(0,id.b)(this,er,!0,"f");(0,id.b)(this,er,!1,"f"),void 0!==(0,id.V)(this,es,"f")&&clearTimeout((0,id.V)(this,es,"f")),(0,id.b)(this,es,setTimeout((0,id.V)(this,et,"f"),(0,id.V)(this,ee,"f")),"f")}}disarm(){(0,id.b)(this,er,!1,"f"),void 0!==(0,id.V)(this,es,"f")&&(clearTimeout((0,id.V)(this,es,"f")),(0,id.b)(this,es,void 0,"f"))}}),af=(()=>{class e{constructor(e,t){en.add(this),ea.set(this,!1),eo.set(this,void 0),el.set(this,void 0),ec.set(this,void 0),eu.set(this,void 0),eh.set(this,void 0),ed.set(this,new Set),ep.set(this,new Set),e_.set(this,new Map),ef.set(this,new Map),eg.set(this,new ai),em.set(this,0),ev.set(this,3e5),eb.set(this,null),ey.set(this,void 0),ew.set(this,void 0),ek.set(this,void 0),ez.set(this,!1),this.client=t.client,this.sessionId=e,this.tools=t.tools,this.maxIdleMs=t.maxIdleMs??6e4,(0,id.b)(this,eh,(0,rz.u)(t.client),"f"),(0,id.b)(this,eu,new Map(t.tools.map(e=>[au(e),e])),"f"),(0,id.b)(this,eo,new AbortController,"f"),(0,id.b)(this,el,n4(t.signal,(0,id.V)(this,eo,"f")),"f"),(0,id.b)(this,ec,t.requestOptions,"f"),(0,id.b)(this,ey,new a_(this.maxIdleMs,()=>{(0,id.V)(this,eh,"f").info("session idle after its turn ended; stopping",{component:"session-tool-runner",session_id:this.sessionId,max_idle_ms:this.maxIdleMs}),(0,id.V)(this,eo,"f").abort()}),"f")}get signal(){return(0,id.V)(this,eo,"f").signal}abort(){(0,id.V)(this,eo,"f").abort()}_setSendRetryWindow(e){(0,id.b)(this,ev,e,"f")}async *[(ea=new WeakMap,eo=new WeakMap,el=new WeakMap,ec=new WeakMap,eu=new WeakMap,eh=new WeakMap,ed=new WeakMap,ep=new WeakMap,e_=new WeakMap,ef=new WeakMap,eg=new WeakMap,em=new WeakMap,ev=new WeakMap,eb=new WeakMap,ey=new WeakMap,ew=new WeakMap,ek=new WeakMap,ez=new WeakMap,en=new WeakSet,Symbol.asyncIterator)](){if((0,id.V)(this,ea,"f"))throw new ry.v("Cannot iterate over a consumed SessionToolRunner");(0,id.b)(this,ea,!0,"f"),(0,id.b)(this,ew,this.client._tracer?iJ.active():void 0,"f"),(0,id.V)(this,eh,"f").info("session tool runner starting",{component:"session-tool-runner",session_id:this.sessionId});let e=(0,id.V)(this,en,"m",eS).call(this).catch(e=>{(0,id.V)(this,eo,"f").signal.aborted||(0,id.V)(this,eh,"f").error("stream loop failed",{error:String(e)}),(0,id.V)(this,eo,"f").abort()});try{let t;for(;;){let e=await (0,id.V)(this,eg,"f").next((0,id.V)(this,eo,"f").signal);if(e.done)break;yield e.value}for(await e;void 0!==(t=(0,id.V)(this,eg,"f").tryShift());)yield t}finally{(0,id.V)(this,eo,"f").abort(),(0,id.V)(this,ey,"f").disarm(),await e;try{await (0,id.V)(this,en,"m",eM).call(this)}catch(e){(0,id.V)(this,eh,"f").warn("drain failed",{error:String(e)})}for(let e of((0,id.V)(this,eg,"f").close(),this.tools))try{await e.close?.()}catch(t){(0,id.V)(this,eh,"f").warn("tool.close failed",{tool:au(e),error:String(t)})}(0,id.V)(this,el,"f").call(this)}}}return ex=function(){return{...(0,id.V)(this,ec,"f"),headers:r$([{[nt]:"session-tool-runner"},(0,id.V)(this,ec,"f")?.headers]),signal:(0,id.V)(this,eo,"f").signal}},eS=async function(){let e=(0,id.V)(this,eo,"f"),t=500;for(;!e.signal.aborted;){try{let e=await this.client.beta.sessions.events.stream(this.sessionId,{},(0,id.V)(this,en,"m",ex).call(this));for await(let i of(await (0,id.V)(this,en,"m",eV).call(this),e))if(t=500,await (0,id.V)(this,en,"m",eq).call(this,i))return}catch(i){if(e.signal.throwIfAborted(),(0,n5.d)(i))throw(0,id.V)(this,eh,"f").error("permanent stream failure, shutting down",{error:String(i)}),e.abort(),i;(0,id.V)(this,eh,"f").warn("stream disconnected, reconnecting",{error:String(i),backoff_ms:t})}e.signal.throwIfAborted(),await i_(t,e.signal),t=Math.min(2*t,1e4)}},eV=async function(){let e=(0,id.V)(this,eo,"f"),t=[],i=!1;(0,id.b)(this,ez,!1,"f");try{for await(let e of this.client.beta.sessions.events.list(this.sessionId,{limit:1e3},(0,id.V)(this,en,"m",ex).call(this)))(0,id.V)(this,en,"m",eA).call(this,e,t),"user.tool_confirmation"!==e.type&&(i=ap(e))}catch(i){for(let r of(e.signal.throwIfAborted(),(0,id.V)(this,eh,"f").warn("reconcile list failed",{error:String(i)}),t))(0,id.V)(this,ed,"f").delete(r.id);return}(0,id.b)(this,ez,!0,"f");let r=t.filter(e=>!(0,id.V)(this,ep,"f").has(e.id));for(let e of((0,id.V)(this,ey,"f").disarm(),r))await (0,id.V)(this,en,"m",eR).call(this,e);for(let e of[...(0,id.V)(this,ef,"f").values()]){let t=(0,id.V)(this,e_,"f").get(e.id);void 0!==t&&await (0,id.V)(this,en,"m",eT).call(this,e,t)}let s=r.filter(e=>!(0,id.V)(this,ep,"f").has(e.id)&&!(0,id.V)(this,ef,"f").has(e.id));i&&0===s.length?(0,id.V)(this,ey,"f").arm():(0,id.V)(this,ey,"f").disarm()},eA=function(e,t){(0,id.V)(this,en,"m",eI).call(this,e),"agent.tool_use"===e.type||"agent.custom_tool_use"===e.type?((0,id.V)(this,ed,"f").add(e.id),(0,id.V)(this,ep,"f").has(e.id)||t.push(e)):"user.tool_result"===e.type?(0,id.V)(this,ep,"f").add(e.tool_use_id):"user.custom_tool_result"===e.type?(0,id.V)(this,ep,"f").add(e.custom_tool_use_id):"user.tool_confirmation"!==e.type||(0,id.V)(this,ep,"f").has(e.tool_use_id)||(0,id.V)(this,e_,"f").set(e.tool_use_id,e.result)},eI=function(e){if(this.client._tracer&&void 0===(0,id.V)(this,ek,"f"))switch(e.type){case"session.thread_status_running":case"session.thread_status_idle":case"session.thread_status_rescheduled":case"session.thread_status_terminated":(0,id.b)(this,ek,e.session_thread_id,"f")}},eq=async function(e){switch((0,id.V)(this,ey,"f").noteEvent(e),(0,id.V)(this,ez,"f")&&(0,id.V)(this,en,"m",eI).call(this,e),e.type){case"agent.tool_use":case"agent.custom_tool_use":return(0,id.V)(this,ed,"f").has(e.id)||((0,id.V)(this,ed,"f").add(e.id),await (0,id.V)(this,en,"m",eR).call(this,e)),!1;case"user.tool_confirmation":return await (0,id.V)(this,en,"m",e$).call(this,e),!1;case"user.tool_result":return(0,id.V)(this,ep,"f").add(e.tool_use_id),!1;case"user.custom_tool_result":return(0,id.V)(this,ep,"f").add(e.custom_tool_use_id),!1;case"session.status_terminated":case"session.deleted":return(0,id.V)(this,eh,"f").info("session terminated",{component:"session-tool-runner",session_id:this.sessionId}),(0,id.V)(this,eo,"f").abort(),!0;default:return!1}},eR=async function(e){let t=e.evaluated_permission,i="deny"===t?"deny":(0,id.V)(this,e_,"f").get(e.id);void 0===i?void 0===t||"allow"===t?await (0,id.V)(this,en,"m",eE).call(this,e,void 0):(0,id.V)(this,ef,"f").has(e.id)||((0,id.V)(this,eh,"f").info("tool call awaiting confirmation; holding",{component:"session-tool-runner",session_id:this.sessionId,tool:e.name,tool_use_id:e.id}),(0,id.V)(this,ef,"f").set(e.id,e),(0,id.V)(this,ey,"f").block(e.id)):await (0,id.V)(this,en,"m",eT).call(this,e,i)},e$=async function(e){(0,id.V)(this,e_,"f").set(e.tool_use_id,e.result);let t=(0,id.V)(this,ef,"f").get(e.tool_use_id);void 0!==t&&await (0,id.V)(this,en,"m",eT).call(this,t,e.result)},eT=async function(e,t){let i=(0,id.V)(this,ef,"f").delete(e.id);if("allow"===t){(0,id.V)(this,eh,"f").info("tool call confirmed",{component:"session-tool-runner",session_id:this.sessionId,tool:e.name,tool_use_id:e.id}),i||(0,id.V)(this,ey,"f").block(e.id);try{await (0,id.V)(this,en,"m",eE).call(this,e,"allow")}finally{(0,id.V)(this,ey,"f").unblock(e.id)}return}i&&(0,id.V)(this,ey,"f").unblock(e.id),(0,id.V)(this,ep,"f").add(e.id),(0,id.V)(this,eh,"f").info("tool call denied; not executing",{component:"session-tool-runner",session_id:this.sessionId,tool:e.name,tool_use_id:e.id}),(0,id.V)(this,en,"m",eP).call(this,{event:e,toolUseId:e.id,name:e.name,isError:!1,posted:!1,confirmation:"deny"})},eP=function(e){(0,id.V)(this,eg,"f").push(e)},eE=async function(e,t){var i,r,s,n,a;if(!(0,id.V)(this,ep,"f").has(e.id)){(0,id.V)(this,eh,"f").info("executing tool",{component:"session-tool-runner",session_id:this.sessionId,tool:e.name,tool_use_id:e.id}),(0,id.b)(this,em,(i=(0,id.V)(this,em,"f"),++i),"f");try{let i,r,o=(0,id.V)(this,eu,"f").get(e.name);if(!o){(0,id.V)(this,eh,"f").info("tool not owned by this runner; leaving the tool_use_id pending for its owner",{component:"session-tool-runner",session_id:this.sessionId,tool:e.name,tool_use_id:e.id}),"allow"===t&&(0,id.V)(this,ey,"f").disarm(),(0,id.V)(this,en,"m",eP).call(this,{event:e,toolUseId:e.id,name:e.name,isError:!1,posted:!1,confirmation:t});return}let l=(0,id.V)(this,ec,"f")?.openTelemetry?.conversationId??(e.session_thread_id||(0,id.V)(this,ek,"f")),c=new AbortController,u=n4((0,id.V)(this,eo,"f").signal,c),h=setTimeout(()=>c.abort(),12e4);try{let t={signal:(0,id.V)(this,eo,"f").signal,conversationId:l,sessionID:this.sessionId,parentContext:(0,id.V)(this,ew,"f")},s=await ad(this.client,o,e,t,async()=>{let t=await ah(o,e.input,{toolUse:e,toolUseBlock:e,signal:c.signal}),i=function(e){if("string"==typeof e)return[{type:"text",text:e||"(no output)"}];let t=e.map(e=>"text"===e.type?{type:"text",text:e.text||"(no output)"}:"image"===e.type||"document"===e.type?e:"search_result"===e.type?{type:"search_result",source:e.source,title:e.title,content:e.content.map(e=>({type:"text",text:e.text})),citations:{enabled:e.citations?.enabled??!1}}:{type:"text",text:JSON.stringify(e)});return t.length>0?t:[{type:"text",text:"(no output)"}]}(t.content),r=this.client._tracer?i.map((e,i)=>{let r="string"==typeof t.content?void 0:t.content[i];return r&&"text"!==r.type&&"text"===e.type?r:e}):i;return{sent:i,content:r,isError:t.isError}});i=s.sent,r=s.isError}finally{clearTimeout(h),u()}let d=(s=e,n=r,a=i,"agent.custom_tool_use"===s.type?{type:"user.custom_tool_result",custom_tool_use_id:s.id,is_error:n,content:a}:{type:"user.tool_result",tool_use_id:s.id,is_error:n,content:a}),p=await (0,id.V)(this,en,"m",eO).call(this,d,e.id,l);(0,id.V)(this,en,"m",eP).call(this,{event:e,result:d,toolUseId:e.id,name:e.name,isError:r,posted:p,confirmation:t})}finally{(0,id.b)(this,em,(r=(0,id.V)(this,em,"f"),--r),"f"),0===(0,id.V)(this,em,"f")&&(0,id.V)(this,eb,"f")?.call(this)}}},eO=async function(e,t,i){let r,s=(0,id.V)(this,eo,"f"),n=Date.now(),a=0;for(;;){a++,s.signal.throwIfAborted();try{return await this.client.beta.sessions.events.send(this.sessionId,{events:[e]},{...(0,id.V)(this,en,"m",ex).call(this),openTelemetry:{conversationId:i}}),(0,id.V)(this,ep,"f").add(t),!0}catch(o){if(r=o,(0,n5.d)(o))break;let e=(0,id.V)(this,ev,"f")-(Date.now()-n);if(e<=0)break;let i=Math.min((0,n5.o)((0,n5.J)(a-1,1e3,3e4)),e);(0,id.V)(this,eh,"f").warn("tool result send failed; retrying",{tool_use_id:t,attempt:a,backoff_ms:i,error:String(o)}),await i_(i,s.signal)}}return(0,id.V)(this,eh,"f").error("failed to send tool result",{tool_use_id:t,attempts:a,error:String(r)}),!1},eM=async function(){0!==(0,id.V)(this,em,"f")&&(await Promise.race([new Promise(e=>(0,id.b)(this,eb,e,"f")),i_(3e4)]),(0,id.b)(this,eb,null,"f"),(0,id.V)(this,em,"f")>0&&(0,id.V)(this,eh,"f").warn("drain timeout exceeded"))},e})(),ag=e.i(193668),am=(eN=new WeakMap,eL=new WeakSet,eC=async function(t,i,r,s){let n,a,o,l=(0,rz.u)(this.client),c=function(e){let t;if(!e)return null;try{let i=e.replace(/-/g,"+").replace(/_/g,"/"),r=i.padEnd(4*Math.ceil(i.length/4),"=");t=JSON.parse((0,rw.z)((e=>{if(void 0!==globalThis.Buffer){let t=globalThis.Buffer.from(e,"base64");return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}if("u">typeof atob){let t=atob(e),i=new Uint8Array(t.length);for(let e=0;e<t.length;e++)i[e]=t.charCodeAt(e);return i}throw new ry.v("Cannot decode base64 string; Expected `Buffer` or `atob` to be defined")})(r)))}catch{return null}if(null===t||"object"!=typeof t||Array.isArray(t))return null;let i=t.sessions_token;return"string"==typeof i&&""!==i?i:null}(t.secret),u=c??i;if(void 0===u)throw new ry.v("handleItem: the work item carried a secret payload but no sessions token could be extracted, and there is no environment key to fall back to; the poller must issue a secret whose payload carries `sessions_token`, or provide the environment key (pass it, construct the worker with it, or set ANTHROPIC_ENVIRONMENT_KEY)");t.secret&&null===c&&l.warn("work item carried a secret payload but no sessions token could be extracted; falling back to the environment key",{work_id:t.id});let h=n3(this.client,{authToken:u,helper:"environments-worker"}),d=t.data.id,p=new AbortController,_=n4(r,p),f=new ay(p),g=await e.A(146735),m=aw(h,t,f,l,this.requestOptions,e=>{n=e,a?._setSendRetryWindow(e)}).catch(e=>{p.signal.aborted||l.error("heartbeat loop failed",{work_id:t.id,error:String(e)}),p.abort()}),v=async()=>{},b=!1;try{if("session"!==t.data.type)return void l.debug("skipping non-session work item",{work_id:t.id,type:t.data.type});let e=await h.beta.sessions.retrieve(d);if(null===c&&null!==this.memorySyncIntervalMs&&e.resources.some(e=>"memory_store"===e.type))throw new g.SessionMemoryError(`cannot mount the session's memories: the work item carried no sessions token (work_id=${t.id}, session_id=${d}); the memory endpoints reject the environment key, so the poller must issue a per-item \`secret\` carrying \`sessions_token\`, or set \`memorySyncIntervalMs: null\` to run without memory`);let i={workdir:this.workdir,client:h,session:e,...void 0!==this.maxFileBytes?{maxFileBytes:this.maxFileBytes}:{}};try{v=await g.setupSkills(i)}catch(e){l.warn("skill setup failed",{session_id:d,work_id:t.id,error:String(e)})}null!==c&&null!==this.memorySyncIntervalMs?(o=new g.SessionMemoryStores(h,{workdir:this.workdir,...void 0!==this.memorySyncIntervalMs?{syncIntervalMs:this.memorySyncIntervalMs}:{},syncDeletions:this.memorySyncDeletions}),await o.download(e),i.allowedRoots=o.roots,i.readOnlyRoots=o.readOnlyRoots):l.debug("memory stores disabled for this item",{work_id:t.id});let r="function"==typeof this.tools?this.tools(i):this.tools??g.betaAgentToolset20260401(i);for await(let e of(a=new af(d,{client:h,tools:r,...void 0!==this.maxIdleMs?{maxIdleMs:this.maxIdleMs}:{},...void 0!==this.requestOptions?{requestOptions:this.requestOptions}:{},signal:p.signal}),void 0!==n&&a._setSendRetryWindow(n),a))o&&await o.syncIfDue();b=!p.signal.aborted}finally{try{await v().catch(e=>{l.warn("skill cleanup failed",{session_id:d,work_id:t.id,error:String(e)})})}finally{if(o){let e=g.MEMORY_FLUSH_TIMEOUT_MS;b&&await av(o.finish(),e)&&l.warn(`final memory sync cut off after ${e}ms; the flush that follows still uploads changed files`,{session_id:d,work_id:t.id});let i=new AbortController;await av(o.flushWrites(i.signal),e)&&(i.abort(),l.warn(`memory flush cut off after ${e}ms; changed files it had not uploaded yet are not saved`,{session_id:d,work_id:t.id})),await o.dispose().catch(e=>{l.warn("memory store cleanup failed",{session_id:d,work_id:t.id,error:String(e)})})}}f.finish("runner_done"),_(),await m,f.lost?l.info("lease lost; released without stopping it",{session_id:d,work_id:t.id}):await ab(h,t,l,this.requestOptions),(f.lost||f.rejected)&&rL(this.client,()=>s?.end())}},class{constructor(e){if(eL.add(this),eN.set(this,void 0),void 0!==e.unrestrictedPaths)throw new ry.v("The `unrestrictedPaths` option you passed to EnvironmentWorker (or client.beta.environments.work.worker()) is no longer supported. The worker's file tools (read, write, edit, glob, grep) are now always confined to `workdir` plus the session's memory folders. Remove `unrestrictedPaths` from your options; to let the file tools reach any other directory, add it to `AgentToolContext.allowedRoots` from a `tools` factory.");this.client=e.client,this.environmentId=e.environmentId,this.environmentKey=e.environmentKey,this.tools=e.tools,this.workdir=e.workdir??process.cwd(),this.maxFileBytes=e.maxFileBytes,this.maxIdleMs=e.maxIdleMs,null!=e.memorySyncIntervalMs&&(0,ag.A)(e.memorySyncIntervalMs,"memorySyncIntervalMs"),this.memorySyncIntervalMs=e.memorySyncIntervalMs,this.memorySyncDeletions=e.memorySyncDeletions??"enabled",this.workerId=e.workerId,this.requestOptions=e.requestOptions,(0,id.b)(this,eN,e.signal,"f")}async run(e){let{environmentId:t,environmentKey:i}=this;if(void 0===t||void 0===i)throw new ry.v("EnvironmentWorker.run: environmentId and environmentKey are required to poll for work");let r=e??(0,id.V)(this,eN,"f"),s=new ae({client:this.client,environmentId:t,environmentKey:i,...void 0!==this.workerId?{workerId:this.workerId}:{},...r?{signal:r}:{},...void 0!==this.requestOptions?{requestOptions:this.requestOptions}:{},autoStop:!1});for await(let e of s){let t=s._workSpan;try{await n7(this.client,t,s.signal,()=>(0,id.V)(this,eL,"m",eC).call(this,e,i,s.signal,t))}catch(t){if(s.signal?.aborted)throw t;(0,rz.u)(this.client).error("work item failed",{work_id:e.id,error:String(t)})}}}async handleItem(e){let t=e?.workId??(0,rT.f)("ANTHROPIC_WORK_ID"),i=e?.environmentId??(0,rT.f)("ANTHROPIC_ENVIRONMENT_ID"),r=e?.sessionId??(0,rT.f)("ANTHROPIC_SESSION_ID"),s=(e?.environmentKey??this.environmentKey??(0,rT.f)("ANTHROPIC_ENVIRONMENT_KEY"))||void 0,n=e?.workSecret||(0,rT.f)("ANTHROPIC_WORK_SECRET")||null;if(!t)throw new ry.v("handleItem: workId is required — pass it or set ANTHROPIC_WORK_ID");if(!i)throw new ry.v("handleItem: environmentId is required — pass it or set ANTHROPIC_ENVIRONMENT_ID");if(!r)throw new ry.v("handleItem: sessionId is required — pass it or set ANTHROPIC_SESSION_ID");if(!s&&!n)throw new ry.v("handleItem: environmentKey is required when there is no work secret — pass it, construct the worker with it, or set ANTHROPIC_ENVIRONMENT_KEY");await (0,id.V)(this,eL,"m",eC).call(this,{id:t,environment_id:i,secret:n,data:{type:"session",id:r}},s,e?.signal??(0,id.V)(this,eN,"f"))}});async function av(e,t){let i;try{return await Promise.race([e.then(()=>!1,()=>!1),new Promise(e=>{i=setTimeout(()=>e(!0),t)})])}finally{void 0!==i&&clearTimeout(i)}}async function ab(e,t,i,r){try{await e.beta.environments.work.stop(t.id,{environment_id:t.environment_id,force:!0},{...r,headers:r$([r?.headers])})}catch(e){(0,n5.w)(e,409)||i.error("force-stop on exit failed",{work_id:t.id,error:String(e)})}}var ay=(ej=new WeakMap,eD=new WeakMap,class{constructor(e){ej.set(this,void 0),eD.set(this,void 0),(0,id.b)(this,ej,e,"f")}get signal(){return(0,id.V)(this,ej,"f").signal}finish(e){(0,id.b)(this,eD,(0,id.V)(this,eD,"f")??e,"f"),(0,id.V)(this,ej,"f").abort()}get lost(){return"lease_lost"===(0,id.V)(this,eD,"f")||"assumed_lost"===(0,id.V)(this,eD,"f")}get rejected(){return"heartbeat_rejected"===(0,id.V)(this,eD,"f")}});async function aw(e,t,i,r,s,n){let a=3e4,o=9e4,l=Date.now(),c="NO_HEARTBEAT",u=async()=>{let u=new AbortController,h=n4(i.signal,u),d=setTimeout(()=>u.abort(),a);try{let h=await e.beta.environments.work.heartbeat(t.id,{environment_id:t.environment_id,expected_last_heartbeat:c},{...s,headers:r$([s?.headers]),signal:u.signal});l=Date.now(),c=h.last_heartbeat,h.ttl_seconds>0&&(o=1e3*h.ttl_seconds,a=Math.max(1e3,Math.min(o/2,3e4)),n?.(o)),("stopping"===h.state||"stopped"===h.state)&&(r.info("heartbeat signals shutdown",{work_id:t.id,state:h.state}),i.finish("control_plane_stop")),h.lease_extended||(r.warn("lease not extended, shutting down",{work_id:t.id}),i.finish("control_plane_stop"))}catch(e){if(i.signal.throwIfAborted(),(0,n5.w)(e,412)){let s=function(e){let t=e instanceof ry.E?e.error:void 0;for(let e of["error","details","current_state"]){if(!(0,ip.u)(t))return{};t=t[e]}return(0,ip.u)(t)?t:{}}(e);r.error("lease lost: heartbeat precondition failed",{work_id:t.id,server_state:s.state,server_ttl_seconds:s.ttl_seconds,server_last_heartbeat:s.last_heartbeat}),i.finish("lease_lost");return}if((0,n5.d)(e))throw r.error("permanent heartbeat failure",{work_id:t.id,error:String(e)}),i.finish("heartbeat_rejected"),e;if(Date.now()-l>o){r.error("lease assumed lost: no successful heartbeat in ttl",{work_id:t.id,ttl_ms:o,error:String(e)}),i.finish("assumed_lost");return}r.warn("transient heartbeat failure",{work_id:t.id,error:String(e)})}finally{clearTimeout(d),h()}};for(await u();!i.signal.aborted;)await i_(a,i.signal),i.signal.throwIfAborted(),await u()}var ak=(()=>{class e extends ne{retrieve(e,t,i){let{environment_id:r,betas:s,workspace_id:n}=t;return this._client.get(nb`/v1/environments/${r}/work/${e}`,{...i,headers:r$([{"anthropic-beta":[...s??[],"managed-agents-2026-04-01"].toString(),...null!=n?{"anthropic-workspace-id":n}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.environments.work.retrieve",i,{route:"/v1/environments/{environment_id}/work/{work_id}",attributes:{"anthropic.environment.id":r,"anthropic.environment.work.id":e}})})}update(e,t,i){let{environment_id:r,betas:s,workspace_id:n,...a}=t;return this._client.post(nb`/v1/environments/${r}/work/${e}`,{body:a,...i,headers:r$([{"anthropic-beta":[...s??[],"managed-agents-2026-04-01"].toString(),...null!=n?{"anthropic-workspace-id":n}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.environments.work.update",i,{route:"/v1/environments/{environment_id}/work/{work_id}",attributes:{"anthropic.environment.id":r,"anthropic.environment.work.id":e}})})}list(e,t={},i){let{betas:r,...s}=t??{};return this._client.getAPIList(nb`/v1/environments/${e}/work`,s4,{query:s,...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.environments.work.list",i,{route:"/v1/environments/{environment_id}/work",queryParams:["limit","page"],attributes:{"anthropic.environment.id":e}})})}ack(e,t,i){let{environment_id:r,betas:s}=t;return this._client.post(nb`/v1/environments/${r}/work/${e}/ack`,{...i,headers:r$([{"anthropic-beta":[...s??[],"managed-agents-2026-04-01"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.environments.work.ack",i,{route:"/v1/environments/{environment_id}/work/{work_id}/ack",attributes:{"anthropic.environment.id":r,"anthropic.environment.work.id":e}})})}heartbeat(e,t,i){let{environment_id:r,desired_ttl_seconds:s,expected_last_heartbeat:n,betas:a}=t;return this._client.post(nb`/v1/environments/${r}/work/${e}/heartbeat`,{query:{desired_ttl_seconds:s,expected_last_heartbeat:n},...i,headers:r$([{"anthropic-beta":[...a??[],"managed-agents-2026-04-01"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.environments.work.heartbeat",i,{route:"/v1/environments/{environment_id}/work/{work_id}/heartbeat",queryParams:["desired_ttl_seconds","expected_last_heartbeat"],attributes:{"anthropic.environment.id":r,"anthropic.environment.work.id":e}})})}poll(e,t={},i){let{betas:r,"Anthropic-Worker-ID":s,...n}=t??{};return this._client.get(nb`/v1/environments/${e}/work/poll`,{query:n,...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"Anthropic-Worker-ID":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.environments.work.poll",i,{route:"/v1/environments/{environment_id}/work/poll",queryParams:["block_ms","reclaim_older_than_ms"],attributes:{"anthropic.environment.id":e}})})}stats(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.get(nb`/v1/environments/${e}/work/stats`,{...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.environments.work.stats",i,{route:"/v1/environments/{environment_id}/work/stats",attributes:{"anthropic.environment.id":e}})})}stop(e,t,i){let{environment_id:r,betas:s,workspace_id:n,...a}=t;return this._client.post(nb`/v1/environments/${r}/work/${e}/stop`,{body:a,...i,headers:r$([{"anthropic-beta":[...s??[],"managed-agents-2026-04-01"].toString(),...null!=n?{"anthropic-workspace-id":n}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.environments.work.stop",i,{route:"/v1/environments/{environment_id}/work/{work_id}/stop",attributes:{"anthropic.environment.id":r,"anthropic.environment.work.id":e}})})}poller(e){return new ae({...e,client:this._client})}worker(e){return new am({...e,client:this._client})}}return e.WorkPoller=ae,e.EnvironmentWorker=am,e})(),az=(()=>{class e extends ne{constructor(){super(...arguments),this.work=new ak(this._client)}create(e,t){let{betas:i,workspace_id:r,...s}=e;return this._client.post("/v1/environments",{body:s,...t,headers:r$([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...null!=r?{"anthropic-workspace-id":r}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.environments.create",t,{route:"/v1/environments",createdIDAttribute:"anthropic.environment.id"})})}retrieve(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.get(nb`/v1/environments/${e}`,{...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.environments.retrieve",i,{route:"/v1/environments/{environment_id}",attributes:{"anthropic.environment.id":e}})})}update(e,t,i){let{betas:r,workspace_id:s,...n}=t;return this._client.post(nb`/v1/environments/${e}`,{body:n,...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.environments.update",i,{route:"/v1/environments/{environment_id}",attributes:{"anthropic.environment.id":e}})})}list(e={},t){let{betas:i,workspace_id:r,...s}=e??{};return this._client.getAPIList("/v1/environments",s4,{query:s,...t,headers:r$([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...null!=r?{"anthropic-workspace-id":r}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.environments.list",t,{route:"/v1/environments",queryParams:["include_archived","limit","page"]})})}delete(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.delete(nb`/v1/environments/${e}`,{...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.environments.delete",i,{route:"/v1/environments/{environment_id}",attributes:{"anthropic.environment.id":e}})})}archive(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.post(nb`/v1/environments/${e}/archive`,{...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.environments.archive",i,{route:"/v1/environments/{environment_id}/archive",attributes:{"anthropic.environment.id":e}})})}}return e.Work=ak,e})();class ax extends ne{create(e,t,i){let{view:r,betas:s,workspace_id:n,...a}=t;return this._client.post(nb`/v1/memory_stores/${e}/memories`,{query:{view:r},body:a,...i,headers:r$([{"anthropic-beta":[...s??[],"agent-memory-2026-07-22"].toString(),...null!=n?{"anthropic-workspace-id":n}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.memory_stores.memories.create",i,{route:"/v1/memory_stores/{memory_store_id}/memories",queryParams:["view"],attributes:{"gen_ai.memory.store.id":e},createdIDAttribute:"gen_ai.memory.record.id"})})}retrieve(e,t,i){let{memory_store_id:r,betas:s,workspace_id:n,...a}=t;return this._client.get(nb`/v1/memory_stores/${r}/memories/${e}`,{query:a,...i,headers:r$([{"anthropic-beta":[...s??[],"agent-memory-2026-07-22"].toString(),...null!=n?{"anthropic-workspace-id":n}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.memory_stores.memories.retrieve",i,{route:"/v1/memory_stores/{memory_store_id}/memories/{memory_id}",queryParams:["view"],attributes:{"gen_ai.memory.store.id":r,"gen_ai.memory.record.id":e}})})}update(e,t,i){let{memory_store_id:r,view:s,betas:n,workspace_id:a,...o}=t;return this._client.post(nb`/v1/memory_stores/${r}/memories/${e}`,{query:{view:s},body:o,...i,headers:r$([{"anthropic-beta":[...n??[],"agent-memory-2026-07-22"].toString(),...null!=a?{"anthropic-workspace-id":a}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.memory_stores.memories.update",i,{route:"/v1/memory_stores/{memory_store_id}/memories/{memory_id}",queryParams:["view"],attributes:{"gen_ai.memory.store.id":r,"gen_ai.memory.record.id":e}})})}list(e,t={},i){let{betas:r,workspace_id:s,...n}=t??{};return this._client.getAPIList(nb`/v1/memory_stores/${e}/memories`,s4,{query:n,...i,headers:r$([{"anthropic-beta":[...r??[],"agent-memory-2026-07-22"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.memory_stores.memories.list",i,{route:"/v1/memory_stores/{memory_store_id}/memories",queryParams:["depth","limit","page","path_prefix","view"],contentQueryParams:["page"],attributes:{"gen_ai.memory.store.id":e}})})}delete(e,t,i){let{memory_store_id:r,expected_content_sha256:s,betas:n,workspace_id:a}=t;return this._client.delete(nb`/v1/memory_stores/${r}/memories/${e}`,{query:{expected_content_sha256:s},...i,headers:r$([{"anthropic-beta":[...n??[],"agent-memory-2026-07-22"].toString(),...null!=a?{"anthropic-workspace-id":a}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.memory_stores.memories.delete",i,{route:"/v1/memory_stores/{memory_store_id}/memories/{memory_id}",queryParams:["expected_content_sha256"],attributes:{"gen_ai.memory.store.id":r,"gen_ai.memory.record.id":e}})})}}class aS extends ne{retrieve(e,t,i){let{memory_store_id:r,betas:s,workspace_id:n,...a}=t;return this._client.get(nb`/v1/memory_stores/${r}/memory_versions/${e}`,{query:a,...i,headers:r$([{"anthropic-beta":[...s??[],"agent-memory-2026-07-22"].toString(),...null!=n?{"anthropic-workspace-id":n}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.memory_stores.memory_versions.retrieve",i,{route:"/v1/memory_stores/{memory_store_id}/memory_versions/{memory_version_id}",queryParams:["view"],attributes:{"gen_ai.memory.store.id":r,"anthropic.memory_store.memory_version.id":e}})})}list(e,t={},i){let{betas:r,workspace_id:s,...n}=t??{};return this._client.getAPIList(nb`/v1/memory_stores/${e}/memory_versions`,s4,{query:n,...i,headers:r$([{"anthropic-beta":[...r??[],"agent-memory-2026-07-22"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.memory_stores.memory_versions.list",i,{route:"/v1/memory_stores/{memory_store_id}/memory_versions",queryParams:["api_key_id","created_at[gte]","created_at[lte]","limit","memory_id","operation","page","service_account_id","session_id","view"],attributes:{"gen_ai.memory.store.id":e}})})}redact(e,t,i){let{memory_store_id:r,betas:s,workspace_id:n}=t;return this._client.post(nb`/v1/memory_stores/${r}/memory_versions/${e}/redact`,{...i,headers:r$([{"anthropic-beta":[...s??[],"agent-memory-2026-07-22"].toString(),...null!=n?{"anthropic-workspace-id":n}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.memory_stores.memory_versions.redact",i,{route:"/v1/memory_stores/{memory_store_id}/memory_versions/{memory_version_id}/redact",attributes:{"gen_ai.memory.store.id":r,"anthropic.memory_store.memory_version.id":e}})})}}var aV=(()=>{class e extends ne{constructor(){super(...arguments),this.memories=new ax(this._client),this.memoryVersions=new aS(this._client)}create(e,t){let{betas:i,workspace_id:r,...s}=e;return this._client.post("/v1/memory_stores",{body:s,...t,headers:r$([{"anthropic-beta":[...i??[],"agent-memory-2026-07-22"].toString(),...null!=r?{"anthropic-workspace-id":r}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.memory_stores.create",t,{route:"/v1/memory_stores",createdIDAttribute:"gen_ai.memory.store.id"})})}retrieve(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.get(nb`/v1/memory_stores/${e}`,{...i,headers:r$([{"anthropic-beta":[...r??[],"agent-memory-2026-07-22"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.memory_stores.retrieve",i,{route:"/v1/memory_stores/{memory_store_id}",attributes:{"gen_ai.memory.store.id":e}})})}update(e,t,i){let{betas:r,workspace_id:s,...n}=t;return this._client.post(nb`/v1/memory_stores/${e}`,{body:n,...i,headers:r$([{"anthropic-beta":[...r??[],"agent-memory-2026-07-22"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.memory_stores.update",i,{route:"/v1/memory_stores/{memory_store_id}",attributes:{"gen_ai.memory.store.id":e}})})}list(e={},t){let{betas:i,workspace_id:r,...s}=e??{};return this._client.getAPIList("/v1/memory_stores",s4,{query:s,...t,headers:r$([{"anthropic-beta":[...i??[],"agent-memory-2026-07-22"].toString(),...null!=r?{"anthropic-workspace-id":r}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.memory_stores.list",t,{route:"/v1/memory_stores",queryParams:["created_at[gte]","created_at[lte]","include_archived","limit","page"]})})}delete(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.delete(nb`/v1/memory_stores/${e}`,{...i,headers:r$([{"anthropic-beta":[...r??[],"agent-memory-2026-07-22"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.memory_stores.delete",i,{route:"/v1/memory_stores/{memory_store_id}",attributes:{"gen_ai.memory.store.id":e}})})}archive(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.post(nb`/v1/memory_stores/${e}/archive`,{...i,headers:r$([{"anthropic-beta":[...r??[],"agent-memory-2026-07-22"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.memory_stores.archive",i,{route:"/v1/memory_stores/{memory_store_id}/archive",attributes:{"gen_ai.memory.store.id":e}})})}}return e.Memories=ax,e.MemoryVersions=aS,e})();class aA extends ne{create(e,t){let{betas:i,user_profile_id:r,workspace_id:s,...n}=e;return this._client.post("/v1/messages/batches",{body:n,...t,headers:r$([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString(),...null!=r?{"anthropic-user-profile-id":r}:void 0,...null!=s?{"anthropic-workspace-id":s}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.messages.batches.create",t,{route:"/v1/messages/batches",attributes:{"anthropic.message.batch.request_count":n.requests?.length},createdIDAttribute:"anthropic.message.batch.id"})})}retrieve(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.get(nb`/v1/messages/batches/${e}`,{...i,headers:r$([{"anthropic-beta":[...r??[],"message-batches-2024-09-24"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.messages.batches.retrieve",i,{route:"/v1/messages/batches/{message_batch_id}",attributes:{"anthropic.message.batch.id":e}})})}list(e={},t){let{betas:i,workspace_id:r,...s}=e??{};return this._client.getAPIList("/v1/messages/batches",s6,{query:s,...t,headers:r$([{"anthropic-beta":[...i??[],"message-batches-2024-09-24"].toString(),...null!=r?{"anthropic-workspace-id":r}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.messages.batches.list",t,{route:"/v1/messages/batches",queryParams:["after_id","before_id","limit"]})})}delete(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.delete(nb`/v1/messages/batches/${e}`,{...i,headers:r$([{"anthropic-beta":[...r??[],"message-batches-2024-09-24"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.messages.batches.delete",i,{route:"/v1/messages/batches/{message_batch_id}",attributes:{"anthropic.message.batch.id":e}})})}cancel(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.post(nb`/v1/messages/batches/${e}/cancel`,{...i,headers:r$([{"anthropic-beta":[...r??[],"message-batches-2024-09-24"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.messages.batches.cancel",i,{route:"/v1/messages/batches/{message_batch_id}/cancel",attributes:{"anthropic.message.batch.id":e}})})}async results(e,t={},i){let r=await this.retrieve(e,t,i);if(!r.results_url)throw new ry.v(`No batch \`results_url\`; Has it finished processing? ${r.processing_status} - ${r.id}`);let{betas:s,workspace_id:n}=t??{};return this._client.get(r.results_url,{...i,headers:r$([{"anthropic-beta":[...s??[],"message-batches-2024-09-24"].toString(),Accept:"application/binary",...null!=n?{"anthropic-workspace-id":n}:void 0},i?.headers]),stream:!0,__qualifiers:{beta:"true"},__binaryResponse:!0,__span:rN(this._client,"anthropic.messages.batches.results",i,{route:"/v1/messages/batches/{message_batch_id}/results",attributes:{"anthropic.message.batch.id":e}})})._thenUnwrap((e,t)=>ng.fromResponse(t.response,t.controller))}}function aI(e){return e?.output_format??e?.output_config?.format}function aq(e,t,i){let r=aI(t);return t&&"parse"in(r??{})?aR(e,t,i):{...e,content:e.content.map(e=>"text"===e.type?Object.defineProperty(Object.defineProperty({...e},"parsed_output",{value:null,enumerable:!1}),"parsed",{get:()=>(i.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),null),enumerable:!1}):e),parsed_output:null}}function aR(e,t,i){let r=null,s=e.content.map(e=>{if("text"===e.type){let s=function(e,t){let i=aI(e);if(i?.type!=="json_schema")return null;try{if("parse"in i)return i.parse(t);return JSON.parse(t)}catch(e){throw new ry.v(`Failed to parse structured output: ${e}`)}}(t,e.text);return null===r&&(r=s),Object.defineProperty(Object.defineProperty({...e},"parsed_output",{value:s,enumerable:!1}),"parsed",{get:()=>(i.logger.warn("The `parsed` property on `text` blocks is deprecated, please use `parsed_output` instead."),s),enumerable:!1})}return e});return{...e,content:s,parsed_output:r}}function a$(e,t){let{betas:i,user_profile_id:r,workspace_id:s,tools:n,messages:a}=e;return r$([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0,...null!=r?{"anthropic-user-profile-id":r}:void 0,...null!=s?{"anthropic-workspace-id":s}:void 0},na(n,a),t?.headers])}function aT(e){if(!e.output_format)return e;aP(e);let{output_format:t,...i}=e;return{...i,output_config:{...e.output_config,format:t}}}function aP(e){if(e.output_format&&e.output_config?.format)throw new ry.v("Both output_format and output_config.format were provided. Please use only output_config.format (output_format is deprecated).")}function aE(e){return"tool_use"===e.type||"server_tool_use"===e.type||"mcp_tool_use"===e.type}var aO=(()=>{class e{constructor(e,t){eU.add(this),this.messages=[],this.receivedMessages=[],eW.set(this,void 0),eF.set(this,null),this.controller=new AbortController,eH.set(this,void 0),eB.set(this,()=>{}),eK.set(this,()=>{}),eJ.set(this,void 0),eG.set(this,()=>{}),eX.set(this,()=>{}),eQ.set(this,{}),eY.set(this,!1),eZ.set(this,!1),e0.set(this,!1),e1.set(this,!1),e2.set(this,void 0),e6.set(this,void 0),e4.set(this,void 0),e5.set(this,void 0),e3.set(this,void 0),e8.set(this,void 0),e9.set(this,void 0),tt.set(this,e=>{if((0,id.b)(this,eZ,!0,"f"),(0,id.V)(this,e8,"f")&&((0,id.V)(this,e8,"f").streamed=void 0),(0,ig.c)(e)&&(e=new ry.F),e instanceof ry.F)return(0,id.b)(this,e0,!0,"f"),this._emit("abort",e);if(e instanceof ry.v)return this._emit("error",e);if(e instanceof Error){let t=new ry.v(e.message);return t.cause=e,this._emit("error",t)}return this._emit("error",new ry.v(String(e)))}),(0,id.b)(this,eH,new Promise((e,t)=>{(0,id.b)(this,eB,e,"f"),(0,id.b)(this,eK,t,"f")}),"f"),(0,id.b)(this,eJ,new Promise((e,t)=>{(0,id.b)(this,eG,e,"f"),(0,id.b)(this,eX,t,"f")}),"f"),(0,id.V)(this,eH,"f").catch(()=>{}),(0,id.V)(this,eJ,"f").catch(()=>{}),(0,id.b)(this,eF,e,"f"),(0,id.b)(this,e5,t?.logger??console,"f"),(0,id.b)(this,e3,t?.client,"f")}get response(){return(0,id.V)(this,e2,"f")}get request_id(){return(0,id.V)(this,e6,"f")}get workspace_id(){return(0,id.V)(this,e4,"f")}async withResponse(){(0,id.b)(this,e1,!0,"f");let e=await (0,id.V)(this,eH,"f");if(!e)throw Error("Could not resolve a `Response` object");return{data:this,response:e,request_id:e.headers.get("request-id"),workspace_id:e.headers.get("anthropic-workspace-id")}}static fromReadableStream(t){let i=new e(null);return i._run(()=>i._fromReadableStream(t)),i}static createMessage(t,i,r,{logger:s,client:n}={}){let a=new e(i,{logger:s,client:n});for(let e of i.messages)a._addMessageParam(e);return(0,id.b)(a,eF,{...i,stream:!0},"f"),a._run(()=>a._createMessage((e,i)=>t.create(e,i),{...i,stream:!0},{...r,headers:{...r?.headers,[ni]:"stream"}})),a}_start(e,t,i,r){for(let e of t.messages)this._addMessageParam(e);let s=(0,id.V)(this,e3,"f");(0,id.b)(this,e3,void 0,"f");let n=(t,i)=>e(t,i)._thenUnwrap((e,{options:t})=>((0,id.b)(this,e3,s,"f"),(0,id.b)(this,e8,t.__span,"f"),(0,id.b)(this,e9,t.body,"f"),e));this._run(()=>this._createMessage(n,{...t,stream:!0},i).finally(r))}_run(e){e().then(()=>{this._emitFinal(),this._emit("end")},(0,id.V)(this,tt,"f"))}_addMessageParam(e){this.messages.push(e)}_addMessage(e,t=!0){this.receivedMessages.push(e),t&&this._emit("message",e)}async _createMessage(e,t,i){let r,s=i?.signal;s&&(s.aborted&&this.controller.abort(),r=this.controller.abort.bind(this.controller),s.addEventListener("abort",r));try{(0,id.V)(this,eU,"m",ti).call(this),(0,id.b)(this,e8,i?.__span??((0,id.V)(this,e3,"f")&&function(e,t,i){if(!e._tracer)return;let r=a$(t,i);return rN(e,"anthropic.messages.create",i,sz(e,{...aT(t),stream:!0},r))}((0,id.V)(this,e3,"f"),t,i)),"f");let{response:r,data:s}=await e({...t,stream:!0},{...i,__span:(0,id.V)(this,e8,"f"),signal:this.controller.signal}).withResponse();try{this._connected(r)}catch(e){throw(0,id.V)(this,e8,"f")&&((0,id.V)(this,e8,"f").failure=e),s.controller.abort(),e}for await(let e of s)try{(0,id.V)(this,eU,"m",tr).call(this,e)}catch(e){throw(0,id.V)(this,e8,"f")&&((0,id.V)(this,e8,"f").failure=e),e}if(s.controller.signal?.aborted)throw new ry.F;(0,id.V)(this,eU,"m",ts).call(this)}finally{s&&r&&s.removeEventListener("abort",r)}}_connected(e){this.ended||((0,id.b)(this,e2,e,"f"),(0,id.b)(this,e6,e?.headers.get("request-id"),"f"),(0,id.b)(this,e4,e?.headers.get("anthropic-workspace-id"),"f"),(0,id.V)(this,eB,"f").call(this,e),this._emit("connect"))}get ended(){return(0,id.V)(this,eY,"f")}get errored(){return(0,id.V)(this,eZ,"f")}get aborted(){return(0,id.V)(this,e0,"f")}abort(){this.controller.abort()}on(e,t){return((0,id.V)(this,eQ,"f")[e]||((0,id.V)(this,eQ,"f")[e]=[])).push({listener:t}),this}off(e,t){let i=(0,id.V)(this,eQ,"f")[e];if(!i)return this;let r=i.findIndex(e=>e.listener===t);return r>=0&&i.splice(r,1),this}once(e,t){return((0,id.V)(this,eQ,"f")[e]||((0,id.V)(this,eQ,"f")[e]=[])).push({listener:t,once:!0}),this}emitted(e){return new Promise((t,i)=>{(0,id.b)(this,e1,!0,"f"),"error"!==e&&this.once("error",i),this.once(e,t)})}async done(){(0,id.b)(this,e1,!0,"f"),await (0,id.V)(this,eJ,"f")}get currentMessage(){return(0,id.V)(this,eW,"f")}async finalMessage(){return await this.done(),(0,id.V)(this,eU,"m",e7).call(this)}async finalText(){return await this.done(),(0,id.V)(this,eU,"m",te).call(this)}_emit(e,...t){if((0,id.V)(this,eY,"f"))return;"end"===e&&((0,id.b)(this,eY,!0,"f"),(0,id.V)(this,eG,"f").call(this));let i=(0,id.V)(this,eQ,"f")[e];if(i&&((0,id.V)(this,eQ,"f")[e]=i.filter(e=>!e.once),i.forEach(({listener:e})=>e(...t))),"abort"===e){let e=t[0];(0,id.V)(this,e1,"f")||i?.length||Promise.reject(e),(0,id.V)(this,eK,"f").call(this,e),(0,id.V)(this,eX,"f").call(this,e),this._emit("end");return}if("error"===e){let e=t[0];(0,id.V)(this,e1,"f")||i?.length||Promise.reject(e),(0,id.V)(this,eK,"f").call(this,e),(0,id.V)(this,eX,"f").call(this,e),this._emit("end")}}_emitFinal(){this.receivedMessages.at(-1)&&this._emit("finalMessage",(0,id.V)(this,eU,"m",e7).call(this))}_deliverEvent(e,t){this._emit("_rawEvent",e),t&&this._emit("streamEvent",e,t)}async _fromReadableStream(e,t){let i,r=t?.signal;r&&(r.aborted&&this.controller.abort(),i=this.controller.abort.bind(this.controller),r.addEventListener("abort",i));try{(0,id.V)(this,eU,"m",ti).call(this),this._connected(null);let t=rx.fromReadableStream(e,this.controller);for await(let e of t)(0,id.V)(this,eU,"m",tr).call(this,e);if(t.controller.signal?.aborted)throw new ry.F;(0,id.V)(this,eU,"m",ts).call(this)}finally{r&&i&&r.removeEventListener("abort",i)}}[(eW=new WeakMap,eF=new WeakMap,eH=new WeakMap,eB=new WeakMap,eK=new WeakMap,eJ=new WeakMap,eG=new WeakMap,eX=new WeakMap,eQ=new WeakMap,eY=new WeakMap,eZ=new WeakMap,e0=new WeakMap,e1=new WeakMap,e2=new WeakMap,e6=new WeakMap,e4=new WeakMap,e5=new WeakMap,e3=new WeakMap,e8=new WeakMap,e9=new WeakMap,tt=new WeakMap,eU=new WeakSet,e7=function(){if(0===this.receivedMessages.length)throw new ry.v("stream ended without producing a Message with role=assistant");return this.receivedMessages.at(-1)},te=function(){if(0===this.receivedMessages.length)throw new ry.v("stream ended without producing a Message with role=assistant");let e=this.receivedMessages.at(-1).content.filter(e=>"text"===e.type).map(e=>e.text);if(0===e.length)throw new ry.v("stream ended without producing a content block with type=text");return e.join(" ")},ti=function(){this.ended||(0,id.b)(this,eW,void 0,"f")},tr=function(e){if(this.ended)return;let t=(0,id.V)(this,eU,"m",tn).call(this,e);if(this._deliverEvent(e,t),t)switch(e.type){case"content_block_delta":{let i=t.content.at(-1);switch(e.delta.type){case"text_delta":"text"===i.type&&this._emit("text",e.delta.text,i.text||"");break;case"citations_delta":"text"===i.type&&this._emit("citation",e.delta.citation,i.citations??[]);break;case"input_json_delta":if(aE(i)&&(0,id.V)(this,eQ,"f").inputJson?.length){let t;try{t=i.input}catch(e){(0,id.V)(this,tt,"f").call(this,(0,id.V)(this,eU,"m",ta).call(this,i,e));break}this._emit("inputJson",e.delta.partial_json,t)}break;case"thinking_delta":"thinking"===i.type&&this._emit("thinking",e.delta.thinking,i.thinking);break;case"signature_delta":"thinking"===i.type&&this._emit("signature",i.signature);break;case"compaction_delta":"compaction"===i.type&&i.content&&this._emit("compaction",i.content);break;default:(0,ip.f)(e.delta)}break}case"message_stop":(0,id.V)(this,e3,"f")&&(0,id.V)(this,e8,"f")&&(0,id.V)(this,eF,"f")&&sZ((0,id.V)(this,e3,"f"),(0,id.V)(this,e8,"f"),(0,id.V)(this,e9,"f")??(0,id.V)(this,eF,"f"),t),this._addMessageParam(t),this._addMessage(aq(t,(0,id.V)(this,eF,"f"),{logger:(0,id.V)(this,e5,"f")}),!0);break;case"content_block_stop":this._emit("contentBlock",t.content.at(-1));break;case"message_start":(0,id.b)(this,eW,t,"f"),(0,id.V)(this,e8,"f")&&(0,id.V)(this,eF,"f")&&((0,id.V)(this,e8,"f").streamed={body:(0,id.V)(this,e9,"f")??(0,id.V)(this,eF,"f"),message:t})}},ts=function(){if(this.ended)throw new ry.v("stream has ended, this shouldn't happen");let e=(0,id.V)(this,eW,"f");if(!e)throw new ry.v("request ended without sending any chunks");return(0,id.b)(this,eW,void 0,"f"),aq(e,(0,id.V)(this,eF,"f"),{logger:(0,id.V)(this,e5,"f")})},tn=function(e){let t=(0,id.V)(this,eW,"f");if("message_start"===e.type){if(t)throw new ry.v(`Unexpected event order, got ${e.type} before receiving "message_stop"`);return e.message}if(t)switch(e.type){case"message_stop":default:return t;case"message_delta":return t.stop_reason=e.delta.stop_reason,t.stop_sequence=e.delta.stop_sequence,t.stop_details=e.delta.stop_details,t.usage.output_tokens=e.usage.output_tokens,null!=e.delta.container&&(t.container=e.delta.container),null!=e.context_management&&(t.context_management=e.context_management),null!=e.input_transformations&&(t.input_transformations=e.input_transformations),null!=e.usage.input_tokens&&(t.usage.input_tokens=e.usage.input_tokens),null!=e.usage.cache_creation_input_tokens&&(t.usage.cache_creation_input_tokens=e.usage.cache_creation_input_tokens),null!=e.usage.cache_read_input_tokens&&(t.usage.cache_read_input_tokens=e.usage.cache_read_input_tokens),null!=e.usage.server_tool_use&&(t.usage.server_tool_use=e.usage.server_tool_use),null!=e.usage.iterations&&(t.usage.iterations=e.usage.iterations),null!=e.usage.fallback_credit&&(t.usage.fallback_credit=e.usage.fallback_credit),null!=e.usage.output_tokens_details&&(t.usage.output_tokens_details=e.usage.output_tokens_details),t;case"content_block_start":return t.content.push(e.content_block),"fallback"===e.content_block.type&&(t.model=e.content_block.to.model),t;case"content_block_delta":{let i=t.content.at(e.index);switch(e.delta.type){case"text_delta":i?.type==="text"&&(t.content[e.index]={...i,text:(i.text||"")+e.delta.text});break;case"citations_delta":i?.type==="text"&&(t.content[e.index]={...i,citations:[...i.citations??[],e.delta.citation]});break;case"input_json_delta":if(i&&aE(i)){let r=(i[nd]||"")+e.delta.partial_json;t.content[e.index]=np(i,r)}break;case"thinking_delta":i?.type==="thinking"&&(t.content[e.index]={...i,thinking:i.thinking+e.delta.thinking});break;case"signature_delta":i?.type==="thinking"&&(t.content[e.index]={...i,signature:e.delta.signature});break;case"compaction_delta":if(i?.type==="compaction"){let r={...i,content:e.delta.content};"encrypted_content"in e.delta&&(r.encrypted_content=e.delta.encrypted_content),t.content[e.index]=r}break;default:(0,ip.f)(e.delta)}return t}case"content_block_stop":{let i=t.content.at(e.index);if(i&&aE(i)&&nd in i){let e;try{e=i.input}catch(t){e={},(0,id.V)(this,tt,"f").call(this,(0,id.V)(this,eU,"m",ta).call(this,i,t))}Object.defineProperty(i,"input",{value:e,enumerable:!0,configurable:!0,writable:!0})}return t}}},ta=function(e,t){let i=e[nd];return new ry.v(`Unable to parse tool parameter JSON from model. Please retry your request or adjust your prompt. Error: ${t}. JSON: ${i}`)},Symbol.asyncIterator)](){let e=[],t=[],i=!1;return this.on("_rawEvent",i=>{let r=t.shift();r?r.resolve(i):e.push(i)}),this.on("end",()=>{for(let e of(i=!0,t))e.resolve(void 0);t.length=0}),this.on("abort",e=>{for(let r of(i=!0,t))r.reject(e);t.length=0}),this.on("error",e=>{for(let r of(i=!0,t))r.reject(e);t.length=0}),{next:async()=>e.length?{value:e.shift(),done:!1}:i?{value:void 0,done:!0}:new Promise((e,i)=>t.push({resolve:e,reject:i})).then(e=>e?{value:e,done:!1}:{value:void 0,done:!0}),return:async()=>(this.abort(),{value:void 0,done:!0})}}toReadableStream(){return new rx(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}return e})();let aM={browser_toolset_20260801:"browser",computer_toolset_20260801:"computer"};function aL(e){return aM[e.type]}function aN(e){return"run"in e&&null!=e.type&&Object.prototype.hasOwnProperty.call(aM,e.type)}var aC=ry;class aj extends aC.v{constructor(e,t){super(e),this.name="ToolsetUsageError",t&&"cause"in t&&(this.cause=t.cause)}}class aD extends aj{constructor(e,t){super(e,t),this.name="ToolsetContractError"}}ar.f,ar.f,ar.f,ar.f,ar.f,ar.f,ar.f,ar.f;let aU="Not executed: an earlier action in this turn failed.",aW={browser:aU,computer:"Not executed: an earlier computer action in this turn failed."};function aF(e,t,i=!1){return i&&(""===t||Array.isArray(t)&&0===t.length)&&(t="The tool call failed with an empty error message."),{type:"tool_result",tool_use_id:e.id,toolset_name:e.toolset_name??null,content:t,...i?{is_error:!0}:{}}}async function aH(e,t,i={}){let r=aL(e);if(t.toolset_name!==r)throw new aD(`tool_use ${JSON.stringify(t.id)} (toolset_name=${JSON.stringify(t.toolset_name??null)}, name=${JSON.stringify(t.name)}) is not a member call of the ${JSON.stringify(r)} toolset`);let s={...i,toolUse:t,toolUseBlock:t};try{return aF(t,await e.run(s,t))}catch(e){var n;if(e instanceof aj)throw e;return function(e){if(e?.aborted)throw new ry.F}(s.signal),aF(t,"string"==typeof(n=e instanceof ar.f?e.content:ac(aa(al(e)),4096))?aa(n):n.filter(e=>"text"===e.type&&""!==e.text).map(e=>({...e,text:aa(e.text)})),!0)}}var aB=(()=>{class e extends aO{constructor(e,t,i){super(e,{client:i}),to.add(this),tl.set(this,void 0),tc.set(this,0),tu.set(this,[]),th.set(this,[]),td.set(this,void 0),tp.set(this,[]),t_.set(this,!1),(0,id.b)(this,tl,t,"f")}get toolCalls(){return(0,id.V)(this,th,"f")}_deliverEvent(e,t){var i;(0,id.b)(this,tc,(i=(0,id.V)(this,tc,"f"),++i),"f");let r="content_block_stop"===e.type?t?.content[e.index]:void 0,s=r?.type==="tool_use"?r:void 0;s&&(0,id.V)(this,th,"f").push(s),super._deliverEvent(e,t),(0,id.V)(this,to,"m",tf).call(this,e,s),(0,id.V)(this,to,"m",tg).call(this)}[(tl=new WeakMap,tc=new WeakMap,tu=new WeakMap,th=new WeakMap,td=new WeakMap,tp=new WeakMap,t_=new WeakMap,to=new WeakSet,Symbol.asyncIterator)](){let e=super[Symbol.asyncIterator](),t={handled:(0,id.V)(this,tc,"f")};(0,id.V)(this,tu,"f").push(t);let i=!1;return{next:async()=>{i&&(i=!1,t.handled++,(0,id.V)(this,to,"m",tg).call(this));try{let r=await e.next();return i=!r.done,r.done&&(0,id.V)(this,to,"m",tm).call(this,t),r}catch(e){throw(0,id.V)(this,to,"m",tm).call(this,t),e}},return:async()=>{let i=e.return?.();return(0,id.V)(this,to,"m",tm).call(this,t),await i??{value:void 0,done:!0}}}}}return tf=function(e,t){if((0,id.V)(this,t_,"f"))return;if("content_block_start"===e.type&&"fallback"===e.content_block.type){(0,id.b)(this,t_,!0,"f"),(0,id.b)(this,td,void 0,"f");return}let i="content_block_start"===e.type||"message_delta"===e.type&&"tool_use"===e.delta.stop_reason;(0,id.V)(this,td,"f")&&i&&((0,id.V)(this,tp,"f").push({toolUse:(0,id.V)(this,td,"f"),event:(0,id.V)(this,tc,"f")}),(0,id.b)(this,td,void 0,"f")),t&&(0,id.b)(this,td,t,"f")},tg=function(){if(this.errored||this.controller.signal.aborted)return;let e=Math.min((0,id.V)(this,tc,"f"),...(0,id.V)(this,tu,"f").map(e=>e.handled));for(;(0,id.V)(this,tp,"f")[0]&&(0,id.V)(this,tp,"f")[0].event<=e;)(0,id.V)(this,tl,"f").call(this,(0,id.V)(this,tp,"f").shift().toolUse)},tm=function(e){let t=(0,id.V)(this,tu,"f").indexOf(e);t>=0&&((0,id.V)(this,tu,"f").splice(t,1),(0,id.V)(this,to,"m",tg).call(this))},e})(),aK=e.i(368120);class aJ{constructor(e,t,i){this.fields=e,this.ownMessages=t,this.ownCreateOnly=i,this.deferredMessages=[],this.replacementHistory=null,this.createOnly=a0(e)}}var aG=(tb=new WeakMap,ty=new WeakMap,tw=new WeakMap,tk=new WeakMap,tz=new WeakMap,tx=new WeakMap,tv=new WeakSet,tS=function(){for(let e of[(0,id.V)(this,tw,"f"),(0,id.V)(this,ty,"f")])for(let t=e.length-1;t>=0;t--)if(e[t].reply)return e[t].reply;return null},tV=function(e){if("id"in e)return e.id===(0,id.V)(this,tv,"a",tS)?.id;let t=(0,id.V)(this,tw,"f").at(-1)??(0,id.V)(this,ty,"f").at(-1);return t?.reply!=null&&a3(e,t.param)},tA=function(e){(0,id.V)(this,tx,"f").info(`Replaying the full message history under a new thread: reason=${e} previous_message_id=${this.previousMessageId}`),(0,id.b)(this,tk,{type:"create",replacesLostThread:"thread_not_found"===e},"f")},tI=function(){let e=(0,id.V)(this,ty,"f").at(-1);if((0,id.V)(this,tw,"f").length||!e||e.reply&&!e.partial)return;e.reply&&(0,id.V)(this,ty,"f").pop();let t=(0,id.V)(this,ty,"f").length;for(;t>0&&!(0,id.V)(this,ty,"f")[t-1].reply;)t-=1;(0,id.b)(this,tw,(0,id.V)(this,ty,"f").splice(t),"f"),(0,id.V)(this,tx,"f").info(`Re-sending the turn whose reply ended before \`message_stop\`: partial_reply_id=${e.reply?.id??null}`)},tq=function(e){return"refusal"===e.stop_reason&&"never_threaded"!==(0,id.V)(this,tk,"f").type&&(null!==this.previousMessageId&&(0,id.V)(this,tv,"m",tA).call(this,"refusal"),!0)},tR=function(e,{partial:t}){(0,id.V)(this,ty,"f").push(...(0,id.V)(this,tw,"f")),(0,id.b)(this,tw,[],"f"),e&&(0,id.V)(this,ty,"f").push({param:a8(e),reply:e,partial:t})},t$=function(e){let{container:t}=(0,id.V)(this,tb,"f");null==t?(0,id.b)(this,tb,{...(0,id.V)(this,tb,"f"),container:e},"f"):"object"==typeof t&&null==t.id&&(0,id.b)(this,tb,{...(0,id.V)(this,tb,"f"),container:{...t,id:e}},"f")},tT=function(e){if("continue"!==(0,id.V)(this,tk,"f").type)return;let{createdWith:t}=(0,id.V)(this,tk,"f"),i=aZ.filter(i=>e[i]!==t[i]);if(i.length){let e=i.map(e=>`\`${e}\``).join(" and ");throw new ry.v(`Cannot change ${e} on a thread: the server keeps the \`system\` and \`tools\` the thread was created with. To change them, start a new thread from \`thread.params\`.`+(i.includes("tools")?" To add or remove tools on this thread, send `tool_addition` or `tool_removal` blocks in a `system` message.":""))}},tP=function(e,{stream:t}){var i;let r,s={...this.options,...a4(e)};return t&&(s.headers=r$([{[ni]:"stream"},s.headers])),"never_threaded"!==(0,id.V)(this,tk,"f").type&&(s.headers=r$([s.headers,{[nt]:"message-thread"}])),this.threading&&(s.headers=null===(r=r$([i=s.headers]).values.get("anthropic-beta"))?i:r$([i,{"anthropic-beta":rR(r,aY)}])),s},class e{constructor({params:e,options:t,threading:i,logger:r}){tv.add(this),tb.set(this,void 0),ty.set(this,[]),tw.set(this,[]),tk.set(this,void 0),tz.set(this,null),tx.set(this,void 0);let{messages:s,unsupportedRequestBehavior:n,...a}=e;a6(a),this.options=t,this.unsupportedRequestBehavior=n??"error",(0,id.b)(this,tb,a,"f"),(0,id.b)(this,tk,i?{type:"create",replacesLostThread:!1}:{type:"never_threaded"},"f"),(0,id.b)(this,tx,r,"f"),this.push(s??[])}get threading(){return"create"===(0,id.V)(this,tk,"f").type||"continue"===(0,id.V)(this,tk,"f").type}get previousMessageId(){return"continue"===(0,id.V)(this,tk,"f").type?(0,id.V)(this,tk,"f").previousMessageId:null}get messages(){let e=(0,id.V)(this,tz,"f")?.replacementHistory?.slice()??[...(0,id.V)(this,ty,"f"),...(0,id.V)(this,tw,"f")].map(e=>e.param);return(0,id.V)(this,tz,"f")&&e.push(...(0,id.V)(this,tz,"f").deferredMessages.map(a8)),e}get params(){let e="create"===(0,id.V)(this,tk,"f").type?(0,id.V)(this,tz,"f")?.ownCreateOnly:void 0;return{...(0,id.V)(this,tb,"f"),...e,messages:this.messages}}push(e){if((0,id.V)(this,tz,"f"))return void(0,id.V)(this,tz,"f").deferredMessages.push(...e);for(let t of e)(0,id.V)(this,tv,"m",tV).call(this,t)||(0,id.V)(this,tw,"f").push({param:a8(t),reply:null})}update(e={},t={}){for(let i of(a6(e),(0,id.b)(this,tb,{...(0,id.V)(this,tb,"f"),...a4(e)},"f"),this.options={...this.options,...a4(t)},aZ))void 0!==e[i]&&delete(0,id.V)(this,tz,"f")?.ownCreateOnly[i]}fork(t=(0,id.V)(this,tb,"f")){let i=new e({params:{...t,unsupportedRequestBehavior:this.unsupportedRequestBehavior},options:this.options,threading:"never_threaded"!==(0,id.V)(this,tk,"f").type,logger:(0,id.V)(this,tx,"f")});return this.threading||i.stopThreading(),(0,id.V)(this,tz,"f")?.replacementHistory?(0,id.b)(i,tw,(0,id.V)(this,tz,"f").replacementHistory.map(e=>({param:e,reply:null})),"f"):((0,id.b)(i,ty,[...(0,id.V)(this,ty,"f")],"f"),(0,id.b)(i,tw,[...(0,id.V)(this,tw,"f")],"f")),(0,id.V)(this,tz,"f")&&i.push((0,id.V)(this,tz,"f").deferredMessages),i}setParams({messages:e,...t}){(0,id.b)(this,tb,t,"f"),(0,id.V)(this,tz,"f")&&((0,id.V)(this,tz,"f").ownCreateOnly={}),this.setMessages(e)}setMessages(e){let t=[...(0,id.V)(this,ty,"f"),...(0,id.V)(this,tw,"f")];if((0,id.V)(this,tz,"f")){let i=t.map(e=>e.param);a5(e,i)?((0,id.V)(this,tz,"f").replacementHistory=null,(0,id.V)(this,tz,"f").deferredMessages=e.slice(i.length)):((0,id.V)(this,tz,"f").replacementHistory=e,(0,id.V)(this,tz,"f").deferredMessages=[]);return}!a5(e,(0,id.V)(this,ty,"f").map(e=>e.param))&&((0,id.b)(this,ty,[],"f"),this.threading&&(0,id.b)(this,tk,{type:"create",replacesLostThread:!1},"f")),(0,id.b)(this,tw,[],"f");let i=new Map(t.filter(e=>e.reply).map(e=>[e.param.content,e]));for(let t of e.slice((0,id.V)(this,ty,"f").length))(0,id.V)(this,tv,"m",tV).call(this,t)||(0,id.V)(this,tw,"f").push({...i.get(t.content)??{reply:null},param:a8(t)})}get hasTurnToSend(){return(0,id.V)(this,tw,"f").length>0||aQ((0,id.V)(this,ty,"f").at(-1)?.reply?.stop_reason)}startTurn(e,t){if((0,id.V)(this,tz,"f"))throw new ry.v("Another `send()`, `parse()` or `stream()` is already in progress on this thread");a6(t);let i=(0,id.V)(this,tw,"f").length;this.push(e);let r=(0,id.V)(this,tw,"f").slice(i);(0,id.V)(this,tv,"m",tI).call(this);let s={};return void 0!==t.system&&(s.system=t.system),void 0!==t.tools&&(s.tools=t.tools),(0,id.b)(this,tz,new aJ({...(0,id.V)(this,tb,"f"),...a4(t)},r,s),"f")}endTurn(e){(0,id.b)(this,tz,null,"f"),(0,id.b)(this,tw,(0,id.V)(this,tw,"f").filter(t=>!e.ownMessages.includes(t)),"f"),e.replacementHistory&&this.setMessages(e.replacementHistory),this.push(e.deferredMessages)}recoversFrom(e){var t;let i;if(!(e instanceof ry.E))return!1;let r="continue_unthreaded"===this.unsupportedRequestBehavior,s=(t=e,i=a2(t)?.error_code,a1.find(e=>e===i)??null);if(null!==s&&"continue"===(0,id.V)(this,tk,"f").type)return"thread_not_found"===s&&(0,id.V)(this,tk,"f").replacesLostThread&&r?((0,id.V)(this,tx,"f").info(`The server lost the thread again right after a replay; continuing without a thread: previous_message_id=${(0,id.V)(this,tk,"f").previousMessageId}`),this.stopThreading()):(0,id.V)(this,tv,"m",tA).call(this,s),!0;let n=function(e){let t=a2(e);if(t?.error_code!=="thread_unsupported_request")return null;let i=t.unsupported;return Array.isArray(i)?i.map(String):[]}(e);return null!==n&&!!this.threading&&!!r&&((0,id.V)(this,tx,"f").info(`The server cannot thread this request; continuing without a thread: unsupported=${n.join(",")}`),this.stopThreading(),!0)}stopThreading(){this.threading&&(0,id.b)(this,tk,{type:"unthreaded"},"f")}recordPartialReply(e,t){var i,r;let s,n;(0,id.V)(this,tv,"m",tq).call(this,e)||((0,id.V)(this,tv,"m",tR).call(this,(i=e,r=t,s=i.content.slice(0,r),n=i.content[r],n?.type==="text"&&n.text&&s.push(n),s.length?{...i,content:s}:null),{partial:!0}),null!==this.previousMessageId&&(0,id.V)(this,tv,"m",tA).call(this,"stream_ended_before_message_stop"))}recordReply(e,t){!(0,id.V)(this,tv,"m",tq).call(this,t)&&((0,id.V)(this,tv,"m",tR).call(this,t,{partial:!1}),"create"===(0,id.V)(this,tk,"f").type&&(0,id.b)(this,tb,{...(0,id.V)(this,tb,"f"),...e.ownCreateOnly},"f"),this.threading&&((0,id.b)(this,tk,{type:"continue",previousMessageId:t.id,createdWith:e.createOnly,replacesLostThread:"create"===(0,id.V)(this,tk,"f").type&&(0,id.V)(this,tk,"f").replacesLostThread},"f"),t.usage.iterations?.some(e=>"fallback_message"===e.type)&&(0,id.V)(this,tv,"m",tA).call(this,"fallback_message")),t.container&&(0,id.V)(this,tv,"m",t$).call(this,t.container.id))}buildCreateArguments(e,t,{stream:i}){(0,id.V)(this,tv,"m",tT).call(this,e.createOnly);let r=(0,id.V)(this,tk,"f"),s="continue"===r.type?[]:(0,id.V)(this,ty,"f").map(e=>e.param);if("never_threaded"!==r.type){let e=(0,id.V)(this,ty,"f").map(e=>null!==e.reply).lastIndexOf(!0)+1;s=s.map((t,i)=>i<e?function e(t){if(!(0,ip.u)(t))return t;let{cache_control:i,...r}=t;for(let t of["content","source","tool","definition","tool_references"]){let i=r[t];Array.isArray(i)?r[t]=i.map(e):(0,ip.u)(i)&&(r[t]=e(i))}return r}(t):t)}let n={...e.fields,messages:[...s,...(0,id.V)(this,tw,"f").map(e=>e.param)]};if(this.threading&&!n.betas?.includes(aY)&&(n.betas=[...n.betas??[],aY]),"create"===r.type)n.thread={type:"create"};else if("continue"===r.type)for(let e of(n.thread={type:"continue",previous_message_id:r.previousMessageId},aZ))delete n[e];return{params:n,options:(0,id.V)(this,tv,"m",tP).call(this,t,{stream:i})}}checkNextTurn(e){(0,id.V)(this,tv,"m",tT).call(this,a0({...(0,id.V)(this,tb,"f"),...a4(e)}))}});let aX=["pause_turn","compaction"];function aQ(e){return aX.some(t=>t===e)}let aY="message-threads-2026-08-12",aZ=["system","tools"];function a0(e){return{system:JSON.stringify(e.system),tools:JSON.stringify(e.tools)}}let a1=["thread_not_found","thread_already_continued","thread_continue_in_flight"];function a2(e){let t=e.error,i=t?.error?.details;return(0,ip.u)(i)?i:null}function a6(e){if("thread"in e&&void 0!==e.thread)throw TypeError("`thread` cannot be set here. The message thread sets it for each request itself.")}function a4(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e))}function a5(e,t){return t.length<=e.length&&t.every((t,i)=>a3(t,e[i]))}function a3(e,t){let[i,r]=[a8(e),a8(t)];return Object.keys({...i,...r}).every(e=>i[e]===r[e]||JSON.stringify(i[e])===JSON.stringify(r[e]))}function a8(e){return"id"in e?{role:e.role,content:e.content}:e}function a9(e){return void 0===e?[]:(0,ip.z)(e)?e:[e]}function a7(e){let{stream:t,max_iterations:i,runToolsEagerly:r,thread:s,...n}=e;if(void 0!==s&&!1!==s)throw TypeError("`thread` cannot be set in the params of a tool runner. The runner sets it for each request itself. To run without a message thread, pass `thread: false`.");return{settings:{stream:t,max_iterations:i,runToolsEagerly:r},thread:s,threadParams:n}}let oe="a tool runner's toolsets come only from its tools param; change them with setMessagesParams(), or build a new runner";var ot=(()=>{class e{constructor(e,t,i){tE.add(this),tO.set(this,!1),tM.set(this,!1),tL.set(this,void 0),tN.set(this,void 0),tC.set(this,void 0),tj.set(this,void 0),tD.set(this,void 0),tU.set(this,void 0),tW.set(this,void 0),tF.set(this,void 0),tH.set(this,void 0),tB.set(this,0),tK.set(this,void 0),tJ.set(this,{status:"idle"}),tG.set(this,void 0),tX.set(this,null),tQ.set(this,new Map),tY.set(this,[]);let{thread:r,settings:s}="_state"in e?{thread:e,settings:t}:e.beta.messages._toolRunnerThread(t);or(r._state.params),os(s),(0,id.b)(this,tL,r,"f"),(0,id.b)(this,tN,a4(s),"f");let{tools:n,messages:a}=r._state.params,o=nn(n,a);"_state"in e||r._state.setMessages(JSON.parse(JSON.stringify(ol(a)))),(0,id.b)(this,tC,{...i},"f"),(0,id.b)(this,tj,r$([{[nt]:"BetaToolRunner"},o.length?{[nt]:o.join(", ")}:void 0]),"f"),(0,id.b)(this,tH,(0,aK.f)(),"f")}async *[(tO=new WeakMap,tM=new WeakMap,tL=new WeakMap,tN=new WeakMap,tC=new WeakMap,tj=new WeakMap,tD=new WeakMap,tU=new WeakMap,tW=new WeakMap,tF=new WeakMap,tH=new WeakMap,tB=new WeakMap,tK=new WeakMap,tJ=new WeakMap,tG=new WeakMap,tX=new WeakMap,tQ=new WeakMap,tY=new WeakMap,tE=new WeakSet,tZ=function(e){return(0,id.V)(this,tK,"f")?iJ.with((0,id.V)(this,tK,"f"),e):e()},Symbol.asyncIterator)](){var e;if((0,id.V)(this,tO,"f"))throw new ry.v("Cannot iterate over a consumed stream");(0,id.b)(this,tO,!0,"f"),(0,id.b)(this,tM,!0,"f"),(0,id.b)(this,tF,void 0,"f");let t=rL((0,id.V)(this,tL,"f")._client,()=>(function(e,t,i){if(!e._tracer)return;let r=t.output_config?.format?.type==="json_schema"||t.output_format?.type==="json_schema";return e._tracer.startSpan("anthropic.messages.tool_runner",{kind:rv.INTERNAL,attributes:{[ss]:"invoke_agent",[rO]:e._genAIProviderName,[so]:t.model,...r?{[sa]:su}:void 0,...null!=i?{[rE]:i}:void 0}})})((0,id.V)(this,tL,"f")._client,this.params,(0,id.V)(this,tC,"f").openTelemetry?.conversationId));(0,id.b)(this,tK,t&&rm.setSpan(iJ.active(),t),"f");try{for(;;)try{if((0,id.V)(this,tN,"f").max_iterations&&(0,id.V)(this,tB,"f")>=(0,id.V)(this,tN,"f").max_iterations)break;if((0,id.V)(this,tE,"m",ir).call(this),"scheduled"===(0,id.V)(this,tJ,"f").status&&"resume"!==of((0,id.V)(this,tX,"f"))){yield*(0,id.V)(this,tE,"m",t4).call(this,(0,id.V)(this,tJ,"f").config);continue}(0,id.b)(this,tM,!1,"f"),(0,id.b)(this,tF,void 0,"f"),(0,id.b)(this,tB,(e=(0,id.V)(this,tB,"f"),++e),"f"),(0,id.b)(this,tU,void 0,"f"),yield*(0,id.V)(this,tE,"m",t0).call(this,(0,id.V)(this,tL,"f"));let t=(0,id.V)(this,tD,"f");(0,id.b)(this,tD,void 0,"f");let i=await (0,id.V)(this,tE,"m",tZ).call(this,async()=>{let e;if((0,id.V)(this,tM,"f"))(0,id.b)(this,tX,null,"f"),(0,id.V)(this,tW,"f")?.abort(),(0,id.V)(this,tL,"f")._state.checkNextTurn(oo((0,id.V)(this,tL,"f"))),(0,id.V)(this,tL,"f")._state.setMessages(t),e=t.at(-1);else{let t=await (0,id.V)(this,tU,"f"),i=of(t.stop_reason);if((0,id.b)(this,tX,t.stop_reason,"f"),"stop"===i)return"stop";if("resume"===i)return"continue";e=function(e){for(let t=e.length-1;t>=0;t--){let i=e[t];if("assistant"===i.role)return i;if("user"===i.role&&Array.isArray(i.content)&&i.content.some(e=>"tool_result"===e.type))break}}((0,id.V)(this,tL,"f").messages)}op(e)&&(0,id.V)(this,tL,"f")._state.checkNextTurn(oo((0,id.V)(this,tL,"f")));let i=await (0,id.V)(this,tE,"m",ie).call(this,e,(0,id.V)(this,tC,"f").signal,(0,id.V)(this,tK,"f"));if(i){let e=(0,id.V)(this,tL,"f").messages,t=e.map(e=>e.role).lastIndexOf("assistant")+1;(0,id.V)(this,tL,"f")._state.setMessages([...e.slice(0,t),i,...e.slice(t)])}else if(!(0,id.V)(this,tM,"f")&&!(0,id.V)(this,tL,"f")._state.hasTurnToSend)return"stop";return"continue"});if("stop"===i){yield*(0,id.V)(this,tE,"m",t7).call(this);break}}finally{(0,id.V)(this,tW,"f")?.abort(),(0,id.b)(this,tW,void 0,"f")}if(await (0,id.V)(this,tE,"m",t6).call(this),!(0,id.V)(this,tU,"f"))throw new ry.v("ToolRunner concluded without a message from the server");(0,id.V)(this,tH,"f").resolve(await (0,id.V)(this,tU,"f")),rL((0,id.V)(this,tL,"f")._client,()=>t?.setStatus({code:rb.OK}))}catch(e){throw t&&rL((0,id.V)(this,tL,"f")._client,()=>rU(t,e)),(0,id.b)(this,tO,!1,"f"),(0,id.b)(this,tD,void 0,"f"),(0,id.V)(this,tH,"f").promise.catch(()=>{}),(0,id.V)(this,tH,"f").reject(e),(0,id.b)(this,tH,(0,aK.f)(),"f"),e}finally{rL((0,id.V)(this,tL,"f")._client,()=>t?.end()),(0,id.b)(this,tK,void 0,"f")}}setMessagesParams(e){var t,i;let r="function"==typeof e?e(this.params):e;if(or(r),"idle"!==(0,id.V)(this,tJ,"f").status&&on(r),"in_flight"===(0,id.V)(this,tJ,"f").status&&(t=r.messages,i=(0,id.V)(this,tL,"f").messages,!(t.length===i.length&&t.every((e,t)=>a3(e,i[t])))))throw new ry.v(oi);let{settings:s,threadParams:n}=a7(r);os(s),(0,id.b)(this,tN,a4(s),"f"),(0,id.V)(this,tD,"f")?((0,id.b)(this,tD,n.messages,"f"),(0,id.V)(this,tL,"f")._state.setParams({...n,messages:(0,id.V)(this,tL,"f").messages})):(0,id.V)(this,tL,"f")._state.setParams(n),(0,id.b)(this,tM,!0,"f"),(0,id.b)(this,tF,void 0,"f")}setRequestOptions(e){"function"==typeof e?(0,id.b)(this,tC,e((0,id.V)(this,tC,"f")),"f"):(0,id.b)(this,tC,{...(0,id.V)(this,tC,"f"),...e},"f")}async generateToolResponse(e=(0,id.V)(this,tC,"f").signal){let t=(0,id.V)(this,tL,"f")._client._tracer?iJ.active():void 0,i=await (0,id.V)(this,tU,"f")??(0,id.V)(this,tL,"f").messages.at(-1);return i?(0,id.V)(this,tE,"m",ie).call(this,i,e,t):null}deferToolCall(e){let t="string"==typeof e?e:e.id;(0,id.V)(this,tG,"f")&&!(0,id.V)(this,tG,"f").has(t)&&(0,id.V)(this,tG,"f").set(t,{status:"held"})}get deferredToolCalls(){let e=(0,id.V)(this,tW,"f"),t=(0,id.V)(this,tG,"f");return e instanceof aB&&t?e.toolCalls.filter(e=>t.get(e.id)?.status==="held"):[]}done(){return(0,id.V)(this,tH,"f").promise}async runUntilDone(){if(!(0,id.V)(this,tO,"f"))for await(let e of this);return this.done()}get params(){return{...(0,id.V)(this,tL,"f")._state.params,...(0,id.V)(this,tD,"f")&&{messages:[...(0,id.V)(this,tD,"f")]},...(0,id.V)(this,tN,"f")}}pushMessages(...e){this.setMessagesParams(t=>({...t,messages:[...t.messages,...e]}))}compactBeforeNextTurn(e){"in_flight"!==(0,id.V)(this,tJ,"f").status&&(on(this.params),(0,id.b)(this,tJ,{status:"scheduled",config:e??{type:"summarize"}},"f"))}addTools(...e){let t=(0,id.V)(this,tE,"m",it).call(this);for(let i of e){if(aN(i))throw new aD(`addTools() can't add the '${ao(aL(i))}' toolset: ${oe}`);let e=(i.type??"custom").replace(/_\d{8}$/,"").replace(/_toolset$/,"");if(t.has(e))throw new aD(`addTools() can't replace the '${ao(e)}' toolset: ${oe}`)}for(let t of e)"name"in t&&(0,id.V)(this,tQ,"f").set(t.name,"run"in t?t:null),(0,id.V)(this,tY,"f").push({type:"addition",tool:t})}removeTools(...e){let t=(0,id.V)(this,tE,"m",it).call(this);for(let i of e){let e="string"==typeof i?i:i.name;if(t.has(e))throw new aD(`removeTools() can't remove the '${ao(e)}' toolset: a tool runner's toolsets come only from its tools param; remove it there with setMessagesParams(), or build a new runner without it`)}for(let t of e){let e="string"==typeof t?t:t.name;(0,id.V)(this,tQ,"f").set(e,null),(0,id.V)(this,tY,"f").push({type:"removal",name:e})}}then(e,t){return this.runUntilDone().then(e,t)}}return t0=async function*(e){await (0,id.V)(this,tE,"m",t6).call(this),(0,id.b)(this,tG,void 0,"f");let t=e.messages;t.some(oc)&&(0,id.V)(this,tE,"m",tZ).call(this,()=>e._state.setMessages(ol(t)));let{tools:i}=e._state.params;(0,id.V)(this,tN,"f").stream?((0,id.b)(this,tW,(0,id.V)(this,tE,"m",tZ).call(this,()=>(0,id.V)(this,tN,"f").runToolsEagerly?(0,id.V)(this,tE,"m",t2).call(this,e):e.stream(void 0,oo(e),(0,id.V)(this,tE,"m",t1).call(this,e))),"f"),i&&e.update({tools:i}),e===(0,id.V)(this,tL,"f")&&(0,id.b)(this,tD,e.messages,"f"),(0,id.b)(this,tU,(0,id.V)(this,tW,"f").finalMessage(),"f"),(0,id.V)(this,tU,"f").catch(()=>{}),yield(0,id.V)(this,tW,"f")):((0,id.b)(this,tU,(0,id.V)(this,tE,"m",tZ).call(this,()=>e.send(void 0,oo(e),(0,id.V)(this,tE,"m",t1).call(this,e))),"f"),i&&e.update({tools:i}),e===(0,id.V)(this,tL,"f")&&(0,id.b)(this,tD,e.messages,"f"),yield(0,id.V)(this,tU,"f"))},t1=function(e){let{headers:t=e._state.options.headers}=(0,id.V)(this,tC,"f");return{...(0,id.V)(this,tC,"f"),headers:r$([(0,id.V)(this,tj,"f"),t])}},t2=function(e){let t=new Map;(0,id.b)(this,tG,t,"f");let i=new Map,r=e=>{let r=t.has(e.id),s=!e.toolset_name&&(0,id.V)(this,tE,"m",it).call(this).has(e.name),n=s?e.name:e.toolset_name;if(n){if(r||s||i.has(n))return void i.set(n,"waiting");i.set(n,"running");let a=oh((0,id.V)(this,tE,"m",ii).call(this),n,e,(0,id.V)(this,tC,"f"),(0,id.V)(this,tL,"f")._client,(0,id.V)(this,tK,"f"));return t.set(e.id,{status:"started",result:a}),void a.then(({is_error:e})=>{e||"waiting"===i.get(n)?i.set(n,"waiting"):i.delete(n)},()=>i.set(n,"waiting"))}if(r)return;let a=od((0,id.V)(this,tE,"m",t3).call(this),(0,id.V)(this,tE,"m",t8).call(this),e,(0,id.V)(this,tC,"f"),(0,id.V)(this,tL,"f")._client,(0,id.V)(this,tK,"f"));a.catch(()=>{}),t.set(e.id,{status:"started",result:a})},s=new aB(e._state.params,r,e._client);return e._stream(s,void 0,oo(e),(0,id.V)(this,tE,"m",t1).call(this,e)),s},t6=async function(){let e=[...(0,id.V)(this,tG,"f")?.values()??[]].filter(e=>"started"===e.status);await Promise.allSettled(e.map(e=>e.result))},t4=async function*(e){on(this.params),(0,id.b)(this,tJ,{status:"in_flight"},"f"),(0,id.b)(this,tF,void 0,"f");let t=(0,id.V)(this,tU,"f"),i=(0,id.V)(this,tE,"m",t5).call(this,e),r=(0,id.V)(this,tL,"f").messages.length;try{yield*(0,id.V)(this,tE,"m",t0).call(this,i);let e=await (0,id.V)(this,tU,"f");if(e.content.some(e=>"compaction"===e.type&&e.content)){(0,id.V)(this,tE,"m",t9).call(this);let t={role:e.role,content:e.content},i=(0,id.V)(this,tL,"f").messages.slice(r).filter(e=>!a3(e,t));(0,id.V)(this,tL,"f")._state.setMessages([t,...i])}else(0,rz.u)((0,id.V)(this,tL,"f")._client).warn("Compaction produced no summary; keeping the conversation as it is."),(0,id.b)(this,tU,t,"f")}finally{(0,id.b)(this,tJ,{status:"idle"},"f"),i._state.threading||(0,id.V)(this,tL,"f")._state.stopThreading()}},t5=function(e){let{messages:t,...i}=function(e){let{context_management:t,stop_sequences:i,output_format:r,...s}=e;return(s.tool_choice?.type==="any"||s.tool_choice?.type==="tool")&&delete s.tool_choice,s.output_config&&(s.output_config=(({format:e,...t})=>t)(s.output_config)),Array.isArray(s.fallbacks)&&(s.fallbacks=s.fallbacks.map(e=>e.output_config?{...e,output_config:(({format:e,...t})=>t)(e.output_config)}:e)),s}((0,id.V)(this,tL,"f")._state.params),r=(0,id.V)(this,tL,"f").fork();return r._state=(0,id.V)(this,tL,"f")._state.fork({...i,compaction:e}),r},t3=function(){let e=new Map;for(let t of(0,id.V)(this,tL,"f")._state.params.tools??[])"run"in t&&"name"in t&&e.set(t.name,t);for(let[t,i]of(0,id.V)(this,tQ,"f"))i?e.set(t,i):e.delete(t);return e},t8=function(){let e=new Set((0,id.V)(this,tE,"m",t3).call(this).keys());for(let t of[...this.params.messages,(0,id.V)(this,tE,"m",is).call(this)])if(Array.isArray(t.content)){for(let i of t.content)if("system"===t.role)o_(i,e);else if("assistant"===t.role&&"compaction"===i.type)for(let t of i.tool_changes??[])o_(t,e)}return e},t9=function(){let e=(0,id.V)(this,tE,"m",t8).call(this);for(let t of(0,id.V)(this,tE,"m",t3).call(this).keys())e.has(t)||(0,id.V)(this,tQ,"f").set(t,null)},t7=async function*(){if("scheduled"===(0,id.V)(this,tJ,"f").status){if(op((0,id.V)(this,tL,"f").messages.at(-1))){(0,rz.u)((0,id.V)(this,tL,"f")._client).warn("The pending compaction was skipped because the last turn ended with tool calls that were not run. Call `compactBeforeNextTurn()` again if you continue the conversation."),(0,id.b)(this,tJ,{status:"idle"},"f");return}yield*(0,id.V)(this,tE,"m",t4).call(this,(0,id.V)(this,tJ,"f").config)}},ie=async function(e,t,i){return void 0!==(0,id.V)(this,tF,"f")||(0,id.b)(this,tF,ou((0,id.V)(this,tE,"m",ii).call(this),(0,id.V)(this,tE,"m",t3).call(this),(0,id.V)(this,tE,"m",t8).call(this),e,{...(0,id.V)(this,tC,"f"),signal:t},(0,id.V)(this,tG,"f"),(0,id.V)(this,tL,"f")._client,i),"f"),(0,id.V)(this,tF,"f")},it=function(){return new Set((0,id.V)(this,tE,"m",ii).call(this).tools.filter(aN).map(aL))},ii=function(){return{...this.params,tools:(0,id.V)(this,tL,"f")._state.params.tools??[]}},ir=function(){"pause_turn"!==(0,id.V)(this,tX,"f")&&0!==(0,id.V)(this,tY,"f").length&&((0,id.V)(this,tL,"f").append((0,id.V)(this,tE,"m",is).call(this)),(0,id.b)(this,tY,[],"f"))},is=function(){let e=[];for(let t of(0,id.V)(this,tY,"f")){if("removal"===t.type){e.push({type:"tool_removal",tool:{type:"tool_reference",name:t.name}});continue}let i=oa(t.tool);e.push({type:"tool_addition",tool:{type:"tool_definition",definition:i}})}return{role:"system",content:e}},e})();let oi="Message params can't be changed while the conversation is being compacted, because the compaction response is about to replace them. Change them after this iteration instead.";function or(e){if("compaction"in e&&null!=e.compaction)throw new ry.v("`compaction` cannot be set on a tool runner: every request in the loop would compact again. Call `runner.compactBeforeNextTurn()` when the conversation should be compacted instead.")}function os(e){if(e.runToolsEagerly&&!e.stream)throw TypeError("`runToolsEagerly: true` needs `stream: true` in the tool runner's params, because a reply that isn't streamed arrives whole.")}function on(e){if(e.context_management?.edits?.some(e=>e.type.startsWith("compact_")))throw new ry.v("`compactBeforeNextTurn()` can't be used while `context_management` has a compaction edit, because the API doesn't accept a compaction block together with one. Remove the edit first.")}function oa(e){return"run"in e?{...Object.fromEntries(Object.entries("toJSON"in e&&"function"==typeof e.toJSON?e.toJSON():e).filter(([e])=>oy.includes(e))),...ns(e)&&{[nr]:e[nr]}}:e}function oo(e){let{tools:t}=e._state.params;return t?{tools:t.map(oa)}:{}}function ol(e){return e.map(e=>{if("system"!==e.role||!Array.isArray(e.content))return e;let t=e.content.map(e=>"tool_addition"===e.type&&"tool_definition"===e.tool.type?{...e,tool:{...e.tool,definition:oa(e.tool.definition)}}:e);return{...e,content:t}})}function oc(e){return"system"===e.role&&Array.isArray(e.content)&&e.content.some(e=>"tool_addition"===e.type&&"tool_definition"===e.tool.type&&"run"in e.tool.definition)}async function ou(e,t,i,r,s,n,a,o){if(!r||"assistant"!==r.role||!r.content||"string"==typeof r.content)return null;let l=r.content.filter(e=>"tool_use"===e.type);if(0===l.length)return null;let c=new Map;return{role:"user",content:await Promise.all(l.map(async r=>{let l=n?.get(r.id),u=l?.status==="started"?l.result:void 0;if(r.toolset_name){let t=r.toolset_name,i=c.get(t)??{tail:Promise.resolve(),failed:!1};c.set(t,i);let l=e.tools.some(e=>aN(e)&&aL(e)===t),h=u??i.tail.then(()=>i.failed?aF(r,Object.prototype.hasOwnProperty.call(aW,t)?aW[t]:aU,!0):oh(e,t,r,s,a,o));return i.tail=h.then(({is_error:e})=>{e&&l&&(i.failed=!0)},()=>{i.failed=!0}),n?.set(r.id,{status:"started",result:h}),h}if(u)return u;if(!(i.has(r.name)?t.get(r.name):void 0)&&e.tools.some(e=>aN(e)&&aL(e)===r.name)){var h;let e=c.get(r.name)??{tail:Promise.resolve(),failed:!1};return c.set(r.name,e),e.tail=e.tail.then(()=>{e.failed=!0}),{type:"tool_result",tool_use_id:(h=r).id,content:`Error: the '${ao(h.name)}' toolset could not run this call${function(e){let t="object"==typeof e&&null!==e?e:{};if(!("actions"in t)){let e="action"in t?t.action:void 0;return"string"==typeof e?`: the call has no 'actions' list (action: '${ao(e)}')`:": the call has no 'actions' list"}let{actions:i}=t;if("string"==typeof i)return": 'actions' is text, not a list of actions";if(!Array.isArray(i))return": 'actions' is not a list of actions";if(0===i.length)return": the 'actions' list is empty";let r=[];for(let[e,t]of i.entries()){let i="object"==typeof t&&null!==t&&"action"in t?t.action:void 0;if("string"!=typeof i)return`: action ${e} must be an object with a string 'action' field`;r.push(`'${ao(i)}'`)}let s=r.length>10?`, and ${r.length-10} more`:"";return`: its actions could not be run as sent (actions: ${r.slice(0,10).join(", ")}${s})`}(h.input)}; nothing in the batch was executed`,is_error:!0}}let d=od(t,i,r,s,a,o);return n?.set(r.id,{status:"started",result:d}),d}))}}async function oh(e,t,i,r,s,n){let a=e.tools.find(e=>aN(e)&&aL(e)===t);if(!a)return aF(i,`Error: Toolset '${ao(t)}' member '${ao(i.name)}' not found`,!0);let o={signal:r?.signal,conversationId:r?.openTelemetry?.conversationId,parentContext:n};return(await ad(s,a,i,o,async()=>{let e=await aH(a,i,{signal:r?.signal});return{block:e,content:e.content??[],isError:!0===e.is_error}})).block}async function od(e,t,i,r,s,n){let a=t.has(i.name)?e.get(i.name):void 0;if(!a){var o;return{type:"tool_result",tool_use_id:(o=i).id,content:`Error: Tool '${o.name}' not found`,is_error:!0}}let l={signal:r?.signal,conversationId:r?.openTelemetry?.conversationId,parentContext:n},c=await ad(s,a,i,l,()=>ah(a,i.input,{toolUse:i,toolUseBlock:i,signal:r?.signal}));return{type:"tool_result",tool_use_id:i.id,content:c.content,...c.isError?{is_error:!0}:void 0}}function op(e){return Array.isArray(e?.content)&&e.content.some(e=>"tool_use"===e.type)}function o_(e,t){switch(e.type){case"tool_removal":case"tool_addition":var i,r;let s;i=e,r=t,void 0!==(s=function(e){switch(e.type){case"tool_reference":return e.name;case"tool_definition":return"name"in e.definition?e.definition.name:void 0;default:return}}(i.tool))&&("tool_removal"===i.type?r.delete(s):r.add(s))}}function of(e){if(null===e)return"stop";if(aQ(e))return"resume";switch(e){case"tool_use":return"run_tools";case"end_turn":case"stop_sequence":case"max_tokens":case"model_context_window_exceeded":case"refusal":return"stop";default:return(0,ip.f)(e),"stop"}}class og{constructor(e,t,i){if(!e._supportsMessageThreads)throw new ry.v("Message threads are not available on this client; use `client.beta.messages.create()` with the full `messages` instead");aP(t),this._client=e,this._state=new aG({params:t,options:i??{},threading:!0,logger:(0,rz.u)(e)})}static _fromState(e,t){return Object.assign(Object.create(og.prototype),{_client:e,_state:t})}get messages(){return this._state.messages}get previousMessageId(){return this._state.previousMessageId}get params(){return{...this._state.params,unsupportedRequestBehavior:this._state.unsupportedRequestBehavior}}append(...e){this._state.push(e)}send(e,t={},i={}){return this._send(e,t,i,e=>e)}parse(e,t={},i={}){return this._send(e,t,i,e=>aR(e,this._state.params,{logger:(0,rz.u)(this._client)}))}_send(e,t,i,r){let s=this._state.startTurn(a9(e),t),n=(async()=>{try{let{request:e,props:t}=await this._createWithRecovery(s,i,{stream:!1}),r=await e;return this._state.recordReply(s,r),{props:t,reply:r}}finally{this._state.endTurn(s)}})();return new s0(this._client,n.then(({props:e})=>e),async()=>{let{props:e,reply:t}=await n;return sj(r(t),e.response)})}stream(e,t={},i={}){let r=new aO(this._state.params,{logger:(0,rz.u)(this._client),client:this._client});return this._stream(r,e,t,i),r}_stream(e,t,i,r){let s,n=this._state.startTurn(a9(t),i),a=0,o=!1;e.on("streamEvent",(e,t)=>{o||(s=t,"content_block_stop"===e.type&&(a+=1),"message_stop"===e.type&&(o=!0,this._state.recordReply(n,t),this._state.endTurn(n)))});let l=()=>{o||(o=!0,s&&this._state.recordPartialReply(s,a),this._state.endTurn(n))};e.controller.signal.addEventListener("abort",l,{once:!0});let c=(e,t)=>new s0(this._client,this._createWithRecovery(n,{...r,signal:t?.signal},{stream:!0}).then(({props:e})=>e));e._start(c,this._state.params,{signal:r.signal??this._state.options.signal},l)}update(e={},t={}){this._state.update(e,t)}toolRunner(e={},t={}){return a6(e),new ot(this,e,t)}fork(){return og._fromState(this._client,this._state.fork())}async _createWithRecovery(e,t,{stream:i}){for(;;){let{params:r,options:s}=this._state.buildCreateArguments(e,t,{stream:i}),n=this._client.beta.messages.create({...r,stream:i},s);try{return{request:n,props:await n._responseProps()}}catch(e){if(!this._state.recoversFrom(e))throw e}}}}let om={"claude-sonnet-4-5":"November 30th, 2026","claude-sonnet-4-5-20250929":"November 30th, 2026"},ov=["claude-mythos-preview","claude-opus-4-6"];var ob=(()=>{class e extends ne{constructor(){super(...arguments),this.batches=new aA(this._client)}create(e,t){let i=aT(e),{betas:r,user_profile_id:s,workspace_id:n,...a}=i;a.model in om&&console.warn(`The model '${a.model}' is deprecated and will reach end-of-life on ${om[a.model]}
|
|
6
6
|
Please migrate to a newer model. Visit https://docs.anthropic.com/en/docs/resources/model-deprecations for more information.`),ov.includes(a.model)&&a.thinking&&"enabled"===a.thinking.type&&console.warn(`Using Claude with ${a.model} and 'thinking.type=enabled' is deprecated. Use 'thinking.type=adaptive' instead which results in better model performance in our testing: https://platform.claude.com/docs/en/build-with-claude/adaptive-thinking`);let o=t?.timeout??this._client._options.timeout;if(!a.stream&&null==o){let e=nw[a.model]??void 0;o=this._client.calculateNonstreamingTimeout(a.max_tokens,e)}let l=a$(i,t),c=this._client._tracer&&rN(this._client,"anthropic.messages.create",t,sz(this._client,a,l));sx(this._client,c,a);let u=this._client.post("/v1/messages",{body:a,timeout:o??6e5,...t,__qualifiers:{beta:"true"},__span:c,headers:l,stream:i.stream??!1});return c?u._thenUnwrap(e=>(sS(this._client,c,a,e),e)):u}parse(e,t){return t={...t,headers:r$([{"anthropic-beta":[...e.betas??[],"structured-outputs-2025-12-15"].toString()},t?.headers])},this.create(e,t).then(t=>aR(t,e,{logger:this._client.logger??console}))}stream(e,t){return aO.createMessage(this,e,t,{client:this._client})}countTokens(e,t){let{betas:i,user_profile_id:r,workspace_id:s,...n}=aT(e),a=r$([{"anthropic-beta":[...i??[],"token-counting-2024-11-01"].toString(),...null!=r?{"anthropic-user-profile-id":r}:void 0,...null!=s?{"anthropic-workspace-id":s}:void 0},t?.headers]),o=rN(this._client,"anthropic.messages.count_tokens",t,{route:"/v1/messages/count_tokens",attributes:{[so]:n.model}}),l=this._client.post("/v1/messages/count_tokens",{body:n,...t,__qualifiers:{beta:"true"},__span:o,headers:a});return o?l._thenUnwrap(e=>(sV(this._client,o,e),e)):l}toolRunner(e,t){return new ot(this._client,e,t)}_toolRunnerThread(e){aP(e);let{settings:t,thread:i,threadParams:r}=a7(e),s=new aG({params:{...r,unsupportedRequestBehavior:"continue_unthreaded"},options:{},threading:!1!==i&&this._client._supportsMessageThreads,logger:(0,rz.u)(this._client)});return{thread:og._fromState(this._client,s),settings:t}}thread(e,t){return new og(this._client,e,t)}}return e.Batches=aA,e.BetaToolRunner=ot,e.ToolError=ar.f,e})();let oy=["input_schema","name","allowed_callers","cache_control","defer_loading","description","eager_input_streaming","input_examples","strict","type","configs","display_height_px","display_width_px","display_number","enable_zoom","max_characters"];class ow extends ne{retrieve(e,t){return this._client.get(nb`/v1/organizations/api_keys/${e}`,{...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.api_keys.retrieve",t,{route:"/v1/organizations/api_keys/{api_key_id}",attributes:{"anthropic.organization.api_key.id":e}})})}update(e,t,i){return this._client.post(nb`/v1/organizations/api_keys/${e}`,{body:t,...i,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.api_keys.update",i,{route:"/v1/organizations/api_keys/{api_key_id}",attributes:{"anthropic.organization.api_key.id":e}})})}list(e={},t){return this._client.getAPIList("/v1/organizations/api_keys",s6,{query:e,...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.api_keys.list",t,{route:"/v1/organizations/api_keys",queryParams:["after_id","before_id","created_by_user_id","limit","status","workspace_id"]})})}}class ok extends ne{retrieve(e){return this._client.get("/v1/organizations/compliance_settings",{...e,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.compliance_settings.retrieve",e,{route:"/v1/organizations/compliance_settings"})})}update(e,t){return this._client.post("/v1/organizations/compliance_settings",{body:e,...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.compliance_settings.update",t,{route:"/v1/organizations/compliance_settings"})})}}class oz extends ne{create(e,t){return this._client.post("/v1/organizations/external_keys",{body:e,...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.external_keys.create",t,{route:"/v1/organizations/external_keys",createdIDAttribute:"anthropic.organization.external_key.id"})})}retrieve(e,t){return this._client.get(nb`/v1/organizations/external_keys/${e}`,{...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.external_keys.retrieve",t,{route:"/v1/organizations/external_keys/{external_key_id}",attributes:{"anthropic.organization.external_key.id":e}})})}update(e,t,i){return this._client.post(nb`/v1/organizations/external_keys/${e}`,{body:t,...i,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.external_keys.update",i,{route:"/v1/organizations/external_keys/{external_key_id}",attributes:{"anthropic.organization.external_key.id":e}})})}list(e={},t){return this._client.getAPIList("/v1/organizations/external_keys",s4,{query:e,...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.external_keys.list",t,{route:"/v1/organizations/external_keys",queryParams:["limit","page"]})})}delete(e,t){return this._client.delete(nb`/v1/organizations/external_keys/${e}`,{...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.external_keys.delete",t,{route:"/v1/organizations/external_keys/{external_key_id}",attributes:{"anthropic.organization.external_key.id":e}})})}validate(e,t){return this._client.post(nb`/v1/organizations/external_keys/${e}/validate`,{...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.external_keys.validate",t,{route:"/v1/organizations/external_keys/{external_key_id}/validate",attributes:{"anthropic.organization.external_key.id":e}})})}}class ox extends ne{create(e,t){return this._client.post("/v1/organizations/invites",{body:e,...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.invites.create",t,{route:"/v1/organizations/invites",createdIDAttribute:"anthropic.organization.invite.id"})})}retrieve(e,t){return this._client.get(nb`/v1/organizations/invites/${e}`,{...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.invites.retrieve",t,{route:"/v1/organizations/invites/{invite_id}",attributes:{"anthropic.organization.invite.id":e}})})}list(e={},t){return this._client.getAPIList("/v1/organizations/invites",s6,{query:e,...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.invites.list",t,{route:"/v1/organizations/invites",queryParams:["after_id","before_id","email","limit","roles","statuses"]})})}delete(e,t){return this._client.delete(nb`/v1/organizations/invites/${e}`,{...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.invites.delete",t,{route:"/v1/organizations/invites/{invite_id}",attributes:{"anthropic.organization.invite.id":e}})})}}class oS extends ne{retrieve(e,t={},i){let{betas:r,...s}=t??{};return this._client.get(nb`/v1/organizations/plugin_marketplaces/${e}`,{query:s,...i,headers:r$([{"anthropic-beta":[...r??[],"ce-plugins-2026-09-01"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.plugin_marketplaces.retrieve",i,{route:"/v1/organizations/plugin_marketplaces/{marketplace_id}",queryParams:["organization_id"],attributes:{"anthropic.organization.plugin_marketplace.id":e}})})}update(e,t,i){let{betas:r,...s}=t;return this._client.post(nb`/v1/organizations/plugin_marketplaces/${e}`,{body:s,...i,headers:r$([{"anthropic-beta":[...r??[],"ce-plugins-2026-09-01"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.plugin_marketplaces.update",i,{route:"/v1/organizations/plugin_marketplaces/{marketplace_id}",attributes:{"anthropic.organization.plugin_marketplace.id":e}})})}list(e={},t){let{betas:i,...r}=e??{};return this._client.getAPIList("/v1/organizations/plugin_marketplaces",s4,{query:r,...t,headers:r$([{"anthropic-beta":[...i??[],"ce-plugins-2026-09-01"].toString()},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.plugin_marketplaces.list",t,{route:"/v1/organizations/plugin_marketplaces",queryParams:["limit","organization_id","owner_type","page","source"]})})}validateArchive(e,t){let{betas:i,...r}=e;return this._client.post("/v1/organizations/plugin_marketplaces/validate_archive",sG({body:r,...t,headers:r$([{"anthropic-beta":[...i??[],"ce-plugins-2026-09-01"].toString()},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.plugin_marketplaces.validate_archive",t,{route:"/v1/organizations/plugin_marketplaces/validate_archive"})},this._client))}validateRepository(e,t){let{betas:i,...r}=e;return this._client.post("/v1/organizations/plugin_marketplaces/validate_repository",{body:r,...t,headers:r$([{"anthropic-beta":[...i??[],"ce-plugins-2026-09-01"].toString()},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.plugin_marketplaces.validate_repository",t,{route:"/v1/organizations/plugin_marketplaces/validate_repository"})})}}class oV extends ne{list(e={},t){return this._client.getAPIList("/v1/organizations/rate_limits",s4,{query:e,...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.rate_limits.list",t,{route:"/v1/organizations/rate_limits",queryParams:["group_type","limit","model","page"]})})}}class oA extends ne{retrieve(e,t){return this._client.get(nb`/v1/organizations/users/${e}`,{...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.users.retrieve",t,{route:"/v1/organizations/users/{user_id}",attributes:{"anthropic.organization.user.id":e}})})}update(e,t,i){return this._client.post(nb`/v1/organizations/users/${e}`,{body:t,...i,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.users.update",i,{route:"/v1/organizations/users/{user_id}",attributes:{"anthropic.organization.user.id":e}})})}list(e={},t){return this._client.getAPIList("/v1/organizations/users",s6,{query:e,...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.users.list",t,{route:"/v1/organizations/users",queryParams:["after_id","before_id","email","limit","roles"]})})}remove(e,t){return this._client.delete(nb`/v1/organizations/users/${e}`,{...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.users.remove",t,{route:"/v1/organizations/users/{user_id}",attributes:{"anthropic.organization.user.id":e}})})}}class oI extends ne{create(e,t){let{betas:i,...r}=e;return this._client.post("/v1/organizations/webhooks",{body:r,...t,headers:r$([{"anthropic-beta":[...i??[],"webhooks-2026-10-07"].toString()},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.webhooks.create",t,{route:"/v1/organizations/webhooks",createdIDAttribute:"anthropic.organization.webhook.id"})})}retrieve(e,t={},i){let{betas:r}=t??{};return this._client.get(nb`/v1/organizations/webhooks/${e}`,{...i,headers:r$([{"anthropic-beta":[...r??[],"webhooks-2026-10-07"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.webhooks.retrieve",i,{route:"/v1/organizations/webhooks/{webhook_endpoint_id}",attributes:{"anthropic.organization.webhook.id":e}})})}update(e,t,i){let{betas:r,...s}=t;return this._client.post(nb`/v1/organizations/webhooks/${e}`,{body:s,...i,headers:r$([{"anthropic-beta":[...r??[],"webhooks-2026-10-07"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.webhooks.update",i,{route:"/v1/organizations/webhooks/{webhook_endpoint_id}",attributes:{"anthropic.organization.webhook.id":e}})})}list(e={},t){let{betas:i,...r}=e??{};return this._client.getAPIList("/v1/organizations/webhooks",s6,{query:r,...t,headers:r$([{"anthropic-beta":[...i??[],"webhooks-2026-10-07"].toString()},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.webhooks.list",t,{route:"/v1/organizations/webhooks",queryParams:["after_id","before_id","limit","order"]})})}delete(e,t={},i){let{betas:r}=t??{};return this._client.delete(nb`/v1/organizations/webhooks/${e}`,{...i,headers:r$([{"anthropic-beta":[...r??[],"webhooks-2026-10-07"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.webhooks.delete",i,{route:"/v1/organizations/webhooks/{webhook_endpoint_id}",attributes:{"anthropic.organization.webhook.id":e}})})}regenerateSigningSecret(e,t={},i){let{betas:r}=t??{};return this._client.post(nb`/v1/organizations/webhooks/${e}/regenerate_signing_secret`,{...i,headers:r$([{"anthropic-beta":[...r??[],"webhooks-2026-10-07"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.webhooks.regenerate_signing_secret",i,{route:"/v1/organizations/webhooks/{webhook_endpoint_id}/regenerate_signing_secret",attributes:{"anthropic.organization.webhook.id":e}})})}}class oq extends ne{list(e,t){return this._client.getAPIList("/v1/organizations/analytics/artifacts",s4,{query:e,...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.analytics.artifacts.list",t,{route:"/v1/organizations/analytics/artifacts",queryParams:["date","filter","group_by","limit","page"]})})}}class oR extends ne{list(e={},t){return this._client.getAPIList("/v1/organizations/analytics/connectors",s4,{query:e,...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.analytics.connectors.list",t,{route:"/v1/organizations/analytics/connectors",queryParams:["date","ending_date","filter","group_by","limit","order","order_by","page","starting_date"],contentQueryParams:["filter"]})})}}class o$ extends ne{list(e,t){let{betas:i,...r}=e;return this._client.getAPIList("/v1/organizations/analytics/cost",s3,{query:r,...t,headers:r$([{"anthropic-beta":[...i??[],"analytics-usage-cost-2026-08-24"].toString()},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.analytics.cost.list",t,{route:"/v1/organizations/analytics/cost",queryParams:["actor_ids","actor_types","agent_ids","api_key_ids","claude_tag_categories","claude_tag_user_ids","context_windows","deployment_ids","ending_at","environment_ids","exclude_deleted_users","group_by","inference_geos","limit","models","order","order_by","page","products","rbac_group_ids","service_tiers","session_ids","slack_channel_ids","speeds","starting_at","time_bucket_width","user_profile_ids","workspace_ids"]})})}}class oT extends ne{list(e,t){return this._client.getAPIList("/v1/organizations/analytics/cost_report",s3,{query:e,...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.analytics.cost_report.list",t,{route:"/v1/organizations/analytics/cost_report",queryParams:["bucket_width","claude_tag_categories","claude_tag_user_ids","context_windows","ending_at","group_by","inference_geos","limit","models","page","products","rbac_group_ids","slack_channel_ids","speeds","starting_at","user_ids"]})})}}class oP extends ne{list(e={},t){return this._client.getAPIList("/v1/organizations/analytics/plugins",s4,{query:e,...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.analytics.plugins.list",t,{route:"/v1/organizations/analytics/plugins",queryParams:["date","ending_date","filter","group_by","limit","order","order_by","page","starting_date"],contentQueryParams:["filter"]})})}}class oE extends ne{list(e={},t){return this._client.getAPIList("/v1/organizations/analytics/skills",s4,{query:e,...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.analytics.skills.list",t,{route:"/v1/organizations/analytics/skills",queryParams:["date","ending_date","filter","group_by","limit","order","order_by","page","starting_date"],contentQueryParams:["filter"]})})}}class oO extends ne{list(e,t){return this._client.getAPIList("/v1/organizations/analytics/summaries",s4,{query:e,...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.analytics.summaries.list",t,{route:"/v1/organizations/analytics/summaries",queryParams:["ending_date","filter","limit","page","starting_date"]})})}}class oM extends ne{list(e,t){let{betas:i,...r}=e;return this._client.getAPIList("/v1/organizations/analytics/usage",s3,{query:r,...t,headers:r$([{"anthropic-beta":[...i??[],"analytics-usage-cost-2026-08-24"].toString()},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.analytics.usage.list",t,{route:"/v1/organizations/analytics/usage",queryParams:["actor_ids","actor_types","agent_ids","api_key_ids","claude_tag_categories","claude_tag_user_ids","context_windows","deployment_ids","ending_at","environment_ids","exclude_deleted_users","group_by","inference_geos","limit","models","order","order_by","page","products","rbac_group_ids","service_tiers","session_ids","slack_channel_ids","speeds","starting_at","time_bucket_width","user_profile_ids","workspace_ids"]})})}}class oL extends ne{list(e,t){return this._client.getAPIList("/v1/organizations/analytics/usage_report",s3,{query:e,...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.analytics.usage_report.list",t,{route:"/v1/organizations/analytics/usage_report",queryParams:["bucket_width","claude_tag_categories","claude_tag_user_ids","context_windows","ending_at","group_by","inference_geos","limit","models","page","products","rbac_group_ids","slack_channel_ids","speeds","starting_at","user_ids"]})})}}class oN extends ne{list(e,t){return this._client.getAPIList("/v1/organizations/analytics/user_cost_report",s3,{query:e,...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.analytics.user_cost_report.list",t,{route:"/v1/organizations/analytics/user_cost_report",queryParams:["bucket_width","claude_tag_categories","claude_tag_user_ids","context_windows","ending_at","exclude_deleted_users","group_by","inference_geos","limit","models","order","order_by","page","products","rbac_group_ids","slack_channel_ids","speeds","starting_at","user_ids"]})})}}class oC extends ne{list(e,t){return this._client.getAPIList("/v1/organizations/analytics/user_usage_report",s3,{query:e,...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.analytics.user_usage_report.list",t,{route:"/v1/organizations/analytics/user_usage_report",queryParams:["bucket_width","claude_tag_categories","claude_tag_user_ids","context_windows","ending_at","exclude_deleted_users","group_by","inference_geos","limit","models","order","order_by","page","products","rbac_group_ids","slack_channel_ids","speeds","starting_at","user_ids"]})})}}class oj extends ne{list(e={},t){return this._client.getAPIList("/v1/organizations/analytics/users",s4,{query:e,...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.analytics.users.list",t,{route:"/v1/organizations/analytics/users",queryParams:["date","ending_date","filter","group_by","limit","order","order_by","page","starting_date"],contentQueryParams:["page"]})})}}class oD extends ne{list(e={},t){return this._client.getAPIList("/v1/organizations/analytics/apps/chat/projects",s4,{query:e,...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.analytics.apps.chat.projects.list",t,{route:"/v1/organizations/analytics/apps/chat/projects",queryParams:["date","ending_date","filter","group_by","limit","order","order_by","page","starting_date"]})})}}var oU=(()=>{class e extends ne{constructor(){super(...arguments),this.projects=new oD(this._client)}}return e.Projects=oD,e})(),oW=(()=>{class e extends ne{constructor(){super(...arguments),this.chat=new oU(this._client)}}return e.Chat=oU,e})(),oF=(()=>{class e extends ne{constructor(){super(...arguments),this.summaries=new oO(this._client),this.users=new oj(this._client),this.apps=new oW(this._client),this.connectors=new oR(this._client),this.plugins=new oP(this._client),this.skills=new oE(this._client),this.artifacts=new oq(this._client),this.usage=new oM(this._client),this.cost=new o$(this._client),this.usageReport=new oL(this._client),this.userUsageReport=new oC(this._client),this.costReport=new oT(this._client),this.userCostReport=new oN(this._client)}}return e.Summaries=oO,e.Users=oj,e.Apps=oW,e.Connectors=oR,e.Plugins=oP,e.Skills=oE,e.Artifacts=oq,e.Usage=oM,e.Cost=o$,e.UsageReport=oL,e.UserUsageReport=oC,e.CostReport=oT,e.UserCostReport=oN,e})();class oH extends ne{create(e,t){let{betas:i,...r}=e;return this._client.post("/v1/organizations/claude_tag/slack_channels",{body:r,...t,headers:r$([{"anthropic-beta":[...i??[],"experimental-claude-tag-2026-10-21"].toString()},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.claude_tag.slack_channels.create",t,{route:"/v1/organizations/claude_tag/slack_channels",createdIDAttribute:"anthropic.organization.claude_tag.slack_channel.id"})})}retrieve(e,t={},i){let{betas:r,...s}=t??{};return this._client.get(nb`/v1/organizations/claude_tag/slack_channels/${e}`,{query:s,...i,headers:r$([{"anthropic-beta":[...r??[],"experimental-claude-tag-2026-10-21"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.claude_tag.slack_channels.retrieve",i,{route:"/v1/organizations/claude_tag/slack_channels/{id}",queryParams:["include_inherited"],attributes:{"anthropic.organization.claude_tag.slack_channel.id":e}})})}update(e,t,i){let{betas:r,...s}=t;return this._client.post(nb`/v1/organizations/claude_tag/slack_channels/${e}`,{body:s,...i,headers:r$([{"anthropic-beta":[...r??[],"experimental-claude-tag-2026-10-21"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.claude_tag.slack_channels.update",i,{route:"/v1/organizations/claude_tag/slack_channels/{id}",attributes:{"anthropic.organization.claude_tag.slack_channel.id":e}})})}list(e,t){let{betas:i,...r}=e;return this._client.getAPIList("/v1/organizations/claude_tag/slack_channels",s4,{query:r,...t,headers:r$([{"anthropic-beta":[...i??[],"experimental-claude-tag-2026-10-21"].toString()},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.claude_tag.slack_channels.list",t,{route:"/v1/organizations/claude_tag/slack_channels",queryParams:["include_inherited","limit","page","slack_channel_id","slack_workspace_id"]})})}delete(e,t={},i){let{betas:r}=t??{};return this._client.delete(nb`/v1/organizations/claude_tag/slack_channels/${e}`,{...i,headers:r$([{"anthropic-beta":[...r??[],"experimental-claude-tag-2026-10-21"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.claude_tag.slack_channels.delete",i,{route:"/v1/organizations/claude_tag/slack_channels/{id}",attributes:{"anthropic.organization.claude_tag.slack_channel.id":e}})})}}class oB extends ne{retrieve(e,t={},i){let{betas:r,...s}=t??{};return this._client.get(nb`/v1/organizations/claude_tag/slack_workspaces/${e}`,{query:s,...i,headers:r$([{"anthropic-beta":[...r??[],"experimental-claude-tag-2026-10-21"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.claude_tag.slack_workspaces.retrieve",i,{route:"/v1/organizations/claude_tag/slack_workspaces/{id}",queryParams:["include_inherited"],attributes:{"anthropic.organization.claude_tag.slack_workspace.id":e}})})}update(e,t,i){let{betas:r,...s}=t;return this._client.post(nb`/v1/organizations/claude_tag/slack_workspaces/${e}`,{body:s,...i,headers:r$([{"anthropic-beta":[...r??[],"experimental-claude-tag-2026-10-21"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.claude_tag.slack_workspaces.update",i,{route:"/v1/organizations/claude_tag/slack_workspaces/{id}",attributes:{"anthropic.organization.claude_tag.slack_workspace.id":e}})})}list(e={},t){let{betas:i,...r}=e??{};return this._client.getAPIList("/v1/organizations/claude_tag/slack_workspaces",s4,{query:r,...t,headers:r$([{"anthropic-beta":[...i??[],"experimental-claude-tag-2026-10-21"].toString()},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.claude_tag.slack_workspaces.list",t,{route:"/v1/organizations/claude_tag/slack_workspaces",queryParams:["include_inherited","limit","page","slack_workspace_id"]})})}}class oK extends ne{create(e,t,i){let{target:r,betas:s}=t;return this._client.post(nb`/v1/organizations/claude_tag/bundles/${e}/targets`,{body:r,...i,headers:r$([{"anthropic-beta":[...s??[],"experimental-claude-tag-2026-10-21"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.claude_tag.bundles.targets.create",i,{route:"/v1/organizations/claude_tag/bundles/{bundle_id}/targets",attributes:{"anthropic.organization.claude_tag.bundle.id":e}})})}retrieve(e,t,i){let{bundle_id:r,betas:s}=t;return this._client.get(nb`/v1/organizations/claude_tag/bundles/${r}/targets/${e}`,{...i,headers:r$([{"anthropic-beta":[...s??[],"experimental-claude-tag-2026-10-21"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.claude_tag.bundles.targets.retrieve",i,{route:"/v1/organizations/claude_tag/bundles/{bundle_id}/targets/{target_id}",attributes:{"anthropic.organization.claude_tag.bundle.id":r,"anthropic.organization.claude_tag.bundle.target.id":e}})})}list(e,t={},i){let{betas:r,...s}=t??{};return this._client.getAPIList(nb`/v1/organizations/claude_tag/bundles/${e}/targets`,s4,{query:s,...i,headers:r$([{"anthropic-beta":[...r??[],"experimental-claude-tag-2026-10-21"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.claude_tag.bundles.targets.list",i,{route:"/v1/organizations/claude_tag/bundles/{bundle_id}/targets",queryParams:["limit","page"],attributes:{"anthropic.organization.claude_tag.bundle.id":e}})})}delete(e,t,i){let{bundle_id:r,betas:s}=t;return this._client.delete(nb`/v1/organizations/claude_tag/bundles/${r}/targets/${e}`,{...i,headers:r$([{"anthropic-beta":[...s??[],"experimental-claude-tag-2026-10-21"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.claude_tag.bundles.targets.delete",i,{route:"/v1/organizations/claude_tag/bundles/{bundle_id}/targets/{target_id}",attributes:{"anthropic.organization.claude_tag.bundle.id":r,"anthropic.organization.claude_tag.bundle.target.id":e}})})}}var oJ=(()=>{class e extends ne{constructor(){super(...arguments),this.targets=new oK(this._client)}retrieve(e,t={},i){let{betas:r}=t??{};return this._client.get(nb`/v1/organizations/claude_tag/bundles/${e}`,{...i,headers:r$([{"anthropic-beta":[...r??[],"experimental-claude-tag-2026-10-21"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.claude_tag.bundles.retrieve",i,{route:"/v1/organizations/claude_tag/bundles/{bundle_id}",attributes:{"anthropic.organization.claude_tag.bundle.id":e}})})}list(e={},t){let{betas:i,...r}=e??{};return this._client.getAPIList("/v1/organizations/claude_tag/bundles",s4,{query:r,...t,headers:r$([{"anthropic-beta":[...i??[],"experimental-claude-tag-2026-10-21"].toString()},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.claude_tag.bundles.list",t,{route:"/v1/organizations/claude_tag/bundles",queryParams:["limit","page"]})})}}return e.Targets=oK,e})(),oG=(()=>{class e extends ne{constructor(){super(...arguments),this.slackChannels=new oH(this._client),this.slackWorkspaces=new oB(this._client),this.bundles=new oJ(this._client)}}return e.SlackChannels=oH,e.SlackWorkspaces=oB,e.Bundles=oJ,e})();class oX extends ne{create(e,t){let{betas:i,...r}=e;return this._client.post("/v1/organizations/federation_issuers",{body:r,...t,headers:r$([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.federation.issuers.create",t,{route:"/v1/organizations/federation_issuers",createdIDAttribute:"anthropic.organization.federation_issuer.id"})})}retrieve(e,t={},i){let{betas:r}=t??{};return this._client.get(nb`/v1/organizations/federation_issuers/${e}`,{...i,headers:r$([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.federation.issuers.retrieve",i,{route:"/v1/organizations/federation_issuers/{federation_issuer_id}",attributes:{"anthropic.organization.federation_issuer.id":e}})})}update(e,t,i){let{betas:r,...s}=t;return this._client.post(nb`/v1/organizations/federation_issuers/${e}`,{body:s,...i,headers:r$([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.federation.issuers.update",i,{route:"/v1/organizations/federation_issuers/{federation_issuer_id}",attributes:{"anthropic.organization.federation_issuer.id":e}})})}list(e={},t){let{betas:i,...r}=e??{};return this._client.getAPIList("/v1/organizations/federation_issuers",s4,{query:r,...t,headers:r$([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.federation.issuers.list",t,{route:"/v1/organizations/federation_issuers",queryParams:["include_archived","limit","page"]})})}archive(e,t={},i){let{betas:r}=t??{};return this._client.post(nb`/v1/organizations/federation_issuers/${e}/archive`,{...i,headers:r$([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.federation.issuers.archive",i,{route:"/v1/organizations/federation_issuers/{federation_issuer_id}/archive",attributes:{"anthropic.organization.federation_issuer.id":e}})})}}class oQ extends ne{list(e,t={},i){let{betas:r,...s}=t??{};return this._client.getAPIList(nb`/v1/organizations/federation_rules/${e}/workspaces`,s4,{query:s,...i,headers:r$([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.federation.rules.workspaces.list",i,{route:"/v1/organizations/federation_rules/{federation_rule_id}/workspaces",queryParams:["limit","page"],attributes:{"anthropic.organization.federation_rule.id":e}})})}add(e,t,i){let{betas:r,...s}=t;return this._client.post(nb`/v1/organizations/federation_rules/${e}/workspaces`,{body:s,...i,headers:r$([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.federation.rules.workspaces.add",i,{route:"/v1/organizations/federation_rules/{federation_rule_id}/workspaces",attributes:{"anthropic.organization.federation_rule.id":e},createdIDAttribute:"anthropic.organization.federation_rule.workspace.id",createdIDField:"workspace_id"})})}remove(e,t,i){let{federation_rule_id:r,betas:s}=t;return this._client.delete(nb`/v1/organizations/federation_rules/${r}/workspaces/${e}`,{...i,headers:r$([{...s?.toString()!=null?{"anthropic-beta":s?.toString()}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.federation.rules.workspaces.remove",i,{route:"/v1/organizations/federation_rules/{federation_rule_id}/workspaces/{workspace_id}",attributes:{"anthropic.organization.federation_rule.id":r,"anthropic.organization.federation_rule.workspace.id":e}})})}}var oY=(()=>{class e extends ne{constructor(){super(...arguments),this.workspaces=new oQ(this._client)}create(e,t){let{betas:i,...r}=e;return this._client.post("/v1/organizations/federation_rules",{body:r,...t,headers:r$([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.federation.rules.create",t,{route:"/v1/organizations/federation_rules",createdIDAttribute:"anthropic.organization.federation_rule.id"})})}retrieve(e,t={},i){let{betas:r}=t??{};return this._client.get(nb`/v1/organizations/federation_rules/${e}`,{...i,headers:r$([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.federation.rules.retrieve",i,{route:"/v1/organizations/federation_rules/{federation_rule_id}",attributes:{"anthropic.organization.federation_rule.id":e}})})}update(e,t,i){let{betas:r,...s}=t;return this._client.post(nb`/v1/organizations/federation_rules/${e}`,{body:s,...i,headers:r$([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.federation.rules.update",i,{route:"/v1/organizations/federation_rules/{federation_rule_id}",attributes:{"anthropic.organization.federation_rule.id":e}})})}list(e={},t){let{betas:i,...r}=e??{};return this._client.getAPIList("/v1/organizations/federation_rules",s4,{query:r,...t,headers:r$([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.federation.rules.list",t,{route:"/v1/organizations/federation_rules",queryParams:["include_archived","issuer_id","limit","page"]})})}archive(e,t={},i){let{betas:r}=t??{};return this._client.post(nb`/v1/organizations/federation_rules/${e}/archive`,{...i,headers:r$([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.federation.rules.archive",i,{route:"/v1/organizations/federation_rules/{federation_rule_id}/archive",attributes:{"anthropic.organization.federation_rule.id":e}})})}}return e.Workspaces=oQ,e})(),oZ=(()=>{class e extends ne{constructor(){super(...arguments),this.issuers=new oX(this._client),this.rules=new oY(this._client)}}return e.Issuers=oX,e.Rules=oY,e})();class o0 extends ne{list(e,t={},i){let{betas:r,...s}=t??{};return this._client.getAPIList(nb`/v1/organizations/plugins/${e}/installation_settings`,s4,{query:s,...i,headers:r$([{"anthropic-beta":[...r??[],"ce-plugins-2026-09-01"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.plugins.installation_settings.list",i,{route:"/v1/organizations/plugins/{plugin_id}/installation_settings",queryParams:["limit","organization_id","page","target_type"],attributes:{"anthropic.organization.plugin.id":e}})})}remove(e,t,i){let{plugin_id:r,betas:s}=t;return this._client.delete(nb`/v1/organizations/plugins/${r}/installation_settings/${e}`,{...i,headers:r$([{"anthropic-beta":[...s??[],"ce-plugins-2026-09-01"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.plugins.installation_settings.remove",i,{route:"/v1/organizations/plugins/{plugin_id}/installation_settings/{target}",attributes:{"anthropic.organization.plugin.id":r,"anthropic.organization.plugin.installation_setting.id":e}})})}set(e,t,i){let{plugin_id:r,betas:s,...n}=t;return this._client.post(nb`/v1/organizations/plugins/${r}/installation_settings/${e}`,{body:n,...i,headers:r$([{"anthropic-beta":[...s??[],"ce-plugins-2026-09-01"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.plugins.installation_settings.set",i,{route:"/v1/organizations/plugins/{plugin_id}/installation_settings/{target}",attributes:{"anthropic.organization.plugin.id":r,"anthropic.organization.plugin.installation_setting.id":e}})})}}class o1 extends ne{list(e,t={},i){let{betas:r,...s}=t??{};return this._client.getAPIList(nb`/v1/organizations/plugins/${e}/shares`,s4,{query:s,...i,headers:r$([{"anthropic-beta":[...r??[],"ce-plugins-2026-09-01"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.plugins.shares.list",i,{route:"/v1/organizations/plugins/{plugin_id}/shares",queryParams:["limit","organization_id","page","target_type"],attributes:{"anthropic.organization.plugin.id":e}})})}}class o2 extends ne{create(e,t,i){let{betas:r,...s}=t;return this._client.post(nb`/v1/organizations/plugins/${e}/versions`,sG({body:s,...i,headers:r$([{"anthropic-beta":[...r??[],"ce-plugins-2026-09-01"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.plugins.versions.create",i,{route:"/v1/organizations/plugins/{plugin_id}/versions",attributes:{"anthropic.organization.plugin.id":e},createdIDAttribute:"anthropic.organization.plugin.version.id"})},this._client))}retrieve(e,t,i){let{plugin_id:r,betas:s,...n}=t;return this._client.get(nb`/v1/organizations/plugins/${r}/versions/${e}`,{query:n,...i,headers:r$([{"anthropic-beta":[...s??[],"ce-plugins-2026-09-01"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.plugins.versions.retrieve",i,{route:"/v1/organizations/plugins/{plugin_id}/versions/{version}",queryParams:["organization_id"],attributes:{"anthropic.organization.plugin.id":r,"anthropic.organization.plugin.version.id":e}})})}list(e,t={},i){let{betas:r,...s}=t??{};return this._client.getAPIList(nb`/v1/organizations/plugins/${e}/versions`,s4,{query:s,...i,headers:r$([{"anthropic-beta":[...r??[],"ce-plugins-2026-09-01"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.plugins.versions.list",i,{route:"/v1/organizations/plugins/{plugin_id}/versions",queryParams:["limit","organization_id","page"],attributes:{"anthropic.organization.plugin.id":e}})})}download(e,t,i){let{plugin_id:r,betas:s,...n}=t;return this._client.get(nb`/v1/organizations/plugins/${r}/versions/${e}/content`,{query:n,...i,headers:r$([{"anthropic-beta":[...s??[],"ce-plugins-2026-09-01"].toString(),Accept:"application/binary"},i?.headers]),__qualifiers:{beta:"true"},__binaryResponse:!0,__span:rN(this._client,"anthropic.organization.plugins.versions.download",i,{route:"/v1/organizations/plugins/{plugin_id}/versions/{version}/content",queryParams:["organization_id"],attributes:{"anthropic.organization.plugin.id":r,"anthropic.organization.plugin.version.id":e}})})}}var o6=(()=>{class e extends ne{constructor(){super(...arguments),this.versions=new o2(this._client),this.installationSettings=new o0(this._client),this.shares=new o1(this._client)}create(e,t){let{betas:i,...r}=e;return this._client.post("/v1/organizations/plugins",sG({body:r,...t,headers:r$([{"anthropic-beta":[...i??[],"ce-plugins-2026-09-01"].toString()},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.plugins.create",t,{route:"/v1/organizations/plugins",createdIDAttribute:"anthropic.organization.plugin.id"})},this._client))}retrieve(e,t={},i){let{betas:r,...s}=t??{};return this._client.get(nb`/v1/organizations/plugins/${e}`,{query:s,...i,headers:r$([{"anthropic-beta":[...r??[],"ce-plugins-2026-09-01"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.plugins.retrieve",i,{route:"/v1/organizations/plugins/{plugin_id}",queryParams:["organization_id"],attributes:{"anthropic.organization.plugin.id":e}})})}update(e,t,i){let{betas:r,...s}=t;return this._client.post(nb`/v1/organizations/plugins/${e}`,{body:s,...i,headers:r$([{"anthropic-beta":[...r??[],"ce-plugins-2026-09-01"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.plugins.update",i,{route:"/v1/organizations/plugins/{plugin_id}",attributes:{"anthropic.organization.plugin.id":e}})})}list(e={},t){let{betas:i,...r}=e??{};return this._client.getAPIList("/v1/organizations/plugins",s4,{query:r,...t,headers:r$([{"anthropic-beta":[...i??[],"ce-plugins-2026-09-01"].toString()},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.plugins.list",t,{route:"/v1/organizations/plugins",queryParams:["created_at[gt]","created_at[gte]","created_at[lt]","created_at[lte]","limit","marketplace_id","organization_id","owner_type","owner_user_id","page"]})})}delete(e,t={},i){let{betas:r}=t??{};return this._client.delete(nb`/v1/organizations/plugins/${e}`,{...i,headers:r$([{"anthropic-beta":[...r??[],"ce-plugins-2026-09-01"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.plugins.delete",i,{route:"/v1/organizations/plugins/{plugin_id}",attributes:{"anthropic.organization.plugin.id":e}})})}}return e.Versions=o2,e.InstallationSettings=o0,e.Shares=o1,e})();class o4 extends ne{list(e,t={},i){return this._client.getAPIList(nb`/v1/organizations/rbac_groups/${e}/members`,s4,{query:t,...i,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.rbac_groups.members.list",i,{route:"/v1/organizations/rbac_groups/{rbac_group_id}/members",queryParams:["limit","page"],attributes:{"anthropic.organization.rbac_group.id":e}})})}add(e,t,i){return this._client.post(nb`/v1/organizations/rbac_groups/${e}/members`,{body:t,...i,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.rbac_groups.members.add",i,{route:"/v1/organizations/rbac_groups/{rbac_group_id}/members",attributes:{"anthropic.organization.rbac_group.id":e},createdIDAttribute:"anthropic.organization.rbac_group.member.id",createdIDField:"user_id"})})}remove(e,t,i){let{rbac_group_id:r}=t;return this._client.delete(nb`/v1/organizations/rbac_groups/${r}/members/${e}`,{...i,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.rbac_groups.members.remove",i,{route:"/v1/organizations/rbac_groups/{rbac_group_id}/members/{user_id}",attributes:{"anthropic.organization.rbac_group.id":r,"anthropic.organization.rbac_group.member.id":e}})})}}var o5=(()=>{class e extends ne{constructor(){super(...arguments),this.members=new o4(this._client)}create(e,t){return this._client.post("/v1/organizations/rbac_groups",{body:e,...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.rbac_groups.create",t,{route:"/v1/organizations/rbac_groups",createdIDAttribute:"anthropic.organization.rbac_group.id"})})}retrieve(e,t){return this._client.get(nb`/v1/organizations/rbac_groups/${e}`,{...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.rbac_groups.retrieve",t,{route:"/v1/organizations/rbac_groups/{rbac_group_id}",attributes:{"anthropic.organization.rbac_group.id":e}})})}update(e,t,i){return this._client.post(nb`/v1/organizations/rbac_groups/${e}`,{body:t,...i,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.rbac_groups.update",i,{route:"/v1/organizations/rbac_groups/{rbac_group_id}",attributes:{"anthropic.organization.rbac_group.id":e}})})}list(e={},t){return this._client.getAPIList("/v1/organizations/rbac_groups",s4,{query:e,...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.rbac_groups.list",t,{route:"/v1/organizations/rbac_groups",queryParams:["limit","page"]})})}delete(e,t){return this._client.delete(nb`/v1/organizations/rbac_groups/${e}`,{...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.rbac_groups.delete",t,{route:"/v1/organizations/rbac_groups/{rbac_group_id}",attributes:{"anthropic.organization.rbac_group.id":e}})})}}return e.Members=o4,e})();class o3 extends ne{list(e,t={},i){return this._client.getAPIList(nb`/v1/organizations/rbac_roles/${e}/permissions`,s4,{query:t,...i,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.rbac_roles.permissions.list",i,{route:"/v1/organizations/rbac_roles/{rbac_role_id}/permissions",queryParams:["limit","page"],attributes:{"anthropic.organization.rbac_role.id":e}})})}}var o8=(()=>{class e extends ne{constructor(){super(...arguments),this.permissions=new o3(this._client)}retrieve(e,t){return this._client.get(nb`/v1/organizations/rbac_roles/${e}`,{...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.rbac_roles.retrieve",t,{route:"/v1/organizations/rbac_roles/{rbac_role_id}",attributes:{"anthropic.organization.rbac_role.id":e}})})}list(e={},t){return this._client.getAPIList("/v1/organizations/rbac_roles",s4,{query:e,...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.rbac_roles.list",t,{route:"/v1/organizations/rbac_roles",queryParams:["limit","page"]})})}}return e.Permissions=o3,e})();class o9 extends ne{list(e,t={},i){let{betas:r,...s}=t??{};return this._client.getAPIList(nb`/v1/organizations/service_accounts/${e}/workspaces`,s4,{query:s,...i,headers:r$([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.service_accounts.workspaces.list",i,{route:"/v1/organizations/service_accounts/{service_account_id}/workspaces",queryParams:["limit","page"],attributes:{"anthropic.organization.service_account.id":e}})})}add(e,t,i){let{betas:r,...s}=t;return this._client.post(nb`/v1/organizations/service_accounts/${e}/workspaces`,{body:s,...i,headers:r$([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.service_accounts.workspaces.add",i,{route:"/v1/organizations/service_accounts/{service_account_id}/workspaces",attributes:{"anthropic.organization.service_account.id":e},createdIDAttribute:"anthropic.organization.service_account.workspace.id",createdIDField:"workspace_id"})})}remove(e,t,i){let{service_account_id:r,betas:s}=t;return this._client.delete(nb`/v1/organizations/service_accounts/${r}/workspaces/${e}`,{...i,headers:r$([{...s?.toString()!=null?{"anthropic-beta":s?.toString()}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.service_accounts.workspaces.remove",i,{route:"/v1/organizations/service_accounts/{service_account_id}/workspaces/{workspace_id}",attributes:{"anthropic.organization.service_account.id":r,"anthropic.organization.service_account.workspace.id":e}})})}}var o7=(()=>{class e extends ne{constructor(){super(...arguments),this.workspaces=new o9(this._client)}create(e,t){let{betas:i,...r}=e;return this._client.post("/v1/organizations/service_accounts",{body:r,...t,headers:r$([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.service_accounts.create",t,{route:"/v1/organizations/service_accounts",createdIDAttribute:"anthropic.organization.service_account.id"})})}retrieve(e,t={},i){let{betas:r}=t??{};return this._client.get(nb`/v1/organizations/service_accounts/${e}`,{...i,headers:r$([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.service_accounts.retrieve",i,{route:"/v1/organizations/service_accounts/{service_account_id}",attributes:{"anthropic.organization.service_account.id":e}})})}update(e,t,i){let{betas:r,...s}=t;return this._client.post(nb`/v1/organizations/service_accounts/${e}`,{body:s,...i,headers:r$([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.service_accounts.update",i,{route:"/v1/organizations/service_accounts/{service_account_id}",attributes:{"anthropic.organization.service_account.id":e}})})}list(e={},t){let{betas:i,...r}=e??{};return this._client.getAPIList("/v1/organizations/service_accounts",s4,{query:r,...t,headers:r$([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.service_accounts.list",t,{route:"/v1/organizations/service_accounts",queryParams:["include_archived","limit","page"]})})}archive(e,t={},i){let{betas:r}=t??{};return this._client.post(nb`/v1/organizations/service_accounts/${e}/archive`,{...i,headers:r$([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.service_accounts.archive",i,{route:"/v1/organizations/service_accounts/{service_account_id}/archive",attributes:{"anthropic.organization.service_account.id":e}})})}}return e.Workspaces=o9,e})();class le extends ne{list(e={},t){return this._client.getAPIList("/v1/organizations/spend_limits/effective",s4,{query:e,...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.spend_limits.effective.list",t,{route:"/v1/organizations/spend_limits/effective",queryParams:["limit","page","period","user_ids"]})})}}class lt extends ne{retrieve(e,t){return this._client.get(nb`/v1/organizations/spend_limit_increase_requests/${e}`,{...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.spend_limits.increase_requests.retrieve",t,{route:"/v1/organizations/spend_limit_increase_requests/{spend_limit_increase_request_id}",attributes:{"anthropic.organization.spend_limit_increase_request.id":e}})})}list(e={},t){return this._client.getAPIList("/v1/organizations/spend_limit_increase_requests",s4,{query:e,...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.spend_limits.increase_requests.list",t,{route:"/v1/organizations/spend_limit_increase_requests",queryParams:["actor_ids","limit","page","status"]})})}approve(e,t,i){return this._client.post(nb`/v1/organizations/spend_limit_increase_requests/${e}/approve`,{body:t,...i,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.spend_limits.increase_requests.approve",i,{route:"/v1/organizations/spend_limit_increase_requests/{spend_limit_increase_request_id}/approve",attributes:{"anthropic.organization.spend_limit_increase_request.id":e}})})}deny(e,t,i){return this._client.post(nb`/v1/organizations/spend_limit_increase_requests/${e}/deny`,{body:t,...i,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.spend_limits.increase_requests.deny",i,{route:"/v1/organizations/spend_limit_increase_requests/{spend_limit_increase_request_id}/deny",attributes:{"anthropic.organization.spend_limit_increase_request.id":e}})})}}var li=(()=>{class e extends ne{constructor(){super(...arguments),this.effective=new le(this._client),this.increaseRequests=new lt(this._client)}retrieve(e,t){return this._client.get(nb`/v1/organizations/spend_limits/${e}`,{...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.spend_limits.retrieve",t,{route:"/v1/organizations/spend_limits/{spend_limit_id}",attributes:{"anthropic.organization.spend_limit.id":e}})})}list(e={},t){let{betas:i,...r}=e??{};return this._client.getAPIList("/v1/organizations/spend_limits",s4,{query:r,...t,headers:r$([{"anthropic-beta":[...i??[],"spend-limit-reads-2026-09-26"].toString()},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.spend_limits.list",t,{route:"/v1/organizations/spend_limits",queryParams:["limit","page","scope_type","workspace_id"]})})}delete(e,t){return this._client.delete(nb`/v1/organizations/spend_limits/${e}`,{...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.spend_limits.delete",t,{route:"/v1/organizations/spend_limits/{spend_limit_id}",attributes:{"anthropic.organization.spend_limit.id":e}})})}set(e,t){let{betas:i,...r}=e;return this._client.post("/v1/organizations/spend_limits",{body:r,...t,headers:r$([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.spend_limits.set",t,{route:"/v1/organizations/spend_limits",createdIDAttribute:"anthropic.organization.spend_limit.id"})})}}return e.Effective=le,e.IncreaseRequests=lt,e})();class lr extends ne{list(e,t={},i){let{betas:r,...s}=t??{};return this._client.getAPIList(nb`/v1/organizations/telemetry_destinations/${e}/workspaces`,s4,{query:s,...i,headers:r$([{"anthropic-beta":[...r??[],"telemetry-destinations-2026-08-11"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.telemetry_destinations.workspaces.list",i,{route:"/v1/organizations/telemetry_destinations/{destination_id}/workspaces",queryParams:["limit","page"],attributes:{"anthropic.organization.telemetry_destination.id":e}})})}add(e,t,i){let{destination_id:r,betas:s}=t;return this._client.post(nb`/v1/organizations/telemetry_destinations/${r}/workspaces/${e}`,{...i,headers:r$([{"anthropic-beta":[...s??[],"telemetry-destinations-2026-08-11"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.telemetry_destinations.workspaces.add",i,{route:"/v1/organizations/telemetry_destinations/{destination_id}/workspaces/{workspace_id}",attributes:{"anthropic.organization.telemetry_destination.id":r,"anthropic.organization.telemetry_destination.workspace.id":e}})})}remove(e,t,i){let{destination_id:r,betas:s}=t;return this._client.delete(nb`/v1/organizations/telemetry_destinations/${r}/workspaces/${e}`,{...i,headers:r$([{"anthropic-beta":[...s??[],"telemetry-destinations-2026-08-11"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.telemetry_destinations.workspaces.remove",i,{route:"/v1/organizations/telemetry_destinations/{destination_id}/workspaces/{workspace_id}",attributes:{"anthropic.organization.telemetry_destination.id":r,"anthropic.organization.telemetry_destination.workspace.id":e}})})}}var ls=(()=>{class e extends ne{constructor(){super(...arguments),this.workspaces=new lr(this._client)}create(e,t){let{betas:i,...r}=e;return this._client.post("/v1/organizations/telemetry_destinations",{body:r,...t,headers:r$([{"anthropic-beta":[...i??[],"telemetry-destinations-2026-08-11"].toString()},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.telemetry_destinations.create",t,{route:"/v1/organizations/telemetry_destinations",createdIDAttribute:"anthropic.organization.telemetry_destination.id"})})}retrieve(e,t={},i){let{betas:r}=t??{};return this._client.get(nb`/v1/organizations/telemetry_destinations/${e}`,{...i,headers:r$([{"anthropic-beta":[...r??[],"telemetry-destinations-2026-08-11"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.telemetry_destinations.retrieve",i,{route:"/v1/organizations/telemetry_destinations/{destination_id}",attributes:{"anthropic.organization.telemetry_destination.id":e}})})}update(e,t,i){let{betas:r,...s}=t;return this._client.post(nb`/v1/organizations/telemetry_destinations/${e}`,{body:s,...i,headers:r$([{"anthropic-beta":[...r??[],"telemetry-destinations-2026-08-11"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.telemetry_destinations.update",i,{route:"/v1/organizations/telemetry_destinations/{destination_id}",attributes:{"anthropic.organization.telemetry_destination.id":e}})})}list(e={},t){let{betas:i,...r}=e??{};return this._client.getAPIList("/v1/organizations/telemetry_destinations",s4,{query:r,...t,headers:r$([{"anthropic-beta":[...i??[],"telemetry-destinations-2026-08-11"].toString()},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.telemetry_destinations.list",t,{route:"/v1/organizations/telemetry_destinations",queryParams:["limit","page","workspace_ids"]})})}delete(e,t={},i){let{betas:r}=t??{};return this._client.delete(nb`/v1/organizations/telemetry_destinations/${e}`,{...i,headers:r$([{"anthropic-beta":[...r??[],"telemetry-destinations-2026-08-11"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.telemetry_destinations.delete",i,{route:"/v1/organizations/telemetry_destinations/{destination_id}",attributes:{"anthropic.organization.telemetry_destination.id":e}})})}test(e,t={},i){let{betas:r}=t??{};return this._client.post(nb`/v1/organizations/telemetry_destinations/${e}/test`,{...i,headers:r$([{"anthropic-beta":[...r??[],"telemetry-destinations-2026-08-11"].toString()},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.telemetry_destinations.test",i,{route:"/v1/organizations/telemetry_destinations/{destination_id}/test",attributes:{"anthropic.organization.telemetry_destination.id":e}})})}}return e.Workspaces=lr,e})();class ln extends ne{retrieve(e,t,i){let{workspace_id:r}=t;return this._client.get(nb`/v1/organizations/workspaces/${r}/members/${e}`,{...i,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.workspaces.members.retrieve",i,{route:"/v1/organizations/workspaces/{workspace_id}/members/{user_id}",attributes:{"anthropic.organization.workspace.id":r,"anthropic.organization.workspace.member.id":e}})})}update(e,t,i){let{workspace_id:r,...s}=t;return this._client.post(nb`/v1/organizations/workspaces/${r}/members/${e}`,{body:s,...i,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.workspaces.members.update",i,{route:"/v1/organizations/workspaces/{workspace_id}/members/{user_id}",attributes:{"anthropic.organization.workspace.id":r,"anthropic.organization.workspace.member.id":e}})})}list(e,t={},i){return this._client.getAPIList(nb`/v1/organizations/workspaces/${e}/members`,s6,{query:t,...i,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.workspaces.members.list",i,{route:"/v1/organizations/workspaces/{workspace_id}/members",queryParams:["after_id","before_id","limit"],attributes:{"anthropic.organization.workspace.id":e}})})}add(e,t,i){return this._client.post(nb`/v1/organizations/workspaces/${e}/members`,{body:t,...i,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.workspaces.members.add",i,{route:"/v1/organizations/workspaces/{workspace_id}/members",attributes:{"anthropic.organization.workspace.id":e},createdIDAttribute:"anthropic.organization.workspace.member.id",createdIDField:"user_id"})})}remove(e,t,i){let{workspace_id:r}=t;return this._client.delete(nb`/v1/organizations/workspaces/${r}/members/${e}`,{...i,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.workspaces.members.remove",i,{route:"/v1/organizations/workspaces/{workspace_id}/members/{user_id}",attributes:{"anthropic.organization.workspace.id":r,"anthropic.organization.workspace.member.id":e}})})}}class la extends ne{update(e,t,i){let{workspace_id:r,...s}=t;return this._client.post(nb`/v1/organizations/workspaces/${r}/rate_limits/${e}`,{body:s,...i,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.workspaces.rate_limits.update",i,{route:"/v1/organizations/workspaces/{workspace_id}/rate_limits/{rate_limit_id}",attributes:{"anthropic.organization.workspace.id":r,"anthropic.organization.workspace.rate_limit.id":e}})})}list(e,t={},i){return this._client.getAPIList(nb`/v1/organizations/workspaces/${e}/rate_limits`,s4,{query:t,...i,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.workspaces.rate_limits.list",i,{route:"/v1/organizations/workspaces/{workspace_id}/rate_limits",queryParams:["group_type","include_inherited","limit","page"],attributes:{"anthropic.organization.workspace.id":e}})})}}class lo extends ne{retrieve(e,t,i){let{workspace_id:r,betas:s}=t;return this._client.get(nb`/v1/organizations/workspaces/${r}/service_accounts/${e}`,{...i,headers:r$([{...s?.toString()!=null?{"anthropic-beta":s?.toString()}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.workspaces.service_accounts.retrieve",i,{route:"/v1/organizations/workspaces/{workspace_id}/service_accounts/{service_account_id}",attributes:{"anthropic.organization.workspace.id":r,"anthropic.organization.workspace.service_account.id":e}})})}update(e,t,i){let{workspace_id:r,betas:s,...n}=t;return this._client.post(nb`/v1/organizations/workspaces/${r}/service_accounts/${e}`,{body:n,...i,headers:r$([{...s?.toString()!=null?{"anthropic-beta":s?.toString()}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.workspaces.service_accounts.update",i,{route:"/v1/organizations/workspaces/{workspace_id}/service_accounts/{service_account_id}",attributes:{"anthropic.organization.workspace.id":r,"anthropic.organization.workspace.service_account.id":e}})})}list(e,t={},i){let{betas:r,...s}=t??{};return this._client.getAPIList(nb`/v1/organizations/workspaces/${e}/service_accounts`,s4,{query:s,...i,headers:r$([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.workspaces.service_accounts.list",i,{route:"/v1/organizations/workspaces/{workspace_id}/service_accounts",queryParams:["limit","page"],attributes:{"anthropic.organization.workspace.id":e}})})}add(e,t,i){let{betas:r,...s}=t;return this._client.post(nb`/v1/organizations/workspaces/${e}/service_accounts`,{body:s,...i,headers:r$([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.workspaces.service_accounts.add",i,{route:"/v1/organizations/workspaces/{workspace_id}/service_accounts",attributes:{"anthropic.organization.workspace.id":e},createdIDAttribute:"anthropic.organization.workspace.service_account.id",createdIDField:"service_account_id"})})}remove(e,t,i){let{workspace_id:r,betas:s}=t;return this._client.delete(nb`/v1/organizations/workspaces/${r}/service_accounts/${e}`,{...i,headers:r$([{...s?.toString()!=null?{"anthropic-beta":s?.toString()}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.workspaces.service_accounts.remove",i,{route:"/v1/organizations/workspaces/{workspace_id}/service_accounts/{service_account_id}",attributes:{"anthropic.organization.workspace.id":r,"anthropic.organization.workspace.service_account.id":e}})})}}var ll=(()=>{class e extends ne{constructor(){super(...arguments),this.rateLimits=new la(this._client),this.members=new ln(this._client),this.serviceAccounts=new lo(this._client)}create(e,t){let{betas:i,...r}=e;return this._client.post("/v1/organizations/workspaces",{body:r,...t,headers:r$([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.workspaces.create",t,{route:"/v1/organizations/workspaces",createdIDAttribute:"anthropic.organization.workspace.id"})})}retrieve(e,t){return this._client.get(nb`/v1/organizations/workspaces/${e}`,{...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.workspaces.retrieve",t,{route:"/v1/organizations/workspaces/{workspace_id}",attributes:{"anthropic.organization.workspace.id":e}})})}update(e,t,i){return this._client.post(nb`/v1/organizations/workspaces/${e}`,{body:t,...i,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.workspaces.update",i,{route:"/v1/organizations/workspaces/{workspace_id}",attributes:{"anthropic.organization.workspace.id":e}})})}list(e={},t){return this._client.getAPIList("/v1/organizations/workspaces",s6,{query:e,...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.workspaces.list",t,{route:"/v1/organizations/workspaces",queryParams:["after_id","before_id","include_archived","include_default","limit"]})})}archive(e,t){return this._client.post(nb`/v1/organizations/workspaces/${e}/archive`,{...t,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.workspaces.archive",t,{route:"/v1/organizations/workspaces/{workspace_id}/archive",attributes:{"anthropic.organization.workspace.id":e}})})}}return e.RateLimits=la,e.Members=ln,e.ServiceAccounts=lo,e})(),lc=(()=>{class e extends ne{constructor(){super(...arguments),this.apiKeys=new ow(this._client),this.externalKeys=new oz(this._client),this.federation=new oZ(this._client),this.invites=new ox(this._client),this.serviceAccounts=new o7(this._client),this.users=new oA(this._client),this.workspaces=new ll(this._client),this.rateLimits=new oV(this._client),this.complianceSettings=new ok(this._client),this.analytics=new oF(this._client),this.spendLimits=new li(this._client),this.rbacGroups=new o5(this._client),this.rbacRoles=new o8(this._client),this.plugins=new o6(this._client),this.pluginMarketplaces=new oS(this._client),this.telemetryDestinations=new ls(this._client),this.webhooks=new oI(this._client),this.claudeTag=new oG(this._client)}retrieve(e){return this._client.get("/v1/organizations/me",{...e,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.organization.retrieve",e,{route:"/v1/organizations/me"})})}}return e.APIKeys=ow,e.ExternalKeys=oz,e.Federation=oZ,e.Invites=ox,e.ServiceAccounts=o7,e.Users=oA,e.Workspaces=ll,e.RateLimits=oV,e.ComplianceSettings=ok,e.Analytics=oF,e.SpendLimits=li,e.RBACGroups=o5,e.RBACRoles=o8,e.Plugins=o6,e.PluginMarketplaces=oS,e.TelemetryDestinations=ls,e.Webhooks=oI,e.ClaudeTag=oG,e})(),lu=(()=>{class e extends ne{list(e,t={},i){let{betas:r,workspace_id:s,...n}=t??{};return this._client.getAPIList(nb`/v1/sessions/${e}/events`,s4,{query:n,...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.sessions.events.list",i,{route:"/v1/sessions/{session_id}/events",queryParams:["created_at[gt]","created_at[gte]","created_at[lt]","created_at[lte]","limit","order","page","types"],attributes:{"anthropic.session.id":e}})})}send(e,t,i){let{betas:r,workspace_id:s,...n}=t;return this._client.post(nb`/v1/sessions/${e}/events`,{body:n,...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.sessions.events.send",i,{route:"/v1/sessions/{session_id}/events",attributes:{"anthropic.session.id":e}})})}stream(e,t={},i){let{betas:r,workspace_id:s,...n}=t??{};return this._client.get(nb`/v1/sessions/${e}/events/stream`,{query:n,...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),stream:!0,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.sessions.events.stream",i,{route:"/v1/sessions/{session_id}/events/stream",queryParams:["event_deltas"],attributes:{"anthropic.session.id":e}})})}toolRunner(e,t){return new af(e,{...t,client:this._client})}}return e.SessionToolRunner=af,e})();class lh extends ne{retrieve(e,t,i){let{session_id:r,betas:s,workspace_id:n}=t;return this._client.get(nb`/v1/sessions/${r}/resources/${e}`,{...i,headers:r$([{"anthropic-beta":[...s??[],"managed-agents-2026-04-01"].toString(),...null!=n?{"anthropic-workspace-id":n}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.sessions.resources.retrieve",i,{route:"/v1/sessions/{session_id}/resources/{resource_id}",attributes:{"anthropic.session.id":r,"anthropic.session.resource.id":e}})})}update(e,t,i){let{session_id:r,betas:s,workspace_id:n,...a}=t;return this._client.post(nb`/v1/sessions/${r}/resources/${e}`,{body:a,...i,headers:r$([{"anthropic-beta":[...s??[],"managed-agents-2026-04-01"].toString(),...null!=n?{"anthropic-workspace-id":n}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.sessions.resources.update",i,{route:"/v1/sessions/{session_id}/resources/{resource_id}",attributes:{"anthropic.session.id":r,"anthropic.session.resource.id":e}})})}list(e,t={},i){let{betas:r,workspace_id:s,...n}=t??{};return this._client.getAPIList(nb`/v1/sessions/${e}/resources`,s4,{query:n,...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.sessions.resources.list",i,{route:"/v1/sessions/{session_id}/resources",queryParams:["limit","page"],attributes:{"anthropic.session.id":e}})})}delete(e,t,i){let{session_id:r,betas:s,workspace_id:n}=t;return this._client.delete(nb`/v1/sessions/${r}/resources/${e}`,{...i,headers:r$([{"anthropic-beta":[...s??[],"managed-agents-2026-04-01"].toString(),...null!=n?{"anthropic-workspace-id":n}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.sessions.resources.delete",i,{route:"/v1/sessions/{session_id}/resources/{resource_id}",attributes:{"anthropic.session.id":r,"anthropic.session.resource.id":e}})})}add(e,t,i){let{betas:r,workspace_id:s,...n}=t;return this._client.post(nb`/v1/sessions/${e}/resources`,{body:n,...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.sessions.resources.add",i,{route:"/v1/sessions/{session_id}/resources",attributes:{"anthropic.session.id":e},createdIDAttribute:"anthropic.session.resource.id"})})}}class ld extends ne{list(e,t,i){let{session_id:r,betas:s,workspace_id:n,...a}=t;return this._client.getAPIList(nb`/v1/sessions/${r}/threads/${e}/events`,s4,{query:a,...i,headers:r$([{"anthropic-beta":[...s??[],"managed-agents-2026-04-01"].toString(),...null!=n?{"anthropic-workspace-id":n}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.sessions.threads.events.list",i,{route:"/v1/sessions/{session_id}/threads/{thread_id}/events",queryParams:["limit","page"],attributes:{"anthropic.session.id":r,"anthropic.session.thread.id":e}})})}stream(e,t,i){let{session_id:r,betas:s,workspace_id:n,...a}=t;return this._client.get(nb`/v1/sessions/${r}/threads/${e}/stream`,{query:a,...i,headers:r$([{"anthropic-beta":[...s??[],"managed-agents-2026-04-01"].toString(),...null!=n?{"anthropic-workspace-id":n}:void 0},i?.headers]),stream:!0,__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.sessions.threads.events.stream",i,{route:"/v1/sessions/{session_id}/threads/{thread_id}/stream",queryParams:["event_deltas"],attributes:{"anthropic.session.id":r,"anthropic.session.thread.id":e}})})}}var lp=(()=>{class e extends ne{constructor(){super(...arguments),this.events=new ld(this._client)}retrieve(e,t,i){let{session_id:r,betas:s,workspace_id:n}=t;return this._client.get(nb`/v1/sessions/${r}/threads/${e}`,{...i,headers:r$([{"anthropic-beta":[...s??[],"managed-agents-2026-04-01"].toString(),...null!=n?{"anthropic-workspace-id":n}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.sessions.threads.retrieve",i,{route:"/v1/sessions/{session_id}/threads/{thread_id}",attributes:{"anthropic.session.id":r,"anthropic.session.thread.id":e}})})}list(e,t={},i){let{betas:r,workspace_id:s,...n}=t??{};return this._client.getAPIList(nb`/v1/sessions/${e}/threads`,s4,{query:n,...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.sessions.threads.list",i,{route:"/v1/sessions/{session_id}/threads",queryParams:["limit","page","statuses"],attributes:{"anthropic.session.id":e}})})}archive(e,t,i){let{session_id:r,betas:s,workspace_id:n}=t;return this._client.post(nb`/v1/sessions/${r}/threads/${e}/archive`,{...i,headers:r$([{"anthropic-beta":[...s??[],"managed-agents-2026-04-01"].toString(),...null!=n?{"anthropic-workspace-id":n}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.sessions.threads.archive",i,{route:"/v1/sessions/{session_id}/threads/{thread_id}/archive",attributes:{"anthropic.session.id":r,"anthropic.session.thread.id":e}})})}}return e.Events=ld,e})(),l_=(()=>{class e extends ne{constructor(){super(...arguments),this.events=new lu(this._client),this.resources=new lh(this._client),this.threads=new lp(this._client)}create(e,t){let{betas:i,workspace_id:r,...s}=e,n=r$([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...null!=r?{"anthropic-workspace-id":r}:void 0},t?.headers]),a=rN(this._client,"anthropic.sessions.create",t,{route:"/v1/sessions",attributes:{"gen_ai.agent.id":"object"==typeof s.agent?s.agent?.id:s.agent,"anthropic.session.environment.id":s.environment_id},createdIDAttribute:"anthropic.session.id"}),o=this._client.post("/v1/sessions",{body:s,...t,headers:n,__qualifiers:{beta:"true"},__span:a});return a?o._thenUnwrap(e=>{var t=this._client;try{a?.span.setAttributes({"gen_ai.agent.name":e.agent.name,[so]:e.agent.model.id})}catch(e){(0,rz.u)(t).debug("could not record the response on its span",e)}return e}):o}retrieve(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.get(nb`/v1/sessions/${e}`,{...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.sessions.retrieve",i,{route:"/v1/sessions/{session_id}",attributes:{"anthropic.session.id":e}})})}update(e,t,i){let{betas:r,workspace_id:s,...n}=t;return this._client.post(nb`/v1/sessions/${e}`,{body:n,...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.sessions.update",i,{route:"/v1/sessions/{session_id}",attributes:{"anthropic.session.id":e}})})}list(e={},t){let{betas:i,workspace_id:r,...s}=e??{};return this._client.getAPIList("/v1/sessions",s5,{query:s,...t,headers:r$([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...null!=r?{"anthropic-workspace-id":r}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.sessions.list",t,{route:"/v1/sessions",queryParams:["agent_id","agent_version","created_at[gt]","created_at[gte]","created_at[lt]","created_at[lte]","deployment_id","include_archived","limit","memory_store_id","order","page","statuses"]})})}delete(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.delete(nb`/v1/sessions/${e}`,{...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.sessions.delete",i,{route:"/v1/sessions/{session_id}",attributes:{"anthropic.session.id":e}})})}archive(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.post(nb`/v1/sessions/${e}/archive`,{...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.sessions.archive",i,{route:"/v1/sessions/{session_id}/archive",attributes:{"anthropic.session.id":e}})})}}return e.Events=lu,e.Resources=lh,e.Threads=lp,e})();class lf extends ne{create(e,t,i){let{betas:r,workspace_id:s,...n}=t;return this._client.post(nb`/v1/skills/${e}/versions`,sG({body:n,...i,headers:r$([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0,...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.skills.versions.create",i,{route:"/v1/skills/{skill_id}/versions",attributes:{"anthropic.skill.id":e},createdIDAttribute:"anthropic.skill.version.id"})},this._client,!1))}retrieve(e,t,i){let{skill_id:r,betas:s,workspace_id:n}=t;return this._client.get(nb`/v1/skills/${r}/versions/${e}`,{...i,headers:r$([{...s?.toString()!=null?{"anthropic-beta":s?.toString()}:void 0,...null!=n?{"anthropic-workspace-id":n}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.skills.versions.retrieve",i,{route:"/v1/skills/{skill_id}/versions/{version}",attributes:{"anthropic.skill.id":r,"anthropic.skill.version.id":e}})})}list(e,t={},i){let{betas:r,workspace_id:s,...n}=t??{};return this._client.getAPIList(nb`/v1/skills/${e}/versions`,s4,{query:n,...i,headers:r$([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0,...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.skills.versions.list",i,{route:"/v1/skills/{skill_id}/versions",queryParams:["limit","page"],attributes:{"anthropic.skill.id":e}})})}delete(e,t,i){let{skill_id:r,betas:s,workspace_id:n}=t;return this._client.delete(nb`/v1/skills/${r}/versions/${e}`,{...i,headers:r$([{...s?.toString()!=null?{"anthropic-beta":s?.toString()}:void 0,...null!=n?{"anthropic-workspace-id":n}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.skills.versions.delete",i,{route:"/v1/skills/{skill_id}/versions/{version}",attributes:{"anthropic.skill.id":r,"anthropic.skill.version.id":e}})})}download(e,t,i){let{skill_id:r,betas:s,workspace_id:n}=t;return this._client.get(nb`/v1/skills/${r}/versions/${e}/content`,{...i,headers:r$([{Accept:"application/binary",...s?.toString()!=null?{"anthropic-beta":s?.toString()}:void 0,...null!=n?{"anthropic-workspace-id":n}:void 0},i?.headers]),__qualifiers:{beta:"true"},__binaryResponse:!0,__span:rN(this._client,"anthropic.skills.versions.download",i,{route:"/v1/skills/{skill_id}/versions/{version}/content",attributes:{"anthropic.skill.id":r,"anthropic.skill.version.id":e}})})}}var lg=(()=>{class e extends ne{constructor(){super(...arguments),this.versions=new lf(this._client)}create(e,t){let{betas:i,workspace_id:r,...s}=e;return this._client.post("/v1/skills",sG({body:s,...t,headers:r$([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0,...null!=r?{"anthropic-workspace-id":r}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.skills.create",t,{route:"/v1/skills",createdIDAttribute:"anthropic.skill.id"})},this._client,!1))}retrieve(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.get(nb`/v1/skills/${e}`,{...i,headers:r$([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0,...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.skills.retrieve",i,{route:"/v1/skills/{skill_id}",attributes:{"anthropic.skill.id":e}})})}list(e={},t){let{betas:i,workspace_id:r,...s}=e??{};return this._client.getAPIList("/v1/skills",s4,{query:s,...t,headers:r$([{...i?.toString()!=null?{"anthropic-beta":i?.toString()}:void 0,...null!=r?{"anthropic-workspace-id":r}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.skills.list",t,{route:"/v1/skills",queryParams:["limit","page","source"]})})}delete(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.delete(nb`/v1/skills/${e}`,{...i,headers:r$([{...r?.toString()!=null?{"anthropic-beta":r?.toString()}:void 0,...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.skills.delete",i,{route:"/v1/skills/{skill_id}",attributes:{"anthropic.skill.id":e}})})}}return e.Versions=lf,e})();class lm extends ne{create(e,t,i){let{betas:r,workspace_id:s,...n}=t;return this._client.post(nb`/v1/tunnels/${e}/certificates`,{body:n,...i,headers:r$([{"anthropic-beta":[...r??[],"mcp-tunnels-2026-06-22"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.tunnels.certificates.create",i,{route:"/v1/tunnels/{tunnel_id}/certificates",attributes:{"anthropic.tunnel.id":e},createdIDAttribute:"anthropic.tunnel.certificate.id"})})}retrieve(e,t,i){let{tunnel_id:r,betas:s,workspace_id:n}=t;return this._client.get(nb`/v1/tunnels/${r}/certificates/${e}`,{...i,headers:r$([{"anthropic-beta":[...s??[],"mcp-tunnels-2026-06-22"].toString(),...null!=n?{"anthropic-workspace-id":n}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.tunnels.certificates.retrieve",i,{route:"/v1/tunnels/{tunnel_id}/certificates/{certificate_id}",attributes:{"anthropic.tunnel.id":r,"anthropic.tunnel.certificate.id":e}})})}list(e,t={},i){let{betas:r,workspace_id:s,...n}=t??{};return this._client.getAPIList(nb`/v1/tunnels/${e}/certificates`,s4,{query:n,...i,headers:r$([{"anthropic-beta":[...r??[],"mcp-tunnels-2026-06-22"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.tunnels.certificates.list",i,{route:"/v1/tunnels/{tunnel_id}/certificates",queryParams:["include_archived","limit","page"],attributes:{"anthropic.tunnel.id":e}})})}archive(e,t,i){let{tunnel_id:r,betas:s,workspace_id:n}=t;return this._client.post(nb`/v1/tunnels/${r}/certificates/${e}/archive`,{...i,headers:r$([{"anthropic-beta":[...s??[],"mcp-tunnels-2026-06-22"].toString(),...null!=n?{"anthropic-workspace-id":n}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.tunnels.certificates.archive",i,{route:"/v1/tunnels/{tunnel_id}/certificates/{certificate_id}/archive",attributes:{"anthropic.tunnel.id":r,"anthropic.tunnel.certificate.id":e}})})}}var lv=(()=>{class e extends ne{constructor(){super(...arguments),this.certificates=new lm(this._client)}create(e,t){let{betas:i,workspace_id:r,...s}=e;return this._client.post("/v1/tunnels",{body:s,...t,headers:r$([{"anthropic-beta":[...i??[],"mcp-tunnels-2026-06-22"].toString(),...null!=r?{"anthropic-workspace-id":r}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.tunnels.create",t,{route:"/v1/tunnels",createdIDAttribute:"anthropic.tunnel.id"})})}retrieve(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.get(nb`/v1/tunnels/${e}`,{...i,headers:r$([{"anthropic-beta":[...r??[],"mcp-tunnels-2026-06-22"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.tunnels.retrieve",i,{route:"/v1/tunnels/{tunnel_id}",attributes:{"anthropic.tunnel.id":e}})})}list(e={},t){let{betas:i,workspace_id:r,...s}=e??{};return this._client.getAPIList("/v1/tunnels",s4,{query:s,...t,headers:r$([{"anthropic-beta":[...i??[],"mcp-tunnels-2026-06-22"].toString(),...null!=r?{"anthropic-workspace-id":r}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.tunnels.list",t,{route:"/v1/tunnels",queryParams:["include_archived","limit","page"]})})}archive(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.post(nb`/v1/tunnels/${e}/archive`,{...i,headers:r$([{"anthropic-beta":[...r??[],"mcp-tunnels-2026-06-22"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.tunnels.archive",i,{route:"/v1/tunnels/{tunnel_id}/archive",attributes:{"anthropic.tunnel.id":e}})})}revealToken(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.post(nb`/v1/tunnels/${e}/reveal_token`,{...i,headers:r$([{"anthropic-beta":[...r??[],"mcp-tunnels-2026-06-22"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.tunnels.reveal_token",i,{route:"/v1/tunnels/{tunnel_id}/reveal_token",attributes:{"anthropic.tunnel.id":e}})})}rotateToken(e,t,i){let{betas:r,workspace_id:s,...n}=t;return this._client.post(nb`/v1/tunnels/${e}/rotate_token`,{body:n,...i,headers:r$([{"anthropic-beta":[...r??[],"mcp-tunnels-2026-06-22"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.tunnels.rotate_token",i,{route:"/v1/tunnels/{tunnel_id}/rotate_token",attributes:{"anthropic.tunnel.id":e}})})}}return e.Certificates=lm,e})();class lb extends ne{create(e,t,i){let{betas:r,workspace_id:s,...n}=t;return this._client.post(nb`/v1/user_profiles/${e}/action_urls`,{body:n,...i,headers:r$([{"anthropic-beta":[...r??[],"user-profiles-2026-08-18"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.user_profiles.action_urls.create",i,{route:"/v1/user_profiles/{user_profile_id}/action_urls",attributes:{"anthropic.user_profile.id":e}})})}}var ly=(()=>{class e extends ne{constructor(){super(...arguments),this.actionURLs=new lb(this._client)}create(e,t){let{betas:i,workspace_id:r,...s}=e;return this._client.post("/v1/user_profiles",{body:s,...t,headers:r$([{"anthropic-beta":[...i??[],"user-profiles-2026-08-18"].toString(),...null!=r?{"anthropic-workspace-id":r}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.user_profiles.create",t,{route:"/v1/user_profiles",createdIDAttribute:"anthropic.user_profile.id"})})}retrieve(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.get(nb`/v1/user_profiles/${e}`,{...i,headers:r$([{"anthropic-beta":[...r??[],"user-profiles-2026-08-18"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.user_profiles.retrieve",i,{route:"/v1/user_profiles/{user_profile_id}",attributes:{"anthropic.user_profile.id":e}})})}update(e,t,i){let{betas:r,workspace_id:s,...n}=t;return this._client.post(nb`/v1/user_profiles/${e}`,{body:n,...i,headers:r$([{"anthropic-beta":[...r??[],"user-profiles-2026-08-18"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.user_profiles.update",i,{route:"/v1/user_profiles/{user_profile_id}",attributes:{"anthropic.user_profile.id":e}})})}list(e={},t){let{betas:i,workspace_id:r,...s}=e??{};return this._client.getAPIList("/v1/user_profiles",s4,{query:s,...t,headers:r$([{"anthropic-beta":[...i??[],"user-profiles-2026-08-18"].toString(),...null!=r?{"anthropic-workspace-id":r}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.user_profiles.list",t,{route:"/v1/user_profiles",queryParams:["limit","order","order_by","page"]})})}delete(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.delete(nb`/v1/user_profiles/${e}`,{...i,headers:r$([{"anthropic-beta":[...r??[],"user-profiles-2026-08-18"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.user_profiles.delete",i,{route:"/v1/user_profiles/{user_profile_id}",attributes:{"anthropic.user_profile.id":e}})})}createEnrollmentURL(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.post(nb`/v1/user_profiles/${e}/enrollment_url`,{...i,headers:r$([{"anthropic-beta":[...r??[],"user-profiles-2026-08-18"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.user_profiles.create_enrollment_url",i,{route:"/v1/user_profiles/{user_profile_id}/enrollment_url",attributes:{"anthropic.user_profile.id":e}})})}}return e.ActionURLs=lb,e})();class lw extends ne{create(e,t,i){let{betas:r,workspace_id:s,...n}=t;return this._client.post(nb`/v1/vaults/${e}/credentials`,{body:n,...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.vaults.credentials.create",i,{route:"/v1/vaults/{vault_id}/credentials",attributes:{"anthropic.vault.id":e},createdIDAttribute:"anthropic.vault.credential.id"})})}retrieve(e,t,i){let{vault_id:r,betas:s,workspace_id:n}=t;return this._client.get(nb`/v1/vaults/${r}/credentials/${e}`,{...i,headers:r$([{"anthropic-beta":[...s??[],"managed-agents-2026-04-01"].toString(),...null!=n?{"anthropic-workspace-id":n}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.vaults.credentials.retrieve",i,{route:"/v1/vaults/{vault_id}/credentials/{credential_id}",attributes:{"anthropic.vault.id":r,"anthropic.vault.credential.id":e}})})}update(e,t,i){let{vault_id:r,betas:s,workspace_id:n,...a}=t;return this._client.post(nb`/v1/vaults/${r}/credentials/${e}`,{body:a,...i,headers:r$([{"anthropic-beta":[...s??[],"managed-agents-2026-04-01"].toString(),...null!=n?{"anthropic-workspace-id":n}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.vaults.credentials.update",i,{route:"/v1/vaults/{vault_id}/credentials/{credential_id}",attributes:{"anthropic.vault.id":r,"anthropic.vault.credential.id":e}})})}list(e,t={},i){let{betas:r,workspace_id:s,...n}=t??{};return this._client.getAPIList(nb`/v1/vaults/${e}/credentials`,s4,{query:n,...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.vaults.credentials.list",i,{route:"/v1/vaults/{vault_id}/credentials",queryParams:["include_archived","limit","page"],attributes:{"anthropic.vault.id":e}})})}delete(e,t,i){let{vault_id:r,betas:s,workspace_id:n}=t;return this._client.delete(nb`/v1/vaults/${r}/credentials/${e}`,{...i,headers:r$([{"anthropic-beta":[...s??[],"managed-agents-2026-04-01"].toString(),...null!=n?{"anthropic-workspace-id":n}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.vaults.credentials.delete",i,{route:"/v1/vaults/{vault_id}/credentials/{credential_id}",attributes:{"anthropic.vault.id":r,"anthropic.vault.credential.id":e}})})}archive(e,t,i){let{vault_id:r,betas:s,workspace_id:n}=t;return this._client.post(nb`/v1/vaults/${r}/credentials/${e}/archive`,{...i,headers:r$([{"anthropic-beta":[...s??[],"managed-agents-2026-04-01"].toString(),...null!=n?{"anthropic-workspace-id":n}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.vaults.credentials.archive",i,{route:"/v1/vaults/{vault_id}/credentials/{credential_id}/archive",attributes:{"anthropic.vault.id":r,"anthropic.vault.credential.id":e}})})}mcpOAuthValidate(e,t,i){let{vault_id:r,betas:s,workspace_id:n}=t;return this._client.post(nb`/v1/vaults/${r}/credentials/${e}/mcp_oauth_validate`,{...i,headers:r$([{"anthropic-beta":[...s??[],"managed-agents-2026-04-01"].toString(),...null!=n?{"anthropic-workspace-id":n}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.vaults.credentials.mcp_oauth_validate",i,{route:"/v1/vaults/{vault_id}/credentials/{credential_id}/mcp_oauth_validate",attributes:{"anthropic.vault.id":r,"anthropic.vault.credential.id":e}})})}}var lk=(()=>{class e extends ne{constructor(){super(...arguments),this.credentials=new lw(this._client)}create(e,t){let{betas:i,workspace_id:r,...s}=e;return this._client.post("/v1/vaults",{body:s,...t,headers:r$([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...null!=r?{"anthropic-workspace-id":r}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.vaults.create",t,{route:"/v1/vaults",createdIDAttribute:"anthropic.vault.id"})})}retrieve(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.get(nb`/v1/vaults/${e}`,{...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.vaults.retrieve",i,{route:"/v1/vaults/{vault_id}",attributes:{"anthropic.vault.id":e}})})}update(e,t,i){let{betas:r,workspace_id:s,...n}=t;return this._client.post(nb`/v1/vaults/${e}`,{body:n,...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.vaults.update",i,{route:"/v1/vaults/{vault_id}",attributes:{"anthropic.vault.id":e}})})}list(e={},t){let{betas:i,workspace_id:r,...s}=e??{};return this._client.getAPIList("/v1/vaults",s4,{query:s,...t,headers:r$([{"anthropic-beta":[...i??[],"managed-agents-2026-04-01"].toString(),...null!=r?{"anthropic-workspace-id":r}:void 0},t?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.vaults.list",t,{route:"/v1/vaults",queryParams:["include_archived","limit","page"]})})}delete(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.delete(nb`/v1/vaults/${e}`,{...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.vaults.delete",i,{route:"/v1/vaults/{vault_id}",attributes:{"anthropic.vault.id":e}})})}archive(e,t={},i){let{betas:r,workspace_id:s}=t??{};return this._client.post(nb`/v1/vaults/${e}/archive`,{...i,headers:r$([{"anthropic-beta":[...r??[],"managed-agents-2026-04-01"].toString(),...null!=s?{"anthropic-workspace-id":s}:void 0},i?.headers]),__qualifiers:{beta:"true"},__span:rN(this._client,"anthropic.vaults.archive",i,{route:"/v1/vaults/{vault_id}/archive",attributes:{"anthropic.vault.id":e}})})}}return e.Credentials=lw,e})(),lz=(()=>{class e extends ne{constructor(){super(...arguments),this.models=new nY(this._client),this.messages=new ob(this._client),this.agents=new n2(this._client),this.environments=new az(this._client),this.sessions=new l_(this._client),this.deployments=new nG(this._client),this.deploymentRuns=new nJ(this._client),this.vaults=new lk(this._client),this.memoryStores=new aV(this._client),this.files=new nQ(this._client),this.skills=new lg(this._client),this.webhooks=new n0(this._client),this.userProfiles=new ly(this._client),this.dreams=new nX(this._client),this.tunnels=new lv(this._client),this.organization=new lc(this._client)}}return e.Models=nY,e.Messages=ob,e.Agents=n2,e.Environments=az,e.Sessions=l_,e.Deployments=nG,e.DeploymentRuns=nJ,e.Vaults=lk,e.MemoryStores=aV,e.Files=nQ,e.Skills=lg,e.Webhooks=n0,e.UserProfiles=ly,e.Dreams=nX,e.Tunnels=lv,e.Organization=lc,e})();let lx=!1;var lS=(()=>{class e{get credentials(){return this._authState.provider}get openTelemetry(){return(0,id.V)(this,iu,"f")}_instrumentationScope(){return{version:im}}constructor({baseURL:e=(0,rT.f)("ANTHROPIC_BASE_URL"),apiKey:t,authToken:i,webhookKey:r=(0,rT.f)("ANTHROPIC_WEBHOOK_SIGNING_KEY")??null,...s}={}){ia.add(this),this._requestAuthFlags=new WeakMap,il.set(this,void 0),ic.set(this,void 0),iu.set(this,void 0),this._genAIProviderName="anthropic",this._supportsMessageThreads=!1;let n={apiKey:t,authToken:i,...s},a=ip.y.filter(e=>null!=n[e]);if(a.length>1){let e=e=>e.map(e=>`\`${e}\``).join(", ");throw TypeError(`Pass at most one of ${e(ip.y)}. Received ${e(a)}.`)}let[o]=a,l=null!=o?null:{apiKey:void 0===t?(0,rT.f)("ANTHROPIC_API_KEY"):void 0,authToken:void 0===i?(0,rT.f)("ANTHROPIC_AUTH_TOKEN"):void 0},c=null!=o?{type:o,value:n[o]}:l?.apiKey!=null?{type:"apiKey",value:l.apiKey}:l?.authToken!=null?{type:"authToken",value:l.authToken}:{type:"defaultChain"},u={apiKey:"apiKey"===c.type?c.value:null,authToken:"authToken"===c.type?c.value:null,webhookKey:r,...s,baseURL:e||"https://api.anthropic.com"};u.dangerouslyAllowBrowser,this.baseURL=u.baseURL,this._baseURLIsExplicit=s.__baseURLIsExplicit??!!e,this.timeout=u.timeout??io.DEFAULT_TIMEOUT,this.logger=u.logger??console,this.logLevel=rz.I,this.logLevel=(0,rz.J)(u.logLevel,"ClientOptions.logLevel",(0,rz.u)(this))??(0,rz.J)((0,rT.f)("ANTHROPIC_LOG"),"process.env['ANTHROPIC_LOG']",(0,rz.u)(this))??rz.I,l?.apiKey==null||null==l.authToken||lx||(lx=!0,(0,rz.u)(this).warn("Anthropic: ANTHROPIC_API_KEY and ANTHROPIC_AUTH_TOKEN are both set. Using ANTHROPIC_API_KEY.")),this.fetchOptions=u.fetchOptions,this.maxRetries=(0,ip.H)("maxRetries",u.maxRetries??2);let h=this._instrumentationScope();(0,id.b)(this,iu,function(e){let{tracerProvider:t,propagation:i,traces:r}=!1===e?{traces:!1}:e??{propagation:(0,rT.f)("ANTHROPIC_OPEN_TELEMETRY_PROPAGATION")?.toLowerCase()!=="false",traces:{enabled:(0,rT.f)("ANTHROPIC_OPEN_TELEMETRY")?.toLowerCase()!=="false",contentMode:(0,rT.f)("ANTHROPIC_OPEN_TELEMETRY_TRACES_CONTENT_MODE")?.toLowerCase()==="content"?"content":"metadata_only",maxContentBytes:Number(/^\d+$/.exec((0,rT.f)("ANTHROPIC_OPEN_TELEMETRY_TRACES_MAX_CONTENT_BYTES")??"")?.[0]??0/0)}},{enabled:s,contentMode:n,maxContentBytes:a}="boolean"==typeof r?{enabled:r}:r??{};return Object.freeze({tracerProvider:t,propagation:i??!0,traces:Object.freeze({enabled:s??!0,contentMode:"content"===n?"content":"metadata_only",maxContentBytes:void 0!==a&&Number.isInteger(a)&&a>=1?a:75e4})})}(u.openTelemetry),"f"),u.openTelemetry=(0,id.V)(this,iu,"f"),this._tracer=rL(this,()=>(function(e,t,i){if(!e.traces.enabled)return;let r=void 0!==i?`${rP}.${i}`:rP;return(e.tracerProvider??rm.getTracerProvider()).getTracer(r,t)})((0,id.V)(this,iu,"f"),h.version,h.platform)),this.fetch=u.fetch??function(){if("u">typeof fetch)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}(),(0,id.b)(this,il,iq,"f"),this.middleware=[...u.middleware??[]];let d=(0,rT.f)("ANTHROPIC_CUSTOM_HEADERS");if(d){let e={};for(let t of d.split("\n")){let i=t.indexOf(":");i>=0&&(e[t.substring(0,i).trim()]=t.substring(i+1).trim())}u.defaultHeaders={...e,...u.defaultHeaders}}let p=s.__auth;if(delete u.__auth,delete u.__baseURLIsExplicit,this._options=u,this.apiKey="string"==typeof u.apiKey?u.apiKey:null,(0,id.b)(this,ic,"function"==typeof u.apiKey?u.apiKey:null,"f"),this.authToken=u.authToken??null,this.webhookKey=r,p)this._authState=p,!this._baseURLIsExplicit&&p.baseURL&&(this.baseURL=p.baseURL);else switch(this._authState={provider:null,tokenCache:null,resolution:null,error:null,extraHeaders:{}},c.type){case"apiKey":case"authToken":break;case"credentials":this._authState.provider=c.value,this._authState.tokenCache=this._makeTokenCache(c.value);break;case"config":{let e=sL(c.value,this._credentialResolverOptions());this._authState.provider=e.provider,this._authState.tokenCache=this._makeTokenCache(e.provider),this._authState.extraHeaders=e.extraHeaders,this._applyCredentialBaseURL(e.baseURL);break}case"profile":this._authState.resolution=this._resolveDefaultCredentials(c.value);break;case"defaultChain":this._shouldResolveDefaultCredentials()&&(this._authState.resolution=this._resolveDefaultCredentials());break;default:(0,ip.f)(c)}}_shouldResolveDefaultCredentials(){return!0}_applyCredentialBaseURL(e){if(!e)return;let t=e.replace(/\/+$/,"");this._authState.baseURL=t,this._baseURLIsExplicit||(this.baseURL=t)}_credentialResolverOptions(){return{baseURL:this.baseURL,fetch:this._credentialsFetch(),userAgent:this.getUserAgent(),onCacheWriteError:e=>{(0,rz.u)(this).debug("credential cache write failed (best-effort)",e)},onSafetyWarning:e=>{(0,rz.u)(this).warn(e)}}}_credentialsFetch(){return sW(this.fetch,this.middleware,void 0,this)}_makeTokenCache(e){return new si(e,e=>{(0,rz.u)(this).debug("advisory token refresh failed; serving cached token",e)})}withOptions(e){for(let t of(e={...e},ip.y))void 0===e[t]&&delete e[t];let t=ip.y.some(t=>t in e),i=ip.y.some(t=>null!=e[t]),r={...this._options,...this._baseURLIsExplicit?{baseURL:this.baseURL}:{},maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,middleware:this.middleware,apiKey:this.apiKey??(0,id.V)(this,ic,"f"),authToken:this.authToken,webhookKey:this.webhookKey,...i?Object.fromEntries(ip.y.map(e=>[e,null])):{},...e,openTelemetry:e.openTelemetry??(0,id.V)(this,iu,"f"),__auth:t?void 0:this._authState,__baseURLIsExplicit:"baseURL"in e||this._baseURLIsExplicit};return new this.constructor(r)}async _resolveDefaultCredentials(e){try{let t=await sN(this._credentialResolverOptions(),e);if(t)this._authState.provider=t.provider,this._authState.tokenCache=this._makeTokenCache(t.provider),this._authState.extraHeaders=t.extraHeaders,this._applyCredentialBaseURL(t.baseURL);else if(null!=e)throw new ry.v(`Profile "${e}" could not be resolved (no <config_dir>/configs/${e}.json found).`)}catch(e){this._authState.error=e}finally{this._authState.resolution=null}}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){if(!(e.get("x-api-key")||e.get("authorization"))){if(this._authState.error)throw this._authState.error;if(!(this._authState.tokenCache||this._authState.resolution||this.apiKey&&e.get("authorization")||t.has("authorization")||this.authToken&&e.get("authorization"))&&!t.has("authorization"))throw Error('Could not resolve authentication method. Expected one of apiKey, authToken, credentials, config, or profile to be set. Or for the "Authorization" header to be explicitly omitted')}}_authFlags(e){let t=this._requestAuthFlags.get(e);return t||(t={usedTokenCache:!1,didRefreshFor401:!1},this._requestAuthFlags.set(e,t)),t}async authHeaders(e){if(this._authState.resolution&&await this._authState.resolution,!this._authState.error){if((0,id.V)(this,ic,"f")&&null==this.apiKey){let e;try{e=await (0,id.V)(this,ic,"f").call(this)}catch(e){throw new ry.v(`The \`apiKey\` function failed: ${(0,ig.Y)(e).message}`,{cause:e})}if(!e)throw new ry.v(`The \`apiKey\` function must return a non-empty string. It returned ${JSON.stringify(e)}.`);return r$([{Authorization:`Bearer ${e}`}])}if(this._authState.tokenCache&&null==this.apiKey){let t=await this._authState.tokenCache.getToken();return this._authFlags(e).usedTokenCache=!0,r$([{Authorization:`Bearer ${t}`}])}return r$([await this.bearerAuth(e),await this.apiKeyAuth(e)])}}async apiKeyAuth(e){if(null!=this.apiKey)return r$([{Authorization:`Bearer ${this.apiKey}`}])}async bearerAuth(e){if(null!=this.authToken)return r$([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(e){return function(e,t={}){let i,r=e,s=function(e=rY){let t;if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.encodeDotInKeys&&"boolean"!=typeof e.encodeDotInKeys)throw TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw TypeError("Encoder has to be a function.");let i=e.charset||rY.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let r=rF;if(void 0!==e.format){if(!rK(rB,e.format))throw TypeError("Unknown format option provided.");r=e.format}let s=rB[r],n=rY.filter;if(("function"==typeof e.filter||(0,ip.o)(e.filter))&&(n=e.filter),t=e.arrayFormat&&e.arrayFormat in rX?e.arrayFormat:"indices"in e?e.indices?"indices":"repeat":rY.arrayFormat,"commaRoundTrip"in e&&"boolean"!=typeof e.commaRoundTrip)throw TypeError("`commaRoundTrip` must be a boolean, or absent");let a=void 0===e.allowDots?!0==!!e.encodeDotInKeys||rY.allowDots:!!e.allowDots;return{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:rY.addQueryPrefix,allowDots:a,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:rY.allowEmptyArrays,arrayFormat:t,charset:i,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:rY.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:void 0===e.delimiter?rY.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:rY.encode,encodeDotInKeys:"boolean"==typeof e.encodeDotInKeys?e.encodeDotInKeys:rY.encodeDotInKeys,encoder:"function"==typeof e.encoder?e.encoder:rY.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:rY.encodeValuesOnly,filter:n,format:r,formatter:s,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:rY.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:rY.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:rY.strictNullHandling}}(t);"function"==typeof s.filter?r=(0,s.filter)("",r):(0,ip.o)(s.filter)&&(i=s.filter);let n=[];if("object"!=typeof r||null===r)return"";let a=rX[s.arrayFormat],o="comma"===a&&s.commaRoundTrip;i||(i=Object.keys(r)),s.sort&&i.sort(s.sort);let l=new WeakMap;for(let e=0;e<i.length;++e){let t=i[e];s.skipNulls&&null===r[t]||rQ(n,function e(t,i,r,s,n,a,o,l,c,u,h,d,p,_,f,g,m,v){var b,y;let w,k=t,z=v,x=0,S=!1;for(;void 0!==(z=z.get(rZ))&&!S;){let e=z.get(t);if(x+=1,void 0!==e)if(e===x)throw RangeError("Cyclic object value");else S=!0;void 0===z.get(rZ)&&(x=0)}if("function"==typeof u?k=u(i,k):k instanceof Date?k=p?.(k):"comma"===r&&(0,ip.o)(k)&&(k=rG(k,function(e){return e instanceof Date?p?.(e):e})),null===k){if(a)return c&&!g?c(i,rY.encoder,m,"key",_):i;k=""}if("string"==typeof(b=k)||"number"==typeof b||"boolean"==typeof b||"symbol"==typeof b||"bigint"==typeof b||(y=k)&&"object"==typeof y&&y.constructor&&y.constructor.isBuffer&&y.constructor.isBuffer(y)){if(c){let e=g?i:c(i,rY.encoder,m,"key",_);return[f?.(e)+"="+f?.(c(k,rY.encoder,m,"value",_))]}return[f?.(i)+"="+f?.(String(k))]}let V=[];if(void 0===k)return V;if("comma"===r&&(0,ip.o)(k))g&&c&&(k=rG(k,c)),w=[{value:k.length>0?k.join(",")||null:void 0}];else if((0,ip.o)(u))w=u;else{let e=Object.keys(k);w=h?e.sort(h):e}let A=l?String(i).replace(/\./g,"%2E"):String(i),I=s&&(0,ip.o)(k)&&1===k.length?A+"[]":A;if(n&&(0,ip.o)(k)&&0===k.length)return I+"[]";for(let i=0;i<w.length;++i){let b=w[i],y="object"==typeof b&&void 0!==b.value?b.value:k[b];if(o&&null===y)continue;let z=d&&l?b.replace(/\./g,"%2E"):b,S=(0,ip.o)(k)?"function"==typeof r?r(I,z):I:I+(d?"."+z:"["+z+"]");v.set(t,x);let A=new WeakMap;A.set(rZ,v),rQ(V,e(y,S,r,s,n,a,o,l,"comma"===r&&g&&(0,ip.o)(k)?null:c,u,h,d,p,_,f,g,m,A))}return V}(r[t],t,a,o,s.allowEmptyArrays,s.strictNullHandling,s.skipNulls,s.encodeDotInKeys,s.encode?s.encoder:null,s.filter,s.sort,s.allowDots,s.serializeDate,s.format,s.formatter,s.encodeValuesOnly,s.charset,l))}let c=n.join(s.delimiter),u=!0===s.addQueryPrefix?"?":"";return s.charsetSentinel&&("iso-8859-1"===s.charset?u+="utf8=%26%2310003%3B&":u+="utf8=%E2%9C%93&"),c.length>0?u+c:""}(e,{arrayFormat:"brackets"})}getUserAgent(){return`Anthropic/JS ${im}`}makeStatusError(e,t,i,r){return ry.E.generate(e,t,i,r)}buildURL(e,t,i){let r=!(0,id.V)(this,ia,"m",ih).call(this)&&i||this.baseURL,s=new URL((0,ip.X)(e)?e:r+(r.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),n=this.defaultQuery(),a=Object.fromEntries(s.searchParams);return(0,ip.O)(n)&&(0,ip.O)(a)||(t={...a,...n,...t}),"object"==typeof t&&t&&!Array.isArray(t)&&(s.search=this.stringifyQuery(t)),s.toString()}_calculateNonstreamingTimeout(e){if(3600*e/128e3>600)throw new ry.v("Streaming is required for operations that may take longer than 10 minutes. See https://platform.claude.com/docs/en/cli-sdks-libraries/sdks/typescript#streaming-responses for more details");return 6e5}async prepareOptions(e){}async prepareRequest(e,{url:t,options:i}){if(this._authState.tokenCache&&null==this.apiKey){let t=e.headers instanceof Headers?e.headers:new Headers(e.headers);for(let[e,i]of Object.entries(this._authState.extraHeaders))t.has(e)||t.set(e,i);let i=t.get("anthropic-beta")?.split(",").map(e=>e.trim());i?.includes(r2)||t.set("anthropic-beta",[...i??[],r2].join(",")),e.headers=t}}backendMiddleware(){return[]}get(e,t){return this.methodRequest("get",e,t)}post(e,t){return this.methodRequest("post",e,t)}patch(e,t){return this.methodRequest("patch",e,t)}put(e,t){return this.methodRequest("put",e,t)}delete(e,t){return this.methodRequest("delete",e,t)}methodRequest(e,t,i){return this.request(Promise.resolve(i).then(i=>({method:e,path:t,...i})))}request(e,t=null){return this._tracer?new s0(this,this.makeTracedRequest(e,t)):new s0(this,this.makeRequest(e,t,void 0))}async makeTracedRequest(e,t){let i=await e,r=i.__span?.span;if(!r)return this.makeRequest(i,t,void 0);try{return await iJ.with(rm.setSpan(iJ.active(),r),()=>this.makeRequest(i,t,void 0,r))}catch(t){let e={status:"error",options:i,error:t};throw sk(this,r,e),rL(this,()=>rj(r,e)),t}}async makeRequest(e,t,i,r){var s;let n=await e,a=(0,ip.H)("maxRetries",n.maxRetries??this.maxRetries);this.isStreamBody(n.body)&&(a=0),null==t&&(t=a,this._requestAuthFlags.delete(n)),await this.prepareOptions(n);let{req:o,url:l,timeout:c}=await this.buildRequest(n,{retryCount:a-t}),u="log_"+(0x1000000*Math.random()|0).toString(16).padStart(6,"0"),h=void 0===i?"":`, retryOf: ${i}`;r&&this.openTelemetry.propagation&&(o.headers=rL(this,()=>(function(e,t){let i=r$([t]).values;for(let[t,r]of Object.entries(rW(e)))i.set(t,r);return i})(r,o.headers))??o.headers);let d=Date.now();if(n.signal?.aborted)throw new ry.F;let p=new AbortController,_=await this.fetchWithTimeout(l,o,c,p,n,{requestLogID:u,retryOfRequestLogID:i}).catch(ig.Y),f=Date.now();if(_ instanceof globalThis.Error){iz(p);let e=`retrying, ${t} attempts remaining`;if(n.signal?.aborted)throw new ry.F;let s=(0,ig.c)(_)||/timed? ?out/i.test(String(_)+("cause"in _?String(_.cause):"")),a=this.middleware.length>0||!!n.middleware?.length||this.backendMiddleware().length>0;if(a&&!s&&!function(e){let t=new Set;for(;"object"==typeof e&&null!==e&&!t.has(e);){if(t.add(e),sU(e)||(0,ig.c)(e)||e instanceof ry.I||e instanceof ry.O)return!0;e=e.cause}return!1}(_))throw(0,rz.u)(this).info(`[${u}] middleware error (not retryable)`),(0,rz.M)((0,rz.u)(this),`[${u}] middleware error (not retryable)`,{retryOfRequestLogID:i,url:l,durationMs:f-d,message:_.message}),_;if(t)return(0,rz.u)(this).info(`[${u}] connection ${s?"timed out":"failed"} - ${e}`),(0,rz.M)((0,rz.u)(this),`[${u}] connection ${s?"timed out":"failed"} (${e})`,{retryOfRequestLogID:i,url:l,durationMs:f-d,message:_.message}),this.retryRequest(n,t,i??u,r);if((0,rz.u)(this).info(`[${u}] connection ${s?"timed out":"failed"} - error; no more retries left`),(0,rz.M)((0,rz.u)(this),`[${u}] connection ${s?"timed out":"failed"} (error; no more retries left)`,{retryOfRequestLogID:i,url:l,durationMs:f-d,message:_.message}),s)throw new ry.R;if(a&&!sU(_))throw _;throw new ry.I({cause:_})}let g=[..._.headers.entries()].filter(([e])=>"request-id"===e||"anthropic-workspace-id"===e).map(([e,t])=>", "+e+": "+JSON.stringify(t)).join(""),m=`[${u}${h}${g}] ${o.method} ${l} ${_.ok?"succeeded":"failed"} with status ${_.status} in ${f-d}ms`;if(!_.ok){let e=await this.shouldRetry(_,n);if(t&&e){let e=`retrying, ${t} attempts remaining`;return await iI(_.body),iz(p),(0,rz.u)(this).info(`${m} - ${e}`),(0,rz.M)((0,rz.u)(this),`[${u}] response error (${e})`,{retryOfRequestLogID:i,url:_.url,status:_.status,headers:_.headers,durationMs:f-d}),this.retryRequest(n,t,i??u,r,_.headers)}let s=e?"error; no more retries left":"error; not retryable";(0,rz.u)(this).info(`${m} - ${s}`);let a=await _.text().catch(e=>(0,ig.Y)(e).message),o=(0,ip.k)(a),l=o?void 0:a;throw(0,rz.M)((0,rz.u)(this),`[${u}] response error (${s})`,{retryOfRequestLogID:i,url:_.url,status:_.status,headers:_.headers,message:l,durationMs:Date.now()-d}),iz(p),this.makeStatusError(_.status,o,l,_.headers)}return(0,rz.u)(this).info(m),(0,rz.M)((0,rz.u)(this),`[${u}] response start`,{retryOfRequestLogID:i,url:_.url,status:_.status,headers:_.headers,durationMs:f-d}),s=_.body??_,iw.has(p)&&ik?.register(s,p,p),{response:_,options:n,controller:p,requestLogID:u,retryOfRequestLogID:i,startTime:d}}getAPIList(e,t,i){return this.requestAPIList(t,i&&"then"in i?i.then(t=>({method:"get",path:e,...t})):{method:"get",path:e,...i})}requestAPIList(e,t){return this._tracer?new s2(this,this.makeTracedRequest(t,null),e):new s2(this,this.makeRequest(t,null,void 0),e)}async fetchWithTimeout(e,t,i,r,s,n){let{signal:a,method:o,...l}=t||{},c=this._makeAbort(r);a&&(a.addEventListener("abort",c,{once:!0}),iw.set(r,()=>a.removeEventListener("abort",c)));let u=globalThis.ReadableStream&&l.body instanceof globalThis.ReadableStream||"object"==typeof l.body&&null!==l.body&&Symbol.asyncIterator in l.body,h={signal:r.signal,...u?{duplex:"half"}:{},method:"GET",...l};o&&(h.method=o.toUpperCase());let d=this.fetch,p=async(e,t)=>{let r=setTimeout(c,i);try{return await d.call(void 0,e,t)}finally{clearTimeout(r)}},_=void 0===s?p:async(e,t={})=>{let i="string"==typeof e?e:e instanceof URL?e.href:e.url;t.headers=t.headers instanceof Headers?t.headers:new Headers(t.headers);let r=[];s.__span&&(t.headers=new Headers(t.headers),r=sA(t.headers)),await this.prepareRequest(t,{url:i,options:s}),r.length&&(t.headers=r$([t.headers,r]).values);let a=s.__span;return a&&rL(this,()=>(function(e,t,i,r=!1){if(e.attempts=(e.attempts??0)+1,e.attempts>1)return void e.span.setAttribute("http.request.resend_count",e.attempts-1);e.span.setAttribute("http.request.method",t);try{let{protocol:t,host:s,pathname:n,search:a}=new URL(i),o=function(e,t,i){if(!e||!t?.length)return;let r=!1,s=e.split("&").filter(e=>{try{let s=decodeURIComponent(e.split("=",1)[0]),n=t.includes(s)||!s.endsWith("[]")?s:s.slice(0,-2);if(!t.includes(n))return!1;return r||(r=rC.includes(n)||!!i?.includes(n)),!0}catch{return!1}});return s.length?{value:s.join("&"),content:r}:void 0}(a.slice(1),e.queryParams,e.contentQueryParams);if(e.span.setAttributes({"url.scheme":t.slice(0,-1),"url.path":n}),o?.content&&!r)return;e.span.setAttributes({...void 0!==o?{"url.query":o.value}:void 0,"url.full":`${t}//${s}${n}${void 0!==o?`?${o.value}`:""}`})}catch{}})(a,t.method??"GET",i,"content"===this.openTelemetry.traces.contentMode)),n&&(0,rz.M)((0,rz.u)(this),`[${n.requestLogID}] sending request`,{retryOfRequestLogID:n.retryOfRequestLogID,method:t.method,url:i,options:s,headers:t.headers}),p(e,t)},f=s?.middleware,g=s?.__span?this.backendMiddleware().map(sI):this.backendMiddleware(),m=f?.length||g.length?[...this.middleware,...f??[],...g]:this.middleware;return await sW(_,m,s,this)(e,h)}async shouldRetry(e,t){let i=this._authFlags(t);if(401===e.status&&this._authState.tokenCache&&i.usedTokenCache&&!i.didRefreshFor401)return i.didRefreshFor401=!0,this._authState.tokenCache.invalidate(),!0;let r=e.headers.get("x-should-retry");return"true"===r||"false"!==r&&(408===e.status||409===e.status||429===e.status||!!(e.status>=500))}async retryRequest(e,t,i,r,s){let n,a=s?.get("retry-after-ms");if(a){let e=parseFloat(a);Number.isNaN(e)||(n=e)}let o=s?.get("retry-after");if(o&&!n){let e=parseFloat(o);n=Number.isNaN(e)?Date.parse(o)-Date.now():1e3*e}if(void 0===n||!(n>0&&n<=0x7fffffff)){let i=e.maxRetries??this.maxRetries;n=this.calculateDefaultRetryTimeoutMillis(t,i)}return await i_(n,e.signal??void 0),this.makeRequest(e,t-1,i,r)}calculateDefaultRetryTimeoutMillis(e,t){return Math.min(.5*Math.pow(2,t-e),8)*(1-.25*Math.random())*1e3}calculateNonstreamingTimeout(e,t){if(36e5*e/128e3>6e5||null!=t&&e>t)throw new ry.v("Streaming is required for operations that may take longer than 10 minutes. See https://platform.claude.com/docs/en/cli-sdks-libraries/sdks/typescript#long-requests for more details");return 6e5}async buildRequest(e,{retryCount:t=0}={}){let i={...e},{method:r,path:s,query:n,defaultBaseURL:a}=i;this._authState.resolution&&await this._authState.resolution,!this._baseURLIsExplicit&&this._authState.baseURL&&this.baseURL!==this._authState.baseURL&&(this.baseURL=this._authState.baseURL);let o=this.buildURL(s,n,a);"timeout"in i&&(0,ip.H)("timeout",i.timeout),i.timeout=i.timeout??this.timeout;let{bodyHeaders:l,body:c}=this.buildBody({options:i}),u=await this.buildHeaders({options:e,method:r,bodyHeaders:l,retryCount:t,timeout:i.timeout});return{req:{method:r,headers:u,...i.signal&&{signal:i.signal},...globalThis.ReadableStream&&c instanceof globalThis.ReadableStream&&{duplex:"half"},...c&&{body:c},...this.fetchOptions??{},...i.fetchOptions??{}},url:o,timeout:i.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:i,retryCount:r,timeout:s}){let n=r$([{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(r),"X-Stainless-Timeout":String(Math.trunc(s/1e3)),...iy(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":"true"}:void 0,"anthropic-version":"2026-10-21"},await this.authHeaders(e),this._options.defaultHeaders,i,e.headers]);return this.validateHeaders(n),n.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};let i=r$([t]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||"string"==typeof e&&i.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:this.isStreamBody(e)?{bodyHeaders:void 0,body:iS(e)}:"object"==typeof e&&"application/x-www-form-urlencoded"===i.values.get("content-type")?{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(e)}:(0,id.V)(this,il,"f").call(this,{body:e,headers:i})}isStreamBody(e){return!!globalThis.ReadableStream&&e instanceof globalThis.ReadableStream||"object"==typeof e&&null!==e&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&"function"==typeof e.next)}}return io=e,il=new WeakMap,ic=new WeakMap,iu=new WeakMap,ia=new WeakSet,ih=function(){return"https://api.anthropic.com"!==this.baseURL},e.Anthropic=io,e.DEFAULT_TIMEOUT=6e5,e.AnthropicError=ry.v,e.APIError=ry.E,e.APIConnectionError=ry.I,e.APIConnectionTimeoutError=ry.R,e.APIUserAbortError=ry.F,e.NotFoundError=ry.i,e.ConflictError=ry.y,e.RateLimitError=ry.t,e.BadRequestError=ry.B,e.AuthenticationError=ry.P,e.InternalServerError=ry.j,e.PermissionDeniedError=ry.N,e.UnprocessableEntityError=ry.o,e.toFile=s9,e})(),lV=(()=>{class e extends lS{constructor(){super(...arguments),this._supportsMessageThreads=!0,this.messages=new nk(this),this.models=new nS(this),this.files=new nV(this),this.skills=new nI(this),this.userProfiles=new nR(this),this.organization=new nK(this),this.beta=new lz(this)}}return e.Messages=nk,e.Models=nS,e.Files=nV,e.Skills=nI,e.UserProfiles=nR,e.Organization=nK,e.Beta=lz,e})(),lA=e.i(381234),lI=e.i(280151),lq=e.i(50377),lR=e.i(481183),l$=e.i(93716),lT=e.i(23234);let lP=(0,lq.f)("ai:anthropic"),lE="https://api.anthropic.com",lO="claude-sonnet-5-5";class lM extends lI.f{providerName="Anthropic";client;model;baseURL;constructor(e){super();let t=e?.apiKey,i=e?.authToken;if(!t&&!i)throw Error("AI_AUTH_ERROR: ANTHROPIC_API_KEY is required for Anthropic provider");this.baseURL=(0,lR.z)(e?.baseUrl||lE).replace(/\/v1$/,""),this.model=e?.model||lO,this.client=function(e,t,i){let r={baseURL:e,timeout:6e5};if(function(e){try{return new URL(e).hostname===new URL(lE).hostname}catch{return!1}}(e))return new lV(t?{...r,apiKey:t,authToken:null}:{...r,apiKey:null,authToken:i});let s={"anthropic-version":"2023-06-01"};return t?(s["x-api-key"]=t,new lV({...r,apiKey:null,authToken:null,defaultHeaders:s})):new lV({...r,apiKey:null,authToken:i,defaultHeaders:s})}(this.baseURL,t,i),lP.info({provider:"Anthropic",model:this.model,baseURL:this.baseURL},"AI Provider initialized")}get configuredModel(){return this.model}async complete(e){let t,i=await (0,l$.h)(async i=>{let r=e.user;if(e.image){var s,n;let t,i,a=[(s=e.image.base64,n=e.image.mimeType,{type:"image",source:{type:"base64",media_type:"image/png"===(t=(((i=s.match(/^data:([^;]+);base64,([\s\S]*)$/))?i[1]:n)||"").toLowerCase())||"image/gif"===t||"image/webp"===t?t:"image/jpeg",data:i?i[2]:s}}),{type:"text",text:e.user}];e.extraUserText&&a.push({type:"text",text:e.extraUserText}),r=a}else e.extraUserText&&(r=`${e.user}
|
|
7
|
-
${e.extraUserText}`);let{data:a,response:o}=await this.client.messages.create({model:this.model,max_tokens:i,system:e.system,messages:[{role:"user",content:r}]}).withResponse();t=(0,lA.v)(o.headers);let l=a.content.filter(e=>"text"===e.type).map(e=>e.text).join("");return lP.debug({stopReason:a.stop_reason,usage:a.usage},"Anthropic response received"),{text:l,usage:function(e){if(!e)return;let t=[e.input_tokens,e.cache_creation_input_tokens,e.cache_read_input_tokens].filter(e=>"number"==typeof e);return(0,lA.w)(t.length>0?t.reduce((e,t)=>e+t,0):void 0,e.output_tokens)}(a.usage),model:a.model,choices:[{finish_reason:"max_tokens"===a.stop_reason?"length":a.stop_reason,message:{content:l}}]}},this.model);if(!i.text)throw Error("Empty response from AI");return{text:i.text,usage:i.usage,model:i.model||void 0,requestId:t}}handleError(e){if(lP.error({error:e},"Anthropic error"),e instanceof Error&&("AI_OUTPUT_TRUNCATED"===e.message||(0,lT.v)(e.message)))throw e;if(e instanceof lV.APIConnectionTimeoutError)throw Error("AI_TIMEOUT_ERROR",{cause:e});if(e instanceof lV.APIConnectionError)throw Error("AI_CONNECTION_FAILED",{cause:e});if(e instanceof lV.APIError&&e.status){let t=e.status;if(401===t)throw Error("AI_AUTH_ERROR",{cause:e});if(403===t)throw Error("AI_PERMISSION_DENIED",{cause:e});if(404===t)throw Error("AI_NOT_FOUND",{cause:e});if(408===t)throw Error("AI_TIMEOUT_ERROR",{cause:e});if(402===t||429===t)throw Error("AI_QUOTA_EXCEEDED",{cause:e});if(t>=500)throw Error("AI_SERVICE_UNAVAILABLE",{cause:e})}throw Error((0,lT.g)(e),{cause:e})}}e.s(["R",0,lM,"l",0,lE,"A",0,lO],690604)},280151,e=>{var t=e.i(687604),i=e.i(261829),r=e.i(983598);e.i(332116);var s=e.i(557354),n=e.i(999617),a=e.i(700122),o=e.i(459398),l=e.i(50377),c=e.i(23234),u=e.i(43746),h=e.i(357189),d=e.i(115851),p=e.i(907240),_=e.i(80435),f=e.i(971724),g=e.i(140561),m=e.i(105954),v=e.i(206033),b=e.i(455744),y=e.i(469755);let w=f.z.object({id:g.z.union([m.z.string(),v.z.number()]),text:m.z.string(),uncertain:b.z.array(y.z.unknown()).nullish()}).passthrough(),k=f.z.object({questions:b.z.array(y.z.unknown())});var z=e.i(381234);let x=(0,l.f)("ai:base");e.s(["f",0,class{completionObserver;observeCompletions(e){this.completionObserver=e}async run(e){let t=Date.now();try{let i=await this.complete(e);return this.notifyCompletion({task:e.task,status:"succeeded",durationMs:Date.now()-t,usage:i.usage,model:i.model||this.configuredModel,requestId:i.requestId}),i.text}catch(i){throw this.notifyCompletion({task:e.task,status:"failed",durationMs:Date.now()-t,model:this.configuredModel,errorCode:(0,z.y)(i)}),i}}notifyCompletion(e){let t=this.completionObserver;if(t)try{Promise.resolve(t(e)).catch(t=>{x.error({error:t,task:e.task},"AI completion observer failed")})}catch(t){x.error({error:t,task:e.task},"AI completion observer failed")}}handleError(e){if(x.error({error:e},"AI provider error"),e instanceof Error&&e.message.startsWith("AI_RESPONSE_ERROR:"))throw e;throw Error((0,c.g)(e),{cause:e})}async analyzeImage(e,i="image/jpeg",r="zh",n,l,c,u,h){let d=(0,s.b)(),_=u?{candidateTags:u}:await (0,o.i)(l,n),f=(0,t.generateAnalyzeRequest)(r,n,l,{customTemplate:d.prompts?.analyze,..._},c,h);x.box("🔍 AI Image Analysis Request",{provider:this.providerName,imageSize:`${e.length} bytes`,mimeType:i,language:r,grade:n||"all"}),x.box("📝 Full System Prompt",f.system);try{let t=await this.run({task:"analyze",system:f.system,user:f.user,image:{base64:e,mimeType:i}});x.box("🤖 AI Raw Response",t);let r=(0,p.f)((0,a.M)(t),_);return x.box("✅ Parsed & Validated Result",JSON.stringify(r,null,2)),r}catch(e){throw x.error({error:e,stack:e instanceof Error?e.stack:void 0},"Error during AI analysis"),this.handleError(e),e}}async generateSimilarQuestion(e,i,r="zh",n="medium",o,l){let c=(0,s.b)(),u=(0,t.generateSimilarQuestionRequest)(r,e,i,n,{customTemplate:c.prompts?.similar,originalFigureSvg:l},o),h=u.user;x.info({provider:this.providerName,difficulty:n,language:r},"Generate Similar Question Request");try{let e=await this.run({task:"similar",system:u.system,user:h});return x.box("🤖 AI Raw Response",e),(0,d.f)((0,a.M)(e))}catch(e){throw x.error({error:e,stack:e instanceof Error?e.stack:void 0},"Error during question generation"),this.handleError(e),e}}async reanswerQuestion(e,i="zh",r,o,l,c){let d=(0,t.generateReanswerRequest)(i,e,r,{candidateTags:c,customTemplate:(0,s.b)().prompts?.reanswer},l);x.info({provider:this.providerName,questionLength:e.length,subject:r||"auto",hasImage:!!o},"Reanswer Question Request");try{let e=await this.run({task:"reanswer",system:d.system,user:d.user,image:o?{base64:o}:void 0});x.debug({rawResponse:e},"AI raw response");let t=(0,a.a)(e,"wrong_answer_text")||"";return(0,p.f)({answerText:(0,a.a)(e,"answer_text")||"",analysis:(0,a.a)(e,"analysis")||"",knowledgePoints:(0,a.D)((0,a.a)(e,"knowledge_points")),wrongAnswerText:t,mistakeAnalysis:(0,a.a)(e,"mistake_analysis")||"",mistakeStatus:(0,u.x)((0,a.a)(e,"mistake_status"),t),subject:(0,n.F)((0,a.a)(e,"subject")),gradeSemester:(0,h.X)((0,a.a)(e,"grade_semester")),difficultyStars:(0,n.B)((0,a.a)(e,"difficulty_stars")),questionType:(0,n.w)((0,a.a)(e,"question_type"))},{candidateTags:c})}catch(e){throw x.error({error:e,stack:e instanceof Error?e.stack:void 0},"Error during reanswer"),this.handleError(e),e}}async analyzeForGeogebra(e,i,r,s){let n=(0,t.generateGeogebraRequest)(e,i,r,s);x.info({provider:this.providerName,questionLength:e.length},"GeoGebra Analysis Request");try{let e,t,i,r,s=await this.run({task:"geogebra",system:n.system,user:n.user});x.debug({rawResponse:s},"GeoGebra AI raw response");let a=((t=(e=s.trim()).match(/```(?:json)?\s*([\s\S]*?)```/))&&(e=t[1].trim()),i=e.indexOf("{"),r=e.lastIndexOf("}"),-1!==i&&-1!==r&&(e=e.substring(i,r+1)),JSON.parse(e));return{suitable:!!a.suitable,commands:Array.isArray(a.commands)?a.commands:[],description:"string"==typeof a.description?a.description:""}}catch(e){throw x.error({error:e,stack:e instanceof Error?e.stack:void 0},"Error during GeoGebra analysis"),this.handleError(e),e}}async evaluateMastery(e){let i=(0,t.generateMasteryRequest)(e);x.info({provider:this.providerName,historyCount:e.history.length},"Mastery Evaluation Request");try{let e=await this.run({task:"mastery",system:i.system,user:i.user});return x.debug({rawResponse:e},"Mastery AI raw response"),(0,n.r)(e)}catch(e){throw x.error({error:e,stack:e instanceof Error?e.stack:void 0},"Error during mastery evaluation"),this.handleError(e),e}}async recognizeGrade(e){let i=(0,t.generateGradeRecognitionRequest)(e);try{let e=await this.run({task:"recognize-grade",system:i.system,user:i.user});return(0,n.b)(e)}catch(e){throw x.error({error:e},"识别题目年级失败"),this.handleError(e),e}}async gradeAnswer(e){let i=(0,t.generateGradingRequest)(e);x.info({provider:this.providerName},"Answer Grading Request");try{let e=await this.run({task:"grading",system:i.system,user:i.user});return x.debug({rawResponse:e},"Grading AI raw response"),(0,n.o)(e)}catch(e){throw x.error({error:e,stack:e instanceof Error?e.stack:void 0},"Error during answer grading"),this.handleError(e),e}}async suggestKnowledgeTags(e){let i=(0,t.generateTagSuggestRequest)(e);x.info({provider:this.providerName,subject:e.subject,allowedTagCount:e.allowedTags.length,allowCustom:!0===e.allowCustom},"Tag Suggestion Request");try{let t=await this.run({task:"tag-suggest",system:i.system,user:i.user});return x.debug({rawResponse:t},"Tag suggestion AI raw response"),(0,n.K)(t,e.allowedTags,!0===e.allowCustom)}catch(e){throw x.error({error:e,stack:e instanceof Error?e.stack:void 0},"Error during tag suggestion"),this.handleError(e),e}}async generateFigureSvg(e,i,r){let s=(0,t.generateFigureRequest)(r);x.info({provider:this.providerName,imageSize:e.length},"Figure SVG Request");try{let t=await this.run({task:"figure",system:s.system,user:s.user,image:{base64:e,mimeType:i},extraUserText:"请重新绘制图中题目的配图。"});return x.debug({rawResponse:t},"Figure SVG AI raw response"),(0,n.t)((0,a.a)(t,"has_figure"),(0,a.a)(t,"figure_svg"))}catch(e){throw x.error({error:e,stack:e instanceof Error?e.stack:void 0},"Error during figure SVG generation"),this.handleError(e),e}}async fixLatex(e){let i=(0,t.generateLatexFixRequest)(e);x.info({provider:this.providerName,fields:Object.keys(e)},"LaTeX Fix Request");try{let t=await this.run({task:"latex-fix",system:i.system,user:i.user});return x.debug({rawResponse:t},"LaTeX fix AI raw response"),(0,r.f)(t,e)}catch(e){throw x.error({error:e,stack:e instanceof Error?e.stack:void 0},"Error during LaTeX fix"),this.handleError(e),e}}async generateSvgAnimation(e,r,s,n,o="zh"){let l=(0,t.generateSvgAnimationRequest)(e,r,s,n,o);x.info({provider:this.providerName,questionLength:e.length},"SVG Animation Request");try{let e=await this.run({task:"svg-animation",system:l.system,user:l.user});return x.debug({rawResponse:e},"SVG animation AI raw response"),(0,i.J)((0,a.a)(e,"svg_animation")||e)}catch(e){throw x.error({error:e,stack:e instanceof Error?e.stack:void 0},"Error during SVG animation generation"),this.handleError(e),e}}async generateSvgNarration(e,r,s,n,o="zh"){let l=(0,t.generateSvgNarrationRequest)(e,r,s,n,o);x.info({provider:this.providerName,svgLength:n.length},"SVG Narration Request");try{let e=await this.run({task:"svg-narration",system:l.system,user:l.user});return x.debug({rawResponse:e},"SVG narration AI raw response"),(0,i.a)((0,a.a)(e,"narration")||e)}catch(e){throw x.error({error:e,stack:e instanceof Error?e.stack:void 0},"Error during SVG narration generation"),this.handleError(e),e}}async splitQuestions(e){let i=(0,t.generateQuestionSplitRequest)(e);x.info({provider:this.providerName,kind:e.kind},"Question Split Request");let r="image"===e.kind?{base64:e.imageBase64,mimeType:e.mimeType}:void 0;try{let t=await this.run({task:"question-split",system:i.system,user:i.user,image:r});return x.debug({rawResponse:t},"Question split AI raw response"),(0,_.z)(t,e)}catch(t){if(x.error({error:t,stack:t instanceof Error?t.stack:void 0},"Error during question split"),"image"===e.kind&&(0,_.F)(t))throw Error(_.b,{cause:t});throw this.handleError(t),t}}async fixQuestionText(e){let i=(0,t.generateTextFixRequest)(e);x.info({provider:this.providerName,questions:e.length},"Text Fix Request");try{let t=await this.run({task:"text-fix",system:i.system,user:i.user});return x.debug({rawResponse:t},"Text fix AI raw response"),function(e,t){let i=new Set(t.map(e=>e.id)),r=new Set,s=[];for(let t of function(e){let t=(0,n.Q)(e),i=t.match(/```(?:json)?\s*([\s\S]*?)```/);i&&(t=i[1]);let r=t.indexOf("{"),s=t.lastIndexOf("}");if(-1!==r&&s>r)try{let e=k.safeParse(JSON.parse(t.slice(r,s+1)));if(e.success)return e.data}catch{}throw Error("AI_RESPONSE_ERROR: invalid text fix output")}(e).questions){let e=w.safeParse(t);if(!e.success)continue;let n=String(e.data.id);if(!i.has(n)||r.has(n))continue;r.add(n);let a=(e.data.uncertain??[]).filter(e=>"string"==typeof e&&e.trim().length>0).map(e=>e.trim().slice(0,200)).slice(0,20);s.push({id:n,text:e.data.text.trim(),uncertain:a})}return s}(t,e)}catch(e){throw x.error({error:e,stack:e instanceof Error?e.stack:void 0},"Error during text fix"),this.handleError(e),e}}}],280151)},381234,93716,983598,700122,115851,907240,e=>{var t=e.i(629833),i=e.i(50377);let r=[{pattern:/claude-(opus|sonnet|haiku|fable|mythos)-([5-9]|4[-.][6-9])/,maxOutputTokens:128e3},{pattern:/claude-(opus|sonnet|haiku)-4[-.]5/,maxOutputTokens:64e3},{pattern:/claude-sonnet-4/,maxOutputTokens:64e3},{pattern:/claude-opus-4/,maxOutputTokens:32e3},{pattern:/claude-3[-.]7-sonnet/,maxOutputTokens:64e3},{pattern:/claude-3[-.]5-/,maxOutputTokens:8192},{pattern:/claude-3-/,maxOutputTokens:4096},{pattern:/(^|[/-])gpt-[5-9]/,maxOutputTokens:128e3},{pattern:/(^|[/-])o1-mini/,maxOutputTokens:65536},{pattern:/(^|[/-])o1-preview/,maxOutputTokens:32768},{pattern:/(^|[/-])o[134](-|$)/,maxOutputTokens:1e5},{pattern:/(^|[/-])gpt-4\.1/,maxOutputTokens:32768},{pattern:/(^|[/-])gpt-4o/,maxOutputTokens:16384},{pattern:/(^|[/-])gpt-4-(turbo|vision|1106|0125)/,maxOutputTokens:4096},{pattern:/(^|[/-])gpt-4(-|$)/,maxOutputTokens:8192},{pattern:/(^|[/-])gpt-3\.5/,maxOutputTokens:4096},{pattern:/gemini-(2\.5|[3-9])/,maxOutputTokens:65536},{pattern:/gemini-(1\.5|2\.0)/,maxOutputTokens:8192},{pattern:/^deepseek-(flash|v4)/,maxOutputTokens:384e3},{pattern:/^glm-4\.6v/,maxOutputTokens:32e3},{pattern:/^glm-(5|4\.7|4\.6)/,maxOutputTokens:128e3},{pattern:/^glm-4\.5/,maxOutputTokens:96e3},{pattern:/^glm-4\.1v/,maxOutputTokens:16e3},{pattern:/^glm-4-long/,maxOutputTokens:4e3},{pattern:/^glm-4v-flash/,maxOutputTokens:1e3},{pattern:/^glm-4-flash/,maxOutputTokens:16e3},{pattern:/^doubao-seed-character/,maxOutputTokens:32e3},{pattern:/^doubao-seed-(evolving|2-1)/,maxOutputTokens:256e3},{pattern:/^doubao-seed-2-0/,maxOutputTokens:128e3},{pattern:/^minimax-m3/,maxOutputTokens:128e3},{pattern:/^kimi-k3/,maxOutputTokens:131072},{pattern:/^qwen3\.8-max/,maxOutputTokens:128e3}],s=(0,i.f)("ai:truncation"),n="AI_OUTPUT_TRUNCATED",a=[65536,32768,8192],o=new Map;async function l(e,i,r){let n=i;for(;;)try{return await e(n)}catch(u){let e=(0,t.Z)(u),i=function(e,t){if(!/max[_ ]?(completion[_ ]?|output[_ ]?)?tokens|output tokens|completion tokens/i.test(e))return;let i=(e.match(/\d+/g)||[]).map(Number).filter(e=>Number.isSafeInteger(e)&&e>=1024&&e<t);return i.length>0?Math.max(...i):void 0}(e,n),l=i??(/max[_ ]?(completion[_ ]?|output[_ ]?)?tokens/i.test(e)?a.find(e=>e<n):void 0);if(!l)throw u;let c=r?.trim().toLowerCase();c&&i&&o.set(c,i),s.warn({model:r,requested:n,adjusted:l},"max_tokens exceeds model limit, retrying with model limit"),n=l}}async function c(e,t){let i,a,c=await l(e,((i=t?.trim().toLowerCase())?o.get(i):void 0)??function(e){let t=(e||"").trim().toLowerCase();if(t)return r.find(e=>e.pattern.test(t))?.maxOutputTokens}(i)??262144,t);if((a=c?.choices?.[0])&&"length"===a.finish_reason&&!(a.message?.content||"").trim())throw Error(n);return c?.choices?.[0]?.finish_reason==="length"&&s.warn({model:t},"Output truncated at model max_tokens, parsing partial content"),c}e.s(["z",0,n,"h",0,c],93716);var u=e.i(23234);let h=["x-oneapi-request-id","x-request-id","request-id","apim-request-id"];function d(e){return"number"==typeof e&&Number.isFinite(e)&&e>=0?Math.round(e):void 0}e.s(["w",0,function(e,t){let i={inputTokens:d(e),outputTokens:d(t)};return void 0===i.inputTokens&&void 0===i.outputTokens?void 0:i},"y",0,function(e){return e instanceof Error&&e.message===n?n:(0,u.g)(e)},"v",0,function(e){if(!e)return;if("function"==typeof e.get){for(let t of h){let i=e.get(t)?.trim();if(i)return i}return}let t=new Map(Object.entries(e).map(([e,t])=>[e.toLowerCase(),t]));for(let e of h){let i=t.get(e),r=(Array.isArray(i)?i[0]:i)?.trim();if(r)return r}}],381234),e.i(396617);var p=e.i(976336);e.s(["f",0,function(e,t){let i={};for(let r of Object.keys(t)){let t=p.t[r],s=e.indexOf(`<${t}>`);if(-1===s)continue;let n=s+t.length+2,a=e.indexOf(`</${t}>`,n);if(-1===a)continue;let o=e.slice(n,a).trim();o&&(i[r]=o)}return i}],983598);var _=e.i(999617),f=e.i(43746),g=e.i(357189);let m=(0,i.f)("ai:response-parser");function v(e,t){let i=(0,_.Q)(e),r=`<${t}>`,s=`</${t}>`,n=i.indexOf(r);if(-1===n)return null;let a=n+r.length,o=i.lastIndexOf(s);return -1===o&&"analysis"===t?(m.warn({tagName:t},"Tag was verified unclosed, treating as truncated and reading to end"),i.substring(a).trim()):-1===o||a>=o?null:i.substring(a,o).trim()}function b(e){return(e||"").split(/[,,\n]/).map(e=>e.trim()).filter(e=>e.length>0)}e.s(["a",0,v,"M",0,function(e){m.debug({textLength:e.length},"Parsing AI response");let t=v(e,"question_text"),i=v(e,"answer_text"),r=v(e,"analysis"),s=v(e,"subject"),n=v(e,"knowledge_points"),a=v(e,"requires_image"),o=v(e,"wrong_answer_text")||"",l=v(e,"mistake_analysis")||"",c=v(e,"mistake_status");if(!t||!i||!r)throw m.error({rawTextSample:e.substring(0,500)},"Missing critical XML tags"),Error("Invalid AI response: Missing critical XML tags (<question_text>, <answer_text>, or <analysis>)");let u="其他";s&&["数学","物理","化学","生物","英语","语文","历史","地理","政治","其他"].includes(s)&&(u=s);let h=b(n),d=a?.toLowerCase().trim()==="true",p=(0,f.x)(c,o),y={questionText:t,answerText:i,analysis:r,wrongAnswerText:o,mistakeAnalysis:l,mistakeStatus:p,subject:u,knowledgePoints:h,requiresImage:d,gradeSemester:(0,g.X)(v(e,"grade_semester")),difficultyStars:(0,_.B)(v(e,"difficulty_stars")),questionType:(0,_.w)(v(e,"question_type")),...(0,_.t)(v(e,"has_figure"),v(e,"figure_svg"))},w=(0,_.u)(y);return w.success?(m.debug("Validated successfully via XML tags"),w.data):(m.warn({validationError:w.error.format()},"Schema validation warning"),y)},"D",0,b],700122),e.s(["f",0,function(e){let t=e.questionText.replace(/[((【\[]\s*(?:(?:本题|共|满分)\s*)?\d+(?:\.\d+)?\s*(?:分|points?|marks?|pts?\.?)\s*[))】\]]/giu,"").replace(/^\s*(?:#{1,6}\s*)?(?:第\s*\d+\s*题\s*[::.、]?|(?:Question|Problem)\s*\d+\s*[::.、]?|\d+\s*(?:[、.]|\.(?!\d)))\s*/iu,"").trim(),i=/^\s*(?:[-*]\s*)?(?:[A-DA-D][..、::))]|[((][A-DA-D][))])\s*\S/imu.test(t),r=t.match(/(?:^|\s)(?:[A-DA-D][..、::))]|[((][A-DA-D][))])/giu)||[],s=/(?:下列|以下|选择|答案|哪项|哪一|正确的是|正确的是)/u.test(t),n=t.match(/[①②③④⑤⑥⑦⑧⑨⑩][^①②③④⑤⑥⑦⑧⑨⑩]*/gu)||[],a=!(n.length<2)&&(!!s||!!(n.length>=4));if(!t||i||r.length>=2||a)throw Error("AI_RESPONSE_ERROR: 生成题目必须为不含选项的填空题或解答题");return{...e,questionText:t}}],115851);let y={数学:"prefetchedMathTags",物理:"prefetchedPhysicsTags",化学:"prefetchedChemistryTags",生物:"prefetchedBiologyTags",英语:"prefetchedEnglishTags",语文:"prefetchedChineseTags",历史:"prefetchedHistoryTags",地理:"prefetchedGeographyTags",政治:"prefetchedPoliticsTags"};e.s(["f",0,function(e,t){let i;if(t.candidateTags?.allowCustom!==!0&&(i=t.candidateTags?.tags,!t.candidateTags)){let r=y[e.subject];if(r){let e=t[r];i=e?.length?e:void 0}else{let e=Object.values(y).flatMap(e=>t[e]??[]);i=e.length?e:void 0}}let r=i?new Set(i):null,s=[...new Set(e.knowledgePoints.map(e=>e.trim()).filter(e=>e&&(!r||r.has(e))))].slice(0,_.e);return{...e,knowledgePoints:s}}],907240)},23234,e=>{let t=["AI_CONNECTION_FAILED","AI_TIMEOUT_ERROR","AI_QUOTA_EXCEEDED","AI_PERMISSION_DENIED","AI_NOT_FOUND","AI_RESPONSE_ERROR","AI_AUTH_ERROR","AI_SERVICE_UNAVAILABLE","AI_UNKNOWN_ERROR"];e.s(["v",0,function(e){return t.some(t=>e.includes(t))},"g",0,function(e){let i=e instanceof Error?e.message:String(e),r=i.toLowerCase();for(let e of t)if(i.includes(e))return e;return r.includes("401")||r.includes("unauthorized")||r.includes("api key")?"AI_AUTH_ERROR":r.includes("403")||r.includes("forbidden")||r.includes("permission")?"AI_PERMISSION_DENIED":r.includes("404")||r.includes("not found")||r.includes("does not exist")?"AI_NOT_FOUND":r.includes("429")||r.includes("402")||r.includes("rate limit")||r.includes("too many")||r.includes("quota")||r.includes("额度")||r.includes("insufficient")||r.includes("balance")||r.includes("余额")||r.includes("积分")||r.includes("credit")?"AI_QUOTA_EXCEEDED":r.includes("fetch failed")||r.includes("network")||r.includes("connect")||r.includes("enotfound")||r.includes("econnrefused")||r.includes("etimedout")||r.includes("econnreset")?"AI_CONNECTION_FAILED":r.includes("timeout")||r.includes("timed out")||r.includes("aborted")||r.includes("408")?"AI_TIMEOUT_ERROR":r.includes("500")||r.includes("502")||r.includes("503")||r.includes("504")||r.includes("无可用")||r.includes("overloaded")||r.includes("unavailable")?"AI_SERVICE_UNAVAILABLE":r.includes("invalid json")||r.includes("parse")||r.includes("json")||r.includes("missing critical xml")?"AI_RESPONSE_ERROR":"AI_UNKNOWN_ERROR"}])},80435,843716,276041,e=>{var t=e.i(200592),i=e.i(588107),r=e.i(971724),s=e.i(140561),n=e.i(105954),a=e.i(206033),o=e.i(455744),l=e.i(469755),c=e.i(180473),u=e.i(999617);let h=/^[\s ]+/,d="一二三四五六七八九十",p=[{family:"dot",pattern:/^(\d{1,3})\s*(?:.|\.(?!\d))\s*/},{family:"comma",pattern:/^(\d{1,3})\s*[、,,](?!\d)\s*/},{family:"paren",pattern:/^(\d{1,3})\s*[))]\s*/},{family:"colon",pattern:/^(\d{1,3})\s*[::](?!\d)\s*/},{family:"ti",pattern:/^第\s*(\d{1,3}|[一二三四五六七八九十]{1,3})\s*题\s*[..、::]?\s*/},{family:"example",pattern:/^(?:例题?|练习|习题)\s*(\d{1,3})\s*[..、::]?\s*/},{family:"q",pattern:/^(?:Q|Question|Problem|Exercise)\s*(\d{1,3})\s*[..::)]?\s+/i},{family:"cn",pattern:/^([一二三四五六七八九十]{1,3})\s*[、..]\s*/}];function _(e){let t=e.replace(h,"");for(let{family:e,pattern:i}of p){let r=t.match(i);if(!r||t.length<=r[0].length)continue;let s=function(e){if(/^\d+$/.test(e))return Number(e);if("十"===e)return 10;let t=e.indexOf("十");return -1===t?d.indexOf(e)+1:10*(0===t?1:d.indexOf(e[0])+1)+(t===e.length-1?0:d.indexOf(e[t+1])+1)}(r[1]);if(Number.isFinite(s)&&!(s<=0))return{value:s,family:e,prefixLength:r[0].length,label:r[1]}}return null}function f(e){let t=e.split("\n"),i=t[0]?.replace(h,"")??"",r=_(i);return r&&"cn"!==r.family&&(t[0]=i.slice(r.prefixLength)),t.join("\n")}function g(e){return e.replace(/\r\n?/g,"\n").split("\n").map(e=>e.replace(h,"").replace(/[\s ]+$/,""))}function m(e){let t=[];for(let i of e)(i||0!==t.length&&""!==t[t.length-1])&&t.push(i);for(;t.length>0&&""===t[t.length-1];)t.pop();return t.join("\n")}let v=/(姓名|班级|学号|日期|得分|分数|评分|考号|座位号|家长签字|用时|Name\s*[::_]|Class\s*[::_]|Date\s*[::_]|Score\s*[::_])|_{3,}|共\s*\d+\s*(道|题|小题)|做完|答案(见|在)|最后一页|满分\s*\d+\s*分/i,b=/(阅读|材料|短文|文章|选文|诗歌|古诗|文言文|下[面列]的?(表格|图表|统计|信息)|根据.{0,20}(回答|完成)|passage|read the|according to the)/i,y=/^(参考答案|答案与解析|答案|Answers?|Answer Key)\s*[::]?$/i,w=/^(第[一二三四五六七八九十]+(部分|大题|节)|(Part|Section)\s+[A-Z0-9IVX]+\b)/i,k=/(选择|填空|判断|计算|解答|应用|解决问题|操作|作图|阅读|写作|作文|综合|口算|听力|单项|完形|题)/,z=/(\d{1,3})\s*[~~\-—–至到]\s*(\d{1,3})\s*(?:小?题|questions?)/i,x=/(小问|小题|下列问题|以下问题|下列各题|下面各题|完成下列|回答下列|回答以下|following questions|answer the following)/i;function S(e){let t=[],i=[];for(let r of e)r?i.push(r):i.length&&(t.push(i.join("\n")),i=[]);return i.length&&t.push(i.join("\n")),t}function V(e,t=[]){let i=e.trim();return!(!i||i.length>12||/[。!?!?,,、;;::..()()【】\[\]{}]$/.test(i)||/\d/.test(i)||/[。!?!?;;,,]/.test(i))&&!!(/(篇|章|节|部分|组)$/.test(i)||/^(Part|Section)\s+[A-Z0-9]+$/i.test(i))&&(!t.length||t.some(e=>{let t=_(e);return null!==t&&1===t.value}))}function A(e,t){let i=[];for(let r=0;r<e.length;r++){let s=e[r],n=[s];for(let i=r+1;i<e.length;i++){let r=e[i],a=n[n.length-1];if(r.family!==s.family)continue;let o=1===r.value&&[...t].some(e=>e>a.line&&e<r.line);(r.value===a.value+1||o)&&n.push(r)}n.length>i.length&&(i=n)}return i}function I(e,t,i){return!!w.test(e)||!!t&&"cn"===t.family&&"cn"!==i&&null!==i&&(e.length<=40||k.test(e.slice(0,20)))}function q(e,t,i,r,s){for(let n=e-1;n>=0;n--)if(t[n]){if(s.has(n)||I(t[n],i[n],r)||V(t[n]))return t[n];break}return null}function R(e){let t=e.match(z);if(!t)return null;let i=Number(t[1]),r=Number(t[2]);return i<=r?{from:i,to:r}:null}let $={answer:/^(?:【\s*(?:参考答案|答案)\s*】|(?:参考答案|答案)\s*[::]|Answer\s*[::])\s*(.*)$/i,analysis:/^(?:【\s*(?:解析|分析|详解|解答|点评)\s*】|(?:解析|分析|详解|解答|点评)\s*[::])\s*(.*)$/,knowledge:/^(?:【\s*(?:知识点|考点)\s*】|(?:知识点|考点)\s*[::])\s*(.*)$/,difficulty:/^(?:【\s*难度\s*】|难度\s*[::])\s*(.*)$/,questionType:/^(?:【\s*题型\s*】|题型\s*[::])\s*(.*)$/,wrongAnswer:/^(?:【\s*错答\s*】|我的答案\s*[::]|学生答案\s*[::])\s*(.*)$/},T={易:1,较易:2,中等:3,较难:4,难:5};function P(e){return e.split(/[、,,;;]/).map(e=>e.trim()).filter(Boolean)}function E(e){let t={answer:[],analysis:[],knowledge:[],difficulty:[],questionType:[],wrongAnswer:[]},i=[],r=null;for(let s of e){let e=null;for(let i of Object.keys($)){let n=s.match($[i]);if(!n)continue;e=i,r=i;let a=n[1].trim();a&&t[i].push(a);break}e||(r&&s.trim()?t[r].push(s.trim()):i.push(s))}let s={},n=t.answer.join("\n").trim();n&&(s.answer=n);let a=t.analysis.join("\n").trim();a&&(s.analysis=a);let o=t.knowledge.flatMap(P);o.length&&(s.knowledgePoints=o);let l=t.difficulty.join(" ").trim(),c=l?function(e){let t=e.trim();if(!t)return null;let i=t.match(/^(\d{1,2})\s*(?:星|级)?$/);if(i){let e=Number(i[1]);return e>=1&&e<=5?e:null}if(/^[★☆]{1,5}$/.test(t)){let e=(t.match(/★/g)??[]).length;return e>=1?e:null}return t in T?T[t]:null}(l):null;null!==c&&(s.difficultyStars=c);let u=t.questionType.join(" ").trim();u&&(s.questionType=u);let h=t.wrongAnswer.join("\n").trim();return h&&(s.wrongAnswer=h),{text:m(i),fields:s}}let O=/^(\d{1,3})\s*[..、,,)]\s*(\S[\s\S]*)$/,M=/^(\d{1,3})\s*[~~—–-]\s*(\d{1,3})\s*[::..、]?\s*([A-Za-z]+)$/;function L(e){let t=e.trim();if(!t)return null;let i=function(e){let t=e.trim().match(M);if(!t)return null;let i=Number(t[1]),r=Number(t[2]),s=t[3];if(!Number.isFinite(i)||!Number.isFinite(r)||i<=0||r<=i||r-i+1>60)return null;let n=r-i+1;return s.length!==n?null:Array.from({length:n},(e,t)=>({label:String(i+t),text:s[t]}))}(t);if(i)return i;let r=function(e){let t=e.trim(),i=[];for(let e of t.matchAll(/(\d{1,3})\s*[..、,,;;]\s*/g)){let r=e.index??0,s=t[r+e[0].length];s&&/\d/.test(s)||i.push({index:r,label:e[1],afterIndex:r+e[0].length})}if(i.length<2)return null;for(let e=1;e<i.length;e++)if(Number(i[e].label)<=Number(i[e-1].label))return null;let r=[];for(let e=0;e<i.length;e++){let s=i[e].afterIndex,n=e+1<i.length?i[e+1].index:t.length,a=t.slice(s,n).trim().replace(/[;;]+$/,"").trim();if(!a||a.length>30||/[。!?!?]/.test(a))return null;r.push({label:i[e].label,text:a})}return r}(t);if(r)return r.map(e=>({label:e.label??"",text:e.text})).filter(e=>e.label);let s=t.match(O);if(!s)return null;let n=Number(s[1]);return!Number.isFinite(n)||n<=0?null:[{label:s[1],text:s[2].trim()}]}function N(e){let t=e.match(/^(.*?)(?:【?\s*(?:解析|分析|详解|解答|点评)\s*】?\s*[::])([\s\S]*)$/);if(t){let i=t[1].replace(/^(?:【?\s*(?:参考答案|答案)\s*】?\s*[::])\s*/,"").trim(),r=t[2].trim();return r?{answer:i,analysis:r}:{answer:e.trim()}}return{answer:e.replace(/^(?:【?\s*(?:参考答案|答案)\s*】?\s*[::])\s*/,"").trim()||e.trim()}}function C(e,t){let i=[],r=!1;for(let s of e){let e={value:!1},n=[];for(let i of s.split("\n")){let r=i.trim()?L(i):null;if(!r){i.trim()&&n.push(i);continue}let s=!1;for(let a of r){let r=t.find(e=>e.label===a.label);if(!r){n.push(i);break}s=!0,e.value=!0;let o=N(a.text);o.answer&&!r.answer&&(r.answer=o.answer),o.analysis&&(r.analysis=r.analysis?`${r.analysis}
|
|
8
|
-
${o.analysis}`:o.analysis)}!s&&!n.includes(i)&&i.trim()&&!n.includes(i)&&n.push(i)}r=r||e.value,e.value?n.length&&i.push(n.join("\n")):i.push(s)}return[i,r]}function
|
|
7
|
+
${e.extraUserText}`);let{data:a,response:o}=await this.client.messages.create({model:this.model,max_tokens:i,system:e.system,messages:[{role:"user",content:r}]}).withResponse();t=(0,lA.v)(o.headers);let l=a.content.filter(e=>"text"===e.type).map(e=>e.text).join("");return lP.debug({stopReason:a.stop_reason,usage:a.usage},"Anthropic response received"),{text:l,usage:function(e){if(!e)return;let t=[e.input_tokens,e.cache_creation_input_tokens,e.cache_read_input_tokens].filter(e=>"number"==typeof e);return(0,lA.w)(t.length>0?t.reduce((e,t)=>e+t,0):void 0,e.output_tokens)}(a.usage),model:a.model,choices:[{finish_reason:"max_tokens"===a.stop_reason?"length":a.stop_reason,message:{content:l}}]}},this.model);if(!i.text)throw Error("Empty response from AI");return{text:i.text,usage:i.usage,model:i.model||void 0,requestId:t}}handleError(e){if(lP.error({error:e},"Anthropic error"),e instanceof Error&&("AI_OUTPUT_TRUNCATED"===e.message||(0,lT.v)(e.message)))throw e;if(e instanceof lV.APIConnectionTimeoutError)throw Error("AI_TIMEOUT_ERROR",{cause:e});if(e instanceof lV.APIConnectionError)throw Error("AI_CONNECTION_FAILED",{cause:e});if(e instanceof lV.APIError&&e.status){let t=e.status;if(401===t)throw Error("AI_AUTH_ERROR",{cause:e});if(403===t)throw Error("AI_PERMISSION_DENIED",{cause:e});if(404===t)throw Error("AI_NOT_FOUND",{cause:e});if(408===t)throw Error("AI_TIMEOUT_ERROR",{cause:e});if(402===t||429===t)throw Error("AI_QUOTA_EXCEEDED",{cause:e});if(t>=500)throw Error("AI_SERVICE_UNAVAILABLE",{cause:e})}throw Error((0,lT.g)(e),{cause:e})}}e.s(["R",0,lM,"l",0,lE,"A",0,lO],690604)},280151,e=>{var t=e.i(687604),i=e.i(261829),r=e.i(983598);e.i(332116);var s=e.i(557354),n=e.i(999617),a=e.i(700122),o=e.i(459398),l=e.i(50377),c=e.i(23234),u=e.i(43746),h=e.i(357189),d=e.i(115851),p=e.i(907240),_=e.i(80435),f=e.i(971724),g=e.i(140561),m=e.i(105954),v=e.i(206033),b=e.i(455744),y=e.i(469755);let w=f.z.object({id:g.z.union([m.z.string(),v.z.number()]),text:m.z.string(),uncertain:b.z.array(y.z.unknown()).nullish()}).passthrough(),k=f.z.object({questions:b.z.array(y.z.unknown())});var z=e.i(381234);let x=(0,l.f)("ai:base");e.s(["f",0,class{completionObserver;observeCompletions(e){this.completionObserver=e}async run(e){let t=Date.now();try{let i=await this.complete(e);return this.notifyCompletion({task:e.task,status:"succeeded",durationMs:Date.now()-t,usage:i.usage,model:i.model||this.configuredModel,requestId:i.requestId}),i.text}catch(i){throw this.notifyCompletion({task:e.task,status:"failed",durationMs:Date.now()-t,model:this.configuredModel,errorCode:(0,z.y)(i)}),i}}notifyCompletion(e){let t=this.completionObserver;if(t)try{Promise.resolve(t(e)).catch(t=>{x.error({error:t,task:e.task},"AI completion observer failed")})}catch(t){x.error({error:t,task:e.task},"AI completion observer failed")}}handleError(e){if(x.error({error:e},"AI provider error"),e instanceof Error&&e.message.startsWith("AI_RESPONSE_ERROR:"))throw e;throw Error((0,c.g)(e),{cause:e})}async analyzeImage(e,i="image/jpeg",r="zh",n,l,c,u,h){let d=(0,s.b)(),_=u?{candidateTags:u}:await (0,o.i)(l,n),f=(0,t.generateAnalyzeRequest)(r,n,l,{customTemplate:d.prompts?.analyze,..._},c,h);x.box("🔍 AI Image Analysis Request",{provider:this.providerName,imageSize:`${e.length} bytes`,mimeType:i,language:r,grade:n||"all"}),x.box("📝 Full System Prompt",f.system);try{let t=await this.run({task:"analyze",system:f.system,user:f.user,image:{base64:e,mimeType:i}});x.box("🤖 AI Raw Response",t);let r=(0,p.f)((0,a.M)(t),_);return x.box("✅ Parsed & Validated Result",JSON.stringify(r,null,2)),r}catch(e){throw x.error({error:e,stack:e instanceof Error?e.stack:void 0},"Error during AI analysis"),this.handleError(e),e}}async generateSimilarQuestion(e,i,r="zh",n="medium",o,l){let c=(0,s.b)(),u=(0,t.generateSimilarQuestionRequest)(r,e,i,n,{customTemplate:c.prompts?.similar,originalFigureSvg:l},o),h=u.user;x.info({provider:this.providerName,difficulty:n,language:r},"Generate Similar Question Request");try{let e=await this.run({task:"similar",system:u.system,user:h});return x.box("🤖 AI Raw Response",e),(0,d.f)((0,a.M)(e))}catch(e){throw x.error({error:e,stack:e instanceof Error?e.stack:void 0},"Error during question generation"),this.handleError(e),e}}async reanswerQuestion(e,i="zh",r,o,l,c){let d=(0,t.generateReanswerRequest)(i,e,r,{candidateTags:c,customTemplate:(0,s.b)().prompts?.reanswer},l);x.info({provider:this.providerName,questionLength:e.length,subject:r||"auto",hasImage:!!o},"Reanswer Question Request");try{let e=await this.run({task:"reanswer",system:d.system,user:d.user,image:o?{base64:o}:void 0});x.debug({rawResponse:e},"AI raw response");let t=(0,a.a)(e,"wrong_answer_text")||"";return(0,p.f)({answerText:(0,a.a)(e,"answer_text")||"",analysis:(0,a.a)(e,"analysis")||"",knowledgePoints:(0,a.D)((0,a.a)(e,"knowledge_points")),wrongAnswerText:t,mistakeAnalysis:(0,a.a)(e,"mistake_analysis")||"",mistakeStatus:(0,u.x)((0,a.a)(e,"mistake_status"),t),subject:(0,n.F)((0,a.a)(e,"subject")),gradeSemester:(0,h.X)((0,a.a)(e,"grade_semester")),difficultyStars:(0,n.B)((0,a.a)(e,"difficulty_stars")),questionType:(0,n.w)((0,a.a)(e,"question_type"))},{candidateTags:c})}catch(e){throw x.error({error:e,stack:e instanceof Error?e.stack:void 0},"Error during reanswer"),this.handleError(e),e}}async analyzeForGeogebra(e,i,r,s){let n=(0,t.generateGeogebraRequest)(e,i,r,s);x.info({provider:this.providerName,questionLength:e.length},"GeoGebra Analysis Request");try{let e,t,i,r,s=await this.run({task:"geogebra",system:n.system,user:n.user});x.debug({rawResponse:s},"GeoGebra AI raw response");let a=((t=(e=s.trim()).match(/```(?:json)?\s*([\s\S]*?)```/))&&(e=t[1].trim()),i=e.indexOf("{"),r=e.lastIndexOf("}"),-1!==i&&-1!==r&&(e=e.substring(i,r+1)),JSON.parse(e));return{suitable:!!a.suitable,commands:Array.isArray(a.commands)?a.commands:[],description:"string"==typeof a.description?a.description:""}}catch(e){throw x.error({error:e,stack:e instanceof Error?e.stack:void 0},"Error during GeoGebra analysis"),this.handleError(e),e}}async evaluateMastery(e){let i=(0,t.generateMasteryRequest)(e);x.info({provider:this.providerName,historyCount:e.history.length},"Mastery Evaluation Request");try{let e=await this.run({task:"mastery",system:i.system,user:i.user});return x.debug({rawResponse:e},"Mastery AI raw response"),(0,n.r)(e)}catch(e){throw x.error({error:e,stack:e instanceof Error?e.stack:void 0},"Error during mastery evaluation"),this.handleError(e),e}}async recognizeGrade(e){let i=(0,t.generateGradeRecognitionRequest)(e);try{let e=await this.run({task:"recognize-grade",system:i.system,user:i.user});return(0,n.b)(e)}catch(e){throw x.error({error:e},"识别题目年级失败"),this.handleError(e),e}}async gradeAnswer(e){let i=(0,t.generateGradingRequest)(e);x.info({provider:this.providerName},"Answer Grading Request");try{let e=await this.run({task:"grading",system:i.system,user:i.user});return x.debug({rawResponse:e},"Grading AI raw response"),(0,n.o)(e)}catch(e){throw x.error({error:e,stack:e instanceof Error?e.stack:void 0},"Error during answer grading"),this.handleError(e),e}}async suggestKnowledgeTags(e){let i=(0,t.generateTagSuggestRequest)(e);x.info({provider:this.providerName,subject:e.subject,allowedTagCount:e.allowedTags.length,allowCustom:!0===e.allowCustom},"Tag Suggestion Request");try{let t=await this.run({task:"tag-suggest",system:i.system,user:i.user});return x.debug({rawResponse:t},"Tag suggestion AI raw response"),(0,n.K)(t,e.allowedTags,!0===e.allowCustom)}catch(e){throw x.error({error:e,stack:e instanceof Error?e.stack:void 0},"Error during tag suggestion"),this.handleError(e),e}}async generateFigureSvg(e,i,r){let s=(0,t.generateFigureRequest)(r);x.info({provider:this.providerName,imageSize:e.length},"Figure SVG Request");try{let t=await this.run({task:"figure",system:s.system,user:s.user,image:{base64:e,mimeType:i},extraUserText:"请重新绘制图中题目的配图。"});return x.debug({rawResponse:t},"Figure SVG AI raw response"),(0,n.t)((0,a.a)(t,"has_figure"),(0,a.a)(t,"figure_svg"))}catch(e){throw x.error({error:e,stack:e instanceof Error?e.stack:void 0},"Error during figure SVG generation"),this.handleError(e),e}}async fixLatex(e){let i=(0,t.generateLatexFixRequest)(e);x.info({provider:this.providerName,fields:Object.keys(e)},"LaTeX Fix Request");try{let t=await this.run({task:"latex-fix",system:i.system,user:i.user});return x.debug({rawResponse:t},"LaTeX fix AI raw response"),(0,r.f)(t,e)}catch(e){throw x.error({error:e,stack:e instanceof Error?e.stack:void 0},"Error during LaTeX fix"),this.handleError(e),e}}async generateSvgAnimation(e,r,s,n,o="zh"){let l=(0,t.generateSvgAnimationRequest)(e,r,s,n,o);x.info({provider:this.providerName,questionLength:e.length},"SVG Animation Request");try{let e=await this.run({task:"svg-animation",system:l.system,user:l.user});return x.debug({rawResponse:e},"SVG animation AI raw response"),(0,i.J)((0,a.a)(e,"svg_animation")||e)}catch(e){throw x.error({error:e,stack:e instanceof Error?e.stack:void 0},"Error during SVG animation generation"),this.handleError(e),e}}async generateSvgNarration(e,r,s,n,o="zh"){let l=(0,t.generateSvgNarrationRequest)(e,r,s,n,o);x.info({provider:this.providerName,svgLength:n.length},"SVG Narration Request");try{let e=await this.run({task:"svg-narration",system:l.system,user:l.user});return x.debug({rawResponse:e},"SVG narration AI raw response"),(0,i.a)((0,a.a)(e,"narration")||e)}catch(e){throw x.error({error:e,stack:e instanceof Error?e.stack:void 0},"Error during SVG narration generation"),this.handleError(e),e}}async splitQuestions(e){let i=(0,t.generateQuestionSplitRequest)(e);x.info({provider:this.providerName,kind:e.kind},"Question Split Request");let r="image"===e.kind?{base64:e.imageBase64,mimeType:e.mimeType}:void 0;try{let t=await this.run({task:"question-split",system:i.system,user:i.user,image:r});return x.debug({rawResponse:t},"Question split AI raw response"),(0,_.z)(t,e)}catch(t){if(x.error({error:t,stack:t instanceof Error?t.stack:void 0},"Error during question split"),"image"===e.kind&&(0,_.F)(t))throw Error(_.b,{cause:t});throw this.handleError(t),t}}async fixQuestionText(e){let i=(0,t.generateTextFixRequest)(e);x.info({provider:this.providerName,questions:e.length},"Text Fix Request");try{let t=await this.run({task:"text-fix",system:i.system,user:i.user});return x.debug({rawResponse:t},"Text fix AI raw response"),function(e,t){let i=new Set(t.map(e=>e.id)),r=new Set,s=[];for(let t of function(e){let t=(0,n.Q)(e),i=t.match(/```(?:json)?\s*([\s\S]*?)```/);i&&(t=i[1]);let r=t.indexOf("{"),s=t.lastIndexOf("}");if(-1!==r&&s>r)try{let e=k.safeParse(JSON.parse(t.slice(r,s+1)));if(e.success)return e.data}catch{}throw Error("AI_RESPONSE_ERROR: invalid text fix output")}(e).questions){let e=w.safeParse(t);if(!e.success)continue;let n=String(e.data.id);if(!i.has(n)||r.has(n))continue;r.add(n);let a=(e.data.uncertain??[]).filter(e=>"string"==typeof e&&e.trim().length>0).map(e=>e.trim().slice(0,200)).slice(0,20);s.push({id:n,text:e.data.text.trim(),uncertain:a})}return s}(t,e)}catch(e){throw x.error({error:e,stack:e instanceof Error?e.stack:void 0},"Error during text fix"),this.handleError(e),e}}}],280151)},381234,93716,983598,e=>{var t=e.i(629833),i=e.i(50377);let r=[{pattern:/claude-(opus|sonnet|haiku|fable|mythos)-([5-9]|4[-.][6-9])/,maxOutputTokens:128e3},{pattern:/claude-(opus|sonnet|haiku)-4[-.]5/,maxOutputTokens:64e3},{pattern:/claude-sonnet-4/,maxOutputTokens:64e3},{pattern:/claude-opus-4/,maxOutputTokens:32e3},{pattern:/claude-3[-.]7-sonnet/,maxOutputTokens:64e3},{pattern:/claude-3[-.]5-/,maxOutputTokens:8192},{pattern:/claude-3-/,maxOutputTokens:4096},{pattern:/(^|[/-])gpt-[5-9]/,maxOutputTokens:128e3},{pattern:/(^|[/-])o1-mini/,maxOutputTokens:65536},{pattern:/(^|[/-])o1-preview/,maxOutputTokens:32768},{pattern:/(^|[/-])o[134](-|$)/,maxOutputTokens:1e5},{pattern:/(^|[/-])gpt-4\.1/,maxOutputTokens:32768},{pattern:/(^|[/-])gpt-4o/,maxOutputTokens:16384},{pattern:/(^|[/-])gpt-4-(turbo|vision|1106|0125)/,maxOutputTokens:4096},{pattern:/(^|[/-])gpt-4(-|$)/,maxOutputTokens:8192},{pattern:/(^|[/-])gpt-3\.5/,maxOutputTokens:4096},{pattern:/gemini-(2\.5|[3-9])/,maxOutputTokens:65536},{pattern:/gemini-(1\.5|2\.0)/,maxOutputTokens:8192},{pattern:/^deepseek-(flash|v4)/,maxOutputTokens:384e3},{pattern:/^glm-4\.6v/,maxOutputTokens:32e3},{pattern:/^glm-(5|4\.7|4\.6)/,maxOutputTokens:128e3},{pattern:/^glm-4\.5/,maxOutputTokens:96e3},{pattern:/^glm-4\.1v/,maxOutputTokens:16e3},{pattern:/^glm-4-long/,maxOutputTokens:4e3},{pattern:/^glm-4v-flash/,maxOutputTokens:1e3},{pattern:/^glm-4-flash/,maxOutputTokens:16e3},{pattern:/^doubao-seed-character/,maxOutputTokens:32e3},{pattern:/^doubao-seed-(evolving|2-1)/,maxOutputTokens:256e3},{pattern:/^doubao-seed-2-0/,maxOutputTokens:128e3},{pattern:/^minimax-m3/,maxOutputTokens:128e3},{pattern:/^kimi-k3/,maxOutputTokens:131072},{pattern:/^qwen3\.8-max/,maxOutputTokens:128e3}],s=(0,i.f)("ai:truncation"),n="AI_OUTPUT_TRUNCATED",a=[65536,32768,8192],o=new Map;async function l(e,i,r){let n=i;for(;;)try{return await e(n)}catch(u){let e=(0,t.Z)(u),i=function(e,t){if(!/max[_ ]?(completion[_ ]?|output[_ ]?)?tokens|output tokens|completion tokens/i.test(e))return;let i=(e.match(/\d+/g)||[]).map(Number).filter(e=>Number.isSafeInteger(e)&&e>=1024&&e<t);return i.length>0?Math.max(...i):void 0}(e,n),l=i??(/max[_ ]?(completion[_ ]?|output[_ ]?)?tokens/i.test(e)?a.find(e=>e<n):void 0);if(!l)throw u;let c=r?.trim().toLowerCase();c&&i&&o.set(c,i),s.warn({model:r,requested:n,adjusted:l},"max_tokens exceeds model limit, retrying with model limit"),n=l}}async function c(e,t){let i,a,c=await l(e,((i=t?.trim().toLowerCase())?o.get(i):void 0)??function(e){let t=(e||"").trim().toLowerCase();if(t)return r.find(e=>e.pattern.test(t))?.maxOutputTokens}(i)??262144,t);if((a=c?.choices?.[0])&&"length"===a.finish_reason&&!(a.message?.content||"").trim())throw Error(n);return c?.choices?.[0]?.finish_reason==="length"&&s.warn({model:t},"Output truncated at model max_tokens, parsing partial content"),c}e.s(["z",0,n,"h",0,c],93716);var u=e.i(23234);let h=["x-oneapi-request-id","x-request-id","request-id","apim-request-id"];function d(e){return"number"==typeof e&&Number.isFinite(e)&&e>=0?Math.round(e):void 0}e.s(["w",0,function(e,t){let i={inputTokens:d(e),outputTokens:d(t)};return void 0===i.inputTokens&&void 0===i.outputTokens?void 0:i},"y",0,function(e){return e instanceof Error&&e.message===n?n:(0,u.g)(e)},"v",0,function(e){if(!e)return;if("function"==typeof e.get){for(let t of h){let i=e.get(t)?.trim();if(i)return i}return}let t=new Map(Object.entries(e).map(([e,t])=>[e.toLowerCase(),t]));for(let e of h){let i=t.get(e),r=(Array.isArray(i)?i[0]:i)?.trim();if(r)return r}}],381234),e.i(396617);var p=e.i(976336);e.s(["f",0,function(e,t){let i={};for(let r of Object.keys(t)){let t=p.t[r],s=e.indexOf(`<${t}>`);if(-1===s)continue;let n=s+t.length+2,a=e.indexOf(`</${t}>`,n);if(-1===a)continue;let o=e.slice(n,a).trim();o&&(i[r]=o)}return i}],983598)},23234,e=>{let t=["AI_CONNECTION_FAILED","AI_TIMEOUT_ERROR","AI_QUOTA_EXCEEDED","AI_PERMISSION_DENIED","AI_NOT_FOUND","AI_RESPONSE_ERROR","AI_AUTH_ERROR","AI_SERVICE_UNAVAILABLE","AI_UNKNOWN_ERROR"];e.s(["v",0,function(e){return t.some(t=>e.includes(t))},"g",0,function(e){let i=e instanceof Error?e.message:String(e),r=i.toLowerCase();for(let e of t)if(i.includes(e))return e;return r.includes("401")||r.includes("unauthorized")||r.includes("api key")?"AI_AUTH_ERROR":r.includes("403")||r.includes("forbidden")||r.includes("permission")?"AI_PERMISSION_DENIED":r.includes("404")||r.includes("not found")||r.includes("does not exist")?"AI_NOT_FOUND":r.includes("429")||r.includes("402")||r.includes("rate limit")||r.includes("too many")||r.includes("quota")||r.includes("额度")||r.includes("insufficient")||r.includes("balance")||r.includes("余额")||r.includes("积分")||r.includes("credit")?"AI_QUOTA_EXCEEDED":r.includes("fetch failed")||r.includes("network")||r.includes("connect")||r.includes("enotfound")||r.includes("econnrefused")||r.includes("etimedout")||r.includes("econnreset")||r.includes("terminated")||r.includes("socket hang up")||r.includes("other side closed")||r.includes("epipe")?"AI_CONNECTION_FAILED":r.includes("timeout")||r.includes("timed out")||r.includes("aborted")||r.includes("408")?"AI_TIMEOUT_ERROR":r.includes("500")||r.includes("502")||r.includes("503")||r.includes("504")||r.includes("无可用")||r.includes("overloaded")||r.includes("unavailable")?"AI_SERVICE_UNAVAILABLE":r.includes("invalid json")||r.includes("parse")||r.includes("json")||r.includes("missing critical xml")||r.includes("invalid ai response")||r.includes("empty response")?"AI_RESPONSE_ERROR":"AI_UNKNOWN_ERROR"}])},80435,276041,e=>{var t=e.i(200592),i=e.i(588107),r=e.i(971724),s=e.i(140561),n=e.i(105954),a=e.i(206033),o=e.i(455744),l=e.i(469755),c=e.i(180473),u=e.i(999617),h=e.i(843716),d=e.i(604147),p=e.i(377807);let _=r.z.object({x:a.z.number().min(0).max(1),y:a.z.number().min(0).max(1),width:a.z.number().min(.01).max(1),height:a.z.number().min(.01).max(1)}).refine(e=>e.x+e.width<=1.0001&&e.y+e.height<=1.0001,{message:"REGION_OUT_OF_BOUNDS"}),f=["unclear","partial","unlocated"],g=n.z.string().max(1572864,"DRAFT_IMAGE_TOO_LARGE").regex(/^data:image\/(?:jpeg|png|webp);base64,[A-Za-z0-9+/]+=*$/,"DRAFT_IMAGE_INVALID"),m=r.z.object({original:n.z.string().max(2e4),text:n.z.string().max(2e4),uncertain:o.z.array(n.z.string().max(200)).max(20)}),v=r.z.object({key:n.z.string().regex(/^[A-Za-z0-9_-]{1,40}$/),label:n.z.string().max(20).nullable(),text:n.z.string().max(2e4),material:n.z.string().max(2e4).nullable(),section:n.z.string().max(500).nullable(),selected:c.z.boolean(),regions:o.z.array(_).max(4),hasFigure:c.z.boolean(),flags:o.z.array(d.z.enum(f)).max(f.length),fix:m.nullish(),answer:n.z.string().max(2e4).nullish(),analysis:n.z.string().max(2e4).nullish(),knowledgePoints:o.z.array(n.z.string().max(200)).max(100).optional(),difficultyStars:a.z.number().int().min(1).max(5).nullish(),questionType:n.z.string().max(200).nullish(),wrongAnswer:n.z.string().max(2e4).nullish(),source:n.z.string().trim().max(200).nullish(),image:g.nullish()}),b=["blurry","partial","truncated","tooMany"],y=r.z.object({items:o.z.array(v).max(h.S),ignored:o.z.array(n.z.string().max(2e4)).max(200),warnings:o.z.array(d.z.enum(b)).max(b.length)}).superRefine((e,t)=>{let i=new Set;for(let r of e.items)i.has(r.key)&&t.addIssue({code:"custom",message:"DUPLICATE_ITEM_KEY"}),i.add(r.key)});function w(e=[]){let t=new Set(e);for(;;){let e=`q${Math.random().toString(36).slice(2,10)}`;if(!t.has(e))return e}}e.s(["O",0,2e4,"w",0,100,"y",0,4,"k",0,.01,"h",0,function(e,t){let i=t?.trim();return i?{...e,items:e.items.map(e=>e.source?.trim()?e:{...e,source:i})}:e},"Z",0,y,"d",0,function(e,t,i=0){let r=[];return{items:e.slice(0,h.S).map(e=>{let t=w(r);return r.push(t),{key:t,label:e.label?.slice(0,20)??null,text:e.text.slice(0,2e4),material:e.material?.slice(0,2e4)??null,section:e.section?.slice(0,500)??null,selected:e.text.trim().length>0,regions:[],hasFigure:!1,flags:[],answer:e.answer??null,analysis:e.analysis??null,knowledgePoints:e.knowledgePoints?.slice(0,100),difficultyStars:e.difficultyStars??null,questionType:(0,p.P)(e.questionType),wrongAnswer:e.wrongAnswer??null,source:null}}),ignored:t.slice(0,200),warnings:i>0||e.length>h.S?["tooMany"]:[]}},"n",0,g,"q",0,w,"c",0,function(e,t){return e.items.filter(e=>e.selected&&("image"===t?e.regions.length>0:e.text.trim().length>0))}],276041);let k=t.z.tuple([i.z.coerce.number().int(),i.z.coerce.number().int()]),z=r.z.object({x:i.z.coerce.number(),y:i.z.coerce.number(),w:i.z.coerce.number(),h:i.z.coerce.number()}),x=r.z.object({label:s.z.union([n.z.string(),a.z.number()]).nullish(),lines:k.nullish(),material:k.nullish(),section:n.z.string().nullish(),text:n.z.string().nullish(),regions:o.z.array(l.z.unknown()).nullish(),hasFigure:c.z.boolean().nullish(),unclear:c.z.boolean().nullish(),partial:c.z.boolean().nullish()}).passthrough(),S=r.z.object({quality:n.z.string().nullish(),questions:o.z.array(l.z.unknown())});function V(e){return null==e?null:String(e).trim().replace(/[..、::))]+$/,"").slice(0,20)||null}function A(e){let t=z.safeParse(e);if(!t.success)return null;let{x:i,y:r,w:s,h:n}=t.data;if(![i,r,s,n].every(Number.isFinite))return null;let a=Math.max(0,Math.min(1e3,i)),o=Math.max(0,Math.min(1e3,r)),l=(Math.max(0,Math.min(1e3,i+s))-a)/1e3,c=(Math.max(0,Math.min(1e3,r+n))-o)/1e3;if(l<.01||c<.01)return null;let u=e=>Math.round(1e4*e)/1e4;return{x:u(a/1e3),y:u(o/1e3),width:u(l),height:u(c)}}function I(e,t){if(!e)return null;let[i,r]=e;return i>=1&&r>=i&&r<=t?[i,r]:null}e.s(["b",0,"AI_IMAGE_NOT_SUPPORTED","W",0,1e3,"F",0,function(e){let t=(e instanceof Error?e.message:String(e)).toLowerCase();return/(image|vision|multimodal|multi-modal|图片|图像|视觉|多模态)/.test(t)&&/(not support|unsupported|does not accept|cannot|invalid content type|not allowed|不支持|无法处理)/.test(t)},"z",0,function(e,t){let{value:i,truncated:r}=function(e){let t=(0,u.Q)(e),i=t.match(/```(?:json)?\s*([\s\S]*?)```/);i&&(t=i[1]);let r=t.indexOf("{"),s=t.lastIndexOf("}");if(-1!==r&&s>r)try{let e=S.safeParse(JSON.parse(t.slice(r,s+1)));if(e.success)return{value:e.data,truncated:!1}}catch{}let n=function(e){let t=e.search(/"questions"\s*:\s*\[/);if(-1===t)return[];let i=[],r=e.indexOf("[",t)+1,s=0,n=!1,a=!1,o=-1;for(;r<e.length;r++){let t=e[r];if(n){a?a=!1:"\\"===t?a=!0:'"'===t&&(n=!1);continue}if('"'===t)n=!0;else if("{"===t)0===s&&(o=r),s++;else if("}"===t){if(0==--s&&-1!==o){try{i.push(JSON.parse(e.slice(o,r+1)))}catch{}o=-1}}else if("]"===t&&0===s)break}return i}(t);if(0===n.length)throw Error("AI_RESPONSE_ERROR: invalid question split output");return{value:{questions:n},truncated:!0}}(e),s="text"===t.kind?function(e,t){let i=Array(t.length).fill(!1),r=[],s=[],n=[];for(let a of e){let e=x.safeParse(a);if(!e.success)continue;let o=I(e.data.lines,t.length);if(!o||r.some(([e,t])=>o[0]<=t&&o[1]>=e))continue;let l=(0,h.N)((0,h.C)(t.slice(o[0]-1,o[1])));if(!l.trim())continue;let c=I(e.data.material,t.length),u=c&&(c[1]<o[0]||c[0]>o[1])?c:null;r.push(o),s.push(u);for(let e=o[0]-1;e<o[1];e++)i[e]=!0;if(u)for(let e=u[0]-1;e<u[1];e++)i[e]=!0;n.push({label:V(e.data.label),text:l,material:u&&(0,h.C)(t.slice(u[0]-1,u[1]))||null,section:e.data.section?.trim().slice(0,500)||null,regions:[],hasFigure:!1,flags:[]})}s.forEach((e,t)=>{e&&r.some(([t,i])=>e[0]<=i&&e[1]>=t)&&(n[t].material=null)});let a=n.map((e,t)=>({question:e,start:r[t][0]})).sort((e,t)=>e.start-t.start),o=[],l=[];for(let e=0;e<t.length;e++)!i[e]&&t[e].trim()?l.push(t[e]):l.length&&(o.push(l.join("\n")),l=[]);return l.length&&o.push(l.join("\n")),{questions:a.map(({question:e})=>e),ignored:o,warnings:[]}}(i.questions,t.lines):function(e,t){let i=[];for(let t of e){let e=x.safeParse(t);if(!e.success)continue;let r=(0,h.e)((e.data.text||"").trim()).slice(0,4e3),s=(e.data.regions||[]).map(A).filter(e=>null!==e).slice(0,4);if(!r&&0===s.length)continue;let n=[];e.data.unclear&&n.push("unclear"),e.data.partial&&n.push("partial"),0===s.length&&n.push("unlocated"),i.push({label:V(e.data.label),text:r,material:null,section:e.data.section?.trim().slice(0,500)||null,regions:s,hasFigure:!0===e.data.hasFigure,flags:n})}let r=[];return"blurry"===t&&r.push("blurry"),"partial"===t&&r.push("partial"),{questions:i,ignored:[],warnings:r}}(i.questions,i.quality),n=[...s.warnings];r&&n.push("truncated");let a=s.questions.slice(h.S);a.length&&n.push("tooMany");let o=[...s.ignored,...a.map(e=>[e.material,e.text].filter(Boolean).join("\n\n")).filter(Boolean)];return{...s,questions:s.questions.slice(0,h.S),ignored:o,warnings:n}}],80435)},700122,115851,907240,e=>{var t=e.i(999617),i=e.i(43746),r=e.i(357189),s=e.i(843716);let n=(0,e.i(50377).f)("ai:response-parser");function a(e,i){let r=(0,t.Q)(e),s=`<${i}>`,a=`</${i}>`,o=r.indexOf(s);if(-1===o)return null;let l=o+s.length,c=r.lastIndexOf(a);return -1===c&&"analysis"===i?(n.warn({tagName:i},"Tag was verified unclosed, treating as truncated and reading to end"),r.substring(l).trim()):-1===c||l>=c?null:r.substring(l,c).trim()}function o(e){return(e||"").split(/[,,\n]/).map(e=>e.trim()).filter(e=>e.length>0)}e.s(["a",0,a,"M",0,function(e){n.debug({textLength:e.length},"Parsing AI response");let l=a(e,"question_text"),c=l?(0,s.e)(l):null,u=a(e,"answer_text"),h=a(e,"analysis"),d=a(e,"subject"),p=a(e,"knowledge_points"),_=a(e,"requires_image"),f=a(e,"wrong_answer_text")||"",g=a(e,"mistake_analysis")||"",m=a(e,"mistake_status");if(!c||!u||!h)throw n.error({rawTextSample:e.substring(0,500)},"Missing critical XML tags"),Error("Invalid AI response: Missing critical XML tags (<question_text>, <answer_text>, or <analysis>)");let v="其他";d&&["数学","科学","物理","化学","生物","英语","语文","历史","地理","政治","其他"].includes(d)&&(v=d);let b=o(p),y=_?.toLowerCase().trim()==="true",w=(0,i.x)(m,f),k={questionText:c,answerText:u,analysis:h,wrongAnswerText:f,mistakeAnalysis:g,mistakeStatus:w,subject:v,knowledgePoints:b,requiresImage:y,gradeSemester:(0,r.X)(a(e,"grade_semester")),difficultyStars:(0,t.B)(a(e,"difficulty_stars")),questionType:(0,t.w)(a(e,"question_type")),...(0,t.t)(a(e,"has_figure"),a(e,"figure_svg"))},z=(0,t.u)(k);return z.success?(n.debug("Validated successfully via XML tags"),z.data):(n.warn({validationError:z.error.format()},"Schema validation warning"),k)},"D",0,o],700122),e.s(["f",0,function(e){let t=e.questionText.replace(/[((【\[]\s*(?:(?:本题|共|满分)\s*)?\d+(?:\.\d+)?\s*(?:分|points?|marks?|pts?\.?)\s*[))】\]]/giu,"").replace(/^\s*(?:#{1,6}\s*)?(?:第\s*\d+\s*题\s*[::.、]?|(?:Question|Problem)\s*\d+\s*[::.、]?|\d+\s*(?:[、.]|\.(?!\d)))\s*/iu,"").trim(),i=/^\s*(?:[-*]\s*)?(?:[A-DA-D][..、::))]|[((][A-DA-D][))])\s*\S/imu.test(t),r=t.match(/(?:^|\s)(?:[A-DA-D][..、::))]|[((][A-DA-D][))])/giu)||[],s=/(?:下列|以下|选择|答案|哪项|哪一|正确的是|正确的是)/u.test(t),n=t.match(/[①②③④⑤⑥⑦⑧⑨⑩][^①②③④⑤⑥⑦⑧⑨⑩]*/gu)||[],a=!(n.length<2)&&(!!s||!!(n.length>=4));if(!t||i||r.length>=2||a)throw Error("AI_RESPONSE_ERROR: 生成题目必须为不含选项的填空题或解答题");return{...e,questionText:t}}],115851);let l={数学:"prefetchedMathTags",科学:"prefetchedScienceTags",物理:"prefetchedPhysicsTags",化学:"prefetchedChemistryTags",生物:"prefetchedBiologyTags",英语:"prefetchedEnglishTags",语文:"prefetchedChineseTags",历史:"prefetchedHistoryTags",地理:"prefetchedGeographyTags",政治:"prefetchedPoliticsTags"};e.s(["f",0,function(e,i){let r;if(i.candidateTags?.allowCustom!==!0&&(r=i.candidateTags?.tags,!i.candidateTags)){let t=l[e.subject];if(t){let e=i[t];r=e?.length?e:void 0}else{let e=Object.values(l).flatMap(e=>i[e]??[]);r=e.length?e:void 0}}let s=r?new Set(r):null,n=[...new Set(e.knowledgePoints.map(e=>e.trim()).filter(e=>e&&(!s||s.has(e))))].slice(0,t.e);return{...e,knowledgePoints:n}}],907240)},999617,e=>{var t=e.i(971724),i=e.i(105954),r=e.i(604147),s=e.i(455744),n=e.i(180473),a=e.i(206033),o=e.i(588107),l=e.i(140561),c=e.i(469755),u=e.i(819428),h=e.i(357189),d=e.i(377807);let p=t.z.object({questionText:i.z.string().min(1,"题目文本不能为空"),answerText:i.z.string().min(1,"答案不能为空"),analysis:i.z.string().min(1,"解析不能为空"),wrongAnswerText:i.z.string().optional().default(""),mistakeAnalysis:i.z.string().optional().default(""),mistakeStatus:r.z.enum(["not_attempted","wrong_attempt","unknown"]).optional().default("unknown"),subject:r.z.enum(["数学","科学","物理","化学","生物","英语","语文","历史","地理","政治","其他"]),knowledgePoints:s.z.array(i.z.string()).max(5,"知识点最多 5 个"),requiresImage:n.z.boolean().optional().default(!1),difficultyStars:a.z.number().int().min(1).max(5).nullable().optional(),questionType:i.z.string().nullable().optional(),gradeSemester:i.z.string().max(100).nullable().optional(),hasFigure:n.z.boolean().optional(),figureSvg:i.z.string().nullable().optional(),source:i.z.string().trim().max(200).nullish()}),_=t.z.object({probability:o.z.coerce.number().min(0).max(100),reason:i.z.string().trim().min(1).max(500)});function f(e){return e.replace(/<(think|thinking)\b[^>]*>[\s\S]*?<\/\1>/gi,"").trim()}function g(e){let t=f(e),i=t.match(/```(?:json)?\s*([\s\S]*?)```/);i&&(t=i[1].trim());let r=t.indexOf("{"),s=t.lastIndexOf("}");return -1!==r&&s>r&&(t=t.substring(r,s+1)),JSON.parse(t)}let m=t.z.object({correct:l.z.union([n.z.boolean(),r.z.enum(["true","false"]).transform(e=>"true"===e)]),reason:i.z.string().trim().min(1).max(500)});function v(e){return(0,d.P)(e)}function b(e){let t;if("number"==typeof e)t=e;else{if("string"!=typeof e)return null;let i=e.trim(),r=(i.match(/[★⭐]/gu)||[]).length,s=i.match(/\d+(\.\d+)?/);t=r>0&&!s?r:s?Number(s[0]):0/0}if(!Number.isFinite(t))return null;let i=Math.round(t);return i>=1&&i<=5?i:null}e.s(["e",0,5,"U",0,p,"F",0,function(e){let t=p.shape.subject.safeParse(e?.trim());return t.success?t.data:void 0},"o",0,function(e){return m.parse(g(e))},"B",0,b,"t",0,function(e,t){let i=(0,u.W)(t);return{hasFigure:e?.trim().toLowerCase()==="true"||null!==i,figureSvg:i}},"b",0,function(e){let r=t.z.object({gradeSemester:i.z.string().nullable()}).parse(g(e));return(0,h.X)(r.gradeSemester)},"r",0,function(e){let t=_.parse(g(e));return{probability:Math.round(t.probability)/100,reason:t.reason}},"w",0,v,"K",0,function(e,r,n=!1){let a=t.z.object({tags:s.z.array(i.z.string()),difficultyStars:c.z.unknown().optional(),questionType:c.z.unknown().optional()}).parse(g(e)),o=new Set(r),l=[],u=[];for(let e of a.tags.map(e=>e.trim()))!(!e||l.includes(e)||u.includes(e))&&(o.has(e)?l.push(e):n&&u.push(e));return{tags:(n?[...l,...u]:l).slice(0,5),difficultyStars:b(a.difficultyStars),questionType:v(a.questionType)}},"u",0,function(e){return p.safeParse(e)},"Q",0,f])},459398,e=>{var t=e.i(698043),i=e.i(50377),r=e.i(668426);let s=(0,i.f)("ai:tag-service");async function n(e,i="default"){let r={1:["一年级"],2:["二年级"],3:["三年级"],4:["四年级"],5:["五年级"],6:["六年级"],7:["七年级上","七年级下"],8:["八年级上","八年级下"],9:["九年级上","九年级下"],10:["高一上","高一下"],11:["高二上","高二下"],12:["高三上","高三下","高三"]},a=[];if(e)if(e<=6)for(let t=1;t<=e;t++)a.push(...r[t]);else if(e>=7&&e<=9)for(let t=7;t<=e;t++)a.push(...r[t]||[]);else for(let t=10;t<=e;t++)a.push(...r[t]||[]);else for(let e=7;e<=12;e++)a.push(...r[e]);try{let e=(await t.f.knowledgeTag.findMany({where:{subject:"math",parentId:null,tagSet:i,name:{in:a}},select:{id:!0}})).map(e=>e.id),r=await t.f.knowledgeTag.findMany({where:{subject:"math",isSystem:!0,tagSet:i},select:{id:!0,name:!0,parentId:!0}}),s=new Map;r.forEach(e=>{if(e.parentId){let t=s.get(e.parentId)||[];t.push(e.id),s.set(e.parentId,t)}});let n=e=>{let t=s.get(e)||[];return 0===t.length?[e]:t.flatMap(e=>n(e))},o=new Set;e.forEach(e=>{n(e).forEach(e=>o.add(e))});let l=new Map(r.map(e=>[e.id,e.name]));return Array.from(o).map(e=>l.get(e)).filter(e=>!!e)}catch(e){return s.error({error:e},"getMathTagsFromDB error"),[]}}async function a(e,i="default"){try{return(await t.f.knowledgeTag.findMany({where:{subject:e,isSystem:!0,tagSet:i,children:{none:{}}},select:{name:!0},orderBy:{order:"asc"}})).map(e=>e.name)}catch(e){return s.error({error:e},"getTagsFromDB error"),[]}}async function o(e,i,n="default"){try{let s=await t.f.knowledgeTag.findMany({where:{subject:e,isSystem:!0,tagSet:n},select:{id:!0,name:!0,parentId:!0},orderBy:[{order:"asc"},{createdAt:"asc"}]}),a=new Map;for(let e of s)if(e.parentId){let t=a.get(e.parentId)||[];t.push(e),a.set(e.parentId,t)}let o=new Set,l=e=>{let t=a.get(e.id);t?.length?t.forEach(l):o.add(e.name)};return s.filter(e=>!e.parentId&&(0,r.U)(e.name,i)&&a.has(e.id)).forEach(l),Array.from(o)}catch(t){return s.error({error:t,subject:e,stage:i,tagSet:n},"getScopeTagsFromDB error"),[]}}async function l(e,i,n,a){try{let s=await t.f.knowledgeTag.findMany({where:{subject:e,tagSet:n,OR:[{isSystem:!0},{userId:a}]},select:{id:!0,name:!0,parentId:!0,isSystem:!0},orderBy:[{order:"asc"},{createdAt:"asc"}]}),o=new Map(s.map(e=>[e.id,e])),l=new Set(s.flatMap(e=>e.parentId?[e.parentId]:[])),c=new Set;for(let e of s){if(e.isSystem||l.has(e.id))continue;let t=e,s=new Set([e.id]);for(;t.parentId&&o.has(t.parentId)&&!s.has(t.parentId);)t=o.get(t.parentId),s.add(t.id);(t.id===e.id||(0,r.U)(t.name,i))&&c.add(e.name)}return Array.from(c)}catch(t){return s.error({error:t,subject:e,stage:i,tagSet:n},"getUserScopeTagsFromDB error"),[]}}async function c(e,t="default",i){if(!e.subject)return;let s=await o(e.subject,e.stage,t),n=0===s.length,a=n&&i?await l(e.subject,e.stage,t,i):s;return{subjectName:r.L[e.subject],tags:a,...n?{allowCustom:!0}:{}}}async function u(e,t,i="default"){return{prefetchedMathTags:"数学"!==e&&e?[]:await n(t||null,i),prefetchedScienceTags:"科学"!==e&&e?[]:await a("science",i),prefetchedPhysicsTags:"物理"!==e&&e?[]:await a("physics",i),prefetchedChemistryTags:"化学"!==e&&e?[]:await a("chemistry",i),prefetchedBiologyTags:"生物"!==e&&e?[]:await a("biology",i),prefetchedEnglishTags:"英语"!==e&&e?[]:await a("english",i),prefetchedChineseTags:"语文"!==e&&e?[]:await a("chinese",i),prefetchedHistoryTags:"历史"!==e&&e?[]:await a("history",i),prefetchedGeographyTags:"地理"!==e&&e?[]:await a("geography",i),prefetchedPoliticsTags:"政治"!==e&&e?[]:await a("politics",i)}}e.s(["v",0,n,"K",0,c,"e",0,o,"C",0,l,"i",0,u])},843716,e=>{let t=/^[\s ]+/,i="一二三四五六七八九十",r=[{family:"dot",pattern:/^(\d{1,3})\s*(?:.|\.(?!\d))\s*/},{family:"comma",pattern:/^(\d{1,3})\s*[、,,](?!\d)\s*/},{family:"paren",pattern:/^(\d{1,3})\s*[))]\s*/},{family:"colon",pattern:/^(\d{1,3})\s*[::](?!\d)\s*/},{family:"ti",pattern:/^第\s*(\d{1,3}|[一二三四五六七八九十]{1,3})\s*题\s*[..、::]?\s*/},{family:"example",pattern:/^(?:例题?|练习|习题)\s*(\d{1,3})\s*[..、::]?\s*/},{family:"q",pattern:/^(?:Q|Question|Problem|Exercise)\s*(\d{1,3})\s*[..::)]?\s+/i},{family:"cn",pattern:/^([一二三四五六七八九十]{1,3})\s*[、..]\s*/}];function s(e){let s=e.replace(t,"");for(let{family:e,pattern:t}of r){let r=s.match(t);if(!r||s.length<=r[0].length)continue;let n=function(e){if(/^\d+$/.test(e))return Number(e);if("十"===e)return 10;let t=e.indexOf("十");return -1===t?i.indexOf(e)+1:10*(0===t?1:i.indexOf(e[0])+1)+(t===e.length-1?0:i.indexOf(e[t+1])+1)}(r[1]);if(Number.isFinite(n)&&!(n<=0))return{value:n,family:e,prefixLength:r[0].length,label:r[1]}}return null}function n(e){let i=e.split("\n"),r=i[0]?.replace(t,"")??"",n=s(r);return n&&"cn"!==n.family&&(i[0]=r.slice(n.prefixLength)),i.join("\n")}function a(e){return e.replace(/\r\n?/g,"\n").split("\n").map(e=>e.replace(t,"").replace(/[\s ]+$/,""))}function o(e){let t=[];for(let i of e)(i||0!==t.length&&""!==t[t.length-1])&&t.push(i);for(;t.length>0&&""===t[t.length-1];)t.pop();return t.join("\n")}let l=/(姓名|班级|学号|日期|得分|分数|评分|考号|座位号|家长签字|用时|Name\s*[::_]|Class\s*[::_]|Date\s*[::_]|Score\s*[::_])|_{3,}|共\s*\d+\s*(道|题|小题)|做完|答案(见|在)|最后一页|满分\s*\d+\s*分/i,c=/(阅读|材料|短文|文章|选文|诗歌|古诗|文言文|下[面列]的?(表格|图表|统计|信息)|根据.{0,20}(回答|完成)|passage|read the|according to the)/i,u=/^(参考答案|答案与解析|答案|Answers?|Answer Key)\s*[::]?$/i,h=/^(第[一二三四五六七八九十]+(部分|大题|节)|(Part|Section)\s+[A-Z0-9IVX]+\b)/i,d=/(选择|填空|判断|计算|解答|应用|解决问题|操作|作图|阅读|写作|作文|综合|口算|听力|单项|完形|题)/,p=/(\d{1,3})\s*[~~\-—–至到]\s*(\d{1,3})\s*(?:小?题|questions?)/i,_=/(小问|小题|下列问题|以下问题|下列各题|下面各题|完成下列|回答下列|回答以下|following questions|answer the following)/i;function f(e){let t=[],i=[];for(let r of e)r?i.push(r):i.length&&(t.push(i.join("\n")),i=[]);return i.length&&t.push(i.join("\n")),t}function g(e,t=[]){let i=e.trim();return!(!i||i.length>12||/[。!?!?,,、;;::..()()【】\[\]{}]$/.test(i)||/\d/.test(i)||/[。!?!?;;,,]/.test(i))&&!!(/(篇|章|节|部分|组)$/.test(i)||/^(Part|Section)\s+[A-Z0-9]+$/i.test(i))&&(!t.length||t.some(e=>{let t=s(e);return null!==t&&1===t.value}))}function m(e,t){let i=[];for(let r=0;r<e.length;r++){let s=e[r],n=[s];for(let i=r+1;i<e.length;i++){let r=e[i],a=n[n.length-1];if(r.family!==s.family)continue;let o=1===r.value&&[...t].some(e=>e>a.line&&e<r.line);(r.value===a.value+1||o)&&n.push(r)}n.length>i.length&&(i=n)}return i}function v(e,t,i){return!!h.test(e)||!!t&&"cn"===t.family&&"cn"!==i&&null!==i&&(e.length<=40||d.test(e.slice(0,20)))}function b(e,t,i,r,s){for(let n=e-1;n>=0;n--)if(t[n]){if(s.has(n)||v(t[n],i[n],r)||g(t[n]))return t[n];break}return null}function y(e){let t=e.match(p);if(!t)return null;let i=Number(t[1]),r=Number(t[2]);return i<=r?{from:i,to:r}:null}let w={answer:/^(?:【\s*(?:参考答案|答案)\s*】|(?:参考答案|答案)\s*[::]|Answer\s*[::])\s*(.*)$/i,analysis:/^(?:【\s*(?:解析|分析|详解|解答|点评)\s*】|(?:解析|分析|详解|解答|点评)\s*[::])\s*(.*)$/,knowledge:/^(?:【\s*(?:知识点|考点)\s*】|(?:知识点|考点)\s*[::])\s*(.*)$/,difficulty:/^(?:【\s*难度\s*】|难度\s*[::])\s*(.*)$/,questionType:/^(?:【\s*题型\s*】|题型\s*[::])\s*(.*)$/,wrongAnswer:/^(?:【\s*错答\s*】|我的答案\s*[::]|学生答案\s*[::])\s*(.*)$/},k={易:1,较易:2,中等:3,较难:4,难:5};function z(e){return e.split(/[、,,;;]/).map(e=>e.trim()).filter(Boolean)}function x(e){let t={answer:[],analysis:[],knowledge:[],difficulty:[],questionType:[],wrongAnswer:[]},i=[],r=null;for(let s of e){let e=null;for(let i of Object.keys(w)){let n=s.match(w[i]);if(!n)continue;e=i,r=i;let a=n[1].trim();a&&t[i].push(a);break}e||(r&&s.trim()?t[r].push(s.trim()):i.push(s))}let s={},n=t.answer.join("\n").trim();n&&(s.answer=n);let a=t.analysis.join("\n").trim();a&&(s.analysis=a);let l=t.knowledge.flatMap(z);l.length&&(s.knowledgePoints=l);let c=t.difficulty.join(" ").trim(),u=c?function(e){let t=e.trim();if(!t)return null;let i=t.match(/^(\d{1,2})\s*(?:星|级)?$/);if(i){let e=Number(i[1]);return e>=1&&e<=5?e:null}if(/^[★☆]{1,5}$/.test(t)){let e=(t.match(/★/g)??[]).length;return e>=1?e:null}return t in k?k[t]:null}(c):null;null!==u&&(s.difficultyStars=u);let h=t.questionType.join(" ").trim();h&&(s.questionType=h);let d=t.wrongAnswer.join("\n").trim();return d&&(s.wrongAnswer=d),{text:o(i),fields:s}}let S=/^(\d{1,3})\s*[..、,,)]\s*(\S[\s\S]*)$/,V=/^(\d{1,3})\s*[~~—–-]\s*(\d{1,3})\s*[::..、]?\s*([A-Za-z]+)$/;function A(e){let t=e.trim();if(!t)return null;let i=function(e){let t=e.trim().match(V);if(!t)return null;let i=Number(t[1]),r=Number(t[2]),s=t[3];if(!Number.isFinite(i)||!Number.isFinite(r)||i<=0||r<=i||r-i+1>60)return null;let n=r-i+1;return s.length!==n?null:Array.from({length:n},(e,t)=>({label:String(i+t),text:s[t]}))}(t);if(i)return i;let r=function(e){let t=e.trim(),i=[];for(let e of t.matchAll(/(\d{1,3})\s*[..、,,;;]\s*/g)){let r=e.index??0,s=t[r+e[0].length];s&&/\d/.test(s)||i.push({index:r,label:e[1],afterIndex:r+e[0].length})}if(i.length<2)return null;for(let e=1;e<i.length;e++)if(Number(i[e].label)<=Number(i[e-1].label))return null;let r=[];for(let e=0;e<i.length;e++){let s=i[e].afterIndex,n=e+1<i.length?i[e+1].index:t.length,a=t.slice(s,n).trim().replace(/[;;]+$/,"").trim();if(!a||a.length>30||/[。!?!?]/.test(a))return null;r.push({label:i[e].label,text:a})}return r}(t);if(r)return r.map(e=>({label:e.label??"",text:e.text})).filter(e=>e.label);let s=t.match(S);if(!s)return null;let n=Number(s[1]);return!Number.isFinite(n)||n<=0?null:[{label:s[1],text:s[2].trim()}]}function I(e){let t=e.match(/^(.*?)(?:【?\s*(?:解析|分析|详解|解答|点评)\s*】?\s*[::])([\s\S]*)$/);if(t){let i=t[1].replace(/^(?:【?\s*(?:参考答案|答案)\s*】?\s*[::])\s*/,"").trim(),r=t[2].trim();return r?{answer:i,analysis:r}:{answer:e.trim()}}return{answer:e.replace(/^(?:【?\s*(?:参考答案|答案)\s*】?\s*[::])\s*/,"").trim()||e.trim()}}function q(e,t){let i=[],r=!1;for(let s of e){let e={value:!1},n=[];for(let i of s.split("\n")){let r=i.trim()?A(i):null;if(!r){i.trim()&&n.push(i);continue}let s=!1;for(let a of r){let r=t.find(e=>e.label===a.label);if(!r){n.push(i);break}s=!0,e.value=!0;let o=I(a.text);o.answer&&!r.answer&&(r.answer=o.answer),o.analysis&&(r.analysis=r.analysis?`${r.analysis}
|
|
8
|
+
${o.analysis}`:o.analysis)}!s&&!n.includes(i)&&i.trim()&&!n.includes(i)&&n.push(i)}r=r||e.value,e.value?n.length&&i.push(n.join("\n")):i.push(s)}return[i,r]}function R(e){let t=e.text.trim(),i=e.material?.trim(),r=i?`${i}
|
|
9
9
|
|
|
10
10
|
${t}`:t,s=[];return(e.answer?.trim()&&s.push(`参考答案:${e.answer.trim()}`),e.analysis?.trim()&&s.push(`参考解析:${e.analysis.trim()}`),e.wrongAnswer?.trim()&&s.push(`学生作答:${e.wrongAnswer.trim()}`),s.length)?`${r}
|
|
11
11
|
|
|
12
|
-
${s.join("\n\n")}`:r}e.s(["S",0,60,"i",0,2e4,"$",0,function(e){let t=[];for(let i of
|
|
13
|
-
${i}`:W.push(i)},G
|
|
14
|
-
${i.analysis}`:i.analysis)}h||o.includes(r)||o.push(r)}l?o.length&&r.push(o.join("\n")):r.push(s)}return r}(P,p,F):P}else i=C(P,F)[0];let Z=F.slice(n);return{questions:F.slice(0,n),ignored:[...W,...i,...Z.map(e=>j(e))],detected:!0,ambiguous:!1,candidateCount:F.length,overflow:Z.length,tooLong:a}},"N",0,f],843716);var D=e.i(604147),U=e.i(377807);let W=r.z.object({x:a.z.number().min(0).max(1),y:a.z.number().min(0).max(1),width:a.z.number().min(.01).max(1),height:a.z.number().min(.01).max(1)}).refine(e=>e.x+e.width<=1.0001&&e.y+e.height<=1.0001,{message:"REGION_OUT_OF_BOUNDS"}),F=["unclear","partial","unlocated"],H=n.z.string().max(1572864,"DRAFT_IMAGE_TOO_LARGE").regex(/^data:image\/(?:jpeg|png|webp);base64,[A-Za-z0-9+/]+=*$/,"DRAFT_IMAGE_INVALID"),B=r.z.object({original:n.z.string().max(2e4),text:n.z.string().max(2e4),uncertain:o.z.array(n.z.string().max(200)).max(20)}),K=r.z.object({key:n.z.string().regex(/^[A-Za-z0-9_-]{1,40}$/),label:n.z.string().max(20).nullable(),text:n.z.string().max(2e4),material:n.z.string().max(2e4).nullable(),section:n.z.string().max(500).nullable(),selected:c.z.boolean(),regions:o.z.array(W).max(4),hasFigure:c.z.boolean(),flags:o.z.array(D.z.enum(F)).max(F.length),fix:B.nullish(),answer:n.z.string().max(2e4).nullish(),analysis:n.z.string().max(2e4).nullish(),knowledgePoints:o.z.array(n.z.string().max(200)).max(100).optional(),difficultyStars:a.z.number().int().min(1).max(5).nullish(),questionType:n.z.string().max(200).nullish(),wrongAnswer:n.z.string().max(2e4).nullish(),source:n.z.string().trim().max(200).nullish(),image:H.nullish()}),J=["blurry","partial","truncated","tooMany"],G=r.z.object({items:o.z.array(K).max(60),ignored:o.z.array(n.z.string().max(2e4)).max(200),warnings:o.z.array(D.z.enum(J)).max(J.length)}).superRefine((e,t)=>{let i=new Set;for(let r of e.items)i.has(r.key)&&t.addIssue({code:"custom",message:"DUPLICATE_ITEM_KEY"}),i.add(r.key)});function X(e=[]){let t=new Set(e);for(;;){let e=`q${Math.random().toString(36).slice(2,10)}`;if(!t.has(e))return e}}e.s(["O",0,2e4,"w",0,100,"y",0,4,"k",0,.01,"h",0,function(e,t){let i=t?.trim();return i?{...e,items:e.items.map(e=>e.source?.trim()?e:{...e,source:i})}:e},"Z",0,G,"d",0,function(e,t,i=0){let r=[];return{items:e.slice(0,60).map(e=>{let t=X(r);return r.push(t),{key:t,label:e.label?.slice(0,20)??null,text:e.text.slice(0,2e4),material:e.material?.slice(0,2e4)??null,section:e.section?.slice(0,500)??null,selected:e.text.trim().length>0,regions:[],hasFigure:!1,flags:[],answer:e.answer??null,analysis:e.analysis??null,knowledgePoints:e.knowledgePoints?.slice(0,100),difficultyStars:e.difficultyStars??null,questionType:(0,U.P)(e.questionType),wrongAnswer:e.wrongAnswer??null,source:null}}),ignored:t.slice(0,200),warnings:i>0||e.length>60?["tooMany"]:[]}},"n",0,H,"q",0,X,"c",0,function(e,t){return e.items.filter(e=>e.selected&&("image"===t?e.regions.length>0:e.text.trim().length>0))}],276041);let Q=t.z.tuple([i.z.coerce.number().int(),i.z.coerce.number().int()]),Y=r.z.object({x:i.z.coerce.number(),y:i.z.coerce.number(),w:i.z.coerce.number(),h:i.z.coerce.number()}),Z=r.z.object({label:s.z.union([n.z.string(),a.z.number()]).nullish(),lines:Q.nullish(),material:Q.nullish(),section:n.z.string().nullish(),text:n.z.string().nullish(),regions:o.z.array(l.z.unknown()).nullish(),hasFigure:c.z.boolean().nullish(),unclear:c.z.boolean().nullish(),partial:c.z.boolean().nullish()}).passthrough(),ee=r.z.object({quality:n.z.string().nullish(),questions:o.z.array(l.z.unknown())});function et(e){return null==e?null:String(e).trim().replace(/[..、::))]+$/,"").slice(0,20)||null}function ei(e){let t=Y.safeParse(e);if(!t.success)return null;let{x:i,y:r,w:s,h:n}=t.data;if(![i,r,s,n].every(Number.isFinite))return null;let a=Math.max(0,Math.min(1e3,i)),o=Math.max(0,Math.min(1e3,r)),l=(Math.max(0,Math.min(1e3,i+s))-a)/1e3,c=(Math.max(0,Math.min(1e3,r+n))-o)/1e3;if(l<.01||c<.01)return null;let u=e=>Math.round(1e4*e)/1e4;return{x:u(a/1e3),y:u(o/1e3),width:u(l),height:u(c)}}function er(e,t){if(!e)return null;let[i,r]=e;return i>=1&&r>=i&&r<=t?[i,r]:null}e.s(["b",0,"AI_IMAGE_NOT_SUPPORTED","W",0,1e3,"F",0,function(e){let t=(e instanceof Error?e.message:String(e)).toLowerCase();return/(image|vision|multimodal|multi-modal|图片|图像|视觉|多模态)/.test(t)&&/(not support|unsupported|does not accept|cannot|invalid content type|not allowed|不支持|无法处理)/.test(t)},"z",0,function(e,t){let{value:i,truncated:r}=function(e){let t=(0,u.Q)(e),i=t.match(/```(?:json)?\s*([\s\S]*?)```/);i&&(t=i[1]);let r=t.indexOf("{"),s=t.lastIndexOf("}");if(-1!==r&&s>r)try{let e=ee.safeParse(JSON.parse(t.slice(r,s+1)));if(e.success)return{value:e.data,truncated:!1}}catch{}let n=function(e){let t=e.search(/"questions"\s*:\s*\[/);if(-1===t)return[];let i=[],r=e.indexOf("[",t)+1,s=0,n=!1,a=!1,o=-1;for(;r<e.length;r++){let t=e[r];if(n){a?a=!1:"\\"===t?a=!0:'"'===t&&(n=!1);continue}if('"'===t)n=!0;else if("{"===t)0===s&&(o=r),s++;else if("}"===t){if(0==--s&&-1!==o){try{i.push(JSON.parse(e.slice(o,r+1)))}catch{}o=-1}}else if("]"===t&&0===s)break}return i}(t);if(0===n.length)throw Error("AI_RESPONSE_ERROR: invalid question split output");return{value:{questions:n},truncated:!0}}(e),s="text"===t.kind?function(e,t){let i=Array(t.length).fill(!1),r=[],s=[],n=[];for(let a of e){let e=Z.safeParse(a);if(!e.success)continue;let o=er(e.data.lines,t.length);if(!o||r.some(([e,t])=>o[0]<=t&&o[1]>=e))continue;let l=f(m(t.slice(o[0]-1,o[1])));if(!l.trim())continue;let c=er(e.data.material,t.length),u=c&&(c[1]<o[0]||c[0]>o[1])?c:null;r.push(o),s.push(u);for(let e=o[0]-1;e<o[1];e++)i[e]=!0;if(u)for(let e=u[0]-1;e<u[1];e++)i[e]=!0;n.push({label:et(e.data.label),text:l,material:u&&m(t.slice(u[0]-1,u[1]))||null,section:e.data.section?.trim().slice(0,500)||null,regions:[],hasFigure:!1,flags:[]})}s.forEach((e,t)=>{e&&r.some(([t,i])=>e[0]<=i&&e[1]>=t)&&(n[t].material=null)});let a=n.map((e,t)=>({question:e,start:r[t][0]})).sort((e,t)=>e.start-t.start),o=[],l=[];for(let e=0;e<t.length;e++)!i[e]&&t[e].trim()?l.push(t[e]):l.length&&(o.push(l.join("\n")),l=[]);return l.length&&o.push(l.join("\n")),{questions:a.map(({question:e})=>e),ignored:o,warnings:[]}}(i.questions,t.lines):function(e,t){let i=[];for(let t of e){let e=Z.safeParse(t);if(!e.success)continue;let r=(e.data.text||"").trim().slice(0,4e3),s=(e.data.regions||[]).map(ei).filter(e=>null!==e).slice(0,4);if(!r&&0===s.length)continue;let n=[];e.data.unclear&&n.push("unclear"),e.data.partial&&n.push("partial"),0===s.length&&n.push("unlocated"),i.push({label:et(e.data.label),text:r,material:null,section:e.data.section?.trim().slice(0,500)||null,regions:s,hasFigure:!0===e.data.hasFigure,flags:n})}let r=[];return"blurry"===t&&r.push("blurry"),"partial"===t&&r.push("partial"),{questions:i,ignored:[],warnings:r}}(i.questions,i.quality),n=[...s.warnings];r&&n.push("truncated");let a=s.questions.slice(60);a.length&&n.push("tooMany");let o=[...s.ignored,...a.map(e=>[e.material,e.text].filter(Boolean).join("\n\n")).filter(Boolean)];return{...s,questions:s.questions.slice(0,60),ignored:o,warnings:n}}],80435)},999617,e=>{var t=e.i(971724),i=e.i(105954),r=e.i(604147),s=e.i(455744),n=e.i(180473),a=e.i(206033),o=e.i(588107),l=e.i(140561),c=e.i(469755),u=e.i(819428),h=e.i(357189),d=e.i(377807);let p=t.z.object({questionText:i.z.string().min(1,"题目文本不能为空"),answerText:i.z.string().min(1,"答案不能为空"),analysis:i.z.string().min(1,"解析不能为空"),wrongAnswerText:i.z.string().optional().default(""),mistakeAnalysis:i.z.string().optional().default(""),mistakeStatus:r.z.enum(["not_attempted","wrong_attempt","unknown"]).optional().default("unknown"),subject:r.z.enum(["数学","物理","化学","生物","英语","语文","历史","地理","政治","其他"]),knowledgePoints:s.z.array(i.z.string()).max(5,"知识点最多 5 个"),requiresImage:n.z.boolean().optional().default(!1),difficultyStars:a.z.number().int().min(1).max(5).nullable().optional(),questionType:i.z.string().nullable().optional(),gradeSemester:i.z.string().max(100).nullable().optional(),hasFigure:n.z.boolean().optional(),figureSvg:i.z.string().nullable().optional(),source:i.z.string().trim().max(200).nullish()}),_=t.z.object({probability:o.z.coerce.number().min(0).max(100),reason:i.z.string().trim().min(1).max(500)});function f(e){return e.replace(/<(think|thinking)\b[^>]*>[\s\S]*?<\/\1>/gi,"").trim()}function g(e){let t=f(e),i=t.match(/```(?:json)?\s*([\s\S]*?)```/);i&&(t=i[1].trim());let r=t.indexOf("{"),s=t.lastIndexOf("}");return -1!==r&&s>r&&(t=t.substring(r,s+1)),JSON.parse(t)}let m=t.z.object({correct:l.z.union([n.z.boolean(),r.z.enum(["true","false"]).transform(e=>"true"===e)]),reason:i.z.string().trim().min(1).max(500)});function v(e){return(0,d.P)(e)}function b(e){let t;if("number"==typeof e)t=e;else{if("string"!=typeof e)return null;let i=e.trim(),r=(i.match(/[★⭐]/gu)||[]).length,s=i.match(/\d+(\.\d+)?/);t=r>0&&!s?r:s?Number(s[0]):0/0}if(!Number.isFinite(t))return null;let i=Math.round(t);return i>=1&&i<=5?i:null}e.s(["e",0,5,"U",0,p,"F",0,function(e){let t=p.shape.subject.safeParse(e?.trim());return t.success?t.data:void 0},"o",0,function(e){return m.parse(g(e))},"B",0,b,"t",0,function(e,t){let i=(0,u.W)(t);return{hasFigure:e?.trim().toLowerCase()==="true"||null!==i,figureSvg:i}},"b",0,function(e){let r=t.z.object({gradeSemester:i.z.string().nullable()}).parse(g(e));return(0,h.X)(r.gradeSemester)},"r",0,function(e){let t=_.parse(g(e));return{probability:Math.round(t.probability)/100,reason:t.reason}},"w",0,v,"K",0,function(e,r,n=!1){let a=t.z.object({tags:s.z.array(i.z.string()),difficultyStars:c.z.unknown().optional(),questionType:c.z.unknown().optional()}).parse(g(e)),o=new Set(r),l=[],u=[];for(let e of a.tags.map(e=>e.trim()))!(!e||l.includes(e)||u.includes(e))&&(o.has(e)?l.push(e):n&&u.push(e));return{tags:(n?[...l,...u]:l).slice(0,5),difficultyStars:b(a.difficultyStars),questionType:v(a.questionType)}},"u",0,function(e){return p.safeParse(e)},"Q",0,f])},459398,e=>{var t=e.i(698043),i=e.i(50377),r=e.i(668426);let s=(0,i.f)("ai:tag-service");async function n(e,i="default"){let r={1:["一年级"],2:["二年级"],3:["三年级"],4:["四年级"],5:["五年级"],6:["六年级"],7:["七年级上","七年级下"],8:["八年级上","八年级下"],9:["九年级上","九年级下"],10:["高一上","高一下"],11:["高二上","高二下"],12:["高三上","高三下","高三"]},a=[];if(e)if(e<=6)for(let t=1;t<=e;t++)a.push(...r[t]);else if(e>=7&&e<=9)for(let t=7;t<=e;t++)a.push(...r[t]||[]);else for(let t=10;t<=e;t++)a.push(...r[t]||[]);else for(let e=7;e<=12;e++)a.push(...r[e]);try{let e=(await t.f.knowledgeTag.findMany({where:{subject:"math",parentId:null,tagSet:i,name:{in:a}},select:{id:!0}})).map(e=>e.id),r=await t.f.knowledgeTag.findMany({where:{subject:"math",isSystem:!0,tagSet:i},select:{id:!0,name:!0,parentId:!0}}),s=new Map;r.forEach(e=>{if(e.parentId){let t=s.get(e.parentId)||[];t.push(e.id),s.set(e.parentId,t)}});let n=e=>{let t=s.get(e)||[];return 0===t.length?[e]:t.flatMap(e=>n(e))},o=new Set;e.forEach(e=>{n(e).forEach(e=>o.add(e))});let l=new Map(r.map(e=>[e.id,e.name]));return Array.from(o).map(e=>l.get(e)).filter(e=>!!e)}catch(e){return s.error({error:e},"getMathTagsFromDB error"),[]}}async function a(e,i="default"){try{return(await t.f.knowledgeTag.findMany({where:{subject:e,isSystem:!0,tagSet:i,children:{none:{}}},select:{name:!0},orderBy:{order:"asc"}})).map(e=>e.name)}catch(e){return s.error({error:e},"getTagsFromDB error"),[]}}async function o(e,i,n="default"){try{let s=await t.f.knowledgeTag.findMany({where:{subject:e,isSystem:!0,tagSet:n},select:{id:!0,name:!0,parentId:!0},orderBy:[{order:"asc"},{createdAt:"asc"}]}),a=new Map;for(let e of s)if(e.parentId){let t=a.get(e.parentId)||[];t.push(e),a.set(e.parentId,t)}let o=new Set,l=e=>{let t=a.get(e.id);t?.length?t.forEach(l):o.add(e.name)};return s.filter(e=>!e.parentId&&(0,r.U)(e.name,i)&&a.has(e.id)).forEach(l),Array.from(o)}catch(t){return s.error({error:t,subject:e,stage:i,tagSet:n},"getScopeTagsFromDB error"),[]}}async function l(e,i,n,a){try{let s=await t.f.knowledgeTag.findMany({where:{subject:e,tagSet:n,OR:[{isSystem:!0},{userId:a}]},select:{id:!0,name:!0,parentId:!0,isSystem:!0},orderBy:[{order:"asc"},{createdAt:"asc"}]}),o=new Map(s.map(e=>[e.id,e])),l=new Set(s.flatMap(e=>e.parentId?[e.parentId]:[])),c=new Set;for(let e of s){if(e.isSystem||l.has(e.id))continue;let t=e,s=new Set([e.id]);for(;t.parentId&&o.has(t.parentId)&&!s.has(t.parentId);)t=o.get(t.parentId),s.add(t.id);(t.id===e.id||(0,r.U)(t.name,i))&&c.add(e.name)}return Array.from(c)}catch(t){return s.error({error:t,subject:e,stage:i,tagSet:n},"getUserScopeTagsFromDB error"),[]}}async function c(e,t="default",i){if(!e.subject)return;let s=await o(e.subject,e.stage,t),n=0===s.length,a=n&&i?await l(e.subject,e.stage,t,i):s;return{subjectName:r.L[e.subject],tags:a,...n?{allowCustom:!0}:{}}}async function u(e,t,i="default"){return{prefetchedMathTags:"数学"!==e&&e?[]:await n(t||null,i),prefetchedPhysicsTags:"物理"!==e&&e?[]:await a("physics",i),prefetchedChemistryTags:"化学"!==e&&e?[]:await a("chemistry",i),prefetchedBiologyTags:"生物"!==e&&e?[]:await a("biology",i),prefetchedEnglishTags:"英语"!==e&&e?[]:await a("english",i),prefetchedChineseTags:"语文"!==e&&e?[]:await a("chinese",i),prefetchedHistoryTags:"历史"!==e&&e?[]:await a("history",i),prefetchedGeographyTags:"地理"!==e&&e?[]:await a("geography",i),prefetchedPoliticsTags:"政治"!==e&&e?[]:await a("politics",i)}}e.s(["v",0,n,"K",0,c,"e",0,o,"C",0,l,"i",0,u])},357189,539811,e=>{var t=e.i(376025);function i(e,r,s=new Date,n="en",a=t.J){let o=(0,t.c)(s,a),l=o.getFullYear(),c=o.getMonth()+1,u=l-r,h="2nd";c>=9?(u+=1,h="1st"):h=c<2?"1st":"2nd";let d="zh"===n,p=d?"1st"===h?"上期":"下期":"1st"===h?"1st Semester":"2nd Semester",_=(d?{primary:["一年级","二年级","三年级","四年级","五年级","六年级"],junior_high:["初一","初二","初三"],senior_high:["高一","高二","高三"],university:["大一","大二","大三","大四"]}:{primary:["Grade 1","Grade 2","Grade 3","Grade 4","Grade 5","Grade 6"],junior_high:["Junior High Grade 1","Junior High Grade 2","Junior High Grade 3"],senior_high:["Senior High Grade 1","Senior High Grade 2","Senior High Grade 3"],university:["Freshman","Sophomore","Junior","Senior"]})[e]||[],f=`${u}`;if(f=u>0&&u<=_.length?_[u-1]:u>_.length?d?"已毕业":"Graduated":d?"学前":"Pre-school",!d)return`${f}, ${p}`;{let e="1st"===h?"上":"下";return`${f}${e}`}}e.s(["f",0,i],539811);var r=e.i(411706);function s(e){if("string"!=typeof e)return null;let t=e.trim();return r.H.includes(t)?t:null}function n(e,r=t.J){return"ai"===e.gradeRecognitionMode?null:e.fixedGradeSemester?e.fixedGradeSemester:e.educationStage&&e.enrollmentYear?i(e.educationStage,e.enrollmentYear,new Date,"zh",r):null}e.s(["K",0,["fixed","ai"],"L",0,n,"Z",0,function(e,i=t.J){let s=n(e,i),a=s?r.T.findIndex(e=>s.startsWith(e)):-1;return{grade:a>=0&&a<12?a+1:null,gradeSemester:s}},"P",0,function(e,t){return"ai"===e.gradeRecognitionMode&&void 0===t.gradeSemester&&void 0===t.recognizedGradeSemester&&!!t.questionText?.trim()},"X",0,s,"S",0,function(e,i,r=t.J){return void 0!==i.gradeSemester?i.gradeSemester?.trim()||null:"ai"===e.gradeRecognitionMode?s(i.recognizedGradeSemester):n(e,r)}],357189)},481183,e=>{function t(e){let t=e.length;for(;t>0&&"/"===e[t-1];)t--;return e.slice(0,t)}e.s(["$",0,function(e){let i;try{i=new URL(e)}catch{throw Error(`Invalid base URL: ${e}`)}if("http:"!==i.protocol&&"https:"!==i.protocol)throw Error(`Base URL must use http or https: ${e}`);return t(i.toString())},"z",0,t])}],426900,(e,t,i)=>{!function(i,r){var s={};r(s);var n=s.default;for(var a in s)n[a]=s[a];if("object"==typeof t.exports)t.exports=n;else if("function"==typeof define&&define.amd)e.r,void 0!==n&&e.v(n);else i.sha256=n}(e.e,function(e){"use strict";e.__esModule=!0,e.digestLength=32,e.blockSize=64;var t=new Uint32Array([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]);function i(e,i,r,s,n){for(var a,o,l,c,u,h,d,p,_,f,g,m,v;n>=64;){for(a=i[0],o=i[1],l=i[2],c=i[3],u=i[4],h=i[5],d=i[6],p=i[7],f=0;f<16;f++)g=s+4*f,e[f]=(255&r[g])<<24|(255&r[g+1])<<16|(255&r[g+2])<<8|255&r[g+3];for(f=16;f<64;f++)m=((_=e[f-2])>>>17|_<<15)^(_>>>19|_<<13)^_>>>10,v=((_=e[f-15])>>>7|_<<25)^(_>>>18|_<<14)^_>>>3,e[f]=(m+e[f-7]|0)+(v+e[f-16]|0);for(f=0;f<64;f++)m=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&h^~u&d)|0)+(p+(t[f]+e[f]|0)|0)|0,v=((a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10))+(a&o^a&l^o&l)|0,p=d,d=h,h=u,u=c+m|0,c=l,l=o,o=a,a=m+v|0;i[0]+=a,i[1]+=o,i[2]+=l,i[3]+=c,i[4]+=u,i[5]+=h,i[6]+=d,i[7]+=p,s+=64,n-=64}return s}var r=function(){function t(){this.digestLength=e.digestLength,this.blockSize=e.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return t.prototype.reset=function(){return this.state[0]=0x6a09e667,this.state[1]=0xbb67ae85,this.state[2]=0x3c6ef372,this.state[3]=0xa54ff53a,this.state[4]=0x510e527f,this.state[5]=0x9b05688c,this.state[6]=0x1f83d9ab,this.state[7]=0x5be0cd19,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},t.prototype.clean=function(){for(var e=0;e<this.buffer.length;e++)this.buffer[e]=0;for(var e=0;e<this.temp.length;e++)this.temp[e]=0;this.reset()},t.prototype.update=function(e,t){if(void 0===t&&(t=e.length),this.finished)throw Error("SHA256: can't update because hash was finished.");var r=0;if(this.bytesHashed+=t,this.bufferLength>0){for(;this.bufferLength<64&&t>0;)this.buffer[this.bufferLength++]=e[r++],t--;64===this.bufferLength&&(i(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(t>=64&&(r=i(this.temp,this.state,e,r,t),t%=64);t>0;)this.buffer[this.bufferLength++]=e[r++],t--;return this},t.prototype.finish=function(e){if(!this.finished){var t=this.bytesHashed,r=this.bufferLength,s=t/0x20000000|0,n=t<<3,a=t%64<56?64:128;this.buffer[r]=128;for(var o=r+1;o<a-8;o++)this.buffer[o]=0;this.buffer[a-8]=s>>>24&255,this.buffer[a-7]=s>>>16&255,this.buffer[a-6]=s>>>8&255,this.buffer[a-5]=s>>>0&255,this.buffer[a-4]=n>>>24&255,this.buffer[a-3]=n>>>16&255,this.buffer[a-2]=n>>>8&255,this.buffer[a-1]=n>>>0&255,i(this.temp,this.state,this.buffer,0,a),this.finished=!0}for(var o=0;o<8;o++)e[4*o+0]=this.state[o]>>>24&255,e[4*o+1]=this.state[o]>>>16&255,e[4*o+2]=this.state[o]>>>8&255,e[4*o+3]=this.state[o]>>>0&255;return this},t.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},t.prototype._saveState=function(e){for(var t=0;t<this.state.length;t++)e[t]=this.state[t]},t.prototype._restoreState=function(e,t){for(var i=0;i<this.state.length;i++)this.state[i]=e[i];this.bytesHashed=t,this.finished=!1,this.bufferLength=0},t}();e.Hash=r;var s=function(){function e(e){this.inner=new r,this.outer=new r,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var t=new Uint8Array(this.blockSize);if(e.length>this.blockSize)new r().update(e).finish(t).clean();else for(var i=0;i<e.length;i++)t[i]=e[i];for(var i=0;i<t.length;i++)t[i]^=54;this.inner.update(t);for(var i=0;i<t.length;i++)t[i]^=106;this.outer.update(t),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var i=0;i<t.length;i++)t[i]=0}return e.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},e.prototype.clean=function(){for(var e=0;e<this.istate.length;e++)this.ostate[e]=this.istate[e]=0;this.inner.clean(),this.outer.clean()},e.prototype.update=function(e){return this.inner.update(e),this},e.prototype.finish=function(e){return this.outer.finished?this.outer.finish(e):(this.inner.finish(e),this.outer.update(e,this.digestLength).finish(e)),this},e.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},e}();function n(e){var t=new r().update(e),i=t.digest();return t.clean(),i}function a(e,t){var i=new s(e).update(t),r=i.digest();return i.clean(),r}e.HMAC=s,e.hash=n,e.default=n,e.hmac=a;var o=new Uint8Array(e.digestLength);e.hkdf=function(e,t,i,r){void 0===t&&(t=o),void 0===r&&(r=32);for(var n=new Uint8Array([1]),l=new s(a(t,e)),c=new Uint8Array(l.digestLength),u=c.length,h=new Uint8Array(r),d=0;d<r;d++)u===c.length&&(!function(e,t,i,r){var s=r[0];if(0===s)throw Error("hkdf: cannot expand more");t.reset(),s>1&&t.update(e),i&&t.update(i),t.update(r),t.finish(e),r[0]++}(c,l,i,n),u=0),h[d]=c[u++];return l.clean(),c.fill(0),n.fill(0),h},e.pbkdf2=function(e,t,i,r){for(var n=new s(e),a=n.digestLength,o=new Uint8Array(4),l=new Uint8Array(a),c=new Uint8Array(a),u=new Uint8Array(r),h=0;h*a<r;h++){var d=h+1;o[0]=d>>>24&255,o[1]=d>>>16&255,o[2]=d>>>8&255,o[3]=d>>>0&255,n.reset(),n.update(t),n.update(o),n.finish(c);for(var p=0;p<a;p++)l[p]=c[p];for(var p=2;p<=i;p++){n.reset(),n.update(c).finish(c);for(var _=0;_<a;_++)l[_]^=c[_]}for(var p=0;p<a&&h*a+p<r;p++)u[h*a+p]=l[p]}for(var h=0;h<a;h++)l[h]=c[h]=0;for(var h=0;h<4;h++)o[h]=0;return n.clean(),u}})}];
|
|
12
|
+
${s.join("\n\n")}`:r}e.s(["S",0,60,"i",0,2e4,"$",0,function(e){let t=[];for(let i of a(e))(i||0!==t.length&&""!==t[t.length-1])&&t.push(i);for(;t.length>0&&""===t[t.length-1];)t.pop();return t},"T",0,R,"C",0,o,"J",0,function(e,t={}){let i,r,d=void 0===t.maxLength?2e4:Math.min(Math.max(t.maxLength,1e3),1e6),w=void 0===t.maxQuestions?60:Math.min(Math.max(t.maxQuestions,2),2e3),k=e.length>d,z=a(e.slice(0,d)),S=z.map(e=>e?s(e):null),V=z.length;for(let e=0;e<z.length;e++)if(u.test(z[e])){V=e;break}let $=[],T=[];for(let e=0;e<V;e++){let t=S[e];t&&("cn"===t.family?T:$).push({...t,line:e})}let P=new Set;for(let e=0;e<V;e++)(h.test(z[e])||S[e]?.family==="cn"||g(z[e],z.slice(e+1,e+5)))&&P.add(e);let E=[],O=m($,P);if(O.length<2){let e=m(T,new Set);e.length>=2&&(E=[{chain:e,sectionHeading:null}])}else E=function(e,t,i,r){if(e.length<2)return[];let s=e[0].family,n=[0];for(let t=1;t<e.length;t++)1===e[t].value&&n.push(t);if(n.length<2){let n=b(e[0].line,t,i,s,r);return null!==n?[{chain:e,sectionHeading:n}]:[]}let a=[];for(let o=0;o<n.length;o++){let l=n[o],c=o+1<n.length?n[o+1]:e.length,u=e.slice(l,c),h=0===o?b(e[0].line,t,i,s,r):function(e,t,i,r,s,n){for(let a=e+1;a<t;a++)if(i[a]&&(n.has(a)||v(i[a],r[a],s)||g(i[a])))return i[a];return null}(e[l-1].line,e[l].line,t,i,s,r);if(null===h&&o>0){a[a.length-1].chain.push(...u);continue}a.push({chain:u,sectionHeading:h})}return a.filter(e=>e.chain.length>0)}(O,z,S,P);let M=E.length?E.flatMap(e=>e.chain):O,L=o(z.slice(0,V)),N=V<z.length?f(z.slice(V)):[],C=(r=s(z[M[0]?.line??0]??""))?r.label:null,j=e=>({questions:L?[{label:C,text:L,material:null,section:null,lineRange:{from:0,to:V}}]:[],ignored:N,detected:!1,ambiguous:e,candidateCount:e?M.length:+!!L,overflow:0,tooLong:k});if(M.length<2){if(!L)return j(!1);let e=x(L.split("\n")),t=j(!1);if(t.questions.length>0&&Object.keys(e.fields).length>0&&(t.questions[0]={...t.questions[0],text:n(e.text),...e.fields}),t.questions.length>0&&N.length){let[e,i]=q(N,t.questions);t.ignored=e,i||(t.ignored=N)}return t}let D=M[0].family;if(!t.forceNumbered&&function(e,t,i,r){let s=null;for(let n=t-1;n>=0;n--)if(e[n]){s=v(e[n],r[n],i)?null:e[n];break}return!(!s||l.test(s)||p.test(s))&&("paren"===i?s.length>=15||/[。?!?!::,,;;]$/.test(s):/[::]$/.test(s)&&_.test(s))}(z,M[0].line,D,S)){let e=j(!0);if(e.questions.length>0&&L){let t=x(L.split("\n"));Object.keys(t.fields).length>0&&(e.questions[0]={...e.questions[0],text:n(t.text),...t.fields})}return e}let U=new Set(M.map(e=>e.line)),W=[],F=[],H=null,B=[],K=[],J=(e,t)=>{for(let i of f(e))(!l.test(i)||!(i.length<80))&&(c.test(i)||i.length>=80&&/[。!?.!?;;]/.test(i))?B.push({text:i,range:y(i)}):t?W.push(i):H&&!F.some(e=>e.section===H)?H=`${H}
|
|
13
|
+
${i}`:W.push(i)},G=M[0].line,X=[];for(let e=0;e<G;e++)z[e]&&(v(z[e],S[e],D)||g(z[e],z.slice(e+1,e+5)))?(J(X.splice(0),!0),H=z[e],K=[]):X.push(z[e]);J(X,!0);let Q=E.length>1,Y=e=>{if(!Q)return -1;let t=0;for(let i=0;i<E.length;i++)if(e<(t+=E[i].chain.length))return i;return E.length-1};for(let e=0;e<M.length;e++){let t=M[e].line,i=e+1<M.length?M[e+1].line:V,r=Y(e);if(Q&&r>=0){let e=E[r].sectionHeading;null!==e&&(H=e,K=[])}B.length&&(K=[...K.filter(e=>e.range),...B],B=[]);let s=i,a=null;for(let e=t+1;e<i;e++)if(z[e]&&!U.has(e)&&v(z[e],S[e],D)){s=e,a=z[e];break}let l=z.slice(t,s),u=f(l),h=[];for(;u.length>1&&c.test(u[u.length-1].slice(0,30));)h.unshift(u.pop());let d=h.length?u.join("\n"):o(l),p=M[e].value,_=K.filter(e=>!e.range||p>=e.range.from&&p<=e.range.to),g=x(n(d).split("\n"));for(let r of(F.push({label:M[e].label,text:g.text,material:_.length?_.map(e=>e.text).join("\n\n"):null,section:H,lineRange:{from:t,to:i},...g.fields}),h))B.push({text:r,range:y(r)});null!==a&&(H=a,K=[],J(z.slice(s+1,i),!1))}if(Q&&N.length){let e=E.map(e=>e.sectionHeading).filter(e=>null!==e),t=N.join("\n");i=e.some(e=>t.includes(e))?function(e,t,i){let r=[],s=0,n=t.map(e=>{let t=i.slice(s,s+e.chain.length);return s+=e.chain.length,t}),a=-1;for(let s of e){let e=s.split("\n"),o=[],l=!1;for(let r of e){let e=r.trim();if(!e){o.push(r);continue}let s=t.findIndex(t=>t.sectionHeading&&e.includes(t.sectionHeading));if(s>=0){a=s;continue}let c=A(e);if(!c){o.push(r);continue}let u=a>=0?n[a]:i,h=!1;for(let e of c){let t=u.find(t=>t.label===e.label);if(!t){o.push(r);break}h=!0,l=!0;let i=I(e.text);i.answer&&!t.answer&&(t.answer=i.answer),i.analysis&&(t.analysis=t.analysis?`${t.analysis}
|
|
14
|
+
${i.analysis}`:i.analysis)}h||o.includes(r)||o.push(r)}l?o.length&&r.push(o.join("\n")):r.push(s)}return r}(N,E,F):N}else i=q(N,F)[0];let Z=F.slice(w);return{questions:F.slice(0,w),ignored:[...W,...i,...Z.map(e=>R(e))],detected:!0,ambiguous:!1,candidateCount:F.length,overflow:Z.length,tooLong:k}},"e",0,function(e){let i=e.split("\n"),r=i[0]?.replace(t,"")??"",n=s(r);return n?.family==="dot"&&(i[0]=r.slice(n.prefixLength)),i.join("\n")},"N",0,n])},357189,539811,e=>{var t=e.i(376025);function i(e,r,s=new Date,n="en",a=t.J){let o=(0,t.c)(s,a),l=o.getFullYear(),c=o.getMonth()+1,u=l-r,h="2nd";c>=9?(u+=1,h="1st"):h=c<2?"1st":"2nd";let d="zh"===n,p=d?"1st"===h?"上期":"下期":"1st"===h?"1st Semester":"2nd Semester",_=(d?{primary:["一年级","二年级","三年级","四年级","五年级","六年级"],junior_high:["初一","初二","初三"],senior_high:["高一","高二","高三"],university:["大一","大二","大三","大四"]}:{primary:["Grade 1","Grade 2","Grade 3","Grade 4","Grade 5","Grade 6"],junior_high:["Junior High Grade 1","Junior High Grade 2","Junior High Grade 3"],senior_high:["Senior High Grade 1","Senior High Grade 2","Senior High Grade 3"],university:["Freshman","Sophomore","Junior","Senior"]})[e]||[],f=`${u}`;if(f=u>0&&u<=_.length?_[u-1]:u>_.length?d?"已毕业":"Graduated":d?"学前":"Pre-school",!d)return`${f}, ${p}`;{let e="1st"===h?"上":"下";return`${f}${e}`}}e.s(["f",0,i],539811);var r=e.i(411706);function s(e){if("string"!=typeof e)return null;let t=e.trim();return r.H.includes(t)?t:null}function n(e,r=t.J){return"ai"===e.gradeRecognitionMode?null:e.fixedGradeSemester?e.fixedGradeSemester:e.educationStage&&e.enrollmentYear?i(e.educationStage,e.enrollmentYear,new Date,"zh",r):null}e.s(["K",0,["fixed","ai"],"L",0,n,"Z",0,function(e,i=t.J){let s=n(e,i),a=s?r.T.findIndex(e=>s.startsWith(e)):-1;return{grade:a>=0&&a<12?a+1:null,gradeSemester:s}},"P",0,function(e,t){return"ai"===e.gradeRecognitionMode&&void 0===t.gradeSemester&&void 0===t.recognizedGradeSemester&&!!t.questionText?.trim()},"X",0,s,"S",0,function(e,i,r=t.J){return void 0!==i.gradeSemester?i.gradeSemester?.trim()||null:"ai"===e.gradeRecognitionMode?s(i.recognizedGradeSemester):n(e,r)}],357189)},481183,e=>{function t(e){let t=e.length;for(;t>0&&"/"===e[t-1];)t--;return e.slice(0,t)}e.s(["$",0,function(e){let i;try{i=new URL(e)}catch{throw Error(`Invalid base URL: ${e}`)}if("http:"!==i.protocol&&"https:"!==i.protocol)throw Error(`Base URL must use http or https: ${e}`);return t(i.toString())},"z",0,t])}],426900,(e,t,i)=>{!function(i,r){var s={};r(s);var n=s.default;for(var a in s)n[a]=s[a];if("object"==typeof t.exports)t.exports=n;else if("function"==typeof define&&define.amd)e.r,void 0!==n&&e.v(n);else i.sha256=n}(e.e,function(e){"use strict";e.__esModule=!0,e.digestLength=32,e.blockSize=64;var t=new Uint32Array([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]);function i(e,i,r,s,n){for(var a,o,l,c,u,h,d,p,_,f,g,m,v;n>=64;){for(a=i[0],o=i[1],l=i[2],c=i[3],u=i[4],h=i[5],d=i[6],p=i[7],f=0;f<16;f++)g=s+4*f,e[f]=(255&r[g])<<24|(255&r[g+1])<<16|(255&r[g+2])<<8|255&r[g+3];for(f=16;f<64;f++)m=((_=e[f-2])>>>17|_<<15)^(_>>>19|_<<13)^_>>>10,v=((_=e[f-15])>>>7|_<<25)^(_>>>18|_<<14)^_>>>3,e[f]=(m+e[f-7]|0)+(v+e[f-16]|0);for(f=0;f<64;f++)m=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&h^~u&d)|0)+(p+(t[f]+e[f]|0)|0)|0,v=((a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10))+(a&o^a&l^o&l)|0,p=d,d=h,h=u,u=c+m|0,c=l,l=o,o=a,a=m+v|0;i[0]+=a,i[1]+=o,i[2]+=l,i[3]+=c,i[4]+=u,i[5]+=h,i[6]+=d,i[7]+=p,s+=64,n-=64}return s}var r=function(){function t(){this.digestLength=e.digestLength,this.blockSize=e.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return t.prototype.reset=function(){return this.state[0]=0x6a09e667,this.state[1]=0xbb67ae85,this.state[2]=0x3c6ef372,this.state[3]=0xa54ff53a,this.state[4]=0x510e527f,this.state[5]=0x9b05688c,this.state[6]=0x1f83d9ab,this.state[7]=0x5be0cd19,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},t.prototype.clean=function(){for(var e=0;e<this.buffer.length;e++)this.buffer[e]=0;for(var e=0;e<this.temp.length;e++)this.temp[e]=0;this.reset()},t.prototype.update=function(e,t){if(void 0===t&&(t=e.length),this.finished)throw Error("SHA256: can't update because hash was finished.");var r=0;if(this.bytesHashed+=t,this.bufferLength>0){for(;this.bufferLength<64&&t>0;)this.buffer[this.bufferLength++]=e[r++],t--;64===this.bufferLength&&(i(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(t>=64&&(r=i(this.temp,this.state,e,r,t),t%=64);t>0;)this.buffer[this.bufferLength++]=e[r++],t--;return this},t.prototype.finish=function(e){if(!this.finished){var t=this.bytesHashed,r=this.bufferLength,s=t/0x20000000|0,n=t<<3,a=t%64<56?64:128;this.buffer[r]=128;for(var o=r+1;o<a-8;o++)this.buffer[o]=0;this.buffer[a-8]=s>>>24&255,this.buffer[a-7]=s>>>16&255,this.buffer[a-6]=s>>>8&255,this.buffer[a-5]=s>>>0&255,this.buffer[a-4]=n>>>24&255,this.buffer[a-3]=n>>>16&255,this.buffer[a-2]=n>>>8&255,this.buffer[a-1]=n>>>0&255,i(this.temp,this.state,this.buffer,0,a),this.finished=!0}for(var o=0;o<8;o++)e[4*o+0]=this.state[o]>>>24&255,e[4*o+1]=this.state[o]>>>16&255,e[4*o+2]=this.state[o]>>>8&255,e[4*o+3]=this.state[o]>>>0&255;return this},t.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},t.prototype._saveState=function(e){for(var t=0;t<this.state.length;t++)e[t]=this.state[t]},t.prototype._restoreState=function(e,t){for(var i=0;i<this.state.length;i++)this.state[i]=e[i];this.bytesHashed=t,this.finished=!1,this.bufferLength=0},t}();e.Hash=r;var s=function(){function e(e){this.inner=new r,this.outer=new r,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var t=new Uint8Array(this.blockSize);if(e.length>this.blockSize)new r().update(e).finish(t).clean();else for(var i=0;i<e.length;i++)t[i]=e[i];for(var i=0;i<t.length;i++)t[i]^=54;this.inner.update(t);for(var i=0;i<t.length;i++)t[i]^=106;this.outer.update(t),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate);for(var i=0;i<t.length;i++)t[i]=0}return e.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},e.prototype.clean=function(){for(var e=0;e<this.istate.length;e++)this.ostate[e]=this.istate[e]=0;this.inner.clean(),this.outer.clean()},e.prototype.update=function(e){return this.inner.update(e),this},e.prototype.finish=function(e){return this.outer.finished?this.outer.finish(e):(this.inner.finish(e),this.outer.update(e,this.digestLength).finish(e)),this},e.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},e}();function n(e){var t=new r().update(e),i=t.digest();return t.clean(),i}function a(e,t){var i=new s(e).update(t),r=i.digest();return i.clean(),r}e.HMAC=s,e.hash=n,e.default=n,e.hmac=a;var o=new Uint8Array(e.digestLength);e.hkdf=function(e,t,i,r){void 0===t&&(t=o),void 0===r&&(r=32);for(var n=new Uint8Array([1]),l=new s(a(t,e)),c=new Uint8Array(l.digestLength),u=c.length,h=new Uint8Array(r),d=0;d<r;d++)u===c.length&&(!function(e,t,i,r){var s=r[0];if(0===s)throw Error("hkdf: cannot expand more");t.reset(),s>1&&t.update(e),i&&t.update(i),t.update(r),t.finish(e),r[0]++}(c,l,i,n),u=0),h[d]=c[u++];return l.clean(),c.fill(0),n.fill(0),h},e.pbkdf2=function(e,t,i,r){for(var n=new s(e),a=n.digestLength,o=new Uint8Array(4),l=new Uint8Array(a),c=new Uint8Array(a),u=new Uint8Array(r),h=0;h*a<r;h++){var d=h+1;o[0]=d>>>24&255,o[1]=d>>>16&255,o[2]=d>>>8&255,o[3]=d>>>0&255,n.reset(),n.update(t),n.update(o),n.finish(c);for(var p=0;p<a;p++)l[p]=c[p];for(var p=2;p<=i;p++){n.reset(),n.update(c).finish(c);for(var _=0;_<a;_++)l[_]^=c[_]}for(var p=0;p<a&&h*a+p<r;p++)u[h*a+p]=l[p]}for(var h=0;h<a;h++)l[h]=c[h]=0;for(var h=0;h<4;h++)o[h]=0;return n.clean(),u}})}];
|
|
15
15
|
|
|
16
|
-
//# sourceMappingURL=
|
|
16
|
+
//# sourceMappingURL=_0sreqb-d5c0h6._.js.map
|