{"version":3,"sources":["jsdelivr-header.js","/npm/@okta/src/OktaContext.ts","/npm/@okta/src/OktaError.tsx","/npm/@okta/src/Security.tsx","/npm/@okta/src/withOktaAuth.tsx","/npm/@okta/src/LoginCallback.tsx","/npm/@okta/src/SecureRoute.tsx"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;iuBCqBa,O,uLAFP,EAAW,QAAA,EAEJ,OAAc,OAAA,EAAA,C,wECbrB,wBAAsD,sBAAA,gBAAA,6BAAA,sBAAA,qB,0CAC1D,yBAAgC,sBAAA,iBAC9B,kCAAO,sBAAU,0BAClB,0BAAA,kBAAA,gBACD,YAAO,iBAAA,cAAA,MAJT,YAAA,W,+CCYA,E,UAOE,Y,IACA,U,yBAGkC,iBAAM,cAAS,SAAK,EAAA,KAAA,KAAA,EAAA,SAGnD,iBAAA,cAAA,mBAAA,EAAA,W,EAHH,SAAA,SAAA,GAAA,IAAA,EAAA,EAAA,SAAO,EAAP,EAAA,mBAAkB,EAAlB,EAAA,e,aAQE,EAAkB,iBAAlB,UAAsC,WACpC,OAAA,EAQA,EAAa,iBAAA,eAPd,IAQA,I,uCAGD,EAAS,EAAQ,GAAjB,EAAuC,KAAA,iBAAA,WAAA,WAAA,GAAA,IAAA,EAAA,QAAA,oBAAA,QAAA,KAAA,yLAAA,EAAA,QAAA,mBAAA,eAAA,EAAA,2BAAA,QAAA,6BAAA,QAAA,MAAA,SAAA,EAAA,EAAA,GAAvC,OAAA,6BAAA,QAAA,MAAA,SAAA,G,OAAA,OAAA,EAAA,KAAA,EAAA,MAAA,cAAA,EAAA,OAAA,SAAA,EAAA,EAAA,IAdF,OAoBA,IAAM,MACC,OAAU,EAAA,O,KAKf,YAEO,SAAA,EAAA,GACL,OAAQ,EAAK,MAAA,KAAA,UACd,C,CAhBsC,GAmBvC,O,uCACA,GAAI,EAAJ,CAGM,EAAO,eACX,iBAAA,eAAA,mBAAA,OAAA,e,uGAOF,IAAA,EAAY,EAA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U,8CAAA,IAAA,EAAA,W,iGAAA,IAAA,EAAA,E,oCAKlB,QAAA,MAAA,SAAA,GAEM,O,OACN,EAAS,OAAe,M,KAClB,E,eATY,EAUd,OAVc,M,+BAAA,K,aAAA,EAAA,WAAA,cAAA,OAAA,SAAA,KAAA,OAAA,SAAA,QAAA,EAAA,eAAA,KAAA,EAAA,GAAA,GAAA,CAAA,EAAA,KAAA,Q,CAAA,OAAA,EAAA,KAAA,EAAA,EAAA,GAAA,OAAA,EAAA,KAAA,GAAH,qBAAA,EAAA,KAAA,GAAA,EAAA,qB,QAkBjB,IAAY,MACV,OAAA,EAAA,OAGE,GAAC,EACH,K,kBAGE,SAAU,WAAd,UACE,CACA,CA5BkB,G,GAiClB,IAaA,kBACF,EAAA,SAAO,E,mBAGL,IAAe,gBAAU,GAC3B,EAAA,EACD,IAED,IAAA,EAAA,EACE,Q","file":"/npm/@okta/okta-react@6.10.0/bundles/okta-react.cjs.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@okta/okta-react@6.10.0/bundles/okta-react.cjs.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/*\n * Copyright (c) 2020-Present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\nimport * as React from 'react';\nimport { AuthState, OktaAuth } from '@okta/okta-auth-js';\n\nexport type OnAuthRequiredFunction = (oktaAuth: OktaAuth) => Promise<void> | void;\nexport type OnAuthResumeFunction = () => void;\n\nexport type RestoreOriginalUriFunction = (oktaAuth: OktaAuth, originalUri: string) => Promise<void> | void;\n\nexport interface IOktaContext {\n    oktaAuth: OktaAuth;\n    authState: AuthState | null;\n    _onAuthRequired?: OnAuthRequiredFunction;\n}\n\nconst OktaContext = React.createContext<IOktaContext | null>(null);\n\nexport const useOktaAuth = (): IOktaContext => React.useContext(OktaContext) as IOktaContext;\n\nexport default OktaContext;\n","/*\n * Copyright (c) 2020-Present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport * as React from 'react';\n\nconst OktaError: React.FC<{ error: Error }> = ({ error }) => { \n  if(error.name && error.message) { \n    return <p>{error.name}: {error.message}</p>;\n  }\n  return <p>Error: {error.toString()}</p>;\n};\n\nexport default OktaError;\n","/*!\n * Copyright (c) 2017-Present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport * as React from 'react';\nimport { AuthSdkError, AuthState, OktaAuth } from '@okta/okta-auth-js';\nimport OktaContext, { IOktaContext, OnAuthRequiredFunction, RestoreOriginalUriFunction } from './OktaContext';\nimport OktaError from './OktaError';\nimport { compare as compareVersions } from 'compare-versions';\n\ndeclare const AUTH_JS: {\n  minSupportedVersion: string;\n}\n\ndeclare const PACKAGE_NAME: string;\ndeclare const PACKAGE_VERSION: string;\ndeclare const SKIP_VERSION_CHECK: string;\n\nconst Security: React.FC<{\n  oktaAuth: OktaAuth,\n  restoreOriginalUri: RestoreOriginalUriFunction, \n  onAuthRequired?: OnAuthRequiredFunction,\n  children?: React.ReactNode\n} & React.HTMLAttributes<HTMLDivElement>> = ({ \n  oktaAuth,\n  restoreOriginalUri, \n  onAuthRequired, \n  children\n}) => { \n  const [authState, setAuthState] = React.useState(() => {\n    if (!oktaAuth) {\n      return null;\n    }\n    return oktaAuth.authStateManager.getAuthState();\n  });\n\n  React.useEffect(() => {\n    if (!oktaAuth || !restoreOriginalUri) {\n      return;\n    }\n\n    // Add default restoreOriginalUri callback\n    // props.restoreOriginalUri is required, therefore if options.restoreOriginalUri exists, there are 2 callbacks\n    // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n    // @ts-ignore\n    if (oktaAuth.options.restoreOriginalUri) {\n      console.warn('Two custom restoreOriginalUri callbacks are detected. The one from the OktaAuth configuration will be overridden by the provided restoreOriginalUri prop from the Security component.');\n    }\n    // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n    // @ts-ignore\n    oktaAuth.options.restoreOriginalUri = (async (oktaAuth: unknown, originalUri: string) => {\n      return restoreOriginalUri(oktaAuth as OktaAuth, originalUri);\n    }) as ((oktaAuth: OktaAuth, originalUri?: string) => Promise<void>);\n\n  }, []); // empty array, only check on component mount\n\n  React.useEffect(() => {\n    if (!oktaAuth) {\n      return;\n    }\n\n    // Add okta-react userAgent\n    if (oktaAuth._oktaUserAgent) {\n      oktaAuth._oktaUserAgent.addEnvironment(`${PACKAGE_NAME}/${PACKAGE_VERSION}`);\n    } else {\n      console.warn('_oktaUserAgent is not available on auth SDK instance. Please use okta-auth-js@^5.3.1 .');\n    }\n\n    // Update Security provider with latest authState\n    const currentAuthState = oktaAuth.authStateManager.getAuthState();\n    if (currentAuthState !== authState) {\n      setAuthState(currentAuthState);\n    }\n    const handler = (authState: AuthState) => {\n      setAuthState(authState);\n    };\n    oktaAuth.authStateManager.subscribe(handler);\n\n    // Trigger an initial change event to make sure authState is latest\n    oktaAuth.start();\n\n    return () => {\n      oktaAuth.authStateManager.unsubscribe(handler);\n    };\n  }, [oktaAuth]);\n\n  const oktaContextValue = React.useMemo((): IOktaContext => ({\n    oktaAuth,\n    authState,\n    _onAuthRequired: onAuthRequired\n  }), [oktaAuth, authState, onAuthRequired]);\n\n  if (!oktaAuth) {\n    const err = new AuthSdkError('No oktaAuth instance passed to Security Component.');\n    return <OktaError error={err} />;\n  }\n\n  if (!restoreOriginalUri) {\n    const err = new AuthSdkError('No restoreOriginalUri callback passed to Security Component.');\n    return <OktaError error={err} />;\n  }\n\n  if (!oktaAuth._oktaUserAgent) {\n    console.warn('_oktaUserAgent is not available on auth SDK instance. Please use okta-auth-js@^5.3.1 .');\n  }\n  else {\n    // use SKIP_VERSION_CHECK flag to control version check in tests\n    // OKTA-465157: remove SKIP_VERSION_CHECK\n    const isAuthJsSupported = SKIP_VERSION_CHECK === '1' ||\n      compareVersions(oktaAuth._oktaUserAgent.getVersion(), AUTH_JS.minSupportedVersion, '>=');\n    if (!isAuthJsSupported) {\n      const err = new AuthSdkError(`\n        Passed in oktaAuth is not compatible with the SDK,\n        minimum supported okta-auth-js version is ${AUTH_JS.minSupportedVersion}.\n      `);\n      return <OktaError error={err} />;\n    }\n  }\n\n  return (\n    <OktaContext.Provider value={oktaContextValue}>\n      {children}\n    </OktaContext.Provider>\n  );\n};\n\nexport default Security;\n","/*\n * Copyright (c) 2020-Present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport * as React from 'react';\nimport { useOktaAuth, IOktaContext } from './OktaContext';\n\nconst withOktaAuth = <P extends IOktaContext>(\n  ComponentToWrap: React.ComponentType<P>\n): React.FC<Omit<P, keyof IOktaContext>> => { \n  const WrappedComponent = (props: Omit<P, keyof IOktaContext>) => { \n    const oktaAuthProps = useOktaAuth();\n    return <ComponentToWrap {...oktaAuthProps as IOktaContext } {...props as P} />;\n  };\n  WrappedComponent.displayName = 'withOktaAuth_' + (ComponentToWrap.displayName || ComponentToWrap.name);\n  return WrappedComponent;\n};\n\nexport default withOktaAuth;\n","/*\n * Copyright (c) 2017-Present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport * as React from 'react';\nimport { useOktaAuth, OnAuthResumeFunction } from './OktaContext';\nimport OktaError from './OktaError';\n\ninterface LoginCallbackProps {\n  errorComponent?: React.ComponentType<{ error: Error }>;\n  onAuthResume?: OnAuthResumeFunction;\n  loadingElement?: React.ReactElement;\n}\n\nlet handledRedirect = false;\n\nconst LoginCallback: React.FC<LoginCallbackProps> = ({ errorComponent, loadingElement = null, onAuthResume }) => { \n  const { oktaAuth, authState } = useOktaAuth();\n  const [callbackError, setCallbackError] = React.useState(null);\n\n  const ErrorReporter = errorComponent || OktaError;\n  React.useEffect(() => {\n    // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n    // @ts-ignore OKTA-464505: backward compatibility support for auth-js@5\n    const isInteractionRequired = oktaAuth.idx.isInteractionRequired || oktaAuth.isInteractionRequired.bind(oktaAuth);\n    if (onAuthResume && isInteractionRequired()) {\n      onAuthResume();\n      return;\n    }\n    // OKTA-635977: Prevents multiple calls of handleLoginRedirect() in React18 StrictMode\n    // Top-level variable solution follows: https://react.dev/learn/you-might-not-need-an-effect#initializing-the-application\n    if (!handledRedirect) {\n      oktaAuth.handleLoginRedirect().catch(e => {\n        setCallbackError(e);\n      })\n      handledRedirect = true;\n    }\n  }, [oktaAuth]);\n\n  const authError = authState?.error;\n  const displayError = callbackError || authError;\n  if (displayError) { \n    return <ErrorReporter error={displayError}/>;\n  }\n\n  return loadingElement;\n};\n\nexport default LoginCallback;\n","/*\n * Copyright (c) 2017-Present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport * as React from 'react';\nimport { useOktaAuth, OnAuthRequiredFunction } from './OktaContext';\nimport * as ReactRouterDom from 'react-router-dom';\nimport { toRelativeUrl, AuthSdkError } from '@okta/okta-auth-js';\nimport OktaError from './OktaError';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet useMatch: any;\nif ('useRouteMatch' in ReactRouterDom) {\n  // trick static analyzer to avoid \"'useRouteMatch' is not exported\" error\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  useMatch = (ReactRouterDom as any)['useRouteMatch' in ReactRouterDom ? 'useRouteMatch' : ''];\n} else {\n  // throw when useMatch is triggered\n  useMatch = () => { \n    throw new AuthSdkError('Unsupported: SecureRoute only works with react-router-dom v5 or any router library with compatible APIs. See examples under the \"samples\" folder for how to implement your own custom SecureRoute Component.');\n  };\n}\n\nconst SecureRoute: React.FC<{\n  onAuthRequired?: OnAuthRequiredFunction;\n  errorComponent?: React.ComponentType<{ error: Error }>;\n} & ReactRouterDom.RouteProps & React.HTMLAttributes<HTMLDivElement>> = ({ \n  onAuthRequired,\n  errorComponent,\n  ...routeProps\n}) => { \n  const { oktaAuth, authState, _onAuthRequired } = useOktaAuth();\n  const match = useMatch(routeProps);\n  const pendingLogin = React.useRef(false);\n  const [handleLoginError, setHandleLoginError] = React.useState<Error | null>(null);\n  const ErrorReporter = errorComponent || OktaError;\n\n  React.useEffect(() => {\n    const handleLogin = async () => {\n      if (pendingLogin.current) {\n        return;\n      }\n\n      pendingLogin.current = true;\n\n      const originalUri = toRelativeUrl(window.location.href, window.location.origin);\n      oktaAuth.setOriginalUri(originalUri);\n      const onAuthRequiredFn = onAuthRequired || _onAuthRequired;\n      if (onAuthRequiredFn) {\n        await onAuthRequiredFn(oktaAuth);\n      } else {\n        await oktaAuth.signInWithRedirect();\n      }\n    };\n\n    // Only process logic if the route matches\n    if (!match) {\n      return;\n    }\n\n    if (!authState) {\n      return;\n    }\n\n    if (authState.isAuthenticated) {\n      pendingLogin.current = false;\n      return;\n    }\n\n    // Start login if app has decided it is not logged in and there is no pending signin\n    if(!authState.isAuthenticated) { \n      handleLogin().catch(err => {\n        setHandleLoginError(err as Error);\n      });\n    }  \n\n  }, [\n    authState,\n    oktaAuth, \n    match, \n    onAuthRequired, \n    _onAuthRequired\n  ]);\n\n  if (handleLoginError) {\n    return <ErrorReporter error={handleLoginError} />;\n  }\n\n  if (!authState || !authState.isAuthenticated) {\n    return null;\n  }\n\n  return (\n    <ReactRouterDom.Route\n      { ...routeProps }\n    />\n  );\n};\n\nexport default SecureRoute;\n"]}