<commit_before>import * as React from 'react';
import clsx from 'clsx';
import PropTypes from 'prop-types';
import { unstable_composeClasses as composeClasses } from '@material-ui/unstyled';
import capitalize from '../utils/capitalize';
import experimentalStyled from '../styles/experimentalStyled';
import useTheme from '../styles/useTheme';
import { getHiddenCssUtilityClass } from './hiddenCssClasses';

const useUtilityClasses = (styleProps) => {
  const { classes, breakpoints } = styleProps;

  const slots = {
    root: [
      'root',
      ...breakpoints.map(({ breakpoint, dir }) => {
        return dir === 'only'
          ? `${dir}${capitalize(breakpoint)}`
          : `${breakpoint}${capitalize(dir)}`;
      }),
    ],
  };

  return composeClasses(slots, getHiddenCssUtilityClass, classes);
};

const HiddenCssRoot = experimentalStyled(
  'div',
  {},
  {
    name: 'PrivateHiddenCss',
    slot: 'Root',
  },
)(({ theme, styleProps }) => {
  const hidden = {
    display: 'none',
  };

  return {
    ...styleProps.breakpoints
      .map(({ breakpoint, dir }) => {
        if (dir === 'only') {
          return {
            [theme.breakpoints.only(breakpoint)]: hidden,
          };
        }
        return dir === 'up'
          ? {
              [theme.breakpoints.up(breakpoint)]: hidden,
            }
          : {
              [theme.breakpoints.down(breakpoint)]: hidden,
            };
      })
      .reduce((r, o) => {
        Object.keys(o).forEach((k) => {
          r[k] = o[k];
        });
        return r;
      }, {}),
  };
});

/**
 * @ignore - internal component.
 */
function HiddenCss(props) {
  const { children, className, only, ...other } = props;
  const theme = useTheme();

  if (process.env.NODE_ENV !== 'production') {
    const unknownProps = Object.keys(other).filter((propName) => {
      const isUndeclaredBreakpoint = !theme.breakpoints.keys.some((breakpoint) => {
        return `${breakpoint}Up` === propName || `${breakpoint}Down` === propName;
      });
      return !['classes', 'theme', 'isRtl'].includes(propName) && isUndeclaredBreakpoint;
    });

    if (unknownProps.length > 0) {
      console.error(
        `Material-UI: Unsupported props received by \`<Hidden implementation="css" />\`: ${unknownProps.join(
          ', ',
        )}. Did you forget to wrap this component in a ThemeProvider declaring these breakpoints?`,
      );
    }
  }

  const breakpoints = [];

  for (let i = 0; i < theme.breakpoints.keys.length; i += 1) {
    const breakpoint = theme.breakpoints.keys[i];
    const breakpointUp = other[`${breakpoint}Up`];
    const breakpointDown = other[`${breakpoint}Down`];

    if (breakpointUp) {
      breakpoints.push({ breakpoint, dir: 'up' });
    }
    if (breakpointDown) {
      breakpoints.push({ breakpoint, dir: 'down' });
    }
  }

  if (only) {
    const onlyBreakpoints = Array.isArray(only) ? only : [only];<commit_msg>[Hidden] Fix unsupported props warning when sx prop is used (#24624)<commit_after>import * as React from 'react';
import clsx from 'clsx';
import PropTypes from 'prop-types';
import { unstable_composeClasses as composeClasses } from '@material-ui/unstyled';
import capitalize from '../utils/capitalize';
import experimentalStyled from '../styles/experimentalStyled';
import useTheme from '../styles/useTheme';
import { getHiddenCssUtilityClass } from './hiddenCssClasses';

const useUtilityClasses = (styleProps) => {
  const { classes, breakpoints } = styleProps;

  const slots = {
    root: [
      'root',
      ...breakpoints.map(({ breakpoint, dir }) => {
        return dir === 'only'
          ? `${dir}${capitalize(breakpoint)}`
          : `${breakpoint}${capitalize(dir)}`;
      }),
    ],
  };

  return composeClasses(slots, getHiddenCssUtilityClass, classes);
};

const HiddenCssRoot = experimentalStyled(
  'div',
  {},
  {
    name: 'PrivateHiddenCss',
    slot: 'Root',
  },
)(({ theme, styleProps }) => {
  const hidden = {
    display: 'none',
  };

  return {
    ...styleProps.breakpoints
      .map(({ breakpoint, dir }) => {
        if (dir === 'only') {
          return {
            [theme.breakpoints.only(breakpoint)]: hidden,
          };
        }
        return dir === 'up'
          ? {
              [theme.breakpoints.up(breakpoint)]: hidden,
            }
          : {
              [theme.breakpoints.down(breakpoint)]: hidden,
            };
      })
      .reduce((r, o) => {
        Object.keys(o).forEach((k) => {
          r[k] = o[k];
        });
        return r;
      }, {}),
  };
});

/**
 * @ignore - internal component.
 */
function HiddenCss(props) {
  const { children, className, only, ...other } = props;
  const theme = useTheme();

  if (process.env.NODE_ENV !== 'production') {
    const unknownProps = Object.keys(other).filter((propName) => {
      const isUndeclaredBreakpoint = !theme.breakpoints.keys.some((breakpoint) => {
        return `${breakpoint}Up` === propName || `${breakpoint}Down` === propName;
      });
      return !['classes', 'theme', 'isRtl', 'sx'].includes(propName) && isUndeclaredBreakpoint;
    });

    if (unknownProps.length > 0) {
      console.error(
        `Material-UI: Unsupported props received by \`<Hidden implementation="css" />\`: ${unknownProps.join(
          ', ',
        )}. Did you forget to wrap this component in a ThemeProvider declaring these breakpoints?`,
      );
    }
  }

  const breakpoints = [];

  for (let i = 0; i < theme.breakpoints.keys.length; i += 1) {
    const breakpoint = theme.breakpoints.keys[i];
    const breakpointUp = other[`${breakpoint}Up`];
    const breakpointDown = other[`${breakpoint}Down`];

    if (breakpointUp) {
      breakpoints.push({ breakpoint, dir: 'up' });
    }
    if (breakpointDown) {
      breakpoints.push({ breakpoint, dir: 'down' });
    }
  }

  if (only) {
    const onlyBreakpoints = Array.isArray(only) ? only : [only];
{'fraction_non_alphanumeric': 0.1652836579170195, 'fraction_numerical': 0.0018628281117696868, 'mean_word_length': 2.6366995073891624, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 23, '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': '5385949', 'n_tokens_mistral': 1848, 'n_tokens_neox': 1801, 'n_words': 396}