import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
import React, { useState } from "react";
import { QuestionOutlined } from '@fishx/icons';
import { useDrag } from 'react-dnd';
import config from "../../../config/helpConfig";
var helpPoint = config.helpPoint;

var HelpSetting = function HelpSetting(props) {
  var href = props.href;

  var _useState = useState({}),
      _useState2 = _slicedToArray(_useState, 2),
      helpStyle = _useState2[0],
      setHelpStyle = _useState2[1];

  var _useDrag = useDrag({
    item: {
      type: 'HelpSetting'
    },
    end: function end(item, monitor) {
      var _window, _window$event, _window2, _window2$event;

      var left = (_window = window) === null || _window === void 0 ? void 0 : (_window$event = _window.event) === null || _window$event === void 0 ? void 0 : _window$event.clientX;
      var top = (_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$event = _window2.event) === null || _window2$event === void 0 ? void 0 : _window2$event.clientY;
      setHelpStyle({
        position: 'fixed',
        left: left,
        top: top
      });
    }
  }),
      _useDrag2 = _slicedToArray(_useDrag, 2),
      drager = _useDrag2[1];

  return /*#__PURE__*/React.createElement("a", {
    ref: drager,
    target: "_blank",
    rel: "noreferrer",
    href: href || helpPoint,
    className: "frombuilder-setting-help",
    style: helpStyle
  }, /*#__PURE__*/React.createElement(QuestionOutlined, null));
};

export default HelpSetting;
//# sourceMappingURL=Help.js.map