import '../../../../preact/compat/dist/compat.module.mjs';
import PropTypes from '../../../../../_virtual/index8.mjs';
import { jsx as u } from '../../../../preact/jsx-runtime/dist/jsxRuntime.module.mjs';
import resolveProps from '../../../utils/esm/resolveProps/resolveProps.mjs';
import { useContext as q } from '../../../../preact/hooks/dist/hooks.module.mjs';
import { createContext as F } from '../../../../preact/dist/preact.module.mjs';

const PropsContext = /*#__PURE__*/F(undefined);
function DefaultPropsProvider({
  value,
  children
}) {
  return /*#__PURE__*/u(PropsContext.Provider, {
    value: value,
    children: children
  });
}
DefaultPropsProvider.propTypes /* remove-proptypes */ = {
  // ┌────────────────────────────── Warning ──────────────────────────────┐
  // │ These PropTypes are generated from the TypeScript type definitions. │
  // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
  // └─────────────────────────────────────────────────────────────────────┘
  /**
   * @ignore
   */
  children: PropTypes.node,
  /**
   * @ignore
   */
  value: PropTypes.object
} ;
function getThemeProps(params) {
  const {
    theme,
    name,
    props
  } = params;
  if (!theme || !theme.components || !theme.components[name]) {
    return props;
  }
  const config = theme.components[name];
  if (config.defaultProps) {
    // compatible with v5 signature
    return resolveProps(config.defaultProps, props);
  }
  if (!config.styleOverrides && !config.variants) {
    // v6 signature, no property 'defaultProps'
    return resolveProps(config, props);
  }
  return props;
}
function useDefaultProps$1({
  props,
  name
}) {
  const ctx = q(PropsContext);
  return getThemeProps({
    props,
    name,
    theme: {
      components: ctx
    }
  });
}

export { DefaultPropsProvider as default, useDefaultProps$1 as useDefaultProps };
//# sourceMappingURL=DefaultPropsProvider.mjs.map
