/**
 * ldesign v0.4.2
 * (c) 2023 ldesign
 * @license MIT
 */

import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
import _defineProperty from '@babel/runtime/helpers/defineProperty';
import { defineComponent, computed, createVNode } from 'vue';
import { usePrefixClass, useCommonClassName } from '../hooks/useConfig.js';
import { useContent, useTNodeJSX } from '../hooks/tnode.js';
import props from './props.js';
import { useConfig } from '../config-provider/useConfig.js';
import 'lodash/isFunction';
import 'lodash/camelCase';
import 'lodash/kebabCase';
import '../utils/render-tnode.js';
import 'lodash/isEmpty';
import 'lodash/isString';
import 'lodash/isObject';
import 'lodash/cloneDeep';
import '../config-provider/context.js';
import 'lodash/mergeWith';
import 'lodash/merge';
import 'lodash/isArray';
import '../_common/js/global-config/default-config.js';
import '../_common/js/global-config/locale/zh_CN.js';
import '@babel/runtime/helpers/typeof';
import '../_chunks/dep-2e5d8948.js';
import 'dayjs';
import '../_chunks/dep-4580aabe.js';
import '../config-provider/type.js';

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var _Link = defineComponent({
  name: "TLink",
  props: _objectSpread({}, props),
  emits: ["click"],
  setup: function setup(props2, _ref) {
    var emit = _ref.emit;
    var renderContent = useContent();
    var renderTNodeJSX = useTNodeJSX();
    var COMPONENT_NAME = usePrefixClass("link");
    var _useCommonClassName = useCommonClassName(),
      STATUS = _useCommonClassName.STATUS,
      SIZE = _useCommonClassName.SIZE;
    var _useConfig = useConfig("classPrefix"),
      classPrefix = _useConfig.classPrefix;
    var linkClass = computed(function () {
      var _ref2;
      return ["".concat(COMPONENT_NAME.value), "".concat(COMPONENT_NAME.value, "--theme-").concat(props2.theme), (_ref2 = {}, _defineProperty(_ref2, SIZE.value[props2.size], props2.size !== "medium"), _defineProperty(_ref2, STATUS.value.disabled, props2.disabled), _defineProperty(_ref2, "".concat(classPrefix.value, "-is-underline"), props2.underline), _defineProperty(_ref2, "".concat(COMPONENT_NAME.value, "--hover-").concat(props2.hover), !props2.disabled), _ref2)];
    });
    var handleClick = function handleClick(event) {
      if (!props2.disabled) emit("click", event);
    };
    return function () {
      var linkContent = renderContent("default", "content");
      var prefix = renderTNodeJSX("prefixIcon");
      var suffix = renderTNodeJSX("suffixIcon");
      return createVNode("a", {
        "class": _toConsumableArray(linkClass.value),
        "href": props2.disabled || !props2.href ? void 0 : props2.href,
        "target": props2.target,
        "onClick": handleClick
      }, [prefix ? createVNode("span", {
        "class": "".concat(COMPONENT_NAME.value, "__prefix-icon")
      }, [prefix]) : null, linkContent, suffix ? createVNode("span", {
        "class": "".concat(COMPONENT_NAME.value, "__suffix-icon")
      }, [suffix]) : null]);
    };
  }
});

export { _Link as default };
//# sourceMappingURL=link.js.map
