{"version":3,"sources":["../../src/types/auth.ts"],"names":[],"mappings":"AAkFO,SAAS,UAAU,OAAA,EAAuC;AAC/D,EAAA,IAAI,CAAC,SAAS,OAAO,IAAA;AACrB,EAAA,OAAO,OAAA,CAAQ,SAAA,CAAU,WAAA,KAAgB,OAAA,CAAQ,SAAS,WAAA,IAAe,IAAA,CAAA;AAC3E","file":"auth.mjs","sourcesContent":["export interface AuthUser {\n  id: string;\n  email: string;\n  role: string | null;\n}\n\nexport type AuthMode =\n  | 'signin'\n  | 'signup'\n  | 'forgot'\n  | 'reset'\n  | 'verify'\n  | 'verify-sent';\n\nexport type AuthErrorCode =\n  | 'wrong_credentials'\n  | 'email_exists'\n  | 'invalid_email'\n  | 'weak_password'\n  | 'invalid_token'\n  | 'registration_disabled'\n  | 'signup_disabled'\n  | 'network'\n  | 'unknown';\n\nexport interface AuthError {\n  code: AuthErrorCode;\n  message: string;\n}\n\nexport interface SignInResult {\n  user: AuthUser;\n}\n\nexport interface SignUpResult {\n  user: AuthUser;\n  emailVerificationRequired: boolean;\n}\n\nexport interface ResetPasswordResult {\n  user: AuthUser | null;\n}\n\nexport interface VerifyEmailResult {\n  user: AuthUser | null;\n}\n\nexport interface SessionResult {\n  user: AuthUser | null;\n}\n\nexport interface LoginMethods {\n  /** @deprecated Use `workspace.hasPassword`. Kept for older AuthDialog versions and older CE backends that returned only the flat shape. */\n  hasPassword: boolean;\n  /** @deprecated Use `workspace.hasGoogle`. Kept for older AuthDialog versions and older CE backends that returned only the flat shape. */\n  hasGoogle: boolean;\n  /**\n   * Workspace-level auth capabilities. Always present on responses from CE\n   * backends >= the namespaced rollout. Falls back to defaults derived from\n   * top-level fields when the response predates that change.\n   */\n  workspace: {\n    hasPassword: boolean;\n    hasGoogle: boolean;\n    /** Workspace's master public-signup gate (admin kill switch). */\n    allowSignup: boolean;\n  };\n  /**\n   * Per-project signup gate. Present only when the workspace has\n   * REQUIRE_PROJECT_MEMBERSHIP enabled AND the request hostname maps to a\n   * project. Absent on the admin domain or when the master switch is off.\n   */\n  project?: {\n    allowSignup: boolean;\n  };\n}\n\n/**\n * Effective signup permission for the current site. AuthDialog hides the\n * Sign up tab when this is false. Computed as\n * `workspace.allowSignup && (project?.allowSignup ?? true)`.\n */\nexport function canSignup(methods: LoginMethods | null): boolean {\n  if (!methods) return true; // Default-allow while loading; mirrors prior behavior.\n  return methods.workspace.allowSignup && (methods.project?.allowSignup ?? true);\n}\n"]}