{"version":3,"sources":["../src/helpers.ts","../src/matchers/type-guards.ts","../src/utils/formatRenderHistory.ts","../src/matchers/async/phase.ts","../src/matchers/async/render-count.ts","../src/matchers/sync/phase.ts","../src/matchers/sync/render-count.ts","../src/matchers/sync/render-count-budget.ts","../src/matchers/sync/render-loops.ts","../src/matchers/index.ts","../src/registry.ts","../src/auto-setup.ts","../src/profiler/components/createOnRenderCallback.ts","../src/profiler/components/ProfiledComponent.tsx","../src/profiler/core/CacheMetrics.ts","../src/profiler/api/ProfilerAPI.ts","../src/profiler/core/constants.ts","../src/profiler/core/ProfilerCache.ts","../src/profiler/core/ProfilerEvents.ts","../src/profiler/core/ProfilerData.ts","../src/profiler/core/ProfilerStorage.ts","../src/profiler/components/withProfiler.tsx","../src/hooks/profileHook.tsx","../src/hooks/createHookProfiler.tsx","../src/utils/async.ts","../src/utils/renderProfiled.tsx","../src/index.ts"],"names":["formatFailureMessage","formatSuccessMessage","expect","afterEach","afterAll","useRef","jsx","Profiler","render","act"],"mappings":";;;;;;;;;AAwCO,IAAM,iBAAA,mBAAoB,MAAA,CAAA,CAC/B,SAAA,EACA,WAAA,EACA,SACA,KAAA,KACS;AACT,EAAA,YAAA,CAAa,SAAS,CAAA;AACtB,EAAA,WAAA,EAAY;AACZ,EAAA,OAAA,CAAQ,KAAK,CAAA;AACf,CAAA,EATiC,mBAAA,CAAA;AAqD1B,IAAM,kDAAkC,MAAA,CAAA,CAC7C,SAAA,EACA,aACA,OAAA,EACA,KAAA,EACA,aACA,aAAA,KACS;AAET,EAAA,IAAI,gBAAgB,aAAA,EAAe;AACjC,IAAA;AAAA,EACF;AAGA,EAAA,iBAAA,CAAkB,SAAA,EAAW,WAAA,EAAa,OAAA,EAAS,KAAK,CAAA;AAC1D,CAAA,EAf+C,iCAAA,CAAA;;;ACxFxC,SAAS,oBACd,QAAA,EACwC;AACxC,EAAA,OACE,OAAO,QAAA,KAAa,UAAA,IACpB,oBAAoB,QAAA,IACpB,kBAAA,IAAsB,YACt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E3E,EAAA,OAAO;AAAA,IACL,SAAA,EAAW,iBAAA;AAAA,IACX,GAAG,GAAA;AAAA,IACH,QAAA,0BAAW,QAAA,KAAyB;AAElC,MAAA,YAAA,GAAe,EAAE,GAAG,YAAA,EAAc,GAAG,QAAA,EAAS;AAC9C,MAAA,GAAA,CAAI,yBAASA,cAAAA,CAAC,iBAAA,EAAA,EAAmB,GAAG,cAAc,CAAE,CAAA;AAAA,IACtD,CAAA,EAJU,UAAA;AAAA,GAKZ;AACF;AArBgB,MAAA,CAAA,cAAA,EAAA,gBAAA,CAAA;;;ACzBT,IAAM,OAAA,GAAU,OAAA,CAAQ,GAAA,CAAI,mBAAA,IAAuB","file":"index.cjs","sourcesContent":["/**\n * Performs cleanup and resolves a promise in async event-based operations.\n *\n * This helper ensures the correct cleanup sequence when an async condition is met:\n * 1. Cancel the timeout (no longer need to wait)\n * 2. Unsubscribe from events (prevent memory leaks)\n * 3. Resolve the promise with the result\n *\n * @template T - The type of value to resolve with\n * @param timeoutId - The timeout ID to clear\n * @param unsubscribe - Callback to unsubscribe from event listener\n * @param resolve - Promise resolve function\n * @param value - Value to resolve the promise with\n *\n * @example\n * ```typescript\n * // Usage in async matcher\n * const unsubscribe = component.onRender(({ phase }) => {\n *   if (phase === targetPhase) {\n *     cleanupAndResolve(timeoutId, unsubscribe, resolve, {\n *       pass: true,\n *       message: () => \"Phase reached\"\n *     });\n *   }\n * });\n * ```\n *\n * @example\n * ```typescript\n * // Usage in async utility (Promise<void>)\n * const unsubscribe = component.onRender(({ count }) => {\n *   if (count >= targetCount) {\n *     cleanupAndResolve(timeoutId, unsubscribe, resolve, undefined);\n *   }\n * });\n * ```\n *\n * @since 1.6.0\n * @internal - This is a low-level helper, not part of public API\n */\nexport const cleanupAndResolve = <T>(\n  timeoutId: NodeJS.Timeout,\n  unsubscribe: () => void,\n  resolve: (value: T) => void,\n  value: T,\n): void => {\n  clearTimeout(timeoutId);\n  unsubscribe();\n  resolve(value);\n};\n\n/**\n * Conditionally performs cleanup and resolves a promise if phases match.\n *\n * This helper combines phase matching logic with cleanup/resolve sequence.\n * By moving the conditional logic INSIDE the helper (instead of the callback),\n * we make it unit-testable and kill mutation testing survivors.\n *\n * **Architecture:** Callback becomes a \"dumb data pipe\", helper contains all logic.\n *\n * Call sequence when phases match:\n * 1. Check if actualPhase === expectedPhase\n * 2. If match: Cancel timeout → Unsubscribe → Resolve\n * 3. If no match: Return early (no side effects)\n *\n * @template T - The type of value to resolve with\n * @param timeoutId - The timeout ID to clear\n * @param unsubscribe - Callback to unsubscribe from event listener\n * @param resolve - Promise resolve function\n * @param value - Value to resolve the promise with\n * @param actualPhase - The phase that occurred\n * @param expectedPhase - The phase we're waiting for\n *\n * @example\n * ```typescript\n * // Usage in async phase matcher\n * const unsubscribe = component.onRender(({ phase: renderPhase }) => {\n *   // Callback is just a data pipe - no logic!\n *   cleanupAndResolveIfPhaseMatches(\n *     timeoutId,\n *     unsubscribe,\n *     resolve,\n *     { pass: true, message: () => \"...\" },\n *     renderPhase,  // actual\n *     phase         // expected\n *   );\n * });\n * ```\n *\n * @since 1.6.0\n * @internal - This is a low-level helper, not part of public API\n * @see docs/mutation-testing-case-study.md - Final solution for mutants #4 and #8\n */\nexport const cleanupAndResolveIfPhaseMatches = <T>(\n  timeoutId: NodeJS.Timeout,\n  unsubscribe: () => void,\n  resolve: (value: T) => void,\n  value: T,\n  actualPhase: string,\n  expectedPhase: string,\n): void => {\n  // Guard: early return if phases don't match (unit-testable!)\n  if (actualPhase !== expectedPhase) {\n    return;\n  }\n\n  // Phases match - perform cleanup and resolve\n  cleanupAndResolve(timeoutId, unsubscribe, resolve, value);\n};\n","import type { ProfiledComponent } from \"../types\";\n\n/**\n * Type guard to validate that a value is a profiled component\n */\nexport function isProfiledComponent(\n  received: unknown,\n): received is ProfiledComponent<unknown> {\n  return (\n    typeof received === \"function\" &&\n    \"getRenderCount\" in received &&\n    \"getRenderHistory\" in received &&\n    \"getLastRender\" in received\n  );\n}\n","import type { PhaseType } from \"../types\";\n\nconst getPluralEnding = (number: number): string => {\n  return number === 1 ? \"\" : \"s\";\n};\n\n/**\n * Formats render history into a human-readable string for error messages\n *\n * @param history - Array of render phases\n * @param maxItems - Maximum number of items to display (default: 10)\n * @returns Formatted string with render details\n *\n * @example\n * ```typescript\n * const history = component.getRenderHistory();\n * const formatted = formatRenderHistory(history);\n * // Output:\n * //   #1 [mount        phase]\n * //   #2 [update       phase]\n * //   💡 Tip: Use Component.getRenderHistory() to inspect all render details\n * ```\n */\nexport function formatRenderHistory(\n  history: readonly PhaseType[],\n  maxItems = 10,\n): string {\n  if (history.length === 0) {\n    return \"No renders\";\n  }\n\n  const items = history.slice(0, maxItems).map((phase, index) => {\n    // Format phase with padding for alignment\n    const paddedPhase = phase.padEnd(12);\n\n    return `  #${index + 1} [${paddedPhase} phase]`;\n  });\n\n  const result = items.join(\"\\n\");\n\n  // Add helpful tip at the end\n  const tip =\n    \"\\n\\n  💡 Tip: Use Component.getRenderHistory() to inspect all render details\";\n\n  // Add \"and X more\" indicator if there are more items\n  const hasMore = history.length > maxItems;\n\n  return hasMore\n    ? `${result}\\n  ... and ${history.length - maxItems} more${tip}`\n    : result + tip;\n}\n\n/**\n * Formats a short summary of render statistics\n *\n * @param history - Array of render phases\n * @returns Brief statistics summary\n *\n * @example\n * ```typescript\n * const summary = formatRenderSummary(history);\n * // \"3 renders (1 mount, 2 updates)\"\n * ```\n */\nexport function formatRenderSummary(history: readonly PhaseType[]): string {\n  if (history.length === 0) {\n    return \"0 renders\";\n  }\n\n  let mounts = 0;\n  let updates = 0;\n  let nested = 0;\n\n  for (const phase of history) {\n    switch (phase) {\n      case \"mount\": {\n        mounts++;\n\n        break;\n      }\n      case \"update\": {\n        updates++;\n\n        break;\n      }\n      case \"nested-update\": {\n        nested++;\n\n        break;\n      }\n      // No default - all possible PhaseType values are handled\n    }\n  }\n\n  const parts: string[] = [];\n\n  if (mounts > 0) {\n    parts.push(`${mounts} mount${getPluralEnding(mounts)}`);\n  }\n  if (updates > 0) {\n    parts.push(`${updates} update${getPluralEnding(updates)}`);\n  }\n  if (nested > 0) {\n    parts.push(`${nested} nested update${getPluralEnding(nested)}`);\n  }\n\n  return `${history.length} render${getPluralEnding(history.length)} (${parts.join(\", \")})`;\n}\n","import { cleanupAndResolveIfPhaseMatches } from \"@/helpers\";\nimport { isProfiledComponent } from \"@/matchers/type-guards\";\nimport { formatRenderSummary } from \"@/utils/formatRenderHistory\";\n\nimport type { WaitOptions, MatcherResult } from \"@/matchers/types\";\nimport type { PhaseType } from \"@/types\";\n\n/**\n * Assert that component eventually reaches specific render phase (async)\n *\n * Uses event-based approach with onRender() for instant notification.\n * No polling overhead - resolves immediately when condition is met.\n *\n * @param received - The component to check (must be created with withProfiler)\n * @param phase - Expected render phase ('mount', 'update', or 'nested-update')\n * @param options - Wait options\n * @returns Promise with matcher result\n *\n * @since v1.6.0 - Rewritten to use event-based approach (no polling)\n *\n * @example\n * await expect(ProfiledComponent).toEventuallyReachPhase('update')\n * await expect(ProfiledComponent).toEventuallyReachPhase('mount', { timeout: 2000 })\n */\nexport async function toEventuallyReachPhase(\n  received: unknown,\n  phase: PhaseType,\n  options?: WaitOptions,\n): Promise<MatcherResult> {\n  if (!isProfiledComponent(received)) {\n    return {\n      pass: false,\n      message: () =>\n        `Expected a profiled component created with withProfiler(), received ${typeof received}`,\n    };\n  }\n\n  const validPhases = [\"mount\", \"update\", \"nested-update\"];\n\n  if (!validPhases.includes(phase)) {\n    return {\n      pass: false,\n      message: () =>\n        `Phase must be one of: ${validPhases.join(\", \")}, received ${phase}`,\n    };\n  }\n\n  const { timeout = 1000 } = options ?? {};\n\n  if (!Number.isFinite(timeout) || timeout <= 0) {\n    return {\n      pass: false,\n      message: () =>\n        `Expected timeout to be a positive number, received ${timeout}`,\n    };\n  }\n\n  return new Promise((resolve) => {\n    // Race condition protection: check if already satisfied\n    if (received.getRenderHistory().includes(phase)) {\n      resolve({\n        pass: true,\n        message: () =>\n          `Expected component not to eventually reach phase \"${phase}\" within ${timeout}ms, but it did`,\n      });\n\n      return;\n    }\n\n    // Setup timeout\n    const timeoutId = setTimeout(() => {\n      unsubscribe();\n\n      const history = received.getRenderHistory();\n      const phases = history.join(\", \");\n      const summary = formatRenderSummary(history);\n\n      resolve({\n        pass: false,\n        message: () =>\n          `Expected component to eventually reach phase \"${phase}\" within ${timeout}ms, but it didn't (${summary}).\\n\\nCurrent phases: [${phases}]`,\n      });\n    }, timeout);\n\n    // Subscribe to render events\n    const unsubscribe = received.onRender(({ phase: renderPhase }) => {\n      // Callback is just a data pipe - no logic!\n      // All conditional logic moved inside helper (unit-testable)\n      cleanupAndResolveIfPhaseMatches(\n        timeoutId,\n        unsubscribe,\n        resolve,\n        {\n          pass: true,\n          message: () =>\n            `Expected component not to eventually reach phase \"${phase}\" within ${timeout}ms, but it did`,\n        },\n        renderPhase, // actual phase\n        phase, // expected phase\n      );\n    });\n  });\n}\n","import { cleanupAndResolve } from \"@/helpers\";\nimport { isProfiledComponent } from \"@/matchers/type-guards\";\nimport {\n  formatRenderHistory,\n  formatRenderSummary,\n} from \"@/utils/formatRenderHistory\";\n\nimport type { WaitOptions, MatcherResult } from \"@/matchers/types\";\n\n/**\n * Assert that component eventually renders exact number of times (async)\n *\n * Uses event-based approach with onRender() for instant notification.\n * No polling overhead - resolves immediately when condition is met.\n *\n * @param received - The component to check (must be created with withProfiler)\n * @param expected - Expected number of renders\n * @param options - Wait options (timeout only, no interval)\n * @returns Promise with matcher result\n *\n * @since v1.6.0 - Rewritten to use event-based approach (no polling)\n *\n * @example\n * await expect(ProfiledComponent).toEventuallyRenderTimes(3)\n * await expect(ProfiledComponent).toEventuallyRenderTimes(5, { timeout: 2000 })\n */\nexport async function toEventuallyRenderTimes(\n  received: unknown,\n  expected: number,\n  options?: WaitOptions,\n): Promise<MatcherResult> {\n  if (!isProfiledComponent(received)) {\n    return {\n      pass: false,\n      message: () =>\n        `Expected a profiled component created with withProfiler(), received ${typeof received}`,\n    };\n  }\n\n  if (!Number.isInteger(expected) || expected < 0) {\n    return {\n      pass: false,\n      message: () =>\n        `Expected render count must be a non-negative integer, received ${expected}`,\n    };\n  }\n\n  const { timeout = 1000 } = options ?? {};\n\n  if (!Number.isFinite(timeout) || timeout <= 0) {\n    return {\n      pass: false,\n      message: () =>\n        `Expected timeout to be a positive number, received ${timeout}`,\n    };\n  }\n\n  return new Promise((resolve) => {\n    // Race condition protection: check if already satisfied\n    if (received.getRenderCount() === expected) {\n      resolve({\n        pass: true,\n        message: () =>\n          `Expected component not to eventually render ${expected} times within ${timeout}ms, but it did`,\n        actual: expected,\n        expected,\n      });\n\n      return;\n    }\n\n    // Setup timeout\n    const timeoutId = setTimeout(() => {\n      unsubscribe();\n\n      const actual = received.getRenderCount();\n      const history = received.getRenderHistory();\n      const summary = formatRenderSummary(history);\n      const details = formatRenderHistory(history, 10);\n\n      resolve({\n        pass: false,\n        message: () =>\n          `Expected component to eventually render ${expected} times within ${timeout}ms, but got ${actual} (${summary})\\n\\n${details}`,\n        actual,\n        expected,\n      });\n    }, timeout);\n\n    // Subscribe to render events\n    const unsubscribe = received.onRender(({ count }) => {\n      if (count === expected) {\n        cleanupAndResolve(timeoutId, unsubscribe, resolve, {\n          pass: true,\n          message: () =>\n            `Expected component not to eventually render ${expected} times within ${timeout}ms, but it did`,\n          actual: count,\n          expected,\n        });\n      }\n    });\n  });\n}\n\n/**\n * Assert that component eventually renders at least N times (async)\n *\n * Uses event-based approach with onRender() for instant notification.\n * No polling overhead - resolves immediately when condition is met.\n *\n * @param received - The component to check (must be created with withProfiler)\n * @param minCount - Minimum expected number of renders\n * @param options - Wait options (timeout only, no interval)\n * @returns Promise with matcher result\n *\n * @since v1.6.0 - Rewritten to use event-based approach (no polling)\n *\n * @example\n * await expect(ProfiledComponent).toEventuallyRenderAtLeast(2)\n * await expect(ProfiledComponent).toEventuallyRenderAtLeast(3, { timeout: 2000 })\n */\nexport async function toEventuallyRenderAtLeast(\n  received: unknown,\n  minCount: number,\n  options?: WaitOptions,\n): Promise<MatcherResult> {\n  if (!isProfiledComponent(received)) {\n    return {\n      pass: false,\n      message: () =>\n        `Expected a profiled component created with withProfiler(), received ${typeof received}`,\n    };\n  }\n\n  if (!Number.isInteger(minCount) || minCount < 0) {\n    return {\n      pass: false,\n      message: () =>\n        `Minimum render count must be a non-negative integer, received ${minCount}`,\n    };\n  }\n\n  const { timeout = 1000 } = options ?? {};\n\n  if (!Number.isFinite(timeout) || timeout <= 0) {\n    return {\n      pass: false,\n      message: () =>\n        `Expected timeout to be a positive number, received ${timeout}`,\n    };\n  }\n\n  return new Promise((resolve) => {\n    // Race condition protection: check if already satisfied\n    if (received.getRenderCount() >= minCount) {\n      const actual = received.getRenderCount();\n\n      resolve({\n        pass: true,\n        message: () =>\n          `Expected component not to eventually render at least ${minCount} times within ${timeout}ms, but it rendered ${actual} times`,\n        actual,\n        expected: minCount,\n      });\n\n      return;\n    }\n\n    // Setup timeout\n    const timeoutId = setTimeout(() => {\n      unsubscribe();\n\n      const actual = received.getRenderCount();\n      const history = received.getRenderHistory();\n      const summary = formatRenderSummary(history);\n      const details = formatRenderHistory(history, 10);\n\n      resolve({\n        pass: false,\n        message: () =>\n          `Expected component to eventually render at least ${minCount} times within ${timeout}ms, but got ${actual} (${summary})\\n\\n${details}`,\n        actual,\n        expected: minCount,\n      });\n    }, timeout);\n\n    // Subscribe to render events\n    const unsubscribe = received.onRender(({ count }) => {\n      if (count >= minCount) {\n        cleanupAndResolve(timeoutId, unsubscribe, resolve, {\n          pass: true,\n          message: () =>\n            `Expected component not to eventually render at least ${minCount} times within ${timeout}ms, but it rendered ${count} times`,\n          actual: count,\n          expected: minCount,\n        });\n      }\n    });\n  });\n}\n","import { isProfiledComponent } from \"@/matchers/type-guards\";\nimport { formatRenderHistory } from \"@/utils/formatRenderHistory\";\n\nimport type { MatcherResult } from \"@/matchers/types\";\n\n/**\n * Assert that component mounted exactly once\n *\n * @param received - The component to check\n * @returns Matcher result\n * @example\n * expect(ProfiledComponent).toHaveMountedOnce()\n */\nexport function toHaveMountedOnce(received: unknown): MatcherResult {\n  if (!isProfiledComponent(received)) {\n    return {\n      pass: false,\n      message: () =>\n        `Expected a profiled component created with withProfiler(), received ${typeof received}`,\n    };\n  }\n\n  const mounts = received.getRendersByPhase(\"mount\");\n  const mountCount = mounts.length;\n  const pass = mountCount === 1;\n\n  return {\n    pass,\n    message: () => {\n      if (mountCount === 0) {\n        return `Expected component to mount once, but it never mounted`;\n      }\n      if (pass) {\n        return `Expected component not to mount, but it mounted once`;\n      }\n\n      // Show all mount renders\n      const mountDetails = formatRenderHistory(mounts, 10);\n\n      return `Expected component to mount once, but it mounted ${mountCount} times\\n\\nMount renders:\\n${mountDetails}`;\n    },\n    actual: mountCount,\n    expected: 1,\n  };\n}\n\n/**\n * Assert that component never mounted\n *\n * @param received - The component to check\n * @returns Matcher result\n * @example\n * expect(ProfiledComponent).toHaveNeverMounted()\n */\nexport function toHaveNeverMounted(received: unknown): MatcherResult {\n  if (!isProfiledComponent(received)) {\n    return {\n      pass: false,\n      message: () =>\n        `Expected a profiled component created with withProfiler(), received ${typeof received}`,\n    };\n  }\n\n  const hasMounted = received.hasMounted();\n\n  return {\n    pass: !hasMounted,\n    message: () =>\n      hasMounted\n        ? `Expected component never to mount, but it mounted`\n        : `Expected component to mount, but it never did`,\n  };\n}\n\n/**\n * Assert that component only mounted (never updated in current test)\n *\n * @param received - The component to check\n * @returns Matcher result\n * @example\n * expect(ProfiledComponent).toHaveOnlyMounted()\n */\nexport function toHaveOnlyMounted(received: unknown): MatcherResult {\n  if (!isProfiledComponent(received)) {\n    return {\n      pass: false,\n      message: () =>\n        `Expected a profiled component created with withProfiler(), received ${typeof received}`,\n    };\n  }\n\n  const history = received.getRenderHistory();\n  const hasMounts = history.includes(\"mount\");\n  const hasUpdates = history.includes(\"update\");\n  const pass = hasMounts && !hasUpdates;\n\n  return {\n    pass,\n    message: () => {\n      if (history.length === 0) {\n        return `Expected component to have only mounts, but it never rendered`;\n      }\n      if (hasMounts && hasUpdates) {\n        return `Expected component to have only mounts, but it also updated`;\n      }\n      // At this point, if hasUpdates is true, hasMounts must be false\n      // (otherwise the previous condition would have returned)\n      if (hasUpdates) {\n        return `Expected component to have only mounts, but it only updated`;\n      }\n\n      return `Expected component not to have only mounts, but it did`;\n    },\n  };\n}\n\n/**\n * Assert that component only updated (never mounted in current test)\n *\n * @param received - The component to check\n * @returns Matcher result\n * @example\n * expect(ProfiledComponent).toHaveOnlyUpdated()\n */\nexport function toHaveOnlyUpdated(received: unknown): MatcherResult {\n  if (!isProfiledComponent(received)) {\n    return {\n      pass: false,\n      message: () =>\n        `Expected a profiled component created with withProfiler(), received ${typeof received}`,\n    };\n  }\n\n  const history = received.getRenderHistory();\n  const hasMounts = history.includes(\"mount\");\n  const hasUpdates = history.includes(\"update\");\n  const pass = !hasMounts && hasUpdates;\n\n  return {\n    pass,\n    message: () => {\n      if (history.length === 0) {\n        return `Expected component to have only updates, but it never rendered`;\n      }\n      if (hasMounts && hasUpdates) {\n        return `Expected component to have only updates, but it also mounted`;\n      }\n      if (hasMounts && !hasUpdates) {\n        return `Expected component to have only updates, but it only mounted`;\n      }\n\n      return `Expected component not to have only updates, but it did`;\n    },\n  };\n}\n","import { isProfiledComponent } from \"@/matchers/type-guards\";\nimport {\n  formatRenderHistory,\n  formatRenderSummary,\n} from \"@/utils/formatRenderHistory\";\n\nimport type { MatcherResult } from \"@/matchers/types\";\n\n/**\n * Assert that component has rendered at least once\n *\n * @param received - The component to check\n * @returns Matcher result\n * @example\n * expect(ProfiledComponent).toHaveRendered()\n */\nexport function toHaveRendered(received: unknown): MatcherResult {\n  if (!isProfiledComponent(received)) {\n    return {\n      pass: false,\n      message: () =>\n        `Expected a profiled component created with withProfiler(), received ${typeof received}`,\n    };\n  }\n\n  const renders = received.getRenderCount();\n\n  return {\n    pass: renders > 0,\n    message: () =>\n      renders > 0\n        ? `Expected component not to render, but it rendered ${renders} time(s)`\n        : `Expected component to render at least once, but it never rendered`,\n  };\n}\n\n/**\n * Assert exact number of renders\n *\n * @param received - The component to check (must be created with withProfiler)\n * @param expected - Expected number of renders\n * @returns Matcher result\n * @example\n * expect(ProfiledComponent).toHaveRenderedTimes(3)\n */\nexport function toHaveRenderedTimes(\n  received: unknown,\n  expected: number,\n): MatcherResult {\n  if (!isProfiledComponent(received)) {\n    return {\n      pass: false,\n      message: () =>\n        `Expected a profiled component created with withProfiler(), received ${typeof received}`,\n    };\n  }\n\n  if (!Number.isInteger(expected) || expected < 0) {\n    return {\n      pass: false,\n      message: () =>\n        `Expected render count must be a non-negative integer, received ${expected}`,\n    };\n  }\n\n  const actual = received.getRenderCount();\n  const pass = actual === expected;\n\n  return {\n    message: () => {\n      if (pass) {\n        return `Expected component not to render ${expected} time(s), but it did`;\n      }\n\n      // Show detailed render history on failure\n      const history = received.getRenderHistory();\n      const summary = formatRenderSummary(history);\n      const details = formatRenderHistory(history, 10);\n\n      return `Expected ${expected} renders, but got ${actual} (${summary})\\n\\n${details}`;\n    },\n    pass,\n    actual,\n    expected,\n  };\n}\n","import { isProfiledComponent } from \"@/matchers/type-guards\";\nimport {\n  formatRenderHistory,\n  formatRenderSummary,\n} from \"@/utils/formatRenderHistory\";\n\nimport type { MatcherResult } from \"@/matchers/types\";\nimport type { PhaseType, RenderCountBudget } from \"@/types\";\n\n/**\n * Result of checking a single budget constraint\n */\ninterface ConstraintCheckResult {\n  check: string;\n  violation?: string;\n}\n\n/**\n * Check single budget constraint\n */\nfunction checkConstraint(\n  actual: number,\n  max: number | undefined,\n  label: string,\n  violationMsg: string,\n): ConstraintCheckResult | undefined {\n  if (max === undefined) {\n    return undefined;\n  }\n\n  const pass = actual <= max;\n  const status = pass ? \"✅\" : \"❌\";\n\n  return {\n    check: `  ${label}: ${actual} (budget: ${max}) ${status}`,\n    ...(pass ? {} : { violation: `${violationMsg}: ${actual} > ${max}` }),\n  };\n}\n\n/**\n * Validate budget has at least one constraint and all values are valid\n */\nfunction validateBudget(budget: RenderCountBudget): MatcherResult | undefined {\n  const { maxRenders, maxMounts, maxUpdates } = budget;\n\n  // Check at least one constraint is defined\n  if (\n    maxRenders === undefined &&\n    maxMounts === undefined &&\n    maxUpdates === undefined\n  ) {\n    return {\n      pass: false,\n      message: () =>\n        \"Budget must specify at least one constraint (maxRenders, maxMounts, or maxUpdates)\",\n    };\n  }\n\n  // Validate each constraint value\n  const constraints: [string, unknown][] = [\n    [\"maxRenders\", maxRenders],\n    [\"maxMounts\", maxMounts],\n    [\"maxUpdates\", maxUpdates],\n  ];\n\n  for (const [name, value] of constraints) {\n    if (value === undefined) {\n      continue;\n    }\n\n    if (typeof value === \"object\") {\n      return {\n        pass: false,\n        message: () => `Budget.${name} must not be object or null`,\n      };\n    }\n\n    if (!Number.isInteger(value) || (typeof value === \"number\" && value < 0)) {\n      // After checking typeof === \"object\" above, value is primitive but TypeScript can't narrow unknown\n      // eslint-disable-next-line @typescript-eslint/no-base-to-string\n      const stringValue = String(value);\n\n      return {\n        pass: false,\n        message: () =>\n          `Budget.${name} must be a non-negative integer, received ${stringValue}`,\n      };\n    }\n  }\n\n  return undefined;\n}\n\n/**\n * Format matcher failure message\n */\nfunction formatFailureMessage(\n  componentName: string,\n  checks: string[],\n  violations: string[],\n  history: readonly PhaseType[],\n): string {\n  const summary = formatRenderSummary(history);\n  const details = formatRenderHistory(history, 10);\n\n  return (\n    `Expected ${componentName} to meet render count budget:\\n` +\n    `${checks.join(\"\\n\")}\\n\\n` +\n    `Violations:\\n  ${violations.join(\"\\n  \")}\\n\\n` +\n    `Actual: ${summary}\\n\\n${details}`\n  );\n}\n\n/**\n * Format matcher success message (for .not modifier)\n */\nfunction formatSuccessMessage(componentName: string, checks: string[]): string {\n  return `Expected ${componentName} NOT to meet render count budget, but it did:\\n${checks.join(\"\\n\")}`;\n}\n\n/**\n * Assert that component renders within budget constraints\n *\n * @param received - The component to check (must be created with withProfiler)\n * @param budget - Budget constraints\n * @returns Matcher result\n * @example\n * expect(ProfiledComponent).toMeetRenderCountBudget({ maxRenders: 3 })\n */\nexport function toMeetRenderCountBudget(\n  received: unknown,\n  budget: RenderCountBudget,\n): MatcherResult {\n  // 1. Validate received is ProfiledComponent\n  if (!isProfiledComponent(received)) {\n    return {\n      pass: false,\n      message: () =>\n        `Expected a profiled component created with withProfiler(), received ${typeof received}`,\n    };\n  }\n\n  // 2. Validate budget\n  const validationError = validateBudget(budget);\n\n  if (validationError) {\n    return validationError;\n  }\n\n  // 3. Extract render data\n  const {\n    maxRenders,\n    maxMounts,\n    maxUpdates,\n    componentName = \"Component\",\n  } = budget;\n  const history = received.getRenderHistory();\n  const actualTotal = history.length;\n  const actualMounts = history.filter((p) => p === \"mount\").length;\n  const actualUpdates = history.filter(\n    (p) => p === \"update\" || p === \"nested-update\",\n  ).length;\n\n  // 4. Check constraints\n  const results = [\n    checkConstraint(\n      actualTotal,\n      maxRenders,\n      \"Total renders\",\n      \"Total renders exceeded\",\n    ),\n    checkConstraint(actualMounts, maxMounts, \"Mounts\", \"Mount count exceeded\"),\n    checkConstraint(\n      actualUpdates,\n      maxUpdates,\n      \"Updates\",\n      \"Update count exceeded\",\n    ),\n  ].filter((r): r is ConstraintCheckResult => r !== undefined);\n\n  const checks = results.map((r) => r.check);\n  const violations = results\n    .map((r) => r.violation)\n    .filter((v): v is string => v !== undefined);\n  const pass = violations.length === 0;\n\n  // 5. Return result\n  return {\n    pass,\n    message: () =>\n      pass\n        ? formatSuccessMessage(componentName, checks)\n        : formatFailureMessage(componentName, checks, violations, history),\n    actual: {\n      total: actualTotal,\n      mounts: actualMounts,\n      updates: actualUpdates,\n    },\n    expected: budget,\n  };\n}\n","import { isProfiledComponent } from \"@/matchers/type-guards\";\nimport { formatRenderHistory } from \"@/utils/formatRenderHistory\";\n\nimport type { MatcherResult } from \"@/matchers/types\";\nimport type { PhaseType, RenderLoopOptions } from \"@/types\";\n\n/**\n * Result of loop detection\n */\ninterface LoopResult {\n  hasLoop: boolean;\n  loopPhase?: PhaseType;\n  consecutiveCount?: number;\n  startIndex?: number;\n  endIndex?: number;\n}\n\n/**\n * Statistics about max consecutive runs\n */\ninterface RunStats {\n  maxUpdateRun: number;\n  maxNestedRun: number;\n}\n\n/**\n * Normalized options with defaults applied\n */\ninterface NormalizedOptions {\n  maxConsecutiveUpdates: number;\n  maxConsecutiveNested: number;\n  ignoreInitialUpdates: number;\n  showFullHistory: boolean;\n  componentName: string;\n}\n\n/**\n * Validate and normalize options with defaults\n */\nfunction normalizeOptions(\n  options: RenderLoopOptions = {},\n): NormalizedOptions | MatcherResult {\n  const {\n    maxConsecutiveUpdates = 10,\n    maxConsecutiveNested,\n    ignoreInitialUpdates = 0,\n    showFullHistory = false,\n    componentName = \"Component\",\n  } = options;\n\n  if (!Number.isInteger(maxConsecutiveUpdates) || maxConsecutiveUpdates < 1) {\n    return {\n      pass: false,\n      message: () =>\n        `maxConsecutiveUpdates must be a positive integer, received ${maxConsecutiveUpdates}`,\n    };\n  }\n\n  const effectiveMaxNested = maxConsecutiveNested ?? maxConsecutiveUpdates;\n\n  if (!Number.isInteger(effectiveMaxNested) || effectiveMaxNested < 1) {\n    return {\n      pass: false,\n      message: () =>\n        `maxConsecutiveNested must be a positive integer, received ${maxConsecutiveNested}`,\n    };\n  }\n\n  if (!Number.isInteger(ignoreInitialUpdates) || ignoreInitialUpdates < 0) {\n    return {\n      pass: false,\n      message: () =>\n        `ignoreInitialUpdates must be a non-negative integer, received ${ignoreInitialUpdates}`,\n    };\n  }\n\n  return {\n    maxConsecutiveUpdates,\n    maxConsecutiveNested: effectiveMaxNested,\n    ignoreInitialUpdates,\n    showFullHistory,\n    componentName,\n  };\n}\n\n/**\n * Detect render loops in history using single-pass O(n) algorithm\n * Returns early on first loop detection for efficiency.\n */\nfunction detectLoop(\n  history: readonly PhaseType[],\n  options: NormalizedOptions,\n): LoopResult {\n  const { maxConsecutiveUpdates, maxConsecutiveNested, ignoreInitialUpdates } =\n    options;\n\n  let currentPhase: PhaseType | undefined = undefined;\n  let consecutiveCount = 0;\n  let startIndex = 0;\n  let updatesSeen = 0;\n\n  for (const [i, phase] of history.entries()) {\n    if (\n      (phase === \"update\" || phase === \"nested-update\") &&\n      updatesSeen < ignoreInitialUpdates\n    ) {\n      updatesSeen++;\n      currentPhase = undefined;\n      consecutiveCount = 0;\n\n      continue;\n    }\n\n    if (phase === \"mount\") {\n      currentPhase = phase;\n      consecutiveCount = 1;\n      startIndex = i;\n\n      continue;\n    }\n\n    if (phase === currentPhase) {\n      consecutiveCount++;\n      const threshold =\n        phase === \"update\" ? maxConsecutiveUpdates : maxConsecutiveNested;\n\n      if (consecutiveCount > threshold) {\n        return {\n          hasLoop: true,\n          loopPhase: phase,\n          consecutiveCount,\n          startIndex,\n          endIndex: i,\n        };\n      }\n    } else {\n      currentPhase = phase;\n      consecutiveCount = 1;\n      startIndex = i;\n    }\n  }\n\n  return { hasLoop: false };\n}\n\n/**\n * Record max run for the given phase type\n */\nfunction recordMaxRun(\n  phase: PhaseType | undefined,\n  run: number,\n  stats: RunStats,\n): void {\n  // Stryker disable EqualityOperator: Equivalent mutant - `>` to `>=` is identical (max = run when run == max doesn't change value)\n  if (phase === \"update\" && run > stats.maxUpdateRun) {\n    stats.maxUpdateRun = run;\n  } else if (phase === \"nested-update\" && run > stats.maxNestedRun) {\n    stats.maxNestedRun = run;\n  }\n  // Stryker restore EqualityOperator\n}\n\n/**\n * Compute max consecutive runs for each phase type.\n * Only called when no loop is detected (for success message).\n */\nfunction computeRunStats(history: readonly PhaseType[]): RunStats {\n  const stats: RunStats = { maxUpdateRun: 0, maxNestedRun: 0 };\n  let currentPhase: PhaseType | undefined = undefined;\n  let currentRun = 0;\n\n  for (const phase of history) {\n    if (phase === \"mount\") {\n      currentPhase = phase;\n      currentRun = 1;\n\n      continue;\n    }\n\n    if (phase === currentPhase) {\n      currentRun++;\n    } else {\n      recordMaxRun(currentPhase, currentRun, stats);\n      currentPhase = phase;\n      currentRun = 1;\n    }\n  }\n\n  recordMaxRun(currentPhase, currentRun, stats);\n\n  return stats;\n}\n\n/**\n * Format loop sequence with indices for error message\n */\nfunction formatLoopSequence(\n  history: readonly PhaseType[],\n  startIndex: number,\n  endIndex: number,\n  maxItems = 10,\n): string {\n  const loopSlice = history.slice(startIndex, endIndex + 1);\n  const totalItems = loopSlice.length;\n  const itemsToShow = loopSlice.slice(0, maxItems);\n\n  const lines = itemsToShow.map((phase, idx) => {\n    const globalIndex = startIndex + idx + 1;\n\n    return `  #${globalIndex}  [${phase.padEnd(12)} phase]`;\n  });\n\n  if (totalItems > maxItems) {\n    lines.push(`  ... and ${totalItems - maxItems} more`);\n  }\n\n  return lines.join(\"\\n\");\n}\n\n/**\n * Format failure message with diagnostics\n */\nfunction formatFailureMessage(\n  componentName: string,\n  result: LoopResult,\n  history: readonly PhaseType[],\n  options: NormalizedOptions,\n): string {\n  const { loopPhase, consecutiveCount, startIndex = 0, endIndex = 0 } = result;\n  const { maxConsecutiveUpdates, maxConsecutiveNested, showFullHistory } =\n    options;\n\n  const threshold =\n    loopPhase === \"update\" ? maxConsecutiveUpdates : maxConsecutiveNested;\n\n  let message = `Expected ${componentName} not to have render loops, but found:\\n`;\n\n  message += `  Suspicious pattern: ${consecutiveCount} consecutive '${loopPhase}' phases (threshold: ${threshold})\\n\\n`;\n\n  const loopSequence = formatLoopSequence(history, startIndex, endIndex);\n\n  message += `Loop sequence (renders #${startIndex + 1}-#${endIndex + 1}):\\n${loopSequence}\\n\\n`;\n  message += `Potential causes:\\n`;\n  message += `  - useEffect with missing/incorrect dependencies\\n`;\n  message += `  - setState called during render\\n`;\n  message += `  - Circular state updates between components\\n\\n`;\n\n  if (showFullHistory) {\n    message += `Full render history:\\n${formatRenderHistory(history, history.length)}\\n\\n`;\n  }\n\n  message += `💡 Tip: Use ${componentName}.getRenderHistory() to inspect full history`;\n\n  return message;\n}\n\n/**\n * Format success message (for .not modifier)\n */\nfunction formatSuccessMessage(\n  componentName: string,\n  stats: RunStats,\n  options: NormalizedOptions,\n): string {\n  const { maxConsecutiveUpdates, maxConsecutiveNested } = options;\n  const { maxUpdateRun, maxNestedRun } = stats;\n\n  return (\n    `Expected ${componentName} to have render loops, but none were detected:\\n` +\n    `  All consecutive 'update' runs: <= ${maxUpdateRun} (threshold: ${maxConsecutiveUpdates})\\n` +\n    `  All consecutive 'nested-update' runs: <= ${maxNestedRun} (threshold: ${maxConsecutiveNested})`\n  );\n}\n\n/**\n * Assert that component does not have suspicious render loop patterns\n *\n * Detects consecutive same-phase renders that may indicate infinite loops.\n * Catches render loops BEFORE hitting MAX_SAFE_RENDERS (10,000).\n *\n * @param received - The component to check (must be created with withProfiler)\n * @param options - Loop detection options\n * @returns Matcher result\n * @example\n * // Default threshold (10 consecutive updates)\n * expect(ProfiledComponent).notToHaveRenderLoops()\n *\n * @example\n * // Custom threshold\n * expect(ProfiledComponent).notToHaveRenderLoops({ maxConsecutiveUpdates: 5 })\n *\n * @example\n * // Ignore initialization updates\n * expect(ProfiledComponent).notToHaveRenderLoops({\n *   ignoreInitialUpdates: 2,\n *   componentName: 'Header'\n * })\n * @since v1.8.0\n */\nexport function notToHaveRenderLoops(\n  received: unknown,\n  options: RenderLoopOptions = {},\n): MatcherResult {\n  if (!isProfiledComponent(received)) {\n    return {\n      pass: false,\n      message: () =>\n        `Expected a profiled component created with withProfiler(), received ${typeof received}`,\n    };\n  }\n\n  const normalized = normalizeOptions(options);\n\n  if (\"pass\" in normalized) {\n    return normalized;\n  }\n\n  const history = received.getRenderHistory();\n  const loopResult = detectLoop(history, normalized);\n  const pass = !loopResult.hasLoop;\n\n  return {\n    pass,\n    message: () => {\n      if (pass) {\n        const stats = computeRunStats(history);\n\n        return formatSuccessMessage(\n          normalized.componentName,\n          stats,\n          normalized,\n        );\n      }\n\n      return formatFailureMessage(\n        normalized.componentName,\n        loopResult,\n        history,\n        normalized,\n      );\n    },\n  };\n}\n","import { expect } from \"vitest\";\n\nimport { toEventuallyReachPhase } from \"@/matchers/async/phase\";\n\nimport {\n  toEventuallyRenderAtLeast,\n  toEventuallyRenderTimes,\n} from \"./async/render-count\";\nimport {\n  toHaveMountedOnce,\n  toHaveNeverMounted,\n  toHaveOnlyMounted,\n  toHaveOnlyUpdated,\n} from \"./sync/phase\";\nimport { toHaveRendered, toHaveRenderedTimes } from \"./sync/render-count\";\nimport { toMeetRenderCountBudget } from \"./sync/render-count-budget\";\nimport { notToHaveRenderLoops } from \"./sync/render-loops\";\n\n/**\n * Register all custom Vitest matchers for profiled components\n *\n * This combines:\n * - Render count (toHaveRendered, toHaveRenderedTimes, toMeetRenderCountBudget)\n * - Phase (toHaveMountedOnce, toHaveNeverMounted, toHaveOnlyMounted, toHaveOnlyUpdated)\n * - Render loops (notToHaveRenderLoops)\n * - Async render count (toEventuallyRenderTimes, toEventuallyRenderAtLeast)\n * - Async phase (toEventuallyReachPhase)\n */\nexpect.extend({\n  // Synchronous render count matchers\n  toHaveRendered,\n  toHaveRenderedTimes,\n  toMeetRenderCountBudget,\n  // Synchronous phase matchers\n  toHaveMountedOnce,\n  toHaveNeverMounted,\n  toHaveOnlyMounted,\n  toHaveOnlyUpdated,\n  // Render loop detection\n  notToHaveRenderLoops,\n  // Asynchronous render count matchers\n  toEventuallyRenderTimes,\n  toEventuallyRenderAtLeast,\n  // Asynchronous phase matchers\n  toEventuallyReachPhase,\n});\n","/**\n * Internal registry of all profiled components\n * Automatically cleared between tests via auto-setup\n *\n * Uses WeakSet for automatic garbage collection of components\n * that are no longer referenced elsewhere.\n */\nclass ComponentRegistry {\n  /**\n   * WeakSet allows automatic garbage collection when components\n   * are no longer referenced elsewhere in the application\n   */\n  private readonly components = new WeakSet<{ clear: () => void }>();\n\n  /**\n   * Strong references to active components that need cleanup.\n   * Components are removed from this Set after clearAll() to allow GC.\n   */\n  private readonly activeComponents = new Set<{ clear: () => void }>();\n\n  /**\n   * Register a component for automatic cleanup\n   *\n   * @internal\n   */\n  register(component: { clear: () => void }): void {\n    this.components.add(component);\n    this.activeComponents.add(component);\n  }\n\n  /**\n   * Unregister a component (allows garbage collection)\n   * Call this for components that won't be reused in future tests\n   *\n   * @internal\n   */\n  unregister(component: { clear: () => void }): void {\n    this.activeComponents.delete(component);\n    // WeakSet will allow GC when no other references exist\n  }\n\n  /**\n   * Clear all registered components\n   * Called automatically by afterEach hook\n   *\n   * Clears render data from components but keeps them registered\n   * for reuse in subsequent tests (e.g., components created in describe() blocks).\n   *\n   * Components that are no longer referenced in test code will be\n   * automatically garbage collected via WeakSet.\n   *\n   * @internal\n   */\n  clearAll(): void {\n    // Clear data from all active components\n    for (const c of this.activeComponents) {\n      c.clear();\n    }\n    // Note: We don't clear activeComponents Set itself to allow\n    // components created in describe() blocks to persist and be reused\n  }\n\n  /**\n   * Completely reset registry - clear all references\n   *\n   * This method should be called in afterAll() hooks for stress tests\n   * that create many components to prevent memory accumulation.\n   *\n   * Difference from clearAll():\n   * - clearAll(): Clears render data, keeps components registered\n   * - reset(): Clears render data AND removes all component references\n   *\n   * @internal\n   */\n  reset(): void {\n    // First clear all component data\n    for (const c of this.activeComponents) {\n      c.clear();\n    }\n\n    // Then remove all strong references to allow GC\n    this.activeComponents.clear();\n  }\n\n  /**\n   * Get count of active registered components\n   * For debugging purposes only\n   *\n   * @internal\n   */\n  /* v8 ignore next 3 -- @preserve */\n  getRegisteredCount(): number {\n    return this.activeComponents.size;\n  }\n}\n\n/**\n * Global singleton registry\n *\n * @internal\n */\nexport const registry = new ComponentRegistry();\n\n/**\n * Clear render data from all profiled components but keep them registered\n *\n * Use this in afterEach() hooks or between benchmark iterations to reset\n * render history while keeping components registered for reuse.\n *\n * @example\n * ```typescript\n * import { afterEach } from \"vitest\";\n * import { clearProfilerData } from \"vitest-react-profiler\";\n *\n * afterEach(() => {\n *   clearProfilerData();\n * });\n * ```\n *\n * @public\n * @since v1.7.0\n */\nexport const clearProfilerData = (): void => {\n  registry.clearAll();\n};\n\n/**\n * Clear all component references from registry\n *\n * Use this in afterAll() hooks for stress tests that create many components\n * to prevent memory accumulation within a single test file.\n *\n * @example\n * ```typescript\n * import { afterAll } from \"vitest\";\n * import { clearRegistry } from \"vitest-react-profiler\";\n *\n * afterAll(() => {\n *   clearRegistry();\n * });\n * ```\n *\n * @public\n */\nexport const clearRegistry = (): void => {\n  registry.reset();\n};\n","import { afterAll, afterEach } from \"vitest\";\n\nimport { registry } from \"./registry\";\n\n// Stryker disable  all\n/**\n * Automatically registers cleanup hooks when imported\n * This ensures test isolation without manual intervention\n *\n * afterEach: Clears render data (keeps components for reuse in describe() blocks)\n * afterAll: Completely resets registry (prevents memory accumulation in stress tests)\n *\n * No need for manual clearCounters() calls or cleanup hooks\n */\ntry {\n  /* v8 ignore next 5 -- @preserve */\n  if (typeof afterEach === \"function\") {\n    afterEach(() => {\n      registry.clearAll();\n    });\n  }\n  /* v8 ignore next 3 -- @preserve */\n} catch {\n  // Silently ignore if not in test context\n}\n\ntry {\n  /* v8 ignore next 5 -- @preserve */\n  if (typeof afterAll === \"function\") {\n    afterAll(() => {\n      registry.reset();\n    });\n  }\n  /* v8 ignore next 3 -- @preserve */\n} catch {\n  // Silently ignore if not in test context\n}\n","import type { ProfilerStorage } from \"@/profiler/core/ProfilerStorage\";\nimport type { AnyComponentType } from \"@/types\";\nimport type { ProfilerOnRenderCallback } from \"react\";\n\n/**\n * Create onRender callback for component\n *\n * Captures render phase from React Profiler and stores it directly\n */\nexport function createOnRenderCallback(\n  component: AnyComponentType,\n  storage: ProfilerStorage,\n): ProfilerOnRenderCallback {\n  return (_id, phase) => {\n    const data = storage.getOrCreate(component);\n\n    data.addRender(phase);\n  };\n}\n","import { Profiler, useRef } from \"react\";\n\nimport type {\n  ReactElement,\n  ComponentType,\n  ProfilerOnRenderCallback,\n} from \"react\";\n\ninterface ProfiledComponentProps<P> {\n  Component: ComponentType<P>;\n  componentProps: P;\n  componentName: string;\n  onRender: ProfilerOnRenderCallback;\n}\n\n// Global counter for generating unique IDs across all instances\nlet globalInstanceCounter = 0;\n\n/**\n * React component with built-in Profiler\n *\n * Responsibilities:\n * - Wrapping component in <Profiler>\n * - Generating unique ID for each instance\n * - Passing onRender callback\n */\nexport function ProfiledComponentWrapper<P extends object>(\n  props: Readonly<ProfiledComponentProps<P>>,\n): ReactElement {\n  const { Component, componentProps, componentName, onRender } = props;\n\n  // Stable ID for this component instance\n  const idRef = useRef<string>(\"\");\n\n  // Generate ID on first render\n  if (!idRef.current) {\n    globalInstanceCounter += 1;\n    idRef.current = `${componentName}-${globalInstanceCounter}`;\n  }\n\n  return (\n    <Profiler id={idRef.current} onRender={onRender}>\n      <Component {...componentProps} />\n    </Profiler>\n  );\n}\n","/**\n * CacheMetrics - Centralized cache performance tracking\n *\n * @since v1.6.0\n *\n * Tracks cache hits/misses for:\n * - phaseCache: ProfilerCache.getPhaseCache()\n * - closureCache: ProfilerAPI closure-based methods\n *\n * Usage in tests:\n * ```typescript\n * import { cacheMetrics } from '@/profiler/core/CacheMetrics';\n *\n * afterAll(() => {\n *   console.log(cacheMetrics.report());\n * });\n * ```\n */\n\nexport type CacheType = \"phaseCache\" | \"closureCache\";\n\ninterface CacheStats {\n  hits: number;\n  misses: number;\n}\n\n/**\n * Singleton for tracking cache performance metrics\n */\nclass CacheMetrics {\n  private readonly metrics: Record<CacheType, CacheStats> = {\n    phaseCache: { hits: 0, misses: 0 },\n    closureCache: { hits: 0, misses: 0 },\n  };\n\n  /**\n   * Record a cache hit\n   *\n   * @internal This is only active when __DEV__ is enabled.\n   * In production builds, this code is tree-shaken out.\n   */\n  recordHit(cacheType: CacheType): void {\n    // Stryker disable next-line all\n    if (__DEV__) {\n      this.metrics[cacheType].hits++;\n    }\n  }\n\n  /**\n   * Record a cache miss (computation performed)\n   *\n   * @internal This is only active when __DEV__ is enabled.\n   * In production builds, this code is tree-shaken out.\n   */\n  recordMiss(cacheType: CacheType): void {\n    // Stryker disable next-line all\n    if (__DEV__) {\n      this.metrics[cacheType].misses++;\n    }\n  }\n\n  /**\n   * Get hit rate percentage for a cache type\n   *\n   * @returns Hit rate as percentage (0-100)\n   *\n   * @internal This is only active when __DEV__ is enabled.\n   * In production builds, this always returns 0.\n   */\n  getHitRate(cacheType: CacheType): number {\n    // Stryker disable next-line all\n    if (__DEV__) {\n      const { hits, misses } = this.metrics[cacheType];\n      const total = hits + misses;\n\n      return total === 0 ? 0 : (hits / total) * 100;\n    }\n\n    /* v8 ignore next -- @preserve */\n    return 0;\n  }\n\n  /**\n   * Get formatted report of all cache metrics\n   *\n   * @example\n   * ```\n   * phaseCache: 320/400 hits (80.00%)\n   * closureCache: 180/200 hits (90.00%)\n   * ```\n   *\n   * @internal This is only active when __DEV__ is enabled.\n   * In production builds, this returns an empty string.\n   */\n  report(): string {\n    /* v8 ignore next 2 -- @preserve */\n    // Stryker disable next-line all\n    if (__DEV__) {\n      return Object.entries(this.metrics)\n        .map(([type, { hits, misses }]) => {\n          const total = hits + misses;\n          const rate = total === 0 ? 0 : ((hits / total) * 100).toFixed(2);\n\n          return `${type}: ${hits}/${total} hits (${rate}%)`;\n        })\n        .join(\"\\n\");\n    }\n\n    /* v8 ignore next 2 -- @preserve */\n    // Stryker disable next-line all\n    return \"\";\n  }\n\n  /**\n   * Reset all metrics (useful between test runs)\n   *\n   * @internal This is only active when __DEV__ is enabled.\n   * In production builds, this is a no-op.\n   */\n  reset(): void {\n    // Stryker disable next-line all\n    if (__DEV__) {\n      for (const cache of Object.values(this.metrics)) {\n        cache.hits = 0;\n        cache.misses = 0;\n      }\n    }\n  }\n\n  /**\n   * Get raw metrics data (for testing or custom reporting)\n   *\n   * @internal This is only active when __DEV__ is enabled.\n   * In production builds, this returns empty metrics structure.\n   */\n  getMetrics(): Readonly<Record<CacheType, Readonly<CacheStats>>> {\n    // Stryker disable next-line all\n    if (__DEV__) {\n      return this.metrics;\n    }\n\n    /* v8 ignore next 5 -- @preserve */\n    // Return empty metrics for production\n    return {\n      phaseCache: { hits: 0, misses: 0 },\n      closureCache: { hits: 0, misses: 0 },\n    };\n  }\n}\n\n/**\n * Global singleton instance\n */\nexport const cacheMetrics = new CacheMetrics();\n","import { cleanupAndResolve } from \"@/helpers\";\n\nimport { cacheMetrics } from \"../core/CacheMetrics\";\n\nimport type { ProfilerStorage } from \"../core/ProfilerStorage\";\nimport type {\n  AnyComponentType,\n  PhaseType,\n  ProfiledComponent,\n  RenderEventInfo,\n  WaitOptions,\n} from \"@/types\";\nimport type { ComponentType } from \"react\";\n\n// Empty frozen array constant for default returns\nconst EMPTY_FROZEN_ARRAY: readonly PhaseType[] = Object.freeze([]);\n\n/**\n * Creates public API methods for ProfiledComponent\n *\n * Responsibilities:\n * - Creating methods getRenderCount, getRenderHistory, etc.\n * - Accessing data through ProfilerStorage\n * - Handling cases when data doesn't exist\n */\nexport class ProfilerAPI {\n  private readonly storage: ProfilerStorage;\n\n  constructor(storage: ProfilerStorage) {\n    this.storage = storage;\n  }\n\n  /**\n   * Create getRenderCount method for component\n   *\n   * @since v1.6.0 - Optimized: lazy closure caching eliminates WeakMap lookup\n   */\n  createGetRenderCount(component: AnyComponentType): () => number {\n    let cachedData: ReturnType<typeof this.storage.get> | undefined;\n\n    return () => {\n      if (cachedData === undefined) {\n        cacheMetrics.recordMiss(\"closureCache\");\n        cachedData = this.storage.get(component);\n      } else {\n        cacheMetrics.recordHit(\"closureCache\");\n      }\n\n      return cachedData?.getRenderCount() ?? 0;\n    };\n  }\n\n  /**\n   * Create getRenderHistory method for component\n   *\n   * @since v1.6.0 - Optimized: lazy closure caching eliminates WeakMap lookup\n   */\n  createGetRenderHistory(\n    component: AnyComponentType,\n  ): () => readonly PhaseType[] {\n    let cachedData: ReturnType<typeof this.storage.get> | undefined;\n\n    return () => {\n      if (cachedData === undefined) {\n        cacheMetrics.recordMiss(\"closureCache\");\n        cachedData = this.storage.get(component);\n      } else {\n        cacheMetrics.recordHit(\"closureCache\");\n      }\n\n      return cachedData?.getHistory() ?? EMPTY_FROZEN_ARRAY;\n    };\n  }\n\n  /**\n   * Create getLastRender method for component\n   *\n   * @since v1.6.0 - Optimized: lazy closure caching eliminates WeakMap lookup\n   */\n  createGetLastRender(\n    component: AnyComponentType,\n  ): () => PhaseType | undefined {\n    let cachedData: ReturnType<typeof this.storage.get> | undefined;\n\n    return () => {\n      if (cachedData === undefined) {\n        cacheMetrics.recordMiss(\"closureCache\");\n        cachedData = this.storage.get(component);\n      } else {\n        cacheMetrics.recordHit(\"closureCache\");\n      }\n\n      return cachedData?.getLastRender();\n    };\n  }\n\n  /**\n   * Create getRenderAt method for component\n   *\n   * @since v1.6.0 - Optimized: lazy closure caching eliminates WeakMap lookup\n   */\n  createGetRenderAt(\n    component: AnyComponentType,\n  ): (index: number) => PhaseType | undefined {\n    let cachedData: ReturnType<typeof this.storage.get> | undefined;\n\n    return (index: number) => {\n      if (cachedData === undefined) {\n        cacheMetrics.recordMiss(\"closureCache\");\n        cachedData = this.storage.get(component);\n      } else {\n        cacheMetrics.recordHit(\"closureCache\");\n      }\n\n      return cachedData?.getRenderAt(index);\n    };\n  }\n\n  /**\n   * Create getRendersByPhase method for component\n   *\n   * @since v1.6.0 - Optimized: lazy closure caching eliminates WeakMap lookup\n   */\n  createGetRendersByPhase(\n    component: AnyComponentType,\n  ): (phase: PhaseType) => readonly PhaseType[] {\n    let cachedData: ReturnType<typeof this.storage.get> | undefined;\n\n    return (phase: PhaseType) => {\n      if (cachedData === undefined) {\n        cacheMetrics.recordMiss(\"closureCache\");\n        cachedData = this.storage.get(component);\n      } else {\n        cacheMetrics.recordHit(\"closureCache\");\n      }\n\n      return cachedData?.getRendersByPhase(phase) ?? EMPTY_FROZEN_ARRAY;\n    };\n  }\n\n  /**\n   * Create hasMounted method for component\n   *\n   * @since v1.6.0 - Optimized: lazy closure caching eliminates WeakMap lookup\n   */\n  createHasMounted(component: AnyComponentType): () => boolean {\n    let cachedData: ReturnType<typeof this.storage.get> | undefined;\n\n    return () => {\n      if (cachedData === undefined) {\n        cacheMetrics.recordMiss(\"closureCache\");\n        cachedData = this.storage.get(component);\n      } else {\n        cacheMetrics.recordHit(\"closureCache\");\n      }\n\n      return cachedData?.hasMounted() ?? false;\n    };\n  }\n\n  /**\n   * Create onRender method for component\n   *\n   * Subscribes to render events and returns unsubscribe function.\n   * If component has no profiler data, returns no-op unsubscribe.\n   *\n   * @param component - Component to subscribe to\n   * @returns Function that accepts callback and returns unsubscribe function\n   *\n   * @since v1.6.0 - Optimized: lazy closure caching eliminates WeakMap lookup\n   *\n   * @example\n   * ```typescript\n   * const onRender = api.createOnRender(MyComponent);\n   * const unsubscribe = onRender((info) => {\n   *   console.log(`Rendered ${info.count} times`);\n   * });\n   * // Later...\n   * unsubscribe();\n   * ```\n   */\n  createOnRender(\n    component: AnyComponentType,\n  ): (callback: (info: RenderEventInfo) => void) => () => void {\n    let cachedData: ReturnType<typeof this.storage.get> | undefined;\n\n    return (callback) => {\n      if (cachedData === undefined) {\n        cacheMetrics.recordMiss(\"closureCache\");\n        cachedData = this.storage.get(component);\n      } else {\n        cacheMetrics.recordHit(\"closureCache\");\n      }\n\n      if (!cachedData) {\n        // Return no-op unsubscribe if no profiler data\n        return () => {};\n      }\n\n      const events = cachedData.getEvents();\n\n      return events.subscribe(callback);\n    };\n  }\n\n  /**\n   * Create waitForNextRender method for component\n   *\n   * Returns a promise that resolves when the next render occurs.\n   * Rejects if timeout is exceeded or component has no profiler data.\n   *\n   * @param component - Component to wait for\n   * @returns Function that accepts options and returns promise\n   *\n   * @since v1.6.0 - Optimized: lazy closure caching eliminates WeakMap lookup\n   *\n   * @example\n   * ```typescript\n   * const waitForNextRender = api.createWaitForNextRender(MyComponent);\n   * const info = await waitForNextRender({ timeout: 2000 });\n   * console.log(`Rendered: ${info.phase}`);\n   * ```\n   */\n  createWaitForNextRender(\n    component: AnyComponentType,\n  ): (options?: WaitOptions) => Promise<RenderEventInfo> {\n    let cachedData: ReturnType<typeof this.storage.get> | undefined;\n\n    return (options) => {\n      const { timeout = 1000 } = options ?? {};\n\n      return new Promise((resolve, reject) => {\n        if (cachedData === undefined) {\n          cacheMetrics.recordMiss(\"closureCache\");\n          cachedData = this.storage.get(component);\n        } else {\n          cacheMetrics.recordHit(\"closureCache\");\n        }\n\n        if (!cachedData) {\n          reject(\n            new Error(\n              `Component has no profiler data. ` +\n                `Did you forget to wrap it with withProfiler()? ` +\n                `Component: ${(component.displayName ?? component.name) || \"Unknown\"}`,\n            ),\n          );\n\n          return;\n        }\n\n        const events = cachedData.getEvents();\n\n        const timeoutId = setTimeout(() => {\n          unsubscribe();\n          reject(new Error(`Timeout: No render occurred within ${timeout}ms`));\n        }, timeout);\n\n        const unsubscribe = events.subscribe((info) => {\n          cleanupAndResolve(timeoutId, unsubscribe, resolve, info);\n        });\n      });\n    };\n  }\n\n  /**\n   * Create all API methods for component\n   */\n  createAllMethods<P>(\n    component: ComponentType<P>,\n  ): Pick<\n    ProfiledComponent<P>,\n    | \"getRenderCount\"\n    | \"getRenderHistory\"\n    | \"getLastRender\"\n    | \"getRenderAt\"\n    | \"getRendersByPhase\"\n    | \"hasMounted\"\n    | \"onRender\"\n    | \"waitForNextRender\"\n  > {\n    return {\n      getRenderCount: this.createGetRenderCount(component),\n      getRenderHistory: this.createGetRenderHistory(component),\n      getLastRender: this.createGetLastRender(component),\n      getRenderAt: this.createGetRenderAt(component),\n      getRendersByPhase: this.createGetRendersByPhase(component),\n      hasMounted: this.createHasMounted(component),\n      onRender: this.createOnRender(component),\n      waitForNextRender: this.createWaitForNextRender(component),\n    };\n  }\n}\n","/**\n * Safety limits for detecting bugs and preventing memory leaks\n *\n * @packageDocumentation\n * @module profiler/core/constants\n */\n\n/**\n * Maximum number of renders before throwing error (Circuit Breaker)\n *\n * Detects infinite render loops caused by:\n * - useEffect with missing/wrong dependencies\n * - setState called during render\n * - Circular state updates\n *\n * Real-world usage: Most components render < 100 times in tests\n * 10,000 = 100x safety margin\n *\n * @internal\n */\nexport const MAX_SAFE_RENDERS = 10_000;\n\n/**\n * Maximum number of event listeners before throwing error (Memory Leak Detection)\n *\n * Detects memory leaks caused by:\n * - Forgot to call unsubscribe() in useEffect cleanup\n * - Listeners added in render function instead of useEffect\n * - Component remounting repeatedly without cleanup\n *\n * Real-world usage: 1-5 listeners per component\n * 100 = 20x-100x safety margin\n *\n * @internal\n */\nexport const MAX_LISTENERS = 100;\n","import { cacheMetrics } from \"./CacheMetrics\";\n\nimport type { ProfilerCacheInterface } from \"./interfaces\";\nimport type { PhaseType } from \"@/types\";\n\n/**\n * Manages all types of caching for profiler data\n *\n * Supports phaseCache - filtered renders by phase (mount/update/nested-update)\n *\n * @since v1.6.0 - Added cache metrics tracking\n * @since v1.7.0 - Implements ProfilerCacheInterface for Dependency Injection\n */\nexport class ProfilerCache implements ProfilerCacheInterface {\n  private phaseCache?:\n    | {\n        mount?: readonly PhaseType[];\n        update?: readonly PhaseType[];\n        \"nested-update\"?: readonly PhaseType[];\n      }\n    | undefined;\n\n  /**\n   * Get or compute renders by phase\n   *\n   * @since v1.6.0 - Added cache metrics tracking\n   */\n  getPhaseCache(\n    phase: PhaseType,\n    compute: () => readonly PhaseType[],\n  ): readonly PhaseType[] {\n    // Initialize phaseCache as empty object if undefined\n    this.phaseCache ??= {};\n\n    if (this.phaseCache[phase] !== undefined) {\n      cacheMetrics.recordHit(\"phaseCache\");\n\n      return this.phaseCache[phase];\n    }\n\n    cacheMetrics.recordMiss(\"phaseCache\");\n\n    const filtered = compute();\n\n    this.phaseCache[phase] = Object.freeze(filtered);\n\n    return this.phaseCache[phase];\n  }\n\n  /**\n   * Smart cache invalidation (called on new render)\n   *\n   * Invalidates only affected caches based on the phase that was added.\n   * This avoids unnecessary cache misses for unaffected phase filters.\n   *\n   * @param phase - The render phase that was just added\n   *\n   * @since v1.6.0 - Optimized: selective invalidation by phase\n   */\n  invalidate(phase: PhaseType): void {\n    // Smart invalidation: only invalidate cache for the current phase\n    // Other phase caches remain valid (e.g., adding \"update\" doesn't affect \"mount\" cache)\n    if (this.phaseCache) {\n      delete this.phaseCache[phase];\n    }\n  }\n\n  /**\n   * Full clear (called on clear)\n   */\n  clear(): void {\n    this.phaseCache = undefined;\n  }\n}\n","import { MAX_LISTENERS } from \"./constants\";\n\nimport type {\n  ProfilerEventsInterface,\n  RenderEventInfo,\n  RenderListener,\n} from \"./interfaces\";\n\n/**\n * Simple event emitter for render events\n *\n * Responsibilities:\n * - Managing render event subscribers\n * - Emitting render events to all subscribers\n * - Providing cleanup mechanisms\n * - Detecting memory leaks (too many listeners)\n *\n * Implementation notes:\n * - Uses Set for O(1) add/remove operations\n * - Thread-safe in React (all listeners called synchronously)\n * - Listeners called in insertion order (Set maintains order)\n *\n * @since v1.7.0 - Implements ProfilerEventsInterface for Dependency Injection\n */\nexport class ProfilerEvents implements ProfilerEventsInterface {\n  private readonly listeners = new Set<RenderListener>();\n\n  /**\n   * Subscribe to render events\n   *\n   * @param listener - Callback to invoke on each render\n   * @returns Unsubscribe function (safe for multiple calls)\n   * @throws {Error} If listener count exceeds MAX_LISTENERS (likely memory leak)\n   *\n   * @example\n   * ```typescript\n   * const unsubscribe = events.subscribe((info) => {\n   *   console.log(`Render #${info.count}: ${info.phase}`);\n   * });\n   *\n   * // Later...\n   * unsubscribe();\n   * ```\n   */\n  subscribe(listener: RenderListener): () => void {\n    this.listeners.add(listener);\n\n    // Memory leak detection: detect forgotten unsubscribe()\n    if (this.listeners.size > MAX_LISTENERS) {\n      throw new Error(\n        `🔥 Memory leak detected!\\n\\n` +\n          `Component has ${this.listeners.size} event listeners.\\n` +\n          `This likely indicates a bug:\\n` +\n          `  • Forgot to call unsubscribe() in useEffect cleanup\\n` +\n          `  • Listeners added in render function instead of useEffect\\n` +\n          `  • Component remounting repeatedly without cleanup\\n\\n` +\n          `💡 Always return unsubscribe from useEffect:\\n` +\n          `useEffect(() => {\\n` +\n          `  const unsubscribe = component.onRender(...);\\n` +\n          `  return unsubscribe;\\n` +\n          `}, []);`,\n      );\n    }\n\n    // Return unsubscribe function\n    // Safe to call multiple times (Set.delete is idempotent)\n    return () => {\n      this.listeners.delete(listener);\n    };\n  }\n\n  /**\n   * Emit render event to all subscribers\n   *\n   * Calls all listeners synchronously in order of subscription\n   *\n   * @param info - Render event information\n   *\n   * @example\n   * ```typescript\n   * events.emit({\n   *   count: 1,\n   *   phase: 'mount',\n   *   history: Object.freeze(['mount'])\n   * });\n   * ```\n   */\n  emit(info: RenderEventInfo): void {\n    // Call listeners in order of subscription\n    for (const listener of this.listeners) {\n      listener(info);\n    }\n  }\n\n  /**\n   * Remove all listeners\n   *\n   * @example\n   * ```typescript\n   * events.clear();\n   * console.log(events.hasListeners()); // false\n   * ```\n   */\n  clear(): void {\n    this.listeners.clear();\n  }\n\n  /**\n   * Check if there are any listeners\n   *\n   * Useful for optimization - skip emit() if no listeners\n   *\n   * @returns True if at least one listener is subscribed\n   *\n   * @example\n   * ```typescript\n   * if (events.hasListeners()) {\n   *   events.emit(info);\n   * }\n   * ```\n   */\n  hasListeners(): boolean {\n    return this.listeners.size > 0;\n  }\n}\n","import { MAX_SAFE_RENDERS } from \"./constants\";\nimport { ProfilerCache } from \"./ProfilerCache\";\nimport { ProfilerEvents } from \"./ProfilerEvents\";\n\nimport type {\n  ProfilerCacheInterface,\n  ProfilerEventsInterface,\n  RenderEventInfo,\n} from \"./interfaces\";\nimport type { PhaseType } from \"@/types\";\n\n/**\n * Manages profiling data for a single component\n *\n * Responsibilities:\n * - Storing renderHistory (array of phases)\n * - Adding new renders\n * - Accessing render history\n * - Coordinating with cache\n * - Emitting render events to subscribers\n *\n * @since v1.7.0 - Added Dependency Injection for cache and events\n */\nexport class ProfilerData {\n  private renderHistory: PhaseType[];\n  private readonly cache: ProfilerCacheInterface;\n  private events?: ProfilerEventsInterface;\n  private readonly eventsFactory: () => ProfilerEventsInterface;\n\n  /**\n   * @param cache - Cache implementation for optimizing data access (default: ProfilerCache)\n   * @param eventsFactory - Factory function for creating event emitter (default: ProfilerEvents)\n   *\n   * @example\n   * // Default usage (backward compatible)\n   * const data = new ProfilerData();\n   *\n   * @example\n   * // With custom cache (e.g., for testing)\n   * const mockCache = createMockCache();\n   * const data = new ProfilerData(mockCache);\n   *\n   * @example\n   * // With custom events factory\n   * const data = new ProfilerData(\n   *   new ProfilerCache(),\n   *   () => new CustomEvents()\n   * );\n   */\n  constructor(\n    cache: ProfilerCacheInterface = new ProfilerCache(),\n    eventsFactory: () => ProfilerEventsInterface = () => new ProfilerEvents(),\n  ) {\n    this.renderHistory = [];\n    this.cache = cache;\n    this.eventsFactory = eventsFactory;\n    // ProfilerEvents created lazily on first subscription (optimization)\n  }\n\n  /**\n   * Add a new render to history\n   *\n   * Emits render event to all subscribers after adding to history\n   *\n   * @throws {Error} If render count exceeds MAX_SAFE_RENDERS (likely infinite loop)\n   */\n  addRender(phase: PhaseType): void {\n    // Circuit breaker: detect infinite render loops BEFORE adding\n    if (this.renderHistory.length >= MAX_SAFE_RENDERS) {\n      // Show last 10 phases from current history + the phase we're trying to add\n      const last9 = this.renderHistory\n        .slice(-9)\n        .map((p) => `\"${p}\"`)\n        .join(\", \");\n      const last10 = `${last9}, \"${phase}\"`;\n\n      throw new Error(\n        `🔥 Infinite render loop detected!\\n\\n` +\n          `Component rendered ${this.renderHistory.length} times.\\n` +\n          `Attempted to add render #${this.renderHistory.length + 1}.\\n` +\n          `This likely indicates a bug:\\n` +\n          `  • useEffect with missing/wrong dependencies\\n` +\n          `  • setState called during render\\n` +\n          `  • Circular state updates\\n\\n` +\n          `Last 10 phases: [${last10}]\\n\\n` +\n          `💡 Check your useEffect dependencies and state update logic.`,\n      );\n    }\n\n    this.renderHistory.push(phase);\n\n    // Smart cache invalidation: only invalidate cache for current phase\n    this.cache.invalidate(phase);\n\n    // Optimization: Only emit if there are listeners\n    // Optional chaining used since ProfilerEvents is lazily initialized\n    if (this.events?.hasListeners()) {\n      // Capture snapshot of current history (O(n) copy)\n      // Snapshot ensures event shows history at emit time, not access time\n      const historySnapshot = [...this.renderHistory];\n\n      // Cache for lazy freeze - frozen only on first access\n      let frozenSnapshot: readonly PhaseType[] | undefined;\n\n      // Create object with getter property for lazy freeze\n      // This defers expensive Object.freeze() until history is actually accessed\n      const info: RenderEventInfo = {\n        count: this.renderHistory.length,\n        phase: phase,\n        get history(): readonly PhaseType[] {\n          frozenSnapshot ??= Object.freeze(historySnapshot);\n\n          return frozenSnapshot;\n        },\n      };\n\n      this.events.emit(info);\n    }\n  }\n\n  /**\n   * Get the number of renders\n   */\n  getRenderCount(): number {\n    return this.renderHistory.length;\n  }\n\n  /**\n   * Get immutable copy of history\n   */\n  getHistory(): readonly PhaseType[] {\n    return Object.freeze([...this.renderHistory]);\n  }\n\n  /**\n   * Get the last render phase\n   *\n   * @since v1.6.0 - Optimized: direct array access instead of frozen copy\n   */\n  getLastRender(): PhaseType | undefined {\n    return this.renderHistory.at(-1);\n  }\n\n  /**\n   * Get render phase by index\n   *\n   * @since v1.6.0 - Optimized: direct array access instead of frozen copy\n   */\n  getRenderAt(index: number): PhaseType | undefined {\n    return this.renderHistory[index];\n  }\n\n  /**\n   * Get renders filtered by phase (with caching)\n   */\n  getRendersByPhase(phase: PhaseType): readonly PhaseType[] {\n    return this.cache.getPhaseCache(phase, () => {\n      return this.renderHistory.filter((p) => p === phase);\n    });\n  }\n\n  /**\n   * Check if component has ever mounted\n   *\n   * React guarantees that first render phase is always \"mount\" in normal usage.\n   * This method checks the first element and throws an invariant violation\n   * if it's not \"mount\", helping catch integration bugs early.\n   *\n   * @since v1.6.0 - Optimized: O(1) direct array access\n   */\n  hasMounted(): boolean {\n    if (this.renderHistory.length === 0) {\n      return false; // Not render - valid state\n    }\n\n    if (this.renderHistory[0] !== \"mount\") {\n      throw new Error(\n        `Invariant violation: First render must be \"mount\", got \"${this.renderHistory[0]}\". ` +\n          `This indicates a bug in React Profiler or library integration.`,\n      );\n    }\n\n    return true;\n  }\n\n  /**\n   * Get event system for subscribing to render events\n   *\n   * Lazily creates ProfilerEvents on first access (optimization)\n   *\n   * @returns ProfilerEvents instance for this component\n   * @since v1.6.0 - Optimized: lazy initialization, only created when needed\n   * @since v1.7.0 - Uses injected eventsFactory instead of direct instantiation\n   */\n  getEvents(): ProfilerEventsInterface {\n    this.events ??= this.eventsFactory();\n\n    return this.events;\n  }\n\n  /**\n   * Clear all history, caches, and event subscribers\n   */\n  clear(): void {\n    this.renderHistory = [];\n    this.cache.clear();\n    this.events?.clear();\n  }\n}\n","import { ProfilerData } from \"./ProfilerData\";\n\nimport type { AnyComponentType } from \"@/types\";\n\n/**\n * Type-safe storage for profiler data\n *\n * Uses WeakMap for automatic garbage collection\n * and data isolation between components\n */\nexport class ProfilerStorage {\n  private readonly storage: WeakMap<AnyComponentType, ProfilerData>;\n\n  constructor() {\n    this.storage = new WeakMap();\n  }\n\n  /**\n   * Get component data\n   */\n  get(component: AnyComponentType): ProfilerData | undefined {\n    return this.storage.get(component);\n  }\n\n  /**\n   * Set component data\n   */\n  set(component: AnyComponentType, data: ProfilerData): void {\n    this.storage.set(component, data);\n  }\n\n  /**\n   * Check if data exists\n   */\n  has(component: AnyComponentType): boolean {\n    return this.storage.has(component);\n  }\n\n  /**\n   * Get or create component data\n   */\n  getOrCreate(component: AnyComponentType): ProfilerData {\n    let data = this.get(component);\n\n    if (data === undefined) {\n      data = new ProfilerData();\n      this.set(component, data);\n    }\n\n    return data;\n  }\n}\n","import { createOnRenderCallback } from \"@/profiler/components/createOnRenderCallback\";\nimport { registry } from \"@/registry\";\n\nimport { ProfiledComponentWrapper } from \"./ProfiledComponent\";\nimport { ProfilerAPI } from \"../api/ProfilerAPI\";\nimport { ProfilerStorage } from \"../core/ProfilerStorage\";\n\nimport type { ProfiledComponentType } from \"@/types\";\nimport type { ComponentType, ReactElement } from \"react\";\n\n// Global singletons - single instance for entire application\nconst globalStorage = new ProfilerStorage();\nconst globalAPI = new ProfilerAPI(globalStorage);\n\n/**\n * Wraps a React component with profiling capabilities for testing\n *\n * @param Component - The component to profile\n * @param displayName - Optional custom display name for debugging\n * @returns A wrapped component with profiling API\n */\nexport function withProfiler<P extends object>(\n  Component: ComponentType<P>,\n  displayName?: string,\n): ProfiledComponentType<P> {\n  // Step 1: Determine component name\n  const componentName =\n    displayName ?? Component.displayName ?? (Component.name || \"Component\");\n\n  // Step 2: Create onRender callback (will initialize storage via getOrCreate)\n  const onRender = createOnRenderCallback(Component, globalStorage);\n\n  // Step 3: Create wrapper component\n  const ProfiledComponentFunc = (props: P): ReactElement => {\n    return (\n      <ProfiledComponentWrapper\n        Component={Component}\n        componentProps={props}\n        componentName={componentName}\n        onRender={onRender}\n      />\n    );\n  };\n\n  // Cast to ProfiledComponent type\n  const ProfiledComp = ProfiledComponentFunc as ProfiledComponentType<P>;\n\n  // Step 4: Set displayName\n  ProfiledComp.displayName = `withProfiler(${componentName})`;\n\n  // Step 5: Add OriginalComponent reference (hidden from enumeration)\n  Object.defineProperty(ProfiledComp, \"OriginalComponent\", {\n    value: Component,\n    writable: false,\n    enumerable: false,\n    configurable: false,\n  });\n\n  // Step 6: Attach API methods\n  const apiMethods = globalAPI.createAllMethods(Component);\n\n  Object.assign(ProfiledComp, apiMethods);\n\n  // Step 7: Register for cleanup\n  const clearInternal = () => {\n    const data = globalStorage.get(Component);\n\n    data?.clear();\n  };\n\n  registry.register({ clear: clearInternal });\n\n  // Step 8: Return wrapped component with full API\n  return ProfiledComp;\n}\n","import { render, act } from \"@testing-library/react\";\n\nimport { withProfiler } from \"../profiler/components/withProfiler\";\n\nimport type { ProfiledComponent } from \"../types\";\nimport type { RenderOptions } from \"@testing-library/react\";\n\n/**\n * Options for profileHook\n */\nexport interface ProfileHookOptions {\n  /**\n   * React Testing Library render options.\n   * Most commonly used for wrapping the hook in a context provider.\n   *\n   * @example\n   * ```tsx\n   * const { result } = profileHook(\n   *   () => useMyContextHook(),\n   *   { renderOptions: { wrapper: MyContextProvider } }\n   * );\n   * ```\n   */\n  renderOptions?: RenderOptions;\n}\n\n/**\n * Type guard to distinguish ProfileHookOptions from initialProps\n */\nexport function isProfileHookOptions(\n  value: unknown,\n): value is ProfileHookOptions {\n  return (\n    typeof value === \"object\" && value !== null && \"renderOptions\" in value\n  );\n}\n\n/**\n * Profile a React Hook to detect extra renders\n *\n * @param hook - The hook function to profile\n * @param initialPropsOrOptions - Initial props for hooks with parameters, or options for hooks without\n * @param options - Options including renderOptions for wrapping in context providers\n * @returns Object with hook result and profiled component\n *\n * @example\n * ```tsx\n * // Hook without parameters\n * const { result, ProfiledHook } = profileHook(() => useMyHook());\n *\n * // Hook with parameters\n * const { result, ProfiledHook } = profileHook(\n *   ({ value }) => useBadHook(value),\n *   { value: 1 }\n * );\n *\n * // Hook with context dependency\n * const wrapper = ({ children }: { children: React.ReactNode }) => (\n *   <MyContextProvider>{children}</MyContextProvider>\n * );\n *\n * const { result, ProfiledHook } = profileHook(\n *   () => useMyContextHook(),\n *   { renderOptions: { wrapper } }\n * );\n *\n * expect(ProfiledHook).toHaveRenderedTimes(1);\n * ```\n */\n\n// Type overload 1: Hook without parameters, without options\nexport function profileHook<TResult>(hook: () => TResult): {\n  result: { readonly current: TResult };\n  rerender: () => void;\n  unmount: () => void;\n  ProfiledHook: ProfiledComponent<object>;\n};\n\n// Type overload 2: Hook without parameters, with options\nexport function profileHook<TResult>(\n  hook: () => TResult,\n  options: ProfileHookOptions,\n): {\n  result: { readonly current: TResult };\n  rerender: () => void;\n  unmount: () => void;\n  ProfiledHook: ProfiledComponent<object>;\n};\n\n// Type overload 3: Hook with parameters, without options\nexport function profileHook<TProps extends object, TResult>(\n  hook: (props: TProps) => TResult,\n  initialProps: TProps,\n): {\n  result: { readonly current: TResult };\n  rerender: (newProps?: TProps) => void;\n  unmount: () => void;\n  ProfiledHook: ProfiledComponent<TProps>;\n};\n\n// Type overload 4: Hook with parameters, with options\nexport function profileHook<TProps extends object, TResult>(\n  hook: (props: TProps) => TResult,\n  initialProps: TProps,\n  options: ProfileHookOptions,\n): {\n  result: { readonly current: TResult };\n  rerender: (newProps?: TProps) => void;\n  unmount: () => void;\n  ProfiledHook: ProfiledComponent<TProps>;\n};\n\n// Implementation\nexport function profileHook<TProps extends object = object, TResult = unknown>(\n  hook: (props: TProps) => TResult,\n  secondArg?: TProps | ProfileHookOptions,\n  thirdArg?: ProfileHookOptions,\n): {\n  result: { readonly current: TResult };\n  rerender: (newProps?: TProps) => void;\n  unmount: () => void;\n  ProfiledHook: ProfiledComponent<TProps>;\n} {\n  // Determine initialProps and options based on arguments\n  // The type guard isProfileHookOptions distinguishes options from props\n  let initialProps: TProps | undefined;\n  let options: ProfileHookOptions | undefined;\n\n  if (thirdArg !== undefined) {\n    // 3 args: profileHook(hook, props, options)\n    initialProps = secondArg as TProps;\n    options = thirdArg;\n  } else if (isProfileHookOptions(secondArg)) {\n    // 2 args with options: profileHook(hook, options)\n    options = secondArg;\n  } else {\n    // 1-2 args: profileHook(hook) or profileHook(hook, props)\n    // When secondArg is undefined, initialProps stays undefined (correct for no-props case)\n    initialProps = secondArg;\n  }\n\n  let hookResult: TResult;\n\n  // Component wrapper that calls the hook\n  const HookComponent = (props: TProps) => {\n    hookResult = hook(props);\n\n    return null;\n  };\n\n  // Set display name for debugging\n  const hookName = hook.name || \"useHook\";\n\n  HookComponent.displayName = `HookWrapper(${hookName})`;\n\n  // Wrap with profiler\n  const ProfiledHook = withProfiler(HookComponent, hookName);\n\n  // Use empty object for hooks without parameters\n  const propsToUse = (initialProps ?? {}) as TProps;\n\n  // Render the component with optional renderOptions (for wrapper, etc.)\n  const { rerender: rtlRerender, unmount } = render(\n    <ProfiledHook {...propsToUse} />,\n    options?.renderOptions,\n  );\n\n  return {\n    // Use getter to return actual current value\n    result: {\n      get current() {\n        return hookResult;\n      },\n    },\n    // Wrap rerender in act() to avoid warnings\n    // Note: RTL's rerender preserves the wrapper from initial render()\n    rerender: (newProps?: TProps) => {\n      act(() => {\n        const props = (newProps ?? {}) as TProps;\n\n        rtlRerender(<ProfiledHook {...props} />);\n      });\n    },\n    unmount,\n    ProfiledHook,\n  };\n}\n","import { profileHook } from \"./profileHook\";\n\nimport type { ProfileHookOptions } from \"./profileHook\";\nimport type { PhaseType, ProfiledComponent } from \"../types\";\n\n/**\n * Simplified API for hook profiling with built-in assertions\n *\n * @param hook - The hook function to profile\n * @param initialPropsOrOptions - Initial props for hooks with parameters, or options for hooks without\n * @param options - Options including renderOptions for wrapping in context providers\n * @returns Profiler object with assertion helpers and metrics\n *\n * @example\n * ```tsx\n * // Simple usage\n * const profiler = createHookProfiler(() => useMyHook());\n * profiler.expectRenderCount(1);\n *\n * // With props\n * const profiler = createHookProfiler(\n *   ({ value }) => useMyHook(value),\n *   { value: 1 }\n * );\n * profiler.rerender({ value: 2 });\n * profiler.expectRenderCount(2);\n *\n * // With context provider\n * const profiler = createHookProfiler(\n *   () => useMyContextHook(),\n *   { renderOptions: { wrapper: MyContextProvider } }\n * );\n * ```\n */\n\n// Type overload 1: Hook without parameters, without options\nexport function createHookProfiler<TResult>(hook: () => TResult): {\n  result: { readonly current: TResult };\n  rerender: () => void;\n  unmount: () => void;\n  ProfiledHook: ProfiledComponent<object>;\n  expectRenderCount: (expected: number) => void;\n  getRenderCount: () => number;\n  getRenderHistory: () => readonly PhaseType[];\n  getLastRender: () => PhaseType | undefined;\n};\n\n// Type overload 2: Hook without parameters, with options\nexport function createHookProfiler<TResult>(\n  hook: () => TResult,\n  options: ProfileHookOptions,\n): {\n  result: { readonly current: TResult };\n  rerender: () => void;\n  unmount: () => void;\n  ProfiledHook: ProfiledComponent<object>;\n  expectRenderCount: (expected: number) => void;\n  getRenderCount: () => number;\n  getRenderHistory: () => readonly PhaseType[];\n  getLastRender: () => PhaseType | undefined;\n};\n\n// Type overload 3: Hook with parameters, without options\nexport function createHookProfiler<TProps extends object, TResult>(\n  hook: (props: TProps) => TResult,\n  initialProps: TProps,\n): {\n  result: { readonly current: TResult };\n  rerender: (newProps?: TProps) => void;\n  unmount: () => void;\n  ProfiledHook: ProfiledComponent<TProps>;\n  expectRenderCount: (expected: number) => void;\n  getRenderCount: () => number;\n  getRenderHistory: () => readonly PhaseType[];\n  getLastRender: () => PhaseType | undefined;\n};\n\n// Type overload 4: Hook with parameters, with options\nexport function createHookProfiler<TProps extends object, TResult>(\n  hook: (props: TProps) => TResult,\n  initialProps: TProps,\n  options: ProfileHookOptions,\n): {\n  result: { readonly current: TResult };\n  rerender: (newProps?: TProps) => void;\n  unmount: () => void;\n  ProfiledHook: ProfiledComponent<TProps>;\n  expectRenderCount: (expected: number) => void;\n  getRenderCount: () => number;\n  getRenderHistory: () => readonly PhaseType[];\n  getLastRender: () => PhaseType | undefined;\n};\n\n// Implementation\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function createHookProfiler<\n  TProps extends object = object,\n  TResult = unknown,\n>(\n  hook: (props: TProps) => TResult,\n  secondArg?: TProps | ProfileHookOptions,\n  thirdArg?: ProfileHookOptions,\n) {\n  // Forward all arguments to profileHook - it handles all the type checking\n  // Use type assertion to bypass TypeScript's overload resolution\n  // since profileHook's runtime type guard will determine the correct path\n  const { result, rerender, unmount, ProfiledHook } =\n    thirdArg === undefined\n      ? (\n          profileHook as (\n            hook: (props: TProps) => TResult,\n            secondArg?: TProps | ProfileHookOptions,\n          ) => ReturnType<typeof profileHook<TProps, TResult>>\n        )(hook, secondArg)\n      : profileHook(hook, secondArg as TProps, thirdArg);\n\n  return {\n    // Access to hook result\n    result,\n\n    // Lifecycle methods\n    rerender,\n    unmount,\n\n    // Direct access to profiled component\n    ProfiledHook,\n\n    // Assertion helpers\n    expectRenderCount(expected: number): void {\n      const actual = ProfiledHook.getRenderCount();\n\n      if (actual !== expected) {\n        throw new Error(\n          `Expected ${expected} render(s), but got ${actual}. ` +\n            `This hook may be causing unnecessary re-renders.`,\n        );\n      }\n    },\n\n    // Metrics\n    getRenderCount: () => ProfiledHook.getRenderCount(),\n    getRenderHistory: () => ProfiledHook.getRenderHistory(),\n    getLastRender: () => ProfiledHook.getLastRender(),\n  };\n}\n","import { cleanupAndResolve, cleanupAndResolveIfPhaseMatches } from \"@/helpers\";\n\nimport type { PhaseType, ProfiledComponent, WaitOptions } from \"../types\";\n\n/**\n * Wait for a component to reach a specific render count\n *\n * Uses event-based approach with onRender() for instant notification.\n * No polling overhead - resolves immediately when condition is met.\n *\n * @param component - The profiled component to wait for\n * @param count - Expected number of renders (must be non-negative integer)\n * @param options - Wait options (timeout must be positive number)\n *\n * @since v1.6.0 - Rewritten to use event-based approach (no polling)\n *\n * @example\n * ```typescript\n * const ProfiledButton = withProfiler(Button);\n * render(<ProfiledButton onClick={() => setState(x => x + 1)} />);\n *\n * // Wait for 3 renders (event-based, instant)\n * await waitForRenders(ProfiledButton, 3);\n * expect(ProfiledButton).toHaveRenderedTimes(3);\n * ```\n *\n * @throws {TypeError} If count is not a non-negative integer or timeout is invalid\n * @throws {Error} If the expected render count is not reached within timeout\n */\nexport async function waitForRenders<P>(\n  component: ProfiledComponent<P>,\n  count: number,\n  options?: WaitOptions,\n): Promise<void> {\n  // Validate count parameter\n  if (!Number.isInteger(count) || count < 0) {\n    throw new TypeError(\n      `Expected count to be a non-negative integer, received ${count}`,\n    );\n  }\n\n  const { timeout = 1000 } = options ?? {};\n\n  // Validate timeout parameter\n  if (!Number.isFinite(timeout) || timeout <= 0) {\n    throw new TypeError(\n      `Expected timeout to be a positive number, received ${timeout}`,\n    );\n  }\n\n  return new Promise((resolve, reject) => {\n    // Race condition protection: check if already satisfied\n    if (component.getRenderCount() >= count) {\n      resolve();\n\n      return;\n    }\n\n    // Setup timeout\n    const timeoutId = setTimeout(() => {\n      unsubscribe();\n      const actual = component.getRenderCount();\n      const more = count - actual;\n\n      reject(\n        new Error(\n          `Expected ${count} renders, but got ${actual}. Waiting for ${more} more render(s). Timed out after ${timeout}ms`,\n        ),\n      );\n    }, timeout);\n\n    // Subscribe to render events\n    const unsubscribe = component.onRender(({ count: renderCount }) => {\n      if (renderCount >= count) {\n        cleanupAndResolve(timeoutId, unsubscribe, resolve, undefined);\n      }\n    });\n  });\n}\n\n/**\n * Wait for a component to reach at least a minimum render count\n *\n * Uses event-based approach with onRender() for instant notification.\n * No polling overhead - resolves immediately when condition is met.\n *\n * @param component - The profiled component to wait for\n * @param minCount - Minimum number of renders (must be non-negative integer)\n * @param options - Wait options (timeout must be positive number)\n *\n * @since v1.6.0 - Rewritten to use event-based approach (no polling)\n *\n * @example\n * ```typescript\n * const ProfiledButton = withProfiler(Button);\n * render(<ProfiledButton onClick={() => setState(x => x + 1)} />);\n *\n * // Wait for at least 2 renders (event-based, instant)\n * await waitForMinimumRenders(ProfiledButton, 2);\n * expect(ProfiledButton.getRenderCount()).toBeGreaterThanOrEqual(2);\n * ```\n *\n * @throws {TypeError} If minCount is not a non-negative integer or timeout is invalid\n * @throws {Error} If the minimum render count is not reached within timeout\n */\nexport async function waitForMinimumRenders<P>(\n  component: ProfiledComponent<P>,\n  minCount: number,\n  options?: WaitOptions,\n): Promise<void> {\n  // Validate minCount parameter\n  if (!Number.isInteger(minCount) || minCount < 0) {\n    throw new TypeError(\n      `Expected minCount to be a non-negative integer, received ${minCount}`,\n    );\n  }\n\n  const { timeout = 1000 } = options ?? {};\n\n  // Validate timeout parameter\n  if (!Number.isFinite(timeout) || timeout <= 0) {\n    throw new TypeError(\n      `Expected timeout to be a positive number, received ${timeout}`,\n    );\n  }\n\n  return new Promise((resolve, reject) => {\n    // Race condition protection: check if already satisfied\n    if (component.getRenderCount() >= minCount) {\n      resolve();\n\n      return;\n    }\n\n    // Setup timeout\n    const timeoutId = setTimeout(() => {\n      unsubscribe();\n      const actual = component.getRenderCount();\n      const more = minCount - actual;\n\n      reject(\n        new Error(\n          `Expected at least ${minCount} renders, but got ${actual}. Waiting for ${more} more render(s). Timed out after ${timeout}ms`,\n        ),\n      );\n    }, timeout);\n\n    // Subscribe to render events\n    const unsubscribe = component.onRender(({ count: renderCount }) => {\n      if (renderCount >= minCount) {\n        cleanupAndResolve(timeoutId, unsubscribe, resolve, undefined);\n      }\n    });\n  });\n}\n\n/**\n * Wait for a component to reach a specific render phase\n *\n * Uses event-based approach with onRender() for instant notification.\n * No polling overhead - resolves immediately when condition is met.\n *\n * @param component - The profiled component to wait for\n * @param phase - The render phase to wait for ('mount', 'update', or 'nested-update')\n * @param options - Wait options (timeout must be positive number)\n *\n * @since v1.6.0 - Rewritten to use event-based approach (no polling)\n *\n * @example\n * ```typescript\n * const ProfiledButton = withProfiler(Button);\n * const { rerender } = render(<ProfiledButton value={1} />);\n *\n * // Wait for component to update (event-based, instant)\n * rerender(<ProfiledButton value={2} />);\n * await waitForPhase(ProfiledButton, 'update');\n *\n * expect(ProfiledButton.getRendersByPhase('update')).toHaveLength(1);\n * ```\n *\n * @throws {TypeError} If timeout is invalid\n * @throws {Error} If the phase is not reached within timeout\n */\nexport async function waitForPhase<P>(\n  component: ProfiledComponent<P>,\n  phase: PhaseType,\n  options?: WaitOptions,\n): Promise<void> {\n  const { timeout = 1000 } = options ?? {};\n\n  // Validate timeout parameter\n  if (!Number.isFinite(timeout) || timeout <= 0) {\n    throw new TypeError(\n      `Expected timeout to be a positive number, received ${timeout}`,\n    );\n  }\n\n  return new Promise((resolve, reject) => {\n    // Race condition protection: check if already satisfied\n    if (component.getRenderHistory().includes(phase)) {\n      resolve();\n\n      return;\n    }\n\n    // Setup timeout\n    const timeoutId = setTimeout(() => {\n      unsubscribe();\n      const history = component.getRenderHistory();\n\n      reject(\n        new Error(\n          `Expected component to reach phase \"${phase}\", but it hasn't yet within ${timeout}ms. Current phases: [${history.join(\", \")}]`,\n        ),\n      );\n    }, timeout);\n\n    // Subscribe to render events\n    const unsubscribe = component.onRender(({ phase: renderPhase }) => {\n      // Callback is just a data pipe - no logic!\n      // All conditional logic moved inside helper (unit-testable)\n      cleanupAndResolveIfPhaseMatches(\n        timeoutId,\n        unsubscribe,\n        resolve,\n        undefined,\n        renderPhase, // actual phase\n        phase, // expected phase\n      );\n    });\n  });\n}\n","import { render } from \"@testing-library/react\";\n\nimport { withProfiler } from \"../profiler/components/withProfiler\";\n\nimport type { ProfiledComponentType } from \"../types\";\nimport type { RenderOptions, RenderResult } from \"@testing-library/react\";\nimport type { ComponentType } from \"react\";\n\n/**\n * Options for renderProfiled\n */\nexport interface RenderProfiledOptions {\n  /**\n   * Custom display name for the profiled component\n   */\n  displayName?: string;\n\n  /**\n   * React Testing Library render options\n   */\n  renderOptions?: RenderOptions;\n}\n\n/**\n * Result of renderProfiled that includes the profiled component and all RTL utilities\n */\nexport interface RenderProfiledResult<P extends object>\n  extends Omit<RenderResult, \"rerender\"> {\n  /**\n   * The profiled component with profiling API methods\n   */\n  component: ProfiledComponentType<P>;\n\n  /**\n   * Enhanced rerender function that accepts partial props\n   *\n   * @param newProps - Partial props to merge with original props\n   */\n  rerender: (newProps: Partial<P>) => void;\n}\n\n/**\n * Simplified helper for rendering a component with profiling in a single step\n *\n * This is a convenience wrapper that combines `withProfiler()` and `render()` into one call,\n * making it easier to write tests with profiling enabled.\n *\n * @param Component - The React component to profile\n * @param props - Initial props for the component\n * @param options - Optional configuration\n * @returns An object containing the profiled component and all React Testing Library utilities\n *\n * @example\n * ```tsx\n * // Before (manual approach)\n * const ProfiledButton = withProfiler(Button);\n * const { rerender } = render(<ProfiledButton value={1} />);\n * expect(ProfiledButton).toHaveRenderedTimes(1);\n * rerender(<ProfiledButton value={2} />);\n * expect(ProfiledButton).toHaveRenderedTimes(2);\n *\n * // After (with renderProfiled)\n * const { component, rerender } = renderProfiled(Button, { value: 1 });\n * expect(component).toHaveRenderedTimes(1);\n * rerender({ value: 2 }); // automatically merges props\n * expect(component).toHaveRenderedTimes(2);\n * ```\n *\n * @example\n * ```tsx\n * // With custom display name\n * const { component } = renderProfiled(Button, { value: 1 }, {\n *   displayName: 'MyButton'\n * });\n *\n * // With RTL render options\n * const { component } = renderProfiled(Button, { value: 1 }, {\n *   renderOptions: { wrapper: ThemeProvider }\n * });\n * ```\n */\nexport function renderProfiled<P extends object>(\n  Component: ComponentType<P>,\n  props: P,\n  options?: RenderProfiledOptions,\n): RenderProfiledResult<P> {\n  const ProfiledComponent = withProfiler(Component, options?.displayName);\n\n  // Track current props to merge with partial updates\n  let currentProps = props;\n\n  const rtl = render(<ProfiledComponent {...props} />, options?.renderOptions);\n\n  return {\n    component: ProfiledComponent,\n    ...rtl,\n    rerender: (newProps: Partial<P>) => {\n      // Merge current props with new partial props\n      currentProps = { ...currentProps, ...newProps };\n      rtl.rerender(<ProfiledComponent {...currentProps} />);\n    },\n  };\n}\n","/**\n * vitest-react-profiler\n * React component render tracking and performance testing utilities for Vitest\n *\n * @packageDocumentation\n */\n\n// Core functionality\n// Matchers - auto-registered when imported\nimport \"./matchers\";\n\n// Auto-setup - registers afterEach cleanup hook\nimport \"./auto-setup\";\n\nexport { withProfiler } from \"./profiler/components/withProfiler\";\n\n// Hook profiling\nexport { profileHook, createHookProfiler } from \"./hooks\";\n\nexport type { ProfileHookOptions } from \"./hooks\";\n\n// Utilities\nexport {\n  formatRenderHistory,\n  formatRenderSummary,\n} from \"./utils/formatRenderHistory\";\n\n// Async utilities\nexport {\n  waitForRenders,\n  waitForMinimumRenders,\n  waitForPhase,\n} from \"./utils/async\";\n\n// Rendering utilities\nexport { renderProfiled } from \"./utils/renderProfiled\";\n\nexport type {\n  RenderProfiledOptions,\n  RenderProfiledResult,\n} from \"./utils/renderProfiled\";\n\n// Testing utilities\nexport { clearProfilerData, clearRegistry } from \"./registry\";\n\n// Types\nexport type {\n  PhaseType,\n  ProfiledComponent,\n  ProfiledComponentType,\n  WaitOptions,\n  RenderEventInfo,\n} from \"./types\";\n\n// Version info\n/* v8 ignore next 3 -- @preserve */\nexport const VERSION = process.env.npm_package_version ?? \"0.0.0\";\n"]}