(window.webpackJsonp=window.webpackJsonp||[]).push([[34],{"./api-dev/components/api/api-context-bar/APIInfoContextBarView/APIInfoContextBarView.js":function(e,t,n){"use strict";n.r(t),function(e){n.d(t,"default",(function(){return v}));var i,a=n("../../node_modules/react/index.js"),o=n.n(a),s=n("../../node_modules/mobx-react/dist/mobx-react.module.js"),c=n("./appsdk/contextbar/ContextBarViewHeader.js"),r=n("./js/utils/ClipboardHelper.js"),d=n("./js/components/base/Buttons.js"),l=n("../../node_modules/@postman/aether/esmLib/index.js"),m=n("./node_modules/moment/moment.js"),p=n.n(m),_=n("./api-dev/components/common/UserProfile/UserProfile.js"),f=n("./api-dev/components/common/APIOffline/APIOffline.js");function y(){return y=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},y.apply(this,arguments)}let v=Object(s.observer)(i=class extends a.Component{constructor(e){super(e),this.state={entityIdCopied:{id:!1,versionId:!1,schemaId:!1}},this.handleCopyToClipboard=this.handleCopyToClipboard.bind(this)}componentWillUnmount(){clearTimeout(this.copiedTimeout)}handleCopyToClipboard(t){e.get(this.state.entityIdCopied,t)||(r.default.copy(e.get(this.props.contextData,t,"")),this.setState((e=>({entityIdCopied:y({},e.entityIdCopied,{[t]:!0})})),(()=>{this.copiedTimeout=setTimeout((()=>this.setState((e=>({entityIdCopied:y({},e.entityIdCopied,{[t]:!1})})))),3e3)})))}render(){const t=e.get(this.props,"contextData.model",{}),n=p()(t.createdAt).format("DD MMM YYYY, h:mm A");return o.a.createElement("div",{className:"api-info-context-view-wrapper"},o.a.createElement(c.ContextBarViewHeader,{title:"API 详情",onClose:this.props.onClose}),t.isOffline?o.a.createElement(f.default,{origin:"context-bar"}):o.a.createElement("div",{className:"api-info-context-view"},o.a.createElement("div",{className:"api-info-context-view__entity"},o.a.createElement("div",{className:"api-info-context-view__entity__label"},"ID"),o.a.createElement("div",{className:"api-info-context-view__entity__content"},o.a.createElement("div",{className:"api-info-context-view__entity__content__id--entity",title:t.id},t.id),o.a.createElement(d.Button,{tooltip:"拷贝",type:"icon",onClick:()=>this.handleCopyToClipboard("id")},e.get(this.state.entityIdCopied,"id")?o.a.createElement(l.Icon,{name:"icon-state-success-stroke",className:"pm-icon pm-icon-normal success-tick-icon"}):o.a.createElement(l.Icon,{name:"icon-action-copy-stroke",className:"pm-icon pm-icon-normal"})))),o.a.createElement("div",{className:"api-info-context-view__entity"},o.a.createElement("div",{className:"api-info-context-view__entity__label"},"创建者"),o.a.createElement("div",{className:"api-info-context-view__entity__content"},e.get(t,"createdBy.id")?o.a.createElement(_.default,{id:e.get(t,"createdBy.id"),name:e.get(t,"createdBy.name"),username:e.get(t,"createdBy.username"),profileLink:e.get(t,"createdBy.profileLink"),isAccessible:e.get(t,"createdBy.isAccessible")}):"无效的用户")),o.a.createElement("div",{className:"api-info-context-view__entity"},o.a.createElement("div",{className:"api-info-context-view__entity__label"},"创建于"),o.a.createElement("div",{className:"api-info-context-view__entity__content"},o.a.createElement("div",{className:"api-info-context-view__entity__content__id",title:n},n)))))}})||i}.call(this,n("./node_modules/lodash/lodash.js"))}}]);