#
tokens: 82855/50000 1/3460 files (page 3445/3460)
lines: off (toggle) GitHub
raw markdown copy
This is page 3445 of 3460. Use http://codebase.md/clerk/javascript?lines=false&page={x} to view the full context.

# Directory Structure

```
├── .changeset
│   ├── bright-papayas-accept.md
│   ├── changelog.js
│   ├── config.json
│   ├── moody-parks-scream.md
│   ├── README.md
│   ├── ripe-ants-carry.md
│   ├── ripe-banks-pay.md
│   └── shaggy-numbers-attack.md
├── .coderabbit.yaml
├── .cursor
│   └── rules
│       ├── clerk-js-ui.mdc
│       ├── development.mdc
│       ├── global.mdc
│       ├── monorepo.mdc
│       ├── nextjs.mdc
│       ├── react.mdc
│       └── typescript.mdc
├── .dockerignore
├── .editorconfig
├── .github
│   ├── .cache-version
│   ├── actions
│   │   ├── ensure-stable-pr
│   │   │   └── action.yml
│   │   ├── init
│   │   │   └── action.yml
│   │   ├── init-blacksmith
│   │   │   └── action.yml
│   │   ├── verdaccio
│   │   │   └── action.yml
│   │   └── version-prepatch
│   │       └── action.yml
│   ├── ISSUE_TEMPLATE
│   │   ├── BUG_REPORT.yml
│   │   └── config.yml
│   ├── labeler.yml
│   ├── PULL_REQUEST_TEMPLATE.md
│   └── workflows
│       ├── ci.yml
│       ├── e2e-cleanups.yml
│       ├── labeler.yml
│       ├── lock-threads.yml
│       ├── major-version-check.yml
│       ├── nightly-checks.yml
│       ├── pr-title-linter.yml
│       ├── preview.retheme.yml
│       ├── preview.yml
│       ├── release-canary.yml
│       ├── release-snapshot.yml
│       ├── release.yml
│       └── validate-renovate-config.yml
├── .gitignore
├── .husky
│   └── pre-commit
├── .jit
│   └── config.yml
├── .lintstagedrc.json
├── .npmrc
├── .nvmrc
├── .prettierignore
├── .typedoc
│   ├── __tests__
│   │   ├── __snapshots__
│   │   │   └── file-structure.test.ts.snap
│   │   └── file-structure.test.ts
│   ├── custom-plugin.mjs
│   ├── custom-router.mjs
│   ├── custom-theme.mjs
│   ├── README.md
│   ├── tsconfig.json
│   └── typedoc-prettier-config.json
├── .vscode
│   ├── extensions.json
│   ├── launch.json
│   ├── settings.json
│   └── tasks.json
├── commitlint.config.ts
├── docs
│   ├── CICD.md
│   ├── CODE_OF_CONDUCT.md
│   ├── CONTRIBUTING.md
│   ├── PUBLISH.md
│   └── SECURITY.md
├── eslint.config.mjs
├── integration
│   ├── .env.local.sample
│   ├── .keys.json.sample
│   ├── certs
│   │   └── README.md
│   ├── cleanup
│   │   └── cleanup.setup.ts
│   ├── constants.ts
│   ├── deployments
│   │   └── vercel.test.ts
│   ├── models
│   │   ├── application.ts
│   │   ├── applicationConfig.ts
│   │   ├── deployment.ts
│   │   ├── environment.ts
│   │   ├── helpers.ts
│   │   ├── longRunningApplication.ts
│   │   └── stateFile.ts
│   ├── playwright.cleanup.config.ts
│   ├── playwright.config.ts
│   ├── playwright.deployments.config.ts
│   ├── presets
│   │   ├── astro.ts
│   │   ├── custom-flows.ts
│   │   ├── elements.ts
│   │   ├── envs.ts
│   │   ├── expo.ts
│   │   ├── express.ts
│   │   ├── index.ts
│   │   ├── longRunningApps.ts
│   │   ├── next.ts
│   │   ├── nuxt.ts
│   │   ├── react-router.ts
│   │   ├── react.ts
│   │   ├── tanstack.ts
│   │   ├── utils.ts
│   │   └── vue.ts
│   ├── README.md
│   ├── scripts
│   │   ├── awaitableTreekill.ts
│   │   ├── clerkJsServer.ts
│   │   ├── index.ts
│   │   ├── logger.ts
│   │   ├── proxyServer.ts
│   │   ├── range.ts
│   │   ├── run.ts
│   │   ├── setup.ts
│   │   ├── waitForIdleProcess.ts
│   │   └── waitForServer.ts
│   ├── templates
│   │   ├── astro-hybrid
│   │   │   ├── .gitignore
│   │   │   ├── astro.config.mjs
│   │   │   ├── package.json
│   │   │   ├── public
│   │   │   │   └── favicon.svg
│   │   │   ├── src
│   │   │   │   ├── layouts
│   │   │   │   │   └── Layout.astro
│   │   │   │   ├── middleware.ts
│   │   │   │   └── pages
│   │   │   │       ├── index.astro
│   │   │   │       ├── only-admins.astro
│   │   │   │       ├── only-members.astro
│   │   │   │       └── ssr.astro
│   │   │   └── tsconfig.json
│   │   ├── astro-node
│   │   │   ├── .gitignore
│   │   │   ├── astro.config.mjs
│   │   │   ├── package.json
│   │   │   ├── public
│   │   │   │   └── favicon.svg
│   │   │   ├── README.md
│   │   │   ├── src
│   │   │   │   ├── components
│   │   │   │   │   ├── Card.astro
│   │   │   │   │   ├── CustomUserButton.astro
│   │   │   │   │   ├── LanguagePicker.tsx
│   │   │   │   │   ├── page-with-user.tsx
│   │   │   │   │   ├── SignOutReact.tsx
│   │   │   │   │   └── StreamUser.astro
│   │   │   │   ├── env.d.ts
│   │   │   │   ├── layouts
│   │   │   │   │   ├── Layout.astro
│   │   │   │   │   ├── react
│   │   │   │   │   │   └── Layout.astro
│   │   │   │   │   ├── Streaming.astro
│   │   │   │   │   └── ViewTransitionsLayout.astro
│   │   │   │   ├── middleware.ts
│   │   │   │   └── pages
│   │   │   │       ├── api
│   │   │   │       │   ├── auth
│   │   │   │       │   │   └── me.ts
│   │   │   │       │   └── protected
│   │   │   │       │       ├── current-org.ts
│   │   │   │       │       └── only-admin.ts
│   │   │   │       ├── billing
│   │   │   │       │   ├── checkout-btn.astro
│   │   │   │       │   ├── plan-details-btn.astro
│   │   │   │       │   └── subscription-details-btn.astro
│   │   │   │       ├── buttons.astro
│   │   │   │       ├── custom-pages
│   │   │   │       │   ├── organization-profile.astro
│   │   │   │       │   └── user-profile.astro
│   │   │   │       ├── discover.astro
│   │   │   │       ├── index.astro
│   │   │   │       ├── only-admins.astro
│   │   │   │       ├── only-members.astro
│   │   │   │       ├── organization.astro
│   │   │   │       ├── pricing-table.astro
│   │   │   │       ├── react
│   │   │   │       │   ├── index.astro
│   │   │   │       │   ├── only-admins.astro
│   │   │   │       │   ├── only-members.astro
│   │   │   │       │   ├── sign-in.astro
│   │   │   │       │   └── user.astro
│   │   │   │       ├── server-islands.astro
│   │   │   │       ├── sign-in.astro
│   │   │   │       ├── transitions
│   │   │   │       │   ├── index.astro
│   │   │   │       │   └── sign-in.astro
│   │   │   │       ├── user.astro
│   │   │   │       └── utility.astro
│   │   │   ├── tailwind.config.cjs
│   │   │   └── tsconfig.json
│   │   ├── custom-flows-react-vite
│   │   │   ├── .gitignore
│   │   │   ├── components.json
│   │   │   ├── eslint.config.js
│   │   │   ├── index.html
│   │   │   ├── package.json
│   │   │   ├── src
│   │   │   │   ├── components
│   │   │   │   │   └── ui
│   │   │   │   │       ├── button.tsx
│   │   │   │   │       ├── card.tsx
│   │   │   │   │       ├── input.tsx
│   │   │   │   │       └── label.tsx
│   │   │   │   ├── index.css
│   │   │   │   ├── lib
│   │   │   │   │   └── utils.ts
│   │   │   │   ├── main.tsx
│   │   │   │   ├── routes
│   │   │   │   │   ├── Home.tsx
│   │   │   │   │   ├── Protected.tsx
│   │   │   │   │   ├── SignIn.tsx
│   │   │   │   │   └── SignUp.tsx
│   │   │   │   └── vite-env.d.ts
│   │   │   ├── tsconfig.app.json
│   │   │   ├── tsconfig.json
│   │   │   ├── tsconfig.node.json
│   │   │   └── vite.config.ts
│   │   ├── elements-next
│   │   │   ├── .gitignore
│   │   │   ├── next.config.js
│   │   │   ├── package.json
│   │   │   ├── postcss.config.js
│   │   │   ├── README.md
│   │   │   ├── src
│   │   │   │   ├── app
│   │   │   │   │   ├── favicon.ico
│   │   │   │   │   ├── globals.css
│   │   │   │   │   ├── layout.tsx
│   │   │   │   │   ├── otp
│   │   │   │   │   │   └── page.tsx
│   │   │   │   │   ├── page.tsx
│   │   │   │   │   ├── sign-in
│   │   │   │   │   │   └── [[...sign-in]]
│   │   │   │   │   │       └── page.tsx
│   │   │   │   │   ├── sign-up
│   │   │   │   │   │   └── [[...sign-up]]
│   │   │   │   │   │       └── page.tsx
│   │   │   │   │   └── validate-password
│   │   │   │   │       └── page.tsx
│   │   │   │   └── middleware.ts
│   │   │   ├── tailwind.config.js
│   │   │   └── tsconfig.json
│   │   ├── expo-web
│   │   │   ├── .gitignore
│   │   │   ├── app
│   │   │   │   ├── _layout.tsx
│   │   │   │   ├── +html.tsx
│   │   │   │   ├── +not-found.tsx
│   │   │   │   ├── custom-sign-in.tsx
│   │   │   │   ├── custom-sign-up.tsx
│   │   │   │   ├── index.tsx
│   │   │   │   └── sign-in.tsx
│   │   │   ├── app.json
│   │   │   ├── assets
│   │   │   │   └── images
│   │   │   │       ├── icon.png
│   │   │   │       └── splash.png
│   │   │   ├── babel.config.js
│   │   │   ├── constants
│   │   │   │   └── Colors.ts
│   │   │   ├── metro.config.js
│   │   │   ├── package.json
│   │   │   ├── README.md
│   │   │   └── tsconfig.json
│   │   ├── express-vite
│   │   │   ├── .gitignore
│   │   │   ├── index.html
│   │   │   ├── package.json
│   │   │   ├── src
│   │   │   │   ├── client
│   │   │   │   │   ├── main.ts
│   │   │   │   │   ├── tsconfig.json
│   │   │   │   │   └── vite-env.d.ts
│   │   │   │   └── server
│   │   │   │       └── main.ts
│   │   │   └── tsconfig.json
│   │   ├── index.ts
│   │   ├── next-app-router
│   │   │   ├── .gitignore
│   │   │   ├── next.config.js
│   │   │   ├── package.json
│   │   │   ├── public
│   │   │   │   ├── next.svg
│   │   │   │   └── vercel.svg
│   │   │   ├── README.md
│   │   │   ├── src
│   │   │   │   ├── app
│   │   │   │   │   ├── (reverification)
│   │   │   │   │   │   ├── action-with-use-reverification
│   │   │   │   │   │   │   └── page.tsx
│   │   │   │   │   │   ├── actions.ts
│   │   │   │   │   │   ├── button-action.tsx
│   │   │   │   │   │   └── requires-re-verification
│   │   │   │   │   │       └── page.tsx
│   │   │   │   │   ├── api
│   │   │   │   │   │   ├── me
│   │   │   │   │   │   │   └── route.ts
│   │   │   │   │   │   └── settings
│   │   │   │   │   │       └── route.ts
│   │   │   │   │   ├── api-keys
│   │   │   │   │   │   └── page.tsx
│   │   │   │   │   ├── billing
│   │   │   │   │   │   ├── checkout-btn
│   │   │   │   │   │   │   └── page.tsx
│   │   │   │   │   │   ├── hooks
│   │   │   │   │   │   │   └── page.tsx
│   │   │   │   │   │   ├── plan-details-btn
│   │   │   │   │   │   │   └── page.tsx
│   │   │   │   │   │   └── subscription-details-btn
│   │   │   │   │   │       └── page.tsx
│   │   │   │   │   ├── buttons
│   │   │   │   │   │   └── page.tsx
│   │   │   │   │   ├── client-id.tsx
│   │   │   │   │   ├── create-organization
│   │   │   │   │   │   └── page.tsx
│   │   │   │   │   ├── csp
│   │   │   │   │   │   └── page.tsx
│   │   │   │   │   ├── favicon.ico
│   │   │   │   │   ├── globals.css
│   │   │   │   │   ├── hash
│   │   │   │   │   │   └── sign-in
│   │   │   │   │   │       └── [[...page]]
│   │   │   │   │   │           └── page.tsx
│   │   │   │   │   ├── jwt-v2-organizations
│   │   │   │   │   │   ├── (tests)
│   │   │   │   │   │   │   ├── conditionals.tsx
│   │   │   │   │   │   │   ├── has-client
│   │   │   │   │   │   │   │   └── page.tsx
│   │   │   │   │   │   │   ├── has-server
│   │   │   │   │   │   │   │   └── page.tsx
│   │   │   │   │   │   │   ├── has-ssr
│   │   │   │   │   │   │   │   ├── client.tsx
│   │   │   │   │   │   │   │   └── page.tsx
│   │   │   │   │   │   │   ├── layout.tsx
│   │   │   │   │   │   │   └── page.tsx
│   │   │   │   │   │   ├── client-jwt.tsx
│   │   │   │   │   │   └── server-jwt.tsx
│   │   │   │   │   ├── layout.tsx
│   │   │   │   │   ├── only-admin
│   │   │   │   │   │   └── page.tsx
│   │   │   │   │   ├── organization-list
│   │   │   │   │   │   └── page.tsx
│   │   │   │   │   ├── organization-profile
│   │   │   │   │   │   └── page.tsx
│   │   │   │   │   ├── organization-switcher
│   │   │   │   │   │   └── page.tsx
│   │   │   │   │   ├── organizations-by-id
│   │   │   │   │   │   └── [id]
│   │   │   │   │   │       ├── page.tsx
│   │   │   │   │   │       └── settings
│   │   │   │   │   │           └── page.tsx
│   │   │   │   │   ├── organizations-by-slug
│   │   │   │   │   │   └── [slug]
│   │   │   │   │   │       ├── page.tsx
│   │   │   │   │   │       └── settings
│   │   │   │   │   │           └── page.tsx
│   │   │   │   │   ├── page-protected
│   │   │   │   │   │   └── page.tsx
│   │   │   │   │   ├── page.module.css
│   │   │   │   │   ├── page.tsx
│   │   │   │   │   ├── personal-account
│   │   │   │   │   │   └── page.tsx
│   │   │   │   │   ├── pricing-table
│   │   │   │   │   │   └── page.tsx
│   │   │   │   │   ├── protected
│   │   │   │   │   │   └── page.tsx
│   │   │   │   │   ├── settings
│   │   │   │   │   │   ├── auth-has
│   │   │   │   │   │   │   └── page.tsx
│   │   │   │   │   │   ├── auth-protect
│   │   │   │   │   │   │   └── page.tsx
│   │   │   │   │   │   ├── rcc-protect
│   │   │   │   │   │   │   └── page.tsx
│   │   │   │   │   │   ├── rsc-protect
│   │   │   │   │   │   │   └── page.tsx
│   │   │   │   │   │   └── useAuth-has
│   │   │   │   │   │       ├── layout.tsx
│   │   │   │   │   │       └── page.tsx
│   │   │   │   │   ├── sign-in
│   │   │   │   │   │   └── [[...catchall]]
│   │   │   │   │   │       └── page.tsx
│   │   │   │   │   ├── sign-in-or-up
│   │   │   │   │   │   └── [[...catchall]]
│   │   │   │   │   │       └── page.tsx
│   │   │   │   │   ├── sign-up
│   │   │   │   │   │   └── [[...catchall]]
│   │   │   │   │   │       └── page.tsx
│   │   │   │   │   ├── switcher
│   │   │   │   │   │   └── page.tsx
│   │   │   │   │   ├── user
│   │   │   │   │   │   └── [[...catchall]]
│   │   │   │   │   │       └── page.tsx
│   │   │   │   │   ├── user-avatar
│   │   │   │   │   │   └── page.tsx
│   │   │   │   │   ├── user-button
│   │   │   │   │   │   └── page.tsx
│   │   │   │   │   └── waitlist
│   │   │   │   │       └── page.tsx
│   │   │   │   └── middleware.ts
│   │   │   └── tsconfig.json
│   │   ├── next-app-router-quickstart
│   │   │   ├── .gitignore
│   │   │   ├── next.config.js
│   │   │   ├── package.json
│   │   │   ├── public
│   │   │   │   ├── next.svg
│   │   │   │   └── vercel.svg
│   │   │   ├── README.md
│   │   │   ├── src
│   │   │   │   ├── app
│   │   │   │   │   ├── favicon.ico
│   │   │   │   │   ├── globals.css
│   │   │   │   │   ├── layout.tsx
│   │   │   │   │   ├── page.module.css
│   │   │   │   │   └── page.tsx
│   │   │   │   └── middleware.ts
│   │   │   └── tsconfig.json
│   │   ├── nuxt-node
│   │   │   ├── app
│   │   │   │   ├── app.vue
│   │   │   │   ├── middleware
│   │   │   │   │   └── auth.global.js
│   │   │   │   └── pages
│   │   │   │       ├── index.vue
│   │   │   │       ├── only-admin.vue
│   │   │   │       ├── pricing-table.vue
│   │   │   │       ├── sign-in.vue
│   │   │   │       └── user.vue
│   │   │   ├── nuxt.config.js
│   │   │   ├── package.json
│   │   │   └── server
│   │   │       └── api
│   │   │           └── me.js
│   │   ├── react-cra
│   │   │   ├── .gitignore
│   │   │   ├── package.json
│   │   │   ├── public
│   │   │   │   ├── favicon.ico
│   │   │   │   ├── index.html
│   │   │   │   ├── logo192.png
│   │   │   │   ├── logo512.png
│   │   │   │   ├── manifest.json
│   │   │   │   └── robots.txt
│   │   │   ├── README.md
│   │   │   ├── src
│   │   │   │   ├── App.css
│   │   │   │   ├── App.tsx
│   │   │   │   ├── index.css
│   │   │   │   ├── index.tsx
│   │   │   │   ├── logo.svg
│   │   │   │   └── react-app-env.d.ts
│   │   │   └── tsconfig.json
│   │   ├── react-router-library
│   │   │   ├── index.html
│   │   │   ├── package.json
│   │   │   ├── public
│   │   │   │   └── vite.svg
│   │   │   ├── README.md
│   │   │   ├── src
│   │   │   │   ├── App.css
│   │   │   │   ├── App.tsx
│   │   │   │   ├── assets
│   │   │   │   │   └── react.svg
│   │   │   │   ├── index.css
│   │   │   │   ├── main.tsx
│   │   │   │   └── vite-env.d.ts
│   │   │   ├── tsconfig.app.json
│   │   │   ├── tsconfig.json
│   │   │   ├── tsconfig.node.json
│   │   │   └── vite.config.ts
│   │   ├── react-router-node
│   │   │   ├── .gitignore
│   │   │   ├── app
│   │   │   │   ├── root.tsx
│   │   │   │   ├── routes
│   │   │   │   │   ├── home.tsx
│   │   │   │   │   ├── protected.tsx
│   │   │   │   │   ├── sign-in.tsx
│   │   │   │   │   └── sign-up.tsx
│   │   │   │   └── routes.ts
│   │   │   ├── package.json
│   │   │   ├── public
│   │   │   │   └── favicon.ico
│   │   │   ├── react-router.config.ts
│   │   │   ├── README.md
│   │   │   ├── tsconfig.json
│   │   │   └── vite.config.ts
│   │   ├── react-vite
│   │   │   ├── .gitignore
│   │   │   ├── index.html
│   │   │   ├── package.json
│   │   │   ├── public
│   │   │   │   └── vite.svg
│   │   │   ├── src
│   │   │   │   ├── App.css
│   │   │   │   ├── App.tsx
│   │   │   │   ├── assets
│   │   │   │   │   └── react.svg
│   │   │   │   ├── buttons
│   │   │   │   │   └── index.tsx
│   │   │   │   ├── clerk-status
│   │   │   │   │   └── index.tsx
│   │   │   │   ├── client-id.tsx
│   │   │   │   ├── create-organization
│   │   │   │   │   └── index.tsx
│   │   │   │   ├── custom-user-button
│   │   │   │   │   ├── index.tsx
│   │   │   │   │   ├── with-dynamic-items.tsx
│   │   │   │   │   ├── with-dynamic-label-and-custom-pages.tsx
│   │   │   │   │   └── with-dynamic-labels.tsx
│   │   │   │   ├── custom-user-button-trigger
│   │   │   │   │   └── index.tsx
│   │   │   │   ├── custom-user-profile
│   │   │   │   │   └── index.tsx
│   │   │   │   ├── index.css
│   │   │   │   ├── main.tsx
│   │   │   │   ├── organization-list
│   │   │   │   │   └── index.tsx
│   │   │   │   ├── organization-profile
│   │   │   │   │   └── index.tsx
│   │   │   │   ├── organization-switcher
│   │   │   │   │   └── index.tsx
│   │   │   │   ├── PageContext.tsx
│   │   │   │   ├── protected
│   │   │   │   │   └── index.tsx
│   │   │   │   ├── sign-in
│   │   │   │   │   └── index.tsx
│   │   │   │   ├── sign-up
│   │   │   │   │   └── index.tsx
│   │   │   │   ├── user
│   │   │   │   │   └── index.tsx
│   │   │   │   ├── user-avatar
│   │   │   │   │   └── index.tsx
│   │   │   │   ├── user-button
│   │   │   │   │   └── index.tsx
│   │   │   │   ├── vite-env.d.ts
│   │   │   │   └── waitlist
│   │   │   │       └── index.tsx
│   │   │   ├── tsconfig.json
│   │   │   ├── tsconfig.node.json
│   │   │   └── vite.config.ts
│   │   ├── tanstack-react-start
│   │   │   ├── .gitignore
│   │   │   ├── package.json
│   │   │   ├── README.md
│   │   │   ├── src
│   │   │   │   ├── router.tsx
│   │   │   │   ├── routes
│   │   │   │   │   ├── __root.tsx
│   │   │   │   │   ├── index.tsx
│   │   │   │   │   ├── sign-in.tsx
│   │   │   │   │   └── user.tsx
│   │   │   │   ├── routeTree.gen.ts
│   │   │   │   ├── start.ts
│   │   │   │   └── styles
│   │   │   │       └── app.css
│   │   │   ├── tsconfig.json
│   │   │   └── vite.config.ts
│   │   └── vue-vite
│   │       ├── .gitignore
│   │       ├── index.html
│   │       ├── package.json
│   │       ├── public
│   │       │   └── vite.svg
│   │       ├── src
│   │       │   ├── App.vue
│   │       │   ├── assets
│   │       │   │   └── styles.css
│   │       │   ├── components
│   │       │   │   ├── CustomUserButton.vue
│   │       │   │   └── LanguagePicker.vue
│   │       │   ├── main.ts
│   │       │   ├── router.ts
│   │       │   ├── views
│   │       │   │   ├── Admin.vue
│   │       │   │   ├── billing
│   │       │   │   │   ├── CheckoutBtn.vue
│   │       │   │   │   ├── PlanDetailsBtn.vue
│   │       │   │   │   └── SubscriptionDetailsBtn.vue
│   │       │   │   ├── custom-pages
│   │       │   │   │   ├── OrganizationProfile.vue
│   │       │   │   │   └── UserProfile.vue
│   │       │   │   ├── Home.vue
│   │       │   │   ├── PricingTable.vue
│   │       │   │   ├── Profile.vue
│   │       │   │   ├── SignIn.vue
│   │       │   │   ├── Unstyled.vue
│   │       │   │   └── UserAvatar.vue
│   │       │   └── vite-env.d.ts
│   │       ├── tsconfig.app.json
│   │       ├── tsconfig.json
│   │       ├── tsconfig.node.json
│   │       └── vite.config.ts
│   ├── tests
│   │   ├── appearance.test.ts
│   │   ├── astro
│   │   │   ├── components.test.ts
│   │   │   ├── hybrid.test.ts
│   │   │   └── machine.test.ts
│   │   ├── billing-hooks.test.ts
│   │   ├── components.test.ts
│   │   ├── content-security-policy.test.ts
│   │   ├── custom-flows
│   │   │   ├── sign-in.test.ts
│   │   │   └── sign-up.test.ts
│   │   ├── custom-pages.test.ts
│   │   ├── db-jwt.test.ts
│   │   ├── dynamic-keys.test.ts
│   │   ├── elements
│   │   │   ├── next-sign-in.test.ts
│   │   │   ├── next-sign-up.test.ts
│   │   │   ├── otp.test.ts
│   │   │   └── validate-password.test.ts
│   │   ├── email-code.test.ts
│   │   ├── email-link.test.ts
│   │   ├── expo-web
│   │   │   ├── basic.test.ts
│   │   │   └── custom-flows.test.ts
│   │   ├── express
│   │   │   └── basic.test.ts
│   │   ├── global.setup.ts
│   │   ├── global.teardown.ts
│   │   ├── handshake
│   │   │   └── handshake.test.ts
│   │   ├── handshake.test.ts
│   │   ├── impersonation-flow.test.ts
│   │   ├── last-authentication-strategy.test.ts
│   │   ├── legal-consent.test.ts
│   │   ├── localhost
│   │   │   ├── localhost-different-port-different-instance.test.ts
│   │   │   ├── localhost-different-port-same-instance.test.ts
│   │   │   └── localhost-switch-instance.test.ts
│   │   ├── machine-auth
│   │   │   ├── api-keys.test.ts
│   │   │   ├── component.test.ts
│   │   │   └── m2m.test.ts
│   │   ├── middleware-placement.test.ts
│   │   ├── navigation.test.ts
│   │   ├── next-account-portal
│   │   │   ├── clerk-v4-ap-core-1.test.ts
│   │   │   ├── clerk-v4-ap-core-2.test.ts
│   │   │   ├── clerk-v5-ap-core-1.test.ts
│   │   │   ├── clerk-v5-ap-core-2.test.ts
│   │   │   └── common.ts
│   │   ├── next-build.test.ts
│   │   ├── next-quickstart-keyless.test.ts
│   │   ├── next-quickstart.test.ts
│   │   ├── non-secure-context.test.ts
│   │   ├── nuxt
│   │   │   ├── basic.test.ts
│   │   │   └── middleware.test.ts
│   │   ├── oauth-flows.test.ts
│   │   ├── pricing-table.test.ts
│   │   ├── protect-jwt-v2.test.ts
│   │   ├── protect.test.ts
│   │   ├── react-router
│   │   │   ├── basic.test.ts
│   │   │   ├── library-mode.test.ts
│   │   │   └── pre-middleware.test.ts
│   │   ├── redirects.test.ts
│   │   ├── resiliency.test.ts
│   │   ├── restricted-mode.test.ts
│   │   ├── reverification.test.ts
│   │   ├── session-tasks-eject-flow.test.ts
│   │   ├── session-tasks-multi-session.test.ts
│   │   ├── session-tasks-sign-in.test.ts
│   │   ├── session-tasks-sign-up.test.ts
│   │   ├── session-token-cache
│   │   │   ├── multi-session.test.ts
│   │   │   └── single-session.test.ts
│   │   ├── sessions
│   │   │   ├── root-subdomain-prod-instances.test.ts
│   │   │   └── utils.ts
│   │   ├── sign-in-flow.test.ts
│   │   ├── sign-in-or-up-component.test.ts
│   │   ├── sign-in-or-up-email-links-flow.test.ts
│   │   ├── sign-in-or-up-flow.test.ts
│   │   ├── sign-in-or-up-restricted-mode.test.ts
│   │   ├── sign-out-smoke.test.ts
│   │   ├── sign-up-flow.test.ts
│   │   ├── snapshots
│   │   │   └── appearance.test.ts-snapshots
│   │   │       └── appearance-prop-all-clerk-themes-render-1-chrome-darwin.png
│   │   ├── tanstack-start
│   │   │   └── basic.test.ts
│   │   ├── unsafeMetadata.test.ts
│   │   ├── update-props.test.ts
│   │   ├── user-avatar.test.ts
│   │   ├── user-profile.test.ts
│   │   ├── vue
│   │   │   └── components.test.ts
│   │   ├── waitlist-mode.test.ts
│   │   └── whatsapp-phone-code.test.ts
│   ├── testUtils
│   │   ├── emailService.ts
│   │   ├── handshake.ts
│   │   ├── index.ts
│   │   ├── invitationsService.ts
│   │   ├── organizationsService.ts
│   │   ├── phoneUtils.ts
│   │   ├── testAgainstRunningApps.ts
│   │   └── usersService.ts
│   ├── tsconfig.json
│   └── types.d.ts
├── jest.setup-after-env.ts
├── LICENSE
├── package.json
├── packages
│   ├── agent-toolkit
│   │   ├── CHANGELOG.md
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── src
│   │   │   ├── ai-sdk
│   │   │   │   ├── adapter.ts
│   │   │   │   └── index.ts
│   │   │   ├── global.d.ts
│   │   │   ├── langchain
│   │   │   │   ├── adapter.ts
│   │   │   │   └── index.ts
│   │   │   ├── lib
│   │   │   │   ├── clerk-client.ts
│   │   │   │   ├── clerk-tool.ts
│   │   │   │   ├── constants.ts
│   │   │   │   ├── inject-session-claims.ts
│   │   │   │   ├── tools
│   │   │   │   │   ├── index.ts
│   │   │   │   │   ├── invitations.ts
│   │   │   │   │   ├── organizations.ts
│   │   │   │   │   └── users.ts
│   │   │   │   ├── types.ts
│   │   │   │   ├── utils.ts
│   │   │   │   └── utilts.test.ts
│   │   │   └── modelcontextprotocol
│   │   │       ├── adapter.ts
│   │   │       ├── index.ts
│   │   │       └── local-server.ts
│   │   ├── tsconfig.json
│   │   ├── tsconfig.test.json
│   │   └── tsup.config.ts
│   ├── astro
│   │   ├── .gitignore
│   │   ├── CHANGELOG.md
│   │   ├── client
│   │   │   └── package.json
│   │   ├── env.d.ts
│   │   ├── hotload
│   │   │   └── package.json
│   │   ├── internal
│   │   │   └── package.json
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── react
│   │   │   └── package.json
│   │   ├── README.md
│   │   ├── server
│   │   │   └── package.json
│   │   ├── src
│   │   │   ├── astro-components
│   │   │   │   ├── control
│   │   │   │   │   ├── AuthenticateWithRedirectCallback.astro
│   │   │   │   │   ├── BaseClerkControlElement.ts
│   │   │   │   │   ├── Protect.astro
│   │   │   │   │   ├── ProtectCSR.astro
│   │   │   │   │   ├── ProtectSSR.astro
│   │   │   │   │   ├── SignedIn.astro
│   │   │   │   │   ├── SignedInCSR.astro
│   │   │   │   │   ├── SignedInSSR.astro
│   │   │   │   │   ├── SignedOut.astro
│   │   │   │   │   ├── SignedOutCSR.astro
│   │   │   │   │   └── SignedOutSSR.astro
│   │   │   │   ├── index.ts
│   │   │   │   ├── interactive
│   │   │   │   │   ├── CreateOrganization.astro
│   │   │   │   │   ├── CustomProfilePageRenderer.astro
│   │   │   │   │   ├── GoogleOneTap.astro
│   │   │   │   │   ├── InternalUIComponentRenderer.astro
│   │   │   │   │   ├── OrganizationList.astro
│   │   │   │   │   ├── OrganizationProfile
│   │   │   │   │   │   ├── index.ts
│   │   │   │   │   │   ├── OrganizationProfile.astro
│   │   │   │   │   │   ├── OrganizationProfileLink.astro
│   │   │   │   │   │   └── OrganizationProfilePage.astro
│   │   │   │   │   ├── OrganizationSwitcher
│   │   │   │   │   │   ├── index.ts
│   │   │   │   │   │   ├── OrganizationProfileLink.astro
│   │   │   │   │   │   ├── OrganizationProfilePage.astro
│   │   │   │   │   │   └── OrganizationSwitcher.astro
│   │   │   │   │   ├── OrganizationSwitcher.astro
│   │   │   │   │   ├── PricingTable.astro
│   │   │   │   │   ├── SignIn.astro
│   │   │   │   │   ├── SignUp.astro
│   │   │   │   │   ├── UserAvatar.astro
│   │   │   │   │   ├── UserButton
│   │   │   │   │   │   ├── index.ts
│   │   │   │   │   │   ├── MenuItemRenderer.astro
│   │   │   │   │   │   ├── UserButton.astro
│   │   │   │   │   │   ├── UserButtonAction.astro
│   │   │   │   │   │   ├── UserButtonLink.astro
│   │   │   │   │   │   ├── UserButtonMenuItems.astro
│   │   │   │   │   │   └── UserButtonUserProfilePage.astro
│   │   │   │   │   ├── UserProfile
│   │   │   │   │   │   ├── index.ts
│   │   │   │   │   │   ├── UserProfile.astro
│   │   │   │   │   │   ├── UserProfileLink.astro
│   │   │   │   │   │   └── UserProfilePage.astro
│   │   │   │   │   └── Waitlist.astro
│   │   │   │   └── unstyled
│   │   │   │       ├── CheckoutButton.astro
│   │   │   │       ├── PlanDetailsButton.astro
│   │   │   │       ├── SignInButton.astro
│   │   │   │       ├── SignOutButton.astro
│   │   │   │       ├── SignUpButton.astro
│   │   │   │       ├── SubscriptionDetailsButton.astro
│   │   │   │       └── utils.ts
│   │   │   ├── async-local-storage.client.ts
│   │   │   ├── async-local-storage.server.ts
│   │   │   ├── client
│   │   │   │   └── index.ts
│   │   │   ├── env.d.ts
│   │   │   ├── global.d.ts
│   │   │   ├── index.ts
│   │   │   ├── integration
│   │   │   │   ├── create-integration.ts
│   │   │   │   └── vite-plugin-astro-config.ts
│   │   │   ├── internal
│   │   │   │   ├── create-clerk-instance.ts
│   │   │   │   ├── create-injection-script-runner.ts
│   │   │   │   ├── index.ts
│   │   │   │   ├── invoke-clerk-astro-js-functions.ts
│   │   │   │   ├── merge-env-vars-with-params.ts
│   │   │   │   ├── mount-clerk-astro-js-components.ts
│   │   │   │   ├── run-once.ts
│   │   │   │   ├── swap-document.ts
│   │   │   │   ├── types.ts
│   │   │   │   └── utils
│   │   │   │       └── generateSafeId.ts
│   │   │   ├── react
│   │   │   │   ├── CheckoutButton.tsx
│   │   │   │   ├── controlComponents.tsx
│   │   │   │   ├── hooks.ts
│   │   │   │   ├── index.ts
│   │   │   │   ├── PlanDetailsButton.tsx
│   │   │   │   ├── SignInButton.tsx
│   │   │   │   ├── SignOutButton.tsx
│   │   │   │   ├── SignUpButton.tsx
│   │   │   │   ├── SubscriptionDetailsButton.tsx
│   │   │   │   ├── types.ts
│   │   │   │   ├── uiComponents.tsx
│   │   │   │   └── utils.tsx
│   │   │   ├── server
│   │   │   │   ├── build-clerk-hotload-script.ts
│   │   │   │   ├── clerk-client.ts
│   │   │   │   ├── clerk-middleware.ts
│   │   │   │   ├── current-user.ts
│   │   │   │   ├── get-safe-env.ts
│   │   │   │   ├── index.ts
│   │   │   │   ├── route-matcher.ts
│   │   │   │   ├── server-redirect-with-auth.ts
│   │   │   │   ├── types.ts
│   │   │   │   └── utils.ts
│   │   │   ├── stores
│   │   │   │   ├── external.ts
│   │   │   │   └── internal.ts
│   │   │   ├── types.ts
│   │   │   └── webhooks.ts
│   │   ├── tsconfig.json
│   │   ├── tsup.config.ts
│   │   ├── turbo.json
│   │   └── webhooks
│   │       └── package.json
│   ├── backend
│   │   ├── .gitignore
│   │   ├── CHANGELOG.md
│   │   ├── errors
│   │   │   └── package.json
│   │   ├── internal
│   │   │   └── package.json
│   │   ├── jwt
│   │   │   └── package.json
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── src
│   │   │   ├── __tests__
│   │   │   │   ├── createRedirect.test.ts
│   │   │   │   ├── exports.test.ts
│   │   │   │   └── webhooks.test.ts
│   │   │   ├── api
│   │   │   │   ├── __tests__
│   │   │   │   │   ├── ClientApi.test.ts
│   │   │   │   │   ├── factory.test.ts
│   │   │   │   │   ├── M2MTokenApi.test.ts
│   │   │   │   │   ├── MachineApi.test.ts
│   │   │   │   │   ├── SamlConnectionApi.test.ts
│   │   │   │   │   └── SessionApi.test.ts
│   │   │   │   ├── endpoints
│   │   │   │   │   ├── AbstractApi.ts
│   │   │   │   │   ├── AccountlessApplicationsAPI.ts
│   │   │   │   │   ├── ActorTokenApi.ts
│   │   │   │   │   ├── AllowlistIdentifierApi.ts
│   │   │   │   │   ├── APIKeysApi.ts
│   │   │   │   │   ├── BetaFeaturesApi.ts
│   │   │   │   │   ├── BillingApi.ts
│   │   │   │   │   ├── BlocklistIdentifierApi.ts
│   │   │   │   │   ├── ClientApi.ts
│   │   │   │   │   ├── DomainApi.ts
│   │   │   │   │   ├── EmailAddressApi.ts
│   │   │   │   │   ├── IdPOAuthAccessTokenApi.ts
│   │   │   │   │   ├── index.ts
│   │   │   │   │   ├── InstanceApi.ts
│   │   │   │   │   ├── InvitationApi.ts
│   │   │   │   │   ├── JwksApi.ts
│   │   │   │   │   ├── JwtTemplatesApi.ts
│   │   │   │   │   ├── M2MTokenApi.ts
│   │   │   │   │   ├── MachineApi.ts
│   │   │   │   │   ├── OAuthApplicationsApi.ts
│   │   │   │   │   ├── OrganizationApi.ts
│   │   │   │   │   ├── PhoneNumberApi.ts
│   │   │   │   │   ├── ProxyCheckApi.ts
│   │   │   │   │   ├── RedirectUrlApi.ts
│   │   │   │   │   ├── SamlConnectionApi.ts
│   │   │   │   │   ├── SessionApi.ts
│   │   │   │   │   ├── SignInTokenApi.ts
│   │   │   │   │   ├── SignUpApi.ts
│   │   │   │   │   ├── TestingTokenApi.ts
│   │   │   │   │   ├── UserApi.ts
│   │   │   │   │   ├── util-types.ts
│   │   │   │   │   ├── WaitlistEntryApi.ts
│   │   │   │   │   └── WebhookApi.ts
│   │   │   │   ├── factory.ts
│   │   │   │   ├── index.ts
│   │   │   │   ├── request.ts
│   │   │   │   └── resources
│   │   │   │       ├── AccountlessApplication.ts
│   │   │   │       ├── ActorToken.ts
│   │   │   │       ├── AllowlistIdentifier.ts
│   │   │   │       ├── APIKey.ts
│   │   │   │       ├── BlocklistIdentifier.ts
│   │   │   │       ├── Client.ts
│   │   │   │       ├── CnameTarget.ts
│   │   │   │       ├── CommercePlan.ts
│   │   │   │       ├── CommerceSubscription.ts
│   │   │   │       ├── CommerceSubscriptionItem.ts
│   │   │   │       ├── Cookies.ts
│   │   │   │       ├── DeletedObject.ts
│   │   │   │       ├── Deserializer.ts
│   │   │   │       ├── Domain.ts
│   │   │   │       ├── Email.ts
│   │   │   │       ├── EmailAddress.ts
│   │   │   │       ├── Enums.ts
│   │   │   │       ├── ExternalAccount.ts
│   │   │   │       ├── Feature.ts
│   │   │   │       ├── HandshakePayload.ts
│   │   │   │       ├── IdentificationLink.ts
│   │   │   │       ├── IdPOAuthAccessToken.ts
│   │   │   │       ├── index.ts
│   │   │   │       ├── Instance.ts
│   │   │   │       ├── InstanceRestrictions.ts
│   │   │   │       ├── InstanceSettings.ts
│   │   │   │       ├── Invitation.ts
│   │   │   │       ├── JSON.ts
│   │   │   │       ├── JwtTemplate.ts
│   │   │   │       ├── M2MToken.ts
│   │   │   │       ├── Machine.ts
│   │   │   │       ├── MachineScope.ts
│   │   │   │       ├── MachineSecretKey.ts
│   │   │   │       ├── OauthAccessToken.ts
│   │   │   │       ├── OAuthApplication.ts
│   │   │   │       ├── Organization.ts
│   │   │   │       ├── OrganizationDomain.ts
│   │   │   │       ├── OrganizationInvitation.ts
│   │   │   │       ├── OrganizationMembership.ts
│   │   │   │       ├── OrganizationSettings.ts
│   │   │   │       ├── PhoneNumber.ts
│   │   │   │       ├── ProxyCheck.ts
│   │   │   │       ├── RedirectUrl.ts
│   │   │   │       ├── SamlAccount.ts
│   │   │   │       ├── SamlConnection.ts
│   │   │   │       ├── Session.ts
│   │   │   │       ├── SignInTokens.ts
│   │   │   │       ├── SignUpAttempt.ts
│   │   │   │       ├── SMSMessage.ts
│   │   │   │       ├── TestingToken.ts
│   │   │   │       ├── Token.ts
│   │   │   │       ├── User.ts
│   │   │   │       ├── Verification.ts
│   │   │   │       ├── WaitlistEntry.ts
│   │   │   │       ├── Web3Wallet.ts
│   │   │   │       └── Webhooks.ts
│   │   │   ├── constants.ts
│   │   │   ├── createRedirect.ts
│   │   │   ├── errors.ts
│   │   │   ├── fixtures
│   │   │   │   ├── index.ts
│   │   │   │   ├── jwks.json
│   │   │   │   ├── machine.ts
│   │   │   │   └── user.json
│   │   │   ├── global.d.ts
│   │   │   ├── index.ts
│   │   │   ├── internal.ts
│   │   │   ├── jwt
│   │   │   │   ├── __tests__
│   │   │   │   │   ├── assertions.test.ts
│   │   │   │   │   ├── cryptoKeys.test.ts
│   │   │   │   │   ├── signJwt.test.ts
│   │   │   │   │   └── verifyJwt.test.ts
│   │   │   │   ├── algorithms.ts
│   │   │   │   ├── assertions.ts
│   │   │   │   ├── cryptoKeys.ts
│   │   │   │   ├── index.ts
│   │   │   │   ├── legacyReturn.ts
│   │   │   │   ├── signJwt.ts
│   │   │   │   ├── types.ts
│   │   │   │   └── verifyJwt.ts
│   │   │   ├── mock-server.ts
│   │   │   ├── runtime
│   │   │   │   ├── browser
│   │   │   │   │   └── crypto.mjs
│   │   │   │   └── node
│   │   │   │       ├── crypto.js
│   │   │   │       └── crypto.mjs
│   │   │   ├── runtime.ts
│   │   │   ├── tokens
│   │   │   │   ├── __tests__
│   │   │   │   │   ├── authenticateContext.test.ts
│   │   │   │   │   ├── authObjects.test.ts
│   │   │   │   │   ├── authStatus.test.ts
│   │   │   │   │   ├── clerkRequest.test.ts
│   │   │   │   │   ├── factory.test.ts
│   │   │   │   │   ├── getAuth.test-d.ts
│   │   │   │   │   ├── handshake.test.ts
│   │   │   │   │   ├── keys.test.ts
│   │   │   │   │   ├── machine.test.ts
│   │   │   │   │   ├── organizationMatcher.test.ts
│   │   │   │   │   ├── request.test-d.ts
│   │   │   │   │   ├── request.test.ts
│   │   │   │   │   └── verify.test.ts
│   │   │   │   ├── authenticateContext.ts
│   │   │   │   ├── authObjects.ts
│   │   │   │   ├── authStatus.ts
│   │   │   │   ├── clerkRequest.ts
│   │   │   │   ├── clerkUrl.ts
│   │   │   │   ├── cookie.ts
│   │   │   │   ├── factory.ts
│   │   │   │   ├── handshake.ts
│   │   │   │   ├── keys.ts
│   │   │   │   ├── machine.ts
│   │   │   │   ├── organizationMatcher.ts
│   │   │   │   ├── request.ts
│   │   │   │   ├── tokenTypes.ts
│   │   │   │   ├── types.ts
│   │   │   │   └── verify.ts
│   │   │   ├── util
│   │   │   │   ├── __tests__
│   │   │   │   │   └── path.test.ts
│   │   │   │   ├── decorateObjectWithResources.ts
│   │   │   │   ├── mergePreDefinedOptions.ts
│   │   │   │   ├── optionsAssertions.ts
│   │   │   │   ├── path.ts
│   │   │   │   ├── rfc4648.ts
│   │   │   │   └── shared.ts
│   │   │   └── webhooks.ts
│   │   ├── tsconfig.declarations.json
│   │   ├── tsconfig.json
│   │   ├── tsup.config.ts
│   │   ├── typedoc.json
│   │   ├── vitest.config.mts
│   │   ├── vitest.setup.mts
│   │   └── webhooks
│   │       └── package.json
│   ├── chrome-extension
│   │   ├── .gitignore
│   │   ├── background
│   │   │   └── package.json
│   │   ├── CHANGELOG.md
│   │   ├── docs
│   │   │   ├── clerk-provider.md
│   │   │   ├── manifest.md
│   │   │   └── service-worker.md
│   │   ├── internal
│   │   │   └── package.json
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── react
│   │   │   └── package.json
│   │   ├── README.md
│   │   ├── src
│   │   │   ├── __tests__
│   │   │   │   ├── __snapshots__
│   │   │   │   │   └── exports.test.ts.snap
│   │   │   │   └── exports.test.ts
│   │   │   ├── background
│   │   │   │   ├── clerk.ts
│   │   │   │   └── index.ts
│   │   │   ├── global.d.ts
│   │   │   ├── index.ts
│   │   │   ├── internal
│   │   │   │   ├── clerk.ts
│   │   │   │   ├── constants.ts
│   │   │   │   ├── index.ts
│   │   │   │   └── utils
│   │   │   │       ├── __tests__
│   │   │   │       │   ├── cookies.test.ts
│   │   │   │       │   ├── manifest.test.ts
│   │   │   │       │   └── storage.test.ts
│   │   │   │       ├── cookies.ts
│   │   │   │       ├── errors.ts
│   │   │   │       ├── jwt-handler.ts
│   │   │   │       ├── manifest.ts
│   │   │   │       ├── request-handler.ts
│   │   │   │       ├── response-handler.ts
│   │   │   │       └── storage.ts
│   │   │   ├── react
│   │   │   │   ├── ClerkProvider.tsx
│   │   │   │   ├── index.ts
│   │   │   │   ├── NotSupported.tsx
│   │   │   │   └── re-exports.ts
│   │   │   └── types.ts
│   │   ├── tsconfig.declarations.json
│   │   ├── tsconfig.json
│   │   ├── tsconfig.test.json
│   │   ├── tsup.config.ts
│   │   ├── vitest.config.mts
│   │   └── vitest.setup.mts
│   ├── clerk-js
│   │   ├── .gitignore
│   │   ├── bundle-check.mjs
│   │   ├── bundlewatch-fix.mjs
│   │   ├── bundlewatch.config.json
│   │   ├── CHANGELOG.md
│   │   ├── clerk.png
│   │   ├── docs
│   │   │   └── events.md
│   │   ├── headless
│   │   │   ├── index.d.ts
│   │   │   └── index.js
│   │   ├── LICENSE
│   │   ├── no-rhc
│   │   │   ├── index.d.ts
│   │   │   └── index.js
│   │   ├── package.json
│   │   ├── playwright.config.ts
│   │   ├── README.md
│   │   ├── rspack.config.js
│   │   ├── sandbox
│   │   │   ├── app.ts
│   │   │   ├── integration
│   │   │   │   ├── create-organization.spec.ts
│   │   │   │   ├── create-organization.spec.ts-snapshots
│   │   │   │   │   └── create-organization-chromium-darwin.png
│   │   │   │   ├── global.setup.ts
│   │   │   │   ├── helpers.ts
│   │   │   │   ├── oauth-consent.spec.ts
│   │   │   │   ├── oauth-consent.spec.ts-snapshots
│   │   │   │   │   └── oauth-consent-chromium-darwin.png
│   │   │   │   ├── org-switcher.spec.ts
│   │   │   │   ├── org-switcher.spec.ts-snapshots
│   │   │   │   │   ├── organization-switcher-action-hover-chromium-darwin.png
│   │   │   │   │   └── organization-switcher-popover-chromium-darwin.png
│   │   │   │   ├── organization-list.spec.ts
│   │   │   │   ├── organization-list.spec.ts-snapshots
│   │   │   │   │   └── organization-list-chromium-darwin.png
│   │   │   │   ├── sign-in-modal.spec.ts
│   │   │   │   ├── sign-in-modal.spec.ts-snapshots
│   │   │   │   │   └── sign-in-modal-chromium-darwin.png
│   │   │   │   ├── sign-in.spec.ts
│   │   │   │   ├── sign-in.spec.ts-snapshots
│   │   │   │   │   ├── sign-in-action-link-hover-chromium-darwin.png
│   │   │   │   │   ├── sign-in-chromium-darwin.png
│   │   │   │   │   ├── sign-in-primary-button-hover-chromium-darwin.png
│   │   │   │   │   └── sign-in-secondary-button-hover-chromium-darwin.png
│   │   │   │   ├── sign-up.spec.ts
│   │   │   │   ├── sign-up.spec.ts-snapshots
│   │   │   │   │   └── sign-up-chromium-darwin.png
│   │   │   │   ├── user-button.spec.ts
│   │   │   │   ├── user-button.spec.ts-snapshots
│   │   │   │   │   └── user-button-popover-chromium-darwin.png
│   │   │   │   ├── user-profile.spec.ts
│   │   │   │   └── user-profile.spec.ts-snapshots
│   │   │   │       └── user-profile-chromium-darwin.png
│   │   │   └── template.html
│   │   ├── src
│   │   │   ├── __tests__
│   │   │   │   └── headless.test.ts
│   │   │   ├── core
│   │   │   │   ├── __tests__
│   │   │   │   │   ├── clerk.redirects.test.ts
│   │   │   │   │   ├── clerk.test.ts
│   │   │   │   │   ├── fapiClient.test.ts
│   │   │   │   │   └── tokenCache.test.ts
│   │   │   │   ├── auth
│   │   │   │   │   ├── __tests__
│   │   │   │   │   │   ├── cookieSuffix.test.ts
│   │   │   │   │   │   ├── devBrowser.test.ts
│   │   │   │   │   │   ├── getCookieDomain.test.ts
│   │   │   │   │   │   └── getSecureAttribute.test.ts
│   │   │   │   │   ├── AuthCookieService.ts
│   │   │   │   │   ├── CaptchaHeartbeat.ts
│   │   │   │   │   ├── cookies
│   │   │   │   │   │   ├── __tests__
│   │   │   │   │   │   │   ├── clientUat.test.ts
│   │   │   │   │   │   │   └── session.test.ts
│   │   │   │   │   │   ├── activeContext.ts
│   │   │   │   │   │   ├── clientUat.ts
│   │   │   │   │   │   ├── devBrowser.ts
│   │   │   │   │   │   └── session.ts
│   │   │   │   │   ├── cookieSuffix.ts
│   │   │   │   │   ├── devBrowser.ts
│   │   │   │   │   ├── getCookieDomain.ts
│   │   │   │   │   ├── getSecureAttribute.ts
│   │   │   │   │   ├── safeLock.ts
│   │   │   │   │   └── SessionCookiePoller.ts
│   │   │   │   ├── clerk.ts
│   │   │   │   ├── constants.ts
│   │   │   │   ├── errors.ts
│   │   │   │   ├── events.ts
│   │   │   │   ├── fapiClient.ts
│   │   │   │   ├── fraudProtection.test.ts
│   │   │   │   ├── fraudProtection.ts
│   │   │   │   ├── jwt-client.ts
│   │   │   │   ├── modules
│   │   │   │   │   ├── apiKeys
│   │   │   │   │   │   └── index.ts
│   │   │   │   │   ├── billing
│   │   │   │   │   │   ├── index.ts
│   │   │   │   │   │   ├── namespace.ts
│   │   │   │   │   │   └── payment-source-methods.ts
│   │   │   │   │   ├── checkout
│   │   │   │   │   │   ├── __tests__
│   │   │   │   │   │   │   └── manager.test.ts
│   │   │   │   │   │   ├── instance.ts
│   │   │   │   │   │   └── manager.ts
│   │   │   │   │   └── debug
│   │   │   │   │       ├── __tests__
│   │   │   │   │       │   └── logger.test.ts
│   │   │   │   │       ├── index.ts
│   │   │   │   │       ├── logger.ts
│   │   │   │   │       ├── transports
│   │   │   │   │       │   ├── __tests__
│   │   │   │   │       │   │   └── telemetry.test.ts
│   │   │   │   │       │   ├── composite.ts
│   │   │   │   │       │   ├── console.ts
│   │   │   │   │       │   └── telemetry.ts
│   │   │   │   │       └── types.ts
│   │   │   │   ├── query-core.ts
│   │   │   │   ├── resources
│   │   │   │   │   ├── __tests__
│   │   │   │   │   │   ├── AuthConfig.test.ts
│   │   │   │   │   │   ├── Base.test.ts
│   │   │   │   │   │   ├── Client.test.ts
│   │   │   │   │   │   ├── Environment.test.ts
│   │   │   │   │   │   ├── ExternalAccount.test.ts
│   │   │   │   │   │   ├── Image.test.ts
│   │   │   │   │   │   ├── Organization.test.ts
│   │   │   │   │   │   ├── OrganizationDomain.test.ts
│   │   │   │   │   │   ├── OrganizationInvitation.test.ts
│   │   │   │   │   │   ├── OrganizationMembership.test.ts
│   │   │   │   │   │   ├── OrganizationMembershipRequest.test.ts
│   │   │   │   │   │   ├── OrganizationSuggestion.test.ts
│   │   │   │   │   │   ├── PublicUserData.test.ts
│   │   │   │   │   │   ├── Session.test.ts
│   │   │   │   │   │   ├── SignIn.test.ts
│   │   │   │   │   │   ├── Token.test.ts
│   │   │   │   │   │   ├── User.test.ts
│   │   │   │   │   │   ├── UserSettings.test.ts
│   │   │   │   │   │   ├── Waitlist.test.ts
│   │   │   │   │   │   └── Web3Wallet.test.ts
│   │   │   │   │   ├── APIKey.ts
│   │   │   │   │   ├── APIKeySettings.ts
│   │   │   │   │   ├── AuthConfig.ts
│   │   │   │   │   ├── BackupCode.ts
│   │   │   │   │   ├── Base.ts
│   │   │   │   │   ├── BillingCheckout.ts
│   │   │   │   │   ├── BillingPayer.ts
│   │   │   │   │   ├── BillingPayment.ts
│   │   │   │   │   ├── BillingPaymentMethod.ts
│   │   │   │   │   ├── BillingPlan.ts
│   │   │   │   │   ├── BillingStatement.ts
│   │   │   │   │   ├── BillingSubscription.ts
│   │   │   │   │   ├── Client.ts
│   │   │   │   │   ├── CommerceSettings.ts
│   │   │   │   │   ├── DeletedObject.ts
│   │   │   │   │   ├── DisplayConfig.ts
│   │   │   │   │   ├── EmailAddress.ts
│   │   │   │   │   ├── EnterpriseAccount.ts
│   │   │   │   │   ├── Environment.ts
│   │   │   │   │   ├── ExternalAccount.ts
│   │   │   │   │   ├── Feature.ts
│   │   │   │   │   ├── IdentificationLink.ts
│   │   │   │   │   ├── Image.ts
│   │   │   │   │   ├── index.ts
│   │   │   │   │   ├── internal.ts
│   │   │   │   │   ├── Organization.ts
│   │   │   │   │   ├── OrganizationDomain.ts
│   │   │   │   │   ├── OrganizationInvitation.ts
│   │   │   │   │   ├── OrganizationMembership.ts
│   │   │   │   │   ├── OrganizationMembershipRequest.ts
│   │   │   │   │   ├── OrganizationSettings.ts
│   │   │   │   │   ├── OrganizationSuggestion.ts
│   │   │   │   │   ├── Passkey.ts
│   │   │   │   │   ├── Permission.ts
│   │   │   │   │   ├── PhoneNumber.ts
│   │   │   │   │   ├── PublicUserData.ts
│   │   │   │   │   ├── Role.ts
│   │   │   │   │   ├── SamlAccount.ts
│   │   │   │   │   ├── Session.ts
│   │   │   │   │   ├── SessionVerification.ts
│   │   │   │   │   ├── SessionWithActivities.ts
│   │   │   │   │   ├── SignIn.ts
│   │   │   │   │   ├── SignUp.ts
│   │   │   │   │   ├── Token.ts
│   │   │   │   │   ├── TOTP.ts
│   │   │   │   │   ├── User.ts
│   │   │   │   │   ├── UserData.ts
│   │   │   │   │   ├── UserOrganizationInvitation.ts
│   │   │   │   │   ├── UserSettings.ts
│   │   │   │   │   ├── Verification.ts
│   │   │   │   │   ├── Waitlist.ts
│   │   │   │   │   └── Web3Wallet.ts
│   │   │   │   ├── sessionTasks.ts
│   │   │   │   ├── signals.ts
│   │   │   │   ├── state.ts
│   │   │   │   ├── tokenCache.ts
│   │   │   │   └── warnings.ts
│   │   │   ├── emotion.d.ts
│   │   │   ├── global.d.ts
│   │   │   ├── index.browser.ts
│   │   │   ├── index.headless.browser.ts
│   │   │   ├── index.headless.ts
│   │   │   ├── index.legacy.browser.ts
│   │   │   ├── index.ts
│   │   │   ├── test
│   │   │   │   ├── core-fixtures.ts
│   │   │   │   ├── create-fixtures.tsx
│   │   │   │   ├── fixture-helpers.ts
│   │   │   │   ├── fixtures.ts
│   │   │   │   ├── mock-helpers.ts
│   │   │   │   └── utils.ts
│   │   │   ├── ui
│   │   │   │   ├── baseTheme.ts
│   │   │   │   ├── common
│   │   │   │   │   ├── __tests__
│   │   │   │   │   │   ├── redirects.test.ts
│   │   │   │   │   │   ├── verification.test.ts
│   │   │   │   │   │   └── withRedirect.test.tsx
│   │   │   │   │   ├── CalloutWithAction.tsx
│   │   │   │   │   ├── ChooseEnterpriseConnectionCard.tsx
│   │   │   │   │   ├── constants.ts
│   │   │   │   │   ├── CustomPageContentContainer.tsx
│   │   │   │   │   ├── DevOnly.tsx
│   │   │   │   │   ├── EmailLinkCompleteFlowCard.tsx
│   │   │   │   │   ├── EmailLinkStatusCard.tsx
│   │   │   │   │   ├── EmailLinkVerify.tsx
│   │   │   │   │   ├── forms.ts
│   │   │   │   │   ├── Gate.tsx
│   │   │   │   │   ├── index.ts
│   │   │   │   │   ├── InfiniteListSpinner.tsx
│   │   │   │   │   ├── NotificationCountBadge.tsx
│   │   │   │   │   ├── organizations
│   │   │   │   │   │   └── OrganizationPreview.tsx
│   │   │   │   │   ├── PrintableComponent.tsx
│   │   │   │   │   ├── ProviderInitialIcon.tsx
│   │   │   │   │   ├── QRCode.tsx
│   │   │   │   │   ├── redirects.ts
│   │   │   │   │   ├── RemoveResourceForm.tsx
│   │   │   │   │   ├── SSOCallback.tsx
│   │   │   │   │   ├── verification.ts
│   │   │   │   │   ├── withRedirect.tsx
│   │   │   │   │   └── Wizard.tsx
│   │   │   │   ├── components
│   │   │   │   │   ├── ApiKeys
│   │   │   │   │   │   ├── __tests__
│   │   │   │   │   │   │   └── ApiKeys.spec.tsx
│   │   │   │   │   │   ├── APIKeyModal.tsx
│   │   │   │   │   │   ├── ApiKeys.tsx
│   │   │   │   │   │   ├── APIKeysTable.tsx
│   │   │   │   │   │   ├── CopyAPIKeyModal.tsx
│   │   │   │   │   │   ├── CreateAPIKeyForm.tsx
│   │   │   │   │   │   ├── RevokeAPIKeyConfirmationModal.tsx
│   │   │   │   │   │   └── utils.ts
│   │   │   │   │   ├── BlankCaptchaModal
│   │   │   │   │   │   └── index.tsx
│   │   │   │   │   ├── Checkout
│   │   │   │   │   │   ├── __tests__
│   │   │   │   │   │   │   └── Checkout.test.tsx
│   │   │   │   │   │   ├── CheckoutComplete.tsx
│   │   │   │   │   │   ├── CheckoutForm.tsx
│   │   │   │   │   │   ├── CheckoutPage.tsx
│   │   │   │   │   │   ├── index.tsx
│   │   │   │   │   │   └── parts.tsx
│   │   │   │   │   ├── CreateOrganization
│   │   │   │   │   │   ├── __tests__
│   │   │   │   │   │   │   └── CreateOrganization.test.tsx
│   │   │   │   │   │   ├── CreateOrganization.tsx
│   │   │   │   │   │   ├── CreateOrganizationForm.tsx
│   │   │   │   │   │   ├── CreateOrganizationPage.tsx
│   │   │   │   │   │   └── index.tsx
│   │   │   │   │   ├── GoogleOneTap
│   │   │   │   │   │   ├── index.tsx
│   │   │   │   │   │   └── one-tap-start.tsx
│   │   │   │   │   ├── ImpersonationFab
│   │   │   │   │   │   └── index.tsx
│   │   │   │   │   ├── KeylessPrompt
│   │   │   │   │   │   ├── ClerkLogoIcon.tsx
│   │   │   │   │   │   ├── index.tsx
│   │   │   │   │   │   ├── KeySlashIcon.tsx
│   │   │   │   │   │   └── use-revalidate-environment.ts
│   │   │   │   │   ├── OAuthConsent
│   │   │   │   │   │   └── OAuthConsent.tsx
│   │   │   │   │   ├── OrganizationList
│   │   │   │   │   │   ├── __tests__
│   │   │   │   │   │   │   └── OrganizationList.test.tsx
│   │   │   │   │   │   ├── index.tsx
│   │   │   │   │   │   ├── OrganizationListPage.tsx
│   │   │   │   │   │   ├── shared.tsx
│   │   │   │   │   │   ├── UserInvitationList.tsx
│   │   │   │   │   │   ├── UserMembershipList.tsx
│   │   │   │   │   │   ├── UserSuggestionList.tsx
│   │   │   │   │   │   └── utils.ts
│   │   │   │   │   ├── OrganizationProfile
│   │   │   │   │   │   ├── __tests__
│   │   │   │   │   │   │   ├── InviteMembersPage.test.tsx
│   │   │   │   │   │   │   ├── LeaveOrganizationPage.test.tsx
│   │   │   │   │   │   │   ├── OrganizationGeneralPage.test.tsx
│   │   │   │   │   │   │   ├── OrganizationMembers.test.tsx
│   │   │   │   │   │   │   ├── OrganizationProfile.test.tsx
│   │   │   │   │   │   │   ├── ProfileSettingsPage.test.tsx
│   │   │   │   │   │   │   └── utils.ts
│   │   │   │   │   │   ├── ActionConfirmationPage.tsx
│   │   │   │   │   │   ├── ActiveMembersList.tsx
│   │   │   │   │   │   ├── AddDomainForm.tsx
│   │   │   │   │   │   ├── BillingWidget.tsx
│   │   │   │   │   │   ├── DomainList.tsx
│   │   │   │   │   │   ├── EnrollmentBadge.tsx
│   │   │   │   │   │   ├── index.tsx
│   │   │   │   │   │   ├── InvitedMembersList.tsx
│   │   │   │   │   │   ├── InviteMembersForm.tsx
│   │   │   │   │   │   ├── InviteMembersScreen.tsx
│   │   │   │   │   │   ├── MemberListTable.tsx
│   │   │   │   │   │   ├── MembersActions.tsx
│   │   │   │   │   │   ├── MembershipWidget.tsx
│   │   │   │   │   │   ├── MembersSearch.tsx
│   │   │   │   │   │   ├── OrganizationApiKeysPage.tsx
│   │   │   │   │   │   ├── OrganizationBillingPage.tsx
│   │   │   │   │   │   ├── OrganizationGeneralPage.tsx
│   │   │   │   │   │   ├── OrganizationMembers.tsx
│   │   │   │   │   │   ├── OrganizationMembersTabInvitations.tsx
│   │   │   │   │   │   ├── OrganizationMembersTabRequests.tsx
│   │   │   │   │   │   ├── OrganizationPaymentAttemptPage.tsx
│   │   │   │   │   │   ├── OrganizationPlansPage.tsx
│   │   │   │   │   │   ├── OrganizationProfileAvatarUploader.tsx
│   │   │   │   │   │   ├── OrganizationProfileNavbar.tsx
│   │   │   │   │   │   ├── OrganizationProfileRoutes.tsx
│   │   │   │   │   │   ├── OrganizationStatementPage.tsx
│   │   │   │   │   │   ├── ProfileForm.tsx
│   │   │   │   │   │   ├── RemoveDomainForm.tsx
│   │   │   │   │   │   ├── RemoveDomainScreen.tsx
│   │   │   │   │   │   ├── RequestToJoinList.tsx
│   │   │   │   │   │   ├── VerifiedDomainForm.tsx
│   │   │   │   │   │   ├── VerifiedDomainScreen.tsx
│   │   │   │   │   │   ├── VerifyDomainForm.tsx
│   │   │   │   │   │   └── VerifyDomainScreen.tsx
│   │   │   │   │   ├── OrganizationSwitcher
│   │   │   │   │   │   ├── __tests__
│   │   │   │   │   │   │   ├── OrganizationSwitcher.test.tsx
│   │   │   │   │   │   │   ├── test-utils.ts
│   │   │   │   │   │   │   └── utils.test.ts
│   │   │   │   │   │   ├── index.tsx
│   │   │   │   │   │   ├── OrganizationSwitcherPopover.tsx
│   │   │   │   │   │   ├── OrganizationSwitcherTrigger.tsx
│   │   │   │   │   │   ├── OtherOrganizationActions.tsx
│   │   │   │   │   │   ├── UserInvitationSuggestionList.tsx
│   │   │   │   │   │   ├── UserMembershipList.tsx
│   │   │   │   │   │   └── utils.ts
│   │   │   │   │   ├── PaymentAttempts
│   │   │   │   │   │   ├── index.ts
│   │   │   │   │   │   ├── PaymentAttemptPage.tsx
│   │   │   │   │   │   └── PaymentAttemptsList.tsx
│   │   │   │   │   ├── PaymentMethods
│   │   │   │   │   │   ├── AddPaymentMethod.tsx
│   │   │   │   │   │   ├── index.ts
│   │   │   │   │   │   ├── PaymentElementSkeleton.tsx
│   │   │   │   │   │   ├── PaymentMethodRow.tsx
│   │   │   │   │   │   ├── PaymentMethods.tsx
│   │   │   │   │   │   └── TestPaymentMethod.tsx
│   │   │   │   │   ├── Plans
│   │   │   │   │   │   ├── __tests__
│   │   │   │   │   │   │   └── PlanDetails.test.tsx
│   │   │   │   │   │   └── PlanDetails.tsx
│   │   │   │   │   ├── prefetch-organization-list.tsx
│   │   │   │   │   ├── PricingTable
│   │   │   │   │   │   ├── __tests__
│   │   │   │   │   │   │   └── PricingTable.test.tsx
│   │   │   │   │   │   ├── index.tsx
│   │   │   │   │   │   ├── PricingTable.tsx
│   │   │   │   │   │   ├── PricingTableDefault.tsx
│   │   │   │   │   │   ├── PricingTableMatrix.tsx
│   │   │   │   │   │   └── utils
│   │   │   │   │   │       ├── pricing-footer-state.spec.ts
│   │   │   │   │   │       └── pricing-footer-state.ts
│   │   │   │   │   ├── SessionTasks
│   │   │   │   │   │   ├── index.tsx
│   │   │   │   │   │   └── tasks
│   │   │   │   │   │       ├── TaskChooseOrganization
│   │   │   │   │   │       │   ├── __tests__
│   │   │   │   │   │       │   │   └── TaskChooseOrganization.test.tsx
│   │   │   │   │   │       │   ├── ChooseOrganizationScreen.tsx
│   │   │   │   │   │       │   ├── CreateOrganizationScreen.tsx
│   │   │   │   │   │       │   └── index.tsx
│   │   │   │   │   │       └── withTaskGuard.ts
│   │   │   │   │   ├── SignIn
│   │   │   │   │   │   ├── __tests__
│   │   │   │   │   │   │   ├── handleCombinedFlowTransfer.test.ts
│   │   │   │   │   │   │   ├── ResetPassword.test.tsx
│   │   │   │   │   │   │   ├── ResetPasswordSuccess.test.tsx
│   │   │   │   │   │   │   ├── SignInAccountSwitcher.test.tsx
│   │   │   │   │   │   │   ├── SignInFactorOne.test.tsx
│   │   │   │   │   │   │   ├── SignInFactorOneCodeForm.test.tsx
│   │   │   │   │   │   │   ├── SignInFactorTwo.test.tsx
│   │   │   │   │   │   │   ├── SignInStart.test.tsx
│   │   │   │   │   │   │   └── utils.test.ts
│   │   │   │   │   │   ├── AlternativeMethods.tsx
│   │   │   │   │   │   ├── handleCombinedFlowTransfer.ts
│   │   │   │   │   │   ├── HavingTrouble.tsx
│   │   │   │   │   │   ├── index.tsx
│   │   │   │   │   │   ├── lazy-sign-up.ts
│   │   │   │   │   │   ├── ResetPassword.tsx
│   │   │   │   │   │   ├── ResetPasswordSuccess.tsx
│   │   │   │   │   │   ├── shared.ts
│   │   │   │   │   │   ├── SignInAccountSwitcher.tsx
│   │   │   │   │   │   ├── SignInAlternativePhoneCodePhoneNumberCard.tsx
│   │   │   │   │   │   ├── SignInFactorOne.tsx
│   │   │   │   │   │   ├── SignInFactorOneAlternativeChannelCodeForm.tsx
│   │   │   │   │   │   ├── SignInFactorOneAlternativePhoneCodeCard.tsx
│   │   │   │   │   │   ├── SignInFactorOneCodeForm.tsx
│   │   │   │   │   │   ├── SignInFactorOneEmailCodeCard.tsx
│   │   │   │   │   │   ├── SignInFactorOneEmailLinkCard.tsx
│   │   │   │   │   │   ├── SignInFactorOneEnterpriseConnections.tsx
│   │   │   │   │   │   ├── SignInFactorOneForgotPasswordCard.tsx
│   │   │   │   │   │   ├── SignInFactorOnePasskey.tsx
│   │   │   │   │   │   ├── SignInFactorOnePasswordCard.tsx
│   │   │   │   │   │   ├── SignInFactorOnePhoneCodeCard.tsx
│   │   │   │   │   │   ├── SignInFactorTwo.tsx
│   │   │   │   │   │   ├── SignInFactorTwoAlternativeMethods.tsx
│   │   │   │   │   │   ├── SignInFactorTwoBackupCodeCard.tsx
│   │   │   │   │   │   ├── SignInFactorTwoCodeForm.tsx
│   │   │   │   │   │   ├── SignInFactorTwoPhoneCodeCard.tsx
│   │   │   │   │   │   ├── SignInFactorTwoTOTPCard.tsx
│   │   │   │   │   │   ├── SignInSocialButtons.tsx
│   │   │   │   │   │   ├── SignInSSOCallback.tsx
│   │   │   │   │   │   ├── SignInStart.tsx
│   │   │   │   │   │   ├── useResetPasswordFactor.tsx
│   │   │   │   │   │   ├── utils.ts
│   │   │   │   │   │   └── withHavingTrouble.tsx
│   │   │   │   │   ├── SignUp
│   │   │   │   │   │   ├── __tests__
│   │   │   │   │   │   │   ├── SignUpContinue.test.tsx
│   │   │   │   │   │   │   ├── SignUpEmailLinkFlowComplete.test.tsx
│   │   │   │   │   │   │   ├── signUpFormHelpers.test.ts
│   │   │   │   │   │   │   ├── SignUpStart.test.tsx
│   │   │   │   │   │   │   ├── SignUpVerifyEmail.test.tsx
│   │   │   │   │   │   │   └── SignUpVerifyPhone.test.tsx
│   │   │   │   │   │   ├── index.tsx
│   │   │   │   │   │   ├── SignUpContinue.tsx
│   │   │   │   │   │   ├── SignUpEmailCodeCard.tsx
│   │   │   │   │   │   ├── SignUpEmailLinkCard.tsx
│   │   │   │   │   │   ├── SignUpEnterpriseConnections.tsx
│   │   │   │   │   │   ├── SignUpForm.tsx
│   │   │   │   │   │   ├── signUpFormHelpers.ts
│   │   │   │   │   │   ├── SignUpPhoneCodeCard.tsx
│   │   │   │   │   │   ├── SignUpRestrictedAccess.tsx
│   │   │   │   │   │   ├── SignUpSocialButtons.tsx
│   │   │   │   │   │   ├── SignUpSSOCallback.tsx
│   │   │   │   │   │   ├── SignUpStart.tsx
│   │   │   │   │   │   ├── SignUpStartAlternativePhoneCodePhoneNumberCard.tsx
│   │   │   │   │   │   ├── SignUpVerificationCodeForm.tsx
│   │   │   │   │   │   ├── SignUpVerifyEmail.tsx
│   │   │   │   │   │   ├── SignUpVerifyPhone.tsx
│   │   │   │   │   │   └── util.ts
│   │   │   │   │   ├── Statements
│   │   │   │   │   │   ├── index.ts
│   │   │   │   │   │   ├── Statement.tsx
│   │   │   │   │   │   ├── StatementPage.tsx
│   │   │   │   │   │   └── StatementsList.tsx
│   │   │   │   │   ├── SubscriptionDetails
│   │   │   │   │   │   ├── __tests__
│   │   │   │   │   │   │   └── SubscriptionDetails.test.tsx
│   │   │   │   │   │   └── index.tsx
│   │   │   │   │   ├── Subscriptions
│   │   │   │   │   │   ├── __tests__
│   │   │   │   │   │   │   └── SubscriptionsList.test.tsx
│   │   │   │   │   │   ├── badge.tsx
│   │   │   │   │   │   ├── index.tsx
│   │   │   │   │   │   └── SubscriptionsList.tsx
│   │   │   │   │   ├── UserAvatar
│   │   │   │   │   │   └── index.tsx
│   │   │   │   │   ├── UserButton
│   │   │   │   │   │   ├── __tests__
│   │   │   │   │   │   │   └── UserButton.test.tsx
│   │   │   │   │   │   ├── index.tsx
│   │   │   │   │   │   ├── SessionActions.tsx
│   │   │   │   │   │   ├── useMultisessionActions.tsx
│   │   │   │   │   │   ├── UserButtonPopover.tsx
│   │   │   │   │   │   ├── UserButtonTopLevelIdentifier.tsx
│   │   │   │   │   │   └── UserButtonTrigger.tsx
│   │   │   │   │   ├── UserProfile
│   │   │   │   │   │   ├── __tests__
│   │   │   │   │   │   │   ├── AccountPage.test.tsx
│   │   │   │   │   │   │   ├── ConnectedAccountsSection.test.tsx
│   │   │   │   │   │   │   ├── EmailsSection.test.tsx
│   │   │   │   │   │   │   ├── EnterpriseAccountsSection.test.tsx
│   │   │   │   │   │   │   ├── MfaPage.test.tsx
│   │   │   │   │   │   │   ├── PasskeysSection.test.tsx
│   │   │   │   │   │   │   ├── PasswordSection.test.tsx
│   │   │   │   │   │   │   ├── PhoneSection.test.tsx
│   │   │   │   │   │   │   ├── SecurityPage.test.tsx
│   │   │   │   │   │   │   ├── UsernameSection.test.tsx
│   │   │   │   │   │   │   ├── UserProfile.test.tsx
│   │   │   │   │   │   │   ├── UserProfileSection.test.tsx
│   │   │   │   │   │   │   └── utils.test.ts
│   │   │   │   │   │   ├── AccountPage.tsx
│   │   │   │   │   │   ├── ActiveDevicesSection.tsx
│   │   │   │   │   │   ├── AddAuthenticatorApp.tsx
│   │   │   │   │   │   ├── ApiKeysPage.tsx
│   │   │   │   │   │   ├── BillingPage.tsx
│   │   │   │   │   │   ├── ConnectedAccountsMenu.tsx
│   │   │   │   │   │   ├── ConnectedAccountsSection.tsx
│   │   │   │   │   │   ├── DeleteSection.tsx
│   │   │   │   │   │   ├── DeleteUserForm.tsx
│   │   │   │   │   │   ├── EmailForm.tsx
│   │   │   │   │   │   ├── EmailsSection.tsx
│   │   │   │   │   │   ├── EnterpriseAccountsSection.tsx
│   │   │   │   │   │   ├── index.tsx
│   │   │   │   │   │   ├── LinkButtonWithDescription.tsx
│   │   │   │   │   │   ├── MfaBackupCodeCreateForm.tsx
│   │   │   │   │   │   ├── MfaBackupCodeList.tsx
│   │   │   │   │   │   ├── MfaBackupCodeScreen.tsx
│   │   │   │   │   │   ├── MfaBackupCodeTile.tsx
│   │   │   │   │   │   ├── MfaForm.tsx
│   │   │   │   │   │   ├── MfaPhoneCodeScreen.tsx
│   │   │   │   │   │   ├── MfaScreens.tsx
│   │   │   │   │   │   ├── MfaSection.tsx
│   │   │   │   │   │   ├── MfaTOTPScreen.tsx
│   │   │   │   │   │   ├── PasskeySection.tsx
│   │   │   │   │   │   ├── PasswordForm.tsx
│   │   │   │   │   │   ├── PasswordSection.tsx
│   │   │   │   │   │   ├── PhoneForm.tsx
│   │   │   │   │   │   ├── PhoneSection.tsx
│   │   │   │   │   │   ├── PlansPage.tsx
│   │   │   │   │   │   ├── ProfileForm.tsx
│   │   │   │   │   │   ├── RemoveResourceForm.tsx
│   │   │   │   │   │   ├── SecurityPage.tsx
│   │   │   │   │   │   ├── UsernameForm.tsx
│   │   │   │   │   │   ├── UsernameSection.tsx
│   │   │   │   │   │   ├── UserProfileAvatarUploader.tsx
│   │   │   │   │   │   ├── UserProfileNavbar.tsx
│   │   │   │   │   │   ├── UserProfileRoutes.tsx
│   │   │   │   │   │   ├── UserProfileSection.tsx
│   │   │   │   │   │   ├── utils.ts
│   │   │   │   │   │   ├── VerifyTOTP.tsx
│   │   │   │   │   │   ├── VerifyWithCode.tsx
│   │   │   │   │   │   ├── VerifyWithEnterpriseConnection.tsx
│   │   │   │   │   │   ├── VerifyWithLink.tsx
│   │   │   │   │   │   ├── Web3Form.tsx
│   │   │   │   │   │   └── Web3Section.tsx
│   │   │   │   │   ├── UserVerification
│   │   │   │   │   │   ├── __tests__
│   │   │   │   │   │   │   ├── UVFactorOne.test.tsx
│   │   │   │   │   │   │   └── UVFactorTwo.test.tsx
│   │   │   │   │   │   ├── AlternativeMethods.tsx
│   │   │   │   │   │   ├── HavingTrouble.tsx
│   │   │   │   │   │   ├── index.tsx
│   │   │   │   │   │   ├── use-after-verification.ts
│   │   │   │   │   │   ├── useReverificationAlternativeStrategies.ts
│   │   │   │   │   │   ├── UserVerificationFactorOne.tsx
│   │   │   │   │   │   ├── UserVerificationFactorOnePassword.tsx
│   │   │   │   │   │   ├── UserVerificationFactorTwo.tsx
│   │   │   │   │   │   ├── UserVerificationFactorTwoTOTP.tsx
│   │   │   │   │   │   ├── useUserVerificationSession.tsx
│   │   │   │   │   │   ├── utils.ts
│   │   │   │   │   │   ├── UVFactorOneCodeForm.tsx
│   │   │   │   │   │   ├── UVFactorOneEmailCodeCard.tsx
│   │   │   │   │   │   ├── UVFactorOnePasskeysCard.tsx
│   │   │   │   │   │   ├── UVFactorOnePhoneCodeCard.tsx
│   │   │   │   │   │   ├── UVFactorTwoAlternativeMethods.tsx
│   │   │   │   │   │   ├── UVFactorTwoBackupCodeCard.tsx
│   │   │   │   │   │   ├── UVFactorTwoCodeForm.tsx
│   │   │   │   │   │   ├── UVFactorTwoPhoneCodeCard.tsx
│   │   │   │   │   │   └── withHavingTrouble.tsx
│   │   │   │   │   └── Waitlist
│   │   │   │   │       ├── __tests__
│   │   │   │   │       │   └── Waitlist.test.tsx
│   │   │   │   │       ├── index.tsx
│   │   │   │   │       ├── WaitlistForm.tsx
│   │   │   │   │       └── waitlistFormHelpers.ts
│   │   │   │   ├── Components.tsx
│   │   │   │   ├── constants.ts
│   │   │   │   ├── contexts
│   │   │   │   │   ├── AcceptedUserInvitations.tsx
│   │   │   │   │   ├── ClerkUIComponentsContext.tsx
│   │   │   │   │   ├── components
│   │   │   │   │   │   ├── ApiKeys.ts
│   │   │   │   │   │   ├── Checkout.ts
│   │   │   │   │   │   ├── CreateOrganization.ts
│   │   │   │   │   │   ├── GoogleOneTap.ts
│   │   │   │   │   │   ├── index.ts
│   │   │   │   │   │   ├── OAuthConsent.ts
│   │   │   │   │   │   ├── OrganizationList.ts
│   │   │   │   │   │   ├── OrganizationProfile.ts
│   │   │   │   │   │   ├── OrganizationSwitcher.ts
│   │   │   │   │   │   ├── Plans.tsx
│   │   │   │   │   │   ├── PricingTable.ts
│   │   │   │   │   │   ├── SessionTasks.ts
│   │   │   │   │   │   ├── SignIn.ts
│   │   │   │   │   │   ├── SignOut.ts
│   │   │   │   │   │   ├── SignUp.ts
│   │   │   │   │   │   ├── SubscriberType.ts
│   │   │   │   │   │   ├── SubscriptionDetails.ts
│   │   │   │   │   │   ├── UserAvatar.ts
│   │   │   │   │   │   ├── UserButton.ts
│   │   │   │   │   │   ├── UserProfile.ts
│   │   │   │   │   │   ├── UserVerification.ts
│   │   │   │   │   │   └── Waitlist.ts
│   │   │   │   │   ├── CoreClerkContextWrapper.tsx
│   │   │   │   │   ├── CoreClientContext.tsx
│   │   │   │   │   ├── CoreSessionContext.tsx
│   │   │   │   │   ├── CoreUserContext.tsx
│   │   │   │   │   ├── EnvironmentContext.tsx
│   │   │   │   │   ├── index.ts
│   │   │   │   │   ├── OptionsContext.tsx
│   │   │   │   │   └── utils.ts
│   │   │   │   ├── customizables
│   │   │   │   │   ├── __tests__
│   │   │   │   │   │   ├── elementDescriptors.test.tsx
│   │   │   │   │   │   ├── FlowRoot.spec.tsx
│   │   │   │   │   │   ├── makeCustomizable.test.tsx
│   │   │   │   │   │   ├── parseAppearance.test.tsx
│   │   │   │   │   │   ├── parseVariables.test.ts
│   │   │   │   │   │   └── test-utils.ts
│   │   │   │   │   ├── AppearanceContext.tsx
│   │   │   │   │   ├── classGeneration.ts
│   │   │   │   │   ├── elementDescriptors.ts
│   │   │   │   │   ├── Flow.tsx
│   │   │   │   │   ├── index.ts
│   │   │   │   │   ├── makeCustomizable.tsx
│   │   │   │   │   ├── makeResponsive.tsx
│   │   │   │   │   ├── parseAppearance.ts
│   │   │   │   │   ├── parseVariables.ts
│   │   │   │   │   └── sanitizeDomProps.tsx
│   │   │   │   ├── elements
│   │   │   │   │   ├── __mocks__
│   │   │   │   │   │   └── @formkit
│   │   │   │   │   │       └── auto-animate
│   │   │   │   │   │           └── react
│   │   │   │   │   │               └── index.ts
│   │   │   │   │   ├── __tests__
│   │   │   │   │   │   ├── CodeControl.test.tsx
│   │   │   │   │   │   ├── LinkRenderer.test.tsx
│   │   │   │   │   │   ├── PlainInput.test.tsx
│   │   │   │   │   │   ├── RadioGroup.test.tsx
│   │   │   │   │   │   └── TimerButton.test.tsx
│   │   │   │   │   ├── Action
│   │   │   │   │   │   ├── ActionCard.tsx
│   │   │   │   │   │   ├── ActionClosed.tsx
│   │   │   │   │   │   ├── ActionOpen.tsx
│   │   │   │   │   │   ├── ActionRoot.tsx
│   │   │   │   │   │   ├── ActionTrigger.tsx
│   │   │   │   │   │   └── index.tsx
│   │   │   │   │   ├── Actions.tsx
│   │   │   │   │   ├── Alert.tsx
│   │   │   │   │   ├── Animated.tsx
│   │   │   │   │   ├── ApplicationLogo.tsx
│   │   │   │   │   ├── ArrowBlockButton.tsx
│   │   │   │   │   ├── Avatar.tsx
│   │   │   │   │   ├── AvatarUploader.tsx
│   │   │   │   │   ├── BackLink.tsx
│   │   │   │   │   ├── Badge.tsx
│   │   │   │   │   ├── CaptchaElement.tsx
│   │   │   │   │   ├── Card
│   │   │   │   │   │   ├── CardAction.tsx
│   │   │   │   │   │   ├── CardAlert.tsx
│   │   │   │   │   │   ├── CardClerkAndPagesTag.tsx
│   │   │   │   │   │   ├── CardContent.tsx
│   │   │   │   │   │   ├── CardFooter.tsx
│   │   │   │   │   │   ├── CardRoot.tsx
│   │   │   │   │   │   └── index.ts
│   │   │   │   │   ├── ClipboardInput.tsx
│   │   │   │   │   ├── CodeControl.tsx
│   │   │   │   │   ├── contexts
│   │   │   │   │   │   └── index.tsx
│   │   │   │   │   ├── DataTable.tsx
│   │   │   │   │   ├── DevModeNotice.tsx
│   │   │   │   │   ├── Divider.tsx
│   │   │   │   │   ├── Drawer.tsx
│   │   │   │   │   ├── ErrorCard.tsx
│   │   │   │   │   ├── FieldControl.tsx
│   │   │   │   │   ├── Form.tsx
│   │   │   │   │   ├── FormattedPhoneNumber.tsx
│   │   │   │   │   ├── FormButtons.tsx
│   │   │   │   │   ├── FormContainer.tsx
│   │   │   │   │   ├── FormControl.tsx
│   │   │   │   │   ├── FullHeightLoader.tsx
│   │   │   │   │   ├── Gauge.tsx
│   │   │   │   │   ├── Header.tsx
│   │   │   │   │   ├── IconButton.tsx
│   │   │   │   │   ├── IconCircle.tsx
│   │   │   │   │   ├── IdentityPreview.tsx
│   │   │   │   │   ├── InformationBox.tsx
│   │   │   │   │   ├── InputGroup.tsx
│   │   │   │   │   ├── InputWithIcon.tsx
│   │   │   │   │   ├── InvisibleRootBox.tsx
│   │   │   │   │   ├── LegalConsentCheckbox.tsx
│   │   │   │   │   ├── LineItems.tsx
│   │   │   │   │   ├── LinkRenderer.tsx
│   │   │   │   │   ├── LoadingCard.tsx
│   │   │   │   │   ├── Menu.tsx
│   │   │   │   │   ├── Modal.tsx
│   │   │   │   │   ├── Navbar.tsx
│   │   │   │   │   ├── OrganizationAvatar.tsx
│   │   │   │   │   ├── OrganizationPreview.tsx
│   │   │   │   │   ├── Pagination.tsx
│   │   │   │   │   ├── PasswordInput.tsx
│   │   │   │   │   ├── PersonalWorkspacePreview.tsx
│   │   │   │   │   ├── PhoneInput
│   │   │   │   │   │   ├── __tests__
│   │   │   │   │   │   │   └── useFormattedPhoneNumber.test.ts
│   │   │   │   │   │   ├── countryCodeData.ts
│   │   │   │   │   │   ├── index.tsx
│   │   │   │   │   │   └── useFormattedPhoneNumber.ts
│   │   │   │   │   ├── Popover.tsx
│   │   │   │   │   ├── PopoverCard.tsx
│   │   │   │   │   ├── Portal.tsx
│   │   │   │   │   ├── PreviewButton.tsx
│   │   │   │   │   ├── ProfileCard
│   │   │   │   │   │   ├── index.ts
│   │   │   │   │   │   ├── ProfileCardContent.tsx
│   │   │   │   │   │   └── ProfileCardRoot.tsx
│   │   │   │   │   ├── RadioGroup.tsx
│   │   │   │   │   ├── ReversibleContainer.tsx
│   │   │   │   │   ├── RootBox.tsx
│   │   │   │   │   ├── RouterLink.tsx
│   │   │   │   │   ├── Section.tsx
│   │   │   │   │   ├── SegmentedControl.tsx
│   │   │   │   │   ├── Select.tsx
│   │   │   │   │   ├── SocialButtons.tsx
│   │   │   │   │   ├── SuccessPage.tsx
│   │   │   │   │   ├── Switch.tsx
│   │   │   │   │   ├── Tabs.tsx
│   │   │   │   │   ├── TagInput.tsx
│   │   │   │   │   ├── ThreeDotsMenu.tsx
│   │   │   │   │   ├── TimerButton.tsx
│   │   │   │   │   ├── Tooltip.tsx
│   │   │   │   │   ├── UserAvatar.tsx
│   │   │   │   │   ├── UserPreview.tsx
│   │   │   │   │   ├── utils.ts
│   │   │   │   │   ├── VerificationCodeCard.tsx
│   │   │   │   │   ├── VerificationLinkCard.tsx
│   │   │   │   │   └── withAvatarShimmer.tsx
│   │   │   │   ├── foundations
│   │   │   │   │   ├── __tests__
│   │   │   │   │   │   └── createInternalTheme.test.ts
│   │   │   │   │   ├── borders.ts
│   │   │   │   │   ├── colors.ts
│   │   │   │   │   ├── createInternalTheme.ts
│   │   │   │   │   ├── defaultFoundations.ts
│   │   │   │   │   ├── index.ts
│   │   │   │   │   ├── opacity.ts
│   │   │   │   │   ├── shadows.ts
│   │   │   │   │   ├── sizes.ts
│   │   │   │   │   ├── transitions.ts
│   │   │   │   │   ├── typography.ts
│   │   │   │   │   └── zIndices.ts
│   │   │   │   ├── hooks
│   │   │   │   │   ├── __tests__
│   │   │   │   │   │   ├── useCoreOrganization.test.tsx
│   │   │   │   │   │   ├── useCoreOrganizationList.test.tsx
│   │   │   │   │   │   ├── useDevMode.test.tsx
│   │   │   │   │   │   ├── useDirection.test.ts
│   │   │   │   │   │   ├── useEnabledThirdPartyProviders.test.tsx
│   │   │   │   │   │   ├── usePasswordComplexity.test.tsx
│   │   │   │   │   │   └── useSupportEmail.test.tsx
│   │   │   │   │   ├── index.ts
│   │   │   │   │   ├── useAlternativeStrategies.ts
│   │   │   │   │   ├── useClerkModalStateParams.tsx
│   │   │   │   │   ├── useClipboard.ts
│   │   │   │   │   ├── useDebounce.ts
│   │   │   │   │   ├── useDevMode.tsx
│   │   │   │   │   ├── useDirection.ts
│   │   │   │   │   ├── useEmailLink.ts
│   │   │   │   │   ├── useEnabledThirdPartyProviders.tsx
│   │   │   │   │   ├── useEnterpriseSSOLink.ts
│   │   │   │   │   ├── useFetch.ts
│   │   │   │   │   ├── useFetchRoles.ts
│   │   │   │   │   ├── useInView.ts
│   │   │   │   │   ├── useLoadingStatus.ts
│   │   │   │   │   ├── useMultipleSessions.ts
│   │   │   │   │   ├── useNavigateToFlowStart.ts
│   │   │   │   │   ├── useOrganizationListInView.ts
│   │   │   │   │   ├── usePassword.ts
│   │   │   │   │   ├── usePasswordComplexity.ts
│   │   │   │   │   ├── usePopover.ts
│   │   │   │   │   ├── usePrefersReducedMotion.ts
│   │   │   │   │   ├── usePreloadTasks.ts
│   │   │   │   │   ├── useSafeState.ts
│   │   │   │   │   ├── useScrollLock.ts
│   │   │   │   │   ├── useSearchInput.ts
│   │   │   │   │   ├── useSetSessionWithTimeout.ts
│   │   │   │   │   ├── useSupportEmail.ts
│   │   │   │   │   ├── useTabState.ts
│   │   │   │   │   └── useWindowEventListener.ts
│   │   │   │   ├── icons
│   │   │   │   │   ├── add.svg
│   │   │   │   │   ├── apple-pay.svg
│   │   │   │   │   ├── arrow-left.svg
│   │   │   │   │   ├── arrow-right-button.svg
│   │   │   │   │   ├── arrow-right.svg
│   │   │   │   │   ├── arrows-up-down.svg
│   │   │   │   │   ├── auth-app.svg
│   │   │   │   │   ├── billing.svg
│   │   │   │   │   ├── block.svg
│   │   │   │   │   ├── caret-left.svg
│   │   │   │   │   ├── caret-right.svg
│   │   │   │   │   ├── caret.svg
│   │   │   │   │   ├── chat-alt.svg
│   │   │   │   │   ├── check-circle.svg
│   │   │   │   │   ├── check.svg
│   │   │   │   │   ├── checkmark-filled.svg
│   │   │   │   │   ├── chevron-down.svg
│   │   │   │   │   ├── chevron-up-down.svg
│   │   │   │   │   ├── clipboard-outline.svg
│   │   │   │   │   ├── clipboard.svg
│   │   │   │   │   ├── close.svg
│   │   │   │   │   ├── code.svg
│   │   │   │   │   ├── cog-filled.svg
│   │   │   │   │   ├── cog.svg
│   │   │   │   │   ├── copy.svg
│   │   │   │   │   ├── credit-card.svg
│   │   │   │   │   ├── device-laptop.svg
│   │   │   │   │   ├── device-mobile.svg
│   │   │   │   │   ├── dot-circle-horizontal.svg
│   │   │   │   │   ├── download.svg
│   │   │   │   │   ├── email.svg
│   │   │   │   │   ├── exclamation-circle.svg
│   │   │   │   │   ├── exclamation-triangle.svg
│   │   │   │   │   ├── eye-slash.svg
│   │   │   │   │   ├── eye.svg
│   │   │   │   │   ├── fingerprint.svg
│   │   │   │   │   ├── folder.svg
│   │   │   │   │   ├── generic-pay.svg
│   │   │   │   │   ├── index.ts
│   │   │   │   │   ├── information-circle.svg
│   │   │   │   │   ├── link.svg
│   │   │   │   │   ├── lock-closed.svg
│   │   │   │   │   ├── lock-dotted-circle.svg
│   │   │   │   │   ├── logo-mark-new.svg
│   │   │   │   │   ├── logo-mark.svg
│   │   │   │   │   ├── magnifying-glass.svg
│   │   │   │   │   ├── menu.svg
│   │   │   │   │   ├── minus.svg
│   │   │   │   │   ├── mobile-small.svg
│   │   │   │   │   ├── mobile.svg
│   │   │   │   │   ├── organization.svg
│   │   │   │   │   ├── pencil-edit.svg
│   │   │   │   │   ├── pencil.svg
│   │   │   │   │   ├── plans.svg
│   │   │   │   │   ├── plus.svg
│   │   │   │   │   ├── print.svg
│   │   │   │   │   ├── question-mark.svg
│   │   │   │   │   ├── request-auth.svg
│   │   │   │   │   ├── rotate-left-right.svg
│   │   │   │   │   ├── selector.svg
│   │   │   │   │   ├── signout-double.svg
│   │   │   │   │   ├── signout.svg
│   │   │   │   │   ├── spinner-jumbo.svg
│   │   │   │   │   ├── switch-arrow-right.svg
│   │   │   │   │   ├── switch-arrows.svg
│   │   │   │   │   ├── threeDots.svg
│   │   │   │   │   ├── tick-shield.svg
│   │   │   │   │   ├── times.svg
│   │   │   │   │   ├── trash.svg
│   │   │   │   │   ├── upload.svg
│   │   │   │   │   ├── user.svg
│   │   │   │   │   ├── userAdd.svg
│   │   │   │   │   └── users.svg
│   │   │   │   ├── lazyModules
│   │   │   │   │   ├── common.ts
│   │   │   │   │   ├── components.ts
│   │   │   │   │   ├── drawers.tsx
│   │   │   │   │   ├── MountedCheckoutDrawer.tsx
│   │   │   │   │   ├── MountedPlanDetailDrawer.tsx
│   │   │   │   │   ├── MountedSubscriptionDetailDrawer.tsx
│   │   │   │   │   └── providers.tsx
│   │   │   │   ├── localization
│   │   │   │   │   ├── __tests__
│   │   │   │   │   │   ├── applyTokensToString.test.ts
│   │   │   │   │   │   ├── makeLocalizable.test.tsx
│   │   │   │   │   │   └── parseLocalization.test.tsx
│   │   │   │   │   ├── applyTokensToString.ts
│   │   │   │   │   ├── defaultEnglishResource.ts
│   │   │   │   │   ├── index.ts
│   │   │   │   │   ├── localizationKeys.ts
│   │   │   │   │   ├── localizationModifiers.ts
│   │   │   │   │   ├── makeLocalizable.tsx
│   │   │   │   │   └── parseLocalization.ts
│   │   │   │   ├── portal
│   │   │   │   │   └── index.tsx
│   │   │   │   ├── primitives
│   │   │   │   │   ├── Alert.tsx
│   │   │   │   │   ├── AlertIcon.tsx
│   │   │   │   │   ├── applyDataStateProps.ts
│   │   │   │   │   ├── Badge.tsx
│   │   │   │   │   ├── Box.tsx
│   │   │   │   │   ├── Button.tsx
│   │   │   │   │   ├── Dd.tsx
│   │   │   │   │   ├── Dl.tsx
│   │   │   │   │   ├── Dt.tsx
│   │   │   │   │   ├── Flex.tsx
│   │   │   │   │   ├── Form.tsx
│   │   │   │   │   ├── FormErrorText.tsx
│   │   │   │   │   ├── FormInfoText.tsx
│   │   │   │   │   ├── FormLabel.tsx
│   │   │   │   │   ├── FormSuccessText.tsx
│   │   │   │   │   ├── FormWarningText.tsx
│   │   │   │   │   ├── gapPropertyCompat.ts
│   │   │   │   │   ├── Grid.tsx
│   │   │   │   │   ├── Heading.tsx
│   │   │   │   │   ├── hooks
│   │   │   │   │   │   ├── useFormField.tsx
│   │   │   │   │   │   └── useInput.ts
│   │   │   │   │   ├── Hr.tsx
│   │   │   │   │   ├── Icon.tsx
│   │   │   │   │   ├── Image.tsx
│   │   │   │   │   ├── index.ts
│   │   │   │   │   ├── Input.tsx
│   │   │   │   │   ├── Link.tsx
│   │   │   │   │   ├── NotificationBadge.tsx
│   │   │   │   │   ├── Span.tsx
│   │   │   │   │   ├── Spinner.tsx
│   │   │   │   │   ├── Table.tsx
│   │   │   │   │   ├── Tbody.tsx
│   │   │   │   │   ├── Td.tsx
│   │   │   │   │   ├── Text.tsx
│   │   │   │   │   ├── Th.tsx
│   │   │   │   │   ├── Thead.tsx
│   │   │   │   │   └── Tr.tsx
│   │   │   │   ├── router
│   │   │   │   │   ├── __mocks__
│   │   │   │   │   │   └── RouteContext.tsx
│   │   │   │   │   ├── __tests__
│   │   │   │   │   │   ├── HashRouter.test.tsx
│   │   │   │   │   │   ├── PathRouter.test.tsx
│   │   │   │   │   │   ├── Switch.test.tsx
│   │   │   │   │   │   └── VirtualRouter.test.tsx
│   │   │   │   │   ├── BaseRouter.tsx
│   │   │   │   │   ├── HashRouter.tsx
│   │   │   │   │   ├── index.tsx
│   │   │   │   │   ├── newPaths.ts
│   │   │   │   │   ├── PathRouter.tsx
│   │   │   │   │   ├── pathToRegexp.ts
│   │   │   │   │   ├── Route.tsx
│   │   │   │   │   ├── RouteContext.tsx
│   │   │   │   │   ├── Switch.tsx
│   │   │   │   │   └── VirtualRouter.tsx
│   │   │   │   ├── styledSystem
│   │   │   │   │   ├── __tests__
│   │   │   │   │   │   └── createVariants.test.ts
│   │   │   │   │   ├── animations.ts
│   │   │   │   │   ├── breakpoints.tsx
│   │   │   │   │   ├── common.ts
│   │   │   │   │   ├── createCssVariables.ts
│   │   │   │   │   ├── createVariants.ts
│   │   │   │   │   ├── index.ts
│   │   │   │   │   ├── InternalThemeProvider.tsx
│   │   │   │   │   ├── StyleCacheProvider.tsx
│   │   │   │   │   └── types.ts
│   │   │   │   ├── types.ts
│   │   │   │   └── utils
│   │   │   │       ├── __tests__
│   │   │   │       │   ├── createCustomMenuItems.test.ts
│   │   │   │       │   ├── createCustomPages.test.ts
│   │   │   │       │   ├── cssSupports.test.ts
│   │   │   │       │   ├── cssVariables.test.ts
│   │   │   │       │   ├── factorSorting.test.ts
│   │   │   │       │   ├── formatSafeIdentifier.test.ts
│   │   │   │       │   ├── intl.test.ts
│   │   │   │       │   ├── originPrefersPopup.test.ts
│   │   │   │       │   ├── passwordUtils.test.tsx
│   │   │   │       │   ├── phoneUtils.test.ts
│   │   │   │       │   └── truncateTextWithEndVisible.test.ts
│   │   │   │       ├── colors
│   │   │   │       │   ├── __tests__
│   │   │   │       │   │   ├── constants.test.ts
│   │   │   │       │   │   ├── index.test.ts
│   │   │   │       │   │   ├── legacy.test.ts
│   │   │   │       │   │   ├── modern.test.ts
│   │   │   │       │   │   ├── scales.test.ts
│   │   │   │       │   │   └── utils.test.ts
│   │   │   │       │   ├── constants.ts
│   │   │   │       │   ├── index.ts
│   │   │   │       │   ├── legacy.ts
│   │   │   │       │   ├── modern.ts
│   │   │   │       │   ├── README.md
│   │   │   │       │   ├── scales.ts
│   │   │   │       │   └── utils.ts
│   │   │   │       ├── containsAllOf.ts
│   │   │   │       ├── createCustomMenuItems.tsx
│   │   │   │       ├── createCustomPages.tsx
│   │   │   │       ├── createInfiniteAccessProxy.ts
│   │   │   │       ├── createSlug.ts
│   │   │   │       ├── cssSupports.ts
│   │   │   │       ├── cssVariables.ts
│   │   │   │       ├── errorHandler.ts
│   │   │   │       ├── ExternalElementMounter.tsx
│   │   │   │       ├── factorSorting.ts
│   │   │   │       ├── formatDate.ts
│   │   │   │       ├── formatSafeIdentifier.ts
│   │   │   │       ├── fromEntries.ts
│   │   │   │       ├── getClosestProfileScrollBox.ts
│   │   │   │       ├── getRelativeToNowDateKey.ts
│   │   │   │       ├── getValidReactChildren.ts
│   │   │   │       ├── intl.ts
│   │   │   │       ├── isMobileDevice.ts
│   │   │   │       ├── mergeRefs.ts
│   │   │   │       ├── originPrefersPopup.ts
│   │   │   │       ├── passwordUtils.ts
│   │   │   │       ├── phoneUtils.ts
│   │   │   │       ├── range.ts
│   │   │   │       ├── readObjectPath.ts
│   │   │   │       ├── removeUndefinedProps.ts
│   │   │   │       ├── roleLocalizationKey.ts
│   │   │   │       ├── runtimeEnvironment.ts
│   │   │   │       ├── sanitizeCustomLinkURL.ts
│   │   │   │       ├── sleep.ts
│   │   │   │       ├── timeAgo.ts
│   │   │   │       ├── truncateTextWithEndVisible.ts
│   │   │   │       ├── useFormControl.ts
│   │   │   │       ├── usernameUtils.ts
│   │   │   │       └── web3CallbackErrorHandler.ts
│   │   │   └── utils
│   │   │       ├── __tests__
│   │   │       │   ├── appearance.test.ts
│   │   │       │   ├── captcha.test.ts
│   │   │       │   ├── completeSignUpFlow.test.ts
│   │   │       │   ├── date.test.ts
│   │   │       │   ├── dynamicParamParser.test.ts
│   │   │       │   ├── email.test.ts
│   │   │       │   ├── encoders.test.ts
│   │   │       │   ├── errors.test.ts
│   │   │       │   ├── filterUndefinedValues.test.ts
│   │   │       │   ├── getClerkQueryParam.test.ts
│   │   │       │   ├── ignoreEventValue.test.ts
│   │   │       │   ├── instance.test.ts
│   │   │       │   ├── jwt.test.ts
│   │   │       │   ├── locale.test.ts
│   │   │       │   ├── localStorage.test.ts
│   │   │       │   ├── memoizeStateListenerCallback.test.ts
│   │   │       │   ├── organization.test.ts
│   │   │       │   ├── passkeys.test.ts
│   │   │       │   ├── path.test.ts
│   │   │       │   ├── queryStateParams.test.ts
│   │   │       │   ├── querystring.test.ts
│   │   │       │   ├── redirectUrls.test.ts
│   │   │       │   ├── resourceParams.test.ts
│   │   │       │   ├── runAsyncResourceTask.test.ts
│   │   │       │   ├── tokenId.test.ts
│   │   │       │   └── url.test.ts
│   │   │       ├── appearance.ts
│   │   │       ├── assertNoLegacyProp.ts
│   │   │       ├── authenticateWithPopup.ts
│   │   │       ├── beforeUnloadTracker.ts
│   │   │       ├── billing.ts
│   │   │       ├── captcha
│   │   │       │   ├── CaptchaChallenge.ts
│   │   │       │   ├── constants.ts
│   │   │       │   ├── getCaptchaToken.ts
│   │   │       │   ├── retrieveCaptchaInfo.ts
│   │   │       │   ├── turnstile.ts
│   │   │       │   └── types.ts
│   │   │       ├── completeSignUpFlow.ts
│   │   │       ├── componentGuards.ts
│   │   │       ├── convertPageToOffsetSearchParams.ts
│   │   │       ├── date.ts
│   │   │       ├── debug.ts
│   │   │       ├── disambiguateRedirectOptions.ts
│   │   │       ├── dynamicParamParser.ts
│   │   │       ├── email.ts
│   │   │       ├── encoders.ts
│   │   │       ├── errors.ts
│   │   │       ├── errorThrower.ts
│   │   │       ├── filterUndefinedValues.ts
│   │   │       ├── getClerkQueryParam.ts
│   │   │       ├── hex.ts
│   │   │       ├── ignoreEventValue.ts
│   │   │       ├── image.ts
│   │   │       ├── index.ts
│   │   │       ├── injectedWeb3Providers.ts
│   │   │       ├── instance.ts
│   │   │       ├── jwt.ts
│   │   │       ├── locale.ts
│   │   │       ├── localStorage.ts
│   │   │       ├── memoizeStateListenerCallback.ts
│   │   │       ├── normalizeRoutingOptions.ts
│   │   │       ├── one-tap.ts
│   │   │       ├── organization.ts
│   │   │       ├── pageLifecycle.ts
│   │   │       ├── passkeys.ts
│   │   │       ├── passwords
│   │   │       │   ├── complexity.ts
│   │   │       │   ├── password.ts
│   │   │       │   └── strength.ts
│   │   │       ├── path.ts
│   │   │       ├── props.ts
│   │   │       ├── queryStateParams.ts
│   │   │       ├── querystring.ts
│   │   │       ├── redirectUrls.ts
│   │   │       ├── resourceParams.ts
│   │   │       ├── runAsyncResourceTask.ts
│   │   │       ├── runtime.ts
│   │   │       ├── setWebpackChunkPublicPath.ts
│   │   │       ├── tokenId.ts
│   │   │       ├── url.ts
│   │   │       ├── user.ts
│   │   │       ├── web3.ts
│   │   │       ├── windowNavigate.ts
│   │   │       └── zxcvbn.ts
│   │   ├── svgTransform.js
│   │   ├── tsconfig.declarations.json
│   │   ├── tsconfig.dev.json
│   │   ├── tsconfig.json
│   │   ├── turbo.json
│   │   ├── vercel.json
│   │   ├── vitest.config.mts
│   │   └── vitest.setup.mts
│   ├── dev-cli
│   │   ├── bin
│   │   │   └── cli.js
│   │   ├── CHANGELOG.md
│   │   ├── jsconfig.json
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── schema.json
│   │   └── src
│   │       ├── cli.js
│   │       ├── codemods
│   │       │   ├── index.js
│   │       │   └── transforms
│   │       │       └── add-clerkjsurl-to-provider.cjs
│   │       ├── commands
│   │       │   ├── auth.js
│   │       │   ├── config.js
│   │       │   ├── init.js
│   │       │   ├── set-instance.js
│   │       │   ├── set-root.js
│   │       │   ├── setup.js
│   │       │   └── watch.js
│   │       └── utils
│   │           ├── errors.js
│   │           ├── getClerkPackages.js
│   │           ├── getConfiguration.js
│   │           ├── getMonorepoRoot.js
│   │           ├── getPackageJSON.js
│   │           └── getPackageVersion.js
│   ├── elements
│   │   ├── .gitignore
│   │   ├── .npmignore
│   │   ├── CHANGELOG.md
│   │   ├── examples
│   │   │   └── nextjs
│   │   │       ├── .env.local.example
│   │   │       ├── .gitignore
│   │   │       ├── app
│   │   │       │   ├── example
│   │   │       │   │   └── page.tsx
│   │   │       │   ├── favicon.ico
│   │   │       │   ├── globals.css
│   │   │       │   ├── layout.tsx
│   │   │       │   ├── modal
│   │   │       │   │   └── page.tsx
│   │   │       │   ├── otp-playground
│   │   │       │   │   └── page.tsx
│   │   │       │   ├── page.tsx
│   │   │       │   ├── sign-in
│   │   │       │   │   └── [[...sign-in]]
│   │   │       │   │       └── page.tsx
│   │   │       │   └── sign-up
│   │   │       │       └── [[...sign-up]]
│   │   │       │           └── page.tsx
│   │   │       ├── components
│   │   │       │   ├── design.tsx
│   │   │       │   ├── form.tsx
│   │   │       │   ├── social-providers.tsx
│   │   │       │   └── spinner.tsx
│   │   │       ├── middleware.ts
│   │   │       ├── next.config.js
│   │   │       ├── package.json
│   │   │       ├── postcss.config.js
│   │   │       ├── public
│   │   │       │   ├── clerk.svg
│   │   │       │   ├── next.svg
│   │   │       │   └── vercel.svg
│   │   │       ├── README.md
│   │   │       ├── tailwind.config.ts
│   │   │       └── tsconfig.json
│   │   ├── jest.config.js
│   │   ├── jest.setup.js
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── src
│   │   │   ├── index.ts
│   │   │   ├── internals
│   │   │   │   ├── constants
│   │   │   │   │   └── index.ts
│   │   │   │   ├── errors
│   │   │   │   │   └── index.ts
│   │   │   │   ├── machines
│   │   │   │   │   ├── form
│   │   │   │   │   │   ├── form.context.ts
│   │   │   │   │   │   ├── form.machine.ts
│   │   │   │   │   │   ├── form.types.ts
│   │   │   │   │   │   └── index.ts
│   │   │   │   │   ├── shared
│   │   │   │   │   │   ├── __tests__
│   │   │   │   │   │   │   └── shared.actions.test.ts
│   │   │   │   │   │   ├── index.ts
│   │   │   │   │   │   ├── shared.actions.ts
│   │   │   │   │   │   ├── shared.actors.ts
│   │   │   │   │   │   └── shared.types.ts
│   │   │   │   │   ├── sign-in
│   │   │   │   │   │   ├── __tests__
│   │   │   │   │   │   │   └── router.selectors.test.ts
│   │   │   │   │   │   ├── index.ts
│   │   │   │   │   │   ├── reset-password.machine.ts
│   │   │   │   │   │   ├── reset-password.types.ts
│   │   │   │   │   │   ├── router.machine.ts
│   │   │   │   │   │   ├── router.selectors.ts
│   │   │   │   │   │   ├── router.types.ts
│   │   │   │   │   │   ├── start.machine.ts
│   │   │   │   │   │   ├── start.types.ts
│   │   │   │   │   │   ├── utils
│   │   │   │   │   │   │   ├── index.ts
│   │   │   │   │   │   │   └── starting-factors.ts
│   │   │   │   │   │   ├── verification.machine.ts
│   │   │   │   │   │   └── verification.types.ts
│   │   │   │   │   ├── sign-up
│   │   │   │   │   │   ├── continue.machine.ts
│   │   │   │   │   │   ├── continue.types.ts
│   │   │   │   │   │   ├── index.ts
│   │   │   │   │   │   ├── router.machine.ts
│   │   │   │   │   │   ├── router.types.ts
│   │   │   │   │   │   ├── start.machine.ts
│   │   │   │   │   │   ├── start.types.ts
│   │   │   │   │   │   ├── utils
│   │   │   │   │   │   │   ├── __tests__
│   │   │   │   │   │   │   │   └── fields-to-params.test.ts
│   │   │   │   │   │   │   ├── fields-to-params.ts
│   │   │   │   │   │   │   └── index.ts
│   │   │   │   │   │   ├── verification.machine.ts
│   │   │   │   │   │   └── verification.types.ts
│   │   │   │   │   ├── third-party
│   │   │   │   │   │   ├── index.ts
│   │   │   │   │   │   ├── third-party.actors.ts
│   │   │   │   │   │   ├── third-party.machine.ts
│   │   │   │   │   │   └── third-party.types.ts
│   │   │   │   │   ├── types
│   │   │   │   │   │   ├── index.ts
│   │   │   │   │   │   └── router.types.ts
│   │   │   │   │   └── utils
│   │   │   │   │       ├── __tests__
│   │   │   │   │       │   ├── assert.test.ts
│   │   │   │   │       │   ├── formatters.test.ts
│   │   │   │   │       │   ├── next.test.ts
│   │   │   │   │       │   └── strategies.test.ts
│   │   │   │   │       ├── assert.ts
│   │   │   │   │       ├── clerkjs.ts
│   │   │   │   │       ├── formatters.ts
│   │   │   │   │       ├── next.ts
│   │   │   │   │       └── strategies.ts
│   │   │   │   └── utils
│   │   │   │       └── inspector
│   │   │   │           ├── browser
│   │   │   │           │   └── index.ts
│   │   │   │           ├── console
│   │   │   │           │   ├── console.ts
│   │   │   │           │   └── index.ts
│   │   │   │           └── index.ts
│   │   │   ├── react
│   │   │   │   ├── common
│   │   │   │   │   ├── connections.tsx
│   │   │   │   │   ├── form
│   │   │   │   │   │   ├── field-error.tsx
│   │   │   │   │   │   ├── field-state.tsx
│   │   │   │   │   │   ├── field.tsx
│   │   │   │   │   │   ├── form.tsx
│   │   │   │   │   │   ├── global-error.tsx
│   │   │   │   │   │   ├── hooks
│   │   │   │   │   │   │   ├── __tests__
│   │   │   │   │   │   │   │   ├── use-field-feedback.test.ts
│   │   │   │   │   │   │   │   ├── use-form.test.tsx
│   │   │   │   │   │   │   │   ├── use-global-errors.test.ts
│   │   │   │   │   │   │   │   └── use-previous.test.ts
│   │   │   │   │   │   │   ├── index.ts
│   │   │   │   │   │   │   ├── use-field-context.ts
│   │   │   │   │   │   │   ├── use-field-feedback.ts
│   │   │   │   │   │   │   ├── use-field-state.ts
│   │   │   │   │   │   │   ├── use-field.ts
│   │   │   │   │   │   │   ├── use-form.ts
│   │   │   │   │   │   │   ├── use-global-errors.ts
│   │   │   │   │   │   │   ├── use-input.tsx
│   │   │   │   │   │   │   ├── use-previous.ts
│   │   │   │   │   │   │   └── use-validity-state-context.ts
│   │   │   │   │   │   ├── index.tsx
│   │   │   │   │   │   ├── input.tsx
│   │   │   │   │   │   ├── label.tsx
│   │   │   │   │   │   ├── otp.tsx
│   │   │   │   │   │   ├── submit.tsx
│   │   │   │   │   │   ├── types.ts
│   │   │   │   │   │   └── utils
│   │   │   │   │   │       ├── __tests__
│   │   │   │   │   │       │   ├── determine-input-type-from-name.test.ts
│   │   │   │   │   │       │   └── enrich-field-state.test.ts
│   │   │   │   │   │       ├── determine-input-type-from-name.ts
│   │   │   │   │   │       ├── enrich-field-state.ts
│   │   │   │   │   │       └── index.ts
│   │   │   │   │   ├── index.ts
│   │   │   │   │   ├── link.tsx
│   │   │   │   │   └── loading.tsx
│   │   │   │   ├── hooks
│   │   │   │   │   ├── __tests__
│   │   │   │   │   │   ├── use-active-states.hook.test.ts
│   │   │   │   │   │   ├── use-active-tags.hook.test.ts
│   │   │   │   │   │   └── use-focus.hook.test.ts
│   │   │   │   │   ├── index.ts
│   │   │   │   │   ├── use-active-states.hook.ts
│   │   │   │   │   ├── use-active-tags.hook.ts
│   │   │   │   │   ├── use-focus.hook.ts
│   │   │   │   │   ├── use-loading.hook.ts
│   │   │   │   │   ├── use-password.hook.ts
│   │   │   │   │   └── use-third-party-provider.hook.ts
│   │   │   │   ├── router
│   │   │   │   │   ├── index.ts
│   │   │   │   │   ├── next.ts
│   │   │   │   │   └── virtual.ts
│   │   │   │   ├── sign-in
│   │   │   │   │   ├── action
│   │   │   │   │   │   ├── action.tsx
│   │   │   │   │   │   ├── index.ts
│   │   │   │   │   │   ├── navigate.tsx
│   │   │   │   │   │   ├── resend.tsx
│   │   │   │   │   │   └── set-active-session.tsx
│   │   │   │   │   ├── captcha.tsx
│   │   │   │   │   ├── choose-session
│   │   │   │   │   │   ├── __tests__
│   │   │   │   │   │   │   └── choose-session.test.tsx
│   │   │   │   │   │   ├── choose-session.hooks.ts
│   │   │   │   │   │   ├── choose-session.tsx
│   │   │   │   │   │   └── index.tsx
│   │   │   │   │   ├── choose-strategy.tsx
│   │   │   │   │   ├── context
│   │   │   │   │   │   ├── index.ts
│   │   │   │   │   │   ├── router.context.ts
│   │   │   │   │   │   ├── sign-in-strategy.context.ts
│   │   │   │   │   │   └── strategies.context.ts
│   │   │   │   │   ├── identifiers.tsx
│   │   │   │   │   ├── index.ts
│   │   │   │   │   ├── passkey.tsx
│   │   │   │   │   ├── reset-password.tsx
│   │   │   │   │   ├── root.tsx
│   │   │   │   │   ├── sso-callback.tsx
│   │   │   │   │   ├── start.tsx
│   │   │   │   │   ├── step.tsx
│   │   │   │   │   └── verifications.tsx
│   │   │   │   ├── sign-up
│   │   │   │   │   ├── action
│   │   │   │   │   │   ├── action.tsx
│   │   │   │   │   │   ├── index.ts
│   │   │   │   │   │   ├── navigate.tsx
│   │   │   │   │   │   └── resend.tsx
│   │   │   │   │   ├── captcha.tsx
│   │   │   │   │   ├── context
│   │   │   │   │   │   ├── index.ts
│   │   │   │   │   │   ├── router.context.ts
│   │   │   │   │   │   └── strategies.context.ts
│   │   │   │   │   ├── continue.tsx
│   │   │   │   │   ├── index.ts
│   │   │   │   │   ├── restricted.tsx
│   │   │   │   │   ├── root.tsx
│   │   │   │   │   ├── start.tsx
│   │   │   │   │   ├── step.tsx
│   │   │   │   │   └── verifications.tsx
│   │   │   │   └── utils
│   │   │   │       ├── __tests__
│   │   │   │       │   └── map-scope-to-strategy.test.ts
│   │   │   │       ├── create-context-for-dom-validation.ts
│   │   │   │       ├── create-context-from-actor-ref.ts
│   │   │   │       ├── generate-password-error-text.ts
│   │   │   │       ├── is-react-fragment.ts
│   │   │   │       ├── is-valid-component-type.ts
│   │   │   │       ├── map-scope-to-strategy.ts
│   │   │   │       └── path-inference
│   │   │   │           ├── __tests__
│   │   │   │           │   ├── next.test.ts
│   │   │   │           │   └── utils.test.ts
│   │   │   │           ├── next.tsx
│   │   │   │           └── utils.ts
│   │   │   ├── types
│   │   │   │   ├── clerk.d.ts
│   │   │   │   ├── common.d.ts
│   │   │   │   └── global.d.ts
│   │   │   └── utils
│   │   │       ├── clerk-js.ts
│   │   │       ├── is-absolute-url.ts
│   │   │       ├── safe-access.ts
│   │   │       ├── test-utils.ts
│   │   │       └── third-party-strategies.ts
│   │   ├── tsconfig.declarations.json
│   │   ├── tsconfig.json
│   │   ├── tsconfig.test.json
│   │   ├── tsup.config.ts
│   │   └── turbo.json
│   ├── expo
│   │   ├── CHANGELOG.md
│   │   ├── LICENSE
│   │   ├── local-credentials
│   │   │   └── package.json
│   │   ├── package.json
│   │   ├── passkeys
│   │   │   └── package.json
│   │   ├── README.md
│   │   ├── resource-cache
│   │   │   └── package.json
│   │   ├── secure-store
│   │   │   └── package.json
│   │   ├── src
│   │   │   ├── cache
│   │   │   │   ├── dummy-data
│   │   │   │   │   ├── client-resource.ts
│   │   │   │   │   ├── environment-resource.ts
│   │   │   │   │   └── index.ts
│   │   │   │   ├── index.ts
│   │   │   │   ├── MemoryTokenCache.ts
│   │   │   │   ├── ResourceCache.ts
│   │   │   │   └── types.ts
│   │   │   ├── components
│   │   │   │   ├── controlComponents.tsx
│   │   │   │   └── index.ts
│   │   │   ├── errorThrower.ts
│   │   │   ├── experimental.ts
│   │   │   ├── global.d.ts
│   │   │   ├── hooks
│   │   │   │   ├── __tests__
│   │   │   │   │   └── useSignInWithApple.test.ts
│   │   │   │   ├── index.ts
│   │   │   │   ├── useAuth.ts
│   │   │   │   ├── useOAuth.ts
│   │   │   │   ├── useSignInWithApple.ios.ts
│   │   │   │   ├── useSignInWithApple.ts
│   │   │   │   └── useSSO.ts
│   │   │   ├── index.ts
│   │   │   ├── local-credentials
│   │   │   │   ├── index.tsx
│   │   │   │   └── useLocalCredentials
│   │   │   │       ├── index.tsx
│   │   │   │       ├── shared.ts
│   │   │   │       ├── useLocalCredentials.ts
│   │   │   │       └── useLocalCredentials.web.ts
│   │   │   ├── passkeys
│   │   │   │   └── index.ts
│   │   │   ├── polyfills
│   │   │   │   ├── base64Polyfill.ts
│   │   │   │   └── index.ts
│   │   │   ├── provider
│   │   │   │   ├── ClerkProvider.tsx
│   │   │   │   └── singleton
│   │   │   │       ├── createClerkInstance.ts
│   │   │   │       ├── index.ts
│   │   │   │       ├── singleton.ts
│   │   │   │       ├── singleton.web.ts
│   │   │   │       └── types.ts
│   │   │   ├── resource-cache
│   │   │   │   ├── __tests__
│   │   │   │   │   ├── dummy-test-data.ts
│   │   │   │   │   └── secure-store.test.ts
│   │   │   │   ├── index.ts
│   │   │   │   └── resource-cache.ts
│   │   │   ├── secure-store
│   │   │   │   └── index.ts
│   │   │   ├── token-cache
│   │   │   │   └── index.ts
│   │   │   ├── utils
│   │   │   │   ├── errors.ts
│   │   │   │   ├── index.ts
│   │   │   │   └── runtime.ts
│   │   │   └── web
│   │   │       ├── index.ts
│   │   │       └── uiComponents.tsx
│   │   ├── token-cache
│   │   │   └── package.json
│   │   ├── tsconfig.declarations.json
│   │   ├── tsconfig.json
│   │   ├── tsconfig.test.json
│   │   ├── tsup.config.ts
│   │   ├── vitest.config.mts
│   │   ├── vitest.setup.mts
│   │   └── web
│   │       └── package.json
│   ├── expo-passkeys
│   │   ├── .gitignore
│   │   ├── .npmignore
│   │   ├── android
│   │   │   ├── build.gradle
│   │   │   └── src
│   │   │       └── main
│   │   │           ├── AndroidManifest.xml
│   │   │           └── java
│   │   │               └── expo
│   │   │                   └── modules
│   │   │                       └── clerkexpopasskeys
│   │   │                           ├── ClerkExpoPasskeysExceptions.kt
│   │   │                           ├── ClerkExpoPasskeysModule.kt
│   │   │                           └── CredentialManager.kt
│   │   ├── app.json
│   │   ├── CHANGELOG.md
│   │   ├── expo-module.config.json
│   │   ├── ios
│   │   │   ├── AccountManager.swift
│   │   │   ├── ClerkExpoPasskeys.podspec
│   │   │   ├── ClerkExpoPasskeysModule.swift
│   │   │   └── Helpers.swift
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── src
│   │   │   ├── ClerkExpoPasskeys.types.ts
│   │   │   ├── ClerkExpoPasskeysModule.ts
│   │   │   ├── ClerkExpoPasskeysModule.web.ts
│   │   │   ├── index.ts
│   │   │   └── utils.ts
│   │   ├── tsconfig.declarations.json
│   │   ├── tsconfig.json
│   │   └── tsup.config.ts
│   ├── express
│   │   ├── .gitignore
│   │   ├── .npmignore
│   │   ├── CHANGELOG.md
│   │   ├── env.d.ts
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── src
│   │   │   ├── __tests__
│   │   │   │   ├── __snapshots__
│   │   │   │   │   └── exports.test.ts.snap
│   │   │   │   ├── clerkMiddleware.test.ts
│   │   │   │   ├── exports.test.ts
│   │   │   │   ├── getAuth.test.ts
│   │   │   │   ├── helpers.ts
│   │   │   │   └── requireAuth.test.ts
│   │   │   ├── authenticateRequest.ts
│   │   │   ├── clerkClient.ts
│   │   │   ├── clerkMiddleware.ts
│   │   │   ├── errors.ts
│   │   │   ├── getAuth.ts
│   │   │   ├── global.d.ts
│   │   │   ├── index.ts
│   │   │   ├── requireAuth.ts
│   │   │   ├── types.ts
│   │   │   ├── utils.ts
│   │   │   └── webhooks.ts
│   │   ├── tsconfig.json
│   │   ├── tsup.config.ts
│   │   ├── turbo.json
│   │   ├── vitest.config.mts
│   │   ├── vitest.setup.mts
│   │   └── webhooks
│   │       └── package.json
│   ├── fastify
│   │   ├── CHANGELOG.md
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── src
│   │   │   ├── __tests__
│   │   │   │   ├── __snapshots__
│   │   │   │   │   ├── clerkClient.test.ts.snap
│   │   │   │   │   ├── constants.test.ts.snap
│   │   │   │   │   ├── exports.test.ts.snap
│   │   │   │   │   └── getAuth.test.ts.snap
│   │   │   │   ├── clerkClient.test.ts
│   │   │   │   ├── clerkPlugin.test.ts
│   │   │   │   ├── constants.test.ts
│   │   │   │   ├── exports.test.ts
│   │   │   │   ├── getAuth.test.ts
│   │   │   │   └── withClerkMiddleware.test.ts
│   │   │   ├── clerkClient.ts
│   │   │   ├── clerkPlugin.ts
│   │   │   ├── constants.ts
│   │   │   ├── errors.ts
│   │   │   ├── getAuth.ts
│   │   │   ├── global.d.ts
│   │   │   ├── index.ts
│   │   │   ├── test
│   │   │   │   └── utils.ts
│   │   │   ├── types.ts
│   │   │   ├── utils.ts
│   │   │   ├── webhooks.ts
│   │   │   └── withClerkMiddleware.ts
│   │   ├── tsconfig.json
│   │   ├── tsconfig.test.json
│   │   ├── tsup.config.ts
│   │   ├── vitest.config.mts
│   │   ├── vitest.setup.mts
│   │   └── webhooks
│   │       └── package.json
│   ├── localizations
│   │   ├── .gitignore
│   │   ├── CHANGELOG.md
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── src
│   │   │   ├── ar-SA.ts
│   │   │   ├── be-BY.ts
│   │   │   ├── bg-BG.ts
│   │   │   ├── bn-IN.ts
│   │   │   ├── ca-ES.ts
│   │   │   ├── cs-CZ.ts
│   │   │   ├── da-DK.ts
│   │   │   ├── de-DE.ts
│   │   │   ├── el-GR.ts
│   │   │   ├── en-GB.ts
│   │   │   ├── en-US.ts
│   │   │   ├── es-CR.ts
│   │   │   ├── es-ES.ts
│   │   │   ├── es-MX.ts
│   │   │   ├── es-UY.ts
│   │   │   ├── fa-IR.ts
│   │   │   ├── fi-FI.ts
│   │   │   ├── fr-FR.ts
│   │   │   ├── he-IL.ts
│   │   │   ├── hi-IN.ts
│   │   │   ├── hr-HR.ts
│   │   │   ├── hu-HU.ts
│   │   │   ├── id-ID.ts
│   │   │   ├── index.ts
│   │   │   ├── is-IS.ts
│   │   │   ├── it-IT.ts
│   │   │   ├── ja-JP.ts
│   │   │   ├── kk-KZ.ts
│   │   │   ├── ko-KR.ts
│   │   │   ├── mn-MN.ts
│   │   │   ├── ms-MY.ts
│   │   │   ├── nb-NO.ts
│   │   │   ├── nl-BE.ts
│   │   │   ├── nl-NL.ts
│   │   │   ├── pl-PL.ts
│   │   │   ├── pt-BR.ts
│   │   │   ├── pt-PT.ts
│   │   │   ├── ro-RO.ts
│   │   │   ├── ru-RU.ts
│   │   │   ├── sk-SK.ts
│   │   │   ├── sr-RS.ts
│   │   │   ├── sv-SE.ts
│   │   │   ├── ta-IN.ts
│   │   │   ├── te-IN.ts
│   │   │   ├── th-TH.ts
│   │   │   ├── tr-TR.ts
│   │   │   ├── uk-UA.ts
│   │   │   ├── utils
│   │   │   │   ├── enUS_v4.ts
│   │   │   │   ├── generate.ts
│   │   │   │   └── utils.ts
│   │   │   ├── vi-VN.ts
│   │   │   ├── zh-CN.ts
│   │   │   └── zh-TW.ts
│   │   ├── subpaths.mjs
│   │   ├── tsconfig.json
│   │   └── tsup.config.ts
│   ├── nextjs
│   │   ├── .gitignore
│   │   ├── CHANGELOG.md
│   │   ├── errors
│   │   │   └── package.json
│   │   ├── internal
│   │   │   └── package.json
│   │   ├── LICENSE
│   │   ├── package.cjs.json
│   │   ├── package.esm.json
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── server
│   │   │   └── package.json
│   │   ├── src
│   │   │   ├── __tests__
│   │   │   │   ├── keyless-custom-headers.test.ts
│   │   │   │   └── webhooks.test.ts
│   │   │   ├── app-router
│   │   │   │   ├── client
│   │   │   │   │   ├── ClerkProvider.tsx
│   │   │   │   │   ├── keyless-cookie-sync.tsx
│   │   │   │   │   ├── keyless-creator-reader.tsx
│   │   │   │   │   ├── useAwaitablePush.ts
│   │   │   │   │   ├── useAwaitableReplace.ts
│   │   │   │   │   └── useInternalNavFun.ts
│   │   │   │   ├── keyless-actions.ts
│   │   │   │   ├── server
│   │   │   │   │   ├── auth.ts
│   │   │   │   │   ├── ClerkProvider.tsx
│   │   │   │   │   ├── controlComponents.tsx
│   │   │   │   │   ├── currentUser.ts
│   │   │   │   │   ├── keyless-provider.tsx
│   │   │   │   │   └── utils.ts
│   │   │   │   └── server-actions.ts
│   │   │   ├── client-boundary
│   │   │   │   ├── ClerkProvider.tsx
│   │   │   │   ├── controlComponents.ts
│   │   │   │   ├── hooks
│   │   │   │   │   ├── useEnforceCatchAllRoute.tsx
│   │   │   │   │   ├── useEnforceRoutingProps.tsx
│   │   │   │   │   ├── usePagesRouter.tsx
│   │   │   │   │   ├── usePathnameWithoutCatchAll.tsx
│   │   │   │   │   └── useSafeLayoutEffect.tsx
│   │   │   │   ├── hooks.ts
│   │   │   │   ├── NextOptionsContext.tsx
│   │   │   │   ├── PromisifiedAuthProvider.tsx
│   │   │   │   └── uiComponents.tsx
│   │   │   ├── components.client.ts
│   │   │   ├── components.server.ts
│   │   │   ├── constants.ts
│   │   │   ├── errors.ts
│   │   │   ├── experimental.ts
│   │   │   ├── global.d.ts
│   │   │   ├── index.ts
│   │   │   ├── internal.ts
│   │   │   ├── pages
│   │   │   │   ├── __tests__
│   │   │   │   │   ├── __snapshots__
│   │   │   │   │   │   └── exports.test.ts.snap
│   │   │   │   │   ├── exports.test.ts
│   │   │   │   │   └── index.test.tsx
│   │   │   │   └── ClerkProvider.tsx
│   │   │   ├── runtime
│   │   │   │   ├── browser
│   │   │   │   │   └── safe-node-apis.js
│   │   │   │   └── node
│   │   │   │       └── safe-node-apis.js
│   │   │   ├── server
│   │   │   │   ├── __tests__
│   │   │   │   │   ├── __snapshots__
│   │   │   │   │   │   └── exports.test.ts.snap
│   │   │   │   │   ├── clerkClient.test.ts
│   │   │   │   │   ├── clerkMiddleware.test.ts
│   │   │   │   │   ├── content-security-policy.test.ts
│   │   │   │   │   ├── createGetAuth.test.ts
│   │   │   │   │   ├── exports.test.ts
│   │   │   │   │   └── getAuthDataFromRequest.test.ts
│   │   │   │   ├── buildClerkProps.ts
│   │   │   │   ├── clerkClient.ts
│   │   │   │   ├── clerkMiddleware.ts
│   │   │   │   ├── constants.ts
│   │   │   │   ├── content-security-policy.ts
│   │   │   │   ├── createClerkClient.ts
│   │   │   │   ├── createGetAuth.ts
│   │   │   │   ├── data
│   │   │   │   │   └── getAuthDataFromRequest.ts
│   │   │   │   ├── errors.ts
│   │   │   │   ├── errorThrower.ts
│   │   │   │   ├── fs
│   │   │   │   │   ├── middleware-location.ts
│   │   │   │   │   └── utils.ts
│   │   │   │   ├── headers-utils.ts
│   │   │   │   ├── index.ts
│   │   │   │   ├── keyless-custom-headers.ts
│   │   │   │   ├── keyless-log-cache.ts
│   │   │   │   ├── keyless-node.ts
│   │   │   │   ├── keyless-telemetry.ts
│   │   │   │   ├── keyless.ts
│   │   │   │   ├── middleware-storage.ts
│   │   │   │   ├── nextErrors.ts
│   │   │   │   ├── nextFetcher.ts
│   │   │   │   ├── protect.ts
│   │   │   │   ├── routeMatcher.ts
│   │   │   │   ├── types.ts
│   │   │   │   └── utils.ts
│   │   │   ├── types
│   │   │   │   └── safe-node-apis.d.ts
│   │   │   ├── types.ts
│   │   │   ├── utils
│   │   │   │   ├── __tests__
│   │   │   │   │   ├── debugLogger.test.ts
│   │   │   │   │   ├── matcher.test.ts
│   │   │   │   │   └── removeBasePath.test.ts
│   │   │   │   ├── clerk-js-script.tsx
│   │   │   │   ├── debugLogger.ts
│   │   │   │   ├── feature-flags.ts
│   │   │   │   ├── index.ts
│   │   │   │   ├── invalidateNextRouterCache.ts
│   │   │   │   ├── logFormatter.ts
│   │   │   │   ├── mergeNextClerkPropsWithEnv.ts
│   │   │   │   ├── only-try.ts
│   │   │   │   ├── removeBasePath.ts
│   │   │   │   ├── response.ts
│   │   │   │   ├── router-telemetry.ts
│   │   │   │   ├── sdk-versions.ts
│   │   │   │   └── serverRedirectWithAuth.ts
│   │   │   ├── vendor
│   │   │   │   ├── crypto-es.js
│   │   │   │   └── README.md
│   │   │   └── webhooks.ts
│   │   ├── tsconfig.declarations.json
│   │   ├── tsconfig.json
│   │   ├── tsconfig.test.json
│   │   ├── tsup.config.ts
│   │   ├── typedoc.json
│   │   ├── vitest.config.mts
│   │   ├── vitest.setup.mts
│   │   └── webhooks
│   │       └── package.json
│   ├── nuxt
│   │   ├── .gitignore
│   │   ├── CHANGELOG.md
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── src
│   │   │   ├── global.d.ts
│   │   │   ├── module.ts
│   │   │   └── runtime
│   │   │       ├── client
│   │   │       │   ├── index.ts
│   │   │       │   └── routeMatcher.ts
│   │   │       ├── components
│   │   │       │   └── index.ts
│   │   │       ├── composables
│   │   │       │   └── index.ts
│   │   │       ├── errors.ts
│   │   │       ├── plugin.ts
│   │   │       ├── server
│   │   │       │   ├── __tests__
│   │   │       │   │   ├── auth.test-d.ts
│   │   │       │   │   └── clerkMiddleware.test.ts
│   │   │       │   ├── clerkClient.ts
│   │   │       │   ├── clerkMiddleware.ts
│   │   │       │   ├── errors.ts
│   │   │       │   ├── getAuth.ts
│   │   │       │   ├── index.ts
│   │   │       │   ├── middleware.ts
│   │   │       │   ├── routeMatcher.ts
│   │   │       │   ├── types.ts
│   │   │       │   └── utils.ts
│   │   │       └── webhooks.ts
│   │   ├── tsconfig.json
│   │   ├── tsup.config.ts
│   │   └── vitest.config.ts
│   ├── react
│   │   ├── .gitignore
│   │   ├── CHANGELOG.md
│   │   ├── clerk.png
│   │   ├── docs
│   │   │   ├── use-auth.md
│   │   │   ├── use-sign-in.md
│   │   │   └── use-sign-up.md
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── src
│   │   │   ├── __tests__
│   │   │   │   └── isomorphicClerk.test.ts
│   │   │   ├── components
│   │   │   │   ├── __tests__
│   │   │   │   │   ├── CheckoutButton.test.tsx
│   │   │   │   │   ├── OrganizationProfile.test.tsx
│   │   │   │   │   ├── OrganizationSwitcher.test.tsx
│   │   │   │   │   ├── PlanDetailsButton.test.tsx
│   │   │   │   │   ├── SignIn.test.tsx
│   │   │   │   │   ├── SignInButton.test.tsx
│   │   │   │   │   ├── SignInWithMetamaskButton.test.tsx
│   │   │   │   │   ├── SignOutButton.test.tsx
│   │   │   │   │   ├── SignUp.test.tsx
│   │   │   │   │   ├── SignUpButton.test.tsx
│   │   │   │   │   ├── SubscriptionDetailsButton.test.tsx
│   │   │   │   │   ├── UserAvatar.test.tsx
│   │   │   │   │   ├── UserButton.test.tsx
│   │   │   │   │   └── UserProfile.test.tsx
│   │   │   │   ├── CheckoutButton.tsx
│   │   │   │   ├── ClerkHostRenderer.tsx
│   │   │   │   ├── controlComponents.tsx
│   │   │   │   ├── index.ts
│   │   │   │   ├── PlanDetailsButton.tsx
│   │   │   │   ├── SignInButton.tsx
│   │   │   │   ├── SignInWithMetamaskButton.tsx
│   │   │   │   ├── SignOutButton.tsx
│   │   │   │   ├── SignUpButton.tsx
│   │   │   │   ├── SubscriptionDetailsButton.tsx
│   │   │   │   ├── uiComponents.tsx
│   │   │   │   └── withClerk.tsx
│   │   │   ├── contexts
│   │   │   │   ├── __tests__
│   │   │   │   │   └── ClerkProvider.test.tsx
│   │   │   │   ├── assertHelpers.ts
│   │   │   │   ├── AuthContext.ts
│   │   │   │   ├── ClerkContextProvider.tsx
│   │   │   │   ├── ClerkProvider.tsx
│   │   │   │   ├── index.ts
│   │   │   │   ├── IsomorphicClerkContext.tsx
│   │   │   │   ├── OrganizationContext.tsx
│   │   │   │   ├── SessionContext.tsx
│   │   │   │   └── UserContext.tsx
│   │   │   ├── errors
│   │   │   │   ├── errorThrower.ts
│   │   │   │   └── messages.ts
│   │   │   ├── errors.ts
│   │   │   ├── experimental.ts
│   │   │   ├── global.d.ts
│   │   │   ├── hooks
│   │   │   │   ├── __tests__
│   │   │   │   │   ├── __snapshots__
│   │   │   │   │   │   └── useRoutingProps.test.tsx.snap
│   │   │   │   │   ├── useAuth.test.tsx
│   │   │   │   │   ├── useAuth.type.test.ts
│   │   │   │   │   └── useRoutingProps.test.tsx
│   │   │   │   ├── index.ts
│   │   │   │   ├── useAssertWrappedByClerkProvider.ts
│   │   │   │   ├── useAuth.ts
│   │   │   │   ├── useClerkSignal.ts
│   │   │   │   ├── useEmailLink.ts
│   │   │   │   ├── useRoutingProps.ts
│   │   │   │   ├── useSignIn.ts
│   │   │   │   ├── useSignUp.ts
│   │   │   │   └── utils.ts
│   │   │   ├── index.ts
│   │   │   ├── internal.ts
│   │   │   ├── isomorphicClerk.ts
│   │   │   ├── polyfills.ts
│   │   │   ├── stateProxy.ts
│   │   │   ├── types.ts
│   │   │   └── utils
│   │   │       ├── __tests__
│   │   │       │   ├── useCustomMenuItems.test.tsx
│   │   │       │   └── useMaxAllowedInstancesGuard.test.tsx
│   │   │       ├── childrenUtils.tsx
│   │   │       ├── componentValidation.ts
│   │   │       ├── index.ts
│   │   │       ├── isConstructor.ts
│   │   │       ├── isDevOrStageUrl.tsx
│   │   │       ├── useCustomElementPortal.tsx
│   │   │       ├── useCustomMenuItems.tsx
│   │   │       ├── useCustomPages.tsx
│   │   │       ├── useMaxAllowedInstancesGuard.tsx
│   │   │       └── useWaitForComponentMount.ts
│   │   ├── subpaths.mjs
│   │   ├── tsconfig.declarations.json
│   │   ├── tsconfig.json
│   │   ├── tsconfig.test.json
│   │   ├── tsup.config.ts
│   │   ├── turbo.json
│   │   ├── typedoc.json
│   │   ├── vitest.config.mts
│   │   └── vitest.setup.mts
│   ├── react-router
│   │   ├── CHANGELOG.md
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── src
│   │   │   ├── __tests__
│   │   │   │   ├── __snapshots__
│   │   │   │   │   └── exports.test.ts.snap
│   │   │   │   └── exports.test.ts
│   │   │   ├── api
│   │   │   │   └── index.ts
│   │   │   ├── client
│   │   │   │   ├── index.ts
│   │   │   │   ├── ReactRouterClerkProvider.tsx
│   │   │   │   ├── ReactRouterOptionsContext.tsx
│   │   │   │   ├── types.ts
│   │   │   │   ├── uiComponents.tsx
│   │   │   │   ├── useAwaitableNavigate.tsx
│   │   │   │   └── usePathnameWithoutSplatRouteParams.tsx
│   │   │   ├── errors.ts
│   │   │   ├── errorThrower.ts
│   │   │   ├── global.d.ts
│   │   │   ├── index.ts
│   │   │   ├── server
│   │   │   │   ├── __tests__
│   │   │   │   │   ├── clerkMiddleware.test.ts
│   │   │   │   │   ├── getAuth.test.ts
│   │   │   │   │   └── rootAuthLoader.test.ts
│   │   │   │   ├── clerkClient.ts
│   │   │   │   ├── clerkMiddleware.ts
│   │   │   │   ├── getAuth.ts
│   │   │   │   ├── index.ts
│   │   │   │   ├── legacyAuthenticateRequest.ts
│   │   │   │   ├── loadOptions.ts
│   │   │   │   ├── rootAuthLoader.ts
│   │   │   │   ├── types.ts
│   │   │   │   └── utils.ts
│   │   │   ├── ssr
│   │   │   │   └── index.ts
│   │   │   ├── utils
│   │   │   │   ├── __tests__
│   │   │   │   │   └── assert.test.ts
│   │   │   │   ├── assert.ts
│   │   │   │   ├── env.ts
│   │   │   │   └── errors.ts
│   │   │   └── webhooks.ts
│   │   ├── tsconfig.json
│   │   ├── tsup.config.ts
│   │   ├── vitest.config.mts
│   │   └── vitest.setup.mts
│   ├── remix
│   │   ├── api.server
│   │   │   └── package.json
│   │   ├── CHANGELOG.md
│   │   ├── errors
│   │   │   └── package.json
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── src
│   │   │   ├── __tests__
│   │   │   │   ├── __snapshots__
│   │   │   │   │   └── exports.test.ts.snap
│   │   │   │   └── exports.test.ts
│   │   │   ├── api
│   │   │   │   └── index.ts
│   │   │   ├── client
│   │   │   │   ├── ClerkApp.tsx
│   │   │   │   ├── index.ts
│   │   │   │   ├── RemixClerkProvider.tsx
│   │   │   │   ├── RemixOptionsContext.tsx
│   │   │   │   ├── types.ts
│   │   │   │   ├── uiComponents.tsx
│   │   │   │   ├── useAwaitableNavigate.tsx
│   │   │   │   └── usePathnameWithoutSplatRouteParams.tsx
│   │   │   ├── errors.ts
│   │   │   ├── errorThrower.ts
│   │   │   ├── global.d.ts
│   │   │   ├── globalPolyfill.ts
│   │   │   ├── index.ts
│   │   │   ├── ssr
│   │   │   │   ├── authenticateRequest.ts
│   │   │   │   ├── getAuth.ts
│   │   │   │   ├── index.ts
│   │   │   │   ├── loadOptions.ts
│   │   │   │   ├── rootAuthLoader.ts
│   │   │   │   ├── types.ts
│   │   │   │   └── utils.ts
│   │   │   └── utils
│   │   │       ├── errors.ts
│   │   │       ├── index.ts
│   │   │       └── utils.ts
│   │   ├── ssr.server
│   │   │   └── package.json
│   │   ├── tsconfig.declarations.json
│   │   ├── tsconfig.json
│   │   ├── tsup.config.ts
│   │   ├── vitest.config.mts
│   │   └── vitest.setup.mts
│   ├── shared
│   │   ├── .gitignore
│   │   ├── CHANGELOG.md
│   │   ├── docs
│   │   │   ├── use-clerk.md
│   │   │   ├── use-session-list.md
│   │   │   ├── use-session.md
│   │   │   └── use-user.md
│   │   ├── global.d.ts
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── scripts
│   │   │   └── postinstall.mjs
│   │   ├── src
│   │   │   ├── __tests__
│   │   │   │   ├── apiUrlFromPublishableKey.spec.ts
│   │   │   │   ├── browser.spec.ts
│   │   │   │   ├── buildAccountsBaseUrl.spec.ts
│   │   │   │   ├── color.spec.ts
│   │   │   │   ├── color.test.ts.bak
│   │   │   │   ├── date.spec.ts
│   │   │   │   ├── deprecated.spec.ts
│   │   │   │   ├── deriveState.spec.ts
│   │   │   │   ├── devbrowser.spec.ts
│   │   │   │   ├── error.spec.ts
│   │   │   │   ├── eventBus.spec.ts
│   │   │   │   ├── fastDeepMerge.spec.ts
│   │   │   │   ├── handleValueOrFn.spec.ts
│   │   │   │   ├── jwtPayloadParser.spec.ts
│   │   │   │   ├── keys.spec.ts
│   │   │   │   ├── loadClerkJsScript.spec.ts
│   │   │   │   ├── localStorageBroadcastChannel.spec.ts
│   │   │   │   ├── logger.spec.ts
│   │   │   │   ├── netlifyCacheHandler.spec.ts
│   │   │   │   ├── organization.spec.ts
│   │   │   │   ├── pathMatcher.spec.ts
│   │   │   │   ├── proxy.spec.ts
│   │   │   │   ├── retry.spec.ts
│   │   │   │   ├── telemetry.logs.spec.ts
│   │   │   │   ├── underscore.spec.ts
│   │   │   │   ├── url.spec.ts
│   │   │   │   └── versionSelector.spec.ts
│   │   │   ├── alternativePhoneCode.ts
│   │   │   ├── apiUrlFromPublishableKey.ts
│   │   │   ├── authorization-errors.ts
│   │   │   ├── authorization.ts
│   │   │   ├── browser.ts
│   │   │   ├── buildAccountsBaseUrl.ts
│   │   │   ├── clerkEventBus.ts
│   │   │   ├── color.ts
│   │   │   ├── compiled
│   │   │   │   └── path-to-regexp
│   │   │   │       ├── index.js
│   │   │   │       └── LICENSE.txt
│   │   │   ├── constants.ts
│   │   │   ├── cookie.ts
│   │   │   ├── date.ts
│   │   │   ├── deprecated.ts
│   │   │   ├── deriveState.ts
│   │   │   ├── devBrowser.ts
│   │   │   ├── dom
│   │   │   │   ├── index.ts
│   │   │   │   └── waitForElement.ts
│   │   │   ├── error.ts
│   │   │   ├── errors
│   │   │   │   ├── clerkApiError.ts
│   │   │   │   ├── clerkApiResponseError.ts
│   │   │   │   ├── clerkError.ts
│   │   │   │   ├── clerkRuntimeError.ts
│   │   │   │   ├── createErrorTypeGuard.ts
│   │   │   │   ├── emailLinkError.ts
│   │   │   │   ├── errorThrower.ts
│   │   │   │   ├── globalHookError.ts
│   │   │   │   ├── helpers.ts
│   │   │   │   ├── metamaskError.ts
│   │   │   │   ├── parseError.ts
│   │   │   │   └── webAuthNError.ts
│   │   │   ├── eventBus.ts
│   │   │   ├── file.ts
│   │   │   ├── getEnvVariable.ts
│   │   │   ├── globs.ts
│   │   │   ├── handleValueOrFn.ts
│   │   │   ├── index.ts
│   │   │   ├── isomorphicAtob.ts
│   │   │   ├── isomorphicBtoa.ts
│   │   │   ├── jwtPayloadParser.ts
│   │   │   ├── keys.ts
│   │   │   ├── loadClerkJsScript.ts
│   │   │   ├── loadScript.ts
│   │   │   ├── localStorageBroadcastChannel.ts
│   │   │   ├── logger.ts
│   │   │   ├── netlifyCacheHandler.ts
│   │   │   ├── oauth.ts
│   │   │   ├── object.ts
│   │   │   ├── organization.ts
│   │   │   ├── pathMatcher.ts
│   │   │   ├── pathToRegexp.ts
│   │   │   ├── poller.ts
│   │   │   ├── proxy.ts
│   │   │   ├── react
│   │   │   │   ├── __tests__
│   │   │   │   │   ├── commerce.test.tsx
│   │   │   │   │   └── useReverification.spec.ts
│   │   │   │   ├── clerk-rq
│   │   │   │   │   ├── queryOptions.ts
│   │   │   │   │   ├── types.ts
│   │   │   │   │   ├── use-clerk-query-client.ts
│   │   │   │   │   ├── useBaseQuery.ts
│   │   │   │   │   └── useQuery.ts
│   │   │   │   ├── clerk-swr.ts
│   │   │   │   ├── commerce.tsx
│   │   │   │   ├── contexts.tsx
│   │   │   │   ├── hooks
│   │   │   │   │   ├── __tests__
│   │   │   │   │   │   ├── createBillingPaginatedHook.spec.tsx
│   │   │   │   │   │   ├── useCheckout.type.spec.ts
│   │   │   │   │   │   ├── usePagesOrInfinite.spec.ts
│   │   │   │   │   │   ├── usePlans.spec.tsx
│   │   │   │   │   │   ├── usePreviousValue.spec.ts
│   │   │   │   │   │   ├── useSafeValues.spec.ts
│   │   │   │   │   │   ├── useSubscription.spec.tsx
│   │   │   │   │   │   └── wrapper.tsx
│   │   │   │   │   ├── createBillingPaginatedHook.tsx
│   │   │   │   │   ├── createContextAndHook.ts
│   │   │   │   │   ├── index.ts
│   │   │   │   │   ├── useAPIKeys.ts
│   │   │   │   │   ├── useCheckout.ts
│   │   │   │   │   ├── useClerk.ts
│   │   │   │   │   ├── useDeepEqualMemo.ts
│   │   │   │   │   ├── useOrganization.tsx
│   │   │   │   │   ├── useOrganizationList.tsx
│   │   │   │   │   ├── usePagesOrInfinite.ts
│   │   │   │   │   ├── usePaymentAttempts.tsx
│   │   │   │   │   ├── usePaymentMethods.tsx
│   │   │   │   │   ├── usePlans.tsx
│   │   │   │   │   ├── usePreviousValue.ts
│   │   │   │   │   ├── useReverification.ts
│   │   │   │   │   ├── useSafeLayoutEffect.tsx
│   │   │   │   │   ├── useSession.ts
│   │   │   │   │   ├── useSessionList.ts
│   │   │   │   │   ├── useStatements.tsx
│   │   │   │   │   ├── useSubscription.rq.tsx
│   │   │   │   │   ├── useSubscription.swr.tsx
│   │   │   │   │   ├── useSubscription.tsx
│   │   │   │   │   ├── useSubscription.types.ts
│   │   │   │   │   └── useUser.ts
│   │   │   │   ├── index.ts
│   │   │   │   ├── providers
│   │   │   │   │   ├── SWRConfigCompat.rq.tsx
│   │   │   │   │   ├── SWRConfigCompat.swr.tsx
│   │   │   │   │   └── SWRConfigCompat.tsx
│   │   │   │   ├── stripe-react
│   │   │   │   │   ├── index.tsx
│   │   │   │   │   └── utils.ts
│   │   │   │   └── types.ts
│   │   │   ├── retry.ts
│   │   │   ├── router
│   │   │   │   ├── __tests__
│   │   │   │   │   └── router.spec.ts
│   │   │   │   ├── react.tsx
│   │   │   │   └── router.ts
│   │   │   ├── router.ts
│   │   │   ├── saml.ts
│   │   │   ├── telemetry
│   │   │   │   ├── collector.ts
│   │   │   │   ├── events
│   │   │   │   │   ├── __tests__
│   │   │   │   │   │   └── theme-usage.spec.ts
│   │   │   │   │   ├── component-mounted.ts
│   │   │   │   │   ├── framework-metadata.ts
│   │   │   │   │   ├── index.ts
│   │   │   │   │   ├── method-called.ts
│   │   │   │   │   └── theme-usage.ts
│   │   │   │   ├── throttler.ts
│   │   │   │   └── types.ts
│   │   │   ├── telemetry.ts
│   │   │   ├── types
│   │   │   │   ├── apiKeys.ts
│   │   │   │   ├── apiKeysSettings.ts
│   │   │   │   ├── appearance.ts
│   │   │   │   ├── attributes.ts
│   │   │   │   ├── authConfig.ts
│   │   │   │   ├── authObject.ts
│   │   │   │   ├── backupCode.ts
│   │   │   │   ├── billing.ts
│   │   │   │   ├── clerk.ts
│   │   │   │   ├── client.ts
│   │   │   │   ├── commerceSettings.ts
│   │   │   │   ├── customMenuItems.ts
│   │   │   │   ├── customPages.ts
│   │   │   │   ├── deletedObject.ts
│   │   │   │   ├── displayConfig.ts
│   │   │   │   ├── elementIds.ts
│   │   │   │   ├── emailAddress.ts
│   │   │   │   ├── enterpriseAccount.ts
│   │   │   │   ├── environment.ts
│   │   │   │   ├── errors.ts
│   │   │   │   ├── externalAccount.ts
│   │   │   │   ├── factors.ts
│   │   │   │   ├── hooks.ts
│   │   │   │   ├── identificationLink.ts
│   │   │   │   ├── identifiers.ts
│   │   │   │   ├── image.ts
│   │   │   │   ├── index.ts
│   │   │   │   ├── instance.ts
│   │   │   │   ├── json.ts
│   │   │   │   ├── jwt.ts
│   │   │   │   ├── jwtv2.ts
│   │   │   │   ├── key.ts
│   │   │   │   ├── localization.ts
│   │   │   │   ├── multiDomain.ts
│   │   │   │   ├── oauth.ts
│   │   │   │   ├── organization.ts
│   │   │   │   ├── organizationDomain.ts
│   │   │   │   ├── organizationInvitation.ts
│   │   │   │   ├── organizationMembership.ts
│   │   │   │   ├── organizationMembershipRequest.ts
│   │   │   │   ├── organizationSettings.ts
│   │   │   │   ├── organizationSuggestion.ts
│   │   │   │   ├── pagination.ts
│   │   │   │   ├── passkey.ts
│   │   │   │   ├── passwords.ts
│   │   │   │   ├── permission.ts
│   │   │   │   ├── phoneCodeChannel.ts
│   │   │   │   ├── phoneNumber.ts
│   │   │   │   ├── protect.ts
│   │   │   │   ├── redirects.ts
│   │   │   │   ├── resource.ts
│   │   │   │   ├── role.ts
│   │   │   │   ├── router.ts
│   │   │   │   ├── runtime-values.ts
│   │   │   │   ├── saml.ts
│   │   │   │   ├── samlAccount.ts
│   │   │   │   ├── samlConnection.ts
│   │   │   │   ├── session.ts
│   │   │   │   ├── sessionVerification.ts
│   │   │   │   ├── signIn.ts
│   │   │   │   ├── signInCommon.ts
│   │   │   │   ├── signInFuture.ts
│   │   │   │   ├── signUp.ts
│   │   │   │   ├── signUpCommon.ts
│   │   │   │   ├── signUpFuture.ts
│   │   │   │   ├── snapshots.ts
│   │   │   │   ├── ssr.ts
│   │   │   │   ├── state.ts
│   │   │   │   ├── strategies.ts
│   │   │   │   ├── telemetry.ts
│   │   │   │   ├── theme.ts
│   │   │   │   ├── token.ts
│   │   │   │   ├── totp.ts
│   │   │   │   ├── user.ts
│   │   │   │   ├── userOrganizationInvitation.ts
│   │   │   │   ├── userSettings.ts
│   │   │   │   ├── utils copy.ts
│   │   │   │   ├── utils.ts
│   │   │   │   ├── verification.ts
│   │   │   │   ├── virtual-data-hooks.d.ts
│   │   │   │   ├── waitlist.ts
│   │   │   │   ├── web3.ts
│   │   │   │   └── web3Wallet.ts
│   │   │   ├── underscore.ts
│   │   │   ├── url.ts
│   │   │   ├── utils
│   │   │   │   ├── __tests__
│   │   │   │   │   ├── createDeferredPromise.spec.ts
│   │   │   │   │   └── instance.spec.ts
│   │   │   │   ├── allSettled.ts
│   │   │   │   ├── createDeferredPromise.ts
│   │   │   │   ├── fastDeepMerge.ts
│   │   │   │   ├── handleValueOrFn.ts
│   │   │   │   ├── index.ts
│   │   │   │   ├── instance.ts
│   │   │   │   ├── logErrorInDevMode.ts
│   │   │   │   ├── noop.ts
│   │   │   │   └── runtimeEnvironment.ts
│   │   │   ├── versionSelector.ts
│   │   │   ├── web3.ts
│   │   │   ├── webauthn.ts
│   │   │   └── workerTimers
│   │   │       ├── createWorkerTimers.ts
│   │   │       ├── index.ts
│   │   │       ├── workerTimers.built.ts
│   │   │       ├── workerTimers.types.ts
│   │   │       └── workerTimers.worker.ts
│   │   ├── subpaths.mjs
│   │   ├── tsconfig.json
│   │   ├── tsconfig.test.json
│   │   ├── tsdown.config.mts
│   │   ├── typedoc.json
│   │   ├── vitest.config.mts
│   │   └── vitest.setup.mts
│   ├── tanstack-react-start
│   │   ├── .gitignore
│   │   ├── CHANGELOG.md
│   │   ├── errors
│   │   │   └── package.json
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── server
│   │   │   └── package.json
│   │   ├── src
│   │   │   ├── __tests__
│   │   │   │   ├── __snapshots__
│   │   │   │   │   └── exports.test.ts.snap
│   │   │   │   └── exports.test.ts
│   │   │   ├── client
│   │   │   │   ├── ClerkProvider.tsx
│   │   │   │   ├── index.ts
│   │   │   │   ├── OptionsContext.tsx
│   │   │   │   ├── types.ts
│   │   │   │   ├── uiComponents.tsx
│   │   │   │   ├── useAwaitableNavigate.ts
│   │   │   │   └── utils.ts
│   │   │   ├── errors.ts
│   │   │   ├── experimental.ts
│   │   │   ├── global.d.ts
│   │   │   ├── index.ts
│   │   │   ├── server
│   │   │   │   ├── auth.ts
│   │   │   │   ├── clerkClient.ts
│   │   │   │   ├── clerkMiddleware.ts
│   │   │   │   ├── constants.ts
│   │   │   │   ├── index.ts
│   │   │   │   ├── loadOptions.ts
│   │   │   │   ├── types.ts
│   │   │   │   └── utils
│   │   │   │       └── index.ts
│   │   │   ├── utils
│   │   │   │   ├── env.ts
│   │   │   │   ├── errors.ts
│   │   │   │   └── index.ts
│   │   │   └── webhooks.ts
│   │   ├── tsconfig.declarations.json
│   │   ├── tsconfig.json
│   │   ├── tsup.config.ts
│   │   ├── vite-env.d.ts
│   │   ├── vitest.config.mts
│   │   ├── vitest.setup.mts
│   │   └── webhooks
│   │       └── package.json
│   ├── testing
│   │   ├── .gitignore
│   │   ├── CHANGELOG.md
│   │   ├── cypress
│   │   │   └── package.json
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── playwright
│   │   │   └── package.json
│   │   ├── README.md
│   │   ├── src
│   │   │   ├── common
│   │   │   │   ├── constants.ts
│   │   │   │   ├── errors.ts
│   │   │   │   ├── helpers-utils.ts
│   │   │   │   ├── index.ts
│   │   │   │   ├── setup.ts
│   │   │   │   └── types.ts
│   │   │   ├── cypress
│   │   │   │   ├── custom-commands.ts
│   │   │   │   ├── index.ts
│   │   │   │   ├── setup.ts
│   │   │   │   └── setupClerkTestingToken.ts
│   │   │   ├── index.ts
│   │   │   └── playwright
│   │   │       ├── helpers.ts
│   │   │       ├── index.ts
│   │   │       ├── setup.ts
│   │   │       ├── setupClerkTestingToken.ts
│   │   │       └── unstable
│   │   │           ├── index.ts
│   │   │           └── page-objects
│   │   │               ├── apiKeys.ts
│   │   │               ├── app.ts
│   │   │               ├── checkout.ts
│   │   │               ├── clerk.ts
│   │   │               ├── common.ts
│   │   │               ├── expect.ts
│   │   │               ├── impersonation.ts
│   │   │               ├── index.ts
│   │   │               ├── keylessPopover.ts
│   │   │               ├── organizationSwitcher.ts
│   │   │               ├── planDetails.ts
│   │   │               ├── pricingTable.ts
│   │   │               ├── sessionTask.ts
│   │   │               ├── signIn.ts
│   │   │               ├── signUp.ts
│   │   │               ├── subscriptionDetails.ts
│   │   │               ├── testingToken.ts
│   │   │               ├── userAvatar.ts
│   │   │               ├── userButton.ts
│   │   │               ├── userProfile.ts
│   │   │               ├── userVerification.ts
│   │   │               └── waitlist.ts
│   │   ├── tsconfig.json
│   │   └── tsup.config.ts
│   ├── themes
│   │   ├── CHANGELOG.md
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── src
│   │   │   ├── createTheme.ts
│   │   │   ├── index.ts
│   │   │   └── themes
│   │   │       ├── dark.ts
│   │   │       ├── index.ts
│   │   │       ├── neobrutalism.ts
│   │   │       ├── shadcn.css
│   │   │       ├── shadcn.ts
│   │   │       ├── shadesOfPurple.ts
│   │   │       └── simple.ts
│   │   ├── tsconfig.json
│   │   └── tsup.config.ts
│   ├── types
│   │   ├── CHANGELOG.md
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.md
│   │   └── src
│   │       ├── index.d.mts
│   │       ├── index.d.ts
│   │       ├── index.js
│   │       └── index.mjs
│   ├── upgrade
│   │   ├── .gitignore
│   │   ├── CHANGELOG.md
│   │   ├── LICENSE
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── src
│   │   │   ├── app.js
│   │   │   ├── cli.js
│   │   │   ├── codemods
│   │   │   │   ├── __tests__
│   │   │   │   │   ├── __fixtures__
│   │   │   │   │   │   ├── transform-async-request.fixtures.js
│   │   │   │   │   │   └── transform-clerk-provider-dynamic.fixtures.js
│   │   │   │   │   ├── transform-async-request.test.js
│   │   │   │   │   └── transform-clerk-provider-dynamic.test.js
│   │   │   │   ├── index.js
│   │   │   │   ├── transform-async-request.cjs
│   │   │   │   └── transform-clerk-provider-dynamic.cjs
│   │   │   ├── components
│   │   │   │   ├── Codemod.js
│   │   │   │   ├── Command.js
│   │   │   │   ├── Header.js
│   │   │   │   ├── Scan.js
│   │   │   │   ├── SDKWorkflow.js
│   │   │   │   └── UpgradeSDK.js
│   │   │   ├── constants
│   │   │   │   ├── sdks.js
│   │   │   │   └── versions.js
│   │   │   ├── guide-generators
│   │   │   │   ├── core-2
│   │   │   │   │   ├── backend
│   │   │   │   │   │   ├── import-paths.mdx
│   │   │   │   │   │   ├── index.js
│   │   │   │   │   │   └── intro.mdx
│   │   │   │   │   ├── chrome-extension
│   │   │   │   │   │   ├── index.js
│   │   │   │   │   │   └── intro.mdx
│   │   │   │   │   ├── expo
│   │   │   │   │   │   ├── index.js
│   │   │   │   │   │   └── intro.mdx
│   │   │   │   │   ├── fastify
│   │   │   │   │   │   ├── index.js
│   │   │   │   │   │   └── intro.mdx
│   │   │   │   │   ├── generate-all.sh
│   │   │   │   │   ├── js
│   │   │   │   │   │   ├── index.js
│   │   │   │   │   │   └── intro.mdx
│   │   │   │   │   ├── nextjs
│   │   │   │   │   │   ├── import-changes.mdx
│   │   │   │   │   │   ├── index.js
│   │   │   │   │   │   ├── intro.mdx
│   │   │   │   │   │   ├── middleware-changes.mdx
│   │   │   │   │   │   └── nextjs-version.mdx
│   │   │   │   │   ├── node
│   │   │   │   │   │   ├── index.js
│   │   │   │   │   │   ├── intro.mdx
│   │   │   │   │   │   └── node-setters-removals.mdx
│   │   │   │   │   ├── overview
│   │   │   │   │   │   ├── index.js
│   │   │   │   │   │   └── intro.mdx
│   │   │   │   │   ├── react
│   │   │   │   │   │   ├── hof-removals.mdx
│   │   │   │   │   │   ├── index.js
│   │   │   │   │   │   └── intro.mdx
│   │   │   │   │   ├── remix
│   │   │   │   │   │   ├── index.js
│   │   │   │   │   │   └── intro.mdx
│   │   │   │   │   ├── retheme
│   │   │   │   │   │   ├── index.js
│   │   │   │   │   │   └── intro.mdx
│   │   │   │   │   └── shared
│   │   │   │   │       ├── after-sign-x-handling.mdx
│   │   │   │   │       ├── cli.mdx
│   │   │   │   │       ├── deprecation-removals.mdx
│   │   │   │   │       ├── image-url.mdx
│   │   │   │   │       ├── node-version.mdx
│   │   │   │   │       ├── orgs-claim.mdx
│   │   │   │   │       ├── pagination-args.mdx
│   │   │   │   │       ├── pagination-return.mdx
│   │   │   │   │       ├── path-routing.mdx
│   │   │   │   │       ├── prepare.mdx
│   │   │   │   │       ├── react-version.mdx
│   │   │   │   │       ├── redesign-preview.mdx
│   │   │   │   │       └── update-version.mdx
│   │   │   │   └── text-generation.js
│   │   │   ├── img
│   │   │   │   ├── alternativemethods-backlink.png
│   │   │   │   ├── button-to-organizationlistcreateorganizationactionbutton.png
│   │   │   │   ├── connected-accounts-dropdown.png
│   │   │   │   ├── mfa-dropdown.png
│   │   │   │   ├── organizationprofile-settings.png
│   │   │   │   ├── remove-identitypreview-avatar.png
│   │   │   │   ├── remove-socialbuttonsblockbuttonarrow.png
│   │   │   │   ├── userbuttonpopoveractionbuttontext-removed.png
│   │   │   │   └── userprofile-security.png
│   │   │   ├── util
│   │   │   │   ├── all-titles.js
│   │   │   │   ├── expandable-list.js
│   │   │   │   ├── generate-changelog.js
│   │   │   │   ├── get-clerk-version.js
│   │   │   │   ├── guess-framework.js
│   │   │   │   └── load-change.js
│   │   │   └── versions
│   │   │       └── core-2
│   │   │           ├── backend
│   │   │           │   ├── api-url-value-changed.md
│   │   │           │   ├── authenticaterequest-params-change.md
│   │   │           │   ├── buildrequesturl-removed.md
│   │   │           │   ├── clerk-import.md
│   │   │           │   ├── client-unstableoptions-removed.md
│   │   │           │   ├── clockskewinseconds.md
│   │   │           │   ├── constants-import-path-move.md
│   │   │           │   ├── createauthenticaterequest-import-path-move.md
│   │   │           │   ├── createclerkclient-apikey.md
│   │   │           │   ├── createclerkclient-frontendapi.md
│   │   │           │   ├── createemail-removed.md
│   │   │           │   ├── createisomorphicrequest-import-path-move.md
│   │   │           │   ├── createisomorphicrequest-removed.md
│   │   │           │   ├── decodejwt-import-path-move.md
│   │   │           │   ├── getclientlist-arguments.md
│   │   │           │   ├── getorganizationmembershiplist-return-signature.md
│   │   │           │   ├── getpendingorganizationinvitationlist.md
│   │   │           │   ├── getsessionlist-arguments.md
│   │   │           │   ├── httpoptions-removed.md
│   │   │           │   ├── interstitial-removed.md
│   │   │           │   ├── members-count.md
│   │   │           │   ├── membershiprole.md
│   │   │           │   ├── organizationjson-logourl.md
│   │   │           │   ├── organizationmembershippublicuserdatajson-profileimageurl.md
│   │   │           │   ├── pkgversion.md
│   │   │           │   ├── redirect-import-path-move.md
│   │   │           │   ├── signjwt-import-path-move.md
│   │   │           │   ├── signjwterror-import-move.md
│   │   │           │   ├── tokenverificationerror-import-move.md
│   │   │           │   ├── tokenverificationerroraction-import-move.md
│   │   │           │   ├── tokenverificationerrorcode-import-move.md
│   │   │           │   ├── tokenverificationerrorreason-import-move.md
│   │   │           │   ├── userjson-profileimageurl.md
│   │   │           │   └── verifyjwt-import-path-move.md
│   │   │           ├── chrome-extension
│   │   │           │   └── clerkprovider-tokencache.md
│   │   │           ├── common
│   │   │           │   ├── aftersignxurl-changes.md
│   │   │           │   ├── afterswitchorganizationurl.md
│   │   │           │   ├── alternativemethods-backlink.md
│   │   │           │   ├── api-key-to-secret-key.md
│   │   │           │   ├── appearance-organizationpreview-organizationswitcher.md
│   │   │           │   ├── appearance-variables-breaking-changes.md
│   │   │           │   ├── button-to-organizationlistcreateorganizationactionbutton.md
│   │   │           │   ├── card-changes.md
│   │   │           │   ├── changed-localization-keys.md
│   │   │           │   ├── clerkprovider-frontendapi-2.md
│   │   │           │   ├── clerkprovideroptionswrapper-dropped.md
│   │   │           │   ├── connected-accounts-dropdown.md
│   │   │           │   ├── emaillinkerrorcode-import-change.md
│   │   │           │   ├── externalaccount-avatarurl.md
│   │   │           │   ├── externalaccount-picture.md
│   │   │           │   ├── externalaccountjson-avatarurl.md
│   │   │           │   ├── frontend-api-to-publishable-key.md
│   │   │           │   ├── getallowlistidentifierlist-return-signature.md
│   │   │           │   ├── getclientlist-return-signature.md
│   │   │           │   ├── getinvitationlist-return-signature.md
│   │   │           │   ├── getorganizationinvitationlist-return-signature.md
│   │   │           │   ├── getorganizationinvitationlist-return-type-change.md
│   │   │           │   ├── getorganizationlist-return-signature.md
│   │   │           │   ├── getorganizationlist-return-type-change.md
│   │   │           │   ├── getorganizationmembershiplist-return-type-change.md
│   │   │           │   ├── getredirecturllist-return-signature.md
│   │   │           │   ├── getsessionlist-return-signature.md
│   │   │           │   ├── getuserlist-return-signature.md
│   │   │           │   ├── getuseroauthaccesstoken-return-signature.md
│   │   │           │   ├── handlemagiclinkverification.md
│   │   │           │   ├── isclerkapiresponserror-import-change.md
│   │   │           │   ├── isemaillinkerror-import-change.md
│   │   │           │   ├── isknownerror-import-change.md
│   │   │           │   ├── ismagiclinkerror.md
│   │   │           │   ├── ismetamaskerror-import-change.md
│   │   │           │   ├── magiclinkerror.md
│   │   │           │   ├── magiclinkerrorcode.md
│   │   │           │   ├── mfa-dropdown.md
│   │   │           │   ├── min-react-version.md
│   │   │           │   ├── multisessionappsupport-import-change.md
│   │   │           │   ├── navigate-to-routerpush-routerreplace.md
│   │   │           │   ├── new-localization-keys.md
│   │   │           │   ├── organization-create-string.md
│   │   │           │   ├── organization-getdomains-arguments-change.md
│   │   │           │   ├── organization-getinvitations-arguments-changed.md
│   │   │           │   ├── organization-getmembershiprequests-arguments-changed.md
│   │   │           │   ├── organization-getmemberships-arguments-changed.md
│   │   │           │   ├── organization-getpendinginvitations.md
│   │   │           │   ├── organization-getroles-arguments-changed.md
│   │   │           │   ├── organization-logourl.md
│   │   │           │   ├── organizationmembershippublicuserdata-profileimageurl.md
│   │   │           │   ├── organizationprofile-settings.md
│   │   │           │   ├── organizationswitcherpopoveractionbuttontext-removed.md
│   │   │           │   ├── remove-identitypreview-avatar.md
│   │   │           │   ├── remove-socialbuttonsblockbuttonarrow.md
│   │   │           │   ├── removed-localization-keys.md
│   │   │           │   ├── setsession.md
│   │   │           │   ├── signoutcallback-to-redirecturl.md
│   │   │           │   ├── supported-external-accounts-removed.md
│   │   │           │   ├── usemagiclink.md
│   │   │           │   ├── useorganization-invitationlist.md
│   │   │           │   ├── useorganization-membershiplist.md
│   │   │           │   ├── useorganizations.md
│   │   │           │   ├── user-getorganizationinvitations-arguments-changed.md
│   │   │           │   ├── user-getorganizationmemberships-arguments-changed.md
│   │   │           │   ├── user-getorganizationmemberships-return-signature.md
│   │   │           │   ├── user-getorganizationsuggestions-arguments-changed.md
│   │   │           │   ├── user-profileimageurl.md
│   │   │           │   ├── user-update-password.md
│   │   │           │   ├── userbuttonpopoveractionbuttontext-removed.md
│   │   │           │   ├── userbuttontrigger-userbuttonbox-invert.md
│   │   │           │   ├── userprofile-prop.md
│   │   │           │   ├── userprofile-security.md
│   │   │           │   ├── withclerk-hof-removed.md
│   │   │           │   ├── withclerk-removed.md
│   │   │           │   ├── withsession-hof-removed.md
│   │   │           │   ├── withsession-removed.md
│   │   │           │   ├── withuser-hof-removed.md
│   │   │           │   └── withuser-removed-2.md
│   │   │           ├── expo
│   │   │           │   ├── apikey-to-publishable-key.md
│   │   │           │   └── clerkprovider-frontendapi.md
│   │   │           ├── fastify
│   │   │           │   ├── api-url-value-change.md
│   │   │           │   ├── clerk-import-change.md
│   │   │           │   ├── clerkplugin-frontendapi.md
│   │   │           │   ├── createclerkclient-apikey.md
│   │   │           │   └── createclerkclient-frontendapi.md
│   │   │           ├── index.js
│   │   │           ├── js
│   │   │           │   ├── clerk-import.md
│   │   │           │   ├── clerk-isready-removed.md
│   │   │           │   ├── experimental-canusecaptcha.md
│   │   │           │   ├── experimental-captchasitekey.md
│   │   │           │   ├── experimental-captchaurl.md
│   │   │           │   ├── getorganizationmemberships.md
│   │   │           │   ├── lastorganizationinvitation-member.md
│   │   │           │   ├── redirecttohome.md
│   │   │           │   ├── signup-attemptweb3walletverification-generatedsignature.md
│   │   │           │   ├── unstable-invitationupdate.md
│   │   │           │   ├── unstable-membershipupdate.md
│   │   │           │   ├── user-createexternalaccount-redirecturl.md
│   │   │           │   └── user-orgpublicdata-profileimageurl.md
│   │   │           ├── nextjs
│   │   │           │   ├── api-url-value-change.md
│   │   │           │   ├── auth-import-change.md
│   │   │           │   ├── auth-middleware-deprecated.md
│   │   │           │   ├── authmiddleware-apikey.md
│   │   │           │   ├── authmiddleware-frontendapi.md
│   │   │           │   ├── authmiddleware-import-change.md
│   │   │           │   ├── buildclerkprops-import-change.md
│   │   │           │   ├── clerk-import-change.md
│   │   │           │   ├── clerk-js-version-next-public.md
│   │   │           │   ├── constants-import-change.md
│   │   │           │   ├── createauthenticaterequest-import-change.md
│   │   │           │   ├── createclerkclient-apikey.md
│   │   │           │   ├── createclerkclient-frontendapi.md
│   │   │           │   ├── createisomorphicrequest-import-change.md
│   │   │           │   ├── currentuser-import-change.md
│   │   │           │   ├── decodejwt-import-change.md
│   │   │           │   ├── emaillinkerrorcode-import-change.md
│   │   │           │   ├── getauth-apikey.md
│   │   │           │   ├── import-api-url.md
│   │   │           │   ├── import-api-version.md
│   │   │           │   ├── import-clerk-js-url.md
│   │   │           │   ├── import-clerk-js-version.md
│   │   │           │   ├── import-domain.md
│   │   │           │   ├── import-is-satellite.md
│   │   │           │   ├── import-nextjs-api.md
│   │   │           │   ├── import-nextjs-app-beta.md
│   │   │           │   ├── import-nextjs-edge-middleware.md
│   │   │           │   ├── import-nextjs-edge-middlewarefiles.md
│   │   │           │   ├── import-nextjs-ssr.md
│   │   │           │   ├── import-proxy-url.md
│   │   │           │   ├── import-publishable-key.md
│   │   │           │   ├── import-secret-key.md
│   │   │           │   ├── import-sign-in-url.md
│   │   │           │   ├── import-sign-up-url.md
│   │   │           │   ├── isclerkapiresponserror-import-change.md
│   │   │           │   ├── isemaillinkerror-import-change.md
│   │   │           │   ├── isknownerror-import-change.md
│   │   │           │   ├── min-nextjs-version.md
│   │   │           │   ├── multisessionappsupport-import-change.md
│   │   │           │   ├── next-public-clerk-js-url.md
│   │   │           │   ├── redirect-import-change.md
│   │   │           │   ├── redirecttosignin-import-path.md
│   │   │           │   ├── redirecttosignup-import-path.md
│   │   │           │   ├── signjwt-import-change.md
│   │   │           │   ├── verifyjwt-import-change.md
│   │   │           │   ├── verifytoken-import-change.md
│   │   │           │   └── with-clerk-middleware-removed.md
│   │   │           ├── node
│   │   │           │   ├── api-url-value-change.md
│   │   │           │   ├── cjs-esm-instance.md
│   │   │           │   ├── clerk-import-change.md
│   │   │           │   ├── clerkexpressrequireauth-apikey.md
│   │   │           │   ├── clerkexpressrequireauth-frontendapi.md
│   │   │           │   ├── clerkexpresswithauth-apikey.md
│   │   │           │   ├── clerkexpresswithauth-frontendapi.md
│   │   │           │   ├── createclerkclient-apikey.md
│   │   │           │   ├── createclerkclient-frontendapi.md
│   │   │           │   ├── createclerkexpressrequireauth-apikey.md
│   │   │           │   ├── createclerkexpressrequireauth-frontendapi.md
│   │   │           │   ├── createclerkexpressrequireauth-public-key-required.md
│   │   │           │   ├── createclerkexpresswithauth-apikey.md
│   │   │           │   ├── createclerkexpresswithauth-frontendapi.md
│   │   │           │   ├── createclerkexpresswithauth-publickey-required.md
│   │   │           │   ├── legacyauthobject-removed.md
│   │   │           │   ├── setclerkapikey.md
│   │   │           │   ├── setclerkapiversion.md
│   │   │           │   ├── setclerkhttpoptions.md
│   │   │           │   └── setclerkserverapiurl.md
│   │   │           ├── react
│   │   │           │   └── api-url-value-change.md
│   │   │           ├── remix
│   │   │           │   ├── clerk-import-change.md
│   │   │           │   ├── clerkerrorboundary-removed.md
│   │   │           │   ├── createclerkclient-apikey.md
│   │   │           │   ├── getauth-apikey.md
│   │   │           │   ├── rootauthloader-apikey.md
│   │   │           │   └── rootauthloader-frontendapi.md
│   │   │           └── shared
│   │   │               ├── getrequesturl.md
│   │   │               ├── organizationcontext.md
│   │   │               └── useorganizationlist-organizationlist.md
│   │   ├── tsconfig.json
│   │   └── vitest.config.js
│   └── vue
│       ├── CHANGELOG.md
│       ├── LICENSE
│       ├── package.json
│       ├── README.md
│       ├── src
│       │   ├── components
│       │   │   ├── __tests__
│       │   │   │   ├── SignInButton.test.ts
│       │   │   │   ├── SignInWithMetamaskButton.test.ts
│       │   │   │   ├── SignOutButton.test.ts
│       │   │   │   └── SignUpButton.test.ts
│       │   │   ├── CheckoutButton.vue
│       │   │   ├── ClerkHostRenderer.ts
│       │   │   ├── controlComponents.ts
│       │   │   ├── index.ts
│       │   │   ├── PlanDetailsButton.vue
│       │   │   ├── SignInButton.vue
│       │   │   ├── SignInWithMetamaskButton.vue
│       │   │   ├── SignOutButton.vue
│       │   │   ├── SignUpButton.vue
│       │   │   ├── SubscriptionDetailsButton.vue
│       │   │   └── ui-components
│       │   │       ├── CreateOrganization.vue
│       │   │       ├── GoogleOneTap.vue
│       │   │       ├── OrganizationList.vue
│       │   │       ├── OrganizationProfile
│       │   │       │   ├── index.ts
│       │   │       │   └── OrganizationProfile.vue
│       │   │       ├── OrganizationSwitcher
│       │   │       │   ├── index.ts
│       │   │       │   └── OrganizationSwitcher.vue
│       │   │       ├── PricingTable.vue
│       │   │       ├── SignIn.vue
│       │   │       ├── SignUp.vue
│       │   │       ├── UserAvatar.vue
│       │   │       ├── UserButton
│       │   │       │   ├── index.ts
│       │   │       │   └── UserButton.vue
│       │   │       ├── UserProfile
│       │   │       │   ├── index.ts
│       │   │       │   └── UserProfile.vue
│       │   │       └── Waitlist.vue
│       │   ├── composables
│       │   │   ├── __tests__
│       │   │   │   └── useClerkContext.test.ts
│       │   │   ├── index.ts
│       │   │   ├── useAuth.ts
│       │   │   ├── useClerk.ts
│       │   │   ├── useClerkContext.ts
│       │   │   ├── useOrganization.ts
│       │   │   ├── useSession.ts
│       │   │   ├── useSessionList.ts
│       │   │   ├── useSignIn.ts
│       │   │   ├── useSignUp.ts
│       │   │   └── useUser.ts
│       │   ├── env.d.ts
│       │   ├── errors
│       │   │   ├── errorThrower.ts
│       │   │   └── messages.ts
│       │   ├── errors.ts
│       │   ├── experimental.ts
│       │   ├── global.d.ts
│       │   ├── index.ts
│       │   ├── internal.ts
│       │   ├── keys.ts
│       │   ├── plugin.ts
│       │   ├── types.ts
│       │   └── utils
│       │       ├── __tests__
│       │       │   ├── useCustomElementPortal.test.ts
│       │       │   └── useCustomMenuItems.test.ts
│       │       ├── childrenUtils.ts
│       │       ├── componentValidation.ts
│       │       ├── index.ts
│       │       ├── toComputedRefs.ts
│       │       ├── updateClerkOptions.ts
│       │       ├── useClerkLoaded.ts
│       │       ├── useCustomElementPortal.ts
│       │       ├── useCustomMenuItems.ts
│       │       └── useCustomPages.ts
│       ├── tsconfig.build.json
│       ├── tsconfig.json
│       ├── tsup.config.ts
│       ├── vitest.config.ts
│       └── vitest.setup.ts
├── patches
│   └── [email protected]
├── playground
│   ├── app-router
│   │   ├── .gitignore
│   │   ├── .vscode
│   │   │   └── settings.json
│   │   ├── next.config.js
│   │   ├── package.json
│   │   ├── public
│   │   │   ├── next.svg
│   │   │   └── vercel.svg
│   │   ├── README.md
│   │   ├── src
│   │   │   ├── app
│   │   │   │   ├── action
│   │   │   │   │   └── page.tsx
│   │   │   │   ├── api
│   │   │   │   │   └── hello
│   │   │   │   │       └── route.ts
│   │   │   │   ├── client
│   │   │   │   │   └── page.tsx
│   │   │   │   ├── favicon.ico
│   │   │   │   ├── globals.css
│   │   │   │   ├── layout.tsx
│   │   │   │   ├── page.module.css
│   │   │   │   ├── page.tsx
│   │   │   │   ├── protected
│   │   │   │   │   ├── ClientSideWrapper.tsx
│   │   │   │   │   └── page.tsx
│   │   │   │   ├── sign-in
│   │   │   │   │   └── [[...catchall]]
│   │   │   │   │       └── page.tsx
│   │   │   │   └── sign-up
│   │   │   │       └── [[...catchall]]
│   │   │   │           └── page.tsx
│   │   │   ├── common
│   │   │   │   └── Links.tsx
│   │   │   ├── middleware.ts
│   │   │   └── pages
│   │   │       ├── _app.tsx
│   │   │       ├── profile
│   │   │       │   └── [[...index]].tsx
│   │   │       └── user
│   │   │           └── [[...index]].tsx
│   │   └── tsconfig.json
│   ├── browser-extension
│   │   ├── .env.chrome.example
│   │   ├── .env.development.example
│   │   ├── .gitignore
│   │   ├── assets
│   │   │   └── icon.png
│   │   ├── package.json
│   │   ├── postcss.config.js
│   │   ├── README.md
│   │   ├── src
│   │   │   ├── assets
│   │   │   │   ├── chrome-extension-sdk-2.jpg
│   │   │   │   ├── dark-logo.png
│   │   │   │   ├── icon.png
│   │   │   │   └── light-logo.png
│   │   │   ├── background
│   │   │   │   └── index.ts
│   │   │   ├── components
│   │   │   │   ├── nav-bar.tsx
│   │   │   │   └── ui
│   │   │   │       └── button.tsx
│   │   │   ├── content.tsx
│   │   │   ├── features
│   │   │   │   └── count-button.tsx
│   │   │   ├── popup
│   │   │   │   ├── index.tsx
│   │   │   │   ├── layouts
│   │   │   │   │   └── root-layout.tsx
│   │   │   │   └── routes
│   │   │   │       ├── home.tsx
│   │   │   │       ├── sdk-features.tsx
│   │   │   │       ├── settings.tsx
│   │   │   │       ├── sign-in.tsx
│   │   │   │       └── sign-up.tsx
│   │   │   ├── sidepanel
│   │   │   │   └── index.tsx
│   │   │   ├── style.css
│   │   │   ├── tabs
│   │   │   │   ├── background-worker-demo.html
│   │   │   │   └── background-worker-demo.tsx
│   │   │   └── utils
│   │   │       └── components.ts
│   │   ├── tailwind.config.js
│   │   └── tsconfig.json
│   ├── cra-js
│   │   ├── .gitignore
│   │   ├── package.json
│   │   ├── public
│   │   │   ├── favicon.ico
│   │   │   ├── index.html
│   │   │   ├── logo192.png
│   │   │   ├── logo512.png
│   │   │   ├── manifest.json
│   │   │   └── robots.txt
│   │   ├── README.md
│   │   └── src
│   │       ├── App.css
│   │       ├── App.js
│   │       ├── App.test.js
│   │       ├── index.css
│   │       ├── index.js
│   │       ├── logo.svg
│   │       ├── reportWebVitals.js
│   │       └── setupTests.js
│   ├── expo
│   │   ├── .env.example
│   │   ├── .gitignore
│   │   ├── app.json.example
│   │   ├── App.tsx
│   │   ├── babel.config.js
│   │   ├── metro.config.js
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── tsconfig.json
│   │   └── webpack.config.js
│   ├── express
│   │   ├── .env.sample
│   │   ├── .gitignore
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── src
│   │   │   ├── loadEnv.ts
│   │   │   ├── routes
│   │   │   │   ├── index.ts
│   │   │   │   ├── private.ts
│   │   │   │   └── public.ts
│   │   │   ├── server.ts
│   │   │   └── views
│   │   │       └── home.ejs
│   │   └── tsconfig.json
│   ├── fastify
│   │   ├── .env.sample
│   │   ├── .gitignore
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── src
│   │   │   ├── loadEnv.ts
│   │   │   ├── routes
│   │   │   │   ├── index.ts
│   │   │   │   ├── private.ts
│   │   │   │   └── public.ts
│   │   │   ├── server.ts
│   │   │   └── templates
│   │   │       └── sign-in.ejs
│   │   └── tsconfig.json
│   ├── nextjs
│   │   ├── .env.example
│   │   ├── .gitignore
│   │   ├── .vscode
│   │   │   └── settings.json
│   │   ├── app
│   │   │   ├── api
│   │   │   │   └── route.ts
│   │   │   ├── app-dir
│   │   │   │   ├── client
│   │   │   │   │   └── page.tsx
│   │   │   │   ├── client-component.tsx
│   │   │   │   ├── create-organization
│   │   │   │   │   └── page.tsx
│   │   │   │   ├── discover
│   │   │   │   │   └── page.tsx
│   │   │   │   ├── organization
│   │   │   │   │   └── page.tsx
│   │   │   │   ├── page.tsx
│   │   │   │   ├── sign-in
│   │   │   │   │   └── page.tsx
│   │   │   │   ├── sign-up
│   │   │   │   │   └── page.tsx
│   │   │   │   └── user
│   │   │   │       └── page.tsx
│   │   │   └── layout.tsx
│   │   ├── middleware.ts
│   │   ├── next.config.js
│   │   ├── package.json
│   │   ├── pages
│   │   │   ├── _app.tsx
│   │   │   ├── api
│   │   │   │   ├── hello-edge.ts
│   │   │   │   └── hello.ts
│   │   │   ├── create-organization
│   │   │   │   └── [[...index]].tsx
│   │   │   ├── custom
│   │   │   │   └── forgotPassword.tsx
│   │   │   ├── discover
│   │   │   │   └── index.tsx
│   │   │   ├── index.tsx
│   │   │   ├── organization
│   │   │   │   └── [[...index]].tsx
│   │   │   ├── organization-list
│   │   │   │   └── [[...index]].tsx
│   │   │   ├── redirect-helpers
│   │   │   │   └── index.tsx
│   │   │   ├── session-examples
│   │   │   │   └── index.tsx
│   │   │   ├── sign-in
│   │   │   │   └── [[...index]].tsx
│   │   │   ├── sign-up
│   │   │   │   └── [[...index]].tsx
│   │   │   ├── user
│   │   │   │   └── [[...index]].tsx
│   │   │   ├── user-examples
│   │   │   │   └── index.tsx
│   │   │   └── waitlist
│   │   │       └── index.tsx
│   │   ├── public
│   │   │   ├── favicon.ico
│   │   │   └── vercel.svg
│   │   ├── README.md
│   │   ├── styles
│   │   │   ├── globals.css
│   │   │   └── Home.module.css
│   │   └── tsconfig.json
│   ├── react-router
│   │   ├── .env.example
│   │   ├── .gitignore
│   │   ├── app
│   │   │   ├── app.css
│   │   │   ├── root.tsx
│   │   │   ├── routes
│   │   │   │   ├── home.tsx
│   │   │   │   ├── profile-form.tsx
│   │   │   │   ├── profile.tsx
│   │   │   │   ├── sign-in.tsx
│   │   │   │   ├── sign-up.tsx
│   │   │   │   ├── use-auth.tsx
│   │   │   │   └── use-user.tsx
│   │   │   ├── routes.ts
│   │   │   └── welcome
│   │   │       ├── logo-dark.svg
│   │   │       ├── logo-light.svg
│   │   │       └── welcome.tsx
│   │   ├── package.json
│   │   ├── public
│   │   │   └── favicon.ico
│   │   ├── react-router.config.ts
│   │   ├── README.md
│   │   ├── tailwind.config.ts
│   │   ├── tsconfig.json
│   │   └── vite.config.ts
│   ├── remix-cf-pages
│   │   ├── .gitignore
│   │   ├── .node-version
│   │   ├── app
│   │   │   ├── entry.client.tsx
│   │   │   ├── entry.server.tsx
│   │   │   ├── root.tsx
│   │   │   └── routes
│   │   │       ├── index.tsx
│   │   │       └── sign-in.tsx
│   │   ├── package.json
│   │   ├── public
│   │   │   ├── _headers
│   │   │   ├── _routes.json
│   │   │   └── favicon.ico
│   │   ├── README.md
│   │   ├── remix.config.js
│   │   ├── remix.env.d.ts
│   │   ├── server.js
│   │   └── tsconfig.json
│   ├── remix-cf-worker
│   │   ├── .gitignore
│   │   ├── app
│   │   │   ├── entry.client.tsx
│   │   │   ├── entry.server.tsx
│   │   │   ├── root.tsx
│   │   │   └── routes
│   │   │       └── index.tsx
│   │   ├── package.json
│   │   ├── public
│   │   │   └── favicon.ico
│   │   ├── README.md
│   │   ├── remix.config.js
│   │   ├── remix.env.d.ts
│   │   ├── server.js
│   │   ├── tsconfig.json
│   │   └── wrangler.toml
│   ├── remix-node
│   │   ├── .gitignore
│   │   ├── app
│   │   │   ├── entry.client.tsx
│   │   │   ├── entry.server.tsx
│   │   │   ├── root.tsx
│   │   │   └── routes
│   │   │       ├── _index.tsx
│   │   │       ├── protected.tsx
│   │   │       ├── sign-in.$.tsx
│   │   │       └── sign-up.$.tsx
│   │   ├── package.json
│   │   ├── public
│   │   │   └── favicon.ico
│   │   ├── README.md
│   │   ├── remix.config.js
│   │   ├── remix.env.d.ts
│   │   └── tsconfig.json
│   ├── vanillajs
│   │   └── index.html
│   └── vite-react-ts
│       ├── .env.example
│       ├── .gitignore
│       ├── index.html
│       ├── package.json
│       ├── public
│       │   ├── clerk.svg
│       │   └── vite.svg
│       ├── src
│       │   ├── App.css
│       │   ├── App.tsx
│       │   ├── assets
│       │   │   └── react.svg
│       │   ├── index.css
│       │   ├── main.tsx
│       │   └── vite-env.d.ts
│       ├── tsconfig.json
│       ├── tsconfig.node.json
│       └── vite.config.ts
├── pnpm-lock.yaml
├── pnpm-workspace.yaml
├── prettier.config.mjs
├── README.md
├── renovate.json5
├── scripts
│   ├── .env.example
│   ├── 1password-keys.mjs
│   ├── backport.mjs
│   ├── canary.mjs
│   ├── common.mjs
│   ├── format-non-workspace.mjs
│   ├── format-package.mjs
│   ├── install-site-in-isolation.mjs
│   ├── lint.mjs
│   ├── notify.mjs
│   ├── nuke.mjs
│   ├── renovate-config-generator.mjs
│   ├── search-for-rhc.mjs
│   ├── snapshot.mjs
│   ├── subpath-workaround.mjs
│   ├── tsconfig.json
│   ├── utils.ts
│   └── vitest-debug.mjs
├── tsconfig.json
├── tsconfig.typedoc.json
├── turbo.json
├── typedoc.config.mjs
├── verdaccio.install.yaml
├── verdaccio.publish.yaml
└── vitest.workspace.mjs
```

# Files

--------------------------------------------------------------------------------
/packages/clerk-js/src/core/clerk.ts:
--------------------------------------------------------------------------------

```typescript
import { inBrowser as inClientSide, isValidBrowserOnline } from '@clerk/shared/browser';
import { clerkEvents, createClerkEventBus } from '@clerk/shared/clerkEventBus';
import { deprecated } from '@clerk/shared/deprecated';
import {
  ClerkRuntimeError,
  EmailLinkError,
  EmailLinkErrorCodeStatus,
  is4xxError,
  isClerkAPIResponseError,
  isClerkRuntimeError,
} from '@clerk/shared/error';
import { parsePublishableKey } from '@clerk/shared/keys';
import { logger } from '@clerk/shared/logger';
import { CLERK_NETLIFY_CACHE_BUST_PARAM } from '@clerk/shared/netlifyCacheHandler';
import { isHttpOrHttps, isValidProxyUrl, proxyUrlToAbsoluteURL } from '@clerk/shared/proxy';
import {
  eventPrebuiltComponentMounted,
  eventPrebuiltComponentOpened,
  eventThemeUsage,
  TelemetryCollector,
} from '@clerk/shared/telemetry';
import type {
  __experimental_CheckoutInstance,
  __experimental_CheckoutOptions,
  __internal_CheckoutProps,
  __internal_OAuthConsentProps,
  __internal_PlanDetailsProps,
  __internal_SubscriptionDetailsProps,
  __internal_UserVerificationModalProps,
  APIKeysNamespace,
  APIKeysProps,
  AuthenticateWithBaseParams,
  AuthenticateWithCoinbaseWalletParams,
  AuthenticateWithGoogleOneTapParams,
  AuthenticateWithMetamaskParams,
  AuthenticateWithOKXWalletParams,
  BillingNamespace,
  Clerk as ClerkInterface,
  ClerkAPIError,
  ClerkAuthenticateWithWeb3Params,
  ClerkOptions,
  ClientJSONSnapshot,
  ClientResource,
  CreateOrganizationParams,
  CreateOrganizationProps,
  CredentialReturn,
  DomainOrProxyUrl,
  EnvironmentJSON,
  EnvironmentJSONSnapshot,
  EnvironmentResource,
  GenerateSignatureParams,
  GoogleOneTapProps,
  HandleEmailLinkVerificationParams,
  HandleOAuthCallbackParams,
  InstanceType,
  JoinWaitlistParams,
  ListenerCallback,
  NavigateOptions,
  OrganizationListProps,
  OrganizationProfileProps,
  OrganizationResource,
  OrganizationSwitcherProps,
  PricingTableProps,
  PublicKeyCredentialCreationOptionsWithoutExtensions,
  PublicKeyCredentialRequestOptionsWithoutExtensions,
  PublicKeyCredentialWithAuthenticatorAssertionResponse,
  PublicKeyCredentialWithAuthenticatorAttestationResponse,
  RedirectOptions,
  Resources,
  SDKMetadata,
  SessionResource,
  SetActiveParams,
  SignedInSessionResource,
  SignInProps,
  SignInRedirectOptions,
  SignInResource,
  SignOut,
  SignOutCallback,
  SignOutOptions,
  SignUpField,
  SignUpProps,
  SignUpRedirectOptions,
  SignUpResource,
  TaskChooseOrganizationProps,
  TasksRedirectOptions,
  UnsubscribeCallback,
  UserAvatarProps,
  UserButtonProps,
  UserProfileProps,
  UserResource,
  WaitlistProps,
  WaitlistResource,
  Web3Provider,
} from '@clerk/shared/types';
import { addClerkPrefix, isAbsoluteUrl, stripScheme } from '@clerk/shared/url';
import { allSettled, handleValueOrFn, noop } from '@clerk/shared/utils';
import type { QueryClient } from '@tanstack/query-core';

import { debugLogger, initDebugLogger } from '@/utils/debug';

import type { MountComponentRenderer } from '../ui/Components';
import {
  ALLOWED_PROTOCOLS,
  buildURL,
  canViewOrManageAPIKeys,
  completeSignUpFlow,
  createAllowedRedirectOrigins,
  createBeforeUnloadTracker,
  createPageLifecycle,
  disabledAllBillingFeatures,
  disabledAPIKeysFeature,
  disabledOrganizationsFeature,
  errorThrower,
  generateSignatureWithBase,
  generateSignatureWithCoinbaseWallet,
  generateSignatureWithMetamask,
  generateSignatureWithOKXWallet,
  getClerkQueryParam,
  getWeb3Identifier,
  hasExternalAccountSignUpError,
  inActiveBrowserTab,
  inBrowser,
  isDevAccountPortalOrigin,
  isError,
  isOrganizationId,
  isRedirectForFAPIInitiatedFlow,
  isSignedInAndSingleSessionModeEnabled,
  noOrganizationExists,
  noUserExists,
  processCssLayerNameExtraction,
  removeClerkQueryParam,
  requiresUserInput,
  stripOrigin,
  windowNavigate,
} from '../utils';
import { assertNoLegacyProp } from '../utils/assertNoLegacyProp';
import { CLERK_ENVIRONMENT_STORAGE_ENTRY, SafeLocalStorage } from '../utils/localStorage';
import { memoizeListenerCallback } from '../utils/memoizeStateListenerCallback';
import { RedirectUrls } from '../utils/redirectUrls';
import { AuthCookieService } from './auth/AuthCookieService';
import { CaptchaHeartbeat } from './auth/CaptchaHeartbeat';
import { CLERK_SATELLITE_URL, CLERK_SUFFIXED_COOKIES, CLERK_SYNCED, ERROR_CODES } from './constants';
import {
  clerkErrorInitFailed,
  clerkInvalidSignInUrlFormat,
  clerkInvalidSignInUrlOrigin,
  clerkMissingProxyUrlAndDomain,
  clerkMissingSignInUrlAsSatellite,
  clerkOAuthCallbackDidNotCompleteSignInSignUp,
  clerkRedirectUrlIsMissingScheme,
  clerkUnsupportedEnvironmentWarning,
} from './errors';
import { eventBus, events } from './events';
import type { FapiClient, FapiRequestCallback } from './fapiClient';
import { createFapiClient } from './fapiClient';
import { createClientFromJwt } from './jwt-client';
import { APIKeys } from './modules/apiKeys';
import { Billing } from './modules/billing';
import { createCheckoutInstance } from './modules/checkout/instance';
import { BaseResource, Client, Environment, Organization, Waitlist } from './resources/internal';
import { getTaskEndpoint, navigateIfTaskExists, warnMissingPendingTaskHandlers } from './sessionTasks';
import { State } from './state';
import { warnings } from './warnings';

type SetActiveHook = (intent?: 'sign-out') => void | Promise<void>;

declare global {
  interface Window {
    Clerk?: Clerk;
    __clerk_publishable_key?: string;
    __clerk_proxy_url?: ClerkInterface['proxyUrl'];
    __clerk_domain?: ClerkInterface['domain'];
  }
}

const CANNOT_RENDER_BILLING_DISABLED_ERROR_CODE = 'cannot_render_billing_disabled';
const CANNOT_RENDER_USER_MISSING_ERROR_CODE = 'cannot_render_user_missing';
const CANNOT_RENDER_ORGANIZATIONS_DISABLED_ERROR_CODE = 'cannot_render_organizations_disabled';
const CANNOT_RENDER_ORGANIZATION_MISSING_ERROR_CODE = 'cannot_render_organization_missing';
const CANNOT_RENDER_SINGLE_SESSION_ENABLED_ERROR_CODE = 'cannot_render_single_session_enabled';
const CANNOT_RENDER_API_KEYS_DISABLED_ERROR_CODE = 'cannot_render_api_keys_disabled';
const CANNOT_RENDER_API_KEYS_ORG_UNAUTHORIZED_ERROR_CODE = 'cannot_render_api_keys_org_unauthorized';
const defaultOptions: ClerkOptions = {
  polling: true,
  standardBrowser: true,
  touchSession: true,
  isSatellite: false,
  signInUrl: undefined,
  signUpUrl: undefined,
  afterSignOutUrl: undefined,
  signInFallbackRedirectUrl: undefined,
  signUpFallbackRedirectUrl: undefined,
  signInForceRedirectUrl: undefined,
  signUpForceRedirectUrl: undefined,
  newSubscriptionRedirectUrl: undefined,
};

export class Clerk implements ClerkInterface {
  public static mountComponentRenderer?: MountComponentRenderer;

  public static version: string = __PKG_VERSION__;
  public static sdkMetadata: SDKMetadata = {
    name: __PKG_NAME__,
    version: __PKG_VERSION__,
  };

  private static _billing: BillingNamespace;
  private static _apiKeys: APIKeysNamespace;
  private _checkout: ClerkInterface['__experimental_checkout'] | undefined;

  public client: ClientResource | undefined;
  public session: SignedInSessionResource | null | undefined;
  public organization: OrganizationResource | null | undefined;
  public user: UserResource | null | undefined;
  public __internal_country?: string | null;
  public telemetry: TelemetryCollector | undefined;
  public readonly __internal_state: State = new State();

  protected internal_last_error: ClerkAPIError | null = null;
  // converted to protected environment to support `updateEnvironment` type assertion
  protected environment?: EnvironmentResource | null;

  #queryClient: QueryClient | undefined;
  #publishableKey = '';
  #domain: DomainOrProxyUrl['domain'];
  #proxyUrl: DomainOrProxyUrl['proxyUrl'];
  #authService?: AuthCookieService;
  #captchaHeartbeat?: CaptchaHeartbeat;
  #broadcastChannel: BroadcastChannel | null = null;
  #componentControls?: ReturnType<MountComponentRenderer> | null;
  //@ts-expect-error with being undefined even though it's not possible - related to issue with ts and error thrower
  #fapiClient: FapiClient;
  #instanceType?: InstanceType;
  #status: ClerkInterface['status'] = 'loading';
  #listeners: Array<(emission: Resources) => void> = [];
  #navigationListeners: Array<() => void> = [];
  #options: ClerkOptions = {};
  #pageLifecycle: ReturnType<typeof createPageLifecycle> | null = null;
  #touchThrottledUntil = 0;
  #publicEventBus = createClerkEventBus();

  get __internal_queryClient(): { __tag: 'clerk-rq-client'; client: QueryClient } | undefined {
    if (!this.#queryClient) {
      void import('./query-core')
        .then(module => module.QueryClient)
        .then(QueryClient => {
          if (this.#queryClient) {
            return;
          }
          this.#queryClient = new QueryClient();
          // @ts-expect-error - queryClientStatus is not typed
          this.#publicEventBus.emit('queryClientStatus', 'ready');
        });
    }

    return this.#queryClient
      ? {
          __tag: 'clerk-rq-client',
          client: this.#queryClient,
        }
      : undefined;
  }

  public __internal_getCachedResources:
    | (() => Promise<{ client: ClientJSONSnapshot | null; environment: EnvironmentJSONSnapshot | null }>)
    | undefined;

  public __internal_createPublicCredentials:
    | ((
        publicKey: PublicKeyCredentialCreationOptionsWithoutExtensions,
      ) => Promise<CredentialReturn<PublicKeyCredentialWithAuthenticatorAttestationResponse>>)
    | undefined;

  public __internal_getPublicCredentials:
    | (({
        publicKeyOptions,
      }: {
        publicKeyOptions: PublicKeyCredentialRequestOptionsWithoutExtensions;
      }) => Promise<CredentialReturn<PublicKeyCredentialWithAuthenticatorAssertionResponse>>)
    | undefined;

  public __internal_isWebAuthnSupported: (() => boolean) | undefined;
  public __internal_isWebAuthnAutofillSupported: (() => Promise<boolean>) | undefined;
  public __internal_isWebAuthnPlatformAuthenticatorSupported: (() => Promise<boolean>) | undefined;

  public __internal_setActiveInProgress = false;

  get publishableKey(): string {
    return this.#publishableKey;
  }

  get version(): string {
    return Clerk.version;
  }

  set sdkMetadata(metadata: SDKMetadata) {
    Clerk.sdkMetadata = metadata;
  }

  get sdkMetadata(): SDKMetadata {
    return Clerk.sdkMetadata;
  }

  get loaded(): boolean {
    return this.status === 'degraded' || this.status === 'ready';
  }

  get status(): ClerkInterface['status'] {
    return this.#status;
  }

  get isSatellite(): boolean {
    if (inBrowser()) {
      return handleValueOrFn(this.#options.isSatellite, new URL(window.location.href), false);
    }
    return false;
  }

  get domain(): string {
    if (inBrowser()) {
      const strippedDomainString = stripScheme(handleValueOrFn(this.#domain, new URL(window.location.href)));
      if (this.#instanceType === 'production') {
        return addClerkPrefix(strippedDomainString);
      }
      return strippedDomainString;
    }
    return '';
  }

  get proxyUrl(): string {
    if (inBrowser()) {
      const _unfilteredProxy = handleValueOrFn(this.#proxyUrl, new URL(window.location.href));
      if (!isValidProxyUrl(_unfilteredProxy)) {
        errorThrower.throwInvalidProxyUrl({ url: _unfilteredProxy });
      }
      return proxyUrlToAbsoluteURL(_unfilteredProxy);
    }
    return '';
  }

  get frontendApi(): string {
    const publishableKey = parsePublishableKey(this.publishableKey);

    if (!publishableKey) {
      return errorThrower.throwInvalidPublishableKeyError({
        key: this.publishableKey,
      });
    }

    return publishableKey.frontendApi;
  }

  get instanceType() {
    return this.#instanceType;
  }

  get isStandardBrowser(): boolean {
    return this.#options.standardBrowser || false;
  }

  get billing(): BillingNamespace {
    if (!Clerk._billing) {
      Clerk._billing = new Billing();
    }
    return Clerk._billing;
  }

  get apiKeys(): APIKeysNamespace {
    if (!Clerk._apiKeys) {
      Clerk._apiKeys = new APIKeys();
    }
    return Clerk._apiKeys;
  }

  __experimental_checkout(options: __experimental_CheckoutOptions): __experimental_CheckoutInstance {
    if (!this._checkout) {
      this._checkout = params => createCheckoutInstance(this, params);
    }
    return this._checkout(options);
  }

  public __internal_getOption<K extends keyof ClerkOptions>(key: K): ClerkOptions[K] {
    return this.#options[key];
  }

  get isSignedIn(): boolean {
    const hasPendingSession = this?.session?.status === 'pending';
    if (hasPendingSession) {
      return false;
    }

    return !!this.session;
  }

  public constructor(key: string, options?: DomainOrProxyUrl) {
    key = (key || '').trim();

    if (!key) {
      return errorThrower.throwMissingPublishableKeyError();
    }

    const publishableKey = parsePublishableKey(key);

    if (!publishableKey) {
      return errorThrower.throwInvalidPublishableKeyError({ key });
    }

    this.#domain = options?.domain;
    this.#proxyUrl = options?.proxyUrl;
    this.environment = Environment.getInstance();
    this.#instanceType = publishableKey.instanceType;
    this.#publishableKey = key;

    this.#fapiClient = createFapiClient({
      domain: this.domain,
      frontendApi: this.frontendApi,
      // this.instanceType is assigned above
      instanceType: this.instanceType as InstanceType,
      isSatellite: this.isSatellite,
      getSessionId: () => {
        return this.session?.id;
      },
      proxyUrl: this.proxyUrl,
    });
    this.#publicEventBus.emit(clerkEvents.Status, 'loading');
    this.#publicEventBus.prioritizedOn(clerkEvents.Status, s => (this.#status = s));

    // This line is used for the piggy-backing mechanism
    BaseResource.clerk = this;
  }

  public getFapiClient = (): FapiClient => this.#fapiClient;

  public load = async (options?: ClerkOptions): Promise<void> => {
    debugLogger.info('load() start', {}, 'clerk');
    if (this.loaded) {
      return;
    }

    // Log a development mode warning once
    if (this.#instanceType === 'development') {
      logger.warnOnce(
        'Clerk: Clerk has been loaded with development keys. Development instances have strict usage limits and should not be used when deploying your application to production. Learn more: https://clerk.com/docs/deployments/overview',
      );
    }

    this.#options = this.#initOptions(options);

    // In development mode, if custom router options are provided, warn if both routerPush and routerReplace are not provided
    if (
      this.#instanceType === 'development' &&
      (this.#options.routerPush || this.#options.routerReplace) &&
      (!this.#options.routerPush || !this.#options.routerReplace)
    ) {
      // Typing this.#options as ClerkOptions to ensure proper type checking. TypeScript will infer the type as `never`
      // since missing both `routerPush` and `routerReplace` is not a valid ClerkOptions.
      const options = this.#options as ClerkOptions;
      const missingRouter = !options.routerPush ? 'routerPush' : 'routerReplace';
      logger.warnOnce(
        `Clerk: Both \`routerPush\` and \`routerReplace\` need to be defined, but \`${missingRouter}\` is not defined. This may cause issues with navigation in your application.`,
      );
    }

    /**
     * Listen to `Session.getToken` resolving to emit the updated session
     * with the new token to the state listeners.
     */
    eventBus.on(events.SessionTokenResolved, () => {
      this.#setAccessors(this.session);
      this.#emit();
    });

    assertNoLegacyProp(this.#options);

    if (this.#options.sdkMetadata) {
      Clerk.sdkMetadata = this.#options.sdkMetadata;
    }

    if (this.#options.telemetry !== false) {
      this.telemetry = new TelemetryCollector({
        clerkVersion: Clerk.version,
        samplingRate: 1,
        perEventSampling: this.#options.__internal_keyless_claimKeylessApplicationUrl ? false : undefined,
        publishableKey: this.publishableKey,
        ...this.#options.telemetry,
      });

      // Record theme usage telemetry when appearance is provided
      if (this.#options.appearance) {
        this.telemetry.record(eventThemeUsage(this.#options.appearance));
      }
    }

    try {
      if (this.#options.standardBrowser) {
        await this.#loadInStandardBrowser();
      } else {
        await this.#loadInNonStandardBrowser();
      }
      const telemetry = this.#options.telemetry;
      const telemetryEnabled = telemetry !== false && !telemetry?.disabled;

      const isKeyless = Boolean(this.#options.__internal_keyless_claimKeylessApplicationUrl);
      const hasClientDebugMode = Boolean(this.environment?.clientDebugMode);
      const isProd = this.environment?.isProduction?.() ?? false;

      const shouldEnable = hasClientDebugMode || (isKeyless && !isProd);
      const logLevel = isKeyless && !hasClientDebugMode ? 'error' : undefined;

      if (shouldEnable) {
        initDebugLogger({
          enabled: true,
          ...(logLevel ? { logLevel } : {}),
          ...(telemetryEnabled && this.telemetry ? { telemetryCollector: this.telemetry } : {}),
        });
      }
      debugLogger.info('load() complete', {}, 'clerk');
    } catch (error) {
      this.#publicEventBus.emit(clerkEvents.Status, 'error');
      debugLogger.error('load() failed', { error }, 'clerk');
      // bubble up the error
      throw error;
    }
  };

  #isCombinedSignInOrUpFlow(): boolean {
    return Boolean(!this.#options.signUpUrl && this.#options.signInUrl && !isAbsoluteUrl(this.#options.signInUrl));
  }

  public signOut: SignOut = async (callbackOrOptions?: SignOutCallback | SignOutOptions, options?: SignOutOptions) => {
    if (!this.client || this.client.sessions.length === 0) {
      return;
    }

    const onBeforeSetActive: SetActiveHook =
      typeof window !== 'undefined' && typeof window.__unstable__onBeforeSetActive === 'function'
        ? window.__unstable__onBeforeSetActive
        : noop;

    const onAfterSetActive: SetActiveHook =
      typeof window !== 'undefined' && typeof window.__unstable__onAfterSetActive === 'function'
        ? window.__unstable__onAfterSetActive
        : noop;

    const opts = callbackOrOptions && typeof callbackOrOptions === 'object' ? callbackOrOptions : options || {};

    const redirectUrl = opts?.redirectUrl || this.buildAfterSignOutUrl();
    debugLogger.debug(
      'signOut() start',
      {
        hasClient: Boolean(this.client),
        multiSessionCount: this.client?.signedInSessions.length ?? 0,
        redirectUrl,
        sessionTarget: opts?.sessionId ?? null,
      },
      'clerk',
    );
    const signOutCallback = typeof callbackOrOptions === 'function' ? callbackOrOptions : undefined;

    const executeSignOut = async () => {
      const tracker = createBeforeUnloadTracker(this.#options.standardBrowser);

      // Notify other tabs that user is signing out and clean up cookies.
      eventBus.emit(events.UserSignOut, null);

      this.#setTransitiveState();

      await tracker.track(async () => {
        if (signOutCallback) {
          await signOutCallback();
        } else {
          await this.navigate(redirectUrl);
        }
      });

      if (tracker.isUnloading()) {
        return;
      }

      this.#setAccessors();
      this.#emit();

      await onAfterSetActive();
    };

    /**
     * Clears the router cache for `@clerk/nextjs` on all routes except the current one.
     * Note: Calling `onBeforeSetActive` before signing out, allows for new RSC prefetch requests to render as signed in.
     * Since we are calling `onBeforeSetActive` before signing out, we should NOT pass `"sign-out"`.
     */
    await onBeforeSetActive();
    if (!opts.sessionId || this.client.signedInSessions.length === 1) {
      if (this.#options.experimental?.persistClient ?? true) {
        await this.client.removeSessions();
      } else {
        await this.client.destroy();
      }

      await executeSignOut();

      debugLogger.info('signOut() complete', { redirectUrl: stripOrigin(redirectUrl) }, 'clerk');
      return;
    }

    // Multi-session handling
    const session = this.client.signedInSessions.find(s => s.id === opts.sessionId);
    const shouldSignOutCurrent = session?.id && this.session?.id === session.id;

    await session?.remove();

    if (shouldSignOutCurrent) {
      await executeSignOut();
      debugLogger.info('signOut() complete', { redirectUrl: stripOrigin(redirectUrl) }, 'clerk');
    }
  };

  public openGoogleOneTap = (props?: GoogleOneTapProps): void => {
    const component = 'GoogleOneTap';
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls
      .ensureMounted({ preloadHint: component })
      .then(controls => controls.openModal('googleOneTap', props || {}));

    this.telemetry?.record(eventPrebuiltComponentOpened(component, props));
  };

  public closeGoogleOneTap = (): void => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls.ensureMounted().then(controls => controls.closeModal('googleOneTap'));
  };

  public openSignIn = (props?: SignInProps): void => {
    this.assertComponentsReady(this.#componentControls);
    if (isSignedInAndSingleSessionModeEnabled(this, this.environment)) {
      if (this.#instanceType === 'development') {
        throw new ClerkRuntimeError(warnings.cannotOpenSignInOrSignUp, {
          code: CANNOT_RENDER_SINGLE_SESSION_ENABLED_ERROR_CODE,
        });
      }
      return;
    }
    const component = 'SignIn';
    void this.#componentControls
      .ensureMounted({ preloadHint: component })
      .then(controls => controls.openModal('signIn', props || {}));

    const additionalData = { withSignUp: props?.withSignUp ?? this.#isCombinedSignInOrUpFlow() };
    this.telemetry?.record(eventPrebuiltComponentOpened(component, props, additionalData));
  };

  public closeSignIn = (): void => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls.ensureMounted().then(controls => controls.closeModal('signIn'));
  };

  public __internal_openCheckout = (props?: __internal_CheckoutProps): void => {
    this.assertComponentsReady(this.#componentControls);
    if (disabledAllBillingFeatures(this, this.environment)) {
      if (this.#instanceType === 'development') {
        throw new ClerkRuntimeError(warnings.cannotRenderAnyBillingComponent('Checkout'), {
          code: CANNOT_RENDER_BILLING_DISABLED_ERROR_CODE,
        });
      }
      return;
    }
    if (noUserExists(this)) {
      if (this.#instanceType === 'development') {
        throw new ClerkRuntimeError(warnings.cannotOpenCheckout, {
          code: CANNOT_RENDER_USER_MISSING_ERROR_CODE,
        });
      }
      return;
    }

    void this.#componentControls
      .ensureMounted({ preloadHint: 'Checkout' })
      .then(controls => controls.openDrawer('checkout', props || {}));
  };

  public __internal_closeCheckout = (): void => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls.ensureMounted().then(controls => controls.closeDrawer('checkout'));
  };

  public __internal_openPlanDetails = (props: __internal_PlanDetailsProps): void => {
    this.assertComponentsReady(this.#componentControls);
    if (disabledAllBillingFeatures(this, this.environment)) {
      if (this.#instanceType === 'development') {
        throw new ClerkRuntimeError(warnings.cannotRenderAnyBillingComponent('PlanDetails'), {
          code: CANNOT_RENDER_BILLING_DISABLED_ERROR_CODE,
        });
      }
      return;
    }
    const component = 'PlanDetails';
    void this.#componentControls
      .ensureMounted({ preloadHint: component })
      .then(controls => controls.openDrawer('planDetails', props || {}));

    this.telemetry?.record(eventPrebuiltComponentOpened(component, props));
  };

  public __internal_closePlanDetails = (): void => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls.ensureMounted().then(controls => controls.closeDrawer('planDetails'));
  };

  public __internal_openSubscriptionDetails = (props?: __internal_SubscriptionDetailsProps): void => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls
      .ensureMounted({ preloadHint: 'SubscriptionDetails' })
      .then(controls => controls.openDrawer('subscriptionDetails', props || {}));
  };

  public __internal_closeSubscriptionDetails = (): void => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls.ensureMounted().then(controls => controls.closeDrawer('subscriptionDetails'));
  };

  public __internal_openReverification = (props?: __internal_UserVerificationModalProps): void => {
    this.assertComponentsReady(this.#componentControls);
    if (noUserExists(this)) {
      if (this.#instanceType === 'development') {
        throw new ClerkRuntimeError(warnings.cannotOpenUserProfile, {
          code: CANNOT_RENDER_USER_MISSING_ERROR_CODE,
        });
      }
      return;
    }
    void this.#componentControls
      .ensureMounted({ preloadHint: 'UserVerification' })
      .then(controls => controls.openModal('userVerification', props || {}));

    this.telemetry?.record(eventPrebuiltComponentOpened(`UserVerification`, props));
  };

  public __internal_closeReverification = (): void => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls.ensureMounted().then(controls => controls.closeModal('userVerification'));
  };

  public __internal_openBlankCaptchaModal = (): Promise<unknown> => {
    this.assertComponentsReady(this.#componentControls);
    return this.#componentControls
      .ensureMounted({ preloadHint: 'BlankCaptchaModal' })
      .then(controls => controls.openModal('blankCaptcha', {}));
  };

  public __internal_closeBlankCaptchaModal = (): Promise<unknown> => {
    this.assertComponentsReady(this.#componentControls);
    return this.#componentControls
      .ensureMounted({ preloadHint: 'BlankCaptchaModal' })
      .then(controls => controls.closeModal('blankCaptcha'));
  };

  public __internal_loadStripeJs = async () => {
    if (__BUILD_DISABLE_RHC__) {
      clerkUnsupportedEnvironmentWarning('Stripe');
      return { loadStripe: () => Promise.resolve(null) };
    }

    const { loadStripe } = await import('@stripe/stripe-js');
    return loadStripe;
  };

  public openSignUp = (props?: SignUpProps): void => {
    this.assertComponentsReady(this.#componentControls);
    if (isSignedInAndSingleSessionModeEnabled(this, this.environment)) {
      if (this.#instanceType === 'development') {
        throw new ClerkRuntimeError(warnings.cannotOpenSignInOrSignUp, {
          code: CANNOT_RENDER_SINGLE_SESSION_ENABLED_ERROR_CODE,
        });
      }
      return;
    }
    void this.#componentControls
      .ensureMounted({ preloadHint: 'SignUp' })
      .then(controls => controls.openModal('signUp', props || {}));

    this.telemetry?.record(eventPrebuiltComponentOpened('SignUp', props));
  };

  public closeSignUp = (): void => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls.ensureMounted().then(controls => controls.closeModal('signUp'));
  };

  public openUserProfile = (props?: UserProfileProps): void => {
    this.assertComponentsReady(this.#componentControls);
    if (noUserExists(this)) {
      if (this.#instanceType === 'development') {
        throw new ClerkRuntimeError(warnings.cannotOpenUserProfile, {
          code: CANNOT_RENDER_USER_MISSING_ERROR_CODE,
        });
      }
      return;
    }
    void this.#componentControls
      .ensureMounted({ preloadHint: 'UserProfile' })
      .then(controls => controls.openModal('userProfile', props || {}));

    const additionalData = (props?.customPages?.length || 0) > 0 ? { customPages: true } : undefined;
    this.telemetry?.record(eventPrebuiltComponentOpened('UserProfile', props, additionalData));
  };

  public closeUserProfile = (): void => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls.ensureMounted().then(controls => controls.closeModal('userProfile'));
  };

  public openOrganizationProfile = (props?: OrganizationProfileProps): void => {
    this.assertComponentsReady(this.#componentControls);
    if (disabledOrganizationsFeature(this, this.environment)) {
      if (this.#instanceType === 'development') {
        throw new ClerkRuntimeError(warnings.cannotRenderAnyOrganizationComponent('OrganizationProfile'), {
          code: CANNOT_RENDER_ORGANIZATIONS_DISABLED_ERROR_CODE,
        });
      }
      return;
    }
    if (noOrganizationExists(this)) {
      if (this.#instanceType === 'development') {
        throw new ClerkRuntimeError(warnings.cannotRenderComponentWhenOrgDoesNotExist, {
          code: CANNOT_RENDER_ORGANIZATION_MISSING_ERROR_CODE,
        });
      }
      return;
    }
    void this.#componentControls
      .ensureMounted({ preloadHint: 'OrganizationProfile' })
      .then(controls => controls.openModal('organizationProfile', props || {}));

    this.telemetry?.record(eventPrebuiltComponentOpened('OrganizationProfile', props));
  };

  public closeOrganizationProfile = (): void => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls.ensureMounted().then(controls => controls.closeModal('organizationProfile'));
  };

  public openCreateOrganization = (props?: CreateOrganizationProps): void => {
    this.assertComponentsReady(this.#componentControls);
    if (disabledOrganizationsFeature(this, this.environment)) {
      if (this.#instanceType === 'development') {
        throw new ClerkRuntimeError(warnings.cannotRenderAnyOrganizationComponent('CreateOrganization'), {
          code: CANNOT_RENDER_ORGANIZATIONS_DISABLED_ERROR_CODE,
        });
      }
      return;
    }
    void this.#componentControls
      .ensureMounted({ preloadHint: 'CreateOrganization' })
      .then(controls => controls.openModal('createOrganization', props || {}));

    this.telemetry?.record(eventPrebuiltComponentOpened('CreateOrganization', props));
  };

  public closeCreateOrganization = (): void => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls.ensureMounted().then(controls => controls.closeModal('createOrganization'));
  };

  public openWaitlist = (props?: WaitlistProps): void => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls
      .ensureMounted({ preloadHint: 'Waitlist' })
      .then(controls => controls.openModal('waitlist', props || {}));

    this.telemetry?.record(eventPrebuiltComponentOpened('Waitlist', props));
  };

  public closeWaitlist = (): void => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls.ensureMounted().then(controls => controls.closeModal('waitlist'));
  };

  public mountSignIn = (node: HTMLDivElement, props?: SignInProps): void => {
    this.assertComponentsReady(this.#componentControls);
    const component = 'SignIn';
    void this.#componentControls.ensureMounted({ preloadHint: component }).then(controls =>
      controls.mountComponent({
        name: component,
        appearanceKey: 'signIn',
        node,
        props,
      }),
    );

    const additionalData = { withSignUp: props?.withSignUp ?? this.#isCombinedSignInOrUpFlow() };
    this.telemetry?.record(eventPrebuiltComponentMounted(component, props, additionalData));
  };

  public unmountSignIn = (node: HTMLDivElement): void => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls.ensureMounted().then(controls =>
      controls.unmountComponent({
        node,
      }),
    );
  };

  public mountUserAvatar = (node: HTMLDivElement, props?: UserAvatarProps): void => {
    this.assertComponentsReady(this.#componentControls);
    const component = 'UserAvatar';
    void this.#componentControls.ensureMounted({ preloadHint: component }).then(controls =>
      controls.mountComponent({
        name: component,
        appearanceKey: 'userAvatar',
        node,
        props,
      }),
    );

    this.telemetry?.record(eventPrebuiltComponentMounted(component, props));
  };

  public unmountUserAvatar = (node: HTMLDivElement): void => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls.ensureMounted().then(controls =>
      controls.unmountComponent({
        node,
      }),
    );
  };

  public mountSignUp = (node: HTMLDivElement, props?: SignUpProps): void => {
    this.assertComponentsReady(this.#componentControls);
    const component = 'SignUp';
    void this.#componentControls.ensureMounted({ preloadHint: component }).then(controls =>
      controls.mountComponent({
        name: component,
        appearanceKey: 'signUp',
        node,
        props,
      }),
    );

    this.telemetry?.record(eventPrebuiltComponentMounted(component, props));
  };

  public unmountSignUp = (node: HTMLDivElement): void => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls.ensureMounted().then(controls =>
      controls.unmountComponent({
        node,
      }),
    );
  };

  public mountUserProfile = (node: HTMLDivElement, props?: UserProfileProps): void => {
    this.assertComponentsReady(this.#componentControls);
    if (noUserExists(this)) {
      if (this.#instanceType === 'development') {
        throw new ClerkRuntimeError(warnings.cannotRenderComponentWhenUserDoesNotExist, {
          code: CANNOT_RENDER_USER_MISSING_ERROR_CODE,
        });
      }
      return;
    }
    const component = 'UserProfile';
    void this.#componentControls.ensureMounted({ preloadHint: component }).then(controls =>
      controls.mountComponent({
        name: component,
        appearanceKey: 'userProfile',
        node,
        props,
      }),
    );

    const additionalData = (props?.customPages?.length || 0) > 0 ? { customPages: true } : undefined;
    this.telemetry?.record(eventPrebuiltComponentMounted(component, props, additionalData));
  };

  public unmountUserProfile = (node: HTMLDivElement): void => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls.ensureMounted().then(controls =>
      controls.unmountComponent({
        node,
      }),
    );
  };

  public mountOrganizationProfile = (node: HTMLDivElement, props?: OrganizationProfileProps) => {
    this.assertComponentsReady(this.#componentControls);
    if (disabledOrganizationsFeature(this, this.environment)) {
      if (this.#instanceType === 'development') {
        throw new ClerkRuntimeError(warnings.cannotRenderAnyOrganizationComponent('OrganizationProfile'), {
          code: CANNOT_RENDER_ORGANIZATIONS_DISABLED_ERROR_CODE,
        });
      }
      return;
    }
    const userExists = !noUserExists(this);
    if (noOrganizationExists(this) && userExists) {
      if (this.#instanceType === 'development') {
        throw new ClerkRuntimeError(warnings.cannotRenderComponentWhenOrgDoesNotExist, {
          code: CANNOT_RENDER_ORGANIZATION_MISSING_ERROR_CODE,
        });
      }
      return;
    }
    void this.#componentControls.ensureMounted({ preloadHint: 'OrganizationProfile' }).then(controls =>
      controls.mountComponent({
        name: 'OrganizationProfile',
        appearanceKey: 'userProfile',
        node,
        props,
      }),
    );

    this.telemetry?.record(eventPrebuiltComponentMounted('OrganizationProfile', props));
  };

  public unmountOrganizationProfile = (node: HTMLDivElement) => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls.ensureMounted().then(controls =>
      controls.unmountComponent({
        node,
      }),
    );
  };

  public mountCreateOrganization = (node: HTMLDivElement, props?: CreateOrganizationProps) => {
    this.assertComponentsReady(this.#componentControls);
    if (disabledOrganizationsFeature(this, this.environment)) {
      if (this.#instanceType === 'development') {
        throw new ClerkRuntimeError(warnings.cannotRenderAnyOrganizationComponent('CreateOrganization'), {
          code: CANNOT_RENDER_ORGANIZATIONS_DISABLED_ERROR_CODE,
        });
      }
      return;
    }
    void this.#componentControls?.ensureMounted({ preloadHint: 'CreateOrganization' }).then(controls =>
      controls.mountComponent({
        name: 'CreateOrganization',
        appearanceKey: 'createOrganization',
        node,
        props,
      }),
    );

    this.telemetry?.record(eventPrebuiltComponentMounted('CreateOrganization', props));
  };

  public unmountCreateOrganization = (node: HTMLDivElement) => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls?.ensureMounted().then(controls =>
      controls.unmountComponent({
        node,
      }),
    );
  };

  public mountOrganizationSwitcher = (node: HTMLDivElement, props?: OrganizationSwitcherProps) => {
    this.assertComponentsReady(this.#componentControls);
    if (disabledOrganizationsFeature(this, this.environment)) {
      if (this.#instanceType === 'development') {
        throw new ClerkRuntimeError(warnings.cannotRenderAnyOrganizationComponent('OrganizationSwitcher'), {
          code: CANNOT_RENDER_ORGANIZATIONS_DISABLED_ERROR_CODE,
        });
      }
      return;
    }
    void this.#componentControls?.ensureMounted({ preloadHint: 'OrganizationSwitcher' }).then(controls =>
      controls.mountComponent({
        name: 'OrganizationSwitcher',
        appearanceKey: 'organizationSwitcher',
        node,
        props,
      }),
    );

    this.telemetry?.record(
      eventPrebuiltComponentMounted('OrganizationSwitcher', {
        ...props,
        forceOrganizationSelection: this.environment?.organizationSettings.forceOrganizationSelection,
      }),
    );
  };

  public unmountOrganizationSwitcher = (node: HTMLDivElement): void => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls?.ensureMounted().then(controls => controls.unmountComponent({ node }));
  };

  public __experimental_prefetchOrganizationSwitcher = () => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls
      ?.ensureMounted({ preloadHint: 'OrganizationSwitcher' })
      .then(controls => controls.prefetch('organizationSwitcher'));
  };

  public mountOrganizationList = (node: HTMLDivElement, props?: OrganizationListProps) => {
    this.assertComponentsReady(this.#componentControls);
    if (disabledOrganizationsFeature(this, this.environment)) {
      if (this.#instanceType === 'development') {
        throw new ClerkRuntimeError(warnings.cannotRenderAnyOrganizationComponent('OrganizationList'), {
          code: CANNOT_RENDER_ORGANIZATIONS_DISABLED_ERROR_CODE,
        });
      }
      return;
    }
    void this.#componentControls?.ensureMounted({ preloadHint: 'OrganizationList' }).then(controls =>
      controls.mountComponent({
        name: 'OrganizationList',
        appearanceKey: 'organizationList',
        node,
        props,
      }),
    );

    this.telemetry?.record(
      eventPrebuiltComponentMounted('OrganizationList', {
        ...props,
        forceOrganizationSelection: this.environment?.organizationSettings.forceOrganizationSelection,
      }),
    );
  };

  public unmountOrganizationList = (node: HTMLDivElement): void => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls?.ensureMounted().then(controls => controls.unmountComponent({ node }));
  };

  public mountUserButton = (node: HTMLDivElement, props?: UserButtonProps) => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls?.ensureMounted({ preloadHint: 'UserButton' }).then(controls =>
      controls.mountComponent({
        name: 'UserButton',
        appearanceKey: 'userButton',
        node,
        props,
      }),
    );

    const additionalData = {
      ...(props?.customMenuItems?.length || 0 > 0 ? { customItems: true } : undefined),
      ...(props?.__experimental_asStandalone ? { standalone: true } : undefined),
    };

    this.telemetry?.record(eventPrebuiltComponentMounted('UserButton', props, additionalData));
  };

  public unmountUserButton = (node: HTMLDivElement): void => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls?.ensureMounted().then(controls => controls.unmountComponent({ node }));
  };

  public mountWaitlist = (node: HTMLDivElement, props?: WaitlistProps) => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls?.ensureMounted({ preloadHint: 'Waitlist' }).then(controls =>
      controls.mountComponent({
        name: 'Waitlist',
        appearanceKey: 'waitlist',
        node,
        props,
      }),
    );

    this.telemetry?.record(eventPrebuiltComponentMounted('Waitlist', props));
  };

  public unmountWaitlist = (node: HTMLDivElement): void => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls?.ensureMounted().then(controls => controls.unmountComponent({ node }));
  };

  public mountPricingTable = (node: HTMLDivElement, props?: PricingTableProps): void => {
    this.assertComponentsReady(this.#componentControls);
    if (disabledAllBillingFeatures(this, this.environment)) {
      if (this.#instanceType === 'development') {
        throw new ClerkRuntimeError(warnings.cannotRenderAnyBillingComponent('PricingTable'), {
          code: CANNOT_RENDER_BILLING_DISABLED_ERROR_CODE,
        });
      }
      return;
    }
    // Temporary backward compatibility for legacy prop: `forOrganizations`. Will be removed in the coming minor release.
    const nextProps = { ...(props as any) } as PricingTableProps & { forOrganizations?: boolean };
    if (typeof (props as any)?.forOrganizations !== 'undefined') {
      logger.warnOnce(
        'Clerk: [IMPORTANT] <PricingTable /> prop `forOrganizations` is deprecated and will be removed in the coming minors. Use `for="organization"` instead.',
      );
    }

    void this.#componentControls.ensureMounted({ preloadHint: 'PricingTable' }).then(controls =>
      controls.mountComponent({
        name: 'PricingTable',
        appearanceKey: 'pricingTable',
        node,
        props: nextProps,
      }),
    );

    this.telemetry?.record(eventPrebuiltComponentMounted('PricingTable', nextProps));
  };

  public unmountPricingTable = (node: HTMLDivElement): void => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls.ensureMounted().then(controls =>
      controls.unmountComponent({
        node,
      }),
    );
  };

  public __internal_mountOAuthConsent = (node: HTMLDivElement, props?: __internal_OAuthConsentProps) => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls.ensureMounted({ preloadHint: 'OAuthConsent' }).then(controls =>
      controls.mountComponent({
        name: 'OAuthConsent',
        appearanceKey: '__internal_oauthConsent',
        node,
        props,
      }),
    );
  };

  public __internal_unmountOAuthConsent = (node: HTMLDivElement) => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls.ensureMounted().then(controls => controls.unmountComponent({ node }));
  };

  /**
   * @experimental This API is in early access and may change in future releases.
   *
   * Mount a api keys component at the target element.
   * @param targetNode Target to mount the APIKeys component.
   * @param props Configuration parameters.
   */
  public mountApiKeys = (node: HTMLDivElement, props?: APIKeysProps) => {
    this.assertComponentsReady(this.#componentControls);

    logger.warnOnce('Clerk: <APIKeys /> component is in early access and not yet recommended for production use.');

    if (disabledAPIKeysFeature(this, this.environment)) {
      if (this.#instanceType === 'development') {
        throw new ClerkRuntimeError(warnings.cannotRenderAPIKeysComponent, {
          code: CANNOT_RENDER_API_KEYS_DISABLED_ERROR_CODE,
        });
      }
      return;
    }

    if (this.organization && !canViewOrManageAPIKeys(this)) {
      if (this.#instanceType === 'development') {
        throw new ClerkRuntimeError(warnings.cannotRenderAPIKeysComponentForOrgWhenUnauthorized, {
          code: CANNOT_RENDER_API_KEYS_ORG_UNAUTHORIZED_ERROR_CODE,
        });
      }
      return;
    }

    void this.#componentControls.ensureMounted({ preloadHint: 'APIKeys' }).then(controls =>
      controls.mountComponent({
        name: 'APIKeys',
        appearanceKey: 'apiKeys',
        node,
        props,
      }),
    );

    this.telemetry?.record(eventPrebuiltComponentMounted('APIKeys', props));
  };

  /**
   * @experimental This API is in early access and may change in future releases.
   *
   * Unmount a api keys component from the target element.
   * If there is no component mounted at the target node, results in a noop.
   *
   * @param targetNode Target node to unmount the ApiKeys component from.
   */
  public unmountApiKeys = (node: HTMLDivElement) => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls.ensureMounted().then(controls => controls.unmountComponent({ node }));
  };

  public mountTaskChooseOrganization = (node: HTMLDivElement, props?: TaskChooseOrganizationProps) => {
    this.assertComponentsReady(this.#componentControls);

    if (disabledOrganizationsFeature(this, this.environment)) {
      if (this.#instanceType === 'development') {
        throw new ClerkRuntimeError(warnings.cannotRenderAnyOrganizationComponent('TaskChooseOrganization'), {
          code: CANNOT_RENDER_ORGANIZATIONS_DISABLED_ERROR_CODE,
        });
      }
      return;
    }

    void this.#componentControls.ensureMounted({ preloadHint: 'TaskChooseOrganization' }).then(controls =>
      controls.mountComponent({
        name: 'TaskChooseOrganization',
        appearanceKey: 'taskChooseOrganization',
        node,
        props,
      }),
    );

    this.telemetry?.record(eventPrebuiltComponentMounted('TaskChooseOrganization', props));
  };

  public unmountTaskChooseOrganization = (node: HTMLDivElement) => {
    this.assertComponentsReady(this.#componentControls);
    void this.#componentControls.ensureMounted().then(controls => controls.unmountComponent({ node }));
  };

  /**
   * `setActive` can be used to set the active session and/or organization.
   */
  public setActive = async (params: SetActiveParams): Promise<void> => {
    const { organization, beforeEmit, redirectUrl, navigate: setActiveNavigate } = params;
    let { session } = params;
    this.__internal_setActiveInProgress = true;
    debugLogger.debug(
      'setActive() start',
      {
        hasClient: Boolean(this.client),
        sessionTarget: typeof session === 'string' ? session : (session?.id ?? session ?? null),
        organizationTarget:
          typeof organization === 'string' ? organization : (organization?.id ?? organization ?? null),
        redirectUrl: redirectUrl ?? null,
      },
      'clerk',
    );
    try {
      if (!this.client) {
        debugLogger.warn('Clerk setActive called before client is loaded', {}, 'clerk');
        throw new Error('setActive is being called before the client is loaded. Wait for init.');
      }

      if (session === undefined && !this.session) {
        debugLogger.warn('Clerk setActive precondition not met: no target session and no active session', {}, 'clerk');
        throw new Error(
          'setActive should either be called with a session param or there should be already an active session.',
        );
      }

      if (typeof session === 'string') {
        session = (this.client.sessions.find(x => x.id === session) as SignedInSessionResource) || null;
      }

      const onBeforeSetActive: SetActiveHook =
        typeof window !== 'undefined' && typeof window.__unstable__onBeforeSetActive === 'function'
          ? window.__unstable__onBeforeSetActive
          : noop;

      const onAfterSetActive: SetActiveHook =
        typeof window !== 'undefined' && typeof window.__unstable__onAfterSetActive === 'function'
          ? window.__unstable__onAfterSetActive
          : noop;

      let newSession = session === undefined ? this.session : session;
      if (newSession?.status === 'pending') {
        warnMissingPendingTaskHandlers({ ...this.#options, ...params });
      }

      // At this point, the `session` variable should contain either an `SignedInSessionResource`
      // ,`null` or `undefined`.
      // We now want to set the last active organization id on that session (if it exists).
      // However, if the `organization` parameter is not given (i.e. `undefined`), we want
      // to keep the organization id that the session had.
      const shouldSwitchOrganization = organization !== undefined;

      if (newSession && shouldSwitchOrganization) {
        const organizationIdOrSlug = typeof organization === 'string' ? organization : organization?.id;

        if (isOrganizationId(organizationIdOrSlug)) {
          newSession.lastActiveOrganizationId = organizationIdOrSlug || null;
        } else {
          const matchingOrganization = newSession.user.organizationMemberships.find(
            mem => mem.organization.slug === organizationIdOrSlug,
          );

          const newLastActiveOrganizationId = matchingOrganization?.organization.id || null;
          const isPersonalWorkspace = newLastActiveOrganizationId === null;

          // Do not update in-memory to personal workspace if force organization selection is enabled
          if (this.environment?.organizationSettings?.forceOrganizationSelection && isPersonalWorkspace) {
            return;
          }

          newSession.lastActiveOrganizationId = newLastActiveOrganizationId;
        }
      }

      // Do not revalidate server cache for pending sessions to avoid unmount of `SignIn/SignUp` AIOs when navigating to task
      if (newSession?.status !== 'pending') {
        /**
         * Hint to each framework, that the user will be signed out when `{session: null}` is provided.
         */
        await onBeforeSetActive(newSession === null ? 'sign-out' : undefined);
      }

      //1. setLastActiveSession to passed user session (add a param).
      //   Note that this will also update the session's active organization
      //   id.
      if (inActiveBrowserTab() || !this.#options.standardBrowser) {
        await this.#touchCurrentSession(newSession);
        // reload session from updated client
        newSession = this.#getSessionFromClient(newSession?.id);
      }

      // getToken syncs __session and __client_uat to cookies using events.TokenUpdate dispatched event.
      const token = await newSession?.getToken();
      if (!token) {
        if (!isValidBrowserOnline()) {
          debugLogger.warn(
            'Token is null when setting active session (offline)',
            { sessionId: newSession?.id },
            'clerk',
          );
        }
        eventBus.emit(events.TokenUpdate, { token: null });
      }

      //2. If there's a beforeEmit, typically we're navigating.  Emit the session as
      //   undefined, then wait for beforeEmit to complete before emitting the new session.
      //   When undefined, neither SignedIn nor SignedOut renders, which avoids flickers or
      //   automatic reloading when reloading shouldn't be happening.
      const tracker = createBeforeUnloadTracker(this.#options.standardBrowser);

      if (beforeEmit) {
        deprecated(
          'Clerk.setActive({beforeEmit})',
          'Use the `redirectUrl` property instead. Example `Clerk.setActive({redirectUrl:"/"})`',
        );
        await tracker.track(async () => {
          this.#setTransitiveState();
          await beforeEmit(newSession);
        });
      }

      const taskUrl =
        newSession?.status === 'pending' &&
        newSession?.currentTask &&
        this.#options.taskUrls?.[newSession?.currentTask.key];

      if (!beforeEmit && (redirectUrl || taskUrl || setActiveNavigate)) {
        await tracker.track(async () => {
          if (!this.client) {
            // Typescript is not happy because since thinks this.client might have changed to undefined because the function is asynchronous.
            return;
          }

          if (newSession?.status !== 'pending') {
            this.#setTransitiveState();
          }

          if (taskUrl) {
            const taskUrlWithRedirect = redirectUrl
              ? buildURL({ base: taskUrl, hashSearchParams: { redirectUrl } }, { stringify: true })
              : taskUrl;
            await this.navigate(taskUrlWithRedirect);
          } else if (setActiveNavigate && newSession) {
            await setActiveNavigate({ session: newSession });
          } else if (redirectUrl) {
            if (this.client.isEligibleForTouch()) {
              const absoluteRedirectUrl = new URL(redirectUrl, window.location.href);
              const redirectUrlWithAuth = this.buildUrlWithAuth(
                this.client.buildTouchUrl({ redirectUrl: absoluteRedirectUrl }),
              );
              await this.navigate(redirectUrlWithAuth);
            }
            await this.navigate(redirectUrl);
          }
        });
      }

      //3. Check if hard reloading (onbeforeunload). If not, set the user/session and emit
      if (tracker.isUnloading()) {
        return;
      }

      this.#setAccessors(newSession);
      this.#emit();

      // Do not revalidate server cache for pending sessions to avoid unmount of `SignIn/SignUp` AIOs when navigating to task
      // newSession can be mutated by the time we get here (org change session touch)
      if (newSession?.status !== 'pending') {
        await onAfterSetActive();
      }
    } finally {
      this.__internal_setActiveInProgress = false;
    }
  };

  public addListener = (listener: ListenerCallback): UnsubscribeCallback => {
    listener = memoizeListenerCallback(listener);
    this.#listeners.push(listener);
    // emit right away
    if (this.client) {
      listener({
        client: this.client,
        session: this.session,
        user: this.user,
        organization: this.organization,
      });
    }

    const unsubscribe = () => {
      this.#listeners = this.#listeners.filter(l => l !== listener);
    };
    return unsubscribe;
  };
  public on: ClerkInterface['on'] = (...args) => {
    this.#publicEventBus.on(...args);
  };

  public off: ClerkInterface['off'] = (...args) => {
    this.#publicEventBus.off(...args);
  };

  public __internal_addNavigationListener = (listener: () => void): UnsubscribeCallback => {
    this.#navigationListeners.push(listener);
    const unsubscribe = () => {
      this.#navigationListeners = this.#navigationListeners.filter(l => l !== listener);
    };
    return unsubscribe;
  };

  public navigate = async (to: string | undefined, options?: NavigateOptions): Promise<unknown> => {
    if (!to || !inBrowser()) {
      return;
    }

    /**
     * Trigger all navigation listeners. In order for modal UI components to close.
     */
    setTimeout(() => {
      this.#emitNavigationListeners();
    }, 0);

    let toURL = new URL(to, window.location.href);

    if (!this.#allowedRedirectProtocols.includes(toURL.protocol)) {
      console.warn(
        `Clerk: "${toURL.protocol}" is not a valid protocol. Redirecting to "/" instead. If you think this is a mistake, please open an issue.`,
      );
      toURL = new URL('/', window.location.href);
    }

    const customNavigate =
      options?.replace && this.#options.routerReplace ? this.#options.routerReplace : this.#options.routerPush;

    debugLogger.info(`Clerk is navigating to: ${toURL}`);
    if (this.#options.routerDebug) {
      console.log(`Clerk is navigating to: ${toURL}`);
    }

    // Custom protocol URLs have an origin value of 'null'. In many cases, this indicates deep-linking and we want to ensure the customNavigate function is used if available.
    if ((toURL.origin !== 'null' && toURL.origin !== window.location.origin) || !customNavigate) {
      windowNavigate(toURL);
      return;
    }

    const metadata = {
      ...(options?.metadata ? { __internal_metadata: options?.metadata } : {}),
      windowNavigate,
    };
    // React router only wants the path, search or hash portion.
    return await customNavigate(stripOrigin(toURL), metadata);
  };

  public buildUrlWithAuth(to: string): string {
    if (this.#instanceType === 'production') {
      return to;
    }

    const toURL = new URL(to, window.location.origin);

    if (toURL.origin === window.location.origin) {
      return toURL.href;
    }

    if (!this.#authService) {
      return toURL.href;
    }

    return this.#authService.decorateUrlWithDevBrowserToken(toURL).href;
  }

  public buildSignInUrl(options?: SignInRedirectOptions): string {
    return this.#buildUrl(
      'signInUrl',
      { ...options, redirectUrl: options?.redirectUrl || window.location.href },
      options?.initialValues,
    );
  }

  public buildSignUpUrl(options?: SignUpRedirectOptions): string {
    return this.#buildUrl(
      'signUpUrl',
      { ...options, redirectUrl: options?.redirectUrl || window.location.href },
      options?.initialValues,
    );
  }

  public buildUserProfileUrl(): string {
    if (!this.environment || !this.environment.displayConfig) {
      return '';
    }
    return this.buildUrlWithAuth(this.environment.displayConfig.userProfileUrl);
  }

  public buildHomeUrl(): string {
    if (!this.environment || !this.environment.displayConfig) {
      return '';
    }
    return this.buildUrlWithAuth(this.environment.displayConfig.homeUrl);
  }

  public buildAfterSignInUrl({ params }: { params?: URLSearchParams } = {}): string {
    return this.buildUrlWithAuth(new RedirectUrls(this.#options, {}, params).getAfterSignInUrl());
  }

  public buildAfterSignUpUrl({ params }: { params?: URLSearchParams } = {}): string {
    return this.buildUrlWithAuth(new RedirectUrls(this.#options, {}, params).getAfterSignUpUrl());
  }

  public buildAfterSignOutUrl(): string {
    if (!this.#options.afterSignOutUrl) {
      return '/';
    }

    return this.buildUrlWithAuth(this.#options.afterSignOutUrl);
  }

  public buildNewSubscriptionRedirectUrl(): string {
    if (!this.#options.newSubscriptionRedirectUrl) {
      return this.buildAfterSignInUrl();
    }

    return this.#options.newSubscriptionRedirectUrl;
  }

  public buildWaitlistUrl(options?: { initialValues?: Record<string, string> }): string {
    if (!this.environment || !this.environment.displayConfig) {
      return '';
    }
    const waitlistUrl = this.#options['waitlistUrl'] || this.environment.displayConfig.waitlistUrl;
    const initValues = new URLSearchParams(options?.initialValues || {});
    return buildURL({ base: waitlistUrl, hashSearchParams: [initValues] }, { stringify: true });
  }

  public buildAfterMultiSessionSingleSignOutUrl(): string {
    if (!this.environment) {
      return '';
    }

    if (this.#options.afterMultiSessionSingleSignOutUrl) {
      return this.buildUrlWithAuth(this.#options.afterMultiSessionSingleSignOutUrl);
    }

    if (this.#options.signInUrl) {
      return this.buildUrlWithAuth(
        buildURL(
          {
            base: this.#options.signInUrl,
            hashPath: 'choose',
          },
          { stringify: true },
        ),
      );
    }

    return this.buildUrlWithAuth(this.environment.displayConfig.afterSignOutOneUrl);
  }

  public buildCreateOrganizationUrl(): string {
    if (!this.environment || !this.environment.displayConfig) {
      return '';
    }
    return this.buildUrlWithAuth(this.environment.displayConfig.createOrganizationUrl);
  }

  public buildOrganizationProfileUrl(): string {
    if (!this.environment || !this.environment.displayConfig) {
      return '';
    }
    return this.buildUrlWithAuth(this.environment.displayConfig.organizationProfileUrl);
  }

  public buildTasksUrl(options?: TasksRedirectOptions): string {
    const currentTask = this.session?.currentTask;
    if (!currentTask) {
      return '';
    }

    const customTaskUrl = this.#options.taskUrls?.[currentTask.key];
    if (customTaskUrl) {
      return customTaskUrl;
    }

    return buildURL(
      {
        base: this.buildSignInUrl(options),
        hashPath: getTaskEndpoint(currentTask),
      },
      {
        stringify: true,
      },
    );
  }

  #redirectToSatellite = async (): Promise<unknown> => {
    if (!inBrowser()) {
      return;
    }
    const searchParams = new URLSearchParams({
      [CLERK_SYNCED]: 'true',
    });

    const satelliteUrl = getClerkQueryParam(CLERK_SATELLITE_URL);
    if (!satelliteUrl || !isHttpOrHttps(satelliteUrl)) {
      clerkRedirectUrlIsMissingScheme();
    }

    const backToSatelliteUrl = buildURL(
      { base: getClerkQueryParam(CLERK_SATELLITE_URL) as string, searchParams },
      { stringify: true },
    );
    return this.navigate(this.buildUrlWithAuth(backToSatelliteUrl));
  };

  public redirectWithAuth = async (to: string): Promise<unknown> => {
    if (inBrowser()) {
      return this.navigate(this.buildUrlWithAuth(to));
    }
    return;
  };

  public redirectToSignIn = async (options?: SignInRedirectOptions): Promise<unknown> => {
    if (inBrowser()) {
      return this.navigate(this.buildSignInUrl(options));
    }
    return;
  };

  public redirectToSignUp = async (options?: SignUpRedirectOptions): Promise<unknown> => {
    if (inBrowser()) {
      return this.navigate(this.buildSignUpUrl(options));
    }
    return;
  };

  public redirectToUserProfile = async (): Promise<unknown> => {
    if (inBrowser()) {
      return this.navigate(this.buildUserProfileUrl());
    }
    return;
  };

  public redirectToCreateOrganization = async (): Promise<unknown> => {
    if (inBrowser()) {
      return this.navigate(this.buildCreateOrganizationUrl());
    }
    return;
  };

  public redirectToOrganizationProfile = async (): Promise<unknown> => {
    if (inBrowser()) {
      return this.navigate(this.buildOrganizationProfileUrl());
    }
    return;
  };

  public redirectToAfterSignIn = async (): Promise<unknown> => {
    if (inBrowser()) {
      return this.navigate(this.buildAfterSignInUrl());
    }
    return;
  };

  public redirectToAfterSignUp = async (): Promise<unknown> => {
    if (inBrowser()) {
      return this.navigate(this.buildAfterSignUpUrl());
    }
    return;
  };

  public redirectToAfterSignOut = async (): Promise<unknown> => {
    if (inBrowser()) {
      return this.navigate(this.buildAfterSignOutUrl());
    }
    return;
  };

  public redirectToWaitlist = async (): Promise<unknown> => {
    if (inBrowser()) {
      return this.navigate(this.buildWaitlistUrl());
    }
    return;
  };

  public redirectToTasks = async (options?: TasksRedirectOptions): Promise<unknown> => {
    if (inBrowser()) {
      return this.navigate(this.buildTasksUrl(options));
    }
    return;
  };

  public handleEmailLinkVerification = async (
    params: HandleEmailLinkVerificationParams,
    customNavigate?: (to: string) => Promise<unknown>,
  ): Promise<unknown> => {
    if (!this.client) {
      return;
    }

    const verificationStatus = getClerkQueryParam('__clerk_status');
    if (verificationStatus === 'expired') {
      throw new EmailLinkError(EmailLinkErrorCodeStatus.Expired);
    } else if (verificationStatus === 'client_mismatch') {
      throw new EmailLinkError(EmailLinkErrorCodeStatus.ClientMismatch);
    } else if (verificationStatus !== 'verified') {
      throw new EmailLinkError(EmailLinkErrorCodeStatus.Failed);
    }

    const newSessionId = getClerkQueryParam('__clerk_created_session');
    const { signIn, signUp, sessions } = this.client;

    const shouldCompleteOnThisDevice = sessions.some(s => s.id === newSessionId);
    const shouldContinueOnThisDevice =
      signIn.status === 'needs_second_factor' || signUp.status === 'missing_requirements';

    const navigate = (to: string) =>
      customNavigate && typeof customNavigate === 'function' ? customNavigate(to) : this.navigate(to);

    const redirectContinue = params.redirectUrl ? () => navigate(params.redirectUrl as string) : noop;

    if (shouldCompleteOnThisDevice) {
      return this.setActive({
        session: newSessionId,
        redirectUrl: params.redirectUrlComplete,
      });
    } else if (shouldContinueOnThisDevice) {
      return redirectContinue();
    }

    if (typeof params.onVerifiedOnOtherDevice === 'function') {
      params.onVerifiedOnOtherDevice();
    }
    return null;
  };

  public handleGoogleOneTapCallback = async (
    signInOrUp: SignInResource | SignUpResource,
    params: HandleOAuthCallbackParams,
    customNavigate?: (to: string) => Promise<unknown>,
  ): Promise<unknown> => {
    if (!this.loaded || !this.environment || !this.client) {
      return;
    }
    const { signIn: _signIn, signUp: _signUp } = this.client;

    const signIn = 'identifier' in (signInOrUp || {}) ? (signInOrUp as SignInResource) : _signIn;
    const signUp = 'missingFields' in (signInOrUp || {}) ? (signInOrUp as SignUpResource) : _signUp;

    const navigate = (to: string) =>
      customNavigate && typeof customNavigate === 'function'
        ? customNavigate(this.buildUrlWithAuth(to))
        : this.navigate(this.buildUrlWithAuth(to));

    return this._handleRedirectCallback(params, {
      signUp,
      signIn,
      navigate,
    });
  };

  private _handleRedirectCallback = async (
    params: HandleOAuthCallbackParams,
    {
      signIn,
      signUp,
      navigate,
    }: {
      signIn: SignInResource;
      signUp: SignUpResource;
      navigate: (to: string) => Promise<unknown>;
    },
  ): Promise<unknown> => {
    if (!this.loaded || !this.environment || !this.client) {
      return;
    }

    // If `handleRedirectCallback` is called on a window without an opener property (such as when the OAuth flow popup
    // directs the opening page to navigate to the /sso-callback route), we need to reload the signIn and signUp resources
    // to ensure that we have the latest state. This operation can fail when we try reloading a resource that doesn't
    // exist (such as when reloading a signIn resource during a signUp attempt), but this can be safely ignored.
    if (!window.opener && params.reloadResource) {
      try {
        if (params.reloadResource === 'signIn') {
          await signIn.reload();
        } else if (params.reloadResource === 'signUp') {
          await signUp.reload();
        }
      } catch {
        // This catch intentionally left blank.
      }
    }

    const { displayConfig } = this.environment;
    const { firstFactorVerification } = signIn;
    const { externalAccount } = signUp.verifications;
    const su = {
      status: signUp.status,
      missingFields: signUp.missingFields,
      externalAccountStatus: externalAccount.status,
      externalAccountErrorCode: externalAccount.error?.code,
      externalAccountSessionId: externalAccount.error?.meta?.sessionId,
      sessionId: signUp.createdSessionId,
    };

    const si = {
      status: signIn.status,
      firstFactorVerificationStatus: firstFactorVerification.status,
      firstFactorVerificationErrorCode: firstFactorVerification.error?.code,
      firstFactorVerificationSessionId: firstFactorVerification.error?.meta?.sessionId,
      sessionId: signIn.createdSessionId,
    };

    const makeNavigate = (to: string) => () => navigate(to);

    const navigateToSignIn = makeNavigate(params.signInUrl || displayConfig.signInUrl);

    const navigateToSignUp = makeNavigate(params.signUpUrl || displayConfig.signUpUrl);

    const navigateToFactorOne = makeNavigate(
      params.firstFactorUrl ||
        buildURL({ base: displayConfig.signInUrl, hashPath: '/factor-one' }, { stringify: true }),
    );

    const navigateToFactorTwo = makeNavigate(
      params.secondFactorUrl ||
        buildURL({ base: displayConfig.signInUrl, hashPath: '/factor-two' }, { stringify: true }),
    );

    const navigateToResetPassword = makeNavigate(
      params.resetPasswordUrl ||
        buildURL({ base: displayConfig.signInUrl, hashPath: '/reset-password' }, { stringify: true }),
    );

    const redirectUrls = new RedirectUrls(this.#options, params);

    const navigateToContinueSignUp = makeNavigate(
      params.continueSignUpUrl ||
        buildURL(
          {
            base: displayConfig.signUpUrl,
            hashPath: '/continue',
          },
          { stringify: true },
        ),
    );

    const navigateToNextStepSignUp = ({ missingFields }: { missingFields: SignUpField[] }) => {
      if (missingFields.length) {
        return navigateToContinueSignUp();
      }

      return completeSignUpFlow({
        signUp,
        verifyEmailPath:
          params.verifyEmailAddressUrl ||
          buildURL(
            {
              base: displayConfig.signUpUrl,
              hashPath: '/verify-email-address',
            },
            { stringify: true },
          ),
        verifyPhonePath:
          params.verifyPhoneNumberUrl ||
          buildURL({ base: displayConfig.signUpUrl, hashPath: '/verify-phone-number' }, { stringify: true }),
        navigate,
      });
    };

    const signInUrl = params.signInUrl || displayConfig.signInUrl;
    const signUpUrl = params.signUpUrl || displayConfig.signUpUrl;

    const setActiveNavigate = async ({
      session,
      baseUrl,
      redirectUrl,
    }: {
      session: SessionResource;
      baseUrl: string;
      redirectUrl: string;
    }) => {
      if (!session.currentTask) {
        await this.navigate(redirectUrl);
        return;
      }

      await navigateIfTaskExists(session, {
        baseUrl,
        navigate: this.navigate,
      });
    };

    if (si.status === 'complete') {
      return this.setActive({
        session: si.sessionId,
        navigate: async ({ session }) => {
          await setActiveNavigate({ session, baseUrl: signInUrl, redirectUrl: redirectUrls.getAfterSignInUrl() });
        },
      });
    }

    const userExistsButNeedsToSignIn =
      su.externalAccountStatus === 'transferable' && su.externalAccountErrorCode === 'external_account_exists';

    if (userExistsButNeedsToSignIn) {
      const res = await signIn.create({ transfer: true });
      switch (res.status) {
        case 'complete':
          return this.setActive({
            session: res.createdSessionId,
            navigate: async ({ session }) => {
              await setActiveNavigate({ session, baseUrl: signUpUrl, redirectUrl: redirectUrls.getAfterSignInUrl() });
            },
          });
        case 'needs_first_factor':
          return navigateToFactorOne();
        case 'needs_second_factor':
          return navigateToFactorTwo();
        case 'needs_new_password':
          return navigateToResetPassword();
        default:
          clerkOAuthCallbackDidNotCompleteSignInSignUp('sign in');
      }
    }

    const userLockedFromSignUp = su.externalAccountErrorCode === 'user_locked';
    const userLockedFromSignIn = si.firstFactorVerificationErrorCode === 'user_locked';

    if (userLockedFromSignUp) {
      return navigateToSignUp();
    }

    if (userLockedFromSignIn) {
      return navigateToSignIn();
    }

    const userHasUnverifiedEmail =
      si.status === 'needs_first_factor' && !signIn.supportedFirstFactors?.every(f => f.strategy === 'enterprise_sso');

    if (userHasUnverifiedEmail) {
      return navigateToFactorOne();
    }

    const userNeedsNewPassword = si.status === 'needs_new_password';

    if (userNeedsNewPassword) {
      return navigateToResetPassword();
    }

    const userNeedsToBeCreated = si.firstFactorVerificationStatus === 'transferable';

    if (userNeedsToBeCreated) {
      if (params.transferable === false) {
        return navigateToSignIn();
      }

      const res = await signUp.create({ transfer: true });
      switch (res.status) {
        case 'complete':
          return this.setActive({
            session: res.createdSessionId,
            navigate: async ({ session }) => {
              await setActiveNavigate({ session, baseUrl: signUpUrl, redirectUrl: redirectUrls.getAfterSignUpUrl() });
            },
          });
        case 'missing_requirements':
          return navigateToNextStepSignUp({ missingFields: res.missingFields });
        default:
          clerkOAuthCallbackDidNotCompleteSignInSignUp('sign in');
      }
    }

    if (su.status === 'complete') {
      return this.setActive({
        session: su.sessionId,
        navigate: async ({ session }) => {
          await setActiveNavigate({ session, baseUrl: signUpUrl, redirectUrl: redirectUrls.getAfterSignUpUrl() });
        },
      });
    }

    if (si.status === 'needs_second_factor') {
      return navigateToFactorTwo();
    }

    const suUserAlreadySignedIn =
      (su.externalAccountStatus === 'failed' || su.externalAccountStatus === 'unverified') &&
      su.externalAccountErrorCode === 'identifier_already_signed_in' &&
      su.externalAccountSessionId;

    const siUserAlreadySignedIn =
      si.firstFactorVerificationStatus === 'failed' &&
      si.firstFactorVerificationErrorCode === 'identifier_already_signed_in' &&
      si.firstFactorVerificationSessionId;

    const userAlreadySignedIn = suUserAlreadySignedIn || siUserAlreadySignedIn;
    if (userAlreadySignedIn) {
      const sessionId = si.firstFactorVerificationSessionId || su.externalAccountSessionId;
      if (sessionId) {
        return this.setActive({
          session: sessionId,
          navigate: async ({ session }) => {
            await setActiveNavigate({
              session,
              baseUrl: suUserAlreadySignedIn ? signUpUrl : signInUrl,
              redirectUrl: redirectUrls.getAfterSignInUrl(),
            });
          },
        });
      }
    }

    if (hasExternalAccountSignUpError(signUp)) {
      return navigateToSignUp();
    }

    if (su.externalAccountStatus === 'verified' && su.status === 'missing_requirements') {
      return navigateToNextStepSignUp({ missingFields: signUp.missingFields });
    }

    if (this.session?.currentTask) {
      await this.redirectToTasks({
        redirectUrl: this.buildAfterSignInUrl(),
      });
      return;
    }

    return navigateToSignIn();
  };

  public handleRedirectCallback = async (
    params: HandleOAuthCallbackParams = {},
    customNavigate?: (to: string) => Promise<unknown>,
  ): Promise<unknown> => {
    if (!this.loaded || !this.environment || !this.client) {
      return;
    }
    const { signIn, signUp } = this.client;

    const navigate = (to: string) =>
      customNavigate && typeof customNavigate === 'function' ? customNavigate(to) : this.navigate(to);

    return this._handleRedirectCallback(params, {
      signUp,
      signIn,
      navigate,
    });
  };

  // TODO: Deprecate this one, and mark it as internal. Is there actual benefit for external developers to use this ? Should they ever reach for it ?
  public handleUnauthenticated = async (opts = { broadcast: true }): Promise<unknown> => {
    if (!this.client || !this.session) {
      return;
    }
    try {
      const newClient = await Client.getOrCreateInstance().fetch();
      this.updateClient(newClient);
      if (this.session) {
        return;
      }
      if (opts.broadcast) {
        eventBus.emit(events.UserSignOut, null);
      }
      return this.setActive({ session: null });
    } catch (err) {
      // `/client` can fail with either a 401, a 403, 500 or network errors.
      // 401 is already handled internally in our fetcher.
      // 403 means that the client is blocked, signing out the user is the only option.
      // 500 means that the client is not working, signing out the user is the only option, since the intention was to sign out the user.
      if (isClerkAPIResponseError(err) && [403, 500].includes(err.status)) {
        return this.setActive({ session: null });
      } else {
        throw err;
      }
    }
  };

  public authenticateWithGoogleOneTap = async (
    params: AuthenticateWithGoogleOneTapParams,
  ): Promise<SignInResource | SignUpResource> => {
    if (__BUILD_DISABLE_RHC__) {
      clerkUnsupportedEnvironmentWarning('Google One Tap');
      // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
      return this.client!.signIn; // TODO: Remove not null assertion
    }

    return this.client?.signIn
      .create({
        strategy: 'google_one_tap',
        token: params.token,
      })
      .catch(err => {
        if (isClerkAPIResponseError(err) && err.errors[0].code === 'external_account_not_found') {
          return this.client?.signUp.create({
            strategy: 'google_one_tap',
            token: params.token,
            legalAccepted: params.legalAccepted,
          });
        }
        throw err;
      }) as Promise<SignInResource | SignUpResource>;
  };

  public authenticateWithMetamask = async (props: AuthenticateWithMetamaskParams = {}): Promise<void> => {
    await this.authenticateWithWeb3({
      ...props,
      strategy: 'web3_metamask_signature',
    });
  };

  public authenticateWithCoinbaseWallet = async (props: AuthenticateWithCoinbaseWalletParams = {}): Promise<void> => {
    await this.authenticateWithWeb3({
      ...props,
      strategy: 'web3_coinbase_wallet_signature',
    });
  };

  public authenticateWithBase = async (props: AuthenticateWithBaseParams = {}): Promise<void> => {
    await this.authenticateWithWeb3({
      ...props,
      strategy: 'web3_base_signature',
    });
  };

  public authenticateWithOKXWallet = async (props: AuthenticateWithOKXWalletParams = {}): Promise<void> => {
    await this.authenticateWithWeb3({
      ...props,
      strategy: 'web3_okx_wallet_signature',
    });
  };

  public authenticateWithWeb3 = async ({
    redirectUrl,
    signUpContinueUrl,
    customNavigate,
    unsafeMetadata,
    strategy,
    legalAccepted,
    secondFactorUrl,
  }: ClerkAuthenticateWithWeb3Params): Promise<void> => {
    if (!this.client || !this.environment) {
      return;
    }

    const { displayConfig } = this.environment;

    const provider = strategy.replace('web3_', '').replace('_signature', '') as Web3Provider;
    const identifier = await getWeb3Identifier({ provider });
    let generateSignature: (params: GenerateSignatureParams) => Promise<string>;
    switch (provider) {
      case 'metamask':
        generateSignature = generateSignatureWithMetamask;
        break;
      case 'base':
        generateSignature = generateSignatureWithBase;
        break;
      case 'coinbase_wallet':
        generateSignature = generateSignatureWithCoinbaseWallet;
        break;
      default:
        generateSignature = generateSignatureWithOKXWallet;
        break;
    }

    const makeNavigate = (to: string) => () =>
      customNavigate && typeof customNavigate === 'function' ? customNavigate(to) : this.navigate(to);

    const navigateToFactorTwo = makeNavigate(
      secondFactorUrl || buildURL({ base: displayConfig.signInUrl, hashPath: '/factor-two' }, { stringify: true }),
    );

    const navigateToContinueSignUp = makeNavigate(
      signUpContinueUrl ||
        buildURL(
          {
            base: displayConfig.signUpUrl,
            hashPath: '/continue',
          },
          { stringify: true },
        ),
    );

    let signInOrSignUp: SignInResource | SignUpResource;
    try {
      signInOrSignUp = await this.client.signIn.authenticateWithWeb3({
        identifier,
        generateSignature,
        strategy,
      });
    } catch (err) {
      if (isError(err, ERROR_CODES.FORM_IDENTIFIER_NOT_FOUND)) {
        signInOrSignUp = await this.client.signUp.authenticateWithWeb3({
          identifier,
          generateSignature,
          unsafeMetadata,
          strategy,
          legalAccepted,
        });

        if (
          signUpContinueUrl &&
          signInOrSignUp.status === 'missing_requirements' &&
          signInOrSignUp.verifications.web3Wallet.status === 'verified'
        ) {
          await navigateToContinueSignUp();
        }
      } else {
        throw err;
      }
    }

    const setActiveNavigate = async ({ session, redirectUrl }: { session: SessionResource; redirectUrl: string }) => {
      if (!session.currentTask) {
        await this.navigate(redirectUrl);
        return;
      }

      await navigateIfTaskExists(session, {
        baseUrl: displayConfig.signInUrl,
        navigate: this.navigate,
      });
    };

    switch (signInOrSignUp.status) {
      case 'needs_second_factor':
        await navigateToFactorTwo();
        break;
      case 'complete':
        if (signInOrSignUp.createdSessionId) {
          await this.setActive({
            session: signInOrSignUp.createdSessionId,
            navigate: async ({ session }) => {
              await setActiveNavigate({ session, redirectUrl: redirectUrl ?? this.buildAfterSignInUrl() });
            },
          });
        }
        break;
      default:
        return;
    }
  };

  public createOrganization = async ({ name, slug }: CreateOrganizationParams): Promise<OrganizationResource> => {
    return Organization.create({ name, slug });
  };

  public getOrganization = async (organizationId: string): Promise<OrganizationResource> =>
    Organization.get(organizationId);

  public joinWaitlist = async ({ emailAddress }: JoinWaitlistParams): Promise<WaitlistResource> =>
    Waitlist.join({ emailAddress });

  public updateEnvironment(environment: EnvironmentResource): asserts this is { environment: EnvironmentResource } {
    this.environment = environment;
  }

  __internal_setCountry = (country: string | null) => {
    if (!this.__internal_country) {
      this.__internal_country = country;
    }
  };

  get __internal_last_error(): ClerkAPIError | null {
    const value = this.internal_last_error;
    this.internal_last_error = null;
    return value;
  }

  set __internal_last_error(value: ClerkAPIError | null) {
    this.internal_last_error = value;
  }

  updateClient = (newClient: ClientResource): void => {
    if (!this.client) {
      // This is the first time client is being
      // set, so we also need to set session
      const session = this.#options.selectInitialSession
        ? this.#options.selectInitialSession(newClient)
        : this.#defaultSession(newClient);
      this.#setAccessors(session);
    }
    this.client = newClient;

    if (this.session) {
      const session = this.#getSessionFromClient(this.session.id);

      const hasTransitionedToPendingStatus = this.session.status === 'active' && session?.status === 'pending';
      if (hasTransitionedToPendingStatus) {
        const onAfterSetActive: SetActiveHook =
          typeof window !== 'undefined' && typeof window.__unstable__onAfterSetActive === 'function'
            ? window.__unstable__onAfterSetActive
            : noop;

        // Execute hooks to update server authentication context and trigger
        // page protections in clerkMiddleware or server components
        void onAfterSetActive();
      }

      // Note: this might set this.session to null
      this.#setAccessors(session);

      // A client response contains its associated sessions, along with a fresh token, so we dispatch a token update event.
      if (!this.session?.lastActiveToken && !isValidBrowserOnline()) {
        debugLogger.warn(
          'No last active token when updating client (offline)',
          { sessionId: this.session?.id },
          'clerk',
        );
      }
      eventBus.emit(events.TokenUpdate, { token: this.session?.lastActiveToken });
    }

    this.#emit();
  };

  get __unstable__environment(): EnvironmentResource | null | undefined {
    return this.environment;
  }

  // TODO: Fix this properly
  // eslint-disable-next-line @typescript-eslint/require-await
  __unstable__setEnvironment = async (env: EnvironmentJSON) => {
    this.environment = new Environment(env);

    if (Clerk.mountComponentRenderer) {
      this.#componentControls = Clerk.mountComponentRenderer(this, this.environment, this.#options);
    }
  };

  __unstable__onBeforeRequest = (callback: FapiRequestCallback<any>): void => {
    this.#fapiClient.onBeforeRequest(callback);
  };

  __unstable__onAfterResponse = (callback: FapiRequestCallback<any>): void => {
    this.#fapiClient.onAfterResponse(callback);
  };

  // TODO @userland-errors:
  __unstable__updateProps = (_props: any) => {
    // We need to re-init the options here in order to keep the options passed to ClerkProvider
    // in sync with the state of clerk-js. If we don't init the options here again, the following scenario is possible:
    // 1. User renders <ClerkProvider propA={undefined} propB={1} />
    // 2. clerk-js initializes propA with a default value
    // 3. The customer update propB independently of propA and window.Clerk.updateProps is called
    // 4. If we don't merge the new props with the current options, propA will be reset to undefined
    const props = {
      ..._props,
      options: this.#initOptions({ ...this.#options, ..._props.options }),
    };

    return this.#componentControls?.ensureMounted().then(controls => controls.updateProps(props));
  };

  __internal_navigateWithError(to: string, err: ClerkAPIError) {
    this.__internal_last_error = err;
    return this.navigate(to);
  }

  #buildSyncUrlForDevelopmentInstances = (): string => {
    const searchParams = new URLSearchParams({
      [CLERK_SATELLITE_URL]: window.location.href,
    });
    return buildURL({ base: this.#options.signInUrl, searchParams }, { stringify: true });
  };

  #buildSyncUrlForProductionInstances = (): string => {
    let primarySyncUrl;

    if (this.proxyUrl) {
      const proxy = new URL(this.proxyUrl);
      primarySyncUrl = new URL(`${proxy.pathname}/v1/client/sync`, proxy.origin);
    } else if (this.domain) {
      primarySyncUrl = new URL(`/v1/client/sync`, `https://${this.domain}`);
    }

    primarySyncUrl?.searchParams.append('redirect_url', window.location.href);

    return primarySyncUrl?.toString() || '';
  };

  #shouldSyncWithPrimary = (): boolean => {
    if (getClerkQueryParam(CLERK_SYNCED) === 'true') {
      return false;
    }

    if (!this.isSatellite) {
      return false;
    }

    return !!this.#authService?.isSignedOut();
  };

  #shouldRedirectToSatellite = (): boolean => {
    if (this.#instanceType === 'production') {
      return false;
    }

    if (this.isSatellite) {
      return false;
    }

    const satelliteUrl = getClerkQueryParam(CLERK_SATELLITE_URL);
    return !!satelliteUrl;
  };

  #syncWithPrimary = async () => {
    if (this.instanceType === 'development') {
      await this.navigate(this.#buildSyncUrlForDevelopmentInstances());
    } else if (this.instanceType === 'production') {
      await this.navigate(this.#buildSyncUrlForProductionInstances());
    }
  };

  #assertSignInFormatAndOrigin = (_signInUrl: string, origin: string) => {
    let signInUrl: URL;
    try {
      signInUrl = new URL(_signInUrl);
    } catch {
      clerkInvalidSignInUrlFormat();
    }

    if (signInUrl.origin === origin) {
      clerkInvalidSignInUrlOrigin();
    }
  };

  #validateMultiDomainOptions = () => {
    if (!this.isSatellite) {
      return;
    }

    if (this.#instanceType === 'development' && !this.#options.signInUrl) {
      clerkMissingSignInUrlAsSatellite();
    }

    if (!this.proxyUrl && !this.domain) {
      clerkMissingProxyUrlAndDomain();
    }

    if (this.#options.signInUrl) {
      this.#assertSignInFormatAndOrigin(this.#options.signInUrl, window.location.origin);
    }
  };

  #loadInStandardBrowser = async (): Promise<void> => {
    /**
     * 0. Init auth service and setup dev browser
     * This is not needed for production instances hence the .clear()
     * At this point we have already attempted to pre-populate devBrowser with a fresh JWT, if Step 2 was successful this will not be overwritten.
     * For multi-domain we want to avoid retrieving a fresh JWT from FAPI, and we need to get the token as a result of multi-domain session syncing.
     */
    this.#authService = await AuthCookieService.create(
      this,
      this.#fapiClient,
      // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
      this.#instanceType!,
      this.#publicEventBus,
    );

    /**
     * 1. Multi-domain SSO handling
     * If needed the app will attempt to sync with another app hosted in a different domain in order to acquire a session
     * - for development instances it populates dev browser JWT and `devBrowserHandler.setup()` should not have run.
     */
    this.#validateMultiDomainOptions();
    if (this.#shouldSyncWithPrimary()) {
      await this.#syncWithPrimary();
      // ClerkJS is not considered loaded during the sync/link process with the primary domain, return early
      return;
    }

    /**
     * 3. If the app is considered a primary domain and is in the middle of the sync/link flow, interact the loading of Clerk and redirect back to the satellite app
     * Initially step 2 and 4 were considered one but for step 2 we need devBrowserHandler.setup() to not have run and step 4 requires a valid dev browser JWT
     */
    if (this.#shouldRedirectToSatellite()) {
      await this.#redirectToSatellite();
      return;
    }

    /**
     * 4. Continue with clerk-js setup.
     * - Fetch & update environment
     * - Fetch & update client
     * - Mount components
     */
    this.#pageLifecycle = createPageLifecycle();

    if (typeof BroadcastChannel !== 'undefined') {
      this.#broadcastChannel = new BroadcastChannel('clerk');
    }

    this.#setupBrowserListeners();

    const isInAccountsHostedPages = isDevAccountPortalOrigin(window?.location.hostname);
    const shouldTouchEnv = this.#instanceType === 'development' && !isInAccountsHostedPages;

    let initializationDegradedCounter = 0;

    let retries = 0;
    while (retries < 2) {
      retries++;

      try {
        const initEnvironmentPromise = Environment.getInstance()
          .fetch({ touch: shouldTouchEnv })
          .then(res => this.updateEnvironment(res))
          .catch(() => {
            ++initializationDegradedCounter;
            const environmentSnapshot = SafeLocalStorage.getItem<EnvironmentJSONSnapshot | null>(
              CLERK_ENVIRONMENT_STORAGE_ENTRY,
              null,
            );

            if (environmentSnapshot) {
              this.updateEnvironment(new Environment(environmentSnapshot));
            }
          });

        const initClient = async () => {
          return Client.getOrCreateInstance()
            .fetch()
            .then(res => this.updateClient(res))
            .catch(async e => {
              /**
               * Only handle non 4xx errors, like 5xx errors and network errors.
               */
              if (is4xxError(e)) {
                // bubble it up
                throw e;
              }

              ++initializationDegradedCounter;

              const jwtInCookie = this.#authService?.getSessionCookie();
              const localClient = createClientFromJwt(jwtInCookie);

              this.updateClient(localClient);

              /**
               * In most scenarios we want the poller to stop while we are fetching a fresh token during an outage.
               * We want to avoid having the below `getToken()` retrying at the same time as the poller.
               */
              this.#authService?.stopPollingForToken();

              // Attempt to grab a fresh token
              await this.session
                ?.getToken({ skipCache: true })
                // If the token fetch fails, let Clerk be marked as loaded and leave it up to the poller.
                .catch(() => null)
                .finally(() => {
                  this.#authService?.startPollingForToken();
                });

              // Allows for Clerk to be marked as loaded with the client and session created from the JWT.
              return null;
            });
        };

        const initComponents = () => {
          if (Clerk.mountComponentRenderer && !this.#componentControls) {
            this.#componentControls = Clerk.mountComponentRenderer(
              this,
              this.environment as Environment,
              this.#options,
            );
          }
        };

        const [, clientResult] = await allSettled([initEnvironmentPromise, initClient()]);

        if (clientResult.status === 'rejected') {
          const e = clientResult.reason;

          if (isError(e, 'requires_captcha')) {
            initComponents();
            await initClient();
          } else {
            throw e;
          }
        }

        this.#authService?.setClientUatCookieForDevelopmentInstances();

        if (await this.#redirectFAPIInitiatedFlow()) {
          return;
        }

        initComponents();

        break;
      } catch (err) {
        if (isError(err, 'dev_browser_unauthenticated')) {
          await this.#authService.handleUnauthenticatedDevBrowser();
        } else if (!isValidBrowserOnline()) {
          console.warn(err);
          return;
        } else {
          throw err;
        }
      }

      if (retries >= 2) {
        clerkErrorInitFailed();
      }
    }

    this.#captchaHeartbeat = new CaptchaHeartbeat(this);
    void this.#captchaHeartbeat.start();
    this.#clearClerkQueryParams();
    this.#handleImpersonationFab();
    this.#handleKeylessPrompt();

    this.#publicEventBus.emit(clerkEvents.Status, initializationDegradedCounter > 0 ? 'degraded' : 'ready');
  };

  private shouldFallbackToCachedResources = (): boolean => {
    return !!this.__internal_getCachedResources;
  };

  #loadInNonStandardBrowser = async (): Promise<void> => {
    let environment: Environment, client: Client;
    const fetchMaxTries = this.shouldFallbackToCachedResources() ? 1 : undefined;
    let initializationDegradedCounter = 0;
    try {
      [environment, client] = await Promise.all([
        Environment.getInstance().fetch({ touch: false, fetchMaxTries }),
        Client.getOrCreateInstance().fetch({ fetchMaxTries }),
      ]);
    } catch (err) {
      if (isClerkRuntimeError(err) && err.code === 'network_error' && this.shouldFallbackToCachedResources()) {
        const cachedResources = await this.__internal_getCachedResources?.();
        environment = new Environment(cachedResources?.environment);
        Client.clearInstance();
        client = Client.getOrCreateInstance(cachedResources?.client);
        ++initializationDegradedCounter;
      } else {
        throw err;
      }
    }

    this.updateClient(client);
    this.updateEnvironment(environment);

    // TODO: Add an auth service also for non standard browsers that will poll for the __session JWT but won't use cookies

    if (Clerk.mountComponentRenderer) {
      this.#componentControls = Clerk.mountComponentRenderer(this, this.environment, this.#options);
    }

    this.#publicEventBus.emit(clerkEvents.Status, initializationDegradedCounter > 0 ? 'degraded' : 'ready');
  };

  // This is used by @clerk/clerk-expo
  __internal_reloadInitialResources = async (): Promise<void> => {
    const [environment, client] = await Promise.all([
      Environment.getInstance().fetch({ touch: false, fetchMaxTries: 1 }),
      Client.getOrCreateInstance().fetch({ fetchMaxTries: 1 }),
    ]);

    this.updateClient(client);
    this.updateEnvironment(environment);

    this.#emit();
  };

  #defaultSession = (client: ClientResource): SignedInSessionResource | null => {
    if (client.lastActiveSessionId) {
      const currentSession = client.signedInSessions.find(s => s.id === client.lastActiveSessionId);
      if (currentSession) {
        return currentSession;
      }
    }
    const session = client.signedInSessions[0];
    return session || null;
  };

  #setupBrowserListeners = (): void => {
    if (!inClientSide()) {
      return;
    }

    this.#pageLifecycle?.onPageFocus(() => {
      if (!this.session) {
        return;
      }

      // In multi-session apps, it's possible that different tabs will have different active sessions. It's critical that the tab's active session is touched in this case so the session is properly updated on the backend, and so we avoid any throttling when multi-session mode is enabled.
      const multisessionMode = this.environment && !this.environment.authConfig.singleSessionMode;
      if (!multisessionMode && this.#touchThrottledUntil > Date.now()) {
        return;
      }
      this.#touchThrottledUntil = Date.now() + 5_000;

      if (this.#options.touchSession) {
        void this.#touchCurrentSession(this.session);
      }
    });

    /**
     * Background tabs get notified of cross-tab signout events.
     */
    this.#broadcastChannel?.addEventListener('message', (event: MessageEvent) => {
      if (event.data?.type === 'signout') {
        void this.handleUnauthenticated({ broadcast: false });
      }
    });

    /**
     * Allow resources within the singleton to notify other tabs about a signout event (scoped to a single tab)
     */
    eventBus.on(events.UserSignOut, () => {
      this.#broadcastChannel?.postMessage({ type: 'signout' });
    });

    eventBus.on(events.EnvironmentUpdate, () => {
      // Cache the environment snapshot for 24 hours
      SafeLocalStorage.setItem(
        CLERK_ENVIRONMENT_STORAGE_ENTRY,
        this.environment?.__internal_toSnapshot(),
        24 * 60 * 60 * 1_000,
      );
    });
  };

  // TODO: Be more conservative about touches. Throttle, don't touch when only one user, etc
  #touchCurrentSession = async (session?: SignedInSessionResource | null): Promise<void> => {
    if (!session) {
      return Promise.resolve();
    }

    await session.touch().catch(e => {
      if (is4xxError(e)) {
        void this.handleUnauthenticated();
      }
    });
  };

  #emit = (): void => {
    if (this.client) {
      for (const listener of this.#listeners) {
        listener({
          client: this.client,
          session: this.session,
          user: this.user,
          organization: this.organization,
        });
      }
    }
  };

  #emitNavigationListeners = (): void => {
    for (const listener of this.#navigationListeners) {
      listener();
    }
  };

  /**
   * Temporarily clears the accessors before emitting changes to React context state.
   * This is used during transitions like sign-out or session changes to prevent UI flickers
   * such as unexpected unmount of control components
   */
  #setTransitiveState = () => {
    this.session = undefined;
    this.organization = undefined;
    this.user = undefined;
    this.#emit();
  };

  #getLastActiveOrganizationFromSession = () => {
    const orgMemberships = this.session?.user.organizationMemberships || [];
    return (
      orgMemberships.map(om => om.organization).find(org => org.id === this.session?.lastActiveOrganizationId) || null
    );
  };

  #setAccessors = (session?: SignedInSessionResource | null) => {
    this.session = session || null;
    this.organization = this.#getLastActiveOrganizationFromSession();
    this.user = this.session ? this.session.user : null;
  };

  #getSessionFromClient = (sessionId: string | undefined): SignedInSessionResource | null => {
    return this.client?.signedInSessions.find(x => x.id === sessionId) || null;
  };

  #handleImpersonationFab = () => {
    this.addListener(({ session }) => {
      const isImpersonating = !!session?.actor;
      if (isImpersonating) {
        void this.#componentControls?.ensureMounted().then(controls => controls.mountImpersonationFab());
      }
    });
  };

  #handleKeylessPrompt = () => {
    if (this.#options.__internal_keyless_claimKeylessApplicationUrl) {
      void this.#componentControls?.ensureMounted().then(controls => {
        // TODO(@pantelis): Investigate if this resets existing props
        controls.updateProps({
          options: {
            __internal_keyless_claimKeylessApplicationUrl: this.#options.__internal_keyless_claimKeylessApplicationUrl,
            __internal_keyless_copyInstanceKeysUrl: this.#options.__internal_keyless_copyInstanceKeysUrl,
            __internal_keyless_dismissPrompt: this.#options.__internal_keyless_dismissPrompt,
          },
        });
      });
    }
  };

  #buildUrl = (
    key: 'signInUrl' | 'signUpUrl',
    options: RedirectOptions,
    _initValues?: Record<string, string>,
  ): string => {
    if (!key || !this.loaded || !this.environment || !this.environment.displayConfig) {
      return '';
    }

    let signInOrUpUrl = this.#options[key] || this.environment.displayConfig[key];
    if (this.#isCombinedSignInOrUpFlow()) {
      // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
      signInOrUpUrl = this.#options.signInUrl!;
    }
    const redirectUrls = new RedirectUrls(this.#options, options).toSearchParams();
    const initValues = new URLSearchParams(_initValues || {});
    const url = buildURL(
      {
        base: signInOrUpUrl,
        hashPath: this.#isCombinedSignInOrUpFlow() && key === 'signUpUrl' ? '/create' : '',
        hashSearchParams: [initValues, redirectUrls],
      },
      { stringify: true },
    );
    return this.buildUrlWithAuth(url);
  };

  assertComponentsReady(controls: unknown): asserts controls is ReturnType<MountComponentRenderer> {
    if (!Clerk.mountComponentRenderer) {
      throw new Error('ClerkJS was loaded without UI components.');
    }
    if (!controls) {
      throw new Error('ClerkJS components are not ready yet.');
    }
  }

  #redirectFAPIInitiatedFlow = async (): Promise<boolean> => {
    const redirectUrl = new URLSearchParams(window.location.search).get('redirect_url');
    const isProdInstance = this.instanceType === 'production';
    const shouldRedirect = redirectUrl !== null && isRedirectForFAPIInitiatedFlow(this.frontendApi, redirectUrl);

    if (isProdInstance || !shouldRedirect) {
      return false;
    }

    const userSignedIn = this.session;
    const signInUrl = this.#options.signInUrl || this.environment?.displayConfig.signInUrl;
    const referrerIsSignInUrl = signInUrl && window.location.href.startsWith(signInUrl);
    const signUpUrl = this.#options.signUpUrl || this.environment?.displayConfig.signUpUrl;
    const referrerIsSignUpUrl = signUpUrl && window.location.href.startsWith(signUpUrl);

    // don't redirect if user is not signed in and referrer is sign in/up url
    if (requiresUserInput(redirectUrl) && !userSignedIn && (referrerIsSignInUrl || referrerIsSignUpUrl)) {
      return false;
    }

    await this.navigate(this.buildUrlWithAuth(redirectUrl));
    return true;
  };

  #initOptions = (options?: ClerkOptions): ClerkOptions => {
    const processedOptions = options ? { ...options } : {};

    // Extract cssLayerName from baseTheme if present and move it to appearance level
    if (processedOptions.appearance) {
      processedOptions.appearance = processCssLayerNameExtraction(processedOptions.appearance);
    }

    return {
      ...defaultOptions,
      ...processedOptions,
      allowedRedirectOrigins: createAllowedRedirectOrigins(
        options?.allowedRedirectOrigins,
        this.frontendApi,
        this.instanceType,
      ),
    };
  };

  /**
   * The handshake payload is transported in the URL in development. In cases where FAPI is returning the handshake payload, but Clerk is being used in a client-only application,
   * we remove the handshake associated parameters as they are not necessary.
   */
  #clearClerkQueryParams = () => {
    try {
      removeClerkQueryParam(CLERK_SYNCED);
      removeClerkQueryParam(CLERK_NETLIFY_CACHE_BUST_PARAM);
      // @nikos: we're looking into dropping this param completely
      // in the meantime, we're removing it here to keep the URL clean
      removeClerkQueryParam(CLERK_SUFFIXED_COOKIES);
      removeClerkQueryParam('__clerk_handshake');
      removeClerkQueryParam('__clerk_handshake_nonce');
      removeClerkQueryParam('__clerk_help');
    } catch {
      // ignore
    }
  };

  get #allowedRedirectProtocols() {
    let allowedProtocols = ALLOWED_PROTOCOLS;

    if (this.#options.allowedRedirectProtocols) {
      allowedProtocols = allowedProtocols.concat(this.#options.allowedRedirectProtocols);
    }

    return allowedProtocols;
  }
}

```
Page 3445/3460FirstPrevNextLast