{
  "version": 3,
  "sources": ["../../src/utils/useRecordEffect.ts"],
  "sourcesContent": ["import type { Event, FramerEvents } from \"@framerjs/events\"\nimport { getEngine } from \"document/getEngine.ts\"\nimport React from \"react\"\nimport { record } from \"web/lib/tracker.ts\"\n\n/** Will record an event when the component mounts. And, if given any dependencies, when they\n * change. But will not record an event if the component (re)mount is happening because of error\n * recovery, or because the document was reloaded from the server.\n *\n * If you need custom logic, use `React.useEffect` instead and check `getEngine()?.isRemountingUI()`\n * before sending events.\n * */\nexport function useRecordEffect<\n\tT extends FramerEvents[\"event\"],\n\tE extends FramerEvents = Extract<FramerEvents, { event: T }>,\n>(event: T, data: E extends Event<T, infer D> ? D : never, dependencies: React.DependencyList = []) {\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: the event and data parameters should be constants.\n\tReact.useEffect(() => {\n\t\tif (getEngine()?.isRemountingUI()) return\n\t\trecord(event, data)\n\t}, dependencies)\n}\n"],
  "mappings": ";;;;;;;;;;;;;;AAEA,mBAAkB;AAUX,SAAS,gBAGd,OAAU,MAA+C,eAAqC,CAAC,GAAG;AAEnG,eAAAA,QAAM,UAAU,MAAM;AACrB,QAAI,UAAU,GAAG,eAAe,EAAG;AACnC,WAAO,OAAO,IAAI;AAAA,EACnB,GAAG,YAAY;AAChB;",
  "names": ["React"]
}
