{"ast":null,"code":"import * as React from 'react';\nimport { useId, useMemo } from 'react';\nimport { PresenceContext } from '../../context/PresenceContext.mjs';\nimport { useConstant } from '../../utils/use-constant.mjs';\nimport { PopChild } from './PopChild.mjs';\nconst PresenceChild = _ref => {\n  let {\n    children,\n    initial,\n    isPresent,\n    onExitComplete,\n    custom,\n    presenceAffectsLayout,\n    mode\n  } = _ref;\n  const presenceChildren = useConstant(newChildrenMap);\n  const id = useId();\n  const context = useMemo(() => ({\n    id,\n    initial,\n    isPresent,\n    custom,\n    onExitComplete: childId => {\n      presenceChildren.set(childId, true);\n      for (const isComplete of presenceChildren.values()) {\n        if (!isComplete) return; // can stop searching when any is incomplete\n      }\n      onExitComplete && onExitComplete();\n    },\n    register: childId => {\n      presenceChildren.set(childId, false);\n      return () => presenceChildren.delete(childId);\n    }\n  }),\n  /**\n   * If the presence of a child affects the layout of the components around it,\n   * we want to make a new context value to ensure they get re-rendered\n   * so they can detect that layout change.\n   */\n  presenceAffectsLayout ? undefined : [isPresent]);\n  useMemo(() => {\n    presenceChildren.forEach((_, key) => presenceChildren.set(key, false));\n  }, [isPresent]);\n  /**\n   * If there's no `motion` components to fire exit animations, we want to remove this\n   * component immediately.\n   */\n  React.useEffect(() => {\n    !isPresent && !presenceChildren.size && onExitComplete && onExitComplete();\n  }, [isPresent]);\n  if (mode === \"popLayout\") {\n    children = React.createElement(PopChild, {\n      isPresent: isPresent\n    }, children);\n  }\n  return React.createElement(PresenceContext.Provider, {\n    value: context\n  }, children);\n};\nfunction newChildrenMap() {\n  return new Map();\n}\nexport { PresenceChild };","map":{"version":3,"names":["React","useId","useMemo","PresenceContext","useConstant","PopChild","PresenceChild","_ref","children","initial","isPresent","onExitComplete","custom","presenceAffectsLayout","mode","presenceChildren","newChildrenMap","id","context","childId","set","isComplete","values","register","delete","undefined","forEach","_","key","useEffect","size","createElement","Provider","value","Map"],"sources":["/opt/bitnami/minigames/frasle/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs"],"sourcesContent":["import * as React from 'react';\nimport { useId, useMemo } from 'react';\nimport { PresenceContext } from '../../context/PresenceContext.mjs';\nimport { useConstant } from '../../utils/use-constant.mjs';\nimport { PopChild } from './PopChild.mjs';\n\nconst PresenceChild = ({ children, initial, isPresent, onExitComplete, custom, presenceAffectsLayout, mode, }) => {\n    const presenceChildren = useConstant(newChildrenMap);\n    const id = useId();\n    const context = useMemo(() => ({\n        id,\n        initial,\n        isPresent,\n        custom,\n        onExitComplete: (childId) => {\n            presenceChildren.set(childId, true);\n            for (const isComplete of presenceChildren.values()) {\n                if (!isComplete)\n                    return; // can stop searching when any is incomplete\n            }\n            onExitComplete && onExitComplete();\n        },\n        register: (childId) => {\n            presenceChildren.set(childId, false);\n            return () => presenceChildren.delete(childId);\n        },\n    }), \n    /**\n     * If the presence of a child affects the layout of the components around it,\n     * we want to make a new context value to ensure they get re-rendered\n     * so they can detect that layout change.\n     */\n    presenceAffectsLayout ? undefined : [isPresent]);\n    useMemo(() => {\n        presenceChildren.forEach((_, key) => presenceChildren.set(key, false));\n    }, [isPresent]);\n    /**\n     * If there's no `motion` components to fire exit animations, we want to remove this\n     * component immediately.\n     */\n    React.useEffect(() => {\n        !isPresent &&\n            !presenceChildren.size &&\n            onExitComplete &&\n            onExitComplete();\n    }, [isPresent]);\n    if (mode === \"popLayout\") {\n        children = React.createElement(PopChild, { isPresent: isPresent }, children);\n    }\n    return (React.createElement(PresenceContext.Provider, { value: context }, children));\n};\nfunction newChildrenMap() {\n    return new Map();\n}\n\nexport { PresenceChild };\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,KAAK,EAAEC,OAAO,QAAQ,OAAO;AACtC,SAASC,eAAe,QAAQ,mCAAmC;AACnE,SAASC,WAAW,QAAQ,8BAA8B;AAC1D,SAASC,QAAQ,QAAQ,gBAAgB;AAEzC,MAAMC,aAAa,GAAGC,IAAA,IAA4F;EAAA,IAA3F;IAAEC,QAAQ;IAAEC,O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