Liferay.Loader.define("dynamic-data-mapping-form-field-type@6.0.145/Options/DnD.es",["module","exports","require","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$react","liferay!frontend-js-react-web$react-dnd","liferay!frontend-js-react-web$react-dnd-html5-backend"],(function(e,r,t){window;{Object.defineProperty(r,"__esModule",{value:!0}),r.default=function DnD({children:r,index:t,onDragEnd:c=(()=>{}),option:d}){const[{isDragging:f},l,u]=(0,o.useDrag)({collect:e=>({isDragging:e.isDragging()}),end:(e,r)=>{const t=r.getDropResult();e&&t&&c(t)},item:{option:d,position:t,type:e.OPTION}}),[{canDrop:s,isOver:p},g]=(0,o.useDrop)({accept:e.OPTION,collect:e=>({canDrop:e.canDrop(),isOver:e.isOver()}),drop:e=>({itemPosition:e.position,targetPosition:t})});return(0,a.useEffect)((()=>{u((0,i.getEmptyImage)(),{captureDraggingState:!0})}),[u]),a.default.createElement(a.default.Fragment,null,a.default.createElement("div",{className:(0,n.default)("ddm-options-target",{targetOver:p&&s}),ref:g}),a.default.cloneElement(r,_objectSpread(_objectSpread({},r.props),{},{className:{"dragged ddm-source-dragging":f},ref:l})))},r.OPTIONS_TYPES=void 0;var n=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(t("liferay!frontend-js-react-web$classnames")),a=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=_getRequireWildcardCache();if(r&&r.has(e))return r.get(e);var t={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var o=n?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(t,a,o):t[a]=e[a]}t.default=e,r&&r.set(e,t);return t}(t("liferay!frontend-js-react-web$react")),o=t("liferay!frontend-js-react-web$react-dnd"),i=t("liferay!frontend-js-react-web$react-dnd-html5-backend");function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach((function(r){_defineProperty(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function _defineProperty(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}const e={OPTION:"option"};r.OPTIONS_TYPES=e}}));
//# sourceMappingURL=DnD.es.js.map