<commit_before>/* @flow */
import { render, rehydrate } from 'fela-dom'
import objectEach from 'fast-loops/lib/objectEach'

function hasDOM(renderer) {
  return (
    !renderer.isNativeRenderer &&
    typeof window !== 'undefined' &&
    window.document &&
    window.document.createElement
  )
}

export default function ProviderFactory(
  BaseComponent: any,
  renderChildren: Function,
  statics?: Object
): any {
  class Provider extends BaseComponent {
    constructor(props: Object, context: Object) {
      super(props, context)

      if (props.rehydrate && hasDOM(props.renderer)) {
        rehydrate(props.renderer)
      }
    }

    componentWillMount(): void {
      if (this.props.renderToDOM && hasDOM(this.props.renderer)) {
        render(this.props.renderer)
      }
    }

    getChildContext(): Object {<commit_msg>fix renderer bug under safari<commit_after>/* @flow */
import { render, rehydrate } from 'fela-dom'
import objectEach from 'fast-loops/lib/objectEach'

function hasDOM(renderer) {
  return (
    renderer &&
    !renderer.isNativeRenderer &&
    typeof window !== 'undefined' &&
    window.document &&
    window.document.createElement
  )
}

export default function ProviderFactory(
  BaseComponent: any,
  renderChildren: Function,
  statics?: Object
): any {
  class Provider extends BaseComponent {
    constructor(props: Object, context: Object) {
      super(props, context)

      if (props.rehydrate && hasDOM(props.renderer)) {
        rehydrate(props.renderer)
      }
    }

    componentWillMount(): void {
      if (this.props.renderToDOM && hasDOM(this.props.renderer)) {
        render(this.props.renderer)
      }
    }

    getChildContext(): Object {
{'fraction_non_alphanumeric': 0.11868390129259694, 'fraction_numerical': 0.0, 'mean_word_length': 3.2468827930174564, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5705020', 'n_tokens_mistral': 512, 'n_tokens_neox': 507, 'n_words': 111}