"use strict";var React=require("react"),classNames=require("classnames"),stringUtil=require("./stringUtil-1ce2e674.js"),mobxReact=require("mobx-react"),MapEditView=require("./MapEditView-677fbbe0.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$1="dm-map-visual-card-simple-eye",SimpleEye=mobxReact.observer(function(e){var t=e.className,t=void 0===t?"":t,a=e.onClick,e=e.visible,c=React__namespace.useContext(MapEditView.appContext.getContext()).routeStore.customerIcons,s=(null==c?void 0:c.showIcon)||"visibility-on",c=(null==c?void 0:c.hideIcon)||"visibility-off";return React__namespace.createElement("div",{className:classNames__default.default(t+" "+prefixCls$1,((t={})[prefixCls$1+"-disable"]=!e,t)),onClick:a},e?React__namespace.createElement(stringUtil.Icon$1,{icon:s,size:16}):React__namespace.createElement(stringUtil.Icon$1,{icon:c,size:16}))}),prefixCls=(SimpleEye.whyDidYouRender=!0,SimpleEye.displayName="SimpleEye","dm-map-visual-list-item"),useRef=React__namespace.useRef,useState=React__namespace.useState,MapVisualListItem=React__namespace.memo(function(e){var e=e||{},t=e.text,a=e.onSelect,c=e.onDelete,s=e.setName,e=e.isSimpleCardsMode,i=useState(!1),n=i[0],l=i[1],r=useRef(),u=useRef(null);reactUse.useClickAway(u,function(){l(!1)});return React__namespace.useEffect(function(){var e;n&&null!==(e=null===(e=u.current)||void 0===e?void 0:e.querySelector("input"))&&void 0!==e&&e.select()},[n]),React__namespace.createElement(React__namespace.Fragment,null,React__namespace.createElement("div",{className:classNames__default.default(prefixCls+"-border",((i={})[prefixCls+"-border-detail"]=!e,i))}),React__namespace.createElement("div",{className:prefixCls,ref:u},React__namespace.createElement("div",{className:classNames__default.default(prefixCls+"-text",((i={})[prefixCls+"-text-detail"]=!e,i))},n?React__namespace.createElement(stringUtil.Input,{allowClear:!1,className:prefixCls+"-input",type:"menu-bg",placeholder:t,autoFocus:!0,defaultValue:t,onPressEnter:function(e){e=e.target.value;l(!1),s&&s(e)},onBlur:function(e){e=e.target.value;l(!1),s&&s(e)}}):React__namespace.createElement("div",{className:prefixCls+"-name",onClick:function(){r.current&&clearTimeout(r.current),r.current=window.setTimeout(function(){a&&a()},300)},onDoubleClick:function(){r.current&&clearTimeout(r.current),l(!0)}},t),c&&React__namespace.createElement(stringUtil.IconButton,{className:prefixCls+"-delete-icon",icon:"close",type:"only-icon",onClick:c}))))});exports.MapVisualListItem=MapVisualListItem,exports.SimpleEye=SimpleEye;
