1. /**
    
  2.  * Copyright (c) Meta Platforms, Inc. and affiliates.
    
  3.  *
    
  4.  * This source code is licensed under the MIT license found in the
    
  5.  * LICENSE file in the root directory of this source tree.
    
  6.  *
    
  7.  * @flow
    
  8.  */
    
  9. 
    
  10. 'use strict';
    
  11. 
    
  12. import type {ReactNodeList} from 'shared/ReactTypes';
    
  13. import type {
    
  14.   RootType,
    
  15.   HydrateRootOptions,
    
  16.   CreateRootOptions,
    
  17. } from './src/client/ReactDOMRoot';
    
  18. 
    
  19. import {
    
  20.   createRoot as createRootImpl,
    
  21.   hydrateRoot as hydrateRootImpl,
    
  22.   __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED as Internals,
    
  23. } from './';
    
  24. 
    
  25. export function createRoot(
    
  26.   container: Element | Document | DocumentFragment,
    
  27.   options?: CreateRootOptions,
    
  28. ): RootType {
    
  29.   if (__DEV__) {
    
  30.     Internals.usingClientEntryPoint = true;
    
  31.   }
    
  32.   try {
    
  33.     return createRootImpl(container, options);
    
  34.   } finally {
    
  35.     if (__DEV__) {
    
  36.       Internals.usingClientEntryPoint = false;
    
  37.     }
    
  38.   }
    
  39. }
    
  40. 
    
  41. export function hydrateRoot(
    
  42.   container: Document | Element,
    
  43.   children: ReactNodeList,
    
  44.   options?: HydrateRootOptions,
    
  45. ): RootType {
    
  46.   if (__DEV__) {
    
  47.     Internals.usingClientEntryPoint = true;
    
  48.   }
    
  49.   try {
    
  50.     return hydrateRootImpl(container, children, options);
    
  51.   } finally {
    
  52.     if (__DEV__) {
    
  53.       Internals.usingClientEntryPoint = false;
    
  54.     }
    
  55.   }
    
  56. }