@rabbi696/ezrouter 0.6.11 → 0.6.12
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/app/.next-cli-build/BUILD_ID +1 -1
- package/app/.next-cli-build/app-path-routes-manifest.json +3 -3
- package/app/.next-cli-build/build-manifest.json +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/convoy/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/error-log/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mcp-gateway/keys/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mcp-gateway/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mcp-gateway/servers/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/routing-health/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error.html +1 -1
- package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_not-found.html +1 -1
- package/app/.next-cli-build/server/app/_not-found.rsc +3 -3
- package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/api/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/test-batch/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/route.js +1 -1
- package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/callback.html +1 -1
- package/app/.next-cli-build/server/app/callback.rsc +3 -3
- package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/convoy.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/convoy.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/convoy.segments/!KGRhc2hib2FyZCk/dashboard/convoy/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/convoy.segments/!KGRhc2hib2FyZCk/dashboard/convoy.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/convoy.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/convoy.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/convoy.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/convoy.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/convoy.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/convoy.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway/keys.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway/keys.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway/keys.segments/!KGRhc2hib2FyZCk/dashboard/mcp-gateway/keys/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway/keys.segments/!KGRhc2hib2FyZCk/dashboard/mcp-gateway/keys.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway/keys.segments/!KGRhc2hib2FyZCk/dashboard/mcp-gateway.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway/keys.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway/keys.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway/keys.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway/keys.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway/keys.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway/keys.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway/servers.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway/servers.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway/servers.segments/!KGRhc2hib2FyZCk/dashboard/mcp-gateway/servers/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway/servers.segments/!KGRhc2hib2FyZCk/dashboard/mcp-gateway/servers.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway/servers.segments/!KGRhc2hib2FyZCk/dashboard/mcp-gateway.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway/servers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway/servers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway/servers.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway/servers.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway/servers.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway/servers.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway.segments/!KGRhc2hib2FyZCk/dashboard/mcp-gateway/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway.segments/!KGRhc2hib2FyZCk/dashboard/mcp-gateway.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/mcp-gateway.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.html +2 -2
- package/app/.next-cli-build/server/app/dashboard/quota.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/routing-health.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/routing-health.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/routing-health.segments/!KGRhc2hib2FyZCk/dashboard/routing-health/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/routing-health.segments/!KGRhc2hib2FyZCk/dashboard/routing-health.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/routing-health.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/routing-health.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/routing-health.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/routing-health.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/routing-health.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/routing-health.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard.html +1 -1
- package/app/.next-cli-build/server/app/dashboard.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/index.html +1 -1
- package/app/.next-cli-build/server/app/index.rsc +3 -3
- package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/index.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/index.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/landing.html +1 -1
- package/app/.next-cli-build/server/app/landing.rsc +3 -3
- package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/login.html +1 -1
- package/app/.next-cli-build/server/app/login.rsc +4 -4
- package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +3 -3
- package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app-paths-manifest.json +3 -3
- package/app/.next-cli-build/server/chunks/2021.js +1 -1
- package/app/.next-cli-build/server/chunks/3886.js +1 -1
- package/app/.next-cli-build/server/chunks/3977.js +1 -1
- package/app/.next-cli-build/server/chunks/412.js +1 -1
- package/app/.next-cli-build/server/chunks/4208.js +1 -1
- package/app/.next-cli-build/server/chunks/4827.js +1 -1
- package/app/.next-cli-build/server/chunks/7775.js +1 -1
- package/app/.next-cli-build/server/chunks/8306.js +1 -1
- package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
- package/app/.next-cli-build/server/pages/404.html +1 -1
- package/app/.next-cli-build/server/pages/500.html +1 -1
- package/app/.next-cli-build/static/chunks/{1321-28c50cf30d629b3c.js → 1321-47f236257542fa9d.js} +1 -1
- package/app/.next-cli-build/static/chunks/{5497-3d7a0fb93236c34a.js → 5497-8d7a375ff775ac38.js} +3 -3
- package/app/CHANGELOG.md +2 -1
- package/app/package.json +1 -1
- package/package.json +1 -1
- /package/app/.next-cli-build/static/{5WoZ9O2i6m7EB5bVhSiW3 → z2OLdTW4c54InBRDXKviL}/_buildManifest.js +0 -0
- /package/app/.next-cli-build/static/{5WoZ9O2i6m7EB5bVhSiW3 → z2OLdTW4c54InBRDXKviL}/_ssgManifest.js +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
exports.id=3977,exports.ids=[3977,9485,9718],exports.modules={4630:(a,b,c)=>{"use strict";c.d(b,{Ak:()=>e,Yg:()=>h,sr:()=>d.sr,xq:()=>d.xq});var d=c(39141);function e(a){return(a?.providerSpecificData?.baseUrl?.trim()||"http://localhost:11434").replace(/\/$/,"")}let f=d.xq["xiaomi-tokenplan"]?.regions||{},g=d.xq["xiaomi-tokenplan"]?.defaultRegion;function h(a){return f[a?.providerSpecificData?.region]||f[g]}},19956:(a,b,c)=>{"use strict";c.d(b,{h:()=>d,t:()=>e});let d={OPENAI:"openai",OPENAI_RESPONSES:"openai-responses",OPENAI_RESPONSE:"openai-response",CLAUDE:"claude",GEMINI:"gemini",GEMINI_CLI:"gemini-cli",VERTEX:"vertex",CODEX:"codex",ANTIGRAVITY:"antigravity",KIRO:"kiro",CURSOR:"cursor",OLLAMA:"ollama",COMMANDCODE:"commandcode"};function e(a,b){return a.includes("/v1/responses")?d.OPENAI_RESPONSES:a.includes("/v1/messages")?d.CLAUDE:a.includes("/v1/chat/completions")&&Array.isArray(b?.input)?d.OPENAI:null}},21350:(a,b,c)=>{"use strict";c.r(b),c.d(b,{DELETE:()=>S,GET:()=>Q,POST:()=>R});var d=c(49796),e=c(23211),f=c(79748),g=c.n(f),h=c(33873),i=c.n(h),j=c(21820),k=c.n(j),l=c(55511),m=c.n(l),n=c(28286),o=c(30869),p=c(54603),q=c(68658),r=c(24424);async function s(a){return!!(await (0,q.gN)(a)||await (0,q.wR)(a))}let t=o.h0.appPort,u=`http://localhost:${t}/api/mcp/`,v=null,w=async()=>(v||(v=await (0,p.Xj)("9r-cli-auth")),v),x=async a=>{let b=await w();for(let c of a)"string"==typeof c?.url&&c.url.startsWith(u)&&(c.headers={...c.headers||{},"x-9r-cli-token":b});return a},y="gateway",z={coworkEgressAllowedHosts:["*"],disabledBuiltinTools:[],isLocalDevMcpEnabled:!0,isDesktopExtensionEnabled:!0,isDesktopExtensionDirectoryEnabled:!0,isDesktopExtensionSignatureRequired:!1,isClaudeCodeForDesktopEnabled:!0,disableEssentialTelemetry:!0,disableNonessentialTelemetry:!0,disableNonessentialServices:!0},A=()=>{if("darwin"===k().platform()){let a=i().join(k().homedir(),"Library","Application Support");return[i().join(a,"Claude-3p"),i().join(a,"Claude")]}if("win32"===k().platform()){let a=process.env.LOCALAPPDATA||i().join(k().homedir(),"AppData","Local"),b=process.env.APPDATA||i().join(k().homedir(),"AppData","Roaming");return[i().join(a,"Claude-3p"),i().join(b,"Claude-3p"),i().join(a,"Claude"),i().join(b,"Claude")]}return[i().join(k().homedir(),".config","Claude-3p"),i().join(k().homedir(),".config","Claude")]},B=async()=>{let a=A();for(let b of a)try{return await g().access(i().join(b,"configLibrary")),b}catch{}return a[0]},C=()=>A()[0],D=async()=>i().join(await B(),"configLibrary"),E=()=>i().join(C(),"configLibrary"),F=async()=>i().join(await D(),"_meta.json"),G=()=>{if("darwin"===k().platform())return i().join(k().homedir(),"Library","Application Support","Claude");if("win32"===k().platform()){let a=process.env.APPDATA||i().join(k().homedir(),"AppData","Roaming");return i().join(a,"Claude")}return i().join(k().homedir(),".config","Claude")},H=()=>i().join(G(),"claude_desktop_config.json"),I=async()=>{try{let a=(await g().readFile(H(),"utf-8")).replace(/,(\s*[}\]])/g,"$1");return JSON.parse(a)||{}}catch(a){return{}}},J=async a=>{await g().mkdir(G(),{recursive:!0}),await g().writeFile(H(),JSON.stringify(a,null,2))},K=async()=>{let a=await I();return"3p"!==a.deploymentMode&&(a.deploymentMode="3p",await J(a),!0)},L=async()=>{let a=await I();if(!a.mcpServers||"object"!=typeof a.mcpServers)return;let b=new Set(n.LOCAL_STDIO_PLUGINS.map(a=>a.name));for(let c of Object.keys(a.mcpServers))b.has(c)&&delete a.mcpServers[c];0===Object.keys(a.mcpServers).length&&delete a.mcpServers,await J(a)},M=async()=>{for(let a of[...A(),...(()=>{if("darwin"===k().platform())return["/Applications/Claude.app",i().join(k().homedir(),"Applications","Claude.app")];if("win32"===k().platform()){let a=process.env.LOCALAPPDATA||i().join(k().homedir(),"AppData","Local"),b=process.env.ProgramFiles||"C:\\Program Files";return[i().join(a,"AnthropicClaude"),i().join(b,"Claude"),i().join(b,"AnthropicClaude")]}return[]})()])try{return await g().access(a),!0}catch{}return!1},N=async a=>{try{let b=(await g().readFile(a,"utf-8")).replace(/,(\s*[}\]])/g,"$1");return JSON.parse(b)}catch(a){return null}},O=async()=>{let a=i().join(E(),"_meta.json"),b=await N(a);if(!b||!b.appliedId){let c=await N(await F());if(c?.appliedId)b=c;else{let a=m().randomUUID();b={appliedId:a,entries:[{id:a,name:"Default"}]}}await g().mkdir(E(),{recursive:!0}),await g().writeFile(a,JSON.stringify(b,null,2))}return b};async function P(a){let b=i().join(C(),"config.json"),c={};try{c=JSON.parse(await g().readFile(b,"utf-8"))||{}}catch(a){if("ENOENT"!==a.code)return{error:a.code}}let d={};for(let b of a)b?.name&&(d[b.name]=!0);return c.operonSkipMcpApprovals=d,await g().mkdir(C(),{recursive:!0}),await g().writeFile(b,JSON.stringify(c,null,2)),{written:Object.keys(d).length}}async function Q(a){if(!await s(a))return e.NextResponse.json({error:"Unauthorized"},{status:401});try{if(!await M())return e.NextResponse.json({installed:!1,config:null,message:"Claude Desktop (Cowork mode) not detected"});let a=await N(await F()),b=a?.appliedId||null,c=await D(),d=b?i().join(c,`${b}.json`):null,f=d?await N(d):null,g=f?.inferenceGatewayBaseUrl||null,h=Array.isArray(f?.inferenceModels)?f.inferenceModels.map(a=>"string"==typeof a?a:a?.name).filter(Boolean):[],j=Array.isArray(f?.managedMcpServers)?f.managedMcpServers:[],k=!!(f?.inferenceProvider===y&&g),l=new Set(n.LOCAL_STDIO_PLUGINS.map(a=>a.name)),m=j.filter(a=>l.has(a.name)&&"string"==typeof a.url&&a.url.includes("/api/mcp/")).map(a=>a.name),o=j.filter(a=>a.custom||!l.has(a.name)&&"string"==typeof a.url&&a.url.includes("/api/mcp/")).map(a=>({name:a.name,url:a.url,transport:a.transport,custom:!0}));return e.NextResponse.json({installed:!0,config:f,has9Router:k,configPath:d,cowork:{appliedId:b,baseUrl:g,models:h,provider:f?.inferenceProvider||null,plugins:j.filter(a=>!a.custom&&!(l.has(a.name)&&"string"==typeof a.url&&a.url.includes("/api/mcp/"))).map(a=>{let b=a.toolPolicy?Object.keys(a.toolPolicy):[],c=`${a.name}-`,d=new Set;for(let a of b){let b=a;for(;b.startsWith(c);)b=b.slice(c.length);d.add(b)}let e=n.DEFAULT_PLUGINS.find(b=>b.name===a.name),f=e&&Array.isArray(e.toolNames)?e.toolNames:Array.from(d);return{name:a.name,url:a.url,transport:a.transport,oauth:!!a.oauth,toolNames:f}}),localPlugins:m,customPlugins:o},defaultPlugins:n.DEFAULT_PLUGINS,localStdioPlugins:n.LOCAL_STDIO_PLUGINS})}catch(a){return console.log("Error reading cowork settings:",a),e.NextResponse.json({error:"Failed to read cowork settings"},{status:500})}}async function R(a){if(!await s(a))return e.NextResponse.json({error:"Unauthorized"},{status:401});try{let{baseUrl:b,apiKey:c,models:d,plugins:f,localPlugins:h,customPlugins:j}=await a.json();if(!b||!c)return e.NextResponse.json({error:"baseUrl and apiKey are required"},{status:400});let k=Array.isArray(d)?d.filter(a=>"string"==typeof a&&a.trim()):[];if(0===k.length)return e.NextResponse.json({error:"At least one model is required"},{status:400});let l=Array.isArray(f)?f:n.DEFAULT_PLUGINS,m=Array.isArray(h)?h:[],o=(Array.isArray(j)?j:[]).filter(a=>a?.url),p=await x((a=>{let b=Array.isArray(a)?a:[],c=[];for(let a of b){let b=n.LOCAL_STDIO_PLUGINS.find(b=>b.name===a);if(!b)continue;let d={name:b.name,url:`http://localhost:${t}/api/mcp/${b.name}/sse`,transport:"sse"};if(Array.isArray(b.toolNames)&&b.toolNames.length>0){let a=`${b.name}-`,c={};for(let d of b.toolNames)c[d]="allow",c[`${a}${d}`]="allow";d.toolPolicy=c}c.push(d)}return c})(m)),q=await x((a=>{if(!Array.isArray(a))return[];let b=[];for(let c of a)c?.name&&c?.url&&b.push({name:c.name,url:c.url,transport:c.transport||"sse",custom:!0});return b})(o)),r=[...(0,n.buildManagedMcpServers)(l),...p,...q],s=await K(),u=await O(),v=i().join(E(),`${u.appliedId}.json`),w={...z,inferenceProvider:y,inferenceGatewayBaseUrl:b,inferenceGatewayApiKey:c,inferenceModels:k.map(a=>({name:a}))};r.length>0&&(w.managedMcpServers=r),await g().writeFile(v,JSON.stringify(w,null,2));let A=null;try{A=await P(r)}catch(a){A={error:a.message}}try{await L()}catch{}return e.NextResponse.json({success:!0,bootstrapped:s,message:s?"Cowork enabled (3p mode set). Quit & reopen Claude Desktop.":"Cowork settings applied. Quit & reopen Claude Desktop.",configPath:v,skipApprovals:A,localMcp:{applied:m,via:"3p-sse-bridge"}})}catch(a){return console.log("Error applying cowork settings:",a),e.NextResponse.json({error:"Failed to apply cowork settings"},{status:500})}}async function S(a){if(!await s(a))return e.NextResponse.json({error:"Unauthorized"},{status:401});try{let a=await N(await F());if(!a?.appliedId)return e.NextResponse.json({success:!0,message:"No active config to reset"});let b=i().join(await D(),`${a.appliedId}.json`);try{await g().writeFile(b,JSON.stringify({},null,2))}catch(a){if("ENOENT"!==a.code)throw a}try{await P([])}catch{}try{await L()}catch{}return e.NextResponse.json({success:!0,message:"Cowork config reset"})}catch(a){return console.log("Error resetting cowork settings:",a),e.NextResponse.json({error:"Failed to reset cowork settings"},{status:500})}}(0,r.D)([Q,R,S]),(0,d.A)(Q,"4085f3cfb4938799ce5a0538d337fde0b8e8b0f22e",null),(0,d.A)(R,"40306faa9d9e22c69592746d4c660ca5d4dbdc2c5f",null),(0,d.A)(S,"40cc849095c06ecb44c2ca4581b08bc9686fd23e40",null)},24424:(a,b)=>{"use strict";function c(a){for(let b=0;b<a.length;b++){let c=a[b];if("function"!=typeof c)throw Object.defineProperty(Error(`A "use server" file can only export async functions, found ${typeof c}.
|
|
2
|
-
Read more: https://nextjs.org/docs/messages/invalid-use-server-value`),"__NEXT_ERROR_CODE",{value:"E352",enumerable:!1,configurable:!0})}}Object.defineProperty(b,"D",{enumerable:!0,get:function(){return c}})},28286:a=>{"use strict";a.exports={DEFAULT_PLUGINS:[{name:"exa",title:"Exa",description:"Real-time web search and code documentation",url:"https://mcp.exa.ai/mcp",transport:"http",oauth:!1,toolNames:["web_search_exa","web_fetch_exa"]},{name:"tavily",title:"Tavily",description:"Real-time web search optimized for LLM agents",url:"https://mcp.tavily.com/mcp",transport:"http",oauth:!0,toolNames:["tavily_search","tavily_extract","tavily_crawl","tavily_map"]}],LOCAL_STDIO_PLUGINS:[{name:"browsermcp",title:"Browser MCP",description:"Control your running Chrome (requires Chrome extension)",extensionUrl:"https://chromewebstore.google.com/detail/browser-mcp-automate-your/bjfgambnhccakkhmkepdoekmckoijdlc",command:"npx",args:["-y","@browsermcp/mcp@latest"],toolNames:["browser_navigate","browser_snapshot","browser_click","browser_type","browser_screenshot","browser_get_console_logs","browser_wait","browser_press_key","browser_go_back","browser_go_forward"]}],buildManagedMcpServers:function(a){let b=Array.isArray(a)?a:[],c=[],d=new Set;for(let a of b){if(!a?.name||!a?.url||d.has(a.name))continue;d.add(a.name);let b={name:a.name,url:a.url,transport:a.transport||(/\/sse(\b|\/)/i.test(a.url)?"sse":"http")};if(a.oauth&&(b.oauth=!0),Array.isArray(a.toolNames)&&a.toolNames.length>0){let c=`${a.name}-`,d=new Set;for(let b of a.toolNames){if("string"!=typeof b||!b)continue;let a=b;for(;a.startsWith(c);)a=a.slice(c.length);d.add(a)}let e={};for(let a of d)e[a]="allow",e[`${c}${a}`]="allow";b.toolPolicy=e}c.push(b)}return c}}},29485:(a,b,c)=>{"use strict";c.d(b,{KC:()=>u,OA:()=>q,PROVIDER_MODELS:()=>f.vq,SM:()=>j,Xg:()=>t,cY:()=>v,ez:()=>p,fZ:()=>k,kt:()=>r,ux:()=>o});var d=c(4630),e=c(30717),f=c(39141),g=c(6595),h=c(8382),i=c(19956);function j(a){return f.vq[a]||[]}function k(a){let b=f.vq[a];return b?.[0]?.id||null}let l=new Set(["kr","kiro"]),m=new Map;for(let[a,b]of Object.entries(f.vq)){if(!Array.isArray(b))continue;let c=new Map,d=new Map;for(let e of b)if(e?.id!=null&&(c.set(e.id,e),l.has(a))){let a=(0,g.Kq)(e.id);a!==e.id&&d.set(a,e)}m.set(a,{exact:c,normalized:d})}function n(a,b,c){if(!a)return;let d="string"==typeof b?b.replace(/\([^()]+\)\s*$/,"").trim():b,e=m.get(c);if(e){let a=e.exact.get(d);return a||(e.normalized.size?e.normalized.get(d):void 0)}let f=a.find(a=>a.id===d);if(f)return f;if(!l.has(c))return;let h=(0,g.Kq)(d);if(h!==d)return a.find(a=>a.id===h)}function o(a,b){if((!a||"oc"===a||"opencode"===a||"ocg"===a||"opencode-go"===a)&&(0,h.d)(b))return i.h.OPENAI_RESPONSES;let c=t[a]||a,d=f.vq[c]||f.vq[a];return d?(0,g.gr)(n(d,b,c)):null}function p(a,b){let c=t[a]||a,d=f.vq[c]||f.vq[a];return d?(0,g.ec)(n(d,b,c)):null}function q(a,b){let c=t[a]||a,d=f.vq[c]||f.vq[a];if(!d)return null;let e=n(d,b,c);return e?.kind||e?.type||null}function r(a,b){let c=t[a]||a,d="string"==typeof b?b.match(/\([^()]+\)\s*$/):null,e=d?d[0]:"",g=e?b.slice(0,d.index).trim():b,i=n(f.vq[c]||f.vq[a],g,c),j=i?.upstreamModelId||i?.id;if(j){let a=j.match(/\([^()]+\)\s*$/),b=a?.[0]||"";return(b?j.slice(0,a.index).trim():j)+(e||b)}return"cx"===c&&"string"==typeof g&&g.endsWith(h.d5)?g.slice(0,-h.d5.length)+e:g+e}let s=Object.fromEntries(e.default.filter(a=>a.alias&&a.alias!==a.id).map(a=>[a.id,a.alias])),t=Object.fromEntries(Object.keys(d.xq).map(a=>[a,s[a]||a]));function u(a){let b=t[a]||a;return f.vq[b]||[]}function v(a,b){return(0,g.g5)(n(f.vq[a],b,a))}},30869:(a,b,c)=>{"use strict";c.d(b,{UY:()=>h,eh:()=>f.eh,fg:()=>e.fg,h0:()=>g,oc:()=>i});var d=c(39006),e=c(40615),f=c(81329);d.rE;let g={npmPackageName:"@rabbi696/ezrouter",installCmd:"npm i -g @rabbi696/ezrouter",installCmdLatest:"npm i -g @rabbi696/ezrouter@latest --prefer-online",shutdownCountdownSec:3,exitDelayMs:500,statusPort:20129,statusPollIntervalMs:1e3,statusLogTailLines:8,installRetries:3,installRetryDelayMs:5e3,lingerAfterDoneMs:3e4,waitForExitMinMs:5e3,waitForExitMaxMs:2e4,waitForExitCheckMs:500,appPort:20126},h={maxLines:200,pollIntervalMs:1e3,streamTimeoutMs:5e3},i={tickIntervalMs:6e4,pingLeadMs:5e3,refreshAheadMs:3e5,failureCooldownMs:9e5,providers:{claude:{settingsKey:"claudeAutoPing",quotaKey:"session (5h)",pingInactiveSession:!0,inactiveMinPingIntervalMs:18e6,pingModel:"claude-haiku-4-5-20251001",pingText:"hi",pingMaxTokens:1},codex:{settingsKey:"codexAutoPing",quotaKey:"session",pingWhenResetAtSlides:!0,resetAtDriftMs:3e4,minPingIntervalMs:6e5,skipWhenBlockingQuotaExhausted:!0,pingText:"hi",pingInstructions:"Reply with OK.",pingReasoningEffort:"none"}}}},39006:a=>{"use strict";a.exports={rE:"0.6.
|
|
2
|
+
Read more: https://nextjs.org/docs/messages/invalid-use-server-value`),"__NEXT_ERROR_CODE",{value:"E352",enumerable:!1,configurable:!0})}}Object.defineProperty(b,"D",{enumerable:!0,get:function(){return c}})},28286:a=>{"use strict";a.exports={DEFAULT_PLUGINS:[{name:"exa",title:"Exa",description:"Real-time web search and code documentation",url:"https://mcp.exa.ai/mcp",transport:"http",oauth:!1,toolNames:["web_search_exa","web_fetch_exa"]},{name:"tavily",title:"Tavily",description:"Real-time web search optimized for LLM agents",url:"https://mcp.tavily.com/mcp",transport:"http",oauth:!0,toolNames:["tavily_search","tavily_extract","tavily_crawl","tavily_map"]}],LOCAL_STDIO_PLUGINS:[{name:"browsermcp",title:"Browser MCP",description:"Control your running Chrome (requires Chrome extension)",extensionUrl:"https://chromewebstore.google.com/detail/browser-mcp-automate-your/bjfgambnhccakkhmkepdoekmckoijdlc",command:"npx",args:["-y","@browsermcp/mcp@latest"],toolNames:["browser_navigate","browser_snapshot","browser_click","browser_type","browser_screenshot","browser_get_console_logs","browser_wait","browser_press_key","browser_go_back","browser_go_forward"]}],buildManagedMcpServers:function(a){let b=Array.isArray(a)?a:[],c=[],d=new Set;for(let a of b){if(!a?.name||!a?.url||d.has(a.name))continue;d.add(a.name);let b={name:a.name,url:a.url,transport:a.transport||(/\/sse(\b|\/)/i.test(a.url)?"sse":"http")};if(a.oauth&&(b.oauth=!0),Array.isArray(a.toolNames)&&a.toolNames.length>0){let c=`${a.name}-`,d=new Set;for(let b of a.toolNames){if("string"!=typeof b||!b)continue;let a=b;for(;a.startsWith(c);)a=a.slice(c.length);d.add(a)}let e={};for(let a of d)e[a]="allow",e[`${c}${a}`]="allow";b.toolPolicy=e}c.push(b)}return c}}},29485:(a,b,c)=>{"use strict";c.d(b,{KC:()=>u,OA:()=>q,PROVIDER_MODELS:()=>f.vq,SM:()=>j,Xg:()=>t,cY:()=>v,ez:()=>p,fZ:()=>k,kt:()=>r,ux:()=>o});var d=c(4630),e=c(30717),f=c(39141),g=c(6595),h=c(8382),i=c(19956);function j(a){return f.vq[a]||[]}function k(a){let b=f.vq[a];return b?.[0]?.id||null}let l=new Set(["kr","kiro"]),m=new Map;for(let[a,b]of Object.entries(f.vq)){if(!Array.isArray(b))continue;let c=new Map,d=new Map;for(let e of b)if(e?.id!=null&&(c.set(e.id,e),l.has(a))){let a=(0,g.Kq)(e.id);a!==e.id&&d.set(a,e)}m.set(a,{exact:c,normalized:d})}function n(a,b,c){if(!a)return;let d="string"==typeof b?b.replace(/\([^()]+\)\s*$/,"").trim():b,e=m.get(c);if(e){let a=e.exact.get(d);return a||(e.normalized.size?e.normalized.get(d):void 0)}let f=a.find(a=>a.id===d);if(f)return f;if(!l.has(c))return;let h=(0,g.Kq)(d);if(h!==d)return a.find(a=>a.id===h)}function o(a,b){if((!a||"oc"===a||"opencode"===a||"ocg"===a||"opencode-go"===a)&&(0,h.d)(b))return i.h.OPENAI_RESPONSES;let c=t[a]||a,d=f.vq[c]||f.vq[a];return d?(0,g.gr)(n(d,b,c)):null}function p(a,b){let c=t[a]||a,d=f.vq[c]||f.vq[a];return d?(0,g.ec)(n(d,b,c)):null}function q(a,b){let c=t[a]||a,d=f.vq[c]||f.vq[a];if(!d)return null;let e=n(d,b,c);return e?.kind||e?.type||null}function r(a,b){let c=t[a]||a,d="string"==typeof b?b.match(/\([^()]+\)\s*$/):null,e=d?d[0]:"",g=e?b.slice(0,d.index).trim():b,i=n(f.vq[c]||f.vq[a],g,c),j=i?.upstreamModelId||i?.id;if(j){let a=j.match(/\([^()]+\)\s*$/),b=a?.[0]||"";return(b?j.slice(0,a.index).trim():j)+(e||b)}return"cx"===c&&"string"==typeof g&&g.endsWith(h.d5)?g.slice(0,-h.d5.length)+e:g+e}let s=Object.fromEntries(e.default.filter(a=>a.alias&&a.alias!==a.id).map(a=>[a.id,a.alias])),t=Object.fromEntries(Object.keys(d.xq).map(a=>[a,s[a]||a]));function u(a){let b=t[a]||a;return f.vq[b]||[]}function v(a,b){return(0,g.g5)(n(f.vq[a],b,a))}},30869:(a,b,c)=>{"use strict";c.d(b,{UY:()=>h,eh:()=>f.eh,fg:()=>e.fg,h0:()=>g,oc:()=>i});var d=c(39006),e=c(40615),f=c(81329);d.rE;let g={npmPackageName:"@rabbi696/ezrouter",installCmd:"npm i -g @rabbi696/ezrouter",installCmdLatest:"npm i -g @rabbi696/ezrouter@latest --prefer-online",shutdownCountdownSec:3,exitDelayMs:500,statusPort:20129,statusPollIntervalMs:1e3,statusLogTailLines:8,installRetries:3,installRetryDelayMs:5e3,lingerAfterDoneMs:3e4,waitForExitMinMs:5e3,waitForExitMaxMs:2e4,waitForExitCheckMs:500,appPort:20126},h={maxLines:200,pollIntervalMs:1e3,streamTimeoutMs:5e3},i={tickIntervalMs:6e4,pingLeadMs:5e3,refreshAheadMs:3e5,failureCooldownMs:9e5,providers:{claude:{settingsKey:"claudeAutoPing",quotaKey:"session (5h)",pingInactiveSession:!0,inactiveMinPingIntervalMs:18e6,pingModel:"claude-haiku-4-5-20251001",pingText:"hi",pingMaxTokens:1},codex:{settingsKey:"codexAutoPing",quotaKey:"session",pingWhenResetAtSlides:!0,resetAtDriftMs:3e4,minPingIntervalMs:6e5,skipWhenBlockingQuotaExhausted:!0,pingText:"hi",pingInstructions:"Reply with OK.",pingReasoningEffort:"none"}}}},39006:a=>{"use strict";a.exports={rE:"0.6.12"}},49796:(a,b,c)=>{"use strict";Object.defineProperty(b,"A",{enumerable:!0,get:function(){return d.registerServerReference}});let d=c(77943)},77943:(a,b,c)=>{"use strict";a.exports=c(7553).vendored["react-rsc"].ReactServerDOMWebpackServer},78335:()=>{},81329:(a,b,c)=>{"use strict";c.d(b,{CP:()=>f,Xg:()=>d.Xg,bs:()=>g,eh:()=>e,vq:()=>d.PROVIDER_MODELS});var d=c(29485);Object.entries(c(40615).AI_PROVIDERS).filter(([,a])=>a.passthroughModels).map(([a])=>a);let e=Object.entries(d.PROVIDER_MODELS).flatMap(([a,b])=>b.map(b=>({provider:a,model:b.id,name:b.name}))),f=(a,b=null)=>a?.kind||a?.type||b,g={vision:{icon:"visibility",label:"Vision",desc:"Supports image input",color:"text-blue-500"},reasoning:{icon:"neurology",label:"Reasoning",desc:"Supports reasoning / thinking",color:"text-amber-500"}}},89718:(a,b,c)=>{"use strict";c.d(b,{$e:()=>d.$e,CF:()=>d.CF,CG:()=>d.CG,Dj:()=>d.Dj,Fh:()=>d.Fh,Iq:()=>d.Iq,K1:()=>d.K1,KJ:()=>d.KJ,Ko:()=>d.Ko,L:()=>d.L,L9:()=>d.L9,Lh:()=>d.Lh,Mc:()=>d.Mc,OM:()=>d.OM,PX:()=>d.PX,Pc:()=>d.Pc,Q6:()=>d.Q6,Q_:()=>d.Q_,Qu:()=>d.Qu,RT:()=>d.RT,S8:()=>d.S8,Uv:()=>d.Uv,VT:()=>d.VT,XW:()=>d.XW,Xx:()=>d.Xx,Yd:()=>d.Yd,ZO:()=>d.ZO,__:()=>d.__,aQ:()=>d.aQ,bI:()=>d.bI,c:()=>d.c,dA:()=>d.dA,ek:()=>d.ek,fK:()=>d.fK,fv:()=>d.fv,getProviderConnections:()=>d.P,ho:()=>d.ho,hr:()=>d.hr,i0:()=>d.i0,iE:()=>d.iE,jd:()=>d.jd,lk:()=>d.lk,mV:()=>d.mV,mt:()=>d.mt,o5:()=>d.o5,oG:()=>d.oG,op:()=>d.op,pO:()=>d.pO,qr:()=>d.qr,r4:()=>d.r4,sZ:()=>d.sZ,t$:()=>d.t$,uL:()=>d.uL,ui:()=>d.ui,updateProviderConnection:()=>d.rj,uv:()=>d.uv,xN:()=>d.xN,y7:()=>d.y7,yF:()=>d.yF,yg:()=>d.yg,zP:()=>d.zP});var d=c(53267)},96487:()=>{}};
|
|
@@ -14,4 +14,4 @@ Steps:
|
|
|
14
14
|
`,children:[e?(0,d.jsx)("span",{className:"material-symbols-outlined leading-none",style:{fontSize:"10px"},children:"block"}):c&&(0,d.jsx)("span",{className:"material-symbols-outlined leading-none",style:{fontSize:"10px"},children:"check"}),a.name]},a.id)})})]}),Object.entries(X).map(([a,b])=>(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 sticky top-0 bg-surface py-0.5",children:[(0,d.jsx)(i.A,{src:`/providers/${a}.png`,alt:b.name,size:14,fallbackText:(b.name||a).slice(0,2).toUpperCase(),fallbackColor:b.color}),(0,d.jsx)("span",{className:"text-xs font-medium text-primary",children:b.name}),(0,d.jsxs)("span",{className:"text-[10px] text-text-muted",children:["(",b.models.length,")"]})]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-1.5",children:b.models.map(a=>{let b=g===a.value,c=a.isPlaceholder;return(0,d.jsx)("button",{onClick:()=>Y(a),title:c?"Select to pre-fill, then edit model ID in the input":void 0,className:`
|
|
15
15
|
px-2 py-1 rounded-xl text-xs font-medium transition-all border hover:cursor-pointer
|
|
16
16
|
${c?"border-dashed border-border text-text-muted hover:border-primary/50 hover:text-primary bg-surface italic":b?"bg-primary text-white border-primary":x.includes(a.value)?"bg-primary border-primary text-white hover:bg-primary-hover":"bg-surface border-border text-text-main hover:border-primary/50 hover:bg-primary/5"}
|
|
17
|
-
`,children:(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[x.includes(a.value)&&!c&&(0,d.jsx)("span",{className:"material-symbols-outlined leading-none",style:{fontSize:"10px"},children:"check"}),c?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[11px]",children:"edit"}),a.name]}):(0,d.jsxs)(d.Fragment,{children:[a.value,(0,d.jsx)(j.default,{caps:B(a.value)})]})]})},a.value)})})]},a)),0===Object.keys(X).length&&0===V.length&&(0,d.jsxs)("div",{className:"text-center py-4 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-2xl mb-1 block",children:"search_off"}),(0,d.jsx)("p",{className:"text-xs",children:"No models found"})]})]})]})}r.propTypes={isOpen:g().bool.isRequired,onClose:g().func.isRequired,onSelect:g().func.isRequired,onDeselect:g().func,selectedModel:g().string,activeProviders:g().arrayOf(g().shape({provider:g().string.isRequired})),title:g().string,modelAliases:g().object,kindFilter:g().string,addedModelValues:g().arrayOf(g().string),closeOnSelect:g().bool,comboContext:g().shape({id:g().string,name:g().string})}},62727:(a,b,c)=>{c.d(b,{default:()=>l});var d=c(48249),e=c(67484),f=c(95145),g=c(83552),h=c(99070),i=c(60971);let j=/^[a-zA-Z0-9_.\-]+$/;function k({index:a,model:b,isFirst:c,isLast:f,onEdit:g,onMoveUp:h,onMoveDown:i,onRemove:j}){let[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(b),p=()=>{let a=n.trim();a&&a!==b?g(a):o(b),m(!1)};return(0,d.jsxs)("div",{className:"group flex min-w-0 items-center gap-1.5 rounded-md bg-black/[0.02] px-2 py-1 transition-colors hover:bg-black/[0.04] dark:bg-white/[0.02] dark:hover:bg-white/[0.04]",children:[(0,d.jsx)("span",{className:"text-[10px] font-medium text-text-muted w-3 text-center shrink-0",children:a+1}),l?(0,d.jsx)("input",{autoFocus:!0,value:n,onChange:a=>o(a.target.value),onBlur:p,onKeyDown:a=>{"Enter"===a.key&&p(),"Escape"===a.key&&(o(b),m(!1))},className:"min-w-0 flex-1 rounded border border-primary/40 bg-white px-1.5 py-0.5 font-mono text-xs text-text-main outline-none dark:bg-black/20"}):(0,d.jsx)("div",{className:"min-w-0 flex-1 cursor-text truncate rounded px-1.5 py-0.5 font-mono text-xs text-text-main hover:bg-black/5 dark:hover:bg-white/5",onClick:()=>m(!0),title:"Click to edit",children:b}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,d.jsx)("button",{onClick:h,disabled:c,className:`p-0.5 rounded ${c?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move up",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_upward"})}),(0,d.jsx)("button",{onClick:i,disabled:f,className:`p-0.5 rounded ${f?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move down",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_downward"})})]}),(0,d.jsx)("button",{onClick:j,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 transition-all",title:"Remove",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]})}function l({isOpen:a,combo:b,onClose:c,onSave:m,activeProviders:n,kindFilter:o=null,forcePrefix:p="",title:q}){let r=b?.name?p&&b.name.startsWith(p)?b.name.slice(p.length):b.name:"",[s,t]=(0,e.useState)(r),[u,v]=(0,e.useState)(b?.models||[]),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(!1),[A,B]=(0,e.useState)(""),[C,D]=(0,e.useState)({}),E=a=>{if(!a.trim())return B("Name is required"),!1;let b=p+a;return j.test(b)?(B(""),!0):(B("Only letters, numbers, -, _ and . allowed"),!1)},F=a=>{let b=a.target.value;p&&b.startsWith(p)&&(b=b.slice(p.length)),t(b),b?E(b):B("")},G=async()=>{E(s)&&(z(!0),await m({name:p+s.trim(),models:u}),z(!1))},H=!!b;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.default,{isOpen:a,onClose:c,title:q||(H?"Edit Combo":"Create Combo"),children:(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{children:[p?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("label",{className:"text-sm font-medium mb-1 block",children:"Combo Name"}),(0,d.jsxs)("div",{className:"flex items-stretch",children:[(0,d.jsx)("span",{className:"inline-flex items-center px-2 rounded-l border border-r-0 border-black/10 dark:border-white/10 bg-black/[0.04] dark:bg-white/[0.04] text-text-muted font-mono text-sm",children:p}),(0,d.jsx)("input",{value:s,onChange:F,placeholder:"my-combo",className:"flex-1 min-w-0 rounded-r border border-black/10 dark:border-white/10 bg-white dark:bg-black/20 px-2 py-1.5 font-mono text-sm outline-none focus:border-primary"})]}),A&&(0,d.jsx)("p",{className:"text-[11px] text-red-500 mt-0.5",children:A})]}):(0,d.jsx)(g.default,{label:"Combo Name",value:s,onChange:F,placeholder:"my-combo",error:A}),(0,d.jsxs)("p",{className:"text-[10px] text-text-muted mt-0.5",children:[p?`Auto-prefixed with "${p}". `:"","Only letters, numbers, -, _ and . allowed"]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Models"}),0===u.length?(0,d.jsxs)("div",{className:"text-center py-4 border border-dashed border-black/10 dark:border-white/10 rounded-lg bg-black/[0.01] dark:bg-white/[0.01]",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-xl mb-1",children:"layers"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"No models added yet"})]}):(0,d.jsx)("div",{className:"flex max-h-[55vh] min-w-0 flex-col gap-1 overflow-y-auto sm:max-h-[350px]",children:u.map((a,b)=>(0,d.jsx)(k,{index:b,model:a,isFirst:0===b,isLast:b===u.length-1,onEdit:a=>{let c=[...u];c[b]=a,v(c)},onMoveUp:()=>(a=>{if(0===a)return;let b=[...u];[b[a-1],b[a]]=[b[a],b[a-1]],v(b)})(b),onMoveDown:()=>(a=>{if(a===u.length-1)return;let b=[...u];[b[a],b[a+1]]=[b[a+1],b[a]],v(b)})(b),onRemove:()=>v(u.filter((a,c)=>c!==b))},b))}),(0,d.jsxs)("button",{onClick:()=>x(!0),className:"w-full mt-2 py-2 border border-dashed border-black/10 dark:border-white/10 rounded-lg text-xs text-primary font-medium hover:text-primary hover:border-primary/50 transition-colors flex items-center justify-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add Model"]})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2 pt-1 sm:flex-row",children:[(0,d.jsx)(h.default,{onClick:c,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,d.jsx)(h.default,{onClick:G,fullWidth:!0,size:"sm",disabled:!s.trim()||!!A||y,children:y?"Saving...":H?"Save":"Create"})]})]})}),w&&(0,d.jsx)(i.default,{isOpen:w,onClose:()=>x(!1),onSelect:a=>{u.includes(a.value)||v([...u,a.value])},onDeselect:a=>{v(u.filter(b=>b!==a.value))},activeProviders:n,modelAliases:C,title:"Add Model to Combo",kindFilter:o,addedModelValues:u,closeOnSelect:!1})]})}},67559:(a,b,c)=>{c.d(b,{XD:()=>h});var d=c(92592);function e(a){if(!a)return!1;let b="oauth"===a.authType,c=("apikey"===a.authType||"api_key"===a.authType)&&d.jO.includes(a.provider);return b||c}function f(a){let b=a?.quotaPauseThresholds;return b&&"object"==typeof b?b:{}}function g(a){let b=Number(a);return!Number.isFinite(b)||b<=0||b>100?0:b}function h(a){let b=f(a),c=a?.lastQuotaSnapshot?.windows||[],d=Object.values(b).some(a=>g(a)>0),h=function(a){if(!e(a))return null;let b=f(a),c=a?.lastQuotaSnapshot?.windows;if(!c||!Array.isArray(c)||0===c.length)return null;let d=null;for(let a of c){if(!a||!0===a.unlimited)continue;let c=g(b[a.key]);if(!c)continue;let e=Number(a.remainingPercentage);Number.isFinite(e)&&e<=c&&(null===d||e<Number(d.remainingPercentage))&&(d={key:a.key,remainingPercentage:e,threshold:c})}return d}(a);return{enabled:d,paused:null!==h,triggered:h,eligible:e(a),windows:c.map(a=>{let c=g(b[a.key]),d=Number(a.remainingPercentage);return{key:a.key,remainingPercentage:Number.isFinite(d)?d:null,threshold:c,configured:c>0,paused:c>0&&!a.unlimited&&Number.isFinite(d)&&d<=c}})}}},67738:(a,b,c)=>{c.d(b,{default:()=>i});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412);function i({isOpen:a,onClose:b,onCreated:c,onSaved:f,node:g}){let j=!!g,[k,l]=(0,e.useState)({name:"",prefix:"",baseUrl:"https://api.openai.com/v1"}),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(""),[s,t]=(0,e.useState)(!1),[u,v]=(0,e.useState)(null),w=async()=>{if(k.name.trim()&&k.prefix.trim()&&k.baseUrl.trim()){n(!0);try{let a=j?`/api/provider-nodes/${g.id}`:"/api/provider-nodes",b={name:k.name,prefix:k.prefix,baseUrl:k.baseUrl};j||(b.type="custom-embedding");let d=await fetch(a,{method:j?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),e=await d.json();d.ok&&(j?f?.(e.node):c?.(e.node))}catch(a){console.log("Error saving custom embedding node:",a)}finally{n(!1)}}},x=async()=>{t(!0);try{let a=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:k.baseUrl,apiKey:o,type:"custom-embedding",modelId:q.trim()||void 0})}),b=await a.json();v(b)}catch{v({valid:!1,error:"Network error"})}finally{t(!1)}};return(0,d.jsx)(h.aF,{isOpen:a,title:j?"Edit Custom Embedding":"Add Custom Embedding",onClose:b,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)(h.pd,{label:"Name",value:k.name,onChange:a=>l({...k,name:a.target.value}),placeholder:"Voyage AI",hint:"Required. A friendly label for this embedding provider."}),(0,d.jsx)(h.pd,{label:"Prefix",value:k.prefix,onChange:a=>l({...k,prefix:a.target.value}),placeholder:"voyage",hint:"Required. Used as the provider prefix for model IDs (e.g. voyage/voyage-3)."}),(0,d.jsx)(h.pd,{label:"Base URL",value:k.baseUrl,onChange:a=>l({...k,baseUrl:a.target.value}),placeholder:"https://api.voyageai.com/v1",hint:"Most embedding APIs are OpenAI-compatible: Voyage, Cohere, Jina, Mistral, Together..."}),(0,d.jsx)(h.pd,{label:"API Key (for Check)",type:"password",value:o,onChange:a=>p(a.target.value)}),(0,d.jsx)(h.pd,{label:"Model ID (for Check)",value:q,onChange:a=>r(a.target.value),placeholder:"e.g. voyage-3, embed-english-v3.0, text-embedding-3-small",hint:"Required for validation. Will send a test embeddings request."}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)(h.$n,{onClick:x,disabled:!o||!q.trim()||s||!k.baseUrl.trim(),variant:"secondary",children:s?"Checking...":"Check"}),(()=>{if(!u)return null;let{valid:a,error:b,dimensions:c}=u;return a?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.Ex,{variant:"success",children:"Valid"}),c&&(0,d.jsxs)("span",{className:"text-sm text-text-muted",children:[c," dims"]})]}):(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)(h.Ex,{variant:"error",children:"Invalid"}),b&&(0,d.jsx)("span",{className:"text-sm text-red-500",children:b})]})})()]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:w,fullWidth:!0,disabled:!k.name.trim()||!k.prefix.trim()||!k.baseUrl.trim()||m,children:m?j?"Saving...":"Creating...":j?"Save":"Create"}),(0,d.jsx)(h.$n,{onClick:b,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}i.propTypes={isOpen:g().bool.isRequired,onClose:g().func.isRequired,onCreated:g().func,onSaved:g().func,node:g().shape({id:g().string,name:g().string,prefix:g().string,baseUrl:g().string})}},72738:(a,b,c)=>{c.d(b,{A:()=>i});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(29225);function i({src:a,providerId:b,alt:c,size:f=32,className:g="",fallbackText:j="?",fallbackColor:k}){let l=function(a,b){if(b)return(0,h.HY)(b);if(!a)return null;let c=String(a).match(/^\/providers\/([^/]+)\.png$/i);return c?(0,h.HY)(c[1]):a}(a,b),[m,n]=(0,e.useState)(!1);return!l||m?(0,d.jsx)("span",{className:`inline-flex items-center justify-center font-bold rounded-lg ${g}`.trim(),style:{width:f,height:f,color:k,fontSize:Math.max(10,Math.floor(.38*f))},children:j}):(0,d.jsx)("img",{src:l,alt:c,width:f,height:f,className:g,loading:"lazy",decoding:"async",onError:()=>{let a=l.match(/^\/providers\/([^/]+)\.png$/i);a&&(0,h.Kw)(a[1]),b&&(0,h.Kw)(b),n(!0)}})}i.propTypes={src:g().string,providerId:g().string,alt:g().string,size:g().number,className:g().string,fallbackText:g().string,fallbackColor:g().string}},73816:(a,b,c)=>{c.d(b,{default:()=>i});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412);function i({isOpen:a,onClose:b,onCreated:c,onSaved:f,node:g}){let j=!!g,[k,l]=(0,e.useState)({name:"",prefix:"",baseUrl:"https://api.x.ai/v1/videos"}),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)(null),u=async()=>{if(k.name.trim()&&k.prefix.trim()&&k.baseUrl.trim()){n(!0);try{let a=j?`/api/provider-nodes/${g.id}`:"/api/provider-nodes",b={name:k.name,prefix:k.prefix,baseUrl:k.baseUrl};j||(b.type="custom-video");let d=await fetch(a,{method:j?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),e=await d.json();d.ok&&(j?f?.(e.node):c?.(e.node))}catch(a){console.log("Error saving custom video node:",a)}finally{n(!1)}}},v=async()=>{r(!0);try{let a=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:k.baseUrl,apiKey:o,type:"custom-video"})}),b=await a.json();t(b)}catch{t({valid:!1,error:"Network error"})}finally{r(!1)}};return(0,d.jsx)(h.aF,{isOpen:a,title:j?"Edit Custom Video":"Add Custom Video",onClose:b,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)(h.pd,{label:"Name",value:k.name,onChange:a=>l({...k,name:a.target.value}),placeholder:"Grok Imagine",hint:"Required. A friendly label for this video provider."}),(0,d.jsx)(h.pd,{label:"Prefix",value:k.prefix,onChange:a=>l({...k,prefix:a.target.value}),placeholder:"grok-video",hint:"Required. Used as the provider prefix for model IDs (e.g. grok-video/grok-imagine-video)."}),(0,d.jsx)(h.pd,{label:"Base URL",value:k.baseUrl,onChange:a=>l({...k,baseUrl:a.target.value}),placeholder:"https://api.x.ai/v1/videos",hint:"xAI-style async job endpoint. POST {base}/generations creates a job; GET {base}/{request_id} polls."}),(0,d.jsx)(h.pd,{label:"API Key (for Check)",type:"password",value:o,onChange:a=>p(a.target.value),hint:"Check probes the endpoint with an empty body — verifies the key is authorized without creating a billable job."}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)(h.$n,{onClick:v,disabled:!o||q||!k.baseUrl.trim(),variant:"secondary",children:q?"Checking...":"Check"}),(()=>{if(!s)return null;let{valid:a,error:b}=s;return a?(0,d.jsx)(h.Ex,{variant:"success",children:"Reachable \xb7 Authorized"}):(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)(h.Ex,{variant:"error",children:"Invalid"}),b&&(0,d.jsx)("span",{className:"text-sm text-red-500",children:b})]})})()]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:u,fullWidth:!0,disabled:!k.name.trim()||!k.prefix.trim()||!k.baseUrl.trim()||m,children:m?j?"Saving...":"Creating...":j?"Save":"Create"}),(0,d.jsx)(h.$n,{onClick:b,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}i.propTypes={isOpen:g().bool.isRequired,onClose:g().func.isRequired,onCreated:g().func,onSaved:g().func,node:g().shape({id:g().string,name:g().string,prefix:g().string,baseUrl:g().string})}},74812:(a,b,c)=>{c.d(b,{CardSkeleton:()=>i,PageLoading:()=>g,Skeleton:()=>h,Spinner:()=>f,default:()=>j});var d=c(48249),e=c(71404);function f({size:a="md",className:b}){return(0,d.jsx)("span",{className:(0,e.cn)("material-symbols-outlined animate-spin text-brand-500",{sm:"size-4",md:"size-6",lg:"size-8",xl:"size-12"}[a],b),children:"progress_activity"})}function g({message:a="Loading..."}){return(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center bg-bg",children:[(0,d.jsx)(f,{size:"xl"}),(0,d.jsx)("p",{className:"mt-4 text-text-muted",children:a})]})}function h({className:a,...b}){return(0,d.jsx)("div",{className:(0,e.cn)("animate-pulse rounded-[10px] bg-surface-2",a),...b})}function i(){return(0,d.jsxs)("div",{className:"p-6 rounded-[14px] border border-border-subtle bg-surface shadow-[var(--shadow-soft)]",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsx)(h,{className:"h-4 w-24"}),(0,d.jsx)(h,{className:"size-10 rounded-[10px]"})]}),(0,d.jsx)(h,{className:"h-8 w-16 mb-2"}),(0,d.jsx)(h,{className:"h-3 w-20"})]})}function j({type:a="spinner",...b}){switch(a){case"page":return(0,d.jsx)(g,{...b});case"skeleton":return(0,d.jsx)(h,{...b});case"card":return(0,d.jsx)(i,{...b});default:return(0,d.jsx)(f,{...b})}}},75171:(a,b,c)=>{c.d(b,{default:()=>h});var d=c(48249),e=c(71404);let f={default:"bg-surface-2 text-text-muted",primary:"bg-brand-500/10 text-brand-600 dark:text-brand-300",success:"bg-green-500/10 text-green-600 dark:text-green-400",warning:"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",error:"bg-red-500/10 text-red-600 dark:text-red-400",info:"bg-blue-500/10 text-blue-600 dark:text-blue-400"},g={sm:"px-2 py-0.5 text-[10px]",md:"px-2.5 py-1 text-xs",lg:"px-3 py-1.5 text-sm"};function h({children:a,variant:b="default",size:c="md",dot:i=!1,icon:j,className:k}){return(0,d.jsxs)("span",{className:(0,e.cn)("inline-flex items-center gap-1.5 rounded-full font-semibold",f[b],g[c],k),children:[i&&(0,d.jsx)("span",{className:(0,e.cn)("size-1.5 rounded-full","success"===b&&"bg-green-500","warning"===b&&"bg-yellow-500","error"===b&&"bg-red-500","info"===b&&"bg-blue-500","primary"===b&&"bg-brand-500","default"===b&&"bg-gray-500")}),j&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:j}),a]})}},79346:(a,b,c)=>{c.d(b,{default:()=>j});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412),i=c(50377);function j({isOpen:a,provider:b,providerInfo:c,onSuccess:f,onClose:g,oauthMeta:k,idcConfig:l}){let[m,n]=(0,e.useState)("waiting"),[o,p]=(0,e.useState)(null),[q,r]=(0,e.useState)(""),[s,t]=(0,e.useState)(null),[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(null),[y,z]=(0,e.useState)(!1),[A,B]=(0,e.useState)(!1),C=(0,e.useRef)(null),D=(0,e.useRef)(!1);(0,e.useRef)(!1);let E=(0,e.useRef)({proxyStarted:!1,proxyProvider:null,stopSent:!1}),F=(0,e.useRef)(f),G=(0,e.useRef)(g),H=(0,e.useRef)(a);(0,e.useRef)(null);let{copied:I,copy:J}=(0,i.C)(),[K,L]=(0,e.useState)(!1),[M,N]=(0,e.useState)("/callback?code=...");(0,e.useRef)(!1);let O=(0,e.useCallback)(async(a,c)=>{try{B(!0),t(null);let d=o?.redirectUri||"",e=o?.codeVerifier||null,f=c||o?.state||null,g=await fetch(`/api/oauth/${b}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,redirectUri:d,codeVerifier:e,state:f,...o?.systemId?{systemId:o.systemId}:{},...k?{meta:k}:{}})}),h=await g.json();if(!g.ok||h?.success===!1)throw Error(h.error||"Token exchange failed");n("success"),F.current?.()}catch(a){t(a.message),n("error")}finally{B(!1)}},[o,b,k]),P=(0,e.useCallback)(async a=>{if(o?.state)try{let b=await fetch("/api/oauth/xai/manual-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,state:o.state})}),c=await b.json();if(!b.ok)throw Error(c.error);n("success"),F.current?.()}catch(a){t(a.message),n("error")}},[o]),Q=(0,e.useCallback)(async(a,c,d,e,f)=>{D.current=!1,z(!0);let g=Date.now()+(Number.isFinite(f)&&f>0?f:12e4);for(;Date.now()<g;){if(D.current){console.log("[OAuthModal] Polling aborted"),z(!1);return}if(await new Promise(a=>setTimeout(a,1e3*d)),D.current){console.log("[OAuthModal] Polling aborted after sleep"),z(!1);return}try{let f=await fetch(`/api/oauth/${b}/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:a,codeVerifier:c,extraData:e,..."cursor"===b?{state:a}:{}})}),g=await f.json();if(g.success){D.current=!0,n("success"),z(!1),F.current?.();return}if("expired_token"===g.error||"access_denied"===g.error)throw Error(g.errorDescription||g.error);"slow_down"===g.error&&(d=Math.min(d+5,30))}catch(a){t(a.message),n("error"),z(!1);return}}t("Authorization timeout"),n("error"),z(!1)},[b]),R=(0,e.useCallback)(()=>{let a=E.current;a.proxyStarted&&!a.stopSent&&a.proxyProvider&&(a.stopSent=!0,fetch(`/api/oauth/${a.proxyProvider}/stop-proxy`).catch(()=>{}))},[]),S=(0,e.useCallback)(async a=>{let b=await fetch(`/api/oauth/${a}/start-proxy`),c=await b.json();if(!b.ok||!c.success||!c.callbackUrl)throw Error(c.reason||c.error||`Failed to start ${a} callback server`);if(E.current.proxyStarted=!0,E.current.proxyProvider=a,E.current.stopSent=!1,!H.current)return void R();let d=new URL(`/api/oauth/${a}/authorize`,window.location.origin);d.searchParams.set("redirect_uri",c.callbackUrl);let e=await fetch(d),f=await e.json();if(!e.ok)throw R(),Error(f.error);if(!H.current)return void R();let g={state:f.state};f.codeVerifier&&(g.codeVerifier=f.codeVerifier),f.systemId&&(g.systemId=f.systemId);let h=await fetch(`/api/oauth/${a}/register-session`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)}),i=null;try{i=await h.json()}catch{i=null}if(!h.ok||i?.success===!1)throw R(),Error(i?.error||"Failed to register login session; please retry");H.current&&(p({...f,proxyProvider:a}),n("waiting"),C.current=window.open(f.authUrl,"oauth_popup","width=600,height=700"),C.current||n("input"))},[R]),T=async()=>{if(b)try{let a;if(t(null),"cursor"===b){v(!0),n("waiting");let a=await fetch(`/api/oauth/cursor/authorize?redirect_uri=${encodeURIComponent(window.location.origin+"/callback")}`),b=await a.json();if(!a.ok)throw Error(b.error);p(b),x({verification_uri:b.authUrl,user_code:""}),b.authUrl&&window.open(b.authUrl,"_blank","noopener,noreferrer"),Q(b.state,null,2,null,1e3*(b.expiresIn||300));return}if("zed"===b&&authMode,PROXY_OAUTH_PROVIDERS.has(b)&&"browser"===authMode)return void await S(b);if(["github","qwen","kiro","kimi","kimi-coding","kilocode","codebuddy-cn","qoder","grok-cli","frontier-for-all"].includes(b)){v(!0),n("waiting");let a=new URL(`/api/oauth/${b}/device-code`,window.location.origin);"kiro"===b&&l?.startUrl&&(a.searchParams.set("start_url",l.startUrl),l.region&&a.searchParams.set("region",l.region),a.searchParams.set("auth_method","idc"));let c=await fetch(a.toString()),d=await c.json();if(!c.ok)throw Error(d.error);x(d);let e=d.verification_uri_complete||d.verification_uri;e&&window.open(e,"_blank","noopener,noreferrer");let f="kiro"===b?{_clientId:d._clientId,_clientSecret:d._clientSecret,_region:d._region,_authMethod:d._authMethod,_startUrl:d._startUrl}:"qoder"===b?{_qoderNonce:d._qoderNonce,_qoderMachineId:d._qoderMachineId,_qoderVerifier:d.codeVerifier}:"kimi"===b||"kimi-coding"===b?{_kimiDeviceId:d._kimiDeviceId}:null;Q(d.device_code,d.codeVerifier,d.interval||5,f,Number.isFinite(d.expires_in)&&d.expires_in>0?1e3*d.expires_in:void 0);return}let c=window.location.port||("https:"===window.location.protocol?"443":"80");a="codex"===b?"http://localhost:1455/auth/callback":"xai"===b?"http://127.0.0.1:56121/callback":`${window.location.origin}/callback`;let d=new URL(`/api/oauth/${b}/authorize`,window.location.origin);d.searchParams.set("redirect_uri",a),k&&Object.entries(k).forEach(([a,b])=>{b&&d.searchParams.set(a,b)});let e=await fetch(d.toString()),f=await e.json();if(!e.ok)throw Error(f.error);let g=!1,h=!1;if("codex"===b)try{let b=new URL("/api/oauth/codex/start-proxy",window.location.origin);b.searchParams.set("app_port",c),b.searchParams.set("state",f.state),b.searchParams.set("code_verifier",f.codeVerifier),b.searchParams.set("redirect_uri",a);let d=await fetch(b.toString()),e=await d.json();g=e.success,h=!!e.serverSide}catch{g=!1}let i=!1,j=!1;if("xai"===b)try{let b=new URL("/api/oauth/xai/start-proxy",window.location.origin);b.searchParams.set("app_port",c),b.searchParams.set("state",f.state),b.searchParams.set("code_verifier",f.codeVerifier),b.searchParams.set("redirect_uri",a);let d=await fetch(b.toString()),e=await d.json();if(i=e.success,j=!!e.serverSide,!i&&"port_busy"===e.reason)throw Error("Port 56121 in use; close the conflicting process and retry")}catch(a){if(a?.message)throw a;i=!1}if(p({...f,redirectUri:a,codexServerSide:h,xaiServerSide:j}),("codex"===b&&g||"xai"===b&&i)&&(E.current.proxyStarted=!0,E.current.proxyProvider=b,E.current.stopSent=!1),!f.authUrl){if("device_code"===f.flowType)throw Error(`Provider ${b} uses device-code login but is not wired in the OAuth modal device-code list`);throw Error("No authorization URL returned from OAuth provider")}"codex"===b&&g||"xai"===b&&i||K&&"codex"!==b&&"xai"!==b?(n("waiting"),C.current=window.open(f.authUrl,"oauth_popup","width=600,height=700"),C.current||n("input")):(n("input"),window.open(f.authUrl,"_blank"))}catch(a){t(a.message),n("error")}},U=async()=>{try{if(t(null),"paste-token"===authMode&&PASTE_TOKEN_PROVIDERS[b]){let a=pasteToken.trim();if(!a)throw Error("Missing token");let c=await fetch(`/api/oauth/${b}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a})}),d=await c.json();if(!c.ok)throw Error(d.error);n("success"),F.current?.();return}let a=q.trim();if(!a)return;if(B(!0),PROXY_OAUTH_PROVIDERS.has(b)&&a){let c=await fetch(`/api/oauth/${b}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,state:o?.state,...o?.redirectUri?{redirectUri:o.redirectUri}:{},...o?.codeVerifier?{codeVerifier:o.codeVerifier}:{},...o?.systemId?{systemId:o.systemId}:{}})}),d=await c.json();if(!c.ok)throw Error(d.error);n("success"),F.current?.();return}if(a.startsWith("eyJ")&&a.includes("."))return void await O(a,null);if("xai"===b&&a&&!a.includes("://")&&!a.includes("?")&&!a.includes("code="))return void await P(a);if("kimchi"===b&&a&&!a.includes("://")&&!a.includes("?"))return void await O(a,null);let c=null,d=null,e=null,f=null;if(a.includes("://")||a.startsWith("/")||a.startsWith("?")){let b=a.startsWith("/")||a.startsWith("?")?`http://localhost${a.startsWith("?")?"":"/"}${a}`:a;try{let a=new URL(b);if(c=a.searchParams.get("code"),d=a.searchParams.get("token"),e=a.searchParams.get("state"),f=a.searchParams.get("error"))throw Error(a.searchParams.get("error_description")||f)}catch(b){if(f)throw b;c=a}}else c=a;if(!c&&!d)throw Error("xai"===b?"Paste the callback URL or copied xAI code":"kimchi"===b?"No Kimchi token found in URL":"No authorization code found in URL");await O(d||c,e)}catch(a){t(a.message),n("error")}finally{B(!1)}},V=(0,e.useCallback)(()=>{R(),"codex"===b?fetch("/api/oauth/codex/stop-proxy").catch(()=>{}):"xai"===b&&fetch("/api/oauth/xai/stop-proxy").catch(()=>{}),G.current?.()},[R,b]);if(!b||!c)return null;let W="xai"===b,X="kimchi"===b,Y="zed"===b&&"browser"===authMode&&!1,Z=!!PASTE_TOKEN_PROVIDERS[b],$=w?.verification_uri_complete||w?.verification_uri||"",_=W?"Connect Grok Build OAuth":`Connect ${c.name}`,aa=W?"http://127.0.0.1:56121/callback?code=... or copied code":X?`${M.replace("code=...","token=...")} or copied token`:M;return(0,d.jsx)(h.aF,{isOpen:a,title:_,onClose:V,size:"lg",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[PROXY_OAUTH_PROVIDERS.has(b)&&("waiting"===m||"input"===m||"error"===m)&&(0,d.jsxs)(d.Fragment,{children:[Z&&(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("button",{type:"button",onClick:()=>{setAuthMode("browser"),t(null),n("waiting"),T()},className:`flex-1 rounded-lg border px-3 py-2 text-sm transition-colors ${"browser"===authMode?"border-primary bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:"\uD83C\uDF10 Sign in with browser"}),(0,d.jsx)("button",{type:"button",onClick:()=>{setAuthMode("paste-token"),t(null),n("input")},className:`flex-1 rounded-lg border px-3 py-2 text-sm transition-colors ${"paste-token"===authMode?"border-primary bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:"\uD83D\uDD11 Paste token"})]}),"browser"===authMode&&(0,d.jsxs)(d.Fragment,{children:["waiting"===m&&!Y&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border border-border rounded-lg bg-sidebar/50",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-base text-primary animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{className:"text-sm",children:"Waiting for browser authorization…"})]}),"input"===m&&Y&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Sign in at Zed in your browser"}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"A Zed sign-in tab was opened. Complete the sign-in there — Zed will land on a 127.0.0.1 address that only your own computer can see, which is expected."}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.pd,{value:o?.authUrl||"",readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,d.jsx)(h.$n,{variant:"secondary",icon:"auth_url"===I?"check":"content_copy",onClick:()=>J(o?.authUrl,"auth_url"),disabled:!o?.authUrl,children:"Copy"}),(0,d.jsx)(h.$n,{variant:"secondary",icon:"open_in_new",onClick:()=>o?.authUrl&&window.open(o.authUrl,"_blank","noopener,noreferrer"),disabled:!o?.authUrl,children:"Open"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL from your browser here"}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Copy the full 127.0.0.1 URL from your browser's address bar (it contains your user_id and an encrypted token, which is decrypted on the server)."}),(0,d.jsx)(h.pd,{value:q,onChange:a=>r(a.target.value),placeholder:"http://127.0.0.1:58443/?user_id=...&access_token=...",className:"font-mono text-xs"})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:U,fullWidth:!0,disabled:!q,children:"Connect"}),(0,d.jsx)(h.$n,{onClick:V,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"input"===m&&!Y&&(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Popup was blocked. After authorizing in the browser, paste the full callback URL here:"}),(0,d.jsx)(h.pd,{value:q,onChange:a=>r(a.target.value),placeholder:"http://127.0.0.1:.../callback?...",className:"font-mono text-xs"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:U,fullWidth:!0,disabled:!q,children:"Connect"}),(0,d.jsx)(h.$n,{onClick:V,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]}),"paste-token"===authMode&&Z&&(0,d.jsxs)("div",{className:"space-y-3",children:[ideStatus&&!ideStatus.installed&&(0,d.jsxs)("div",{className:`px-3 py-2 rounded-lg text-sm ${PASTE_TOKEN_PROVIDERS[b].ideOptional?"bg-blue-500/10 text-blue-700 dark:text-blue-300":"bg-yellow-500/10 text-yellow-700 dark:text-yellow-300"}`,children:[PASTE_TOKEN_PROVIDERS[b].ideName," IDE not detected.",PASTE_TOKEN_PROVIDERS[b].ideOptional?" You can still grab the token from DevTools.":` Install ${PASTE_TOKEN_PROVIDERS[b].ideName} IDE to get the token, or use "Sign in with browser".`]}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:PASTE_TOKEN_PROVIDERS[b].instructions}),(0,d.jsx)(h.pd,{value:pasteToken,onChange:a=>setPasteToken(a.target.value),placeholder:PASTE_TOKEN_PROVIDERS[b].placeholder,className:"font-mono text-xs"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:U,fullWidth:!0,disabled:!pasteToken,children:"Connect"}),(0,d.jsx)(h.$n,{onClick:V,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]}),("waiting"===m||"input"===m)&&!u&&!PROXY_OAUTH_PROVIDERS.has(b)&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border border-border rounded-lg bg-sidebar/50",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-base text-primary animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{className:"text-sm",children:W?"Waiting for Grok Build OAuth…":"Waiting for popup authorization…"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3 my-1",children:[(0,d.jsx)("div",{className:"flex-1 h-px bg-border"}),(0,d.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wider",children:"Or paste callback URL manually"}),(0,d.jsx)("div",{className:"flex-1 h-px bg-border"})]}),(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("p",{className:"text-sm font-medium mb-2",children:["Step 1: Open this ",W?"Grok Build OAuth URL":"URL"," in your browser"]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.pd,{value:o?.authUrl||"",readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,d.jsx)(h.$n,{variant:"secondary",icon:"auth_url"===I?"check":"content_copy",onClick:()=>J(o?.authUrl,"auth_url"),disabled:!o?.authUrl,children:"Copy"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("p",{className:"text-sm font-medium mb-2",children:["Step 2: Paste the ","xai"===b?"callback URL or copied code":X?"callback URL or copied token":"callback URL"," here"]}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"xai"===b?"If xAI shows a code instead of redirecting, paste that code here.":X?"After authorization, copy the full callback URL or token from your browser.":"After authorization, copy the full URL from your browser."}),(0,d.jsx)(h.pd,{value:q,onChange:a=>r(a.target.value),placeholder:aa,className:"font-mono text-xs"})]})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:U,fullWidth:!0,disabled:!q.trim()||A,children:A?"Connecting...":"Connect"}),(0,d.jsx)(h.$n,{onClick:V,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"waiting"===m&&u&&w&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"text-center py-4",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Visit the login URL below and authorize:"}),(0,d.jsxs)("div",{className:"bg-sidebar p-4 rounded-lg mb-4",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Login URL"}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("code",{className:"flex-1 text-sm break-all",children:$}),(0,d.jsx)(h.$n,{size:"sm",variant:"ghost",icon:"login_url"===I?"check":"content_copy",onClick:()=>J($,"login_url"),disabled:!$}),(0,d.jsx)(h.$n,{size:"sm",variant:"ghost",icon:"open_in_new",onClick:()=>window.open($,"_blank","noopener,noreferrer"),disabled:!$,children:"Open"})]})]}),w.user_code&&(0,d.jsxs)("div",{className:"bg-primary/10 p-4 rounded-lg",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Your Code"}),(0,d.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,d.jsx)("p",{className:"text-2xl font-mono font-bold text-primary",children:w.user_code}),(0,d.jsx)(h.$n,{size:"sm",variant:"ghost",icon:"user_code"===I?"check":"content_copy",onClick:()=>J(w.user_code,"user_code")})]})]})]}),y&&(0,d.jsxs)("div",{className:"flex items-center justify-center gap-2 text-sm text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),"Waiting for authorization..."]})]}),"success"===m&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,d.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your ",c.name," account has been connected."]}),(0,d.jsx)(h.$n,{onClick:V,fullWidth:!0,children:"Done"})]}),"error"===m&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,d.jsx)("p",{className:"text-sm text-red-600 mb-4",children:s}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:T,variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,d.jsx)(h.$n,{onClick:V,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}j.propTypes={isOpen:g().bool.isRequired,provider:g().string,providerInfo:g().shape({name:g().string}),onSuccess:g().func,onClose:g().func.isRequired,oauthMeta:g().object,idcConfig:g().shape({startUrl:g().string,region:g().string})}},79488:(a,b,c)=>{c.d(b,{default:()=>i});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412);function i({isOpen:a,onSuccess:b,onClose:c}){let[f,g]=(0,e.useState)(""),[j,k]=(0,e.useState)(!1),[l,m]=(0,e.useState)(null),[n,o]=(0,e.useState)(!1),p=async()=>{if(!f.trim())return void m("Please paste your cookie");k(!0),m(null);try{let a=await fetch("/api/oauth/iflow/cookie",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookie:f.trim()})}),c=await a.json();if(!a.ok)throw Error(c.error||"Authentication failed");o(!0),setTimeout(()=>{b?.(),q()},1500)}catch(a){m(a.message)}finally{k(!1)}},q=()=>{g(""),m(null),o(!1),c?.()};return(0,d.jsx)(h.aF,{isOpen:a,onClose:q,title:"iFlow Cookie Authentication",children:(0,d.jsx)("div",{className:"space-y-4",children:n?(0,d.jsxs)("div",{className:"text-center py-8",children:[(0,d.jsx)("div",{className:"text-6xl mb-4",children:"✅"}),(0,d.jsx)("p",{className:"text-lg font-medium text-text-primary",children:"Authentication Successful!"}),(0,d.jsx)("p",{className:"text-sm text-text-muted mt-2",children:"Fresh API key obtained"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["To get a fresh API key, paste your browser cookie from"," ",(0,d.jsx)("a",{href:"https://platform.iflow.cn",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"platform.iflow.cn"})]}),(0,d.jsxs)("div",{className:"bg-surface-secondary p-3 rounded-lg text-xs space-y-2",children:[(0,d.jsx)("p",{className:"font-medium text-text-primary",children:"How to get cookie:"}),(0,d.jsxs)("ol",{className:"list-decimal list-inside space-y-1 text-text-muted",children:[(0,d.jsx)("li",{children:"Open platform.iflow.cn in your browser"}),(0,d.jsx)("li",{children:"Login to your account"}),(0,d.jsx)("li",{children:"Open DevTools (F12) → Application/Storage → Cookies"}),(0,d.jsx)("li",{children:"Copy the entire cookie string (must include BXAuth)"}),(0,d.jsx)("li",{children:"Paste it below"})]})]})]}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("label",{className:"block text-sm font-medium text-text-primary",children:"Cookie String"}),(0,d.jsx)("textarea",{value:f,onChange:a=>g(a.target.value),placeholder:"BXAuth=xxx; ...",className:"w-full px-3 py-2 bg-surface-secondary border border-border rounded-lg text-sm text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-primary resize-none",rows:4,disabled:j})]}),l&&(0,d.jsx)("div",{className:"p-3 bg-error/10 border border-error/20 rounded-lg",children:(0,d.jsx)("p",{className:"text-sm text-error",children:l})}),(0,d.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,d.jsx)(h.$n,{variant:"secondary",onClick:q,disabled:j,fullWidth:!0,children:"Cancel"}),(0,d.jsx)(h.$n,{onClick:p,loading:j,fullWidth:!0,children:"Authenticate"})]})]})})})}i.propTypes={isOpen:g().bool.isRequired,onSuccess:g().func,onClose:g().func}},83552:(a,b,c)=>{c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({label:a,type:b="text",placeholder:c,value:g,onChange:h,error:i,hint:j,icon:k,disabled:l=!1,required:m=!1,className:n,inputClassName:o,...p}){return(0,d.jsxs)("div",{className:(0,e.cn)("flex flex-col gap-1.5",n),children:[a&&(0,d.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[a,m&&(0,d.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,d.jsxs)("div",{className:"relative",children:[k&&(0,d.jsx)("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-text-muted",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:k})}),(0,d.jsx)("input",{type:b,placeholder:c,value:g,onChange:h,disabled:l,className:(0,e.cn)("w-full py-2.5 px-3 text-sm text-text-main bg-surface-2 rounded-[10px]","border border-transparent placeholder-text-muted/70","focus:outline-none focus:ring-2 focus:ring-brand-500/30 focus:border-brand-500/40","transition-all duration-150 ease-out disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",k&&"pl-10",i&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",o),...p})]}),i&&(0,d.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),i]}),j&&!i&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:j})]})}},85158:(a,b,c)=>{c.d(b,{default:()=>i});var d=c(48249),e=c(67484),f=c(71404),g=c(99070),h=c(91099);function i({currentPage:a,pageSize:b,totalItems:c,onPageChange:j,onPageSizeChange:k,className:l,pageSizeOptions:m=[10,20,50],allowCustomPageSize:n=!1,maxPageSize:o=500}){let[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(String(b)),t=()=>{let a=Number.parseInt(r,10);if(!Number.isFinite(a))return void s(String(b));let c=Math.min(o,Math.max(1,a));s(String(c)),c!==b&&k(c)},u=Math.ceil(c/b),v=c>0?(a-1)*b+1:0,w=Math.min(a*b,c),x=(()=>{let b=[],c=Math.max(1,a-2),d=Math.min(u,c+5-1);d-c+1<5&&(c=Math.max(1,d-5+1));for(let a=c;a<=d;a++)b.push(a);return b})();return(0,d.jsxs)("div",{className:(0,f.cn)("flex flex-col gap-2 py-4 px-2",l),children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 sm:gap-4",children:[c>0&&(0,d.jsxs)("div",{className:"whitespace-nowrap text-sm text-text-muted",children:["Showing ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:v})," to"," ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:w})," of"," ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:c})," results"]}),k&&(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-sm text-text-muted",children:"Rows:"}),(0,d.jsx)(h.default,{size:"sm",value:p&&n?"__custom__":String(b),options:[...m.map(a=>({value:String(a),label:String(a)})),...n?[{value:"__custom__",label:"Custom"}]:[]],onChange:a=>{if("__custom__"===a){q(!0),s(String(b));return}q(!1),k(Number(a))}}),p&&n&&(0,d.jsx)("input",{type:"number",min:"1",max:String(o),value:r,onChange:a=>s(a.target.value),onBlur:t,onKeyDown:a=>{"Enter"===a.key&&t()},className:(0,f.cn)("h-7 w-20 rounded-[8px] border border-border bg-surface-2","px-2 text-xs text-text-main focus:outline-none focus:ring-2 focus:ring-brand-500/30","transition-all"),style:{colorScheme:"auto"},"aria-label":"Custom accounts per page"})]})]}),u>1&&(0,d.jsx)("div",{className:"flex justify-end",children:(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)(g.default,{variant:"outline",size:"sm",onClick:()=>j(a-1),disabled:1===a,className:"w-9 px-0","aria-label":"Go to previous page",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_left"})}),(0,d.jsxs)("span",{className:"px-2 text-sm text-text-muted sm:hidden",children:["Page ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:a})," of"," ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:u})]}),(0,d.jsxs)("div",{className:"hidden items-center gap-1 sm:flex",children:[x[0]>1&&(0,d.jsx)(g.default,{variant:"ghost",size:"sm",onClick:()=>j(1),className:"w-9 px-0","aria-label":"Go to first page",children:"1"}),x[0]>2&&(0,d.jsx)(g.default,{variant:"ghost",size:"sm",onClick:()=>j(Math.max(1,a-5)),className:"w-9 px-0","aria-label":"Jump 5 pages back",children:"..."}),x.map(b=>{let c=a===b;return(0,d.jsx)(g.default,{variant:c?"primary":"ghost",size:"sm",onClick:()=>j(b),className:"w-9 px-0","aria-label":`Go to page ${b}`,"aria-current":c?"page":void 0,children:b},b)}),x[x.length-1]<u-1&&(0,d.jsx)(g.default,{variant:"ghost",size:"sm",onClick:()=>j(Math.min(u,a+5)),className:"w-9 px-0","aria-label":"Jump 5 pages forward",children:"..."}),x[x.length-1]<u&&(0,d.jsx)(g.default,{variant:"ghost",size:"sm",onClick:()=>j(u),className:"w-9 px-0","aria-label":"Go to last page",children:u})]}),(0,d.jsx)(g.default,{variant:"outline",size:"sm",onClick:()=>j(a+1),disabled:a===u,className:"w-9 px-0","aria-label":"Go to next page",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_right"})})]})})]})}},91099:(a,b,c)=>{c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({options:a=[],value:b,onChange:c,size:g="md",className:h}){let i={sm:"h-7 text-xs",md:"h-9 text-sm",lg:"h-11 text-base"};return(0,d.jsx)("div",{className:(0,e.cn)("inline-flex items-center p-1 rounded-[10px] overflow-x-auto","bg-surface-2",h),children:a.map(a=>(0,d.jsxs)("button",{onClick:()=>c(a.value),className:(0,e.cn)("shrink-0 px-4 rounded-[8px] font-medium transition-all",i[g],b===a.value?"bg-surface text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[a.icon&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] mr-1.5",children:a.icon}),a.label]},a.value))})}},91809:(a,b,c)=>{c.d(b,{default:()=>g});var d=c(48249),e=c(67484),f=c(17660);function g(){let[a,b]=(0,e.useState)([]),[c,g]=(0,e.useState)(!0),[h,i]=(0,e.useState)(!0);return(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("h2",{className:"text-xl font-semibold",children:"Request Logs"}),(0,d.jsx)("div",{className:"flex items-center gap-2",children:(0,d.jsxs)("label",{className:"text-sm font-medium text-text-muted flex items-center gap-2 cursor-pointer",children:[(0,d.jsx)("span",{children:"Auto Refresh (3s)"}),(0,d.jsx)("div",{onClick:()=>i(!h),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors focus:outline-none ${h?"bg-primary":"bg-bg-subtle border border-border"}`,children:(0,d.jsx)("span",{className:`inline-block h-3 w-3 transform rounded-full bg-white transition-transform ${h?"translate-x-5":"translate-x-1"}`})})]})})]}),(0,d.jsx)(f.default,{className:"overflow-hidden bg-black/5 dark:bg-black/20",children:(0,d.jsx)("div",{className:"p-0 overflow-x-auto max-h-[600px] overflow-y-auto font-mono text-xs",children:c&&0===a.length?(0,d.jsx)("div",{className:"p-8 text-center text-text-muted",children:"Loading logs..."}):0===a.length?(0,d.jsx)("div",{className:"p-8 text-center text-text-muted",children:"No logs recorded yet."}):(0,d.jsxs)("table",{className:"w-full text-left border-collapse whitespace-nowrap",children:[(0,d.jsx)("thead",{className:"sticky top-0 bg-bg-subtle border-b border-border z-10",children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"DateTime"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Model"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Provider"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Account"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"In"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Out"}),(0,d.jsx)("th",{className:"px-3 py-2",children:"Status"})]})}),(0,d.jsx)("tbody",{className:"divide-y divide-border/50",children:a.map((a,b)=>{let c=a.split(" | ");if(c.length<7)return null;let e=c[6],f=e.includes("PENDING"),g=e.includes("FAILED"),h=e.includes("OK");return(0,d.jsxs)("tr",{className:`hover:bg-primary/5 transition-colors ${f?"bg-primary/5":""}`,children:[(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-text-muted",children:c[0]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border font-medium",children:c[1]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border",children:(0,d.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-bg-subtle border border-border text-[10px] uppercase font-bold",children:c[2]})}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border truncate max-w-[150px]",title:c[3],children:c[3]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-primary",children:c[4]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-success",children:c[5]}),(0,d.jsx)("td",{className:`px-3 py-1.5 font-bold ${h?"text-success":g?"text-error":"text-primary animate-pulse"}`,children:e})]},b)})})]})})}),(0,d.jsx)("div",{className:"text-[10px] text-text-muted italic",children:"Logs are loaded from the request history database."})]})}},95145:(a,b,c)=>{c.d(b,{ConfirmModal:()=>j,default:()=>i});var d=c(48249),e=c(67484),f=c(71404),g=c(99070),h=c(32971);function i({isOpen:a,onClose:b,title:c,children:g,footer:j,size:k="md",closeOnOverlay:l=!0,showTrafficLights:m=!0,allowFullscreen:n=!0,className:o}){let[p,q]=(0,e.useState)(!1);return a?(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-[2px] fade-in",onClick:l?b:void 0}),(0,d.jsxs)("div",{className:(0,f.cn)("relative w-full bg-surface","border border-border-subtle","rounded-[14px] shadow-[var(--shadow-elev)]","fade-in transition-all duration-150",p?"max-w-[95vw] w-[95vw] h-[90vh] max-h-[90vh] flex flex-col":({sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl",full:"max-w-4xl"})[k],o),children:[(c||m)&&(0,d.jsxs)("div",{className:"flex items-center justify-between p-2 border-b border-border-subtle select-none cursor-default",onDoubleClick:()=>n&&q(a=>!a),children:[(0,d.jsxs)("div",{className:"flex items-center",children:[m&&(0,d.jsxs)("div",{className:"hidden md:flex items-center gap-2 mr-4 ml-2",children:[(0,d.jsx)(h.default,{text:"Close",position:"top",color:"#FF5F56",children:(0,d.jsx)("button",{onClick:b,"aria-label":"Close",title:"Close",className:"w-4 h-4 rounded-full bg-[#FF5F56] hover:brightness-90 transition-all cursor-pointer flex items-center justify-center group/dot",children:(0,d.jsx)("span",{className:"text-[9px] font-bold text-white opacity-0 group-hover/dot:opacity-100 transition-opacity leading-none",children:"✕"})})}),(0,d.jsx)("div",{className:"w-4 h-4 rounded-full bg-[#3a3a3a]/20 dark:bg-white/15 cursor-not-allowed"}),n?(0,d.jsx)(h.default,{text:p?"Restore":"Maximize",position:"top",color:"#28C840",children:(0,d.jsx)("button",{type:"button",onClick:()=>q(a=>!a),"aria-label":p?"Restore":"Maximize",title:p?"Restore":"Maximize (Full screen)",className:"w-4 h-4 rounded-full bg-[#28C840] border border-[#1AAB29] hover:brightness-90 transition-all cursor-pointer flex items-center justify-center group/dot",children:(0,d.jsx)("span",{className:"text-[10px] font-bold text-[#004d11] opacity-0 group-hover/dot:opacity-100 transition-opacity leading-none",children:p?"⤡":"⤢"})})}):(0,d.jsx)("div",{className:"w-4 h-4 rounded-full bg-[#3a3a3a]/20 dark:bg-white/15 cursor-not-allowed"})]}),c&&(0,d.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:c})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[n&&(0,d.jsx)("button",{type:"button",onClick:()=>q(a=>!a),"aria-label":p?"Restore":"Full Screen",title:p?"Restore":"Full Screen",className:"hidden md:flex p-1.5 rounded-[10px] text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors cursor-pointer",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:p?"close_fullscreen":"open_in_full"})}),(0,d.jsx)("button",{onClick:b,"aria-label":"Close",className:"md:hidden p-1.5 rounded-[10px] text-text-muted hover:bg-surface-2 hover:text-text-main transition-colors",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]})]}),(0,d.jsx)("div",{className:(0,f.cn)("p-6 overflow-y-auto custom-scrollbar",p?"flex-1 min-h-0":"max-h-[calc(85vh-100px)]"),children:g}),j&&(0,d.jsx)("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-border-subtle",children:j})]})]}):null}function j({isOpen:a,onClose:b,onConfirm:c,title:e="Confirm",message:f,confirmText:h="Confirm",cancelText:k="Cancel",variant:l="danger",loading:m=!1}){return(0,d.jsx)(i,{isOpen:a,onClose:b,title:e,size:"sm",footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g.default,{variant:"ghost",onClick:b,disabled:m,children:k}),(0,d.jsx)(g.default,{variant:l,onClick:c,loading:m,children:h})]}),children:(0,d.jsx)("p",{className:"text-text-muted",children:f})})}},95514:(a,b,c)=>{c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({checked:a=!1,onChange:b,label:c,description:g,disabled:h=!1,size:i="md",className:j}){let k={sm:{track:"w-8 h-4",thumb:"size-3",translate:"translate-x-4"},md:{track:"w-11 h-6",thumb:"size-5",translate:"translate-x-5"},lg:{track:"w-14 h-7",thumb:"size-6",translate:"translate-x-7"}};return(0,d.jsxs)("div",{className:(0,e.cn)("flex items-center gap-3",h&&"opacity-50 cursor-not-allowed",j),children:[(0,d.jsx)("button",{type:"button",role:"switch","aria-checked":a,disabled:h,onClick:()=>{!h&&b&&b(!a)},className:(0,e.cn)("relative inline-flex shrink-0 cursor-pointer rounded-full","transition-colors duration-200 ease-in-out","focus:outline-none focus:ring-2 focus:ring-brand-500/30",a?"bg-brand-500":"bg-surface-3",k[i].track,h&&"cursor-not-allowed"),children:(0,d.jsx)("span",{className:(0,e.cn)("pointer-events-none inline-block rounded-full bg-white shadow-sm","transform transition duration-200 ease-in-out",a?k[i].translate:"translate-x-0.5",k[i].thumb,"mt-0.5")})}),(c||g)&&(0,d.jsxs)("div",{className:"flex flex-col",children:[c&&(0,d.jsx)("span",{className:"text-sm font-medium text-text-main",children:c}),g&&(0,d.jsx)("span",{className:"text-xs text-text-muted",children:g})]})]})}},99070:(a,b,c)=>{c.d(b,{default:()=>h});var d=c(48249),e=c(71404);let f={primary:"bg-brand-500 hover:bg-brand-600 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted",secondary:"bg-surface-2 hover:bg-surface-3 text-text-main border border-border disabled:opacity-50",outline:"border border-border text-text-main hover:bg-surface-2 hover:border-brand-500/40",ghost:"text-text-muted hover:bg-surface-2 hover:text-text-main",danger:"bg-red-500 hover:bg-red-600 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted",success:"bg-green-600 hover:bg-green-700 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted"},g={sm:"h-7 px-3 text-xs rounded-[8px]",md:"h-9 px-4 text-sm rounded-[10px]",lg:"h-11 px-6 text-sm rounded-[10px]"};function h({children:a,variant:b="primary",size:c="md",icon:i,iconRight:j,disabled:k=!1,loading:l=!1,fullWidth:m=!1,className:n,...o}){return(0,d.jsxs)("button",{className:(0,e.cn)("inline-flex items-center justify-center gap-2 font-semibold transition-all duration-150 ease-out cursor-pointer","active:scale-[0.97] disabled:opacity-50 disabled:cursor-not-allowed disabled:active:scale-100",f[b],g[c],m&&"w-full",n),disabled:k||l,...o,children:[l?(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}):i?(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:i}):null,a,j&&!l&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:j})]})}}};
|
|
17
|
+
`,children:(0,d.jsxs)("span",{className:"flex items-center gap-1",children:[x.includes(a.value)&&!c&&(0,d.jsx)("span",{className:"material-symbols-outlined leading-none",style:{fontSize:"10px"},children:"check"}),c?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[11px]",children:"edit"}),a.name]}):(0,d.jsxs)(d.Fragment,{children:[a.value,(0,d.jsx)(j.default,{caps:B(a.value)})]})]})},a.value)})})]},a)),0===Object.keys(X).length&&0===V.length&&(0,d.jsxs)("div",{className:"text-center py-4 text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-2xl mb-1 block",children:"search_off"}),(0,d.jsx)("p",{className:"text-xs",children:"No models found"})]})]})]})}r.propTypes={isOpen:g().bool.isRequired,onClose:g().func.isRequired,onSelect:g().func.isRequired,onDeselect:g().func,selectedModel:g().string,activeProviders:g().arrayOf(g().shape({provider:g().string.isRequired})),title:g().string,modelAliases:g().object,kindFilter:g().string,addedModelValues:g().arrayOf(g().string),closeOnSelect:g().bool,comboContext:g().shape({id:g().string,name:g().string})}},62727:(a,b,c)=>{c.d(b,{default:()=>l});var d=c(48249),e=c(67484),f=c(95145),g=c(83552),h=c(99070),i=c(60971);let j=/^[a-zA-Z0-9_.\-]+$/;function k({index:a,model:b,isFirst:c,isLast:f,onEdit:g,onMoveUp:h,onMoveDown:i,onRemove:j}){let[l,m]=(0,e.useState)(!1),[n,o]=(0,e.useState)(b),p=()=>{let a=n.trim();a&&a!==b?g(a):o(b),m(!1)};return(0,d.jsxs)("div",{className:"group flex min-w-0 items-center gap-1.5 rounded-md bg-black/[0.02] px-2 py-1 transition-colors hover:bg-black/[0.04] dark:bg-white/[0.02] dark:hover:bg-white/[0.04]",children:[(0,d.jsx)("span",{className:"text-[10px] font-medium text-text-muted w-3 text-center shrink-0",children:a+1}),l?(0,d.jsx)("input",{autoFocus:!0,value:n,onChange:a=>o(a.target.value),onBlur:p,onKeyDown:a=>{"Enter"===a.key&&p(),"Escape"===a.key&&(o(b),m(!1))},className:"min-w-0 flex-1 rounded border border-primary/40 bg-white px-1.5 py-0.5 font-mono text-xs text-text-main outline-none dark:bg-black/20"}):(0,d.jsx)("div",{className:"min-w-0 flex-1 cursor-text truncate rounded px-1.5 py-0.5 font-mono text-xs text-text-main hover:bg-black/5 dark:hover:bg-white/5",onClick:()=>m(!0),title:"Click to edit",children:b}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,d.jsx)("button",{onClick:h,disabled:c,className:`p-0.5 rounded ${c?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move up",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_upward"})}),(0,d.jsx)("button",{onClick:i,disabled:f,className:`p-0.5 rounded ${f?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move down",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_downward"})})]}),(0,d.jsx)("button",{onClick:j,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 transition-all",title:"Remove",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]})}function l({isOpen:a,combo:b,onClose:c,onSave:m,activeProviders:n,kindFilter:o=null,forcePrefix:p="",title:q}){let r=b?.name?p&&b.name.startsWith(p)?b.name.slice(p.length):b.name:"",[s,t]=(0,e.useState)(r),[u,v]=(0,e.useState)(b?.models||[]),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(!1),[A,B]=(0,e.useState)(""),[C,D]=(0,e.useState)({}),E=a=>{if(!a.trim())return B("Name is required"),!1;let b=p+a;return j.test(b)?(B(""),!0):(B("Only letters, numbers, -, _ and . allowed"),!1)},F=a=>{let b=a.target.value;p&&b.startsWith(p)&&(b=b.slice(p.length)),t(b),b?E(b):B("")},G=async()=>{E(s)&&(z(!0),await m({name:p+s.trim(),models:u}),z(!1))},H=!!b;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.default,{isOpen:a,onClose:c,title:q||(H?"Edit Combo":"Create Combo"),children:(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{children:[p?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("label",{className:"text-sm font-medium mb-1 block",children:"Combo Name"}),(0,d.jsxs)("div",{className:"flex items-stretch",children:[(0,d.jsx)("span",{className:"inline-flex items-center px-2 rounded-l border border-r-0 border-black/10 dark:border-white/10 bg-black/[0.04] dark:bg-white/[0.04] text-text-muted font-mono text-sm",children:p}),(0,d.jsx)("input",{value:s,onChange:F,placeholder:"my-combo",className:"flex-1 min-w-0 rounded-r border border-black/10 dark:border-white/10 bg-white dark:bg-black/20 px-2 py-1.5 font-mono text-sm outline-none focus:border-primary"})]}),A&&(0,d.jsx)("p",{className:"text-[11px] text-red-500 mt-0.5",children:A})]}):(0,d.jsx)(g.default,{label:"Combo Name",value:s,onChange:F,placeholder:"my-combo",error:A}),(0,d.jsxs)("p",{className:"text-[10px] text-text-muted mt-0.5",children:[p?`Auto-prefixed with "${p}". `:"","Only letters, numbers, -, _ and . allowed"]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Models"}),0===u.length?(0,d.jsxs)("div",{className:"text-center py-4 border border-dashed border-black/10 dark:border-white/10 rounded-lg bg-black/[0.01] dark:bg-white/[0.01]",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-xl mb-1",children:"layers"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"No models added yet"})]}):(0,d.jsx)("div",{className:"flex max-h-[55vh] min-w-0 flex-col gap-1 overflow-y-auto sm:max-h-[350px]",children:u.map((a,b)=>(0,d.jsx)(k,{index:b,model:a,isFirst:0===b,isLast:b===u.length-1,onEdit:a=>{let c=[...u];c[b]=a,v(c)},onMoveUp:()=>(a=>{if(0===a)return;let b=[...u];[b[a-1],b[a]]=[b[a],b[a-1]],v(b)})(b),onMoveDown:()=>(a=>{if(a===u.length-1)return;let b=[...u];[b[a],b[a+1]]=[b[a+1],b[a]],v(b)})(b),onRemove:()=>v(u.filter((a,c)=>c!==b))},b))}),(0,d.jsxs)("button",{onClick:()=>x(!0),className:"w-full mt-2 py-2 border border-dashed border-black/10 dark:border-white/10 rounded-lg text-xs text-primary font-medium hover:text-primary hover:border-primary/50 transition-colors flex items-center justify-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add Model"]})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2 pt-1 sm:flex-row",children:[(0,d.jsx)(h.default,{onClick:c,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,d.jsx)(h.default,{onClick:G,fullWidth:!0,size:"sm",disabled:!s.trim()||!!A||y,children:y?"Saving...":H?"Save":"Create"})]})]})}),w&&(0,d.jsx)(i.default,{isOpen:w,onClose:()=>x(!1),onSelect:a=>{u.includes(a.value)||v([...u,a.value])},onDeselect:a=>{v(u.filter(b=>b!==a.value))},activeProviders:n,modelAliases:C,title:"Add Model to Combo",kindFilter:o,addedModelValues:u,closeOnSelect:!1})]})}},67559:(a,b,c)=>{c.d(b,{XD:()=>h});var d=c(92592);function e(a){if(!a)return!1;let b="oauth"===a.authType,c=("apikey"===a.authType||"api_key"===a.authType)&&d.jO.includes(a.provider);return b||c}function f(a){let b=a?.quotaPauseThresholds;return b&&"object"==typeof b?b:{}}function g(a){let b=Number(a);return!Number.isFinite(b)||b<=0||b>100?0:b}function h(a){let b=f(a),c=a?.lastQuotaSnapshot?.windows||[],d=Object.values(b).some(a=>g(a)>0),h=function(a){if(!e(a))return null;let b=f(a),c=a?.lastQuotaSnapshot?.windows;if(!c||!Array.isArray(c)||0===c.length)return null;let d=null;for(let a of c){if(!a||!0===a.unlimited)continue;let c=g(b[a.key]);if(!c)continue;let e=Number(a.remainingPercentage);Number.isFinite(e)&&e<=c&&(null===d||e<Number(d.remainingPercentage))&&(d={key:a.key,remainingPercentage:e,threshold:c})}return d}(a);return{enabled:d,paused:null!==h,triggered:h,eligible:e(a),windows:c.map(a=>{let c=g(b[a.key]),d=Number(a.remainingPercentage);return{key:a.key,remainingPercentage:Number.isFinite(d)?d:null,threshold:c,configured:c>0,paused:c>0&&!a.unlimited&&Number.isFinite(d)&&d<=c}})}}},67738:(a,b,c)=>{c.d(b,{default:()=>i});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412);function i({isOpen:a,onClose:b,onCreated:c,onSaved:f,node:g}){let j=!!g,[k,l]=(0,e.useState)({name:"",prefix:"",baseUrl:"https://api.openai.com/v1"}),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(""),[s,t]=(0,e.useState)(!1),[u,v]=(0,e.useState)(null),w=async()=>{if(k.name.trim()&&k.prefix.trim()&&k.baseUrl.trim()){n(!0);try{let a=j?`/api/provider-nodes/${g.id}`:"/api/provider-nodes",b={name:k.name,prefix:k.prefix,baseUrl:k.baseUrl};j||(b.type="custom-embedding");let d=await fetch(a,{method:j?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),e=await d.json();d.ok&&(j?f?.(e.node):c?.(e.node))}catch(a){console.log("Error saving custom embedding node:",a)}finally{n(!1)}}},x=async()=>{t(!0);try{let a=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:k.baseUrl,apiKey:o,type:"custom-embedding",modelId:q.trim()||void 0})}),b=await a.json();v(b)}catch{v({valid:!1,error:"Network error"})}finally{t(!1)}};return(0,d.jsx)(h.aF,{isOpen:a,title:j?"Edit Custom Embedding":"Add Custom Embedding",onClose:b,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)(h.pd,{label:"Name",value:k.name,onChange:a=>l({...k,name:a.target.value}),placeholder:"Voyage AI",hint:"Required. A friendly label for this embedding provider."}),(0,d.jsx)(h.pd,{label:"Prefix",value:k.prefix,onChange:a=>l({...k,prefix:a.target.value}),placeholder:"voyage",hint:"Required. Used as the provider prefix for model IDs (e.g. voyage/voyage-3)."}),(0,d.jsx)(h.pd,{label:"Base URL",value:k.baseUrl,onChange:a=>l({...k,baseUrl:a.target.value}),placeholder:"https://api.voyageai.com/v1",hint:"Most embedding APIs are OpenAI-compatible: Voyage, Cohere, Jina, Mistral, Together..."}),(0,d.jsx)(h.pd,{label:"API Key (for Check)",type:"password",value:o,onChange:a=>p(a.target.value)}),(0,d.jsx)(h.pd,{label:"Model ID (for Check)",value:q,onChange:a=>r(a.target.value),placeholder:"e.g. voyage-3, embed-english-v3.0, text-embedding-3-small",hint:"Required for validation. Will send a test embeddings request."}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)(h.$n,{onClick:x,disabled:!o||!q.trim()||s||!k.baseUrl.trim(),variant:"secondary",children:s?"Checking...":"Check"}),(()=>{if(!u)return null;let{valid:a,error:b,dimensions:c}=u;return a?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.Ex,{variant:"success",children:"Valid"}),c&&(0,d.jsxs)("span",{className:"text-sm text-text-muted",children:[c," dims"]})]}):(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)(h.Ex,{variant:"error",children:"Invalid"}),b&&(0,d.jsx)("span",{className:"text-sm text-red-500",children:b})]})})()]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:w,fullWidth:!0,disabled:!k.name.trim()||!k.prefix.trim()||!k.baseUrl.trim()||m,children:m?j?"Saving...":"Creating...":j?"Save":"Create"}),(0,d.jsx)(h.$n,{onClick:b,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}i.propTypes={isOpen:g().bool.isRequired,onClose:g().func.isRequired,onCreated:g().func,onSaved:g().func,node:g().shape({id:g().string,name:g().string,prefix:g().string,baseUrl:g().string})}},72738:(a,b,c)=>{c.d(b,{A:()=>i});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(29225);function i({src:a,providerId:b,alt:c,size:f=32,className:g="",fallbackText:j="?",fallbackColor:k}){let l=function(a,b){if(b)return(0,h.HY)(b);if(!a)return null;let c=String(a).match(/^\/providers\/([^/]+)\.png$/i);return c?(0,h.HY)(c[1]):a}(a,b),[m,n]=(0,e.useState)(!1);return!l||m?(0,d.jsx)("span",{className:`inline-flex items-center justify-center font-bold rounded-lg ${g}`.trim(),style:{width:f,height:f,color:k,fontSize:Math.max(10,Math.floor(.38*f))},children:j}):(0,d.jsx)("img",{src:l,alt:c,width:f,height:f,className:g,loading:"lazy",decoding:"async",onError:()=>{let a=l.match(/^\/providers\/([^/]+)\.png$/i);a&&(0,h.Kw)(a[1]),b&&(0,h.Kw)(b),n(!0)}})}i.propTypes={src:g().string,providerId:g().string,alt:g().string,size:g().number,className:g().string,fallbackText:g().string,fallbackColor:g().string}},73816:(a,b,c)=>{c.d(b,{default:()=>i});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412);function i({isOpen:a,onClose:b,onCreated:c,onSaved:f,node:g}){let j=!!g,[k,l]=(0,e.useState)({name:"",prefix:"",baseUrl:"https://api.x.ai/v1/videos"}),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(!1),[s,t]=(0,e.useState)(null),u=async()=>{if(k.name.trim()&&k.prefix.trim()&&k.baseUrl.trim()){n(!0);try{let a=j?`/api/provider-nodes/${g.id}`:"/api/provider-nodes",b={name:k.name,prefix:k.prefix,baseUrl:k.baseUrl};j||(b.type="custom-video");let d=await fetch(a,{method:j?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),e=await d.json();d.ok&&(j?f?.(e.node):c?.(e.node))}catch(a){console.log("Error saving custom video node:",a)}finally{n(!1)}}},v=async()=>{r(!0);try{let a=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:k.baseUrl,apiKey:o,type:"custom-video"})}),b=await a.json();t(b)}catch{t({valid:!1,error:"Network error"})}finally{r(!1)}};return(0,d.jsx)(h.aF,{isOpen:a,title:j?"Edit Custom Video":"Add Custom Video",onClose:b,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)(h.pd,{label:"Name",value:k.name,onChange:a=>l({...k,name:a.target.value}),placeholder:"Grok Imagine",hint:"Required. A friendly label for this video provider."}),(0,d.jsx)(h.pd,{label:"Prefix",value:k.prefix,onChange:a=>l({...k,prefix:a.target.value}),placeholder:"grok-video",hint:"Required. Used as the provider prefix for model IDs (e.g. grok-video/grok-imagine-video)."}),(0,d.jsx)(h.pd,{label:"Base URL",value:k.baseUrl,onChange:a=>l({...k,baseUrl:a.target.value}),placeholder:"https://api.x.ai/v1/videos",hint:"xAI-style async job endpoint. POST {base}/generations creates a job; GET {base}/{request_id} polls."}),(0,d.jsx)(h.pd,{label:"API Key (for Check)",type:"password",value:o,onChange:a=>p(a.target.value),hint:"Check probes the endpoint with an empty body — verifies the key is authorized without creating a billable job."}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)(h.$n,{onClick:v,disabled:!o||q||!k.baseUrl.trim(),variant:"secondary",children:q?"Checking...":"Check"}),(()=>{if(!s)return null;let{valid:a,error:b}=s;return a?(0,d.jsx)(h.Ex,{variant:"success",children:"Reachable \xb7 Authorized"}):(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)(h.Ex,{variant:"error",children:"Invalid"}),b&&(0,d.jsx)("span",{className:"text-sm text-red-500",children:b})]})})()]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:u,fullWidth:!0,disabled:!k.name.trim()||!k.prefix.trim()||!k.baseUrl.trim()||m,children:m?j?"Saving...":"Creating...":j?"Save":"Create"}),(0,d.jsx)(h.$n,{onClick:b,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}i.propTypes={isOpen:g().bool.isRequired,onClose:g().func.isRequired,onCreated:g().func,onSaved:g().func,node:g().shape({id:g().string,name:g().string,prefix:g().string,baseUrl:g().string})}},74812:(a,b,c)=>{c.d(b,{CardSkeleton:()=>i,PageLoading:()=>g,Skeleton:()=>h,Spinner:()=>f,default:()=>j});var d=c(48249),e=c(71404);function f({size:a="md",className:b}){return(0,d.jsx)("span",{className:(0,e.cn)("material-symbols-outlined animate-spin text-brand-500",{sm:"size-4",md:"size-6",lg:"size-8",xl:"size-12"}[a],b),children:"progress_activity"})}function g({message:a="Loading..."}){return(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center bg-bg",children:[(0,d.jsx)(f,{size:"xl"}),(0,d.jsx)("p",{className:"mt-4 text-text-muted",children:a})]})}function h({className:a,...b}){return(0,d.jsx)("div",{className:(0,e.cn)("animate-pulse rounded-[10px] bg-surface-2",a),...b})}function i(){return(0,d.jsxs)("div",{className:"p-6 rounded-[14px] border border-border-subtle bg-surface shadow-[var(--shadow-soft)]",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsx)(h,{className:"h-4 w-24"}),(0,d.jsx)(h,{className:"size-10 rounded-[10px]"})]}),(0,d.jsx)(h,{className:"h-8 w-16 mb-2"}),(0,d.jsx)(h,{className:"h-3 w-20"})]})}function j({type:a="spinner",...b}){switch(a){case"page":return(0,d.jsx)(g,{...b});case"skeleton":return(0,d.jsx)(h,{...b});case"card":return(0,d.jsx)(i,{...b});default:return(0,d.jsx)(f,{...b})}}},75171:(a,b,c)=>{c.d(b,{default:()=>h});var d=c(48249),e=c(71404);let f={default:"bg-surface-2 text-text-muted",primary:"bg-brand-500/10 text-brand-600 dark:text-brand-300",success:"bg-green-500/10 text-green-600 dark:text-green-400",warning:"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",error:"bg-red-500/10 text-red-600 dark:text-red-400",info:"bg-blue-500/10 text-blue-600 dark:text-blue-400"},g={sm:"px-2 py-0.5 text-[10px]",md:"px-2.5 py-1 text-xs",lg:"px-3 py-1.5 text-sm"};function h({children:a,variant:b="default",size:c="md",dot:i=!1,icon:j,className:k}){return(0,d.jsxs)("span",{className:(0,e.cn)("inline-flex items-center gap-1.5 rounded-full font-semibold",f[b],g[c],k),children:[i&&(0,d.jsx)("span",{className:(0,e.cn)("size-1.5 rounded-full","success"===b&&"bg-green-500","warning"===b&&"bg-yellow-500","error"===b&&"bg-red-500","info"===b&&"bg-blue-500","primary"===b&&"bg-brand-500","default"===b&&"bg-gray-500")}),j&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:j}),a]})}},79346:(a,b,c)=>{c.d(b,{default:()=>l});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412),i=c(50377);let j=new Set(["trae","windsurf","zed"]),k={trae:{label:"Cloud-IDE-JWT",instructions:"Sign in at trae.ai (or solo.trae.ai), open DevTools → Network, copy the Cloud-IDE-JWT token from any request's Authorization header (~14-day lifetime).",placeholder:"Paste Cloud-IDE-JWT here...",ideName:"Trae",ideOptional:!0},windsurf:{label:"Windsurf API key",instructions:'In the Windsurf/VS Code IDE, run the "Windsurf: Provide Auth Token" command, then copy the displayed sk-ws-... key.',placeholder:"Paste sk-ws-... key here...",ideName:"Windsurf",ideOptional:!1}};function l({isOpen:a,provider:b,providerInfo:c,onSuccess:f,onClose:g,oauthMeta:m,idcConfig:n}){let[o,p]=(0,e.useState)("waiting"),[q,r]=(0,e.useState)(null),[s,t]=(0,e.useState)(""),[u,v]=(0,e.useState)(null),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(null),[A,B]=(0,e.useState)(!1),[C,D]=(0,e.useState)("browser"),[E,F]=(0,e.useState)(""),[G,H]=(0,e.useState)(null),[I,J]=(0,e.useState)(!1),K=(0,e.useRef)(null),L=(0,e.useRef)(!1);(0,e.useRef)(!1);let M=(0,e.useRef)({proxyStarted:!1,proxyProvider:null,stopSent:!1}),N=(0,e.useRef)(f),O=(0,e.useRef)(g),P=(0,e.useRef)(a);(0,e.useRef)(null);let{copied:Q,copy:R}=(0,i.C)(),[S,T]=(0,e.useState)(!1),[U,V]=(0,e.useState)("/callback?code=...");(0,e.useRef)(!1);let W=(0,e.useCallback)(async(a,c)=>{try{J(!0),v(null);let d=q?.redirectUri||"",e=q?.codeVerifier||null,f=c||q?.state||null,g=await fetch(`/api/oauth/${b}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,redirectUri:d,codeVerifier:e,state:f,...q?.systemId?{systemId:q.systemId}:{},...m?{meta:m}:{}})}),h=await g.json();if(!g.ok||h?.success===!1)throw Error(h.error||"Token exchange failed");p("success"),N.current?.()}catch(a){v(a.message),p("error")}finally{J(!1)}},[q,b,m]),X=(0,e.useCallback)(async a=>{if(q?.state)try{let b=await fetch("/api/oauth/xai/manual-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,state:q.state})}),c=await b.json();if(!b.ok)throw Error(c.error);p("success"),N.current?.()}catch(a){v(a.message),p("error")}},[q]),Y=(0,e.useCallback)(async(a,c,d,e,f)=>{L.current=!1,B(!0);let g=Date.now()+(Number.isFinite(f)&&f>0?f:12e4);for(;Date.now()<g;){if(L.current){console.log("[OAuthModal] Polling aborted"),B(!1);return}if(await new Promise(a=>setTimeout(a,1e3*d)),L.current){console.log("[OAuthModal] Polling aborted after sleep"),B(!1);return}try{let f=await fetch(`/api/oauth/${b}/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:a,codeVerifier:c,extraData:e,..."cursor"===b?{state:a}:{}})}),g=await f.json();if(g.success){L.current=!0,p("success"),B(!1),N.current?.();return}if("expired_token"===g.error||"access_denied"===g.error)throw Error(g.errorDescription||g.error);"slow_down"===g.error&&(d=Math.min(d+5,30))}catch(a){v(a.message),p("error"),B(!1);return}}v("Authorization timeout"),p("error"),B(!1)},[b]),Z=(0,e.useCallback)(()=>{let a=M.current;a.proxyStarted&&!a.stopSent&&a.proxyProvider&&(a.stopSent=!0,fetch(`/api/oauth/${a.proxyProvider}/stop-proxy`).catch(()=>{}))},[]),$=(0,e.useCallback)(async a=>{let b=await fetch(`/api/oauth/${a}/start-proxy`),c=await b.json();if(!b.ok||!c.success||!c.callbackUrl)throw Error(c.reason||c.error||`Failed to start ${a} callback server`);if(M.current.proxyStarted=!0,M.current.proxyProvider=a,M.current.stopSent=!1,!P.current)return void Z();let d=new URL(`/api/oauth/${a}/authorize`,window.location.origin);d.searchParams.set("redirect_uri",c.callbackUrl);let e=await fetch(d),f=await e.json();if(!e.ok)throw Z(),Error(f.error);if(!P.current)return void Z();let g={state:f.state};f.codeVerifier&&(g.codeVerifier=f.codeVerifier),f.systemId&&(g.systemId=f.systemId);let h=await fetch(`/api/oauth/${a}/register-session`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)}),i=null;try{i=await h.json()}catch{i=null}if(!h.ok||i?.success===!1)throw Z(),Error(i?.error||"Failed to register login session; please retry");P.current&&(r({...f,proxyProvider:a}),p("waiting"),K.current=window.open(f.authUrl,"oauth_popup","width=600,height=700"),K.current||p("input"))},[Z]),_=async()=>{if(b)try{let a;if(v(null),"cursor"===b){x(!0),p("waiting");let a=await fetch(`/api/oauth/cursor/authorize?redirect_uri=${encodeURIComponent(window.location.origin+"/callback")}`),b=await a.json();if(!a.ok)throw Error(b.error);r(b),z({verification_uri:b.authUrl,user_code:""}),b.authUrl&&window.open(b.authUrl,"_blank","noopener,noreferrer"),Y(b.state,null,2,null,1e3*(b.expiresIn||300));return}if(j.has(b)&&"browser"===C)return void await $(b);if(["github","qwen","kiro","kimi","kimi-coding","kilocode","codebuddy-cn","qoder","grok-cli","frontier-for-all"].includes(b)){x(!0),p("waiting");let a=new URL(`/api/oauth/${b}/device-code`,window.location.origin);"kiro"===b&&n?.startUrl&&(a.searchParams.set("start_url",n.startUrl),n.region&&a.searchParams.set("region",n.region),a.searchParams.set("auth_method","idc"));let c=await fetch(a.toString()),d=await c.json();if(!c.ok)throw Error(d.error);z(d);let e=d.verification_uri_complete||d.verification_uri;e&&window.open(e,"_blank","noopener,noreferrer");let f="kiro"===b?{_clientId:d._clientId,_clientSecret:d._clientSecret,_region:d._region,_authMethod:d._authMethod,_startUrl:d._startUrl}:"qoder"===b?{_qoderNonce:d._qoderNonce,_qoderMachineId:d._qoderMachineId,_qoderVerifier:d.codeVerifier}:"kimi"===b||"kimi-coding"===b?{_kimiDeviceId:d._kimiDeviceId}:null;Y(d.device_code,d.codeVerifier,d.interval||5,f,Number.isFinite(d.expires_in)&&d.expires_in>0?1e3*d.expires_in:void 0);return}let c=window.location.port||("https:"===window.location.protocol?"443":"80");a="codex"===b?"http://localhost:1455/auth/callback":"xai"===b?"http://127.0.0.1:56121/callback":`${window.location.origin}/callback`;let d=new URL(`/api/oauth/${b}/authorize`,window.location.origin);d.searchParams.set("redirect_uri",a),m&&Object.entries(m).forEach(([a,b])=>{b&&d.searchParams.set(a,b)});let e=await fetch(d.toString()),f=await e.json();if(!e.ok)throw Error(f.error);let g=!1,h=!1;if("codex"===b)try{let b=new URL("/api/oauth/codex/start-proxy",window.location.origin);b.searchParams.set("app_port",c),b.searchParams.set("state",f.state),b.searchParams.set("code_verifier",f.codeVerifier),b.searchParams.set("redirect_uri",a);let d=await fetch(b.toString()),e=await d.json();g=e.success,h=!!e.serverSide}catch{g=!1}let i=!1,k=!1;if("xai"===b)try{let b=new URL("/api/oauth/xai/start-proxy",window.location.origin);b.searchParams.set("app_port",c),b.searchParams.set("state",f.state),b.searchParams.set("code_verifier",f.codeVerifier),b.searchParams.set("redirect_uri",a);let d=await fetch(b.toString()),e=await d.json();if(i=e.success,k=!!e.serverSide,!i&&"port_busy"===e.reason)throw Error("Port 56121 in use; close the conflicting process and retry")}catch(a){if(a?.message)throw a;i=!1}if(r({...f,redirectUri:a,codexServerSide:h,xaiServerSide:k}),("codex"===b&&g||"xai"===b&&i)&&(M.current.proxyStarted=!0,M.current.proxyProvider=b,M.current.stopSent=!1),!f.authUrl){if("device_code"===f.flowType)throw Error(`Provider ${b} uses device-code login but is not wired in the OAuth modal device-code list`);throw Error("No authorization URL returned from OAuth provider")}"codex"===b&&g||"xai"===b&&i||S&&"codex"!==b&&"xai"!==b?(p("waiting"),K.current=window.open(f.authUrl,"oauth_popup","width=600,height=700"),K.current||p("input")):(p("input"),window.open(f.authUrl,"_blank"))}catch(a){v(a.message),p("error")}},aa=async()=>{try{if(v(null),"paste-token"===C&&k[b]){let a=E.trim();if(!a)throw Error("Missing token");let c=await fetch(`/api/oauth/${b}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a})}),d=await c.json();if(!c.ok)throw Error(d.error);p("success"),N.current?.();return}let a=s.trim();if(!a)return;if(J(!0),j.has(b)&&a){let c=await fetch(`/api/oauth/${b}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,state:q?.state,...q?.redirectUri?{redirectUri:q.redirectUri}:{},...q?.codeVerifier?{codeVerifier:q.codeVerifier}:{},...q?.systemId?{systemId:q.systemId}:{}})}),d=await c.json();if(!c.ok)throw Error(d.error);p("success"),N.current?.();return}if(a.startsWith("eyJ")&&a.includes("."))return void await W(a,null);if("xai"===b&&a&&!a.includes("://")&&!a.includes("?")&&!a.includes("code="))return void await X(a);if("kimchi"===b&&a&&!a.includes("://")&&!a.includes("?"))return void await W(a,null);let c=null,d=null,e=null,f=null;if(a.includes("://")||a.startsWith("/")||a.startsWith("?")){let b=a.startsWith("/")||a.startsWith("?")?`http://localhost${a.startsWith("?")?"":"/"}${a}`:a;try{let a=new URL(b);if(c=a.searchParams.get("code"),d=a.searchParams.get("token"),e=a.searchParams.get("state"),f=a.searchParams.get("error"))throw Error(a.searchParams.get("error_description")||f)}catch(b){if(f)throw b;c=a}}else c=a;if(!c&&!d)throw Error("xai"===b?"Paste the callback URL or copied xAI code":"kimchi"===b?"No Kimchi token found in URL":"No authorization code found in URL");await W(d||c,e)}catch(a){v(a.message),p("error")}finally{J(!1)}},ab=(0,e.useCallback)(()=>{Z(),"codex"===b?fetch("/api/oauth/codex/stop-proxy").catch(()=>{}):"xai"===b&&fetch("/api/oauth/xai/stop-proxy").catch(()=>{}),O.current?.()},[Z,b]);if(!b||!c)return null;let ac="xai"===b,ad="kimchi"===b,ae="zed"===b&&"browser"===C&&!1,af=!!k[b],ag=y?.verification_uri_complete||y?.verification_uri||"",ah=ac?"Connect Grok Build OAuth":`Connect ${c.name}`,ai=ac?"http://127.0.0.1:56121/callback?code=... or copied code":ad?`${U.replace("code=...","token=...")} or copied token`:U;return(0,d.jsx)(h.aF,{isOpen:a,title:ah,onClose:ab,size:"lg",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[j.has(b)&&("waiting"===o||"input"===o||"error"===o)&&(0,d.jsxs)(d.Fragment,{children:[af&&(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("button",{type:"button",onClick:()=>{D("browser"),v(null),p("waiting"),_()},className:`flex-1 rounded-lg border px-3 py-2 text-sm transition-colors ${"browser"===C?"border-primary bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:"\uD83C\uDF10 Sign in with browser"}),(0,d.jsx)("button",{type:"button",onClick:()=>{D("paste-token"),v(null),p("input")},className:`flex-1 rounded-lg border px-3 py-2 text-sm transition-colors ${"paste-token"===C?"border-primary bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:"\uD83D\uDD11 Paste token"})]}),"browser"===C&&(0,d.jsxs)(d.Fragment,{children:["waiting"===o&&!ae&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border border-border rounded-lg bg-sidebar/50",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-base text-primary animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{className:"text-sm",children:"Waiting for browser authorization…"})]}),"input"===o&&ae&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Sign in at Zed in your browser"}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"A Zed sign-in tab was opened. Complete the sign-in there — Zed will land on a 127.0.0.1 address that only your own computer can see, which is expected."}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.pd,{value:q?.authUrl||"",readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,d.jsx)(h.$n,{variant:"secondary",icon:"auth_url"===Q?"check":"content_copy",onClick:()=>R(q?.authUrl,"auth_url"),disabled:!q?.authUrl,children:"Copy"}),(0,d.jsx)(h.$n,{variant:"secondary",icon:"open_in_new",onClick:()=>q?.authUrl&&window.open(q.authUrl,"_blank","noopener,noreferrer"),disabled:!q?.authUrl,children:"Open"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL from your browser here"}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Copy the full 127.0.0.1 URL from your browser's address bar (it contains your user_id and an encrypted token, which is decrypted on the server)."}),(0,d.jsx)(h.pd,{value:s,onChange:a=>t(a.target.value),placeholder:"http://127.0.0.1:58443/?user_id=...&access_token=...",className:"font-mono text-xs"})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:aa,fullWidth:!0,disabled:!s,children:"Connect"}),(0,d.jsx)(h.$n,{onClick:ab,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"input"===o&&!ae&&(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Popup was blocked. After authorizing in the browser, paste the full callback URL here:"}),(0,d.jsx)(h.pd,{value:s,onChange:a=>t(a.target.value),placeholder:"http://127.0.0.1:.../callback?...",className:"font-mono text-xs"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:aa,fullWidth:!0,disabled:!s,children:"Connect"}),(0,d.jsx)(h.$n,{onClick:ab,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]}),"paste-token"===C&&af&&(0,d.jsxs)("div",{className:"space-y-3",children:[G&&!G.installed&&(0,d.jsxs)("div",{className:`px-3 py-2 rounded-lg text-sm ${k[b].ideOptional?"bg-blue-500/10 text-blue-700 dark:text-blue-300":"bg-yellow-500/10 text-yellow-700 dark:text-yellow-300"}`,children:[k[b].ideName," IDE not detected.",k[b].ideOptional?" You can still grab the token from DevTools.":` Install ${k[b].ideName} IDE to get the token, or use "Sign in with browser".`]}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:k[b].instructions}),(0,d.jsx)(h.pd,{value:E,onChange:a=>F(a.target.value),placeholder:k[b].placeholder,className:"font-mono text-xs"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:aa,fullWidth:!0,disabled:!E,children:"Connect"}),(0,d.jsx)(h.$n,{onClick:ab,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]}),("waiting"===o||"input"===o)&&!w&&!j.has(b)&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border border-border rounded-lg bg-sidebar/50",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-base text-primary animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{className:"text-sm",children:ac?"Waiting for Grok Build OAuth…":"Waiting for popup authorization…"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3 my-1",children:[(0,d.jsx)("div",{className:"flex-1 h-px bg-border"}),(0,d.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wider",children:"Or paste callback URL manually"}),(0,d.jsx)("div",{className:"flex-1 h-px bg-border"})]}),(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("p",{className:"text-sm font-medium mb-2",children:["Step 1: Open this ",ac?"Grok Build OAuth URL":"URL"," in your browser"]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.pd,{value:q?.authUrl||"",readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,d.jsx)(h.$n,{variant:"secondary",icon:"auth_url"===Q?"check":"content_copy",onClick:()=>R(q?.authUrl,"auth_url"),disabled:!q?.authUrl,children:"Copy"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("p",{className:"text-sm font-medium mb-2",children:["Step 2: Paste the ","xai"===b?"callback URL or copied code":ad?"callback URL or copied token":"callback URL"," here"]}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"xai"===b?"If xAI shows a code instead of redirecting, paste that code here.":ad?"After authorization, copy the full callback URL or token from your browser.":"After authorization, copy the full URL from your browser."}),(0,d.jsx)(h.pd,{value:s,onChange:a=>t(a.target.value),placeholder:ai,className:"font-mono text-xs"})]})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:aa,fullWidth:!0,disabled:!s.trim()||I,children:I?"Connecting...":"Connect"}),(0,d.jsx)(h.$n,{onClick:ab,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"waiting"===o&&w&&y&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"text-center py-4",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Visit the login URL below and authorize:"}),(0,d.jsxs)("div",{className:"bg-sidebar p-4 rounded-lg mb-4",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Login URL"}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("code",{className:"flex-1 text-sm break-all",children:ag}),(0,d.jsx)(h.$n,{size:"sm",variant:"ghost",icon:"login_url"===Q?"check":"content_copy",onClick:()=>R(ag,"login_url"),disabled:!ag}),(0,d.jsx)(h.$n,{size:"sm",variant:"ghost",icon:"open_in_new",onClick:()=>window.open(ag,"_blank","noopener,noreferrer"),disabled:!ag,children:"Open"})]})]}),y.user_code&&(0,d.jsxs)("div",{className:"bg-primary/10 p-4 rounded-lg",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Your Code"}),(0,d.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,d.jsx)("p",{className:"text-2xl font-mono font-bold text-primary",children:y.user_code}),(0,d.jsx)(h.$n,{size:"sm",variant:"ghost",icon:"user_code"===Q?"check":"content_copy",onClick:()=>R(y.user_code,"user_code")})]})]})]}),A&&(0,d.jsxs)("div",{className:"flex items-center justify-center gap-2 text-sm text-text-muted",children:[(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),"Waiting for authorization..."]})]}),"success"===o&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-green-600",children:"check_circle"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,d.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your ",c.name," account has been connected."]}),(0,d.jsx)(h.$n,{onClick:ab,fullWidth:!0,children:"Done"})]}),"error"===o&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-red-600",children:"error"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,d.jsx)("p",{className:"text-sm text-red-600 mb-4",children:u}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:_,variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,d.jsx)(h.$n,{onClick:ab,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}l.propTypes={isOpen:g().bool.isRequired,provider:g().string,providerInfo:g().shape({name:g().string}),onSuccess:g().func,onClose:g().func.isRequired,oauthMeta:g().object,idcConfig:g().shape({startUrl:g().string,region:g().string})}},79488:(a,b,c)=>{c.d(b,{default:()=>i});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412);function i({isOpen:a,onSuccess:b,onClose:c}){let[f,g]=(0,e.useState)(""),[j,k]=(0,e.useState)(!1),[l,m]=(0,e.useState)(null),[n,o]=(0,e.useState)(!1),p=async()=>{if(!f.trim())return void m("Please paste your cookie");k(!0),m(null);try{let a=await fetch("/api/oauth/iflow/cookie",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookie:f.trim()})}),c=await a.json();if(!a.ok)throw Error(c.error||"Authentication failed");o(!0),setTimeout(()=>{b?.(),q()},1500)}catch(a){m(a.message)}finally{k(!1)}},q=()=>{g(""),m(null),o(!1),c?.()};return(0,d.jsx)(h.aF,{isOpen:a,onClose:q,title:"iFlow Cookie Authentication",children:(0,d.jsx)("div",{className:"space-y-4",children:n?(0,d.jsxs)("div",{className:"text-center py-8",children:[(0,d.jsx)("div",{className:"text-6xl mb-4",children:"✅"}),(0,d.jsx)("p",{className:"text-lg font-medium text-text-primary",children:"Authentication Successful!"}),(0,d.jsx)("p",{className:"text-sm text-text-muted mt-2",children:"Fresh API key obtained"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["To get a fresh API key, paste your browser cookie from"," ",(0,d.jsx)("a",{href:"https://platform.iflow.cn",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"platform.iflow.cn"})]}),(0,d.jsxs)("div",{className:"bg-surface-secondary p-3 rounded-lg text-xs space-y-2",children:[(0,d.jsx)("p",{className:"font-medium text-text-primary",children:"How to get cookie:"}),(0,d.jsxs)("ol",{className:"list-decimal list-inside space-y-1 text-text-muted",children:[(0,d.jsx)("li",{children:"Open platform.iflow.cn in your browser"}),(0,d.jsx)("li",{children:"Login to your account"}),(0,d.jsx)("li",{children:"Open DevTools (F12) → Application/Storage → Cookies"}),(0,d.jsx)("li",{children:"Copy the entire cookie string (must include BXAuth)"}),(0,d.jsx)("li",{children:"Paste it below"})]})]})]}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("label",{className:"block text-sm font-medium text-text-primary",children:"Cookie String"}),(0,d.jsx)("textarea",{value:f,onChange:a=>g(a.target.value),placeholder:"BXAuth=xxx; ...",className:"w-full px-3 py-2 bg-surface-secondary border border-border rounded-lg text-sm text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-primary resize-none",rows:4,disabled:j})]}),l&&(0,d.jsx)("div",{className:"p-3 bg-error/10 border border-error/20 rounded-lg",children:(0,d.jsx)("p",{className:"text-sm text-error",children:l})}),(0,d.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,d.jsx)(h.$n,{variant:"secondary",onClick:q,disabled:j,fullWidth:!0,children:"Cancel"}),(0,d.jsx)(h.$n,{onClick:p,loading:j,fullWidth:!0,children:"Authenticate"})]})]})})})}i.propTypes={isOpen:g().bool.isRequired,onSuccess:g().func,onClose:g().func}},83552:(a,b,c)=>{c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({label:a,type:b="text",placeholder:c,value:g,onChange:h,error:i,hint:j,icon:k,disabled:l=!1,required:m=!1,className:n,inputClassName:o,...p}){return(0,d.jsxs)("div",{className:(0,e.cn)("flex flex-col gap-1.5",n),children:[a&&(0,d.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[a,m&&(0,d.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,d.jsxs)("div",{className:"relative",children:[k&&(0,d.jsx)("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-text-muted",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:k})}),(0,d.jsx)("input",{type:b,placeholder:c,value:g,onChange:h,disabled:l,className:(0,e.cn)("w-full py-2.5 px-3 text-sm text-text-main bg-surface-2 rounded-[10px]","border border-transparent placeholder-text-muted/70","focus:outline-none focus:ring-2 focus:ring-brand-500/30 focus:border-brand-500/40","transition-all duration-150 ease-out disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",k&&"pl-10",i&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",o),...p})]}),i&&(0,d.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),i]}),j&&!i&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:j})]})}},85158:(a,b,c)=>{c.d(b,{default:()=>i});var d=c(48249),e=c(67484),f=c(71404),g=c(99070),h=c(91099);function i({currentPage:a,pageSize:b,totalItems:c,onPageChange:j,onPageSizeChange:k,className:l,pageSizeOptions:m=[10,20,50],allowCustomPageSize:n=!1,maxPageSize:o=500}){let[p,q]=(0,e.useState)(!1),[r,s]=(0,e.useState)(String(b)),t=()=>{let a=Number.parseInt(r,10);if(!Number.isFinite(a))return void s(String(b));let c=Math.min(o,Math.max(1,a));s(String(c)),c!==b&&k(c)},u=Math.ceil(c/b),v=c>0?(a-1)*b+1:0,w=Math.min(a*b,c),x=(()=>{let b=[],c=Math.max(1,a-2),d=Math.min(u,c+5-1);d-c+1<5&&(c=Math.max(1,d-5+1));for(let a=c;a<=d;a++)b.push(a);return b})();return(0,d.jsxs)("div",{className:(0,f.cn)("flex flex-col gap-2 py-4 px-2",l),children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 sm:gap-4",children:[c>0&&(0,d.jsxs)("div",{className:"whitespace-nowrap text-sm text-text-muted",children:["Showing ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:v})," to"," ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:w})," of"," ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:c})," results"]}),k&&(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"text-sm text-text-muted",children:"Rows:"}),(0,d.jsx)(h.default,{size:"sm",value:p&&n?"__custom__":String(b),options:[...m.map(a=>({value:String(a),label:String(a)})),...n?[{value:"__custom__",label:"Custom"}]:[]],onChange:a=>{if("__custom__"===a){q(!0),s(String(b));return}q(!1),k(Number(a))}}),p&&n&&(0,d.jsx)("input",{type:"number",min:"1",max:String(o),value:r,onChange:a=>s(a.target.value),onBlur:t,onKeyDown:a=>{"Enter"===a.key&&t()},className:(0,f.cn)("h-7 w-20 rounded-[8px] border border-border bg-surface-2","px-2 text-xs text-text-main focus:outline-none focus:ring-2 focus:ring-brand-500/30","transition-all"),style:{colorScheme:"auto"},"aria-label":"Custom accounts per page"})]})]}),u>1&&(0,d.jsx)("div",{className:"flex justify-end",children:(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[(0,d.jsx)(g.default,{variant:"outline",size:"sm",onClick:()=>j(a-1),disabled:1===a,className:"w-9 px-0","aria-label":"Go to previous page",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_left"})}),(0,d.jsxs)("span",{className:"px-2 text-sm text-text-muted sm:hidden",children:["Page ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:a})," of"," ",(0,d.jsx)("span",{className:"font-medium text-text-main",children:u})]}),(0,d.jsxs)("div",{className:"hidden items-center gap-1 sm:flex",children:[x[0]>1&&(0,d.jsx)(g.default,{variant:"ghost",size:"sm",onClick:()=>j(1),className:"w-9 px-0","aria-label":"Go to first page",children:"1"}),x[0]>2&&(0,d.jsx)(g.default,{variant:"ghost",size:"sm",onClick:()=>j(Math.max(1,a-5)),className:"w-9 px-0","aria-label":"Jump 5 pages back",children:"..."}),x.map(b=>{let c=a===b;return(0,d.jsx)(g.default,{variant:c?"primary":"ghost",size:"sm",onClick:()=>j(b),className:"w-9 px-0","aria-label":`Go to page ${b}`,"aria-current":c?"page":void 0,children:b},b)}),x[x.length-1]<u-1&&(0,d.jsx)(g.default,{variant:"ghost",size:"sm",onClick:()=>j(Math.min(u,a+5)),className:"w-9 px-0","aria-label":"Jump 5 pages forward",children:"..."}),x[x.length-1]<u&&(0,d.jsx)(g.default,{variant:"ghost",size:"sm",onClick:()=>j(u),className:"w-9 px-0","aria-label":"Go to last page",children:u})]}),(0,d.jsx)(g.default,{variant:"outline",size:"sm",onClick:()=>j(a+1),disabled:a===u,className:"w-9 px-0","aria-label":"Go to next page",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"chevron_right"})})]})})]})}},91099:(a,b,c)=>{c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({options:a=[],value:b,onChange:c,size:g="md",className:h}){let i={sm:"h-7 text-xs",md:"h-9 text-sm",lg:"h-11 text-base"};return(0,d.jsx)("div",{className:(0,e.cn)("inline-flex items-center p-1 rounded-[10px] overflow-x-auto","bg-surface-2",h),children:a.map(a=>(0,d.jsxs)("button",{onClick:()=>c(a.value),className:(0,e.cn)("shrink-0 px-4 rounded-[8px] font-medium transition-all",i[g],b===a.value?"bg-surface text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[a.icon&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] mr-1.5",children:a.icon}),a.label]},a.value))})}},91809:(a,b,c)=>{c.d(b,{default:()=>g});var d=c(48249),e=c(67484),f=c(17660);function g(){let[a,b]=(0,e.useState)([]),[c,g]=(0,e.useState)(!0),[h,i]=(0,e.useState)(!0);return(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("h2",{className:"text-xl font-semibold",children:"Request Logs"}),(0,d.jsx)("div",{className:"flex items-center gap-2",children:(0,d.jsxs)("label",{className:"text-sm font-medium text-text-muted flex items-center gap-2 cursor-pointer",children:[(0,d.jsx)("span",{children:"Auto Refresh (3s)"}),(0,d.jsx)("div",{onClick:()=>i(!h),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors focus:outline-none ${h?"bg-primary":"bg-bg-subtle border border-border"}`,children:(0,d.jsx)("span",{className:`inline-block h-3 w-3 transform rounded-full bg-white transition-transform ${h?"translate-x-5":"translate-x-1"}`})})]})})]}),(0,d.jsx)(f.default,{className:"overflow-hidden bg-black/5 dark:bg-black/20",children:(0,d.jsx)("div",{className:"p-0 overflow-x-auto max-h-[600px] overflow-y-auto font-mono text-xs",children:c&&0===a.length?(0,d.jsx)("div",{className:"p-8 text-center text-text-muted",children:"Loading logs..."}):0===a.length?(0,d.jsx)("div",{className:"p-8 text-center text-text-muted",children:"No logs recorded yet."}):(0,d.jsxs)("table",{className:"w-full text-left border-collapse whitespace-nowrap",children:[(0,d.jsx)("thead",{className:"sticky top-0 bg-bg-subtle border-b border-border z-10",children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"DateTime"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Model"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Provider"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Account"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"In"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Out"}),(0,d.jsx)("th",{className:"px-3 py-2",children:"Status"})]})}),(0,d.jsx)("tbody",{className:"divide-y divide-border/50",children:a.map((a,b)=>{let c=a.split(" | ");if(c.length<7)return null;let e=c[6],f=e.includes("PENDING"),g=e.includes("FAILED"),h=e.includes("OK");return(0,d.jsxs)("tr",{className:`hover:bg-primary/5 transition-colors ${f?"bg-primary/5":""}`,children:[(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-text-muted",children:c[0]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border font-medium",children:c[1]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border",children:(0,d.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-bg-subtle border border-border text-[10px] uppercase font-bold",children:c[2]})}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border truncate max-w-[150px]",title:c[3],children:c[3]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-primary",children:c[4]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-success",children:c[5]}),(0,d.jsx)("td",{className:`px-3 py-1.5 font-bold ${h?"text-success":g?"text-error":"text-primary animate-pulse"}`,children:e})]},b)})})]})})}),(0,d.jsx)("div",{className:"text-[10px] text-text-muted italic",children:"Logs are loaded from the request history database."})]})}},95145:(a,b,c)=>{c.d(b,{ConfirmModal:()=>j,default:()=>i});var d=c(48249),e=c(67484),f=c(71404),g=c(99070),h=c(32971);function i({isOpen:a,onClose:b,title:c,children:g,footer:j,size:k="md",closeOnOverlay:l=!0,showTrafficLights:m=!0,allowFullscreen:n=!0,className:o}){let[p,q]=(0,e.useState)(!1);return a?(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-[2px] fade-in",onClick:l?b:void 0}),(0,d.jsxs)("div",{className:(0,f.cn)("relative w-full bg-surface","border border-border-subtle","rounded-[14px] shadow-[var(--shadow-elev)]","fade-in transition-all duration-150",p?"max-w-[95vw] w-[95vw] h-[90vh] max-h-[90vh] flex flex-col":({sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl",full:"max-w-4xl"})[k],o),children:[(c||m)&&(0,d.jsxs)("div",{className:"flex items-center justify-between p-2 border-b border-border-subtle select-none cursor-default",onDoubleClick:()=>n&&q(a=>!a),children:[(0,d.jsxs)("div",{className:"flex items-center",children:[m&&(0,d.jsxs)("div",{className:"hidden md:flex items-center gap-2 mr-4 ml-2",children:[(0,d.jsx)(h.default,{text:"Close",position:"top",color:"#FF5F56",children:(0,d.jsx)("button",{onClick:b,"aria-label":"Close",title:"Close",className:"w-4 h-4 rounded-full bg-[#FF5F56] hover:brightness-90 transition-all cursor-pointer flex items-center justify-center group/dot",children:(0,d.jsx)("span",{className:"text-[9px] font-bold text-white opacity-0 group-hover/dot:opacity-100 transition-opacity leading-none",children:"✕"})})}),(0,d.jsx)("div",{className:"w-4 h-4 rounded-full bg-[#3a3a3a]/20 dark:bg-white/15 cursor-not-allowed"}),n?(0,d.jsx)(h.default,{text:p?"Restore":"Maximize",position:"top",color:"#28C840",children:(0,d.jsx)("button",{type:"button",onClick:()=>q(a=>!a),"aria-label":p?"Restore":"Maximize",title:p?"Restore":"Maximize (Full screen)",className:"w-4 h-4 rounded-full bg-[#28C840] border border-[#1AAB29] hover:brightness-90 transition-all cursor-pointer flex items-center justify-center group/dot",children:(0,d.jsx)("span",{className:"text-[10px] font-bold text-[#004d11] opacity-0 group-hover/dot:opacity-100 transition-opacity leading-none",children:p?"⤡":"⤢"})})}):(0,d.jsx)("div",{className:"w-4 h-4 rounded-full bg-[#3a3a3a]/20 dark:bg-white/15 cursor-not-allowed"})]}),c&&(0,d.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:c})]}),(0,d.jsxs)("div",{className:"flex items-center gap-1",children:[n&&(0,d.jsx)("button",{type:"button",onClick:()=>q(a=>!a),"aria-label":p?"Restore":"Full Screen",title:p?"Restore":"Full Screen",className:"hidden md:flex p-1.5 rounded-[10px] text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors cursor-pointer",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:p?"close_fullscreen":"open_in_full"})}),(0,d.jsx)("button",{onClick:b,"aria-label":"Close",className:"md:hidden p-1.5 rounded-[10px] text-text-muted hover:bg-surface-2 hover:text-text-main transition-colors",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]})]}),(0,d.jsx)("div",{className:(0,f.cn)("p-6 overflow-y-auto custom-scrollbar",p?"flex-1 min-h-0":"max-h-[calc(85vh-100px)]"),children:g}),j&&(0,d.jsx)("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-border-subtle",children:j})]})]}):null}function j({isOpen:a,onClose:b,onConfirm:c,title:e="Confirm",message:f,confirmText:h="Confirm",cancelText:k="Cancel",variant:l="danger",loading:m=!1}){return(0,d.jsx)(i,{isOpen:a,onClose:b,title:e,size:"sm",footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g.default,{variant:"ghost",onClick:b,disabled:m,children:k}),(0,d.jsx)(g.default,{variant:l,onClick:c,loading:m,children:h})]}),children:(0,d.jsx)("p",{className:"text-text-muted",children:f})})}},95514:(a,b,c)=>{c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({checked:a=!1,onChange:b,label:c,description:g,disabled:h=!1,size:i="md",className:j}){let k={sm:{track:"w-8 h-4",thumb:"size-3",translate:"translate-x-4"},md:{track:"w-11 h-6",thumb:"size-5",translate:"translate-x-5"},lg:{track:"w-14 h-7",thumb:"size-6",translate:"translate-x-7"}};return(0,d.jsxs)("div",{className:(0,e.cn)("flex items-center gap-3",h&&"opacity-50 cursor-not-allowed",j),children:[(0,d.jsx)("button",{type:"button",role:"switch","aria-checked":a,disabled:h,onClick:()=>{!h&&b&&b(!a)},className:(0,e.cn)("relative inline-flex shrink-0 cursor-pointer rounded-full","transition-colors duration-200 ease-in-out","focus:outline-none focus:ring-2 focus:ring-brand-500/30",a?"bg-brand-500":"bg-surface-3",k[i].track,h&&"cursor-not-allowed"),children:(0,d.jsx)("span",{className:(0,e.cn)("pointer-events-none inline-block rounded-full bg-white shadow-sm","transform transition duration-200 ease-in-out",a?k[i].translate:"translate-x-0.5",k[i].thumb,"mt-0.5")})}),(c||g)&&(0,d.jsxs)("div",{className:"flex flex-col",children:[c&&(0,d.jsx)("span",{className:"text-sm font-medium text-text-main",children:c}),g&&(0,d.jsx)("span",{className:"text-xs text-text-muted",children:g})]})]})}},99070:(a,b,c)=>{c.d(b,{default:()=>h});var d=c(48249),e=c(71404);let f={primary:"bg-brand-500 hover:bg-brand-600 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted",secondary:"bg-surface-2 hover:bg-surface-3 text-text-main border border-border disabled:opacity-50",outline:"border border-border text-text-main hover:bg-surface-2 hover:border-brand-500/40",ghost:"text-text-muted hover:bg-surface-2 hover:text-text-main",danger:"bg-red-500 hover:bg-red-600 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted",success:"bg-green-600 hover:bg-green-700 text-white shadow-sm disabled:bg-surface-3 disabled:text-text-muted"},g={sm:"h-7 px-3 text-xs rounded-[8px]",md:"h-9 px-4 text-sm rounded-[10px]",lg:"h-11 px-6 text-sm rounded-[10px]"};function h({children:a,variant:b="primary",size:c="md",icon:i,iconRight:j,disabled:k=!1,loading:l=!1,fullWidth:m=!1,className:n,...o}){return(0,d.jsxs)("button",{className:(0,e.cn)("inline-flex items-center justify-center gap-2 font-semibold transition-all duration-150 ease-out cursor-pointer","active:scale-[0.97] disabled:opacity-50 disabled:cursor-not-allowed disabled:active:scale-100",f[b],g[c],m&&"w-full",n),disabled:k||l,...o,children:[l?(0,d.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}):i?(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:i}):null,a,j&&!l&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:j})]})}}};
|
|
@@ -249,4 +249,4 @@ ${C}`,modelId:o,origin:"AI_EDITOR",...v?.userInputMessage?.userInputMessageConte
|
|
|
249
249
|
${b}
|
|
250
250
|
\`\`\`
|
|
251
251
|
Respond ONLY with the JSON object, no other text.`)}else"json_object"===a.type&&p.push("You must respond with valid JSON. Respond ONLY with a JSON object, no other text.")}let q={type:k.R4.TEXT,text:f.Co};if(p.length>0){let a=p.join("\n");n.system=[q,{type:k.R4.TEXT,text:a,cache_control:{type:"ephemeral",ttl:"1h"}}]}else n.system=[q];if(b.tools&&Array.isArray(b.tools)){for(let a of(n.tools=[],b.tools)){let b=a.type;if(b&&b!==k.x4.FUNCTION){n.tools.push(a);continue}let c=a.function??a,e=c.name,f=""+e;d.set(f,e),n.tools.push({name:f,description:c.description||"",input_schema:c.parameters||c.input_schema||{type:"object",properties:{},required:[]}})}n.tools.length>0&&(n.tools[n.tools.length-1].cache_control={type:"ephemeral",ttl:"1h"})}return b.tool_choice&&(n.tool_choice=function(a){if(!a)return{type:"auto"};if("string"==typeof a)return"required"===a?{type:"any"}:{type:"auto"};if("object"==typeof a){if(a.function?.name)return{type:"tool",name:a.function.name};if(o.has(a.type))return a}return{type:"auto"}}(b.tool_choice)),d.size>0&&(n._toolNameMap=d),n}let o=new Set(["auto","any","tool","none"]);function p(a,b,c){let d=n(a,b,c);return d.system&&Array.isArray(d.system)&&(d.system=d.system.filter(a=>!a.text||!a.text.includes("You are Claude Code")),0===d.system.length&&delete d.system),d.tools&&Array.isArray(d.tools)&&(d.tools=d.tools.map(a=>a.name&&a.name.startsWith("")?{...a,name:a.name.slice(0)}:a)),d.messages&&Array.isArray(d.messages)&&(d.messages=d.messages.map(a=>{if(!a.content||!Array.isArray(a.content))return a;let b=a.content.map(a=>a.type===k.R4.TOOL_USE&&a.name&&a.name.startsWith("")?{...a,name:a.name.slice(0)}:a);return{...a,content:b}})),d}(0,d.kz)(e.h.OPENAI,e.h.CLAUDE,n,null)},89666:(a,b,c)=>{c.d(b,{h:()=>m});var d=c(78950),e=c(68531),f=c(10342),g=c(78953),h=c(52655);function i(a){try{return JSON.stringify(a)??String(a)}catch{return String(a)}}function j(a){if(!Array.isArray(a))return a;let b=function(a){let b=new Set;for(let c of a)c?.type===g.Du.FUNCTION_CALL&&"string"==typeof c.call_id&&b.add(c.call_id);return b}(a),c=[],d=a.filter(a=>{if(a?.type!==g.Du.FUNCTION_CALL_OUTPUT||!a.call_id)return!0;let d="string"==typeof a.call_id&&b.has(a.call_id);return d||(console.warn(`[Translator] Stripped orphaned function_call_output (call_id=${a.call_id}) — no matching function_call in input`),c.push(a.call_id)),d});return 0===c.length?a:d}function k(a){return a?"object"!==a.type||a.properties?a:{...a,properties:{}}:{type:"object",properties:{}}}function l(a){if(a?.type===g.x4.IMAGE_URL){let b="string"==typeof a.image_url?a.image_url:a.image_url?.url;return{type:g.Du.INPUT_IMAGE,image_url:b,detail:a.image_url?.detail||"auto"}}return a?.type===g.Du.INPUT_IMAGE?a:null}function m(a,b,c,d){if(b.input){let c=j(b.input),d=c===b.input?{...b,model:a,stream:!0}:{...b,input:c,model:a,stream:!0};return void 0===d.max_output_tokens&&(void 0!==d.max_completion_tokens?d.max_output_tokens=d.max_completion_tokens:void 0!==d.max_tokens&&(d.max_output_tokens=d.max_tokens)),delete d.max_tokens,delete d.max_completion_tokens,d}let e={model:a,input:[],stream:!0,store:!1},h=!1;for(let a of b.messages||[]){if(a.role===g.z7.SYSTEM||a.role===g.z7.DEVELOPER){if(!h){var i;e.instructions="string"==typeof(i=a.content)?i:Array.isArray(i)?i.map(a=>"string"==typeof a?.text?a.text:"string"==typeof a?.content?a.content:"").filter(Boolean).join("\n"):"",h=!0}continue}if(a.role===g.z7.USER||a.role===g.z7.ASSISTANT){if(a.role===g.z7.ASSISTANT){let b=function(a){if(!a||"object"!=typeof a)return null;let b="string"==typeof a.encrypted_content&&a.encrypted_content||"string"==typeof a.reasoning_encrypted_content&&a.reasoning_encrypted_content||"string"==typeof a.reasoning?.encrypted_content&&a.reasoning.encrypted_content||"",c="";if("string"==typeof a.reasoning_content&&a.reasoning_content.trim()?c=a.reasoning_content:"string"==typeof a.reasoning&&a.reasoning.trim()?c=a.reasoning:Array.isArray(a.reasoning_details)&&(c=a.reasoning_details.map(a=>"string"==typeof a?.text?a.text:"string"==typeof a?.content?a.content:"").filter(Boolean).join("\n")),!b&&!c)return null;let d={type:g.Du.REASONING};return c&&(d.summary=[{type:g.Du.SUMMARY_TEXT,text:c}]),b&&(d.encrypted_content=b),d}(a);b&&e.input.push(b)}let b=a.role===g.z7.USER?g.Du.INPUT_TEXT:g.Du.OUTPUT_TEXT,c="string"==typeof a.content?[{type:b,text:a.content}]:Array.isArray(a.content)?a.content.map(a=>{if(a.type===g.x4.TEXT)return{type:b,text:a.text};let c=l(a);if(c)return c;let d=a.text||a.content||JSON.stringify(a);return{type:b,text:"string"==typeof d?d:JSON.stringify(d)}}):[];c.length>0&&e.input.push({type:g.Du.MESSAGE,role:a.role,content:c})}if(a.role===g.z7.ASSISTANT&&a.tool_calls)for(let b of a.tool_calls){let a="string"==typeof b.function?.name?b.function.name.trim():"";a&&e.input.push({type:g.Du.FUNCTION_CALL,call_id:(0,f.N8)(b.id),name:a.slice(0,128),arguments:(0,f.We)(b.function?.arguments)})}if(a.role===g.z7.TOOL){let b=[],c=Array.isArray(a.content)?a.content.filter(a=>{let c=l(a);return!c||(b.push(c),!1)}):a.content;e.input.push({type:g.Du.FUNCTION_CALL_OUTPUT,call_id:(0,f.N8)(a.tool_call_id),output:(0,f.DP)(c)}),b.length>0&&e.input.push({type:g.Du.MESSAGE,role:g.z7.USER,content:b})}}h||(e.instructions=""),b.tools&&Array.isArray(b.tools)&&(e.tools=b.tools.map(a=>{if(a.type===g.x4.FUNCTION){let b="string"==typeof a.function?.name?a.function.name.trim():"";return b?{type:g.x4.FUNCTION,name:b.slice(0,128),description:String(a.function.description||""),parameters:k(a.function.parameters),strict:a.function.strict??!1}:null}return a}).filter(Boolean)),void 0!==b.temperature&&(e.temperature=b.temperature),void 0!==b.max_output_tokens?e.max_output_tokens=b.max_output_tokens:void 0!==b.max_completion_tokens?e.max_output_tokens=b.max_completion_tokens:void 0!==b.max_tokens&&(e.max_output_tokens=b.max_tokens),void 0!==b.top_p&&(e.top_p=b.top_p),void 0!==b.reasoning&&(e.reasoning=b.reasoning),void 0!==b.reasoning_effort&&(e.reasoning={effort:b.reasoning_effort,summary:"auto"}),void 0!==b.service_tier&&(e.service_tier=b.service_tier),void 0!==b.prompt_cache_key&&(e.prompt_cache_key=b.prompt_cache_key),e.input=j(e.input);let m=function(a){if(a?.type==="json_schema"){let b=a.json_schema;return b?.schema?{type:"json_schema",name:b.name||"response",schema:b.schema,strict:b.strict??!0}:null}return a?.type==="json_object"?{type:"json_object"}:null}(b.response_format);return m&&(e.text={format:m}),e}(0,d.kz)(e.h.OPENAI_RESPONSES,e.h.OPENAI,function(a,b,c,d){if(!b.input)return b;let e={...b};e.messages=[],b.instructions&&e.messages.push({role:g.z7.SYSTEM,content:b.instructions});let l=null,m=[],n="",o="",p=[],q=new Set,r=[],s=0,t=new Map,u=new Map,v=j((0,f.me)(b.input));if(!v)return b;let w=a=>{if(Array.isArray(a.summary)){let b=a.summary.map(a=>a?.text||"").filter(Boolean).join("\n");if(b)return b}if(Array.isArray(a.content)){let b=a.content.map(a=>a?.text||"").filter(Boolean).join("\n");if(b)return b}return""},x=a=>{n&&(a.reasoning_content=n),o&&(a.encrypted_content=o),n="",o=""};for(let a of v){let b=a.type||(a.role?g.Du.MESSAGE:null);if(b===g.Du.MESSAGE){if(l&&(e.messages.push(l),l=null),m.length>0){for(let a of m)e.messages.push(a);m=[]}let b=Array.isArray(a.content)?a.content.map(a=>{if(a.type===g.Du.INPUT_TEXT||a.type===g.Du.OUTPUT_TEXT)return{type:g.x4.TEXT,text:a.text};if(a.type===g.Du.INPUT_IMAGE){let b=a.image_url||a.file_id||"";return{type:g.x4.IMAGE_URL,image_url:{url:b,detail:a.detail||"auto"}}}return a}):a.content,c={role:a.role,content:b};if(a.role===g.z7.TOOL&&!a.tool_call_id){let b=r.shift();b?c.tool_call_id=b:(c.role=g.z7.USER,c.content=`[Tool result: ${"string"==typeof a.content?a.content:JSON.stringify(a.content)}]`)}a.role===g.z7.ASSISTANT?x(c):(n="",o=""),e.messages.push(c)}else if(b===g.Du.FUNCTION_CALL||b===g.Du.CUSTOM_TOOL_CALL){if(l||x(l={role:g.z7.ASSISTANT,content:null,tool_calls:[]}),!a.name||"string"!=typeof a.name||""===a.name.trim())continue;b===g.Du.CUSTOM_TOOL_CALL&&q.add(a.name);let c=b===g.Du.CUSTOM_TOOL_CALL?{input:"string"==typeof a.input?a.input:JSON.stringify(a.input??"")}:a.arguments,d=a.call_id||(0,h.J4)(s++,l.tool_calls.length,a.name);l.tool_calls.push({id:d,type:g.x4.FUNCTION,function:{name:a.name,arguments:(0,f.We)(c)}}),r.push(d)}else if(b===g.Du.FUNCTION_CALL_OUTPUT||b===g.Du.CUSTOM_TOOL_CALL_OUTPUT){if(l&&(e.messages.push(l),l=null),m.length>0){for(let a of m)e.messages.push(a);m=[]}let b="string"==typeof a.call_id&&a.call_id?a.call_id:"";if(b){let a=r.indexOf(b);a>=0&&r.splice(a,1)}else b=r.shift()||"";if(b){let{text:c,images:d}=function(a){if("string"==typeof a)return{text:a,images:[]};if(!Array.isArray(a))return{text:(0,f.DP)(a),images:[]};let b=[],c=[],d=0;for(let e of a)if(null!=e){if("string"==typeof e){d++,b.push(e);continue}if(e.type===g.Du.INPUT_TEXT||e.type===g.x4.TEXT){d++,"string"==typeof e.text&&b.push(e.text);continue}if(e.type===g.Du.INPUT_IMAGE||e.type===g.x4.IMAGE_URL){d++;let a="string"==typeof e.image_url?e.image_url:e.image_url?.url||e.file_id||"",f="object"==typeof e.image_url?e.image_url?.detail:e.detail;"string"==typeof a&&a?c.push({type:g.x4.IMAGE_URL,image_url:{url:a,detail:f||"auto"}}):b.push("[image omitted: missing image payload]");continue}b.push(i(e))}return 0===d?{text:i(a),images:[]}:{text:b.join("\n"),images:c}}(a.output);e.messages.push({role:g.z7.TOOL,tool_call_id:b,content:c||(d.length>0?"[tool returned images - see the next message]":"")}),d.length>0&&e.messages.push({role:g.z7.USER,content:[{type:g.x4.TEXT,text:"[images returned by the tool result above]"},...d]})}}else if(b===g.Du.ADDITIONAL_TOOLS)Array.isArray(a.tools)&&p.push(...a.tools);else if(b===g.Du.REASONING){let b=w(a);b&&(n=n?`${n}
|
|
252
|
-
${b}`:b),"string"==typeof a.encrypted_content&&a.encrypted_content&&(o=a.encrypted_content);continue}}if(l&&e.messages.push(l),m.length>0)for(let a of m)e.messages.push(a);let y=[...Array.isArray(b.tools)?b.tools:[],...p];if(y.length>0&&(e.tools=y.flatMap(a=>{if(a.function){let b=a.function;if(b?.name&&b.name.includes(".")){let c=b.name.replace(/\./g,"__");return t.set(c,b.name),globalThis.__CB_TOOL_MAP__||={},globalThis.__CB_TOOL_MAP__[c]=b.name,{...a,function:{...b,name:c}}}return a}if("namespace"===a.type&&Array.isArray(a.tools)){let b=a.name||"";return a.tools.filter(a=>a&&a.name).map(c=>{b&&(u.set(c.name,b),globalThis.__CB_NS_TOOLS__||={},globalThis.__CB_NS_TOOLS__[c.name]=b);let d=b?`${b}.${c.name}`:c.name,e=d.includes(".")?d.replace(/\./g,"__"):d;return d!==e&&(t.set(e,d),globalThis.__CB_TOOL_MAP__||={},globalThis.__CB_TOOL_MAP__[e]=d),{type:g.x4.FUNCTION,function:{name:e,description:String(c.description||a.description||""),parameters:k(c.parameters),strict:c.strict}}})}let b=a.name;if(!b||"string"!=typeof b||""===b.trim())return null;let c=b.includes(".")?b.replace(/\./g,"__"):b;if(c!==b&&(t.set(c,b),globalThis.__CB_TOOL_MAP__||={},globalThis.__CB_TOOL_MAP__[c]=b),"custom"===a.type){q.add(b);let c=[a.format?.syntax,a.format?.definition].filter(Boolean).join("\n");return{type:g.x4.FUNCTION,function:{name:b,description:[String(a.description||""),c].filter(Boolean).join("\n\n"),parameters:{type:"object",properties:{input:{type:"string",description:"Raw freeform input for this custom tool"}},required:["input"],additionalProperties:!1}}}}return{type:g.x4.FUNCTION,function:{name:b,description:String(a.description||""),parameters:k(a.parameters),strict:a.strict}}}).filter(Boolean)),q.size>0&&(e._customToolNames=[...q]),t.size>0&&(e._toolNameMap=t),globalThis.__CB_TOOL_MAP__=t.size>0?Object.fromEntries(t):null,globalThis.__CB_NS_TOOLS__=u.size>0?Object.fromEntries(u):null,void 0!==e.max_output_tokens&&(void 0===e.max_tokens&&(e.max_tokens=e.max_output_tokens),delete e.max_output_tokens),void 0!==e.text){var z;let a,b=(z=e.text,a=z?.format,a?.type==="json_schema"&&a.schema?{type:"json_schema",json_schema:{name:a.name||"response",schema:a.schema,strict:a.strict??!0}}:a?.type==="json_object"?{type:"json_object"}:null);b&&void 0===e.response_format&&(e.response_format=b),delete e.text}return delete e.input,delete e.instructions,delete e.include,delete e.prompt_cache_key,delete e.store,"string"==typeof e.reasoning?.effort&&(e.reasoning_effort=e.reasoning.effort),delete e.reasoning,delete e.client_metadata,e},null),(0,d.kz)(e.h.OPENAI,e.h.OPENAI_RESPONSES,m,null)},90053:a=>{a.exports={rE:"0.6.11"}},90242:(a,b,c)=>{c.d(b,{z:()=>e});var d=c(78953);function e(a){return a.every(a=>a.type===d.x4.TEXT)?a.map(a=>a.text).join("\n"):a}},90694:(a,b,c)=>{function d({promptTokens:a,completionTokens:b,totalTokens:c,cachedTokens:e=0,cacheCreationTokens:f=0,reasoningTokens:g=0}){let h={prompt_tokens:a,completion_tokens:b,total_tokens:c};return(e>0||f>0)&&(h.prompt_tokens_details={},e>0&&(h.prompt_tokens_details.cached_tokens=e),f>0&&(h.prompt_tokens_details.cache_creation_tokens=f)),g>0&&(h.completion_tokens_details={reasoning_tokens:g}),h}c.d(b,{B6:()=>g,co:()=>d});let e=a=>"number"==typeof a?a:0,f={claude(a){let b=e(a.input_tokens),c=e(a.output_tokens),d=e(a.cache_read_input_tokens),f=e(a.cache_creation_input_tokens),g=b+d+f;return{promptTokens:g,completionTokens:c,totalTokens:g+c,cachedTokens:d,cacheCreationTokens:f,reasoningTokens:e(a.output_tokens_details?.thinking_tokens)}},gemini(a){let b=e(a.cachedContentTokenCount),c=e(a.promptTokenCount),d=e(a.thoughtsTokenCount),f=e(a.totalTokenCount),g=e(a.candidatesTokenCount);return 0===g&&f>0&&(g=f-c-d)<0&&(g=0),{promptTokens:c,completionTokens:g+d,totalTokens:f,cachedTokens:b,reasoningTokens:d}},kiro(a){let b=e(a.inputTokens),c=e(a.outputTokens),d=e(a.cache_read_input_tokens)||e(a.cachedTokens)||e(a.cached_tokens),f=e(a.cache_creation_input_tokens),g={promptTokens:b,completionTokens:c,totalTokens:b+c};return d>0&&(g.cachedTokens=d),f>0&&(g.cacheCreationTokens=f),g},ollama(a){let b=e(a.prompt_eval_count),c=e(a.eval_count);return{promptTokens:b,completionTokens:c,totalTokens:b+c}},commandcode(a){let b=e(a.inputTokens),c=e(a.outputTokens),d="number"==typeof a.totalTokens?a.totalTokens:b+c;return{promptTokens:b,completionTokens:c,totalTokens:d}}};function g(a,b){let c=f[b];return c&&a&&"object"==typeof a?d(c(a)):null}},93373:(a,b,c)=>{c.d(b,{Du:()=>f,R4:()=>e,m8:()=>g,x4:()=>d});let d={TEXT:"text",IMAGE_URL:"image_url",IMAGE:"image",INPUT_AUDIO:"input_audio",AUDIO_URL:"audio_url",FILE:"file",FUNCTION:"function",EXTRA_CONTENT:"extra_content"},e={TEXT:"text",IMAGE:"image",DOCUMENT:"document",TOOL_USE:"tool_use",TOOL_RESULT:"tool_result",THINKING:"thinking",REDACTED_THINKING:"redacted_thinking",SERVER_TOOL_USE:"server_tool_use",WEB_SEARCH_TOOL_RESULT:"web_search_tool_result"},f={MESSAGE:"message",FUNCTION_CALL:"function_call",FUNCTION_CALL_OUTPUT:"function_call_output",CUSTOM_TOOL_CALL:"custom_tool_call",CUSTOM_TOOL_CALL_OUTPUT:"custom_tool_call_output",ADDITIONAL_TOOLS:"additional_tools",REASONING:"reasoning",OUTPUT_TEXT:"output_text",INPUT_TEXT:"input_text",INPUT_IMAGE:"input_image",SUMMARY_TEXT:"summary_text"},g=[d.TEXT,d.IMAGE_URL,d.IMAGE,d.INPUT_AUDIO,d.AUDIO_URL,d.FILE];d.TEXT,d.IMAGE_URL,d.IMAGE,e.TOOL_RESULT},95901:(a,b,c)=>{c.d(b,{$6:()=>v,Fp:()=>x,Me:()=>w,Nv:()=>t,SE:()=>u});var d=c(73024),e=c(48161),f=c(76760),g=c(77598),h=c(26762);let i="https://mimo-server-cn.xiaomimimo.com",j="account.xiaomi.com",k="miNative PC/Normal Windows_NT/10.0.19045 SDKV/1.0.0 DEVT/PC DEVS/Windows APP/miaccount_desktop APPV/0.1.0",l="MiClaw/1.0",m=new Map,n=new Map;async function o(){let a,b=(a=e.homedir(),"win32"===process.platform?f.join(a,"AppData","Roaming","Xiaomi MiMo","Partitions","xiaomi-account","Network","Cookies"):"darwin"===process.platform?f.join(a,"Library","Application Support","Xiaomi MiMo","Partitions","xiaomi-account","Network","Cookies"):f.join(a,".config","Xiaomi MiMo","Partitions","xiaomi-account","Network","Cookies"));if(!d.existsSync(b))return null;let h=f.join(e.tmpdir(),`9r-mimo-cookies-${process.pid}-${g.randomBytes(4).toString("hex")}.db`);try{d.copyFileSync(b,h)}catch{return null}try{let{DatabaseSync:a}=await Promise.resolve().then(c.t.bind(c,79868,19)),b=new a(h,{readOnly:!0}),d=b.prepare("SELECT name, value FROM cookies WHERE host_key = ?").all("."+j);b.close();let e=Object.fromEntries(d.map(a=>[a.name,a.value]));return e.passToken?e:null}catch{return null}finally{try{d.unlinkSync(h)}catch{}}}function p(a,b){for(let c of b.headers.getSetCookie?.()||[]){let b=/^([^=]+)=([^;]*)/.exec(c.trim());b&&b[2]&&(a[b[1]]=b[2])}}function q(a){return Object.entries(a).filter(([,a])=>a).map(([a,b])=>`${a}=${b}`).join("; ")}async function r(a,b){var c;let d,e={...a},f=(await (0,h.Fm)(`${i}/api/user/xiaomi/me`,{redirect:"manual",headers:{"User-Agent":k,Cookie:q(e)}},b)).headers.get("location");if(!f)return null;let m=new URL(f).searchParams.get("callback");if(!m)return null;let n=await (0,h.Fm)(`https://${j}/pass/serviceLogin?sid=passportapi&_json=true`,{headers:{Cookie:q(e),"User-Agent":l,Accept:"application/json"}},b),o=JSON.parse((await n.text()).replace(/^&&&START&&&/,"")),r=o.nonce||(o.location?new URL(o.location).searchParams.get("nonce"):null);if(!r||!o.location)return null;let s=await (0,h.Fm)(`${o.location}&clientSign=${(d=`nonce=${r}`+((c=o.ssecurity)&&c.trim()?`&${c}`:""),encodeURIComponent(g.createHash("sha1").update(d).digest("base64")))}`,{redirect:"manual",headers:{Cookie:q(e),"User-Agent":l}},b);p(e,s);let t=await (0,h.Fm)(`https://${j}/pass/serviceLogin?sid=mimopc&callback=${encodeURIComponent(m)}&_json=true`,{headers:{Cookie:q(e),"User-Agent":l,Accept:"application/json"}},b),u=JSON.parse((await t.text()).replace(/^&&&START&&&/,""));if(p(e,t),!u?.location||!/\/api\/sts/.test(u.location))return null;let v=await (0,h.Fm)(u.location,{redirect:"manual",headers:{"User-Agent":k,Cookie:q(e)}},b);if(p(e,v),!e.serviceToken)return null;let w={};for(let a of["serviceToken","mimopc_ph","mimopc_slh","userId"])e[a]&&(w[a]=e[a]);return q(w)}async function s(a,b){let c=a?.mimoPassToken?{passToken:a.mimoPassToken,userId:a.mimoUserId,cUserId:a.mimoCUserId}:await o();if(!c)return{cookie:null,reason:"no-pass-token"};let d=g.createHash("sha256").update(c.passToken).digest("hex"),e=m.get(d);if(e&&Date.now()-e.at<18e5)return{cookie:e.cookie};let f=n.get(d);if(f){let a=await f;return a?{cookie:a}:{cookie:null,reason:"sso-failed"}}let h=(async()=>{try{return await r(c,b)}catch{return null}finally{n.delete(d)}})();n.set(d,h);let i=await h;return i?(m.set(d,{cookie:i,at:Date.now()}),{cookie:i}):{cookie:null,reason:"sso-failed"}}function t(){m.clear()}let u=i,v=k;async function w(a=null,b=null){try{let{cookie:c}=await s(a,b);return c}catch{return null}}async function x(a=null,b=null){let{cookie:c,reason:d}=await s(a,b);if(!c)return{error:"no-pass-token"===d?"no-session":"session-failed"};try{let a=await (0,h.Fm)(`${i}/api/user/usage`,{headers:{"User-Agent":k,Cookie:c,Accept:"application/json"},signal:AbortSignal.timeout(1e4)},b);if(!a.ok)return{error:`http-${a.status}`};let d=await a.json().catch(()=>null);if(!d||0!==d.code||!d.data)return{error:"bad-response"};return{percent:d.data.percent,resetDate:d.data.resetDate,resetAt:d.data.resetAt}}catch(a){return{error:a.message}}}},96684:(a,b,c)=>{c.d(b,{F:()=>e,Q:()=>f});var d=c(62457);function e(a,b){switch(b){case"claude":switch(a){case d.Ut.END_TURN:return d.bC.STOP;case d.Ut.MAX_TOKENS:return d.bC.LENGTH;case d.Ut.TOOL_USE:return d.bC.TOOL_CALLS;case d.Ut.STOP_SEQUENCE:return d.bC.STOP;case d.Ut.REFUSAL:return d.bC.CONTENT_FILTER;default:return d.bC.STOP}case"commandcode":switch(a){case"stop":case"error":return d.bC.STOP;case"length":return d.bC.LENGTH;case"tool-calls":case"tool_use":return d.bC.TOOL_CALLS;case"content-filter":return d.bC.CONTENT_FILTER;default:return a||d.bC.STOP}case"gemini":{let b=String(a).toUpperCase();if(d.lW.has(b))return d.bC.ERROR;if(d.zh.has(b))return d.bC.CONTENT_FILTER;switch(b){case d.a_.STOP:return d.bC.STOP;case d.a_.MAX_TOKENS:return d.bC.LENGTH;default:return d.bC.STOP}}case"kiro":case"ollama":switch(a){case"tool_calls":case"tool_use":return d.bC.TOOL_CALLS;case"length":case"max_tokens":return d.bC.LENGTH;default:return d.bC.STOP}default:return a||d.bC.STOP}}function f(a,b){if("claude"!==b)return a;switch(a){case d.bC.STOP:return d.Ut.END_TURN;case d.bC.LENGTH:case"max_tokens":return d.Ut.MAX_TOKENS;case d.bC.TOOL_CALLS:case"tool_calls":case"tool_use":return d.Ut.TOOL_USE;case d.bC.CONTENT_FILTER:return d.Ut.REFUSAL;default:return d.Ut.END_TURN}}},96915:(a,b,c)=>{c.d(b,{Sk:()=>k,el:()=>l});let d=(0,c(58609).U)("gemini_thought_signatures"),e=new Map,f=0;function g(a){let b="string"==typeof a?a.toLowerCase():"";return b?b.includes("claude")?"claude":b.includes("gemini")?"gemini":b:null}function h(a,b){return!a.family||!b||a.family===b}function i(){let a=Date.now();for(let[b,c]of e.entries())c.expiresAt<=a&&e.delete(b);for(;e.size>2e3;){let a=e.keys().next().value;if(!a)break;e.delete(a)}}async function j(){if(++f%100==0)try{let a=await d.getAll(),b=Object.keys(a),c=Date.now(),e=[],f=[];for(let d of b){let b=a[d];!b||"string"!=typeof b.signature||b.expiresAt&&b.expiresAt<=c?e.push(d):f.push({key:d,createdAt:b.createdAt||0})}for(let a of e)await d.remove(a).catch(()=>{});if(f.length>1e4)for(let a of(f.sort((a,b)=>b.createdAt-a.createdAt),f.slice(1e4)))await d.remove(a.key).catch(()=>{})}catch{}}function k(a,b,c=null,f=null){if("string"!=typeof a||!a||"string"!=typeof b||!b)return;let h=Date.now(),l=g(f);i();let m=[];for(let f of(c&&"string"==typeof c&&m.push(`${c}:${a}`),m.push(a),m))e.set(f,{signature:b,family:l,expiresAt:h+36e5}),d.set(f,{signature:b,family:l,createdAt:h,expiresAt:h+6048e5}).catch(()=>{});j().catch(()=>{})}function l(a,b=null,c=null){if("string"!=typeof a||!a)return null;let d=g(c);if(i(),b&&"string"==typeof b){let c=`${b}:${a}`,f=e.get(c);if(f&&f.expiresAt>Date.now()&&h(f,d))return f.signature}let f=e.get(a);return f&&f.expiresAt>Date.now()&&h(f,d)?f.signature:null}},97865:(a,b,c)=>{function d(a){if("string"!=typeof a)return null;let b=a.trim();if(!b)return null;if(/^\d+(\.\d+)?s$/.test(b))return Math.round(1e3*parseFloat(b));let c=b.match(/(\d+(?:\.\d+)?)(h|m|s|ms)/g);if(!c)return null;let d={h:36e5,m:6e4,s:1e3,ms:1},e=0;for(let a of c){let[,b,c]=a.match(/(\d+(?:\.\d+)?)(h|m|s|ms)/);e+=parseFloat(b)*d[c]}return Math.round(e)}function e(a,b=Date.now()){let c={resetsAtMs:null,reason:null,model:null,retryAfter:null};if(!a)return c;let f=a;if("string"==typeof a)try{f=JSON.parse(a)}catch{return c}let g=f?.error?.details;if(!Array.isArray(g))return c;let h=null,i=null,j=null,k=null;for(let a of g)if(a?.["@type"]==="type.googleapis.com/google.rpc.ErrorInfo"){i=a.reason||i,j=a.metadata?.model||j;let c=a.metadata?.quotaResetTimeStamp;if(!h&&c){let a=new Date(c).getTime();Number.isFinite(a)&&a>b&&(h=a)}if(!h){let c=d(a.metadata?.quotaResetDelay);c>0&&(h=b+c)}}else a?.["@type"]==="type.googleapis.com/google.rpc.RetryInfo"&&a?.retryDelay&&(k=a.retryDelay);if(!h&&k){let a=d(k);a>0&&(h=b+a)}return{resetsAtMs:h,reason:i,model:j,retryAfter:k}}c.d(b,{k:()=>e})}};
|
|
252
|
+
${b}`:b),"string"==typeof a.encrypted_content&&a.encrypted_content&&(o=a.encrypted_content);continue}}if(l&&e.messages.push(l),m.length>0)for(let a of m)e.messages.push(a);let y=[...Array.isArray(b.tools)?b.tools:[],...p];if(y.length>0&&(e.tools=y.flatMap(a=>{if(a.function){let b=a.function;if(b?.name&&b.name.includes(".")){let c=b.name.replace(/\./g,"__");return t.set(c,b.name),globalThis.__CB_TOOL_MAP__||={},globalThis.__CB_TOOL_MAP__[c]=b.name,{...a,function:{...b,name:c}}}return a}if("namespace"===a.type&&Array.isArray(a.tools)){let b=a.name||"";return a.tools.filter(a=>a&&a.name).map(c=>{b&&(u.set(c.name,b),globalThis.__CB_NS_TOOLS__||={},globalThis.__CB_NS_TOOLS__[c.name]=b);let d=b?`${b}.${c.name}`:c.name,e=d.includes(".")?d.replace(/\./g,"__"):d;return d!==e&&(t.set(e,d),globalThis.__CB_TOOL_MAP__||={},globalThis.__CB_TOOL_MAP__[e]=d),{type:g.x4.FUNCTION,function:{name:e,description:String(c.description||a.description||""),parameters:k(c.parameters),strict:c.strict}}})}let b=a.name;if(!b||"string"!=typeof b||""===b.trim())return null;let c=b.includes(".")?b.replace(/\./g,"__"):b;if(c!==b&&(t.set(c,b),globalThis.__CB_TOOL_MAP__||={},globalThis.__CB_TOOL_MAP__[c]=b),"custom"===a.type){q.add(b);let c=[a.format?.syntax,a.format?.definition].filter(Boolean).join("\n");return{type:g.x4.FUNCTION,function:{name:b,description:[String(a.description||""),c].filter(Boolean).join("\n\n"),parameters:{type:"object",properties:{input:{type:"string",description:"Raw freeform input for this custom tool"}},required:["input"],additionalProperties:!1}}}}return{type:g.x4.FUNCTION,function:{name:b,description:String(a.description||""),parameters:k(a.parameters),strict:a.strict}}}).filter(Boolean)),q.size>0&&(e._customToolNames=[...q]),t.size>0&&(e._toolNameMap=t),globalThis.__CB_TOOL_MAP__=t.size>0?Object.fromEntries(t):null,globalThis.__CB_NS_TOOLS__=u.size>0?Object.fromEntries(u):null,void 0!==e.max_output_tokens&&(void 0===e.max_tokens&&(e.max_tokens=e.max_output_tokens),delete e.max_output_tokens),void 0!==e.text){var z;let a,b=(z=e.text,a=z?.format,a?.type==="json_schema"&&a.schema?{type:"json_schema",json_schema:{name:a.name||"response",schema:a.schema,strict:a.strict??!0}}:a?.type==="json_object"?{type:"json_object"}:null);b&&void 0===e.response_format&&(e.response_format=b),delete e.text}return delete e.input,delete e.instructions,delete e.include,delete e.prompt_cache_key,delete e.store,"string"==typeof e.reasoning?.effort&&(e.reasoning_effort=e.reasoning.effort),delete e.reasoning,delete e.client_metadata,e},null),(0,d.kz)(e.h.OPENAI,e.h.OPENAI_RESPONSES,m,null)},90053:a=>{a.exports={rE:"0.6.12"}},90242:(a,b,c)=>{c.d(b,{z:()=>e});var d=c(78953);function e(a){return a.every(a=>a.type===d.x4.TEXT)?a.map(a=>a.text).join("\n"):a}},90694:(a,b,c)=>{function d({promptTokens:a,completionTokens:b,totalTokens:c,cachedTokens:e=0,cacheCreationTokens:f=0,reasoningTokens:g=0}){let h={prompt_tokens:a,completion_tokens:b,total_tokens:c};return(e>0||f>0)&&(h.prompt_tokens_details={},e>0&&(h.prompt_tokens_details.cached_tokens=e),f>0&&(h.prompt_tokens_details.cache_creation_tokens=f)),g>0&&(h.completion_tokens_details={reasoning_tokens:g}),h}c.d(b,{B6:()=>g,co:()=>d});let e=a=>"number"==typeof a?a:0,f={claude(a){let b=e(a.input_tokens),c=e(a.output_tokens),d=e(a.cache_read_input_tokens),f=e(a.cache_creation_input_tokens),g=b+d+f;return{promptTokens:g,completionTokens:c,totalTokens:g+c,cachedTokens:d,cacheCreationTokens:f,reasoningTokens:e(a.output_tokens_details?.thinking_tokens)}},gemini(a){let b=e(a.cachedContentTokenCount),c=e(a.promptTokenCount),d=e(a.thoughtsTokenCount),f=e(a.totalTokenCount),g=e(a.candidatesTokenCount);return 0===g&&f>0&&(g=f-c-d)<0&&(g=0),{promptTokens:c,completionTokens:g+d,totalTokens:f,cachedTokens:b,reasoningTokens:d}},kiro(a){let b=e(a.inputTokens),c=e(a.outputTokens),d=e(a.cache_read_input_tokens)||e(a.cachedTokens)||e(a.cached_tokens),f=e(a.cache_creation_input_tokens),g={promptTokens:b,completionTokens:c,totalTokens:b+c};return d>0&&(g.cachedTokens=d),f>0&&(g.cacheCreationTokens=f),g},ollama(a){let b=e(a.prompt_eval_count),c=e(a.eval_count);return{promptTokens:b,completionTokens:c,totalTokens:b+c}},commandcode(a){let b=e(a.inputTokens),c=e(a.outputTokens),d="number"==typeof a.totalTokens?a.totalTokens:b+c;return{promptTokens:b,completionTokens:c,totalTokens:d}}};function g(a,b){let c=f[b];return c&&a&&"object"==typeof a?d(c(a)):null}},93373:(a,b,c)=>{c.d(b,{Du:()=>f,R4:()=>e,m8:()=>g,x4:()=>d});let d={TEXT:"text",IMAGE_URL:"image_url",IMAGE:"image",INPUT_AUDIO:"input_audio",AUDIO_URL:"audio_url",FILE:"file",FUNCTION:"function",EXTRA_CONTENT:"extra_content"},e={TEXT:"text",IMAGE:"image",DOCUMENT:"document",TOOL_USE:"tool_use",TOOL_RESULT:"tool_result",THINKING:"thinking",REDACTED_THINKING:"redacted_thinking",SERVER_TOOL_USE:"server_tool_use",WEB_SEARCH_TOOL_RESULT:"web_search_tool_result"},f={MESSAGE:"message",FUNCTION_CALL:"function_call",FUNCTION_CALL_OUTPUT:"function_call_output",CUSTOM_TOOL_CALL:"custom_tool_call",CUSTOM_TOOL_CALL_OUTPUT:"custom_tool_call_output",ADDITIONAL_TOOLS:"additional_tools",REASONING:"reasoning",OUTPUT_TEXT:"output_text",INPUT_TEXT:"input_text",INPUT_IMAGE:"input_image",SUMMARY_TEXT:"summary_text"},g=[d.TEXT,d.IMAGE_URL,d.IMAGE,d.INPUT_AUDIO,d.AUDIO_URL,d.FILE];d.TEXT,d.IMAGE_URL,d.IMAGE,e.TOOL_RESULT},95901:(a,b,c)=>{c.d(b,{$6:()=>v,Fp:()=>x,Me:()=>w,Nv:()=>t,SE:()=>u});var d=c(73024),e=c(48161),f=c(76760),g=c(77598),h=c(26762);let i="https://mimo-server-cn.xiaomimimo.com",j="account.xiaomi.com",k="miNative PC/Normal Windows_NT/10.0.19045 SDKV/1.0.0 DEVT/PC DEVS/Windows APP/miaccount_desktop APPV/0.1.0",l="MiClaw/1.0",m=new Map,n=new Map;async function o(){let a,b=(a=e.homedir(),"win32"===process.platform?f.join(a,"AppData","Roaming","Xiaomi MiMo","Partitions","xiaomi-account","Network","Cookies"):"darwin"===process.platform?f.join(a,"Library","Application Support","Xiaomi MiMo","Partitions","xiaomi-account","Network","Cookies"):f.join(a,".config","Xiaomi MiMo","Partitions","xiaomi-account","Network","Cookies"));if(!d.existsSync(b))return null;let h=f.join(e.tmpdir(),`9r-mimo-cookies-${process.pid}-${g.randomBytes(4).toString("hex")}.db`);try{d.copyFileSync(b,h)}catch{return null}try{let{DatabaseSync:a}=await Promise.resolve().then(c.t.bind(c,79868,19)),b=new a(h,{readOnly:!0}),d=b.prepare("SELECT name, value FROM cookies WHERE host_key = ?").all("."+j);b.close();let e=Object.fromEntries(d.map(a=>[a.name,a.value]));return e.passToken?e:null}catch{return null}finally{try{d.unlinkSync(h)}catch{}}}function p(a,b){for(let c of b.headers.getSetCookie?.()||[]){let b=/^([^=]+)=([^;]*)/.exec(c.trim());b&&b[2]&&(a[b[1]]=b[2])}}function q(a){return Object.entries(a).filter(([,a])=>a).map(([a,b])=>`${a}=${b}`).join("; ")}async function r(a,b){var c;let d,e={...a},f=(await (0,h.Fm)(`${i}/api/user/xiaomi/me`,{redirect:"manual",headers:{"User-Agent":k,Cookie:q(e)}},b)).headers.get("location");if(!f)return null;let m=new URL(f).searchParams.get("callback");if(!m)return null;let n=await (0,h.Fm)(`https://${j}/pass/serviceLogin?sid=passportapi&_json=true`,{headers:{Cookie:q(e),"User-Agent":l,Accept:"application/json"}},b),o=JSON.parse((await n.text()).replace(/^&&&START&&&/,"")),r=o.nonce||(o.location?new URL(o.location).searchParams.get("nonce"):null);if(!r||!o.location)return null;let s=await (0,h.Fm)(`${o.location}&clientSign=${(d=`nonce=${r}`+((c=o.ssecurity)&&c.trim()?`&${c}`:""),encodeURIComponent(g.createHash("sha1").update(d).digest("base64")))}`,{redirect:"manual",headers:{Cookie:q(e),"User-Agent":l}},b);p(e,s);let t=await (0,h.Fm)(`https://${j}/pass/serviceLogin?sid=mimopc&callback=${encodeURIComponent(m)}&_json=true`,{headers:{Cookie:q(e),"User-Agent":l,Accept:"application/json"}},b),u=JSON.parse((await t.text()).replace(/^&&&START&&&/,""));if(p(e,t),!u?.location||!/\/api\/sts/.test(u.location))return null;let v=await (0,h.Fm)(u.location,{redirect:"manual",headers:{"User-Agent":k,Cookie:q(e)}},b);if(p(e,v),!e.serviceToken)return null;let w={};for(let a of["serviceToken","mimopc_ph","mimopc_slh","userId"])e[a]&&(w[a]=e[a]);return q(w)}async function s(a,b){let c=a?.mimoPassToken?{passToken:a.mimoPassToken,userId:a.mimoUserId,cUserId:a.mimoCUserId}:await o();if(!c)return{cookie:null,reason:"no-pass-token"};let d=g.createHash("sha256").update(c.passToken).digest("hex"),e=m.get(d);if(e&&Date.now()-e.at<18e5)return{cookie:e.cookie};let f=n.get(d);if(f){let a=await f;return a?{cookie:a}:{cookie:null,reason:"sso-failed"}}let h=(async()=>{try{return await r(c,b)}catch{return null}finally{n.delete(d)}})();n.set(d,h);let i=await h;return i?(m.set(d,{cookie:i,at:Date.now()}),{cookie:i}):{cookie:null,reason:"sso-failed"}}function t(){m.clear()}let u=i,v=k;async function w(a=null,b=null){try{let{cookie:c}=await s(a,b);return c}catch{return null}}async function x(a=null,b=null){let{cookie:c,reason:d}=await s(a,b);if(!c)return{error:"no-pass-token"===d?"no-session":"session-failed"};try{let a=await (0,h.Fm)(`${i}/api/user/usage`,{headers:{"User-Agent":k,Cookie:c,Accept:"application/json"},signal:AbortSignal.timeout(1e4)},b);if(!a.ok)return{error:`http-${a.status}`};let d=await a.json().catch(()=>null);if(!d||0!==d.code||!d.data)return{error:"bad-response"};return{percent:d.data.percent,resetDate:d.data.resetDate,resetAt:d.data.resetAt}}catch(a){return{error:a.message}}}},96684:(a,b,c)=>{c.d(b,{F:()=>e,Q:()=>f});var d=c(62457);function e(a,b){switch(b){case"claude":switch(a){case d.Ut.END_TURN:return d.bC.STOP;case d.Ut.MAX_TOKENS:return d.bC.LENGTH;case d.Ut.TOOL_USE:return d.bC.TOOL_CALLS;case d.Ut.STOP_SEQUENCE:return d.bC.STOP;case d.Ut.REFUSAL:return d.bC.CONTENT_FILTER;default:return d.bC.STOP}case"commandcode":switch(a){case"stop":case"error":return d.bC.STOP;case"length":return d.bC.LENGTH;case"tool-calls":case"tool_use":return d.bC.TOOL_CALLS;case"content-filter":return d.bC.CONTENT_FILTER;default:return a||d.bC.STOP}case"gemini":{let b=String(a).toUpperCase();if(d.lW.has(b))return d.bC.ERROR;if(d.zh.has(b))return d.bC.CONTENT_FILTER;switch(b){case d.a_.STOP:return d.bC.STOP;case d.a_.MAX_TOKENS:return d.bC.LENGTH;default:return d.bC.STOP}}case"kiro":case"ollama":switch(a){case"tool_calls":case"tool_use":return d.bC.TOOL_CALLS;case"length":case"max_tokens":return d.bC.LENGTH;default:return d.bC.STOP}default:return a||d.bC.STOP}}function f(a,b){if("claude"!==b)return a;switch(a){case d.bC.STOP:return d.Ut.END_TURN;case d.bC.LENGTH:case"max_tokens":return d.Ut.MAX_TOKENS;case d.bC.TOOL_CALLS:case"tool_calls":case"tool_use":return d.Ut.TOOL_USE;case d.bC.CONTENT_FILTER:return d.Ut.REFUSAL;default:return d.Ut.END_TURN}}},96915:(a,b,c)=>{c.d(b,{Sk:()=>k,el:()=>l});let d=(0,c(58609).U)("gemini_thought_signatures"),e=new Map,f=0;function g(a){let b="string"==typeof a?a.toLowerCase():"";return b?b.includes("claude")?"claude":b.includes("gemini")?"gemini":b:null}function h(a,b){return!a.family||!b||a.family===b}function i(){let a=Date.now();for(let[b,c]of e.entries())c.expiresAt<=a&&e.delete(b);for(;e.size>2e3;){let a=e.keys().next().value;if(!a)break;e.delete(a)}}async function j(){if(++f%100==0)try{let a=await d.getAll(),b=Object.keys(a),c=Date.now(),e=[],f=[];for(let d of b){let b=a[d];!b||"string"!=typeof b.signature||b.expiresAt&&b.expiresAt<=c?e.push(d):f.push({key:d,createdAt:b.createdAt||0})}for(let a of e)await d.remove(a).catch(()=>{});if(f.length>1e4)for(let a of(f.sort((a,b)=>b.createdAt-a.createdAt),f.slice(1e4)))await d.remove(a.key).catch(()=>{})}catch{}}function k(a,b,c=null,f=null){if("string"!=typeof a||!a||"string"!=typeof b||!b)return;let h=Date.now(),l=g(f);i();let m=[];for(let f of(c&&"string"==typeof c&&m.push(`${c}:${a}`),m.push(a),m))e.set(f,{signature:b,family:l,expiresAt:h+36e5}),d.set(f,{signature:b,family:l,createdAt:h,expiresAt:h+6048e5}).catch(()=>{});j().catch(()=>{})}function l(a,b=null,c=null){if("string"!=typeof a||!a)return null;let d=g(c);if(i(),b&&"string"==typeof b){let c=`${b}:${a}`,f=e.get(c);if(f&&f.expiresAt>Date.now()&&h(f,d))return f.signature}let f=e.get(a);return f&&f.expiresAt>Date.now()&&h(f,d)?f.signature:null}},97865:(a,b,c)=>{function d(a){if("string"!=typeof a)return null;let b=a.trim();if(!b)return null;if(/^\d+(\.\d+)?s$/.test(b))return Math.round(1e3*parseFloat(b));let c=b.match(/(\d+(?:\.\d+)?)(h|m|s|ms)/g);if(!c)return null;let d={h:36e5,m:6e4,s:1e3,ms:1},e=0;for(let a of c){let[,b,c]=a.match(/(\d+(?:\.\d+)?)(h|m|s|ms)/);e+=parseFloat(b)*d[c]}return Math.round(e)}function e(a,b=Date.now()){let c={resetsAtMs:null,reason:null,model:null,retryAfter:null};if(!a)return c;let f=a;if("string"==typeof a)try{f=JSON.parse(a)}catch{return c}let g=f?.error?.details;if(!Array.isArray(g))return c;let h=null,i=null,j=null,k=null;for(let a of g)if(a?.["@type"]==="type.googleapis.com/google.rpc.ErrorInfo"){i=a.reason||i,j=a.metadata?.model||j;let c=a.metadata?.quotaResetTimeStamp;if(!h&&c){let a=new Date(c).getTime();Number.isFinite(a)&&a>b&&(h=a)}if(!h){let c=d(a.metadata?.quotaResetDelay);c>0&&(h=b+c)}}else a?.["@type"]==="type.googleapis.com/google.rpc.RetryInfo"&&a?.retryDelay&&(k=a.retryDelay);if(!h&&k){let a=d(k);a>0&&(h=b+a)}return{resetsAtMs:h,reason:i,model:j,retryAfter:k}}c.d(b,{k:()=>e})}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
exports.id=4827,exports.ids=[615,4827,9485],exports.modules={4630:(a,b,c)=>{"use strict";c.d(b,{Ak:()=>e,Yg:()=>h,sr:()=>d.sr,xq:()=>d.xq});var d=c(39141);function e(a){return(a?.providerSpecificData?.baseUrl?.trim()||"http://localhost:11434").replace(/\/$/,"")}let f=d.xq["xiaomi-tokenplan"]?.regions||{},g=d.xq["xiaomi-tokenplan"]?.defaultRegion;function h(a){return f[a?.providerSpecificData?.region]||f[g]}},16329:(a,b,c)=>{"use strict";c.d(b,{Bb:()=>e,Om:()=>g});let d=globalThis.__9routerShutdownState??={flushers:new Set,priorities:new Map,shutdownPromise:null,signalHandler:null,beforeExitHandler:null};function e(a,b=0){if("function"!=typeof a)throw TypeError("shutdown flusher must be a function");return d.flushers.add(a),d.priorities.set(a,Number.isFinite(b)?b:0),d.signalHandler??=()=>g(0),d.beforeExitHandler??=()=>f(),process.listeners("SIGINT").includes(d.signalHandler)||process.once("SIGINT",d.signalHandler),process.listeners("SIGTERM").includes(d.signalHandler)||process.once("SIGTERM",d.signalHandler),process.listeners("beforeExit").includes(d.beforeExitHandler)||process.once("beforeExit",d.beforeExitHandler),()=>{d.flushers.delete(a),d.priorities.delete(a)}}function f(){return d.shutdownPromise||(d.shutdownPromise=(async()=>{let a=new Map;for(let b of d.flushers){let c=d.priorities.get(b)??0;a.has(c)||a.set(c,[]),a.get(c).push(b)}for(let b of[...a.keys()].sort((a,b)=>a-b))for(let c of(await Promise.allSettled(a.get(b).map(a=>Promise.resolve().then(a)))))"rejected"===c.status&&console.error("[Shutdown] flusher failed:",c.reason?.message||c.reason)})()),d.shutdownPromise}async function g(a=0){await f(),process.exit(a)}},19956:(a,b,c)=>{"use strict";c.d(b,{h:()=>d,t:()=>e});let d={OPENAI:"openai",OPENAI_RESPONSES:"openai-responses",OPENAI_RESPONSE:"openai-response",CLAUDE:"claude",GEMINI:"gemini",GEMINI_CLI:"gemini-cli",VERTEX:"vertex",CODEX:"codex",ANTIGRAVITY:"antigravity",KIRO:"kiro",CURSOR:"cursor",OLLAMA:"ollama",COMMANDCODE:"commandcode"};function e(a,b){return a.includes("/v1/responses")?d.OPENAI_RESPONSES:a.includes("/v1/messages")?d.CLAUDE:a.includes("/v1/chat/completions")&&Array.isArray(b?.input)?d.OPENAI:null}},21719:(a,b,c)=>{"use strict";c.d(b,{g:()=>n,l:()=>m});var d=c(79646),e=c(33873),f=c.n(e),g=c(29021),h=c.n(g),i=c(21820),j=c.n(i),k=c(30869),l=c(16329);async function m(){!function(){try{let a=f().join("win32"===process.platform?f().join(process.env.APPDATA||"","ezrouter"):f().join(j().homedir(),".ezrouter"),"mitm",".mitm.pid");if(!h().existsSync(a))return;let b=parseInt(h().readFileSync(a,"utf8").trim(),10);if(!b)return;if("win32"===process.platform)try{(0,d.execSync)(`taskkill /F /T /PID ${b}`,{stdio:"ignore",windowsHide:!0,timeout:3e3})}catch{try{(0,d.execSync)(`powershell -NonInteractive -WindowStyle Hidden -Command "Stop-Process -Id ${b} -Force"`,{stdio:"ignore",windowsHide:!0,timeout:3e3})}catch{}}else try{(0,d.execSync)(`sudo -n kill -9 ${b} 2>/dev/null`,{stdio:"ignore",timeout:3e3})}catch{try{process.kill(b,"SIGKILL")}catch{}}try{h().unlinkSync(a)}catch{}}catch{}}();let a=function(){let a=[];if("win32"===process.platform){try{(0,d.execSync)('powershell -NonInteractive -WindowStyle Hidden -Command "Get-WmiObject Win32_Process -Filter \'Name=\\"node.exe\\"\' | Select-Object ProcessId,CommandLine | ConvertTo-Csv -NoTypeInformation"',{encoding:"utf8",windowsHide:!0,timeout:5e3}).split("\n").slice(1).filter(a=>a.trim()).forEach(b=>{let c=b.toLowerCase();if(c.includes("9router")||c.includes("next-server")||c.includes("\\bin\\app\\")||c.includes("/bin/app/")||c.includes("cli.js")){let c=b.match(/^"(\d+)"/);c&&c[1]&&c[1]!==process.pid.toString()&&a.push(c[1])}})}catch{}for(let b of["cloudflared","tray_windows_release"])try{let c=`powershell -NonInteractive -WindowStyle Hidden -Command "Get-Process ${b} -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Id"`;(0,d.execSync)(c,{encoding:"utf8",windowsHide:!0,timeout:5e3}).split("\n").forEach(b=>{let c=b.trim();c&&!isNaN(c)&&a.push(c)})}catch{}}else try{(0,d.execSync)("ps aux 2>/dev/null",{encoding:"utf8",timeout:5e3}).split("\n").forEach(b=>{if(b.includes("9router")||b.includes("next-server")||b.includes("cloudflared")||b.includes("/bin/app/")||b.includes("tray_darwin")||b.includes("tray_linux")){let c=b.trim().split(/\s+/)[1];c&&!isNaN(c)&&c!==process.pid.toString()&&a.push(c)}})}catch{}return a}(),b=process.platform;a.forEach(a=>{try{"win32"===b?(0,d.execSync)(`taskkill /F /PID ${a} 2>nul`,{stdio:"ignore",shell:!0,windowsHide:!0,timeout:3e3}):(0,d.execSync)(`kill -9 ${a} 2>/dev/null`,{stdio:"ignore",timeout:3e3})}catch{}}),a.length>0&&await new Promise(a=>setTimeout(a,1500))}function n(a=k.h0.npmPackageName){let b=function(a){try{if(!a||!h().existsSync(a))return a;let b=f().join(process.env.DATA_DIR?process.env.DATA_DIR:"win32"===process.platform?f().join(process.env.APPDATA||f().join(j().homedir(),"AppData","Roaming"),"ezrouter"):f().join(j().homedir(),".ezrouter"),"runtime","updater"),c=f().join(b,"updater.js");if(h().existsSync(c))try{if(h().statSync(a).size===h().statSync(c).size)return c}catch{}return h().mkdirSync(b,{recursive:!0}),h().copyFileSync(a,c),c}catch{return a}}(function(){if(process.env.UPDATER_SCRIPT_PATH&&h().existsSync(process.env.UPDATER_SCRIPT_PATH))return process.env.UPDATER_SCRIPT_PATH;let a=f().join(process.cwd(),"src","lib","updater","updater.js");if(h().existsSync(a))return a;let b=f().join(process.cwd(),"..","src","lib","updater","updater.js");return h().existsSync(b)?b:a}()),c="1"===process.env.TRAY_MODE,e={cmd:"win32"===process.platform?"npx.cmd":"npx",args:[k.h0.npmPackageName]},g=c?[...e.args,"--tray","--skip-update"]:[...e.args,"--skip-update"];(0,d.spawn)(process.execPath,[b],{detached:!0,stdio:"ignore",windowsHide:!0,env:{...process.env,UPDATER_PKG_NAME:a,UPDATER_PORT:String(k.h0.statusPort),UPDATER_TAIL_LINES:String(k.h0.statusLogTailLines),UPDATER_RETRIES:String(k.h0.installRetries),UPDATER_RETRY_DELAY_MS:String(k.h0.installRetryDelayMs),UPDATER_LINGER_MS:String(k.h0.lingerAfterDoneMs),UPDATER_WAIT_MIN_MS:String(k.h0.waitForExitMinMs),UPDATER_WAIT_MAX_MS:String(k.h0.waitForExitMaxMs),UPDATER_WAIT_CHECK_MS:String(k.h0.waitForExitCheckMs),UPDATER_APP_PORT:String(process.env.PORT||k.h0.appPort),UPDATER_RELAUNCH:"1",UPDATER_RELAUNCH_CMD:e.cmd,UPDATER_RELAUNCH_ARGS:JSON.stringify(g)}}).unref(),setTimeout(()=>(0,l.Om)(0),k.h0.exitDelayMs)}},29485:(a,b,c)=>{"use strict";c.d(b,{KC:()=>u,OA:()=>q,PROVIDER_MODELS:()=>f.vq,SM:()=>j,Xg:()=>t,cY:()=>v,ez:()=>p,fZ:()=>k,kt:()=>r,ux:()=>o});var d=c(4630),e=c(30717),f=c(39141),g=c(6595),h=c(8382),i=c(19956);function j(a){return f.vq[a]||[]}function k(a){let b=f.vq[a];return b?.[0]?.id||null}let l=new Set(["kr","kiro"]),m=new Map;for(let[a,b]of Object.entries(f.vq)){if(!Array.isArray(b))continue;let c=new Map,d=new Map;for(let e of b)if(e?.id!=null&&(c.set(e.id,e),l.has(a))){let a=(0,g.Kq)(e.id);a!==e.id&&d.set(a,e)}m.set(a,{exact:c,normalized:d})}function n(a,b,c){if(!a)return;let d="string"==typeof b?b.replace(/\([^()]+\)\s*$/,"").trim():b,e=m.get(c);if(e){let a=e.exact.get(d);return a||(e.normalized.size?e.normalized.get(d):void 0)}let f=a.find(a=>a.id===d);if(f)return f;if(!l.has(c))return;let h=(0,g.Kq)(d);if(h!==d)return a.find(a=>a.id===h)}function o(a,b){if((!a||"oc"===a||"opencode"===a||"ocg"===a||"opencode-go"===a)&&(0,h.d)(b))return i.h.OPENAI_RESPONSES;let c=t[a]||a,d=f.vq[c]||f.vq[a];return d?(0,g.gr)(n(d,b,c)):null}function p(a,b){let c=t[a]||a,d=f.vq[c]||f.vq[a];return d?(0,g.ec)(n(d,b,c)):null}function q(a,b){let c=t[a]||a,d=f.vq[c]||f.vq[a];if(!d)return null;let e=n(d,b,c);return e?.kind||e?.type||null}function r(a,b){let c=t[a]||a,d="string"==typeof b?b.match(/\([^()]+\)\s*$/):null,e=d?d[0]:"",g=e?b.slice(0,d.index).trim():b,i=n(f.vq[c]||f.vq[a],g,c),j=i?.upstreamModelId||i?.id;if(j){let a=j.match(/\([^()]+\)\s*$/),b=a?.[0]||"";return(b?j.slice(0,a.index).trim():j)+(e||b)}return"cx"===c&&"string"==typeof g&&g.endsWith(h.d5)?g.slice(0,-h.d5.length)+e:g+e}let s=Object.fromEntries(e.default.filter(a=>a.alias&&a.alias!==a.id).map(a=>[a.id,a.alias])),t=Object.fromEntries(Object.keys(d.xq).map(a=>[a,s[a]||a]));function u(a){let b=t[a]||a;return f.vq[b]||[]}function v(a,b){return(0,g.g5)(n(f.vq[a],b,a))}},30869:(a,b,c)=>{"use strict";c.d(b,{UY:()=>h,eh:()=>f.eh,fg:()=>e.fg,h0:()=>g,oc:()=>i});var d=c(39006),e=c(40615),f=c(81329);d.rE;let g={npmPackageName:"@rabbi696/ezrouter",installCmd:"npm i -g @rabbi696/ezrouter",installCmdLatest:"npm i -g @rabbi696/ezrouter@latest --prefer-online",shutdownCountdownSec:3,exitDelayMs:500,statusPort:20129,statusPollIntervalMs:1e3,statusLogTailLines:8,installRetries:3,installRetryDelayMs:5e3,lingerAfterDoneMs:3e4,waitForExitMinMs:5e3,waitForExitMaxMs:2e4,waitForExitCheckMs:500,appPort:20126},h={maxLines:200,pollIntervalMs:1e3,streamTimeoutMs:5e3},i={tickIntervalMs:6e4,pingLeadMs:5e3,refreshAheadMs:3e5,failureCooldownMs:9e5,providers:{claude:{settingsKey:"claudeAutoPing",quotaKey:"session (5h)",pingInactiveSession:!0,inactiveMinPingIntervalMs:18e6,pingModel:"claude-haiku-4-5-20251001",pingText:"hi",pingMaxTokens:1},codex:{settingsKey:"codexAutoPing",quotaKey:"session",pingWhenResetAtSlides:!0,resetAtDriftMs:3e4,minPingIntervalMs:6e5,skipWhenBlockingQuotaExhausted:!0,pingText:"hi",pingInstructions:"Reply with OK.",pingReasoningEffort:"none"}}}},39006:a=>{"use strict";a.exports={rE:"0.6.11"}},40615:(a,b,c)=>{"use strict";c.d(b,{AI_PROVIDERS:()=>u,js:()=>B,DI:()=>n,fg:()=>k,Pd:()=>o,Vj:()=>p,IS:()=>h,nJ:()=>i,zN:()=>j,JH:()=>m,jO:()=>D,wb:()=>C,br:()=>l,wG:()=>A,zt:()=>v,gb:()=>r,gC:()=>s,AR:()=>t,mq:()=>q,YI:()=>x,rs:()=>w,p5:()=>z});var d=c(30717);let e="⚠️ Risk Notice: This provider uses a subscription/OAuth session not officially licensed for proxy/router use. Account may be restricted or banned. Use at your own risk.";Object.fromEntries(d.default.filter(a=>a.display).map(a=>{let b;return[a.id,"RISK_NOTICE"===(b=a.display).deprecationNotice?{...b,deprecationNotice:e}:b]}));let f=["serviceKinds","ttsConfig","sttConfig","embeddingConfig","imageConfig","imageToTextConfig","videoConfig","musicConfig","searchViaChat","searchConfig","fetchConfig","credentialFallback","modelsFetcher","mediaPriority","hiddenKinds"],g=a=>Object.fromEntries(d.default.filter(b=>b.category===a).map(a=>[a.id,function(a){let b={};for(let c of(a.media&&Object.assign(b,a.media),f))void 0!==a[c]&&(b[c]=a[c]);let c={...a.display||{}};return"RISK_NOTICE"===c.deprecationNotice&&(c.deprecationNotice=e),{...c,id:a.id,alias:a.uiAlias||a.alias,...a.hidden?{hidden:!0}:{},...b,...void 0!==a.priority?{priority:a.priority}:{},...a.hasFree?{hasFree:!0}:{},...a.thinkingConfig?{thinkingConfig:a.thinkingConfig}:{},...a.fastMode?{fastMode:a.fastMode}:{},...a.regions?{regions:a.regions,defaultRegion:a.defaultRegion}:{},...a.hasProviderSpecificData?{hasProviderSpecificData:!0}:{},...a.baseUrlField?{baseUrlField:a.baseUrlField}:{},...a.noAuth?{noAuth:!0}:{},...a.passthroughModels?{passthroughModels:!0}:{},...a.hasOAuth?{hasOAuth:!0}:{},...a.models?{models:a.models}:{},...a.authModes?{authModes:a.authModes}:{},...a.features?{features:{...a.features}}:{},...a.authType?{authType:a.authType}:{},...a.authHint?{authHint:a.authHint}:{},...a.apiKeyOptionalWith?{apiKeyOptionalWith:a.apiKeyOptionalWith}:{}}}(a)])),h=g("free"),i=g("freeTier"),j=g("oauth"),k=g("apikey"),l=g("webCookie"),m="openai-compatible-",n="anthropic-compatible-",o="custom-embedding-",p="custom-video-";function q(a){return"string"==typeof a&&a.startsWith(m)}function r(a){return"string"==typeof a&&a.startsWith(n)}function s(a){return"string"==typeof a&&a.startsWith(o)}function t(a){return"string"==typeof a&&a.startsWith(p)}let u={...h,...i,...j,...k,...l};function v(a){for(let b of Object.values(u))if(b.alias===a||b.id===a)return b;return null}function w(a){let b=v(a);return b?.id||a}function x(a){return!!a&&(!!v(a)||q(a)||r(a))}let y={nvidia:40};function z(a,b){let c=(a?.rpmByProvider||{})[b];if(0===c||"0"===c)return 0;let d=Number(c);return Number.isFinite(d)&&d>0?d:y[b]||0}function A(a){let b=u[a];return b?.alias||a}let B=Object.values(u).reduce((a,b)=>(a[b.alias]=b.id,a),{});Object.values(u).reduce((a,b)=>(a[b.id]=b.alias,a),{});let C=d.default.filter(a=>a.features?.usage).map(a=>a.id),D=d.default.filter(a=>a.features?.usageApikey).map(a=>a.id)},78335:()=>{},81329:(a,b,c)=>{"use strict";c.d(b,{CP:()=>f,Xg:()=>d.Xg,bs:()=>g,eh:()=>e,vq:()=>d.PROVIDER_MODELS});var d=c(29485);Object.entries(c(40615).AI_PROVIDERS).filter(([,a])=>a.passthroughModels).map(([a])=>a);let e=Object.entries(d.PROVIDER_MODELS).flatMap(([a,b])=>b.map(b=>({provider:a,model:b.id,name:b.name}))),f=(a,b=null)=>a?.kind||a?.type||b,g={vision:{icon:"visibility",label:"Vision",desc:"Supports image input",color:"text-blue-500"},reasoning:{icon:"neurology",label:"Reasoning",desc:"Supports reasoning / thinking",color:"text-amber-500"}}},96487:()=>{}};
|
|
1
|
+
exports.id=4827,exports.ids=[615,4827,9485],exports.modules={4630:(a,b,c)=>{"use strict";c.d(b,{Ak:()=>e,Yg:()=>h,sr:()=>d.sr,xq:()=>d.xq});var d=c(39141);function e(a){return(a?.providerSpecificData?.baseUrl?.trim()||"http://localhost:11434").replace(/\/$/,"")}let f=d.xq["xiaomi-tokenplan"]?.regions||{},g=d.xq["xiaomi-tokenplan"]?.defaultRegion;function h(a){return f[a?.providerSpecificData?.region]||f[g]}},16329:(a,b,c)=>{"use strict";c.d(b,{Bb:()=>e,Om:()=>g});let d=globalThis.__9routerShutdownState??={flushers:new Set,priorities:new Map,shutdownPromise:null,signalHandler:null,beforeExitHandler:null};function e(a,b=0){if("function"!=typeof a)throw TypeError("shutdown flusher must be a function");return d.flushers.add(a),d.priorities.set(a,Number.isFinite(b)?b:0),d.signalHandler??=()=>g(0),d.beforeExitHandler??=()=>f(),process.listeners("SIGINT").includes(d.signalHandler)||process.once("SIGINT",d.signalHandler),process.listeners("SIGTERM").includes(d.signalHandler)||process.once("SIGTERM",d.signalHandler),process.listeners("beforeExit").includes(d.beforeExitHandler)||process.once("beforeExit",d.beforeExitHandler),()=>{d.flushers.delete(a),d.priorities.delete(a)}}function f(){return d.shutdownPromise||(d.shutdownPromise=(async()=>{let a=new Map;for(let b of d.flushers){let c=d.priorities.get(b)??0;a.has(c)||a.set(c,[]),a.get(c).push(b)}for(let b of[...a.keys()].sort((a,b)=>a-b))for(let c of(await Promise.allSettled(a.get(b).map(a=>Promise.resolve().then(a)))))"rejected"===c.status&&console.error("[Shutdown] flusher failed:",c.reason?.message||c.reason)})()),d.shutdownPromise}async function g(a=0){await f(),process.exit(a)}},19956:(a,b,c)=>{"use strict";c.d(b,{h:()=>d,t:()=>e});let d={OPENAI:"openai",OPENAI_RESPONSES:"openai-responses",OPENAI_RESPONSE:"openai-response",CLAUDE:"claude",GEMINI:"gemini",GEMINI_CLI:"gemini-cli",VERTEX:"vertex",CODEX:"codex",ANTIGRAVITY:"antigravity",KIRO:"kiro",CURSOR:"cursor",OLLAMA:"ollama",COMMANDCODE:"commandcode"};function e(a,b){return a.includes("/v1/responses")?d.OPENAI_RESPONSES:a.includes("/v1/messages")?d.CLAUDE:a.includes("/v1/chat/completions")&&Array.isArray(b?.input)?d.OPENAI:null}},21719:(a,b,c)=>{"use strict";c.d(b,{g:()=>n,l:()=>m});var d=c(79646),e=c(33873),f=c.n(e),g=c(29021),h=c.n(g),i=c(21820),j=c.n(i),k=c(30869),l=c(16329);async function m(){!function(){try{let a=f().join("win32"===process.platform?f().join(process.env.APPDATA||"","ezrouter"):f().join(j().homedir(),".ezrouter"),"mitm",".mitm.pid");if(!h().existsSync(a))return;let b=parseInt(h().readFileSync(a,"utf8").trim(),10);if(!b)return;if("win32"===process.platform)try{(0,d.execSync)(`taskkill /F /T /PID ${b}`,{stdio:"ignore",windowsHide:!0,timeout:3e3})}catch{try{(0,d.execSync)(`powershell -NonInteractive -WindowStyle Hidden -Command "Stop-Process -Id ${b} -Force"`,{stdio:"ignore",windowsHide:!0,timeout:3e3})}catch{}}else try{(0,d.execSync)(`sudo -n kill -9 ${b} 2>/dev/null`,{stdio:"ignore",timeout:3e3})}catch{try{process.kill(b,"SIGKILL")}catch{}}try{h().unlinkSync(a)}catch{}}catch{}}();let a=function(){let a=[];if("win32"===process.platform){try{(0,d.execSync)('powershell -NonInteractive -WindowStyle Hidden -Command "Get-WmiObject Win32_Process -Filter \'Name=\\"node.exe\\"\' | Select-Object ProcessId,CommandLine | ConvertTo-Csv -NoTypeInformation"',{encoding:"utf8",windowsHide:!0,timeout:5e3}).split("\n").slice(1).filter(a=>a.trim()).forEach(b=>{let c=b.toLowerCase();if(c.includes("9router")||c.includes("next-server")||c.includes("\\bin\\app\\")||c.includes("/bin/app/")||c.includes("cli.js")){let c=b.match(/^"(\d+)"/);c&&c[1]&&c[1]!==process.pid.toString()&&a.push(c[1])}})}catch{}for(let b of["cloudflared","tray_windows_release"])try{let c=`powershell -NonInteractive -WindowStyle Hidden -Command "Get-Process ${b} -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Id"`;(0,d.execSync)(c,{encoding:"utf8",windowsHide:!0,timeout:5e3}).split("\n").forEach(b=>{let c=b.trim();c&&!isNaN(c)&&a.push(c)})}catch{}}else try{(0,d.execSync)("ps aux 2>/dev/null",{encoding:"utf8",timeout:5e3}).split("\n").forEach(b=>{if(b.includes("9router")||b.includes("next-server")||b.includes("cloudflared")||b.includes("/bin/app/")||b.includes("tray_darwin")||b.includes("tray_linux")){let c=b.trim().split(/\s+/)[1];c&&!isNaN(c)&&c!==process.pid.toString()&&a.push(c)}})}catch{}return a}(),b=process.platform;a.forEach(a=>{try{"win32"===b?(0,d.execSync)(`taskkill /F /PID ${a} 2>nul`,{stdio:"ignore",shell:!0,windowsHide:!0,timeout:3e3}):(0,d.execSync)(`kill -9 ${a} 2>/dev/null`,{stdio:"ignore",timeout:3e3})}catch{}}),a.length>0&&await new Promise(a=>setTimeout(a,1500))}function n(a=k.h0.npmPackageName){let b=function(a){try{if(!a||!h().existsSync(a))return a;let b=f().join(process.env.DATA_DIR?process.env.DATA_DIR:"win32"===process.platform?f().join(process.env.APPDATA||f().join(j().homedir(),"AppData","Roaming"),"ezrouter"):f().join(j().homedir(),".ezrouter"),"runtime","updater"),c=f().join(b,"updater.js");if(h().existsSync(c))try{if(h().statSync(a).size===h().statSync(c).size)return c}catch{}return h().mkdirSync(b,{recursive:!0}),h().copyFileSync(a,c),c}catch{return a}}(function(){if(process.env.UPDATER_SCRIPT_PATH&&h().existsSync(process.env.UPDATER_SCRIPT_PATH))return process.env.UPDATER_SCRIPT_PATH;let a=f().join(process.cwd(),"src","lib","updater","updater.js");if(h().existsSync(a))return a;let b=f().join(process.cwd(),"..","src","lib","updater","updater.js");return h().existsSync(b)?b:a}()),c="1"===process.env.TRAY_MODE,e={cmd:"win32"===process.platform?"npx.cmd":"npx",args:[k.h0.npmPackageName]},g=c?[...e.args,"--tray","--skip-update"]:[...e.args,"--skip-update"];(0,d.spawn)(process.execPath,[b],{detached:!0,stdio:"ignore",windowsHide:!0,env:{...process.env,UPDATER_PKG_NAME:a,UPDATER_PORT:String(k.h0.statusPort),UPDATER_TAIL_LINES:String(k.h0.statusLogTailLines),UPDATER_RETRIES:String(k.h0.installRetries),UPDATER_RETRY_DELAY_MS:String(k.h0.installRetryDelayMs),UPDATER_LINGER_MS:String(k.h0.lingerAfterDoneMs),UPDATER_WAIT_MIN_MS:String(k.h0.waitForExitMinMs),UPDATER_WAIT_MAX_MS:String(k.h0.waitForExitMaxMs),UPDATER_WAIT_CHECK_MS:String(k.h0.waitForExitCheckMs),UPDATER_APP_PORT:String(process.env.PORT||k.h0.appPort),UPDATER_RELAUNCH:"1",UPDATER_RELAUNCH_CMD:e.cmd,UPDATER_RELAUNCH_ARGS:JSON.stringify(g)}}).unref(),setTimeout(()=>(0,l.Om)(0),k.h0.exitDelayMs)}},29485:(a,b,c)=>{"use strict";c.d(b,{KC:()=>u,OA:()=>q,PROVIDER_MODELS:()=>f.vq,SM:()=>j,Xg:()=>t,cY:()=>v,ez:()=>p,fZ:()=>k,kt:()=>r,ux:()=>o});var d=c(4630),e=c(30717),f=c(39141),g=c(6595),h=c(8382),i=c(19956);function j(a){return f.vq[a]||[]}function k(a){let b=f.vq[a];return b?.[0]?.id||null}let l=new Set(["kr","kiro"]),m=new Map;for(let[a,b]of Object.entries(f.vq)){if(!Array.isArray(b))continue;let c=new Map,d=new Map;for(let e of b)if(e?.id!=null&&(c.set(e.id,e),l.has(a))){let a=(0,g.Kq)(e.id);a!==e.id&&d.set(a,e)}m.set(a,{exact:c,normalized:d})}function n(a,b,c){if(!a)return;let d="string"==typeof b?b.replace(/\([^()]+\)\s*$/,"").trim():b,e=m.get(c);if(e){let a=e.exact.get(d);return a||(e.normalized.size?e.normalized.get(d):void 0)}let f=a.find(a=>a.id===d);if(f)return f;if(!l.has(c))return;let h=(0,g.Kq)(d);if(h!==d)return a.find(a=>a.id===h)}function o(a,b){if((!a||"oc"===a||"opencode"===a||"ocg"===a||"opencode-go"===a)&&(0,h.d)(b))return i.h.OPENAI_RESPONSES;let c=t[a]||a,d=f.vq[c]||f.vq[a];return d?(0,g.gr)(n(d,b,c)):null}function p(a,b){let c=t[a]||a,d=f.vq[c]||f.vq[a];return d?(0,g.ec)(n(d,b,c)):null}function q(a,b){let c=t[a]||a,d=f.vq[c]||f.vq[a];if(!d)return null;let e=n(d,b,c);return e?.kind||e?.type||null}function r(a,b){let c=t[a]||a,d="string"==typeof b?b.match(/\([^()]+\)\s*$/):null,e=d?d[0]:"",g=e?b.slice(0,d.index).trim():b,i=n(f.vq[c]||f.vq[a],g,c),j=i?.upstreamModelId||i?.id;if(j){let a=j.match(/\([^()]+\)\s*$/),b=a?.[0]||"";return(b?j.slice(0,a.index).trim():j)+(e||b)}return"cx"===c&&"string"==typeof g&&g.endsWith(h.d5)?g.slice(0,-h.d5.length)+e:g+e}let s=Object.fromEntries(e.default.filter(a=>a.alias&&a.alias!==a.id).map(a=>[a.id,a.alias])),t=Object.fromEntries(Object.keys(d.xq).map(a=>[a,s[a]||a]));function u(a){let b=t[a]||a;return f.vq[b]||[]}function v(a,b){return(0,g.g5)(n(f.vq[a],b,a))}},30869:(a,b,c)=>{"use strict";c.d(b,{UY:()=>h,eh:()=>f.eh,fg:()=>e.fg,h0:()=>g,oc:()=>i});var d=c(39006),e=c(40615),f=c(81329);d.rE;let g={npmPackageName:"@rabbi696/ezrouter",installCmd:"npm i -g @rabbi696/ezrouter",installCmdLatest:"npm i -g @rabbi696/ezrouter@latest --prefer-online",shutdownCountdownSec:3,exitDelayMs:500,statusPort:20129,statusPollIntervalMs:1e3,statusLogTailLines:8,installRetries:3,installRetryDelayMs:5e3,lingerAfterDoneMs:3e4,waitForExitMinMs:5e3,waitForExitMaxMs:2e4,waitForExitCheckMs:500,appPort:20126},h={maxLines:200,pollIntervalMs:1e3,streamTimeoutMs:5e3},i={tickIntervalMs:6e4,pingLeadMs:5e3,refreshAheadMs:3e5,failureCooldownMs:9e5,providers:{claude:{settingsKey:"claudeAutoPing",quotaKey:"session (5h)",pingInactiveSession:!0,inactiveMinPingIntervalMs:18e6,pingModel:"claude-haiku-4-5-20251001",pingText:"hi",pingMaxTokens:1},codex:{settingsKey:"codexAutoPing",quotaKey:"session",pingWhenResetAtSlides:!0,resetAtDriftMs:3e4,minPingIntervalMs:6e5,skipWhenBlockingQuotaExhausted:!0,pingText:"hi",pingInstructions:"Reply with OK.",pingReasoningEffort:"none"}}}},39006:a=>{"use strict";a.exports={rE:"0.6.12"}},40615:(a,b,c)=>{"use strict";c.d(b,{AI_PROVIDERS:()=>u,js:()=>B,DI:()=>n,fg:()=>k,Pd:()=>o,Vj:()=>p,IS:()=>h,nJ:()=>i,zN:()=>j,JH:()=>m,jO:()=>D,wb:()=>C,br:()=>l,wG:()=>A,zt:()=>v,gb:()=>r,gC:()=>s,AR:()=>t,mq:()=>q,YI:()=>x,rs:()=>w,p5:()=>z});var d=c(30717);let e="⚠️ Risk Notice: This provider uses a subscription/OAuth session not officially licensed for proxy/router use. Account may be restricted or banned. Use at your own risk.";Object.fromEntries(d.default.filter(a=>a.display).map(a=>{let b;return[a.id,"RISK_NOTICE"===(b=a.display).deprecationNotice?{...b,deprecationNotice:e}:b]}));let f=["serviceKinds","ttsConfig","sttConfig","embeddingConfig","imageConfig","imageToTextConfig","videoConfig","musicConfig","searchViaChat","searchConfig","fetchConfig","credentialFallback","modelsFetcher","mediaPriority","hiddenKinds"],g=a=>Object.fromEntries(d.default.filter(b=>b.category===a).map(a=>[a.id,function(a){let b={};for(let c of(a.media&&Object.assign(b,a.media),f))void 0!==a[c]&&(b[c]=a[c]);let c={...a.display||{}};return"RISK_NOTICE"===c.deprecationNotice&&(c.deprecationNotice=e),{...c,id:a.id,alias:a.uiAlias||a.alias,...a.hidden?{hidden:!0}:{},...b,...void 0!==a.priority?{priority:a.priority}:{},...a.hasFree?{hasFree:!0}:{},...a.thinkingConfig?{thinkingConfig:a.thinkingConfig}:{},...a.fastMode?{fastMode:a.fastMode}:{},...a.regions?{regions:a.regions,defaultRegion:a.defaultRegion}:{},...a.hasProviderSpecificData?{hasProviderSpecificData:!0}:{},...a.baseUrlField?{baseUrlField:a.baseUrlField}:{},...a.noAuth?{noAuth:!0}:{},...a.passthroughModels?{passthroughModels:!0}:{},...a.hasOAuth?{hasOAuth:!0}:{},...a.models?{models:a.models}:{},...a.authModes?{authModes:a.authModes}:{},...a.features?{features:{...a.features}}:{},...a.authType?{authType:a.authType}:{},...a.authHint?{authHint:a.authHint}:{},...a.apiKeyOptionalWith?{apiKeyOptionalWith:a.apiKeyOptionalWith}:{}}}(a)])),h=g("free"),i=g("freeTier"),j=g("oauth"),k=g("apikey"),l=g("webCookie"),m="openai-compatible-",n="anthropic-compatible-",o="custom-embedding-",p="custom-video-";function q(a){return"string"==typeof a&&a.startsWith(m)}function r(a){return"string"==typeof a&&a.startsWith(n)}function s(a){return"string"==typeof a&&a.startsWith(o)}function t(a){return"string"==typeof a&&a.startsWith(p)}let u={...h,...i,...j,...k,...l};function v(a){for(let b of Object.values(u))if(b.alias===a||b.id===a)return b;return null}function w(a){let b=v(a);return b?.id||a}function x(a){return!!a&&(!!v(a)||q(a)||r(a))}let y={nvidia:40};function z(a,b){let c=(a?.rpmByProvider||{})[b];if(0===c||"0"===c)return 0;let d=Number(c);return Number.isFinite(d)&&d>0?d:y[b]||0}function A(a){let b=u[a];return b?.alias||a}let B=Object.values(u).reduce((a,b)=>(a[b.alias]=b.id,a),{});Object.values(u).reduce((a,b)=>(a[b.id]=b.alias,a),{});let C=d.default.filter(a=>a.features?.usage).map(a=>a.id),D=d.default.filter(a=>a.features?.usageApikey).map(a=>a.id)},78335:()=>{},81329:(a,b,c)=>{"use strict";c.d(b,{CP:()=>f,Xg:()=>d.Xg,bs:()=>g,eh:()=>e,vq:()=>d.PROVIDER_MODELS});var d=c(29485);Object.entries(c(40615).AI_PROVIDERS).filter(([,a])=>a.passthroughModels).map(([a])=>a);let e=Object.entries(d.PROVIDER_MODELS).flatMap(([a,b])=>b.map(b=>({provider:a,model:b.id,name:b.name}))),f=(a,b=null)=>a?.kind||a?.type||b,g={vision:{icon:"visibility",label:"Vision",desc:"Supports image input",color:"text-blue-500"},reasoning:{icon:"neurology",label:"Reasoning",desc:"Supports reasoning / thinking",color:"text-amber-500"}}},96487:()=>{}};
|