"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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 _chunkEJEWFBJLjs = require('./chunk-EJEWFBJL.js');var _chunkULH22VZSjs = require('./chunk-ULH22VZS.js');var _chunkFA5TIYY2js = require('./chunk-FA5TIYY2.js');var _chunkUMBEVLFOjs = require('./chunk-UMBEVLFO.js');var _chunkHJWPIWBPjs = require('./chunk-HJWPIWBP.js');var _chunkSNNGCMW6js = require('./chunk-SNNGCMW6.js');var _chunkITKZMK24js = require('./chunk-ITKZMK24.js');var _chunkTBLHKSSUjs = require('./chunk-TBLHKSSU.js');var _chunkMA5VO7M7js = require('./chunk-MA5VO7M7.js');var _chunkOUOR52IRjs = require('./chunk-OUOR52IR.js');var _chunk5QLT6G7Sjs = require('./chunk-5QLT6G7S.js');var _chunkHMJEBZJAjs = require('./chunk-HMJEBZJA.js');var _react = require('react');var _avatars = require('@baseapp-frontend/design-system/components/web/avatars');var _material = require('@mui/material');var _link = require('next/link'); var _link2 = _interopRequireDefault(_link);var _navigation = require('next/navigation');var _reactrelay = require('react-relay');var _jsxruntime = require('react/jsx-runtime');function v(e){"@babel/helpers - typeof";return v=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(e)}var ke=["actions"];function Z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function C(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Z(Object(n),!0).forEach(function(r){Ne(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Z(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ne(e,t,n){return(t=Ue(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ue(e){var t=Le(e,"string");return v(t)=="symbol"?t:t+""}function Le(e,t){if(v(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(v(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Me(e,t){if(e==null)return{};var n,r,a=We(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function We(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function y(e,t){return Qe(e)||He(e,t)||Ke(e,t)||Fe()}function Fe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ke(e,t){if(e){if(typeof e=="string")return ee(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ee(e,t):void 0}}function ee(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function He(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,i,l,p=[],s=!0,b=!1;try{if(i=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(p.push(r.value),p.length!==t);s=!0);}catch(c){b=!0,a=c}finally{try{if(!s&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(b)throw a}}return p}}function Qe(e){if(Array.isArray(e))return e}var re=function(t){var n,r,a,i,l,p=t.comment,s=t.currentThreadDepth,b=t.subscriptionsEnabled,c=t.onReplyClick,oe=t.CommentUpdateProps,ie=t.CommentsRepliesProps,h=t.ActionOverlayProps,R=t.enableDelete,me=R===void 0?!1:R,P=t.Timestamp,ae=P===void 0?_chunk5QLT6G7Sjs.a:P,O=t.CommentUpdate,le=O===void 0?_chunkITKZMK24js.a:O,_=t.CommentReplyButton,se=_===void 0?_chunkUMBEVLFOjs.a:_,j=t.CommentPinnedBadge,ue=j===void 0?_chunkULH22VZSjs.a:j,w=t.CommentReactionButton,ce=w===void 0?_chunkFA5TIYY2js.a:w,D=t.profilePath,pe=D===void 0?"/profile":D,de=_reactrelay.useRefetchableFragment.call(void 0, _chunkTBLHKSSUjs.a,p),S=y(de,2),o=S[0],fe=S[1],ye=_chunkOUOR52IRjs.a.call(void 0, ),ve=ye.setCommentReply,be=_navigation.useRouter.call(void 0, ),T=_react.useRef.call(void 0, null),Ce=_react.useState.call(void 0, !1),I=y(Ce,2),he=I[0],x=I[1],ge=_react.useState.call(void 0, !1),$=y(ge,2),A=$[0],Re=$[1],Pe=_chunkHJWPIWBPjs.a.call(void 0, {comment:o,onEdit:function(){return x(!0)}}),E=_nullishCoalesce(h, () => ({})),B=E.actions,Oe=B===void 0?Pe:B,_e=Me(E,ke),je=_react.useTransition.call(void 0, ),k=y(je,2),N=k[0],we=k[1],De=_chunkOUOR52IRjs.a.call(void 0, ),Se=De.resetCommentReply,Te=_chunkMA5VO7M7js.b.call(void 0, ),U=y(Te,2),Ie=U[0],xe=U[1],L="".concat(pe,"/").concat(o==null||(n=o.user)===null||n===void 0?void 0:n.pk),$e=function(){A||we(function(){fe({isRepliesExpanded:!0},{fetchPolicy:"store-or-network",onComplete:function(M){M?console.error(M):Re(!0)}})})},Ae=function(){var f;_optionalChain([c, 'optionalCall', _2 => _2()]),ve({commentItemRef:T,inReplyToId:o.id,name:(f=o.user)===null||f===void 0?void 0:f.fullName}),$e()},Ee=function(){return he?_jsxruntime.jsx.call(void 0, le,C({comment:o,onCancel:function(){return x(!1)}},oe)):_jsxruntime.jsx.call(void 0, _material.Typography,{variant:"body2",sx:{whiteSpace:"pre-wrap",wordBreak:"normal",overflowWrap:"anywhere"},children:o.body})};if(!o)return null;var Be=function(){Ie({variables:{id:o.id}}),Se()};return _jsxruntime.jsxs.call(void 0, "div",{children:[_jsxruntime.jsx.call(void 0, _chunkSNNGCMW6js.a,{currentThreadDepth:s,children:_jsxruntime.jsx.call(void 0, _chunkHMJEBZJAjs.a,C(C({actions:Oe,showDeleteButton:me&&o.canDelete,handleDeleteItem:Be,isDeletingItem:xe,title:"Comment"},_e),{},{ref:T,children:_jsxruntime.jsxs.call(void 0, _chunkSNNGCMW6js.b,{children:[_jsxruntime.jsx.call(void 0, _avatars.ClickableAvatar,{width:40,height:40,alt:(r=(a=o.user)===null||a===void 0?void 0:a.fullName)!==null&&r!==void 0?r:"Comment's user avatar",src:(i=o.user)===null||i===void 0||(i=i.avatar)===null||i===void 0?void 0:i.url,onClick:function(){return be.push(L)}}),_jsxruntime.jsxs.call(void 0, "div",{className:"grid gap-3",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"grid grid-cols-1 justify-start",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"grid grid-cols-[repeat(2,max-content)] items-center gap-2",children:[_jsxruntime.jsx.call(void 0, _link2.default,{href:L,children:_jsxruntime.jsx.call(void 0, _material.Typography,{variant:"subtitle2",children:(l=o.user)===null||l===void 0?void 0:l.fullName})}),_jsxruntime.jsx.call(void 0, ue,{isPinned:o.isPinned})]}),Ee()]}),_jsxruntime.jsxs.call(void 0, "div",{className:"flex justify-between",children:[_jsxruntime.jsxs.call(void 0, "div",{className:"grid grid-cols-[repeat(2,max-content)] gap-4",children:[_jsxruntime.jsx.call(void 0, ce,{target:o}),_jsxruntime.jsx.call(void 0, se,{onReply:Ae,isLoadingReplies:N,commentId:o.id,totalCommentsCount:o.commentsCount.total})]}),_jsxruntime.jsx.call(void 0, ae,{date:o.created})]})]})]})}))}),A&&!N&&_jsxruntime.jsx.call(void 0, _chunkEJEWFBJLjs.a,C({target:o,currentThreadDepth:s+1,subscriptionsEnabled:b,onReplyClick:c,CommentItem:re},ie),"replies-of-".concat(o.id))]})},ft= exports.a =re;exports.a = ft;
//# sourceMappingURL=chunk-U7WJ43KO.js.map