/**
 * 编辑态选中图元旁的快捷操作：锁定 / 复制 / 删除（与侧栏同源逻辑）
 */
import React, { useCallback } from 'react';
import classNames from 'classnames';
import { Button, Popconfirm, Tooltip } from 'antd';
import { CopyOutlined, DeleteOutlined, LockOutlined, UnlockOutlined } from '@ant-design/icons';
var PREFIX = 'pisell-floor-map-layout';
export function FloorMapEditQuickActions(props) {
  var className = props.className,
    labels = props.labels,
    isLocked = props.isLocked,
    onToggleLock = props.onToggleLock,
    onDuplicate = props.onDuplicate,
    onDelete = props.onDelete,
    _props$viewportScale = props.viewportScale,
    viewportScale = _props$viewportScale === void 0 ? 1 : _props$viewportScale;
  var stopBubble = useCallback(function (e) {
    e.stopPropagation();
  }, []);
  var safeScale = Math.max(viewportScale, 0.01);
  var inv = 1 / safeScale;
  var gap = 10 / safeScale;
  return /*#__PURE__*/React.createElement("div", {
    role: "toolbar",
    "aria-label": labels.ariaToolbar,
    className: classNames("".concat(PREFIX, "-edit-quick-actions"), isLocked && "".concat(PREFIX, "-edit-quick-actions--locked"), className),
    style: {
      transform: "translate(-50%, ".concat(gap, "px) scale(").concat(inv, ")"),
      transformOrigin: 'top center'
    },
    onPointerDown: function onPointerDown(e) {
      return e.stopPropagation();
    }
  }, /*#__PURE__*/React.createElement(Tooltip, {
    title: isLocked ? labels.unlock : labels.lock
  }, /*#__PURE__*/React.createElement(Button, {
    type: "text",
    size: "large",
    icon: isLocked ? /*#__PURE__*/React.createElement(LockOutlined, null) : /*#__PURE__*/React.createElement(UnlockOutlined, null),
    onClick: function onClick(e) {
      stopBubble(e);
      onToggleLock();
    },
    "aria-pressed": isLocked
  })), /*#__PURE__*/React.createElement(Tooltip, {
    title: labels.duplicate
  }, /*#__PURE__*/React.createElement(Button, {
    type: "text",
    size: "large",
    icon: /*#__PURE__*/React.createElement(CopyOutlined, null),
    onClick: function onClick(e) {
      stopBubble(e);
      onDuplicate();
    }
  })), /*#__PURE__*/React.createElement(Popconfirm, {
    title: labels.popTitle,
    description: labels.popDesc,
    onConfirm: function onConfirm() {
      return onDelete();
    },
    okText: labels.okDelete,
    cancelText: labels.cancel,
    okButtonProps: {
      danger: true
    }
  }, /*#__PURE__*/React.createElement(Tooltip, {
    title: labels.delete
  }, /*#__PURE__*/React.createElement(Button, {
    type: "text",
    danger: true,
    size: "large",
    icon: /*#__PURE__*/React.createElement(DeleteOutlined, null),
    onClick: stopBubble
  }))));
}