"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _vue = require("vue");
var _context = require("../../config-provider/context");
var _context2 = require("../context");
const useVariants = (component, variant, legacyBordered = (0, _vue.ref)(undefined)) => {
  const {
    variant: configVariant,
    [component]: componentConfig
  } = (0, _context.useConfigContextInject)();
  const ctxVariant = (0, _context2.useInjectFormVariant)();
  return (0, _vue.computed)(() => {
    var _a, _b, _c, _d;
    const configComponentVariant = (_a = componentConfig === null || componentConfig === void 0 ? void 0 : componentConfig.value) === null || _a === void 0 ? void 0 : _a.variant;
    let mergedVariant;
    if (typeof variant.value !== 'undefined') {
      mergedVariant = variant.value;
    } else if (legacyBordered.value === false) {
      mergedVariant = 'borderless';
    } else {
      // form variant > component global variant > global variant
      mergedVariant = (_d = (_c = (_b = ctxVariant === null || ctxVariant === void 0 ? void 0 : ctxVariant.value) !== null && _b !== void 0 ? _b : configComponentVariant) !== null && _c !== void 0 ? _c : configVariant === null || configVariant === void 0 ? void 0 : configVariant.value) !== null && _d !== void 0 ? _d : 'outlined';
    }
    const enableVariantCls = _context.Variants.includes(mergedVariant);
    return [mergedVariant, enableVariantCls];
  });
};
var _default = exports.default = useVariants;