{"version":3,"sources":["../../../src/components/ContentItem/index.js"],"names":["dayjs","extend","relativeTime","LOCALES","CommentItem","props","state","showInput","showPreviewer","previewerIndex","handleToggleInput","bind","renderTextWithReply","hidePreviewer","index","setState","text","content","newText","reply","user_name","commentId","replyId","action","showReply","onShowReply","app","locale","newContent","images","indexOf","IMAGE_SPLIT","split","pop","join","imageList","needClear","length","imgs","splice","type","IconColor","favor_count","backgroundImage","user_avatar","avatar","intl","get","marginLeft","created","format","fromNow","__html","map","item","i","reply_count","total","userId","user_id","sDeleteReply","id","sDeleteComment","sReplyFavor","favored","sCommentFavor","color","children","Component","propTypes","PropTypes","object","isRequired","oneOf","func","defaultProps"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;AACA;;;;AAEA;;;;AACA;;AAEA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;AATA;;;AAWA;AACAA,gBAAMC,MAAN,CAAaC,sBAAb;;AAEA,IAAMC,UAAU;AACd,WAAS;AADK,CAAhB;;IAIMC,W;;;AACJ,uBAAYC,KAAZ,EAAmB;AAAA;;AAAA,0HACXA,KADW;;AAEjB,UAAKC,KAAL,GAAa;AACXC,iBAAW,KADA;AAEXC,qBAAe,KAFJ;AAGXC,sBAAgB;AAHL,KAAb;AAKA,UAAKC,iBAAL,GAAyB,MAAKA,iBAAL,CAAuBC,IAAvB,OAAzB;AACA,UAAKC,mBAAL,GAA2B,MAAKA,mBAAL,CAAyBD,IAAzB,OAA3B;AACA,UAAKH,aAAL,GAAqB,MAAKA,aAAL,CAAmBG,IAAnB,OAArB;AACA,UAAKE,aAAL,GAAqB,MAAKA,aAAL,CAAmBF,IAAnB,OAArB;AAViB;AAWlB;;;;kCAEaG,K,EAAO;AACnB,WAAKC,QAAL,CAAc;AACZP,uBAAe,IADH;AAEZC,wBAAgBK;AAFJ,OAAd;AAID;;;oCAEe;AACd,WAAKC,QAAL,CAAc;AACZP,uBAAe;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AAO,EAAEE,YAAUzB,SAAZ;AAPT,gBAZF;AAAA;AAqBSxB,sBAAQyB;AArBjB;AAnCF;AA7EF,SAVF;AAoJGnC,qBACC,8BAAC,sBAAD;AACE,mBAASmB,IAAIyC,QADf;AAEE,kBAAQ5C,MAFV;AAGE,mBAASD,OAHX;AAIE,qBAAWD,SAJb;AAKE,kBAAQJ,QAAQ0C,OALlB;AAME,oBAAU,KAAKjD;AANjB;AArJJ,OADF;AAiKD;;;;EA7PuB0D,gB;;AAgQ1BhE,YAAYiE,SAAZ,GAAwB;AACtBpD,WAASqD,oBAAUC,MAAV,CAAiBC,UADJ;AAEtB;AACA;AACA;AACAjD,UAAQ+C,oBAAUG,KAAV,CAAgB,CAAC,SAAD,EAAY,OAAZ,EAAqB,cAArB,CAAhB,CALc;AAMtBhD,eAAa6C,oBAAUI;AAND,CAAxB;;AASAtE,YAAYuE,YAAZ,GAA2B;AACzBpD,UAAQ,SADiB;AAEzBE,eAAa,uBAAM,CAAE;AAFI,CAA3B;;kBAKe,uBAAQrB,WAAR,C","file":"index.js","sourcesContent":["import React, { Component } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { Avatar, Icon, Tooltip, Popconfirm } from \"antd\";\nimport dayjs from \"dayjs\";\nimport \"dayjs/locale/zh-cn\";\n// import 'dayjs/locale/es';\nimport relativeTime from \"dayjs/plugin/relativeTime\";\nimport intl from \"react-intl-universal\";\nimport Comment from \"../../Comment\";\nimport CommentInput from \"../CommentInput\";\nimport avatar from \"../../avatar\";\nimport { renderContent } from \"../../helper\";\nimport { IMAGE_SPLIT } from \"../../constant\";\nimport \"./index.css\";\nimport ImagePreviewer from \"../ImagePreviewer/ImagePreviewer\";\n\n// dayjs.locale(\"zh-cn\");\ndayjs.extend(relativeTime);\n\nconst LOCALES = {\n \"zh-CN\": \"zh-cn\"\n};\n\nclass CommentItem extends Component {\n constructor(props) {\n super(props);\n this.state = {\n showInput: false,\n showPreviewer: false,\n previewerIndex: 0\n };\n this.handleToggleInput = this.handleToggleInput.bind(this);\n this.renderTextWithReply = this.renderTextWithReply.bind(this);\n this.showPreviewer = this.showPreviewer.bind(this);\n this.hidePreviewer = this.hidePreviewer.bind(this);\n }\n\n showPreviewer(index) {\n this.setState({\n showPreviewer: true,\n previewerIndex: index\n });\n }\n\n hidePreviewer() {\n this.setState({\n showPreviewer: false\n });\n }\n\n handleToggleInput() {\n this.setState({ showInput: !this.state.showInput });\n }\n\n renderTextWithReply(text, content) {\n let newText = text;\n const { reply } = content;\n if (reply) {\n // newText = `${newText} //@${\n // reply.user_name\n // } ${reply.content}`;\n newText = `${newText} //@${reply.user_name} ${reply.content}`;\n // newText = (\n // \n // {newText}\n // @{reply.user_name}{reply.content}\n // \n // )\n if (reply.reply) {\n return this.renderTextWithReply(newText, reply);\n }\n }\n return newText;\n }\n\n render() {\n const {\n commentId,\n replyId,\n content,\n action,\n showReply,\n onShowReply,\n app\n } = this.props;\n\n const { locale } = this.props.app;\n const { showInput } = this.state;\n\n let newContent = content.content;\n let images = \"\";\n if (newContent.indexOf(IMAGE_SPLIT) !== -1) {\n newContent = newContent.split(IMAGE_SPLIT);\n images = newContent.pop();\n newContent = newContent.join(\"\");\n }\n\n const imageList = images.split(\",\");\n\n // 在3, 7前需要换行\n const needClear =\n imageList.length === 5 ||\n imageList.length === 6 ||\n imageList.length === 9;\n const imgs = [...imageList];\n if (needClear) {\n if (imgs.length > 6) {\n imgs.splice(3, 0, { type: \"divider\" });\n imgs.splice(7, 0, { type: \"divider\" });\n } else {\n imgs.splice(3, 0, { type: \"divider\" });\n }\n }\n const IconColor = content.favor_count > 0 ? \"#71C135\" : \"#4a90e2\";\n\n return (\n