<commit_before>import React, { createElement, Ref, useContext, useMemo } from 'react';
import type {
  Attrs,
  BaseExtensibleObject,
  ExecutionContext,
  ExtensibleObject,
  IInlineStyleConstructor,
  IStyledNativeComponent,
  IStyledNativeComponentFactory,
  IStyledNativeStatics,
  NativeTarget,
  RuleSet,
  StyledNativeOptions,
} from '../types';
import determineTheme from '../utils/determineTheme';
import { EMPTY_ARRAY, EMPTY_OBJECT } from '../utils/empties';
import generateDisplayName from '../utils/generateDisplayName';
import hoist from '../utils/hoist';
import isStyledComponent from '../utils/isStyledComponent';
import merge from '../utils/mixinDeep';
import { DefaultTheme, ThemeContext } from './ThemeProvider';

function useResolvedAttrs<Props = unknown>(
  theme: DefaultTheme = EMPTY_OBJECT,
  props: Props,
  attrs: Attrs<Props>[]
) {
  // NOTE: can't memoize this
  // returns [context, resolvedAttrs]
  // where resolvedAttrs is only the things injected by the attrs themselves
  const context: ExecutionContext & Props = { ...props, theme };
  const resolvedAttrs: BaseExtensibleObject = {};

  attrs.forEach(attrDef => {
    let resolvedAttrDef = typeof attrDef === 'function' ? attrDef(context) : attrDef;
    let key;

    /* eslint-disable guard-for-in */
    for (key in resolvedAttrDef) {
      // @ts-expect-error bad types
      context[key] = resolvedAttrs[key] = resolvedAttrDef[key];
    }
    /* eslint-enable guard-for-in */
  });

  return [context, resolvedAttrs];
}

// Validator defaults to true if not in HTML/DOM env
const validAttr = () => true;

function useStyledComponentImpl<Target extends NativeTarget, Props extends ExtensibleObject>(
  forwardedComponent: IStyledNativeComponent<Target, Props>,
  props: Props,<commit_msg>chore: ignore bogus error in stylednativecomponent<commit_after>import React, { createElement, Ref, useContext, useMemo } from 'react';
import type {
  Attrs,
  BaseExtensibleObject,
  ExecutionContext,
  ExtensibleObject,
  IInlineStyleConstructor,
  IStyledNativeComponent,
  IStyledNativeComponentFactory,
  IStyledNativeStatics,
  NativeTarget,
  RuleSet,
  StyledNativeOptions,
} from '../types';
import determineTheme from '../utils/determineTheme';
import { EMPTY_ARRAY, EMPTY_OBJECT } from '../utils/empties';
import generateDisplayName from '../utils/generateDisplayName';
import hoist from '../utils/hoist';
import isStyledComponent from '../utils/isStyledComponent';
import merge from '../utils/mixinDeep';
import { DefaultTheme, ThemeContext } from './ThemeProvider';

function useResolvedAttrs<Props = unknown>(
  theme: DefaultTheme = EMPTY_OBJECT,
  props: Props,
  attrs: Attrs<Props>[]
) {
  // NOTE: can't memoize this
  // returns [context, resolvedAttrs]
  // where resolvedAttrs is only the things injected by the attrs themselves
  const context: ExecutionContext & Props = { ...props, theme };
  const resolvedAttrs: BaseExtensibleObject = {};

  attrs.forEach(attrDef => {
    // @ts-expect-error narrowing isn't working properly for some reason
    let resolvedAttrDef = typeof attrDef === 'function' ? attrDef(context) : attrDef;
    let key;

    /* eslint-disable guard-for-in */
    for (key in resolvedAttrDef) {
      // @ts-expect-error bad types
      context[key] = resolvedAttrs[key] = resolvedAttrDef[key];
    }
    /* eslint-enable guard-for-in */
  });

  return [context, resolvedAttrs];
}

// Validator defaults to true if not in HTML/DOM env
const validAttr = () => true;

function useStyledComponentImpl<Target extends NativeTarget, Props extends ExtensibleObject>(
  forwardedComponent: IStyledNativeComponent<Target, Props>,
  props: Props,
{'fraction_non_alphanumeric': 0.11284153005464481, 'fraction_numerical': 0.0, 'mean_word_length': 4.391752577319588, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, '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': '827393', 'n_tokens_mistral': 1104, 'n_tokens_neox': 1067, 'n_words': 294}