/**
 * tdesign v0.46.4
 * (c) 2022 tdesign
 * @license MIT
 */

import _defineProperty from '@babel/runtime/helpers/defineProperty';
import { FileCopyIcon } from 'tdesign-icons-vue';
import copyText from '../utils/clipboard.js';
import { MessagePlugin } from '../message/plugin.js';
import props from './anchor-target-props.js';
import { Popup } from '../popup/index.js';
import mixins from '../utils/mixins.js';
import getConfigReceiverMixins, { getGlobalIconMixins } from '../config-provider/config-receiver.js';
import 'clipboard';
import '@babel/runtime/helpers/typeof';
import 'vue';
import '../message/messageList.js';
import '../message/const.js';
import '../message/message.js';
import '../loading/index.js';
import '../loading/loading.js';
import '../loading/icon/gradient.js';
import '../_common/js/loading/circle-adapter.js';
import '../_common/js/utils/set-style.js';
import '../_common/js/utils/helper.js';
import '@babel/runtime/helpers/toConsumableArray';
import '@babel/runtime/helpers/objectWithoutProperties';
import '@babel/runtime/helpers/slicedToArray';
import '../utils/dom.js';
import 'raf';
import 'lodash/isString';
import '../utils/easing.js';
import '../utils/render-tnode.js';
import 'lodash/camelCase';
import 'lodash/kebabCase';
import '../utils/transfer-dom.js';
import '../loading/props.js';
import '../utils/withInstall.js';
import 'lodash/capitalize';
import './style/index.js';
import '../loading/type.js';
import '../loading/plugin.js';
import '../config.js';
import 'lodash/mergeWith';
import '../config-provider/context.js';
import 'lodash/merge';
import '../_common/js/global-config/default-config.js';
import '../_common/js/global-config/locale/zh_CN.js';
import '../config-provider/type.js';
import '../message/props.js';
import '../message/animation.js';
import '../popup/popup.js';
import '@popperjs/core';
import '../utils/helper.js';
import '../popup/props.js';
import '../popup/container.js';
import '../utils/map-props.js';
import '../popup/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 _AnchorTarget = mixins(getConfigReceiverMixins("anchor"), getGlobalIconMixins()).extend({
  name: "TAnchorTarget",
  props: _objectSpread({}, props),
  methods: {
    copyText: function copyText$1() {
      var a = document.createElement("a");
      a.href = "#".concat(this.id);

      copyText(a.href);

      MessagePlugin.success(this.global.copySuccessText, 1e3);
    }
  },
  render: function render() {
    var h = arguments[0];
    var Tag = this.tag,
        children = this.$scopedSlots["default"],
        id = this.id;

    var _this$useGlobalIcon = this.useGlobalIcon({
      FileCopyIcon: FileCopyIcon
    }),
        FileCopyIcon$1 = _this$useGlobalIcon.FileCopyIcon;

    var className = ["".concat(this.componentName, "__target")];
    var iconClassName = "".concat(this.componentName, "__copy");
    return h(Tag, {
      "attrs": {
        "id": id
      },
      "class": className
    }, [children && children(null), h(Popup, {
      "attrs": {
        "content": this.global.copyText,
        "placement": "top",
        "showArrow": true
      },
      "class": iconClassName
    }, [h(FileCopyIcon$1, {
      "nativeOn": {
        "click": this.copyText
      }
    })])]);
  }
});

export { _AnchorTarget as default };
//# sourceMappingURL=anchor-target.js.map
