madarx 2.9.9 → 2.9.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/app-build-manifest.json +324 -324
- package/.next/standalone/.next/app-path-routes-manifest.json +89 -89
- package/.next/standalone/.next/build-manifest.json +2 -2
- package/.next/standalone/.next/prerender-manifest.json +15 -15
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +1 -1
- package/.next/standalone/.next/server/app/activity/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/admin/page.js +2 -2
- package/.next/standalone/.next/server/app/admin/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/agents/[id]/page.js +4 -4
- package/.next/standalone/.next/server/app/agents/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/agents/page.js +1 -1
- package/.next/standalone/.next/server/app/agents/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/activity/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/admin/audit-export/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/admin/share-links/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/agent-memory/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/agent-runs/[id]/cancel/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/agent-runs/[id]/events/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/agent-runs/[id]/log/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/agent-runs/[id]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/agent-runs/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/agents/[id]/chain/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/agents/[id]/memory/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/agents/[id]/reports/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/agents/[id]/run/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/agents/[id]/skills/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/agents/create/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/agents/ops/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/approvals/[id]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/approvals/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/artifacts/[id]/acl/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/artifacts/[id]/protect/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/artifacts/[id]/raw/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/artifacts/[id]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/artifacts/[id]/share-link/[linkId]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/artifacts/[id]/share-link/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/artifacts/upload/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/audit/list/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/audit/search/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/auth/callback/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/auth/config/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/auth/join-bootstrap/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/auth/session/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/brand/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/chat/sessions/[id]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/chat/sessions/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/config/env/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/config/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/connections/[service]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/connections/[service]/verify/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/connections/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/cron/tick/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/dashboard/spaces/[id]/move/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/dashboard/spaces/[id]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/dashboard/spaces/[id]/share-link/[linkId]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/dashboard/spaces/[id]/share-link/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/dashboard/spaces/import/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/dashboard/spaces/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/disk/files/[id]/blob/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/disk/files/[id]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/disk/files/[id]/transcribe/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/disk/files/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/disk/folders/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/events/since/[cursor]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/events/stream/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/fs/create-folder/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/fs/pick-folder/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/hail/engagements/[id]/blueprint/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/hail/engagements/[id]/diagnostic/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/hail/engagements/[id]/governance/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/hail/engagements/[id]/interview/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/hail/engagements/[id]/pilot/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/hail/engagements/[id]/quarterly/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/hail/engagements/[id]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/hail/engagements/[id]/setup-package/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/hail/engagements/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/hail/interviews/[id]/responses/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/hail/interviews/[id]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/hail/setup-packages/[id]/apply/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/hail/setup-packages/validate/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/heartbeat/tick/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/heartbeat/worker/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/help/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/hermes/jobs/[id]/events/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/hermes/jobs/[id]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/hermes/jobs/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/integrations/google/callback/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/integrations/google/oauth/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/marketplace/[id]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/marketplace/open-design/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/marketplace/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/mines/import-roots/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/mines/portfolio/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/mines/projects/[id]/chunks/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/mines/projects/[id]/diligence/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/mines/projects/[id]/import/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/mines/projects/[id]/publish/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/mines/projects/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/missions/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/onboarding/blueprint/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/onboarding/launch/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/orchestrator/command/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/orchestrator/stream/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/org/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/orgs/[id]/invites/[inviteId]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/orgs/[id]/invites/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/orgs/[id]/members/[userId]/role/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/orgs/[id]/members/[userId]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/orgs/[id]/members/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/orgs/[id]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/orgs/invites/pending/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/orgs/join/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/orgs/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/printing-press/clis/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/printing-press/install/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/printing-press/security-mode/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/privacy/config/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/privacy/verify/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/processes/[id]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/processes/[id]/share-link/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/processes/[id]/stages/[stageId]/override/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/processes/[id]/stages/[stageId]/retry/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/processes/[id]/stages/[stageId]/submit/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/processes/definitions/[slug]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/processes/definitions/[slug]/settings/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/processes/definitions/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/processes/definitions/validate/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/processes/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/processes/start-and-route/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/projects/[slug]/library/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/projects/[slug]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/runs/approve-claude-run/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/runs/claude-code-dry-run/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/runs/competitor-report/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/runs/engine-ping/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/runs/marketing-plan/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/schedules/upsert/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/secrets/[name]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/secrets/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/settings/trust-mode/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/share/[token]/otp/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/share/[token]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/share/[token]/verify/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/share/space/[token]/otp/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/share/space/[token]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/share/space/[token]/verify/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/shared/spaces/[id]/acl/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/shared/spaces/publish/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/shared/spaces/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/shared/spaces/status/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/shared/spaces/unpublish/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/state/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/system/update/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/tasks/[id]/active-run/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/tasks/[id]/attachments/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/tasks/[id]/checklist/[itemId]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/tasks/[id]/checklist/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/tasks/[id]/checkout/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/tasks/[id]/children/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/tasks/[id]/comments/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/tasks/[id]/events/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/tasks/[id]/live-runs/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/tasks/[id]/release/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/tasks/[id]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/tasks/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/tool-allowlists/[id]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/tool-allowlists/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/tool-egress/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/tools/[name]/approve/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/tools/[name]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/tools/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/transcripts/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/voice/providers/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/voice/realtime/context/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/voice/realtime/session/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/voice/realtime/tool-result/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/voice/realtime/tools/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/voice/tts/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/whatsapp/allowlist/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/whatsapp/messages/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/whatsapp/qr/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/whatsapp/send/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/whatsapp/status/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/approvals/page.js +2 -2
- package/.next/standalone/.next/server/app/approvals/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/architecture/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/architecture.html +2 -2
- package/.next/standalone/.next/server/app/architecture.rsc +1 -1
- package/.next/standalone/.next/server/app/audit/live/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/audit/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/brand/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/brand.html +1 -1
- package/.next/standalone/.next/server/app/brand.rsc +1 -1
- package/.next/standalone/.next/server/app/disk/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/federated-ai/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/federated-ai.html +2 -2
- package/.next/standalone/.next/server/app/federated-ai.rsc +1 -1
- package/.next/standalone/.next/server/app/hail/[id]/governance/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/hail/[id]/interview/page.js +2 -2
- package/.next/standalone/.next/server/app/hail/[id]/interview/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/hail/[id]/page.js +2 -2
- package/.next/standalone/.next/server/app/hail/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/hail/[id]/setup/page.js +2 -2
- package/.next/standalone/.next/server/app/hail/[id]/setup/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/hail/page.js +2 -2
- package/.next/standalone/.next/server/app/hail/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/help/[slug]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/help/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/index.html +2 -2
- package/.next/standalone/.next/server/app/index.rsc +1 -1
- package/.next/standalone/.next/server/app/join/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/join.html +1 -1
- package/.next/standalone/.next/server/app/join.rsc +1 -1
- package/.next/standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/marketplace/page.js +2 -2
- package/.next/standalone/.next/server/app/marketplace/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/mines/[projectId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/mines/[projectId]/results/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/mines/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/missions/page.js +2 -2
- package/.next/standalone/.next/server/app/missions/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/onboarding/org/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/onboarding.html +2 -2
- package/.next/standalone/.next/server/app/onboarding.rsc +1 -1
- package/.next/standalone/.next/server/app/org/page.js +1 -1
- package/.next/standalone/.next/server/app/org/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/org/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/[slug]/log/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/[slug]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/new/page.js +1 -1
- package/.next/standalone/.next/server/app/projects/new/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/new.html +1 -1
- package/.next/standalone/.next/server/app/projects/new.rsc +2 -2
- package/.next/standalone/.next/server/app/projects/page.js +10 -10
- package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/reports/[file]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/reports/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/runtime/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/schedules/page.js +2 -2
- package/.next/standalone/.next/server/app/schedules/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/account/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/advanced/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/appearance/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/brand/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/brand.html +2 -2
- package/.next/standalone/.next/server/app/settings/brand.rsc +1 -1
- package/.next/standalone/.next/server/app/settings/connectors/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/engines/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/onboarding/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/onboarding.html +2 -2
- package/.next/standalone/.next/server/app/settings/onboarding.rsc +1 -1
- package/.next/standalone/.next/server/app/settings/organization/page.js +1 -1
- package/.next/standalone/.next/server/app/settings/organization/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/settings/organization/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/runtime/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/tools/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings.html +2 -2
- package/.next/standalone/.next/server/app/settings.rsc +1 -1
- package/.next/standalone/.next/server/app/share/[token]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/share/space/[token]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/tasks/[id]/page.js +2 -2
- package/.next/standalone/.next/server/app/tasks/[id]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/tasks/page.js +1 -1
- package/.next/standalone/.next/server/app/tasks/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/team/[agentId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/team/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/tools/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/whatsapp/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/whatsapp.html +1 -1
- package/.next/standalone/.next/server/app/whatsapp.rsc +1 -1
- package/.next/standalone/.next/server/app/workflows/[caseId]/page.js +1 -1
- package/.next/standalone/.next/server/app/workflows/[caseId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workflows/new/[caseId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workflows/new/definition/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workflows/new/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workflows/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workflows/share/[caseId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app-paths-manifest.json +89 -89
- package/.next/standalone/.next/server/chunks/1658.js +3 -3
- package/.next/standalone/.next/server/chunks/1699.js +4 -4
- package/.next/standalone/.next/server/chunks/9838.js +1 -0
- package/.next/standalone/.next/server/functions-config-manifest.json +52 -52
- package/.next/standalone/.next/server/middleware-manifest.json +5 -5
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/static/chunks/app/projects/page-d79be5eee8055790.js +1 -0
- package/.next/standalone/data/.artifacts-migrated-v1 +1 -1
- package/.next/standalone/data/.default-project-seeded +1 -1
- package/.next/standalone/data/madarx.sqlite +0 -0
- package/.next/standalone/data/madarx.sqlite-shm +0 -0
- package/.next/standalone/data/madarx.sqlite-wal +0 -0
- package/.next/standalone/package.json +1 -1
- package/.next/static/chunks/app/projects/page-d79be5eee8055790.js +1 -0
- package/lib/agent-engines.js +101 -12
- package/lib/auth-config.js +20 -7
- package/package.json +1 -1
- package/.next/standalone/.next/server/chunks/4433.js +0 -1
- package/.next/standalone/.next/static/chunks/app/projects/page-51e4fec59105d81a.js +0 -1
- package/.next/static/chunks/app/projects/page-51e4fec59105d81a.js +0 -1
- /package/.next/standalone/.next/static/{6LfezThF0BYkCq4db5UB1 → BUIr7wYicmHyHGx6KK3SN}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{6LfezThF0BYkCq4db5UB1 → BUIr7wYicmHyHGx6KK3SN}/_ssgManifest.js +0 -0
- /package/.next/static/{6LfezThF0BYkCq4db5UB1 → BUIr7wYicmHyHGx6KK3SN}/_buildManifest.js +0 -0
- /package/.next/static/{6LfezThF0BYkCq4db5UB1 → BUIr7wYicmHyHGx6KK3SN}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
exports.id=1658,exports.ids=[1658],exports.modules={24910:(a,b,c)=>{"use strict";c.d(b,{x:()=>d});let d="0.10.3"},32586:(a,b,c)=>{"use strict";c.d(b,{HV:()=>f,L6:()=>g,c$:()=>h,m:()=>i,xM:()=>d});let d=3180,e=/^(.*)[.](0|[1-9][0-9]*)$/;function f(a,b){if(a===b)return!0;let c=a.match(e);return!!c&&c[1]===b}function g(a,b,c){let e=c??d,f=encodeURIComponent(b);if(f.length<=e)return[{name:a,value:b}];let g=[];for(;f.length>0;){let a=f.slice(0,e),b=a.lastIndexOf("%");b>e-3&&(a=a.slice(0,b));let c="";for(;a.length>0;)try{c=decodeURIComponent(a);break}catch(b){if(b instanceof URIError&&"%"===a.at(-3)&&a.length>3)a=a.slice(0,a.length-3);else throw b}g.push(c),f=f.slice(a.length)}return g.map((b,c)=>({name:`${a}.${c}`,value:b}))}async function h(a,b){let c=await b(a);if(c)return c;let d=[];for(let c=0;;c++){let e=`${a}.${c}`,f=await b(e);if(!f)break;d.push(f)}return d.length>0?d.join(""):null}async function i(a,b,c){await b(a)&&await c(a);for(let d=0;;d++){let e=`${a}.${d}`;if(!await b(e))break;await c(e)}}},33008:(a,b,c)=>{"use strict";c.d(b,{I1:()=>i,Op:()=>j,Pw:()=>g,j_:()=>k,uE:()=>h});let d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),e=" \n\r=".split(""),f=(()=>{let a=Array(128);for(let b=0;b<a.length;b+=1)a[b]=-1;for(let b=0;b<e.length;b+=1)a[e[b].charCodeAt(0)]=-2;for(let b=0;b<d.length;b+=1)a[d[b].charCodeAt(0)]=b;return a})();function g(a){let b=[],c=0,e=0;if(j(a,a=>{for(c=c<<8|a,e+=8;e>=6;){let a=c>>e-6&63;b.push(d[a]),e-=6}}),e>0)for(c<<=6-e,e=6;e>=6;){let a=c>>e-6&63;b.push(d[a]),e-=6}return b.join("")}function h(a){let b=[],c=a=>{b.push(String.fromCodePoint(a))},d={utf8seq:0,codepoint:0},e=0,g=0;for(let b=0;b<a.length;b+=1){let h=f[a.charCodeAt(b)];if(h>-1)for(e=e<<6|h,g+=6;g>=8;)k(e>>g-8&255,d,c),g-=8;else if(-2===h)continue;else throw Error(`Invalid Base64-URL character "${a.at(b)}" at position ${b}`)}return b.join("")}function i(a,b){if(a<=127)return void b(a);if(a<=2047){b(192|a>>6),b(128|63&a);return}if(a<=65535){b(224|a>>12),b(128|a>>6&63),b(128|63&a);return}if(a<=1114111){b(240|a>>18),b(128|a>>12&63),b(128|a>>6&63),b(128|63&a);return}throw Error(`Unrecognized Unicode codepoint: ${a.toString(16)}`)}function j(a,b){for(let c=0;c<a.length;c+=1){let d=a.charCodeAt(c);if(d>55295&&d<=56319){let b=(d-55296)*1024&65535;d=(a.charCodeAt(c+1)-56320&65535|b)+65536,c+=1}i(d,b)}}function k(a,b,c){if(0===b.utf8seq){if(a<=127)return void c(a);for(let c=1;c<6;c+=1)if((a>>7-c&1)==0){b.utf8seq=c;break}if(2===b.utf8seq)b.codepoint=31&a;else if(3===b.utf8seq)b.codepoint=15&a;else if(4===b.utf8seq)b.codepoint=7&a;else throw Error("Invalid UTF-8 sequence");b.utf8seq-=1}else if(b.utf8seq>0){if(a<=127)throw Error("Invalid UTF-8 sequence");b.codepoint=b.codepoint<<6|63&a,b.utf8seq-=1,0===b.utf8seq&&c(b.codepoint)}}},36497:(a,b,c)=>{"use strict";c.d(b,{X:()=>l,Y:()=>k});var d=c(94134),e=c(33008),f=c(
|
|
1
|
+
exports.id=1658,exports.ids=[1658],exports.modules={17461:(a,b,c)=>{"use strict";c.d(b,{Bd:()=>i,Gb:()=>h,lK:()=>f,qg:()=>e,rL:()=>j,vU:()=>g});var d=c(94134);let e=d.qg,f=d.lK;function g(a){let b=d.qg(a);return Object.keys(b??{}).map(a=>({name:a,value:b[a]}))}function h(a,b,c){return d.lK(a,b,c)}function i(){return"undefined"!=typeof window&&void 0!==window.document}function j(a={}){return{getItem:b=>a[b]||null,setItem:(b,c)=>{a[b]=c},removeItem:b=>{delete a[b]}}}},24910:(a,b,c)=>{"use strict";c.d(b,{x:()=>d});let d="0.10.3"},32586:(a,b,c)=>{"use strict";c.d(b,{HV:()=>f,L6:()=>g,c$:()=>h,m:()=>i,xM:()=>d});let d=3180,e=/^(.*)[.](0|[1-9][0-9]*)$/;function f(a,b){if(a===b)return!0;let c=a.match(e);return!!c&&c[1]===b}function g(a,b,c){let e=c??d,f=encodeURIComponent(b);if(f.length<=e)return[{name:a,value:b}];let g=[];for(;f.length>0;){let a=f.slice(0,e),b=a.lastIndexOf("%");b>e-3&&(a=a.slice(0,b));let c="";for(;a.length>0;)try{c=decodeURIComponent(a);break}catch(b){if(b instanceof URIError&&"%"===a.at(-3)&&a.length>3)a=a.slice(0,a.length-3);else throw b}g.push(c),f=f.slice(a.length)}return g.map((b,c)=>({name:`${a}.${c}`,value:b}))}async function h(a,b){let c=await b(a);if(c)return c;let d=[];for(let c=0;;c++){let e=`${a}.${c}`,f=await b(e);if(!f)break;d.push(f)}return d.length>0?d.join(""):null}async function i(a,b,c){await b(a)&&await c(a);for(let d=0;;d++){let e=`${a}.${d}`;if(!await b(e))break;await c(e)}}},33008:(a,b,c)=>{"use strict";c.d(b,{I1:()=>i,Op:()=>j,Pw:()=>g,j_:()=>k,uE:()=>h});let d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),e=" \n\r=".split(""),f=(()=>{let a=Array(128);for(let b=0;b<a.length;b+=1)a[b]=-1;for(let b=0;b<e.length;b+=1)a[e[b].charCodeAt(0)]=-2;for(let b=0;b<d.length;b+=1)a[d[b].charCodeAt(0)]=b;return a})();function g(a){let b=[],c=0,e=0;if(j(a,a=>{for(c=c<<8|a,e+=8;e>=6;){let a=c>>e-6&63;b.push(d[a]),e-=6}}),e>0)for(c<<=6-e,e=6;e>=6;){let a=c>>e-6&63;b.push(d[a]),e-=6}return b.join("")}function h(a){let b=[],c=a=>{b.push(String.fromCodePoint(a))},d={utf8seq:0,codepoint:0},e=0,g=0;for(let b=0;b<a.length;b+=1){let h=f[a.charCodeAt(b)];if(h>-1)for(e=e<<6|h,g+=6;g>=8;)k(e>>g-8&255,d,c),g-=8;else if(-2===h)continue;else throw Error(`Invalid Base64-URL character "${a.at(b)}" at position ${b}`)}return b.join("")}function i(a,b){if(a<=127)return void b(a);if(a<=2047){b(192|a>>6),b(128|63&a);return}if(a<=65535){b(224|a>>12),b(128|a>>6&63),b(128|63&a);return}if(a<=1114111){b(240|a>>18),b(128|a>>12&63),b(128|a>>6&63),b(128|63&a);return}throw Error(`Unrecognized Unicode codepoint: ${a.toString(16)}`)}function j(a,b){for(let c=0;c<a.length;c+=1){let d=a.charCodeAt(c);if(d>55295&&d<=56319){let b=(d-55296)*1024&65535;d=(a.charCodeAt(c+1)-56320&65535|b)+65536,c+=1}i(d,b)}}function k(a,b,c){if(0===b.utf8seq){if(a<=127)return void c(a);for(let c=1;c<6;c+=1)if((a>>7-c&1)==0){b.utf8seq=c;break}if(2===b.utf8seq)b.codepoint=31&a;else if(3===b.utf8seq)b.codepoint=15&a;else if(4===b.utf8seq)b.codepoint=7&a;else throw Error("Invalid UTF-8 sequence");b.utf8seq-=1}else if(b.utf8seq>0){if(a<=127)throw Error("Invalid UTF-8 sequence");b.codepoint=b.codepoint<<6|63&a,b.utf8seq-=1,0===b.utf8seq&&c(b.codepoint)}}},36497:(a,b,c)=>{"use strict";c.d(b,{X:()=>l,Y:()=>k});var d=c(94134),e=c(33008),f=c(17461),g=c(32586),h=c(70541);let i="base64-";function j(a){let b;if(!a.startsWith(i))return a;try{b=(0,e.uE)(a.substring(i.length))}catch(a){return console.warn("@supabase/ssr: could not base64url-decode chunked cookie value, treating as absent. Cookie chunks may have been written partially across responses.",a),null}try{JSON.parse(b)}catch{return console.warn("@supabase/ssr: chunked cookie decoded to invalid JSON, treating as absent. This usually indicates that cookie chunks from different writes were combined (e.g. response committed before all Set-Cookie headers were sent)."),null}return b}function k(a,b){let c,k,m=a.cookies??null,n=a.cookieEncoding,o={},p={},q=()=>{let a=(0,d.qg)(document.cookie);return Object.keys(a).map(b=>({name:b,value:a[b]??""}))},r=a=>{a.forEach(({name:a,value:b,options:c})=>{document.cookie=(0,d.lK)(a,b,c)})};if(m)if("get"in m){let a=async a=>{let b=a.flatMap(a=>[a,...Array.from({length:5}).map((b,c)=>`${a}.${c}`)]),c=[];for(let a=0;a<b.length;a+=1){let d=await m.get(b[a]);(d||"string"==typeof d)&&c.push({name:b[a],value:d})}return c};if(c=async b=>await a(b),"set"in m&&"remove"in m)k=async a=>{for(let b=0;b<a.length;b+=1){let{name:c,value:d,options:e}=a[b];d?await m.set(c,d,e):await m.remove(c,e)}};else if(b)k=async()=>{console.warn("@supabase/ssr: createServerClient was configured without set and remove cookie methods, but the client needs to set cookies. This can lead to issues such as random logouts, early session termination or increased token refresh requests. If in NextJS, check your middleware.ts file, route handlers and server actions for correctness. Consider switching to the getAll and setAll cookie methods instead of get, set and remove which are deprecated and can be difficult to use correctly.")};else throw Error("@supabase/ssr: createBrowserClient requires configuring a getAll and setAll cookie method (deprecated: alternatively both get, set and remove can be used)")}else if("getAll"in m)if(c=async()=>await m.getAll(),"setAll"in m)k=m.setAll;else if(b)k=async()=>{console.warn("@supabase/ssr: createServerClient was configured without the setAll cookie method, but the client needs to set cookies. This can lead to issues such as random logouts, early session termination or increased token refresh requests. If in NextJS, check your middleware.ts file, route handlers and server actions for correctness.")};else throw Error("@supabase/ssr: createBrowserClient requires configuring both getAll and setAll cookie methods (deprecated: alternatively both get, set and remove can be used)");else if(!b&&(0,f.Bd)())c=()=>q(),k=r;else throw Error(`@supabase/ssr: ${b?"createServerClient":"createBrowserClient"} requires configuring getAll and setAll cookie methods (deprecated: alternatively use get, set and remove).${(0,f.Bd)()?" As this is called in a browser runtime, consider removing the cookies option object to use the document.cookie API automatically.":""}`);else if(!b&&(0,f.Bd)())c=()=>q(),k=r;else if(b)throw Error("@supabase/ssr: createServerClient must be initialized with cookie options that specify getAll and setAll functions (deprecated, not recommended: alternatively use get, set and remove)");else c=()=>[],k=()=>{throw Error("@supabase/ssr: createBrowserClient in non-browser runtimes (including Next.js pre-rendering mode) was not initialized cookie options that specify getAll and setAll functions (deprecated: alternatively use get, set and remove), but they were needed")};return b?{getAll:c,setAll:k,setItems:o,removedItems:p,storage:{isServer:!0,getItem:async a=>{if("string"==typeof o[a])return o[a];if(p[a])return null;let b=await c([a]),d=await (0,g.c$)(a,async a=>{let c=b?.find(({name:b})=>b===a)||null;return c?c.value:null});return d?"string"!=typeof d?d:j(d):null},setItem:async(b,d)=>{b.endsWith("-code-verifier")&&await l({getAll:c,setAll:k,setItems:{[b]:d},removedItems:{}},{cookieOptions:a?.cookieOptions??null,cookieEncoding:n}),o[b]=d,delete p[b]},removeItem:async a=>{delete o[a],p[a]=!0}}}:{getAll:c,setAll:k,setItems:o,removedItems:p,storage:{isServer:!1,getItem:async a=>{let b=await c([a]),d=await (0,g.c$)(a,async a=>{let c=b?.find(({name:b})=>b===a)||null;return c?c.value:null});return d?j(d):null},setItem:async(b,d)=>{let f=await c([b]),j=new Set((f?.map(({name:a})=>a)||[]).filter(a=>(0,g.HV)(a,b))),l=d;"base64url"===n&&(l=i+(0,e.Pw)(d));let m=(0,g.L6)(b,l);m.forEach(({name:a})=>{j.delete(a)});let o={...h.U,...a?.cookieOptions,maxAge:0},p={...h.U,...a?.cookieOptions,maxAge:h.U.maxAge};delete o.name,delete p.name;let q=[...[...j].map(a=>({name:a,value:"",options:o})),...m.map(({name:a,value:b})=>({name:a,value:b,options:p}))];q.length>0&&await k(q,{})},removeItem:async b=>{let d=await c([b]),e=(d?.map(({name:a})=>a)||[]).filter(a=>(0,g.HV)(a,b)),f={...h.U,...a?.cookieOptions,maxAge:0};delete f.name,e.length>0&&await k(e.map(a=>({name:a,value:"",options:f})),{})}}}}async function l({getAll:a,setAll:b,setItems:c,removedItems:d},f){let j=f.cookieEncoding,k=f.cookieOptions??null,l=await a([...c?Object.keys(c):[],...d?Object.keys(d):[]]),m=l?.map(({name:a})=>a)||[],n=Object.keys(d).flatMap(a=>m.filter(b=>(0,g.HV)(b,a))),o=Object.keys(c).flatMap(a=>{let b=new Set(m.filter(b=>(0,g.HV)(b,a))),d=c[a];"base64url"===j&&(d=i+(0,e.Pw)(d));let f=(0,g.L6)(a,d);return f.forEach(a=>{b.delete(a.name)}),n.push(...b),f}),p={...h.U,...k,maxAge:0},q={...h.U,...k,maxAge:h.U.maxAge};delete p.name,delete q.name,await b([...n.map(a=>({name:a,value:"",options:p})),...o.map(({name:a,value:b})=>({name:a,value:b,options:q}))],{"Cache-Control":"private, no-cache, no-store, must-revalidate, max-age=0",Expires:"0",Pragma:"no-cache"})}},39113:(a,b,c)=>{"use strict";c.d(b,{Q:()=>f});let d=!1,e=["@supabase/auth-helpers-nextjs","@supabase/auth-helpers-react","@supabase/auth-helpers-remix","@supabase/auth-helpers-sveltekit"];function f(){if(d||"undefined"==typeof process||!process.env?.npm_package_name)return;let a=process.env.npm_package_name;e.includes(a)&&(d=!0,console.warn(`
|
|
2
2
|
╔════════════════════════════════════════════════════════════════════════════╗
|
|
3
3
|
║ ⚠️ IMPORTANT: Package Consolidation Notice ║
|
|
4
4
|
║ ║
|
|
@@ -16,7 +16,7 @@ exports.id=1658,exports.ids=[1658],exports.modules={24910:(a,b,c)=>{"use strict"
|
|
|
16
16
|
║ For more information, visit: ║
|
|
17
17
|
║ https://supabase.com/docs/guides/auth/server-side ║
|
|
18
18
|
╚════════════════════════════════════════════════════════════════════════════╝
|
|
19
|
-
`))}},
|
|
19
|
+
`))}},43096:(a,b,c)=>{"use strict";c.d(b,{Bd:()=>d.Bd,Gb:()=>d.Gb,HV:()=>f.HV,I1:()=>g.I1,L6:()=>f.L6,Op:()=>g.Op,Pw:()=>g.Pw,Up:()=>e.U,c$:()=>f.c$,j_:()=>g.j_,lK:()=>d.lK,m:()=>f.m,qg:()=>d.qg,rL:()=>d.rL,uE:()=>g.uE,vU:()=>d.vU,xM:()=>f.xM});var d=c(17461),e=c(70541),f=c(32586),g=c(33008)},47384:(a,b,c)=>{"use strict";c.d(b,{R:()=>i});var d=c(66167),e=c(24910),f=c(36497),g=c(17461),h=c(39113);function i(a,b,c){if((0,h.Q)(),!a||!b)throw Error(`Your project's URL and Key are required to create a Supabase client!
|
|
20
20
|
|
|
21
21
|
Check your Supabase project's API settings to find these values
|
|
22
22
|
|
|
@@ -56,7 +56,7 @@ Expiration Time: ${e.toISOString()}`),h&&(r+=`
|
|
|
56
56
|
Not Before: ${h.toISOString()}`),i&&(r+=`
|
|
57
57
|
Request ID: ${i}`),j){let a="\nResources:";for(let b of j){if(!b||"string"!=typeof b)throw Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${b}`);a+=`
|
|
58
58
|
- ${b}`}r+=a}return`${q}
|
|
59
|
-
${r}`}({domain:s.host,address:u,statement:q,uri:s.href,version:"1",chainId:v,nonce:null==(d=null==r?void 0:r.signInWithEthereum)?void 0:d.nonce,issuedAt:null!=(f=null==(e=null==r?void 0:r.signInWithEthereum)?void 0:e.issuedAt)?f:new Date,expirationTime:null==(g=null==r?void 0:r.signInWithEthereum)?void 0:g.expirationTime,notBefore:null==(h=null==r?void 0:r.signInWithEthereum)?void 0:h.notBefore,requestId:null==(i=null==r?void 0:r.signInWithEthereum)?void 0:i.requestId,resources:null==(j=null==r?void 0:r.signInWithEthereum)?void 0:j.resources}),o=await k.request({method:"personal_sign",params:[(m=n,"0x"+Array.from(new TextEncoder().encode(m),a=>a.toString(16).padStart(2,"0")).join("")),u]})}try{let{data:b,error:c}=await bY(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:n,signature:o},(null==(k=a.options)?void 0:k.captchaToken)?{gotrue_meta_security:{captcha_token:null==(l=a.options)?void 0:l.captchaToken}}:null),xform:b$});if(c)throw c;if(!b||!b.session||!b.user){let a=new bk;return this._returnResult({data:{user:null,session:null},error:a})}return b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("SIGNED_IN",b.session)),this._returnResult({data:Object.assign({},b),error:c})}catch(a){if(be(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signInWithSolana(a){var b,c,d,e,f,g,h,i,j,k,l,m;let n,o;if("message"in a)n=a.message,o=a.signature;else{let l,{chain:m,wallet:p,statement:q,options:r}=a;if(bB())if("object"==typeof p)l=p;else{let a=window;if("solana"in a&&"object"==typeof a.solana&&("signIn"in a.solana&&"function"==typeof a.solana.signIn||"signMessage"in a.solana&&"function"==typeof a.solana.signMessage))l=a.solana;else throw Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if("object"!=typeof p||!(null==r?void 0:r.url))throw Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");l=p}let s=new URL(null!=(b=null==r?void 0:r.url)?b:window.location.href);if("signIn"in l&&l.signIn){let a,b=await l.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},null==r?void 0:r.signInWithSolana),{version:"1",domain:s.host,uri:s.href}),q?{statement:q}:null));if(Array.isArray(b)&&b[0]&&"object"==typeof b[0])a=b[0];else if(b&&"object"==typeof b&&"signedMessage"in b&&"signature"in b)a=b;else throw Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in a&&"signature"in a&&("string"==typeof a.signedMessage||a.signedMessage instanceof Uint8Array)&&a.signature instanceof Uint8Array)n="string"==typeof a.signedMessage?a.signedMessage:new TextDecoder().decode(a.signedMessage),o=a.signature;else throw Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in l)||"function"!=typeof l.signMessage||!("publicKey"in l)||"object"!=typeof l||!l.publicKey||!("toBase58"in l.publicKey)||"function"!=typeof l.publicKey.toBase58)throw Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");n=[`${s.host} wants you to sign in with your Solana account:`,l.publicKey.toBase58(),...q?["",q,""]:[""],"Version: 1",`URI: ${s.href}`,`Issued At: ${null!=(d=null==(c=null==r?void 0:r.signInWithSolana)?void 0:c.issuedAt)?d:new Date().toISOString()}`,...(null==(e=null==r?void 0:r.signInWithSolana)?void 0:e.notBefore)?[`Not Before: ${r.signInWithSolana.notBefore}`]:[],...(null==(f=null==r?void 0:r.signInWithSolana)?void 0:f.expirationTime)?[`Expiration Time: ${r.signInWithSolana.expirationTime}`]:[],...(null==(g=null==r?void 0:r.signInWithSolana)?void 0:g.chainId)?[`Chain ID: ${r.signInWithSolana.chainId}`]:[],...(null==(h=null==r?void 0:r.signInWithSolana)?void 0:h.nonce)?[`Nonce: ${r.signInWithSolana.nonce}`]:[],...(null==(i=null==r?void 0:r.signInWithSolana)?void 0:i.requestId)?[`Request ID: ${r.signInWithSolana.requestId}`]:[],...(null==(k=null==(j=null==r?void 0:r.signInWithSolana)?void 0:j.resources)?void 0:k.length)?["Resources",...r.signInWithSolana.resources.map(a=>`- ${a}`)]:[]].join("\n");let a=await l.signMessage(new TextEncoder().encode(n),"utf8");if(!a||!(a instanceof Uint8Array))throw Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");o=a}}try{let{data:b,error:c}=await bY(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:n,signature:bA(o)},(null==(l=a.options)?void 0:l.captchaToken)?{gotrue_meta_security:{captcha_token:null==(m=a.options)?void 0:m.captchaToken}}:null),xform:b$});if(c)throw c;if(!b||!b.session||!b.user){let a=new bk;return this._returnResult({data:{user:null,session:null},error:a})}return b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("SIGNED_IN",b.session)),this._returnResult({data:Object.assign({},b),error:c})}catch(a){if(be(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async _exchangeCodeForSession(a){let b=await bG(this.storage,`${this.storageKey}-code-verifier`),[c,d]=(null!=b?b:"").split("/");try{if(!c&&"pkce"===this.flowType)throw new bo;let{data:b,error:e}=await bY(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:a,code_verifier:c},xform:b$});if(await bH(this.storage,`${this.storageKey}-code-verifier`),e)throw e;if(!b||!b.session||!b.user){let a=new bk;return this._returnResult({data:{user:null,session:null,redirectType:null},error:a})}return b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("recovery"===d?"PASSWORD_RECOVERY":"SIGNED_IN",b.session)),this._returnResult({data:Object.assign(Object.assign({},b),{redirectType:null!=d?d:null}),error:e})}catch(a){if(await bH(this.storage,`${this.storageKey}-code-verifier`),be(a))return this._returnResult({data:{user:null,session:null,redirectType:null},error:a});throw a}}async signInWithIdToken(a){try{let{options:b,provider:c,token:d,access_token:e,nonce:f}=a,{data:g,error:h}=await bY(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:c,id_token:d,access_token:e,nonce:f,gotrue_meta_security:{captcha_token:null==b?void 0:b.captchaToken}},xform:b$});if(h)return this._returnResult({data:{user:null,session:null},error:h});if(!g||!g.session||!g.user){let a=new bk;return this._returnResult({data:{user:null,session:null},error:a})}return g.session&&(await this._saveSession(g.session),await this._notifyAllSubscribers("SIGNED_IN",g.session)),this._returnResult({data:g,error:h})}catch(a){if(be(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signInWithOtp(a){var b,c,d,e,f;try{if("email"in a){let{email:d,options:e}=a,f=null,g=null;"pkce"===this.flowType&&([f,g]=await bO(this.storage,this.storageKey));let{error:h}=await bY(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:d,data:null!=(b=null==e?void 0:e.data)?b:{},create_user:null==(c=null==e?void 0:e.shouldCreateUser)||c,gotrue_meta_security:{captcha_token:null==e?void 0:e.captchaToken},code_challenge:f,code_challenge_method:g},redirectTo:null==e?void 0:e.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in a){let{phone:b,options:c}=a,{data:g,error:h}=await bY(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:b,data:null!=(d=null==c?void 0:c.data)?d:{},create_user:null==(e=null==c?void 0:c.shouldCreateUser)||e,gotrue_meta_security:{captcha_token:null==c?void 0:c.captchaToken},channel:null!=(f=null==c?void 0:c.channel)?f:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:null==g?void 0:g.message_id},error:h})}throw new bl("You must provide either an email or phone number.")}catch(a){if(await bH(this.storage,`${this.storageKey}-code-verifier`),be(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async verifyOtp(a){var b,c;try{let d,e;"options"in a&&(d=null==(b=a.options)?void 0:b.redirectTo,e=null==(c=a.options)?void 0:c.captchaToken);let{data:f,error:g}=await bY(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},a),{gotrue_meta_security:{captcha_token:e}}),redirectTo:d,xform:b$});if(g)throw g;if(!f)throw Error("An error occurred on token verification.");let h=f.session,i=f.user;return(null==h?void 0:h.access_token)&&(await this._saveSession(h),await this._notifyAllSubscribers("recovery"==a.type?"PASSWORD_RECOVERY":"SIGNED_IN",h)),this._returnResult({data:{user:i,session:h},error:null})}catch(a){if(be(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signInWithSSO(a){var b,c,d,e,f;try{let g=null,h=null;"pkce"===this.flowType&&([g,h]=await bO(this.storage,this.storageKey));let i=await bY(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in a?{provider_id:a.providerId}:null),"domain"in a?{domain:a.domain}:null),{redirect_to:null!=(c=null==(b=a.options)?void 0:b.redirectTo)?c:void 0}),(null==(d=null==a?void 0:a.options)?void 0:d.captchaToken)?{gotrue_meta_security:{captcha_token:a.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:g,code_challenge_method:h}),headers:this.headers,xform:b1});return(null==(e=i.data)?void 0:e.url)&&bB()&&!(null==(f=a.options)?void 0:f.skipBrowserRedirect)&&window.location.assign(i.data.url),this._returnResult(i)}catch(a){if(await bH(this.storage,`${this.storageKey}-code-verifier`),be(a))return this._returnResult({data:null,error:a});throw a}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async a=>{let{data:{session:b},error:c}=a;if(c)throw c;if(!b)throw new bi;let{error:d}=await bY(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:b.access_token});return this._returnResult({data:{user:null,session:null},error:d})})}catch(a){if(be(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async resend(a){try{let b=`${this.url}/resend`;if("email"in a){let{email:c,type:d,options:e}=a,{error:f}=await bY(this.fetch,"POST",b,{headers:this.headers,body:{email:c,type:d,gotrue_meta_security:{captcha_token:null==e?void 0:e.captchaToken}},redirectTo:null==e?void 0:e.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:f})}if("phone"in a){let{phone:c,type:d,options:e}=a,{data:f,error:g}=await bY(this.fetch,"POST",b,{headers:this.headers,body:{phone:c,type:d,gotrue_meta_security:{captcha_token:null==e?void 0:e.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:null==f?void 0:f.message_id},error:g})}throw new bl("You must provide either an email or phone number and a type")}catch(a){if(be(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async a=>a))}async _acquireLock(a,b){this._debug("#_acquireLock","begin",a);try{if(this.lockAcquired){let a=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),c=(async()=>(await a,await b()))();return this.pendingInLock.push((async()=>{try{await c}catch(a){}})()),c}return await this.lock(`lock:${this.storageKey}`,a,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;let a=b();for(this.pendingInLock.push((async()=>{try{await a}catch(a){}})()),await a;this.pendingInLock.length;){let a=[...this.pendingInLock];await Promise.all(a),this.pendingInLock.splice(0,a.length)}return await a}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(a){this._debug("#_useSession","begin");try{let b=await this.__loadSession();return await a(b)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",Error().stack);try{let b=null,c=await bG(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",c),null!==c&&(this._isValidSession(c)?b=c:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!b)return{data:{session:null},error:null};let d=!!b.expires_at&&1e3*b.expires_at-Date.now()<9e4;if(this._debug("#__loadSession()",`session has${d?"":" not"} expired`,"expires_at",b.expires_at),!d){if(this.userStorage){let a=await bG(this.userStorage,this.storageKey+"-user");(null==a?void 0:a.user)?b.user=a.user:b.user=bT()}if(this.storage.isServer&&b.user&&!b.user.__isUserNotAvailableProxy){var a;let c={value:this.suppressGetSessionWarning};b.user=(a=b.user,new Proxy(a,{get:(a,b,d)=>{if("__isInsecureUserWarningProxy"===b)return!0;if("symbol"==typeof b){let c=b.toString();if("Symbol(Symbol.toPrimitive)"===c||"Symbol(Symbol.toStringTag)"===c||"Symbol(util.inspect.custom)"===c||"Symbol(nodejs.util.inspect.custom)"===c)return Reflect.get(a,b,d)}return c.value||"string"!=typeof b||(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),c.value=!0),Reflect.get(a,b,d)}})),c.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:b},error:null}}let{data:e,error:f}=await this._callRefreshToken(b.refresh_token);if(f)return this._returnResult({data:{session:null},error:f});return this._returnResult({data:{session:e},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(a){if(a)return await this._getUser(a);await this.initializePromise;let b=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return b.data.user&&(this.suppressGetSessionWarning=!0),b}async _getUser(a){try{if(a)return await bY(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:a,xform:b0});return await this._useSession(async a=>{var b,c,d;let{data:e,error:f}=a;if(f)throw f;return(null==(b=e.session)?void 0:b.access_token)||this.hasCustomAuthorizationHeader?await bY(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:null!=(d=null==(c=e.session)?void 0:c.access_token)?d:void 0,xform:b0}):{data:{user:null},error:new bi}})}catch(a){if(be(a))return bj(a)&&(await this._removeSession(),await bH(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:a});throw a}}async updateUser(a,b={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(a,b))}async _updateUser(a,b={}){try{return await this._useSession(async c=>{let{data:d,error:e}=c;if(e)throw e;if(!d.session)throw new bi;let f=d.session,g=null,h=null;"pkce"===this.flowType&&null!=a.email&&([g,h]=await bO(this.storage,this.storageKey));let{data:i,error:j}=await bY(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:null==b?void 0:b.emailRedirectTo,body:Object.assign(Object.assign({},a),{code_challenge:g,code_challenge_method:h}),jwt:f.access_token,xform:b0});if(j)throw j;return f.user=i.user,await this._saveSession(f),await this._notifyAllSubscribers("USER_UPDATED",f),this._returnResult({data:{user:f.user},error:null})})}catch(a){if(await bH(this.storage,`${this.storageKey}-code-verifier`),be(a))return this._returnResult({data:{user:null},error:a});throw a}}async setSession(a){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(a))}async _setSession(a){try{if(!a.access_token||!a.refresh_token)throw new bi;let b=Date.now()/1e3,c=b,d=!0,e=null,{payload:f}=bJ(a.access_token);if(f.exp&&(d=(c=f.exp)<=b),d){let{data:b,error:c}=await this._callRefreshToken(a.refresh_token);if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!b)return{data:{user:null,session:null},error:null};e=b}else{let{data:d,error:f}=await this._getUser(a.access_token);if(f)return this._returnResult({data:{user:null,session:null},error:f});e={access_token:a.access_token,refresh_token:a.refresh_token,user:d.user,token_type:"bearer",expires_in:c-b,expires_at:c},await this._saveSession(e),await this._notifyAllSubscribers("SIGNED_IN",e)}return this._returnResult({data:{user:e.user,session:e},error:null})}catch(a){if(be(a))return this._returnResult({data:{session:null,user:null},error:a});throw a}}async refreshSession(a){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(a))}async _refreshSession(a){try{return await this._useSession(async b=>{var c;if(!a){let{data:d,error:e}=b;if(e)throw e;a=null!=(c=d.session)?c:void 0}if(!(null==a?void 0:a.refresh_token))throw new bi;let{data:d,error:e}=await this._callRefreshToken(a.refresh_token);return e?this._returnResult({data:{user:null,session:null},error:e}):d?this._returnResult({data:{user:d.user,session:d},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(a){if(be(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async _getSessionFromURL(a,b){var c;try{if(!bB())throw new bm("No browser detected.");if(a.error||a.error_description||a.error_code)throw new bm(a.error_description||"Error in URL with unspecified error_description",{error:a.error||"unspecified_error",code:a.error_code||"unspecified_code"});switch(b){case"implicit":if("pkce"===this.flowType)throw new bn("Not a valid PKCE flow url.");break;case"pkce":if("implicit"===this.flowType)throw new bm("Not a valid implicit grant flow url.")}if("pkce"===b){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!a.code)throw new bn("No code detected.");let{data:b,error:d}=await this._exchangeCodeForSession(a.code);if(d)throw d;let e=new URL(window.location.href);return e.searchParams.delete("code"),window.history.replaceState(window.history.state,"",e.toString()),{data:{session:b.session,redirectType:null!=(c=b.redirectType)?c:null},error:null}}let{provider_token:d,provider_refresh_token:e,access_token:f,refresh_token:g,expires_in:h,expires_at:i,token_type:j}=a;if(!f||!h||!g||!j)throw new bm("No session defined in URL");let k=Math.round(Date.now()/1e3),l=parseInt(h),m=k+l;i&&(m=parseInt(i));let n=m-k;1e3*n<=3e4&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${n}s, should have been closer to ${l}s`);let o=m-l;k-o>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",o,m,k):k-o<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",o,m,k);let{data:p,error:q}=await this._getUser(f);if(q)throw q;let r={provider_token:d,provider_refresh_token:e,access_token:f,expires_in:l,expires_at:m,refresh_token:g,token_type:j,user:p.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:r,redirectType:a.type},error:null})}catch(a){if(be(a))return this._returnResult({data:{session:null,redirectType:null},error:a});throw a}}_isImplicitGrantCallback(a){return"function"==typeof this.detectSessionInUrl?this.detectSessionInUrl(new URL(window.location.href),a):!!(a.access_token||a.error_description)}async _isPKCECallback(a){let b=await bG(this.storage,`${this.storageKey}-code-verifier`);return!!(a.code&&b)}async signOut(a={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(a))}async _signOut({scope:a}={scope:"global"}){return await this._useSession(async b=>{var c;let{data:d,error:e}=b;if(e&&!bj(e))return this._returnResult({error:e});let f=null==(c=d.session)?void 0:c.access_token;if(f){let{error:b}=await this.admin.signOut(f,a);if(b&&!(be(b)&&"AuthApiError"===b.name&&(404===b.status||401===b.status||403===b.status)||bj(b)))return this._returnResult({error:b})}return"others"!==a&&(await this._removeSession(),await bH(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(a){let b=Symbol("auth-callback"),c={id:b,callback:a,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",b),this.stateChangeEmitters.delete(b)}};return this._debug("#onAuthStateChange()","registered callback with id",b),this.stateChangeEmitters.set(b,c),(async()=>{await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(b)})})(),{data:{subscription:c}}}async _emitInitialSession(a){return await this._useSession(async b=>{var c,d;try{let{data:{session:d},error:e}=b;if(e)throw e;await (null==(c=this.stateChangeEmitters.get(a))?void 0:c.callback("INITIAL_SESSION",d)),this._debug("INITIAL_SESSION","callback id",a,"session",d)}catch(b){await (null==(d=this.stateChangeEmitters.get(a))?void 0:d.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",a,"error",b),bj(b)?console.warn(b):console.error(b)}})}async resetPasswordForEmail(a,b={}){let c=null,d=null;"pkce"===this.flowType&&([c,d]=await bO(this.storage,this.storageKey,!0));try{return await bY(this.fetch,"POST",`${this.url}/recover`,{body:{email:a,code_challenge:c,code_challenge_method:d,gotrue_meta_security:{captcha_token:b.captchaToken}},headers:this.headers,redirectTo:b.redirectTo})}catch(a){if(await bH(this.storage,`${this.storageKey}-code-verifier`),be(a))return this._returnResult({data:null,error:a});throw a}}async getUserIdentities(){var a;try{let{data:b,error:c}=await this.getUser();if(c)throw c;return this._returnResult({data:{identities:null!=(a=b.user.identities)?a:[]},error:null})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async linkIdentity(a){return"token"in a?this.linkIdentityIdToken(a):this.linkIdentityOAuth(a)}async linkIdentityOAuth(a){var b;try{let{data:c,error:d}=await this._useSession(async b=>{var c,d,e,f,g;let{data:h,error:i}=b;if(i)throw i;let j=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,a.provider,{redirectTo:null==(c=a.options)?void 0:c.redirectTo,scopes:null==(d=a.options)?void 0:d.scopes,queryParams:null==(e=a.options)?void 0:e.queryParams,skipBrowserRedirect:!0});return await bY(this.fetch,"GET",j,{headers:this.headers,jwt:null!=(g=null==(f=h.session)?void 0:f.access_token)?g:void 0})});if(d)throw d;return!bB()||(null==(b=a.options)?void 0:b.skipBrowserRedirect)||window.location.assign(null==c?void 0:c.url),this._returnResult({data:{provider:a.provider,url:null==c?void 0:c.url},error:null})}catch(b){if(be(b))return this._returnResult({data:{provider:a.provider,url:null},error:b});throw b}}async linkIdentityIdToken(a){return await this._useSession(async b=>{var c;try{let{error:d,data:{session:e}}=b;if(d)throw d;let{options:f,provider:g,token:h,access_token:i,nonce:j}=a,{data:k,error:l}=await bY(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:null!=(c=null==e?void 0:e.access_token)?c:void 0,body:{provider:g,id_token:h,access_token:i,nonce:j,link_identity:!0,gotrue_meta_security:{captcha_token:null==f?void 0:f.captchaToken}},xform:b$});if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!k||!k.session||!k.user)return this._returnResult({data:{user:null,session:null},error:new bk});return k.session&&(await this._saveSession(k.session),await this._notifyAllSubscribers("USER_UPDATED",k.session)),this._returnResult({data:k,error:l})}catch(a){if(await bH(this.storage,`${this.storageKey}-code-verifier`),be(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}})}async unlinkIdentity(a){try{return await this._useSession(async b=>{var c,d;let{data:e,error:f}=b;if(f)throw f;return await bY(this.fetch,"DELETE",`${this.url}/user/identities/${a.identity_id}`,{headers:this.headers,jwt:null!=(d=null==(c=e.session)?void 0:c.access_token)?d:void 0})})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _refreshAccessToken(a){let b=`#_refreshAccessToken(${a.substring(0,5)}...)`;this._debug(b,"begin");try{var c,d;let e=Date.now();return await (c=async c=>(c>0&&await bK(200*Math.pow(2,c-1)),this._debug(b,"refreshing attempt",c),await bY(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:a},headers:this.headers,xform:b$})),d=(a,b)=>{let c=200*Math.pow(2,a);return b&&bq(b)&&Date.now()+c-e<3e4},new Promise((a,b)=>{(async()=>{for(let e=0;e<1/0;e++)try{let b=await c(e);if(!d(e,null,b))return void a(b)}catch(a){if(!d(e,a))return void b(a)}})()}))}catch(a){if(this._debug(b,"error",a),be(a))return this._returnResult({data:{session:null,user:null},error:a});throw a}finally{this._debug(b,"end")}}_isValidSession(a){return"object"==typeof a&&null!==a&&"access_token"in a&&"refresh_token"in a&&"expires_at"in a}async _handleProviderSignIn(a,b){let c=await this._getUrlForProvider(`${this.url}/authorize`,a,{redirectTo:b.redirectTo,scopes:b.scopes,queryParams:b.queryParams});return this._debug("#_handleProviderSignIn()","provider",a,"options",b,"url",c),bB()&&!b.skipBrowserRedirect&&window.location.assign(c),{data:{provider:a,url:c},error:null}}async _recoverAndRefresh(){var a,b;let c="#_recoverAndRefresh()";this._debug(c,"begin");try{let d=await bG(this.storage,this.storageKey);if(d&&this.userStorage){let b=await bG(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!b&&(b={user:d.user},await bF(this.userStorage,this.storageKey+"-user",b)),d.user=null!=(a=null==b?void 0:b.user)?a:bT()}else if(d&&!d.user&&!d.user){let a=await bG(this.storage,this.storageKey+"-user");a&&(null==a?void 0:a.user)?(d.user=a.user,await bH(this.storage,this.storageKey+"-user"),await bF(this.storage,this.storageKey,d)):d.user=bT()}if(this._debug(c,"session from storage",d),!this._isValidSession(d)){this._debug(c,"session is not valid"),null!==d&&await this._removeSession();return}let e=(null!=(b=d.expires_at)?b:1/0)*1e3-Date.now()<9e4;if(this._debug(c,`session has${e?"":" not"} expired with margin of 90000s`),e){if(this.autoRefreshToken&&d.refresh_token){let{error:a}=await this._callRefreshToken(d.refresh_token);a&&(console.error(a),bq(a)||(this._debug(c,"refresh failed with a non-retryable error, removing the session",a),await this._removeSession()))}}else if(d.user&&!0===d.user.__isUserNotAvailableProxy)try{let{data:a,error:b}=await this._getUser(d.access_token);!b&&(null==a?void 0:a.user)?(d.user=a.user,await this._saveSession(d),await this._notifyAllSubscribers("SIGNED_IN",d)):this._debug(c,"could not get user data, skipping SIGNED_IN notification")}catch(a){console.error("Error getting user data:",a),this._debug(c,"error getting user data, skipping SIGNED_IN notification",a)}else await this._notifyAllSubscribers("SIGNED_IN",d)}catch(a){this._debug(c,"error",a),console.error(a);return}finally{this._debug(c,"end")}}async _callRefreshToken(a){var b,c;if(!a)throw new bi;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let d=`#_callRefreshToken(${a.substring(0,5)}...)`;this._debug(d,"begin");try{this.refreshingDeferred=new bI;let{data:b,error:c}=await this._refreshAccessToken(a);if(c)throw c;if(!b.session)throw new bi;await this._saveSession(b.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",b.session);let d={data:b.session,error:null};return this.refreshingDeferred.resolve(d),d}catch(a){if(this._debug(d,"error",a),be(a)){let c={data:null,error:a};return bq(a)||await this._removeSession(),null==(b=this.refreshingDeferred)||b.resolve(c),c}throw null==(c=this.refreshingDeferred)||c.reject(a),a}finally{this.refreshingDeferred=null,this._debug(d,"end")}}async _notifyAllSubscribers(a,b,c=!0){let d=`#_notifyAllSubscribers(${a})`;this._debug(d,"begin",b,`broadcast = ${c}`);try{this.broadcastChannel&&c&&this.broadcastChannel.postMessage({event:a,session:b});let d=[],e=Array.from(this.stateChangeEmitters.values()).map(async c=>{try{await c.callback(a,b)}catch(a){d.push(a)}});if(await Promise.all(e),d.length>0){for(let a=0;a<d.length;a+=1)console.error(d[a]);throw d[0]}}finally{this._debug(d,"end")}}async _saveSession(a){this._debug("#_saveSession()",a),this.suppressGetSessionWarning=!0,await bH(this.storage,`${this.storageKey}-code-verifier`);let b=Object.assign({},a),c=b.user&&!0===b.user.__isUserNotAvailableProxy;if(this.userStorage){!c&&b.user&&await bF(this.userStorage,this.storageKey+"-user",{user:b.user});let a=Object.assign({},b);delete a.user;let d=bU(a);await bF(this.storage,this.storageKey,d)}else{let a=bU(b);await bF(this.storage,this.storageKey,a)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await bH(this.storage,this.storageKey),await bH(this.storage,this.storageKey+"-code-verifier"),await bH(this.storage,this.storageKey+"-user"),this.userStorage&&await bH(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");let a=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{a&&bB()&&(null==window?void 0:window.removeEventListener)&&window.removeEventListener("visibilitychange",a)}catch(a){console.error("removing visibilitychange callback failed",a)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");let a=setInterval(()=>this._autoRefreshTokenTick(),3e4);this.autoRefreshTicker=a,a&&"object"==typeof a&&"function"==typeof a.unref?a.unref():"undefined"!=typeof Deno&&"function"==typeof Deno.unrefTimer&&Deno.unrefTimer(a);let b=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=b,b&&"object"==typeof b&&"function"==typeof b.unref?b.unref():"undefined"!=typeof Deno&&"function"==typeof Deno.unrefTimer&&Deno.unrefTimer(b)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");let a=this.autoRefreshTicker;this.autoRefreshTicker=null,a&&clearInterval(a);let b=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,b&&clearTimeout(b)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{let a=Date.now();try{return await this._useSession(async b=>{let{data:{session:c}}=b;if(!c||!c.refresh_token||!c.expires_at)return void this._debug("#_autoRefreshTokenTick()","no session");let d=Math.floor((1e3*c.expires_at-a)/3e4);this._debug("#_autoRefreshTokenTick()",`access token expires in ${d} ticks, a tick lasts 30000ms, refresh threshold is 3 ticks`),d<=3&&await this._callRefreshToken(c.refresh_token)})}catch(a){console.error("Auto refresh tick failed with error. This is likely a transient error.",a)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(a){if(a instanceof b8)this._debug("auto refresh token tick lock not available");else throw a}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!bB()||!(null==window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(a){this._debug("#visibilityChangedCallback","error",a)}},null==window||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(a){console.error("_handleVisibilityChange",a)}}async _onVisibilityChanged(a){let b=`#_onVisibilityChanged(${a})`;this._debug(b,"visibilityState",document.visibilityState),"visible"===document.visibilityState?(this.autoRefreshToken&&this._startAutoRefresh(),a||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if("visible"!==document.visibilityState)return void this._debug(b,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");await this._recoverAndRefresh()}))):"hidden"===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(a,b,c){let d=[`provider=${encodeURIComponent(b)}`];if((null==c?void 0:c.redirectTo)&&d.push(`redirect_to=${encodeURIComponent(c.redirectTo)}`),(null==c?void 0:c.scopes)&&d.push(`scopes=${encodeURIComponent(c.scopes)}`),"pkce"===this.flowType){let[a,b]=await bO(this.storage,this.storageKey),c=new URLSearchParams({code_challenge:`${encodeURIComponent(a)}`,code_challenge_method:`${encodeURIComponent(b)}`});d.push(c.toString())}if(null==c?void 0:c.queryParams){let a=new URLSearchParams(c.queryParams);d.push(a.toString())}return(null==c?void 0:c.skipBrowserRedirect)&&d.push(`skip_http_redirect=${c.skipBrowserRedirect}`),`${a}?${d.join("&")}`}async _unenroll(a){try{return await this._useSession(async b=>{var c;let{data:d,error:e}=b;return e?this._returnResult({data:null,error:e}):await bY(this.fetch,"DELETE",`${this.url}/factors/${a.factorId}`,{headers:this.headers,jwt:null==(c=null==d?void 0:d.session)?void 0:c.access_token})})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _enroll(a){try{return await this._useSession(async b=>{var c,d;let{data:e,error:f}=b;if(f)return this._returnResult({data:null,error:f});let g=Object.assign({friendly_name:a.friendlyName,factor_type:a.factorType},"phone"===a.factorType?{phone:a.phone}:"totp"===a.factorType?{issuer:a.issuer}:{}),{data:h,error:i}=await bY(this.fetch,"POST",`${this.url}/factors`,{body:g,headers:this.headers,jwt:null==(c=null==e?void 0:e.session)?void 0:c.access_token});return i?this._returnResult({data:null,error:i}):("totp"===a.factorType&&"totp"===h.type&&(null==(d=null==h?void 0:h.totp)?void 0:d.qr_code)&&(h.totp.qr_code=`data:image/svg+xml;utf-8,${h.totp.qr_code}`),this._returnResult({data:h,error:null}))})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _verify(a){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async b=>{var c;let{data:d,error:e}=b;if(e)return this._returnResult({data:null,error:e});let f=Object.assign({challenge_id:a.challengeId},"webauthn"in a?{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_response:"create"===a.webauthn.type?ci(a.webauthn.credential_response):cj(a.webauthn.credential_response)})}:{code:a.code}),{data:g,error:h}=await bY(this.fetch,"POST",`${this.url}/factors/${a.factorId}/verify`,{body:f,headers:this.headers,jwt:null==(c=null==d?void 0:d.session)?void 0:c.access_token});return h?this._returnResult({data:null,error:h}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+g.expires_in},g)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",g),this._returnResult({data:g,error:h}))})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}})}async _challenge(a){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async b=>{var c;let{data:d,error:e}=b;if(e)return this._returnResult({data:null,error:e});let f=await bY(this.fetch,"POST",`${this.url}/factors/${a.factorId}/challenge`,{body:a,headers:this.headers,jwt:null==(c=null==d?void 0:d.session)?void 0:c.access_token});if(f.error)return f;let{data:g}=f;if("webauthn"!==g.type)return{data:g,error:null};switch(g.webauthn.type){case"create":return{data:Object.assign(Object.assign({},g),{webauthn:Object.assign(Object.assign({},g.webauthn),{credential_options:Object.assign(Object.assign({},g.webauthn.credential_options),{publicKey:cg(g.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},g),{webauthn:Object.assign(Object.assign({},g.webauthn),{credential_options:Object.assign(Object.assign({},g.webauthn.credential_options),{publicKey:ch(g.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}})}async _challengeAndVerify(a){let{data:b,error:c}=await this._challenge({factorId:a.factorId});return c?this._returnResult({data:null,error:c}):await this._verify({factorId:a.factorId,challengeId:b.id,code:a.code})}async _listFactors(){var a;let{data:{user:b},error:c}=await this.getUser();if(c)return{data:null,error:c};let d={all:[],phone:[],totp:[],webauthn:[]};for(let c of null!=(a=null==b?void 0:b.factors)?a:[])d.all.push(c),"verified"===c.status&&d[c.factor_type].push(c);return{data:d,error:null}}async _getAuthenticatorAssuranceLevel(a){var b,c,d,e;if(a)try{let{payload:d}=bJ(a),e=null;d.aal&&(e=d.aal);let f=e,{data:{user:g},error:h}=await this.getUser(a);if(h)return this._returnResult({data:null,error:h});(null!=(c=null==(b=null==g?void 0:g.factors)?void 0:b.filter(a=>"verified"===a.status))?c:[]).length>0&&(f="aal2");let i=d.amr||[];return{data:{currentLevel:e,nextLevel:f,currentAuthenticationMethods:i},error:null}}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}let{data:{session:f},error:g}=await this.getSession();if(g)return this._returnResult({data:null,error:g});if(!f)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let{payload:h}=bJ(f.access_token),i=null;h.aal&&(i=h.aal);let j=i;return(null!=(e=null==(d=f.user.factors)?void 0:d.filter(a=>"verified"===a.status))?e:[]).length>0&&(j="aal2"),{data:{currentLevel:i,nextLevel:j,currentAuthenticationMethods:h.amr||[]},error:null}}async _getAuthorizationDetails(a){try{return await this._useSession(async b=>{let{data:{session:c},error:d}=b;return d?this._returnResult({data:null,error:d}):c?await bY(this.fetch,"GET",`${this.url}/oauth/authorizations/${a}`,{headers:this.headers,jwt:c.access_token,xform:a=>({data:a,error:null})}):this._returnResult({data:null,error:new bi})})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _approveAuthorization(a,b){try{return await this._useSession(async c=>{let{data:{session:d},error:e}=c;if(e)return this._returnResult({data:null,error:e});if(!d)return this._returnResult({data:null,error:new bi});let f=await bY(this.fetch,"POST",`${this.url}/oauth/authorizations/${a}/consent`,{headers:this.headers,jwt:d.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return f.data&&f.data.redirect_url&&bB()&&!(null==b?void 0:b.skipBrowserRedirect)&&window.location.assign(f.data.redirect_url),f})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _denyAuthorization(a,b){try{return await this._useSession(async c=>{let{data:{session:d},error:e}=c;if(e)return this._returnResult({data:null,error:e});if(!d)return this._returnResult({data:null,error:new bi});let f=await bY(this.fetch,"POST",`${this.url}/oauth/authorizations/${a}/consent`,{headers:this.headers,jwt:d.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return f.data&&f.data.redirect_url&&bB()&&!(null==b?void 0:b.skipBrowserRedirect)&&window.location.assign(f.data.redirect_url),f})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _listOAuthGrants(){try{return await this._useSession(async a=>{let{data:{session:b},error:c}=a;return c?this._returnResult({data:null,error:c}):b?await bY(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:b.access_token,xform:a=>({data:a,error:null})}):this._returnResult({data:null,error:new bi})})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _revokeOAuthGrant(a){try{return await this._useSession(async b=>{let{data:{session:c},error:d}=b;return d?this._returnResult({data:null,error:d}):c?(await bY(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:c.access_token,query:{client_id:a.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new bi})})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async fetchJwk(a,b={keys:[]}){let c=b.keys.find(b=>b.kid===a);if(c)return c;let d=Date.now();if((c=this.jwks.keys.find(b=>b.kid===a))&&this.jwks_cached_at+6e5>d)return c;let{data:e,error:f}=await bY(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(f)throw f;return e.keys&&0!==e.keys.length&&(this.jwks=e,this.jwks_cached_at=d,c=e.keys.find(b=>b.kid===a))?c:null}async getClaims(a,b={}){try{let c=a;if(!c){let{data:a,error:b}=await this.getSession();if(b||!a.session)return this._returnResult({data:null,error:b});c=a.session.access_token}let{header:d,payload:e,signature:f,raw:{header:g,payload:h}}=bJ(c);(null==b?void 0:b.allowExpired)||function(a){if(!a)throw Error("Missing exp claim");if(a<=Math.floor(Date.now()/1e3))throw Error("JWT has expired")}(e.exp);let i=!d.alg||d.alg.startsWith("HS")||!d.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(d.kid,(null==b?void 0:b.keys)?{keys:b.keys}:null==b?void 0:b.jwks);if(!i){let{error:a}=await this.getUser(c);if(a)throw a;return{data:{claims:e,header:d,signature:f},error:null}}let j=function(a){switch(a){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw Error("Invalid alg claim")}}(d.alg),k=await crypto.subtle.importKey("jwk",i,j,!0,["verify"]);if(!await crypto.subtle.verify(j,k,f,function(a){let b=[];return!function(a,b){for(let c=0;c<a.length;c+=1){let d=a.charCodeAt(c);if(d>55295&&d<=56319){let b=(d-55296)*1024&65535;d=(a.charCodeAt(c+1)-56320&65535|b)+65536,c+=1}!function(a,b){if(a<=127)return b(a);if(a<=2047){b(192|a>>6),b(128|63&a);return}if(a<=65535){b(224|a>>12),b(128|a>>6&63),b(128|63&a);return}if(a<=1114111){b(240|a>>18),b(128|a>>12&63),b(128|a>>6&63),b(128|63&a);return}throw Error(`Unrecognized Unicode codepoint: ${a.toString(16)}`)}(d,b)}}(a,a=>b.push(a)),new Uint8Array(b)}(`${g}.${h}`)))throw new bs("Invalid JWT signature");return{data:{claims:e,header:d,signature:f},error:null}}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async signInWithPasskey(a){var b,c,d;bS(this.experimental);try{if(!cl())return this._returnResult({data:null,error:new bg("Browser does not support WebAuthn",null)});let{data:e,error:f}=await this._startPasskeyAuthentication({options:{captchaToken:null==(b=null==a?void 0:a.options)?void 0:b.captchaToken}});if(f||!e)return this._returnResult({data:null,error:f});let g=ch(e.options),h=null!=(d=null==(c=null==a?void 0:a.options)?void 0:c.signal)?d:cf.createNewAbortSignal(),{data:i,error:j}=await cn({publicKey:g,signal:h});if(j||!i)return this._returnResult({data:null,error:null!=j?j:new bg("WebAuthn ceremony failed",null)});let k=cj(i);return this._verifyPasskeyAuthentication({challengeId:e.challenge_id,credential:k})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async registerPasskey(a){var b,c;bS(this.experimental);try{if(!cl())return this._returnResult({data:null,error:new bg("Browser does not support WebAuthn",null)});let{data:d,error:e}=await this._startPasskeyRegistration();if(e||!d)return this._returnResult({data:null,error:e});let f=cg(d.options),g=null!=(c=null==(b=null==a?void 0:a.options)?void 0:b.signal)?c:cf.createNewAbortSignal(),{data:h,error:i}=await cm({publicKey:f,signal:g});if(i||!h)return this._returnResult({data:null,error:null!=i?i:new bg("WebAuthn ceremony failed",null)});let j=ci(h);return this._verifyPasskeyRegistration({challengeId:d.challenge_id,credential:j})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _startPasskeyRegistration(){bS(this.experimental);try{return await this._useSession(async a=>{let{data:{session:b},error:c}=a;if(c)return this._returnResult({data:null,error:c});if(!b)return this._returnResult({data:null,error:new bi});let{data:d,error:e}=await bY(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:b.access_token,body:{}});return e?this._returnResult({data:null,error:e}):this._returnResult({data:d,error:null})})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _verifyPasskeyRegistration(a){bS(this.experimental);try{return await this._useSession(async b=>{let{data:{session:c},error:d}=b;if(d)return this._returnResult({data:null,error:d});if(!c)return this._returnResult({data:null,error:new bi});let{data:e,error:f}=await bY(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:c.access_token,body:{challenge_id:a.challengeId,credential:a.credential}});return f?this._returnResult({data:null,error:f}):this._returnResult({data:e,error:null})})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _startPasskeyAuthentication(a){var b;bS(this.experimental);try{let{data:c,error:d}=await bY(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:null==(b=null==a?void 0:a.options)?void 0:b.captchaToken}}});if(d)return this._returnResult({data:null,error:d});return this._returnResult({data:c,error:null})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _verifyPasskeyAuthentication(a){bS(this.experimental);try{let{data:b,error:c}=await bY(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:a.challengeId,credential:a.credential},xform:b$});if(c)return this._returnResult({data:null,error:c});return b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("SIGNED_IN",b.session)),this._returnResult({data:b,error:null})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _listPasskeys(){bS(this.experimental);try{return await this._useSession(async a=>{let{data:{session:b},error:c}=a;if(c)return this._returnResult({data:null,error:c});if(!b)return this._returnResult({data:null,error:new bi});let{data:d,error:e}=await bY(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:b.access_token,xform:a=>({data:a,error:null})});return e?this._returnResult({data:null,error:e}):this._returnResult({data:d,error:null})})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _updatePasskey(a){bS(this.experimental);try{return await this._useSession(async b=>{let{data:{session:c},error:d}=b;if(d)return this._returnResult({data:null,error:d});if(!c)return this._returnResult({data:null,error:new bi});let{data:e,error:f}=await bY(this.fetch,"PATCH",`${this.url}/passkeys/${a.passkeyId}`,{headers:this.headers,jwt:c.access_token,body:{friendly_name:a.friendlyName}});return f?this._returnResult({data:null,error:f}):this._returnResult({data:e,error:null})})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _deletePasskey(a){bS(this.experimental);try{return await this._useSession(async b=>{let{data:{session:c},error:d}=b;if(d)return this._returnResult({data:null,error:d});if(!c)return this._returnResult({data:null,error:new bi});let{error:e}=await bY(this.fetch,"DELETE",`${this.url}/passkeys/${a.passkeyId}`,{headers:this.headers,jwt:c.access_token,noResolveJson:!0});return e?this._returnResult({data:null,error:e}):this._returnResult({data:null,error:null})})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}}cv.nextInstanceID={};let cw=cv,cx="";cx="undefined"!=typeof Deno?"deno":"undefined"!=typeof document?"web":"undefined"!=typeof navigator&&"ReactNative"===navigator.product?"react-native":"node";let cy={headers:{"X-Client-Info":`supabase-js-${cx}/2.105.4`}},cz={schema:"public"},cA={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},cB={};function cC(a){return(cC="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function cD(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function cE(a){for(var b=1;b<arguments.length;b++){var c=null!=arguments[b]?arguments[b]:{};b%2?cD(Object(c),!0).forEach(function(b){!function(a,b,c){var d;(d=function(a,b){if("object"!=cC(a)||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=cC(d))return d;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}(b,"string"),(b="symbol"==cC(d)?d:d+"")in a)?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c}(a,b,c[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(c)):cD(Object(c)).forEach(function(b){Object.defineProperty(a,b,Object.getOwnPropertyDescriptor(c,b))})}return a}var cF=class extends cw{constructor(a){super(a)}},cG=class{constructor(a,b,c){var d,e,f;this.supabaseUrl=a,this.supabaseKey=b;let g=function(a){let b=null==a?void 0:a.trim();if(!b)throw Error("supabaseUrl is required.");if(!b.match(/^https?:\/\//i))throw Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(b.endsWith("/")?b:b+"/")}catch(a){throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}(a);if(!b)throw Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",g),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",g),this.storageUrl=new URL("storage/v1",g),this.functionsUrl=new URL("functions/v1",g);let h=`sb-${g.hostname.split(".")[0]}-auth-token`,i=function(a,b){var c,d;let{db:e,auth:f,realtime:g,global:h}=a,{db:i,auth:j,realtime:k,global:l}=b,m={db:cE(cE({},i),e),auth:cE(cE({},j),f),realtime:cE(cE({},k),g),storage:{},global:cE(cE(cE({},l),h),{},{headers:cE(cE({},null!=(c=null==l?void 0:l.headers)?c:{}),null!=(d=null==h?void 0:h.headers)?d:{})}),accessToken:async()=>""};return a.accessToken?m.accessToken=a.accessToken:delete m.accessToken,m}(null!=c?c:{},{db:cz,realtime:cB,auth:cE(cE({},cA),{},{storageKey:h}),global:cy});this.storageKey=null!=(d=i.auth.storageKey)?d:"",this.headers=null!=(e=i.global.headers)?e:{},i.accessToken?(this.accessToken=i.accessToken,this.auth=new Proxy({},{get:(a,b)=>{throw Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(b)} is not possible`)}})):this.auth=this._initSupabaseAuthClient(null!=(f=i.auth)?f:{},this.headers,i.global.fetch),this.fetch=((a,b,c)=>{let d=(a=>a?(...b)=>a(...b):(...a)=>fetch(...a))(c),e=Headers;return async(c,f)=>{var g;let h=null!=(g=await b())?g:a,i=new e(null==f?void 0:f.headers);return i.has("apikey")||i.set("apikey",a),i.has("Authorization")||i.set("Authorization",`Bearer ${h}`),d(c,cE(cE({},f),{},{headers:i}))}})(b,this._getAccessToken.bind(this),i.global.fetch),this.realtime=this._initRealtimeClient(cE({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},i.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(a=>this.realtime.setAuth(a)).catch(a=>console.warn("Failed to set initial Realtime auth token:",a)),this.rest=new D(new URL("rest/v1",g).href,{headers:this.headers,schema:i.db.schema,fetch:this.fetch,timeout:i.db.timeout,urlLengthLimit:i.db.urlLengthLimit}),this.storage=new a7(this.storageUrl.href,this.headers,this.fetch,null==c?void 0:c.storage),i.accessToken||this._listenForAuthEvents()}get functions(){return new j(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(a){return this.rest.from(a)}schema(a){return this.rest.schema(a)}rpc(a,b={},c={head:!1,get:!1,count:void 0}){return this.rest.rpc(a,b,c)}channel(a,b={config:{}}){return this.realtime.channel(a,b)}getChannels(){return this.realtime.getChannels()}removeChannel(a){return this.realtime.removeChannel(a)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var a,b;if(this.accessToken)return await this.accessToken();let{data:c}=await this.auth.getSession();return null!=(a=null==(b=c.session)?void 0:b.access_token)?a:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:a,persistSession:b,detectSessionInUrl:c,storage:d,userStorage:e,storageKey:f,flowType:g,lock:h,debug:i,throwOnError:j,experimental:k,lockAcquireTimeout:l,skipAutoInitialize:m},n,o){let p={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new cF({url:this.authUrl.href,headers:cE(cE({},p),n),storageKey:f,autoRefreshToken:a,persistSession:b,detectSessionInUrl:c,storage:d,userStorage:e,flowType:g,lock:h,debug:i,throwOnError:j,experimental:k,fetch:o,lockAcquireTimeout:l,skipAutoInitialize:m,hasCustomAuthorizationHeader:Object.keys(this.headers).some(a=>"authorization"===a.toLowerCase())})}_initRealtimeClient(a){return new at(this.realtimeUrl.href,cE(cE({},a),{},{params:cE(cE({},{apikey:this.supabaseKey}),null==a?void 0:a.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((a,b)=>{this._handleTokenChanged(a,"CLIENT",null==b?void 0:b.access_token)})}_handleTokenChanged(a,b,c){("TOKEN_REFRESHED"===a||"SIGNED_IN"===a)&&this.changedAccessToken!==c?(this.changedAccessToken=c,this.realtime.setAuth(c)):"SIGNED_OUT"===a&&(this.realtime.setAuth(),"STORAGE"==b&&this.auth.signOut(),this.changedAccessToken=void 0)}};let cH=(a,b,c)=>new cG(a,b,c);(function(){if("undefined"!=typeof window)return!1;let a=globalThis.process;if(!a)return!1;let b=a.version;if(null==b)return!1;let c=b.match(/^v(\d+)\./);return!!c&&18>=parseInt(c[1],10)})()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217")},69311:()=>{},70541:(a,b,c)=>{"use strict";c.d(b,{U:()=>d});let d={path:"/",sameSite:"lax",httpOnly:!1,maxAge:3456e4}},81658:(a,b,c)=>{"use strict";c.r(b),c.d(b,{DEFAULT_COOKIE_OPTIONS:()=>h.Up,MAX_CHUNK_SIZE:()=>h.xM,codepointToUTF8:()=>h.I1,combineChunks:()=>h.c$,createBrowserClient:()=>d.k,createChunks:()=>h.L6,createServerClient:()=>e.R,deleteChunks:()=>h.m,isBrowser:()=>h.Bd,isChunkLike:()=>h.HV,memoryLocalStorageAdapter:()=>h.rL,parse:()=>h.qg,parseCookieHeader:()=>h.vU,serialize:()=>h.lK,serializeCookieHeader:()=>h.Gb,stringFromBase64URL:()=>h.uE,stringFromUTF8:()=>h.j_,stringToBase64URL:()=>h.Pw,stringToUTF8:()=>h.Op,warnIfUsingDeprecatedAuthHelpersPackage:()=>i.Q});var d=c(97833),e=c(47384),f=c(69311),g={};for(let a in f)0>["default","warnIfUsingDeprecatedAuthHelpersPackage","createBrowserClient","createServerClient"].indexOf(a)&&(g[a]=()=>f[a]);c.d(b,g);var h=c(43096),i=c(39113)},94134:(a,b)=>{"use strict";b.qg=function(a,b){let c=new h,d=a.length;if(d<2)return c;let e=b?.decode||k,f=0;do{let b=function(a,b,c){let d=a.indexOf("=",b);return d<c?d:-1}(a,f,d);if(-1===b)break;let g=function(a,b,c){let d=a.indexOf(";",b);return -1===d?c:d}(a,f,d);if(b>g){f=a.lastIndexOf(";",b-1)+1;continue}let h=j(a,f,b);void 0===c[h]&&(c[h]=e(j(a,b+1,g))),f=g+1}while(f<d);return c},b.lK=i,b.lK=i;let c=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,d=/^[\u0021-\u003A\u003C-\u007E]*$/,e=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,f=/^[\u0020-\u003A\u003D-\u007E]*$/,g=Object.prototype.toString,h=(()=>{let a=function(){};return a.prototype=Object.create(null),a})();function i(a,b,h){let i="object"==typeof a?a:{...h,name:a,value:String(b)},j=("object"==typeof b?b:h)?.encode||encodeURIComponent;if(!c.test(i.name))throw TypeError(`argument name is invalid: ${i.name}`);let k=i.value?j(i.value):"";if(!d.test(k))throw TypeError(`argument val is invalid: ${i.value}`);let l=i.name+"="+k;if(void 0!==i.maxAge){if(!Number.isInteger(i.maxAge))throw TypeError(`option maxAge is invalid: ${i.maxAge}`);l+="; Max-Age="+i.maxAge}if(i.domain){if(!e.test(i.domain))throw TypeError(`option domain is invalid: ${i.domain}`);l+="; Domain="+i.domain}if(i.path){if(!f.test(i.path))throw TypeError(`option path is invalid: ${i.path}`);l+="; Path="+i.path}if(i.expires){var m;if(m=i.expires,"[object Date]"!==g.call(m)||!Number.isFinite(i.expires.valueOf()))throw TypeError(`option expires is invalid: ${i.expires}`);l+="; Expires="+i.expires.toUTCString()}if(i.httpOnly&&(l+="; HttpOnly"),i.secure&&(l+="; Secure"),i.partitioned&&(l+="; Partitioned"),i.priority)switch("string"==typeof i.priority?i.priority.toLowerCase():void 0){case"low":l+="; Priority=Low";break;case"medium":l+="; Priority=Medium";break;case"high":l+="; Priority=High";break;default:throw TypeError(`option priority is invalid: ${i.priority}`)}if(i.sameSite)switch("string"==typeof i.sameSite?i.sameSite.toLowerCase():i.sameSite){case!0:case"strict":l+="; SameSite=Strict";break;case"lax":l+="; SameSite=Lax";break;case"none":l+="; SameSite=None";break;default:throw TypeError(`option sameSite is invalid: ${i.sameSite}`)}return l}function j(a,b,c){let d=b,e=c;do{let b=a.charCodeAt(d);if(32!==b&&9!==b)break}while(++d<e);for(;e>d;){let b=a.charCodeAt(e-1);if(32!==b&&9!==b)break;e--}return a.slice(d,e)}function k(a){if(-1===a.indexOf("%"))return a;try{return decodeURIComponent(a)}catch(b){return a}}},97833:(a,b,c)=>{"use strict";let d;c.d(b,{k:()=>j});var e=c(66167),f=c(24910),g=c(39842),h=c(36497),i=c(39113);function j(a,b,c){(0,i.Q)();let j=c?.isSingleton===!0||(!c||!("isSingleton"in c))&&(0,g.Bd)();if(j&&d)return d;if(!a||!b)throw Error(`@supabase/ssr: Your project's URL and API key are required to create a Supabase client!
|
|
59
|
+
${r}`}({domain:s.host,address:u,statement:q,uri:s.href,version:"1",chainId:v,nonce:null==(d=null==r?void 0:r.signInWithEthereum)?void 0:d.nonce,issuedAt:null!=(f=null==(e=null==r?void 0:r.signInWithEthereum)?void 0:e.issuedAt)?f:new Date,expirationTime:null==(g=null==r?void 0:r.signInWithEthereum)?void 0:g.expirationTime,notBefore:null==(h=null==r?void 0:r.signInWithEthereum)?void 0:h.notBefore,requestId:null==(i=null==r?void 0:r.signInWithEthereum)?void 0:i.requestId,resources:null==(j=null==r?void 0:r.signInWithEthereum)?void 0:j.resources}),o=await k.request({method:"personal_sign",params:[(m=n,"0x"+Array.from(new TextEncoder().encode(m),a=>a.toString(16).padStart(2,"0")).join("")),u]})}try{let{data:b,error:c}=await bY(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:n,signature:o},(null==(k=a.options)?void 0:k.captchaToken)?{gotrue_meta_security:{captcha_token:null==(l=a.options)?void 0:l.captchaToken}}:null),xform:b$});if(c)throw c;if(!b||!b.session||!b.user){let a=new bk;return this._returnResult({data:{user:null,session:null},error:a})}return b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("SIGNED_IN",b.session)),this._returnResult({data:Object.assign({},b),error:c})}catch(a){if(be(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signInWithSolana(a){var b,c,d,e,f,g,h,i,j,k,l,m;let n,o;if("message"in a)n=a.message,o=a.signature;else{let l,{chain:m,wallet:p,statement:q,options:r}=a;if(bB())if("object"==typeof p)l=p;else{let a=window;if("solana"in a&&"object"==typeof a.solana&&("signIn"in a.solana&&"function"==typeof a.solana.signIn||"signMessage"in a.solana&&"function"==typeof a.solana.signMessage))l=a.solana;else throw Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if("object"!=typeof p||!(null==r?void 0:r.url))throw Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");l=p}let s=new URL(null!=(b=null==r?void 0:r.url)?b:window.location.href);if("signIn"in l&&l.signIn){let a,b=await l.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},null==r?void 0:r.signInWithSolana),{version:"1",domain:s.host,uri:s.href}),q?{statement:q}:null));if(Array.isArray(b)&&b[0]&&"object"==typeof b[0])a=b[0];else if(b&&"object"==typeof b&&"signedMessage"in b&&"signature"in b)a=b;else throw Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in a&&"signature"in a&&("string"==typeof a.signedMessage||a.signedMessage instanceof Uint8Array)&&a.signature instanceof Uint8Array)n="string"==typeof a.signedMessage?a.signedMessage:new TextDecoder().decode(a.signedMessage),o=a.signature;else throw Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in l)||"function"!=typeof l.signMessage||!("publicKey"in l)||"object"!=typeof l||!l.publicKey||!("toBase58"in l.publicKey)||"function"!=typeof l.publicKey.toBase58)throw Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");n=[`${s.host} wants you to sign in with your Solana account:`,l.publicKey.toBase58(),...q?["",q,""]:[""],"Version: 1",`URI: ${s.href}`,`Issued At: ${null!=(d=null==(c=null==r?void 0:r.signInWithSolana)?void 0:c.issuedAt)?d:new Date().toISOString()}`,...(null==(e=null==r?void 0:r.signInWithSolana)?void 0:e.notBefore)?[`Not Before: ${r.signInWithSolana.notBefore}`]:[],...(null==(f=null==r?void 0:r.signInWithSolana)?void 0:f.expirationTime)?[`Expiration Time: ${r.signInWithSolana.expirationTime}`]:[],...(null==(g=null==r?void 0:r.signInWithSolana)?void 0:g.chainId)?[`Chain ID: ${r.signInWithSolana.chainId}`]:[],...(null==(h=null==r?void 0:r.signInWithSolana)?void 0:h.nonce)?[`Nonce: ${r.signInWithSolana.nonce}`]:[],...(null==(i=null==r?void 0:r.signInWithSolana)?void 0:i.requestId)?[`Request ID: ${r.signInWithSolana.requestId}`]:[],...(null==(k=null==(j=null==r?void 0:r.signInWithSolana)?void 0:j.resources)?void 0:k.length)?["Resources",...r.signInWithSolana.resources.map(a=>`- ${a}`)]:[]].join("\n");let a=await l.signMessage(new TextEncoder().encode(n),"utf8");if(!a||!(a instanceof Uint8Array))throw Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");o=a}}try{let{data:b,error:c}=await bY(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:n,signature:bA(o)},(null==(l=a.options)?void 0:l.captchaToken)?{gotrue_meta_security:{captcha_token:null==(m=a.options)?void 0:m.captchaToken}}:null),xform:b$});if(c)throw c;if(!b||!b.session||!b.user){let a=new bk;return this._returnResult({data:{user:null,session:null},error:a})}return b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("SIGNED_IN",b.session)),this._returnResult({data:Object.assign({},b),error:c})}catch(a){if(be(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async _exchangeCodeForSession(a){let b=await bG(this.storage,`${this.storageKey}-code-verifier`),[c,d]=(null!=b?b:"").split("/");try{if(!c&&"pkce"===this.flowType)throw new bo;let{data:b,error:e}=await bY(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:a,code_verifier:c},xform:b$});if(await bH(this.storage,`${this.storageKey}-code-verifier`),e)throw e;if(!b||!b.session||!b.user){let a=new bk;return this._returnResult({data:{user:null,session:null,redirectType:null},error:a})}return b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("recovery"===d?"PASSWORD_RECOVERY":"SIGNED_IN",b.session)),this._returnResult({data:Object.assign(Object.assign({},b),{redirectType:null!=d?d:null}),error:e})}catch(a){if(await bH(this.storage,`${this.storageKey}-code-verifier`),be(a))return this._returnResult({data:{user:null,session:null,redirectType:null},error:a});throw a}}async signInWithIdToken(a){try{let{options:b,provider:c,token:d,access_token:e,nonce:f}=a,{data:g,error:h}=await bY(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:c,id_token:d,access_token:e,nonce:f,gotrue_meta_security:{captcha_token:null==b?void 0:b.captchaToken}},xform:b$});if(h)return this._returnResult({data:{user:null,session:null},error:h});if(!g||!g.session||!g.user){let a=new bk;return this._returnResult({data:{user:null,session:null},error:a})}return g.session&&(await this._saveSession(g.session),await this._notifyAllSubscribers("SIGNED_IN",g.session)),this._returnResult({data:g,error:h})}catch(a){if(be(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signInWithOtp(a){var b,c,d,e,f;try{if("email"in a){let{email:d,options:e}=a,f=null,g=null;"pkce"===this.flowType&&([f,g]=await bO(this.storage,this.storageKey));let{error:h}=await bY(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:d,data:null!=(b=null==e?void 0:e.data)?b:{},create_user:null==(c=null==e?void 0:e.shouldCreateUser)||c,gotrue_meta_security:{captcha_token:null==e?void 0:e.captchaToken},code_challenge:f,code_challenge_method:g},redirectTo:null==e?void 0:e.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in a){let{phone:b,options:c}=a,{data:g,error:h}=await bY(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:b,data:null!=(d=null==c?void 0:c.data)?d:{},create_user:null==(e=null==c?void 0:c.shouldCreateUser)||e,gotrue_meta_security:{captcha_token:null==c?void 0:c.captchaToken},channel:null!=(f=null==c?void 0:c.channel)?f:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:null==g?void 0:g.message_id},error:h})}throw new bl("You must provide either an email or phone number.")}catch(a){if(await bH(this.storage,`${this.storageKey}-code-verifier`),be(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async verifyOtp(a){var b,c;try{let d,e;"options"in a&&(d=null==(b=a.options)?void 0:b.redirectTo,e=null==(c=a.options)?void 0:c.captchaToken);let{data:f,error:g}=await bY(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},a),{gotrue_meta_security:{captcha_token:e}}),redirectTo:d,xform:b$});if(g)throw g;if(!f)throw Error("An error occurred on token verification.");let h=f.session,i=f.user;return(null==h?void 0:h.access_token)&&(await this._saveSession(h),await this._notifyAllSubscribers("recovery"==a.type?"PASSWORD_RECOVERY":"SIGNED_IN",h)),this._returnResult({data:{user:i,session:h},error:null})}catch(a){if(be(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async signInWithSSO(a){var b,c,d,e,f;try{let g=null,h=null;"pkce"===this.flowType&&([g,h]=await bO(this.storage,this.storageKey));let i=await bY(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in a?{provider_id:a.providerId}:null),"domain"in a?{domain:a.domain}:null),{redirect_to:null!=(c=null==(b=a.options)?void 0:b.redirectTo)?c:void 0}),(null==(d=null==a?void 0:a.options)?void 0:d.captchaToken)?{gotrue_meta_security:{captcha_token:a.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:g,code_challenge_method:h}),headers:this.headers,xform:b1});return(null==(e=i.data)?void 0:e.url)&&bB()&&!(null==(f=a.options)?void 0:f.skipBrowserRedirect)&&window.location.assign(i.data.url),this._returnResult(i)}catch(a){if(await bH(this.storage,`${this.storageKey}-code-verifier`),be(a))return this._returnResult({data:null,error:a});throw a}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async a=>{let{data:{session:b},error:c}=a;if(c)throw c;if(!b)throw new bi;let{error:d}=await bY(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:b.access_token});return this._returnResult({data:{user:null,session:null},error:d})})}catch(a){if(be(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async resend(a){try{let b=`${this.url}/resend`;if("email"in a){let{email:c,type:d,options:e}=a,{error:f}=await bY(this.fetch,"POST",b,{headers:this.headers,body:{email:c,type:d,gotrue_meta_security:{captcha_token:null==e?void 0:e.captchaToken}},redirectTo:null==e?void 0:e.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:f})}if("phone"in a){let{phone:c,type:d,options:e}=a,{data:f,error:g}=await bY(this.fetch,"POST",b,{headers:this.headers,body:{phone:c,type:d,gotrue_meta_security:{captcha_token:null==e?void 0:e.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:null==f?void 0:f.message_id},error:g})}throw new bl("You must provide either an email or phone number and a type")}catch(a){if(be(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async a=>a))}async _acquireLock(a,b){this._debug("#_acquireLock","begin",a);try{if(this.lockAcquired){let a=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),c=(async()=>(await a,await b()))();return this.pendingInLock.push((async()=>{try{await c}catch(a){}})()),c}return await this.lock(`lock:${this.storageKey}`,a,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;let a=b();for(this.pendingInLock.push((async()=>{try{await a}catch(a){}})()),await a;this.pendingInLock.length;){let a=[...this.pendingInLock];await Promise.all(a),this.pendingInLock.splice(0,a.length)}return await a}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(a){this._debug("#_useSession","begin");try{let b=await this.__loadSession();return await a(b)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",Error().stack);try{let b=null,c=await bG(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",c),null!==c&&(this._isValidSession(c)?b=c:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!b)return{data:{session:null},error:null};let d=!!b.expires_at&&1e3*b.expires_at-Date.now()<9e4;if(this._debug("#__loadSession()",`session has${d?"":" not"} expired`,"expires_at",b.expires_at),!d){if(this.userStorage){let a=await bG(this.userStorage,this.storageKey+"-user");(null==a?void 0:a.user)?b.user=a.user:b.user=bT()}if(this.storage.isServer&&b.user&&!b.user.__isUserNotAvailableProxy){var a;let c={value:this.suppressGetSessionWarning};b.user=(a=b.user,new Proxy(a,{get:(a,b,d)=>{if("__isInsecureUserWarningProxy"===b)return!0;if("symbol"==typeof b){let c=b.toString();if("Symbol(Symbol.toPrimitive)"===c||"Symbol(Symbol.toStringTag)"===c||"Symbol(util.inspect.custom)"===c||"Symbol(nodejs.util.inspect.custom)"===c)return Reflect.get(a,b,d)}return c.value||"string"!=typeof b||(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),c.value=!0),Reflect.get(a,b,d)}})),c.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:b},error:null}}let{data:e,error:f}=await this._callRefreshToken(b.refresh_token);if(f)return this._returnResult({data:{session:null},error:f});return this._returnResult({data:{session:e},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(a){if(a)return await this._getUser(a);await this.initializePromise;let b=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return b.data.user&&(this.suppressGetSessionWarning=!0),b}async _getUser(a){try{if(a)return await bY(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:a,xform:b0});return await this._useSession(async a=>{var b,c,d;let{data:e,error:f}=a;if(f)throw f;return(null==(b=e.session)?void 0:b.access_token)||this.hasCustomAuthorizationHeader?await bY(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:null!=(d=null==(c=e.session)?void 0:c.access_token)?d:void 0,xform:b0}):{data:{user:null},error:new bi}})}catch(a){if(be(a))return bj(a)&&(await this._removeSession(),await bH(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:a});throw a}}async updateUser(a,b={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(a,b))}async _updateUser(a,b={}){try{return await this._useSession(async c=>{let{data:d,error:e}=c;if(e)throw e;if(!d.session)throw new bi;let f=d.session,g=null,h=null;"pkce"===this.flowType&&null!=a.email&&([g,h]=await bO(this.storage,this.storageKey));let{data:i,error:j}=await bY(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:null==b?void 0:b.emailRedirectTo,body:Object.assign(Object.assign({},a),{code_challenge:g,code_challenge_method:h}),jwt:f.access_token,xform:b0});if(j)throw j;return f.user=i.user,await this._saveSession(f),await this._notifyAllSubscribers("USER_UPDATED",f),this._returnResult({data:{user:f.user},error:null})})}catch(a){if(await bH(this.storage,`${this.storageKey}-code-verifier`),be(a))return this._returnResult({data:{user:null},error:a});throw a}}async setSession(a){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(a))}async _setSession(a){try{if(!a.access_token||!a.refresh_token)throw new bi;let b=Date.now()/1e3,c=b,d=!0,e=null,{payload:f}=bJ(a.access_token);if(f.exp&&(d=(c=f.exp)<=b),d){let{data:b,error:c}=await this._callRefreshToken(a.refresh_token);if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!b)return{data:{user:null,session:null},error:null};e=b}else{let{data:d,error:f}=await this._getUser(a.access_token);if(f)return this._returnResult({data:{user:null,session:null},error:f});e={access_token:a.access_token,refresh_token:a.refresh_token,user:d.user,token_type:"bearer",expires_in:c-b,expires_at:c},await this._saveSession(e),await this._notifyAllSubscribers("SIGNED_IN",e)}return this._returnResult({data:{user:e.user,session:e},error:null})}catch(a){if(be(a))return this._returnResult({data:{session:null,user:null},error:a});throw a}}async refreshSession(a){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(a))}async _refreshSession(a){try{return await this._useSession(async b=>{var c;if(!a){let{data:d,error:e}=b;if(e)throw e;a=null!=(c=d.session)?c:void 0}if(!(null==a?void 0:a.refresh_token))throw new bi;let{data:d,error:e}=await this._callRefreshToken(a.refresh_token);return e?this._returnResult({data:{user:null,session:null},error:e}):d?this._returnResult({data:{user:d.user,session:d},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(a){if(be(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async _getSessionFromURL(a,b){var c;try{if(!bB())throw new bm("No browser detected.");if(a.error||a.error_description||a.error_code)throw new bm(a.error_description||"Error in URL with unspecified error_description",{error:a.error||"unspecified_error",code:a.error_code||"unspecified_code"});switch(b){case"implicit":if("pkce"===this.flowType)throw new bn("Not a valid PKCE flow url.");break;case"pkce":if("implicit"===this.flowType)throw new bm("Not a valid implicit grant flow url.")}if("pkce"===b){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!a.code)throw new bn("No code detected.");let{data:b,error:d}=await this._exchangeCodeForSession(a.code);if(d)throw d;let e=new URL(window.location.href);return e.searchParams.delete("code"),window.history.replaceState(window.history.state,"",e.toString()),{data:{session:b.session,redirectType:null!=(c=b.redirectType)?c:null},error:null}}let{provider_token:d,provider_refresh_token:e,access_token:f,refresh_token:g,expires_in:h,expires_at:i,token_type:j}=a;if(!f||!h||!g||!j)throw new bm("No session defined in URL");let k=Math.round(Date.now()/1e3),l=parseInt(h),m=k+l;i&&(m=parseInt(i));let n=m-k;1e3*n<=3e4&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${n}s, should have been closer to ${l}s`);let o=m-l;k-o>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",o,m,k):k-o<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",o,m,k);let{data:p,error:q}=await this._getUser(f);if(q)throw q;let r={provider_token:d,provider_refresh_token:e,access_token:f,expires_in:l,expires_at:m,refresh_token:g,token_type:j,user:p.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:r,redirectType:a.type},error:null})}catch(a){if(be(a))return this._returnResult({data:{session:null,redirectType:null},error:a});throw a}}_isImplicitGrantCallback(a){return"function"==typeof this.detectSessionInUrl?this.detectSessionInUrl(new URL(window.location.href),a):!!(a.access_token||a.error_description)}async _isPKCECallback(a){let b=await bG(this.storage,`${this.storageKey}-code-verifier`);return!!(a.code&&b)}async signOut(a={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(a))}async _signOut({scope:a}={scope:"global"}){return await this._useSession(async b=>{var c;let{data:d,error:e}=b;if(e&&!bj(e))return this._returnResult({error:e});let f=null==(c=d.session)?void 0:c.access_token;if(f){let{error:b}=await this.admin.signOut(f,a);if(b&&!(be(b)&&"AuthApiError"===b.name&&(404===b.status||401===b.status||403===b.status)||bj(b)))return this._returnResult({error:b})}return"others"!==a&&(await this._removeSession(),await bH(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(a){let b=Symbol("auth-callback"),c={id:b,callback:a,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",b),this.stateChangeEmitters.delete(b)}};return this._debug("#onAuthStateChange()","registered callback with id",b),this.stateChangeEmitters.set(b,c),(async()=>{await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(b)})})(),{data:{subscription:c}}}async _emitInitialSession(a){return await this._useSession(async b=>{var c,d;try{let{data:{session:d},error:e}=b;if(e)throw e;await (null==(c=this.stateChangeEmitters.get(a))?void 0:c.callback("INITIAL_SESSION",d)),this._debug("INITIAL_SESSION","callback id",a,"session",d)}catch(b){await (null==(d=this.stateChangeEmitters.get(a))?void 0:d.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",a,"error",b),bj(b)?console.warn(b):console.error(b)}})}async resetPasswordForEmail(a,b={}){let c=null,d=null;"pkce"===this.flowType&&([c,d]=await bO(this.storage,this.storageKey,!0));try{return await bY(this.fetch,"POST",`${this.url}/recover`,{body:{email:a,code_challenge:c,code_challenge_method:d,gotrue_meta_security:{captcha_token:b.captchaToken}},headers:this.headers,redirectTo:b.redirectTo})}catch(a){if(await bH(this.storage,`${this.storageKey}-code-verifier`),be(a))return this._returnResult({data:null,error:a});throw a}}async getUserIdentities(){var a;try{let{data:b,error:c}=await this.getUser();if(c)throw c;return this._returnResult({data:{identities:null!=(a=b.user.identities)?a:[]},error:null})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async linkIdentity(a){return"token"in a?this.linkIdentityIdToken(a):this.linkIdentityOAuth(a)}async linkIdentityOAuth(a){var b;try{let{data:c,error:d}=await this._useSession(async b=>{var c,d,e,f,g;let{data:h,error:i}=b;if(i)throw i;let j=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,a.provider,{redirectTo:null==(c=a.options)?void 0:c.redirectTo,scopes:null==(d=a.options)?void 0:d.scopes,queryParams:null==(e=a.options)?void 0:e.queryParams,skipBrowserRedirect:!0});return await bY(this.fetch,"GET",j,{headers:this.headers,jwt:null!=(g=null==(f=h.session)?void 0:f.access_token)?g:void 0})});if(d)throw d;return!bB()||(null==(b=a.options)?void 0:b.skipBrowserRedirect)||window.location.assign(null==c?void 0:c.url),this._returnResult({data:{provider:a.provider,url:null==c?void 0:c.url},error:null})}catch(b){if(be(b))return this._returnResult({data:{provider:a.provider,url:null},error:b});throw b}}async linkIdentityIdToken(a){return await this._useSession(async b=>{var c;try{let{error:d,data:{session:e}}=b;if(d)throw d;let{options:f,provider:g,token:h,access_token:i,nonce:j}=a,{data:k,error:l}=await bY(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:null!=(c=null==e?void 0:e.access_token)?c:void 0,body:{provider:g,id_token:h,access_token:i,nonce:j,link_identity:!0,gotrue_meta_security:{captcha_token:null==f?void 0:f.captchaToken}},xform:b$});if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!k||!k.session||!k.user)return this._returnResult({data:{user:null,session:null},error:new bk});return k.session&&(await this._saveSession(k.session),await this._notifyAllSubscribers("USER_UPDATED",k.session)),this._returnResult({data:k,error:l})}catch(a){if(await bH(this.storage,`${this.storageKey}-code-verifier`),be(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}})}async unlinkIdentity(a){try{return await this._useSession(async b=>{var c,d;let{data:e,error:f}=b;if(f)throw f;return await bY(this.fetch,"DELETE",`${this.url}/user/identities/${a.identity_id}`,{headers:this.headers,jwt:null!=(d=null==(c=e.session)?void 0:c.access_token)?d:void 0})})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _refreshAccessToken(a){let b=`#_refreshAccessToken(${a.substring(0,5)}...)`;this._debug(b,"begin");try{var c,d;let e=Date.now();return await (c=async c=>(c>0&&await bK(200*Math.pow(2,c-1)),this._debug(b,"refreshing attempt",c),await bY(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:a},headers:this.headers,xform:b$})),d=(a,b)=>{let c=200*Math.pow(2,a);return b&&bq(b)&&Date.now()+c-e<3e4},new Promise((a,b)=>{(async()=>{for(let e=0;e<1/0;e++)try{let b=await c(e);if(!d(e,null,b))return void a(b)}catch(a){if(!d(e,a))return void b(a)}})()}))}catch(a){if(this._debug(b,"error",a),be(a))return this._returnResult({data:{session:null,user:null},error:a});throw a}finally{this._debug(b,"end")}}_isValidSession(a){return"object"==typeof a&&null!==a&&"access_token"in a&&"refresh_token"in a&&"expires_at"in a}async _handleProviderSignIn(a,b){let c=await this._getUrlForProvider(`${this.url}/authorize`,a,{redirectTo:b.redirectTo,scopes:b.scopes,queryParams:b.queryParams});return this._debug("#_handleProviderSignIn()","provider",a,"options",b,"url",c),bB()&&!b.skipBrowserRedirect&&window.location.assign(c),{data:{provider:a,url:c},error:null}}async _recoverAndRefresh(){var a,b;let c="#_recoverAndRefresh()";this._debug(c,"begin");try{let d=await bG(this.storage,this.storageKey);if(d&&this.userStorage){let b=await bG(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!b&&(b={user:d.user},await bF(this.userStorage,this.storageKey+"-user",b)),d.user=null!=(a=null==b?void 0:b.user)?a:bT()}else if(d&&!d.user&&!d.user){let a=await bG(this.storage,this.storageKey+"-user");a&&(null==a?void 0:a.user)?(d.user=a.user,await bH(this.storage,this.storageKey+"-user"),await bF(this.storage,this.storageKey,d)):d.user=bT()}if(this._debug(c,"session from storage",d),!this._isValidSession(d)){this._debug(c,"session is not valid"),null!==d&&await this._removeSession();return}let e=(null!=(b=d.expires_at)?b:1/0)*1e3-Date.now()<9e4;if(this._debug(c,`session has${e?"":" not"} expired with margin of 90000s`),e){if(this.autoRefreshToken&&d.refresh_token){let{error:a}=await this._callRefreshToken(d.refresh_token);a&&(console.error(a),bq(a)||(this._debug(c,"refresh failed with a non-retryable error, removing the session",a),await this._removeSession()))}}else if(d.user&&!0===d.user.__isUserNotAvailableProxy)try{let{data:a,error:b}=await this._getUser(d.access_token);!b&&(null==a?void 0:a.user)?(d.user=a.user,await this._saveSession(d),await this._notifyAllSubscribers("SIGNED_IN",d)):this._debug(c,"could not get user data, skipping SIGNED_IN notification")}catch(a){console.error("Error getting user data:",a),this._debug(c,"error getting user data, skipping SIGNED_IN notification",a)}else await this._notifyAllSubscribers("SIGNED_IN",d)}catch(a){this._debug(c,"error",a),console.error(a);return}finally{this._debug(c,"end")}}async _callRefreshToken(a){var b,c;if(!a)throw new bi;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let d=`#_callRefreshToken(${a.substring(0,5)}...)`;this._debug(d,"begin");try{this.refreshingDeferred=new bI;let{data:b,error:c}=await this._refreshAccessToken(a);if(c)throw c;if(!b.session)throw new bi;await this._saveSession(b.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",b.session);let d={data:b.session,error:null};return this.refreshingDeferred.resolve(d),d}catch(a){if(this._debug(d,"error",a),be(a)){let c={data:null,error:a};return bq(a)||await this._removeSession(),null==(b=this.refreshingDeferred)||b.resolve(c),c}throw null==(c=this.refreshingDeferred)||c.reject(a),a}finally{this.refreshingDeferred=null,this._debug(d,"end")}}async _notifyAllSubscribers(a,b,c=!0){let d=`#_notifyAllSubscribers(${a})`;this._debug(d,"begin",b,`broadcast = ${c}`);try{this.broadcastChannel&&c&&this.broadcastChannel.postMessage({event:a,session:b});let d=[],e=Array.from(this.stateChangeEmitters.values()).map(async c=>{try{await c.callback(a,b)}catch(a){d.push(a)}});if(await Promise.all(e),d.length>0){for(let a=0;a<d.length;a+=1)console.error(d[a]);throw d[0]}}finally{this._debug(d,"end")}}async _saveSession(a){this._debug("#_saveSession()",a),this.suppressGetSessionWarning=!0,await bH(this.storage,`${this.storageKey}-code-verifier`);let b=Object.assign({},a),c=b.user&&!0===b.user.__isUserNotAvailableProxy;if(this.userStorage){!c&&b.user&&await bF(this.userStorage,this.storageKey+"-user",{user:b.user});let a=Object.assign({},b);delete a.user;let d=bU(a);await bF(this.storage,this.storageKey,d)}else{let a=bU(b);await bF(this.storage,this.storageKey,a)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await bH(this.storage,this.storageKey),await bH(this.storage,this.storageKey+"-code-verifier"),await bH(this.storage,this.storageKey+"-user"),this.userStorage&&await bH(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");let a=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{a&&bB()&&(null==window?void 0:window.removeEventListener)&&window.removeEventListener("visibilitychange",a)}catch(a){console.error("removing visibilitychange callback failed",a)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");let a=setInterval(()=>this._autoRefreshTokenTick(),3e4);this.autoRefreshTicker=a,a&&"object"==typeof a&&"function"==typeof a.unref?a.unref():"undefined"!=typeof Deno&&"function"==typeof Deno.unrefTimer&&Deno.unrefTimer(a);let b=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=b,b&&"object"==typeof b&&"function"==typeof b.unref?b.unref():"undefined"!=typeof Deno&&"function"==typeof Deno.unrefTimer&&Deno.unrefTimer(b)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");let a=this.autoRefreshTicker;this.autoRefreshTicker=null,a&&clearInterval(a);let b=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,b&&clearTimeout(b)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{let a=Date.now();try{return await this._useSession(async b=>{let{data:{session:c}}=b;if(!c||!c.refresh_token||!c.expires_at)return void this._debug("#_autoRefreshTokenTick()","no session");let d=Math.floor((1e3*c.expires_at-a)/3e4);this._debug("#_autoRefreshTokenTick()",`access token expires in ${d} ticks, a tick lasts 30000ms, refresh threshold is 3 ticks`),d<=3&&await this._callRefreshToken(c.refresh_token)})}catch(a){console.error("Auto refresh tick failed with error. This is likely a transient error.",a)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(a){if(a instanceof b8)this._debug("auto refresh token tick lock not available");else throw a}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!bB()||!(null==window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(a){this._debug("#visibilityChangedCallback","error",a)}},null==window||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(a){console.error("_handleVisibilityChange",a)}}async _onVisibilityChanged(a){let b=`#_onVisibilityChanged(${a})`;this._debug(b,"visibilityState",document.visibilityState),"visible"===document.visibilityState?(this.autoRefreshToken&&this._startAutoRefresh(),a||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if("visible"!==document.visibilityState)return void this._debug(b,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");await this._recoverAndRefresh()}))):"hidden"===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(a,b,c){let d=[`provider=${encodeURIComponent(b)}`];if((null==c?void 0:c.redirectTo)&&d.push(`redirect_to=${encodeURIComponent(c.redirectTo)}`),(null==c?void 0:c.scopes)&&d.push(`scopes=${encodeURIComponent(c.scopes)}`),"pkce"===this.flowType){let[a,b]=await bO(this.storage,this.storageKey),c=new URLSearchParams({code_challenge:`${encodeURIComponent(a)}`,code_challenge_method:`${encodeURIComponent(b)}`});d.push(c.toString())}if(null==c?void 0:c.queryParams){let a=new URLSearchParams(c.queryParams);d.push(a.toString())}return(null==c?void 0:c.skipBrowserRedirect)&&d.push(`skip_http_redirect=${c.skipBrowserRedirect}`),`${a}?${d.join("&")}`}async _unenroll(a){try{return await this._useSession(async b=>{var c;let{data:d,error:e}=b;return e?this._returnResult({data:null,error:e}):await bY(this.fetch,"DELETE",`${this.url}/factors/${a.factorId}`,{headers:this.headers,jwt:null==(c=null==d?void 0:d.session)?void 0:c.access_token})})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _enroll(a){try{return await this._useSession(async b=>{var c,d;let{data:e,error:f}=b;if(f)return this._returnResult({data:null,error:f});let g=Object.assign({friendly_name:a.friendlyName,factor_type:a.factorType},"phone"===a.factorType?{phone:a.phone}:"totp"===a.factorType?{issuer:a.issuer}:{}),{data:h,error:i}=await bY(this.fetch,"POST",`${this.url}/factors`,{body:g,headers:this.headers,jwt:null==(c=null==e?void 0:e.session)?void 0:c.access_token});return i?this._returnResult({data:null,error:i}):("totp"===a.factorType&&"totp"===h.type&&(null==(d=null==h?void 0:h.totp)?void 0:d.qr_code)&&(h.totp.qr_code=`data:image/svg+xml;utf-8,${h.totp.qr_code}`),this._returnResult({data:h,error:null}))})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _verify(a){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async b=>{var c;let{data:d,error:e}=b;if(e)return this._returnResult({data:null,error:e});let f=Object.assign({challenge_id:a.challengeId},"webauthn"in a?{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_response:"create"===a.webauthn.type?ci(a.webauthn.credential_response):cj(a.webauthn.credential_response)})}:{code:a.code}),{data:g,error:h}=await bY(this.fetch,"POST",`${this.url}/factors/${a.factorId}/verify`,{body:f,headers:this.headers,jwt:null==(c=null==d?void 0:d.session)?void 0:c.access_token});return h?this._returnResult({data:null,error:h}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+g.expires_in},g)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",g),this._returnResult({data:g,error:h}))})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}})}async _challenge(a){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async b=>{var c;let{data:d,error:e}=b;if(e)return this._returnResult({data:null,error:e});let f=await bY(this.fetch,"POST",`${this.url}/factors/${a.factorId}/challenge`,{body:a,headers:this.headers,jwt:null==(c=null==d?void 0:d.session)?void 0:c.access_token});if(f.error)return f;let{data:g}=f;if("webauthn"!==g.type)return{data:g,error:null};switch(g.webauthn.type){case"create":return{data:Object.assign(Object.assign({},g),{webauthn:Object.assign(Object.assign({},g.webauthn),{credential_options:Object.assign(Object.assign({},g.webauthn.credential_options),{publicKey:cg(g.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},g),{webauthn:Object.assign(Object.assign({},g.webauthn),{credential_options:Object.assign(Object.assign({},g.webauthn.credential_options),{publicKey:ch(g.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}})}async _challengeAndVerify(a){let{data:b,error:c}=await this._challenge({factorId:a.factorId});return c?this._returnResult({data:null,error:c}):await this._verify({factorId:a.factorId,challengeId:b.id,code:a.code})}async _listFactors(){var a;let{data:{user:b},error:c}=await this.getUser();if(c)return{data:null,error:c};let d={all:[],phone:[],totp:[],webauthn:[]};for(let c of null!=(a=null==b?void 0:b.factors)?a:[])d.all.push(c),"verified"===c.status&&d[c.factor_type].push(c);return{data:d,error:null}}async _getAuthenticatorAssuranceLevel(a){var b,c,d,e;if(a)try{let{payload:d}=bJ(a),e=null;d.aal&&(e=d.aal);let f=e,{data:{user:g},error:h}=await this.getUser(a);if(h)return this._returnResult({data:null,error:h});(null!=(c=null==(b=null==g?void 0:g.factors)?void 0:b.filter(a=>"verified"===a.status))?c:[]).length>0&&(f="aal2");let i=d.amr||[];return{data:{currentLevel:e,nextLevel:f,currentAuthenticationMethods:i},error:null}}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}let{data:{session:f},error:g}=await this.getSession();if(g)return this._returnResult({data:null,error:g});if(!f)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let{payload:h}=bJ(f.access_token),i=null;h.aal&&(i=h.aal);let j=i;return(null!=(e=null==(d=f.user.factors)?void 0:d.filter(a=>"verified"===a.status))?e:[]).length>0&&(j="aal2"),{data:{currentLevel:i,nextLevel:j,currentAuthenticationMethods:h.amr||[]},error:null}}async _getAuthorizationDetails(a){try{return await this._useSession(async b=>{let{data:{session:c},error:d}=b;return d?this._returnResult({data:null,error:d}):c?await bY(this.fetch,"GET",`${this.url}/oauth/authorizations/${a}`,{headers:this.headers,jwt:c.access_token,xform:a=>({data:a,error:null})}):this._returnResult({data:null,error:new bi})})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _approveAuthorization(a,b){try{return await this._useSession(async c=>{let{data:{session:d},error:e}=c;if(e)return this._returnResult({data:null,error:e});if(!d)return this._returnResult({data:null,error:new bi});let f=await bY(this.fetch,"POST",`${this.url}/oauth/authorizations/${a}/consent`,{headers:this.headers,jwt:d.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return f.data&&f.data.redirect_url&&bB()&&!(null==b?void 0:b.skipBrowserRedirect)&&window.location.assign(f.data.redirect_url),f})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _denyAuthorization(a,b){try{return await this._useSession(async c=>{let{data:{session:d},error:e}=c;if(e)return this._returnResult({data:null,error:e});if(!d)return this._returnResult({data:null,error:new bi});let f=await bY(this.fetch,"POST",`${this.url}/oauth/authorizations/${a}/consent`,{headers:this.headers,jwt:d.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return f.data&&f.data.redirect_url&&bB()&&!(null==b?void 0:b.skipBrowserRedirect)&&window.location.assign(f.data.redirect_url),f})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _listOAuthGrants(){try{return await this._useSession(async a=>{let{data:{session:b},error:c}=a;return c?this._returnResult({data:null,error:c}):b?await bY(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:b.access_token,xform:a=>({data:a,error:null})}):this._returnResult({data:null,error:new bi})})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _revokeOAuthGrant(a){try{return await this._useSession(async b=>{let{data:{session:c},error:d}=b;return d?this._returnResult({data:null,error:d}):c?(await bY(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:c.access_token,query:{client_id:a.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new bi})})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async fetchJwk(a,b={keys:[]}){let c=b.keys.find(b=>b.kid===a);if(c)return c;let d=Date.now();if((c=this.jwks.keys.find(b=>b.kid===a))&&this.jwks_cached_at+6e5>d)return c;let{data:e,error:f}=await bY(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(f)throw f;return e.keys&&0!==e.keys.length&&(this.jwks=e,this.jwks_cached_at=d,c=e.keys.find(b=>b.kid===a))?c:null}async getClaims(a,b={}){try{let c=a;if(!c){let{data:a,error:b}=await this.getSession();if(b||!a.session)return this._returnResult({data:null,error:b});c=a.session.access_token}let{header:d,payload:e,signature:f,raw:{header:g,payload:h}}=bJ(c);(null==b?void 0:b.allowExpired)||function(a){if(!a)throw Error("Missing exp claim");if(a<=Math.floor(Date.now()/1e3))throw Error("JWT has expired")}(e.exp);let i=!d.alg||d.alg.startsWith("HS")||!d.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(d.kid,(null==b?void 0:b.keys)?{keys:b.keys}:null==b?void 0:b.jwks);if(!i){let{error:a}=await this.getUser(c);if(a)throw a;return{data:{claims:e,header:d,signature:f},error:null}}let j=function(a){switch(a){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw Error("Invalid alg claim")}}(d.alg),k=await crypto.subtle.importKey("jwk",i,j,!0,["verify"]);if(!await crypto.subtle.verify(j,k,f,function(a){let b=[];return!function(a,b){for(let c=0;c<a.length;c+=1){let d=a.charCodeAt(c);if(d>55295&&d<=56319){let b=(d-55296)*1024&65535;d=(a.charCodeAt(c+1)-56320&65535|b)+65536,c+=1}!function(a,b){if(a<=127)return b(a);if(a<=2047){b(192|a>>6),b(128|63&a);return}if(a<=65535){b(224|a>>12),b(128|a>>6&63),b(128|63&a);return}if(a<=1114111){b(240|a>>18),b(128|a>>12&63),b(128|a>>6&63),b(128|63&a);return}throw Error(`Unrecognized Unicode codepoint: ${a.toString(16)}`)}(d,b)}}(a,a=>b.push(a)),new Uint8Array(b)}(`${g}.${h}`)))throw new bs("Invalid JWT signature");return{data:{claims:e,header:d,signature:f},error:null}}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async signInWithPasskey(a){var b,c,d;bS(this.experimental);try{if(!cl())return this._returnResult({data:null,error:new bg("Browser does not support WebAuthn",null)});let{data:e,error:f}=await this._startPasskeyAuthentication({options:{captchaToken:null==(b=null==a?void 0:a.options)?void 0:b.captchaToken}});if(f||!e)return this._returnResult({data:null,error:f});let g=ch(e.options),h=null!=(d=null==(c=null==a?void 0:a.options)?void 0:c.signal)?d:cf.createNewAbortSignal(),{data:i,error:j}=await cn({publicKey:g,signal:h});if(j||!i)return this._returnResult({data:null,error:null!=j?j:new bg("WebAuthn ceremony failed",null)});let k=cj(i);return this._verifyPasskeyAuthentication({challengeId:e.challenge_id,credential:k})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async registerPasskey(a){var b,c;bS(this.experimental);try{if(!cl())return this._returnResult({data:null,error:new bg("Browser does not support WebAuthn",null)});let{data:d,error:e}=await this._startPasskeyRegistration();if(e||!d)return this._returnResult({data:null,error:e});let f=cg(d.options),g=null!=(c=null==(b=null==a?void 0:a.options)?void 0:b.signal)?c:cf.createNewAbortSignal(),{data:h,error:i}=await cm({publicKey:f,signal:g});if(i||!h)return this._returnResult({data:null,error:null!=i?i:new bg("WebAuthn ceremony failed",null)});let j=ci(h);return this._verifyPasskeyRegistration({challengeId:d.challenge_id,credential:j})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _startPasskeyRegistration(){bS(this.experimental);try{return await this._useSession(async a=>{let{data:{session:b},error:c}=a;if(c)return this._returnResult({data:null,error:c});if(!b)return this._returnResult({data:null,error:new bi});let{data:d,error:e}=await bY(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:b.access_token,body:{}});return e?this._returnResult({data:null,error:e}):this._returnResult({data:d,error:null})})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _verifyPasskeyRegistration(a){bS(this.experimental);try{return await this._useSession(async b=>{let{data:{session:c},error:d}=b;if(d)return this._returnResult({data:null,error:d});if(!c)return this._returnResult({data:null,error:new bi});let{data:e,error:f}=await bY(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:c.access_token,body:{challenge_id:a.challengeId,credential:a.credential}});return f?this._returnResult({data:null,error:f}):this._returnResult({data:e,error:null})})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _startPasskeyAuthentication(a){var b;bS(this.experimental);try{let{data:c,error:d}=await bY(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:null==(b=null==a?void 0:a.options)?void 0:b.captchaToken}}});if(d)return this._returnResult({data:null,error:d});return this._returnResult({data:c,error:null})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _verifyPasskeyAuthentication(a){bS(this.experimental);try{let{data:b,error:c}=await bY(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:a.challengeId,credential:a.credential},xform:b$});if(c)return this._returnResult({data:null,error:c});return b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("SIGNED_IN",b.session)),this._returnResult({data:b,error:null})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _listPasskeys(){bS(this.experimental);try{return await this._useSession(async a=>{let{data:{session:b},error:c}=a;if(c)return this._returnResult({data:null,error:c});if(!b)return this._returnResult({data:null,error:new bi});let{data:d,error:e}=await bY(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:b.access_token,xform:a=>({data:a,error:null})});return e?this._returnResult({data:null,error:e}):this._returnResult({data:d,error:null})})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _updatePasskey(a){bS(this.experimental);try{return await this._useSession(async b=>{let{data:{session:c},error:d}=b;if(d)return this._returnResult({data:null,error:d});if(!c)return this._returnResult({data:null,error:new bi});let{data:e,error:f}=await bY(this.fetch,"PATCH",`${this.url}/passkeys/${a.passkeyId}`,{headers:this.headers,jwt:c.access_token,body:{friendly_name:a.friendlyName}});return f?this._returnResult({data:null,error:f}):this._returnResult({data:e,error:null})})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}async _deletePasskey(a){bS(this.experimental);try{return await this._useSession(async b=>{let{data:{session:c},error:d}=b;if(d)return this._returnResult({data:null,error:d});if(!c)return this._returnResult({data:null,error:new bi});let{error:e}=await bY(this.fetch,"DELETE",`${this.url}/passkeys/${a.passkeyId}`,{headers:this.headers,jwt:c.access_token,noResolveJson:!0});return e?this._returnResult({data:null,error:e}):this._returnResult({data:null,error:null})})}catch(a){if(be(a))return this._returnResult({data:null,error:a});throw a}}}cv.nextInstanceID={};let cw=cv,cx="";cx="undefined"!=typeof Deno?"deno":"undefined"!=typeof document?"web":"undefined"!=typeof navigator&&"ReactNative"===navigator.product?"react-native":"node";let cy={headers:{"X-Client-Info":`supabase-js-${cx}/2.105.4`}},cz={schema:"public"},cA={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},cB={};function cC(a){return(cC="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function cD(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function cE(a){for(var b=1;b<arguments.length;b++){var c=null!=arguments[b]?arguments[b]:{};b%2?cD(Object(c),!0).forEach(function(b){!function(a,b,c){var d;(d=function(a,b){if("object"!=cC(a)||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=cC(d))return d;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}(b,"string"),(b="symbol"==cC(d)?d:d+"")in a)?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c}(a,b,c[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(c)):cD(Object(c)).forEach(function(b){Object.defineProperty(a,b,Object.getOwnPropertyDescriptor(c,b))})}return a}var cF=class extends cw{constructor(a){super(a)}},cG=class{constructor(a,b,c){var d,e,f;this.supabaseUrl=a,this.supabaseKey=b;let g=function(a){let b=null==a?void 0:a.trim();if(!b)throw Error("supabaseUrl is required.");if(!b.match(/^https?:\/\//i))throw Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(b.endsWith("/")?b:b+"/")}catch(a){throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}(a);if(!b)throw Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",g),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",g),this.storageUrl=new URL("storage/v1",g),this.functionsUrl=new URL("functions/v1",g);let h=`sb-${g.hostname.split(".")[0]}-auth-token`,i=function(a,b){var c,d;let{db:e,auth:f,realtime:g,global:h}=a,{db:i,auth:j,realtime:k,global:l}=b,m={db:cE(cE({},i),e),auth:cE(cE({},j),f),realtime:cE(cE({},k),g),storage:{},global:cE(cE(cE({},l),h),{},{headers:cE(cE({},null!=(c=null==l?void 0:l.headers)?c:{}),null!=(d=null==h?void 0:h.headers)?d:{})}),accessToken:async()=>""};return a.accessToken?m.accessToken=a.accessToken:delete m.accessToken,m}(null!=c?c:{},{db:cz,realtime:cB,auth:cE(cE({},cA),{},{storageKey:h}),global:cy});this.storageKey=null!=(d=i.auth.storageKey)?d:"",this.headers=null!=(e=i.global.headers)?e:{},i.accessToken?(this.accessToken=i.accessToken,this.auth=new Proxy({},{get:(a,b)=>{throw Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(b)} is not possible`)}})):this.auth=this._initSupabaseAuthClient(null!=(f=i.auth)?f:{},this.headers,i.global.fetch),this.fetch=((a,b,c)=>{let d=(a=>a?(...b)=>a(...b):(...a)=>fetch(...a))(c),e=Headers;return async(c,f)=>{var g;let h=null!=(g=await b())?g:a,i=new e(null==f?void 0:f.headers);return i.has("apikey")||i.set("apikey",a),i.has("Authorization")||i.set("Authorization",`Bearer ${h}`),d(c,cE(cE({},f),{},{headers:i}))}})(b,this._getAccessToken.bind(this),i.global.fetch),this.realtime=this._initRealtimeClient(cE({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},i.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(a=>this.realtime.setAuth(a)).catch(a=>console.warn("Failed to set initial Realtime auth token:",a)),this.rest=new D(new URL("rest/v1",g).href,{headers:this.headers,schema:i.db.schema,fetch:this.fetch,timeout:i.db.timeout,urlLengthLimit:i.db.urlLengthLimit}),this.storage=new a7(this.storageUrl.href,this.headers,this.fetch,null==c?void 0:c.storage),i.accessToken||this._listenForAuthEvents()}get functions(){return new j(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(a){return this.rest.from(a)}schema(a){return this.rest.schema(a)}rpc(a,b={},c={head:!1,get:!1,count:void 0}){return this.rest.rpc(a,b,c)}channel(a,b={config:{}}){return this.realtime.channel(a,b)}getChannels(){return this.realtime.getChannels()}removeChannel(a){return this.realtime.removeChannel(a)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var a,b;if(this.accessToken)return await this.accessToken();let{data:c}=await this.auth.getSession();return null!=(a=null==(b=c.session)?void 0:b.access_token)?a:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:a,persistSession:b,detectSessionInUrl:c,storage:d,userStorage:e,storageKey:f,flowType:g,lock:h,debug:i,throwOnError:j,experimental:k,lockAcquireTimeout:l,skipAutoInitialize:m},n,o){let p={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new cF({url:this.authUrl.href,headers:cE(cE({},p),n),storageKey:f,autoRefreshToken:a,persistSession:b,detectSessionInUrl:c,storage:d,userStorage:e,flowType:g,lock:h,debug:i,throwOnError:j,experimental:k,fetch:o,lockAcquireTimeout:l,skipAutoInitialize:m,hasCustomAuthorizationHeader:Object.keys(this.headers).some(a=>"authorization"===a.toLowerCase())})}_initRealtimeClient(a){return new at(this.realtimeUrl.href,cE(cE({},a),{},{params:cE(cE({},{apikey:this.supabaseKey}),null==a?void 0:a.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((a,b)=>{this._handleTokenChanged(a,"CLIENT",null==b?void 0:b.access_token)})}_handleTokenChanged(a,b,c){("TOKEN_REFRESHED"===a||"SIGNED_IN"===a)&&this.changedAccessToken!==c?(this.changedAccessToken=c,this.realtime.setAuth(c)):"SIGNED_OUT"===a&&(this.realtime.setAuth(),"STORAGE"==b&&this.auth.signOut(),this.changedAccessToken=void 0)}};let cH=(a,b,c)=>new cG(a,b,c);(function(){if("undefined"!=typeof window)return!1;let a=globalThis.process;if(!a)return!1;let b=a.version;if(null==b)return!1;let c=b.match(/^v(\d+)\./);return!!c&&18>=parseInt(c[1],10)})()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217")},69311:()=>{},70541:(a,b,c)=>{"use strict";c.d(b,{U:()=>d});let d={path:"/",sameSite:"lax",httpOnly:!1,maxAge:3456e4}},81658:(a,b,c)=>{"use strict";c.r(b),c.d(b,{DEFAULT_COOKIE_OPTIONS:()=>h.Up,MAX_CHUNK_SIZE:()=>h.xM,codepointToUTF8:()=>h.I1,combineChunks:()=>h.c$,createBrowserClient:()=>d.k,createChunks:()=>h.L6,createServerClient:()=>e.R,deleteChunks:()=>h.m,isBrowser:()=>h.Bd,isChunkLike:()=>h.HV,memoryLocalStorageAdapter:()=>h.rL,parse:()=>h.qg,parseCookieHeader:()=>h.vU,serialize:()=>h.lK,serializeCookieHeader:()=>h.Gb,stringFromBase64URL:()=>h.uE,stringFromUTF8:()=>h.j_,stringToBase64URL:()=>h.Pw,stringToUTF8:()=>h.Op,warnIfUsingDeprecatedAuthHelpersPackage:()=>i.Q});var d=c(97833),e=c(47384),f=c(69311),g={};for(let a in f)0>["default","warnIfUsingDeprecatedAuthHelpersPackage","createBrowserClient","createServerClient"].indexOf(a)&&(g[a]=()=>f[a]);c.d(b,g);var h=c(43096),i=c(39113)},94134:(a,b)=>{"use strict";b.qg=function(a,b){let c=new h,d=a.length;if(d<2)return c;let e=b?.decode||k,f=0;do{let b=function(a,b,c){let d=a.indexOf("=",b);return d<c?d:-1}(a,f,d);if(-1===b)break;let g=function(a,b,c){let d=a.indexOf(";",b);return -1===d?c:d}(a,f,d);if(b>g){f=a.lastIndexOf(";",b-1)+1;continue}let h=j(a,f,b);void 0===c[h]&&(c[h]=e(j(a,b+1,g))),f=g+1}while(f<d);return c},b.lK=i,b.lK=i;let c=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,d=/^[\u0021-\u003A\u003C-\u007E]*$/,e=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,f=/^[\u0020-\u003A\u003D-\u007E]*$/,g=Object.prototype.toString,h=(()=>{let a=function(){};return a.prototype=Object.create(null),a})();function i(a,b,h){let i="object"==typeof a?a:{...h,name:a,value:String(b)},j=("object"==typeof b?b:h)?.encode||encodeURIComponent;if(!c.test(i.name))throw TypeError(`argument name is invalid: ${i.name}`);let k=i.value?j(i.value):"";if(!d.test(k))throw TypeError(`argument val is invalid: ${i.value}`);let l=i.name+"="+k;if(void 0!==i.maxAge){if(!Number.isInteger(i.maxAge))throw TypeError(`option maxAge is invalid: ${i.maxAge}`);l+="; Max-Age="+i.maxAge}if(i.domain){if(!e.test(i.domain))throw TypeError(`option domain is invalid: ${i.domain}`);l+="; Domain="+i.domain}if(i.path){if(!f.test(i.path))throw TypeError(`option path is invalid: ${i.path}`);l+="; Path="+i.path}if(i.expires){var m;if(m=i.expires,"[object Date]"!==g.call(m)||!Number.isFinite(i.expires.valueOf()))throw TypeError(`option expires is invalid: ${i.expires}`);l+="; Expires="+i.expires.toUTCString()}if(i.httpOnly&&(l+="; HttpOnly"),i.secure&&(l+="; Secure"),i.partitioned&&(l+="; Partitioned"),i.priority)switch("string"==typeof i.priority?i.priority.toLowerCase():void 0){case"low":l+="; Priority=Low";break;case"medium":l+="; Priority=Medium";break;case"high":l+="; Priority=High";break;default:throw TypeError(`option priority is invalid: ${i.priority}`)}if(i.sameSite)switch("string"==typeof i.sameSite?i.sameSite.toLowerCase():i.sameSite){case!0:case"strict":l+="; SameSite=Strict";break;case"lax":l+="; SameSite=Lax";break;case"none":l+="; SameSite=None";break;default:throw TypeError(`option sameSite is invalid: ${i.sameSite}`)}return l}function j(a,b,c){let d=b,e=c;do{let b=a.charCodeAt(d);if(32!==b&&9!==b)break}while(++d<e);for(;e>d;){let b=a.charCodeAt(e-1);if(32!==b&&9!==b)break;e--}return a.slice(d,e)}function k(a){if(-1===a.indexOf("%"))return a;try{return decodeURIComponent(a)}catch(b){return a}}},97833:(a,b,c)=>{"use strict";let d;c.d(b,{k:()=>j});var e=c(66167),f=c(24910),g=c(17461),h=c(36497),i=c(39113);function j(a,b,c){(0,i.Q)();let j=c?.isSingleton===!0||(!c||!("isSingleton"in c))&&(0,g.Bd)();if(j&&d)return d;if(!a||!b)throw Error(`@supabase/ssr: Your project's URL and API key are required to create a Supabase client!
|
|
60
60
|
|
|
61
61
|
Check your Supabase project's API settings to find these values
|
|
62
62
|
|