{"version":3,"file":"useMountLifecycleEffect.cjs","names":["_react","require","useMountLifecycleEffect","onMount","onUpdate","isMounted","useRef","onMountRef","useEffect","current","exports"],"sources":["../../src/useMountLifecycleEffect.ts"],"sourcesContent":["/*!\n * Copyright (c) 2025-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 { useEffect, useRef } from \"react\";\n\nexport const useMountLifecycleEffect = ({\n  onMount,\n  onUpdate,\n}: {\n  onMount?: () => void;\n  onUpdate?: () => void;\n}) => {\n  const isMounted = useRef(false);\n  const onMountRef = useRef(onMount);\n\n  useEffect(() => {\n    if (isMounted.current) {\n      onUpdate?.();\n    } else {\n      isMounted.current = true;\n      onMountRef.current?.();\n    }\n  }, [onUpdate]);\n};\n"],"mappings":";;;;;;AAYA,IAAAA,MAAA,GAAAC,OAAA;AAZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIO,MAAMC,uBAAuB,GAAGA,CAAC;EACtCC,OAAO;EACPC;AAIF,CAAC,KAAK;EACJ,MAAMC,SAAS,GAAG,IAAAC,aAAM,EAAC,KAAK,CAAC;EAC/B,MAAMC,UAAU,GAAG,IAAAD,aAAM,EAACH,OAAO,CAAC;EAElC,IAAAK,gBAAS,EAAC,MAAM;IACd,IAAIH,SAAS,CAACI,OAAO,EAAE;MACrBL,QAAQ,GAAG,CAAC;IACd,CAAC,MAAM;MACLC,SAAS,CAACI,OAAO,GAAG,IAAI;MACxBF,UAAU,CAACE,OAAO,GAAG,CAAC;IACxB;EACF,CAAC,EAAE,CAACL,QAAQ,CAAC,CAAC;AAChB,CAAC;AAACM,OAAA,CAAAR,uBAAA,GAAAA,uBAAA","ignoreList":[]}