'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
var context = require('../context.js');
var DisabledContext = require('../DisabledContext.js');
var renderEmpty = require('../renderEmpty.js');
var SizeContext = require('../SizeContext.js');

var useConfigInject = (name, props) => {
  const sizeContext = SizeContext.useInjectSize();
  const disabledContext = DisabledContext.useInjectDisabled();
  const configProvider = vue.inject(context.configProviderKey, {
    ...context.defaultConfigProvider,
    renderEmpty: (name2) => vue.h(renderEmpty.DefaultRenderEmpty, { componentName: name2, prefixCls: props.prefixCls })
  });
  const prefixCls = vue.computed(() => configProvider.getPrefixCls(name, props.prefixCls));
  const customizePrefixCls = vue.computed(() => props.customizePrefixCls);
  const direction = vue.computed(() => {
    var _a, _b;
    return (_b = props.direction) != null ? _b : (_a = configProvider.direction) == null ? void 0 : _a.value;
  });
  const iconPrefixCls = vue.computed(() => {
    var _a;
    return (_a = props.iconPrefixCls) != null ? _a : configProvider.iconPrefixCls.value;
  });
  const rootPrefixCls = vue.computed(() => configProvider.getPrefixCls());
  const autoInsertSpaceInButton = vue.computed(() => {
    var _a;
    return (_a = configProvider.autoInsertSpaceInButton) == null ? void 0 : _a.value;
  });
  const renderEmpty$1 = configProvider.renderEmpty;
  const space = configProvider.space;
  const pageHeader = configProvider.pageHeader;
  const form = configProvider.form;
  const getTargetContainer = vue.computed(
    () => {
      var _a, _b;
      return (_b = props.getTargetContainer) != null ? _b : (_a = configProvider.getTargetContainer) == null ? void 0 : _a.value;
    }
  );
  const getPopupContainer = vue.computed(
    () => {
      var _a, _b;
      return (_b = props.getPopupContainer) != null ? _b : (_a = configProvider.getPopupContainer) == null ? void 0 : _a.value;
    }
  );
  const dropdownMatchSelectWidth = vue.computed(
    () => {
      var _a, _b;
      return (_b = props.dropdownMatchSelectWidth) != null ? _b : (_a = configProvider.dropdownMatchSelectWidth) == null ? void 0 : _a.value;
    }
  );
  const virtual = vue.computed(
    () => {
      var _a;
      return (props.virtual === void 0 ? ((_a = configProvider.virtual) == null ? void 0 : _a.value) !== false : props.virtual !== false) && dropdownMatchSelectWidth.value !== false;
    }
  );
  const size = vue.computed(() => props.size || sizeContext.value);
  const autocomplete = vue.computed(
    () => {
      var _a, _b, _c;
      return (_c = props.autocomplete) != null ? _c : (_b = (_a = configProvider.input) == null ? void 0 : _a.value) == null ? void 0 : _b.autocomplete;
    }
  );
  const disabled = vue.computed(() => {
    var _a;
    return (_a = props.disabled) != null ? _a : disabledContext.value;
  });
  const csp = vue.computed(() => {
    var _a;
    return (_a = props.csp) != null ? _a : configProvider.csp;
  });
  return {
    configProvider,
    prefixCls,
    customizePrefixCls,
    direction,
    size,
    getTargetContainer,
    getPopupContainer,
    space,
    pageHeader,
    form,
    autoInsertSpaceInButton,
    renderEmpty: renderEmpty$1,
    virtual,
    dropdownMatchSelectWidth,
    rootPrefixCls,
    getPrefixCls: configProvider.getPrefixCls,
    autocomplete,
    csp,
    iconPrefixCls,
    disabled,
    select: configProvider.select
  };
};

exports.default = useConfigInject;
//# sourceMappingURL=useConfigInject.js.map
