Liferay.Loader.define("portal-search-ranking-web@2.0.50/js/components/list/ItemDragLayer.es", ['module', 'exports', 'require', 'frontend-js-react-web$react', 'frontend-js-react-web$react-dnd', '../../utils/drag-types.es', './ItemDragPreview.es'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = void 0;

    var _react = _interopRequireDefault(require("frontend-js-react-web$react"));

    var _reactDnd = require("frontend-js-react-web$react-dnd");

    var _dragTypes = _interopRequireDefault(require("../../utils/drag-types.es"));

    var _ItemDragPreview = _interopRequireDefault(require("./ItemDragPreview.es"));

    function _interopRequireDefault(obj) {
      return obj && obj.__esModule ? obj : { default: obj };
    }

    /**
     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
     *
     * The contents of this file are subject to the terms of the Liferay Enterprise
     * Subscription License ("License"). You may not use this file except in
     * compliance with the License. You can obtain a copy of the License by
     * contacting Liferay, Inc. See the License for the specific language governing
     * permissions and limitations under the License, including but not limited to
     * distribution rights of the Software.
     */
    var LAYER_STYLES = {
      height: '100%',
      left: 0,
      pointerEvents: 'none',
      position: 'fixed',
      top: 0,
      width: '100%',
      zIndex: 100
    };
    var OFFSET_X = 8;
    var OFFSET_Y = 16;

    function getItemStyles(props) {
      var currentOffset = props.currentOffset,
          initialOffset = props.initialOffset;

      var _ref = currentOffset || {},
          x = _ref.x,
          y = _ref.y;

      var transform = "translate(".concat(x - OFFSET_X, "px, ").concat(y - OFFSET_Y, "px)");
      return !initialOffset || !currentOffset ? {
        display: 'none'
      } : {
        WebkitTransform: transform,
        transform: transform
      };
    }

    var ItemDragLayer = function ItemDragLayer(props) {
      var dragging = props.dragging,
          item = props.item,
          itemType = props.itemType;

      return dragging ? /*#__PURE__*/_react.default.createElement("div", {
        className: "drag-layer",
        style: LAYER_STYLES
      }, /*#__PURE__*/_react.default.createElement("div", {
        style: getItemStyles(props)
      }, function renderItem() {
        return itemType === _dragTypes.default.LIST_ITEM ? /*#__PURE__*/_react.default.createElement(_ItemDragPreview.default, item) : null;
      }())) : null;
    };

    var _default = (0, _reactDnd.DragLayer)(function (monitor) {
      return {
        currentOffset: monitor.getSourceClientOffset(),
        dragging: monitor.isDragging(),
        initialOffset: monitor.getInitialSourceClientOffset(),
        item: monitor.getItem(),
        itemType: monitor.getItemType()
      };
    })(ItemDragLayer);

    exports.default = _default;
    //# sourceMappingURL=ItemDragLayer.es.js.map
  }
});
//# sourceMappingURL=ItemDragLayer.es.js.map