"use strict";var stringUtil=require("./stringUtil-0d797e21.js"),React=require("react"),classNames=require("classnames"),MapEditView=require("./MapEditView-b37f9adc.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 n=Object.create(null);return a&&Object.keys(a).forEach(function(e){var t;"default"!==e&&(t=Object.getOwnPropertyDescriptor(a,e),Object.defineProperty(n,e,t.get?t:{enumerable:!0,get:function(){return a[e]}}))}),n.default=a,Object.freeze(n)}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,n=e.alias,p=e.isCurrent,u=e.type,c=e.deleteTitle,r=e.onDelete,m=e.onClick,l=e.onChangeText,i=e.provided,e=e.onEdit,s=reactUse.useToggle(!1),o=s[0],_=s[1];return React__namespace.createElement("div",{style:{marginBottom:4},className:classNames__default.default(prefixCls,((s={})[prefixCls+"-current"]=p,s))},React__namespace.createElement("div",{className:prefixCls+"-main",onClick:m},i&&React__namespace.createElement(stringUtil.IconButton,stringUtil.__assign({className: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:prefixCls+"-type-icon"}),!o&&React__namespace.createElement(stringUtil.Tooltip,{title:a,placement:"right",mouseEnterDelay:0,mouseLeaveDelay:0},React__namespace.createElement("div",{className:prefixCls+"-text",onDoubleClick:function(){l&&_(!0)}},n||a)),o&&l&&React__namespace.createElement(stringUtil.Input,{className:prefixCls+"-text-input",autoFocus:!0,allowClear:!1,defaultValue:n||a,onBlur:t,onPressEnter:t})),e&&React__namespace.createElement(stringUtil.IconButton,{icon:"edit",type:"only-icon",onClick:e}),c?React__namespace.createElement(stringUtil.Tooltip,{title:c,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;
