"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 _chunkZZK6JKKCjs = require('./chunk-ZZK6JKKC.js');var _chunkWO2EOEJXjs = require('./chunk-WO2EOEJX.js');var _chunkWX62UOE5js = require('./chunk-WX62UOE5.js');var _chunkEVQXPO7Njs = require('./chunk-EVQXPO7N.js');var _chunkYPQ7OPBOjs = require('./chunk-YPQ7OPBO.js');var _react = require('react');var _displays = require('@baseapp-frontend/design-system/components/web/displays');var _inputs = require('@baseapp-frontend/design-system/components/web/inputs');var _material = require('@mui/material');var _reacthookform = require('react-hook-form');var _reactrelay = require('react-relay');var _reactvirtuoso = require('react-virtuoso');var _jsxruntime = require('react/jsx-runtime');function g(e){"@babel/helpers - typeof";return g=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},g(e)}function $(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(u){return Object.getOwnPropertyDescriptor(e,u).enumerable})),t.push.apply(t,n)}return t}function ee(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?$(Object(t),!0).forEach(function(n){re(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):$(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function re(e,r,t){return(r=te(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function te(e){var r=ne(e,"string");return g(r)=="symbol"?r:r+""}function ne(e,r){if(g(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var n=t.call(e,r||"default");if(g(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function oe(e,r){return ue(e)||me(e,r)||ie(e,r)||ae()}function ae(){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 ie(e,r){if(e){if(typeof e=="string")return D(e,r);var t={}.toString.call(e).slice(8,-1);return t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set"?Array.from(e):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?D(e,r):void 0}}function D(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}function me(e,r){var t=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var n,u,d,s,l=[],c=!0,p=!1;try{if(d=(t=t.call(e)).next,r===0){if(Object(t)!==t)return;c=!1}else for(;!(c=(n=d.call(t)).done)&&(l.push(n.value),l.length!==r);c=!0);}catch(h){p=!0,u=h}finally{try{if(!c&&t.return!=null&&(s=t.return(),Object(s)!==s))return}finally{if(p)throw u}}return l}}function ue(e){if(Array.isArray(e))return e}var ye=function(r){var t,n,u=r.userRef,d=r.MemberItem,s=d===void 0?_chunkZZK6JKKCjs.a:d,l=r.MemberItemProps,c=l===void 0?{}:l,p=r.LoadingState,h=p===void 0?_displays.LoadingState:p,j=r.LoadingStateProps,V=j===void 0?{}:j,M=r.membersContainerHeight,k=M===void 0?400:M,K=_react.useTransition.call(void 0, ),C=oe(K,2),w=C[0],L=C[1],S=_reacthookform.useForm.call(void 0, {defaultValues:{search:""}}),I=S.control,Q=S.reset,P=S.watch,v=_reactrelay.usePaginationFragment.call(void 0, _chunkYPQ7OPBOjs.a,u),i=v.data,q=v.loadNext,W=v.hasNext,X=v.isLoadingNext,G=v.refetch,_=_reactrelay.useFragment.call(void 0, _chunkEVQXPO7Njs.a,i),O=function(o){L(function(){G({q:o})})},x=function(){L(function(){Q(),O("")})},f=_react.useMemo.call(void 0, function(){var a;return(i==null||(a=i.members)===null||a===void 0?void 0:a.edges.filter(function(o){return _optionalChain([o, 'optionalAccess', _2 => _2.node])}).map(function(o){return _optionalChain([o, 'optionalAccess', _3 => _3.node])}))||[]},[i==null||(t=i.members)===null||t===void 0?void 0:t.edges]),J=_==null||(n=_.name)===null||n===void 0?void 0:n.includes(P("search")),b=J?f.length+1:f.length,Y=function(){return X?_jsxruntime.jsx.call(void 0, h,ee({sx:{paddingTop:3,paddingBottom:1},CircularProgressProps:{size:15}},V)):_jsxruntime.jsx.call(void 0, _material.Box,{sx:{paddingTop:3}})},Z=function(o,y){return _jsxruntime.jsx.call(void 0, _chunkWO2EOEJXjs.a,{member:o,data:i,prevMember:f[y-1],nextMember:f[y+1],MemberItemComponent:s,memberItemComponentProps:c,searchQuery:P("search")})};return f.length===0?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _inputs.Searchbar,{variant:"outlined",size:"small",isPending:w,onChange:function(o){return O(o.target.value)},onClear:function(){return x()},name:"search",control:I,sx:{mb:4}}),_jsxruntime.jsx.call(void 0, _material.Typography,{variant:"subtitle2",mb:4,children:b===1?"".concat(b," member"):"".concat(b," members")}),_jsxruntime.jsx.call(void 0, s,{member:i,memberRole:"owner",status:_chunkWX62UOE5js.c.active,searchQuery:P("search")})]}):_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _inputs.Searchbar,{variant:"outlined",size:"small",isPending:w,onChange:function(o){return O(o.target.value)},onClear:function(){return x()},name:"search",control:I,sx:{mb:4}}),_jsxruntime.jsx.call(void 0, _material.Typography,{variant:"subtitle2",mb:4,children:b===1?"".concat(b," member"):"".concat(b," members")}),_jsxruntime.jsx.call(void 0, _reactvirtuoso.Virtuoso,{style:{height:k},data:f,itemContent:function(o,y){return y&&Z(y,o)},components:{Footer:Y},endReached:function(){W&&q(_chunkWX62UOE5js.a)}})]})},xe= exports.a =ye;exports.a = xe;
//# sourceMappingURL=chunk-FAIEQNJK.js.map