airdcpp-webui
Version:
2 lines • 10.7 kB
JavaScript
;(self.webpackChunkairdcpp_webui=self.webpackChunkairdcpp_webui||[]).push([[381],{59089:(e,t,s)=>{s.d(t,{A:()=>a});var n=s(71354),o=s.n(n),i=s(76314),r=s.n(i)()(o());r.push([e.id,".message-section {\n flex: 1;\n overflow-y: auto;\n}\n\n.message-list .date.divider i {\n margin-right: 5px;\n}\n\n.message-list .item .text .highlight.link {\n color: #4183c4;\n}\n\n.message-list .item .text .highlight.bold {\n font-weight: bold;\n}\n\n.message-list .item .text .table.dropdown,\n.message-list .item .text .table.dropdown .popup.trigger {\n max-width: 100%;\n}\n\n.message-list .item .text .table.dropdown .caption {\n overflow: hidden;\n}\n","",{version:3,sources:["webpack://./src/components/messages/messages.css"],names:[],mappings:"AAAA;EACE,OAAO;EACP,gBAAgB;AAClB;;AAEA;EACE,iBAAiB;AACnB;;AAEA;EACE,cAAc;AAChB;;AAEA;EACE,iBAAiB;AACnB;;AAEA;;EAEE,eAAe;AACjB;;AAEA;EACE,gBAAgB;AAClB",sourcesContent:[".message-section {\n flex: 1;\n overflow-y: auto;\n}\n\n.message-list .date.divider i {\n margin-right: 5px;\n}\n\n.message-list .item .text .highlight.link {\n color: #4183c4;\n}\n\n.message-list .item .text .highlight.bold {\n font-weight: bold;\n}\n\n.message-list .item .text .table.dropdown,\n.message-list .item .text .table.dropdown .popup.trigger {\n max-width: 100%;\n}\n\n.message-list .item .text .table.dropdown .caption {\n overflow: hidden;\n}\n"],sourceRoot:""}]);const a=r},91381:(e,t,s)=>{s.d(t,{A:()=>ee});var n=s(74848),o=s(96540),i=s(46942),r=s.n(i),a=s(99347),l=s(68443),h=s(71987),d=Object.defineProperty,c=(e,t,s)=>((e,t,s)=>t in e?d(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s),g=new Map,m=new WeakMap,p=0;function u(e,t,s={},n=undefined){if(void 0===window.IntersectionObserver&&void 0!==n){const o=e.getBoundingClientRect();return t(n,{isIntersecting:n,target:e,intersectionRatio:"number"==typeof s.threshold?s.threshold:0,time:0,boundingClientRect:o,intersectionRect:o,rootBounds:o}),()=>{}}const{id:o,observer:i,elements:r}=function(e){const t=function(e){return Object.keys(e).sort().filter(t=>void 0!==e[t]).map(t=>{return`${t}_${"root"===t?(s=e.root,s?(m.has(s)||(p+=1,m.set(s,p.toString())),m.get(s)):"0"):e[t]}`;var s}).toString()}(e);let s=g.get(t);if(!s){const n=new Map;let o;const i=new IntersectionObserver(t=>{t.forEach(t=>{var s;const i=t.isIntersecting&&o.some(e=>t.intersectionRatio>=e);e.trackVisibility&&void 0===t.isVisible&&(t.isVisible=i),null==(s=n.get(t.target))||s.forEach(e=>{e(i,t)})})},e);o=i.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),s={id:t,observer:i,elements:n},g.set(t,s)}return s}(s),a=r.get(e)||[];return r.has(e)||r.set(e,a),a.push(t),i.observe(e),function(){a.splice(a.indexOf(t),1),0===a.length&&(r.delete(e),i.unobserve(e)),0===r.size&&(i.disconnect(),g.delete(o))}}var b=class extends o.Component{constructor(e){super(e),c(this,"node",null),c(this,"_unobserveCb",null),c(this,"handleNode",e=>{this.node&&(this.unobserve(),e||this.props.triggerOnce||this.props.skip||this.setState({inView:!!this.props.initialInView,entry:void 0})),this.node=e||null,this.observeNode()}),c(this,"handleChange",(e,t)=>{e&&this.props.triggerOnce&&this.unobserve(),function(e){return"function"!=typeof e.children}(this.props)||this.setState({inView:e,entry:t}),this.props.onChange&&this.props.onChange(e,t)}),this.state={inView:!!e.initialInView,entry:void 0}}componentDidMount(){this.unobserve(),this.observeNode()}componentDidUpdate(e){e.rootMargin===this.props.rootMargin&&e.root===this.props.root&&e.threshold===this.props.threshold&&e.skip===this.props.skip&&e.trackVisibility===this.props.trackVisibility&&e.delay===this.props.delay||(this.unobserve(),this.observeNode())}componentWillUnmount(){this.unobserve()}observeNode(){if(!this.node||this.props.skip)return;const{threshold:e,root:t,rootMargin:s,trackVisibility:n,delay:o,fallbackInView:i}=this.props;this._unobserveCb=u(this.node,this.handleChange,{threshold:e,root:t,rootMargin:s,trackVisibility:n,delay:o},i)}unobserve(){this._unobserveCb&&(this._unobserveCb(),this._unobserveCb=null)}render(){const{children:e}=this.props;if("function"==typeof e){const{inView:t,entry:s}=this.state;return e({inView:t,entry:s,ref:this.handleNode})}const{as:t,triggerOnce:s,threshold:n,root:i,rootMargin:r,onChange:a,skip:l,trackVisibility:h,delay:d,initialInView:c,fallbackInView:g,...m}=this.props;return o.createElement(t||"div",{ref:this.handleNode,...m},e)}},f=s(71352),y=s(39115),A=s(74416);const v=({time:e})=>{const{formatTimestamp:t}=(0,A.k)();return(0,n.jsx)("div",{className:"time",children:t(e)})};var w=s(28122);const x=e=>{var{emojify:t,message:s,user:o,label:i,highlightMenuProps:r}=e,a=function(e,t){var s={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(s[n[o]]=e[n[o]])}return s}(e,["emojify","message","user","label","highlightMenuProps"]);return(0,n.jsxs)("div",{className:"text",children:[!!i&&(0,n.jsx)("span",{className:"label",children:`${i}: `}),(0,n.jsx)(w.z,Object.assign({emojify:t,text:s.text,highlights:s.highlights,user:o,menuProps:r},a))]})};const O=({message:e,dropdownContext:t})=>(0,n.jsxs)("div",{className:"header author",children:[e.third_person&&(0,n.jsx)("span",{children:"*"}),(0,n.jsx)(f.Bg,{contextElement:t,triggerIcon:null,user:e.from,remoteMenuId:y.Ay.HUB_USER,entity:e.from.hub_session_id})]});class j extends o.Component{shouldComponentUpdate(){return!1}render(){const e=this.props,{message:t,dropdownContext:s,highlightMenuProps:o}=e,i=function(e,t){var s={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(s[n[o]]=e[n[o]])}return s}(e,["message","dropdownContext","highlightMenuProps"]);return(0,n.jsxs)(b,Object.assign({className:r()("ui item chat",t.from.flags.join(" "))},i,{children:[(0,n.jsx)(v,{time:t.time}),(0,n.jsxs)("div",{className:r()("left",t.third_person?"third-person":"normal"),children:[(0,n.jsx)(O,{message:t,dropdownContext:s}),(0,n.jsx)(x,{message:t,emojify:!0,user:t.from,highlightMenuProps:o})]})]}))}}var C=s(83994),E=s(4425),I=s(86038);const M=e=>{switch(e){case I.F$.VERBOSE:return E.A.VERBOSE;case I.F$.INFO:return E.A.INFO+" circle";case I.F$.WARNING:return E.A.WARNING;case I.F$.ERROR:return E.A.ERROR;default:return""}};class P extends o.Component{shouldComponentUpdate(){return!1}render(){const e=this.props,{message:t,highlightMenuProps:s}=e,o=function(e,t){var s={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(s[n[o]]=e[n[o]])}return s}(e,["message","highlightMenuProps"]);return(0,n.jsxs)(b,Object.assign({className:r()("ui item status",t.severity,t.type)},o,{children:[(0,n.jsx)(C.A,{icon:M(t.severity)}),t.time>0&&(0,n.jsx)(v,{time:t.time}),(0,n.jsx)(x,{label:t.label,message:t,emojify:!1,highlightMenuProps:s})]}))}}const N=e=>{var{message:t}=e,s=function(e,t){var s={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(s[n[o]]=e[n[o]])}return s}(e,["message"]);return t.chat_message?(0,n.jsx)(j,Object.assign({message:t.chat_message,dropdownContext:s.highlightMenuProps.boundary},s)):t.log_message?(0,n.jsx)(P,Object.assign({message:t.log_message},s)):null},_=e=>{const t=e.chat_message?e.chat_message:e.log_message;return t&&new Date(1e3*t.time).getDate()},k=e=>!!e.log_message&&e.log_message.type===I.Lu.HISTORY,S=({time:e})=>{const{formatCalendarTime:t}=(0,A.k)();return(0,n.jsxs)("div",{className:"ui horizontal date divider",children:[(0,n.jsx)(C.A,{icon:E.A.DATE}),t(e)]},`divider${e}`)};var R=s(25507);const V=({entity:e,onMessageVisibilityChanged:t,addDownload:s,highlightRemoteMenuId:o,scrollable:i,instanceId:r},a,l,d,c)=>{if(((e,t)=>{const s=t[e];return 0===e||1===e&&k(t[e-1])?_(s)!==(new Date).getDate()&&!k(s):_(t[e-1])!==_(s)})(d,c)){const e=l.chat_message?l.chat_message:l.log_message;e&&a.push((0,n.jsx)(S,{time:e.time},`divider${e.id}`))}const g=(0,h.Lw)(l);return a.push((0,n.jsx)(N,{id:(0,h.AS)(g,r),onChange:e=>{t(g,e)},threshold:.4,root:i,message:l,highlightMenuProps:{addDownload:s,entity:e,remoteMenuId:o,boundary:".message-section"}},g)),a};var B=s(42695),D=s(88544),$=s(67749),F=s(85072),T=s.n(F),G=s(97825),H=s.n(G),U=s(77659),W=s.n(U),z=s(55056),L=s.n(z),K=s(10540),Y=s.n(K),q=s(41113),J=s.n(q),Q=s(59089),X={};X.styleTagTransform=J(),X.setAttributes=L(),X.insert=W().bind(null,"head"),X.domAPI=H(),X.insertStyleElement=Y(),T()(Q.A,X),Q.A&&Q.A.locals&&Q.A.locals;const Z=o.memo(function({className:e,t,messages:s,chatSession:i,highlightRemoteMenuId:h,scrollPositionHandler:d}){const[c,g]=o.useState(null),m=(p=i,(0,o.useMemo)(()=>{const e={},t=t=>{const s=e[t];if(!s)throw new Error("Download was not found");return s};return{downloadDialogProps:{downloadHandler:(e,s,n)=>t(e.itemInfo.id).downloadHandler(e,s,n),userGetter:(e,s)=>{const n=t(e).userGetter;return n?n(e,s):void 0},itemDataGetter:(e,s)=>t(e).itemDataGetter(e,s),sessionItem:p},addDownloadItem:(t,s)=>{e[t]=s}}},[]));var p;const{messageNodes:u,visibleItems:b}=(({highlightRemoteMenuId:e,messages:t,chatSession:s},n,i)=>{const r=(0,R.te)(),a=(0,o.useMemo)(()=>new Set,[s]),l=(e,t)=>{t?a.add(e):a.delete(e)};return{messageNodes:(0,o.useMemo)(()=>t?t.reduce(V.bind(null,{highlightRemoteMenuId:e,entity:s,onMessageVisibilityChanged:l,addDownload:n.addDownloadItem,scrollable:i,instanceId:r}),[]):null,[t]),visibleItems:a}})({highlightRemoteMenuId:h,messages:s,chatSession:i},m,c);return(0,l.sg)({messages:s,scrollPositionHandler:d,chatSession:i},b,c),(0,n.jsx)("div",{ref:g,className:r()("message-section",e),role:"article",children:u?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"ui list message-list",children:u}),(0,n.jsx)(D.A,Object.assign({},m.downloadDialogProps))]}):(0,n.jsx)(a.A,{text:(0,B.Tl)("Loading messages",t,$.KV.COMMON)})})},(e,t)=>e.messages===t.messages),ee=Z}}]);
//# sourceMappingURL=381.648720e987fa59ec0e87.chunk.js.map