{"version":3,"file":"growi-react.cjs","sources":["../../../../../src/v4/client/utils/growi-facade/growi-react.ts"],"sourcesContent":["import type React from 'react';\nimport type { GrowiFacade } from '@growi/core';\n\ndeclare global {\n  interface Window {\n    growiFacade: GrowiFacade;\n  }\n}\n\n/**\n * Retrieves the React instance that this package should use.\n *\n * - **Production Mode**: Returns the React instance from `window.growiFacade.react`\n *   to ensure a single shared React instance across the app.\n * - **Development Mode**: Returns the React instance passed as an argument,\n *   which allows local development and hot reload without issues.\n *\n * @param react - The React instance to use during development\n * @returns A React instance to be used in the current environment\n *\n * @remarks\n * Using multiple React instances in a single app can cause serious issues,\n * especially with features like Hooks, which rely on a consistent internal state.\n * This function ensures that only one React instance is used in production\n * to avoid such problems.\n */\nexport const growiReact = (react: typeof React): typeof React => {\n  if (process.env.NODE_ENV === 'production') {\n    return window.growiFacade.react as typeof React;\n  }\n  return react as typeof React;\n};\n"],"names":["growiReact","react"],"mappings":"gFA0BO,MAAMA,EAAcC,GACrB,QAAQ,IAAI,WAAa,aACpB,OAAO,YAAY,MAErBA"}