import { defineComponent, ref, resolveComponent, openBlock, createBlock, mergeProps, withCtx, createVNode, renderSlot } from 'vue';

var _sfc_main = /* @__PURE__ */ defineComponent({
  ...{
    name: "FButton"
  },
  __name: "index",
  props: {
    time: { default: 1e3 },
    tip: { default: "" },
    placement: { default: "top" },
    tipProps: { default: () => ({}) },
    isDebounce: { type: Boolean, default: true }
  },
  emits: ["click"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emits = __emit;
    const record = ref(0);
    const handleClick = () => {
      if (!props.isDebounce) return emits("click");
      const newTime = /* @__PURE__ */ new Date();
      if (newTime.getTime() - record.value > props.time) {
        emits("click");
      }
      record.value = newTime.getTime();
    };
    return (_ctx, _cache) => {
      const _component_el_button = resolveComponent("el-button");
      const _component_el_tooltip = resolveComponent("el-tooltip");
      return __props.tip ? (openBlock(), createBlock(_component_el_tooltip, mergeProps({
        key: 0,
        content: __props.tip,
        placement: __props.placement
      }, __props.tipProps), {
        default: withCtx(() => [
          createVNode(
            _component_el_button,
            mergeProps(_ctx.$attrs, {
              class: "f-button-tip",
              onClick: handleClick
            }),
            {
              default: withCtx(() => [
                renderSlot(_ctx.$slots, "default")
              ]),
              _: 3
              /* FORWARDED */
            },
            16
            /* FULL_PROPS */
          )
        ]),
        _: 3
        /* FORWARDED */
      }, 16, ["content", "placement"])) : (openBlock(), createBlock(
        _component_el_button,
        mergeProps({ key: 1 }, _ctx.$attrs, { onClick: handleClick }),
        {
          default: withCtx(() => [
            renderSlot(_ctx.$slots, "default")
          ]),
          _: 3
          /* FORWARDED */
        },
        16
        /* FULL_PROPS */
      ));
    };
  }
});

export { _sfc_main as default };
