"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkXTHAOIOUjs = require('./chunk-XTHAOIOU.js');var _chunkSRMCJWWQjs = require('./chunk-SRMCJWWQ.js');var _chunkP5IH2CSEjs = require('./chunk-P5IH2CSE.js');var _react = require('react');var _authentication = require('@baseapp-frontend/authentication');var _avatars = require('@baseapp-frontend/design-system/components/web/avatars');var _material = require('@mui/material');var _luxon = require('luxon');var _jsxruntime = require('react/jsx-runtime');function m(r){"@babel/helpers - typeof";return m=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(r)}function $(r,e){var i=Object.keys(r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);e&&(o=o.filter(function(v){return Object.getOwnPropertyDescriptor(r,v).enumerable})),i.push.apply(i,o)}return i}function k(r){for(var e=1;e<arguments.length;e++){var i=arguments[e]!=null?arguments[e]:{};e%2?$(Object(i),!0).forEach(function(o){B(r,o,i[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(i)):$(Object(i)).forEach(function(o){Object.defineProperty(r,o,Object.getOwnPropertyDescriptor(i,o))})}return r}function B(r,e,i){return(e=K(e))in r?Object.defineProperty(r,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[e]=i,r}function K(r){var e=H(r,"string");return m(e)=="symbol"?e:e+""}function H(r,e){if(m(r)!="object"||!r)return r;var i=r[Symbol.toPrimitive];if(i!==void 0){var o=i.call(r,e||"default");if(m(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Q=function(e){var i,o,v,t=e.allMessages,O=e.allMessagesLastIndex,n=e.message,p=e.messageIndex,P=e.isGroup,x=P===void 0?!1:P,h=e.MessageItem,G=h===void 0?_chunkXTHAOIOUjs.a:h,j=e.MessageItemProps,A=j===void 0?{}:j,F=_authentication.useCurrentProfile.call(void 0, ),c=F.currentProfile,C=_react.useCallback.call(void 0, function(f){var l,u,s=_optionalChain([t, 'optionalAccess', _2 => _2[f]]),a=_optionalChain([t, 'optionalAccess', _3 => _3[f-1]]),b=(a==null||(l=a.profile)===null||l===void 0?void 0:l.id)!==(s==null||(u=s.profile)===null||u===void 0?void 0:u.id),R=_luxon.DateTime.fromISO(_optionalChain([a, 'optionalAccess', _4 => _4.created])).diff(_luxon.DateTime.fromISO(_optionalChain([s, 'optionalAccess', _5 => _5.created])),"minutes"),U=R.minutes,L=U>_chunkP5IH2CSEjs.a;return b||!a||L?_jsxruntime.jsx.call(void 0, _chunkSRMCJWWQjs.a,{date:_optionalChain([s, 'optionalAccess', _6 => _6.created])}):null},[t]),g=_react.useMemo.call(void 0, function(){var f,l,u=_optionalChain([t, 'optionalAccess', _7 => _7[p]]),s=_optionalChain([t, 'optionalAccess', _8 => _8[p+1]]),a=(s==null||(f=s.profile)===null||f===void 0?void 0:f.id)!==(u==null||(l=u.profile)===null||l===void 0?void 0:l.id),b=O===0;return!!(a||b)},[t,O,p]),S=_optionalChain([c, 'optionalAccess', _9 => _9.id])===(n==null||(i=n.profile)===null||i===void 0?void 0:i.id),y=S?"flex-end":"flex-start",I=g&&!S,N=I&&x;return n?_jsxruntime.jsxs.call(void 0, _material.Box,{sx:{display:"flex",flexDirection:"row",alignSelf:y,width:"100%"},children:[I&&_jsxruntime.jsx.call(void 0, _material.Box,{paddingRight:"12px",children:_jsxruntime.jsx.call(void 0, _avatars.AvatarWithPlaceholder,{className:"self-start justify-self-center",width:32,height:32,src:n==null||(o=n.profile)===null||o===void 0||(o=o.image)===null||o===void 0?void 0:o.url,sx:{border:"none"}})}),_jsxruntime.jsxs.call(void 0, _material.Box,{sx:{display:"flex",ml:g?0:5.5,alignSelf:y,alignItems:y,flexDirection:"column",width:"100%"},children:[N&&_jsxruntime.jsx.call(void 0, _material.Typography,{variant:"subtitle2",color:"text.primary",marginBottom:1/2,children:n==null||(v=n.profile)===null||v===void 0?void 0:v.name}),_jsxruntime.jsx.call(void 0, G,k({messageRef:n,isGroup:x,isFirstGroupedMessage:g},A)),C(p)]})]}):null},ne= exports.a =Q;exports.a = ne;
//# sourceMappingURL=chunk-P4K5PVXL.js.map