"use strict";var stringUtil=require("./stringUtil-b879c63f.js"),React=require("react"),classNames=require("classnames"),MapEditView=require("./MapEditView-4ec15666.js"),reactUse=require("react-use");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function _interopNamespace(a){if(a&&a.__esModule)return a;var c=Object.create(null);return a&&Object.keys(a).forEach(function(e){var t;"default"!==e&&(t=Object.getOwnPropertyDescriptor(a,e),Object.defineProperty(c,e,t.get?t:{enumerable:!0,get:function(){return a[e]}}))}),c.default=a,Object.freeze(c)}var React__namespace=_interopNamespace(React),classNames__default=_interopDefaultLegacy(classNames),prefixCls="dm-map-package-wrapper",PackageWrapper=React__namespace.memo(function(e){function t(e){e=null===(e=e.target)||void 0===e?void 0:e.value,l&&l(e),_(!1)}var a=e.text,c=e.alias,p=e.isCurrent,u=e.type,n=e.deleteTitle,r=e.onDelete,m=e.onClick,l=e.onChangeText,i=e.provided,e=e.onEdit,s=stringUtil.__read(reactUse.useToggle(!1),2),o=s[0],_=s[1];return React__namespace.createElement("div",{style:{marginBottom:4},className:classNames__default.default(prefixCls,((s={})["".concat(prefixCls,"-current")]=p,s))},React__namespace.createElement("div",{className:"".concat(prefixCls,"-main"),onClick:m},i&&React__namespace.createElement(stringUtil.IconButton,stringUtil.__assign({className:"".concat(prefixCls,"-drag-handle"),icon:"drag-handle",type:"only-icon"},null==i?void 0:i.dragHandleProps)),React__namespace.createElement(MapEditView.GeoTypeIcon,{type:u,size:12,className:"".concat(prefixCls,"-type-icon")}),!o&&React__namespace.createElement(stringUtil.Tooltip,{title:a,placement:"right",mouseEnterDelay:0,mouseLeaveDelay:0},React__namespace.createElement("div",{className:"".concat(prefixCls,"-text"),onDoubleClick:function(){l&&_(!0)}},c||a)),o&&l&&React__namespace.createElement(stringUtil.Input,{className:"".concat(prefixCls,"-text-input"),autoFocus:!0,allowClear:!1,defaultValue:c||a,onBlur:t,onPressEnter:t})),e&&React__namespace.createElement(stringUtil.IconButton,{icon:"edit",type:"only-icon",onClick:e}),n?React__namespace.createElement(stringUtil.Tooltip,{title:n,placement:"right",mouseEnterDelay:0,mouseLeaveDelay:0},React__namespace.createElement(stringUtil.IconButton,{icon:"close",type:"only-icon",onClick:r})):React__namespace.createElement(stringUtil.IconButton,{icon:"close",type:"only-icon",onClick:r}))});PackageWrapper.whyDidYouRender=!0,PackageWrapper.displayName="PackageWrapper",exports.PackageWrapper=PackageWrapper;
