"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.useMergedMask = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _vue = require("vue");
const normalizeMaskConfig = mask => {
  if (mask && typeof mask === 'object') {
    return mask;
  }
  if (typeof mask === 'boolean') {
    return {
      enabled: mask,
      blur: mask
    };
  }
  return {};
};
const useMergedMask = (mask, contextMask, prefixCls) => {
  return (0, _vue.computed)(() => {
    const maskConfig = normalizeMaskConfig(mask === null || mask === void 0 ? void 0 : mask.value);
    const contextMaskConfig = normalizeMaskConfig(contextMask === null || contextMask === void 0 ? void 0 : contextMask.value);
    const mergedConfig = (0, _extends2.default)((0, _extends2.default)({}, contextMaskConfig), maskConfig);
    const className = mergedConfig.blur !== false ? `${prefixCls === null || prefixCls === void 0 ? void 0 : prefixCls.value}-mask-blur` : undefined;
    return {
      enabled: mergedConfig.enabled !== false,
      classNames: {
        mask: className
      }
    };
  });
};
exports.useMergedMask = useMergedMask;