/**
 * ldesign v0.2.22
 * (c) 2022/12/7 16:21 built by swimly
 * @license MIT
 */

'use strict';

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

var Vue = require('vue');
var capitalize = require('lodash/capitalize');
var config = require('../config.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var Vue__default = /*#__PURE__*/_interopDefaultLegacy(Vue);
var capitalize__default = /*#__PURE__*/_interopDefaultLegacy(capitalize);

function withInstall(comp, dep) {
  const c = comp;
  const name = c?.options?.name || c.name;
  c.install = (Vue2, config$1) => {
    const installConfig = {
      prefix: config.PREFIX,
      ...config$1
    };
    const defaultPrefix = capitalize__default["default"](config.PREFIX);
    let componentName = name.replace(defaultPrefix, "").replace("-mapprops", "");
    componentName = capitalize__default["default"](installConfig.prefix) + componentName;
    Vue2.component(componentName, comp);
  };
  if (dep && Vue__default["default"] && !(Vue__default["default"]._installedPlugins || []).includes(dep)) Vue__default["default"].use(dep);
  return comp;
}

exports["default"] = withInstall;
exports.withInstall = withInstall;
//# sourceMappingURL=withInstall.js.map
