"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 _chunkMXKYLPQ5js = require('./chunk-MXKYLPQ5.js');var _chunkJFFACKERjs = require('./chunk-JFFACKER.js');var _chunkGGVHDHJ6js = require('./chunk-GGVHDHJ6.js');var _chunkO6JUP3I3js = require('./chunk-O6JUP3I3.js');var _chunk6H7YCGHOjs = require('./chunk-6H7YCGHO.js');var _react = require('react');var _authentication = require('@baseapp-frontend/authentication');var _buttons = require('@baseapp-frontend/design-system/components/web/buttons');var _displays = require('@baseapp-frontend/design-system/components/web/displays');var _icons = require('@baseapp-frontend/design-system/components/web/icons');var _inputs = require('@baseapp-frontend/design-system/components/web/inputs');var _material = require('@mui/material');var _reacthookform = require('react-hook-form');var _reactvirtuoso = require('react-virtuoso');var _jsxruntime = require('react/jsx-runtime');function h(r){"@babel/helpers - typeof";return h=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},h(r)}function N(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);t&&(o=o.filter(function(l){return Object.getOwnPropertyDescriptor(r,l).enumerable})),e.push.apply(e,o)}return e}function g(r){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?N(Object(e),!0).forEach(function(o){Z(r,o,e[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):N(Object(e)).forEach(function(o){Object.defineProperty(r,o,Object.getOwnPropertyDescriptor(e,o))})}return r}function Z(r,t,e){return(t=rr(t))in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function rr(r){var t=tr(r,"string");return h(t)=="symbol"?t:t+""}function tr(r,t){if(h(r)!="object"||!r)return r;var e=r[Symbol.toPrimitive];if(e!==void 0){var o=e.call(r,t||"default");if(h(o)!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(r)}function er(r,t){return ar(r)||ir(r,t)||nr(r,t)||or()}function or(){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 nr(r,t){if(r){if(typeof r=="string")return D(r,t);var e={}.toString.call(r).slice(8,-1);return e==="Object"&&r.constructor&&(e=r.constructor.name),e==="Map"||e==="Set"?Array.from(r):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?D(r,t):void 0}}function D(r,t){(t==null||t>r.length)&&(t=r.length);for(var e=0,o=Array(t);e<t;e++)o[e]=r[e];return o}function ir(r,t){var e=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(e!=null){var o,l,f,m,u=[],s=!0,p=!1;try{if(f=(e=e.call(r)).next,t===0){if(Object(e)!==e)return;s=!1}else for(;!(s=(o=f.call(e)).done)&&(u.push(o.value),u.length!==t);s=!0);}catch(b){p=!0,l=b}finally{try{if(!s&&e.return!=null&&(m=e.return(),Object(m)!==m))return}finally{if(p)throw l}}return u}}function ar(r){if(Array.isArray(r))return r}var vr=function(t){var e=t.allProfilesRef,o=t.ChatRoomListItem,l=o===void 0?_chunkMXKYLPQ5js.a:o,f=t.ChatRoomListItemProps,m=f===void 0?{}:f,u=t.Searchbar,s=u===void 0?_inputs.Searchbar:u,p=t.SearchbarProps,b=p===void 0?{}:p,S=t.VirtuosoProps,V=S===void 0?{}:S,$=t.onChatCreation,k=t.onGroupChatCreationButtonClicked,d=_chunkO6JUP3I3js.b.call(void 0, e),y=d.data.allProfiles,B=d.loadNext,E=d.isLoadingNext,F=d.hasNext,j=d.refetch,G=_react.useTransition.call(void 0, ),L=er(G,2),v=L[0],x=L[1],C=_reacthookform.useForm.call(void 0, {defaultValues:{search:""}}),M=C.control,q=C.reset,H=C.watch,K=_authentication.useCurrentProfile.call(void 0, ),c=K.currentProfile,W=function(a){var P=a.target.value||"";x(function(){j({q:P})})},z=function(){x(function(){q(),j({q:""})})},O=_react.useMemo.call(void 0, function(){return _optionalChain([y, 'optionalAccess', _2 => _2.edges, 'access', _3 => _3.filter, 'call', _4 => _4(function(n){return _optionalChain([n, 'optionalAccess', _5 => _5.node])&&n.node.id!==_optionalChain([c, 'optionalAccess', _6 => _6.id])}), 'access', _7 => _7.map, 'call', _8 => _8(function(n){return _optionalChain([n, 'optionalAccess', _9 => _9.node])})])||[]},[y,_optionalChain([c, 'optionalAccess', _10 => _10.id])]),U=function(){return E?_jsxruntime.jsx.call(void 0, _displays.LoadingState,{sx:{paddingTop:3,paddingBottom:1},CircularProgressProps:{size:15},"aria-label":"loading more profiles"}):_jsxruntime.jsx.call(void 0, _material.Box,{sx:{paddingTop:3}})},J=function(a){return a?_jsxruntime.jsx.call(void 0, l,g({profile:a,onChatCreation:$},m)):null},Q=function(){var a=O.length===0,P=H("search");return!v&&P&&a?_jsxruntime.jsx.call(void 0, _chunk6H7YCGHOjs.a,{}):!v&&a?_jsxruntime.jsx.call(void 0, _chunkGGVHDHJ6js.a,{}):_jsxruntime.jsx.call(void 0, _reactvirtuoso.Virtuoso,g({data:O,itemContent:function(Cr,Y){return J(Y)},style:{scrollbarWidth:"none",maxHeight:"calc(100vh - 72px - 57px - 61px - 72px)"},components:{Footer:U},endReached:function(){F&&B(5)}},V))};return _jsxruntime.jsxs.call(void 0, _chunkJFFACKERjs.a,{children:[_jsxruntime.jsx.call(void 0, _chunkJFFACKERjs.b,{children:_jsxruntime.jsx.call(void 0, s,g({name:"search",onChange:W,onClear:z,control:M,isPending:v},b))}),_jsxruntime.jsx.call(void 0, _buttons.AvatarButton,{onClick:k,caption:"New Group",Icon:_icons.NewGroupIcon}),Q()]})},Vr= exports.a =vr;exports.a = Vr;
//# sourceMappingURL=chunk-77DN3GNG.js.map