{"version":3,"sources":["../src/hooks/legacy/useSignIn.ts","../src/hooks/legacy/useSignUp.ts"],"sourcesContent":["import { __internal_useClientBase } from '@clerk/shared/react';\nimport { eventMethodCalled } from '@clerk/shared/telemetry';\nimport type { UseSignInReturn } from '@clerk/shared/types';\n\nimport { useIsomorphicClerkContext } from '../../contexts/IsomorphicClerkContext';\nimport { useAssertWrappedByClerkProvider } from '../useAssertWrappedByClerkProvider';\n\n/**\n * The `useSignIn()` hook provides access to the [`SignIn`](https://clerk.com/docs/reference/javascript/sign-in) object, which allows you to check the current state of a sign-in attempt and manage the sign-in flow. You can use this to create a [custom sign-in flow](https://clerk.com/docs/guides/development/custom-flows/overview).\n *\n * @unionReturnHeadings\n * [\"Initialization\", \"Loaded\"]\n *\n * @example\n * ### Check the current state of a sign-in\n *\n * The following example uses the `useSignIn()` hook to access the [`SignIn`](https://clerk.com/docs/reference/javascript/sign-in) object, which contains the current sign-in attempt status and methods to create a new sign-in attempt. The `isLoaded` property is used to handle the loading state.\n *\n * <Tabs items='React,Next.js'>\n * <Tab>\n *\n * ```tsx {{ filename: 'src/pages/SignInPage.tsx' }}\n * import { useSignIn } from '@clerk/react'\n *\n * export default function SignInPage() {\n *   const { isLoaded, signIn } = useSignIn()\n *\n *   if (!isLoaded) {\n *     // Handle loading state\n *     return null\n *   }\n *\n *   return <div>The current sign-in attempt status is {signIn?.status}.</div>\n * }\n * ```\n *\n * </Tab>\n * <Tab>\n *\n * {@include ../../../docs/legacy-use-sign-in.md#nextjs-01}\n *\n * </Tab>\n * </Tabs>\n *\n * @example\n * ### Create a custom sign-in flow with `useSignIn()`\n *\n * The `useSignIn()` hook can also be used to build fully custom sign-in flows, if Clerk's prebuilt components don't meet your specific needs or if you require more control over the authentication flow. Different sign-in flows include email and password, email and phone codes, email links, and multifactor (MFA). To learn more about using the `useSignIn()` hook to create custom flows, see the [custom flow guides](https://clerk.com/docs/guides/development/custom-flows/overview).\n *\n * ```empty```\n */\nexport const useSignIn = (): UseSignInReturn => {\n  useAssertWrappedByClerkProvider('useSignIn');\n\n  const isomorphicClerk = useIsomorphicClerkContext();\n  const client = __internal_useClientBase();\n\n  isomorphicClerk.telemetry?.record(eventMethodCalled('useSignIn'));\n\n  if (!client) {\n    return { isLoaded: false, signIn: undefined, setActive: undefined };\n  }\n\n  return {\n    isLoaded: true,\n    signIn: client.signIn,\n    setActive: isomorphicClerk.setActive,\n  };\n};\n","import { __internal_useClientBase } from '@clerk/shared/react';\nimport { eventMethodCalled } from '@clerk/shared/telemetry';\nimport type { UseSignUpReturn } from '@clerk/shared/types';\n\nimport { useIsomorphicClerkContext } from '../../contexts/IsomorphicClerkContext';\nimport { useAssertWrappedByClerkProvider } from '../useAssertWrappedByClerkProvider';\n\n/**\n * The `useSignUp()` hook provides access to the [`SignUp`](https://clerk.com/docs/reference/javascript/sign-up) object, which allows you to check the current state of a sign-up attempt and manage the sign-up flow. You can use this to create a [custom sign-up flow](https://clerk.com/docs/guides/development/custom-flows/overview).\n *\n * @unionReturnHeadings\n * [\"Initialization\", \"Loaded\"]\n *\n * @example\n * ### Check the current state of a sign-up\n *\n * The following example uses the `useSignUp()` hook to access the [`SignUp`](https://clerk.com/docs/reference/javascript/sign-up) object, which contains the current sign-up attempt status and methods to create a new sign-up attempt. The `isLoaded` property is used to handle the loading state.\n *\n * <Tabs items='React,Next.js'>\n * <Tab>\n *\n * ```tsx {{ filename: 'src/pages/SignUpPage.tsx' }}\n * import { useSignUp } from '@clerk/react'\n *\n * export default function SignUpPage() {\n *   const { isLoaded, signUp } = useSignUp()\n *\n *   if (!isLoaded) {\n *     // Handle loading state\n *     return null\n *   }\n *\n *   return <div>The current sign-up attempt status is {signUp?.status}.</div>\n * }\n * ```\n *\n * </Tab>\n * <Tab>\n *\n * {@include ../../../docs/legacy-use-sign-up.md#nextjs-01}\n *\n * </Tab>\n * </Tabs>\n *\n * @example\n * ### Create a custom sign-up flow with `useSignUp()`\n *\n * The `useSignUp()` hook can also be used to build fully custom sign-up flows, if Clerk's prebuilt components don't meet your specific needs or if you require more control over the authentication flow. Different sign-up flows include email and password, email and phone codes, email links, and multifactor (MFA). To learn more about using the `useSignUp()` hook to create custom flows, see the [custom flow guides](https://clerk.com/docs/guides/development/custom-flows/overview).\n *\n * ```empty```\n */\nexport const useSignUp = (): UseSignUpReturn => {\n  useAssertWrappedByClerkProvider('useSignUp');\n\n  const isomorphicClerk = useIsomorphicClerkContext();\n  const client = __internal_useClientBase();\n\n  isomorphicClerk.telemetry?.record(eventMethodCalled('useSignUp'));\n\n  if (!client) {\n    return { isLoaded: false, signUp: undefined, setActive: undefined };\n  }\n\n  return {\n    isLoaded: true,\n    signUp: client.signUp,\n    setActive: isomorphicClerk.setActive,\n  };\n};\n"],"mappings":";;;;;;;AAAA,SAAS,gCAAgC;AACzC,SAAS,yBAAyB;AAkD3B,IAAM,YAAY,MAAuB;AAnDhD;AAoDE,kCAAgC,WAAW;AAE3C,QAAM,kBAAkB,0BAA0B;AAClD,QAAM,SAAS,yBAAyB;AAExC,wBAAgB,cAAhB,mBAA2B,OAAO,kBAAkB,WAAW;AAE/D,MAAI,CAAC,QAAQ;AACX,WAAO,EAAE,UAAU,OAAO,QAAQ,QAAW,WAAW,OAAU;AAAA,EACpE;AAEA,SAAO;AAAA,IACL,UAAU;AAAA,IACV,QAAQ,OAAO;AAAA,IACf,WAAW,gBAAgB;AAAA,EAC7B;AACF;;;ACpEA,SAAS,4BAAAA,iCAAgC;AACzC,SAAS,qBAAAC,0BAAyB;AAkD3B,IAAM,YAAY,MAAuB;AAnDhD;AAoDE,kCAAgC,WAAW;AAE3C,QAAM,kBAAkB,0BAA0B;AAClD,QAAM,SAASC,0BAAyB;AAExC,wBAAgB,cAAhB,mBAA2B,OAAOC,mBAAkB,WAAW;AAE/D,MAAI,CAAC,QAAQ;AACX,WAAO,EAAE,UAAU,OAAO,QAAQ,QAAW,WAAW,OAAU;AAAA,EACpE;AAEA,SAAO;AAAA,IACL,UAAU;AAAA,IACV,QAAQ,OAAO;AAAA,IACf,WAAW,gBAAgB;AAAA,EAC7B;AACF;","names":["__internal_useClientBase","eventMethodCalled","__internal_useClientBase","eventMethodCalled"]}